Commit fb470162 authored by Neil Turton's avatar Neil Turton
Browse files

NCOS 1.06 Imported from Zip drive

parent 9fd2629a
No preview for this file type
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
GBLS VString GBLS VString
GBLS Date GBLS Date
Version SETA 033 ; 007 Version SETA 034 ; 007
VString SETS "0.33" ; "0.07" VString SETS "0.34" ; "0.07"
Date SETS "17 Nov 1994" ; "08 Aug 1988" Date SETS "24 Jan 1995" ; "08 Aug 1988"
END END
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
;; Fix syntax of *Obey command - there *must*not* be ;; Fix syntax of *Obey command - there *must*not* be
;; any space between the -c and the -v ;; any space between the -c and the -v
;; Fix BuffOflow tag to BufOFlo ;; Fix BuffOflow tag to BufOFlo
;; 24-Jan-95 0.34 OM SPECIAL VERSION: -m flag allows caching from a block of memory
;; instead of a file.
;;---------------------------------------------------------------------------- ;;----------------------------------------------------------------------------
Module_BaseAddr Module_BaseAddr
...@@ -131,7 +133,7 @@ Obey_Help DCB "*Obey executes a file of *commands, " ...@@ -131,7 +133,7 @@ Obey_Help DCB "*Obey executes a file of *commands, "
DCB ". Prefixing the filename with -v causes each line to be " DCB ". Prefixing the filename with -v causes each line to be "
DCB "echoed before execution, -c causes the file to be cached and executed from memory" DCB "echoed before execution, -c causes the file to be cached and executed from memory"
DCB 13, 10 DCB 13, 10
Obey_Syntax DCB "Syntax: *Obey [[-v][-c] [<filename> [<parameters>]]]",0 Obey_Syntax DCB "Syntax: *Obey [[-v][-c][-m] [<filename> [<parameters>]]]",0
| |
Messages_File DCB "Resources:Resources.Obey.Messages",0 Messages_File DCB "Resources:Resources.Obey.Messages",0
Obey_Help DCB "HOBYOBY", 0 Obey_Help DCB "HOBYOBY", 0
...@@ -157,6 +159,7 @@ wk_fl_useexit * 1:SHL:1 ; Set <=> OS_Exit has been used to finish a comm ...@@ -157,6 +159,7 @@ wk_fl_useexit * 1:SHL:1 ; Set <=> OS_Exit has been used to finish a comm
wk_fl_verbose * 1:SHL:2 ; Set <=> verbose flag specified wk_fl_verbose * 1:SHL:2 ; Set <=> verbose flag specified
wk_fl_cache * 1:SHL:3 ; Set <=> cache flag set wk_fl_cache * 1:SHL:3 ; Set <=> cache flag set
wk_fl_ResFS * 1:SHL:4 ; Set <=> cache block is in resourceFS wk_fl_ResFS * 1:SHL:4 ; Set <=> cache block is in resourceFS
wk_fl_memory * 1:SHL:5 ; Set <=> cache "file" from memory into RMA
wk_private # 4 ; Back pointer to private word wk_private # 4 ; Back pointer to private word
wk_handle # 4 wk_handle # 4
wk_oldquitR1 # 4 wk_oldquitR1 # 4
...@@ -1016,6 +1019,7 @@ decode_commands ROUT ...@@ -1016,6 +1019,7 @@ decode_commands ROUT
LowerCase R2,LR ; convert to suitable character LowerCase R2,LR ; convert to suitable character
TEQ R2,#"c" TEQ R2,#"c"
TEQNE R2,#"v" ; cache of verbose? TEQNE R2,#"v" ; cache of verbose?
TEQNE R2,#"m" ; or memory-based?
BNE %80 BNE %80
LDR lr, [r11, #wk_flags] LDR lr, [r11, #wk_flags]
...@@ -1023,6 +1027,8 @@ decode_commands ROUT ...@@ -1023,6 +1027,8 @@ decode_commands ROUT
ORREQ lr, lr, #wk_fl_cache ORREQ lr, lr, #wk_fl_cache
TEQ R2,#"v" TEQ R2,#"v"
ORREQ lr, lr, #wk_fl_verbose ORREQ lr, lr, #wk_fl_verbose
TEQ R2,#"m"
ORREQ lr, lr, #wk_fl_memory
STR lr, [r11, #wk_flags] STR lr, [r11, #wk_flags]
ADD R0,R0,#2 ; skip to next command sequence ADD R0,R0,#2 ; skip to next command sequence
...@@ -1044,6 +1050,8 @@ decode_commands ROUT ...@@ -1044,6 +1050,8 @@ decode_commands ROUT
; r1 -> filename to be opened/loaded, r11 -> record for object. ; r1 -> filename to be opened/loaded, r11 -> record for object.
; ;
; if wk_fl_cache set in wk_flags then file is cached, else simply opened ; if wk_fl_cache set in wk_flags then file is cached, else simply opened
; if wk_fl_memory set in wk_flags, then the "filename" is really the address of
; a 0-terminated block of memory. This is cached into a block of RMA.
; ;
; This routine will try and open the file if the cache block is =0, otherwise ; This routine will try and open the file if the cache block is =0, otherwise
; =-1 then it will attempt to create a block of RMA and then read it in. ; =-1 then it will attempt to create a block of RMA and then read it in.
...@@ -1053,6 +1061,10 @@ open_file ROUT ...@@ -1053,6 +1061,10 @@ open_file ROUT
Push "R1-R6,LR" Push "R1-R6,LR"
LDR r0, [r11, #wk_flags] ; Was the command -m address
TST r0, #wk_fl_memory
BNE cache_memory
MOV R0,#OSFind_ReadFile MOV R0,#OSFind_ReadFile
SWI XOS_Find ; r1 -> filename so attempt to open SWI XOS_Find ; r1 -> filename so attempt to open
Pull "R1-R6,PC", VS Pull "R1-R6,PC", VS
...@@ -1085,6 +1097,37 @@ ret_no_err ...@@ -1085,6 +1097,37 @@ ret_no_err
CLRV CLRV
Pull "R1-R6,PC" Pull "R1-R6,PC"
cache_memory
; R1 -> start of numeric string giving address of "file"
MOV R0, #10
ORR R0, R0, #1:SHL:31
SWI OS_ReadUnsigned
Pull "R1-R6,PC",VS
; Now R2 is the address of the "file", so count it (assume 0 termination)
MOV LR, R2 ; pointer
00
LDRB R1, [LR], #1
TEQ R1, #0 ; terminator reached?
BNE %BT00
SUB LR, LR, #1 ; Don't count the null
MOV R4, R2 ; keep original pointer handy
SUB R3, LR, R2 ; get length
MOV r0, #ModHandReason_Claim
SWI XOS_Module
Pull "R1-R6,PC",VS ; can't continue if no RMA
; Now copy the data across. Remember to store the address of the cache block
STR r3, [r11, #wk_ext]
STR r2, [r11, #wk_cacheblock]
01
LDRB lr, [r4], #1
TEQ lr, #0
STRNEB lr, [r2], #1
BNE %BT01
Pull "R1-R6,PC"
cache_file cache_file
; Attempt to cache the file - resort to uncached ; Attempt to cache the file - resort to uncached
; on most errors, except if the GBPB fails. ; on most errors, except if the GBPB fails.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment