Home » Archimedes archive » Acorn User » AU 1998-07.adf » Regulars » StarInfo/Thoukydide/CrazySrc

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

� File        : CrazySrc
� Date        : 07-Jun-97
)� 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+� The filename to save the module under
Zfilename$ = "CrazyPoint"
d
n,� Allocate memory to assemble the module
xcode_size% = &2000
�� code% code_size%
�
�� Pointer types
�ptr_unknown = 0
�ptr_single = 1
�ptr_double = 2
�ptr_caret = 3
�ptr_menu = 4
�
�� Pointer colours
�colour_trans = 0
�colour_cyan = &55
�colour_blue = &aa
colour_red = &ff
colour_trans_cyan = &11
colour_trans_blue = &22
"colour_trans_red = &33
,
6� Usage of workspace
@ws_internal = 0
Jws_types = 4
Tws_hpos = 12
^ws_vpos = 16
hws_xeig = 20
rws_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
�*ws_ptr_block_height = ws_ptr_block + 3
�+ws_ptr_block_activex = ws_ptr_block + 4
�+ws_ptr_block_activey = ws_ptr_block + 5
(ws_ptr_block_data = ws_ptr_block + 6
!ws_buffer = ws_ptr_block + 10
ws_buffer_size = 256
&,ws_ptr_data = ws_buffer + ws_buffer_size
0ws_ptr_data_size = 256
:,ws_size = ws_ptr_data + ws_ptr_data_size
D
N� Multi-pass assembly
X� opt% = 12 � 14 � 2
b    P% = 0
l    O% = code%
v    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
�>        EQUD    0                       ; SWI handler code
�@        EQUD    0                       ; SWI decoding table
?        EQUD    0                       ; SWI decoding code

        ; Title string
 ".title  EQUS    "CrazyPointer"
*        EQUB    0
4
>
H        ; Help string
R?.help   EQUS    "Crazy Pointer" + �9 + "1.01 (07 Jun 1997)"
\7        EQUS    " " + �169 + " A.Thoukydides, 1997"
f        EQUB    0
p        ALIGN
z        
�,        ; 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
�        EQUB    0
�        ALIGN
<        EQUD    command_wobble          ; Offset to code
>        EQUD    &00070001               ; Information word
F        EQUD    command_wobble_syntax   ; Offset to syntax message
$A        EQUD    command_wobble_help     ; Offset to help text
.        
8L        EQUB    0                       ; Terminate the list of keywords
B
L/        ; Help for the CrazyPointer keyword
V.command_help
`E        EQUS    "Crazy Pointer provides animated mouse pointers."
jP        EQUS    " Replacements are provided for the standard, double-click,"
t*        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
�K        MOV     r1, r0                  ; Copy the command tail pointer
�K        ADR     r0, command_wobble_def  ; Pointer to keyword definition
F        MOV     r2, r13                 ; Pointer to output buffer

G        MOV     r3, #48                 ; Size of the output buffer
E        SWI     "XOS_ReadArgs"          ; Scan the command string
J        BVS     command_wobble_done     ; Return from handler if error
(I        LDR     r0, [r2], #4            ; Check if wobble is disabled
2F        TEQ     r0, #0                  ; Is wobble being disabled
<T        BNE     command_wobble_disable  ; Disable the pointer wobble if required
FC        LDR     r0, [r2], #4            ; Read friction pointer
PC        TEQ     r0, #0                  ; Was a value specified
ZB        BEQ     command_wobble_spring   ; Skip this bit if not
d;        LDRB    r1, [r0], #1            ; Read the type
nE        TEQ     r1, #0                  ; Is the value an integer
xF        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
�.command_wobble_force
�@        LDR     r0, [r2], #4            ; Read force pointer
C        TEQ     r0, #0                  ; Was a value specified
B        BEQ     command_wobble_done     ; 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
6A        �ldru(1, 0, 3, 4)              ; Read the force value
@C        STR     r1, [r12, #ws_force]    ; Store the force value
J.command_wobble_done
TO        ADD     r13, r13, #48           ; Skip back over the reserved space
^M        LDMFD   r13!, {pc}              ; Return from the command handler
h.command_wobble_disable
rH        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
�0        EQUS    "Invalid command parameters"
�        EQUB    0
�        ALIGN
.command_wobble_def
<        EQUS    "nowobble/s,friction/e,spring/e,force/e"
        EQUB    0
&.command_wobble_help
0I        EQUS    "*CrazyPointerWobble allows the pointer wobble to be"
:=        EQUS    " controlled by setting three constants."
DR        EQUS    " These are all specified on a logarithmic scale in the range"
ND        EQUS    " 0 to 10, with a value of 5 being the default."
X        EQUB    13
b.command_wobble_syntax
l=        EQUS    "Syntax: *CrazyPointerWobble [-nowobble]"
v,        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
�D        MOVVS   r0, r11                 ; Copy any error pointer
�K        BVS     fail_ws                 ; Fail if an error was produced
E        STR     r2, [r12]               ; Store workspace pointer
H        MOV     r12, r2                 ; Copy the workspace pointer
G        MOV     r0, #0                  ; Value to clear flags with
 O        STR     r0, [r12, #ws_internal] ; Clear the internal operation flag
*N        STRB    r0, [r12, #ws_ptr_block]; Reason code to set pointer shape
4N        STRB    r0, [r12, #ws_ptr_block_activex]; Store horizontal hotspot
>L        STRB    r0, [r12, #ws_ptr_block_activey]; Store vertical hotspot
HA        STR     r0, [r12, #ws_filtn]    ; Initially no wibble
RJ        STR     r0, [r12, #ws_filtv]    ; Initially no wibble velocity
\G        MOV     r0, #5                  ; The default configuration
fB        STR     r0, [r12, #ws_friction] ; The default friction
pI        STR     r0, [r12, #ws_spring]   ; The default spring strength
z?        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
�G        MOV     r0, #8                  ; Width of pointer in bytes
�J        STRB    r0, [r12, #ws_ptr_block_width]; Store width of pointer
	I        MOV     r0, #32                 ; Height of pointer in pixels
	L        STRB    r0, [r12, #ws_ptr_block_height]; Store height of pointer
	M        ADD     r0, r12, #ws_ptr_data   ; Pointer to pointer data        
	$L        STR     r0, [r12, #ws_ptr_block_data]; Store pointer to the data
	.R        MOV     r0, #21                 ; Reason code to read pointer position
	8A        ADD     r1, r12, #ws_buffer     ; Pointer to a buffer
	BR        MOV     r2, #6                  ; Reason code to read pointer position
	LI        STRB    r2, [r1]                ; Store reason code in buffer
	VC        SWI     "XOS_Word"              ; Read pointer position
	`D        MOVVS   r0, r11                 ; Copy any error pointer
	jK        BVS     fail_position           ; Fail if an error was produced
	tM        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   r0, r11                 ; Copy any error pointer
	�K        BVS     fail_vdu                ; Fail if an error was produced
	�I        MOV     r0, #&10                ; Number of the EventV vector
L        ADR     r1, eventv_handler      ; Address of the handler routine

N        MOV     r2, r12                 ; Value of r12 used by the handler
D        SWI     "XOS_Claim"             ; Claim the event vector
D        MOVVS   r0, r11                 ; Copy any error pointer
(K        BVS     fail_eventv             ; Fail if an error was produced
2J        MOV     r0, #&1f                ; Number of the SpriteV vector
<L        ADR     r1, spritev_handler     ; Address of the handler routine
FN        MOV     r2, r12                 ; Value of r12 used by the handler
PJ        SWI     "XOS_Claim"             ; Claim the OS_SpriteOp vector
ZD        MOVVS   r0, r11                 ; Copy any error pointer
dK        BVS     fail_spritev            ; Fail if an error was produced
nH        MOV     r0, #&07                ; Number of the WordV vector
xL        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   r0, r11                 ; 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   r0, r11                 ; Copy any error pointer
�K        BVS     fail_vsync              ; Fail if an error was produced
�?        LDMFD   r13!, {r11, pc}         ; Return to RISC OS
�
�        ; Finalisation code
�.finalisation
=        STMFD   r13!, {r11, r14}        ; Stack registers
F        LDR     r12, [r12]              ; Obtain workspace pointer
E        MOV     r11, #0                 ; Clear the error pointer
"N        MOV     r0, #13                 ; OS_Byte code to disable an event
,D        MOV     r1, #4                  ; The vsync event number
6M        SWI     "XOS_Byte"              ; Disable the vertical sync event
@K        BVS     exit                    ; Exit if an error was produced
J.fail_vsync
TH        MOV     r0, #&07                ; Number of the WordV vector
^L        ADR     r1, wordv_handler       ; Address of the handler routine
hN        MOV     r2, r12                 ; Value of r12 used by the handler
rH        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
�I        MOV     r0, #&10                ; Number of the EventV vector
�L        ADR     r1, eventv_handler      ; Address of the handler routine
�N        MOV     r2, r12                 ; Value of r12 used by the handler
�F        SWI     "XOS_Release"           ; Release the event vector
�K        BVS     exit                    ; Exit if an error was produced
�.fail_eventv

.fail_vdu
.fail_position
K        MOV     r0, #7                  ; Reason code to release memory
&H        MOV     r2, r12                 ; Copy the workspace pointer
0C        SWI     "XOS_Module"            ; Release the workspace
:K        BVS     exit                    ; Exit if an error was produced
D.fail_ws
NG        TEQ     r11, #0                 ; Is there an error pointer
XG        BEQ     exit                    ; Exit without error if not
bD        MOV     r0, r11                 ; Copy the error pointer
lC        CMP     pc, #&80000000          ; Set the overflow flag
v?.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
�D        BL      read_vdu                ; Read the pixel scaling

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



%        ; Read the pixel scalings

 
.read_vdu

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

4M        MVN     r0, #0                  ; Read variables for current mode

>L        MOV     r1, #4                  ; Variable number for XEigFactor

HG        SWI     "XOS_ReadModeVariable"  ; Read the XEigFactor value

RG        MOV     r3, r2                  ; Copy the XEigFactor value

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

fG        SWI     "XOS_ReadModeVariable"  ; Read the YEigFactor value

pO        MOV     r0, #0                  ; Initialise the common eigen value

z.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

�
$        ; EventV handler routine
.eventv_handler
=        STMFD   r13!, {r8-r9, r14}      ; Stack registers
$N        MOV     r9, pc                  ; Save the current status and mode
.H        �R     r8, r9, #3              ; Derive the SVC-mode version
8<        TEQP    r8, #0                  ; Enter SVC mode
BJ        MOV     r0, r0                  ; Allow the processor to adapt
L:        STMFD   r13!, {r14}             ; Save r14_svc
VF        BL      update                  ; Update the pointer shape
`=        LDMFD   r13!, {r14}             ; Restore r14_svc
jQ        TEQP    r9, #0                  ; Reenter the original processor mode
tP        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
�I        ADDEQ   r2, r2, #4              ; Advance pointer to the name
Q        ADR     r8, pointers_start      ; Pointer to the first reference name

.spritev_handler_loop
L        MOV     r9, #0                  ; Check from the first character
.spritev_handler_char
(I        LDRB    r10, [r2, r9]           ; Read pointer name character
2K        LDRB    r11, [r8, r9]           ; Read reference name character
<L        TEQ     r11, #0                 ; Is it the end of the reference
FE        BEQ     spritev_handler_found   ; Complete match if it is
PE        TEQ     r10, r11                ; Do the characters match
ZO        BNE     spritev_handler_next    ; Skip to the next reference if not
dK        ADD     r9, r9, #1              ; Advance to the next character
nQ        TEQ     r9, #12                 ; Maximum length is twelve characters
xO        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
�L        �RNE   r3, r3, #&10            ; Clear the shape definition flag
.spritev_handler_done
M        LDMFD   r13!, {r2, r8-r11, pc}^ ; Pass on to the original routine
.spritev_handler_found
"D        LDR     r2, [r8, #12]           ; Read the pointer index
,>        B       spritev_handler_checked ; Handle the match
6
@!        ; Known pointer names
J.pointers_start
T/        �pointer("ptr_default", ptr_single)
^.        �pointer("ptr_double", ptr_double)
h,        �pointer("ptr_write", ptr_caret)
r,        �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
�D        LDR     r0, [r12, #ws_internal] ; Read the internal flag
�I        TEQ     r0, #0                  ; Is it an internal operation
H        BNE     wordv_handler_done      ; Skip the next bit if it is
C        LDRB    r0, [r1, #1]            ; Read the shape number
D        ADD     r0, r0, #ws_types       ; Offset to type details
&N        MOV     r1, #ptr_unknown        ; Code for an unknown pointer type
0N        STRB    r1, [r12, r0]           ; Set this pointer type to unknown
:.wordv_handler_done
D>        LDMFD   r13!, {r0-r1, pc}^      ; Pass on the call
N
X3        ; Update the shape of the mouse pointer
b=.update STMFD   r13!, {r0-r5, r14}      ; Stack registers
lO        MOV     r0, #106                ; Reason code to read pointer shape
vP        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
�Q        BVS     update_done             ; No update pointer if error produced
E        MOV     r0, r3                  ; Copy pointer shape type
M        LDRB    r4, [r1, #1]            ; Read LSB of horizontal position
M        LDRB    r5, [r1, #2]            ; Read MSB of horizontal position
 H        �R     r4, r4, r5, ASL#8       ; Combine horizontal position
*N        MOV     r4, r4, ASL#16          ; Scale the horizontal position up
4O        LDR     r5, [r12, #ws_hpos]     ; Read previous horizontal position
>K        SUB     r2, r4, r5              ; Calculate horizontal movement
HL        MOV     r2, r2, ASR#1           ; Reduce the horizontal position
RP        ADD     r4, r5, r2              ; And modify the last known position
\K        LDRB    r3, [r1, #3]            ; Read LSB of vertical position
fK        LDRB    r5, [r1, #4]            ; Read MSB of vertical position
pF        �R     r3, r3, r5, ASL#8       ; Combine vertical position
zL        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
�K        MOV     r2, r2, ASR r3          ; Scale the horizontal movement
N        ADR     r14, update_plot        ; Return address to update pointer
J        ADD     pc, pc, r0, LSL#2       ; Jump to the relevant routine
P        MOV     r0, r0                  ; This instruction is never executed
$@        B       update_done             ; Shape 0 is unknown
.I        B       update_single           ; Shape 1 is a single pointer
8O        B       update_double           ; Shape 2 is a double click pointer
BQ        B       update_write            ; Shape 3 is a caret or writable icon
LJ        B       update_menu             ; Shape 4 is a popup menu icon
V.update_plot
`N        MOV     r0, #21                 ; Reason code to set pointer shape
jH        ADD     r1, r12, #ws_ptr_block  ; Pointer to parameter block
tC        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
�=        STMFD   r13!, {r0, r3-r8, r14}  ; Stack registers
N        LDR     r5, [r12, #ws_cogr]     ; Read previous row pointer centre

Q        LDR     r6, [r12, #ws_cogc]     ; Read previous column pointer centre
K        MOV     r7, #0                  ; Start by assuming no movement
E        TEQ     r1, #0                  ; Is there any row motion
(H        TEQEQ   r2, #0                  ; Is there any column motion
2N        BEQ     update_standard_still   ; Do not change direction if still
<J        ADD     r5, r5, r1              ; Calculate the new row offset
FM        ADD     r6, r6, r2              ; Calculate the new column offset
PF        MOV     r0, r5, ASR#8           ; Scale the new row offset
ZG        MUL     r1, r0, r0              ; Square the new row offset
dI        MOV     r0, r6, ASR#8           ; Scale the new column offset
nJ        MUL     r2, r0, r0              ; Square the new column offset
x=        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
�N        MOV     r0, r7, ASR#3           ; Copy and scale the length offset
G        BL      update_filter           ; Update the pointer wibble
M        ADD     r0, r0, r0, ASL#2       ; Multiply the length offset by 5
E        MOV     r7, #11<<16             ; The nominal tail length
"O        ADD     r7, r7, r0              ; Add the wibble to the tail length
,T        MOV     r0, #7                  ; Number of coordinates in pointer shape
6I        ADR     r1, update_standard_basic; Pointer to the basic shape
@P        ADR     r2, update_standard_length; Pointer to the length adjustment
JK        MOV     r3, r7                  ; Copy the required head length
TO        ADD     r4, r12, #ws_buffer     ; Pointer to the destination buffer
^J        BL      trans_add               ; Set the required head length
hR        MOV     r1, r4                  ; New source buffer is previous output
rN        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
�M        BL      divide                  ; Calculate the head width offset
�H        MOV     r3, r0                  ; Copy the head width offset
?        LDMFD   r13!, {r0-r1}           ; Restore registers
N        BL      trans_add               ; Set the width of the header base
R        MOV     r2, r1                  ; Destination coordinates are the same
&O        MOV     r3, r5                  ; Row component of desired vertical
0R        MOV     r4, r6                  ; Column component of desired vertical
:L        BL      trans_rotate            ; Rotate the pointer as required
DS        BL      trans_fit               ; Scale the coordinates for the pointer
NG        MOV     r1, r0                  ; Copy the number of points
XD        LDMFD   r13!, {r0, r3-r8, pc}   ; Return from subroutine
bE.update_standard_basic                  ; The basic pointer shape
l        �coordinate(0, 0)
v        �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)
�        �coordinate(1, 0)
N.update_standard_tail                   ; Offsets to change the tail width
        �coordinate(0, 0)
        �coordinate(0, 0)
         �coordinate(0, 0)
*        �coordinate(0, 0.5)
4         �coordinate(0, -0.5)
>        �coordinate(0, 0)
H        �coordinate(0, 0)
RN.update_standard_head                   ; Offsets to change the head width
\        �coordinate(0, 0)
f        �coordinate(0, 0.5)
p        �coordinate(0, 0)
z        �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
�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

$L        ; Plot a double click pointer type r0 that has moved by (r2, r1)
..update_double
8=        STMFD   r13!, {r0-r2, r14}      ; Stack registers
BI        BL      update_standard         ; Construct the pointer shape
LG        MOV     r0, #colour_trans       ; Background is transparent
VI        BL      plot_fill               ; Clear the pointer initially
`Q        MOV     r0, #colour_trans_blue  ; Fill interior with transparent blue
jF        BL      plot_poly_fill          ; Plot the filled interior
tI        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
�K        ADD     r4, r12, #ws_buffer     ; Pointer to destination buffer
I        BL      trans_add               ; Add the motion to the shape

A        MOV     r1, r4                  ; Copy buffer pointer
Q        MOV     r2, r1                  ; Use the same buffer for the results
S        BL      trans_fit               ; Scale the coordinates for the pointer
(G        MOV     r1, r0                  ; Copy the number of points
2G        MOV     r0, #colour_trans       ; Background is transparent
<I        BL      plot_fill               ; Clear the pointer initially
FK        MOV     r0, #colour_blue        ; Fill interior with solid blue
PF        BL      plot_poly_fill          ; Plot the filled interior
ZI        MOV     r0, #colour_cyan        ; Outline the pointer in cyan
dF        BL      plot_poly_line          ; Plot the pointer outline
nD        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
xE.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)
�        �coordinate(9, 2)
        �coordinate(7, 0)
        �coordinate(9, -2)
        �coordinate(9, -4)
"        �coordinate(7, -4)
,        �coordinate(6, -1)
6        �coordinate(2, -1)
@        �coordinate(-2, -1)
J        �coordinate(-7, -1)
T        �coordinate(-8, -4)
^M.update_write_horizontal                ; Offsets to distort horizontally
h         �coordinate(0.6, -1)
r"        �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)
�#        �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)
0#        �coordinate(0.15, -0.5)
:         �coordinate(0.6, -1)
D
ND        ; Plot a menu pointer type r0 that has moved by (r2, r1)
X.update_menu
b=        STMFD   r13!, {r0-r4, r14}      ; Stack registers
lI        LDR     r3, [r12, #ws_cogr]     ; Read previous row direction
vL        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
�J        ADR     r1, update_menu_frame   ; Pointer to source cordinates
K        ADD     r2, r12, #ws_buffer     ; Pointer to destination buffer
S        BL      trans_fit               ; Scale the coordinates for the pointer
K        ADD     r2, r2, r0, LSL#3       ; Pointer to destination buffer
 O        MOV     r0, #9                  ; Number of points in pointer shape
*K        ADR     r1, update_menu_ptr     ; Pointer to source coordinates
>L        BL      trans_rotate            ; Rotate the pointer as required
HR        MOV     r1, r2                  ; Source buffer is same as destination
RS        BL      trans_fit               ; Scale the coordinates for the pointer
fG        MOV     r0, #colour_trans       ; Background is transparent
pK        ADD     r2, r12, #ws_buffer     ; Pointer to coordinates buffer
zI        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
D        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
K.update_menu_frame                      ; The outside frame of the menu
$        �coordinate(-3, 0)
.        �coordinate(-3, 16)
8        �coordinate(20, 16)
B        �coordinate(20, 0)
LF.update_menu_entries                    ; The interior of the menu
V        �coordinate(0.5, 1)
`         �coordinate(0.5, 14)
j!        �coordinate(18.5, 14)
t         �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
�C        LDR     r1, [r12, #ws_filtn]    ; Get previous position
C        LDR     r2, [r12, #ws_filtv]    ; Get previous velocity

D        LDR     r3, [r12, #ws_friction] ; The amount of friction
F        RSB     r3, r3, #10             ; Convert to a shift value
A        SUB     r2, r2, r2, ASR r3      ; Apply some friction
(A        LDR     r3, [r12, #ws_spring]   ; The spring constant
2F        RSB     r3, r3, #11             ; Convert to a shift value
<K        SUB     r2, r2, r1, ASR r3      ; Include the restorative force
FR        ADD     r1, r1, r2              ; Add part of velocity to the position
PB        LDR     r3, [r12, #ws_force]    ; The force multiplier
ZF        RSBS    r3, r3, #13             ; Convert to a shift value
dJ        MOVMI   r0, #0                  ; No wibble if result negative
nA        MOV     r0, r0, ASR r3          ; Scale the new input
x?        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
�F        CMP     r1, #1<<8               ; Minimum visible position
S        MOVLT   r2, r2, ASR#1           ; Increase friction when small movement
D        STR     r0, [r12, #ws_filtn]    ; Store the new position
D        STR     r2, [r12, #ws_filtv]    ; Store the new velocity
".update_filter_done
,D        LDMFD   r13!, {r1-r3, pc}       ; Return from subroutine
6
@8        ; Fill the pointer image data with colour r0
J.plot_fill
T=        STMFD   r13!, {r0-r2, r14}      ; Stack registers
^N        BL      colour_expand           ; Expand the colour to fill a word
hI        ADD     r1, r12, #ws_ptr_data   ; Start of pointer image data
rE        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
�G        ADD     r2, r2, r4              ; Set the horizontal origin
�G        ADD     r3, r3, r4              ; Set the horizontal origin
 K        LDRB    r4, [r12, #ws_ptr_block_activey]; Read vertical hotspot
 E        ADD     r1, r1, r4              ; Set the vertical origin
 O        CMP     r2, r3                  ; Place limits in the correct order
 &C        MOVGT   r4, r2                  ; Make a temporary copy
 0=        MOVGT   r2, r3                  ; Swap the limits
 :K        MOVGT   r3, r4                  ; Copy the temporary value back
 DC        CMP     r1, #0                  ; Check lower row limit
 NM        BLT     plot_row_done           ; No plotting if before first row
 XC        CMP     r1, #31                 ; Check upper row limit
 bK        BGT     plot_row_done           ; No plotting if after last row
 lN        BL      colour_expand           ; Expand the colour to fill a word
 vG        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
 �D        LDMFD   r13!, {r0-r4, pc}       ; Return from subroutine
!.plot_row_word
!=        STMFD   r13!, {r2-r4, r14}      ; Stack registers
!E        CMP     r2, #0                  ; Range check lower limit
! D        MOVLT   r2, #0                  ; Start from first pixel
!*E        CMP     r3, #15                 ; Range check upper limit
!4C        MOVGT   r3, #15                 ; End at the last pixel
!>M        SUB     r3, r3, r2              ; Difference between the two ends
!HI        ADD     r3, r3, #1              ; Convert to number of pixels
!RG        MOV     r4, r2, ASL#1           ; Convert start to rotation
!\E        MOV     r2, #3                  ; Mask for a single pixel
!fO        MOV     r2, r2, LSL r4          ; Mask for the first pixel position
!pE        MOV     r4, #0                  ; No pixels set initially
!z.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)
!�.plot_point
"=        STMFD   r13!, {r0-r3, r14}      ; Stack registers
"M        LDRB    r3, [r12, #ws_ptr_block_activex]; Read horizontal hotspot
"G        ADD     r2, r2, r3              ; Set the horizontal origin
"$K        LDRB    r3, [r12, #ws_ptr_block_activey]; Read vertical hotspot
".E        ADD     r1, r1, r3              ; Set the vertical origin
"8C        CMP     r1, #0                  ; Check lower row limit
"BF        CMPGE   r2, #0                  ; Check lower column limit
"LP        BLT     plot_point_done         ; No plotting if below visible range
"VC        CMP     r1, #31                 ; Check upper row limit
"`F        CMPLE   r2, #31                 ; Check upper column limit
"jP        BGT     plot_point_done         ; No plotting if above visible range
"tN        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
"�G        BIC     r2, r2, r3              ; Clear the pixel to be set
#D        �R     r2, r2, r0              ; Set the required colour
#
E        STR     r2, [r1]                ; Strore the updated word
#.plot_point_done
#D        LDMFD   r13!, {r0-r3, pc}       ; Return from subroutine
#(
#2I        ; Plot a midpoint line in colour r0 from (r2, r1) to (r4, r3)
#<.plot_line
#F=        STMFD   r13!, {r0-r7, r14}      ; Stack registers
#PL        MOV     r5, #0                  ; Start with default coordinates
#ZB        SUBS    r1, r1, r3              ; Change in row number
#dL        RSBMI   r3, r3, #0              ; Reflect start point vertically
#nJ        RSBMI   r1, r1, #0              ; Reflect change in row number
#xA        �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
#�G        ADD     r6, r2, r2              ; Horizontal step increment
$M        SUB     r7, r6, r1              ; Initial decision variable value
$M        SUB     r2, r2, r1              ; Half of diagonal step increment
$E        ADD     r2, r2, r2              ; Diagonal step increment
$"E        ADD     r1, r3, r1              ; The last point to plot 
$,.plot_line_loop
$6N        BL      plot_line_point         ; Plot the first point of the line
$@H        CMP     r3, r1                  ; Has the line been finished
$JR        LDMGEFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
$TI        CMP     r7, #0                  ; Check the decision variable
$^I        ADDLE   r7, r7, r6              ; Increment decision variable
$hI        ADDGT   r7, r7, r2              ; Increment decision variable
$rG        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
$�G        RSBNE   r2, r2, #0              ; Negate column if required
$�<        BL      plot_point              ; Plot the point
%D        LDMFD   r13!, {r1-r2, pc}       ; Return from subroutine
%
%R        ; Plot a closed polyline in colour r0 using r1 vertices starting at r2
%&.plot_poly_line
%0=        STMFD   r13!, {r0-r7, r14}      ; Stack registers
%:K        MOV     r5, r2                  ; Pointer to the current vertex
%DP        MOV     r6, r2                  ; Keep a pointer to the first vertex
%NE        MOV     r7, r1                  ; Copy number of segments
%X.plot_poly_line_loop
%bJ        SUBS    r7, r7, #1              ; Decrement remaining segments
%lR        LDMMIFD r13!, {r0-r7, pc}       ; Return from subroutine when finished
%vI        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
%�I        BL      plot_poly_fill_preprocess; Construct the edge details
&.plot_poly_fill_loop
&H        MOV     r2, #0                  ; No intersections found yet
&I        BL      plot_poly_fill_inter    ; Find any intersecting edges
& B        BL      plot_poly_fill_plot     ; Perform the plotting
&*E        ADD     r5, r5, #1              ; Advance to the next row
&4K        CMP     r5, r6                  ; Has the last row been reached
&>E        BLE     plot_poly_fill_loop     ; Loop until all finished
&H.plot_poly_fill_done
&RM        ADD     r13, r13, r1, LSL#2     ; Release the intersections space
&\L        ADD     r13, r13, r1, LSL#4     ; Release the edge details space
&fD        LDMFD   r13!, {r0-r6, pc}       ; Return from subroutine
&p.plot_poly_fill_preprocess
&z?        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
&�@        MOVGT   r9, r4                  ; Set end row number
'L        MOVGT   r4, r8                  ; Copy first column to temporary
'A        MOVGT   r8, r10                 ; Swap column numbers
'C        MOVGT   r10, r4                 ; Set end column number
'$D        CMP     r7, r5                  ; Compare with first row
'.Q        MOVLT   r5, r7                  ; Update first row number is required
'8C        CMP     r9, r6                  ; Compare with last row
'BP        MOVGT   r6, r9                  ; Update last row number is required
'L@        MOV     r8, r8, ASL#16          ; Scale start column
'V>        MOV     r10, r10, ASL#16        ; Scale end column
'`D        STR     r7, [r3]                ; Store start row number
'jB        STR     r9, [r3, #4]            ; Store end row number
'tG        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
'�G        SUBS    r1, r1, #1              ; Decrement number of edges
(R        LDMMIFD r13!, {r0-r1, r3-r9, pc}; Return from subroutine when finished
(
L        LDMIA   r3!, {r6-r9}            ; Read the details for this edge
(G        CMP     r6, r5                  ; Is start row early enough
(H        BGT     plot_poly_fill_inter_loop; Loop for next edge if not
((D        CMP     r7, r5                  ; Is end row late enough
(2H        BLE     plot_poly_fill_inter_loop; Loop for next edge if not
(<O        SUB     r6, r5, r6              ; Number of rows from start of edge
(FH        MLA     r8, r6, r9, r8          ; Calculate intercept column
(PH        MOV     r0, r8, ASR#16          ; Scale the intercept column
(ZS        ADD     r6, r4, r2, LSL#2       ; The next available intersection entry
(d .plot_poly_fill_inter_insert
(nK        TEQ     r4, r6                  ; Is this the start of the list
(xM        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
(�.plot_poly_fill_plot_loop
)E        SUBS    r5, r5, #1              ; Decrement segment count
)D        LDMMIFD r13!, {r1-r5, pc}       ; Return from subroutine
)B        LDMIA   r4!, {r2-r3}            ; Read segment details
)"H        ADD     r2, r2, #1              ; Advance the start position
),D        CMP     r2, r3                  ; Is the segment visible
)6J        BLLE    plot_row                ; Plot this segment if visible
)@G        B       plot_poly_fill_plot_loop; Loop for the next segment
)J
)TF        ; Expand a single byte colour description into a full word
)^.colour_expand
)h>        �R     r0, r0, r0, LSL#8       ; Expand to 16 bits
)r>        �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
)�.divide_unsigned_double
)�@        MOVLS   r3, r3, LSL#1           ; Double the divisor
*T        CMPLS   r3, r0, LSR#1           ; Is divisor larger than double dividend
*L        BLS     divide_unsigned_double  ; Loop again if not large enough
*@        MOV     r2, #0                  ; Clear the quotient
*&.divide_unsigned_loop
*0K        CMP     r0, r3                  ; Can the divisor be subtracted
*:J        SUBCS   r0, r0, r3              ; Subtract divisor if possible
*DQ        ADC     r2, r2, r2              ; Double quotient and add the new bit
*N?        MOV     r3, r3, LSR#1           ; Halve the divisor
*XT        CMP     r3, r1                  ; Has the original divisor been exceeded
*b@        BCS     divide_unsigned_loop    ; Loop if it has not
*l=        MOV     r0, r2                  ; Copy the result
*vD        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
*�H        BNE     sqrt_loop               ; Loop until all bits tested
+D        LDMFD   r13!, {r1-r4, pc}       ; Return from subroutine
+
+F        ; Normalise a vector (r0, r1) to have a magnitude of 1<<16
+ .normalise
+*=        STMFD   r13!, {r2-r5, r14}      ; Stack registers
+4H        TEQ     r0, #0                  ; Check horizontal component
+>F        TEQEQ   r1, #0                  ; Check vertical component
+HN        BEQ     normalise_done          ; Unable to normalise zero vectors
+RK        MOVS    r2, r0                  ; Copy the horizontal component
+\B        RSBMI   r0, r0, #0              ; Keep a positive copy
+fI        MOVS    r3, r1                  ; Copy the vertical component
+pB        RSBMI   r1, r1, #0              ; Keep a positive copy
+z.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
+�K        MUL     r1, r5, r5              ; Square the vertical component
,L        ADD     r0, r0, r1              ; Sum the squares of the lengths
,P        BL      sqrt                    ; Calculate the length of the vector
,@        TEQ     r0, #0                  ; Is the length zero
,$A        �Q   r0, #1                  ; Force a minimum length
,.F        MOV     r1, r0                  ; Copy length to divide by
,8I        MOV     r0, r3                  ; Copy the vertical component
,BJ        BL      divide                  ; Scale the vertical component
,LQ        MOV     r3, r0                  ; Store the scaled vertical component
,VK        MOV     r0, r2                  ; Copy the horizontal component
,`L        BL      divide                  ; Scale the horizontal component
,jS        MOV     r1, r3                  ; Restore the scaled vertical component
,t.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
,�M        SUBS    r0, r0, #1              ; Decrement number of coordinates
-Q        BMI     trans_fit_hotspot       ; Exit loop when all coordinates done
-
K        LDMIA   r1!, {r7-r8}            ; Read the next coordinate pair
-I        ADD     r7, r7, #1<<15          ; Improve horizontal rounding
-A        MOV     r7, r7, ASR#16          ; Scale column number
-(G        MOV     r7, r7, ASR r9          ; Scale by eigen value also
-2I        ADD     r8, r8, #1<<15          ; Improve horizontal rounding
-<A        MOV     r8, r8, ASR#16          ; Scale column number
-FG        MOV     r8, r8, ASR r10         ; Scale by eigen value also
-PO        STMIA   r2!, {r7-r8}            ; Write the transformed coordinates
-ZF        CMP     r7, r3                  ; Compare with minimum row
-dL        MOVLT   r3, r7                  ; Update minimum row if required
-nF        CMP     r7, r4                  ; Compare with maximum row
-xL        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
-�L        SUBMI   r0, r0, r7              ; Force first row within pointer
.K        CMP     r0, #0                  ; Is hotspot within the pointer
.F        MOVLT   r0, #0                  ; Hotspot must be positive
.K        CMP     r0, #31                 ; Is hotspot within the pointer
."P        MOVGT   r0, #31                 ; Restrict hotspot to within pointer
.,H        ADD     r8, r6, r1              ; Calculate last used column
.6Q        RSBS    r8, r8, #31             ; Number of spare pixels at the right
.@N        ADDMI   r1, r1, r8              ; Force last column within pointer
.JI        ADDS    r8, r5, r1              ; Calculate first used column
.TO        SUBMI   r1, r1, r8              ; Force first column within pointer
.^K        CMP     r1, #0                  ; Is hotspot within the pointer
.hF        MOVLT   r1, #0                  ; Hotspot must be positive
.rK        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
.�K        BL      normalise               ; Normalise the vertical vector
.�K        MOV     r3, r0, ASR#8           ; Copy and scale normalised row
/N        MOV     r4, r1, ASR#8           ; Copy and scale normalised column
/?        LDMFD   r13!, {r0-r1}           ; Restore registers
/.trans_rotate_loop
/&M        SUBS    r0, r0, #1              ; Decrement number of coordinates
/0R        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
/:K        LDMIA   r1!, {r5-r6}            ; Read the next coordinate pair
/DE        MOV     r5, r5, ASR#8           ; Prescale the row number
/NH        MOV     r6, r6, ASR#8           ; Prescale the column number
/X?        MUL     r7, r5, r3              ; Rotate row to row
/bJ        RSB     r7, r7, #0              ; Correct sign of row rotation
/lB        MUL     r8, r5, r4              ; Rotate row to column
/vB        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
/�=        STMFD   r13!, {r0-r8, r14}      ; Stack registers
/�L        MOV     r3, r3, ASR#8           ; Prescale the required fraction
/�.trans_add_loop
/�M        SUBS    r0, r0, #1              ; Decrement number of coordinates
/�R        LDMMIFD r13!, {r0-r8, pc}       ; Return from subroutine when finished
/�K        LDMIA   r1!, {r5-r6}            ; Read the original coordinates
0F        LDMIA   r2!, {r7-r8}            ; Read the new coordinates
0I        MOV     r7, r7, ASR#8           ; Prescale the new row number
0L        MOV     r8, r8, ASR#8           ; Prescale the new column number
0 K        MLA     r5, r7, r3, r5          ; Add the required row fraction
0*N        MLA     r6, r8, r3, r6          ; Add the required column fraction
04K        STMIA   r4!, {r5-r6}            ; Write the updated coordinates
0>N        B       trans_add_loop          ; Keep looping until all processed
0H
0R	    ]
0\�
0f
0p� Save the resulting module
0z9È™ "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%
0�	    ]
0�= 0
0�
0�)� Literal fixed point coordinate pair
0�ݤcoordinate(row, column)
0�    [OPT opt%
1&        EQUD    �(row * (1 << 16))
1)        EQUD    �(column * (1 << 16))
1	    ]
1$= 0
1.
18,� Read a word from a non-aligned address
1Bݤldru(rd, ra, rb, rc)
1L    [OPT opt%
1VG        BIC     rb, ra, #3              ; Get word aligned address 
1`K        LDMIA   rb, {rd, rc}            ; Get 64 bits containing answer
1jF        �     rb, ra, #3              ; Correction factor in bytes
1tN        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  30 37 2d 4a 75 6e 2d 39  37 0d 00 1e 29 f4 20 41  |07-Jun-97...). 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 2b f4 20  | 1997...F...P+. |
00000130  54 68 65 20 66 69 6c 65  6e 61 6d 65 20 74 6f 20  |The filename to |
00000140  73 61 76 65 20 74 68 65  20 6d 6f 64 75 6c 65 20  |save the module |
00000150  75 6e 64 65 72 0d 00 5a  1c 66 69 6c 65 6e 61 6d  |under..Z.filenam|
00000160  65 24 20 3d 20 22 43 72  61 7a 79 50 6f 69 6e 74  |e$ = "CrazyPoint|
00000170  22 0d 00 64 04 0d 00 6e  2c f4 20 41 6c 6c 6f 63  |"..d...n,. Alloc|
00000180  61 74 65 20 6d 65 6d 6f  72 79 20 74 6f 20 61 73  |ate memory to as|
00000190  73 65 6d 62 6c 65 20 74  68 65 20 6d 6f 64 75 6c  |semble the modul|
000001a0  65 0d 00 78 16 63 6f 64  65 5f 73 69 7a 65 25 20  |e..x.code_size% |
000001b0  3d 20 26 32 30 30 30 0d  00 82 16 de 20 63 6f 64  |= &2000..... cod|
000001c0  65 25 20 63 6f 64 65 5f  73 69 7a 65 25 0d 00 8c  |e% code_size%...|
000001d0  04 0d 00 96 13 f4 20 50  6f 69 6e 74 65 72 20 74  |...... Pointer t|
000001e0  79 70 65 73 0d 00 a0 13  70 74 72 5f 75 6e 6b 6e  |ypes....ptr_unkn|
000001f0  6f 77 6e 20 3d 20 30 0d  00 aa 12 70 74 72 5f 73  |own = 0....ptr_s|
00000200  69 6e 67 6c 65 20 3d 20  31 0d 00 b4 12 70 74 72  |ingle = 1....ptr|
00000210  5f 64 6f 75 62 6c 65 20  3d 20 32 0d 00 be 11 70  |_double = 2....p|
00000220  74 72 5f 63 61 72 65 74  20 3d 20 33 0d 00 c8 10  |tr_caret = 3....|
00000230  70 74 72 5f 6d 65 6e 75  20 3d 20 34 0d 00 d2 04  |ptr_menu = 4....|
00000240  0d 00 dc 15 f4 20 50 6f  69 6e 74 65 72 20 63 6f  |..... Pointer co|
00000250  6c 6f 75 72 73 0d 00 e6  14 63 6f 6c 6f 75 72 5f  |lours....colour_|
00000260  74 72 61 6e 73 20 3d 20  30 0d 00 f0 15 63 6f 6c  |trans = 0....col|
00000270  6f 75 72 5f 63 79 61 6e  20 3d 20 26 35 35 0d 00  |our_cyan = &55..|
00000280  fa 15 63 6f 6c 6f 75 72  5f 62 6c 75 65 20 3d 20  |..colour_blue = |
00000290  26 61 61 0d 01 04 14 63  6f 6c 6f 75 72 5f 72 65  |&aa....colour_re|
000002a0  64 20 3d 20 26 66 66 0d  01 0e 1b 63 6f 6c 6f 75  |d = &ff....colou|
000002b0  72 5f 74 72 61 6e 73 5f  63 79 61 6e 20 3d 20 26  |r_trans_cyan = &|
000002c0  31 31 0d 01 18 1b 63 6f  6c 6f 75 72 5f 74 72 61  |11....colour_tra|
000002d0  6e 73 5f 62 6c 75 65 20  3d 20 26 32 32 0d 01 22  |ns_blue = &22.."|
000002e0  1a 63 6f 6c 6f 75 72 5f  74 72 61 6e 73 5f 72 65  |.colour_trans_re|
000002f0  64 20 3d 20 26 33 33 0d  01 2c 04 0d 01 36 18 f4  |d = &33..,...6..|
00000300  20 55 73 61 67 65 20 6f  66 20 77 6f 72 6b 73 70  | Usage of worksp|
00000310  61 63 65 0d 01 40 13 77  73 5f 69 6e 74 65 72 6e  |ace..@.ws_intern|
00000320  61 6c 20 3d 20 30 0d 01  4a 10 77 73 5f 74 79 70  |al = 0..J.ws_typ|
00000330  65 73 20 3d 20 34 0d 01  54 10 77 73 5f 68 70 6f  |es = 4..T.ws_hpo|
00000340  73 20 3d 20 31 32 0d 01  5e 10 77 73 5f 76 70 6f  |s = 12..^.ws_vpo|
00000350  73 20 3d 20 31 36 0d 01  68 10 77 73 5f 78 65 69  |s = 16..h.ws_xei|
00000360  67 20 3d 20 32 30 0d 01  72 10 77 73 5f 79 65 69  |g = 20..r.ws_yei|
00000370  67 20 3d 20 32 34 0d 01  7c 10 77 73 5f 63 65 69  |g = 24..|.ws_cei|
00000380  67 20 3d 20 32 38 0d 01  86 11 77 73 5f 66 69 6c  |g = 28....ws_fil|
00000390  74 6e 20 3d 20 33 32 0d  01 90 11 77 73 5f 66 69  |tn = 32....ws_fi|
000003a0  6c 74 76 20 3d 20 33 36  0d 01 9a 10 77 73 5f 63  |ltv = 36....ws_c|
000003b0  6f 67 72 20 3d 20 34 30  0d 01 a4 10 77 73 5f 63  |ogr = 40....ws_c|
000003c0  6f 67 63 20 3d 20 34 34  0d 01 ae 14 77 73 5f 66  |ogc = 44....ws_f|
000003d0  72 69 63 74 69 6f 6e 20  3d 20 34 38 0d 01 b8 12  |riction = 48....|
000003e0  77 73 5f 73 70 72 69 6e  67 20 3d 20 35 32 0d 01  |ws_spring = 52..|
000003f0  c2 11 77 73 5f 66 6f 72  63 65 20 3d 20 35 36 0d  |..ws_force = 56.|
00000400  01 cc 19 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 20  |...ws_ptr_block |
00000410  3d 20 36 30 20 2b 20 32  0d 01 d6 29 77 73 5f 70  |= 60 + 2...)ws_p|
00000420  74 72 5f 62 6c 6f 63 6b  5f 73 68 61 70 65 20 3d  |tr_block_shape =|
00000430  20 77 73 5f 70 74 72 5f  62 6c 6f 63 6b 20 2b 20  | ws_ptr_block + |
00000440  31 0d 01 e0 29 77 73 5f  70 74 72 5f 62 6c 6f 63  |1...)ws_ptr_bloc|
00000450  6b 5f 77 69 64 74 68 20  3d 20 77 73 5f 70 74 72  |k_width = ws_ptr|
00000460  5f 62 6c 6f 63 6b 20 2b  20 32 0d 01 ea 2a 77 73  |_block + 2...*ws|
00000470  5f 70 74 72 5f 62 6c 6f  63 6b 5f 68 65 69 67 68  |_ptr_block_heigh|
00000480  74 20 3d 20 77 73 5f 70  74 72 5f 62 6c 6f 63 6b  |t = ws_ptr_block|
00000490  20 2b 20 33 0d 01 f4 2b  77 73 5f 70 74 72 5f 62  | + 3...+ws_ptr_b|
000004a0  6c 6f 63 6b 5f 61 63 74  69 76 65 78 20 3d 20 77  |lock_activex = w|
000004b0  73 5f 70 74 72 5f 62 6c  6f 63 6b 20 2b 20 34 0d  |s_ptr_block + 4.|
000004c0  01 fe 2b 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 5f  |..+ws_ptr_block_|
000004d0  61 63 74 69 76 65 79 20  3d 20 77 73 5f 70 74 72  |activey = ws_ptr|
000004e0  5f 62 6c 6f 63 6b 20 2b  20 35 0d 02 08 28 77 73  |_block + 5...(ws|
000004f0  5f 70 74 72 5f 62 6c 6f  63 6b 5f 64 61 74 61 20  |_ptr_block_data |
00000500  3d 20 77 73 5f 70 74 72  5f 62 6c 6f 63 6b 20 2b  |= ws_ptr_block +|
00000510  20 36 0d 02 12 21 77 73  5f 62 75 66 66 65 72 20  | 6...!ws_buffer |
00000520  3d 20 77 73 5f 70 74 72  5f 62 6c 6f 63 6b 20 2b  |= ws_ptr_block +|
00000530  20 31 30 0d 02 1c 18 77  73 5f 62 75 66 66 65 72  | 10....ws_buffer|
00000540  5f 73 69 7a 65 20 3d 20  32 35 36 0d 02 26 2c 77  |_size = 256..&,w|
00000550  73 5f 70 74 72 5f 64 61  74 61 20 3d 20 77 73 5f  |s_ptr_data = ws_|
00000560  62 75 66 66 65 72 20 2b  20 77 73 5f 62 75 66 66  |buffer + ws_buff|
00000570  65 72 5f 73 69 7a 65 0d  02 30 1a 77 73 5f 70 74  |er_size..0.ws_pt|
00000580  72 5f 64 61 74 61 5f 73  69 7a 65 20 3d 20 32 35  |r_data_size = 25|
00000590  36 0d 02 3a 2c 77 73 5f  73 69 7a 65 20 3d 20 77  |6..:,ws_size = w|
000005a0  73 5f 70 74 72 5f 64 61  74 61 20 2b 20 77 73 5f  |s_ptr_data + ws_|
000005b0  70 74 72 5f 64 61 74 61  5f 73 69 7a 65 0d 02 44  |ptr_data_size..D|
000005c0  04 0d 02 4e 19 f4 20 4d  75 6c 74 69 2d 70 61 73  |...N.. Multi-pas|
000005d0  73 20 61 73 73 65 6d 62  6c 79 0d 02 58 18 e3 20  |s assembly..X.. |
000005e0  6f 70 74 25 20 3d 20 31  32 20 b8 20 31 34 20 88  |opt% = 12 . 14 .|
000005f0  20 32 0d 02 62 0e 20 20  20 20 50 25 20 3d 20 30  | 2..b.    P% = 0|
00000600  0d 02 6c 12 20 20 20 20  4f 25 20 3d 20 63 6f 64  |..l.    O% = cod|
00000610  65 25 0d 02 76 1f 20 20  20 20 4c 25 20 3d 20 63  |e%..v.    L% = c|
00000620  6f 64 65 25 20 2b 20 63  6f 64 65 5f 73 69 7a 65  |ode% + code_size|
00000630  25 0d 02 80 11 20 20 20  20 5b 4f 50 54 20 6f 70  |%....    [OPT op|
00000640  74 25 0d 02 8a 04 0d 02  94 1b 20 20 20 20 20 20  |t%........      |
00000650  20 20 3b 20 4d 6f 64 75  6c 65 20 68 65 61 64 65  |  ; Module heade|
00000660  72 0d 02 9e 38 20 20 20  20 20 20 20 20 45 51 55  |r...8        EQU|
00000670  44 20 20 20 20 30 20 20  20 20 20 20 20 20 20 20  |D    0          |
00000680  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00000690  74 61 72 74 20 63 6f 64  65 0d 02 a8 41 20 20 20  |tart code...A   |
000006a0  20 20 20 20 20 45 51 55  44 20 20 20 20 69 6e 69  |     EQUD    ini|
000006b0  74 69 61 6c 69 73 61 74  69 6f 6e 20 20 20 20 20  |tialisation     |
000006c0  20 20 20 20 20 3b 20 49  6e 69 74 69 61 6c 69 73  |     ; Initialis|
000006d0  61 74 69 6f 6e 20 63 6f  64 65 0d 02 b2 3f 20 20  |ation code...?  |
000006e0  20 20 20 20 20 20 45 51  55 44 20 20 20 20 66 69  |      EQUD    fi|
000006f0  6e 61 6c 69 73 61 74 69  6f 6e 20 20 20 20 20 20  |nalisation      |
00000700  20 20 20 20 20 20 3b 20  46 69 6e 61 6c 69 73 61  |      ; Finalisa|
00000710  74 69 6f 6e 20 63 6f 64  65 0d 02 bc 42 20 20 20  |tion code...B   |
00000720  20 20 20 20 20 45 51 55  44 20 20 20 20 73 65 72  |     EQUD    ser|
00000730  76 69 63 65 20 20 20 20  20 20 20 20 20 20 20 20  |vice            |
00000740  20 20 20 20 20 3b 20 53  65 72 76 69 63 65 20 63  |     ; Service c|
00000750  61 6c 6c 20 68 61 6e 64  6c 65 72 0d 02 c6 3a 20  |all handler...: |
00000760  20 20 20 20 20 20 20 45  51 55 44 20 20 20 20 74  |       EQUD    t|
00000770  69 74 6c 65 20 20 20 20  20 20 20 20 20 20 20 20  |itle            |
00000780  20 20 20 20 20 20 20 3b  20 54 69 74 6c 65 20 73  |       ; Title s|
00000790  74 72 69 6e 67 0d 02 d0  39 20 20 20 20 20 20 20  |tring...9       |
000007a0  20 45 51 55 44 20 20 20  20 68 65 6c 70 20 20 20  | EQUD    help   |
000007b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000007c0  20 3b 20 48 65 6c 70 20  73 74 72 69 6e 67 0d 02  | ; Help string..|
000007d0  da 44 20 20 20 20 20 20  20 20 45 51 55 44 20 20  |.D        EQUD  |
000007e0  20 20 63 6f 6d 6d 61 6e  64 20 20 20 20 20 20 20  |  command       |
000007f0  20 20 20 20 20 20 20 20  20 20 3b 20 48 65 6c 70  |          ; Help|
00000800  20 61 6e 64 20 63 6f 6d  6d 61 6e 64 20 74 61 62  | and command tab|
00000810  6c 65 0d 02 e4 43 20 20  20 20 20 20 20 20 45 51  |le...C        EQ|
00000820  55 44 20 20 20 20 30 20  20 20 20 20 20 20 20 20  |UD    0         |
00000830  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000840  53 57 49 20 63 68 75 6e  6b 20 62 61 73 65 20 6e  |SWI chunk base n|
00000850  75 6d 62 65 72 0d 02 ee  3e 20 20 20 20 20 20 20  |umber...>       |
00000860  20 45 51 55 44 20 20 20  20 30 20 20 20 20 20 20  | EQUD    0      |
00000870  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000880  20 3b 20 53 57 49 20 68  61 6e 64 6c 65 72 20 63  | ; SWI handler c|
00000890  6f 64 65 0d 02 f8 40 20  20 20 20 20 20 20 20 45  |ode...@        E|
000008a0  51 55 44 20 20 20 20 30  20 20 20 20 20 20 20 20  |QUD    0        |
000008b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000008c0  20 53 57 49 20 64 65 63  6f 64 69 6e 67 20 74 61  | SWI decoding ta|
000008d0  62 6c 65 0d 03 02 3f 20  20 20 20 20 20 20 20 45  |ble...?        E|
000008e0  51 55 44 20 20 20 20 30  20 20 20 20 20 20 20 20  |QUD    0        |
000008f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00000900  20 53 57 49 20 64 65 63  6f 64 69 6e 67 20 63 6f  | SWI decoding co|
00000910  64 65 0d 03 0c 04 0d 03  16 1a 20 20 20 20 20 20  |de........      |
00000920  20 20 3b 20 54 69 74 6c  65 20 73 74 72 69 6e 67  |  ; Title string|
00000930  0d 03 20 22 2e 74 69 74  6c 65 20 20 45 51 55 53  |.. ".title  EQUS|
00000940  20 20 20 20 22 43 72 61  7a 79 50 6f 69 6e 74 65  |    "CrazyPointe|
00000950  72 22 0d 03 2a 15 20 20  20 20 20 20 20 20 45 51  |r"..*.        EQ|
00000960  55 42 20 20 20 20 30 0d  03 34 04 0d 03 3e 04 0d  |UB    0..4...>..|
00000970  03 48 19 20 20 20 20 20  20 20 20 3b 20 48 65 6c  |.H.        ; Hel|
00000980  70 20 73 74 72 69 6e 67  0d 03 52 3f 2e 68 65 6c  |p string..R?.hel|
00000990  70 20 20 20 45 51 55 53  20 20 20 20 22 43 72 61  |p   EQUS    "Cra|
000009a0  7a 79 20 50 6f 69 6e 74  65 72 22 20 2b 20 bd 39  |zy Pointer" + .9|
000009b0  20 2b 20 22 31 2e 30 31  20 28 30 37 20 4a 75 6e  | + "1.01 (07 Jun|
000009c0  20 31 39 39 37 29 22 0d  03 5c 37 20 20 20 20 20  | 1997)"..\7     |
000009d0  20 20 20 45 51 55 53 20  20 20 20 22 20 22 20 2b  |   EQUS    " " +|
000009e0  20 bd 31 36 39 20 2b 20  22 20 41 2e 54 68 6f 75  | .169 + " A.Thou|
000009f0  6b 79 64 69 64 65 73 2c  20 31 39 39 37 22 0d 03  |kydides, 1997"..|
00000a00  66 15 20 20 20 20 20 20  20 20 45 51 55 42 20 20  |f.        EQUB  |
00000a10  20 20 30 0d 03 70 11 20  20 20 20 20 20 20 20 41  |  0..p.        A|
00000a20  4c 49 47 4e 0d 03 7a 0c  20 20 20 20 20 20 20 20  |LIGN..z.        |
00000a30  0d 03 84 2c 20 20 20 20  20 20 20 20 3b 20 48 65  |...,        ; He|
00000a40  6c 70 20 61 6e 64 20 63  6f 6d 6d 61 6e 64 20 6b  |lp and command k|
00000a50  65 79 77 6f 72 64 20 74  61 62 6c 65 0d 03 8e 0c  |eyword table....|
00000a60  2e 63 6f 6d 6d 61 6e 64  0d 03 98 3a 20 20 20 20  |.command...:    |
00000a70  20 20 20 20 45 51 55 53  20 20 20 20 22 43 72 61  |    EQUS    "Cra|
00000a80  7a 79 50 6f 69 6e 74 65  72 22 20 20 20 20 20 20  |zyPointer"      |
00000a90  20 20 20 20 3b 20 43 6f  6d 6d 61 6e 64 20 6e 61  |    ; Command na|
00000aa0  6d 65 0d 03 a2 15 20 20  20 20 20 20 20 20 45 51  |me....        EQ|
00000ab0  55 42 20 20 20 20 30 0d  03 ac 11 20 20 20 20 20  |UB    0....     |
00000ac0  20 20 20 41 4c 49 47 4e  0d 03 b6 3c 20 20 20 20  |   ALIGN...<    |
00000ad0  20 20 20 20 45 51 55 44  20 20 20 20 30 20 20 20  |    EQUD    0   |
00000ae0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000af0  20 20 20 20 3b 20 4f 66  66 73 65 74 20 74 6f 20  |    ; Offset to |
00000b00  63 6f 64 65 0d 03 c0 3e  20 20 20 20 20 20 20 20  |code...>        |
00000b10  45 51 55 44 20 20 20 20  26 30 20 20 20 20 20 20  |EQUD    &0      |
00000b20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b30  3b 20 49 6e 66 6f 72 6d  61 74 69 6f 6e 20 77 6f  |; Information wo|
00000b40  72 64 0d 03 ca 46 20 20  20 20 20 20 20 20 45 51  |rd...F        EQ|
00000b50  55 44 20 20 20 20 30 20  20 20 20 20 20 20 20 20  |UD    0         |
00000b60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000b70  4f 66 66 73 65 74 20 74  6f 20 73 79 6e 74 61 78  |Offset to syntax|
00000b80  20 6d 65 73 73 61 67 65  0d 03 d4 41 20 20 20 20  | message...A    |
00000b90  20 20 20 20 45 51 55 44  20 20 20 20 63 6f 6d 6d  |    EQUD    comm|
00000ba0  61 6e 64 5f 68 65 6c 70  20 20 20 20 20 20 20 20  |and_help        |
00000bb0  20 20 20 20 3b 20 4f 66  66 73 65 74 20 74 6f 20  |    ; Offset to |
00000bc0  68 65 6c 70 20 74 65 78  74 0d 03 de 0c 20 20 20  |help text....   |
00000bd0  20 20 20 20 20 0d 03 e8  3a 20 20 20 20 20 20 20  |     ...:       |
00000be0  20 45 51 55 53 20 20 20  20 22 43 72 61 7a 79 50  | EQUS    "CrazyP|
00000bf0  6f 69 6e 74 65 72 57 6f  62 62 6c 65 22 20 20 20  |ointerWobble"   |
00000c00  20 3b 20 43 6f 6d 6d 61  6e 64 20 6e 61 6d 65 0d  | ; Command name.|
00000c10  03 f2 15 20 20 20 20 20  20 20 20 45 51 55 42 20  |...        EQUB |
00000c20  20 20 20 30 0d 03 fc 11  20 20 20 20 20 20 20 20  |   0....        |
00000c30  41 4c 49 47 4e 0d 04 06  3c 20 20 20 20 20 20 20  |ALIGN...<       |
00000c40  20 45 51 55 44 20 20 20  20 63 6f 6d 6d 61 6e 64  | EQUD    command|
00000c50  5f 77 6f 62 62 6c 65 20  20 20 20 20 20 20 20 20  |_wobble         |
00000c60  20 3b 20 4f 66 66 73 65  74 20 74 6f 20 63 6f 64  | ; Offset to cod|
00000c70  65 0d 04 10 3e 20 20 20  20 20 20 20 20 45 51 55  |e...>        EQU|
00000c80  44 20 20 20 20 26 30 30  30 37 30 30 30 31 20 20  |D    &00070001  |
00000c90  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 49  |             ; I|
00000ca0  6e 66 6f 72 6d 61 74 69  6f 6e 20 77 6f 72 64 0d  |nformation word.|
00000cb0  04 1a 46 20 20 20 20 20  20 20 20 45 51 55 44 20  |..F        EQUD |
00000cc0  20 20 20 63 6f 6d 6d 61  6e 64 5f 77 6f 62 62 6c  |   command_wobbl|
00000cd0  65 5f 73 79 6e 74 61 78  20 20 20 3b 20 4f 66 66  |e_syntax   ; Off|
00000ce0  73 65 74 20 74 6f 20 73  79 6e 74 61 78 20 6d 65  |set to syntax me|
00000cf0  73 73 61 67 65 0d 04 24  41 20 20 20 20 20 20 20  |ssage..$A       |
00000d00  20 45 51 55 44 20 20 20  20 63 6f 6d 6d 61 6e 64  | EQUD    command|
00000d10  5f 77 6f 62 62 6c 65 5f  68 65 6c 70 20 20 20 20  |_wobble_help    |
00000d20  20 3b 20 4f 66 66 73 65  74 20 74 6f 20 68 65 6c  | ; Offset to hel|
00000d30  70 20 74 65 78 74 0d 04  2e 0c 20 20 20 20 20 20  |p text....      |
00000d40  20 20 0d 04 38 4c 20 20  20 20 20 20 20 20 45 51  |  ..8L        EQ|
00000d50  55 42 20 20 20 20 30 20  20 20 20 20 20 20 20 20  |UB    0         |
00000d60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00000d70  54 65 72 6d 69 6e 61 74  65 20 74 68 65 20 6c 69  |Terminate the li|
00000d80  73 74 20 6f 66 20 6b 65  79 77 6f 72 64 73 0d 04  |st of keywords..|
00000d90  42 04 0d 04 4c 2f 20 20  20 20 20 20 20 20 3b 20  |B...L/        ; |
00000da0  48 65 6c 70 20 66 6f 72  20 74 68 65 20 43 72 61  |Help for the Cra|
00000db0  7a 79 50 6f 69 6e 74 65  72 20 6b 65 79 77 6f 72  |zyPointer keywor|
00000dc0  64 0d 04 56 11 2e 63 6f  6d 6d 61 6e 64 5f 68 65  |d..V..command_he|
00000dd0  6c 70 0d 04 60 45 20 20  20 20 20 20 20 20 45 51  |lp..`E        EQ|
00000de0  55 53 20 20 20 20 22 43  72 61 7a 79 20 50 6f 69  |US    "Crazy Poi|
00000df0  6e 74 65 72 20 70 72 6f  76 69 64 65 73 20 61 6e  |nter provides an|
00000e00  69 6d 61 74 65 64 20 6d  6f 75 73 65 20 70 6f 69  |imated mouse poi|
00000e10  6e 74 65 72 73 2e 22 0d  04 6a 50 20 20 20 20 20  |nters."..jP     |
00000e20  20 20 20 45 51 55 53 20  20 20 20 22 20 52 65 70  |   EQUS    " Rep|
00000e30  6c 61 63 65 6d 65 6e 74  73 20 61 72 65 20 70 72  |lacements are pr|
00000e40  6f 76 69 64 65 64 20 66  6f 72 20 74 68 65 20 73  |ovided for the s|
00000e50  74 61 6e 64 61 72 64 2c  20 64 6f 75 62 6c 65 2d  |tandard, double-|
00000e60  63 6c 69 63 6b 2c 22 0d  04 74 2a 20 20 20 20 20  |click,"..t*     |
00000e70  20 20 20 45 51 55 53 20  20 20 20 22 20 61 6e 64  |   EQUS    " and|
00000e80  20 63 61 72 65 74 20 70  6f 69 6e 74 65 72 73 2e  | caret pointers.|
00000e90  22 0d 04 7e 16 20 20 20  20 20 20 20 20 45 51 55  |"..~.        EQU|
00000ea0  42 20 20 20 20 31 33 0d  04 88 4e 20 20 20 20 20  |B    13...N     |
00000eb0  20 20 20 45 51 55 53 20  20 20 20 22 54 68 69 73  |   EQUS    "This|
00000ec0  20 6d 6f 64 75 6c 65 20  69 73 20 69 6e 73 70 69  | module is inspi|
00000ed0  72 65 64 20 62 79 20 4d  6f 75 73 65 50 20 77 72  |red by MouseP wr|
00000ee0  69 74 74 65 6e 20 62 79  20 41 6e 64 72 65 77 20  |itten by Andrew |
00000ef0  42 6f 6c 74 22 0d 04 92  52 20 20 20 20 20 20 20  |Bolt"...R       |
00000f00  20 45 51 55 53 20 20 20  20 22 20 61 6e 64 20 70  | EQUS    " and p|
00000f10  75 62 6c 69 73 68 65 64  20 69 6e 20 74 68 65 20  |ublished in the |
00000f20  4a 75 6e 65 20 31 39 39  37 20 2a 49 6e 66 6f 20  |June 1997 *Info |
00000f30  73 65 63 74 69 6f 6e 20  6f 66 20 41 63 6f 72 6e  |section of Acorn|
00000f40  20 55 73 65 72 2e 22 0d  04 9c 15 20 20 20 20 20  | User."....     |
00000f50  20 20 20 45 51 55 42 20  20 20 20 30 0d 04 a6 11  |   EQUB    0....|
00000f60  20 20 20 20 20 20 20 20  41 4c 49 47 4e 0d 04 b0  |        ALIGN...|
00000f70  04 0d 04 ba 2d 20 20 20  20 20 20 20 20 3b 20 54  |....-        ; T|
00000f80  68 65 20 2a 43 72 61 7a  79 50 6f 69 6e 74 65 72  |he *CrazyPointer|
00000f90  57 6f 62 62 6c 65 20 63  6f 6d 6d 61 6e 64 0d 04  |Wobble command..|
00000fa0  c4 13 2e 63 6f 6d 6d 61  6e 64 5f 77 6f 62 62 6c  |...command_wobbl|
00000fb0  65 0d 04 ce 3d 20 20 20  20 20 20 20 20 53 54 4d  |e...=        STM|
00000fc0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 31 34 7d  |FD   r13!, {r14}|
00000fd0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00000fe0  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0d 04  |tack registers..|
00000ff0  d8 46 20 20 20 20 20 20  20 20 53 55 42 20 20 20  |.F        SUB   |
00001000  20 20 72 31 33 2c 20 72  31 33 2c 20 23 34 38 20  |  r13, r13, #48 |
00001010  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 73 65  |          ; Rese|
00001020  72 76 65 20 73 6f 6d 65  20 73 74 61 63 6b 20 73  |rve some stack s|
00001030  70 61 63 65 0d 04 e2 49  20 20 20 20 20 20 20 20  |pace...I        |
00001040  4c 44 52 20 20 20 20 20  72 31 32 2c 20 5b 72 31  |LDR     r12, [r1|
00001050  32 5d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2]              |
00001060  3b 20 4f 62 74 61 69 6e  20 70 6f 69 6e 74 65 72  |; Obtain pointer|
00001070  20 74 6f 20 77 6f 72 6b  73 70 61 63 65 0d 04 ec  | to workspace...|
00001080  4b 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |K        MOV    |
00001090  20 72 31 2c 20 72 30 20  20 20 20 20 20 20 20 20  | r1, r0         |
000010a0  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
000010b0  74 68 65 20 63 6f 6d 6d  61 6e 64 20 74 61 69 6c  |the command tail|
000010c0  20 70 6f 69 6e 74 65 72  0d 04 f6 4b 20 20 20 20  | pointer...K    |
000010d0  20 20 20 20 41 44 52 20  20 20 20 20 72 30 2c 20  |    ADR     r0, |
000010e0  63 6f 6d 6d 61 6e 64 5f  77 6f 62 62 6c 65 5f 64  |command_wobble_d|
000010f0  65 66 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |ef  ; Pointer to|
00001100  20 6b 65 79 77 6f 72 64  20 64 65 66 69 6e 69 74  | keyword definit|
00001110  69 6f 6e 0d 05 00 46 20  20 20 20 20 20 20 20 4d  |ion...F        M|
00001120  4f 56 20 20 20 20 20 72  32 2c 20 72 31 33 20 20  |OV     r2, r13  |
00001130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00001140  20 50 6f 69 6e 74 65 72  20 74 6f 20 6f 75 74 70  | Pointer to outp|
00001150  75 74 20 62 75 66 66 65  72 0d 05 0a 47 20 20 20  |ut buffer...G   |
00001160  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 33 2c  |     MOV     r3,|
00001170  20 23 34 38 20 20 20 20  20 20 20 20 20 20 20 20  | #48            |
00001180  20 20 20 20 20 3b 20 53  69 7a 65 20 6f 66 20 74  |     ; Size of t|
00001190  68 65 20 6f 75 74 70 75  74 20 62 75 66 66 65 72  |he output buffer|
000011a0  0d 05 14 45 20 20 20 20  20 20 20 20 53 57 49 20  |...E        SWI |
000011b0  20 20 20 20 22 58 4f 53  5f 52 65 61 64 41 72 67  |    "XOS_ReadArg|
000011c0  73 22 20 20 20 20 20 20  20 20 20 20 3b 20 53 63  |s"          ; Sc|
000011d0  61 6e 20 74 68 65 20 63  6f 6d 6d 61 6e 64 20 73  |an the command s|
000011e0  74 72 69 6e 67 0d 05 1e  4a 20 20 20 20 20 20 20  |tring...J       |
000011f0  20 42 56 53 20 20 20 20  20 63 6f 6d 6d 61 6e 64  | BVS     command|
00001200  5f 77 6f 62 62 6c 65 5f  64 6f 6e 65 20 20 20 20  |_wobble_done    |
00001210  20 3b 20 52 65 74 75 72  6e 20 66 72 6f 6d 20 68  | ; Return from h|
00001220  61 6e 64 6c 65 72 20 69  66 20 65 72 72 6f 72 0d  |andler if error.|
00001230  05 28 49 20 20 20 20 20  20 20 20 4c 44 52 20 20  |.(I        LDR  |
00001240  20 20 20 72 30 2c 20 5b  72 32 5d 2c 20 23 34 20  |   r0, [r2], #4 |
00001250  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 68 65  |           ; Che|
00001260  63 6b 20 69 66 20 77 6f  62 62 6c 65 20 69 73 20  |ck if wobble is |
00001270  64 69 73 61 62 6c 65 64  0d 05 32 46 20 20 20 20  |disabled..2F    |
00001280  20 20 20 20 54 45 51 20  20 20 20 20 72 30 2c 20  |    TEQ     r0, |
00001290  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
000012a0  20 20 20 20 3b 20 49 73  20 77 6f 62 62 6c 65 20  |    ; Is wobble |
000012b0  62 65 69 6e 67 20 64 69  73 61 62 6c 65 64 0d 05  |being disabled..|
000012c0  3c 54 20 20 20 20 20 20  20 20 42 4e 45 20 20 20  |<T        BNE   |
000012d0  20 20 63 6f 6d 6d 61 6e  64 5f 77 6f 62 62 6c 65  |  command_wobble|
000012e0  5f 64 69 73 61 62 6c 65  20 20 3b 20 44 69 73 61  |_disable  ; Disa|
000012f0  62 6c 65 20 74 68 65 20  70 6f 69 6e 74 65 72 20  |ble the pointer |
00001300  77 6f 62 62 6c 65 20 69  66 20 72 65 71 75 69 72  |wobble if requir|
00001310  65 64 0d 05 46 43 20 20  20 20 20 20 20 20 4c 44  |ed..FC        LD|
00001320  52 20 20 20 20 20 72 30  2c 20 5b 72 32 5d 2c 20  |R     r0, [r2], |
00001330  23 34 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |#4            ; |
00001340  52 65 61 64 20 66 72 69  63 74 69 6f 6e 20 70 6f  |Read friction po|
00001350  69 6e 74 65 72 0d 05 50  43 20 20 20 20 20 20 20  |inter..PC       |
00001360  20 54 45 51 20 20 20 20  20 72 30 2c 20 23 30 20  | TEQ     r0, #0 |
00001370  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001380  20 3b 20 57 61 73 20 61  20 76 61 6c 75 65 20 73  | ; Was a value s|
00001390  70 65 63 69 66 69 65 64  0d 05 5a 42 20 20 20 20  |pecified..ZB    |
000013a0  20 20 20 20 42 45 51 20  20 20 20 20 63 6f 6d 6d  |    BEQ     comm|
000013b0  61 6e 64 5f 77 6f 62 62  6c 65 5f 73 70 72 69 6e  |and_wobble_sprin|
000013c0  67 20 20 20 3b 20 53 6b  69 70 20 74 68 69 73 20  |g   ; Skip this |
000013d0  62 69 74 20 69 66 20 6e  6f 74 0d 05 64 3b 20 20  |bit if not..d;  |
000013e0  20 20 20 20 20 20 4c 44  52 42 20 20 20 20 72 31  |      LDRB    r1|
000013f0  2c 20 5b 72 30 5d 2c 20  23 31 20 20 20 20 20 20  |, [r0], #1      |
00001400  20 20 20 20 20 20 3b 20  52 65 61 64 20 74 68 65  |      ; Read the|
00001410  20 74 79 70 65 0d 05 6e  45 20 20 20 20 20 20 20  | type..nE       |
00001420  20 54 45 51 20 20 20 20  20 72 31 2c 20 23 30 20  | TEQ     r1, #0 |
00001430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001440  20 3b 20 49 73 20 74 68  65 20 76 61 6c 75 65 20  | ; Is the value |
00001450  61 6e 20 69 6e 74 65 67  65 72 0d 05 78 46 20 20  |an integer..xF  |
00001460  20 20 20 20 20 20 42 4e  45 20 20 20 20 20 63 6f  |      BNE     co|
00001470  6d 6d 61 6e 64 5f 77 6f  62 62 6c 65 5f 66 61 69  |mmand_wobble_fai|
00001480  6c 20 20 20 20 20 3b 20  47 65 6e 65 72 61 74 65  |l     ; Generate|
00001490  20 61 6e 20 65 72 72 6f  72 20 69 66 20 6e 6f 74  | an error if not|
000014a0  0d 05 82 44 20 20 20 20  20 20 20 20 a4 6c 64 72  |...D        .ldr|
000014b0  75 28 31 2c 20 30 2c 20  33 2c 20 34 29 20 20 20  |u(1, 0, 3, 4)   |
000014c0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
000014d0  64 20 74 68 65 20 66 72  69 63 74 69 6f 6e 20 76  |d the friction v|
000014e0  61 6c 75 65 0d 05 8c 46  20 20 20 20 20 20 20 20  |alue...F        |
000014f0  53 54 52 20 20 20 20 20  72 31 2c 20 5b 72 31 32  |STR     r1, [r12|
00001500  2c 20 23 77 73 5f 66 72  69 63 74 69 6f 6e 5d 20  |, #ws_friction] |
00001510  3b 20 53 74 6f 72 65 20  74 68 65 20 66 72 69 63  |; Store the fric|
00001520  74 69 6f 6e 20 76 61 6c  75 65 0d 05 96 1a 2e 63  |tion value.....c|
00001530  6f 6d 6d 61 6e 64 5f 77  6f 62 62 6c 65 5f 73 70  |ommand_wobble_sp|
00001540  72 69 6e 67 0d 05 a0 41  20 20 20 20 20 20 20 20  |ring...A        |
00001550  4c 44 52 20 20 20 20 20  72 30 2c 20 5b 72 32 5d  |LDR     r0, [r2]|
00001560  2c 20 23 34 20 20 20 20  20 20 20 20 20 20 20 20  |, #4            |
00001570  3b 20 52 65 61 64 20 73  70 72 69 6e 67 20 70 6f  |; Read spring po|
00001580  69 6e 74 65 72 0d 05 aa  43 20 20 20 20 20 20 20  |inter...C       |
00001590  20 54 45 51 20 20 20 20  20 72 30 2c 20 23 30 20  | TEQ     r0, #0 |
000015a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000015b0  20 3b 20 57 61 73 20 61  20 76 61 6c 75 65 20 73  | ; Was a value s|
000015c0  70 65 63 69 66 69 65 64  0d 05 b4 42 20 20 20 20  |pecified...B    |
000015d0  20 20 20 20 42 45 51 20  20 20 20 20 63 6f 6d 6d  |    BEQ     comm|
000015e0  61 6e 64 5f 77 6f 62 62  6c 65 5f 66 6f 72 63 65  |and_wobble_force|
000015f0  20 20 20 20 3b 20 53 6b  69 70 20 74 68 69 73 20  |    ; Skip this |
00001600  62 69 74 20 69 66 20 6e  6f 74 0d 05 be 3b 20 20  |bit if not...;  |
00001610  20 20 20 20 20 20 4c 44  52 42 20 20 20 20 72 31  |      LDRB    r1|
00001620  2c 20 5b 72 30 5d 2c 20  23 31 20 20 20 20 20 20  |, [r0], #1      |
00001630  20 20 20 20 20 20 3b 20  52 65 61 64 20 74 68 65  |      ; Read the|
00001640  20 74 79 70 65 0d 05 c8  45 20 20 20 20 20 20 20  | type...E       |
00001650  20 54 45 51 20 20 20 20  20 72 31 2c 20 23 30 20  | TEQ     r1, #0 |
00001660  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001670  20 3b 20 49 73 20 74 68  65 20 76 61 6c 75 65 20  | ; Is the value |
00001680  61 6e 20 69 6e 74 65 67  65 72 0d 05 d2 46 20 20  |an integer...F  |
00001690  20 20 20 20 20 20 42 4e  45 20 20 20 20 20 63 6f  |      BNE     co|
000016a0  6d 6d 61 6e 64 5f 77 6f  62 62 6c 65 5f 66 61 69  |mmand_wobble_fai|
000016b0  6c 20 20 20 20 20 3b 20  47 65 6e 65 72 61 74 65  |l     ; Generate|
000016c0  20 61 6e 20 65 72 72 6f  72 20 69 66 20 6e 6f 74  | an error if not|
000016d0  0d 05 dc 42 20 20 20 20  20 20 20 20 a4 6c 64 72  |...B        .ldr|
000016e0  75 28 31 2c 20 30 2c 20  33 2c 20 34 29 20 20 20  |u(1, 0, 3, 4)   |
000016f0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
00001700  64 20 74 68 65 20 73 70  72 69 6e 67 20 76 61 6c  |d the spring val|
00001710  75 65 0d 05 e6 44 20 20  20 20 20 20 20 20 53 54  |ue...D        ST|
00001720  52 20 20 20 20 20 72 31  2c 20 5b 72 31 32 2c 20  |R     r1, [r12, |
00001730  23 77 73 5f 73 70 72 69  6e 67 5d 20 20 20 3b 20  |#ws_spring]   ; |
00001740  53 74 6f 72 65 20 74 68  65 20 73 70 72 69 6e 67  |Store the spring|
00001750  20 76 61 6c 75 65 0d 05  f0 19 2e 63 6f 6d 6d 61  | value.....comma|
00001760  6e 64 5f 77 6f 62 62 6c  65 5f 66 6f 72 63 65 0d  |nd_wobble_force.|
00001770  05 fa 40 20 20 20 20 20  20 20 20 4c 44 52 20 20  |..@        LDR  |
00001780  20 20 20 72 30 2c 20 5b  72 32 5d 2c 20 23 34 20  |   r0, [r2], #4 |
00001790  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
000017a0  64 20 66 6f 72 63 65 20  70 6f 69 6e 74 65 72 0d  |d force pointer.|
000017b0  06 04 43 20 20 20 20 20  20 20 20 54 45 51 20 20  |..C        TEQ  |
000017c0  20 20 20 72 30 2c 20 23  30 20 20 20 20 20 20 20  |   r0, #0       |
000017d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 57 61 73  |           ; Was|
000017e0  20 61 20 76 61 6c 75 65  20 73 70 65 63 69 66 69  | a value specifi|
000017f0  65 64 0d 06 0e 42 20 20  20 20 20 20 20 20 42 45  |ed...B        BE|
00001800  51 20 20 20 20 20 63 6f  6d 6d 61 6e 64 5f 77 6f  |Q     command_wo|
00001810  62 62 6c 65 5f 64 6f 6e  65 20 20 20 20 20 3b 20  |bble_done     ; |
00001820  53 6b 69 70 20 74 68 69  73 20 62 69 74 20 69 66  |Skip this bit if|
00001830  20 6e 6f 74 0d 06 18 3b  20 20 20 20 20 20 20 20  | not...;        |
00001840  4c 44 52 42 20 20 20 20  72 31 2c 20 5b 72 30 5d  |LDRB    r1, [r0]|
00001850  2c 20 23 31 20 20 20 20  20 20 20 20 20 20 20 20  |, #1            |
00001860  3b 20 52 65 61 64 20 74  68 65 20 74 79 70 65 0d  |; Read the type.|
00001870  06 22 45 20 20 20 20 20  20 20 20 54 45 51 20 20  |."E        TEQ  |
00001880  20 20 20 72 31 2c 20 23  30 20 20 20 20 20 20 20  |   r1, #0       |
00001890  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 73 20  |           ; Is |
000018a0  74 68 65 20 76 61 6c 75  65 20 61 6e 20 69 6e 74  |the value an int|
000018b0  65 67 65 72 0d 06 2c 46  20 20 20 20 20 20 20 20  |eger..,F        |
000018c0  42 4e 45 20 20 20 20 20  63 6f 6d 6d 61 6e 64 5f  |BNE     command_|
000018d0  77 6f 62 62 6c 65 5f 66  61 69 6c 20 20 20 20 20  |wobble_fail     |
000018e0  3b 20 47 65 6e 65 72 61  74 65 20 61 6e 20 65 72  |; Generate an er|
000018f0  72 6f 72 20 69 66 20 6e  6f 74 0d 06 36 41 20 20  |ror if not..6A  |
00001900  20 20 20 20 20 20 a4 6c  64 72 75 28 31 2c 20 30  |      .ldru(1, 0|
00001910  2c 20 33 2c 20 34 29 20  20 20 20 20 20 20 20 20  |, 3, 4)         |
00001920  20 20 20 20 20 3b 20 52  65 61 64 20 74 68 65 20  |     ; Read the |
00001930  66 6f 72 63 65 20 76 61  6c 75 65 0d 06 40 43 20  |force value..@C |
00001940  20 20 20 20 20 20 20 53  54 52 20 20 20 20 20 72  |       STR     r|
00001950  31 2c 20 5b 72 31 32 2c  20 23 77 73 5f 66 6f 72  |1, [r12, #ws_for|
00001960  63 65 5d 20 20 20 20 3b  20 53 74 6f 72 65 20 74  |ce]    ; Store t|
00001970  68 65 20 66 6f 72 63 65  20 76 61 6c 75 65 0d 06  |he force value..|
00001980  4a 18 2e 63 6f 6d 6d 61  6e 64 5f 77 6f 62 62 6c  |J..command_wobbl|
00001990  65 5f 64 6f 6e 65 0d 06  54 4f 20 20 20 20 20 20  |e_done..TO      |
000019a0  20 20 41 44 44 20 20 20  20 20 72 31 33 2c 20 72  |  ADD     r13, r|
000019b0  31 33 2c 20 23 34 38 20  20 20 20 20 20 20 20 20  |13, #48         |
000019c0  20 20 3b 20 53 6b 69 70  20 62 61 63 6b 20 6f 76  |  ; Skip back ov|
000019d0  65 72 20 74 68 65 20 72  65 73 65 72 76 65 64 20  |er the reserved |
000019e0  73 70 61 63 65 0d 06 5e  4d 20 20 20 20 20 20 20  |space..^M       |
000019f0  20 4c 44 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | LDMFD   r13!, {|
00001a00  70 63 7d 20 20 20 20 20  20 20 20 20 20 20 20 20  |pc}             |
00001a10  20 3b 20 52 65 74 75 72  6e 20 66 72 6f 6d 20 74  | ; Return from t|
00001a20  68 65 20 63 6f 6d 6d 61  6e 64 20 68 61 6e 64 6c  |he command handl|
00001a30  65 72 0d 06 68 1b 2e 63  6f 6d 6d 61 6e 64 5f 77  |er..h..command_w|
00001a40  6f 62 62 6c 65 5f 64 69  73 61 62 6c 65 0d 06 72  |obble_disable..r|
00001a50  48 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |H        MOV    |
00001a60  20 72 30 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r0, #0         |
00001a70  20 20 20 20 20 20 20 20  20 3b 20 56 61 6c 75 65  |         ; Value|
00001a80  20 74 6f 20 63 6c 65 61  72 20 66 69 6c 74 65 72  | to clear filter|
00001a90  20 77 69 74 68 0d 06 7c  47 20 20 20 20 20 20 20  | with..|G       |
00001aa0  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
00001ab0  32 2c 20 23 77 73 5f 66  69 6c 74 6e 5d 20 20 20  |2, #ws_filtn]   |
00001ac0  20 3b 20 43 6c 65 61 72  20 61 6e 79 20 65 78 69  | ; Clear any exi|
00001ad0  73 74 69 6e 67 20 77 69  62 62 6c 65 0d 06 86 50  |sting wibble...P|
00001ae0  20 20 20 20 20 20 20 20  53 54 52 20 20 20 20 20  |        STR     |
00001af0  72 30 2c 20 5b 72 31 32  2c 20 23 77 73 5f 66 69  |r0, [r12, #ws_fi|
00001b00  6c 74 76 5d 20 20 20 20  3b 20 43 6c 65 61 72 20  |ltv]    ; Clear |
00001b10  61 6e 79 20 65 78 69 73  74 69 6e 67 20 77 69 62  |any existing wib|
00001b20  62 6c 65 20 76 65 6c 6f  63 69 74 79 0d 06 90 45  |ble velocity...E|
00001b30  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00001b40  72 30 2c 20 23 33 32 20  20 20 20 20 20 20 20 20  |r0, #32         |
00001b50  20 20 20 20 20 20 20 20  3b 20 56 61 6c 75 65 20  |        ; Value |
00001b60  74 6f 20 64 69 73 61 62  6c 65 20 77 6f 62 62 6c  |to disable wobbl|
00001b70  65 0d 06 9a 48 20 20 20  20 20 20 20 20 53 54 52  |e...H        STR|
00001b80  20 20 20 20 20 72 30 2c  20 5b 72 31 32 2c 20 23  |     r0, [r12, #|
00001b90  77 73 5f 66 6f 72 63 65  5d 20 20 20 20 3b 20 43  |ws_force]    ; C|
00001ba0  6c 65 61 72 20 74 68 65  20 66 6f 72 63 65 20 6d  |lear the force m|
00001bb0  75 6c 74 69 70 6c 69 65  72 0d 06 a4 4d 20 20 20  |ultiplier...M   |
00001bc0  20 20 20 20 20 42 20 20  20 20 20 20 20 63 6f 6d  |     B       com|
00001bd0  6d 61 6e 64 5f 77 6f 62  62 6c 65 5f 64 6f 6e 65  |mand_wobble_done|
00001be0  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
00001bf0  6f 6d 20 74 68 65 20 63  6f 6d 6d 61 6e 64 20 68  |om the command h|
00001c00  61 6e 64 6c 65 72 0d 06  ae 18 2e 63 6f 6d 6d 61  |andler.....comma|
00001c10  6e 64 5f 77 6f 62 62 6c  65 5f 66 61 69 6c 0d 06  |nd_wobble_fail..|
00001c20  b8 44 20 20 20 20 20 20  20 20 41 44 52 20 20 20  |.D        ADR   |
00001c30  20 20 72 30 2c 20 63 6f  6d 6d 61 6e 64 5f 77 6f  |  r0, command_wo|
00001c40  62 62 6c 65 5f 65 72 72  6f 72 3b 20 50 6f 69 6e  |bble_error; Poin|
00001c50  74 65 72 20 74 6f 20 65  72 72 6f 72 20 62 6c 6f  |ter to error blo|
00001c60  63 6b 0d 06 c2 50 20 20  20 20 20 20 20 20 43 4d  |ck...P        CM|
00001c70  50 20 20 20 20 20 70 63  2c 20 23 26 38 30 30 30  |P     pc, #&8000|
00001c80  30 30 30 30 20 20 20 20  20 20 20 20 20 20 3b 20  |0000          ; |
00001c90  53 65 74 20 74 68 65 20  6f 76 65 72 66 6c 6f 77  |Set the overflow|
00001ca0  20 66 6c 61 67 20 66 6f  72 20 61 6e 20 65 72 72  | flag for an err|
00001cb0  6f 72 0d 06 cc 4d 20 20  20 20 20 20 20 20 42 20  |or...M        B |
00001cc0  20 20 20 20 20 20 63 6f  6d 6d 61 6e 64 5f 77 6f  |      command_wo|
00001cd0  62 62 6c 65 5f 64 6f 6e  65 20 20 20 20 20 3b 20  |bble_done     ; |
00001ce0  52 65 74 75 72 6e 20 66  72 6f 6d 20 74 68 65 20  |Return from the |
00001cf0  63 6f 6d 6d 61 6e 64 20  68 61 6e 64 6c 65 72 0d  |command handler.|
00001d00  06 d6 19 2e 63 6f 6d 6d  61 6e 64 5f 77 6f 62 62  |....command_wobb|
00001d10  6c 65 5f 65 72 72 6f 72  0d 06 e0 15 20 20 20 20  |le_error....    |
00001d20  20 20 20 20 45 51 55 44  20 20 20 20 30 0d 06 ea  |    EQUD    0...|
00001d30  30 20 20 20 20 20 20 20  20 45 51 55 53 20 20 20  |0        EQUS   |
00001d40  20 22 49 6e 76 61 6c 69  64 20 63 6f 6d 6d 61 6e  | "Invalid comman|
00001d50  64 20 70 61 72 61 6d 65  74 65 72 73 22 0d 06 f4  |d parameters"...|
00001d60  15 20 20 20 20 20 20 20  20 45 51 55 42 20 20 20  |.        EQUB   |
00001d70  20 30 0d 06 fe 11 20 20  20 20 20 20 20 20 41 4c  | 0....        AL|
00001d80  49 47 4e 0d 07 08 17 2e  63 6f 6d 6d 61 6e 64 5f  |IGN.....command_|
00001d90  77 6f 62 62 6c 65 5f 64  65 66 0d 07 12 3c 20 20  |wobble_def...<  |
00001da0  20 20 20 20 20 20 45 51  55 53 20 20 20 20 22 6e  |      EQUS    "n|
00001db0  6f 77 6f 62 62 6c 65 2f  73 2c 66 72 69 63 74 69  |owobble/s,fricti|
00001dc0  6f 6e 2f 65 2c 73 70 72  69 6e 67 2f 65 2c 66 6f  |on/e,spring/e,fo|
00001dd0  72 63 65 2f 65 22 0d 07  1c 15 20 20 20 20 20 20  |rce/e"....      |
00001de0  20 20 45 51 55 42 20 20  20 20 30 0d 07 26 18 2e  |  EQUB    0..&..|
00001df0  63 6f 6d 6d 61 6e 64 5f  77 6f 62 62 6c 65 5f 68  |command_wobble_h|
00001e00  65 6c 70 0d 07 30 49 20  20 20 20 20 20 20 20 45  |elp..0I        E|
00001e10  51 55 53 20 20 20 20 22  2a 43 72 61 7a 79 50 6f  |QUS    "*CrazyPo|
00001e20  69 6e 74 65 72 57 6f 62  62 6c 65 20 61 6c 6c 6f  |interWobble allo|
00001e30  77 73 20 74 68 65 20 70  6f 69 6e 74 65 72 20 77  |ws the pointer w|
00001e40  6f 62 62 6c 65 20 74 6f  20 62 65 22 0d 07 3a 3d  |obble to be"..:=|
00001e50  20 20 20 20 20 20 20 20  45 51 55 53 20 20 20 20  |        EQUS    |
00001e60  22 20 63 6f 6e 74 72 6f  6c 6c 65 64 20 62 79 20  |" controlled by |
00001e70  73 65 74 74 69 6e 67 20  74 68 72 65 65 20 63 6f  |setting three co|
00001e80  6e 73 74 61 6e 74 73 2e  22 0d 07 44 52 20 20 20  |nstants."..DR   |
00001e90  20 20 20 20 20 45 51 55  53 20 20 20 20 22 20 54  |     EQUS    " T|
00001ea0  68 65 73 65 20 61 72 65  20 61 6c 6c 20 73 70 65  |hese are all spe|
00001eb0  63 69 66 69 65 64 20 6f  6e 20 61 20 6c 6f 67 61  |cified on a loga|
00001ec0  72 69 74 68 6d 69 63 20  73 63 61 6c 65 20 69 6e  |rithmic scale in|
00001ed0  20 74 68 65 20 72 61 6e  67 65 22 0d 07 4e 44 20  | the range"..ND |
00001ee0  20 20 20 20 20 20 20 45  51 55 53 20 20 20 20 22  |       EQUS    "|
00001ef0  20 30 20 74 6f 20 31 30  2c 20 77 69 74 68 20 61  | 0 to 10, with a|
00001f00  20 76 61 6c 75 65 20 6f  66 20 35 20 62 65 69 6e  | value of 5 bein|
00001f10  67 20 74 68 65 20 64 65  66 61 75 6c 74 2e 22 0d  |g the default.".|
00001f20  07 58 16 20 20 20 20 20  20 20 20 45 51 55 42 20  |.X.        EQUB |
00001f30  20 20 20 31 33 0d 07 62  1a 2e 63 6f 6d 6d 61 6e  |   13..b..comman|
00001f40  64 5f 77 6f 62 62 6c 65  5f 73 79 6e 74 61 78 0d  |d_wobble_syntax.|
00001f50  07 6c 3d 20 20 20 20 20  20 20 20 45 51 55 53 20  |.l=        EQUS |
00001f60  20 20 20 22 53 79 6e 74  61 78 3a 20 2a 43 72 61  |   "Syntax: *Cra|
00001f70  7a 79 50 6f 69 6e 74 65  72 57 6f 62 62 6c 65 20  |zyPointerWobble |
00001f80  5b 2d 6e 6f 77 6f 62 62  6c 65 5d 22 0d 07 76 2c  |[-nowobble]"..v,|
00001f90  20 20 20 20 20 20 20 20  45 51 55 53 20 20 20 20  |        EQUS    |
00001fa0  22 20 5b 5b 2d 66 72 69  63 74 69 6f 6e 5d 20 3c  |" [[-friction] <|
00001fb0  76 61 6c 75 65 3e 5d 22  0d 07 80 2a 20 20 20 20  |value>]"...*    |
00001fc0  20 20 20 20 45 51 55 53  20 20 20 20 22 20 5b 5b  |    EQUS    " [[|
00001fd0  2d 73 70 72 69 6e 67 5d  20 3c 76 61 6c 75 65 3e  |-spring] <value>|
00001fe0  5d 22 0d 07 8a 29 20 20  20 20 20 20 20 20 45 51  |]"...)        EQ|
00001ff0  55 53 20 20 20 20 22 20  5b 5b 2d 66 6f 72 63 65  |US    " [[-force|
00002000  5d 20 3c 76 61 6c 75 65  3e 5d 22 0d 07 94 15 20  |] <value>]".... |
00002010  20 20 20 20 20 20 20 45  51 55 42 20 20 20 20 30  |       EQUB    0|
00002020  0d 07 9e 11 20 20 20 20  20 20 20 20 41 4c 49 47  |....        ALIG|
00002030  4e 0d 07 a8 04 0d 07 b2  21 20 20 20 20 20 20 20  |N.......!       |
00002040  20 3b 20 49 6e 69 74 69  61 6c 69 73 61 74 69 6f  | ; Initialisatio|
00002050  6e 20 63 6f 64 65 0d 07  bc 13 2e 69 6e 69 74 69  |n code.....initi|
00002060  61 6c 69 73 61 74 69 6f  6e 0d 07 c6 3d 20 20 20  |alisation...=   |
00002070  20 20 20 20 20 53 54 4d  46 44 20 20 20 72 31 33  |     STMFD   r13|
00002080  21 2c 20 7b 72 31 31 2c  20 72 31 34 7d 20 20 20  |!, {r11, r14}   |
00002090  20 20 20 20 20 3b 20 53  74 61 63 6b 20 72 65 67  |     ; Stack reg|
000020a0  69 73 74 65 72 73 0d 07  d0 49 20 20 20 20 20 20  |isters...I      |
000020b0  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 36  |  MOV     r0, #6|
000020c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000020d0  20 20 3b 20 52 65 61 73  6f 6e 20 63 6f 64 65 20  |  ; Reason code |
000020e0  74 6f 20 63 6c 61 69 6d  20 6d 65 6d 6f 72 79 0d  |to claim memory.|
000020f0  07 da 4c 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..L        MOV  |
00002100  20 20 20 72 33 2c 20 23  77 73 5f 73 69 7a 65 20  |   r3, #ws_size |
00002110  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 68 65  |           ; The|
00002120  20 73 69 7a 65 20 6f 66  20 77 6f 72 6b 73 70 61  | size of workspa|
00002130  63 65 20 72 65 71 75 69  72 65 64 0d 07 e4 49 20  |ce required...I |
00002140  20 20 20 20 20 20 20 53  57 49 20 20 20 20 20 22  |       SWI     "|
00002150  58 4f 53 5f 4d 6f 64 75  6c 65 22 20 20 20 20 20  |XOS_Module"     |
00002160  20 20 20 20 20 20 20 3b  20 43 6c 61 69 6d 20 73  |       ; Claim s|
00002170  6f 6d 65 20 6d 6f 64 75  6c 65 20 77 6f 72 6b 73  |ome module works|
00002180  70 61 63 65 0d 07 ee 44  20 20 20 20 20 20 20 20  |pace...D        |
00002190  4d 4f 56 56 53 20 20 20  72 30 2c 20 72 31 31 20  |MOVVS   r0, r11 |
000021a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000021b0  3b 20 43 6f 70 79 20 61  6e 79 20 65 72 72 6f 72  |; Copy any error|
000021c0  20 70 6f 69 6e 74 65 72  0d 07 f8 4b 20 20 20 20  | pointer...K    |
000021d0  20 20 20 20 42 56 53 20  20 20 20 20 66 61 69 6c  |    BVS     fail|
000021e0  5f 77 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |_ws             |
000021f0  20 20 20 20 3b 20 46 61  69 6c 20 69 66 20 61 6e  |    ; Fail if an|
00002200  20 65 72 72 6f 72 20 77  61 73 20 70 72 6f 64 75  | error was produ|
00002210  63 65 64 0d 08 02 45 20  20 20 20 20 20 20 20 53  |ced...E        S|
00002220  54 52 20 20 20 20 20 72  32 2c 20 5b 72 31 32 5d  |TR     r2, [r12]|
00002230  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002240  20 53 74 6f 72 65 20 77  6f 72 6b 73 70 61 63 65  | Store workspace|
00002250  20 70 6f 69 6e 74 65 72  0d 08 0c 48 20 20 20 20  | pointer...H    |
00002260  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 32 2c  |    MOV     r12,|
00002270  20 72 32 20 20 20 20 20  20 20 20 20 20 20 20 20  | r2             |
00002280  20 20 20 20 3b 20 43 6f  70 79 20 74 68 65 20 77  |    ; Copy the w|
00002290  6f 72 6b 73 70 61 63 65  20 70 6f 69 6e 74 65 72  |orkspace pointer|
000022a0  0d 08 16 47 20 20 20 20  20 20 20 20 4d 4f 56 20  |...G        MOV |
000022b0  20 20 20 20 72 30 2c 20  23 30 20 20 20 20 20 20  |    r0, #0      |
000022c0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 56 61  |            ; Va|
000022d0  6c 75 65 20 74 6f 20 63  6c 65 61 72 20 66 6c 61  |lue to clear fla|
000022e0  67 73 20 77 69 74 68 0d  08 20 4f 20 20 20 20 20  |gs with.. O     |
000022f0  20 20 20 53 54 52 20 20  20 20 20 72 30 2c 20 5b  |   STR     r0, [|
00002300  72 31 32 2c 20 23 77 73  5f 69 6e 74 65 72 6e 61  |r12, #ws_interna|
00002310  6c 5d 20 3b 20 43 6c 65  61 72 20 74 68 65 20 69  |l] ; Clear the i|
00002320  6e 74 65 72 6e 61 6c 20  6f 70 65 72 61 74 69 6f  |nternal operatio|
00002330  6e 20 66 6c 61 67 0d 08  2a 4e 20 20 20 20 20 20  |n flag..*N      |
00002340  20 20 53 54 52 42 20 20  20 20 72 30 2c 20 5b 72  |  STRB    r0, [r|
00002350  31 32 2c 20 23 77 73 5f  70 74 72 5f 62 6c 6f 63  |12, #ws_ptr_bloc|
00002360  6b 5d 3b 20 52 65 61 73  6f 6e 20 63 6f 64 65 20  |k]; Reason code |
00002370  74 6f 20 73 65 74 20 70  6f 69 6e 74 65 72 20 73  |to set pointer s|
00002380  68 61 70 65 0d 08 34 4e  20 20 20 20 20 20 20 20  |hape..4N        |
00002390  53 54 52 42 20 20 20 20  72 30 2c 20 5b 72 31 32  |STRB    r0, [r12|
000023a0  2c 20 23 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 5f  |, #ws_ptr_block_|
000023b0  61 63 74 69 76 65 78 5d  3b 20 53 74 6f 72 65 20  |activex]; Store |
000023c0  68 6f 72 69 7a 6f 6e 74  61 6c 20 68 6f 74 73 70  |horizontal hotsp|
000023d0  6f 74 0d 08 3e 4c 20 20  20 20 20 20 20 20 53 54  |ot..>L        ST|
000023e0  52 42 20 20 20 20 72 30  2c 20 5b 72 31 32 2c 20  |RB    r0, [r12, |
000023f0  23 77 73 5f 70 74 72 5f  62 6c 6f 63 6b 5f 61 63  |#ws_ptr_block_ac|
00002400  74 69 76 65 79 5d 3b 20  53 74 6f 72 65 20 76 65  |tivey]; Store ve|
00002410  72 74 69 63 61 6c 20 68  6f 74 73 70 6f 74 0d 08  |rtical hotspot..|
00002420  48 41 20 20 20 20 20 20  20 20 53 54 52 20 20 20  |HA        STR   |
00002430  20 20 72 30 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r0, [r12, #ws_|
00002440  66 69 6c 74 6e 5d 20 20  20 20 3b 20 49 6e 69 74  |filtn]    ; Init|
00002450  69 61 6c 6c 79 20 6e 6f  20 77 69 62 62 6c 65 0d  |ially no wibble.|
00002460  08 52 4a 20 20 20 20 20  20 20 20 53 54 52 20 20  |.RJ        STR  |
00002470  20 20 20 72 30 2c 20 5b  72 31 32 2c 20 23 77 73  |   r0, [r12, #ws|
00002480  5f 66 69 6c 74 76 5d 20  20 20 20 3b 20 49 6e 69  |_filtv]    ; Ini|
00002490  74 69 61 6c 6c 79 20 6e  6f 20 77 69 62 62 6c 65  |tially no wibble|
000024a0  20 76 65 6c 6f 63 69 74  79 0d 08 5c 47 20 20 20  | velocity..\G   |
000024b0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
000024c0  20 23 35 20 20 20 20 20  20 20 20 20 20 20 20 20  | #5             |
000024d0  20 20 20 20 20 3b 20 54  68 65 20 64 65 66 61 75  |     ; The defau|
000024e0  6c 74 20 63 6f 6e 66 69  67 75 72 61 74 69 6f 6e  |lt configuration|
000024f0  0d 08 66 42 20 20 20 20  20 20 20 20 53 54 52 20  |..fB        STR |
00002500  20 20 20 20 72 30 2c 20  5b 72 31 32 2c 20 23 77  |    r0, [r12, #w|
00002510  73 5f 66 72 69 63 74 69  6f 6e 5d 20 3b 20 54 68  |s_friction] ; Th|
00002520  65 20 64 65 66 61 75 6c  74 20 66 72 69 63 74 69  |e default fricti|
00002530  6f 6e 0d 08 70 49 20 20  20 20 20 20 20 20 53 54  |on..pI        ST|
00002540  52 20 20 20 20 20 72 30  2c 20 5b 72 31 32 2c 20  |R     r0, [r12, |
00002550  23 77 73 5f 73 70 72 69  6e 67 5d 20 20 20 3b 20  |#ws_spring]   ; |
00002560  54 68 65 20 64 65 66 61  75 6c 74 20 73 70 72 69  |The default spri|
00002570  6e 67 20 73 74 72 65 6e  67 74 68 0d 08 7a 3f 20  |ng strength..z? |
00002580  20 20 20 20 20 20 20 53  54 52 20 20 20 20 20 72  |       STR     r|
00002590  30 2c 20 5b 72 31 32 2c  20 23 77 73 5f 66 6f 72  |0, [r12, #ws_for|
000025a0  63 65 5d 20 20 20 20 3b  20 54 68 65 20 64 65 66  |ce]    ; The def|
000025b0  61 75 6c 74 20 66 6f 72  63 65 0d 08 84 47 20 20  |ault force...G  |
000025c0  20 20 20 20 20 20 4d 56  4e 20 20 20 20 20 72 30  |      MVN     r0|
000025d0  2c 20 23 26 39 66 30 30  30 20 20 20 20 20 20 20  |, #&9f000       |
000025e0  20 20 20 20 20 20 3b 20  49 6e 69 74 69 61 6c 20  |      ; Initial |
000025f0  63 65 6e 74 72 65 20 72  6f 77 20 6f 66 66 73 65  |centre row offse|
00002600  74 0d 08 8e 4a 20 20 20  20 20 20 20 20 53 54 52  |t...J        STR|
00002610  20 20 20 20 20 72 30 2c  20 5b 72 31 32 2c 20 23  |     r0, [r12, #|
00002620  77 73 5f 63 6f 67 72 5d  20 20 20 20 20 3b 20 49  |ws_cogr]     ; I|
00002630  6e 69 74 69 61 6c 20 72  6f 77 20 6f 66 66 73 65  |nitial row offse|
00002640  74 20 74 6f 20 63 65 6e  74 72 65 0d 08 98 4a 20  |t to centre...J |
00002650  20 20 20 20 20 20 20 4d  56 4e 20 20 20 20 20 72  |       MVN     r|
00002660  30 2c 20 23 26 34 61 30  30 30 20 20 20 20 20 20  |0, #&4a000      |
00002670  20 20 20 20 20 20 20 3b  20 49 6e 69 74 69 61 6c  |       ; Initial|
00002680  20 63 65 6e 74 72 65 20  63 6f 6c 75 6d 6e 20 6f  | centre column o|
00002690  66 66 73 65 74 0d 08 a2  4d 20 20 20 20 20 20 20  |ffset...M       |
000026a0  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
000026b0  32 2c 20 23 77 73 5f 63  6f 67 63 5d 20 20 20 20  |2, #ws_cogc]    |
000026c0  20 3b 20 49 6e 69 74 69  61 6c 20 63 6f 6c 75 6d  | ; Initial colum|
000026d0  6e 20 6f 66 66 73 65 74  20 74 6f 20 63 65 6e 74  |n offset to cent|
000026e0  72 65 0d 08 ac 51 20 20  20 20 20 20 20 20 4d 4f  |re...Q        MO|
000026f0  56 20 20 20 20 20 72 30  2c 20 23 70 74 72 5f 75  |V     r0, #ptr_u|
00002700  6e 6b 6e 6f 77 6e 20 20  20 20 20 20 20 20 3b 20  |nknown        ; |
00002710  4d 6f 73 74 20 70 6f 69  6e 74 65 72 73 20 61 72  |Most pointers ar|
00002720  65 20 75 6e 6b 6e 6f 77  6e 20 69 6e 69 74 69 61  |e unknown initia|
00002730  6c 6c 79 0d 08 b6 46 20  20 20 20 20 20 20 20 53  |lly...F        S|
00002740  54 52 42 20 20 20 20 72  30 2c 20 5b 72 31 32 2c  |TRB    r0, [r12,|
00002750  20 23 77 73 5f 74 79 70  65 73 5d 20 20 20 20 3b  | #ws_types]    ;|
00002760  20 53 68 61 70 65 20 30  20 69 73 20 6e 6f 74 20  | Shape 0 is not |
00002770  61 20 70 6f 69 6e 74 65  72 0d 08 c0 40 20 20 20  |a pointer...@   |
00002780  20 20 20 20 20 53 54 52  42 20 20 20 20 72 30 2c  |     STRB    r0,|
00002790  20 5b 72 31 32 2c 20 23  77 73 5f 74 79 70 65 73  | [r12, #ws_types|
000027a0  20 2b 20 32 5d 3b 20 53  68 61 70 65 20 32 20 69  | + 2]; Shape 2 i|
000027b0  73 20 75 6e 6b 6e 6f 77  6e 0d 08 ca 40 20 20 20  |s unknown...@   |
000027c0  20 20 20 20 20 53 54 52  42 20 20 20 20 72 30 2c  |     STRB    r0,|
000027d0  20 5b 72 31 32 2c 20 23  77 73 5f 74 79 70 65 73  | [r12, #ws_types|
000027e0  20 2b 20 33 5d 3b 20 53  68 61 70 65 20 33 20 69  | + 3]; Shape 3 i|
000027f0  73 20 75 6e 6b 6e 6f 77  6e 0d 08 d4 40 20 20 20  |s unknown...@   |
00002800  20 20 20 20 20 53 54 52  42 20 20 20 20 72 30 2c  |     STRB    r0,|
00002810  20 5b 72 31 32 2c 20 23  77 73 5f 74 79 70 65 73  | [r12, #ws_types|
00002820  20 2b 20 34 5d 3b 20 53  68 61 70 65 20 34 20 69  | + 4]; Shape 4 i|
00002830  73 20 75 6e 6b 6e 6f 77  6e 0d 08 de 4a 20 20 20  |s unknown...J   |
00002840  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
00002850  20 23 70 74 72 5f 73 69  6e 67 6c 65 20 20 20 20  | #ptr_single    |
00002860  20 20 20 20 20 3b 20 54  68 65 20 73 74 61 6e 64  |     ; The stand|
00002870  61 72 64 20 64 65 73 6b  74 6f 70 20 70 6f 69 6e  |ard desktop poin|
00002880  74 65 72 0d 08 e8 50 20  20 20 20 20 20 20 20 53  |ter...P        S|
00002890  54 52 42 20 20 20 20 72  30 2c 20 5b 72 31 32 2c  |TRB    r0, [r12,|
000028a0  20 23 77 73 5f 74 79 70  65 73 20 2b 20 31 5d 3b  | #ws_types + 1];|
000028b0  20 41 73 73 75 6d 65 20  73 68 61 70 65 20 31 20  | Assume shape 1 |
000028c0  69 73 20 74 68 65 20 73  74 61 6e 64 61 72 64 20  |is the standard |
000028d0  6f 6e 65 0d 08 f2 47 20  20 20 20 20 20 20 20 4d  |one...G        M|
000028e0  4f 56 20 20 20 20 20 72  30 2c 20 23 38 20 20 20  |OV     r0, #8   |
000028f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002900  20 57 69 64 74 68 20 6f  66 20 70 6f 69 6e 74 65  | Width of pointe|
00002910  72 20 69 6e 20 62 79 74  65 73 0d 08 fc 4a 20 20  |r in bytes...J  |
00002920  20 20 20 20 20 20 53 54  52 42 20 20 20 20 72 30  |      STRB    r0|
00002930  2c 20 5b 72 31 32 2c 20  23 77 73 5f 70 74 72 5f  |, [r12, #ws_ptr_|
00002940  62 6c 6f 63 6b 5f 77 69  64 74 68 5d 3b 20 53 74  |block_width]; St|
00002950  6f 72 65 20 77 69 64 74  68 20 6f 66 20 70 6f 69  |ore width of poi|
00002960  6e 74 65 72 0d 09 06 49  20 20 20 20 20 20 20 20  |nter...I        |
00002970  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 33 32 20  |MOV     r0, #32 |
00002980  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002990  3b 20 48 65 69 67 68 74  20 6f 66 20 70 6f 69 6e  |; Height of poin|
000029a0  74 65 72 20 69 6e 20 70  69 78 65 6c 73 0d 09 10  |ter in pixels...|
000029b0  4c 20 20 20 20 20 20 20  20 53 54 52 42 20 20 20  |L        STRB   |
000029c0  20 72 30 2c 20 5b 72 31  32 2c 20 23 77 73 5f 70  | r0, [r12, #ws_p|
000029d0  74 72 5f 62 6c 6f 63 6b  5f 68 65 69 67 68 74 5d  |tr_block_height]|
000029e0  3b 20 53 74 6f 72 65 20  68 65 69 67 68 74 20 6f  |; Store height o|
000029f0  66 20 70 6f 69 6e 74 65  72 0d 09 1a 4d 20 20 20  |f pointer...M   |
00002a00  20 20 20 20 20 41 44 44  20 20 20 20 20 72 30 2c  |     ADD     r0,|
00002a10  20 72 31 32 2c 20 23 77  73 5f 70 74 72 5f 64 61  | r12, #ws_ptr_da|
00002a20  74 61 20 20 20 3b 20 50  6f 69 6e 74 65 72 20 74  |ta   ; Pointer t|
00002a30  6f 20 70 6f 69 6e 74 65  72 20 64 61 74 61 20 20  |o pointer data  |
00002a40  20 20 20 20 20 20 0d 09  24 4c 20 20 20 20 20 20  |      ..$L      |
00002a50  20 20 53 54 52 20 20 20  20 20 72 30 2c 20 5b 72  |  STR     r0, [r|
00002a60  31 32 2c 20 23 77 73 5f  70 74 72 5f 62 6c 6f 63  |12, #ws_ptr_bloc|
00002a70  6b 5f 64 61 74 61 5d 3b  20 53 74 6f 72 65 20 70  |k_data]; Store p|
00002a80  6f 69 6e 74 65 72 20 74  6f 20 74 68 65 20 64 61  |ointer to the da|
00002a90  74 61 0d 09 2e 52 20 20  20 20 20 20 20 20 4d 4f  |ta...R        MO|
00002aa0  56 20 20 20 20 20 72 30  2c 20 23 32 31 20 20 20  |V     r0, #21   |
00002ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00002ac0  52 65 61 73 6f 6e 20 63  6f 64 65 20 74 6f 20 72  |Reason code to r|
00002ad0  65 61 64 20 70 6f 69 6e  74 65 72 20 70 6f 73 69  |ead pointer posi|
00002ae0  74 69 6f 6e 0d 09 38 41  20 20 20 20 20 20 20 20  |tion..8A        |
00002af0  41 44 44 20 20 20 20 20  72 31 2c 20 72 31 32 2c  |ADD     r1, r12,|
00002b00  20 23 77 73 5f 62 75 66  66 65 72 20 20 20 20 20  | #ws_buffer     |
00002b10  3b 20 50 6f 69 6e 74 65  72 20 74 6f 20 61 20 62  |; Pointer to a b|
00002b20  75 66 66 65 72 0d 09 42  52 20 20 20 20 20 20 20  |uffer..BR       |
00002b30  20 4d 4f 56 20 20 20 20  20 72 32 2c 20 23 36 20  | MOV     r2, #6 |
00002b40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002b50  20 3b 20 52 65 61 73 6f  6e 20 63 6f 64 65 20 74  | ; Reason code t|
00002b60  6f 20 72 65 61 64 20 70  6f 69 6e 74 65 72 20 70  |o read pointer p|
00002b70  6f 73 69 74 69 6f 6e 0d  09 4c 49 20 20 20 20 20  |osition..LI     |
00002b80  20 20 20 53 54 52 42 20  20 20 20 72 32 2c 20 5b  |   STRB    r2, [|
00002b90  72 31 5d 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1]             |
00002ba0  20 20 20 3b 20 53 74 6f  72 65 20 72 65 61 73 6f  |   ; Store reaso|
00002bb0  6e 20 63 6f 64 65 20 69  6e 20 62 75 66 66 65 72  |n code in buffer|
00002bc0  0d 09 56 43 20 20 20 20  20 20 20 20 53 57 49 20  |..VC        SWI |
00002bd0  20 20 20 20 22 58 4f 53  5f 57 6f 72 64 22 20 20  |    "XOS_Word"  |
00002be0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
00002bf0  61 64 20 70 6f 69 6e 74  65 72 20 70 6f 73 69 74  |ad pointer posit|
00002c00  69 6f 6e 0d 09 60 44 20  20 20 20 20 20 20 20 4d  |ion..`D        M|
00002c10  4f 56 56 53 20 20 20 72  30 2c 20 72 31 31 20 20  |OVVS   r0, r11  |
00002c20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00002c30  20 43 6f 70 79 20 61 6e  79 20 65 72 72 6f 72 20  | Copy any error |
00002c40  70 6f 69 6e 74 65 72 0d  09 6a 4b 20 20 20 20 20  |pointer..jK     |
00002c50  20 20 20 42 56 53 20 20  20 20 20 66 61 69 6c 5f  |   BVS     fail_|
00002c60  70 6f 73 69 74 69 6f 6e  20 20 20 20 20 20 20 20  |position        |
00002c70  20 20 20 3b 20 46 61 69  6c 20 69 66 20 61 6e 20  |   ; Fail if an |
00002c80  65 72 72 6f 72 20 77 61  73 20 70 72 6f 64 75 63  |error was produc|
00002c90  65 64 0d 09 74 4d 20 20  20 20 20 20 20 20 4c 44  |ed..tM        LD|
00002ca0  52 42 20 20 20 20 72 32  2c 20 5b 72 31 2c 20 23  |RB    r2, [r1, #|
00002cb0  31 5d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |1]            ; |
00002cc0  52 65 61 64 20 4c 53 42  20 6f 66 20 68 6f 72 69  |Read LSB of hori|
00002cd0  7a 6f 6e 74 61 6c 20 70  6f 73 69 74 69 6f 6e 0d  |zontal position.|
00002ce0  09 7e 4d 20 20 20 20 20  20 20 20 4c 44 52 42 20  |.~M        LDRB |
00002cf0  20 20 20 72 33 2c 20 5b  72 31 2c 20 23 32 5d 20  |   r3, [r1, #2] |
00002d00  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
00002d10  64 20 4d 53 42 20 6f 66  20 68 6f 72 69 7a 6f 6e  |d MSB of horizon|
00002d20  74 61 6c 20 70 6f 73 69  74 69 6f 6e 0d 09 88 48  |tal position...H|
00002d30  20 20 20 20 20 20 20 20  84 52 20 20 20 20 20 72  |        .R     r|
00002d40  32 2c 20 72 32 2c 20 72  33 2c 20 41 53 4c 23 38  |2, r2, r3, ASL#8|
00002d50  20 20 20 20 20 20 20 3b  20 43 6f 6d 62 69 6e 65  |       ; Combine|
00002d60  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 70 6f 73 69  | horizontal posi|
00002d70  74 69 6f 6e 0d 09 92 4e  20 20 20 20 20 20 20 20  |tion...N        |
00002d80  4d 4f 56 20 20 20 20 20  72 32 2c 20 72 32 2c 20  |MOV     r2, r2, |
00002d90  41 53 4c 23 31 36 20 20  20 20 20 20 20 20 20 20  |ASL#16          |
00002da0  3b 20 53 63 61 6c 65 20  74 68 65 20 68 6f 72 69  |; Scale the hori|
00002db0  7a 6f 6e 74 61 6c 20 70  6f 73 69 74 69 6f 6e 20  |zontal position |
00002dc0  75 70 0d 09 9c 53 20 20  20 20 20 20 20 20 53 54  |up...S        ST|
00002dd0  52 20 20 20 20 20 72 32  2c 20 5b 72 31 32 2c 20  |R     r2, [r12, |
00002de0  23 77 73 5f 68 70 6f 73  5d 20 20 20 20 20 3b 20  |#ws_hpos]     ; |
00002df0  53 74 6f 72 65 20 74 68  65 20 69 6e 69 74 69 61  |Store the initia|
00002e00  6c 20 68 6f 72 69 7a 6f  6e 74 61 6c 20 70 6f 73  |l horizontal pos|
00002e10  69 74 69 6f 6e 0d 09 a6  4b 20 20 20 20 20 20 20  |ition...K       |
00002e20  20 4c 44 52 42 20 20 20  20 72 32 2c 20 5b 72 31  | LDRB    r2, [r1|
00002e30  2c 20 23 33 5d 20 20 20  20 20 20 20 20 20 20 20  |, #3]           |
00002e40  20 3b 20 52 65 61 64 20  4c 53 42 20 6f 66 20 76  | ; Read LSB of v|
00002e50  65 72 74 69 63 61 6c 20  70 6f 73 69 74 69 6f 6e  |ertical position|
00002e60  0d 09 b0 4b 20 20 20 20  20 20 20 20 4c 44 52 42  |...K        LDRB|
00002e70  20 20 20 20 72 33 2c 20  5b 72 31 2c 20 23 34 5d  |    r3, [r1, #4]|
00002e80  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
00002e90  61 64 20 4d 53 42 20 6f  66 20 76 65 72 74 69 63  |ad MSB of vertic|
00002ea0  61 6c 20 70 6f 73 69 74  69 6f 6e 0d 09 ba 46 20  |al position...F |
00002eb0  20 20 20 20 20 20 20 84  52 20 20 20 20 20 72 32  |       .R     r2|
00002ec0  2c 20 72 32 2c 20 72 33  2c 20 41 53 4c 23 38 20  |, r2, r3, ASL#8 |
00002ed0  20 20 20 20 20 20 3b 20  43 6f 6d 62 69 6e 65 20  |      ; Combine |
00002ee0  76 65 72 74 69 63 61 6c  20 70 6f 73 69 74 69 6f  |vertical positio|
00002ef0  6e 0d 09 c4 4c 20 20 20  20 20 20 20 20 4d 4f 56  |n...L        MOV|
00002f00  20 20 20 20 20 72 32 2c  20 72 32 2c 20 41 53 4c  |     r2, r2, ASL|
00002f10  23 31 36 20 20 20 20 20  20 20 20 20 20 3b 20 53  |#16          ; S|
00002f20  63 61 6c 65 20 74 68 65  20 76 65 72 74 69 63 61  |cale the vertica|
00002f30  6c 20 70 6f 73 69 74 69  6f 6e 20 75 70 0d 09 ce  |l position up...|
00002f40  51 20 20 20 20 20 20 20  20 53 54 52 20 20 20 20  |Q        STR    |
00002f50  20 72 32 2c 20 5b 72 31  32 2c 20 23 77 73 5f 76  | r2, [r12, #ws_v|
00002f60  70 6f 73 5d 20 20 20 20  20 3b 20 53 74 6f 72 65  |pos]     ; Store|
00002f70  20 74 68 65 20 69 6e 69  74 69 61 6c 20 76 65 72  | the initial ver|
00002f80  74 69 63 61 6c 20 70 6f  73 69 74 69 6f 6e 0d 09  |tical position..|
00002f90  d8 45 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |.E        BL    |
00002fa0  20 20 72 65 61 64 5f 76  64 75 20 20 20 20 20 20  |  read_vdu      |
00002fb0  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 64  |          ; Read|
00002fc0  20 74 68 65 20 70 69 78  65 6c 20 73 63 61 6c 69  | the pixel scali|
00002fd0  6e 67 73 0d 09 e2 44 20  20 20 20 20 20 20 20 4d  |ngs...D        M|
00002fe0  4f 56 56 53 20 20 20 72  30 2c 20 72 31 31 20 20  |OVVS   r0, r11  |
00002ff0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003000  20 43 6f 70 79 20 61 6e  79 20 65 72 72 6f 72 20  | Copy any error |
00003010  70 6f 69 6e 74 65 72 0d  09 ec 4b 20 20 20 20 20  |pointer...K     |
00003020  20 20 20 42 56 53 20 20  20 20 20 66 61 69 6c 5f  |   BVS     fail_|
00003030  76 64 75 20 20 20 20 20  20 20 20 20 20 20 20 20  |vdu             |
00003040  20 20 20 3b 20 46 61 69  6c 20 69 66 20 61 6e 20  |   ; Fail if an |
00003050  65 72 72 6f 72 20 77 61  73 20 70 72 6f 64 75 63  |error was produc|
00003060  65 64 0d 09 f6 49 20 20  20 20 20 20 20 20 4d 4f  |ed...I        MO|
00003070  56 20 20 20 20 20 72 30  2c 20 23 26 31 30 20 20  |V     r0, #&10  |
00003080  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003090  4e 75 6d 62 65 72 20 6f  66 20 74 68 65 20 45 76  |Number of the Ev|
000030a0  65 6e 74 56 20 76 65 63  74 6f 72 0d 0a 00 4c 20  |entV vector...L |
000030b0  20 20 20 20 20 20 20 41  44 52 20 20 20 20 20 72  |       ADR     r|
000030c0  31 2c 20 65 76 65 6e 74  76 5f 68 61 6e 64 6c 65  |1, eventv_handle|
000030d0  72 20 20 20 20 20 20 3b  20 41 64 64 72 65 73 73  |r      ; Address|
000030e0  20 6f 66 20 74 68 65 20  68 61 6e 64 6c 65 72 20  | of the handler |
000030f0  72 6f 75 74 69 6e 65 0d  0a 0a 4e 20 20 20 20 20  |routine...N     |
00003100  20 20 20 4d 4f 56 20 20  20 20 20 72 32 2c 20 72  |   MOV     r2, r|
00003110  31 32 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |12              |
00003120  20 20 20 3b 20 56 61 6c  75 65 20 6f 66 20 72 31  |   ; Value of r1|
00003130  32 20 75 73 65 64 20 62  79 20 74 68 65 20 68 61  |2 used by the ha|
00003140  6e 64 6c 65 72 0d 0a 14  44 20 20 20 20 20 20 20  |ndler...D       |
00003150  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 43 6c  | SWI     "XOS_Cl|
00003160  61 69 6d 22 20 20 20 20  20 20 20 20 20 20 20 20  |aim"            |
00003170  20 3b 20 43 6c 61 69 6d  20 74 68 65 20 65 76 65  | ; Claim the eve|
00003180  6e 74 20 76 65 63 74 6f  72 0d 0a 1e 44 20 20 20  |nt vector...D   |
00003190  20 20 20 20 20 4d 4f 56  56 53 20 20 20 72 30 2c  |     MOVVS   r0,|
000031a0  20 72 31 31 20 20 20 20  20 20 20 20 20 20 20 20  | r11            |
000031b0  20 20 20 20 20 3b 20 43  6f 70 79 20 61 6e 79 20  |     ; Copy any |
000031c0  65 72 72 6f 72 20 70 6f  69 6e 74 65 72 0d 0a 28  |error pointer..(|
000031d0  4b 20 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K        BVS    |
000031e0  20 66 61 69 6c 5f 65 76  65 6e 74 76 20 20 20 20  | fail_eventv    |
000031f0  20 20 20 20 20 20 20 20  20 3b 20 46 61 69 6c 20  |         ; Fail |
00003200  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
00003210  70 72 6f 64 75 63 65 64  0d 0a 32 4a 20 20 20 20  |produced..2J    |
00003220  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00003230  23 26 31 66 20 20 20 20  20 20 20 20 20 20 20 20  |#&1f            |
00003240  20 20 20 20 3b 20 4e 75  6d 62 65 72 20 6f 66 20  |    ; Number of |
00003250  74 68 65 20 53 70 72 69  74 65 56 20 76 65 63 74  |the SpriteV vect|
00003260  6f 72 0d 0a 3c 4c 20 20  20 20 20 20 20 20 41 44  |or..<L        AD|
00003270  52 20 20 20 20 20 72 31  2c 20 73 70 72 69 74 65  |R     r1, sprite|
00003280  76 5f 68 61 6e 64 6c 65  72 20 20 20 20 20 3b 20  |v_handler     ; |
00003290  41 64 64 72 65 73 73 20  6f 66 20 74 68 65 20 68  |Address of the h|
000032a0  61 6e 64 6c 65 72 20 72  6f 75 74 69 6e 65 0d 0a  |andler routine..|
000032b0  46 4e 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |FN        MOV   |
000032c0  20 20 72 32 2c 20 72 31  32 20 20 20 20 20 20 20  |  r2, r12       |
000032d0  20 20 20 20 20 20 20 20  20 20 3b 20 56 61 6c 75  |          ; Valu|
000032e0  65 20 6f 66 20 72 31 32  20 75 73 65 64 20 62 79  |e of r12 used by|
000032f0  20 74 68 65 20 68 61 6e  64 6c 65 72 0d 0a 50 4a  | the handler..PJ|
00003300  20 20 20 20 20 20 20 20  53 57 49 20 20 20 20 20  |        SWI     |
00003310  22 58 4f 53 5f 43 6c 61  69 6d 22 20 20 20 20 20  |"XOS_Claim"     |
00003320  20 20 20 20 20 20 20 20  3b 20 43 6c 61 69 6d 20  |        ; Claim |
00003330  74 68 65 20 4f 53 5f 53  70 72 69 74 65 4f 70 20  |the OS_SpriteOp |
00003340  76 65 63 74 6f 72 0d 0a  5a 44 20 20 20 20 20 20  |vector..ZD      |
00003350  20 20 4d 4f 56 56 53 20  20 20 72 30 2c 20 72 31  |  MOVVS   r0, r1|
00003360  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
00003370  20 20 3b 20 43 6f 70 79  20 61 6e 79 20 65 72 72  |  ; Copy any err|
00003380  6f 72 20 70 6f 69 6e 74  65 72 0d 0a 64 4b 20 20  |or pointer..dK  |
00003390  20 20 20 20 20 20 42 56  53 20 20 20 20 20 66 61  |      BVS     fa|
000033a0  69 6c 5f 73 70 72 69 74  65 76 20 20 20 20 20 20  |il_spritev      |
000033b0  20 20 20 20 20 20 3b 20  46 61 69 6c 20 69 66 20  |      ; Fail if |
000033c0  61 6e 20 65 72 72 6f 72  20 77 61 73 20 70 72 6f  |an error was pro|
000033d0  64 75 63 65 64 0d 0a 6e  48 20 20 20 20 20 20 20  |duced..nH       |
000033e0  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 26 30  | MOV     r0, #&0|
000033f0  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00003400  20 3b 20 4e 75 6d 62 65  72 20 6f 66 20 74 68 65  | ; Number of the|
00003410  20 57 6f 72 64 56 20 76  65 63 74 6f 72 0d 0a 78  | WordV vector..x|
00003420  4c 20 20 20 20 20 20 20  20 41 44 52 20 20 20 20  |L        ADR    |
00003430  20 72 31 2c 20 77 6f 72  64 76 5f 68 61 6e 64 6c  | r1, wordv_handl|
00003440  65 72 20 20 20 20 20 20  20 3b 20 41 64 64 72 65  |er       ; Addre|
00003450  73 73 20 6f 66 20 74 68  65 20 68 61 6e 64 6c 65  |ss of the handle|
00003460  72 20 72 6f 75 74 69 6e  65 0d 0a 82 4e 20 20 20  |r routine...N   |
00003470  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 32 2c  |     MOV     r2,|
00003480  20 72 31 32 20 20 20 20  20 20 20 20 20 20 20 20  | r12            |
00003490  20 20 20 20 20 3b 20 56  61 6c 75 65 20 6f 66 20  |     ; Value of |
000034a0  72 31 32 20 75 73 65 64  20 62 79 20 74 68 65 20  |r12 used by the |
000034b0  68 61 6e 64 6c 65 72 0d  0a 8c 46 20 20 20 20 20  |handler...F     |
000034c0  20 20 20 53 57 49 20 20  20 20 20 22 58 4f 53 5f  |   SWI     "XOS_|
000034d0  43 6c 61 69 6d 22 20 20  20 20 20 20 20 20 20 20  |Claim"          |
000034e0  20 20 20 3b 20 43 6c 61  69 6d 20 74 68 65 20 4f  |   ; Claim the O|
000034f0  53 5f 57 6f 72 64 20 76  65 63 74 6f 72 0d 0a 96  |S_Word vector...|
00003500  44 20 20 20 20 20 20 20  20 4d 4f 56 56 53 20 20  |D        MOVVS  |
00003510  20 72 30 2c 20 72 31 31  20 20 20 20 20 20 20 20  | r0, r11        |
00003520  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
00003530  61 6e 79 20 65 72 72 6f  72 20 70 6f 69 6e 74 65  |any error pointe|
00003540  72 0d 0a a0 4b 20 20 20  20 20 20 20 20 42 56 53  |r...K        BVS|
00003550  20 20 20 20 20 66 61 69  6c 5f 77 6f 72 64 76 20  |     fail_wordv |
00003560  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 46  |             ; F|
00003570  61 69 6c 20 69 66 20 61  6e 20 65 72 72 6f 72 20  |ail if an error |
00003580  77 61 73 20 70 72 6f 64  75 63 65 64 0d 0a aa 4d  |was produced...M|
00003590  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
000035a0  72 30 2c 20 23 31 34 20  20 20 20 20 20 20 20 20  |r0, #14         |
000035b0  20 20 20 20 20 20 20 20  3b 20 4f 53 5f 42 79 74  |        ; OS_Byt|
000035c0  65 20 63 6f 64 65 20 74  6f 20 65 6e 61 62 6c 65  |e code to enable|
000035d0  20 61 6e 20 65 76 65 6e  74 0d 0a b4 44 20 20 20  | an event...D   |
000035e0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
000035f0  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | #4             |
00003600  20 20 20 20 20 3b 20 54  68 65 20 76 73 79 6e 63  |     ; The vsync|
00003610  20 65 76 65 6e 74 20 6e  75 6d 62 65 72 0d 0a be  | event number...|
00003620  4c 20 20 20 20 20 20 20  20 53 57 49 20 20 20 20  |L        SWI    |
00003630  20 22 58 4f 53 5f 42 79  74 65 22 20 20 20 20 20  | "XOS_Byte"     |
00003640  20 20 20 20 20 20 20 20  20 3b 20 45 6e 61 62 6c  |         ; Enabl|
00003650  65 20 74 68 65 20 76 65  72 74 69 63 61 6c 20 73  |e the vertical s|
00003660  79 6e 63 20 65 76 65 6e  74 0d 0a c8 44 20 20 20  |ync event...D   |
00003670  20 20 20 20 20 4d 4f 56  56 53 20 20 20 72 30 2c  |     MOVVS   r0,|
00003680  20 72 31 31 20 20 20 20  20 20 20 20 20 20 20 20  | r11            |
00003690  20 20 20 20 20 3b 20 43  6f 70 79 20 61 6e 79 20  |     ; Copy any |
000036a0  65 72 72 6f 72 20 70 6f  69 6e 74 65 72 0d 0a d2  |error pointer...|
000036b0  4b 20 20 20 20 20 20 20  20 42 56 53 20 20 20 20  |K        BVS    |
000036c0  20 66 61 69 6c 5f 76 73  79 6e 63 20 20 20 20 20  | fail_vsync     |
000036d0  20 20 20 20 20 20 20 20  20 3b 20 46 61 69 6c 20  |         ; Fail |
000036e0  69 66 20 61 6e 20 65 72  72 6f 72 20 77 61 73 20  |if an error was |
000036f0  70 72 6f 64 75 63 65 64  0d 0a dc 3f 20 20 20 20  |produced...?    |
00003700  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
00003710  2c 20 7b 72 31 31 2c 20  70 63 7d 20 20 20 20 20  |, {r11, pc}     |
00003720  20 20 20 20 3b 20 52 65  74 75 72 6e 20 74 6f 20  |    ; Return to |
00003730  52 49 53 43 20 4f 53 0d  0a e6 04 0d 0a f0 1f 20  |RISC OS........ |
00003740  20 20 20 20 20 20 20 3b  20 46 69 6e 61 6c 69 73  |       ; Finalis|
00003750  61 74 69 6f 6e 20 63 6f  64 65 0d 0a fa 11 2e 66  |ation code.....f|
00003760  69 6e 61 6c 69 73 61 74  69 6f 6e 0d 0b 04 3d 20  |inalisation...= |
00003770  20 20 20 20 20 20 20 53  54 4d 46 44 20 20 20 72  |       STMFD   r|
00003780  31 33 21 2c 20 7b 72 31  31 2c 20 72 31 34 7d 20  |13!, {r11, r14} |
00003790  20 20 20 20 20 20 20 3b  20 53 74 61 63 6b 20 72  |       ; Stack r|
000037a0  65 67 69 73 74 65 72 73  0d 0b 0e 46 20 20 20 20  |egisters...F    |
000037b0  20 20 20 20 4c 44 52 20  20 20 20 20 72 31 32 2c  |    LDR     r12,|
000037c0  20 5b 72 31 32 5d 20 20  20 20 20 20 20 20 20 20  | [r12]          |
000037d0  20 20 20 20 3b 20 4f 62  74 61 69 6e 20 77 6f 72  |    ; Obtain wor|
000037e0  6b 73 70 61 63 65 20 70  6f 69 6e 74 65 72 0d 0b  |kspace pointer..|
000037f0  18 45 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.E        MOV   |
00003800  20 20 72 31 31 2c 20 23  30 20 20 20 20 20 20 20  |  r11, #0       |
00003810  20 20 20 20 20 20 20 20  20 20 3b 20 43 6c 65 61  |          ; Clea|
00003820  72 20 74 68 65 20 65 72  72 6f 72 20 70 6f 69 6e  |r the error poin|
00003830  74 65 72 0d 0b 22 4e 20  20 20 20 20 20 20 20 4d  |ter.."N        M|
00003840  4f 56 20 20 20 20 20 72  30 2c 20 23 31 33 20 20  |OV     r0, #13  |
00003850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003860  20 4f 53 5f 42 79 74 65  20 63 6f 64 65 20 74 6f  | OS_Byte code to|
00003870  20 64 69 73 61 62 6c 65  20 61 6e 20 65 76 65 6e  | disable an even|
00003880  74 0d 0b 2c 44 20 20 20  20 20 20 20 20 4d 4f 56  |t..,D        MOV|
00003890  20 20 20 20 20 72 31 2c  20 23 34 20 20 20 20 20  |     r1, #4     |
000038a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 54  |             ; T|
000038b0  68 65 20 76 73 79 6e 63  20 65 76 65 6e 74 20 6e  |he vsync event n|
000038c0  75 6d 62 65 72 0d 0b 36  4d 20 20 20 20 20 20 20  |umber..6M       |
000038d0  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 42 79  | SWI     "XOS_By|
000038e0  74 65 22 20 20 20 20 20  20 20 20 20 20 20 20 20  |te"             |
000038f0  20 3b 20 44 69 73 61 62  6c 65 20 74 68 65 20 76  | ; Disable the v|
00003900  65 72 74 69 63 61 6c 20  73 79 6e 63 20 65 76 65  |ertical sync eve|
00003910  6e 74 0d 0b 40 4b 20 20  20 20 20 20 20 20 42 56  |nt..@K        BV|
00003920  53 20 20 20 20 20 65 78  69 74 20 20 20 20 20 20  |S     exit      |
00003930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00003940  45 78 69 74 20 69 66 20  61 6e 20 65 72 72 6f 72  |Exit if an error|
00003950  20 77 61 73 20 70 72 6f  64 75 63 65 64 0d 0b 4a  | was produced..J|
00003960  0f 2e 66 61 69 6c 5f 76  73 79 6e 63 0d 0b 54 48  |..fail_vsync..TH|
00003970  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00003980  72 30 2c 20 23 26 30 37  20 20 20 20 20 20 20 20  |r0, #&07        |
00003990  20 20 20 20 20 20 20 20  3b 20 4e 75 6d 62 65 72  |        ; Number|
000039a0  20 6f 66 20 74 68 65 20  57 6f 72 64 56 20 76 65  | of the WordV ve|
000039b0  63 74 6f 72 0d 0b 5e 4c  20 20 20 20 20 20 20 20  |ctor..^L        |
000039c0  41 44 52 20 20 20 20 20  72 31 2c 20 77 6f 72 64  |ADR     r1, word|
000039d0  76 5f 68 61 6e 64 6c 65  72 20 20 20 20 20 20 20  |v_handler       |
000039e0  3b 20 41 64 64 72 65 73  73 20 6f 66 20 74 68 65  |; Address of the|
000039f0  20 68 61 6e 64 6c 65 72  20 72 6f 75 74 69 6e 65  | handler routine|
00003a00  0d 0b 68 4e 20 20 20 20  20 20 20 20 4d 4f 56 20  |..hN        MOV |
00003a10  20 20 20 20 72 32 2c 20  72 31 32 20 20 20 20 20  |    r2, r12     |
00003a20  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 56 61  |            ; Va|
00003a30  6c 75 65 20 6f 66 20 72  31 32 20 75 73 65 64 20  |lue of r12 used |
00003a40  62 79 20 74 68 65 20 68  61 6e 64 6c 65 72 0d 0b  |by the handler..|
00003a50  72 48 20 20 20 20 20 20  20 20 53 57 49 20 20 20  |rH        SWI   |
00003a60  20 20 22 58 4f 53 5f 52  65 6c 65 61 73 65 22 20  |  "XOS_Release" |
00003a70  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 6c 65  |          ; Rele|
00003a80  61 73 65 20 74 68 65 20  4f 53 5f 57 6f 72 64 20  |ase the OS_Word |
00003a90  76 65 63 74 6f 72 0d 0b  7c 4b 20 20 20 20 20 20  |vector..|K      |
00003aa0  20 20 42 56 53 20 20 20  20 20 65 78 69 74 20 20  |  BVS     exit  |
00003ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003ac0  20 20 3b 20 45 78 69 74  20 69 66 20 61 6e 20 65  |  ; Exit if an e|
00003ad0  72 72 6f 72 20 77 61 73  20 70 72 6f 64 75 63 65  |rror was produce|
00003ae0  64 0d 0b 86 0f 2e 66 61  69 6c 5f 77 6f 72 64 76  |d.....fail_wordv|
00003af0  0d 0b 90 4a 20 20 20 20  20 20 20 20 4d 4f 56 20  |...J        MOV |
00003b00  20 20 20 20 72 30 2c 20  23 26 31 66 20 20 20 20  |    r0, #&1f    |
00003b10  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 4e 75  |            ; Nu|
00003b20  6d 62 65 72 20 6f 66 20  74 68 65 20 53 70 72 69  |mber of the Spri|
00003b30  74 65 56 20 76 65 63 74  6f 72 0d 0b 9a 4c 20 20  |teV vector...L  |
00003b40  20 20 20 20 20 20 41 44  52 20 20 20 20 20 72 31  |      ADR     r1|
00003b50  2c 20 73 70 72 69 74 65  76 5f 68 61 6e 64 6c 65  |, spritev_handle|
00003b60  72 20 20 20 20 20 3b 20  41 64 64 72 65 73 73 20  |r     ; Address |
00003b70  6f 66 20 74 68 65 20 68  61 6e 64 6c 65 72 20 72  |of the handler r|
00003b80  6f 75 74 69 6e 65 0d 0b  a4 4e 20 20 20 20 20 20  |outine...N      |
00003b90  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 72 31  |  MOV     r2, r1|
00003ba0  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
00003bb0  20 20 3b 20 56 61 6c 75  65 20 6f 66 20 72 31 32  |  ; Value of r12|
00003bc0  20 75 73 65 64 20 62 79  20 74 68 65 20 68 61 6e  | used by the han|
00003bd0  64 6c 65 72 0d 0b ae 4c  20 20 20 20 20 20 20 20  |dler...L        |
00003be0  53 57 49 20 20 20 20 20  22 58 4f 53 5f 52 65 6c  |SWI     "XOS_Rel|
00003bf0  65 61 73 65 22 20 20 20  20 20 20 20 20 20 20 20  |ease"           |
00003c00  3b 20 52 65 6c 65 61 73  65 20 74 68 65 20 4f 53  |; Release the OS|
00003c10  5f 53 70 72 69 74 65 4f  70 20 76 65 63 74 6f 72  |_SpriteOp vector|
00003c20  0d 0b b8 4b 20 20 20 20  20 20 20 20 42 56 53 20  |...K        BVS |
00003c30  20 20 20 20 65 78 69 74  20 20 20 20 20 20 20 20  |    exit        |
00003c40  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 45 78  |            ; Ex|
00003c50  69 74 20 69 66 20 61 6e  20 65 72 72 6f 72 20 77  |it if an error w|
00003c60  61 73 20 70 72 6f 64 75  63 65 64 0d 0b c2 11 2e  |as produced.....|
00003c70  66 61 69 6c 5f 73 70 72  69 74 65 76 0d 0b cc 49  |fail_spritev...I|
00003c80  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00003c90  72 30 2c 20 23 26 31 30  20 20 20 20 20 20 20 20  |r0, #&10        |
00003ca0  20 20 20 20 20 20 20 20  3b 20 4e 75 6d 62 65 72  |        ; Number|
00003cb0  20 6f 66 20 74 68 65 20  45 76 65 6e 74 56 20 76  | of the EventV v|
00003cc0  65 63 74 6f 72 0d 0b d6  4c 20 20 20 20 20 20 20  |ector...L       |
00003cd0  20 41 44 52 20 20 20 20  20 72 31 2c 20 65 76 65  | ADR     r1, eve|
00003ce0  6e 74 76 5f 68 61 6e 64  6c 65 72 20 20 20 20 20  |ntv_handler     |
00003cf0  20 3b 20 41 64 64 72 65  73 73 20 6f 66 20 74 68  | ; Address of th|
00003d00  65 20 68 61 6e 64 6c 65  72 20 72 6f 75 74 69 6e  |e handler routin|
00003d10  65 0d 0b e0 4e 20 20 20  20 20 20 20 20 4d 4f 56  |e...N        MOV|
00003d20  20 20 20 20 20 72 32 2c  20 72 31 32 20 20 20 20  |     r2, r12    |
00003d30  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 56  |             ; V|
00003d40  61 6c 75 65 20 6f 66 20  72 31 32 20 75 73 65 64  |alue of r12 used|
00003d50  20 62 79 20 74 68 65 20  68 61 6e 64 6c 65 72 0d  | by the handler.|
00003d60  0b ea 46 20 20 20 20 20  20 20 20 53 57 49 20 20  |..F        SWI  |
00003d70  20 20 20 22 58 4f 53 5f  52 65 6c 65 61 73 65 22  |   "XOS_Release"|
00003d80  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 6c  |           ; Rel|
00003d90  65 61 73 65 20 74 68 65  20 65 76 65 6e 74 20 76  |ease the event v|
00003da0  65 63 74 6f 72 0d 0b f4  4b 20 20 20 20 20 20 20  |ector...K       |
00003db0  20 42 56 53 20 20 20 20  20 65 78 69 74 20 20 20  | BVS     exit   |
00003dc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003dd0  20 3b 20 45 78 69 74 20  69 66 20 61 6e 20 65 72  | ; Exit if an er|
00003de0  72 6f 72 20 77 61 73 20  70 72 6f 64 75 63 65 64  |ror was produced|
00003df0  0d 0b fe 10 2e 66 61 69  6c 5f 65 76 65 6e 74 76  |.....fail_eventv|
00003e00  0d 0c 08 0d 2e 66 61 69  6c 5f 76 64 75 0d 0c 12  |.....fail_vdu...|
00003e10  12 2e 66 61 69 6c 5f 70  6f 73 69 74 69 6f 6e 0d  |..fail_position.|
00003e20  0c 1c 4b 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..K        MOV  |
00003e30  20 20 20 72 30 2c 20 23  37 20 20 20 20 20 20 20  |   r0, #7       |
00003e40  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
00003e50  73 6f 6e 20 63 6f 64 65  20 74 6f 20 72 65 6c 65  |son code to rele|
00003e60  61 73 65 20 6d 65 6d 6f  72 79 0d 0c 26 48 20 20  |ase memory..&H  |
00003e70  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 32  |      MOV     r2|
00003e80  2c 20 72 31 32 20 20 20  20 20 20 20 20 20 20 20  |, r12           |
00003e90  20 20 20 20 20 20 3b 20  43 6f 70 79 20 74 68 65  |      ; Copy the|
00003ea0  20 77 6f 72 6b 73 70 61  63 65 20 70 6f 69 6e 74  | workspace point|
00003eb0  65 72 0d 0c 30 43 20 20  20 20 20 20 20 20 53 57  |er..0C        SW|
00003ec0  49 20 20 20 20 20 22 58  4f 53 5f 4d 6f 64 75 6c  |I     "XOS_Modul|
00003ed0  65 22 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |e"            ; |
00003ee0  52 65 6c 65 61 73 65 20  74 68 65 20 77 6f 72 6b  |Release the work|
00003ef0  73 70 61 63 65 0d 0c 3a  4b 20 20 20 20 20 20 20  |space..:K       |
00003f00  20 42 56 53 20 20 20 20  20 65 78 69 74 20 20 20  | BVS     exit   |
00003f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00003f20  20 3b 20 45 78 69 74 20  69 66 20 61 6e 20 65 72  | ; Exit if an er|
00003f30  72 6f 72 20 77 61 73 20  70 72 6f 64 75 63 65 64  |ror was produced|
00003f40  0d 0c 44 0c 2e 66 61 69  6c 5f 77 73 0d 0c 4e 47  |..D..fail_ws..NG|
00003f50  20 20 20 20 20 20 20 20  54 45 51 20 20 20 20 20  |        TEQ     |
00003f60  72 31 31 2c 20 23 30 20  20 20 20 20 20 20 20 20  |r11, #0         |
00003f70  20 20 20 20 20 20 20 20  3b 20 49 73 20 74 68 65  |        ; Is the|
00003f80  72 65 20 61 6e 20 65 72  72 6f 72 20 70 6f 69 6e  |re an error poin|
00003f90  74 65 72 0d 0c 58 47 20  20 20 20 20 20 20 20 42  |ter..XG        B|
00003fa0  45 51 20 20 20 20 20 65  78 69 74 20 20 20 20 20  |EQ     exit     |
00003fb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00003fc0  20 45 78 69 74 20 77 69  74 68 6f 75 74 20 65 72  | Exit without er|
00003fd0  72 6f 72 20 69 66 20 6e  6f 74 0d 0c 62 44 20 20  |ror if not..bD  |
00003fe0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
00003ff0  2c 20 72 31 31 20 20 20  20 20 20 20 20 20 20 20  |, r11           |
00004000  20 20 20 20 20 20 3b 20  43 6f 70 79 20 74 68 65  |      ; Copy the|
00004010  20 65 72 72 6f 72 20 70  6f 69 6e 74 65 72 0d 0c  | error pointer..|
00004020  6c 43 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |lC        CMP   |
00004030  20 20 70 63 2c 20 23 26  38 30 30 30 30 30 30 30  |  pc, #&80000000|
00004040  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 74 20  |          ; Set |
00004050  74 68 65 20 6f 76 65 72  66 6c 6f 77 20 66 6c 61  |the overflow fla|
00004060  67 0d 0c 76 3f 2e 65 78  69 74 20 20 20 4c 44 4d  |g..v?.exit   LDM|
00004070  46 44 20 20 20 72 31 33  21 2c 20 7b 72 31 31 2c  |FD   r13!, {r11,|
00004080  20 70 63 7d 20 20 20 20  20 20 20 20 20 3b 20 52  | pc}         ; R|
00004090  65 74 75 72 6e 20 74 6f  20 52 49 53 43 20 4f 53  |eturn to RISC OS|
000040a0  0d 0c 80 04 0d 0c 8a 22  20 20 20 20 20 20 20 20  |......."        |
000040b0  3b 20 53 65 72 76 69 63  65 20 63 61 6c 6c 20 68  |; Service call h|
000040c0  61 6e 64 6c 65 72 0d 0c  94 0c 2e 73 65 72 76 69  |andler.....servi|
000040d0  63 65 0d 0c 9e 40 20 20  20 20 20 20 20 20 54 45  |ce...@        TE|
000040e0  51 20 20 20 20 20 72 31  2c 20 23 26 34 36 20 20  |Q     r1, #&46  |
000040f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004100  53 65 72 76 69 63 65 5f  4d 6f 64 65 43 68 61 6e  |Service_ModeChan|
00004110  67 65 0d 0c a8 4f 20 20  20 20 20 20 20 20 4d 4f  |ge...O        MO|
00004120  56 4e 45 53 20 20 70 63  2c 20 72 31 34 20 20 20  |VNES  pc, r14   |
00004130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004140  52 65 6a 65 63 74 20 75  6e 72 65 63 6f 67 6e 69  |Reject unrecogni|
00004150  73 65 64 20 63 61 6c 6c  73 20 71 75 69 63 6b 6c  |sed calls quickl|
00004160  79 0d 0c b2 46 20 20 20  20 20 20 20 20 4c 44 52  |y...F        LDR|
00004170  20 20 20 20 20 72 31 32  2c 20 5b 72 31 32 5d 20  |     r12, [r12] |
00004180  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 4f  |             ; O|
00004190  62 74 61 69 6e 20 77 6f  72 6b 73 70 61 63 65 20  |btain workspace |
000041a0  70 6f 69 6e 74 65 72 0d  0c bc 40 20 20 20 20 20  |pointer...@     |
000041b0  20 20 20 54 45 51 20 20  20 20 20 72 31 2c 20 23  |   TEQ     r1, #|
000041c0  26 34 36 20 20 20 20 20  20 20 20 20 20 20 20 20  |&46             |
000041d0  20 20 20 3b 20 53 65 72  76 69 63 65 5f 4d 6f 64  |   ; Service_Mod|
000041e0  65 43 68 61 6e 67 65 0d  0c c6 4e 20 20 20 20 20  |eChange...N     |
000041f0  20 20 20 42 45 51 20 20  20 20 20 73 65 72 76 69  |   BEQ     servi|
00004200  63 65 5f 6d 6f 64 65 5f  63 68 61 6e 67 65 20 20  |ce_mode_change  |
00004210  20 20 20 3b 20 4a 75 6d  70 20 74 6f 20 68 61 6e  |   ; Jump to han|
00004220  64 6c 65 72 20 66 6f 72  20 6d 6f 64 65 20 63 68  |dler for mode ch|
00004230  61 6e 67 65 73 0d 0c d0  04 0d 0c da 21 20 20 20  |anges.......!   |
00004240  20 20 20 20 20 3b 20 48  61 6e 64 6c 65 20 6d 6f  |     ; Handle mo|
00004250  64 65 20 63 68 61 6e 67  65 73 0d 0c e4 18 2e 73  |de changes.....s|
00004260  65 72 76 69 63 65 5f 6d  6f 64 65 5f 63 68 61 6e  |ervice_mode_chan|
00004270  67 65 0d 0c ee 3d 20 20  20 20 20 20 20 20 53 54  |ge...=        ST|
00004280  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 31 34  |MFD   r13!, {r14|
00004290  7d 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |}             ; |
000042a0  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0d  |Stack registers.|
000042b0  0c f8 44 20 20 20 20 20  20 20 20 42 4c 20 20 20  |..D        BL   |
000042c0  20 20 20 72 65 61 64 5f  76 64 75 20 20 20 20 20  |   read_vdu     |
000042d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
000042e0  64 20 74 68 65 20 70 69  78 65 6c 20 73 63 61 6c  |d the pixel scal|
000042f0  69 6e 67 0d 0d 02 46 20  20 20 20 20 20 20 20 4c  |ing...F        L|
00004300  44 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 70 63  |DMFD   r13!, {pc|
00004310  7d 5e 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |}^             ;|
00004320  20 52 65 74 75 72 6e 20  66 72 6f 6d 20 73 65 72  | Return from ser|
00004330  76 69 63 65 20 63 61 6c  6c 0d 0d 0c 04 0d 0d 16  |vice call.......|
00004340  25 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 20  |%        ; Read |
00004350  74 68 65 20 70 69 78 65  6c 20 73 63 61 6c 69 6e  |the pixel scalin|
00004360  67 73 0d 0d 20 0d 2e 72  65 61 64 5f 76 64 75 0d  |gs.. ..read_vdu.|
00004370  0d 2a 3d 20 20 20 20 20  20 20 20 53 54 4d 46 44  |.*=        STMFD|
00004380  20 20 20 72 31 33 21 2c  20 7b 72 30 2d 72 33 2c  |   r13!, {r0-r3,|
00004390  20 72 31 34 7d 20 20 20  20 20 20 3b 20 53 74 61  | r14}      ; Sta|
000043a0  63 6b 20 72 65 67 69 73  74 65 72 73 0d 0d 34 4d  |ck registers..4M|
000043b0  20 20 20 20 20 20 20 20  4d 56 4e 20 20 20 20 20  |        MVN     |
000043c0  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
000043d0  20 20 20 20 20 20 20 20  3b 20 52 65 61 64 20 76  |        ; Read v|
000043e0  61 72 69 61 62 6c 65 73  20 66 6f 72 20 63 75 72  |ariables for cur|
000043f0  72 65 6e 74 20 6d 6f 64  65 0d 0d 3e 4c 20 20 20  |rent mode..>L   |
00004400  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
00004410  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | #4             |
00004420  20 20 20 20 20 3b 20 56  61 72 69 61 62 6c 65 20  |     ; Variable |
00004430  6e 75 6d 62 65 72 20 66  6f 72 20 58 45 69 67 46  |number for XEigF|
00004440  61 63 74 6f 72 0d 0d 48  47 20 20 20 20 20 20 20  |actor..HG       |
00004450  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 52 65  | SWI     "XOS_Re|
00004460  61 64 4d 6f 64 65 56 61  72 69 61 62 6c 65 22 20  |adModeVariable" |
00004470  20 3b 20 52 65 61 64 20  74 68 65 20 58 45 69 67  | ; Read the XEig|
00004480  46 61 63 74 6f 72 20 76  61 6c 75 65 0d 0d 52 47  |Factor value..RG|
00004490  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
000044a0  72 33 2c 20 72 32 20 20  20 20 20 20 20 20 20 20  |r3, r2          |
000044b0  20 20 20 20 20 20 20 20  3b 20 43 6f 70 79 20 74  |        ; Copy t|
000044c0  68 65 20 58 45 69 67 46  61 63 74 6f 72 20 76 61  |he XEigFactor va|
000044d0  6c 75 65 0d 0d 5c 4c 20  20 20 20 20 20 20 20 4d  |lue..\L        M|
000044e0  4f 56 20 20 20 20 20 72  31 2c 20 23 35 20 20 20  |OV     r1, #5   |
000044f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00004500  20 56 61 72 69 61 62 6c  65 20 6e 75 6d 62 65 72  | Variable number|
00004510  20 66 6f 72 20 59 45 69  67 46 61 63 74 6f 72 0d  | for YEigFactor.|
00004520  0d 66 47 20 20 20 20 20  20 20 20 53 57 49 20 20  |.fG        SWI  |
00004530  20 20 20 22 58 4f 53 5f  52 65 61 64 4d 6f 64 65  |   "XOS_ReadMode|
00004540  56 61 72 69 61 62 6c 65  22 20 20 3b 20 52 65 61  |Variable"  ; Rea|
00004550  64 20 74 68 65 20 59 45  69 67 46 61 63 74 6f 72  |d the YEigFactor|
00004560  20 76 61 6c 75 65 0d 0d  70 4f 20 20 20 20 20 20  | value..pO      |
00004570  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 23 30  |  MOV     r0, #0|
00004580  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004590  20 20 3b 20 49 6e 69 74  69 61 6c 69 73 65 20 74  |  ; Initialise t|
000045a0  68 65 20 63 6f 6d 6d 6f  6e 20 65 69 67 65 6e 20  |he common eigen |
000045b0  76 61 6c 75 65 0d 0d 7a  12 2e 72 65 61 64 5f 76  |value..z..read_v|
000045c0  64 75 5f 6c 6f 6f 70 0d  0d 84 44 20 20 20 20 20  |du_loop...D     |
000045d0  20 20 20 54 45 51 20 20  20 20 20 72 32 2c 20 23  |   TEQ     r2, #|
000045e0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
000045f0  20 20 20 3b 20 49 73 20  74 68 65 20 59 45 69 67  |   ; Is the YEig|
00004600  46 61 63 74 6f 72 20 7a  65 72 6f 0d 0d 8e 44 20  |Factor zero...D |
00004610  20 20 20 20 20 20 20 54  45 51 4e 45 20 20 20 72  |       TEQNE   r|
00004620  33 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |3, #0           |
00004630  20 20 20 20 20 20 20 3b  20 49 73 20 74 68 65 20  |       ; Is the |
00004640  58 45 69 67 46 61 63 74  6f 72 20 7a 65 72 6f 0d  |XEigFactor zero.|
00004650  0d 98 53 20 20 20 20 20  20 20 20 42 45 51 20 20  |..S        BEQ  |
00004660  20 20 20 72 65 61 64 5f  76 64 75 5f 64 6f 6e 65  |   read_vdu_done|
00004670  20 20 20 20 20 20 20 20  20 20 20 3b 20 45 78 69  |           ; Exi|
00004680  74 20 6c 6f 6f 70 20 69  66 20 63 6f 6d 6d 6f 6e  |t loop if common|
00004690  20 63 6f 6d 70 6f 6e 65  6e 74 20 72 65 6d 6f 76  | component remov|
000046a0  65 64 0d 0d a2 48 20 20  20 20 20 20 20 20 41 44  |ed...H        AD|
000046b0  44 20 20 20 20 20 72 30  2c 20 72 30 2c 20 23 31  |D     r0, r0, #1|
000046c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000046d0  49 6e 63 72 65 6d 65 6e  74 20 63 6f 6d 6d 6f 6e  |Increment common|
000046e0  20 63 6f 6d 70 6f 6e 65  6e 74 0d 0d ac 42 20 20  | component...B  |
000046f0  20 20 20 20 20 20 53 55  42 20 20 20 20 20 72 32  |      SUB     r2|
00004700  2c 20 72 32 2c 20 23 31  20 20 20 20 20 20 20 20  |, r2, #1        |
00004710  20 20 20 20 20 20 3b 20  44 65 63 72 65 6d 65 6e  |      ; Decremen|
00004720  74 20 59 45 69 67 46 61  63 74 6f 72 0d 0d b6 42  |t YEigFactor...B|
00004730  20 20 20 20 20 20 20 20  53 55 42 20 20 20 20 20  |        SUB     |
00004740  72 33 2c 20 72 33 2c 20  23 31 20 20 20 20 20 20  |r3, r3, #1      |
00004750  20 20 20 20 20 20 20 20  3b 20 44 65 63 72 65 6d  |        ; Decrem|
00004760  65 6e 74 20 58 45 69 67  46 61 63 74 6f 72 0d 0d  |ent XEigFactor..|
00004770  c0 49 20 20 20 20 20 20  20 20 42 20 20 20 20 20  |.I        B     |
00004780  20 20 72 65 61 64 5f 76  64 75 5f 6c 6f 6f 70 20  |  read_vdu_loop |
00004790  20 20 20 20 20 20 20 20  20 20 3b 20 4b 65 65 70  |          ; Keep|
000047a0  20 6c 6f 6f 70 69 6e 67  20 75 6e 74 69 6c 20 66  | looping until f|
000047b0  69 6e 69 73 68 65 64 0d  0d ca 12 2e 72 65 61 64  |inished.....read|
000047c0  5f 76 64 75 5f 64 6f 6e  65 0d 0d d4 4a 20 20 20  |_vdu_done...J   |
000047d0  20 20 20 20 20 53 54 52  20 20 20 20 20 72 30 2c  |     STR     r0,|
000047e0  20 5b 72 31 32 2c 20 23  77 73 5f 63 65 69 67 5d  | [r12, #ws_ceig]|
000047f0  20 20 20 20 20 3b 20 53  74 6f 72 65 20 74 68 65  |     ; Store the|
00004800  20 63 6f 6d 6d 6f 6e 20  65 69 67 65 6e 20 76 61  | common eigen va|
00004810  6c 75 65 0d 0d de 4b 20  20 20 20 20 20 20 20 53  |lue...K        S|
00004820  54 52 20 20 20 20 20 72  33 2c 20 5b 72 31 32 2c  |TR     r3, [r12,|
00004830  20 23 77 73 5f 78 65 69  67 5d 20 20 20 20 20 3b  | #ws_xeig]     ;|
00004840  20 53 74 6f 72 65 20 74  68 65 20 61 64 6a 75 73  | Store the adjus|
00004850  74 65 64 20 58 45 69 67  46 61 63 74 6f 72 0d 0d  |ted XEigFactor..|
00004860  e8 4b 20 20 20 20 20 20  20 20 53 54 52 20 20 20  |.K        STR   |
00004870  20 20 72 32 2c 20 5b 72  31 32 2c 20 23 77 73 5f  |  r2, [r12, #ws_|
00004880  79 65 69 67 5d 20 20 20  20 20 3b 20 53 74 6f 72  |yeig]     ; Stor|
00004890  65 20 74 68 65 20 61 64  6a 75 73 74 65 64 20 59  |e the adjusted Y|
000048a0  45 69 67 46 61 63 74 6f  72 0d 0d f2 44 20 20 20  |EigFactor...D   |
000048b0  20 20 20 20 20 4c 44 4d  46 44 20 20 20 72 31 33  |     LDMFD   r13|
000048c0  21 2c 20 7b 72 30 2d 72  33 2c 20 70 63 7d 5e 20  |!, {r0-r3, pc}^ |
000048d0  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
000048e0  6f 6d 20 73 75 62 72 6f  75 74 69 6e 65 0d 0d fc  |om subroutine...|
000048f0  04 0d 0e 06 24 20 20 20  20 20 20 20 20 3b 20 45  |....$        ; E|
00004900  76 65 6e 74 56 20 68 61  6e 64 6c 65 72 20 72 6f  |ventV handler ro|
00004910  75 74 69 6e 65 0d 0e 10  13 2e 65 76 65 6e 74 76  |utine.....eventv|
00004920  5f 68 61 6e 64 6c 65 72  0d 0e 1a 3d 20 20 20 20  |_handler...=    |
00004930  20 20 20 20 53 54 4d 46  44 20 20 20 72 31 33 21  |    STMFD   r13!|
00004940  2c 20 7b 72 38 2d 72 39  2c 20 72 31 34 7d 20 20  |, {r8-r9, r14}  |
00004950  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00004960  73 74 65 72 73 0d 0e 24  4e 20 20 20 20 20 20 20  |sters..$N       |
00004970  20 4d 4f 56 20 20 20 20  20 72 39 2c 20 70 63 20  | MOV     r9, pc |
00004980  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004990  20 3b 20 53 61 76 65 20  74 68 65 20 63 75 72 72  | ; Save the curr|
000049a0  65 6e 74 20 73 74 61 74  75 73 20 61 6e 64 20 6d  |ent status and m|
000049b0  6f 64 65 0d 0e 2e 48 20  20 20 20 20 20 20 20 84  |ode...H        .|
000049c0  52 20 20 20 20 20 72 38  2c 20 72 39 2c 20 23 33  |R     r8, r9, #3|
000049d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000049e0  44 65 72 69 76 65 20 74  68 65 20 53 56 43 2d 6d  |Derive the SVC-m|
000049f0  6f 64 65 20 76 65 72 73  69 6f 6e 0d 0e 38 3c 20  |ode version..8< |
00004a00  20 20 20 20 20 20 20 54  45 51 50 20 20 20 20 72  |       TEQP    r|
00004a10  38 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |8, #0           |
00004a20  20 20 20 20 20 20 20 3b  20 45 6e 74 65 72 20 53  |       ; Enter S|
00004a30  56 43 20 6d 6f 64 65 0d  0e 42 4a 20 20 20 20 20  |VC mode..BJ     |
00004a40  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 72  |   MOV     r0, r|
00004a50  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00004a60  20 20 20 3b 20 41 6c 6c  6f 77 20 74 68 65 20 70  |   ; Allow the p|
00004a70  72 6f 63 65 73 73 6f 72  20 74 6f 20 61 64 61 70  |rocessor to adap|
00004a80  74 0d 0e 4c 3a 20 20 20  20 20 20 20 20 53 54 4d  |t..L:        STM|
00004a90  46 44 20 20 20 72 31 33  21 2c 20 7b 72 31 34 7d  |FD   r13!, {r14}|
00004aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00004ab0  61 76 65 20 72 31 34 5f  73 76 63 0d 0e 56 46 20  |ave r14_svc..VF |
00004ac0  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 75  |       BL      u|
00004ad0  70 64 61 74 65 20 20 20  20 20 20 20 20 20 20 20  |pdate           |
00004ae0  20 20 20 20 20 20 20 3b  20 55 70 64 61 74 65 20  |       ; Update |
00004af0  74 68 65 20 70 6f 69 6e  74 65 72 20 73 68 61 70  |the pointer shap|
00004b00  65 0d 0e 60 3d 20 20 20  20 20 20 20 20 4c 44 4d  |e..`=        LDM|
00004b10  46 44 20 20 20 72 31 33  21 2c 20 7b 72 31 34 7d  |FD   r13!, {r14}|
00004b20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
00004b30  65 73 74 6f 72 65 20 72  31 34 5f 73 76 63 0d 0e  |estore r14_svc..|
00004b40  6a 51 20 20 20 20 20 20  20 20 54 45 51 50 20 20  |jQ        TEQP  |
00004b50  20 20 72 39 2c 20 23 30  20 20 20 20 20 20 20 20  |  r9, #0        |
00004b60  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 65 6e  |          ; Reen|
00004b70  74 65 72 20 74 68 65 20  6f 72 69 67 69 6e 61 6c  |ter the original|
00004b80  20 70 72 6f 63 65 73 73  6f 72 20 6d 6f 64 65 0d  | processor mode.|
00004b90  0e 74 50 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |.tP        MOV  |
00004ba0  20 20 20 72 30 2c 20 72  30 20 20 20 20 20 20 20  |   r0, r0       |
00004bb0  20 20 20 20 20 20 20 20  20 20 20 3b 20 41 6c 6c  |           ; All|
00004bc0  6f 77 20 74 68 65 20 70  72 6f 63 65 73 73 6f 72  |ow the processor|
00004bd0  20 74 6f 20 61 64 61 70  74 20 61 67 61 69 6e 0d  | to adapt again.|
00004be0  0e 7e 3e 20 20 20 20 20  20 20 20 4c 44 4d 46 44  |.~>        LDMFD|
00004bf0  20 20 20 72 31 33 21 2c  20 7b 72 38 2d 72 39 2c  |   r13!, {r8-r9,|
00004c00  20 70 63 7d 5e 20 20 20  20 20 20 3b 20 50 61 73  | pc}^      ; Pas|
00004c10  73 20 6f 6e 20 74 68 65  20 63 61 6c 6c 0d 0e 88  |s on the call...|
00004c20  04 0d 0e 92 25 20 20 20  20 20 20 20 20 3b 20 53  |....%        ; S|
00004c30  70 72 69 74 65 56 20 68  61 6e 64 6c 65 72 20 72  |priteV handler r|
00004c40  6f 75 74 69 6e 65 0d 0e  9c 14 2e 73 70 72 69 74  |outine.....sprit|
00004c50  65 76 5f 68 61 6e 64 6c  65 72 0d 0e a6 3d 20 20  |ev_handler...=  |
00004c60  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
00004c70  33 21 2c 20 7b 72 32 2c  20 72 38 2d 72 31 31 2c  |3!, {r2, r8-r11,|
00004c80  20 72 31 34 7d 20 3b 20  53 74 61 63 6b 20 72 65  | r14} ; Stack re|
00004c90  67 69 73 74 65 72 73 0d  0e b0 44 20 20 20 20 20  |gisters...D     |
00004ca0  20 20 20 80 20 20 20 20  20 72 38 2c 20 72 30 2c  |   .     r8, r0,|
00004cb0  20 23 26 66 66 20 20 20  20 20 20 20 20 20 20 20  | #&ff           |
00004cc0  20 3b 20 4d 61 73 6b 20  6f 75 74 20 74 68 65 20  | ; Mask out the |
00004cd0  72 65 61 73 6f 6e 20 63  6f 64 65 0d 0e ba 52 20  |reason code...R |
00004ce0  20 20 20 20 20 20 20 54  45 51 20 20 20 20 20 72  |       TEQ     r|
00004cf0  38 2c 20 23 33 36 20 20  20 20 20 20 20 20 20 20  |8, #36          |
00004d00  20 20 20 20 20 20 20 3b  20 52 65 61 73 6f 6e 20  |       ; Reason |
00004d10  63 6f 64 65 20 74 6f 20  73 65 74 20 74 68 65 20  |code to set the |
00004d20  70 6f 69 6e 74 65 72 20  73 68 61 70 65 0d 0e c4  |pointer shape...|
00004d30  52 20 20 20 20 20 20 20  20 42 4e 45 20 20 20 20  |R        BNE    |
00004d40  20 73 70 72 69 74 65 76  5f 68 61 6e 64 6c 65 72  | spritev_handler|
00004d50  5f 64 6f 6e 65 20 20 20  20 3b 20 4e 6f 74 20 69  |_done    ; Not i|
00004d60  6e 74 65 72 65 73 74 65  64 20 69 6e 20 6f 74 68  |nterested in oth|
00004d70  65 72 20 72 65 61 73 6f  6e 20 63 6f 64 65 73 0d  |er reason codes.|
00004d80  0e ce 48 20 20 20 20 20  20 20 20 54 53 54 20 20  |..H        TST  |
00004d90  20 20 20 72 33 2c 20 23  26 31 30 20 20 20 20 20  |   r3, #&10     |
00004da0  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 73 20  |           ; Is |
00004db0  74 68 65 20 73 68 61 70  65 20 62 65 69 6e 67 20  |the shape being |
00004dc0  63 68 61 6e 67 65 64 0d  0e d8 46 20 20 20 20 20  |changed...F     |
00004dd0  20 20 20 42 4e 45 20 20  20 20 20 73 70 72 69 74  |   BNE     sprit|
00004de0  65 76 5f 68 61 6e 64 6c  65 72 5f 64 6f 6e 65 20  |ev_handler_done |
00004df0  20 20 20 3b 20 4e 6f 74  20 69 6e 74 65 72 65 73  |   ; Not interes|
00004e00  74 65 64 20 6f 74 68 65  72 77 69 73 65 0d 0e e2  |ted otherwise...|
00004e10  47 20 20 20 20 20 20 20  20 80 20 20 20 20 20 72  |G        .     r|
00004e20  38 2c 20 72 30 2c 20 23  26 33 30 30 20 20 20 20  |8, r0, #&300    |
00004e30  20 20 20 20 20 20 20 3b  20 47 65 74 20 72 65 67  |       ; Get reg|
00004e40  69 73 74 65 72 20 69 6e  74 65 72 70 72 65 74 61  |ister interpreta|
00004e50  74 69 6f 6e 0d 0e ec 4b  20 20 20 20 20 20 20 20  |tion...K        |
00004e60  54 45 51 20 20 20 20 20  72 38 2c 20 23 35 31 32  |TEQ     r8, #512|
00004e70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00004e80  3b 20 49 73 20 69 74 20  61 20 70 6f 69 6e 74 65  |; Is it a pointe|
00004e90  72 20 74 6f 20 74 68 65  20 73 70 72 69 74 65 0d  |r to the sprite.|
00004ea0  0e f6 49 20 20 20 20 20  20 20 20 41 44 44 45 51  |..I        ADDEQ|
00004eb0  20 20 20 72 32 2c 20 72  32 2c 20 23 34 20 20 20  |   r2, r2, #4   |
00004ec0  20 20 20 20 20 20 20 20  20 20 20 3b 20 41 64 76  |           ; Adv|
00004ed0  61 6e 63 65 20 70 6f 69  6e 74 65 72 20 74 6f 20  |ance pointer to |
00004ee0  74 68 65 20 6e 61 6d 65  0d 0f 00 51 20 20 20 20  |the name...Q    |
00004ef0  20 20 20 20 41 44 52 20  20 20 20 20 72 38 2c 20  |    ADR     r8, |
00004f00  70 6f 69 6e 74 65 72 73  5f 73 74 61 72 74 20 20  |pointers_start  |
00004f10  20 20 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |    ; Pointer to|
00004f20  20 74 68 65 20 66 69 72  73 74 20 72 65 66 65 72  | the first refer|
00004f30  65 6e 63 65 20 6e 61 6d  65 0d 0f 0a 19 2e 73 70  |ence name.....sp|
00004f40  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 6c 6f  |ritev_handler_lo|
00004f50  6f 70 0d 0f 14 4c 20 20  20 20 20 20 20 20 4d 4f  |op...L        MO|
00004f60  56 20 20 20 20 20 72 39  2c 20 23 30 20 20 20 20  |V     r9, #0    |
00004f70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00004f80  43 68 65 63 6b 20 66 72  6f 6d 20 74 68 65 20 66  |Check from the f|
00004f90  69 72 73 74 20 63 68 61  72 61 63 74 65 72 0d 0f  |irst character..|
00004fa0  1e 19 2e 73 70 72 69 74  65 76 5f 68 61 6e 64 6c  |...spritev_handl|
00004fb0  65 72 5f 63 68 61 72 0d  0f 28 49 20 20 20 20 20  |er_char..(I     |
00004fc0  20 20 20 4c 44 52 42 20  20 20 20 72 31 30 2c 20  |   LDRB    r10, |
00004fd0  5b 72 32 2c 20 72 39 5d  20 20 20 20 20 20 20 20  |[r2, r9]        |
00004fe0  20 20 20 3b 20 52 65 61  64 20 70 6f 69 6e 74 65  |   ; Read pointe|
00004ff0  72 20 6e 61 6d 65 20 63  68 61 72 61 63 74 65 72  |r name character|
00005000  0d 0f 32 4b 20 20 20 20  20 20 20 20 4c 44 52 42  |..2K        LDRB|
00005010  20 20 20 20 72 31 31 2c  20 5b 72 38 2c 20 72 39  |    r11, [r8, r9|
00005020  5d 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |]           ; Re|
00005030  61 64 20 72 65 66 65 72  65 6e 63 65 20 6e 61 6d  |ad reference nam|
00005040  65 20 63 68 61 72 61 63  74 65 72 0d 0f 3c 4c 20  |e character..<L |
00005050  20 20 20 20 20 20 20 54  45 51 20 20 20 20 20 72  |       TEQ     r|
00005060  31 31 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |11, #0          |
00005070  20 20 20 20 20 20 20 3b  20 49 73 20 69 74 20 74  |       ; Is it t|
00005080  68 65 20 65 6e 64 20 6f  66 20 74 68 65 20 72 65  |he end of the re|
00005090  66 65 72 65 6e 63 65 0d  0f 46 45 20 20 20 20 20  |ference..FE     |
000050a0  20 20 20 42 45 51 20 20  20 20 20 73 70 72 69 74  |   BEQ     sprit|
000050b0  65 76 5f 68 61 6e 64 6c  65 72 5f 66 6f 75 6e 64  |ev_handler_found|
000050c0  20 20 20 3b 20 43 6f 6d  70 6c 65 74 65 20 6d 61  |   ; Complete ma|
000050d0  74 63 68 20 69 66 20 69  74 20 69 73 0d 0f 50 45  |tch if it is..PE|
000050e0  20 20 20 20 20 20 20 20  54 45 51 20 20 20 20 20  |        TEQ     |
000050f0  72 31 30 2c 20 72 31 31  20 20 20 20 20 20 20 20  |r10, r11        |
00005100  20 20 20 20 20 20 20 20  3b 20 44 6f 20 74 68 65  |        ; Do the|
00005110  20 63 68 61 72 61 63 74  65 72 73 20 6d 61 74 63  | characters matc|
00005120  68 0d 0f 5a 4f 20 20 20  20 20 20 20 20 42 4e 45  |h..ZO        BNE|
00005130  20 20 20 20 20 73 70 72  69 74 65 76 5f 68 61 6e  |     spritev_han|
00005140  64 6c 65 72 5f 6e 65 78  74 20 20 20 20 3b 20 53  |dler_next    ; S|
00005150  6b 69 70 20 74 6f 20 74  68 65 20 6e 65 78 74 20  |kip to the next |
00005160  72 65 66 65 72 65 6e 63  65 20 69 66 20 6e 6f 74  |reference if not|
00005170  0d 0f 64 4b 20 20 20 20  20 20 20 20 41 44 44 20  |..dK        ADD |
00005180  20 20 20 20 72 39 2c 20  72 39 2c 20 23 31 20 20  |    r9, r9, #1  |
00005190  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 41 64  |            ; Ad|
000051a0  76 61 6e 63 65 20 74 6f  20 74 68 65 20 6e 65 78  |vance to the nex|
000051b0  74 20 63 68 61 72 61 63  74 65 72 0d 0f 6e 51 20  |t character..nQ |
000051c0  20 20 20 20 20 20 20 54  45 51 20 20 20 20 20 72  |       TEQ     r|
000051d0  39 2c 20 23 31 32 20 20  20 20 20 20 20 20 20 20  |9, #12          |
000051e0  20 20 20 20 20 20 20 3b  20 4d 61 78 69 6d 75 6d  |       ; Maximum|
000051f0  20 6c 65 6e 67 74 68 20  69 73 20 74 77 65 6c 76  | length is twelv|
00005200  65 20 63 68 61 72 61 63  74 65 72 73 0d 0f 78 4f  |e characters..xO|
00005210  20 20 20 20 20 20 20 20  42 45 51 20 20 20 20 20  |        BEQ     |
00005220  73 70 72 69 74 65 76 5f  68 61 6e 64 6c 65 72 5f  |spritev_handler_|
00005230  66 6f 75 6e 64 20 20 20  3b 20 41 6c 6c 20 6d 61  |found   ; All ma|
00005240  74 63 68 65 64 20 69 66  20 72 65 61 63 68 65 64  |tched if reached|
00005250  20 74 68 69 73 20 70 6f  69 6e 74 0d 0f 82 49 20  | this point...I |
00005260  20 20 20 20 20 20 20 42  20 20 20 20 20 20 20 73  |       B       s|
00005270  70 72 69 74 65 76 5f 68  61 6e 64 6c 65 72 5f 63  |pritev_handler_c|
00005280  68 61 72 20 20 20 20 3b  20 4c 6f 6f 70 20 66 6f  |har    ; Loop fo|
00005290  72 20 74 68 65 20 6e 65  78 74 20 63 68 61 72 61  |r the next chara|
000052a0  63 74 65 72 0d 0f 8c 19  2e 73 70 72 69 74 65 76  |cter.....spritev|
000052b0  5f 68 61 6e 64 6c 65 72  5f 6e 65 78 74 0d 0f 96  |_handler_next...|
000052c0  48 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |H        ADD    |
000052d0  20 72 38 2c 20 72 38 2c  20 23 31 36 20 20 20 20  | r8, r8, #16    |
000052e0  20 20 20 20 20 20 20 20  20 3b 20 41 64 76 61 6e  |         ; Advan|
000052f0  63 65 20 74 6f 20 74 68  65 20 6e 65 78 74 20 72  |ce to the next r|
00005300  65 63 6f 72 64 0d 0f a0  4c 20 20 20 20 20 20 20  |ecord...L       |
00005310  20 41 44 52 20 20 20 20  20 72 39 2c 20 70 6f 69  | ADR     r9, poi|
00005320  6e 74 65 72 73 5f 65 6e  64 20 20 20 20 20 20 20  |nters_end       |
00005330  20 3b 20 50 6f 69 6e 74  65 72 20 74 6f 20 74 68  | ; Pointer to th|
00005340  65 20 65 6e 64 20 6f 66  20 74 68 65 20 6c 69 73  |e end of the lis|
00005350  74 0d 0f aa 46 20 20 20  20 20 20 20 20 54 45 51  |t...F        TEQ|
00005360  20 20 20 20 20 72 38 2c  20 72 39 20 20 20 20 20  |     r8, r9     |
00005370  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 48  |             ; H|
00005380  61 73 20 74 68 65 20 65  6e 64 20 62 65 65 6e 20  |as the end been |
00005390  72 65 61 63 68 65 64 0d  0f b4 4c 20 20 20 20 20  |reached...L     |
000053a0  20 20 20 42 4e 45 20 20  20 20 20 73 70 72 69 74  |   BNE     sprit|
000053b0  65 76 5f 68 61 6e 64 6c  65 72 5f 6c 6f 6f 70 20  |ev_handler_loop |
000053c0  20 20 20 3b 20 54 68 65  72 65 20 69 73 20 61 6e  |   ; There is an|
000053d0  6f 74 68 65 72 20 6e 61  6d 65 20 74 6f 20 63 68  |other name to ch|
000053e0  65 63 6b 0d 0f be 46 20  20 20 20 20 20 20 20 4d  |eck...F        M|
000053f0  4f 56 20 20 20 20 20 72  32 2c 20 23 30 20 20 20  |OV     r2, #0   |
00005400  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005410  20 4e 6f 20 6d 61 74 63  68 69 6e 67 20 70 6f 69  | No matching poi|
00005420  6e 74 65 72 20 6e 61 6d  65 0d 0f c8 1c 2e 73 70  |nter name.....sp|
00005430  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 63 68  |ritev_handler_ch|
00005440  65 63 6b 65 64 0d 0f d2  46 20 20 20 20 20 20 20  |ecked...F       |
00005450  20 80 20 20 20 20 20 72  38 2c 20 72 33 2c 20 23  | .     r8, r3, #|
00005460  26 66 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |&f             ;|
00005470  20 45 78 74 72 61 63 74  20 74 68 65 20 70 6f 69  | Extract the poi|
00005480  6e 74 65 72 20 6e 75 6d  62 65 72 0d 0f dc 44 20  |nter number...D |
00005490  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
000054a0  38 2c 20 72 38 2c 20 23  77 73 5f 74 79 70 65 73  |8, r8, #ws_types|
000054b0  20 20 20 20 20 20 20 3b  20 4f 66 66 73 65 74 20  |       ; Offset |
000054c0  74 6f 20 74 79 70 65 20  64 65 74 61 69 6c 73 0d  |to type details.|
000054d0  0f e6 44 20 20 20 20 20  20 20 20 53 54 52 42 20  |..D        STRB |
000054e0  20 20 20 72 32 2c 20 5b  72 31 32 2c 20 72 38 5d  |   r2, [r12, r8]|
000054f0  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 74 6f  |           ; Sto|
00005500  72 65 20 74 68 65 20 70  6f 69 6e 74 65 72 20 74  |re the pointer t|
00005510  79 70 65 0d 0f f0 47 20  20 20 20 20 20 20 20 54  |ype...G        T|
00005520  45 51 20 20 20 20 20 72  32 2c 20 23 30 20 20 20  |EQ     r2, #0   |
00005530  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005540  20 57 61 73 20 61 20 70  6f 69 6e 74 65 72 20 6d  | Was a pointer m|
00005550  61 74 63 68 20 66 6f 75  6e 64 0d 0f fa 4c 20 20  |atch found...L  |
00005560  20 20 20 20 20 20 84 52  4e 45 20 20 20 72 33 2c  |      .RNE   r3,|
00005570  20 72 33 2c 20 23 26 31  30 20 20 20 20 20 20 20  | r3, #&10       |
00005580  20 20 20 20 20 3b 20 43  6c 65 61 72 20 74 68 65  |     ; Clear the|
00005590  20 73 68 61 70 65 20 64  65 66 69 6e 69 74 69 6f  | shape definitio|
000055a0  6e 20 66 6c 61 67 0d 10  04 19 2e 73 70 72 69 74  |n flag.....sprit|
000055b0  65 76 5f 68 61 6e 64 6c  65 72 5f 64 6f 6e 65 0d  |ev_handler_done.|
000055c0  10 0e 4d 20 20 20 20 20  20 20 20 4c 44 4d 46 44  |..M        LDMFD|
000055d0  20 20 20 72 31 33 21 2c  20 7b 72 32 2c 20 72 38  |   r13!, {r2, r8|
000055e0  2d 72 31 31 2c 20 70 63  7d 5e 20 3b 20 50 61 73  |-r11, pc}^ ; Pas|
000055f0  73 20 6f 6e 20 74 6f 20  74 68 65 20 6f 72 69 67  |s on to the orig|
00005600  69 6e 61 6c 20 72 6f 75  74 69 6e 65 0d 10 18 1a  |inal routine....|
00005610  2e 73 70 72 69 74 65 76  5f 68 61 6e 64 6c 65 72  |.spritev_handler|
00005620  5f 66 6f 75 6e 64 0d 10  22 44 20 20 20 20 20 20  |_found.."D      |
00005630  20 20 4c 44 52 20 20 20  20 20 72 32 2c 20 5b 72  |  LDR     r2, [r|
00005640  38 2c 20 23 31 32 5d 20  20 20 20 20 20 20 20 20  |8, #12]         |
00005650  20 20 3b 20 52 65 61 64  20 74 68 65 20 70 6f 69  |  ; Read the poi|
00005660  6e 74 65 72 20 69 6e 64  65 78 0d 10 2c 3e 20 20  |nter index..,>  |
00005670  20 20 20 20 20 20 42 20  20 20 20 20 20 20 73 70  |      B       sp|
00005680  72 69 74 65 76 5f 68 61  6e 64 6c 65 72 5f 63 68  |ritev_handler_ch|
00005690  65 63 6b 65 64 20 3b 20  48 61 6e 64 6c 65 20 74  |ecked ; Handle t|
000056a0  68 65 20 6d 61 74 63 68  0d 10 36 04 0d 10 40 21  |he match..6...@!|
000056b0  20 20 20 20 20 20 20 20  3b 20 4b 6e 6f 77 6e 20  |        ; Known |
000056c0  70 6f 69 6e 74 65 72 20  6e 61 6d 65 73 0d 10 4a  |pointer names..J|
000056d0  13 2e 70 6f 69 6e 74 65  72 73 5f 73 74 61 72 74  |..pointers_start|
000056e0  0d 10 54 2f 20 20 20 20  20 20 20 20 a4 70 6f 69  |..T/        .poi|
000056f0  6e 74 65 72 28 22 70 74  72 5f 64 65 66 61 75 6c  |nter("ptr_defaul|
00005700  74 22 2c 20 70 74 72 5f  73 69 6e 67 6c 65 29 0d  |t", ptr_single).|
00005710  10 5e 2e 20 20 20 20 20  20 20 20 a4 70 6f 69 6e  |.^.        .poin|
00005720  74 65 72 28 22 70 74 72  5f 64 6f 75 62 6c 65 22  |ter("ptr_double"|
00005730  2c 20 70 74 72 5f 64 6f  75 62 6c 65 29 0d 10 68  |, ptr_double)..h|
00005740  2c 20 20 20 20 20 20 20  20 a4 70 6f 69 6e 74 65  |,        .pointe|
00005750  72 28 22 70 74 72 5f 77  72 69 74 65 22 2c 20 70  |r("ptr_write", p|
00005760  74 72 5f 63 61 72 65 74  29 0d 10 72 2c 20 20 20  |tr_caret)..r,   |
00005770  20 20 20 20 20 a4 70 6f  69 6e 74 65 72 28 22 70  |     .pointer("p|
00005780  74 72 5f 63 61 72 65 74  22 2c 20 70 74 72 5f 63  |tr_caret", ptr_c|
00005790  61 72 65 74 29 0d 10 7c  2c 20 20 20 20 20 20 20  |aret)..|,       |
000057a0  20 a4 70 6f 69 6e 74 65  72 28 22 69 64 63 5f 69  | .pointer("idc_i|
000057b0  62 65 61 6d 22 2c 20 70  74 72 5f 63 61 72 65 74  |beam", ptr_caret|
000057c0  29 0d 10 86 2a 20 20 20  20 20 20 20 20 a4 70 6f  |)...*        .po|
000057d0  69 6e 74 65 72 28 22 70  74 72 5f 6d 65 6e 75 22  |inter("ptr_menu"|
000057e0  2c 20 70 74 72 5f 6d 65  6e 75 29 0d 10 90 11 2e  |, ptr_menu).....|
000057f0  70 6f 69 6e 74 65 72 73  5f 65 6e 64 0d 10 9a 04  |pointers_end....|
00005800  0d 10 a4 23 20 20 20 20  20 20 20 20 3b 20 57 6f  |...#        ; Wo|
00005810  72 64 56 20 68 61 6e 64  6c 65 72 20 72 6f 75 74  |rdV handler rout|
00005820  69 6e 65 0d 10 ae 12 2e  77 6f 72 64 76 5f 68 61  |ine.....wordv_ha|
00005830  6e 64 6c 65 72 0d 10 b8  54 20 20 20 20 20 20 20  |ndler...T       |
00005840  20 54 45 51 20 20 20 20  20 72 30 2c 20 23 32 31  | TEQ     r0, #21|
00005850  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005860  20 3b 20 54 68 65 20 72  65 61 73 6f 6e 20 63 6f  | ; The reason co|
00005870  64 65 20 66 6f 72 20 70  6f 69 6e 74 65 72 20 6f  |de for pointer o|
00005880  70 65 72 61 74 69 6f 6e  73 0d 10 c2 48 20 20 20  |perations...H   |
00005890  20 20 20 20 20 4d 4f 56  4e 45 53 20 20 70 63 2c  |     MOVNES  pc,|
000058a0  20 72 31 34 20 20 20 20  20 20 20 20 20 20 20 20  | r14            |
000058b0  20 20 20 20 20 3b 20 50  61 73 73 20 6f 6e 20 6f  |     ; Pass on o|
000058c0  74 68 65 72 20 72 65 61  73 6f 6e 20 63 6f 64 65  |ther reason code|
000058d0  73 0d 10 cc 3d 20 20 20  20 20 20 20 20 53 54 4d  |s...=        STM|
000058e0  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
000058f0  31 2c 20 72 31 34 7d 20  20 20 20 20 20 3b 20 53  |1, r14}      ; S|
00005900  74 61 63 6b 20 72 65 67  69 73 74 65 72 73 0d 10  |tack registers..|
00005910  d6 45 20 20 20 20 20 20  20 20 4c 44 52 42 20 20  |.E        LDRB  |
00005920  20 20 72 30 2c 20 5b 72  31 5d 20 20 20 20 20 20  |  r0, [r1]      |
00005930  20 20 20 20 20 20 20 20  20 20 3b 20 47 65 74 20  |          ; Get |
00005940  74 68 65 20 73 75 62 20  72 65 61 73 6f 6e 20 63  |the sub reason c|
00005950  6f 64 65 0d 10 e0 4f 20  20 20 20 20 20 20 20 54  |ode...O        T|
00005960  45 51 20 20 20 20 20 72  30 2c 20 23 30 20 20 20  |EQ     r0, #0   |
00005970  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005980  20 52 65 61 73 6f 6e 20  63 6f 64 65 20 74 6f 20  | Reason code to |
00005990  64 65 66 69 6e 65 20 74  68 65 20 70 6f 69 6e 74  |define the point|
000059a0  65 72 0d 10 ea 52 20 20  20 20 20 20 20 20 42 4e  |er...R        BN|
000059b0  45 20 20 20 20 20 77 6f  72 64 76 5f 68 61 6e 64  |E     wordv_hand|
000059c0  6c 65 72 5f 64 6f 6e 65  20 20 20 20 20 20 3b 20  |ler_done      ; |
000059d0  4e 6f 74 20 69 6e 74 65  72 65 73 74 65 64 20 69  |Not interested i|
000059e0  6e 20 6f 74 68 65 72 20  72 65 61 73 6f 6e 20 63  |n other reason c|
000059f0  6f 64 65 73 0d 10 f4 44  20 20 20 20 20 20 20 20  |odes...D        |
00005a00  4c 44 52 20 20 20 20 20  72 30 2c 20 5b 72 31 32  |LDR     r0, [r12|
00005a10  2c 20 23 77 73 5f 69 6e  74 65 72 6e 61 6c 5d 20  |, #ws_internal] |
00005a20  3b 20 52 65 61 64 20 74  68 65 20 69 6e 74 65 72  |; Read the inter|
00005a30  6e 61 6c 20 66 6c 61 67  0d 10 fe 49 20 20 20 20  |nal flag...I    |
00005a40  20 20 20 20 54 45 51 20  20 20 20 20 72 30 2c 20  |    TEQ     r0, |
00005a50  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
00005a60  20 20 20 20 3b 20 49 73  20 69 74 20 61 6e 20 69  |    ; Is it an i|
00005a70  6e 74 65 72 6e 61 6c 20  6f 70 65 72 61 74 69 6f  |nternal operatio|
00005a80  6e 0d 11 08 48 20 20 20  20 20 20 20 20 42 4e 45  |n...H        BNE|
00005a90  20 20 20 20 20 77 6f 72  64 76 5f 68 61 6e 64 6c  |     wordv_handl|
00005aa0  65 72 5f 64 6f 6e 65 20  20 20 20 20 20 3b 20 53  |er_done      ; S|
00005ab0  6b 69 70 20 74 68 65 20  6e 65 78 74 20 62 69 74  |kip the next bit|
00005ac0  20 69 66 20 69 74 20 69  73 0d 11 12 43 20 20 20  | if it is...C   |
00005ad0  20 20 20 20 20 4c 44 52  42 20 20 20 20 72 30 2c  |     LDRB    r0,|
00005ae0  20 5b 72 31 2c 20 23 31  5d 20 20 20 20 20 20 20  | [r1, #1]       |
00005af0  20 20 20 20 20 3b 20 52  65 61 64 20 74 68 65 20  |     ; Read the |
00005b00  73 68 61 70 65 20 6e 75  6d 62 65 72 0d 11 1c 44  |shape number...D|
00005b10  20 20 20 20 20 20 20 20  41 44 44 20 20 20 20 20  |        ADD     |
00005b20  72 30 2c 20 72 30 2c 20  23 77 73 5f 74 79 70 65  |r0, r0, #ws_type|
00005b30  73 20 20 20 20 20 20 20  3b 20 4f 66 66 73 65 74  |s       ; Offset|
00005b40  20 74 6f 20 74 79 70 65  20 64 65 74 61 69 6c 73  | to type details|
00005b50  0d 11 26 4e 20 20 20 20  20 20 20 20 4d 4f 56 20  |..&N        MOV |
00005b60  20 20 20 20 72 31 2c 20  23 70 74 72 5f 75 6e 6b  |    r1, #ptr_unk|
00005b70  6e 6f 77 6e 20 20 20 20  20 20 20 20 3b 20 43 6f  |nown        ; Co|
00005b80  64 65 20 66 6f 72 20 61  6e 20 75 6e 6b 6e 6f 77  |de for an unknow|
00005b90  6e 20 70 6f 69 6e 74 65  72 20 74 79 70 65 0d 11  |n pointer type..|
00005ba0  30 4e 20 20 20 20 20 20  20 20 53 54 52 42 20 20  |0N        STRB  |
00005bb0  20 20 72 31 2c 20 5b 72  31 32 2c 20 72 30 5d 20  |  r1, [r12, r0] |
00005bc0  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 74 20  |          ; Set |
00005bd0  74 68 69 73 20 70 6f 69  6e 74 65 72 20 74 79 70  |this pointer typ|
00005be0  65 20 74 6f 20 75 6e 6b  6e 6f 77 6e 0d 11 3a 17  |e to unknown..:.|
00005bf0  2e 77 6f 72 64 76 5f 68  61 6e 64 6c 65 72 5f 64  |.wordv_handler_d|
00005c00  6f 6e 65 0d 11 44 3e 20  20 20 20 20 20 20 20 4c  |one..D>        L|
00005c10  44 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 30  |DMFD   r13!, {r0|
00005c20  2d 72 31 2c 20 70 63 7d  5e 20 20 20 20 20 20 3b  |-r1, pc}^      ;|
00005c30  20 50 61 73 73 20 6f 6e  20 74 68 65 20 63 61 6c  | Pass on the cal|
00005c40  6c 0d 11 4e 04 0d 11 58  33 20 20 20 20 20 20 20  |l..N...X3       |
00005c50  20 3b 20 55 70 64 61 74  65 20 74 68 65 20 73 68  | ; Update the sh|
00005c60  61 70 65 20 6f 66 20 74  68 65 20 6d 6f 75 73 65  |ape of the mouse|
00005c70  20 70 6f 69 6e 74 65 72  0d 11 62 3d 2e 75 70 64  | pointer..b=.upd|
00005c80  61 74 65 20 53 54 4d 46  44 20 20 20 72 31 33 21  |ate STMFD   r13!|
00005c90  2c 20 7b 72 30 2d 72 35  2c 20 72 31 34 7d 20 20  |, {r0-r5, r14}  |
00005ca0  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00005cb0  73 74 65 72 73 0d 11 6c  4f 20 20 20 20 20 20 20  |sters..lO       |
00005cc0  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 31 30  | MOV     r0, #10|
00005cd0  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
00005ce0  20 3b 20 52 65 61 73 6f  6e 20 63 6f 64 65 20 74  | ; Reason code t|
00005cf0  6f 20 72 65 61 64 20 70  6f 69 6e 74 65 72 20 73  |o read pointer s|
00005d00  68 61 70 65 0d 11 76 50  20 20 20 20 20 20 20 20  |hape..vP        |
00005d10  4d 4f 56 20 20 20 20 20  72 31 2c 20 23 26 37 66  |MOV     r1, #&7f|
00005d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00005d30  3b 20 49 6e 76 61 6c 69  64 20 73 68 61 70 65 20  |; Invalid shape |
00005d40  6e 75 6d 62 65 72 20 74  6f 20 66 6f 72 63 65 20  |number to force |
00005d50  72 65 61 64 0d 11 80 53  20 20 20 20 20 20 20 20  |read...S        |
00005d60  53 57 49 20 20 20 20 20  22 58 4f 53 5f 42 79 74  |SWI     "XOS_Byt|
00005d70  65 22 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |e"              |
00005d80  3b 20 52 65 61 64 20 74  68 65 20 63 75 72 72 65  |; Read the curre|
00005d90  6e 74 20 70 6f 69 6e 74  65 72 20 73 68 61 70 65  |nt pointer shape|
00005da0  20 6e 75 6d 62 65 72 0d  11 8a 51 20 20 20 20 20  | number...Q     |
00005db0  20 20 20 42 56 53 20 20  20 20 20 75 70 64 61 74  |   BVS     updat|
00005dc0  65 5f 64 6f 6e 65 20 20  20 20 20 20 20 20 20 20  |e_done          |
00005dd0  20 20 20 3b 20 4e 6f 20  75 70 64 61 74 65 20 70  |   ; No update p|
00005de0  6f 69 6e 74 65 72 20 69  66 20 65 72 72 6f 72 20  |ointer if error |
00005df0  70 72 6f 64 75 63 65 64  0d 11 94 4b 20 20 20 20  |produced...K    |
00005e00  20 20 20 20 53 54 52 42  20 20 20 20 72 31 2c 20  |    STRB    r1, |
00005e10  5b 72 31 32 2c 20 23 77  73 5f 70 74 72 5f 62 6c  |[r12, #ws_ptr_bl|
00005e20  6f 63 6b 5f 73 68 61 70  65 5d 3b 20 53 74 6f 72  |ock_shape]; Stor|
00005e30  65 20 74 68 65 20 70 6f  69 6e 74 65 72 20 73 68  |e the pointer sh|
00005e40  61 70 65 0d 11 9e 43 20  20 20 20 20 20 20 20 54  |ape...C        T|
00005e50  53 54 20 20 20 20 20 72  31 2c 20 23 26 38 30 20  |ST     r1, #&80 |
00005e60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00005e70  20 49 73 20 74 68 65 20  70 6f 69 6e 74 65 72 20  | Is the pointer |
00005e80  6c 69 6e 6b 65 64 0d 11  a8 3e 20 20 20 20 20 20  |linked...>      |
00005e90  20 20 42 4e 45 20 20 20  20 20 75 70 64 61 74 65  |  BNE     update|
00005ea0  5f 64 6f 6e 65 20 20 20  20 20 20 20 20 20 20 20  |_done           |
00005eb0  20 20 3b 20 4e 6f 20 75  70 64 61 74 65 20 69 66  |  ; No update if|
00005ec0  20 6e 6f 74 0d 11 b2 44  20 20 20 20 20 20 20 20  | not...D        |
00005ed0  41 44 44 20 20 20 20 20  72 31 2c 20 72 31 2c 20  |ADD     r1, r1, |
00005ee0  23 77 73 5f 74 79 70 65  73 20 20 20 20 20 20 20  |#ws_types       |
00005ef0  3b 20 4f 66 66 73 65 74  20 74 6f 20 74 79 70 65  |; Offset to type|
00005f00  20 64 65 74 61 69 6c 73  0d 11 bc 53 20 20 20 20  | details...S    |
00005f10  20 20 20 20 4c 44 52 42  20 20 20 20 72 33 2c 20  |    LDRB    r3, |
00005f20  5b 72 31 32 2c 20 72 31  5d 20 20 20 20 20 20 20  |[r12, r1]       |
00005f30  20 20 20 20 3b 20 44 69  73 63 6f 76 65 72 20 74  |    ; Discover t|
00005f40  68 65 20 74 79 70 65 20  6f 66 20 70 6f 69 6e 74  |he type of point|
00005f50  65 72 20 72 65 71 75 69  72 65 64 0d 11 c6 52 20  |er required...R |
00005f60  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00005f70  30 2c 20 23 32 31 20 20  20 20 20 20 20 20 20 20  |0, #21          |
00005f80  20 20 20 20 20 20 20 3b  20 52 65 61 73 6f 6e 20  |       ; Reason |
00005f90  63 6f 64 65 20 74 6f 20  72 65 61 64 20 70 6f 69  |code to read poi|
00005fa0  6e 74 65 72 20 70 6f 73  69 74 69 6f 6e 0d 11 d0  |nter position...|
00005fb0  41 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |A        ADD    |
00005fc0  20 72 31 2c 20 72 31 32  2c 20 23 77 73 5f 62 75  | r1, r12, #ws_bu|
00005fd0  66 66 65 72 20 20 20 20  20 3b 20 50 6f 69 6e 74  |ffer     ; Point|
00005fe0  65 72 20 74 6f 20 61 20  62 75 66 66 65 72 0d 11  |er to a buffer..|
00005ff0  da 52 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.R        MOV   |
00006000  20 20 72 32 2c 20 23 36  20 20 20 20 20 20 20 20  |  r2, #6        |
00006010  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 61 73  |          ; Reas|
00006020  6f 6e 20 63 6f 64 65 20  74 6f 20 72 65 61 64 20  |on code to read |
00006030  70 6f 69 6e 74 65 72 20  70 6f 73 69 74 69 6f 6e  |pointer position|
00006040  0d 11 e4 49 20 20 20 20  20 20 20 20 53 54 52 42  |...I        STRB|
00006050  20 20 20 20 72 32 2c 20  5b 72 31 5d 20 20 20 20  |    r2, [r1]    |
00006060  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 74  |            ; St|
00006070  6f 72 65 20 72 65 61 73  6f 6e 20 63 6f 64 65 20  |ore reason code |
00006080  69 6e 20 62 75 66 66 65  72 0d 11 ee 43 20 20 20  |in buffer...C   |
00006090  20 20 20 20 20 53 57 49  20 20 20 20 20 22 58 4f  |     SWI     "XO|
000060a0  53 5f 57 6f 72 64 22 20  20 20 20 20 20 20 20 20  |S_Word"         |
000060b0  20 20 20 20 20 3b 20 52  65 61 64 20 70 6f 69 6e  |     ; Read poin|
000060c0  74 65 72 20 70 6f 73 69  74 69 6f 6e 0d 11 f8 51  |ter position...Q|
000060d0  20 20 20 20 20 20 20 20  42 56 53 20 20 20 20 20  |        BVS     |
000060e0  75 70 64 61 74 65 5f 64  6f 6e 65 20 20 20 20 20  |update_done     |
000060f0  20 20 20 20 20 20 20 20  3b 20 4e 6f 20 75 70 64  |        ; No upd|
00006100  61 74 65 20 70 6f 69 6e  74 65 72 20 69 66 20 65  |ate pointer if e|
00006110  72 72 6f 72 20 70 72 6f  64 75 63 65 64 0d 12 02  |rror produced...|
00006120  45 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |E        MOV    |
00006130  20 72 30 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r0, r3         |
00006140  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
00006150  70 6f 69 6e 74 65 72 20  73 68 61 70 65 20 74 79  |pointer shape ty|
00006160  70 65 0d 12 0c 4d 20 20  20 20 20 20 20 20 4c 44  |pe...M        LD|
00006170  52 42 20 20 20 20 72 34  2c 20 5b 72 31 2c 20 23  |RB    r4, [r1, #|
00006180  31 5d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |1]            ; |
00006190  52 65 61 64 20 4c 53 42  20 6f 66 20 68 6f 72 69  |Read LSB of hori|
000061a0  7a 6f 6e 74 61 6c 20 70  6f 73 69 74 69 6f 6e 0d  |zontal position.|
000061b0  12 16 4d 20 20 20 20 20  20 20 20 4c 44 52 42 20  |..M        LDRB |
000061c0  20 20 20 72 35 2c 20 5b  72 31 2c 20 23 32 5d 20  |   r5, [r1, #2] |
000061d0  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
000061e0  64 20 4d 53 42 20 6f 66  20 68 6f 72 69 7a 6f 6e  |d MSB of horizon|
000061f0  74 61 6c 20 70 6f 73 69  74 69 6f 6e 0d 12 20 48  |tal position.. H|
00006200  20 20 20 20 20 20 20 20  84 52 20 20 20 20 20 72  |        .R     r|
00006210  34 2c 20 72 34 2c 20 72  35 2c 20 41 53 4c 23 38  |4, r4, r5, ASL#8|
00006220  20 20 20 20 20 20 20 3b  20 43 6f 6d 62 69 6e 65  |       ; Combine|
00006230  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 70 6f 73 69  | horizontal posi|
00006240  74 69 6f 6e 0d 12 2a 4e  20 20 20 20 20 20 20 20  |tion..*N        |
00006250  4d 4f 56 20 20 20 20 20  72 34 2c 20 72 34 2c 20  |MOV     r4, r4, |
00006260  41 53 4c 23 31 36 20 20  20 20 20 20 20 20 20 20  |ASL#16          |
00006270  3b 20 53 63 61 6c 65 20  74 68 65 20 68 6f 72 69  |; Scale the hori|
00006280  7a 6f 6e 74 61 6c 20 70  6f 73 69 74 69 6f 6e 20  |zontal position |
00006290  75 70 0d 12 34 4f 20 20  20 20 20 20 20 20 4c 44  |up..4O        LD|
000062a0  52 20 20 20 20 20 72 35  2c 20 5b 72 31 32 2c 20  |R     r5, [r12, |
000062b0  23 77 73 5f 68 70 6f 73  5d 20 20 20 20 20 3b 20  |#ws_hpos]     ; |
000062c0  52 65 61 64 20 70 72 65  76 69 6f 75 73 20 68 6f  |Read previous ho|
000062d0  72 69 7a 6f 6e 74 61 6c  20 70 6f 73 69 74 69 6f  |rizontal positio|
000062e0  6e 0d 12 3e 4b 20 20 20  20 20 20 20 20 53 55 42  |n..>K        SUB|
000062f0  20 20 20 20 20 72 32 2c  20 72 34 2c 20 72 35 20  |     r2, r4, r5 |
00006300  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00006310  61 6c 63 75 6c 61 74 65  20 68 6f 72 69 7a 6f 6e  |alculate horizon|
00006320  74 61 6c 20 6d 6f 76 65  6d 65 6e 74 0d 12 48 4c  |tal movement..HL|
00006330  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00006340  72 32 2c 20 72 32 2c 20  41 53 52 23 31 20 20 20  |r2, r2, ASR#1   |
00006350  20 20 20 20 20 20 20 20  3b 20 52 65 64 75 63 65  |        ; Reduce|
00006360  20 74 68 65 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  | the horizontal |
00006370  70 6f 73 69 74 69 6f 6e  0d 12 52 50 20 20 20 20  |position..RP    |
00006380  20 20 20 20 41 44 44 20  20 20 20 20 72 34 2c 20  |    ADD     r4, |
00006390  72 35 2c 20 72 32 20 20  20 20 20 20 20 20 20 20  |r5, r2          |
000063a0  20 20 20 20 3b 20 41 6e  64 20 6d 6f 64 69 66 79  |    ; And modify|
000063b0  20 74 68 65 20 6c 61 73  74 20 6b 6e 6f 77 6e 20  | the last known |
000063c0  70 6f 73 69 74 69 6f 6e  0d 12 5c 4b 20 20 20 20  |position..\K    |
000063d0  20 20 20 20 4c 44 52 42  20 20 20 20 72 33 2c 20  |    LDRB    r3, |
000063e0  5b 72 31 2c 20 23 33 5d  20 20 20 20 20 20 20 20  |[r1, #3]        |
000063f0  20 20 20 20 3b 20 52 65  61 64 20 4c 53 42 20 6f  |    ; Read LSB o|
00006400  66 20 76 65 72 74 69 63  61 6c 20 70 6f 73 69 74  |f vertical posit|
00006410  69 6f 6e 0d 12 66 4b 20  20 20 20 20 20 20 20 4c  |ion..fK        L|
00006420  44 52 42 20 20 20 20 72  35 2c 20 5b 72 31 2c 20  |DRB    r5, [r1, |
00006430  23 34 5d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |#4]            ;|
00006440  20 52 65 61 64 20 4d 53  42 20 6f 66 20 76 65 72  | Read MSB of ver|
00006450  74 69 63 61 6c 20 70 6f  73 69 74 69 6f 6e 0d 12  |tical position..|
00006460  70 46 20 20 20 20 20 20  20 20 84 52 20 20 20 20  |pF        .R    |
00006470  20 72 33 2c 20 72 33 2c  20 72 35 2c 20 41 53 4c  | r3, r3, r5, ASL|
00006480  23 38 20 20 20 20 20 20  20 3b 20 43 6f 6d 62 69  |#8       ; Combi|
00006490  6e 65 20 76 65 72 74 69  63 61 6c 20 70 6f 73 69  |ne vertical posi|
000064a0  74 69 6f 6e 0d 12 7a 4c  20 20 20 20 20 20 20 20  |tion..zL        |
000064b0  4d 4f 56 20 20 20 20 20  72 33 2c 20 72 33 2c 20  |MOV     r3, r3, |
000064c0  41 53 4c 23 31 36 20 20  20 20 20 20 20 20 20 20  |ASL#16          |
000064d0  3b 20 53 63 61 6c 65 20  74 68 65 20 76 65 72 74  |; Scale the vert|
000064e0  69 63 61 6c 20 70 6f 73  69 74 69 6f 6e 20 75 70  |ical position up|
000064f0  0d 12 84 4d 20 20 20 20  20 20 20 20 4c 44 52 20  |...M        LDR |
00006500  20 20 20 20 72 35 2c 20  5b 72 31 32 2c 20 23 77  |    r5, [r12, #w|
00006510  73 5f 76 70 6f 73 5d 20  20 20 20 20 3b 20 52 65  |s_vpos]     ; Re|
00006520  61 64 20 70 72 65 76 69  6f 75 73 20 76 65 72 74  |ad previous vert|
00006530  69 63 61 6c 20 70 6f 73  69 74 69 6f 6e 0d 12 8e  |ical position...|
00006540  49 20 20 20 20 20 20 20  20 53 55 42 20 20 20 20  |I        SUB    |
00006550  20 72 31 2c 20 72 35 2c  20 72 33 20 20 20 20 20  | r1, r5, r3     |
00006560  20 20 20 20 20 20 20 20  20 3b 20 43 61 6c 63 75  |         ; Calcu|
00006570  6c 61 74 65 20 76 65 72  74 69 63 61 6c 20 6d 6f  |late vertical mo|
00006580  76 65 6d 65 6e 74 0d 12  98 4a 20 20 20 20 20 20  |vement...J      |
00006590  20 20 4d 4f 56 20 20 20  20 20 72 31 2c 20 72 31  |  MOV     r1, r1|
000065a0  2c 20 41 53 52 23 31 20  20 20 20 20 20 20 20 20  |, ASR#1         |
000065b0  20 20 3b 20 52 65 64 75  63 65 20 74 68 65 20 76  |  ; Reduce the v|
000065c0  65 72 74 69 63 61 6c 20  6d 6f 76 65 6d 65 6e 74  |ertical movement|
000065d0  0d 12 a2 50 20 20 20 20  20 20 20 20 53 55 42 20  |...P        SUB |
000065e0  20 20 20 20 72 33 2c 20  72 35 2c 20 72 31 20 20  |    r3, r5, r1  |
000065f0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 41 6e  |            ; An|
00006600  64 20 6d 6f 64 69 66 79  20 74 68 65 20 6c 61 73  |d modify the las|
00006610  74 20 6b 6e 6f 77 6e 20  70 6f 73 69 74 69 6f 6e  |t known position|
00006620  0d 12 ac 51 20 20 20 20  20 20 20 20 53 54 52 20  |...Q        STR |
00006630  20 20 20 20 72 33 2c 20  5b 72 31 32 2c 20 23 77  |    r3, [r12, #w|
00006640  73 5f 76 70 6f 73 5d 20  20 20 20 20 3b 20 53 74  |s_vpos]     ; St|
00006650  6f 72 65 20 74 68 65 20  75 70 64 61 74 65 64 20  |ore the updated |
00006660  76 65 72 74 69 63 61 6c  20 70 6f 73 69 74 69 6f  |vertical positio|
00006670  6e 0d 12 b6 53 20 20 20  20 20 20 20 20 53 54 52  |n...S        STR|
00006680  20 20 20 20 20 72 34 2c  20 5b 72 31 32 2c 20 23  |     r4, [r12, #|
00006690  77 73 5f 68 70 6f 73 5d  20 20 20 20 20 3b 20 53  |ws_hpos]     ; S|
000066a0  74 6f 72 65 20 74 68 65  20 75 70 64 61 74 65 64  |tore the updated|
000066b0  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 70 6f 73 69  | horizontal posi|
000066c0  74 69 6f 6e 0d 12 c0 49  20 20 20 20 20 20 20 20  |tion...I        |
000066d0  4c 44 52 20 20 20 20 20  72 33 2c 20 5b 72 31 32  |LDR     r3, [r12|
000066e0  2c 20 23 77 73 5f 63 65  69 67 5d 20 20 20 20 20  |, #ws_ceig]     |
000066f0  3b 20 52 65 61 64 20 74  68 65 20 63 6f 6d 6d 6f  |; Read the commo|
00006700  6e 20 65 69 67 65 6e 20  76 61 6c 75 65 0d 12 ca  |n eigen value...|
00006710  41 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |A        MOV    |
00006720  20 72 34 2c 20 23 31 20  20 20 20 20 20 20 20 20  | r4, #1         |
00006730  20 20 20 20 20 20 20 20  20 3b 20 56 61 6c 75 65  |         ; Value|
00006740  20 74 6f 20 62 65 20 73  68 69 66 74 65 64 0d 12  | to be shifted..|
00006750  d4 3d 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.=        MOV   |
00006760  20 20 72 34 2c 20 72 34  2c 20 41 53 4c 20 72 33  |  r4, r4, ASL r3|
00006770  20 20 20 20 20 20 20 20  20 20 3b 20 54 68 65 20  |          ; The |
00006780  65 69 67 65 6e 20 76 61  6c 75 65 0d 12 de 50 20  |eigen value...P |
00006790  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
000067a0  31 2c 20 72 31 2c 20 72  34 2c 20 41 53 52 23 31  |1, r1, r4, ASR#1|
000067b0  20 20 20 20 20 20 20 3b  20 49 6d 70 72 6f 76 65  |       ; Improve|
000067c0  20 76 65 72 74 69 63 61  6c 20 6d 6f 76 65 6d 65  | vertical moveme|
000067d0  6e 74 20 72 6f 75 6e 64  69 6e 67 0d 12 e8 52 20  |nt rounding...R |
000067e0  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
000067f0  32 2c 20 72 32 2c 20 72  34 2c 20 41 53 52 23 31  |2, r2, r4, ASR#1|
00006800  20 20 20 20 20 20 20 3b  20 49 6d 70 72 6f 76 65  |       ; Improve|
00006810  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 6d 6f 76 65  | horizontal move|
00006820  6d 65 6e 74 20 72 6f 75  6e 64 69 6e 67 0d 12 f2  |ment rounding...|
00006830  49 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |I        MOV    |
00006840  20 72 31 2c 20 72 31 2c  20 41 53 52 20 72 33 20  | r1, r1, ASR r3 |
00006850  20 20 20 20 20 20 20 20  20 3b 20 53 63 61 6c 65  |         ; Scale|
00006860  20 74 68 65 20 76 65 72  74 69 63 61 6c 20 6d 6f  | the vertical mo|
00006870  76 65 6d 65 6e 74 0d 12  fc 4b 20 20 20 20 20 20  |vement...K      |
00006880  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 72 32  |  MOV     r2, r2|
00006890  2c 20 41 53 52 20 72 33  20 20 20 20 20 20 20 20  |, ASR r3        |
000068a0  20 20 3b 20 53 63 61 6c  65 20 74 68 65 20 68 6f  |  ; Scale the ho|
000068b0  72 69 7a 6f 6e 74 61 6c  20 6d 6f 76 65 6d 65 6e  |rizontal movemen|
000068c0  74 0d 13 06 4e 20 20 20  20 20 20 20 20 41 44 52  |t...N        ADR|
000068d0  20 20 20 20 20 72 31 34  2c 20 75 70 64 61 74 65  |     r14, update|
000068e0  5f 70 6c 6f 74 20 20 20  20 20 20 20 20 3b 20 52  |_plot        ; R|
000068f0  65 74 75 72 6e 20 61 64  64 72 65 73 73 20 74 6f  |eturn address to|
00006900  20 75 70 64 61 74 65 20  70 6f 69 6e 74 65 72 0d  | update pointer.|
00006910  13 10 4a 20 20 20 20 20  20 20 20 41 44 44 20 20  |..J        ADD  |
00006920  20 20 20 70 63 2c 20 70  63 2c 20 72 30 2c 20 4c  |   pc, pc, r0, L|
00006930  53 4c 23 32 20 20 20 20  20 20 20 3b 20 4a 75 6d  |SL#2       ; Jum|
00006940  70 20 74 6f 20 74 68 65  20 72 65 6c 65 76 61 6e  |p to the relevan|
00006950  74 20 72 6f 75 74 69 6e  65 0d 13 1a 50 20 20 20  |t routine...P   |
00006960  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
00006970  20 72 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | r0             |
00006980  20 20 20 20 20 3b 20 54  68 69 73 20 69 6e 73 74  |     ; This inst|
00006990  72 75 63 74 69 6f 6e 20  69 73 20 6e 65 76 65 72  |ruction is never|
000069a0  20 65 78 65 63 75 74 65  64 0d 13 24 40 20 20 20  | executed..$@   |
000069b0  20 20 20 20 20 42 20 20  20 20 20 20 20 75 70 64  |     B       upd|
000069c0  61 74 65 5f 64 6f 6e 65  20 20 20 20 20 20 20 20  |ate_done        |
000069d0  20 20 20 20 20 3b 20 53  68 61 70 65 20 30 20 69  |     ; Shape 0 i|
000069e0  73 20 75 6e 6b 6e 6f 77  6e 0d 13 2e 49 20 20 20  |s unknown...I   |
000069f0  20 20 20 20 20 42 20 20  20 20 20 20 20 75 70 64  |     B       upd|
00006a00  61 74 65 5f 73 69 6e 67  6c 65 20 20 20 20 20 20  |ate_single      |
00006a10  20 20 20 20 20 3b 20 53  68 61 70 65 20 31 20 69  |     ; Shape 1 i|
00006a20  73 20 61 20 73 69 6e 67  6c 65 20 70 6f 69 6e 74  |s a single point|
00006a30  65 72 0d 13 38 4f 20 20  20 20 20 20 20 20 42 20  |er..8O        B |
00006a40  20 20 20 20 20 20 75 70  64 61 74 65 5f 64 6f 75  |      update_dou|
00006a50  62 6c 65 20 20 20 20 20  20 20 20 20 20 20 3b 20  |ble           ; |
00006a60  53 68 61 70 65 20 32 20  69 73 20 61 20 64 6f 75  |Shape 2 is a dou|
00006a70  62 6c 65 20 63 6c 69 63  6b 20 70 6f 69 6e 74 65  |ble click pointe|
00006a80  72 0d 13 42 51 20 20 20  20 20 20 20 20 42 20 20  |r..BQ        B  |
00006a90  20 20 20 20 20 75 70 64  61 74 65 5f 77 72 69 74  |     update_writ|
00006aa0  65 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |e            ; S|
00006ab0  68 61 70 65 20 33 20 69  73 20 61 20 63 61 72 65  |hape 3 is a care|
00006ac0  74 20 6f 72 20 77 72 69  74 61 62 6c 65 20 69 63  |t or writable ic|
00006ad0  6f 6e 0d 13 4c 4a 20 20  20 20 20 20 20 20 42 20  |on..LJ        B |
00006ae0  20 20 20 20 20 20 75 70  64 61 74 65 5f 6d 65 6e  |      update_men|
00006af0  75 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |u             ; |
00006b00  53 68 61 70 65 20 34 20  69 73 20 61 20 70 6f 70  |Shape 4 is a pop|
00006b10  75 70 20 6d 65 6e 75 20  69 63 6f 6e 0d 13 56 10  |up menu icon..V.|
00006b20  2e 75 70 64 61 74 65 5f  70 6c 6f 74 0d 13 60 4e  |.update_plot..`N|
00006b30  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00006b40  72 30 2c 20 23 32 31 20  20 20 20 20 20 20 20 20  |r0, #21         |
00006b50  20 20 20 20 20 20 20 20  3b 20 52 65 61 73 6f 6e  |        ; Reason|
00006b60  20 63 6f 64 65 20 74 6f  20 73 65 74 20 70 6f 69  | code to set poi|
00006b70  6e 74 65 72 20 73 68 61  70 65 0d 13 6a 48 20 20  |nter shape..jH  |
00006b80  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 31  |      ADD     r1|
00006b90  2c 20 72 31 32 2c 20 23  77 73 5f 70 74 72 5f 62  |, r12, #ws_ptr_b|
00006ba0  6c 6f 63 6b 20 20 3b 20  50 6f 69 6e 74 65 72 20  |lock  ; Pointer |
00006bb0  74 6f 20 70 61 72 61 6d  65 74 65 72 20 62 6c 6f  |to parameter blo|
00006bc0  63 6b 0d 13 74 43 20 20  20 20 20 20 20 20 53 54  |ck..tC        ST|
00006bd0  52 20 20 20 20 20 72 30  2c 20 5b 72 31 32 2c 20  |R     r0, [r12, |
00006be0  23 77 73 5f 69 6e 74 65  72 6e 61 6c 5d 20 3b 20  |#ws_internal] ; |
00006bf0  53 65 74 20 74 68 65 20  69 6e 74 65 72 6e 61 6c  |Set the internal|
00006c00  20 66 6c 61 67 0d 13 7e  40 20 20 20 20 20 20 20  | flag..~@       |
00006c10  20 53 57 49 20 20 20 20  20 22 58 4f 53 5f 57 6f  | SWI     "XOS_Wo|
00006c20  72 64 22 20 20 20 20 20  20 20 20 20 20 20 20 20  |rd"             |
00006c30  20 3b 20 44 65 66 69 6e  65 20 74 68 65 20 70 6f  | ; Define the po|
00006c40  69 6e 74 65 72 0d 13 88  50 20 20 20 20 20 20 20  |inter...P       |
00006c50  20 42 56 53 20 20 20 20  20 75 70 64 61 74 65 5f  | BVS     update_|
00006c60  64 6f 6e 65 20 20 20 20  20 20 20 20 20 20 20 20  |done            |
00006c70  20 3b 20 53 6b 69 70 20  74 68 65 20 72 65 73 74  | ; Skip the rest|
00006c80  20 69 6e 20 61 6e 20 65  72 72 6f 72 20 70 72 6f  | in an error pro|
00006c90  64 75 63 65 64 0d 13 92  4b 20 20 20 20 20 20 20  |duced...K       |
00006ca0  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 31 30  | MOV     r0, #10|
00006cb0  36 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |6               |
00006cc0  20 3b 20 52 65 61 73 6f  6e 20 63 6f 64 65 20 74  | ; Reason code t|
00006cd0  6f 20 73 65 6c 65 63 74  20 70 6f 69 6e 74 65 72  |o select pointer|
00006ce0  0d 13 9c 48 20 20 20 20  20 20 20 20 4c 44 52 42  |...H        LDRB|
00006cf0  20 20 20 20 72 31 2c 20  5b 72 31 32 2c 20 23 77  |    r1, [r12, #w|
00006d00  73 5f 70 74 72 5f 62 6c  6f 63 6b 5f 73 68 61 70  |s_ptr_block_shap|
00006d10  65 5d 3b 20 47 65 74 20  74 68 65 20 73 68 61 70  |e]; Get the shap|
00006d20  65 20 6e 75 6d 62 65 72  0d 13 a6 41 20 20 20 20  |e number...A    |
00006d30  20 20 20 20 53 57 49 20  20 20 20 20 22 58 4f 53  |    SWI     "XOS|
00006d40  5f 42 79 74 65 22 20 20  20 20 20 20 20 20 20 20  |_Byte"          |
00006d50  20 20 20 20 3b 20 52 65  66 72 65 73 68 20 74 68  |    ; Refresh th|
00006d60  65 20 70 6f 69 6e 74 65  72 0d 13 b0 10 2e 75 70  |e pointer.....up|
00006d70  64 61 74 65 5f 64 6f 6e  65 0d 13 ba 4a 20 20 20  |date_done...J   |
00006d80  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
00006d90  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00006da0  20 20 20 20 20 3b 20 56  61 6c 75 65 20 74 6f 20  |     ; Value to |
00006db0  63 6c 65 61 72 20 74 68  65 20 66 6c 61 67 20 77  |clear the flag w|
00006dc0  69 74 68 0d 13 c4 45 20  20 20 20 20 20 20 20 53  |ith...E        S|
00006dd0  54 52 20 20 20 20 20 72  30 2c 20 5b 72 31 32 2c  |TR     r0, [r12,|
00006de0  20 23 77 73 5f 69 6e 74  65 72 6e 61 6c 5d 20 3b  | #ws_internal] ;|
00006df0  20 43 6c 65 61 72 20 74  68 65 20 69 6e 74 65 72  | Clear the inter|
00006e00  6e 61 6c 20 66 6c 61 67  0d 13 ce 48 20 20 20 20  |nal flag...H    |
00006e10  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
00006e20  2c 20 7b 72 30 2d 72 35  2c 20 70 63 7d 5e 20 20  |, {r0-r5, pc}^  |
00006e30  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
00006e40  6d 20 74 68 65 20 73 75  62 72 6f 75 74 69 6e 65  |m the subroutine|
00006e50  0d 13 d8 04 0d 13 e2 4a  20 20 20 20 20 20 20 20  |.......J        |
00006e60  3b 20 47 65 6e 65 72 61  74 65 20 61 20 73 74 61  |; Generate a sta|
00006e70  6e 64 61 72 64 20 70 6f  69 6e 74 65 72 20 73 68  |ndard pointer sh|
00006e80  61 70 65 20 74 68 61 74  20 68 61 73 20 6d 6f 76  |ape that has mov|
00006e90  65 64 20 62 79 20 28 72  32 2c 20 72 31 29 0d 13  |ed by (r2, r1)..|
00006ea0  ec 14 2e 75 70 64 61 74  65 5f 73 74 61 6e 64 61  |...update_standa|
00006eb0  72 64 0d 13 f6 3d 20 20  20 20 20 20 20 20 53 54  |rd...=        ST|
00006ec0  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 30 2c  |MFD   r13!, {r0,|
00006ed0  20 72 33 2d 72 38 2c 20  72 31 34 7d 20 20 3b 20  | r3-r8, r14}  ; |
00006ee0  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0d  |Stack registers.|
00006ef0  14 00 4e 20 20 20 20 20  20 20 20 4c 44 52 20 20  |..N        LDR  |
00006f00  20 20 20 72 35 2c 20 5b  72 31 32 2c 20 23 77 73  |   r5, [r12, #ws|
00006f10  5f 63 6f 67 72 5d 20 20  20 20 20 3b 20 52 65 61  |_cogr]     ; Rea|
00006f20  64 20 70 72 65 76 69 6f  75 73 20 72 6f 77 20 70  |d previous row p|
00006f30  6f 69 6e 74 65 72 20 63  65 6e 74 72 65 0d 14 0a  |ointer centre...|
00006f40  51 20 20 20 20 20 20 20  20 4c 44 52 20 20 20 20  |Q        LDR    |
00006f50  20 72 36 2c 20 5b 72 31  32 2c 20 23 77 73 5f 63  | r6, [r12, #ws_c|
00006f60  6f 67 63 5d 20 20 20 20  20 3b 20 52 65 61 64 20  |ogc]     ; Read |
00006f70  70 72 65 76 69 6f 75 73  20 63 6f 6c 75 6d 6e 20  |previous column |
00006f80  70 6f 69 6e 74 65 72 20  63 65 6e 74 72 65 0d 14  |pointer centre..|
00006f90  14 4b 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.K        MOV   |
00006fa0  20 20 72 37 2c 20 23 30  20 20 20 20 20 20 20 20  |  r7, #0        |
00006fb0  20 20 20 20 20 20 20 20  20 20 3b 20 53 74 61 72  |          ; Star|
00006fc0  74 20 62 79 20 61 73 73  75 6d 69 6e 67 20 6e 6f  |t by assuming no|
00006fd0  20 6d 6f 76 65 6d 65 6e  74 0d 14 1e 45 20 20 20  | movement...E   |
00006fe0  20 20 20 20 20 54 45 51  20 20 20 20 20 72 31 2c  |     TEQ     r1,|
00006ff0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
00007000  20 20 20 20 20 3b 20 49  73 20 74 68 65 72 65 20  |     ; Is there |
00007010  61 6e 79 20 72 6f 77 20  6d 6f 74 69 6f 6e 0d 14  |any row motion..|
00007020  28 48 20 20 20 20 20 20  20 20 54 45 51 45 51 20  |(H        TEQEQ |
00007030  20 20 72 32 2c 20 23 30  20 20 20 20 20 20 20 20  |  r2, #0        |
00007040  20 20 20 20 20 20 20 20  20 20 3b 20 49 73 20 74  |          ; Is t|
00007050  68 65 72 65 20 61 6e 79  20 63 6f 6c 75 6d 6e 20  |here any column |
00007060  6d 6f 74 69 6f 6e 0d 14  32 4e 20 20 20 20 20 20  |motion..2N      |
00007070  20 20 42 45 51 20 20 20  20 20 75 70 64 61 74 65  |  BEQ     update|
00007080  5f 73 74 61 6e 64 61 72  64 5f 73 74 69 6c 6c 20  |_standard_still |
00007090  20 20 3b 20 44 6f 20 6e  6f 74 20 63 68 61 6e 67  |  ; Do not chang|
000070a0  65 20 64 69 72 65 63 74  69 6f 6e 20 69 66 20 73  |e direction if s|
000070b0  74 69 6c 6c 0d 14 3c 4a  20 20 20 20 20 20 20 20  |till..<J        |
000070c0  41 44 44 20 20 20 20 20  72 35 2c 20 72 35 2c 20  |ADD     r5, r5, |
000070d0  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
000070e0  3b 20 43 61 6c 63 75 6c  61 74 65 20 74 68 65 20  |; Calculate the |
000070f0  6e 65 77 20 72 6f 77 20  6f 66 66 73 65 74 0d 14  |new row offset..|
00007100  46 4d 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |FM        ADD   |
00007110  20 20 72 36 2c 20 72 36  2c 20 72 32 20 20 20 20  |  r6, r6, r2    |
00007120  20 20 20 20 20 20 20 20  20 20 3b 20 43 61 6c 63  |          ; Calc|
00007130  75 6c 61 74 65 20 74 68  65 20 6e 65 77 20 63 6f  |ulate the new co|
00007140  6c 75 6d 6e 20 6f 66 66  73 65 74 0d 14 50 46 20  |lumn offset..PF |
00007150  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00007160  30 2c 20 72 35 2c 20 41  53 52 23 38 20 20 20 20  |0, r5, ASR#8    |
00007170  20 20 20 20 20 20 20 3b  20 53 63 61 6c 65 20 74  |       ; Scale t|
00007180  68 65 20 6e 65 77 20 72  6f 77 20 6f 66 66 73 65  |he new row offse|
00007190  74 0d 14 5a 47 20 20 20  20 20 20 20 20 4d 55 4c  |t..ZG        MUL|
000071a0  20 20 20 20 20 72 31 2c  20 72 30 2c 20 72 30 20  |     r1, r0, r0 |
000071b0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
000071c0  71 75 61 72 65 20 74 68  65 20 6e 65 77 20 72 6f  |quare the new ro|
000071d0  77 20 6f 66 66 73 65 74  0d 14 64 49 20 20 20 20  |w offset..dI    |
000071e0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
000071f0  72 36 2c 20 41 53 52 23  38 20 20 20 20 20 20 20  |r6, ASR#8       |
00007200  20 20 20 20 3b 20 53 63  61 6c 65 20 74 68 65 20  |    ; Scale the |
00007210  6e 65 77 20 63 6f 6c 75  6d 6e 20 6f 66 66 73 65  |new column offse|
00007220  74 0d 14 6e 4a 20 20 20  20 20 20 20 20 4d 55 4c  |t..nJ        MUL|
00007230  20 20 20 20 20 72 32 2c  20 72 30 2c 20 72 30 20  |     r2, r0, r0 |
00007240  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
00007250  71 75 61 72 65 20 74 68  65 20 6e 65 77 20 63 6f  |quare the new co|
00007260  6c 75 6d 6e 20 6f 66 66  73 65 74 0d 14 78 3d 20  |lumn offset..x= |
00007270  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
00007280  30 2c 20 72 31 2c 20 72  32 20 20 20 20 20 20 20  |0, r1, r2       |
00007290  20 20 20 20 20 20 20 3b  20 53 75 6d 20 74 68 65  |       ; Sum the|
000072a0  20 73 71 75 61 72 65 73  0d 14 82 4b 20 20 20 20  | squares...K    |
000072b0  20 20 20 20 42 4c 20 20  20 20 20 20 73 71 72 74  |    BL      sqrt|
000072c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000072d0  20 20 20 20 3b 20 43 61  6c 63 75 6c 61 74 65 20  |    ; Calculate |
000072e0  74 68 65 20 6e 65 77 20  74 61 69 6c 20 6c 65 6e  |the new tail len|
000072f0  67 74 68 0d 14 8c 4a 20  20 20 20 20 20 20 20 4d  |gth...J        M|
00007300  4f 56 20 20 20 20 20 72  30 2c 20 72 30 2c 20 41  |OV     r0, r0, A|
00007310  53 4c 23 38 20 20 20 20  20 20 20 20 20 20 20 3b  |SL#8           ;|
00007320  20 53 63 61 6c 65 20 74  68 65 20 6e 65 77 20 6c  | Scale the new l|
00007330  65 6e 67 74 68 20 62 61  63 6b 20 75 70 0d 14 96  |ength back up...|
00007340  49 20 20 20 20 20 20 20  20 53 55 42 20 20 20 20  |I        SUB    |
00007350  20 72 37 2c 20 72 30 2c  20 23 31 31 3c 3c 31 36  | r7, r0, #11<<16|
00007360  20 20 20 20 20 20 20 20  20 3b 20 53 75 62 74 72  |         ; Subtr|
00007370  61 63 74 20 74 68 65 20  6e 6f 6d 69 6e 61 6c 20  |act the nominal |
00007380  6c 65 6e 67 74 68 0d 14  a0 45 20 20 20 20 20 20  |length...E      |
00007390  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 72 35  |  MOV     r0, r5|
000073a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000073b0  20 20 3b 20 43 6f 70 79  20 74 68 65 20 6e 65 77  |  ; Copy the new|
000073c0  20 72 6f 77 20 6f 66 66  73 65 74 0d 14 aa 48 20  | row offset...H |
000073d0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
000073e0  31 2c 20 72 36 20 20 20  20 20 20 20 20 20 20 20  |1, r6           |
000073f0  20 20 20 20 20 20 20 3b  20 43 6f 70 79 20 74 68  |       ; Copy th|
00007400  65 20 6e 65 77 20 63 6f  6c 75 6d 6e 20 6f 66 66  |e new column off|
00007410  73 65 74 0d 14 b4 49 20  20 20 20 20 20 20 20 42  |set...I        B|
00007420  4c 20 20 20 20 20 20 6e  6f 72 6d 61 6c 69 73 65  |L      normalise|
00007430  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00007440  20 4e 6f 72 6d 61 6c 69  73 65 20 74 68 65 20 6f  | Normalise the o|
00007450  66 66 73 65 74 20 6c 65  6e 67 74 68 0d 14 be 4b  |ffset length...K|
00007460  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00007470  72 32 2c 20 23 31 31 20  20 20 20 20 20 20 20 20  |r2, #11         |
00007480  20 20 20 20 20 20 20 20  3b 20 54 68 65 20 72 65  |        ; The re|
00007490  71 75 69 72 65 64 20 74  61 69 6c 20 6d 61 73 73  |quired tail mass|
000074a0  20 6c 65 6e 67 74 68 0d  14 c8 43 20 20 20 20 20  | length...C     |
000074b0  20 20 20 4d 55 4c 20 20  20 20 20 72 35 2c 20 72  |   MUL     r5, r|
000074c0  32 2c 20 72 30 20 20 20  20 20 20 20 20 20 20 20  |2, r0           |
000074d0  20 20 20 3b 20 54 68 65  20 73 63 61 6c 65 64 20  |   ; The scaled |
000074e0  72 6f 77 20 6f 66 66 73  65 74 0d 14 d2 46 20 20  |row offset...F  |
000074f0  20 20 20 20 20 20 4d 55  4c 20 20 20 20 20 72 36  |      MUL     r6|
00007500  2c 20 72 32 2c 20 72 31  20 20 20 20 20 20 20 20  |, r2, r1        |
00007510  20 20 20 20 20 20 3b 20  54 68 65 20 73 63 61 6c  |      ; The scal|
00007520  65 64 20 63 6f 6c 75 6d  6e 20 6f 66 66 73 65 74  |ed column offset|
00007530  0d 14 dc 4a 20 20 20 20  20 20 20 20 53 54 52 20  |...J        STR |
00007540  20 20 20 20 72 35 2c 20  5b 72 31 32 2c 20 23 77  |    r5, [r12, #w|
00007550  73 5f 63 6f 67 72 5d 20  20 20 20 20 3b 20 53 74  |s_cogr]     ; St|
00007560  6f 72 65 20 74 68 65 20  75 70 64 61 74 65 64 20  |ore the updated |
00007570  72 6f 77 20 63 65 6e 74  72 65 0d 14 e6 4d 20 20  |row centre...M  |
00007580  20 20 20 20 20 20 53 54  52 20 20 20 20 20 72 36  |      STR     r6|
00007590  2c 20 5b 72 31 32 2c 20  23 77 73 5f 63 6f 67 63  |, [r12, #ws_cogc|
000075a0  5d 20 20 20 20 20 3b 20  53 74 6f 72 65 20 74 68  |]     ; Store th|
000075b0  65 20 75 70 64 61 74 65  64 20 63 6f 6c 75 6d 6e  |e updated column|
000075c0  20 63 65 6e 74 72 65 0d  14 f0 1a 2e 75 70 64 61  | centre.....upda|
000075d0  74 65 5f 73 74 61 6e 64  61 72 64 5f 73 74 69 6c  |te_standard_stil|
000075e0  6c 0d 14 fa 4e 20 20 20  20 20 20 20 20 4d 4f 56  |l...N        MOV|
000075f0  20 20 20 20 20 72 30 2c  20 72 37 2c 20 41 53 52  |     r0, r7, ASR|
00007600  23 33 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |#3           ; C|
00007610  6f 70 79 20 61 6e 64 20  73 63 61 6c 65 20 74 68  |opy and scale th|
00007620  65 20 6c 65 6e 67 74 68  20 6f 66 66 73 65 74 0d  |e length offset.|
00007630  15 04 47 20 20 20 20 20  20 20 20 42 4c 20 20 20  |..G        BL   |
00007640  20 20 20 75 70 64 61 74  65 5f 66 69 6c 74 65 72  |   update_filter|
00007650  20 20 20 20 20 20 20 20  20 20 20 3b 20 55 70 64  |           ; Upd|
00007660  61 74 65 20 74 68 65 20  70 6f 69 6e 74 65 72 20  |ate the pointer |
00007670  77 69 62 62 6c 65 0d 15  0e 4d 20 20 20 20 20 20  |wibble...M      |
00007680  20 20 41 44 44 20 20 20  20 20 72 30 2c 20 72 30  |  ADD     r0, r0|
00007690  2c 20 72 30 2c 20 41 53  4c 23 32 20 20 20 20 20  |, r0, ASL#2     |
000076a0  20 20 3b 20 4d 75 6c 74  69 70 6c 79 20 74 68 65  |  ; Multiply the|
000076b0  20 6c 65 6e 67 74 68 20  6f 66 66 73 65 74 20 62  | length offset b|
000076c0  79 20 35 0d 15 18 45 20  20 20 20 20 20 20 20 4d  |y 5...E        M|
000076d0  4f 56 20 20 20 20 20 72  37 2c 20 23 31 31 3c 3c  |OV     r7, #11<<|
000076e0  31 36 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |16             ;|
000076f0  20 54 68 65 20 6e 6f 6d  69 6e 61 6c 20 74 61 69  | The nominal tai|
00007700  6c 20 6c 65 6e 67 74 68  0d 15 22 4f 20 20 20 20  |l length.."O    |
00007710  20 20 20 20 41 44 44 20  20 20 20 20 72 37 2c 20  |    ADD     r7, |
00007720  72 37 2c 20 72 30 20 20  20 20 20 20 20 20 20 20  |r7, r0          |
00007730  20 20 20 20 3b 20 41 64  64 20 74 68 65 20 77 69  |    ; Add the wi|
00007740  62 62 6c 65 20 74 6f 20  74 68 65 20 74 61 69 6c  |bble to the tail|
00007750  20 6c 65 6e 67 74 68 0d  15 2c 54 20 20 20 20 20  | length..,T     |
00007760  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
00007770  37 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |7               |
00007780  20 20 20 3b 20 4e 75 6d  62 65 72 20 6f 66 20 63  |   ; Number of c|
00007790  6f 6f 72 64 69 6e 61 74  65 73 20 69 6e 20 70 6f  |oordinates in po|
000077a0  69 6e 74 65 72 20 73 68  61 70 65 0d 15 36 49 20  |inter shape..6I |
000077b0  20 20 20 20 20 20 20 41  44 52 20 20 20 20 20 72  |       ADR     r|
000077c0  31 2c 20 75 70 64 61 74  65 5f 73 74 61 6e 64 61  |1, update_standa|
000077d0  72 64 5f 62 61 73 69 63  3b 20 50 6f 69 6e 74 65  |rd_basic; Pointe|
000077e0  72 20 74 6f 20 74 68 65  20 62 61 73 69 63 20 73  |r to the basic s|
000077f0  68 61 70 65 0d 15 40 50  20 20 20 20 20 20 20 20  |hape..@P        |
00007800  41 44 52 20 20 20 20 20  72 32 2c 20 75 70 64 61  |ADR     r2, upda|
00007810  74 65 5f 73 74 61 6e 64  61 72 64 5f 6c 65 6e 67  |te_standard_leng|
00007820  74 68 3b 20 50 6f 69 6e  74 65 72 20 74 6f 20 74  |th; Pointer to t|
00007830  68 65 20 6c 65 6e 67 74  68 20 61 64 6a 75 73 74  |he length adjust|
00007840  6d 65 6e 74 0d 15 4a 4b  20 20 20 20 20 20 20 20  |ment..JK        |
00007850  4d 4f 56 20 20 20 20 20  72 33 2c 20 72 37 20 20  |MOV     r3, r7  |
00007860  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007870  3b 20 43 6f 70 79 20 74  68 65 20 72 65 71 75 69  |; Copy the requi|
00007880  72 65 64 20 68 65 61 64  20 6c 65 6e 67 74 68 0d  |red head length.|
00007890  15 54 4f 20 20 20 20 20  20 20 20 41 44 44 20 20  |.TO        ADD  |
000078a0  20 20 20 72 34 2c 20 72  31 32 2c 20 23 77 73 5f  |   r4, r12, #ws_|
000078b0  62 75 66 66 65 72 20 20  20 20 20 3b 20 50 6f 69  |buffer     ; Poi|
000078c0  6e 74 65 72 20 74 6f 20  74 68 65 20 64 65 73 74  |nter to the dest|
000078d0  69 6e 61 74 69 6f 6e 20  62 75 66 66 65 72 0d 15  |ination buffer..|
000078e0  5e 4a 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |^J        BL    |
000078f0  20 20 74 72 61 6e 73 5f  61 64 64 20 20 20 20 20  |  trans_add     |
00007900  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 74 20  |          ; Set |
00007910  74 68 65 20 72 65 71 75  69 72 65 64 20 68 65 61  |the required hea|
00007920  64 20 6c 65 6e 67 74 68  0d 15 68 52 20 20 20 20  |d length..hR    |
00007930  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 2c 20  |    MOV     r1, |
00007940  72 34 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r4              |
00007950  20 20 20 20 3b 20 4e 65  77 20 73 6f 75 72 63 65  |    ; New source|
00007960  20 62 75 66 66 65 72 20  69 73 20 70 72 65 76 69  | buffer is previ|
00007970  6f 75 73 20 6f 75 74 70  75 74 0d 15 72 4e 20 20  |ous output..rN  |
00007980  20 20 20 20 20 20 41 44  52 20 20 20 20 20 72 32  |      ADR     r2|
00007990  2c 20 75 70 64 61 74 65  5f 73 74 61 6e 64 61 72  |, update_standar|
000079a0  64 5f 74 61 69 6c 3b 20  50 6f 69 6e 74 65 72 20  |d_tail; Pointer |
000079b0  74 6f 20 74 61 69 6c 20  77 69 64 74 68 20 61 64  |to tail width ad|
000079c0  6a 75 73 74 6d 65 6e 74  0d 15 7c 3d 20 20 20 20  |justment..|=    |
000079d0  20 20 20 20 53 54 4d 46  44 20 20 20 72 31 33 21  |    STMFD   r13!|
000079e0  2c 20 7b 72 30 2d 72 31  7d 20 20 20 20 20 20 20  |, {r0-r1}       |
000079f0  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
00007a00  73 74 65 72 73 0d 15 86  4a 20 20 20 20 20 20 20  |sters...J       |
00007a10  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 31 30  | MOV     r0, #10|
00007a20  30 3c 3c 31 36 20 20 20  20 20 20 20 20 20 20 20  |0<<16           |
00007a30  20 3b 20 41 72 65 61 20  74 6f 20 64 69 76 69 64  | ; Area to divid|
00007a40  65 20 62 79 20 74 68 65  20 6c 65 6e 67 74 68 0d  |e by the length.|
00007a50  15 90 43 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..C        MOV  |
00007a60  20 20 20 72 31 2c 20 72  37 2c 20 41 53 52 23 31  |   r1, r7, ASR#1|
00007a70  36 20 20 20 20 20 20 20  20 20 20 3b 20 53 63 61  |6          ; Sca|
00007a80  6c 65 20 74 68 65 20 74  61 69 6c 20 6c 65 6e 67  |le the tail leng|
00007a90  74 68 0d 15 9a 47 20 20  20 20 20 20 20 20 52 53  |th...G        RS|
00007aa0  42 20 20 20 20 20 72 31  2c 20 72 31 2c 20 23 32  |B     r1, r1, #2|
00007ab0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |1             ; |
00007ac0  43 61 6c 63 75 6c 61 74  65 20 74 68 65 20 74 61  |Calculate the ta|
00007ad0  69 6c 20 6c 65 6e 67 74  68 0d 15 a4 4d 20 20 20  |il length...M   |
00007ae0  20 20 20 20 20 42 4c 20  20 20 20 20 20 64 69 76  |     BL      div|
00007af0  69 64 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ide             |
00007b00  20 20 20 20 20 3b 20 43  61 6c 63 75 6c 61 74 65  |     ; Calculate|
00007b10  20 74 68 65 20 74 61 69  6c 20 77 69 64 74 68 20  | the tail width |
00007b20  6f 66 66 73 65 74 0d 15  ae 48 20 20 20 20 20 20  |offset...H      |
00007b30  20 20 4d 4f 56 20 20 20  20 20 72 33 2c 20 72 30  |  MOV     r3, r0|
00007b40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007b50  20 20 3b 20 43 6f 70 79  20 74 68 65 20 74 61 69  |  ; Copy the tai|
00007b60  6c 20 77 69 64 74 68 20  6f 66 66 73 65 74 0d 15  |l width offset..|
00007b70  b8 3f 20 20 20 20 20 20  20 20 4c 44 4d 46 44 20  |.?        LDMFD |
00007b80  20 20 72 31 33 21 2c 20  7b 72 30 2d 72 31 7d 20  |  r13!, {r0-r1} |
00007b90  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 73 74  |          ; Rest|
00007ba0  6f 72 65 20 72 65 67 69  73 74 65 72 73 0d 15 c2  |ore registers...|
00007bb0  4c 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |L        BL     |
00007bc0  20 74 72 61 6e 73 5f 61  64 64 20 20 20 20 20 20  | trans_add      |
00007bd0  20 20 20 20 20 20 20 20  20 3b 20 53 65 74 20 74  |         ; Set t|
00007be0  68 65 20 77 69 64 74 68  20 6f 66 20 74 68 65 20  |he width of the |
00007bf0  74 61 69 6c 20 62 61 73  65 0d 15 cc 4e 20 20 20  |tail base...N   |
00007c00  20 20 20 20 20 41 44 52  20 20 20 20 20 72 32 2c  |     ADR     r2,|
00007c10  20 75 70 64 61 74 65 5f  73 74 61 6e 64 61 72 64  | update_standard|
00007c20  5f 68 65 61 64 3b 20 50  6f 69 6e 74 65 72 20 74  |_head; Pointer t|
00007c30  6f 20 68 65 61 64 20 77  69 64 74 68 20 61 64 6a  |o head width adj|
00007c40  75 73 74 6d 65 6e 74 0d  15 d6 3d 20 20 20 20 20  |ustment...=     |
00007c50  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
00007c60  20 7b 72 30 2d 72 31 7d  20 20 20 20 20 20 20 20  | {r0-r1}        |
00007c70  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
00007c80  74 65 72 73 0d 15 e0 4a  20 20 20 20 20 20 20 20  |ters...J        |
00007c90  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 31 33 32  |MOV     r0, #132|
00007ca0  3c 3c 31 36 20 20 20 20  20 20 20 20 20 20 20 20  |<<16            |
00007cb0  3b 20 41 72 65 61 20 74  6f 20 64 69 76 69 64 65  |; Area to divide|
00007cc0  20 62 79 20 74 68 65 20  6c 65 6e 67 74 68 0d 15  | by the length..|
00007cd0  ea 43 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.C        MOV   |
00007ce0  20 20 72 31 2c 20 72 37  2c 20 41 53 52 23 31 36  |  r1, r7, ASR#16|
00007cf0  20 20 20 20 20 20 20 20  20 20 3b 20 53 63 61 6c  |          ; Scal|
00007d00  65 20 74 68 65 20 74 61  69 6c 20 6c 65 6e 67 74  |e the tail lengt|
00007d10  68 0d 15 f4 4d 20 20 20  20 20 20 20 20 42 4c 20  |h...M        BL |
00007d20  20 20 20 20 20 64 69 76  69 64 65 20 20 20 20 20  |     divide     |
00007d30  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00007d40  61 6c 63 75 6c 61 74 65  20 74 68 65 20 68 65 61  |alculate the hea|
00007d50  64 20 77 69 64 74 68 20  6f 66 66 73 65 74 0d 15  |d width offset..|
00007d60  fe 48 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.H        MOV   |
00007d70  20 20 72 33 2c 20 72 30  20 20 20 20 20 20 20 20  |  r3, r0        |
00007d80  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 70 79  |          ; Copy|
00007d90  20 74 68 65 20 68 65 61  64 20 77 69 64 74 68 20  | the head width |
00007da0  6f 66 66 73 65 74 0d 16  08 3f 20 20 20 20 20 20  |offset...?      |
00007db0  20 20 4c 44 4d 46 44 20  20 20 72 31 33 21 2c 20  |  LDMFD   r13!, |
00007dc0  7b 72 30 2d 72 31 7d 20  20 20 20 20 20 20 20 20  |{r0-r1}         |
00007dd0  20 20 3b 20 52 65 73 74  6f 72 65 20 72 65 67 69  |  ; Restore regi|
00007de0  73 74 65 72 73 0d 16 12  4e 20 20 20 20 20 20 20  |sters...N       |
00007df0  20 42 4c 20 20 20 20 20  20 74 72 61 6e 73 5f 61  | BL      trans_a|
00007e00  64 64 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |dd              |
00007e10  20 3b 20 53 65 74 20 74  68 65 20 77 69 64 74 68  | ; Set the width|
00007e20  20 6f 66 20 74 68 65 20  68 65 61 64 65 72 20 62  | of the header b|
00007e30  61 73 65 0d 16 1c 52 20  20 20 20 20 20 20 20 4d  |ase...R        M|
00007e40  4f 56 20 20 20 20 20 72  32 2c 20 72 31 20 20 20  |OV     r2, r1   |
00007e50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00007e60  20 44 65 73 74 69 6e 61  74 69 6f 6e 20 63 6f 6f  | Destination coo|
00007e70  72 64 69 6e 61 74 65 73  20 61 72 65 20 74 68 65  |rdinates are the|
00007e80  20 73 61 6d 65 0d 16 26  4f 20 20 20 20 20 20 20  | same..&O       |
00007e90  20 4d 4f 56 20 20 20 20  20 72 33 2c 20 72 35 20  | MOV     r3, r5 |
00007ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007eb0  20 3b 20 52 6f 77 20 63  6f 6d 70 6f 6e 65 6e 74  | ; Row component|
00007ec0  20 6f 66 20 64 65 73 69  72 65 64 20 76 65 72 74  | of desired vert|
00007ed0  69 63 61 6c 0d 16 30 52  20 20 20 20 20 20 20 20  |ical..0R        |
00007ee0  4d 4f 56 20 20 20 20 20  72 34 2c 20 72 36 20 20  |MOV     r4, r6  |
00007ef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007f00  3b 20 43 6f 6c 75 6d 6e  20 63 6f 6d 70 6f 6e 65  |; Column compone|
00007f10  6e 74 20 6f 66 20 64 65  73 69 72 65 64 20 76 65  |nt of desired ve|
00007f20  72 74 69 63 61 6c 0d 16  3a 4c 20 20 20 20 20 20  |rtical..:L      |
00007f30  20 20 42 4c 20 20 20 20  20 20 74 72 61 6e 73 5f  |  BL      trans_|
00007f40  72 6f 74 61 74 65 20 20  20 20 20 20 20 20 20 20  |rotate          |
00007f50  20 20 3b 20 52 6f 74 61  74 65 20 74 68 65 20 70  |  ; Rotate the p|
00007f60  6f 69 6e 74 65 72 20 61  73 20 72 65 71 75 69 72  |ointer as requir|
00007f70  65 64 0d 16 44 53 20 20  20 20 20 20 20 20 42 4c  |ed..DS        BL|
00007f80  20 20 20 20 20 20 74 72  61 6e 73 5f 66 69 74 20  |      trans_fit |
00007f90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00007fa0  53 63 61 6c 65 20 74 68  65 20 63 6f 6f 72 64 69  |Scale the coordi|
00007fb0  6e 61 74 65 73 20 66 6f  72 20 74 68 65 20 70 6f  |nates for the po|
00007fc0  69 6e 74 65 72 0d 16 4e  47 20 20 20 20 20 20 20  |inter..NG       |
00007fd0  20 4d 4f 56 20 20 20 20  20 72 31 2c 20 72 30 20  | MOV     r1, r0 |
00007fe0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00007ff0  20 3b 20 43 6f 70 79 20  74 68 65 20 6e 75 6d 62  | ; Copy the numb|
00008000  65 72 20 6f 66 20 70 6f  69 6e 74 73 0d 16 58 44  |er of points..XD|
00008010  20 20 20 20 20 20 20 20  4c 44 4d 46 44 20 20 20  |        LDMFD   |
00008020  72 31 33 21 2c 20 7b 72  30 2c 20 72 33 2d 72 38  |r13!, {r0, r3-r8|
00008030  2c 20 70 63 7d 20 20 20  3b 20 52 65 74 75 72 6e  |, pc}   ; Return|
00008040  20 66 72 6f 6d 20 73 75  62 72 6f 75 74 69 6e 65  | from subroutine|
00008050  0d 16 62 45 2e 75 70 64  61 74 65 5f 73 74 61 6e  |..bE.update_stan|
00008060  64 61 72 64 5f 62 61 73  69 63 20 20 20 20 20 20  |dard_basic      |
00008070  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 54 68  |            ; Th|
00008080  65 20 62 61 73 69 63 20  70 6f 69 6e 74 65 72 20  |e basic pointer |
00008090  73 68 61 70 65 0d 16 6c  1d 20 20 20 20 20 20 20  |shape..l.       |
000080a0  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2c 20  | .coordinate(0, |
000080b0  30 29 0d 16 76 1d 20 20  20 20 20 20 20 20 a4 63  |0)..v.        .c|
000080c0  6f 6f 72 64 69 6e 61 74  65 28 30 2c 20 30 29 0d  |oordinate(0, 0).|
000080d0  16 80 1d 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |...        .coor|
000080e0  64 69 6e 61 74 65 28 30  2c 20 32 29 0d 16 8a 1f  |dinate(0, 2)....|
000080f0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
00008100  61 74 65 28 32 31 2c 20  2d 32 29 0d 16 94 1e 20  |ate(21, -2).... |
00008110  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
00008120  74 65 28 32 31 2c 20 32  29 0d 16 9e 1e 20 20 20  |te(21, 2)....   |
00008130  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00008140  28 30 2c 20 2d 32 29 0d  16 a8 1d 20 20 20 20 20  |(0, -2)....     |
00008150  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
00008160  2c 20 30 29 0d 16 b2 4f  2e 75 70 64 61 74 65 5f  |, 0)...O.update_|
00008170  73 74 61 6e 64 61 72 64  5f 6c 65 6e 67 74 68 20  |standard_length |
00008180  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00008190  3b 20 4f 66 66 73 65 74  73 20 74 6f 20 63 68 61  |; Offsets to cha|
000081a0  6e 67 65 20 74 68 65 20  68 65 61 64 20 6c 65 6e  |nge the head len|
000081b0  67 74 68 0d 16 bc 1d 20  20 20 20 20 20 20 20 a4  |gth....        .|
000081c0  63 6f 6f 72 64 69 6e 61  74 65 28 30 2c 20 30 29  |coordinate(0, 0)|
000081d0  0d 16 c6 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
000081e0  72 64 69 6e 61 74 65 28  31 2c 20 30 29 0d 16 d0  |rdinate(1, 0)...|
000081f0  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00008200  6e 61 74 65 28 31 2c 20  30 29 0d 16 da 1d 20 20  |nate(1, 0)....  |
00008210  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00008220  65 28 30 2c 20 30 29 0d  16 e4 1d 20 20 20 20 20  |e(0, 0)....     |
00008230  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
00008240  2c 20 30 29 0d 16 ee 1d  20 20 20 20 20 20 20 20  |, 0)....        |
00008250  a4 63 6f 6f 72 64 69 6e  61 74 65 28 31 2c 20 30  |.coordinate(1, 0|
00008260  29 0d 16 f8 1d 20 20 20  20 20 20 20 20 a4 63 6f  |)....        .co|
00008270  6f 72 64 69 6e 61 74 65  28 31 2c 20 30 29 0d 17  |ordinate(1, 0)..|
00008280  02 4e 2e 75 70 64 61 74  65 5f 73 74 61 6e 64 61  |.N.update_standa|
00008290  72 64 5f 74 61 69 6c 20  20 20 20 20 20 20 20 20  |rd_tail         |
000082a0  20 20 20 20 20 20 20 20  20 20 3b 20 4f 66 66 73  |          ; Offs|
000082b0  65 74 73 20 74 6f 20 63  68 61 6e 67 65 20 74 68  |ets to change th|
000082c0  65 20 74 61 69 6c 20 77  69 64 74 68 0d 17 0c 1d  |e tail width....|
000082d0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
000082e0  61 74 65 28 30 2c 20 30  29 0d 17 16 1d 20 20 20  |ate(0, 0)....   |
000082f0  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00008300  28 30 2c 20 30 29 0d 17  20 1d 20 20 20 20 20 20  |(0, 0).. .      |
00008310  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
00008320  20 30 29 0d 17 2a 1f 20  20 20 20 20 20 20 20 a4  | 0)..*.        .|
00008330  63 6f 6f 72 64 69 6e 61  74 65 28 30 2c 20 30 2e  |coordinate(0, 0.|
00008340  35 29 0d 17 34 20 20 20  20 20 20 20 20 20 a4 63  |5)..4         .c|
00008350  6f 6f 72 64 69 6e 61 74  65 28 30 2c 20 2d 30 2e  |oordinate(0, -0.|
00008360  35 29 0d 17 3e 1d 20 20  20 20 20 20 20 20 a4 63  |5)..>.        .c|
00008370  6f 6f 72 64 69 6e 61 74  65 28 30 2c 20 30 29 0d  |oordinate(0, 0).|
00008380  17 48 1d 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |.H.        .coor|
00008390  64 69 6e 61 74 65 28 30  2c 20 30 29 0d 17 52 4e  |dinate(0, 0)..RN|
000083a0  2e 75 70 64 61 74 65 5f  73 74 61 6e 64 61 72 64  |.update_standard|
000083b0  5f 68 65 61 64 20 20 20  20 20 20 20 20 20 20 20  |_head           |
000083c0  20 20 20 20 20 20 20 20  3b 20 4f 66 66 73 65 74  |        ; Offset|
000083d0  73 20 74 6f 20 63 68 61  6e 67 65 20 74 68 65 20  |s to change the |
000083e0  68 65 61 64 20 77 69 64  74 68 0d 17 5c 1d 20 20  |head width..\.  |
000083f0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00008400  65 28 30 2c 20 30 29 0d  17 66 1f 20 20 20 20 20  |e(0, 0)..f.     |
00008410  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
00008420  2c 20 30 2e 35 29 0d 17  70 1d 20 20 20 20 20 20  |, 0.5)..p.      |
00008430  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
00008440  20 30 29 0d 17 7a 1d 20  20 20 20 20 20 20 20 a4  | 0)..z.        .|
00008450  63 6f 6f 72 64 69 6e 61  74 65 28 30 2c 20 30 29  |coordinate(0, 0)|
00008460  0d 17 84 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
00008470  72 64 69 6e 61 74 65 28  30 2c 20 30 29 0d 17 8e  |rdinate(0, 0)...|
00008480  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00008490  6e 61 74 65 28 30 2c 20  30 29 0d 17 98 20 20 20  |nate(0, 0)...   |
000084a0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
000084b0  65 28 30 2c 20 2d 30 2e  35 29 0d 17 a2 04 0d 17  |e(0, -0.5)......|
000084c0  ac 46 20 20 20 20 20 20  20 20 3b 20 50 6c 6f 74  |.F        ; Plot|
000084d0  20 61 20 73 69 6e 67 6c  65 20 70 6f 69 6e 74 65  | a single pointe|
000084e0  72 20 74 79 70 65 20 72  30 20 74 68 61 74 20 68  |r type r0 that h|
000084f0  61 73 20 6d 6f 76 65 64  20 62 79 20 28 72 32 2c  |as moved by (r2,|
00008500  20 72 31 29 0d 17 b6 12  2e 75 70 64 61 74 65 5f  | r1).....update_|
00008510  73 69 6e 67 6c 65 0d 17  c0 3d 20 20 20 20 20 20  |single...=      |
00008520  20 20 53 54 4d 46 44 20  20 20 72 31 33 21 2c 20  |  STMFD   r13!, |
00008530  7b 72 30 2d 72 32 2c 20  72 31 34 7d 20 20 20 20  |{r0-r2, r14}    |
00008540  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
00008550  65 72 73 0d 17 ca 49 20  20 20 20 20 20 20 20 42  |ers...I        B|
00008560  4c 20 20 20 20 20 20 75  70 64 61 74 65 5f 73 74  |L      update_st|
00008570  61 6e 64 61 72 64 20 20  20 20 20 20 20 20 20 3b  |andard         ;|
00008580  20 43 6f 6e 73 74 72 75  63 74 20 74 68 65 20 70  | Construct the p|
00008590  6f 69 6e 74 65 72 20 73  68 61 70 65 0d 17 d4 47  |ointer shape...G|
000085a0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
000085b0  72 30 2c 20 23 63 6f 6c  6f 75 72 5f 74 72 61 6e  |r0, #colour_tran|
000085c0  73 20 20 20 20 20 20 20  3b 20 42 61 63 6b 67 72  |s       ; Backgr|
000085d0  6f 75 6e 64 20 69 73 20  74 72 61 6e 73 70 61 72  |ound is transpar|
000085e0  65 6e 74 0d 17 de 49 20  20 20 20 20 20 20 20 42  |ent...I        B|
000085f0  4c 20 20 20 20 20 20 70  6c 6f 74 5f 66 69 6c 6c  |L      plot_fill|
00008600  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00008610  20 43 6c 65 61 72 20 74  68 65 20 70 6f 69 6e 74  | Clear the point|
00008620  65 72 20 69 6e 69 74 69  61 6c 6c 79 0d 17 e8 4f  |er initially...O|
00008630  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00008640  72 30 2c 20 23 63 6f 6c  6f 75 72 5f 62 6c 75 65  |r0, #colour_blue|
00008650  20 20 20 20 20 20 20 20  3b 20 46 69 6c 6c 20 74  |        ; Fill t|
00008660  68 65 20 69 6e 74 65 72  69 6f 72 20 77 69 74 68  |he interior with|
00008670  20 73 6f 6c 69 64 20 62  6c 75 65 0d 17 f2 46 20  | solid blue...F |
00008680  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 70  |       BL      p|
00008690  6c 6f 74 5f 70 6f 6c 79  5f 66 69 6c 6c 20 20 20  |lot_poly_fill   |
000086a0  20 20 20 20 20 20 20 3b  20 50 6c 6f 74 20 74 68  |       ; Plot th|
000086b0  65 20 66 69 6c 6c 65 64  20 69 6e 74 65 72 69 6f  |e filled interio|
000086c0  72 0d 17 fc 49 20 20 20  20 20 20 20 20 4d 4f 56  |r...I        MOV|
000086d0  20 20 20 20 20 72 30 2c  20 23 63 6f 6c 6f 75 72  |     r0, #colour|
000086e0  5f 63 79 61 6e 20 20 20  20 20 20 20 20 3b 20 4f  |_cyan        ; O|
000086f0  75 74 6c 69 6e 65 20 74  68 65 20 70 6f 69 6e 74  |utline the point|
00008700  65 72 20 69 6e 20 63 79  61 6e 0d 18 06 46 20 20  |er in cyan...F  |
00008710  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 70 6c  |      BL      pl|
00008720  6f 74 5f 70 6f 6c 79 5f  6c 69 6e 65 20 20 20 20  |ot_poly_line    |
00008730  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 74 68 65  |      ; Plot the|
00008740  20 70 6f 69 6e 74 65 72  20 6f 75 74 6c 69 6e 65  | pointer outline|
00008750  0d 18 10 44 20 20 20 20  20 20 20 20 4c 44 4d 46  |...D        LDMF|
00008760  44 20 20 20 72 31 33 21  2c 20 7b 72 30 2d 72 32  |D   r13!, {r0-r2|
00008770  2c 20 70 63 7d 20 20 20  20 20 20 20 3b 20 52 65  |, pc}       ; Re|
00008780  74 75 72 6e 20 66 72 6f  6d 20 73 75 62 72 6f 75  |turn from subrou|
00008790  74 69 6e 65 0d 18 1a 04  0d 18 24 4c 20 20 20 20  |tine......$L    |
000087a0  20 20 20 20 3b 20 50 6c  6f 74 20 61 20 64 6f 75  |    ; Plot a dou|
000087b0  62 6c 65 20 63 6c 69 63  6b 20 70 6f 69 6e 74 65  |ble click pointe|
000087c0  72 20 74 79 70 65 20 72  30 20 74 68 61 74 20 68  |r type r0 that h|
000087d0  61 73 20 6d 6f 76 65 64  20 62 79 20 28 72 32 2c  |as moved by (r2,|
000087e0  20 72 31 29 0d 18 2e 12  2e 75 70 64 61 74 65 5f  | r1).....update_|
000087f0  64 6f 75 62 6c 65 0d 18  38 3d 20 20 20 20 20 20  |double..8=      |
00008800  20 20 53 54 4d 46 44 20  20 20 72 31 33 21 2c 20  |  STMFD   r13!, |
00008810  7b 72 30 2d 72 32 2c 20  72 31 34 7d 20 20 20 20  |{r0-r2, r14}    |
00008820  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
00008830  65 72 73 0d 18 42 49 20  20 20 20 20 20 20 20 42  |ers..BI        B|
00008840  4c 20 20 20 20 20 20 75  70 64 61 74 65 5f 73 74  |L      update_st|
00008850  61 6e 64 61 72 64 20 20  20 20 20 20 20 20 20 3b  |andard         ;|
00008860  20 43 6f 6e 73 74 72 75  63 74 20 74 68 65 20 70  | Construct the p|
00008870  6f 69 6e 74 65 72 20 73  68 61 70 65 0d 18 4c 47  |ointer shape..LG|
00008880  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00008890  72 30 2c 20 23 63 6f 6c  6f 75 72 5f 74 72 61 6e  |r0, #colour_tran|
000088a0  73 20 20 20 20 20 20 20  3b 20 42 61 63 6b 67 72  |s       ; Backgr|
000088b0  6f 75 6e 64 20 69 73 20  74 72 61 6e 73 70 61 72  |ound is transpar|
000088c0  65 6e 74 0d 18 56 49 20  20 20 20 20 20 20 20 42  |ent..VI        B|
000088d0  4c 20 20 20 20 20 20 70  6c 6f 74 5f 66 69 6c 6c  |L      plot_fill|
000088e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000088f0  20 43 6c 65 61 72 20 74  68 65 20 70 6f 69 6e 74  | Clear the point|
00008900  65 72 20 69 6e 69 74 69  61 6c 6c 79 0d 18 60 51  |er initially..`Q|
00008910  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00008920  72 30 2c 20 23 63 6f 6c  6f 75 72 5f 74 72 61 6e  |r0, #colour_tran|
00008930  73 5f 62 6c 75 65 20 20  3b 20 46 69 6c 6c 20 69  |s_blue  ; Fill i|
00008940  6e 74 65 72 69 6f 72 20  77 69 74 68 20 74 72 61  |nterior with tra|
00008950  6e 73 70 61 72 65 6e 74  20 62 6c 75 65 0d 18 6a  |nsparent blue..j|
00008960  46 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |F        BL     |
00008970  20 70 6c 6f 74 5f 70 6f  6c 79 5f 66 69 6c 6c 20  | plot_poly_fill |
00008980  20 20 20 20 20 20 20 20  20 3b 20 50 6c 6f 74 20  |         ; Plot |
00008990  74 68 65 20 66 69 6c 6c  65 64 20 69 6e 74 65 72  |the filled inter|
000089a0  69 6f 72 0d 18 74 49 20  20 20 20 20 20 20 20 4d  |ior..tI        M|
000089b0  4f 56 20 20 20 20 20 72  30 2c 20 23 63 6f 6c 6f  |OV     r0, #colo|
000089c0  75 72 5f 63 79 61 6e 20  20 20 20 20 20 20 20 3b  |ur_cyan        ;|
000089d0  20 4f 75 74 6c 69 6e 65  20 74 68 65 20 70 6f 69  | Outline the poi|
000089e0  6e 74 65 72 20 69 6e 20  63 79 61 6e 0d 18 7e 46  |nter in cyan..~F|
000089f0  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
00008a00  70 6c 6f 74 5f 70 6f 6c  79 5f 6c 69 6e 65 20 20  |plot_poly_line  |
00008a10  20 20 20 20 20 20 20 20  3b 20 50 6c 6f 74 20 74  |        ; Plot t|
00008a20  68 65 20 70 6f 69 6e 74  65 72 20 6f 75 74 6c 69  |he pointer outli|
00008a30  6e 65 0d 18 88 44 20 20  20 20 20 20 20 20 4c 44  |ne...D        LD|
00008a40  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 30 2d  |MFD   r13!, {r0-|
00008a50  72 32 2c 20 70 63 7d 20  20 20 20 20 20 20 3b 20  |r2, pc}       ; |
00008a60  52 65 74 75 72 6e 20 66  72 6f 6d 20 73 75 62 72  |Return from subr|
00008a70  6f 75 74 69 6e 65 0d 18  92 04 0d 18 9c 45 20 20  |outine.......E  |
00008a80  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 61 20 63  |      ; Plot a c|
00008a90  61 72 65 74 20 70 6f 69  6e 74 65 72 20 74 79 70  |aret pointer typ|
00008aa0  65 20 72 30 20 74 68 61  74 20 68 61 73 20 6d 6f  |e r0 that has mo|
00008ab0  76 65 64 20 62 79 20 28  72 32 2c 20 72 31 29 0d  |ved by (r2, r1).|
00008ac0  18 a6 11 2e 75 70 64 61  74 65 5f 77 72 69 74 65  |....update_write|
00008ad0  0d 18 b0 3d 20 20 20 20  20 20 20 20 53 54 4d 46  |...=        STMF|
00008ae0  44 20 20 20 72 31 33 21  2c 20 7b 72 30 2d 72 36  |D   r13!, {r0-r6|
00008af0  2c 20 72 31 34 7d 20 20  20 20 20 20 3b 20 53 74  |, r14}      ; St|
00008b00  61 63 6b 20 72 65 67 69  73 74 65 72 73 0d 18 ba  |ack registers...|
00008b10  4b 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |K        MOV    |
00008b20  20 72 30 2c 20 72 32 2c  20 41 53 52 23 33 20 20  | r0, r2, ASR#3  |
00008b30  20 20 20 20 20 20 20 20  20 3b 20 56 61 6c 75 65  |         ; Value|
00008b40  20 74 6f 20 75 70 64 61  74 65 20 70 6f 73 69 74  | to update posit|
00008b50  69 6f 6e 20 77 69 74 68  0d 18 c4 3f 20 20 20 20  |ion with...?    |
00008b60  20 20 20 20 42 4c 20 20  20 20 20 20 75 70 64 61  |    BL      upda|
00008b70  74 65 5f 66 69 6c 74 65  72 20 20 20 20 20 20 20  |te_filter       |
00008b80  20 20 20 20 3b 20 46 69  6c 74 65 72 20 74 68 65  |    ; Filter the|
00008b90  20 75 70 64 61 74 65 0d  18 ce 44 20 20 20 20 20  | update...D     |
00008ba0  20 20 20 4d 4f 56 20 20  20 20 20 72 33 2c 20 72  |   MOV     r3, r|
00008bb0  30 2c 20 41 53 4c 23 32  20 20 20 20 20 20 20 20  |0, ASL#2        |
00008bc0  20 20 20 3b 20 43 6f 70  79 20 74 68 65 20 66 69  |   ; Copy the fi|
00008bd0  6c 74 65 72 20 6f 75 74  70 75 74 0d 18 d8 43 20  |lter output...C |
00008be0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00008bf0  30 2c 20 23 32 32 20 20  20 20 20 20 20 20 20 20  |0, #22          |
00008c00  20 20 20 20 20 20 20 3b  20 4e 75 6d 62 65 72 20  |       ; Number |
00008c10  6f 66 20 63 6f 6f 72 64  69 6e 61 74 65 73 0d 18  |of coordinates..|
00008c20  e2 48 20 20 20 20 20 20  20 20 41 44 52 20 20 20  |.H        ADR   |
00008c30  20 20 72 31 2c 20 75 70  64 61 74 65 5f 77 72 69  |  r1, update_wri|
00008c40  74 65 5f 62 61 73 69 63  20 20 3b 20 54 68 65 20  |te_basic  ; The |
00008c50  72 65 71 75 69 72 65 64  20 70 6f 69 6e 74 65 72  |required pointer|
00008c60  20 73 68 61 70 65 0d 18  ec 51 20 20 20 20 20 20  | shape...Q      |
00008c70  20 20 41 44 52 20 20 20  20 20 72 32 2c 20 75 70  |  ADR     r2, up|
00008c80  64 61 74 65 5f 77 72 69  74 65 5f 68 6f 72 69 7a  |date_write_horiz|
00008c90  6f 6e 74 61 6c 3b 20 43  68 61 6e 67 65 73 20 74  |ontal; Changes t|
00008ca0  6f 20 61 64 64 20 68 6f  72 69 7a 6f 6e 74 61 6c  |o add horizontal|
00008cb0  20 6d 6f 74 69 6f 6e 0d  18 f6 4b 20 20 20 20 20  | motion...K     |
00008cc0  20 20 20 41 44 44 20 20  20 20 20 72 34 2c 20 72  |   ADD     r4, r|
00008cd0  31 32 2c 20 23 77 73 5f  62 75 66 66 65 72 20 20  |12, #ws_buffer  |
00008ce0  20 20 20 3b 20 50 6f 69  6e 74 65 72 20 74 6f 20  |   ; Pointer to |
00008cf0  64 65 73 74 69 6e 61 74  69 6f 6e 20 62 75 66 66  |destination buff|
00008d00  65 72 0d 19 00 49 20 20  20 20 20 20 20 20 42 4c  |er...I        BL|
00008d10  20 20 20 20 20 20 74 72  61 6e 73 5f 61 64 64 20  |      trans_add |
00008d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00008d30  41 64 64 20 74 68 65 20  6d 6f 74 69 6f 6e 20 74  |Add the motion t|
00008d40  6f 20 74 68 65 20 73 68  61 70 65 0d 19 0a 41 20  |o the shape...A |
00008d50  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00008d60  31 2c 20 72 34 20 20 20  20 20 20 20 20 20 20 20  |1, r4           |
00008d70  20 20 20 20 20 20 20 3b  20 43 6f 70 79 20 62 75  |       ; Copy bu|
00008d80  66 66 65 72 20 70 6f 69  6e 74 65 72 0d 19 14 51  |ffer pointer...Q|
00008d90  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00008da0  72 32 2c 20 72 31 20 20  20 20 20 20 20 20 20 20  |r2, r1          |
00008db0  20 20 20 20 20 20 20 20  3b 20 55 73 65 20 74 68  |        ; Use th|
00008dc0  65 20 73 61 6d 65 20 62  75 66 66 65 72 20 66 6f  |e same buffer fo|
00008dd0  72 20 74 68 65 20 72 65  73 75 6c 74 73 0d 19 1e  |r the results...|
00008de0  53 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |S        BL     |
00008df0  20 74 72 61 6e 73 5f 66  69 74 20 20 20 20 20 20  | trans_fit      |
00008e00  20 20 20 20 20 20 20 20  20 3b 20 53 63 61 6c 65  |         ; Scale|
00008e10  20 74 68 65 20 63 6f 6f  72 64 69 6e 61 74 65 73  | the coordinates|
00008e20  20 66 6f 72 20 74 68 65  20 70 6f 69 6e 74 65 72  | for the pointer|
00008e30  0d 19 28 47 20 20 20 20  20 20 20 20 4d 4f 56 20  |..(G        MOV |
00008e40  20 20 20 20 72 31 2c 20  72 30 20 20 20 20 20 20  |    r1, r0      |
00008e50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6f  |            ; Co|
00008e60  70 79 20 74 68 65 20 6e  75 6d 62 65 72 20 6f 66  |py the number of|
00008e70  20 70 6f 69 6e 74 73 0d  19 32 47 20 20 20 20 20  | points..2G     |
00008e80  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
00008e90  63 6f 6c 6f 75 72 5f 74  72 61 6e 73 20 20 20 20  |colour_trans    |
00008ea0  20 20 20 3b 20 42 61 63  6b 67 72 6f 75 6e 64 20  |   ; Background |
00008eb0  69 73 20 74 72 61 6e 73  70 61 72 65 6e 74 0d 19  |is transparent..|
00008ec0  3c 49 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |<I        BL    |
00008ed0  20 20 70 6c 6f 74 5f 66  69 6c 6c 20 20 20 20 20  |  plot_fill     |
00008ee0  20 20 20 20 20 20 20 20  20 20 3b 20 43 6c 65 61  |          ; Clea|
00008ef0  72 20 74 68 65 20 70 6f  69 6e 74 65 72 20 69 6e  |r the pointer in|
00008f00  69 74 69 61 6c 6c 79 0d  19 46 4b 20 20 20 20 20  |itially..FK     |
00008f10  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 23  |   MOV     r0, #|
00008f20  63 6f 6c 6f 75 72 5f 62  6c 75 65 20 20 20 20 20  |colour_blue     |
00008f30  20 20 20 3b 20 46 69 6c  6c 20 69 6e 74 65 72 69  |   ; Fill interi|
00008f40  6f 72 20 77 69 74 68 20  73 6f 6c 69 64 20 62 6c  |or with solid bl|
00008f50  75 65 0d 19 50 46 20 20  20 20 20 20 20 20 42 4c  |ue..PF        BL|
00008f60  20 20 20 20 20 20 70 6c  6f 74 5f 70 6f 6c 79 5f  |      plot_poly_|
00008f70  66 69 6c 6c 20 20 20 20  20 20 20 20 20 20 3b 20  |fill          ; |
00008f80  50 6c 6f 74 20 74 68 65  20 66 69 6c 6c 65 64 20  |Plot the filled |
00008f90  69 6e 74 65 72 69 6f 72  0d 19 5a 49 20 20 20 20  |interior..ZI    |
00008fa0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 30 2c 20  |    MOV     r0, |
00008fb0  23 63 6f 6c 6f 75 72 5f  63 79 61 6e 20 20 20 20  |#colour_cyan    |
00008fc0  20 20 20 20 3b 20 4f 75  74 6c 69 6e 65 20 74 68  |    ; Outline th|
00008fd0  65 20 70 6f 69 6e 74 65  72 20 69 6e 20 63 79 61  |e pointer in cya|
00008fe0  6e 0d 19 64 46 20 20 20  20 20 20 20 20 42 4c 20  |n..dF        BL |
00008ff0  20 20 20 20 20 70 6c 6f  74 5f 70 6f 6c 79 5f 6c  |     plot_poly_l|
00009000  69 6e 65 20 20 20 20 20  20 20 20 20 20 3b 20 50  |ine          ; P|
00009010  6c 6f 74 20 74 68 65 20  70 6f 69 6e 74 65 72 20  |lot the pointer |
00009020  6f 75 74 6c 69 6e 65 0d  19 6e 44 20 20 20 20 20  |outline..nD     |
00009030  20 20 20 4c 44 4d 46 44  20 20 20 72 31 33 21 2c  |   LDMFD   r13!,|
00009040  20 7b 72 30 2d 72 36 2c  20 70 63 7d 20 20 20 20  | {r0-r6, pc}    |
00009050  20 20 20 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |   ; Return from|
00009060  20 73 75 62 72 6f 75 74  69 6e 65 0d 19 78 45 2e  | subroutine..xE.|
00009070  75 70 64 61 74 65 5f 77  72 69 74 65 5f 62 61 73  |update_write_bas|
00009080  69 63 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |ic              |
00009090  20 20 20 20 20 20 20 3b  20 54 68 65 20 62 61 73  |       ; The bas|
000090a0  69 63 20 70 6f 69 6e 74  65 72 20 73 68 61 70 65  |ic pointer shape|
000090b0  0d 19 82 20 20 20 20 20  20 20 20 20 a4 63 6f 6f  |...         .coo|
000090c0  72 64 69 6e 61 74 65 28  2d 31 30 2c 20 2d 34 29  |rdinate(-10, -4)|
000090d0  0d 19 8c 20 20 20 20 20  20 20 20 20 a4 63 6f 6f  |...         .coo|
000090e0  72 64 69 6e 61 74 65 28  2d 31 30 2c 20 2d 32 29  |rdinate(-10, -2)|
000090f0  0d 19 96 1e 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
00009100  72 64 69 6e 61 74 65 28  2d 38 2c 20 30 29 0d 19  |rdinate(-8, 0)..|
00009110  a0 1f 20 20 20 20 20 20  20 20 a4 63 6f 6f 72 64  |..        .coord|
00009120  69 6e 61 74 65 28 2d 31  30 2c 20 32 29 0d 19 aa  |inate(-10, 2)...|
00009130  1f 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00009140  6e 61 74 65 28 2d 31 30  2c 20 34 29 0d 19 b4 1e  |nate(-10, 4)....|
00009150  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
00009160  61 74 65 28 2d 38 2c 20  34 29 0d 19 be 1e 20 20  |ate(-8, 4)....  |
00009170  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009180  65 28 2d 37 2c 20 31 29  0d 19 c8 1e 20 20 20 20  |e(-7, 1)....    |
00009190  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
000091a0  2d 32 2c 20 31 29 0d 19  d2 1d 20 20 20 20 20 20  |-2, 1)....      |
000091b0  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 32 2c  |  .coordinate(2,|
000091c0  20 31 29 0d 19 dc 1d 20  20 20 20 20 20 20 20 a4  | 1)....        .|
000091d0  63 6f 6f 72 64 69 6e 61  74 65 28 36 2c 20 31 29  |coordinate(6, 1)|
000091e0  0d 19 e6 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
000091f0  72 64 69 6e 61 74 65 28  37 2c 20 34 29 0d 19 f0  |rdinate(7, 4)...|
00009200  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
00009210  6e 61 74 65 28 39 2c 20  34 29 0d 19 fa 1d 20 20  |nate(9, 4)....  |
00009220  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009230  65 28 39 2c 20 32 29 0d  1a 04 1d 20 20 20 20 20  |e(9, 2)....     |
00009240  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 37  |   .coordinate(7|
00009250  2c 20 30 29 0d 1a 0e 1e  20 20 20 20 20 20 20 20  |, 0)....        |
00009260  a4 63 6f 6f 72 64 69 6e  61 74 65 28 39 2c 20 2d  |.coordinate(9, -|
00009270  32 29 0d 1a 18 1e 20 20  20 20 20 20 20 20 a4 63  |2)....        .c|
00009280  6f 6f 72 64 69 6e 61 74  65 28 39 2c 20 2d 34 29  |oordinate(9, -4)|
00009290  0d 1a 22 1e 20 20 20 20  20 20 20 20 a4 63 6f 6f  |..".        .coo|
000092a0  72 64 69 6e 61 74 65 28  37 2c 20 2d 34 29 0d 1a  |rdinate(7, -4)..|
000092b0  2c 1e 20 20 20 20 20 20  20 20 a4 63 6f 6f 72 64  |,.        .coord|
000092c0  69 6e 61 74 65 28 36 2c  20 2d 31 29 0d 1a 36 1e  |inate(6, -1)..6.|
000092d0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
000092e0  61 74 65 28 32 2c 20 2d  31 29 0d 1a 40 1f 20 20  |ate(2, -1)..@.  |
000092f0  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009300  65 28 2d 32 2c 20 2d 31  29 0d 1a 4a 1f 20 20 20  |e(-2, -1)..J.   |
00009310  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00009320  28 2d 37 2c 20 2d 31 29  0d 1a 54 1f 20 20 20 20  |(-7, -1)..T.    |
00009330  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
00009340  2d 38 2c 20 2d 34 29 0d  1a 5e 4d 2e 75 70 64 61  |-8, -4)..^M.upda|
00009350  74 65 5f 77 72 69 74 65  5f 68 6f 72 69 7a 6f 6e  |te_write_horizon|
00009360  74 61 6c 20 20 20 20 20  20 20 20 20 20 20 20 20  |tal             |
00009370  20 20 20 3b 20 4f 66 66  73 65 74 73 20 74 6f 20  |   ; Offsets to |
00009380  64 69 73 74 6f 72 74 20  68 6f 72 69 7a 6f 6e 74  |distort horizont|
00009390  61 6c 6c 79 0d 1a 68 20  20 20 20 20 20 20 20 20  |ally..h         |
000093a0  a4 63 6f 6f 72 64 69 6e  61 74 65 28 30 2e 36 2c  |.coordinate(0.6,|
000093b0  20 2d 31 29 0d 1a 72 22  20 20 20 20 20 20 20 20  | -1)..r"        |
000093c0  a4 63 6f 6f 72 64 69 6e  61 74 65 28 30 2e 33 2c  |.coordinate(0.3,|
000093d0  20 2d 30 2e 38 29 0d 1a  7c 20 20 20 20 20 20 20  | -0.8)..|       |
000093e0  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2c  |  .coordinate(0,|
000093f0  20 2d 30 2e 36 29 0d 1a  86 23 20 20 20 20 20 20  | -0.6)...#      |
00009400  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 2d 30  |  .coordinate(-0|
00009410  2e 33 2c 20 2d 30 2e 38  29 0d 1a 90 21 20 20 20  |.3, -0.8)...!   |
00009420  20 20 20 20 20 a4 63 6f  6f 72 64 69 6e 61 74 65  |     .coordinate|
00009430  28 2d 30 2e 36 2c 20 2d  31 29 0d 1a 9a 21 20 20  |(-0.6, -1)...!  |
00009440  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
00009450  65 28 2d 30 2e 36 2c 20  2d 31 29 0d 1a a4 24 20  |e(-0.6, -1)...$ |
00009460  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
00009470  74 65 28 2d 30 2e 31 35  2c 20 2d 30 2e 35 29 0d  |te(-0.15, -0.5).|
00009480  1a ae 22 20 20 20 20 20  20 20 20 a4 63 6f 6f 72  |.."        .coor|
00009490  64 69 6e 61 74 65 28 2d  30 2e 31 35 2c 20 2d 30  |dinate(-0.15, -0|
000094a0  29 0d 1a b8 21 20 20 20  20 20 20 20 20 a4 63 6f  |)...!        .co|
000094b0  6f 72 64 69 6e 61 74 65  28 30 2e 31 35 2c 20 2d  |ordinate(0.15, -|
000094c0  30 29 0d 1a c2 23 20 20  20 20 20 20 20 20 a4 63  |0)...#        .c|
000094d0  6f 6f 72 64 69 6e 61 74  65 28 30 2e 31 35 2c 20  |oordinate(0.15, |
000094e0  2d 30 2e 35 29 0d 1a cc  20 20 20 20 20 20 20 20  |-0.5)...        |
000094f0  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2e 36  | .coordinate(0.6|
00009500  2c 20 2d 31 29 0d 1a d6  20 20 20 20 20 20 20 20  |, -1)...        |
00009510  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2e 36  | .coordinate(0.6|
00009520  2c 20 2d 31 29 0d 1a e0  22 20 20 20 20 20 20 20  |, -1)..."       |
00009530  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 30 2e 33  | .coordinate(0.3|
00009540  2c 20 2d 30 2e 38 29 0d  1a ea 20 20 20 20 20 20  |, -0.8)...      |
00009550  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
00009560  2c 20 2d 30 2e 36 29 0d  1a f4 23 20 20 20 20 20  |, -0.6)...#     |
00009570  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 2d  |   .coordinate(-|
00009580  30 2e 33 2c 20 2d 30 2e  38 29 0d 1a fe 21 20 20  |0.3, -0.8)...!  |
00009590  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
000095a0  65 28 2d 30 2e 36 2c 20  2d 31 29 0d 1b 08 21 20  |e(-0.6, -1)...! |
000095b0  20 20 20 20 20 20 20 a4  63 6f 6f 72 64 69 6e 61  |       .coordina|
000095c0  74 65 28 2d 30 2e 36 2c  20 2d 31 29 0d 1b 12 24  |te(-0.6, -1)...$|
000095d0  20 20 20 20 20 20 20 20  a4 63 6f 6f 72 64 69 6e  |        .coordin|
000095e0  61 74 65 28 2d 30 2e 31  35 2c 20 2d 30 2e 35 29  |ate(-0.15, -0.5)|
000095f0  0d 1b 1c 22 20 20 20 20  20 20 20 20 a4 63 6f 6f  |..."        .coo|
00009600  72 64 69 6e 61 74 65 28  2d 30 2e 31 35 2c 20 2d  |rdinate(-0.15, -|
00009610  30 29 0d 1b 26 21 20 20  20 20 20 20 20 20 a4 63  |0)..&!        .c|
00009620  6f 6f 72 64 69 6e 61 74  65 28 30 2e 31 35 2c 20  |oordinate(0.15, |
00009630  2d 30 29 0d 1b 30 23 20  20 20 20 20 20 20 20 a4  |-0)..0#        .|
00009640  63 6f 6f 72 64 69 6e 61  74 65 28 30 2e 31 35 2c  |coordinate(0.15,|
00009650  20 2d 30 2e 35 29 0d 1b  3a 20 20 20 20 20 20 20  | -0.5)..:       |
00009660  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2e  |  .coordinate(0.|
00009670  36 2c 20 2d 31 29 0d 1b  44 04 0d 1b 4e 44 20 20  |6, -1)..D...ND  |
00009680  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 61 20 6d  |      ; Plot a m|
00009690  65 6e 75 20 70 6f 69 6e  74 65 72 20 74 79 70 65  |enu pointer type|
000096a0  20 72 30 20 74 68 61 74  20 68 61 73 20 6d 6f 76  | r0 that has mov|
000096b0  65 64 20 62 79 20 28 72  32 2c 20 72 31 29 0d 1b  |ed by (r2, r1)..|
000096c0  58 10 2e 75 70 64 61 74  65 5f 6d 65 6e 75 0d 1b  |X..update_menu..|
000096d0  62 3d 20 20 20 20 20 20  20 20 53 54 4d 46 44 20  |b=        STMFD |
000096e0  20 20 72 31 33 21 2c 20  7b 72 30 2d 72 34 2c 20  |  r13!, {r0-r4, |
000096f0  72 31 34 7d 20 20 20 20  20 20 3b 20 53 74 61 63  |r14}      ; Stac|
00009700  6b 20 72 65 67 69 73 74  65 72 73 0d 1b 6c 49 20  |k registers..lI |
00009710  20 20 20 20 20 20 20 4c  44 52 20 20 20 20 20 72  |       LDR     r|
00009720  33 2c 20 5b 72 31 32 2c  20 23 77 73 5f 63 6f 67  |3, [r12, #ws_cog|
00009730  72 5d 20 20 20 20 20 3b  20 52 65 61 64 20 70 72  |r]     ; Read pr|
00009740  65 76 69 6f 75 73 20 72  6f 77 20 64 69 72 65 63  |evious row direc|
00009750  74 69 6f 6e 0d 1b 76 4c  20 20 20 20 20 20 20 20  |tion..vL        |
00009760  4c 44 52 20 20 20 20 20  72 34 2c 20 5b 72 31 32  |LDR     r4, [r12|
00009770  2c 20 23 77 73 5f 63 6f  67 63 5d 20 20 20 20 20  |, #ws_cogc]     |
00009780  3b 20 52 65 61 64 20 70  72 65 76 69 6f 75 73 20  |; Read previous |
00009790  63 6f 6c 75 6d 6e 20 64  69 72 65 63 74 69 6f 6e  |column direction|
000097a0  0d 1b 80 4a 20 20 20 20  20 20 20 20 54 45 51 20  |...J        TEQ |
000097b0  20 20 20 20 72 31 2c 20  23 30 20 20 20 20 20 20  |    r1, #0      |
000097c0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 49 73  |            ; Is|
000097d0  20 74 68 65 72 65 20 61  6e 79 20 76 65 72 74 69  | there any verti|
000097e0  63 61 6c 20 6d 6f 74 69  6f 6e 0d 1b 8a 4c 20 20  |cal motion...L  |
000097f0  20 20 20 20 20 20 54 45  51 45 51 20 20 20 72 32  |      TEQEQ   r2|
00009800  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
00009810  20 20 20 20 20 20 3b 20  49 73 20 74 68 65 72 65  |      ; Is there|
00009820  20 61 6e 79 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  | any horizontal |
00009830  6d 6f 74 69 6f 6e 0d 1b  94 4e 20 20 20 20 20 20  |motion...N      |
00009840  20 20 42 45 51 20 20 20  20 20 75 70 64 61 74 65  |  BEQ     update|
00009850  5f 6d 65 6e 75 5f 73 74  69 6c 6c 20 20 20 20 20  |_menu_still     |
00009860  20 20 3b 20 44 6f 20 6e  6f 74 20 63 68 61 6e 67  |  ; Do not chang|
00009870  65 20 64 69 72 65 63 74  69 6f 6e 20 69 66 20 73  |e direction if s|
00009880  74 69 6c 6c 0d 1b 9e 46  20 20 20 20 20 20 20 20  |till...F        |
00009890  41 44 44 20 20 20 20 20  72 30 2c 20 72 33 2c 20  |ADD     r0, r3, |
000098a0  72 31 2c 20 41 53 52 23  33 20 20 20 20 20 20 20  |r1, ASR#3       |
000098b0  3b 20 55 70 64 61 74 65  20 74 68 65 20 72 6f 77  |; Update the row|
000098c0  20 64 69 72 65 63 74 69  6f 6e 0d 1b a8 49 20 20  | direction...I  |
000098d0  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 31  |      ADD     r1|
000098e0  2c 20 72 34 2c 20 72 32  2c 20 41 53 52 23 33 20  |, r4, r2, ASR#3 |
000098f0  20 20 20 20 20 20 3b 20  55 70 64 61 74 65 20 74  |      ; Update t|
00009900  68 65 20 63 6f 6c 75 6d  6e 20 64 69 72 65 63 74  |he column direct|
00009910  69 6f 6e 0d 1b b2 4c 20  20 20 20 20 20 20 20 42  |ion...L        B|
00009920  4c 20 20 20 20 20 20 6e  6f 72 6d 61 6c 69 73 65  |L      normalise|
00009930  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00009940  20 4e 6f 72 6d 61 6c 69  73 65 20 74 68 65 20 64  | Normalise the d|
00009950  69 72 65 63 74 69 6f 6e  20 76 65 63 74 6f 72 0d  |irection vector.|
00009960  1b bc 44 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..D        MOV  |
00009970  20 20 20 72 33 2c 20 72  30 20 20 20 20 20 20 20  |   r3, r0       |
00009980  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 70  |           ; Cop|
00009990  79 20 74 68 65 20 72 6f  77 20 64 69 72 65 63 74  |y the row direct|
000099a0  69 6f 6e 0d 1b c6 47 20  20 20 20 20 20 20 20 4d  |ion...G        M|
000099b0  4f 56 20 20 20 20 20 72  34 2c 20 72 31 20 20 20  |OV     r4, r1   |
000099c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000099d0  20 43 6f 70 79 20 74 68  65 20 63 6f 6c 75 6d 6e  | Copy the column|
000099e0  20 64 69 72 65 63 74 69  6f 6e 0d 1b d0 49 20 20  | direction...I  |
000099f0  20 20 20 20 20 20 53 54  52 20 20 20 20 20 72 33  |      STR     r3|
00009a00  2c 20 5b 72 31 32 2c 20  23 77 73 5f 63 6f 67 72  |, [r12, #ws_cogr|
00009a10  5d 20 20 20 20 20 3b 20  53 74 6f 72 65 20 74 68  |]     ; Store th|
00009a20  65 20 6e 65 77 20 72 6f  77 20 64 69 72 65 63 74  |e new row direct|
00009a30  69 6f 6e 0d 1b da 4c 20  20 20 20 20 20 20 20 53  |ion...L        S|
00009a40  54 52 20 20 20 20 20 72  34 2c 20 5b 72 31 32 2c  |TR     r4, [r12,|
00009a50  20 23 77 73 5f 63 6f 67  63 5d 20 20 20 20 20 3b  | #ws_cogc]     ;|
00009a60  20 53 74 6f 72 65 20 74  68 65 20 6e 65 77 20 63  | Store the new c|
00009a70  6f 6c 75 6d 6e 20 64 69  72 65 63 74 69 6f 6e 0d  |olumn direction.|
00009a80  1b e4 16 2e 75 70 64 61  74 65 5f 6d 65 6e 75 5f  |....update_menu_|
00009a90  73 74 69 6c 6c 0d 1b ee  4b 20 20 20 20 20 20 20  |still...K       |
00009aa0  20 4d 4f 56 20 20 20 20  20 72 30 2c 20 23 38 20  | MOV     r0, #8 |
00009ab0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00009ac0  20 3b 20 4e 75 6d 62 65  72 20 6f 66 20 70 6f 69  | ; Number of poi|
00009ad0  6e 74 73 20 74 6f 20 74  72 61 6e 73 66 6f 72 6d  |nts to transform|
00009ae0  0d 1b f8 4a 20 20 20 20  20 20 20 20 41 44 52 20  |...J        ADR |
00009af0  20 20 20 20 72 31 2c 20  75 70 64 61 74 65 5f 6d  |    r1, update_m|
00009b00  65 6e 75 5f 66 72 61 6d  65 20 20 20 3b 20 50 6f  |enu_frame   ; Po|
00009b10  69 6e 74 65 72 20 74 6f  20 73 6f 75 72 63 65 20  |inter to source |
00009b20  63 6f 72 64 69 6e 61 74  65 73 0d 1c 02 4b 20 20  |cordinates...K  |
00009b30  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 32  |      ADD     r2|
00009b40  2c 20 72 31 32 2c 20 23  77 73 5f 62 75 66 66 65  |, r12, #ws_buffe|
00009b50  72 20 20 20 20 20 3b 20  50 6f 69 6e 74 65 72 20  |r     ; Pointer |
00009b60  74 6f 20 64 65 73 74 69  6e 61 74 69 6f 6e 20 62  |to destination b|
00009b70  75 66 66 65 72 0d 1c 0c  53 20 20 20 20 20 20 20  |uffer...S       |
00009b80  20 42 4c 20 20 20 20 20  20 74 72 61 6e 73 5f 66  | BL      trans_f|
00009b90  69 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |it              |
00009ba0  20 3b 20 53 63 61 6c 65  20 74 68 65 20 63 6f 6f  | ; Scale the coo|
00009bb0  72 64 69 6e 61 74 65 73  20 66 6f 72 20 74 68 65  |rdinates for the|
00009bc0  20 70 6f 69 6e 74 65 72  0d 1c 16 4b 20 20 20 20  | pointer...K    |
00009bd0  20 20 20 20 41 44 44 20  20 20 20 20 72 32 2c 20  |    ADD     r2, |
00009be0  72 32 2c 20 72 30 2c 20  4c 53 4c 23 33 20 20 20  |r2, r0, LSL#3   |
00009bf0  20 20 20 20 3b 20 50 6f  69 6e 74 65 72 20 74 6f  |    ; Pointer to|
00009c00  20 64 65 73 74 69 6e 61  74 69 6f 6e 20 62 75 66  | destination buf|
00009c10  66 65 72 0d 1c 20 4f 20  20 20 20 20 20 20 20 4d  |fer.. O        M|
00009c20  4f 56 20 20 20 20 20 72  30 2c 20 23 39 20 20 20  |OV     r0, #9   |
00009c30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
00009c40  20 4e 75 6d 62 65 72 20  6f 66 20 70 6f 69 6e 74  | Number of point|
00009c50  73 20 69 6e 20 70 6f 69  6e 74 65 72 20 73 68 61  |s in pointer sha|
00009c60  70 65 0d 1c 2a 4b 20 20  20 20 20 20 20 20 41 44  |pe..*K        AD|
00009c70  52 20 20 20 20 20 72 31  2c 20 75 70 64 61 74 65  |R     r1, update|
00009c80  5f 6d 65 6e 75 5f 70 74  72 20 20 20 20 20 3b 20  |_menu_ptr     ; |
00009c90  50 6f 69 6e 74 65 72 20  74 6f 20 73 6f 75 72 63  |Pointer to sourc|
00009ca0  65 20 63 6f 6f 72 64 69  6e 61 74 65 73 0d 1c 3e  |e coordinates..>|
00009cb0  4c 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |L        BL     |
00009cc0  20 74 72 61 6e 73 5f 72  6f 74 61 74 65 20 20 20  | trans_rotate   |
00009cd0  20 20 20 20 20 20 20 20  20 3b 20 52 6f 74 61 74  |         ; Rotat|
00009ce0  65 20 74 68 65 20 70 6f  69 6e 74 65 72 20 61 73  |e the pointer as|
00009cf0  20 72 65 71 75 69 72 65  64 0d 1c 48 52 20 20 20  | required..HR   |
00009d00  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
00009d10  20 72 32 20 20 20 20 20  20 20 20 20 20 20 20 20  | r2             |
00009d20  20 20 20 20 20 3b 20 53  6f 75 72 63 65 20 62 75  |     ; Source bu|
00009d30  66 66 65 72 20 69 73 20  73 61 6d 65 20 61 73 20  |ffer is same as |
00009d40  64 65 73 74 69 6e 61 74  69 6f 6e 0d 1c 52 53 20  |destination..RS |
00009d50  20 20 20 20 20 20 20 42  4c 20 20 20 20 20 20 74  |       BL      t|
00009d60  72 61 6e 73 5f 66 69 74  20 20 20 20 20 20 20 20  |rans_fit        |
00009d70  20 20 20 20 20 20 20 3b  20 53 63 61 6c 65 20 74  |       ; Scale t|
00009d80  68 65 20 63 6f 6f 72 64  69 6e 61 74 65 73 20 66  |he coordinates f|
00009d90  6f 72 20 74 68 65 20 70  6f 69 6e 74 65 72 0d 1c  |or the pointer..|
00009da0  66 47 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |fG        MOV   |
00009db0  20 20 72 30 2c 20 23 63  6f 6c 6f 75 72 5f 74 72  |  r0, #colour_tr|
00009dc0  61 6e 73 20 20 20 20 20  20 20 3b 20 42 61 63 6b  |ans       ; Back|
00009dd0  67 72 6f 75 6e 64 20 69  73 20 74 72 61 6e 73 70  |ground is transp|
00009de0  61 72 65 6e 74 0d 1c 70  4b 20 20 20 20 20 20 20  |arent..pK       |
00009df0  20 41 44 44 20 20 20 20  20 72 32 2c 20 72 31 32  | ADD     r2, r12|
00009e00  2c 20 23 77 73 5f 62 75  66 66 65 72 20 20 20 20  |, #ws_buffer    |
00009e10  20 3b 20 50 6f 69 6e 74  65 72 20 74 6f 20 63 6f  | ; Pointer to co|
00009e20  6f 72 64 69 6e 61 74 65  73 20 62 75 66 66 65 72  |ordinates buffer|
00009e30  0d 1c 7a 49 20 20 20 20  20 20 20 20 42 4c 20 20  |..zI        BL  |
00009e40  20 20 20 20 70 6c 6f 74  5f 66 69 6c 6c 20 20 20  |    plot_fill   |
00009e50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6c  |            ; Cl|
00009e60  65 61 72 20 74 68 65 20  70 6f 69 6e 74 65 72 20  |ear the pointer |
00009e70  69 6e 69 74 69 61 6c 6c  79 0d 1c 84 51 20 20 20  |initially...Q   |
00009e80  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
00009e90  20 23 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | #4             |
00009ea0  20 20 20 20 20 3b 20 4e  75 6d 62 65 72 20 6f 66  |     ; Number of|
00009eb0  20 63 6f 6f 72 64 69 6e  61 74 65 73 20 69 6e 20  | coordinates in |
00009ec0  6d 65 6e 75 20 73 68 61  70 65 0d 1c 8e 4b 20 20  |menu shape...K  |
00009ed0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
00009ee0  2c 20 23 63 6f 6c 6f 75  72 5f 74 72 61 6e 73 5f  |, #colour_trans_|
00009ef0  62 6c 75 65 20 20 3b 20  46 69 6c 6c 20 69 6e 74  |blue  ; Fill int|
00009f00  65 72 69 6f 72 20 77 69  74 68 20 73 6f 6c 69 64  |erior with solid|
00009f10  20 62 6c 75 65 0d 1c 98  46 20 20 20 20 20 20 20  | blue...F       |
00009f20  20 42 4c 20 20 20 20 20  20 70 6c 6f 74 5f 70 6f  | BL      plot_po|
00009f30  6c 79 5f 66 69 6c 6c 20  20 20 20 20 20 20 20 20  |ly_fill         |
00009f40  20 3b 20 50 6c 6f 74 20  74 68 65 20 66 69 6c 6c  | ; Plot the fill|
00009f50  65 64 20 69 6e 74 65 72  69 6f 72 0d 1c a2 49 20  |ed interior...I |
00009f60  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00009f70  30 2c 20 23 63 6f 6c 6f  75 72 5f 63 79 61 6e 20  |0, #colour_cyan |
00009f80  20 20 20 20 20 20 20 3b  20 4f 75 74 6c 69 6e 65  |       ; Outline|
00009f90  20 74 68 65 20 70 6f 69  6e 74 65 72 20 69 6e 20  | the pointer in |
00009fa0  63 79 61 6e 0d 1c ac 46  20 20 20 20 20 20 20 20  |cyan...F        |
00009fb0  42 4c 20 20 20 20 20 20  70 6c 6f 74 5f 70 6f 6c  |BL      plot_pol|
00009fc0  79 5f 6c 69 6e 65 20 20  20 20 20 20 20 20 20 20  |y_line          |
00009fd0  3b 20 50 6c 6f 74 20 74  68 65 20 70 6f 69 6e 74  |; Plot the point|
00009fe0  65 72 20 6f 75 74 6c 69  6e 65 0d 1c b6 49 20 20  |er outline...I  |
00009ff0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 30  |      MOV     r0|
0000a000  2c 20 23 63 6f 6c 6f 75  72 5f 74 72 61 6e 73 5f  |, #colour_trans_|
0000a010  63 79 61 6e 20 20 3b 20  4f 75 74 6c 69 6e 65 20  |cyan  ; Outline |
0000a020  74 68 65 20 70 6f 69 6e  74 65 72 20 69 6e 20 63  |the pointer in c|
0000a030  79 61 6e 0d 1c c0 47 20  20 20 20 20 20 20 20 41  |yan...G        A|
0000a040  44 44 20 20 20 20 20 72  32 2c 20 72 32 2c 20 72  |DD     r2, r2, r|
0000a050  31 2c 20 4c 53 4c 23 33  20 20 20 20 20 20 20 3b  |1, LSL#3       ;|
0000a060  20 50 6f 69 6e 74 65 72  20 74 6f 20 69 6e 74 65  | Pointer to inte|
0000a070  72 69 6f 72 20 73 68 61  70 65 0d 1c ca 44 20 20  |rior shape...D  |
0000a080  20 20 20 20 20 20 42 4c  20 20 20 20 20 20 70 6c  |      BL      pl|
0000a090  6f 74 5f 70 6f 6c 79 5f  66 69 6c 6c 20 20 20 20  |ot_poly_fill    |
0000a0a0  20 20 20 20 20 20 3b 20  50 6c 6f 74 20 74 68 65  |      ; Plot the|
0000a0b0  20 6d 65 6e 75 20 69 6e  74 65 72 69 6f 72 0d 1c  | menu interior..|
0000a0c0  d4 46 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.F        ADD   |
0000a0d0  20 20 72 32 2c 20 72 32  2c 20 72 31 2c 20 4c 53  |  r2, r2, r1, LS|
0000a0e0  4c 23 33 20 20 20 20 20  20 20 3b 20 50 6f 69 6e  |L#3       ; Poin|
0000a0f0  74 65 72 20 74 6f 20 70  6f 69 6e 74 65 72 20 73  |ter to pointer s|
0000a100  68 61 70 65 0d 1c de 4b  20 20 20 20 20 20 20 20  |hape...K        |
0000a110  4d 4f 56 20 20 20 20 20  72 30 2c 20 23 63 6f 6c  |MOV     r0, #col|
0000a120  6f 75 72 5f 62 6c 75 65  20 20 20 20 20 20 20 20  |our_blue        |
0000a130  3b 20 46 69 6c 6c 20 69  6e 74 65 72 69 6f 72 20  |; Fill interior |
0000a140  77 69 74 68 20 73 6f 6c  69 64 20 62 6c 75 65 0d  |with solid blue.|
0000a150  1c e8 54 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |..T        MOV  |
0000a160  20 20 20 72 31 2c 20 23  39 20 20 20 20 20 20 20  |   r1, #9       |
0000a170  20 20 20 20 20 20 20 20  20 20 20 3b 20 4e 75 6d  |           ; Num|
0000a180  62 65 72 20 6f 66 20 63  6f 6f 72 64 69 6e 61 74  |ber of coordinat|
0000a190  65 73 20 69 6e 20 70 6f  69 6e 74 65 72 20 73 68  |es in pointer sh|
0000a1a0  61 70 65 0d 1c f2 46 20  20 20 20 20 20 20 20 42  |ape...F        B|
0000a1b0  4c 20 20 20 20 20 20 70  6c 6f 74 5f 70 6f 6c 79  |L      plot_poly|
0000a1c0  5f 66 69 6c 6c 20 20 20  20 20 20 20 20 20 20 3b  |_fill          ;|
0000a1d0  20 50 6c 6f 74 20 74 68  65 20 66 69 6c 6c 65 64  | Plot the filled|
0000a1e0  20 69 6e 74 65 72 69 6f  72 0d 1c fc 49 20 20 20  | interior...I   |
0000a1f0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 30 2c  |     MOV     r0,|
0000a200  20 23 63 6f 6c 6f 75 72  5f 63 79 61 6e 20 20 20  | #colour_cyan   |
0000a210  20 20 20 20 20 3b 20 4f  75 74 6c 69 6e 65 20 74  |     ; Outline t|
0000a220  68 65 20 70 6f 69 6e 74  65 72 20 69 6e 20 63 79  |he pointer in cy|
0000a230  61 6e 0d 1d 06 46 20 20  20 20 20 20 20 20 42 4c  |an...F        BL|
0000a240  20 20 20 20 20 20 70 6c  6f 74 5f 70 6f 6c 79 5f  |      plot_poly_|
0000a250  6c 69 6e 65 20 20 20 20  20 20 20 20 20 20 3b 20  |line          ; |
0000a260  50 6c 6f 74 20 74 68 65  20 70 6f 69 6e 74 65 72  |Plot the pointer|
0000a270  20 6f 75 74 6c 69 6e 65  0d 1d 10 44 20 20 20 20  | outline...D    |
0000a280  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
0000a290  2c 20 7b 72 30 2d 72 34  2c 20 70 63 7d 20 20 20  |, {r0-r4, pc}   |
0000a2a0  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
0000a2b0  6d 20 73 75 62 72 6f 75  74 69 6e 65 0d 1d 1a 4b  |m subroutine...K|
0000a2c0  2e 75 70 64 61 74 65 5f  6d 65 6e 75 5f 66 72 61  |.update_menu_fra|
0000a2d0  6d 65 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |me              |
0000a2e0  20 20 20 20 20 20 20 20  3b 20 54 68 65 20 6f 75  |        ; The ou|
0000a2f0  74 73 69 64 65 20 66 72  61 6d 65 20 6f 66 20 74  |tside frame of t|
0000a300  68 65 20 6d 65 6e 75 0d  1d 24 1e 20 20 20 20 20  |he menu..$.     |
0000a310  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 2d  |   .coordinate(-|
0000a320  33 2c 20 30 29 0d 1d 2e  1f 20 20 20 20 20 20 20  |3, 0)....       |
0000a330  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 2d 33 2c  | .coordinate(-3,|
0000a340  20 31 36 29 0d 1d 38 1f  20 20 20 20 20 20 20 20  | 16)..8.        |
0000a350  a4 63 6f 6f 72 64 69 6e  61 74 65 28 32 30 2c 20  |.coordinate(20, |
0000a360  31 36 29 0d 1d 42 1e 20  20 20 20 20 20 20 20 a4  |16)..B.        .|
0000a370  63 6f 6f 72 64 69 6e 61  74 65 28 32 30 2c 20 30  |coordinate(20, 0|
0000a380  29 0d 1d 4c 46 2e 75 70  64 61 74 65 5f 6d 65 6e  |)..LF.update_men|
0000a390  75 5f 65 6e 74 72 69 65  73 20 20 20 20 20 20 20  |u_entries       |
0000a3a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 54  |             ; T|
0000a3b0  68 65 20 69 6e 74 65 72  69 6f 72 20 6f 66 20 74  |he interior of t|
0000a3c0  68 65 20 6d 65 6e 75 0d  1d 56 1f 20 20 20 20 20  |he menu..V.     |
0000a3d0  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 30  |   .coordinate(0|
0000a3e0  2e 35 2c 20 31 29 0d 1d  60 20 20 20 20 20 20 20  |.5, 1)..`       |
0000a3f0  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 30 2e  |  .coordinate(0.|
0000a400  35 2c 20 31 34 29 0d 1d  6a 21 20 20 20 20 20 20  |5, 14)..j!      |
0000a410  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 31 38  |  .coordinate(18|
0000a420  2e 35 2c 20 31 34 29 0d  1d 74 20 20 20 20 20 20  |.5, 14)..t      |
0000a430  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 31  |   .coordinate(1|
0000a440  38 2e 35 2c 20 31 29 0d  1d 7e 3f 2e 75 70 64 61  |8.5, 1)..~?.upda|
0000a450  74 65 5f 6d 65 6e 75 5f  70 74 72 20 20 20 20 20  |te_menu_ptr     |
0000a460  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000a470  20 20 20 3b 20 54 68 65  20 70 6f 69 6e 74 65 72  |   ; The pointer|
0000a480  20 73 68 61 70 65 0d 1d  88 1d 20 20 20 20 20 20  | shape....      |
0000a490  20 20 a4 63 6f 6f 72 64  69 6e 61 74 65 28 31 2c  |  .coordinate(1,|
0000a4a0  20 30 29 0d 1d 92 1d 20  20 20 20 20 20 20 20 a4  | 0)....        .|
0000a4b0  63 6f 6f 72 64 69 6e 61  74 65 28 35 2c 20 34 29  |coordinate(5, 4)|
0000a4c0  0d 1d 93 1d 20 20 20 20  20 20 20 20 a4 63 6f 6f  |....        .coo|
0000a4d0  72 64 69 6e 61 74 65 28  36 2c 20 34 29 0d 1d 9c  |rdinate(6, 4)...|
0000a4e0  1d 20 20 20 20 20 20 20  20 a4 63 6f 6f 72 64 69  |.        .coordi|
0000a4f0  6e 61 74 65 28 36 2c 20  32 29 0d 1d a6 1e 20 20  |nate(6, 2)....  |
0000a500  20 20 20 20 20 20 a4 63  6f 6f 72 64 69 6e 61 74  |      .coordinat|
0000a510  65 28 31 31 2c 20 32 29  0d 1d b0 1f 20 20 20 20  |e(11, 2)....    |
0000a520  20 20 20 20 a4 63 6f 6f  72 64 69 6e 61 74 65 28  |    .coordinate(|
0000a530  31 31 2c 20 2d 32 29 0d  1d ba 1e 20 20 20 20 20  |11, -2)....     |
0000a540  20 20 20 a4 63 6f 6f 72  64 69 6e 61 74 65 28 36  |   .coordinate(6|
0000a550  2c 20 2d 32 29 0d 1d c4  1e 20 20 20 20 20 20 20  |, -2)....       |
0000a560  20 a4 63 6f 6f 72 64 69  6e 61 74 65 28 36 2c 20  | .coordinate(6, |
0000a570  2d 34 29 0d 1d c5 1e 20  20 20 20 20 20 20 20 a4  |-4)....        .|
0000a580  63 6f 6f 72 64 69 6e 61  74 65 28 35 2c 20 2d 34  |coordinate(5, -4|
0000a590  29 0d 1d ce 04 0d 1d d8  3c 20 20 20 20 20 20 20  |).......<       |
0000a5a0  20 3b 20 41 70 70 6c 79  20 61 6e 20 75 6e 64 65  | ; Apply an unde|
0000a5b0  72 64 61 6d 70 65 64 20  66 69 6c 74 65 72 20 74  |rdamped filter t|
0000a5c0  6f 20 74 68 65 20 76 61  6c 75 65 20 69 6e 20 72  |o the value in r|
0000a5d0  30 0d 1d e2 12 2e 75 70  64 61 74 65 5f 66 69 6c  |0.....update_fil|
0000a5e0  74 65 72 0d 1d ec 3d 20  20 20 20 20 20 20 20 53  |ter...=        S|
0000a5f0  54 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 31  |TMFD   r13!, {r1|
0000a600  2d 72 33 2c 20 72 31 34  7d 20 20 20 20 20 20 3b  |-r3, r14}      ;|
0000a610  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
0000a620  0d 1d f6 43 20 20 20 20  20 20 20 20 4c 44 52 20  |...C        LDR |
0000a630  20 20 20 20 72 31 2c 20  5b 72 31 32 2c 20 23 77  |    r1, [r12, #w|
0000a640  73 5f 66 69 6c 74 6e 5d  20 20 20 20 3b 20 47 65  |s_filtn]    ; Ge|
0000a650  74 20 70 72 65 76 69 6f  75 73 20 70 6f 73 69 74  |t previous posit|
0000a660  69 6f 6e 0d 1e 00 43 20  20 20 20 20 20 20 20 4c  |ion...C        L|
0000a670  44 52 20 20 20 20 20 72  32 2c 20 5b 72 31 32 2c  |DR     r2, [r12,|
0000a680  20 23 77 73 5f 66 69 6c  74 76 5d 20 20 20 20 3b  | #ws_filtv]    ;|
0000a690  20 47 65 74 20 70 72 65  76 69 6f 75 73 20 76 65  | Get previous ve|
0000a6a0  6c 6f 63 69 74 79 0d 1e  0a 44 20 20 20 20 20 20  |locity...D      |
0000a6b0  20 20 4c 44 52 20 20 20  20 20 72 33 2c 20 5b 72  |  LDR     r3, [r|
0000a6c0  31 32 2c 20 23 77 73 5f  66 72 69 63 74 69 6f 6e  |12, #ws_friction|
0000a6d0  5d 20 3b 20 54 68 65 20  61 6d 6f 75 6e 74 20 6f  |] ; The amount o|
0000a6e0  66 20 66 72 69 63 74 69  6f 6e 0d 1e 14 46 20 20  |f friction...F  |
0000a6f0  20 20 20 20 20 20 52 53  42 20 20 20 20 20 72 33  |      RSB     r3|
0000a700  2c 20 72 33 2c 20 23 31  30 20 20 20 20 20 20 20  |, r3, #10       |
0000a710  20 20 20 20 20 20 3b 20  43 6f 6e 76 65 72 74 20  |      ; Convert |
0000a720  74 6f 20 61 20 73 68 69  66 74 20 76 61 6c 75 65  |to a shift value|
0000a730  0d 1e 1e 41 20 20 20 20  20 20 20 20 53 55 42 20  |...A        SUB |
0000a740  20 20 20 20 72 32 2c 20  72 32 2c 20 72 32 2c 20  |    r2, r2, r2, |
0000a750  41 53 52 20 72 33 20 20  20 20 20 20 3b 20 41 70  |ASR r3      ; Ap|
0000a760  70 6c 79 20 73 6f 6d 65  20 66 72 69 63 74 69 6f  |ply some frictio|
0000a770  6e 0d 1e 28 41 20 20 20  20 20 20 20 20 4c 44 52  |n..(A        LDR|
0000a780  20 20 20 20 20 72 33 2c  20 5b 72 31 32 2c 20 23  |     r3, [r12, #|
0000a790  77 73 5f 73 70 72 69 6e  67 5d 20 20 20 3b 20 54  |ws_spring]   ; T|
0000a7a0  68 65 20 73 70 72 69 6e  67 20 63 6f 6e 73 74 61  |he spring consta|
0000a7b0  6e 74 0d 1e 32 46 20 20  20 20 20 20 20 20 52 53  |nt..2F        RS|
0000a7c0  42 20 20 20 20 20 72 33  2c 20 72 33 2c 20 23 31  |B     r3, r3, #1|
0000a7d0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |1             ; |
0000a7e0  43 6f 6e 76 65 72 74 20  74 6f 20 61 20 73 68 69  |Convert to a shi|
0000a7f0  66 74 20 76 61 6c 75 65  0d 1e 3c 4b 20 20 20 20  |ft value..<K    |
0000a800  20 20 20 20 53 55 42 20  20 20 20 20 72 32 2c 20  |    SUB     r2, |
0000a810  72 32 2c 20 72 31 2c 20  41 53 52 20 72 33 20 20  |r2, r1, ASR r3  |
0000a820  20 20 20 20 3b 20 49 6e  63 6c 75 64 65 20 74 68  |    ; Include th|
0000a830  65 20 72 65 73 74 6f 72  61 74 69 76 65 20 66 6f  |e restorative fo|
0000a840  72 63 65 0d 1e 46 52 20  20 20 20 20 20 20 20 41  |rce..FR        A|
0000a850  44 44 20 20 20 20 20 72  31 2c 20 72 31 2c 20 72  |DD     r1, r1, r|
0000a860  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |2              ;|
0000a870  20 41 64 64 20 70 61 72  74 20 6f 66 20 76 65 6c  | Add part of vel|
0000a880  6f 63 69 74 79 20 74 6f  20 74 68 65 20 70 6f 73  |ocity to the pos|
0000a890  69 74 69 6f 6e 0d 1e 50  42 20 20 20 20 20 20 20  |ition..PB       |
0000a8a0  20 4c 44 52 20 20 20 20  20 72 33 2c 20 5b 72 31  | LDR     r3, [r1|
0000a8b0  32 2c 20 23 77 73 5f 66  6f 72 63 65 5d 20 20 20  |2, #ws_force]   |
0000a8c0  20 3b 20 54 68 65 20 66  6f 72 63 65 20 6d 75 6c  | ; The force mul|
0000a8d0  74 69 70 6c 69 65 72 0d  1e 5a 46 20 20 20 20 20  |tiplier..ZF     |
0000a8e0  20 20 20 52 53 42 53 20  20 20 20 72 33 2c 20 72  |   RSBS    r3, r|
0000a8f0  33 2c 20 23 31 33 20 20  20 20 20 20 20 20 20 20  |3, #13          |
0000a900  20 20 20 3b 20 43 6f 6e  76 65 72 74 20 74 6f 20  |   ; Convert to |
0000a910  61 20 73 68 69 66 74 20  76 61 6c 75 65 0d 1e 64  |a shift value..d|
0000a920  4a 20 20 20 20 20 20 20  20 4d 4f 56 4d 49 20 20  |J        MOVMI  |
0000a930  20 72 30 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r0, #0         |
0000a940  20 20 20 20 20 20 20 20  20 3b 20 4e 6f 20 77 69  |         ; No wi|
0000a950  62 62 6c 65 20 69 66 20  72 65 73 75 6c 74 20 6e  |bble if result n|
0000a960  65 67 61 74 69 76 65 0d  1e 6e 41 20 20 20 20 20  |egative..nA     |
0000a970  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 72  |   MOV     r0, r|
0000a980  30 2c 20 41 53 52 20 72  33 20 20 20 20 20 20 20  |0, ASR r3       |
0000a990  20 20 20 3b 20 53 63 61  6c 65 20 74 68 65 20 6e  |   ; Scale the n|
0000a9a0  65 77 20 69 6e 70 75 74  0d 1e 78 3f 20 20 20 20  |ew input..x?    |
0000a9b0  20 20 20 20 41 44 44 20  20 20 20 20 72 30 2c 20  |    ADD     r0, |
0000a9c0  72 31 2c 20 72 30 2c 20  41 53 4c 23 38 20 20 20  |r1, r0, ASL#8   |
0000a9d0  20 20 20 20 3b 20 41 64  64 20 74 68 65 20 6e 65  |    ; Add the ne|
0000a9e0  77 20 69 6e 70 75 74 0d  1e 82 47 20 20 20 20 20  |w input...G     |
0000a9f0  20 20 20 4d 4f 56 20 20  20 20 20 72 31 2c 20 23  |   MOV     r1, #|
0000aa00  31 3c 3c 31 36 20 20 20  20 20 20 20 20 20 20 20  |1<<16           |
0000aa10  20 20 20 3b 20 54 68 65  20 6d 61 78 69 6d 75 6d  |   ; The maximum|
0000aa20  20 61 6c 6c 6f 77 65 64  20 76 61 6c 75 65 0d 1e  | allowed value..|
0000aa30  8c 44 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |.D        CMP   |
0000aa40  20 20 72 30 2c 20 72 31  20 20 20 20 20 20 20 20  |  r0, r1        |
0000aa50  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 6d 70  |          ; Comp|
0000aa60  61 72 65 20 74 6f 20 74  68 65 20 6d 61 78 69 6d  |are to the maxim|
0000aa70  75 6d 0d 1e 96 4a 20 20  20 20 20 20 20 20 4d 4f  |um...J        MO|
0000aa80  56 47 54 20 20 20 72 30  2c 20 72 31 20 20 20 20  |VGT   r0, r1    |
0000aa90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000aaa0  45 6e 66 6f 72 63 65 20  74 68 65 20 6d 61 78 69  |Enforce the maxi|
0000aab0  6d 75 6d 20 70 6f 73 69  74 69 6f 6e 0d 1e a0 52  |mum position...R|
0000aac0  20 20 20 20 20 20 20 20  43 4d 50 47 54 20 20 20  |        CMPGT   |
0000aad0  72 32 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r2, #0          |
0000aae0  20 20 20 20 20 20 20 20  3b 20 43 6c 69 70 20 74  |        ; Clip t|
0000aaf0  68 65 20 76 65 6c 6f 63  69 74 79 20 69 66 20 6d  |he velocity if m|
0000ab00  61 78 69 6d 75 6d 20 72  65 61 63 68 65 64 0d 1e  |aximum reached..|
0000ab10  aa 46 20 20 20 20 20 20  20 20 4d 4f 56 47 54 20  |.F        MOVGT |
0000ab20  20 20 72 32 2c 20 23 30  20 20 20 20 20 20 20 20  |  r2, #0        |
0000ab30  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 74 20  |          ; Set |
0000ab40  74 68 65 20 76 65 6c 6f  63 69 74 79 20 74 6f 20  |the velocity to |
0000ab50  7a 65 72 6f 0d 1e b4 47  20 20 20 20 20 20 20 20  |zero...G        |
0000ab60  52 53 42 20 20 20 20 20  72 31 2c 20 72 31 2c 20  |RSB     r1, r1, |
0000ab70  23 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#0              |
0000ab80  3b 20 54 68 65 20 6d 69  6e 69 6d 75 6d 20 61 6c  |; The minimum al|
0000ab90  6c 6f 77 65 64 20 76 61  6c 75 65 0d 1e be 44 20  |lowed value...D |
0000aba0  20 20 20 20 20 20 20 43  4d 50 20 20 20 20 20 72  |       CMP     r|
0000abb0  30 2c 20 72 31 20 20 20  20 20 20 20 20 20 20 20  |0, r1           |
0000abc0  20 20 20 20 20 20 20 3b  20 43 6f 6d 70 61 72 65  |       ; Compare|
0000abd0  20 74 6f 20 74 68 65 20  6d 69 6d 69 6d 75 6d 0d  | to the mimimum.|
0000abe0  1e c8 41 20 20 20 20 20  20 20 20 4d 4f 56 4c 54  |..A        MOVLT|
0000abf0  20 20 20 72 30 2c 20 72  31 20 20 20 20 20 20 20  |   r0, r1       |
0000ac00  20 20 20 20 20 20 20 20  20 20 20 3b 20 45 6e 66  |           ; Enf|
0000ac10  6f 72 63 65 20 74 68 65  20 6d 69 6e 69 6d 75 6d  |orce the minimum|
0000ac20  0d 1e d2 52 20 20 20 20  20 20 20 20 43 4d 50 4c  |...R        CMPL|
0000ac30  54 20 20 20 72 32 2c 20  23 30 20 20 20 20 20 20  |T   r2, #0      |
0000ac40  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 6c  |            ; Cl|
0000ac50  69 70 20 74 68 65 20 76  65 6c 6f 63 69 74 79 20  |ip the velocity |
0000ac60  69 66 20 6d 69 6e 69 6d  75 6d 20 72 65 61 63 68  |if minimum reach|
0000ac70  65 64 0d 1e dc 46 20 20  20 20 20 20 20 20 4d 4f  |ed...F        MO|
0000ac80  56 4c 54 20 20 20 72 32  2c 20 23 30 20 20 20 20  |VLT   r2, #0    |
0000ac90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000aca0  53 65 74 20 74 68 65 20  76 65 6c 6f 63 69 74 79  |Set the velocity|
0000acb0  20 74 6f 20 7a 65 72 6f  0d 1e e6 43 20 20 20 20  | to zero...C    |
0000acc0  20 20 20 20 4d 4f 56 53  20 20 20 20 72 31 2c 20  |    MOVS    r1, |
0000acd0  72 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r0              |
0000ace0  20 20 20 20 3b 20 43 6f  70 79 20 74 68 65 20 6e  |    ; Copy the n|
0000acf0  65 77 20 70 6f 73 69 74  69 6f 6e 0d 1e f0 51 20  |ew position...Q |
0000ad00  20 20 20 20 20 20 20 52  53 42 4d 49 20 20 20 72  |       RSBMI   r|
0000ad10  31 2c 20 72 31 2c 20 23  30 20 20 20 20 20 20 20  |1, r1, #0       |
0000ad20  20 20 20 20 20 20 20 3b  20 45 6e 73 75 72 65 20  |       ; Ensure |
0000ad30  63 6f 70 79 20 6f 66 20  70 6f 73 69 74 69 6f 6e  |copy of position|
0000ad40  20 69 73 20 70 6f 73 69  74 69 76 65 0d 1e fa 46  | is positive...F|
0000ad50  20 20 20 20 20 20 20 20  43 4d 50 20 20 20 20 20  |        CMP     |
0000ad60  72 31 2c 20 23 31 3c 3c  38 20 20 20 20 20 20 20  |r1, #1<<8       |
0000ad70  20 20 20 20 20 20 20 20  3b 20 4d 69 6e 69 6d 75  |        ; Minimu|
0000ad80  6d 20 76 69 73 69 62 6c  65 20 70 6f 73 69 74 69  |m visible positi|
0000ad90  6f 6e 0d 1f 04 53 20 20  20 20 20 20 20 20 4d 4f  |on...S        MO|
0000ada0  56 4c 54 20 20 20 72 32  2c 20 72 32 2c 20 41 53  |VLT   r2, r2, AS|
0000adb0  52 23 31 20 20 20 20 20  20 20 20 20 20 20 3b 20  |R#1           ; |
0000adc0  49 6e 63 72 65 61 73 65  20 66 72 69 63 74 69 6f  |Increase frictio|
0000add0  6e 20 77 68 65 6e 20 73  6d 61 6c 6c 20 6d 6f 76  |n when small mov|
0000ade0  65 6d 65 6e 74 0d 1f 0e  44 20 20 20 20 20 20 20  |ement...D       |
0000adf0  20 53 54 52 20 20 20 20  20 72 30 2c 20 5b 72 31  | STR     r0, [r1|
0000ae00  32 2c 20 23 77 73 5f 66  69 6c 74 6e 5d 20 20 20  |2, #ws_filtn]   |
0000ae10  20 3b 20 53 74 6f 72 65  20 74 68 65 20 6e 65 77  | ; Store the new|
0000ae20  20 70 6f 73 69 74 69 6f  6e 0d 1f 18 44 20 20 20  | position...D   |
0000ae30  20 20 20 20 20 53 54 52  20 20 20 20 20 72 32 2c  |     STR     r2,|
0000ae40  20 5b 72 31 32 2c 20 23  77 73 5f 66 69 6c 74 76  | [r12, #ws_filtv|
0000ae50  5d 20 20 20 20 3b 20 53  74 6f 72 65 20 74 68 65  |]    ; Store the|
0000ae60  20 6e 65 77 20 76 65 6c  6f 63 69 74 79 0d 1f 22  | new velocity.."|
0000ae70  17 2e 75 70 64 61 74 65  5f 66 69 6c 74 65 72 5f  |..update_filter_|
0000ae80  64 6f 6e 65 0d 1f 2c 44  20 20 20 20 20 20 20 20  |done..,D        |
0000ae90  4c 44 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |LDMFD   r13!, {r|
0000aea0  31 2d 72 33 2c 20 70 63  7d 20 20 20 20 20 20 20  |1-r3, pc}       |
0000aeb0  3b 20 52 65 74 75 72 6e  20 66 72 6f 6d 20 73 75  |; Return from su|
0000aec0  62 72 6f 75 74 69 6e 65  0d 1f 36 04 0d 1f 40 38  |broutine..6...@8|
0000aed0  20 20 20 20 20 20 20 20  3b 20 46 69 6c 6c 20 74  |        ; Fill t|
0000aee0  68 65 20 70 6f 69 6e 74  65 72 20 69 6d 61 67 65  |he pointer image|
0000aef0  20 64 61 74 61 20 77 69  74 68 20 63 6f 6c 6f 75  | data with colou|
0000af00  72 20 72 30 0d 1f 4a 0e  2e 70 6c 6f 74 5f 66 69  |r r0..J..plot_fi|
0000af10  6c 6c 0d 1f 54 3d 20 20  20 20 20 20 20 20 53 54  |ll..T=        ST|
0000af20  4d 46 44 20 20 20 72 31  33 21 2c 20 7b 72 30 2d  |MFD   r13!, {r0-|
0000af30  72 32 2c 20 72 31 34 7d  20 20 20 20 20 20 3b 20  |r2, r14}      ; |
0000af40  53 74 61 63 6b 20 72 65  67 69 73 74 65 72 73 0d  |Stack registers.|
0000af50  1f 5e 4e 20 20 20 20 20  20 20 20 42 4c 20 20 20  |.^N        BL   |
0000af60  20 20 20 63 6f 6c 6f 75  72 5f 65 78 70 61 6e 64  |   colour_expand|
0000af70  20 20 20 20 20 20 20 20  20 20 20 3b 20 45 78 70  |           ; Exp|
0000af80  61 6e 64 20 74 68 65 20  63 6f 6c 6f 75 72 20 74  |and the colour t|
0000af90  6f 20 66 69 6c 6c 20 61  20 77 6f 72 64 0d 1f 68  |o fill a word..h|
0000afa0  49 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |I        ADD    |
0000afb0  20 72 31 2c 20 72 31 32  2c 20 23 77 73 5f 70 74  | r1, r12, #ws_pt|
0000afc0  72 5f 64 61 74 61 20 20  20 3b 20 53 74 61 72 74  |r_data   ; Start|
0000afd0  20 6f 66 20 70 6f 69 6e  74 65 72 20 69 6d 61 67  | of pointer imag|
0000afe0  65 20 64 61 74 61 0d 1f  72 45 20 20 20 20 20 20  |e data..rE      |
0000aff0  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 23 33  |  MOV     r2, #3|
0000b000  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |2               |
0000b010  20 20 3b 20 4e 75 6d 62  65 72 20 6f 66 20 72 6f  |  ; Number of ro|
0000b020  77 73 20 74 6f 20 63 6c  65 61 72 0d 1f 7c 13 2e  |ws to clear..|..|
0000b030  70 6c 6f 74 5f 66 69 6c  6c 5f 6c 6f 6f 70 0d 1f  |plot_fill_loop..|
0000b040  86 50 20 20 20 20 20 20  20 20 53 55 42 53 20 20  |.P        SUBS  |
0000b050  20 20 72 32 2c 20 72 32  2c 20 23 31 20 20 20 20  |  r2, r2, #1    |
0000b060  20 20 20 20 20 20 20 20  20 20 3b 20 44 65 63 72  |          ; Decr|
0000b070  65 6d 65 6e 74 20 6e 75  6d 62 65 72 20 6f 66 20  |ement number of |
0000b080  72 6f 77 73 20 72 65 6d  61 69 6e 69 6e 67 0d 1f  |rows remaining..|
0000b090  90 52 20 20 20 20 20 20  20 20 4c 44 4d 4d 49 46  |.R        LDMMIF|
0000b0a0  44 20 72 31 33 21 2c 20  7b 72 30 2d 72 32 2c 20  |D r13!, {r0-r2, |
0000b0b0  70 63 7d 20 20 20 20 20  20 20 3b 20 52 65 74 75  |pc}       ; Retu|
0000b0c0  72 6e 20 66 72 6f 6d 20  73 75 62 72 6f 75 74 69  |rn from subrouti|
0000b0d0  6e 65 20 77 68 65 6e 20  66 69 6e 69 73 68 65 64  |ne when finished|
0000b0e0  0d 1f 9a 50 20 20 20 20  20 20 20 20 53 54 52 20  |...P        STR |
0000b0f0  20 20 20 20 72 30 2c 20  5b 72 31 5d 2c 20 23 34  |    r0, [r1], #4|
0000b100  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 65  |            ; Se|
0000b110  74 20 74 68 69 73 20 77  6f 72 64 20 6f 66 20 74  |t this word of t|
0000b120  68 65 20 70 6f 69 6e 74  65 72 20 69 6d 61 67 65  |he pointer image|
0000b130  0d 1f a4 50 20 20 20 20  20 20 20 20 53 54 52 20  |...P        STR |
0000b140  20 20 20 20 72 30 2c 20  5b 72 31 5d 2c 20 23 34  |    r0, [r1], #4|
0000b150  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 65  |            ; Se|
0000b160  74 20 74 68 69 73 20 77  6f 72 64 20 6f 66 20 74  |t this word of t|
0000b170  68 65 20 70 6f 69 6e 74  65 72 20 69 6d 61 67 65  |he pointer image|
0000b180  0d 1f ae 54 20 20 20 20  20 20 20 20 4d 4f 56 20  |...T        MOV |
0000b190  20 20 20 20 72 30 2c 20  72 30 2c 20 52 4f 52 23  |    r0, r0, ROR#|
0000b1a0  32 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 6f  |2           ; Ro|
0000b1b0  74 61 74 65 20 70 61 74  74 65 72 6e 20 62 79 20  |tate pattern by |
0000b1c0  61 20 70 69 78 65 6c 20  66 6f 72 20 6e 65 78 74  |a pixel for next|
0000b1d0  20 72 6f 77 0d 1f b8 44  20 20 20 20 20 20 20 20  | row...D        |
0000b1e0  42 20 20 20 20 20 20 20  70 6c 6f 74 5f 66 69 6c  |B       plot_fil|
0000b1f0  6c 5f 6c 6f 6f 70 20 20  20 20 20 20 20 20 20 20  |l_loop          |
0000b200  3b 20 4c 6f 6f 70 20 66  6f 72 20 74 68 65 20 6e  |; Loop for the n|
0000b210  65 78 74 20 77 6f 72 64  0d 1f c2 04 0d 1f cc 4b  |ext word.......K|
0000b220  20 20 20 20 20 20 20 20  3b 20 50 6c 6f 74 20 61  |        ; Plot a|
0000b230  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 6c 69 6e 65  | horizontal line|
0000b240  20 69 6e 20 63 6f 6c 6f  75 72 20 72 30 20 66 72  | in colour r0 fr|
0000b250  6f 6d 20 28 72 32 2c 20  72 31 29 20 74 6f 20 28  |om (r2, r1) to (|
0000b260  72 33 2c 20 72 31 29 0d  1f d6 0d 2e 70 6c 6f 74  |r3, r1).....plot|
0000b270  5f 72 6f 77 0d 1f e0 3d  20 20 20 20 20 20 20 20  |_row...=        |
0000b280  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
0000b290  30 2d 72 34 2c 20 72 31  34 7d 20 20 20 20 20 20  |0-r4, r14}      |
0000b2a0  3b 20 53 74 61 63 6b 20  72 65 67 69 73 74 65 72  |; Stack register|
0000b2b0  73 0d 1f ea 4d 20 20 20  20 20 20 20 20 4c 44 52  |s...M        LDR|
0000b2c0  42 20 20 20 20 72 34 2c  20 5b 72 31 32 2c 20 23  |B    r4, [r12, #|
0000b2d0  77 73 5f 70 74 72 5f 62  6c 6f 63 6b 5f 61 63 74  |ws_ptr_block_act|
0000b2e0  69 76 65 78 5d 3b 20 52  65 61 64 20 68 6f 72 69  |ivex]; Read hori|
0000b2f0  7a 6f 6e 74 61 6c 20 68  6f 74 73 70 6f 74 0d 1f  |zontal hotspot..|
0000b300  f4 47 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.G        ADD   |
0000b310  20 20 72 32 2c 20 72 32  2c 20 72 34 20 20 20 20  |  r2, r2, r4    |
0000b320  20 20 20 20 20 20 20 20  20 20 3b 20 53 65 74 20  |          ; Set |
0000b330  74 68 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 6f  |the horizontal o|
0000b340  72 69 67 69 6e 0d 1f fe  47 20 20 20 20 20 20 20  |rigin...G       |
0000b350  20 41 44 44 20 20 20 20  20 72 33 2c 20 72 33 2c  | ADD     r3, r3,|
0000b360  20 72 34 20 20 20 20 20  20 20 20 20 20 20 20 20  | r4             |
0000b370  20 3b 20 53 65 74 20 74  68 65 20 68 6f 72 69 7a  | ; Set the horiz|
0000b380  6f 6e 74 61 6c 20 6f 72  69 67 69 6e 0d 20 08 4b  |ontal origin. .K|
0000b390  20 20 20 20 20 20 20 20  4c 44 52 42 20 20 20 20  |        LDRB    |
0000b3a0  72 34 2c 20 5b 72 31 32  2c 20 23 77 73 5f 70 74  |r4, [r12, #ws_pt|
0000b3b0  72 5f 62 6c 6f 63 6b 5f  61 63 74 69 76 65 79 5d  |r_block_activey]|
0000b3c0  3b 20 52 65 61 64 20 76  65 72 74 69 63 61 6c 20  |; Read vertical |
0000b3d0  68 6f 74 73 70 6f 74 0d  20 12 45 20 20 20 20 20  |hotspot. .E     |
0000b3e0  20 20 20 41 44 44 20 20  20 20 20 72 31 2c 20 72  |   ADD     r1, r|
0000b3f0  31 2c 20 72 34 20 20 20  20 20 20 20 20 20 20 20  |1, r4           |
0000b400  20 20 20 3b 20 53 65 74  20 74 68 65 20 76 65 72  |   ; Set the ver|
0000b410  74 69 63 61 6c 20 6f 72  69 67 69 6e 0d 20 1c 4f  |tical origin. .O|
0000b420  20 20 20 20 20 20 20 20  43 4d 50 20 20 20 20 20  |        CMP     |
0000b430  72 32 2c 20 72 33 20 20  20 20 20 20 20 20 20 20  |r2, r3          |
0000b440  20 20 20 20 20 20 20 20  3b 20 50 6c 61 63 65 20  |        ; Place |
0000b450  6c 69 6d 69 74 73 20 69  6e 20 74 68 65 20 63 6f  |limits in the co|
0000b460  72 72 65 63 74 20 6f 72  64 65 72 0d 20 26 43 20  |rrect order. &C |
0000b470  20 20 20 20 20 20 20 4d  4f 56 47 54 20 20 20 72  |       MOVGT   r|
0000b480  34 2c 20 72 32 20 20 20  20 20 20 20 20 20 20 20  |4, r2           |
0000b490  20 20 20 20 20 20 20 3b  20 4d 61 6b 65 20 61 20  |       ; Make a |
0000b4a0  74 65 6d 70 6f 72 61 72  79 20 63 6f 70 79 0d 20  |temporary copy. |
0000b4b0  30 3d 20 20 20 20 20 20  20 20 4d 4f 56 47 54 20  |0=        MOVGT |
0000b4c0  20 20 72 32 2c 20 72 33  20 20 20 20 20 20 20 20  |  r2, r3        |
0000b4d0  20 20 20 20 20 20 20 20  20 20 3b 20 53 77 61 70  |          ; Swap|
0000b4e0  20 74 68 65 20 6c 69 6d  69 74 73 0d 20 3a 4b 20  | the limits. :K |
0000b4f0  20 20 20 20 20 20 20 4d  4f 56 47 54 20 20 20 72  |       MOVGT   r|
0000b500  33 2c 20 72 34 20 20 20  20 20 20 20 20 20 20 20  |3, r4           |
0000b510  20 20 20 20 20 20 20 3b  20 43 6f 70 79 20 74 68  |       ; Copy th|
0000b520  65 20 74 65 6d 70 6f 72  61 72 79 20 76 61 6c 75  |e temporary valu|
0000b530  65 20 62 61 63 6b 0d 20  44 43 20 20 20 20 20 20  |e back. DC      |
0000b540  20 20 43 4d 50 20 20 20  20 20 72 31 2c 20 23 30  |  CMP     r1, #0|
0000b550  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000b560  20 20 3b 20 43 68 65 63  6b 20 6c 6f 77 65 72 20  |  ; Check lower |
0000b570  72 6f 77 20 6c 69 6d 69  74 0d 20 4e 4d 20 20 20  |row limit. NM   |
0000b580  20 20 20 20 20 42 4c 54  20 20 20 20 20 70 6c 6f  |     BLT     plo|
0000b590  74 5f 72 6f 77 5f 64 6f  6e 65 20 20 20 20 20 20  |t_row_done      |
0000b5a0  20 20 20 20 20 3b 20 4e  6f 20 70 6c 6f 74 74 69  |     ; No plotti|
0000b5b0  6e 67 20 69 66 20 62 65  66 6f 72 65 20 66 69 72  |ng if before fir|
0000b5c0  73 74 20 72 6f 77 0d 20  58 43 20 20 20 20 20 20  |st row. XC      |
0000b5d0  20 20 43 4d 50 20 20 20  20 20 72 31 2c 20 23 33  |  CMP     r1, #3|
0000b5e0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
0000b5f0  20 20 3b 20 43 68 65 63  6b 20 75 70 70 65 72 20  |  ; Check upper |
0000b600  72 6f 77 20 6c 69 6d 69  74 0d 20 62 4b 20 20 20  |row limit. bK   |
0000b610  20 20 20 20 20 42 47 54  20 20 20 20 20 70 6c 6f  |     BGT     plo|
0000b620  74 5f 72 6f 77 5f 64 6f  6e 65 20 20 20 20 20 20  |t_row_done      |
0000b630  20 20 20 20 20 3b 20 4e  6f 20 70 6c 6f 74 74 69  |     ; No plotti|
0000b640  6e 67 20 69 66 20 61 66  74 65 72 20 6c 61 73 74  |ng if after last|
0000b650  20 72 6f 77 0d 20 6c 4e  20 20 20 20 20 20 20 20  | row. lN        |
0000b660  42 4c 20 20 20 20 20 20  63 6f 6c 6f 75 72 5f 65  |BL      colour_e|
0000b670  78 70 61 6e 64 20 20 20  20 20 20 20 20 20 20 20  |xpand           |
0000b680  3b 20 45 78 70 61 6e 64  20 74 68 65 20 63 6f 6c  |; Expand the col|
0000b690  6f 75 72 20 74 6f 20 66  69 6c 6c 20 61 20 77 6f  |our to fill a wo|
0000b6a0  72 64 0d 20 76 47 20 20  20 20 20 20 20 20 54 53  |rd. vG        TS|
0000b6b0  54 20 20 20 20 20 72 31  2c 20 23 31 20 20 20 20  |T     r1, #1    |
0000b6c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000b6d0  49 73 20 69 74 20 61 6e  20 6f 64 64 20 6e 75 6d  |Is it an odd num|
0000b6e0  62 65 72 65 64 20 72 6f  77 0d 20 80 4c 20 20 20  |bered row. .L   |
0000b6f0  20 20 20 20 20 4d 4f 56  4e 45 20 20 20 72 30 2c  |     MOVNE   r0,|
0000b700  20 72 30 2c 20 52 4f 52  23 32 20 20 20 20 20 20  | r0, ROR#2      |
0000b710  20 20 20 20 20 3b 20 52  6f 74 61 74 65 20 63 6f  |     ; Rotate co|
0000b720  6c 6f 75 72 20 70 61 74  74 65 72 6e 20 69 66 20  |lour pattern if |
0000b730  69 74 20 69 73 0d 20 8a  41 20 20 20 20 20 20 20  |it is. .A       |
0000b740  20 41 44 44 20 20 20 20  20 72 34 2c 20 72 31 32  | ADD     r4, r12|
0000b750  2c 20 72 31 2c 20 41 53  4c 23 33 20 20 20 20 20  |, r1, ASL#3     |
0000b760  20 3b 20 43 61 6c 63 75  6c 61 74 65 20 72 6f 77  | ; Calculate row|
0000b770  20 73 74 61 72 74 0d 20  94 47 20 20 20 20 20 20  | start. .G      |
0000b780  20 20 41 44 44 20 20 20  20 20 72 34 2c 20 72 34  |  ADD     r4, r4|
0000b790  2c 20 23 77 73 5f 70 74  72 5f 64 61 74 61 20 20  |, #ws_ptr_data  |
0000b7a0  20 20 3b 20 49 6e 63 6c  75 64 65 20 64 61 74 61  |  ; Include data|
0000b7b0  20 73 74 61 72 74 20 6f  66 66 73 65 74 0d 20 9e  | start offset. .|
0000b7c0  4a 20 20 20 20 20 20 20  20 4c 44 52 20 20 20 20  |J        LDR    |
0000b7d0  20 72 31 2c 20 5b 72 34  5d 20 20 20 20 20 20 20  | r1, [r4]       |
0000b7e0  20 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 20  |         ; Read |
0000b7f0  74 68 65 20 65 78 69 73  74 69 6e 67 20 66 69 72  |the existing fir|
0000b800  73 74 20 77 6f 72 64 0d  20 a8 44 20 20 20 20 20  |st word. .D     |
0000b810  20 20 20 42 4c 20 20 20  20 20 20 70 6c 6f 74 5f  |   BL      plot_|
0000b820  72 6f 77 5f 77 6f 72 64  20 20 20 20 20 20 20 20  |row_word        |
0000b830  20 20 20 3b 20 50 72 6f  63 65 73 73 20 74 68 65  |   ; Process the|
0000b840  20 66 69 72 73 74 20 77  6f 72 64 0d 20 b2 4a 20  | first word. .J |
0000b850  20 20 20 20 20 20 20 53  54 52 20 20 20 20 20 72  |       STR     r|
0000b860  31 2c 20 5b 72 34 5d 20  20 20 20 20 20 20 20 20  |1, [r4]         |
0000b870  20 20 20 20 20 20 20 3b  20 53 74 6f 72 65 20 74  |       ; Store t|
0000b880  68 65 20 75 70 64 61 74  65 64 20 66 69 72 73 74  |he updated first|
0000b890  20 77 6f 72 64 0d 20 bc  47 20 20 20 20 20 20 20  | word. .G       |
0000b8a0  20 53 55 42 20 20 20 20  20 72 32 2c 20 72 32 2c  | SUB     r2, r2,|
0000b8b0  20 23 31 36 20 20 20 20  20 20 20 20 20 20 20 20  | #16            |
0000b8c0  20 3b 20 41 64 6a 75 73  74 20 74 68 65 20 73 74  | ; Adjust the st|
0000b8d0  61 72 74 20 70 6f 73 69  74 69 6f 6e 0d 20 c6 45  |art position. .E|
0000b8e0  20 20 20 20 20 20 20 20  53 55 42 20 20 20 20 20  |        SUB     |
0000b8f0  72 33 2c 20 72 33 2c 20  23 31 36 20 20 20 20 20  |r3, r3, #16     |
0000b900  20 20 20 20 20 20 20 20  3b 20 41 64 6a 75 73 74  |        ; Adjust|
0000b910  20 74 68 65 20 65 6e 64  20 70 6f 73 69 74 69 6f  | the end positio|
0000b920  6e 0d 20 d0 4b 20 20 20  20 20 20 20 20 4c 44 52  |n. .K        LDR|
0000b930  20 20 20 20 20 72 31 2c  20 5b 72 34 2c 20 23 34  |     r1, [r4, #4|
0000b940  5d 21 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |]!           ; R|
0000b950  65 61 64 20 74 68 65 20  65 78 69 73 74 69 6e 67  |ead the existing|
0000b960  20 73 65 63 6f 6e 64 20  77 6f 72 64 0d 20 da 45  | second word. .E|
0000b970  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
0000b980  70 6c 6f 74 5f 72 6f 77  5f 77 6f 72 64 20 20 20  |plot_row_word   |
0000b990  20 20 20 20 20 20 20 20  3b 20 50 72 6f 63 65 73  |        ; Proces|
0000b9a0  73 20 74 68 65 20 73 65  63 6f 6e 64 20 77 6f 72  |s the second wor|
0000b9b0  64 0d 20 e4 4b 20 20 20  20 20 20 20 20 53 54 52  |d. .K        STR|
0000b9c0  20 20 20 20 20 72 31 2c  20 5b 72 34 5d 20 20 20  |     r1, [r4]   |
0000b9d0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000b9e0  74 6f 72 65 20 74 68 65  20 75 70 64 61 74 65 64  |tore the updated|
0000b9f0  20 73 65 63 6f 6e 64 20  77 6f 72 64 0d 20 ee 12  | second word. ..|
0000ba00  2e 70 6c 6f 74 5f 72 6f  77 5f 64 6f 6e 65 0d 20  |.plot_row_done. |
0000ba10  f8 44 20 20 20 20 20 20  20 20 4c 44 4d 46 44 20  |.D        LDMFD |
0000ba20  20 20 72 31 33 21 2c 20  7b 72 30 2d 72 34 2c 20  |  r13!, {r0-r4, |
0000ba30  70 63 7d 20 20 20 20 20  20 20 3b 20 52 65 74 75  |pc}       ; Retu|
0000ba40  72 6e 20 66 72 6f 6d 20  73 75 62 72 6f 75 74 69  |rn from subrouti|
0000ba50  6e 65 0d 21 02 12 2e 70  6c 6f 74 5f 72 6f 77 5f  |ne.!...plot_row_|
0000ba60  77 6f 72 64 0d 21 0c 3d  20 20 20 20 20 20 20 20  |word.!.=        |
0000ba70  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
0000ba80  32 2d 72 34 2c 20 72 31  34 7d 20 20 20 20 20 20  |2-r4, r14}      |
0000ba90  3b 20 53 74 61 63 6b 20  72 65 67 69 73 74 65 72  |; Stack register|
0000baa0  73 0d 21 16 45 20 20 20  20 20 20 20 20 43 4d 50  |s.!.E        CMP|
0000bab0  20 20 20 20 20 72 32 2c  20 23 30 20 20 20 20 20  |     r2, #0     |
0000bac0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
0000bad0  61 6e 67 65 20 63 68 65  63 6b 20 6c 6f 77 65 72  |ange check lower|
0000bae0  20 6c 69 6d 69 74 0d 21  20 44 20 20 20 20 20 20  | limit.! D      |
0000baf0  20 20 4d 4f 56 4c 54 20  20 20 72 32 2c 20 23 30  |  MOVLT   r2, #0|
0000bb00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000bb10  20 20 3b 20 53 74 61 72  74 20 66 72 6f 6d 20 66  |  ; Start from f|
0000bb20  69 72 73 74 20 70 69 78  65 6c 0d 21 2a 45 20 20  |irst pixel.!*E  |
0000bb30  20 20 20 20 20 20 43 4d  50 20 20 20 20 20 72 33  |      CMP     r3|
0000bb40  2c 20 23 31 35 20 20 20  20 20 20 20 20 20 20 20  |, #15           |
0000bb50  20 20 20 20 20 20 3b 20  52 61 6e 67 65 20 63 68  |      ; Range ch|
0000bb60  65 63 6b 20 75 70 70 65  72 20 6c 69 6d 69 74 0d  |eck upper limit.|
0000bb70  21 34 43 20 20 20 20 20  20 20 20 4d 4f 56 47 54  |!4C        MOVGT|
0000bb80  20 20 20 72 33 2c 20 23  31 35 20 20 20 20 20 20  |   r3, #15      |
0000bb90  20 20 20 20 20 20 20 20  20 20 20 3b 20 45 6e 64  |           ; End|
0000bba0  20 61 74 20 74 68 65 20  6c 61 73 74 20 70 69 78  | at the last pix|
0000bbb0  65 6c 0d 21 3e 4d 20 20  20 20 20 20 20 20 53 55  |el.!>M        SU|
0000bbc0  42 20 20 20 20 20 72 33  2c 20 72 33 2c 20 72 32  |B     r3, r3, r2|
0000bbd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000bbe0  44 69 66 66 65 72 65 6e  63 65 20 62 65 74 77 65  |Difference betwe|
0000bbf0  65 6e 20 74 68 65 20 74  77 6f 20 65 6e 64 73 0d  |en the two ends.|
0000bc00  21 48 49 20 20 20 20 20  20 20 20 41 44 44 20 20  |!HI        ADD  |
0000bc10  20 20 20 72 33 2c 20 72  33 2c 20 23 31 20 20 20  |   r3, r3, #1   |
0000bc20  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 6e  |           ; Con|
0000bc30  76 65 72 74 20 74 6f 20  6e 75 6d 62 65 72 20 6f  |vert to number o|
0000bc40  66 20 70 69 78 65 6c 73  0d 21 52 47 20 20 20 20  |f pixels.!RG    |
0000bc50  20 20 20 20 4d 4f 56 20  20 20 20 20 72 34 2c 20  |    MOV     r4, |
0000bc60  72 32 2c 20 41 53 4c 23  31 20 20 20 20 20 20 20  |r2, ASL#1       |
0000bc70  20 20 20 20 3b 20 43 6f  6e 76 65 72 74 20 73 74  |    ; Convert st|
0000bc80  61 72 74 20 74 6f 20 72  6f 74 61 74 69 6f 6e 0d  |art to rotation.|
0000bc90  21 5c 45 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |!\E        MOV  |
0000bca0  20 20 20 72 32 2c 20 23  33 20 20 20 20 20 20 20  |   r2, #3       |
0000bcb0  20 20 20 20 20 20 20 20  20 20 20 3b 20 4d 61 73  |           ; Mas|
0000bcc0  6b 20 66 6f 72 20 61 20  73 69 6e 67 6c 65 20 70  |k for a single p|
0000bcd0  69 78 65 6c 0d 21 66 4f  20 20 20 20 20 20 20 20  |ixel.!fO        |
0000bce0  4d 4f 56 20 20 20 20 20  72 32 2c 20 72 32 2c 20  |MOV     r2, r2, |
0000bcf0  4c 53 4c 20 72 34 20 20  20 20 20 20 20 20 20 20  |LSL r4          |
0000bd00  3b 20 4d 61 73 6b 20 66  6f 72 20 74 68 65 20 66  |; Mask for the f|
0000bd10  69 72 73 74 20 70 69 78  65 6c 20 70 6f 73 69 74  |irst pixel posit|
0000bd20  69 6f 6e 0d 21 70 45 20  20 20 20 20 20 20 20 4d  |ion.!pE        M|
0000bd30  4f 56 20 20 20 20 20 72  34 2c 20 23 30 20 20 20  |OV     r4, #0   |
0000bd40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000bd50  20 4e 6f 20 70 69 78 65  6c 73 20 73 65 74 20 69  | No pixels set i|
0000bd60  6e 69 74 69 61 6c 6c 79  0d 21 7a 17 2e 70 6c 6f  |nitially.!z..plo|
0000bd70  74 5f 72 6f 77 5f 77 6f  72 64 5f 6c 6f 6f 70 0d  |t_row_word_loop.|
0000bd80  21 84 48 20 20 20 20 20  20 20 20 53 55 42 53 20  |!.H        SUBS |
0000bd90  20 20 20 72 33 2c 20 72  33 2c 20 23 31 20 20 20  |   r3, r3, #1   |
0000bda0  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 65 63  |           ; Dec|
0000bdb0  72 65 6d 65 6e 74 20 6e  75 6d 62 65 72 20 6f 66  |rement number of|
0000bdc0  20 70 69 78 65 6c 73 0d  21 8e 49 20 20 20 20 20  | pixels.!.I     |
0000bdd0  20 20 20 42 4d 49 20 20  20 20 20 70 6c 6f 74 5f  |   BMI     plot_|
0000bde0  72 6f 77 5f 77 6f 72 64  5f 64 6f 6e 65 20 20 20  |row_word_done   |
0000bdf0  20 20 20 3b 20 45 73 63  61 70 65 20 74 68 65 20  |   ; Escape the |
0000be00  6c 6f 6f 70 20 69 66 20  66 69 6e 69 73 68 65 64  |loop if finished|
0000be10  0d 21 98 4b 20 20 20 20  20 20 20 20 84 52 20 20  |.!.K        .R  |
0000be20  20 20 20 72 34 2c 20 72  34 2c 20 72 32 20 20 20  |   r4, r4, r2   |
0000be30  20 20 20 20 20 20 20 20  20 20 20 3b 20 49 6e 63  |           ; Inc|
0000be40  6c 75 64 65 20 74 68 69  73 20 70 69 78 65 6c 20  |lude this pixel |
0000be50  69 6e 20 74 68 65 20 6d  61 73 6b 0d 21 a2 47 20  |in the mask.!.G |
0000be60  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
0000be70  32 2c 20 72 32 2c 20 4c  53 4c 23 32 20 20 20 20  |2, r2, LSL#2    |
0000be80  20 20 20 20 20 20 20 3b  20 41 64 76 61 6e 63 65  |       ; Advance|
0000be90  20 74 6f 20 74 68 65 20  6e 65 78 74 20 70 69 78  | to the next pix|
0000bea0  65 6c 0d 21 ac 45 20 20  20 20 20 20 20 20 42 20  |el.!.E        B |
0000beb0  20 20 20 20 20 20 70 6c  6f 74 5f 72 6f 77 5f 77  |      plot_row_w|
0000bec0  6f 72 64 5f 6c 6f 6f 70  20 20 20 20 20 20 3b 20  |ord_loop      ; |
0000bed0  4c 6f 6f 70 20 66 6f 72  20 74 68 65 20 6e 65 78  |Loop for the nex|
0000bee0  74 20 70 69 78 65 6c 0d  21 b6 17 2e 70 6c 6f 74  |t pixel.!...plot|
0000bef0  5f 72 6f 77 5f 77 6f 72  64 5f 64 6f 6e 65 0d 21  |_row_word_done.!|
0000bf00  c0 41 20 20 20 20 20 20  20 20 42 49 43 20 20 20  |.A        BIC   |
0000bf10  20 20 72 31 2c 20 72 31  2c 20 72 34 20 20 20 20  |  r1, r1, r4    |
0000bf20  20 20 20 20 20 20 20 20  20 20 3b 20 43 6c 65 61  |          ; Clea|
0000bf30  72 20 70 69 78 65 6c 73  20 74 6f 20 73 65 74 0d  |r pixels to set.|
0000bf40  21 ca 3b 20 20 20 20 20  20 20 20 80 20 20 20 20  |!.;        .    |
0000bf50  20 72 34 2c 20 72 34 2c  20 72 30 20 20 20 20 20  | r4, r4, r0     |
0000bf60  20 20 20 20 20 20 20 20  20 3b 20 43 6f 6c 6f 75  |         ; Colou|
0000bf70  72 20 74 68 65 20 6d 61  73 6b 0d 21 d4 4f 20 20  |r the mask.!.O  |
0000bf80  20 20 20 20 20 20 84 52  20 20 20 20 20 72 31 2c  |      .R     r1,|
0000bf90  20 72 31 2c 20 72 34 20  20 20 20 20 20 20 20 20  | r1, r4         |
0000bfa0  20 20 20 20 20 3b 20 49  6e 63 6c 75 64 65 20 74  |     ; Include t|
0000bfb0  68 65 20 6e 65 77 20 70  69 78 65 6c 73 20 69 6e  |he new pixels in|
0000bfc0  20 74 68 65 20 77 6f 72  64 0d 21 de 44 20 20 20  | the word.!.D   |
0000bfd0  20 20 20 20 20 4c 44 4d  46 44 20 20 20 72 31 33  |     LDMFD   r13|
0000bfe0  21 2c 20 7b 72 32 2d 72  34 2c 20 70 63 7d 20 20  |!, {r2-r4, pc}  |
0000bff0  20 20 20 20 20 3b 20 52  65 74 75 72 6e 20 66 72  |     ; Return fr|
0000c000  6f 6d 20 73 75 62 72 6f  75 74 69 6e 65 0d 21 e8  |om subroutine.!.|
0000c010  04 0d 21 f2 3a 20 20 20  20 20 20 20 20 3b 20 50  |..!.:        ; P|
0000c020  6c 6f 74 20 61 20 73 69  6e 67 6c 65 20 70 6f 69  |lot a single poi|
0000c030  6e 74 20 69 6e 20 63 6f  6c 6f 75 72 20 72 30 20  |nt in colour r0 |
0000c040  61 74 20 28 72 32 2c 20  72 31 29 0d 21 fc 0f 2e  |at (r2, r1).!...|
0000c050  70 6c 6f 74 5f 70 6f 69  6e 74 0d 22 06 3d 20 20  |plot_point.".=  |
0000c060  20 20 20 20 20 20 53 54  4d 46 44 20 20 20 72 31  |      STMFD   r1|
0000c070  33 21 2c 20 7b 72 30 2d  72 33 2c 20 72 31 34 7d  |3!, {r0-r3, r14}|
0000c080  20 20 20 20 20 20 3b 20  53 74 61 63 6b 20 72 65  |      ; Stack re|
0000c090  67 69 73 74 65 72 73 0d  22 10 4d 20 20 20 20 20  |gisters.".M     |
0000c0a0  20 20 20 4c 44 52 42 20  20 20 20 72 33 2c 20 5b  |   LDRB    r3, [|
0000c0b0  72 31 32 2c 20 23 77 73  5f 70 74 72 5f 62 6c 6f  |r12, #ws_ptr_blo|
0000c0c0  63 6b 5f 61 63 74 69 76  65 78 5d 3b 20 52 65 61  |ck_activex]; Rea|
0000c0d0  64 20 68 6f 72 69 7a 6f  6e 74 61 6c 20 68 6f 74  |d horizontal hot|
0000c0e0  73 70 6f 74 0d 22 1a 47  20 20 20 20 20 20 20 20  |spot.".G        |
0000c0f0  41 44 44 20 20 20 20 20  72 32 2c 20 72 32 2c 20  |ADD     r2, r2, |
0000c100  72 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r3              |
0000c110  3b 20 53 65 74 20 74 68  65 20 68 6f 72 69 7a 6f  |; Set the horizo|
0000c120  6e 74 61 6c 20 6f 72 69  67 69 6e 0d 22 24 4b 20  |ntal origin."$K |
0000c130  20 20 20 20 20 20 20 4c  44 52 42 20 20 20 20 72  |       LDRB    r|
0000c140  33 2c 20 5b 72 31 32 2c  20 23 77 73 5f 70 74 72  |3, [r12, #ws_ptr|
0000c150  5f 62 6c 6f 63 6b 5f 61  63 74 69 76 65 79 5d 3b  |_block_activey];|
0000c160  20 52 65 61 64 20 76 65  72 74 69 63 61 6c 20 68  | Read vertical h|
0000c170  6f 74 73 70 6f 74 0d 22  2e 45 20 20 20 20 20 20  |otspot.".E      |
0000c180  20 20 41 44 44 20 20 20  20 20 72 31 2c 20 72 31  |  ADD     r1, r1|
0000c190  2c 20 72 33 20 20 20 20  20 20 20 20 20 20 20 20  |, r3            |
0000c1a0  20 20 3b 20 53 65 74 20  74 68 65 20 76 65 72 74  |  ; Set the vert|
0000c1b0  69 63 61 6c 20 6f 72 69  67 69 6e 0d 22 38 43 20  |ical origin."8C |
0000c1c0  20 20 20 20 20 20 20 43  4d 50 20 20 20 20 20 72  |       CMP     r|
0000c1d0  31 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |1, #0           |
0000c1e0  20 20 20 20 20 20 20 3b  20 43 68 65 63 6b 20 6c  |       ; Check l|
0000c1f0  6f 77 65 72 20 72 6f 77  20 6c 69 6d 69 74 0d 22  |ower row limit."|
0000c200  42 46 20 20 20 20 20 20  20 20 43 4d 50 47 45 20  |BF        CMPGE |
0000c210  20 20 72 32 2c 20 23 30  20 20 20 20 20 20 20 20  |  r2, #0        |
0000c220  20 20 20 20 20 20 20 20  20 20 3b 20 43 68 65 63  |          ; Chec|
0000c230  6b 20 6c 6f 77 65 72 20  63 6f 6c 75 6d 6e 20 6c  |k lower column l|
0000c240  69 6d 69 74 0d 22 4c 50  20 20 20 20 20 20 20 20  |imit."LP        |
0000c250  42 4c 54 20 20 20 20 20  70 6c 6f 74 5f 70 6f 69  |BLT     plot_poi|
0000c260  6e 74 5f 64 6f 6e 65 20  20 20 20 20 20 20 20 20  |nt_done         |
0000c270  3b 20 4e 6f 20 70 6c 6f  74 74 69 6e 67 20 69 66  |; No plotting if|
0000c280  20 62 65 6c 6f 77 20 76  69 73 69 62 6c 65 20 72  | below visible r|
0000c290  61 6e 67 65 0d 22 56 43  20 20 20 20 20 20 20 20  |ange."VC        |
0000c2a0  43 4d 50 20 20 20 20 20  72 31 2c 20 23 33 31 20  |CMP     r1, #31 |
0000c2b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000c2c0  3b 20 43 68 65 63 6b 20  75 70 70 65 72 20 72 6f  |; Check upper ro|
0000c2d0  77 20 6c 69 6d 69 74 0d  22 60 46 20 20 20 20 20  |w limit."`F     |
0000c2e0  20 20 20 43 4d 50 4c 45  20 20 20 72 32 2c 20 23  |   CMPLE   r2, #|
0000c2f0  33 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |31              |
0000c300  20 20 20 3b 20 43 68 65  63 6b 20 75 70 70 65 72  |   ; Check upper|
0000c310  20 63 6f 6c 75 6d 6e 20  6c 69 6d 69 74 0d 22 6a  | column limit."j|
0000c320  50 20 20 20 20 20 20 20  20 42 47 54 20 20 20 20  |P        BGT    |
0000c330  20 70 6c 6f 74 5f 70 6f  69 6e 74 5f 64 6f 6e 65  | plot_point_done|
0000c340  20 20 20 20 20 20 20 20  20 3b 20 4e 6f 20 70 6c  |         ; No pl|
0000c350  6f 74 74 69 6e 67 20 69  66 20 61 62 6f 76 65 20  |otting if above |
0000c360  76 69 73 69 62 6c 65 20  72 61 6e 67 65 0d 22 74  |visible range."t|
0000c370  4e 20 20 20 20 20 20 20  20 42 4c 20 20 20 20 20  |N        BL     |
0000c380  20 63 6f 6c 6f 75 72 5f  65 78 70 61 6e 64 20 20  | colour_expand  |
0000c390  20 20 20 20 20 20 20 20  20 3b 20 45 78 70 61 6e  |         ; Expan|
0000c3a0  64 20 74 68 65 20 63 6f  6c 6f 75 72 20 74 6f 20  |d the colour to |
0000c3b0  66 69 6c 6c 20 61 20 77  6f 72 64 0d 22 7e 47 20  |fill a word."~G |
0000c3c0  20 20 20 20 20 20 20 54  53 54 20 20 20 20 20 72  |       TST     r|
0000c3d0  31 2c 20 23 31 20 20 20  20 20 20 20 20 20 20 20  |1, #1           |
0000c3e0  20 20 20 20 20 20 20 3b  20 49 73 20 69 74 20 61  |       ; Is it a|
0000c3f0  6e 20 6f 64 64 20 6e 75  6d 62 65 72 65 64 20 72  |n odd numbered r|
0000c400  6f 77 0d 22 88 4c 20 20  20 20 20 20 20 20 4d 4f  |ow.".L        MO|
0000c410  56 4e 45 20 20 20 72 30  2c 20 72 30 2c 20 52 4f  |VNE   r0, r0, RO|
0000c420  52 23 32 20 20 20 20 20  20 20 20 20 20 20 3b 20  |R#2           ; |
0000c430  52 6f 74 61 74 65 20 63  6f 6c 6f 75 72 20 70 61  |Rotate colour pa|
0000c440  74 74 65 72 6e 20 69 66  20 69 74 20 69 73 0d 22  |ttern if it is."|
0000c450  92 41 20 20 20 20 20 20  20 20 41 44 44 20 20 20  |.A        ADD   |
0000c460  20 20 72 31 2c 20 72 31  32 2c 20 72 31 2c 20 41  |  r1, r12, r1, A|
0000c470  53 4c 23 33 20 20 20 20  20 20 3b 20 43 61 6c 63  |SL#3      ; Calc|
0000c480  75 6c 61 74 65 20 72 6f  77 20 73 74 61 72 74 0d  |ulate row start.|
0000c490  22 9c 47 20 20 20 20 20  20 20 20 41 44 44 20 20  |".G        ADD  |
0000c4a0  20 20 20 72 31 2c 20 72  31 2c 20 23 77 73 5f 70  |   r1, r1, #ws_p|
0000c4b0  74 72 5f 64 61 74 61 20  20 20 20 3b 20 49 6e 63  |tr_data    ; Inc|
0000c4c0  6c 75 64 65 20 64 61 74  61 20 73 74 61 72 74 20  |lude data start |
0000c4d0  6f 66 66 73 65 74 0d 22  a6 4c 20 20 20 20 20 20  |offset.".L      |
0000c4e0  20 20 54 53 54 20 20 20  20 20 72 32 2c 20 23 26  |  TST     r2, #&|
0000c4f0  31 30 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |10              |
0000c500  20 20 3b 20 53 68 6f 75  6c 64 20 74 68 65 20 73  |  ; Should the s|
0000c510  65 63 6f 6e 64 20 77 6f  72 64 20 62 65 20 75 73  |econd word be us|
0000c520  65 64 0d 22 b0 42 20 20  20 20 20 20 20 20 41 44  |ed.".B        AD|
0000c530  44 4e 45 20 20 20 72 31  2c 20 72 31 2c 20 23 34  |DNE   r1, r1, #4|
0000c540  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000c550  41 64 76 61 6e 63 65 20  69 66 20 69 74 20 73 68  |Advance if it sh|
0000c560  6f 75 6c 64 0d 22 ba 41  20 20 20 20 20 20 20 20  |ould.".A        |
0000c570  80 20 20 20 20 20 72 32  2c 20 72 32 2c 20 23 26  |.     r2, r2, #&|
0000c580  66 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |f             ; |
0000c590  50 69 78 65 6c 20 77 69  74 68 69 6e 20 74 68 65  |Pixel within the|
0000c5a0  20 77 6f 72 64 0d 22 c4  43 20 20 20 20 20 20 20  | word.".C       |
0000c5b0  20 41 44 44 20 20 20 20  20 72 32 2c 20 72 32 2c  | ADD     r2, r2,|
0000c5c0  20 72 32 20 20 20 20 20  20 20 20 20 20 20 20 20  | r2             |
0000c5d0  20 3b 20 43 6f 6e 76 65  72 74 20 74 6f 20 61 20  | ; Convert to a |
0000c5e0  72 6f 74 61 74 69 6f 6e  0d 22 ce 45 20 20 20 20  |rotation.".E    |
0000c5f0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 33 2c 20  |    MOV     r3, |
0000c600  23 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |#3              |
0000c610  20 20 20 20 3b 20 4d 61  73 6b 20 66 6f 72 20 61  |    ; Mask for a|
0000c620  20 73 69 6e 67 6c 65 20  70 69 78 65 6c 0d 22 d8  | single pixel.".|
0000c630  4c 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |L        MOV    |
0000c640  20 72 33 2c 20 72 33 2c  20 4c 53 4c 20 72 32 20  | r3, r3, LSL r2 |
0000c650  20 20 20 20 20 20 20 20  20 3b 20 52 6f 74 61 74  |         ; Rotat|
0000c660  65 20 74 6f 20 74 68 65  20 63 6f 72 72 65 63 74  |e to the correct|
0000c670  20 70 6f 73 69 74 69 6f  6e 0d 22 e2 48 20 20 20  | position.".H   |
0000c680  20 20 20 20 20 80 20 20  20 20 20 72 30 2c 20 72  |     .     r0, r|
0000c690  30 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |0, r3           |
0000c6a0  20 20 20 3b 20 4d 61 73  6b 20 6f 75 74 20 74 68  |   ; Mask out th|
0000c6b0  65 20 72 65 71 75 69 72  65 64 20 63 6f 6c 6f 75  |e required colou|
0000c6c0  72 0d 22 ec 4a 20 20 20  20 20 20 20 20 4c 44 52  |r.".J        LDR|
0000c6d0  20 20 20 20 20 72 32 2c  20 5b 72 31 5d 20 20 20  |     r2, [r1]   |
0000c6e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
0000c6f0  65 61 64 20 74 68 65 20  65 78 69 73 74 69 6e 67  |ead the existing|
0000c700  20 69 6d 61 67 65 20 77  6f 72 64 0d 22 f6 47 20  | image word.".G |
0000c710  20 20 20 20 20 20 20 42  49 43 20 20 20 20 20 72  |       BIC     r|
0000c720  32 2c 20 72 32 2c 20 72  33 20 20 20 20 20 20 20  |2, r2, r3       |
0000c730  20 20 20 20 20 20 20 3b  20 43 6c 65 61 72 20 74  |       ; Clear t|
0000c740  68 65 20 70 69 78 65 6c  20 74 6f 20 62 65 20 73  |he pixel to be s|
0000c750  65 74 0d 23 00 44 20 20  20 20 20 20 20 20 84 52  |et.#.D        .R|
0000c760  20 20 20 20 20 72 32 2c  20 72 32 2c 20 72 30 20  |     r2, r2, r0 |
0000c770  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000c780  65 74 20 74 68 65 20 72  65 71 75 69 72 65 64 20  |et the required |
0000c790  63 6f 6c 6f 75 72 0d 23  0a 45 20 20 20 20 20 20  |colour.#.E      |
0000c7a0  20 20 53 54 52 20 20 20  20 20 72 32 2c 20 5b 72  |  STR     r2, [r|
0000c7b0  31 5d 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1]              |
0000c7c0  20 20 3b 20 53 74 72 6f  72 65 20 74 68 65 20 75  |  ; Strore the u|
0000c7d0  70 64 61 74 65 64 20 77  6f 72 64 0d 23 14 14 2e  |pdated word.#...|
0000c7e0  70 6c 6f 74 5f 70 6f 69  6e 74 5f 64 6f 6e 65 0d  |plot_point_done.|
0000c7f0  23 1e 44 20 20 20 20 20  20 20 20 4c 44 4d 46 44  |#.D        LDMFD|
0000c800  20 20 20 72 31 33 21 2c  20 7b 72 30 2d 72 33 2c  |   r13!, {r0-r3,|
0000c810  20 70 63 7d 20 20 20 20  20 20 20 3b 20 52 65 74  | pc}       ; Ret|
0000c820  75 72 6e 20 66 72 6f 6d  20 73 75 62 72 6f 75 74  |urn from subrout|
0000c830  69 6e 65 0d 23 28 04 0d  23 32 49 20 20 20 20 20  |ine.#(..#2I     |
0000c840  20 20 20 3b 20 50 6c 6f  74 20 61 20 6d 69 64 70  |   ; Plot a midp|
0000c850  6f 69 6e 74 20 6c 69 6e  65 20 69 6e 20 63 6f 6c  |oint line in col|
0000c860  6f 75 72 20 72 30 20 66  72 6f 6d 20 28 72 32 2c  |our r0 from (r2,|
0000c870  20 72 31 29 20 74 6f 20  28 72 34 2c 20 72 33 29  | r1) to (r4, r3)|
0000c880  0d 23 3c 0e 2e 70 6c 6f  74 5f 6c 69 6e 65 0d 23  |.#<..plot_line.#|
0000c890  46 3d 20 20 20 20 20 20  20 20 53 54 4d 46 44 20  |F=        STMFD |
0000c8a0  20 20 72 31 33 21 2c 20  7b 72 30 2d 72 37 2c 20  |  r13!, {r0-r7, |
0000c8b0  72 31 34 7d 20 20 20 20  20 20 3b 20 53 74 61 63  |r14}      ; Stac|
0000c8c0  6b 20 72 65 67 69 73 74  65 72 73 0d 23 50 4c 20  |k registers.#PL |
0000c8d0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
0000c8e0  35 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |5, #0           |
0000c8f0  20 20 20 20 20 20 20 3b  20 53 74 61 72 74 20 77  |       ; Start w|
0000c900  69 74 68 20 64 65 66 61  75 6c 74 20 63 6f 6f 72  |ith default coor|
0000c910  64 69 6e 61 74 65 73 0d  23 5a 42 20 20 20 20 20  |dinates.#ZB     |
0000c920  20 20 20 53 55 42 53 20  20 20 20 72 31 2c 20 72  |   SUBS    r1, r|
0000c930  31 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |1, r3           |
0000c940  20 20 20 3b 20 43 68 61  6e 67 65 20 69 6e 20 72  |   ; Change in r|
0000c950  6f 77 20 6e 75 6d 62 65  72 0d 23 64 4c 20 20 20  |ow number.#dL   |
0000c960  20 20 20 20 20 52 53 42  4d 49 20 20 20 72 33 2c  |     RSBMI   r3,|
0000c970  20 72 33 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r3, #0         |
0000c980  20 20 20 20 20 3b 20 52  65 66 6c 65 63 74 20 73  |     ; Reflect s|
0000c990  74 61 72 74 20 70 6f 69  6e 74 20 76 65 72 74 69  |tart point verti|
0000c9a0  63 61 6c 6c 79 0d 23 6e  4a 20 20 20 20 20 20 20  |cally.#nJ       |
0000c9b0  20 52 53 42 4d 49 20 20  20 72 31 2c 20 72 31 2c  | RSBMI   r1, r1,|
0000c9c0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000c9d0  20 3b 20 52 65 66 6c 65  63 74 20 63 68 61 6e 67  | ; Reflect chang|
0000c9e0  65 20 69 6e 20 72 6f 77  20 6e 75 6d 62 65 72 0d  |e in row number.|
0000c9f0  23 78 41 20 20 20 20 20  20 20 20 84 52 4d 49 20  |#xA        .RMI |
0000ca00  20 20 72 35 2c 20 72 35  2c 20 23 32 20 20 20 20  |  r5, r5, #2    |
0000ca10  20 20 20 20 20 20 20 20  20 20 3b 20 52 65 63 6f  |          ; Reco|
0000ca20  72 64 20 76 65 72 74 69  63 61 6c 20 66 6c 69 70  |rd vertical flip|
0000ca30  0d 23 82 45 20 20 20 20  20 20 20 20 53 55 42 53  |.#.E        SUBS|
0000ca40  20 20 20 20 72 32 2c 20  72 32 2c 20 72 34 20 20  |    r2, r2, r4  |
0000ca50  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 68  |            ; Ch|
0000ca60  61 6e 67 65 20 69 6e 20  63 6f 6c 75 6d 6e 20 6e  |ange in column n|
0000ca70  75 6d 62 65 72 0d 23 8c  4e 20 20 20 20 20 20 20  |umber.#.N       |
0000ca80  20 52 53 42 4d 49 20 20  20 72 34 2c 20 72 34 2c  | RSBMI   r4, r4,|
0000ca90  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000caa0  20 3b 20 52 65 66 6c 65  63 74 20 73 74 61 72 74  | ; Reflect start|
0000cab0  20 70 6f 69 6e 74 20 68  6f 72 69 7a 6f 6e 74 61  | point horizonta|
0000cac0  6c 6c 79 0d 23 96 4d 20  20 20 20 20 20 20 20 52  |lly.#.M        R|
0000cad0  53 42 4d 49 20 20 20 72  32 2c 20 72 32 2c 20 23  |SBMI   r2, r2, #|
0000cae0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |0              ;|
0000caf0  20 52 65 66 6c 65 63 74  20 63 68 61 6e 67 65 20  | Reflect change |
0000cb00  69 6e 20 63 6f 6c 75 6d  6e 20 6e 75 6d 62 65 72  |in column number|
0000cb10  0d 23 a0 43 20 20 20 20  20 20 20 20 84 52 4d 49  |.#.C        .RMI|
0000cb20  20 20 20 72 35 2c 20 72  35 2c 20 23 34 20 20 20  |   r5, r5, #4   |
0000cb30  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 63  |           ; Rec|
0000cb40  6f 72 64 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 66  |ord horizontal f|
0000cb50  6c 69 70 0d 23 aa 41 20  20 20 20 20 20 20 20 43  |lip.#.A        C|
0000cb60  4d 50 20 20 20 20 20 72  32 2c 20 72 31 20 20 20  |MP     r2, r1   |
0000cb70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000cb80  20 43 68 65 63 6b 20 73  6c 6f 70 65 20 6f 66 20  | Check slope of |
0000cb90  6c 69 6e 65 0d 23 b4 46  20 20 20 20 20 20 20 20  |line.#.F        |
0000cba0  4d 4f 56 47 54 20 20 20  72 36 2c 20 72 33 20 20  |MOVGT   r6, r3  |
0000cbb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000cbc0  3b 20 43 6f 70 79 20 6f  72 69 67 69 6e 61 6c 20  |; Copy original |
0000cbd0  72 6f 77 20 6e 75 6d 62  65 72 0d 23 be 42 20 20  |row number.#.B  |
0000cbe0  20 20 20 20 20 20 4d 4f  56 47 54 20 20 20 72 33  |      MOVGT   r3|
0000cbf0  2c 20 72 34 20 20 20 20  20 20 20 20 20 20 20 20  |, r4            |
0000cc00  20 20 20 20 20 20 3b 20  53 77 61 70 20 72 6f 77  |      ; Swap row|
0000cc10  20 77 69 74 68 20 63 6f  6c 75 6d 6e 0d 23 c8 40  | with column.#.@|
0000cc20  20 20 20 20 20 20 20 20  4d 4f 56 47 54 20 20 20  |        MOVGT   |
0000cc30  72 34 2c 20 72 36 20 20  20 20 20 20 20 20 20 20  |r4, r6          |
0000cc40  20 20 20 20 20 20 20 20  3b 20 53 65 74 20 6e 65  |        ; Set ne|
0000cc50  77 20 72 6f 77 20 6e 75  6d 62 65 72 0d 23 d2 46  |w row number.#.F|
0000cc60  20 20 20 20 20 20 20 20  4d 4f 56 47 54 20 20 20  |        MOVGT   |
0000cc70  72 36 2c 20 72 31 20 20  20 20 20 20 20 20 20 20  |r6, r1          |
0000cc80  20 20 20 20 20 20 20 20  3b 20 43 6f 70 79 20 6f  |        ; Copy o|
0000cc90  72 69 67 69 6e 61 6c 20  72 6f 77 20 63 68 61 6e  |riginal row chan|
0000cca0  67 65 0d 23 dc 42 20 20  20 20 20 20 20 20 4d 4f  |ge.#.B        MO|
0000ccb0  56 47 54 20 20 20 72 31  2c 20 72 32 20 20 20 20  |VGT   r1, r2    |
0000ccc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000ccd0  53 77 61 70 20 72 6f 77  20 77 69 74 68 20 63 6f  |Swap row with co|
0000cce0  6c 75 6d 6e 0d 23 e6 40  20 20 20 20 20 20 20 20  |lumn.#.@        |
0000ccf0  4d 4f 56 47 54 20 20 20  72 32 2c 20 72 36 20 20  |MOVGT   r2, r6  |
0000cd00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000cd10  3b 20 53 65 74 20 6e 65  77 20 72 6f 77 20 63 68  |; Set new row ch|
0000cd20  61 6e 67 65 0d 23 f0 47  20 20 20 20 20 20 20 20  |ange.#.G        |
0000cd30  84 52 47 54 20 20 20 72  35 2c 20 72 35 2c 20 23  |.RGT   r5, r5, #|
0000cd40  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
0000cd50  20 52 65 63 6f 72 64 20  63 6f 6f 72 64 69 6e 61  | Record coordina|
0000cd60  74 65 20 72 65 76 65 72  73 61 6c 0d 23 fa 47 20  |te reversal.#.G |
0000cd70  20 20 20 20 20 20 20 41  44 44 20 20 20 20 20 72  |       ADD     r|
0000cd80  36 2c 20 72 32 2c 20 72  32 20 20 20 20 20 20 20  |6, r2, r2       |
0000cd90  20 20 20 20 20 20 20 3b  20 48 6f 72 69 7a 6f 6e  |       ; Horizon|
0000cda0  74 61 6c 20 73 74 65 70  20 69 6e 63 72 65 6d 65  |tal step increme|
0000cdb0  6e 74 0d 24 04 4d 20 20  20 20 20 20 20 20 53 55  |nt.$.M        SU|
0000cdc0  42 20 20 20 20 20 72 37  2c 20 72 36 2c 20 72 31  |B     r7, r6, r1|
0000cdd0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000cde0  49 6e 69 74 69 61 6c 20  64 65 63 69 73 69 6f 6e  |Initial decision|
0000cdf0  20 76 61 72 69 61 62 6c  65 20 76 61 6c 75 65 0d  | variable value.|
0000ce00  24 0e 4d 20 20 20 20 20  20 20 20 53 55 42 20 20  |$.M        SUB  |
0000ce10  20 20 20 72 32 2c 20 72  32 2c 20 72 31 20 20 20  |   r2, r2, r1   |
0000ce20  20 20 20 20 20 20 20 20  20 20 20 3b 20 48 61 6c  |           ; Hal|
0000ce30  66 20 6f 66 20 64 69 61  67 6f 6e 61 6c 20 73 74  |f of diagonal st|
0000ce40  65 70 20 69 6e 63 72 65  6d 65 6e 74 0d 24 18 45  |ep increment.$.E|
0000ce50  20 20 20 20 20 20 20 20  41 44 44 20 20 20 20 20  |        ADD     |
0000ce60  72 32 2c 20 72 32 2c 20  72 32 20 20 20 20 20 20  |r2, r2, r2      |
0000ce70  20 20 20 20 20 20 20 20  3b 20 44 69 61 67 6f 6e  |        ; Diagon|
0000ce80  61 6c 20 73 74 65 70 20  69 6e 63 72 65 6d 65 6e  |al step incremen|
0000ce90  74 0d 24 22 45 20 20 20  20 20 20 20 20 41 44 44  |t.$"E        ADD|
0000cea0  20 20 20 20 20 72 31 2c  20 72 33 2c 20 72 31 20  |     r1, r3, r1 |
0000ceb0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 54  |             ; T|
0000cec0  68 65 20 6c 61 73 74 20  70 6f 69 6e 74 20 74 6f  |he last point to|
0000ced0  20 70 6c 6f 74 20 0d 24  2c 13 2e 70 6c 6f 74 5f  | plot .$,..plot_|
0000cee0  6c 69 6e 65 5f 6c 6f 6f  70 0d 24 36 4e 20 20 20  |line_loop.$6N   |
0000cef0  20 20 20 20 20 42 4c 20  20 20 20 20 20 70 6c 6f  |     BL      plo|
0000cf00  74 5f 6c 69 6e 65 5f 70  6f 69 6e 74 20 20 20 20  |t_line_point    |
0000cf10  20 20 20 20 20 3b 20 50  6c 6f 74 20 74 68 65 20  |     ; Plot the |
0000cf20  66 69 72 73 74 20 70 6f  69 6e 74 20 6f 66 20 74  |first point of t|
0000cf30  68 65 20 6c 69 6e 65 0d  24 40 48 20 20 20 20 20  |he line.$@H     |
0000cf40  20 20 20 43 4d 50 20 20  20 20 20 72 33 2c 20 72  |   CMP     r3, r|
0000cf50  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |1               |
0000cf60  20 20 20 3b 20 48 61 73  20 74 68 65 20 6c 69 6e  |   ; Has the lin|
0000cf70  65 20 62 65 65 6e 20 66  69 6e 69 73 68 65 64 0d  |e been finished.|
0000cf80  24 4a 52 20 20 20 20 20  20 20 20 4c 44 4d 47 45  |$JR        LDMGE|
0000cf90  46 44 20 72 31 33 21 2c  20 7b 72 30 2d 72 37 2c  |FD r13!, {r0-r7,|
0000cfa0  20 70 63 7d 20 20 20 20  20 20 20 3b 20 52 65 74  | pc}       ; Ret|
0000cfb0  75 72 6e 20 66 72 6f 6d  20 73 75 62 72 6f 75 74  |urn from subrout|
0000cfc0  69 6e 65 20 77 68 65 6e  20 66 69 6e 69 73 68 65  |ine when finishe|
0000cfd0  64 0d 24 54 49 20 20 20  20 20 20 20 20 43 4d 50  |d.$TI        CMP|
0000cfe0  20 20 20 20 20 72 37 2c  20 23 30 20 20 20 20 20  |     r7, #0     |
0000cff0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000d000  68 65 63 6b 20 74 68 65  20 64 65 63 69 73 69 6f  |heck the decisio|
0000d010  6e 20 76 61 72 69 61 62  6c 65 0d 24 5e 49 20 20  |n variable.$^I  |
0000d020  20 20 20 20 20 20 41 44  44 4c 45 20 20 20 72 37  |      ADDLE   r7|
0000d030  2c 20 72 37 2c 20 72 36  20 20 20 20 20 20 20 20  |, r7, r6        |
0000d040  20 20 20 20 20 20 3b 20  49 6e 63 72 65 6d 65 6e  |      ; Incremen|
0000d050  74 20 64 65 63 69 73 69  6f 6e 20 76 61 72 69 61  |t decision varia|
0000d060  62 6c 65 0d 24 68 49 20  20 20 20 20 20 20 20 41  |ble.$hI        A|
0000d070  44 44 47 54 20 20 20 72  37 2c 20 72 37 2c 20 72  |DDGT   r7, r7, r|
0000d080  32 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |2              ;|
0000d090  20 49 6e 63 72 65 6d 65  6e 74 20 64 65 63 69 73  | Increment decis|
0000d0a0  69 6f 6e 20 76 61 72 69  61 62 6c 65 0d 24 72 47  |ion variable.$rG|
0000d0b0  20 20 20 20 20 20 20 20  41 44 44 47 54 20 20 20  |        ADDGT   |
0000d0c0  72 34 2c 20 72 34 2c 20  23 31 20 20 20 20 20 20  |r4, r4, #1      |
0000d0d0  20 20 20 20 20 20 20 20  3b 20 50 65 72 66 6f 72  |        ; Perfor|
0000d0e0  6d 20 74 68 65 20 64 69  61 67 6f 6e 61 6c 20 73  |m the diagonal s|
0000d0f0  74 65 70 0d 24 7c 47 20  20 20 20 20 20 20 20 41  |tep.$|G        A|
0000d100  44 44 20 20 20 20 20 72  33 2c 20 72 33 2c 20 23  |DD     r3, r3, #|
0000d110  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
0000d120  20 41 64 76 61 6e 63 65  20 74 6f 20 74 68 65 20  | Advance to the |
0000d130  6e 65 78 74 20 70 69 78  65 6c 0d 24 86 45 20 20  |next pixel.$.E  |
0000d140  20 20 20 20 20 20 42 20  20 20 20 20 20 20 70 6c  |      B       pl|
0000d150  6f 74 5f 6c 69 6e 65 5f  6c 6f 6f 70 20 20 20 20  |ot_line_loop    |
0000d160  20 20 20 20 20 20 3b 20  4c 6f 6f 70 20 66 6f 72  |      ; Loop for|
0000d170  20 74 68 65 20 6e 65 78  74 20 70 69 78 65 6c 0d  | the next pixel.|
0000d180  24 90 14 2e 70 6c 6f 74  5f 6c 69 6e 65 5f 70 6f  |$...plot_line_po|
0000d190  69 6e 74 0d 24 9a 3d 20  20 20 20 20 20 20 20 53  |int.$.=        S|
0000d1a0  54 4d 46 44 20 20 20 72  31 33 21 2c 20 7b 72 31  |TMFD   r13!, {r1|
0000d1b0  2d 72 32 2c 20 72 31 34  7d 20 20 20 20 20 20 3b  |-r2, r14}      ;|
0000d1c0  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
0000d1d0  0d 24 a4 4c 20 20 20 20  20 20 20 20 54 53 54 20  |.$.L        TST |
0000d1e0  20 20 20 20 72 35 2c 20  23 31 20 20 20 20 20 20  |    r5, #1      |
0000d1f0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 48 61  |            ; Ha|
0000d200  76 65 20 63 6f 6f 72 64  69 6e 61 74 65 73 20 62  |ve coordinates b|
0000d210  65 65 6e 20 72 65 76 65  72 73 65 64 0d 24 ae 3e  |een reversed.$.>|
0000d220  20 20 20 20 20 20 20 20  ec 51 20 20 20 72 31 2c  |        .Q   r1,|
0000d230  20 72 33 20 20 20 20 20  20 20 20 20 20 20 20 20  | r3             |
0000d240  20 20 20 20 20 3b 20 43  6f 70 79 20 75 6e 72 65  |     ; Copy unre|
0000d250  76 65 72 73 65 64 20 72  6f 77 0d 24 b8 41 20 20  |versed row.$.A  |
0000d260  20 20 20 20 20 20 ec 51  20 20 20 72 32 2c 20 72  |      .Q   r2, r|
0000d270  34 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4               |
0000d280  20 20 20 3b 20 43 6f 70  79 20 75 6e 72 65 76 65  |   ; Copy unreve|
0000d290  72 73 65 64 20 63 6f 6c  75 6d 6e 0d 24 c2 3f 20  |rsed column.$.? |
0000d2a0  20 20 20 20 20 20 20 4d  4f 56 4e 45 20 20 20 72  |       MOVNE   r|
0000d2b0  31 2c 20 72 34 20 20 20  20 20 20 20 20 20 20 20  |1, r4           |
0000d2c0  20 20 20 20 20 20 20 3b  20 43 6f 70 79 20 72 65  |       ; Copy re|
0000d2d0  76 65 72 73 65 64 20 72  6f 77 0d 24 cc 42 20 20  |versed row.$.B  |
0000d2e0  20 20 20 20 20 20 4d 4f  56 4e 45 20 20 20 72 32  |      MOVNE   r2|
0000d2f0  2c 20 72 33 20 20 20 20  20 20 20 20 20 20 20 20  |, r3            |
0000d300  20 20 20 20 20 20 3b 20  43 6f 70 79 20 72 65 76  |      ; Copy rev|
0000d310  65 72 73 65 64 20 63 6f  6c 75 6d 6e 0d 24 d6 42  |ersed column.$.B|
0000d320  20 20 20 20 20 20 20 20  54 53 54 20 20 20 20 20  |        TST     |
0000d330  72 35 2c 20 23 32 20 20  20 20 20 20 20 20 20 20  |r5, #2          |
0000d340  20 20 20 20 20 20 20 20  3b 20 48 61 73 20 72 6f  |        ; Has ro|
0000d350  77 20 62 65 65 6e 20 6e  65 67 61 74 65 64 0d 24  |w been negated.$|
0000d360  e0 44 20 20 20 20 20 20  20 20 52 53 42 4e 45 20  |.D        RSBNE |
0000d370  20 20 72 31 2c 20 72 31  2c 20 23 30 20 20 20 20  |  r1, r1, #0    |
0000d380  20 20 20 20 20 20 20 20  20 20 3b 20 4e 65 67 61  |          ; Nega|
0000d390  74 65 20 72 6f 77 20 69  66 20 72 65 71 75 69 72  |te row if requir|
0000d3a0  65 64 0d 24 ea 45 20 20  20 20 20 20 20 20 54 53  |ed.$.E        TS|
0000d3b0  54 20 20 20 20 20 72 35  2c 20 23 34 20 20 20 20  |T     r5, #4    |
0000d3c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000d3d0  48 61 73 20 63 6f 6c 75  6d 6e 20 62 65 65 6e 20  |Has column been |
0000d3e0  6e 65 67 61 74 65 64 0d  24 f4 47 20 20 20 20 20  |negated.$.G     |
0000d3f0  20 20 20 52 53 42 4e 45  20 20 20 72 32 2c 20 72  |   RSBNE   r2, r|
0000d400  32 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |2, #0           |
0000d410  20 20 20 3b 20 4e 65 67  61 74 65 20 63 6f 6c 75  |   ; Negate colu|
0000d420  6d 6e 20 69 66 20 72 65  71 75 69 72 65 64 0d 24  |mn if required.$|
0000d430  fe 3c 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |.<        BL    |
0000d440  20 20 70 6c 6f 74 5f 70  6f 69 6e 74 20 20 20 20  |  plot_point    |
0000d450  20 20 20 20 20 20 20 20  20 20 3b 20 50 6c 6f 74  |          ; Plot|
0000d460  20 74 68 65 20 70 6f 69  6e 74 0d 25 08 44 20 20  | the point.%.D  |
0000d470  20 20 20 20 20 20 4c 44  4d 46 44 20 20 20 72 31  |      LDMFD   r1|
0000d480  33 21 2c 20 7b 72 31 2d  72 32 2c 20 70 63 7d 20  |3!, {r1-r2, pc} |
0000d490  20 20 20 20 20 20 3b 20  52 65 74 75 72 6e 20 66  |      ; Return f|
0000d4a0  72 6f 6d 20 73 75 62 72  6f 75 74 69 6e 65 0d 25  |rom subroutine.%|
0000d4b0  12 04 0d 25 1c 52 20 20  20 20 20 20 20 20 3b 20  |...%.R        ; |
0000d4c0  50 6c 6f 74 20 61 20 63  6c 6f 73 65 64 20 70 6f  |Plot a closed po|
0000d4d0  6c 79 6c 69 6e 65 20 69  6e 20 63 6f 6c 6f 75 72  |lyline in colour|
0000d4e0  20 72 30 20 75 73 69 6e  67 20 72 31 20 76 65 72  | r0 using r1 ver|
0000d4f0  74 69 63 65 73 20 73 74  61 72 74 69 6e 67 20 61  |tices starting a|
0000d500  74 20 72 32 0d 25 26 13  2e 70 6c 6f 74 5f 70 6f  |t r2.%&..plot_po|
0000d510  6c 79 5f 6c 69 6e 65 0d  25 30 3d 20 20 20 20 20  |ly_line.%0=     |
0000d520  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000d530  20 7b 72 30 2d 72 37 2c  20 72 31 34 7d 20 20 20  | {r0-r7, r14}   |
0000d540  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000d550  74 65 72 73 0d 25 3a 4b  20 20 20 20 20 20 20 20  |ters.%:K        |
0000d560  4d 4f 56 20 20 20 20 20  72 35 2c 20 72 32 20 20  |MOV     r5, r2  |
0000d570  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000d580  3b 20 50 6f 69 6e 74 65  72 20 74 6f 20 74 68 65  |; Pointer to the|
0000d590  20 63 75 72 72 65 6e 74  20 76 65 72 74 65 78 0d  | current vertex.|
0000d5a0  25 44 50 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |%DP        MOV  |
0000d5b0  20 20 20 72 36 2c 20 72  32 20 20 20 20 20 20 20  |   r6, r2       |
0000d5c0  20 20 20 20 20 20 20 20  20 20 20 3b 20 4b 65 65  |           ; Kee|
0000d5d0  70 20 61 20 70 6f 69 6e  74 65 72 20 74 6f 20 74  |p a pointer to t|
0000d5e0  68 65 20 66 69 72 73 74  20 76 65 72 74 65 78 0d  |he first vertex.|
0000d5f0  25 4e 45 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |%NE        MOV  |
0000d600  20 20 20 72 37 2c 20 72  31 20 20 20 20 20 20 20  |   r7, r1       |
0000d610  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 70  |           ; Cop|
0000d620  79 20 6e 75 6d 62 65 72  20 6f 66 20 73 65 67 6d  |y number of segm|
0000d630  65 6e 74 73 0d 25 58 18  2e 70 6c 6f 74 5f 70 6f  |ents.%X..plot_po|
0000d640  6c 79 5f 6c 69 6e 65 5f  6c 6f 6f 70 0d 25 62 4a  |ly_line_loop.%bJ|
0000d650  20 20 20 20 20 20 20 20  53 55 42 53 20 20 20 20  |        SUBS    |
0000d660  72 37 2c 20 72 37 2c 20  23 31 20 20 20 20 20 20  |r7, r7, #1      |
0000d670  20 20 20 20 20 20 20 20  3b 20 44 65 63 72 65 6d  |        ; Decrem|
0000d680  65 6e 74 20 72 65 6d 61  69 6e 69 6e 67 20 73 65  |ent remaining se|
0000d690  67 6d 65 6e 74 73 0d 25  6c 52 20 20 20 20 20 20  |gments.%lR      |
0000d6a0  20 20 4c 44 4d 4d 49 46  44 20 72 31 33 21 2c 20  |  LDMMIFD r13!, |
0000d6b0  7b 72 30 2d 72 37 2c 20  70 63 7d 20 20 20 20 20  |{r0-r7, pc}     |
0000d6c0  20 20 3b 20 52 65 74 75  72 6e 20 66 72 6f 6d 20  |  ; Return from |
0000d6d0  73 75 62 72 6f 75 74 69  6e 65 20 77 68 65 6e 20  |subroutine when |
0000d6e0  66 69 6e 69 73 68 65 64  0d 25 76 49 20 20 20 20  |finished.%vI    |
0000d6f0  20 20 20 20 4c 44 4d 49  41 20 20 20 72 35 21 2c  |    LDMIA   r5!,|
0000d700  20 7b 72 31 2d 72 32 7d  20 20 20 20 20 20 20 20  | {r1-r2}        |
0000d710  20 20 20 20 3b 20 52 65  61 64 20 6c 69 6e 65 20  |    ; Read line |
0000d720  73 74 61 72 74 20 63 6f  6f 72 64 69 6e 61 74 65  |start coordinate|
0000d730  73 0d 25 80 4f 20 20 20  20 20 20 20 20 ec 51 20  |s.%.O        .Q |
0000d740  20 20 72 35 2c 20 72 36  20 20 20 20 20 20 20 20  |  r5, r6        |
0000d750  20 20 20 20 20 20 20 20  20 20 3b 20 57 72 61 70  |          ; Wrap|
0000d760  20 61 72 6f 75 6e 64 20  74 6f 20 74 68 65 20 73  | around to the s|
0000d770  74 61 72 74 20 66 6f 72  20 74 68 65 20 65 6e 64  |tart for the end|
0000d780  0d 25 8a 47 20 20 20 20  20 20 20 20 4c 44 4d 49  |.%.G        LDMI|
0000d790  41 20 20 20 72 35 2c 20  7b 72 33 2d 72 34 7d 20  |A   r5, {r3-r4} |
0000d7a0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
0000d7b0  61 64 20 6c 69 6e 65 20  65 6e 64 20 63 6f 6f 72  |ad line end coor|
0000d7c0  64 69 6e 61 74 65 73 0d  25 94 3c 20 20 20 20 20  |dinates.%.<     |
0000d7d0  20 20 20 42 4c 20 20 20  20 20 20 70 6c 6f 74 5f  |   BL      plot_|
0000d7e0  6c 69 6e 65 20 20 20 20  20 20 20 20 20 20 20 20  |line            |
0000d7f0  20 20 20 3b 20 50 6c 6f  74 20 74 68 69 73 20 6c  |   ; Plot this l|
0000d800  69 6e 65 0d 25 9e 4c 20  20 20 20 20 20 20 20 42  |ine.%.L        B|
0000d810  20 20 20 20 20 20 20 70  6c 6f 74 5f 70 6f 6c 79  |       plot_poly|
0000d820  5f 6c 69 6e 65 5f 6c 6f  6f 70 20 20 20 20 20 3b  |_line_loop     ;|
0000d830  20 4c 6f 6f 70 20 66 6f  72 20 74 68 65 20 6e 65  | Loop for the ne|
0000d840  78 74 20 6c 69 6e 65 20  73 65 67 6d 65 6e 74 0d  |xt line segment.|
0000d850  25 a8 04 0d 25 b2 4a 20  20 20 20 20 20 20 20 3b  |%...%.J        ;|
0000d860  20 46 69 6c 6c 20 61 20  70 6f 6c 79 67 6f 6e 20  | Fill a polygon |
0000d870  69 6e 20 63 6f 6c 6f 75  72 20 72 30 20 75 73 69  |in colour r0 usi|
0000d880  6e 67 20 72 31 20 76 65  72 74 69 63 65 73 20 73  |ng r1 vertices s|
0000d890  74 61 72 74 69 6e 67 20  61 74 20 72 32 0d 25 bc  |tarting at r2.%.|
0000d8a0  13 2e 70 6c 6f 74 5f 70  6f 6c 79 5f 66 69 6c 6c  |..plot_poly_fill|
0000d8b0  0d 25 c6 3d 20 20 20 20  20 20 20 20 53 54 4d 46  |.%.=        STMF|
0000d8c0  44 20 20 20 72 31 33 21  2c 20 7b 72 30 2d 72 36  |D   r13!, {r0-r6|
0000d8d0  2c 20 72 31 34 7d 20 20  20 20 20 20 3b 20 53 74  |, r14}      ; St|
0000d8e0  61 63 6b 20 72 65 67 69  73 74 65 72 73 0d 25 d0  |ack registers.%.|
0000d8f0  4c 20 20 20 20 20 20 20  20 53 55 42 20 20 20 20  |L        SUB    |
0000d900  20 72 31 33 2c 20 72 31  33 2c 20 72 31 2c 20 4c  | r13, r13, r1, L|
0000d910  53 4c 23 34 20 20 20 20  20 3b 20 52 65 73 65 72  |SL#4     ; Reser|
0000d920  76 65 20 73 70 61 63 65  20 66 6f 72 20 65 64 67  |ve space for edg|
0000d930  65 20 64 65 74 61 69 6c  73 0d 25 da 47 20 20 20  |e details.%.G   |
0000d940  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 33 2c  |     MOV     r3,|
0000d950  20 72 31 33 20 20 20 20  20 20 20 20 20 20 20 20  | r13            |
0000d960  20 20 20 20 20 3b 20 43  6f 70 79 20 65 64 67 65  |     ; Copy edge|
0000d970  20 64 65 74 61 69 6c 73  20 70 6f 69 6e 74 65 72  | details pointer|
0000d980  0d 25 e4 4d 20 20 20 20  20 20 20 20 53 55 42 20  |.%.M        SUB |
0000d990  20 20 20 20 72 31 33 2c  20 72 31 33 2c 20 72 31  |    r13, r13, r1|
0000d9a0  2c 20 4c 53 4c 23 32 20  20 20 20 20 3b 20 52 65  |, LSL#2     ; Re|
0000d9b0  73 65 72 76 65 20 73 70  61 63 65 20 66 6f 72 20  |serve space for |
0000d9c0  69 6e 74 65 72 73 65 63  74 69 6f 6e 73 0d 25 ee  |intersections.%.|
0000d9d0  48 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |H        MOV    |
0000d9e0  20 72 34 2c 20 72 31 33  20 20 20 20 20 20 20 20  | r4, r13        |
0000d9f0  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
0000da00  69 6e 74 65 72 73 65 63  74 69 6f 6e 73 20 70 6f  |intersections po|
0000da10  69 6e 74 65 72 0d 25 f8  49 20 20 20 20 20 20 20  |inter.%.I       |
0000da20  20 42 4c 20 20 20 20 20  20 70 6c 6f 74 5f 70 6f  | BL      plot_po|
0000da30  6c 79 5f 66 69 6c 6c 5f  70 72 65 70 72 6f 63 65  |ly_fill_preproce|
0000da40  73 73 3b 20 43 6f 6e 73  74 72 75 63 74 20 74 68  |ss; Construct th|
0000da50  65 20 65 64 67 65 20 64  65 74 61 69 6c 73 0d 26  |e edge details.&|
0000da60  02 18 2e 70 6c 6f 74 5f  70 6f 6c 79 5f 66 69 6c  |...plot_poly_fil|
0000da70  6c 5f 6c 6f 6f 70 0d 26  0c 48 20 20 20 20 20 20  |l_loop.&.H      |
0000da80  20 20 4d 4f 56 20 20 20  20 20 72 32 2c 20 23 30  |  MOV     r2, #0|
0000da90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000daa0  20 20 3b 20 4e 6f 20 69  6e 74 65 72 73 65 63 74  |  ; No intersect|
0000dab0  69 6f 6e 73 20 66 6f 75  6e 64 20 79 65 74 0d 26  |ions found yet.&|
0000dac0  16 49 20 20 20 20 20 20  20 20 42 4c 20 20 20 20  |.I        BL    |
0000dad0  20 20 70 6c 6f 74 5f 70  6f 6c 79 5f 66 69 6c 6c  |  plot_poly_fill|
0000dae0  5f 69 6e 74 65 72 20 20  20 20 3b 20 46 69 6e 64  |_inter    ; Find|
0000daf0  20 61 6e 79 20 69 6e 74  65 72 73 65 63 74 69 6e  | any intersectin|
0000db00  67 20 65 64 67 65 73 0d  26 20 42 20 20 20 20 20  |g edges.& B     |
0000db10  20 20 20 42 4c 20 20 20  20 20 20 70 6c 6f 74 5f  |   BL      plot_|
0000db20  70 6f 6c 79 5f 66 69 6c  6c 5f 70 6c 6f 74 20 20  |poly_fill_plot  |
0000db30  20 20 20 3b 20 50 65 72  66 6f 72 6d 20 74 68 65  |   ; Perform the|
0000db40  20 70 6c 6f 74 74 69 6e  67 0d 26 2a 45 20 20 20  | plotting.&*E   |
0000db50  20 20 20 20 20 41 44 44  20 20 20 20 20 72 35 2c  |     ADD     r5,|
0000db60  20 72 35 2c 20 23 31 20  20 20 20 20 20 20 20 20  | r5, #1         |
0000db70  20 20 20 20 20 3b 20 41  64 76 61 6e 63 65 20 74  |     ; Advance t|
0000db80  6f 20 74 68 65 20 6e 65  78 74 20 72 6f 77 0d 26  |o the next row.&|
0000db90  34 4b 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |4K        CMP   |
0000dba0  20 20 72 35 2c 20 72 36  20 20 20 20 20 20 20 20  |  r5, r6        |
0000dbb0  20 20 20 20 20 20 20 20  20 20 3b 20 48 61 73 20  |          ; Has |
0000dbc0  74 68 65 20 6c 61 73 74  20 72 6f 77 20 62 65 65  |the last row bee|
0000dbd0  6e 20 72 65 61 63 68 65  64 0d 26 3e 45 20 20 20  |n reached.&>E   |
0000dbe0  20 20 20 20 20 42 4c 45  20 20 20 20 20 70 6c 6f  |     BLE     plo|
0000dbf0  74 5f 70 6f 6c 79 5f 66  69 6c 6c 5f 6c 6f 6f 70  |t_poly_fill_loop|
0000dc00  20 20 20 20 20 3b 20 4c  6f 6f 70 20 75 6e 74 69  |     ; Loop unti|
0000dc10  6c 20 61 6c 6c 20 66 69  6e 69 73 68 65 64 0d 26  |l all finished.&|
0000dc20  48 18 2e 70 6c 6f 74 5f  70 6f 6c 79 5f 66 69 6c  |H..plot_poly_fil|
0000dc30  6c 5f 64 6f 6e 65 0d 26  52 4d 20 20 20 20 20 20  |l_done.&RM      |
0000dc40  20 20 41 44 44 20 20 20  20 20 72 31 33 2c 20 72  |  ADD     r13, r|
0000dc50  31 33 2c 20 72 31 2c 20  4c 53 4c 23 32 20 20 20  |13, r1, LSL#2   |
0000dc60  20 20 3b 20 52 65 6c 65  61 73 65 20 74 68 65 20  |  ; Release the |
0000dc70  69 6e 74 65 72 73 65 63  74 69 6f 6e 73 20 73 70  |intersections sp|
0000dc80  61 63 65 0d 26 5c 4c 20  20 20 20 20 20 20 20 41  |ace.&\L        A|
0000dc90  44 44 20 20 20 20 20 72  31 33 2c 20 72 31 33 2c  |DD     r13, r13,|
0000dca0  20 72 31 2c 20 4c 53 4c  23 34 20 20 20 20 20 3b  | r1, LSL#4     ;|
0000dcb0  20 52 65 6c 65 61 73 65  20 74 68 65 20 65 64 67  | Release the edg|
0000dcc0  65 20 64 65 74 61 69 6c  73 20 73 70 61 63 65 0d  |e details space.|
0000dcd0  26 66 44 20 20 20 20 20  20 20 20 4c 44 4d 46 44  |&fD        LDMFD|
0000dce0  20 20 20 72 31 33 21 2c  20 7b 72 30 2d 72 36 2c  |   r13!, {r0-r6,|
0000dcf0  20 70 63 7d 20 20 20 20  20 20 20 3b 20 52 65 74  | pc}       ; Ret|
0000dd00  75 72 6e 20 66 72 6f 6d  20 73 75 62 72 6f 75 74  |urn from subrout|
0000dd10  69 6e 65 0d 26 70 1e 2e  70 6c 6f 74 5f 70 6f 6c  |ine.&p..plot_pol|
0000dd20  79 5f 66 69 6c 6c 5f 70  72 65 70 72 6f 63 65 73  |y_fill_preproces|
0000dd30  73 0d 26 7a 3f 20 20 20  20 20 20 20 20 53 54 4d  |s.&z?        STM|
0000dd40  46 44 20 20 20 72 31 33  21 2c 20 7b 72 30 2d 72  |FD   r13!, {r0-r|
0000dd50  34 2c 20 72 37 2d 72 31  30 2c 20 72 31 34 7d 3b  |4, r7-r10, r14};|
0000dd60  20 53 74 61 63 6b 20 72  65 67 69 73 74 65 72 73  | Stack registers|
0000dd70  0d 26 84 49 20 20 20 20  20 20 20 20 4c 44 52 20  |.&.I        LDR |
0000dd80  20 20 20 20 72 35 2c 20  5b 72 32 5d 20 20 20 20  |    r5, [r2]    |
0000dd90  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 49 6e  |            ; In|
0000dda0  69 74 69 61 6c 69 73 65  20 66 69 72 73 74 20 72  |itialise first r|
0000ddb0  6f 77 20 6e 75 6d 62 65  72 0d 26 8e 48 20 20 20  |ow number.&.H   |
0000ddc0  20 20 20 20 20 4c 44 52  20 20 20 20 20 72 36 2c  |     LDR     r6,|
0000ddd0  20 5b 72 32 5d 20 20 20  20 20 20 20 20 20 20 20  | [r2]           |
0000dde0  20 20 20 20 20 3b 20 49  6e 69 74 69 61 6c 69 73  |     ; Initialis|
0000ddf0  65 20 6c 61 73 74 20 72  6f 77 20 6e 75 6d 62 65  |e last row numbe|
0000de00  72 0d 26 98 41 20 20 20  20 20 20 20 20 4d 4f 56  |r.&.A        MOV|
0000de10  20 20 20 20 20 72 30 2c  20 72 32 20 20 20 20 20  |     r0, r2     |
0000de20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000de30  6f 70 79 20 76 65 72 74  65 78 20 70 6f 69 6e 74  |opy vertex point|
0000de40  65 72 0d 26 a2 23 2e 70  6c 6f 74 5f 70 6f 6c 79  |er.&.#.plot_poly|
0000de50  5f 66 69 6c 6c 5f 70 72  65 70 72 6f 63 65 73 73  |_fill_preprocess|
0000de60  5f 6c 6f 6f 70 0d 26 ac  47 20 20 20 20 20 20 20  |_loop.&.G       |
0000de70  20 53 55 42 53 20 20 20  20 72 31 2c 20 72 31 2c  | SUBS    r1, r1,|
0000de80  20 23 31 20 20 20 20 20  20 20 20 20 20 20 20 20  | #1             |
0000de90  20 3b 20 44 65 63 72 65  6d 65 6e 74 20 6e 75 6d  | ; Decrement num|
0000dea0  62 65 72 20 6f 66 20 65  64 67 65 73 0d 26 b6 53  |ber of edges.&.S|
0000deb0  20 20 20 20 20 20 20 20  4c 44 4d 4d 49 46 44 20  |        LDMMIFD |
0000dec0  72 31 33 21 2c 20 7b 72  30 2d 72 34 2c 20 72 37  |r13!, {r0-r4, r7|
0000ded0  2d 72 31 30 2c 20 70 63  7d 3b 20 52 65 74 75 72  |-r10, pc}; Retur|
0000dee0  6e 20 66 72 6f 6d 20 73  75 62 72 6f 75 74 69 6e  |n from subroutin|
0000def0  65 20 77 68 65 6e 20 66  69 6e 69 73 68 65 64 0d  |e when finished.|
0000df00  26 c0 49 20 20 20 20 20  20 20 20 4c 44 4d 49 41  |&.I        LDMIA|
0000df10  20 20 20 72 30 21 2c 20  7b 72 37 2d 72 38 7d 20  |   r0!, {r7-r8} |
0000df20  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
0000df30  64 20 6c 69 6e 65 20 73  74 61 72 74 20 63 6f 6f  |d line start coo|
0000df40  72 64 69 6e 61 74 65 73  0d 26 ca 4f 20 20 20 20  |rdinates.&.O    |
0000df50  20 20 20 20 ec 51 20 20  20 72 30 2c 20 72 32 20  |    .Q   r0, r2 |
0000df60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000df70  20 3b 20 57 72 61 70 20  61 72 6f 75 6e 64 20 74  | ; Wrap around t|
0000df80  6f 20 74 68 65 20 73 74  61 72 74 20 66 6f 72 20  |o the start for |
0000df90  74 68 65 20 65 6e 64 0d  26 d4 47 20 20 20 20 20  |the end.&.G     |
0000dfa0  20 20 20 4c 44 4d 49 41  20 20 20 72 30 2c 20 7b  |   LDMIA   r0, {|
0000dfb0  72 39 2d 72 31 30 7d 20  20 20 20 20 20 20 20 20  |r9-r10}         |
0000dfc0  20 20 20 3b 20 52 65 61  64 20 6c 69 6e 65 20 65  |   ; Read line e|
0000dfd0  6e 64 20 63 6f 6f 72 64  69 6e 61 74 65 73 0d 26  |nd coordinates.&|
0000dfe0  de 4f 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |.O        CMP   |
0000dff0  20 20 72 37 2c 20 72 39  20 20 20 20 20 20 20 20  |  r7, r9        |
0000e000  20 20 20 20 20 20 20 20  20 20 3b 20 44 6f 20 74  |          ; Do t|
0000e010  68 65 20 63 6f 6f 72 64  69 6e 61 74 65 73 20 6e  |he coordinates n|
0000e020  65 65 64 20 72 65 76 65  72 73 69 6e 67 0d 26 e8  |eed reversing.&.|
0000e030  49 20 20 20 20 20 20 20  20 4d 4f 56 47 54 20 20  |I        MOVGT  |
0000e040  20 72 34 2c 20 72 37 20  20 20 20 20 20 20 20 20  | r4, r7         |
0000e050  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
0000e060  66 69 72 73 74 20 72 6f  77 20 74 6f 20 74 65 6d  |first row to tem|
0000e070  70 6f 72 61 72 79 0d 26  f2 3e 20 20 20 20 20 20  |porary.&.>      |
0000e080  20 20 4d 4f 56 47 54 20  20 20 72 37 2c 20 72 39  |  MOVGT   r7, r9|
0000e090  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e0a0  20 20 3b 20 53 77 61 70  20 72 6f 77 20 6e 75 6d  |  ; Swap row num|
0000e0b0  62 65 72 73 0d 26 fc 40  20 20 20 20 20 20 20 20  |bers.&.@        |
0000e0c0  4d 4f 56 47 54 20 20 20  72 39 2c 20 72 34 20 20  |MOVGT   r9, r4  |
0000e0d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e0e0  3b 20 53 65 74 20 65 6e  64 20 72 6f 77 20 6e 75  |; Set end row nu|
0000e0f0  6d 62 65 72 0d 27 06 4c  20 20 20 20 20 20 20 20  |mber.'.L        |
0000e100  4d 4f 56 47 54 20 20 20  72 34 2c 20 72 38 20 20  |MOVGT   r4, r8  |
0000e110  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e120  3b 20 43 6f 70 79 20 66  69 72 73 74 20 63 6f 6c  |; Copy first col|
0000e130  75 6d 6e 20 74 6f 20 74  65 6d 70 6f 72 61 72 79  |umn to temporary|
0000e140  0d 27 10 41 20 20 20 20  20 20 20 20 4d 4f 56 47  |.'.A        MOVG|
0000e150  54 20 20 20 72 38 2c 20  72 31 30 20 20 20 20 20  |T   r8, r10     |
0000e160  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 77  |            ; Sw|
0000e170  61 70 20 63 6f 6c 75 6d  6e 20 6e 75 6d 62 65 72  |ap column number|
0000e180  73 0d 27 1a 43 20 20 20  20 20 20 20 20 4d 4f 56  |s.'.C        MOV|
0000e190  47 54 20 20 20 72 31 30  2c 20 72 34 20 20 20 20  |GT   r10, r4    |
0000e1a0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |             ; S|
0000e1b0  65 74 20 65 6e 64 20 63  6f 6c 75 6d 6e 20 6e 75  |et end column nu|
0000e1c0  6d 62 65 72 0d 27 24 44  20 20 20 20 20 20 20 20  |mber.'$D        |
0000e1d0  43 4d 50 20 20 20 20 20  72 37 2c 20 72 35 20 20  |CMP     r7, r5  |
0000e1e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e1f0  3b 20 43 6f 6d 70 61 72  65 20 77 69 74 68 20 66  |; Compare with f|
0000e200  69 72 73 74 20 72 6f 77  0d 27 2e 51 20 20 20 20  |irst row.'.Q    |
0000e210  20 20 20 20 4d 4f 56 4c  54 20 20 20 72 35 2c 20  |    MOVLT   r5, |
0000e220  72 37 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r7              |
0000e230  20 20 20 20 3b 20 55 70  64 61 74 65 20 66 69 72  |    ; Update fir|
0000e240  73 74 20 72 6f 77 20 6e  75 6d 62 65 72 20 69 73  |st row number is|
0000e250  20 72 65 71 75 69 72 65  64 0d 27 38 43 20 20 20  | required.'8C   |
0000e260  20 20 20 20 20 43 4d 50  20 20 20 20 20 72 39 2c  |     CMP     r9,|
0000e270  20 72 36 20 20 20 20 20  20 20 20 20 20 20 20 20  | r6             |
0000e280  20 20 20 20 20 3b 20 43  6f 6d 70 61 72 65 20 77  |     ; Compare w|
0000e290  69 74 68 20 6c 61 73 74  20 72 6f 77 0d 27 42 50  |ith last row.'BP|
0000e2a0  20 20 20 20 20 20 20 20  4d 4f 56 47 54 20 20 20  |        MOVGT   |
0000e2b0  72 36 2c 20 72 39 20 20  20 20 20 20 20 20 20 20  |r6, r9          |
0000e2c0  20 20 20 20 20 20 20 20  3b 20 55 70 64 61 74 65  |        ; Update|
0000e2d0  20 6c 61 73 74 20 72 6f  77 20 6e 75 6d 62 65 72  | last row number|
0000e2e0  20 69 73 20 72 65 71 75  69 72 65 64 0d 27 4c 40  | is required.'L@|
0000e2f0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000e300  72 38 2c 20 72 38 2c 20  41 53 4c 23 31 36 20 20  |r8, r8, ASL#16  |
0000e310  20 20 20 20 20 20 20 20  3b 20 53 63 61 6c 65 20  |        ; Scale |
0000e320  73 74 61 72 74 20 63 6f  6c 75 6d 6e 0d 27 56 3e  |start column.'V>|
0000e330  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000e340  72 31 30 2c 20 72 31 30  2c 20 41 53 4c 23 31 36  |r10, r10, ASL#16|
0000e350  20 20 20 20 20 20 20 20  3b 20 53 63 61 6c 65 20  |        ; Scale |
0000e360  65 6e 64 20 63 6f 6c 75  6d 6e 0d 27 60 44 20 20  |end column.'`D  |
0000e370  20 20 20 20 20 20 53 54  52 20 20 20 20 20 72 37  |      STR     r7|
0000e380  2c 20 5b 72 33 5d 20 20  20 20 20 20 20 20 20 20  |, [r3]          |
0000e390  20 20 20 20 20 20 3b 20  53 74 6f 72 65 20 73 74  |      ; Store st|
0000e3a0  61 72 74 20 72 6f 77 20  6e 75 6d 62 65 72 0d 27  |art row number.'|
0000e3b0  6a 42 20 20 20 20 20 20  20 20 53 54 52 20 20 20  |jB        STR   |
0000e3c0  20 20 72 39 2c 20 5b 72  33 2c 20 23 34 5d 20 20  |  r9, [r3, #4]  |
0000e3d0  20 20 20 20 20 20 20 20  20 20 3b 20 53 74 6f 72  |          ; Stor|
0000e3e0  65 20 65 6e 64 20 72 6f  77 20 6e 75 6d 62 65 72  |e end row number|
0000e3f0  0d 27 74 47 20 20 20 20  20 20 20 20 53 54 52 20  |.'tG        STR |
0000e400  20 20 20 20 72 38 2c 20  5b 72 33 2c 20 23 38 5d  |    r8, [r3, #8]|
0000e410  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 74  |            ; St|
0000e420  6f 72 65 20 73 74 61 72  74 20 63 6f 6c 75 6d 6e  |ore start column|
0000e430  20 6e 75 6d 62 65 72 0d  27 7e 3d 20 20 20 20 20  | number.'~=     |
0000e440  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
0000e450  20 7b 72 30 2d 72 31 7d  20 20 20 20 20 20 20 20  | {r0-r1}        |
0000e460  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000e470  74 65 72 73 0d 27 88 44  20 20 20 20 20 20 20 20  |ters.'.D        |
0000e480  53 55 42 20 20 20 20 20  72 30 2c 20 72 31 30 2c  |SUB     r0, r10,|
0000e490  20 72 38 20 20 20 20 20  20 20 20 20 20 20 20 20  | r8             |
0000e4a0  3b 20 52 65 71 75 69 72  65 64 20 63 6f 6c 75 6d  |; Required colum|
0000e4b0  6e 20 63 68 61 6e 67 65  0d 27 92 41 20 20 20 20  |n change.'.A    |
0000e4c0  20 20 20 20 53 55 42 53  20 20 20 20 72 31 2c 20  |    SUBS    r1, |
0000e4d0  72 39 2c 20 72 37 20 20  20 20 20 20 20 20 20 20  |r9, r7          |
0000e4e0  20 20 20 20 3b 20 52 65  71 75 69 72 65 64 20 72  |    ; Required r|
0000e4f0  6f 77 20 63 68 61 6e 67  65 0d 27 9c 40 20 20 20  |ow change.'.@   |
0000e500  20 20 20 20 20 ec 51 20  20 20 72 30 2c 20 23 30  |     .Q   r0, #0|
0000e510  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e520  20 20 3b 20 46 61 6b 65  20 68 6f 72 69 7a 6f 6e  |  ; Fake horizon|
0000e530  74 61 6c 20 6c 69 6e 65  73 0d 27 a6 48 20 20 20  |tal lines.'.H   |
0000e540  20 20 20 20 20 42 4c 4e  45 20 20 20 20 64 69 76  |     BLNE    div|
0000e550  69 64 65 20 20 20 20 20  20 20 20 20 20 20 20 20  |ide             |
0000e560  20 20 20 20 20 3b 20 43  61 6c 63 75 6c 61 74 65  |     ; Calculate|
0000e570  20 63 6f 6c 75 6d 6e 20  69 6e 63 72 65 6d 65 6e  | column incremen|
0000e580  74 0d 27 b0 47 20 20 20  20 20 20 20 20 53 54 52  |t.'.G        STR|
0000e590  20 20 20 20 20 72 30 2c  20 5b 72 33 2c 20 23 31  |     r0, [r3, #1|
0000e5a0  32 5d 20 20 20 20 20 20  20 20 20 20 20 3b 20 53  |2]           ; S|
0000e5b0  74 6f 72 65 20 73 74 61  72 74 20 63 6f 6c 75 6d  |tore start colum|
0000e5c0  6e 20 6e 75 6d 62 65 72  0d 27 ba 3f 20 20 20 20  |n number.'.?    |
0000e5d0  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
0000e5e0  2c 20 7b 72 30 2d 72 31  7d 20 20 20 20 20 20 20  |, {r0-r1}       |
0000e5f0  20 20 20 20 3b 20 52 65  73 74 6f 72 65 20 72 65  |    ; Restore re|
0000e600  67 69 73 74 65 72 73 0d  27 c4 4a 20 20 20 20 20  |gisters.'.J     |
0000e610  20 20 20 41 44 44 20 20  20 20 20 72 33 2c 20 72  |   ADD     r3, r|
0000e620  33 2c 20 23 31 36 20 20  20 20 20 20 20 20 20 20  |3, #16          |
0000e630  20 20 20 3b 20 41 64 76  61 6e 63 65 20 65 64 67  |   ; Advance edg|
0000e640  65 20 64 65 74 61 69 6c  73 20 70 6f 69 6e 74 65  |e details pointe|
0000e650  72 0d 27 ce 4a 20 20 20  20 20 20 20 20 42 20 20  |r.'.J        B  |
0000e660  20 20 20 20 20 70 6c 6f  74 5f 70 6f 6c 79 5f 66  |     plot_poly_f|
0000e670  69 6c 6c 5f 70 72 65 70  72 6f 63 65 73 73 5f 6c  |ill_preprocess_l|
0000e680  6f 6f 70 3b 20 4c 6f 6f  70 20 66 6f 72 20 74 68  |oop; Loop for th|
0000e690  65 20 6e 65 78 74 20 65  64 67 65 0d 27 d8 19 2e  |e next edge.'...|
0000e6a0  70 6c 6f 74 5f 70 6f 6c  79 5f 66 69 6c 6c 5f 69  |plot_poly_fill_i|
0000e6b0  6e 74 65 72 0d 27 e2 3e  20 20 20 20 20 20 20 20  |nter.'.>        |
0000e6c0  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
0000e6d0  30 2d 72 31 2c 20 72 33  2d 72 39 2c 20 72 31 34  |0-r1, r3-r9, r14|
0000e6e0  7d 3b 20 53 74 61 63 6b  20 72 65 67 69 73 74 65  |}; Stack registe|
0000e6f0  72 73 0d 27 ec 1e 2e 70  6c 6f 74 5f 70 6f 6c 79  |rs.'...plot_poly|
0000e700  5f 66 69 6c 6c 5f 69 6e  74 65 72 5f 6c 6f 6f 70  |_fill_inter_loop|
0000e710  0d 27 f6 47 20 20 20 20  20 20 20 20 53 55 42 53  |.'.G        SUBS|
0000e720  20 20 20 20 72 31 2c 20  72 31 2c 20 23 31 20 20  |    r1, r1, #1  |
0000e730  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 44 65  |            ; De|
0000e740  63 72 65 6d 65 6e 74 20  6e 75 6d 62 65 72 20 6f  |crement number o|
0000e750  66 20 65 64 67 65 73 0d  28 00 52 20 20 20 20 20  |f edges.(.R     |
0000e760  20 20 20 4c 44 4d 4d 49  46 44 20 72 31 33 21 2c  |   LDMMIFD r13!,|
0000e770  20 7b 72 30 2d 72 31 2c  20 72 33 2d 72 39 2c 20  | {r0-r1, r3-r9, |
0000e780  70 63 7d 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |pc}; Return from|
0000e790  20 73 75 62 72 6f 75 74  69 6e 65 20 77 68 65 6e  | subroutine when|
0000e7a0  20 66 69 6e 69 73 68 65  64 0d 28 0a 4c 20 20 20  | finished.(.L   |
0000e7b0  20 20 20 20 20 4c 44 4d  49 41 20 20 20 72 33 21  |     LDMIA   r3!|
0000e7c0  2c 20 7b 72 36 2d 72 39  7d 20 20 20 20 20 20 20  |, {r6-r9}       |
0000e7d0  20 20 20 20 20 3b 20 52  65 61 64 20 74 68 65 20  |     ; Read the |
0000e7e0  64 65 74 61 69 6c 73 20  66 6f 72 20 74 68 69 73  |details for this|
0000e7f0  20 65 64 67 65 0d 28 14  47 20 20 20 20 20 20 20  | edge.(.G       |
0000e800  20 43 4d 50 20 20 20 20  20 72 36 2c 20 72 35 20  | CMP     r6, r5 |
0000e810  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e820  20 3b 20 49 73 20 73 74  61 72 74 20 72 6f 77 20  | ; Is start row |
0000e830  65 61 72 6c 79 20 65 6e  6f 75 67 68 0d 28 1e 48  |early enough.(.H|
0000e840  20 20 20 20 20 20 20 20  42 47 54 20 20 20 20 20  |        BGT     |
0000e850  70 6c 6f 74 5f 70 6f 6c  79 5f 66 69 6c 6c 5f 69  |plot_poly_fill_i|
0000e860  6e 74 65 72 5f 6c 6f 6f  70 3b 20 4c 6f 6f 70 20  |nter_loop; Loop |
0000e870  66 6f 72 20 6e 65 78 74  20 65 64 67 65 20 69 66  |for next edge if|
0000e880  20 6e 6f 74 0d 28 28 44  20 20 20 20 20 20 20 20  | not.((D        |
0000e890  43 4d 50 20 20 20 20 20  72 37 2c 20 72 35 20 20  |CMP     r7, r5  |
0000e8a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000e8b0  3b 20 49 73 20 65 6e 64  20 72 6f 77 20 6c 61 74  |; Is end row lat|
0000e8c0  65 20 65 6e 6f 75 67 68  0d 28 32 48 20 20 20 20  |e enough.(2H    |
0000e8d0  20 20 20 20 42 4c 45 20  20 20 20 20 70 6c 6f 74  |    BLE     plot|
0000e8e0  5f 70 6f 6c 79 5f 66 69  6c 6c 5f 69 6e 74 65 72  |_poly_fill_inter|
0000e8f0  5f 6c 6f 6f 70 3b 20 4c  6f 6f 70 20 66 6f 72 20  |_loop; Loop for |
0000e900  6e 65 78 74 20 65 64 67  65 20 69 66 20 6e 6f 74  |next edge if not|
0000e910  0d 28 3c 4f 20 20 20 20  20 20 20 20 53 55 42 20  |.(<O        SUB |
0000e920  20 20 20 20 72 36 2c 20  72 35 2c 20 72 36 20 20  |    r6, r5, r6  |
0000e930  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 4e 75  |            ; Nu|
0000e940  6d 62 65 72 20 6f 66 20  72 6f 77 73 20 66 72 6f  |mber of rows fro|
0000e950  6d 20 73 74 61 72 74 20  6f 66 20 65 64 67 65 0d  |m start of edge.|
0000e960  28 46 48 20 20 20 20 20  20 20 20 4d 4c 41 20 20  |(FH        MLA  |
0000e970  20 20 20 72 38 2c 20 72  36 2c 20 72 39 2c 20 72  |   r8, r6, r9, r|
0000e980  38 20 20 20 20 20 20 20  20 20 20 3b 20 43 61 6c  |8          ; Cal|
0000e990  63 75 6c 61 74 65 20 69  6e 74 65 72 63 65 70 74  |culate intercept|
0000e9a0  20 63 6f 6c 75 6d 6e 0d  28 50 48 20 20 20 20 20  | column.(PH     |
0000e9b0  20 20 20 4d 4f 56 20 20  20 20 20 72 30 2c 20 72  |   MOV     r0, r|
0000e9c0  38 2c 20 41 53 52 23 31  36 20 20 20 20 20 20 20  |8, ASR#16       |
0000e9d0  20 20 20 3b 20 53 63 61  6c 65 20 74 68 65 20 69  |   ; Scale the i|
0000e9e0  6e 74 65 72 63 65 70 74  20 63 6f 6c 75 6d 6e 0d  |ntercept column.|
0000e9f0  28 5a 53 20 20 20 20 20  20 20 20 41 44 44 20 20  |(ZS        ADD  |
0000ea00  20 20 20 72 36 2c 20 72  34 2c 20 72 32 2c 20 4c  |   r6, r4, r2, L|
0000ea10  53 4c 23 32 20 20 20 20  20 20 20 3b 20 54 68 65  |SL#2       ; The|
0000ea20  20 6e 65 78 74 20 61 76  61 69 6c 61 62 6c 65 20  | next available |
0000ea30  69 6e 74 65 72 73 65 63  74 69 6f 6e 20 65 6e 74  |intersection ent|
0000ea40  72 79 0d 28 64 20 2e 70  6c 6f 74 5f 70 6f 6c 79  |ry.(d .plot_poly|
0000ea50  5f 66 69 6c 6c 5f 69 6e  74 65 72 5f 69 6e 73 65  |_fill_inter_inse|
0000ea60  72 74 0d 28 6e 4b 20 20  20 20 20 20 20 20 54 45  |rt.(nK        TE|
0000ea70  51 20 20 20 20 20 72 34  2c 20 72 36 20 20 20 20  |Q     r4, r6    |
0000ea80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000ea90  49 73 20 74 68 69 73 20  74 68 65 20 73 74 61 72  |Is this the star|
0000eaa0  74 20 6f 66 20 74 68 65  20 6c 69 73 74 0d 28 78  |t of the list.(x|
0000eab0  4d 20 20 20 20 20 20 20  20 42 45 51 20 20 20 20  |M        BEQ    |
0000eac0  20 70 6c 6f 74 5f 70 6f  6c 79 5f 66 69 6c 6c 5f  | plot_poly_fill_|
0000ead0  69 6e 74 65 72 5f 64 6f  6e 65 3b 20 45 78 69 74  |inter_done; Exit|
0000eae0  20 6c 6f 6f 70 20 69 66  20 74 68 65 20 73 74 61  | loop if the sta|
0000eaf0  72 74 20 72 65 61 63 68  65 64 0d 28 82 4c 20 20  |rt reached.(.L  |
0000eb00  20 20 20 20 20 20 4c 44  52 20 20 20 20 20 72 37  |      LDR     r7|
0000eb10  2c 20 5b 72 36 2c 20 23  2d 34 5d 20 20 20 20 20  |, [r6, #-4]     |
0000eb20  20 20 20 20 20 20 3b 20  52 65 61 64 20 74 68 65  |      ; Read the|
0000eb30  20 70 72 65 76 69 6f 75  73 20 69 6e 74 65 72 73  | previous inters|
0000eb40  65 63 74 69 6f 6e 0d 28  8c 50 20 20 20 20 20 20  |ection.(.P      |
0000eb50  20 20 43 4d 50 20 20 20  20 20 72 30 2c 20 72 37  |  CMP     r0, r7|
0000eb60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000eb70  20 20 3b 20 53 68 6f 75  6c 64 20 74 68 69 73 20  |  ; Should this |
0000eb80  69 6e 74 65 72 73 65 63  74 69 6f 6e 20 62 65 20  |intersection be |
0000eb90  65 61 6c 69 65 72 0d 28  96 4f 20 20 20 20 20 20  |ealier.(.O      |
0000eba0  20 20 53 54 52 4c 54 20  20 20 72 37 2c 20 5b 72  |  STRLT   r7, [r|
0000ebb0  36 5d 2c 20 23 2d 34 20  20 20 20 20 20 20 20 20  |6], #-4         |
0000ebc0  20 20 3b 20 53 68 75 66  66 6c 65 20 64 6f 77 6e  |  ; Shuffle down|
0000ebd0  20 74 6f 20 6e 65 78 74  20 69 6e 74 65 72 73 65  | to next interse|
0000ebe0  63 74 69 6f 6e 0d 28 a0  2f 20 20 20 20 20 20 20  |ction.(./       |
0000ebf0  20 42 4c 54 20 20 20 20  20 70 6c 6f 74 5f 70 6f  | BLT     plot_po|
0000ec00  6c 79 5f 66 69 6c 6c 5f  69 6e 74 65 72 5f 69 6e  |ly_fill_inter_in|
0000ec10  73 65 72 74 0d 28 aa 1e  2e 70 6c 6f 74 5f 70 6f  |sert.(...plot_po|
0000ec20  6c 79 5f 66 69 6c 6c 5f  69 6e 74 65 72 5f 64 6f  |ly_fill_inter_do|
0000ec30  6e 65 0d 28 b4 51 20 20  20 20 20 20 20 20 53 54  |ne.(.Q        ST|
0000ec40  52 20 20 20 20 20 72 30  2c 20 5b 72 36 5d 20 20  |R     r0, [r6]  |
0000ec50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000ec60  53 74 6f 72 65 20 74 68  69 73 20 69 6e 74 65 72  |Store this inter|
0000ec70  73 65 63 74 69 6f 6e 20  69 6e 20 74 68 65 20 6c  |section in the l|
0000ec80  69 73 74 0d 28 be 4a 20  20 20 20 20 20 20 20 41  |ist.(.J        A|
0000ec90  44 44 20 20 20 20 20 72  32 2c 20 72 32 2c 20 23  |DD     r2, r2, #|
0000eca0  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
0000ecb0  20 49 6e 63 72 65 6d 65  6e 74 20 69 6e 74 65 72  | Increment inter|
0000ecc0  73 65 63 74 69 6f 6e 20  63 6f 75 6e 74 0d 28 c8  |section count.(.|
0000ecd0  41 20 20 20 20 20 20 20  20 42 20 20 20 20 20 20  |A        B      |
0000ece0  20 70 6c 6f 74 5f 70 6f  6c 79 5f 66 69 6c 6c 5f  | plot_poly_fill_|
0000ecf0  69 6e 74 65 72 5f 6c 6f  6f 70 3b 20 4c 6f 6f 70  |inter_loop; Loop|
0000ed00  20 66 6f 72 20 6e 65 78  74 20 65 64 67 65 0d 28  | for next edge.(|
0000ed10  d2 18 2e 70 6c 6f 74 5f  70 6f 6c 79 5f 66 69 6c  |...plot_poly_fil|
0000ed20  6c 5f 70 6c 6f 74 0d 28  dc 3d 20 20 20 20 20 20  |l_plot.(.=      |
0000ed30  20 20 53 54 4d 46 44 20  20 20 72 31 33 21 2c 20  |  STMFD   r13!, |
0000ed40  7b 72 31 2d 72 35 2c 20  72 31 34 7d 20 20 20 20  |{r1-r5, r14}    |
0000ed50  20 20 3b 20 53 74 61 63  6b 20 72 65 67 69 73 74  |  ; Stack regist|
0000ed60  65 72 73 0d 28 e6 3d 20  20 20 20 20 20 20 20 4d  |ers.(.=        M|
0000ed70  4f 56 20 20 20 20 20 72  31 2c 20 72 35 20 20 20  |OV     r1, r5   |
0000ed80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
0000ed90  20 43 6f 70 79 20 72 6f  77 20 6e 75 6d 62 65 72  | Copy row number|
0000eda0  0d 28 f0 4a 20 20 20 20  20 20 20 20 4d 4f 56 20  |.(.J        MOV |
0000edb0  20 20 20 20 72 35 2c 20  72 32 2c 20 4c 53 52 23  |    r5, r2, LSR#|
0000edc0  31 20 20 20 20 20 20 20  20 20 20 20 3b 20 43 61  |1           ; Ca|
0000edd0  6c 63 75 6c 61 74 65 20  6e 75 6d 62 65 72 20 6f  |lculate number o|
0000ede0  66 20 73 65 67 6d 65 6e  74 73 0d 28 fa 1d 2e 70  |f segments.(...p|
0000edf0  6c 6f 74 5f 70 6f 6c 79  5f 66 69 6c 6c 5f 70 6c  |lot_poly_fill_pl|
0000ee00  6f 74 5f 6c 6f 6f 70 0d  29 04 45 20 20 20 20 20  |ot_loop.).E     |
0000ee10  20 20 20 53 55 42 53 20  20 20 20 72 35 2c 20 72  |   SUBS    r5, r|
0000ee20  35 2c 20 23 31 20 20 20  20 20 20 20 20 20 20 20  |5, #1           |
0000ee30  20 20 20 3b 20 44 65 63  72 65 6d 65 6e 74 20 73  |   ; Decrement s|
0000ee40  65 67 6d 65 6e 74 20 63  6f 75 6e 74 0d 29 0e 44  |egment count.).D|
0000ee50  20 20 20 20 20 20 20 20  4c 44 4d 4d 49 46 44 20  |        LDMMIFD |
0000ee60  72 31 33 21 2c 20 7b 72  31 2d 72 35 2c 20 70 63  |r13!, {r1-r5, pc|
0000ee70  7d 20 20 20 20 20 20 20  3b 20 52 65 74 75 72 6e  |}       ; Return|
0000ee80  20 66 72 6f 6d 20 73 75  62 72 6f 75 74 69 6e 65  | from subroutine|
0000ee90  0d 29 18 42 20 20 20 20  20 20 20 20 4c 44 4d 49  |.).B        LDMI|
0000eea0  41 20 20 20 72 34 21 2c  20 7b 72 32 2d 72 33 7d  |A   r4!, {r2-r3}|
0000eeb0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 65  |            ; Re|
0000eec0  61 64 20 73 65 67 6d 65  6e 74 20 64 65 74 61 69  |ad segment detai|
0000eed0  6c 73 0d 29 22 48 20 20  20 20 20 20 20 20 41 44  |ls.)"H        AD|
0000eee0  44 20 20 20 20 20 72 32  2c 20 72 32 2c 20 23 31  |D     r2, r2, #1|
0000eef0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000ef00  41 64 76 61 6e 63 65 20  74 68 65 20 73 74 61 72  |Advance the star|
0000ef10  74 20 70 6f 73 69 74 69  6f 6e 0d 29 2c 44 20 20  |t position.),D  |
0000ef20  20 20 20 20 20 20 43 4d  50 20 20 20 20 20 72 32  |      CMP     r2|
0000ef30  2c 20 72 33 20 20 20 20  20 20 20 20 20 20 20 20  |, r3            |
0000ef40  20 20 20 20 20 20 3b 20  49 73 20 74 68 65 20 73  |      ; Is the s|
0000ef50  65 67 6d 65 6e 74 20 76  69 73 69 62 6c 65 0d 29  |egment visible.)|
0000ef60  36 4a 20 20 20 20 20 20  20 20 42 4c 4c 45 20 20  |6J        BLLE  |
0000ef70  20 20 70 6c 6f 74 5f 72  6f 77 20 20 20 20 20 20  |  plot_row      |
0000ef80  20 20 20 20 20 20 20 20  20 20 3b 20 50 6c 6f 74  |          ; Plot|
0000ef90  20 74 68 69 73 20 73 65  67 6d 65 6e 74 20 69 66  | this segment if|
0000efa0  20 76 69 73 69 62 6c 65  0d 29 40 47 20 20 20 20  | visible.)@G    |
0000efb0  20 20 20 20 42 20 20 20  20 20 20 20 70 6c 6f 74  |    B       plot|
0000efc0  5f 70 6f 6c 79 5f 66 69  6c 6c 5f 70 6c 6f 74 5f  |_poly_fill_plot_|
0000efd0  6c 6f 6f 70 3b 20 4c 6f  6f 70 20 66 6f 72 20 74  |loop; Loop for t|
0000efe0  68 65 20 6e 65 78 74 20  73 65 67 6d 65 6e 74 0d  |he next segment.|
0000eff0  29 4a 04 0d 29 54 46 20  20 20 20 20 20 20 20 3b  |)J..)TF        ;|
0000f000  20 45 78 70 61 6e 64 20  61 20 73 69 6e 67 6c 65  | Expand a single|
0000f010  20 62 79 74 65 20 63 6f  6c 6f 75 72 20 64 65 73  | byte colour des|
0000f020  63 72 69 70 74 69 6f 6e  20 69 6e 74 6f 20 61 20  |cription into a |
0000f030  66 75 6c 6c 20 77 6f 72  64 0d 29 5e 12 2e 63 6f  |full word.)^..co|
0000f040  6c 6f 75 72 5f 65 78 70  61 6e 64 0d 29 68 3e 20  |lour_expand.)h> |
0000f050  20 20 20 20 20 20 20 84  52 20 20 20 20 20 72 30  |       .R     r0|
0000f060  2c 20 72 30 2c 20 72 30  2c 20 4c 53 4c 23 38 20  |, r0, r0, LSL#8 |
0000f070  20 20 20 20 20 20 3b 20  45 78 70 61 6e 64 20 74  |      ; Expand t|
0000f080  6f 20 31 36 20 62 69 74  73 0d 29 72 3e 20 20 20  |o 16 bits.)r>   |
0000f090  20 20 20 20 20 84 52 20  20 20 20 20 72 30 2c 20  |     .R     r0, |
0000f0a0  72 30 2c 20 72 30 2c 20  4c 53 4c 23 31 36 20 20  |r0, r0, LSL#16  |
0000f0b0  20 20 20 20 3b 20 45 78  70 61 6e 64 20 74 6f 20  |    ; Expand to |
0000f0c0  33 32 20 62 69 74 73 0d  29 7c 44 20 20 20 20 20  |32 bits.)|D     |
0000f0d0  20 20 20 4d 4f 56 20 20  20 20 20 70 63 2c 20 72  |   MOV     pc, r|
0000f0e0  31 34 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |14              |
0000f0f0  20 20 20 3b 20 52 65 74  75 72 6e 20 66 72 6f 6d  |   ; Return from|
0000f100  20 73 75 62 72 6f 75 74  69 6e 65 0d 29 86 04 0d  | subroutine.)...|
0000f110  29 90 28 20 20 20 20 20  20 20 20 3b 20 44 69 76  |).(        ; Div|
0000f120  69 64 65 20 72 30 20 62  79 20 72 31 20 74 6f 20  |ide r0 by r1 to |
0000f130  67 69 76 65 20 72 30 0d  29 9a 3d 2e 64 69 76 69  |give r0.).=.divi|
0000f140  64 65 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |de STMFD   r13!,|
0000f150  20 7b 72 32 2d 72 33 2c  20 72 31 34 7d 20 20 20  | {r2-r3, r14}   |
0000f160  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
0000f170  74 65 72 73 0d 29 a4 42  20 20 20 20 20 20 20 20  |ters.).B        |
0000f180  43 4d 50 20 20 20 20 20  72 30 2c 20 23 30 20 20  |CMP     r0, #0  |
0000f190  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f1a0  3b 20 49 73 20 64 69 76  69 64 65 6e 64 20 6e 65  |; Is dividend ne|
0000f1b0  67 61 74 69 76 65 0d 29  ae 49 20 20 20 20 20 20  |gative.).I      |
0000f1c0  20 20 52 53 42 4d 49 20  20 20 72 30 2c 20 72 30  |  RSBMI   r0, r0|
0000f1d0  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
0000f1e0  20 20 3b 20 45 6e 73 75  72 65 20 64 69 76 69 64  |  ; Ensure divid|
0000f1f0  65 6e 64 20 69 73 20 70  6f 73 69 74 69 76 65 0d  |end is positive.|
0000f200  29 b8 42 20 20 20 20 20  20 20 20 42 4c 20 20 20  |).B        BL   |
0000f210  20 20 20 64 69 76 69 64  65 5f 75 6e 73 69 67 6e  |   divide_unsign|
0000f220  65 64 20 20 20 20 20 20  20 20 20 3b 20 50 65 72  |ed         ; Per|
0000f230  66 6f 72 6d 20 74 68 65  20 64 69 76 69 73 69 6f  |form the divisio|
0000f240  6e 0d 29 c2 4c 20 20 20  20 20 20 20 20 52 53 42  |n.).L        RSB|
0000f250  4d 49 20 20 20 72 30 2c  20 72 30 2c 20 23 30 20  |MI   r0, r0, #0 |
0000f260  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000f270  6f 72 72 65 63 74 20 74  68 65 20 73 69 67 6e 20  |orrect the sign |
0000f280  6f 66 20 74 68 65 20 72  65 73 75 6c 74 0d 29 cc  |of the result.).|
0000f290  44 20 20 20 20 20 20 20  20 4c 44 4d 46 44 20 20  |D        LDMFD  |
0000f2a0  20 72 31 33 21 2c 20 7b  72 32 2d 72 33 2c 20 70  | r13!, {r2-r3, p|
0000f2b0  63 7d 20 20 20 20 20 20  20 3b 20 52 65 74 75 72  |c}       ; Retur|
0000f2c0  6e 20 66 72 6f 6d 20 73  75 62 72 6f 75 74 69 6e  |n from subroutin|
0000f2d0  65 0d 29 d6 14 2e 64 69  76 69 64 65 5f 75 6e 73  |e.)...divide_uns|
0000f2e0  69 67 6e 65 64 0d 29 e0  3e 20 20 20 20 20 20 20  |igned.).>       |
0000f2f0  20 4d 4f 56 20 20 20 20  20 72 33 2c 20 72 31 20  | MOV     r3, r1 |
0000f300  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f310  20 3b 20 43 6f 70 79 20  74 68 65 20 64 69 76 69  | ; Copy the divi|
0000f320  73 6f 72 0d 29 ea 54 20  20 20 20 20 20 20 20 43  |sor.).T        C|
0000f330  4d 50 20 20 20 20 20 72  33 2c 20 72 30 2c 20 4c  |MP     r3, r0, L|
0000f340  53 52 23 31 20 20 20 20  20 20 20 20 20 20 20 3b  |SR#1           ;|
0000f350  20 49 73 20 64 69 76 69  73 6f 72 20 6c 61 72 67  | Is divisor larg|
0000f360  65 72 20 74 68 61 6e 20  64 6f 75 62 6c 65 20 64  |er than double d|
0000f370  69 76 69 64 65 6e 64 0d  29 f4 1b 2e 64 69 76 69  |ividend.)...divi|
0000f380  64 65 5f 75 6e 73 69 67  6e 65 64 5f 64 6f 75 62  |de_unsigned_doub|
0000f390  6c 65 0d 29 fe 40 20 20  20 20 20 20 20 20 4d 4f  |le.).@        MO|
0000f3a0  56 4c 53 20 20 20 72 33  2c 20 72 33 2c 20 4c 53  |VLS   r3, r3, LS|
0000f3b0  4c 23 31 20 20 20 20 20  20 20 20 20 20 20 3b 20  |L#1           ; |
0000f3c0  44 6f 75 62 6c 65 20 74  68 65 20 64 69 76 69 73  |Double the divis|
0000f3d0  6f 72 0d 2a 08 54 20 20  20 20 20 20 20 20 43 4d  |or.*.T        CM|
0000f3e0  50 4c 53 20 20 20 72 33  2c 20 72 30 2c 20 4c 53  |PLS   r3, r0, LS|
0000f3f0  52 23 31 20 20 20 20 20  20 20 20 20 20 20 3b 20  |R#1           ; |
0000f400  49 73 20 64 69 76 69 73  6f 72 20 6c 61 72 67 65  |Is divisor large|
0000f410  72 20 74 68 61 6e 20 64  6f 75 62 6c 65 20 64 69  |r than double di|
0000f420  76 69 64 65 6e 64 0d 2a  12 4c 20 20 20 20 20 20  |vidend.*.L      |
0000f430  20 20 42 4c 53 20 20 20  20 20 64 69 76 69 64 65  |  BLS     divide|
0000f440  5f 75 6e 73 69 67 6e 65  64 5f 64 6f 75 62 6c 65  |_unsigned_double|
0000f450  20 20 3b 20 4c 6f 6f 70  20 61 67 61 69 6e 20 69  |  ; Loop again i|
0000f460  66 20 6e 6f 74 20 6c 61  72 67 65 20 65 6e 6f 75  |f not large enou|
0000f470  67 68 0d 2a 1c 40 20 20  20 20 20 20 20 20 4d 4f  |gh.*.@        MO|
0000f480  56 20 20 20 20 20 72 32  2c 20 23 30 20 20 20 20  |V     r2, #0    |
0000f490  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
0000f4a0  43 6c 65 61 72 20 74 68  65 20 71 75 6f 74 69 65  |Clear the quotie|
0000f4b0  6e 74 0d 2a 26 19 2e 64  69 76 69 64 65 5f 75 6e  |nt.*&..divide_un|
0000f4c0  73 69 67 6e 65 64 5f 6c  6f 6f 70 0d 2a 30 4b 20  |signed_loop.*0K |
0000f4d0  20 20 20 20 20 20 20 43  4d 50 20 20 20 20 20 72  |       CMP     r|
0000f4e0  30 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |0, r3           |
0000f4f0  20 20 20 20 20 20 20 3b  20 43 61 6e 20 74 68 65  |       ; Can the|
0000f500  20 64 69 76 69 73 6f 72  20 62 65 20 73 75 62 74  | divisor be subt|
0000f510  72 61 63 74 65 64 0d 2a  3a 4a 20 20 20 20 20 20  |racted.*:J      |
0000f520  20 20 53 55 42 43 53 20  20 20 72 30 2c 20 72 30  |  SUBCS   r0, r0|
0000f530  2c 20 72 33 20 20 20 20  20 20 20 20 20 20 20 20  |, r3            |
0000f540  20 20 3b 20 53 75 62 74  72 61 63 74 20 64 69 76  |  ; Subtract div|
0000f550  69 73 6f 72 20 69 66 20  70 6f 73 73 69 62 6c 65  |isor if possible|
0000f560  0d 2a 44 51 20 20 20 20  20 20 20 20 41 44 43 20  |.*DQ        ADC |
0000f570  20 20 20 20 72 32 2c 20  72 32 2c 20 72 32 20 20  |    r2, r2, r2  |
0000f580  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 44 6f  |            ; Do|
0000f590  75 62 6c 65 20 71 75 6f  74 69 65 6e 74 20 61 6e  |uble quotient an|
0000f5a0  64 20 61 64 64 20 74 68  65 20 6e 65 77 20 62 69  |d add the new bi|
0000f5b0  74 0d 2a 4e 3f 20 20 20  20 20 20 20 20 4d 4f 56  |t.*N?        MOV|
0000f5c0  20 20 20 20 20 72 33 2c  20 72 33 2c 20 4c 53 52  |     r3, r3, LSR|
0000f5d0  23 31 20 20 20 20 20 20  20 20 20 20 20 3b 20 48  |#1           ; H|
0000f5e0  61 6c 76 65 20 74 68 65  20 64 69 76 69 73 6f 72  |alve the divisor|
0000f5f0  0d 2a 58 54 20 20 20 20  20 20 20 20 43 4d 50 20  |.*XT        CMP |
0000f600  20 20 20 20 72 33 2c 20  72 31 20 20 20 20 20 20  |    r3, r1      |
0000f610  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 48 61  |            ; Ha|
0000f620  73 20 74 68 65 20 6f 72  69 67 69 6e 61 6c 20 64  |s the original d|
0000f630  69 76 69 73 6f 72 20 62  65 65 6e 20 65 78 63 65  |ivisor been exce|
0000f640  65 64 65 64 0d 2a 62 40  20 20 20 20 20 20 20 20  |eded.*b@        |
0000f650  42 43 53 20 20 20 20 20  64 69 76 69 64 65 5f 75  |BCS     divide_u|
0000f660  6e 73 69 67 6e 65 64 5f  6c 6f 6f 70 20 20 20 20  |nsigned_loop    |
0000f670  3b 20 4c 6f 6f 70 20 69  66 20 69 74 20 68 61 73  |; Loop if it has|
0000f680  20 6e 6f 74 0d 2a 6c 3d  20 20 20 20 20 20 20 20  | not.*l=        |
0000f690  4d 4f 56 20 20 20 20 20  72 30 2c 20 72 32 20 20  |MOV     r0, r2  |
0000f6a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f6b0  3b 20 43 6f 70 79 20 74  68 65 20 72 65 73 75 6c  |; Copy the resul|
0000f6c0  74 0d 2a 76 44 20 20 20  20 20 20 20 20 4d 4f 56  |t.*vD        MOV|
0000f6d0  53 20 20 20 20 70 63 2c  20 72 31 34 20 20 20 20  |S    pc, r14    |
0000f6e0  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 52  |             ; R|
0000f6f0  65 74 75 72 6e 20 66 72  6f 6d 20 73 75 62 72 6f  |eturn from subro|
0000f700  75 74 69 6e 65 0d 2a 80  04 0d 2a 8a 4f 20 20 20  |utine.*...*.O   |
0000f710  20 20 20 20 20 3b 20 43  61 6c 63 75 6c 61 74 65  |     ; Calculate|
0000f720  20 74 68 65 20 73 71 75  61 72 65 20 72 6f 6f 74  | the square root|
0000f730  20 6f 66 20 61 6e 20 75  6e 73 69 67 6e 65 64 20  | of an unsigned |
0000f740  69 6e 74 65 67 65 72 20  69 6e 20 72 30 20 74 6f  |integer in r0 to|
0000f750  20 67 69 76 65 20 72 30  0d 2a 94 3d 2e 73 71 72  | give r0.*.=.sqr|
0000f760  74 20 20 20 53 54 4d 46  44 20 20 20 72 31 33 21  |t   STMFD   r13!|
0000f770  2c 20 7b 72 31 2d 72 34  2c 20 72 31 34 7d 20 20  |, {r1-r4, r14}  |
0000f780  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
0000f790  73 74 65 72 73 0d 2a 9e  47 20 20 20 20 20 20 20  |sters.*.G       |
0000f7a0  20 4d 4f 56 20 20 20 20  20 72 31 2c 20 72 30 20  | MOV     r1, r0 |
0000f7b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
0000f7c0  20 3b 20 43 6f 70 79 20  74 68 65 20 6f 72 69 67  | ; Copy the orig|
0000f7d0  69 6e 61 6c 20 69 6e 74  65 67 65 72 0d 2a a8 43  |inal integer.*.C|
0000f7e0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000f7f0  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
0000f800  20 20 20 20 20 20 20 20  3b 20 49 6e 69 74 69 61  |        ; Initia|
0000f810  6c 69 73 65 20 74 68 65  20 72 65 73 75 6c 74 0d  |lise the result.|
0000f820  2a b2 43 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |*.C        MOV  |
0000f830  20 20 20 72 32 2c 20 23  31 3c 3c 31 35 20 20 20  |   r2, #1<<15   |
0000f840  20 20 20 20 20 20 20 20  20 20 20 3b 20 54 68 65  |           ; The|
0000f850  20 66 69 72 73 74 20 62  69 74 20 74 6f 20 74 65  | first bit to te|
0000f860  73 74 0d 2a bc 0e 2e 73  71 72 74 5f 6c 6f 6f 70  |st.*...sqrt_loop|
0000f870  0d 2a c6 48 20 20 20 20  20 20 20 20 84 52 20 20  |.*.H        .R  |
0000f880  20 20 20 72 33 2c 20 72  30 2c 20 72 32 20 20 20  |   r3, r0, r2   |
0000f890  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 6f 6e  |           ; Con|
0000f8a0  73 74 72 75 63 74 20 74  68 65 20 63 75 72 72 65  |struct the curre|
0000f8b0  6e 74 20 67 75 65 73 73  0d 2a d0 46 20 20 20 20  |nt guess.*.F    |
0000f8c0  20 20 20 20 4d 55 4c 20  20 20 20 20 72 34 2c 20  |    MUL     r4, |
0000f8d0  72 33 2c 20 72 33 20 20  20 20 20 20 20 20 20 20  |r3, r3          |
0000f8e0  20 20 20 20 3b 20 53 71  75 61 72 65 20 74 68 65  |    ; Square the|
0000f8f0  20 63 75 72 72 65 6e 74  20 67 75 65 73 73 0d 2a  | current guess.*|
0000f900  da 4d 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |.M        CMP   |
0000f910  20 20 72 34 2c 20 72 31  20 20 20 20 20 20 20 20  |  r4, r1        |
0000f920  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 6d 70  |          ; Comp|
0000f930  61 72 65 20 77 69 74 68  20 74 68 65 20 72 65 71  |are with the req|
0000f940  75 69 72 65 64 20 76 61  6c 75 65 0d 2a e4 50 20  |uired value.*.P |
0000f950  20 20 20 20 20 20 20 4d  4f 56 4c 53 20 20 20 72  |       MOVLS   r|
0000f960  30 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |0, r3           |
0000f970  20 20 20 20 20 20 20 3b  20 4b 65 65 70 20 74 68  |       ; Keep th|
0000f980  65 20 63 75 72 72 65 6e  74 20 67 75 65 73 73 20  |e current guess |
0000f990  69 66 20 73 75 69 74 61  62 6c 65 0d 2a ee 45 20  |if suitable.*.E |
0000f9a0  20 20 20 20 20 20 20 4d  4f 56 53 20 20 20 20 72  |       MOVS    r|
0000f9b0  32 2c 20 72 32 2c 20 4c  53 52 23 31 20 20 20 20  |2, r2, LSR#1    |
0000f9c0  20 20 20 20 20 20 20 3b  20 41 64 76 61 6e 63 65  |       ; Advance|
0000f9d0  20 74 6f 20 74 68 65 20  6e 65 78 74 20 62 69 74  | to the next bit|
0000f9e0  0d 2a f8 48 20 20 20 20  20 20 20 20 42 4e 45 20  |.*.H        BNE |
0000f9f0  20 20 20 20 73 71 72 74  5f 6c 6f 6f 70 20 20 20  |    sqrt_loop   |
0000fa00  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 4c 6f  |            ; Lo|
0000fa10  6f 70 20 75 6e 74 69 6c  20 61 6c 6c 20 62 69 74  |op until all bit|
0000fa20  73 20 74 65 73 74 65 64  0d 2b 02 44 20 20 20 20  |s tested.+.D    |
0000fa30  20 20 20 20 4c 44 4d 46  44 20 20 20 72 31 33 21  |    LDMFD   r13!|
0000fa40  2c 20 7b 72 31 2d 72 34  2c 20 70 63 7d 20 20 20  |, {r1-r4, pc}   |
0000fa50  20 20 20 20 3b 20 52 65  74 75 72 6e 20 66 72 6f  |    ; Return fro|
0000fa60  6d 20 73 75 62 72 6f 75  74 69 6e 65 0d 2b 0c 04  |m subroutine.+..|
0000fa70  0d 2b 16 46 20 20 20 20  20 20 20 20 3b 20 4e 6f  |.+.F        ; No|
0000fa80  72 6d 61 6c 69 73 65 20  61 20 76 65 63 74 6f 72  |rmalise a vector|
0000fa90  20 28 72 30 2c 20 72 31  29 20 74 6f 20 68 61 76  | (r0, r1) to hav|
0000faa0  65 20 61 20 6d 61 67 6e  69 74 75 64 65 20 6f 66  |e a magnitude of|
0000fab0  20 31 3c 3c 31 36 0d 2b  20 0e 2e 6e 6f 72 6d 61  | 1<<16.+ ..norma|
0000fac0  6c 69 73 65 0d 2b 2a 3d  20 20 20 20 20 20 20 20  |lise.+*=        |
0000fad0  53 54 4d 46 44 20 20 20  72 31 33 21 2c 20 7b 72  |STMFD   r13!, {r|
0000fae0  32 2d 72 35 2c 20 72 31  34 7d 20 20 20 20 20 20  |2-r5, r14}      |
0000faf0  3b 20 53 74 61 63 6b 20  72 65 67 69 73 74 65 72  |; Stack register|
0000fb00  73 0d 2b 34 48 20 20 20  20 20 20 20 20 54 45 51  |s.+4H        TEQ|
0000fb10  20 20 20 20 20 72 30 2c  20 23 30 20 20 20 20 20  |     r0, #0     |
0000fb20  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
0000fb30  68 65 63 6b 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  |heck horizontal |
0000fb40  63 6f 6d 70 6f 6e 65 6e  74 0d 2b 3e 46 20 20 20  |component.+>F   |
0000fb50  20 20 20 20 20 54 45 51  45 51 20 20 20 72 31 2c  |     TEQEQ   r1,|
0000fb60  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
0000fb70  20 20 20 20 20 3b 20 43  68 65 63 6b 20 76 65 72  |     ; Check ver|
0000fb80  74 69 63 61 6c 20 63 6f  6d 70 6f 6e 65 6e 74 0d  |tical component.|
0000fb90  2b 48 4e 20 20 20 20 20  20 20 20 42 45 51 20 20  |+HN        BEQ  |
0000fba0  20 20 20 6e 6f 72 6d 61  6c 69 73 65 5f 64 6f 6e  |   normalise_don|
0000fbb0  65 20 20 20 20 20 20 20  20 20 20 3b 20 55 6e 61  |e          ; Una|
0000fbc0  62 6c 65 20 74 6f 20 6e  6f 72 6d 61 6c 69 73 65  |ble to normalise|
0000fbd0  20 7a 65 72 6f 20 76 65  63 74 6f 72 73 0d 2b 52  | zero vectors.+R|
0000fbe0  4b 20 20 20 20 20 20 20  20 4d 4f 56 53 20 20 20  |K        MOVS   |
0000fbf0  20 72 32 2c 20 72 30 20  20 20 20 20 20 20 20 20  | r2, r0         |
0000fc00  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
0000fc10  74 68 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 63  |the horizontal c|
0000fc20  6f 6d 70 6f 6e 65 6e 74  0d 2b 5c 42 20 20 20 20  |omponent.+\B    |
0000fc30  20 20 20 20 52 53 42 4d  49 20 20 20 72 30 2c 20  |    RSBMI   r0, |
0000fc40  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
0000fc50  20 20 20 20 3b 20 4b 65  65 70 20 61 20 70 6f 73  |    ; Keep a pos|
0000fc60  69 74 69 76 65 20 63 6f  70 79 0d 2b 66 49 20 20  |itive copy.+fI  |
0000fc70  20 20 20 20 20 20 4d 4f  56 53 20 20 20 20 72 33  |      MOVS    r3|
0000fc80  2c 20 72 31 20 20 20 20  20 20 20 20 20 20 20 20  |, r1            |
0000fc90  20 20 20 20 20 20 3b 20  43 6f 70 79 20 74 68 65  |      ; Copy the|
0000fca0  20 76 65 72 74 69 63 61  6c 20 63 6f 6d 70 6f 6e  | vertical compon|
0000fcb0  65 6e 74 0d 2b 70 42 20  20 20 20 20 20 20 20 52  |ent.+pB        R|
0000fcc0  53 42 4d 49 20 20 20 72  31 2c 20 72 31 2c 20 23  |SBMI   r1, r1, #|
0000fcd0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |0              ;|
0000fce0  20 4b 65 65 70 20 61 20  70 6f 73 69 74 69 76 65  | Keep a positive|
0000fcf0  20 63 6f 70 79 0d 2b 7a  17 2e 6e 6f 72 6d 61 6c  | copy.+z..normal|
0000fd00  69 73 65 5f 70 72 65 73  63 61 6c 65 0d 2b 84 4f  |ise_prescale.+.O|
0000fd10  20 20 20 20 20 20 20 20  54 53 54 20 20 20 20 20  |        TST     |
0000fd20  72 30 2c 20 23 31 3c 3c  33 30 20 20 20 20 20 20  |r0, #1<<30      |
0000fd30  20 20 20 20 20 20 20 20  3b 20 49 73 20 74 68 65  |        ; Is the|
0000fd40  20 68 6f 72 69 7a 6f 6e  74 61 6c 20 63 6f 6d 70  | horizontal comp|
0000fd50  6f 6e 65 6e 74 20 6c 61  72 67 65 0d 2b 8e 4d 20  |onent large.+.M |
0000fd60  20 20 20 20 20 20 20 54  53 54 45 51 20 20 20 72  |       TSTEQ   r|
0000fd70  31 2c 20 23 31 3c 3c 33  30 20 20 20 20 20 20 20  |1, #1<<30       |
0000fd80  20 20 20 20 20 20 20 3b  20 49 73 20 74 68 65 20  |       ; Is the |
0000fd90  76 65 72 74 69 63 61 6c  20 63 6f 6d 70 6f 6e 65  |vertical compone|
0000fda0  6e 74 20 6c 61 72 67 65  0d 2b 98 47 20 20 20 20  |nt large.+.G    |
0000fdb0  20 20 20 20 42 4e 45 20  20 20 20 20 6e 6f 72 6d  |    BNE     norm|
0000fdc0  61 6c 69 73 65 5f 70 72  65 73 63 61 6c 65 5f 64  |alise_prescale_d|
0000fdd0  6f 6e 65 20 3b 20 53 6b  69 70 20 6c 6f 6f 70 20  |one ; Skip loop |
0000fde0  69 66 20 6c 61 72 67 65  20 65 6e 6f 75 67 68 0d  |if large enough.|
0000fdf0  2b a2 4d 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |+.M        MOV  |
0000fe00  20 20 20 72 32 2c 20 72  32 2c 20 41 53 4c 23 31  |   r2, r2, ASL#1|
0000fe10  20 20 20 20 20 20 20 20  20 20 20 3b 20 44 6f 75  |           ; Dou|
0000fe20  62 6c 65 20 74 68 65 20  68 6f 72 69 7a 6f 6e 74  |ble the horizont|
0000fe30  61 6c 20 63 6f 6d 70 6f  6e 65 6e 74 0d 2b ac 52  |al component.+.R|
0000fe40  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
0000fe50  72 30 2c 20 72 30 2c 20  41 53 4c 23 31 20 20 20  |r0, r0, ASL#1   |
0000fe60  20 20 20 20 20 20 20 20  3b 20 44 6f 75 62 6c 65  |        ; Double|
0000fe70  20 74 68 65 20 68 6f 72  69 7a 6f 6e 74 61 6c 20  | the horizontal |
0000fe80  63 6f 6d 70 6f 6e 65 6e  74 20 63 6f 70 79 0d 2b  |component copy.+|
0000fe90  b6 4b 20 20 20 20 20 20  20 20 4d 4f 56 20 20 20  |.K        MOV   |
0000fea0  20 20 72 33 2c 20 72 33  2c 20 41 53 4c 23 31 20  |  r3, r3, ASL#1 |
0000feb0  20 20 20 20 20 20 20 20  20 20 3b 20 44 6f 75 62  |          ; Doub|
0000fec0  6c 65 20 74 68 65 20 76  65 72 74 69 63 61 6c 20  |le the vertical |
0000fed0  63 6f 6d 70 6f 6e 65 6e  74 0d 2b c0 50 20 20 20  |component.+.P   |
0000fee0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 31 2c  |     MOV     r1,|
0000fef0  20 72 31 2c 20 41 53 4c  23 31 20 20 20 20 20 20  | r1, ASL#1      |
0000ff00  20 20 20 20 20 3b 20 44  6f 75 62 6c 65 20 74 68  |     ; Double th|
0000ff10  65 20 76 65 72 74 69 63  61 6c 20 63 6f 6d 70 6f  |e vertical compo|
0000ff20  6e 65 6e 74 20 63 6f 70  79 0d 2b ca 45 20 20 20  |nent copy.+.E   |
0000ff30  20 20 20 20 20 42 20 20  20 20 20 20 20 6e 6f 72  |     B       nor|
0000ff40  6d 61 6c 69 73 65 5f 70  72 65 73 63 61 6c 65 20  |malise_prescale |
0000ff50  20 20 20 20 20 3b 20 4c  6f 6f 70 20 75 6e 74 69  |     ; Loop unti|
0000ff60  6c 20 6c 61 72 67 65 20  65 6e 6f 75 67 68 0d 2b  |l large enough.+|
0000ff70  d4 1c 2e 6e 6f 72 6d 61  6c 69 73 65 5f 70 72 65  |...normalise_pre|
0000ff80  73 63 61 6c 65 5f 64 6f  6e 65 0d 2b de 4d 20 20  |scale_done.+.M  |
0000ff90  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 34  |      MOV     r4|
0000ffa0  2c 20 72 32 2c 20 41 53  52 23 31 36 20 20 20 20  |, r2, ASR#16    |
0000ffb0  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 64 6f  |      ; Scale do|
0000ffc0  77 6e 20 68 6f 72 69 7a  6f 6e 74 61 6c 20 63 6f  |wn horizontal co|
0000ffd0  6d 70 6f 6e 65 6e 74 0d  2b e8 4b 20 20 20 20 20  |mponent.+.K     |
0000ffe0  20 20 20 4d 4f 56 20 20  20 20 20 72 35 2c 20 72  |   MOV     r5, r|
0000fff0  33 2c 20 41 53 52 23 31  36 20 20 20 20 20 20 20  |3, ASR#16       |
00010000  20 20 20 3b 20 53 63 61  6c 65 20 64 6f 77 6e 20  |   ; Scale down |
00010010  76 65 72 74 69 63 61 6c  20 63 6f 6d 70 6f 6e 65  |vertical compone|
00010020  6e 74 0d 2b f2 4d 20 20  20 20 20 20 20 20 4d 55  |nt.+.M        MU|
00010030  4c 20 20 20 20 20 72 30  2c 20 72 34 2c 20 72 34  |L     r0, r4, r4|
00010040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00010050  53 71 75 61 72 65 20 74  68 65 20 68 6f 72 69 7a  |Square the horiz|
00010060  6f 6e 74 61 6c 20 63 6f  6d 70 6f 6e 65 6e 74 0d  |ontal component.|
00010070  2b fc 4b 20 20 20 20 20  20 20 20 4d 55 4c 20 20  |+.K        MUL  |
00010080  20 20 20 72 31 2c 20 72  35 2c 20 72 35 20 20 20  |   r1, r5, r5   |
00010090  20 20 20 20 20 20 20 20  20 20 20 3b 20 53 71 75  |           ; Squ|
000100a0  61 72 65 20 74 68 65 20  76 65 72 74 69 63 61 6c  |are the vertical|
000100b0  20 63 6f 6d 70 6f 6e 65  6e 74 0d 2c 06 4c 20 20  | component.,.L  |
000100c0  20 20 20 20 20 20 41 44  44 20 20 20 20 20 72 30  |      ADD     r0|
000100d0  2c 20 72 30 2c 20 72 31  20 20 20 20 20 20 20 20  |, r0, r1        |
000100e0  20 20 20 20 20 20 3b 20  53 75 6d 20 74 68 65 20  |      ; Sum the |
000100f0  73 71 75 61 72 65 73 20  6f 66 20 74 68 65 20 6c  |squares of the l|
00010100  65 6e 67 74 68 73 0d 2c  10 50 20 20 20 20 20 20  |engths.,.P      |
00010110  20 20 42 4c 20 20 20 20  20 20 73 71 72 74 20 20  |  BL      sqrt  |
00010120  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010130  20 20 3b 20 43 61 6c 63  75 6c 61 74 65 20 74 68  |  ; Calculate th|
00010140  65 20 6c 65 6e 67 74 68  20 6f 66 20 74 68 65 20  |e length of the |
00010150  76 65 63 74 6f 72 0d 2c  1a 40 20 20 20 20 20 20  |vector.,.@      |
00010160  20 20 54 45 51 20 20 20  20 20 72 30 2c 20 23 30  |  TEQ     r0, #0|
00010170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010180  20 20 3b 20 49 73 20 74  68 65 20 6c 65 6e 67 74  |  ; Is the lengt|
00010190  68 20 7a 65 72 6f 0d 2c  24 41 20 20 20 20 20 20  |h zero.,$A      |
000101a0  20 20 ec 51 20 20 20 72  30 2c 20 23 31 20 20 20  |  .Q   r0, #1   |
000101b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |               ;|
000101c0  20 46 6f 72 63 65 20 61  20 6d 69 6e 69 6d 75 6d  | Force a minimum|
000101d0  20 6c 65 6e 67 74 68 0d  2c 2e 46 20 20 20 20 20  | length.,.F     |
000101e0  20 20 20 4d 4f 56 20 20  20 20 20 72 31 2c 20 72  |   MOV     r1, r|
000101f0  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00010200  20 20 20 3b 20 43 6f 70  79 20 6c 65 6e 67 74 68  |   ; Copy length|
00010210  20 74 6f 20 64 69 76 69  64 65 20 62 79 0d 2c 38  | to divide by.,8|
00010220  49 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |I        MOV    |
00010230  20 72 30 2c 20 72 33 20  20 20 20 20 20 20 20 20  | r0, r3         |
00010240  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
00010250  74 68 65 20 76 65 72 74  69 63 61 6c 20 63 6f 6d  |the vertical com|
00010260  70 6f 6e 65 6e 74 0d 2c  42 4a 20 20 20 20 20 20  |ponent.,BJ      |
00010270  20 20 42 4c 20 20 20 20  20 20 64 69 76 69 64 65  |  BL      divide|
00010280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010290  20 20 3b 20 53 63 61 6c  65 20 74 68 65 20 76 65  |  ; Scale the ve|
000102a0  72 74 69 63 61 6c 20 63  6f 6d 70 6f 6e 65 6e 74  |rtical component|
000102b0  0d 2c 4c 51 20 20 20 20  20 20 20 20 4d 4f 56 20  |.,LQ        MOV |
000102c0  20 20 20 20 72 33 2c 20  72 30 20 20 20 20 20 20  |    r3, r0      |
000102d0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 53 74  |            ; St|
000102e0  6f 72 65 20 74 68 65 20  73 63 61 6c 65 64 20 76  |ore the scaled v|
000102f0  65 72 74 69 63 61 6c 20  63 6f 6d 70 6f 6e 65 6e  |ertical componen|
00010300  74 0d 2c 56 4b 20 20 20  20 20 20 20 20 4d 4f 56  |t.,VK        MOV|
00010310  20 20 20 20 20 72 30 2c  20 72 32 20 20 20 20 20  |     r0, r2     |
00010320  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 43  |             ; C|
00010330  6f 70 79 20 74 68 65 20  68 6f 72 69 7a 6f 6e 74  |opy the horizont|
00010340  61 6c 20 63 6f 6d 70 6f  6e 65 6e 74 0d 2c 60 4c  |al component.,`L|
00010350  20 20 20 20 20 20 20 20  42 4c 20 20 20 20 20 20  |        BL      |
00010360  64 69 76 69 64 65 20 20  20 20 20 20 20 20 20 20  |divide          |
00010370  20 20 20 20 20 20 20 20  3b 20 53 63 61 6c 65 20  |        ; Scale |
00010380  74 68 65 20 68 6f 72 69  7a 6f 6e 74 61 6c 20 63  |the horizontal c|
00010390  6f 6d 70 6f 6e 65 6e 74  0d 2c 6a 53 20 20 20 20  |omponent.,jS    |
000103a0  20 20 20 20 4d 4f 56 20  20 20 20 20 72 31 2c 20  |    MOV     r1, |
000103b0  72 33 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r3              |
000103c0  20 20 20 20 3b 20 52 65  73 74 6f 72 65 20 74 68  |    ; Restore th|
000103d0  65 20 73 63 61 6c 65 64  20 76 65 72 74 69 63 61  |e scaled vertica|
000103e0  6c 20 63 6f 6d 70 6f 6e  65 6e 74 0d 2c 74 13 2e  |l component.,t..|
000103f0  6e 6f 72 6d 61 6c 69 73  65 5f 64 6f 6e 65 0d 2c  |normalise_done.,|
00010400  7e 44 20 20 20 20 20 20  20 20 4c 44 4d 46 44 20  |~D        LDMFD |
00010410  20 20 72 31 33 21 2c 20  7b 72 32 2d 72 35 2c 20  |  r13!, {r2-r5, |
00010420  70 63 7d 20 20 20 20 20  20 20 3b 20 52 65 74 75  |pc}       ; Retu|
00010430  72 6e 20 66 72 6f 6d 20  73 75 62 72 6f 75 74 69  |rn from subrouti|
00010440  6e 65 0d 2c 88 04 0d 2c  92 54 20 20 20 20 20 20  |ne.,...,.T      |
00010450  20 20 3b 20 53 63 61 6c  65 20 61 6e 64 20 74 72  |  ; Scale and tr|
00010460  61 6e 73 6c 61 74 65 20  72 30 20 63 6f 6f 72 64  |anslate r0 coord|
00010470  69 6e 61 74 65 73 20 66  72 6f 6d 20 61 74 20 72  |inates from at r|
00010480  31 20 74 6f 20 61 74 20  72 32 20 66 6f 72 20 74  |1 to at r2 for t|
00010490  68 65 20 70 6f 69 6e 74  65 72 0d 2c 9c 0e 2e 74  |he pointer.,...t|
000104a0  72 61 6e 73 5f 66 69 74  0d 2c a6 3d 20 20 20 20  |rans_fit.,.=    |
000104b0  20 20 20 20 53 54 4d 46  44 20 20 20 72 31 33 21  |    STMFD   r13!|
000104c0  2c 20 7b 72 30 2d 72 31  30 2c 20 72 31 34 7d 20  |, {r0-r10, r14} |
000104d0  20 20 20 20 3b 20 53 74  61 63 6b 20 72 65 67 69  |    ; Stack regi|
000104e0  73 74 65 72 73 0d 2c b0  4b 20 20 20 20 20 20 20  |sters.,.K       |
000104f0  20 4d 4f 56 20 20 20 20  20 72 33 2c 20 23 30 20  | MOV     r3, #0 |
00010500  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010510  20 3b 20 49 6e 69 74 69  61 6c 69 73 65 20 6d 69  | ; Initialise mi|
00010520  6e 69 6d 75 6d 20 72 6f  77 20 6e 75 6d 62 65 72  |nimum row number|
00010530  0d 2c ba 4b 20 20 20 20  20 20 20 20 4d 4f 56 20  |.,.K        MOV |
00010540  20 20 20 20 72 34 2c 20  23 30 20 20 20 20 20 20  |    r4, #0      |
00010550  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 49 6e  |            ; In|
00010560  69 74 69 61 6c 69 73 65  20 6d 61 78 69 6d 75 6d  |itialise maximum|
00010570  20 72 6f 77 20 6e 75 6d  62 65 72 0d 2c c4 4e 20  | row number.,.N |
00010580  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00010590  35 2c 20 23 30 20 20 20  20 20 20 20 20 20 20 20  |5, #0           |
000105a0  20 20 20 20 20 20 20 3b  20 49 6e 69 74 69 61 6c  |       ; Initial|
000105b0  69 73 65 20 6d 69 6e 69  6d 75 6d 20 63 6f 6c 75  |ise minimum colu|
000105c0  6d 6e 20 6e 75 6d 62 65  72 0d 2c ce 4e 20 20 20  |mn number.,.N   |
000105d0  20 20 20 20 20 4d 4f 56  20 20 20 20 20 72 36 2c  |     MOV     r6,|
000105e0  20 23 30 20 20 20 20 20  20 20 20 20 20 20 20 20  | #0             |
000105f0  20 20 20 20 20 3b 20 49  6e 69 74 69 61 6c 69 73  |     ; Initialis|
00010600  65 20 6d 61 78 69 6d 75  6d 20 63 6f 6c 75 6d 6e  |e maximum column|
00010610  20 6e 75 6d 62 65 72 0d  2c d8 47 20 20 20 20 20  | number.,.G     |
00010620  20 20 20 4c 44 52 20 20  20 20 20 72 39 2c 20 5b  |   LDR     r9, [|
00010630  72 31 32 2c 20 23 77 73  5f 79 65 69 67 5d 20 20  |r12, #ws_yeig]  |
00010640  20 20 20 3b 20 52 65 61  64 20 74 68 65 20 59 45  |   ; Read the YE|
00010650  69 67 46 61 63 74 6f 72  20 76 61 6c 75 65 0d 2c  |igFactor value.,|
00010660  e2 47 20 20 20 20 20 20  20 20 4c 44 52 20 20 20  |.G        LDR   |
00010670  20 20 72 31 30 2c 20 5b  72 31 32 2c 20 23 77 73  |  r10, [r12, #ws|
00010680  5f 78 65 69 67 5d 20 20  20 20 3b 20 52 65 61 64  |_xeig]    ; Read|
00010690  20 74 68 65 20 58 45 69  67 46 61 63 74 6f 72 20  | the XEigFactor |
000106a0  76 61 6c 75 65 0d 2c ec  13 2e 74 72 61 6e 73 5f  |value.,...trans_|
000106b0  66 69 74 5f 6c 6f 6f 70  0d 2c f6 4d 20 20 20 20  |fit_loop.,.M    |
000106c0  20 20 20 20 53 55 42 53  20 20 20 20 72 30 2c 20  |    SUBS    r0, |
000106d0  72 30 2c 20 23 31 20 20  20 20 20 20 20 20 20 20  |r0, #1          |
000106e0  20 20 20 20 3b 20 44 65  63 72 65 6d 65 6e 74 20  |    ; Decrement |
000106f0  6e 75 6d 62 65 72 20 6f  66 20 63 6f 6f 72 64 69  |number of coordi|
00010700  6e 61 74 65 73 0d 2d 00  51 20 20 20 20 20 20 20  |nates.-.Q       |
00010710  20 42 4d 49 20 20 20 20  20 74 72 61 6e 73 5f 66  | BMI     trans_f|
00010720  69 74 5f 68 6f 74 73 70  6f 74 20 20 20 20 20 20  |it_hotspot      |
00010730  20 3b 20 45 78 69 74 20  6c 6f 6f 70 20 77 68 65  | ; Exit loop whe|
00010740  6e 20 61 6c 6c 20 63 6f  6f 72 64 69 6e 61 74 65  |n all coordinate|
00010750  73 20 64 6f 6e 65 0d 2d  0a 4b 20 20 20 20 20 20  |s done.-.K      |
00010760  20 20 4c 44 4d 49 41 20  20 20 72 31 21 2c 20 7b  |  LDMIA   r1!, {|
00010770  72 37 2d 72 38 7d 20 20  20 20 20 20 20 20 20 20  |r7-r8}          |
00010780  20 20 3b 20 52 65 61 64  20 74 68 65 20 6e 65 78  |  ; Read the nex|
00010790  74 20 63 6f 6f 72 64 69  6e 61 74 65 20 70 61 69  |t coordinate pai|
000107a0  72 0d 2d 14 49 20 20 20  20 20 20 20 20 41 44 44  |r.-.I        ADD|
000107b0  20 20 20 20 20 72 37 2c  20 72 37 2c 20 23 31 3c  |     r7, r7, #1<|
000107c0  3c 31 35 20 20 20 20 20  20 20 20 20 20 3b 20 49  |<15          ; I|
000107d0  6d 70 72 6f 76 65 20 68  6f 72 69 7a 6f 6e 74 61  |mprove horizonta|
000107e0  6c 20 72 6f 75 6e 64 69  6e 67 0d 2d 1e 41 20 20  |l rounding.-.A  |
000107f0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 37  |      MOV     r7|
00010800  2c 20 72 37 2c 20 41 53  52 23 31 36 20 20 20 20  |, r7, ASR#16    |
00010810  20 20 20 20 20 20 3b 20  53 63 61 6c 65 20 63 6f  |      ; Scale co|
00010820  6c 75 6d 6e 20 6e 75 6d  62 65 72 0d 2d 28 47 20  |lumn number.-(G |
00010830  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
00010840  37 2c 20 72 37 2c 20 41  53 52 20 72 39 20 20 20  |7, r7, ASR r9   |
00010850  20 20 20 20 20 20 20 3b  20 53 63 61 6c 65 20 62  |       ; Scale b|
00010860  79 20 65 69 67 65 6e 20  76 61 6c 75 65 20 61 6c  |y eigen value al|
00010870  73 6f 0d 2d 32 49 20 20  20 20 20 20 20 20 41 44  |so.-2I        AD|
00010880  44 20 20 20 20 20 72 38  2c 20 72 38 2c 20 23 31  |D     r8, r8, #1|
00010890  3c 3c 31 35 20 20 20 20  20 20 20 20 20 20 3b 20  |<<15          ; |
000108a0  49 6d 70 72 6f 76 65 20  68 6f 72 69 7a 6f 6e 74  |Improve horizont|
000108b0  61 6c 20 72 6f 75 6e 64  69 6e 67 0d 2d 3c 41 20  |al rounding.-<A |
000108c0  20 20 20 20 20 20 20 4d  4f 56 20 20 20 20 20 72  |       MOV     r|
000108d0  38 2c 20 72 38 2c 20 41  53 52 23 31 36 20 20 20  |8, r8, ASR#16   |
000108e0  20 20 20 20 20 20 20 3b  20 53 63 61 6c 65 20 63  |       ; Scale c|
000108f0  6f 6c 75 6d 6e 20 6e 75  6d 62 65 72 0d 2d 46 47  |olumn number.-FG|
00010900  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00010910  72 38 2c 20 72 38 2c 20  41 53 52 20 72 31 30 20  |r8, r8, ASR r10 |
00010920  20 20 20 20 20 20 20 20  3b 20 53 63 61 6c 65 20  |        ; Scale |
00010930  62 79 20 65 69 67 65 6e  20 76 61 6c 75 65 20 61  |by eigen value a|
00010940  6c 73 6f 0d 2d 50 4f 20  20 20 20 20 20 20 20 53  |lso.-PO        S|
00010950  54 4d 49 41 20 20 20 72  32 21 2c 20 7b 72 37 2d  |TMIA   r2!, {r7-|
00010960  72 38 7d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |r8}            ;|
00010970  20 57 72 69 74 65 20 74  68 65 20 74 72 61 6e 73  | Write the trans|
00010980  66 6f 72 6d 65 64 20 63  6f 6f 72 64 69 6e 61 74  |formed coordinat|
00010990  65 73 0d 2d 5a 46 20 20  20 20 20 20 20 20 43 4d  |es.-ZF        CM|
000109a0  50 20 20 20 20 20 72 37  2c 20 72 33 20 20 20 20  |P     r7, r3    |
000109b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
000109c0  43 6f 6d 70 61 72 65 20  77 69 74 68 20 6d 69 6e  |Compare with min|
000109d0  69 6d 75 6d 20 72 6f 77  0d 2d 64 4c 20 20 20 20  |imum row.-dL    |
000109e0  20 20 20 20 4d 4f 56 4c  54 20 20 20 72 33 2c 20  |    MOVLT   r3, |
000109f0  72 37 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r7              |
00010a00  20 20 20 20 3b 20 55 70  64 61 74 65 20 6d 69 6e  |    ; Update min|
00010a10  69 6d 75 6d 20 72 6f 77  20 69 66 20 72 65 71 75  |imum row if requ|
00010a20  69 72 65 64 0d 2d 6e 46  20 20 20 20 20 20 20 20  |ired.-nF        |
00010a30  43 4d 50 20 20 20 20 20  72 37 2c 20 72 34 20 20  |CMP     r7, r4  |
00010a40  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010a50  3b 20 43 6f 6d 70 61 72  65 20 77 69 74 68 20 6d  |; Compare with m|
00010a60  61 78 69 6d 75 6d 20 72  6f 77 0d 2d 78 4c 20 20  |aximum row.-xL  |
00010a70  20 20 20 20 20 20 4d 4f  56 47 54 20 20 20 72 34  |      MOVGT   r4|
00010a80  2c 20 72 37 20 20 20 20  20 20 20 20 20 20 20 20  |, r7            |
00010a90  20 20 20 20 20 20 3b 20  55 70 64 61 74 65 20 6d  |      ; Update m|
00010aa0  61 78 69 6d 75 6d 20 72  6f 77 20 69 66 20 72 65  |aximum row if re|
00010ab0  71 75 69 72 65 64 0d 2d  82 49 20 20 20 20 20 20  |quired.-.I      |
00010ac0  20 20 43 4d 50 20 20 20  20 20 72 38 2c 20 72 35  |  CMP     r8, r5|
00010ad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00010ae0  20 20 3b 20 43 6f 6d 70  61 72 65 20 77 69 74 68  |  ; Compare with|
00010af0  20 6d 69 6e 69 6d 75 6d  20 63 6f 6c 75 6d 6e 0d  | minimum column.|
00010b00  2d 8c 4f 20 20 20 20 20  20 20 20 4d 4f 56 4c 54  |-.O        MOVLT|
00010b10  20 20 20 72 35 2c 20 72  38 20 20 20 20 20 20 20  |   r5, r8       |
00010b20  20 20 20 20 20 20 20 20  20 20 20 3b 20 55 70 64  |           ; Upd|
00010b30  61 74 65 20 6d 69 6e 69  6d 75 6d 20 63 6f 6c 75  |ate minimum colu|
00010b40  6d 6e 20 69 66 20 72 65  71 75 69 72 65 64 0d 2d  |mn if required.-|
00010b50  96 49 20 20 20 20 20 20  20 20 43 4d 50 20 20 20  |.I        CMP   |
00010b60  20 20 72 38 2c 20 72 36  20 20 20 20 20 20 20 20  |  r8, r6        |
00010b70  20 20 20 20 20 20 20 20  20 20 3b 20 43 6f 6d 70  |          ; Comp|
00010b80  61 72 65 20 77 69 74 68  20 6d 61 78 69 6d 75 6d  |are with maximum|
00010b90  20 63 6f 6c 75 6d 6e 0d  2d a0 4f 20 20 20 20 20  | column.-.O     |
00010ba0  20 20 20 4d 4f 56 47 54  20 20 20 72 36 2c 20 72  |   MOVGT   r6, r|
00010bb0  38 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |8               |
00010bc0  20 20 20 3b 20 55 70 64  61 74 65 20 6d 61 78 69  |   ; Update maxi|
00010bd0  6d 75 6d 20 63 6f 6c 75  6d 6e 20 69 66 20 72 65  |mum column if re|
00010be0  71 75 69 72 65 64 0d 2d  aa 4f 20 20 20 20 20 20  |quired.-.O      |
00010bf0  20 20 42 20 20 20 20 20  20 20 74 72 61 6e 73 5f  |  B       trans_|
00010c00  66 69 74 5f 6c 6f 6f 70  20 20 20 20 20 20 20 20  |fit_loop        |
00010c10  20 20 3b 20 4c 6f 6f 70  20 66 6f 72 20 74 68 65  |  ; Loop for the|
00010c20  20 6e 65 78 74 20 63 6f  6f 72 64 69 6e 61 74 65  | next coordinate|
00010c30  20 70 61 69 72 0d 2d b4  16 2e 74 72 61 6e 73 5f  | pair.-...trans_|
00010c40  66 69 74 5f 68 6f 74 73  70 6f 74 0d 2d be 50 20  |fit_hotspot.-.P |
00010c50  20 20 20 20 20 20 20 4c  44 52 42 20 20 20 20 72  |       LDRB    r|
00010c60  30 2c 20 5b 72 31 32 2c  20 23 77 73 5f 70 74 72  |0, [r12, #ws_ptr|
00010c70  5f 62 6c 6f 63 6b 5f 61  63 74 69 76 65 79 5d 3b  |_block_activey];|
00010c80  20 52 65 61 64 20 6c 61  73 74 20 76 65 72 74 69  | Read last verti|
00010c90  63 61 6c 20 68 6f 74 73  70 6f 74 0d 2d c8 52 20  |cal hotspot.-.R |
00010ca0  20 20 20 20 20 20 20 4c  44 52 42 20 20 20 20 72  |       LDRB    r|
00010cb0  31 2c 20 5b 72 31 32 2c  20 23 77 73 5f 70 74 72  |1, [r12, #ws_ptr|
00010cc0  5f 62 6c 6f 63 6b 5f 61  63 74 69 76 65 78 5d 3b  |_block_activex];|
00010cd0  20 52 65 61 64 20 6c 61  73 74 20 68 6f 72 69 7a  | Read last horiz|
00010ce0  6f 6e 74 61 6c 20 68 6f  74 73 70 6f 74 0d 2d d2  |ontal hotspot.-.|
00010cf0  45 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |E        ADD    |
00010d00  20 72 37 2c 20 72 34 2c  20 72 30 20 20 20 20 20  | r7, r4, r0     |
00010d10  20 20 20 20 20 20 20 20  20 3b 20 43 61 6c 63 75  |         ; Calcu|
00010d20  6c 61 74 65 20 6c 61 73  74 20 75 73 65 64 20 72  |late last used r|
00010d30  6f 77 0d 2d dc 52 20 20  20 20 20 20 20 20 52 53  |ow.-.R        RS|
00010d40  42 53 20 20 20 20 72 37  2c 20 72 37 2c 20 23 33  |BS    r7, r7, #3|
00010d50  31 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |1             ; |
00010d60  4e 75 6d 62 65 72 20 6f  66 20 73 70 61 72 65 20  |Number of spare |
00010d70  70 69 78 65 6c 73 20 61  74 20 74 68 65 20 62 6f  |pixels at the bo|
00010d80  74 74 6f 6d 0d 2d e6 4b  20 20 20 20 20 20 20 20  |ttom.-.K        |
00010d90  41 44 44 4d 49 20 20 20  72 30 2c 20 72 30 2c 20  |ADDMI   r0, r0, |
00010da0  72 37 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r7              |
00010db0  3b 20 46 6f 72 63 65 20  6c 61 73 74 20 72 6f 77  |; Force last row|
00010dc0  20 77 69 74 68 69 6e 20  70 6f 69 6e 74 65 72 0d  | within pointer.|
00010dd0  2d f0 46 20 20 20 20 20  20 20 20 41 44 44 53 20  |-.F        ADDS |
00010de0  20 20 20 72 37 2c 20 72  33 2c 20 72 30 20 20 20  |   r7, r3, r0   |
00010df0  20 20 20 20 20 20 20 20  20 20 20 3b 20 43 61 6c  |           ; Cal|
00010e00  63 75 6c 61 74 65 20 66  69 72 73 74 20 75 73 65  |culate first use|
00010e10  64 20 72 6f 77 0d 2d fa  4c 20 20 20 20 20 20 20  |d row.-.L       |
00010e20  20 53 55 42 4d 49 20 20  20 72 30 2c 20 72 30 2c  | SUBMI   r0, r0,|
00010e30  20 72 37 20 20 20 20 20  20 20 20 20 20 20 20 20  | r7             |
00010e40  20 3b 20 46 6f 72 63 65  20 66 69 72 73 74 20 72  | ; Force first r|
00010e50  6f 77 20 77 69 74 68 69  6e 20 70 6f 69 6e 74 65  |ow within pointe|
00010e60  72 0d 2e 04 4b 20 20 20  20 20 20 20 20 43 4d 50  |r...K        CMP|
00010e70  20 20 20 20 20 72 30 2c  20 23 30 20 20 20 20 20  |     r0, #0     |
00010e80  20 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 49  |             ; I|
00010e90  73 20 68 6f 74 73 70 6f  74 20 77 69 74 68 69 6e  |s hotspot within|
00010ea0  20 74 68 65 20 70 6f 69  6e 74 65 72 0d 2e 0e 46  | the pointer...F|
00010eb0  20 20 20 20 20 20 20 20  4d 4f 56 4c 54 20 20 20  |        MOVLT   |
00010ec0  72 30 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r0, #0          |
00010ed0  20 20 20 20 20 20 20 20  3b 20 48 6f 74 73 70 6f  |        ; Hotspo|
00010ee0  74 20 6d 75 73 74 20 62  65 20 70 6f 73 69 74 69  |t must be positi|
00010ef0  76 65 0d 2e 18 4b 20 20  20 20 20 20 20 20 43 4d  |ve...K        CM|
00010f00  50 20 20 20 20 20 72 30  2c 20 23 33 31 20 20 20  |P     r0, #31   |
00010f10  20 20 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |              ; |
00010f20  49 73 20 68 6f 74 73 70  6f 74 20 77 69 74 68 69  |Is hotspot withi|
00010f30  6e 20 74 68 65 20 70 6f  69 6e 74 65 72 0d 2e 22  |n the pointer.."|
00010f40  50 20 20 20 20 20 20 20  20 4d 4f 56 47 54 20 20  |P        MOVGT  |
00010f50  20 72 30 2c 20 23 33 31  20 20 20 20 20 20 20 20  | r0, #31        |
00010f60  20 20 20 20 20 20 20 20  20 3b 20 52 65 73 74 72  |         ; Restr|
00010f70  69 63 74 20 68 6f 74 73  70 6f 74 20 74 6f 20 77  |ict hotspot to w|
00010f80  69 74 68 69 6e 20 70 6f  69 6e 74 65 72 0d 2e 2c  |ithin pointer..,|
00010f90  48 20 20 20 20 20 20 20  20 41 44 44 20 20 20 20  |H        ADD    |
00010fa0  20 72 38 2c 20 72 36 2c  20 72 31 20 20 20 20 20  | r8, r6, r1     |
00010fb0  20 20 20 20 20 20 20 20  20 3b 20 43 61 6c 63 75  |         ; Calcu|
00010fc0  6c 61 74 65 20 6c 61 73  74 20 75 73 65 64 20 63  |late last used c|
00010fd0  6f 6c 75 6d 6e 0d 2e 36  51 20 20 20 20 20 20 20  |olumn..6Q       |
00010fe0  20 52 53 42 53 20 20 20  20 72 38 2c 20 72 38 2c  | RSBS    r8, r8,|
00010ff0  20 23 33 31 20 20 20 20  20 20 20 20 20 20 20 20  | #31            |
00011000  20 3b 20 4e 75 6d 62 65  72 20 6f 66 20 73 70 61  | ; Number of spa|
00011010  72 65 20 70 69 78 65 6c  73 20 61 74 20 74 68 65  |re pixels at the|
00011020  20 72 69 67 68 74 0d 2e  40 4e 20 20 20 20 20 20  | right..@N      |
00011030  20 20 41 44 44 4d 49 20  20 20 72 31 2c 20 72 31  |  ADDMI   r1, r1|
00011040  2c 20 72 38 20 20 20 20  20 20 20 20 20 20 20 20  |, r8            |
00011050  20 20 3b 20 46 6f 72 63  65 20 6c 61 73 74 20 63  |  ; Force last c|
00011060  6f 6c 75 6d 6e 20 77 69  74 68 69 6e 20 70 6f 69  |olumn within poi|
00011070  6e 74 65 72 0d 2e 4a 49  20 20 20 20 20 20 20 20  |nter..JI        |
00011080  41 44 44 53 20 20 20 20  72 38 2c 20 72 35 2c 20  |ADDS    r8, r5, |
00011090  72 31 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |r1              |
000110a0  3b 20 43 61 6c 63 75 6c  61 74 65 20 66 69 72 73  |; Calculate firs|
000110b0  74 20 75 73 65 64 20 63  6f 6c 75 6d 6e 0d 2e 54  |t used column..T|
000110c0  4f 20 20 20 20 20 20 20  20 53 55 42 4d 49 20 20  |O        SUBMI  |
000110d0  20 72 31 2c 20 72 31 2c  20 72 38 20 20 20 20 20  | r1, r1, r8     |
000110e0  20 20 20 20 20 20 20 20  20 3b 20 46 6f 72 63 65  |         ; Force|
000110f0  20 66 69 72 73 74 20 63  6f 6c 75 6d 6e 20 77 69  | first column wi|
00011100  74 68 69 6e 20 70 6f 69  6e 74 65 72 0d 2e 5e 4b  |thin pointer..^K|
00011110  20 20 20 20 20 20 20 20  43 4d 50 20 20 20 20 20  |        CMP     |
00011120  72 31 2c 20 23 30 20 20  20 20 20 20 20 20 20 20  |r1, #0          |
00011130  20 20 20 20 20 20 20 20  3b 20 49 73 20 68 6f 74  |        ; Is hot|
00011140  73 70 6f 74 20 77 69 74  68 69 6e 20 74 68 65 20  |spot within the |
00011150  70 6f 69 6e 74 65 72 0d  2e 68 46 20 20 20 20 20  |pointer..hF     |
00011160  20 20 20 4d 4f 56 4c 54  20 20 20 72 31 2c 20 23  |   MOVLT   r1, #|
00011170  30 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |0               |
00011180  20 20 20 3b 20 48 6f 74  73 70 6f 74 20 6d 75 73  |   ; Hotspot mus|
00011190  74 20 62 65 20 70 6f 73  69 74 69 76 65 0d 2e 72  |t be positive..r|
000111a0  4b 20 20 20 20 20 20 20  20 43 4d 50 20 20 20 20  |K        CMP    |
000111b0  20 72 31 2c 20 23 33 31  20 20 20 20 20 20 20 20  | r1, #31        |
000111c0  20 20 20 20 20 20 20 20  20 3b 20 49 73 20 68 6f  |         ; Is ho|
000111d0  74 73 70 6f 74 20 77 69  74 68 69 6e 20 74 68 65  |tspot within the|
000111e0  20 70 6f 69 6e 74 65 72  0d 2e 7c 50 20 20 20 20  | pointer..|P    |
000111f0  20 20 20 20 4d 4f 56 47  54 20 20 20 72 31 2c 20  |    MOVGT   r1, |
00011200  23 33 31 20 20 20 20 20  20 20 20 20 20 20 20 20  |#31             |
00011210  20 20 20 20 3b 20 52 65  73 74 72 69 63 74 20 68  |    ; Restrict h|
00011220  6f 74 73 70 6f 74 20 74  6f 20 77 69 74 68 69 6e  |otspot to within|
00011230  20 70 6f 69 6e 74 65 72  0d 2e 86 4c 20 20 20 20  | pointer...L    |
00011240  20 20 20 20 53 54 52 42  20 20 20 20 72 30 2c 20  |    STRB    r0, |
00011250  5b 72 31 32 2c 20 23 77  73 5f 70 74 72 5f 62 6c  |[r12, #ws_ptr_bl|
00011260  6f 63 6b 5f 61 63 74 69  76 65 79 5d 3b 20 53 74  |ock_activey]; St|
00011270  6f 72 65 20 76 65 72 74  69 63 61 6c 20 68 6f 74  |ore vertical hot|
00011280  73 70 6f 74 0d 2e 90 4e  20 20 20 20 20 20 20 20  |spot...N        |
00011290  53 54 52 42 20 20 20 20  72 31 2c 20 5b 72 31 32  |STRB    r1, [r12|
000112a0  2c 20 23 77 73 5f 70 74  72 5f 62 6c 6f 63 6b 5f  |, #ws_ptr_block_|
000112b0  61 63 74 69 76 65 78 5d  3b 20 53 74 6f 72 65 20  |activex]; Store |
000112c0  68 6f 72 69 7a 6f 6e 74  61 6c 20 68 6f 74 73 70  |horizontal hotsp|
000112d0  6f 74 0d 2e 9a 13 2e 74  72 61 6e 73 5f 66 69 74  |ot.....trans_fit|
000112e0  5f 64 6f 6e 65 0d 2e a4  44 20 20 20 20 20 20 20  |_done...D       |
000112f0  20 4c 44 4d 46 44 20 20  20 72 31 33 21 2c 20 7b  | LDMFD   r13!, {|
00011300  72 30 2d 72 31 30 2c 20  70 63 7d 20 20 20 20 20  |r0-r10, pc}     |
00011310  20 3b 20 52 65 74 75 72  6e 20 66 72 6f 6d 20 73  | ; Return from s|
00011320  75 62 72 6f 75 74 69 6e  65 0d 2e ae 04 0d 2e b8  |ubroutine.......|
00011330  4e 20 20 20 20 20 20 20  20 3b 20 52 6f 74 61 74  |N        ; Rotat|
00011340  65 20 72 30 20 63 6f 6f  72 64 69 6e 61 74 65 73  |e r0 coordinates|
00011350  20 66 72 6f 6d 20 61 74  20 72 31 20 74 6f 20 61  | from at r1 to a|
00011360  74 20 72 32 20 77 69 74  68 20 76 65 72 74 69 63  |t r2 with vertic|
00011370  61 6c 20 28 72 34 2c 20  72 33 29 0d 2e c2 11 2e  |al (r4, r3).....|
00011380  74 72 61 6e 73 5f 72 6f  74 61 74 65 0d 2e cc 3d  |trans_rotate...=|
00011390  20 20 20 20 20 20 20 20  53 54 4d 46 44 20 20 20  |        STMFD   |
000113a0  72 31 33 21 2c 20 7b 72  30 2d 72 38 2c 20 72 31  |r13!, {r0-r8, r1|
000113b0  34 7d 20 20 20 20 20 20  3b 20 53 74 61 63 6b 20  |4}      ; Stack |
000113c0  72 65 67 69 73 74 65 72  73 0d 2e d6 3d 20 20 20  |registers...=   |
000113d0  20 20 20 20 20 53 54 4d  46 44 20 20 20 72 31 33  |     STMFD   r13|
000113e0  21 2c 20 7b 72 30 2d 72  31 7d 20 20 20 20 20 20  |!, {r0-r1}      |
000113f0  20 20 20 20 20 3b 20 53  74 61 63 6b 20 72 65 67  |     ; Stack reg|
00011400  69 73 74 65 72 73 0d 2e  e0 3f 20 20 20 20 20 20  |isters...?      |
00011410  20 20 4d 4f 56 20 20 20  20 20 72 30 2c 20 72 33  |  MOV     r0, r3|
00011420  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00011430  20 20 3b 20 43 6f 70 79  20 76 65 72 74 69 63 61  |  ; Copy vertica|
00011440  6c 20 72 6f 77 0d 2e ea  42 20 20 20 20 20 20 20  |l row...B       |
00011450  20 4d 4f 56 20 20 20 20  20 72 31 2c 20 72 34 20  | MOV     r1, r4 |
00011460  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00011470  20 3b 20 43 6f 70 79 20  76 65 72 74 69 63 61 6c  | ; Copy vertical|
00011480  20 63 6f 6c 75 6d 6e 0d  2e f4 4b 20 20 20 20 20  | column...K     |
00011490  20 20 20 42 4c 20 20 20  20 20 20 6e 6f 72 6d 61  |   BL      norma|
000114a0  6c 69 73 65 20 20 20 20  20 20 20 20 20 20 20 20  |lise            |
000114b0  20 20 20 3b 20 4e 6f 72  6d 61 6c 69 73 65 20 74  |   ; Normalise t|
000114c0  68 65 20 76 65 72 74 69  63 61 6c 20 76 65 63 74  |he vertical vect|
000114d0  6f 72 0d 2e fe 4b 20 20  20 20 20 20 20 20 4d 4f  |or...K        MO|
000114e0  56 20 20 20 20 20 72 33  2c 20 72 30 2c 20 41 53  |V     r3, r0, AS|
000114f0  52 23 38 20 20 20 20 20  20 20 20 20 20 20 3b 20  |R#8           ; |
00011500  43 6f 70 79 20 61 6e 64  20 73 63 61 6c 65 20 6e  |Copy and scale n|
00011510  6f 72 6d 61 6c 69 73 65  64 20 72 6f 77 0d 2f 08  |ormalised row./.|
00011520  4e 20 20 20 20 20 20 20  20 4d 4f 56 20 20 20 20  |N        MOV    |
00011530  20 72 34 2c 20 72 31 2c  20 41 53 52 23 38 20 20  | r4, r1, ASR#8  |
00011540  20 20 20 20 20 20 20 20  20 3b 20 43 6f 70 79 20  |         ; Copy |
00011550  61 6e 64 20 73 63 61 6c  65 20 6e 6f 72 6d 61 6c  |and scale normal|
00011560  69 73 65 64 20 63 6f 6c  75 6d 6e 0d 2f 12 3f 20  |ised column./.? |
00011570  20 20 20 20 20 20 20 4c  44 4d 46 44 20 20 20 72  |       LDMFD   r|
00011580  31 33 21 2c 20 7b 72 30  2d 72 31 7d 20 20 20 20  |13!, {r0-r1}    |
00011590  20 20 20 20 20 20 20 3b  20 52 65 73 74 6f 72 65  |       ; Restore|
000115a0  20 72 65 67 69 73 74 65  72 73 0d 2f 1c 16 2e 74  | registers./...t|
000115b0  72 61 6e 73 5f 72 6f 74  61 74 65 5f 6c 6f 6f 70  |rans_rotate_loop|
000115c0  0d 2f 26 4d 20 20 20 20  20 20 20 20 53 55 42 53  |./&M        SUBS|
000115d0  20 20 20 20 72 30 2c 20  72 30 2c 20 23 31 20 20  |    r0, r0, #1  |
000115e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 44 65  |            ; De|
000115f0  63 72 65 6d 65 6e 74 20  6e 75 6d 62 65 72 20 6f  |crement number o|
00011600  66 20 63 6f 6f 72 64 69  6e 61 74 65 73 0d 2f 30  |f coordinates./0|
00011610  52 20 20 20 20 20 20 20  20 4c 44 4d 4d 49 46 44  |R        LDMMIFD|
00011620  20 72 31 33 21 2c 20 7b  72 30 2d 72 38 2c 20 70  | r13!, {r0-r8, p|
00011630  63 7d 20 20 20 20 20 20  20 3b 20 52 65 74 75 72  |c}       ; Retur|
00011640  6e 20 66 72 6f 6d 20 73  75 62 72 6f 75 74 69 6e  |n from subroutin|
00011650  65 20 77 68 65 6e 20 66  69 6e 69 73 68 65 64 0d  |e when finished.|
00011660  2f 3a 4b 20 20 20 20 20  20 20 20 4c 44 4d 49 41  |/:K        LDMIA|
00011670  20 20 20 72 31 21 2c 20  7b 72 35 2d 72 36 7d 20  |   r1!, {r5-r6} |
00011680  20 20 20 20 20 20 20 20  20 20 20 3b 20 52 65 61  |           ; Rea|
00011690  64 20 74 68 65 20 6e 65  78 74 20 63 6f 6f 72 64  |d the next coord|
000116a0  69 6e 61 74 65 20 70 61  69 72 0d 2f 44 45 20 20  |inate pair./DE  |
000116b0  20 20 20 20 20 20 4d 4f  56 20 20 20 20 20 72 35  |      MOV     r5|
000116c0  2c 20 72 35 2c 20 41 53  52 23 38 20 20 20 20 20  |, r5, ASR#8     |
000116d0  20 20 20 20 20 20 3b 20  50 72 65 73 63 61 6c 65  |      ; Prescale|
000116e0  20 74 68 65 20 72 6f 77  20 6e 75 6d 62 65 72 0d  | the row number.|
000116f0  2f 4e 48 20 20 20 20 20  20 20 20 4d 4f 56 20 20  |/NH        MOV  |
00011700  20 20 20 72 36 2c 20 72  36 2c 20 41 53 52 23 38  |   r6, r6, ASR#8|
00011710  20 20 20 20 20 20 20 20  20 20 20 3b 20 50 72 65  |           ; Pre|
00011720  73 63 61 6c 65 20 74 68  65 20 63 6f 6c 75 6d 6e  |scale the column|
00011730  20 6e 75 6d 62 65 72 0d  2f 58 3f 20 20 20 20 20  | number./X?     |
00011740  20 20 20 4d 55 4c 20 20  20 20 20 72 37 2c 20 72  |   MUL     r7, r|
00011750  35 2c 20 72 33 20 20 20  20 20 20 20 20 20 20 20  |5, r3           |
00011760  20 20 20 3b 20 52 6f 74  61 74 65 20 72 6f 77 20  |   ; Rotate row |
00011770  74 6f 20 72 6f 77 0d 2f  62 4a 20 20 20 20 20 20  |to row./bJ      |
00011780  20 20 52 53 42 20 20 20  20 20 72 37 2c 20 72 37  |  RSB     r7, r7|
00011790  2c 20 23 30 20 20 20 20  20 20 20 20 20 20 20 20  |, #0            |
000117a0  20 20 3b 20 43 6f 72 72  65 63 74 20 73 69 67 6e  |  ; Correct sign|
000117b0  20 6f 66 20 72 6f 77 20  72 6f 74 61 74 69 6f 6e  | of row rotation|
000117c0  0d 2f 6c 42 20 20 20 20  20 20 20 20 4d 55 4c 20  |./lB        MUL |
000117d0  20 20 20 20 72 38 2c 20  72 35 2c 20 72 34 20 20  |    r8, r5, r4  |
000117e0  20 20 20 20 20 20 20 20  20 20 20 20 3b 20 52 6f  |            ; Ro|
000117f0  74 61 74 65 20 72 6f 77  20 74 6f 20 63 6f 6c 75  |tate row to colu|
00011800  6d 6e 0d 2f 76 42 20 20  20 20 20 20 20 20 4d 4c  |mn./vB        ML|
00011810  41 20 20 20 20 20 72 37  2c 20 72 36 2c 20 72 34  |A     r7, r6, r4|
00011820  2c 20 72 37 20 20 20 20  20 20 20 20 20 20 3b 20  |, r7          ; |
00011830  52 6f 74 61 74 65 20 63  6f 6c 75 6d 6e 20 74 6f  |Rotate column to|
00011840  20 72 6f 77 0d 2f 80 45  20 20 20 20 20 20 20 20  | row./.E        |
00011850  4d 4c 41 20 20 20 20 20  72 38 2c 20 72 36 2c 20  |MLA     r8, r6, |
00011860  72 33 2c 20 72 38 20 20  20 20 20 20 20 20 20 20  |r3, r8          |
00011870  3b 20 52 6f 74 61 74 65  20 63 6f 6c 75 6d 6e 20  |; Rotate column |
00011880  74 6f 20 63 6f 6c 75 6d  6e 0d 2f 8a 4d 20 20 20  |to column./.M   |
00011890  20 20 20 20 20 52 53 42  20 20 20 20 20 72 38 2c  |     RSB     r8,|
000118a0  20 72 38 2c 20 23 30 20  20 20 20 20 20 20 20 20  | r8, #0         |
000118b0  20 20 20 20 20 3b 20 43  6f 72 72 65 63 74 20 73  |     ; Correct s|
000118c0  69 67 6e 20 6f 66 20 63  6f 6c 75 6d 6e 20 72 6f  |ign of column ro|
000118d0  74 61 74 69 6f 6e 0d 2f  94 4f 20 20 20 20 20 20  |tation./.O      |
000118e0  20 20 53 54 4d 49 41 20  20 20 72 32 21 2c 20 7b  |  STMIA   r2!, {|
000118f0  72 37 2d 72 38 7d 20 20  20 20 20 20 20 20 20 20  |r7-r8}          |
00011900  20 20 3b 20 57 72 69 74  65 20 74 68 65 20 74 72  |  ; Write the tr|
00011910  61 6e 73 66 6f 72 6d 65  64 20 63 6f 6f 72 64 69  |ansformed coordi|
00011920  6e 61 74 65 73 0d 2f 9e  4e 20 20 20 20 20 20 20  |nates./.N       |
00011930  20 42 20 20 20 20 20 20  20 74 72 61 6e 73 5f 72  | B       trans_r|
00011940  6f 74 61 74 65 5f 6c 6f  6f 70 20 20 20 20 20 20  |otate_loop      |
00011950  20 3b 20 4b 65 65 70 20  6c 6f 6f 70 69 6e 67 20  | ; Keep looping |
00011960  75 6e 74 69 6c 20 61 6c  6c 20 70 72 6f 63 65 73  |until all proces|
00011970  73 65 64 0d 2f a8 04 0d  2f b2 52 20 20 20 20 20  |sed./.../.R     |
00011980  20 20 20 3b 20 41 64 64  20 72 30 20 63 6f 6f 72  |   ; Add r0 coor|
00011990  64 69 6e 61 74 65 73 20  61 74 20 72 31 20 74 6f  |dinates at r1 to|
000119a0  20 72 33 20 66 72 61 63  74 69 6f 6e 20 6f 66 20  | r3 fraction of |
000119b0  74 68 6f 73 65 20 61 74  20 72 32 20 74 6f 20 67  |those at r2 to g|
000119c0  69 76 65 20 61 74 20 72  34 0d 2f bc 0e 2e 74 72  |ive at r4./...tr|
000119d0  61 6e 73 5f 61 64 64 0d  2f c6 3d 20 20 20 20 20  |ans_add./.=     |
000119e0  20 20 20 53 54 4d 46 44  20 20 20 72 31 33 21 2c  |   STMFD   r13!,|
000119f0  20 7b 72 30 2d 72 38 2c  20 72 31 34 7d 20 20 20  | {r0-r8, r14}   |
00011a00  20 20 20 3b 20 53 74 61  63 6b 20 72 65 67 69 73  |   ; Stack regis|
00011a10  74 65 72 73 0d 2f d0 4c  20 20 20 20 20 20 20 20  |ters./.L        |
00011a20  4d 4f 56 20 20 20 20 20  72 33 2c 20 72 33 2c 20  |MOV     r3, r3, |
00011a30  41 53 52 23 38 20 20 20  20 20 20 20 20 20 20 20  |ASR#8           |
00011a40  3b 20 50 72 65 73 63 61  6c 65 20 74 68 65 20 72  |; Prescale the r|
00011a50  65 71 75 69 72 65 64 20  66 72 61 63 74 69 6f 6e  |equired fraction|
00011a60  0d 2f da 13 2e 74 72 61  6e 73 5f 61 64 64 5f 6c  |./...trans_add_l|
00011a70  6f 6f 70 0d 2f e4 4d 20  20 20 20 20 20 20 20 53  |oop./.M        S|
00011a80  55 42 53 20 20 20 20 72  30 2c 20 72 30 2c 20 23  |UBS    r0, r0, #|
00011a90  31 20 20 20 20 20 20 20  20 20 20 20 20 20 20 3b  |1              ;|
00011aa0  20 44 65 63 72 65 6d 65  6e 74 20 6e 75 6d 62 65  | Decrement numbe|
00011ab0  72 20 6f 66 20 63 6f 6f  72 64 69 6e 61 74 65 73  |r of coordinates|
00011ac0  0d 2f ee 52 20 20 20 20  20 20 20 20 4c 44 4d 4d  |./.R        LDMM|
00011ad0  49 46 44 20 72 31 33 21  2c 20 7b 72 30 2d 72 38  |IFD r13!, {r0-r8|
00011ae0  2c 20 70 63 7d 20 20 20  20 20 20 20 3b 20 52 65  |, pc}       ; Re|
00011af0  74 75 72 6e 20 66 72 6f  6d 20 73 75 62 72 6f 75  |turn from subrou|
00011b00  74 69 6e 65 20 77 68 65  6e 20 66 69 6e 69 73 68  |tine when finish|
00011b10  65 64 0d 2f f8 4b 20 20  20 20 20 20 20 20 4c 44  |ed./.K        LD|
00011b20  4d 49 41 20 20 20 72 31  21 2c 20 7b 72 35 2d 72  |MIA   r1!, {r5-r|
00011b30  36 7d 20 20 20 20 20 20  20 20 20 20 20 20 3b 20  |6}            ; |
00011b40  52 65 61 64 20 74 68 65  20 6f 72 69 67 69 6e 61  |Read the origina|
00011b50  6c 20 63 6f 6f 72 64 69  6e 61 74 65 73 0d 30 02  |l coordinates.0.|
00011b60  46 20 20 20 20 20 20 20  20 4c 44 4d 49 41 20 20  |F        LDMIA  |
00011b70  20 72 32 21 2c 20 7b 72  37 2d 72 38 7d 20 20 20  | r2!, {r7-r8}   |
00011b80  20 20 20 20 20 20 20 20  20 3b 20 52 65 61 64 20  |         ; Read |
00011b90  74 68 65 20 6e 65 77 20  63 6f 6f 72 64 69 6e 61  |the new coordina|
00011ba0  74 65 73 0d 30 0c 49 20  20 20 20 20 20 20 20 4d  |tes.0.I        M|
00011bb0  4f 56 20 20 20 20 20 72  37 2c 20 72 37 2c 20 41  |OV     r7, r7, A|
00011bc0  53 52 23 38 20 20 20 20  20 20 20 20 20 20 20 3b  |SR#8           ;|
00011bd0  20 50 72 65 73 63 61 6c  65 20 74 68 65 20 6e 65  | Prescale the ne|
00011be0  77 20 72 6f 77 20 6e 75  6d 62 65 72 0d 30 16 4c  |w row number.0.L|
00011bf0  20 20 20 20 20 20 20 20  4d 4f 56 20 20 20 20 20  |        MOV     |
00011c00  72 38 2c 20 72 38 2c 20  41 53 52 23 38 20 20 20  |r8, r8, ASR#8   |
00011c10  20 20 20 20 20 20 20 20  3b 20 50 72 65 73 63 61  |        ; Presca|
00011c20  6c 65 20 74 68 65 20 6e  65 77 20 63 6f 6c 75 6d  |le the new colum|
00011c30  6e 20 6e 75 6d 62 65 72  0d 30 20 4b 20 20 20 20  |n number.0 K    |
00011c40  20 20 20 20 4d 4c 41 20  20 20 20 20 72 35 2c 20  |    MLA     r5, |
00011c50  72 37 2c 20 72 33 2c 20  72 35 20 20 20 20 20 20  |r7, r3, r5      |
00011c60  20 20 20 20 3b 20 41 64  64 20 74 68 65 20 72 65  |    ; Add the re|
00011c70  71 75 69 72 65 64 20 72  6f 77 20 66 72 61 63 74  |quired row fract|
00011c80  69 6f 6e 0d 30 2a 4e 20  20 20 20 20 20 20 20 4d  |ion.0*N        M|
00011c90  4c 41 20 20 20 20 20 72  36 2c 20 72 38 2c 20 72  |LA     r6, r8, r|
00011ca0  33 2c 20 72 36 20 20 20  20 20 20 20 20 20 20 3b  |3, r6          ;|
00011cb0  20 41 64 64 20 74 68 65  20 72 65 71 75 69 72 65  | Add the require|
00011cc0  64 20 63 6f 6c 75 6d 6e  20 66 72 61 63 74 69 6f  |d column fractio|
00011cd0  6e 0d 30 34 4b 20 20 20  20 20 20 20 20 53 54 4d  |n.04K        STM|
00011ce0  49 41 20 20 20 72 34 21  2c 20 7b 72 35 2d 72 36  |IA   r4!, {r5-r6|
00011cf0  7d 20 20 20 20 20 20 20  20 20 20 20 20 3b 20 57  |}            ; W|
00011d00  72 69 74 65 20 74 68 65  20 75 70 64 61 74 65 64  |rite the updated|
00011d10  20 63 6f 6f 72 64 69 6e  61 74 65 73 0d 30 3e 4e  | coordinates.0>N|
00011d20  20 20 20 20 20 20 20 20  42 20 20 20 20 20 20 20  |        B       |
00011d30  74 72 61 6e 73 5f 61 64  64 5f 6c 6f 6f 70 20 20  |trans_add_loop  |
00011d40  20 20 20 20 20 20 20 20  3b 20 4b 65 65 70 20 6c  |        ; Keep l|
00011d50  6f 6f 70 69 6e 67 20 75  6e 74 69 6c 20 61 6c 6c  |ooping until all|
00011d60  20 70 72 6f 63 65 73 73  65 64 0d 30 48 04 0d 30  | processed.0H..0|
00011d70  52 09 20 20 20 20 5d 0d  30 5c 05 ed 0d 30 66 04  |R.    ].0\...0f.|
00011d80  0d 30 70 1f f4 20 53 61  76 65 20 74 68 65 20 72  |.0p.. Save the r|
00011d90  65 73 75 6c 74 69 6e 67  20 6d 6f 64 75 6c 65 0d  |esulting module.|
00011da0  30 7a 39 c8 99 20 22 4f  53 5f 46 69 6c 65 22 2c  |0z9.. "OS_File",|
00011db0  20 31 30 2c 20 66 69 6c  65 6e 61 6d 65 24 2c 20  | 10, filename$, |
00011dc0  26 66 66 41 2c 2c 20 63  6f 64 65 25 2c 20 63 6f  |&ffA,, code%, co|
00011dd0  64 65 25 20 2b 20 50 25  0d 30 84 05 e0 0d 30 8e  |de% + P%.0....0.|
00011de0  04 0d 30 98 32 f4 20 54  68 65 20 6e 61 6d 65 20  |..0.2. The name |
00011df0  61 6e 64 20 63 6f 72 72  65 73 70 6f 6e 64 69 6e  |and correspondin|
00011e00  67 20 74 79 70 65 20 6f  66 20 61 20 70 6f 69 6e  |g type of a poin|
00011e10  74 65 72 0d 30 a2 1b dd  a4 70 6f 69 6e 74 65 72  |ter.0....pointer|
00011e20  28 6e 61 6d 65 24 2c 20  74 79 70 65 25 29 0d 30  |(name$, type%).0|
00011e30  ac 11 20 20 20 20 5b 4f  50 54 20 6f 70 74 25 0d  |..    [OPT opt%.|
00011e40  30 b6 2f 20 20 20 20 20  20 20 20 45 51 55 53 20  |0./        EQUS |
00011e50  20 20 20 6e 61 6d 65 24  20 2b 20 c4 31 32 20 2d  |   name$ + .12 -|
00011e60  20 a9 28 6e 61 6d 65 24  29 2c 20 bd 30 29 0d 30  | .(name$), .0).0|
00011e70  c0 19 20 20 20 20 20 20  20 20 45 51 55 44 20 20  |..        EQUD  |
00011e80  20 20 74 79 70 65 25 0d  30 ca 09 20 20 20 20 5d  |  type%.0..    ]|
00011e90  0d 30 d4 07 3d 20 30 0d  30 de 04 0d 30 e8 29 f4  |.0..= 0.0...0.).|
00011ea0  20 4c 69 74 65 72 61 6c  20 66 69 78 65 64 20 70  | Literal fixed p|
00011eb0  6f 69 6e 74 20 63 6f 6f  72 64 69 6e 61 74 65 20  |oint coordinate |
00011ec0  70 61 69 72 0d 30 f2 1d  dd a4 63 6f 6f 72 64 69  |pair.0....coordi|
00011ed0  6e 61 74 65 28 72 6f 77  2c 20 63 6f 6c 75 6d 6e  |nate(row, column|
00011ee0  29 0d 30 fc 11 20 20 20  20 5b 4f 50 54 20 6f 70  |).0..    [OPT op|
00011ef0  74 25 0d 31 06 26 20 20  20 20 20 20 20 20 45 51  |t%.1.&        EQ|
00011f00  55 44 20 20 20 20 a8 28  72 6f 77 20 2a 20 28 31  |UD    .(row * (1|
00011f10  20 3c 3c 20 31 36 29 29  0d 31 10 29 20 20 20 20  | << 16)).1.)    |
00011f20  20 20 20 20 45 51 55 44  20 20 20 20 a8 28 63 6f  |    EQUD    .(co|
00011f30  6c 75 6d 6e 20 2a 20 28  31 20 3c 3c 20 31 36 29  |lumn * (1 << 16)|
00011f40  29 0d 31 1a 09 20 20 20  20 5d 0d 31 24 07 3d 20  |).1..    ].1$.= |
00011f50  30 0d 31 2e 04 0d 31 38  2c f4 20 52 65 61 64 20  |0.1...18,. Read |
00011f60  61 20 77 6f 72 64 20 66  72 6f 6d 20 61 20 6e 6f  |a word from a no|
00011f70  6e 2d 61 6c 69 67 6e 65  64 20 61 64 64 72 65 73  |n-aligned addres|
00011f80  73 0d 31 42 1a dd a4 6c  64 72 75 28 72 64 2c 20  |s.1B...ldru(rd, |
00011f90  72 61 2c 20 72 62 2c 20  72 63 29 0d 31 4c 11 20  |ra, rb, rc).1L. |
00011fa0  20 20 20 5b 4f 50 54 20  6f 70 74 25 0d 31 56 47  |   [OPT opt%.1VG|
00011fb0  20 20 20 20 20 20 20 20  42 49 43 20 20 20 20 20  |        BIC     |
00011fc0  72 62 2c 20 72 61 2c 20  23 33 20 20 20 20 20 20  |rb, ra, #3      |
00011fd0  20 20 20 20 20 20 20 20  3b 20 47 65 74 20 77 6f  |        ; Get wo|
00011fe0  72 64 20 61 6c 69 67 6e  65 64 20 61 64 64 72 65  |rd aligned addre|
00011ff0  73 73 20 0d 31 60 4b 20  20 20 20 20 20 20 20 4c  |ss .1`K        L|
00012000  44 4d 49 41 20 20 20 72  62 2c 20 7b 72 64 2c 20  |DMIA   rb, {rd, |
00012010  72 63 7d 20 20 20 20 20  20 20 20 20 20 20 20 3b  |rc}            ;|
00012020  20 47 65 74 20 36 34 20  62 69 74 73 20 63 6f 6e  | Get 64 bits con|
00012030  74 61 69 6e 69 6e 67 20  61 6e 73 77 65 72 0d 31  |taining answer.1|
00012040  6a 46 20 20 20 20 20 20  20 20 80 20 20 20 20 20  |jF        .     |
00012050  72 62 2c 20 72 61 2c 20  23 33 20 20 20 20 20 20  |rb, ra, #3      |
00012060  20 20 20 20 20 20 20 20  3b 20 43 6f 72 72 65 63  |        ; Correc|
00012070  74 69 6f 6e 20 66 61 63  74 6f 72 20 69 6e 20 62  |tion factor in b|
00012080  79 74 65 73 0d 31 74 4e  20 20 20 20 20 20 20 20  |ytes.1tN        |
00012090  4d 4f 56 53 20 20 20 20  72 62 2c 20 72 62 2c 20  |MOVS    rb, rb, |
000120a0  4c 53 4c 23 33 20 20 20  20 20 20 20 20 20 20 20  |LSL#3           |
000120b0  3b 20 61 6e 64 20 69 6e  20 62 69 74 73 2c 20 73  |; and in bits, s|
000120c0  6f 20 63 68 65 63 6b 20  69 66 20 61 6c 69 67 6e  |o check if align|
000120d0  65 64 0d 31 7e 53 20 20  20 20 20 20 20 20 4d 4f  |ed.1~S        MO|
000120e0  56 4e 45 20 20 20 72 64  2c 20 72 64 2c 20 4c 53  |VNE   rd, rd, LS|
000120f0  52 20 72 62 20 20 20 20  20 20 20 20 20 20 3b 20  |R rb          ; |
00012100  49 66 20 6e 6f 74 2c 20  70 72 6f 64 75 63 65 20  |If not, produce |
00012110  62 6f 74 74 6f 6d 20 62  69 74 73 20 6f 66 20 72  |bottom bits of r|
00012120  65 73 75 6c 74 0d 31 88  44 20 20 20 20 20 20 20  |esult.1.D       |
00012130  20 52 53 42 4e 45 20 20  20 72 62 2c 20 72 62 2c  | RSBNE   rb, rb,|
00012140  20 23 33 32 20 20 20 20  20 20 20 20 20 20 20 20  | #32            |
00012150  20 3b 20 47 65 74 20 6f  74 68 65 72 20 73 68 69  | ; Get other shi|
00012160  66 74 20 61 6d 6f 75 6e  74 0d 31 92 4a 20 20 20  |ft amount.1.J   |
00012170  20 20 20 20 20 84 52 4e  45 20 20 20 72 64 2c 20  |     .RNE   rd, |
00012180  72 64 2c 20 72 63 2c 20  4c 53 4c 20 72 62 20 20  |rd, rc, LSL rb  |
00012190  20 20 20 20 3b 20 43 6f  6d 62 69 6e 65 20 74 77  |    ; Combine tw|
000121a0  6f 20 68 61 6c 76 65 73  20 66 6f 72 20 72 65 73  |o halves for res|
000121b0  75 6c 74 0d 31 9c 09 20  20 20 20 5d 0d 31 a6 07  |ult.1..    ].1..|
000121c0  3d 20 30 0d ff                                    |= 0..|
000121c5