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