Home » Archimedes archive » Acorn User » AU 1996-06.adf » Regulars » StarInfo/Jerome/Marriott/StripSrc

StarInfo/Jerome/Marriott/StripSrc

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1996-06.adf » Regulars
Filename: StarInfo/Jerome/Marriott/StripSrc
Read OK:
File size: 09FA bytes
Load address: 0000
Exec address: 0000
File contents
; Strip
;
; Strip control codes/top bit set chars from files
;
; Arguments - <input file> <output file> [-ctrl] [-top]
;
;
        #name   Strip

.Code_Start
        bl      Initialise
        blvc    Strip
        swi     XOS_Exit

.Initialise
        adr     r12,Code_End

        adr     r0,Message_Copyright
        swi     XOS_Write0
        swi     XOS_NewLine

        swi     XOS_GetEnv
        mov     r11,r0
        cmp     r1,#(32*1024)
        adrlt   r0,Error_LackOfMem
        swilt   XOS_Write0
        orrlts  r15,r14,#1<<28

.Find_Space
        ldrb    r0,[r11],#1
        cmp     r0,#0
        adreq   r0,Error_BadParams
        swieq   XOS_Write0
        orreqs  r15,r14,#1<<28
        cmp     r0,#32
        bne     Find_Space

        adr     r0,Arguments
        mov     r1,r11
        mov     r2,r12
        mov     r3,#512
        swi     XOS_ReadArgs
        addvs   r0,r0,#4
        swivs   XOS_Write0
        orrvss  r15,r14,#1<<28

        mov     r15,r14

.Arguments
        dcb     "/a,/a,ctrl/s,top/s",0
        align

.Message_Copyright
        dcb     "Strip � Nicholas Marriott 1995",0
        align

.Error_LackOfMem
        dcb     "Strip: Not enough memory",0
        align

.Error_BadParams
        dcb     "Strip: Bad parameters",0
        align

