; File : virtualise.s ; Date : 14-Dec-99 ; Author : © A.Thoukydides, 1995, 1996, 1997, 1998, 1999, 2016 ; Description : Dynamic area virtual memory manager module. ; This module will not operate in read only memory - it uses ; space in the module for variables. ; ; License : Virtualise is free software: you can redistribute it and/or ; modify it under the terms of the GNU General Public License ; as published by the Free Software Foundation, either ; version 3 of the License, or (at your option) any later ; version. ; ; Virtualise is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty ; of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ; the GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public ; License along with Virtualise. If not, see ; . ; To complete RISC OS 4 support requires: ; test_shrink$l Return the memory that can be freed ; handler_intercept Replace TestShrink if virtual memory ; start_virtualise Change &F70 to &D70 ; pre_add_intercept Change &F70 to &D70 ; create_dynamic Change &103 to &303 ; Include system header files GET OS:Hdr.FileSwitch GET OS:Hdr.Filter GET OS:Hdr.Hourglass GET OS:Hdr.Macros GET OS:Hdr.MessageTrans GET OS:Hdr.OS GET OS:Hdr.OSArgs GET OS:Hdr.OSByte GET OS:Hdr.OSFile GET OS:Hdr.OSFind GET OS:Hdr.OSFSControl GET OS:Hdr.OSGBPB GET OS:Hdr.OSHeap GET OS:Hdr.OSModule GET OS:Hdr.ResourceFS GET OS:Hdr.TaskManager GET OS:Hdr.Types GET OS:Hdr.Wimp GET OS:Hdr.WimpSpriteOp ; Include my header files GET AT:Hdr.macros ; Constants Vector_SWI * 2 ; Number of SWI vector Vector_DataAbort * 4 ; Number of Data abort vector min_spare_pages * 3 ; Minimum number of spare pages to keep auto_user_frac_shift * 15 ; Number of binary places for fraction auto_user_frac * 1 << (auto_user_frac_shift - 1); Default fract to claim auto_user_min * 1024 * 1000 ; Default minimum memory to claim auto_user_max * 1024 * 1024 * 256 ; Default maximum memory to claim auto_sw_free * 1024 * 1024 * 1 ; Default minimum memory to leave free auto_sw_min * 1024 * 1024 * 10 ; Default minimum memory to claim auto_sw_keep * 1024 * 512 ; Default minimum memory to keep auto_sw_disc * 1024 * 1024 * 5 ; Default minimum free disc space resource_directory DefS "Resources.Virtualise"; Directory to use in ResourceFS swi_chunk * &4B6C0 ; SWI chunk used by this module error_base * &80E100 ; The first error number to use area_flag_vm * 1 << 31 ; Area flag to inidcate virtual memory max_area_size * 256 * 1024 * 1024 ; Maximum size of area allowed min_pull_count * 2 ; Minimum page faults between resets shift_pull_count * 3 ; Shift to convert pages to delay mult_shift_pool * 4 ; Shift for multiple limit from pool mult_shift_logical * 3 ; Shift for multiple limit from logical mult_shift_physical * 2 ; Shift for multiple limit from physical cpsr_F * 1 << 6 ; F bit in CPSR cpsr_I * 1 << 7 ; I bit in CPSR cpsr_V * 1 << 28 ; V bit in CPSR cpsr_C * 1 << 29 ; C bit in CPSR cpsr_N * 1 << 30 ; N bit in CPSR cpsr_Z * 1 << 31 ; Z bit in CPSR I * 1 << 27 ; I bit in PC F * 1 << 26 ; F bit in PC guard_pre * &4D562A2F ; Guard word before memory block "/*VM" guard_post * &2F2A4D56 ; Guard word after memory block "VM*/" guard_clear_pre * &6D767B7B ; Guard word before memory block "{{vm" guard_clear_post * &7D7D6D76 ; Guard word after memory block "vm}}" debug DefL {FALSE} ; Should debugging code be included pipe DefL {FALSE} ; Should information be sent to a pipe assert DefL {TRUE} ; Should assertions be included [ {TRUE} demo_area1 DefS "ProArt24DEMO" ; Demo dynamic area name demo_area2 DefS "Compo canvasDEMO"; Demo dynamic area name demo_area3 DefS "Compo mask undoDEMO"; Demo dynamic area name demo_area4 DefS "Compo workspaceDEMO"; Demo dynamic area name demo_area5 DefS "Compo canvas undoDEMO"; Demo dynamic area name demo_area6 DefS "Compo text storeDEMO"; Demo dynamic area name demo_area7 DefS "Compo vector storeDEMO"; Demo dynamic area name demo_area8 DefS "Compo vignetteDEMO"; Demo dynamic area name | demo_area1 DefS "ProArt24" ; Demo dynamic area name demo_area2 DefS "Compo canvas" ; Demo dynamic area name demo_area3 DefS "Compo mask undo"; Demo dynamic area name demo_area4 DefS "Compo workspace"; Demo dynamic area name demo_area5 DefS "Compo canvas undo"; Demo dynamic area name demo_area6 DefS "Compo text store"; Demo dynamic area name demo_area7 DefS "Compo vector store"; Demo dynamic area name demo_area8 DefS "Compo vignette"; Demo dynamic area name ] replace_policy * policy_random \ :OR: policy_flags_reads \ :OR: policy_flags_writes ; Define an area to dump everything into AREA |main|, PIC, CODE, DATA ; Module header base & 0 ; Start offset & initialisation - base ; Initialisation offset & finalisation - base ; Finalisation offset & service - base ; Service call handler offset & title - base ; Title string offset & help - base ; Help string offset & commands - base ; Help and command keyword table offset & swi_chunk ; SWI chunk base number & swi_handler - base ; SWI handler code offset & swi_table - base ; SWI decoding table offset & 0 ; SWI decoding code offset ; Module title and version title = "Virtualise", 0 help = "Virtualise", 9, "1.17 (14 Dec 1999)" ; = " [TEST]" [ :DEF: demo = " [DEMO]" ] = " © A.Thoukydides, 1995, 1996, 1997, 1998, 1999", 0 ALIGN ; Syntax : [