.Strip
        ldr     r10,[r12,#0]
        ldr     r11,[r12,#4]
        ldr     r8,[r12,#8]
        ldr     r9,[r12,#12]

        mov     r0,#&4F
        mov     r1,r10
        swi     XOS_Find
        mov     r10,r0
        addvs   r0,r0,#4
        swivs   XOS_Write0
        orrvss  r15,r14,#1<<28

        mov     r0,#&8F
        mov     r1,r11
        swi     XOS_Find
        mov     r11,r0
        addvs   r0,r0,#4
        swivs   XOS_Write0
        orrvss  r15,r14,#1<<28

.Strip_Loop
        mov     r0,#0
        mov     r1,r10
        swi     XOS_BGet

        mov     r7,r0

.Strip_Loop_Check_Ctrl
        cmp     r8,#0
        beq     Strip_Loop_Check_Top

        cmp     r7,#32
        blt     Strip_Loop_Next

.Strip_Loop_Check_Top
        cmp     r9,#0
        beq     Strip_Loop_Write

        cmp     r7,#127
        bgt     Strip_Loop_Next

.Strip_Loop_Write
        mov     r0,r7
        mov     r1,r11
        swi     XOS_BPut

.Strip_Loop_Next
        mov     r0,#5
        mov     r1,r10
        swi     XOS_Args
        cmp     r2,#0
        beq     Strip_Loop

        mov     r0,#&00
        mov     r1,r10
        swi     XOS_Find

        mov     r0,#&00
        mov     r1,r11
        swi     XOS_Find

        mov     r15,r14

.Code_End
00000000  3b 20 53 74 72 69 70 0a  3b 0a 3b 20 53 74 72 69  |; Strip.;.; Stri|
00000010  70 20 63 6f 6e 74 72 6f  6c 20 63 6f 64 65 73 2f  |p control codes/|
00000020  74 6f 70 20 62 69 74 20  73 65 74 20 63 68 61 72  |top bit set char|
00000030  73 20 66 72 6f 6d 20 66  69 6c 65 73 0a 3b 0a 3b  |s from files.;.;|
00000040  20 41 72 67 75 6d 65 6e  74 73 20 2d 20 3c 69 6e  | Arguments - <in|
00000050  70 75 74 20 66 69 6c 65  3e 20 3c 6f 75 74 70 75  |put file> <outpu|
00000060  74 20 66 69 6c 65 3e 20  5b 2d 63 74 72 6c 5d 20  |t file> [-ctrl] |
00000070  5b 2d 74 6f 70 5d 0a 3b  0a 3b 0a 20 20 20 20 20  |[-top].;.;.     |
00000080  20 20 20 23 6e 61 6d 65  20 20 20 53 74 72 69 70  |   #name   Strip|
00000090  0a 0a 2e 43 6f 64 65 5f  53 74 61 72 74 0a 20 20  |...Code_Start.  |
000000a0  20 20 20 20 20 20 62 6c  20 20 20 20 20 20 49 6e  |      bl      In|
000000b0  69 74 69 61 6c 69 73 65  0a 20 20 20 20 20 20 20  |itialise.       |
000000c0  20 62 6c 76 63 20 20 20  20 53 74 72 69 70 0a 20  | blvc    Strip. |
000000d0  20 20 20 20 20 20 20 73  77 69 20 20 20 20 20 58  |       swi     X|
000000e0  4f 53 5f 45 78 69 74 0a  0a 2e 49 6e 69 74 69 61  |OS_Exit...Initia|
000000f0  6c 69 73 65 0a 20 20 20  20 20 20 20 20 61 64 72  |lise.        adr|
00000100  20 20 20 20 20 72 31 32  2c 43 6f 64 65 5f 45 6e  |     r12,Code_En|
00000110  64 0a 0a 20 20 20 20 20  20 20 20 61 64 72 20 20  |d..        adr  |
00000120  20 20 20 72 30 2c 4d 65  73 73 61 67 65 5f 43 6f  |   r0,Message_Co|
00000130  70 79 72 69 67 68 74 0a  20 20 20 20 20 20 20 20  |pyright.        |
00000140  73 77 69 20 20 20 20 20  58 4f 53 5f 57 72 69 74  |swi     XOS_Writ|
00000150  65 30 0a 20 20 20 20 20  20 20 20 73 77 69 20 20  |e0.        swi  |
00000160  20 20 20 58 4f 53 5f 4e  65 77 4c 69 6e 65 0a 0a  |   XOS_NewLine..|
00000170  20 20 20 20 20 20 20 20  73 77 69 20 20 20 20 20  |        swi     |
00000180  58 4f 53 5f 47 65 74 45  6e 76 0a 20 20 20 20 20  |XOS_GetEnv.     |
00000190  20 20 20 6d 6f 76 20 20  20 20 20 72 31 31 2c 72  |   mov     r11,r|
000001a0  30 0a 20 20 20 20 20 20  20 20 63 6d 70 20 20 20  |0.        cmp   |
000001b0  20 20 72 31 2c 23 28 33  32 2a 31 30 32 34 29 0a  |  r1,#(32*1024).|
000001c0  20 20 20 20 20 20 20 20  61 64 72 6c 74 20 20 20  |        adrlt   |
000001d0  72 30 2c 45 72 72 6f 72  5f 4c 61 63 6b 4f 66 4d  |r0,Error_LackOfM|
000001e0  65 6d 0a 20 20 20 20 20  20 20 20 73 77 69 6c 74  |em.        swilt|
000001f0  20 20 20 58 4f 53 5f 57  72 69 74 65 30 0a 20 20  |   XOS_Write0.  |
00000200  20 20 20 20 20 20 6f 72  72 6c 74 73 20 20 72 31  |      orrlts  r1|
00000210  35 2c 72 31 34 2c 23 31  3c 3c 32 38 0a 0a 2e 46  |5,r14,#1<<28...F|
00000220  69 6e 64 5f 53 70 61 63  65 0a 20 20 20 20 20 20  |ind_Space.      |
00000230  20 20 6c 64 72 62 20 20  20 20 72 30 2c 5b 72 31  |  ldrb    r0,[r1|
00000240  31 5d 2c 23 31 0a 20 20  20 20 20 20 20 20 63 6d  |1],#1.        cm|
00000250  70 20 20 20 20 20 72 30  2c 23 30 0a 20 20 20 20  |p     r0,#0.    |
00000260  20 20 20 20 61 64 72 65  71 20 20 20 72 30 2c 45  |    adreq   r0,E|
00000270  72 72 6f 72 5f 42 61 64  50 61 72 61 6d 73 0a 20  |rror_BadParams. |
00000280  20 20 20 20 20 20 20 73  77 69 65 71 20 20 20 58  |       swieq   X|
00000290  4f 53 5f 57 72 69 74 65  30 0a 20 20 20 20 20 20  |OS_Write0.      |
000002a0  20 20 6f 72 72 65 71 73  20 20 72 31 35 2c 72 31  |  orreqs  r15,r1|
000002b0  34 2c 23 31 3c 3c 32 38  0a 20 20 20 20 20 20 20  |4,#1<<28.       |
000002c0  20 63 6d 70 20 20 20 20  20 72 30 2c 23 33 32 0a  | cmp     r0,#32.|
000002d0  20 20 20 20 20 20 20 20  62 6e 65 20 20 20 20 20  |        bne     |
000002e0  46 69 6e 64 5f 53 70 61  63 65 0a 0a 20 20 20 20  |Find_Space..    |
000002f0  20 20 20 20 61 64 72 20  20 20 20 20 72 30 2c 41  |    adr     r0,A|
00000300  72 67 75 6d 65 6e 74 73  0a 20 20 20 20 20 20 20  |rguments.       |
00000310  20 6d 6f 76 20 20 20 20  20 72 31 2c 72 31 31 0a  | mov     r1,r11.|
00000320  20 20 20 20 20 20 20 20  6d 6f 76 20 20 20 20 20  |        mov     |
00000330  72 32 2c 72 31 32 0a 20  20 20 20 20 20 20 20 6d  |r2,r12.        m|
00000340  6f 76 20 20 20 20 20 72  33 2c 23 35 31 32 0a 20  |ov     r3,#512. |
00000350  20 20 20 20 20 20 20 73  77 69 20 20 20 20 20 58  |       swi     X|
00000360  4f 53 5f 52 65 61 64 41  72 67 73 0a 20 20 20 20  |OS_ReadArgs.    |
00000370  20 20 20 20 61 64 64 76  73 20 20 20 72 30 2c 72  |    addvs   r0,r|
00000380  30 2c 23 34 0a 20 20 20  20 20 20 20 20 73 77 69  |0,#4.        swi|
00000390  76 73 20 20 20 58 4f 53  5f 57 72 69 74 65 30 0a  |vs   XOS_Write0.|
000003a0  20 20 20 20 20 20 20 20  6f 72 72 76 73 73 20 20  |        orrvss  |
000003b0  72 31 35 2c 72 31 34 2c  23 31 3c 3c 32 38 0a 0a  |r15,r14,#1<<28..|
000003c0  20 20 20 20 20 20 20 20  6d 6f 76 20 20 20 20 20  |        mov     |
000003d0  72 31 35 2c 72 31 34 0a  0a 2e 41 72 67 75 6d 65  |r15,r14...Argume|
000003e0  6e 74 73 0a 20 20 20 20  20 20 20 20 64 63 62 20  |nts.        dcb |
000003f0  20 20 20 20 22 2f 61 2c  2f 61 2c 63 74 72 6c 2f  |    "/a,/a,ctrl/|
00000400  73 2c 74 6f 70 2f 73 22  2c 30 0a 20 20 20 20 20  |s,top/s",0.     |
00000410  20 20 20 61 6c 69 67 6e  0a 0a 2e 4d 65 73 73 61  |   align...Messa|
00000420  67 65 5f 43 6f 70 79 72  69 67 68 74 0a 20 20 20  |ge_Copyright.   |
00000430  20 20 20 20 20 64 63 62  20 20 20 20 20 22 53 74  |     dcb     "St|
00000440  72 69 70 20 a9 20 4e 69  63 68 6f 6c 61 73 20 4d  |rip . Nicholas M|
00000450  61 72 72 69 6f 74 74 20  31 39 39 35 22 2c 30 0a  |arriott 1995",0.|
00000460  20 20 20 20 20 20 20 20  61 6c 69 67 6e 0a 0a 2e  |        align...|
00000470  45 72 72 6f 72 5f 4c 61  63 6b 4f 66 4d 65 6d 0a  |Error_LackOfMem.|
00000480  20 20 20 20 20 20 20 20  64 63 62 20 20 20 20 20  |        dcb     |
00000490  22 53 74 72 69 70 3a 20  4e 6f 74 20 65 6e 6f 75  |"Strip: Not enou|
000004a0  67 68 20 6d 65 6d 6f 72  79 22 2c 30 0a 20 20 20  |gh memory",0.   |
000004b0  20 20 20 20 20 61 6c 69  67 6e 0a 0a 2e 45 72 72  |     align...Err|
000004c0  6f 72 5f 42 61 64 50 61  72 61 6d 73 0a 20 20 20  |or_BadParams.   |
000004d0  20 20 20 20 20 64 63 62  20 20 20 20 20 22 53 74  |     dcb     "St|
000004e0  72 69 70 3a 20 42 61 64  20 70 61 72 61 6d 65 74  |rip: Bad paramet|
000004f0  65 72 73 22 2c 30 0a 20  20 20 20 20 20 20 20 61  |ers",0.        a|
00000500  6c 69 67 6e 0a 0a 2e 53  74 72 69 70 0a 20 20 20  |lign...Strip.   |
00000510  20 20 20 20 20 6c 64 72  20 20 20 20 20 72 31 30  |     ldr     r10|
00000520  2c 5b 72 31 32 2c 23 30  5d 0a 20 20 20 20 20 20  |,[r12,#0].      |
00000530  20 20 6c 64 72 20 20 20  20 20 72 31 31 2c 5b 72  |  ldr     r11,[r|
00000540  31 32 2c 23 34 5d 0a 20  20 20 20 20 20 20 20 6c  |12,#4].        l|
00000550  64 72 20 20 20 20 20 72  38 2c 5b 72 31 32 2c 23  |dr     r8,[r12,#|
00000560  38 5d 0a 20 20 20 20 20  20 20 20 6c 64 72 20 20  |8].        ldr  |
00000570  20 20 20 72 39 2c 5b 72  31 32 2c 23 31 32 5d 0a  |   r9,[r12,#12].|
00000580  0a 20 20 20 20 20 20 20  20 6d 6f 76 20 20 20 20  |.        mov    |
00000590  20 72 30 2c 23 26 34 46  0a 20 20 20 20 20 20 20  | r0,#&4F.       |
000005a0  20 6d 6f 76 20 20 20 20  20 72 31 2c 72 31 30 0a  | mov     r1,r10.|
000005b0  20 20 20 20 20 20 20 20  73 77 69 20 20 20 20 20  |        swi     |
000005c0  58 4f 53 5f 46 69 6e 64  0a 20 20 20 20 20 20 20  |XOS_Find.       |
000005d0  20 6d 6f 76 20 20 20 20  20 72 31 30 2c 72 30 0a  | mov     r10,r0.|
000005e0  20 20 20 20 20 20 20 20  61 64 64 76 73 20 20 20  |        addvs   |
000005f0  72 30 2c 72 30 2c 23 34  0a 20 20 20 20 20 20 20  |r0,r0,#4.       |
00000600  20 73 77 69 76 73 20 20  20 58 4f 53 5f 57 72 69  | swivs   XOS_Wri|
00000610  74 65 30 0a 20 20 20 20  20 20 20 20 6f 72 72 76  |te0.        orrv|
00000620  73 73 20 20 72 31 35 2c  72 31 34 2c 23 31 3c 3c  |ss  r15,r14,#1<<|
00000630  32 38 0a 0a 20 20 20 20  20 20 20 20 6d 6f 76 20  |28..        mov |
00000640  20 20 20 20 72 30 2c 23  26 38 46 0a 20 20 20 20  |    r0,#&8F.    |
00000650  20 20 20 20 6d 6f 76 20  20 20 20 20 72 31 2c 72  |    mov     r1,r|
00000660  31 31 0a 20 20 20 20 20  20 20 20 73 77 69 20 20  |11.        swi  |
00000670  20 20 20 58 4f 53 5f 46  69 6e 64 0a 20 20 20 20  |   XOS_Find.    |
00000680  20 20 20 20 6d 6f 76 20  20 20 20 20 72 31 31 2c  |    mov     r11,|
00000690  72 30 0a 20 20 20 20 20  20 20 20 61 64 64 76 73  |r0.        addvs|
000006a0  20 20 20 72 30 2c 72 30  2c 23 34 0a 20 20 20 20  |   r0,r0,#4.    |
000006b0  20 20 20 20 73 77 69 76  73 20 20 20 58 4f 53 5f  |    swivs   XOS_|
000006c0  57 72 69 74 65 30 0a 20  20 20 20 20 20 20 20 6f  |Write0.        o|
000006d0  72 72 76 73 73 20 20 72  31 35 2c 72 31 34 2c 23  |rrvss  r15,r14,#|
000006e0  31 3c 3c 32 38 0a 0a 2e  53 74 72 69 70 5f 4c 6f  |1<<28...Strip_Lo|
000006f0  6f 70 0a 20 20 20 20 20  20 20 20 6d 6f 76 20 20  |op.        mov  |
00000700  20 20 20 72 30 2c 23 30  0a 20 20 20 20 20 20 20  |   r0,#0.       |
00000710  20 6d 6f 76 20 20 20 20  20 72 31 2c 72 31 30 0a  | mov     r1,r10.|
00000720  20 20 20 20 20 20 20 20  73 77 69 20 20 20 20 20  |        swi     |
00000730  58 4f 53 5f 42 47 65 74  0a 0a 20 20 20 20 20 20  |XOS_BGet..      |
00000740  20 20 6d 6f 76 20 20 20  20 20 72 37 2c 72 30 0a  |  mov     r7,r0.|
00000750  0a 2e 53 74 72 69 70 5f  4c 6f 6f 70 5f 43 68 65  |..Strip_Loop_Che|
00000760  63 6b 5f 43 74 72 6c 0a  20 20 20 20 20 20 20 20  |ck_Ctrl.        |
00000770  63 6d 70 20 20 20 20 20  72 38 2c 23 30 0a 20 20  |cmp     r8,#0.  |
00000780  20 20 20 20 20 20 62 65  71 20 20 20 20 20 53 74  |      beq     St|
00000790  72 69 70 5f 4c 6f 6f 70  5f 43 68 65 63 6b 5f 54  |rip_Loop_Check_T|
000007a0  6f 70 0a 0a 20 20 20 20  20 20 20 20 63 6d 70 20  |op..        cmp |
000007b0  20 20 20 20 72 37 2c 23  33 32 0a 20 20 20 20 20  |    r7,#32.     |
000007c0  20 20 20 62 6c 74 20 20  20 20 20 53 74 72 69 70  |   blt     Strip|
000007d0  5f 4c 6f 6f 70 5f 4e 65  78 74 0a 0a 2e 53 74 72  |_Loop_Next...Str|
000007e0  69 70 5f 4c 6f 6f 70 5f  43 68 65 63 6b 5f 54 6f  |ip_Loop_Check_To|
000007f0  70 0a 20 20 20 20 20 20  20 20 63 6d 70 20 20 20  |p.        cmp   |
00000800  20 20 72 39 2c 23 30 0a  20 20 20 20 20 20 20 20  |  r9,#0.        |
00000810  62 65 71 20 20 20 20 20  53 74 72 69 70 5f 4c 6f  |beq     Strip_Lo|
00000820  6f 70 5f 57 72 69 74 65  0a 0a 20 20 20 20 20 20  |op_Write..      |
00000830  20 20 63 6d 70 20 20 20  20 20 72 37 2c 23 31 32  |  cmp     r7,#12|
00000840  37 0a 20 20 20 20 20 20  20 20 62 67 74 20 20 20  |7.        bgt   |
00000850  20 20 53 74 72 69 70 5f  4c 6f 6f 70 5f 4e 65 78  |  Strip_Loop_Nex|
00000860  74 0a 0a 2e 53 74 72 69  70 5f 4c 6f 6f 70 5f 57  |t...Strip_Loop_W|
00000870  72 69 74 65 0a 20 20 20  20 20 20 20 20 6d 6f 76  |rite.        mov|
00000880  20 20 20 20 20 72 30 2c  72 37 0a 20 20 20 20 20  |     r0,r7.     |
00000890  20 20 20 6d 6f 76 20 20  20 20 20 72 31 2c 72 31  |   mov     r1,r1|
000008a0  31 0a 20 20 20 20 20 20  20 20 73 77 69 20 20 20  |1.        swi   |
000008b0  20 20 58 4f 53 5f 42 50  75 74 0a 0a 2e 53 74 72  |  XOS_BPut...Str|
000008c0  69 70 5f 4c 6f 6f 70 5f  4e 65 78 74 0a 20 20 20  |ip_Loop_Next.   |
000008d0  20 20 20 20 20 6d 6f 76  20 20 20 20 20 72 30 2c  |     mov     r0,|
000008e0  23 35 0a 20 20 20 20 20  20 20 20 6d 6f 76 20 20  |#5.        mov  |
000008f0  20 20 20 72 31 2c 72 31  30 0a 20 20 20 20 20 20  |   r1,r10.      |
00000900  20 20 73 77 69 20 20 20  20 20 58 4f 53 5f 41 72  |  swi     XOS_Ar|
00000910  67 73 0a 20 20 20 20 20  20 20 20 63 6d 70 20 20  |gs.        cmp  |
00000920  20 20 20 72 32 2c 23 30  0a 20 20 20 20 20 20 20  |   r2,#0.       |
00000930  20 62 65 71 20 20 20 20  20 53 74 72 69 70 5f 4c  | beq     Strip_L|
00000940  6f 6f 70 0a 0a 20 20 20  20 20 20 20 20 6d 6f 76  |oop..        mov|
00000950  20 20 20 20 20 72 30 2c  23 26 30 30 0a 20 20 20  |     r0,#&00.   |
00000960  20 20 20 20 20 6d 6f 76  20 20 20 20 20 72 31 2c  |     mov     r1,|
00000970  72 31 30 0a 20 20 20 20  20 20 20 20 73 77 69 20  |r10.        swi |
00000980  20 20 20 20 58 4f 53 5f  46 69 6e 64 0a 0a 20 20  |    XOS_Find..  |
00000990  20 20 20 20 20 20 6d 6f  76 20 20 20 20 20 72 30  |      mov     r0|
000009a0  2c 23 26 30 30 0a 20 20  20 20 20 20 20 20 6d 6f  |,#&00.        mo|
000009b0  76 20 20 20 20 20 72 31  2c 72 31 31 0a 20 20 20  |v     r1,r11.   |
000009c0  20 20 20 20 20 73 77 69  20 20 20 20 20 58 4f 53  |     swi     XOS|
000009d0  5f 46 69 6e 64 0a 0a 20  20 20 20 20 20 20 20 6d  |_Find..        m|
000009e0  6f 76 20 20 20 20 20 72  31 35 2c 72 31 34 0a 0a  |ov     r15,r14..|
000009f0  2e 43 6f 64 65 5f 45 6e  64 0a                    |.Code_End.|
000009fa