From a76bc8250a8c8b33a4a0a45c95c8209393b5a541 Mon Sep 17 00:00:00 2001
From: Robert Sprowson <rsprowson@gitlab.riscosopen.org>
Date: Fri, 17 Sep 2010 22:15:32 +0000
Subject: [PATCH] Retire old compiler.

2000 lines of unloved code from 1993 deleted, binary still the same afterwards, so should be same as 1.25.

Version 1.26. Tagged as 'SprExtend-1_26'
---
 Sources/SWIs      |   22 +-
 Sources/SprExtend | 1991 +--------------------------------------------
 VersionASM        |    8 +-
 VersionNum        |   14 +-
 4 files changed, 35 insertions(+), 2000 deletions(-)

diff --git a/Sources/SWIs b/Sources/SWIs
index 85a6070..8c4b0d1 100644
--- a/Sources/SWIs
+++ b/Sources/SWIs
@@ -16,7 +16,6 @@
 
 SpriteExtend_SWIDecode
 
-        [ ccompiler
         Debug   gs,"X R0-3",R0,R1,R2,R3
         Debug   gs,"X R4-7",R4,R5,R6,R7
         Debug   gs,"X R8-9,12",R8,R9,R12
@@ -83,7 +82,6 @@ ErrorBlock_NoFile
         DCB     "NoFile"
         DCB     0
         ALIGN
-        ]
 
 SpriteExtend_SWINames
         DCB     SpriteExtendJPEGSWI_Name,0                ; prefix
@@ -134,7 +132,6 @@ SWIJPEG_Info
         BVS     exitbiggie
 
 ; Set escape stack level in case of unexpected exit from C code.
-        [ ccompiler
         ADRL    R3,ccompiler_sp
         STR     SP,[R3]                 ; in case of unexpected exit
         MOV     R4,#0
@@ -254,7 +251,6 @@ find_image_dims_error
         Debug   gs,"r0(err) =",R0
         ADD     sp, sp, #4              ; skip over stored verison of r0
         Pull    "sl,pc"                 ; pull up other three
-        ]
 
 ;SWIJPEG_FileInfo
 ;In:
@@ -277,7 +273,6 @@ find_image_dims_error
 ;
 SWIJPEG_FileInfo
 
-        [ ccompiler
         Debug   gs, "Filename pointer = ",r1
         Pull    "LR"
         Debug   gs,"JPEGFile: LR =",LR
@@ -326,7 +321,6 @@ SWIJPEG_FileInfo
         Debug   gs,"returning R4,R5,R6 =",R4,R5,R6
         ADDS    sp,sp,#6*4              ; get rid of saved r1-r6 - clear V
         Pull    "R7-R9,PC"              ; copied from exitbiggie, but returning r1-r6 - r0 restored by exit sequence.
-        ]
 
 
 ;SWIJPEG_PlotScaled
@@ -344,16 +338,7 @@ SWIJPEG_FileInfo
 ;  all registers preserved.
 ;
 SWIJPEG_PlotScaled
-;On Entry: what original code expected...
-;  R0 = 66
-;  R1 = pointer to JPEG file image
-;  R2 = length of JPEG file image
-;  R3 = x coordinate at which to plot
-;  R4 = y coordinate at which to plot
-;  R5 = plot action
-;  R6 = scale factors: 0 -> no scaling
-;  R7 = pixel translation table
-        [ ccompiler
+
         Pull    "LR"
         Push    "R1-R9,LR"              ; we must stick to the same form of saved registers as 'exitbiggie' assumes,
         MOV     r1, sp
@@ -613,7 +598,6 @@ jpegscaled_errorexit
         MOV     r4, lr
         Debug   gs,"about to return to ",R4
         MOV     pc, lr
-        ]
 
 ;SWIJPEG_PlotFileScaled
 ;In:
@@ -630,7 +614,6 @@ jpegscaled_errorexit
 ;
 SWIJPEG_PlotFileScaled
 
-        [ ccompiler
         BICS    LR, r4, #3              ;has someone set illegal flags?
         ADRNEL  R0, ErrorBlock_BadFlags
         addr    r1, Title, NE
@@ -717,7 +700,6 @@ JPEG_PlotFileScaled_error
 JPEG_PlotFileScaled_error2
         ADD     sp, sp, #4
         Pull    "R4-R6,PC"
-        ]
 
 ;SWIJPEG_PlotTransformed
 ;  In:
@@ -930,7 +912,6 @@ JPEGTrans_ErrorExit1
 
 SWIJPEG_PlotFileTransformed
 
-        [ ccompiler
         Pull    "LR"
         Push    "R0,R3-R6,LR"
         BICS    r3, r1, #7              ;has someone set illegal flags?
@@ -1007,7 +988,6 @@ JPEG_PlotFileTransformed_error
 JPEG_PlotFileTransformed_error2
         ADD     sp, sp, #4
         Pull    "R3-R6,PC"
-        ]
 
 ;SWIJPEG_PDriverIntercept
 ;  In:
diff --git a/Sources/SprExtend b/Sources/SprExtend
index 2cc4a09..4c2702c 100644
--- a/Sources/SprExtend
+++ b/Sources/SprExtend
@@ -54,20 +54,11 @@ Module_BaseAddr
         GBLL    debugmg
         GBLL    debugid
         GBLL    debugin
-        GBLL    debuglp
         GBLL    debugsc
         GBLL    debugsp
         GBLL    debugch
         GBLL    debugtr
         GBLL    debuger
-        GBLL    debugxx
-        GBLL    debugcg
-        GBLL    debugcp
-        GBLL    debugco
-        GBLL    debugcn
-        GBLL    debugcs
-        GBLL    debugcw
-        GBLL    debugcu
         GBLL    debugmb
         GBLL    debugms
         GBLL    debugag
@@ -101,30 +92,21 @@ ignore_ttr SETL {TRUE}                  ; if plotting <16 to >8bpp and it has a
 med01867 SETL   {TRUE}                  ; if true changes ignore_ttr behaviour to
                                         ; only apply at 8bpp full palette
         GBLL    flagbit
-flagbit SETL    {TRUE}                  ; if true forces the palette to be used over
-                                        ; the translation table, overriding the effect
-                                        ; of med01867 if b4 of R5 on entry was set
-
-        GBLL    widetrans
-widetrans SETL  {TRUE}                  ; support for wide translation tables via R5 bit 5
-
-        [       flagbit
+flagbit SETL    {TRUE}                  ; if true forces the palette to be used over the translation
+        [       flagbit                 ; table, overriding the effect of of med01867 if b4 of R5 on entry was set
         GBLA    flg2_ignorettr
 flg2_ignorettr  SETA 1                  ; R5 is shifted right 4 before storing
         GBLA    flg2_ditheron
 flg2_ditheron   SETA 4
         ]
 
+        GBLL    widetrans
+widetrans SETL  {TRUE}                  ; support for wide translation tables via R5 bit 5
         [       widetrans
         GBLA    flg2_widetrans
 flg2_widetrans  SETA 2
         ]
 
-        GBLL    ccompiler               ; new PutSpriteScaled compiler, written in C
-ccompiler SETL  {TRUE}
-        GBLL    remoldcompiler          ; remove old compiler - set multibuffer to FALSE as well
-remoldcompiler SETL {TRUE}
-
         GBLL    jpeg                    ; jpeg decompression
 jpeg    SETL    {TRUE}
 
@@ -140,20 +122,11 @@ debugpt SETL    debug :LAND: {FALSE}    ; pointer
 debugmg SETL    debug :LAND: {FALSE}    ; 'merge sprites' code
 debugid SETL    debug :LAND: {TRUE}     ; insertdelete rows or columns
 debugin SETL    debug :LAND: {TRUE}     ; input parameters
-debuglp SETL    debug :LAND: {FALSE}    ; loop
 debugsc SETL    debug :LAND: {FALSE}    ; screen parameters
 debugsp SETL    debug :LAND: {TRUE}     ; sprite parameters
 debugch SETL    debug :LAND: {FALSE}    ; character painting
 debugtr SETL    debug :LAND: {FALSE}    ; transformed plotting
 debuger SETL    debug :LAND: {FALSE}    ; error trapping
-debugxx SETL    debug :LAND: {FALSE}    ; misc debugging
-debugcg SETL    debug :LAND: {FALSE}    ; code generator
-debugcp SETL    debug :LAND: {FALSE}    ; code generator - asm_putmany
-debugco SETL    debug :LAND: {FALSE}    ; code generator - asm_tryoutput
-debugcn SETL    debug :LAND: {FALSE}    ; code generator - asm_newpixel
-debugcs SETL    debug :LAND: {FALSE}    ; code generator - asm_start
-debugcw SETL    debug :LAND: {FALSE}    ; code generator - asm_newword
-debugcu SETL    debug :LAND: {FALSE}    ; code generator - asm_putword
 debugmb SETL    debug :LAND: {FALSE}    ; multibuffer code for code generator
 debugms SETL    debug :LAND: {FALSE}    ; minimal multibuffer info messages
 debugag SETL    debug :LAND: {TRUE}     ; amg transient debugging - could be anywhere :-)
@@ -258,6 +231,23 @@ $label  #          0
         SWI     XOS_Release
         MEND
 
+        MACRO
+$l      SetImm  $reg,$value,$cc
+$l      EOR$cc  $reg,$reg,#xxx
+        EOR$cc  $reg,$reg,$value
+        MEND
+
+        MACRO
+$l      SetLsr  $reg,$value,$cc
+$l      EOR$cc  $reg,$reg,#xxx:SHL:7
+        EOR$cc  $reg,$reg,$value,LSL #7
+        MEND
+
+        MACRO
+$l      SetLsl  $reg,$value,$cc
+$l      EOR$cc  $reg,$reg,#xxx:SHL:7
+        EOR$cc  $reg,$reg,$value,LSL #7
+        MEND
 
 ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ; Table of service calls we want
@@ -421,13 +411,11 @@ gotarea
         Debug_Open "<Debug$File>"
       ]
 
-      [ ccompiler
         MOV     R7,#0
         ADRL    R6,ccompiler_space
         STR     R7,[R6]                   ; mark the ccompiler workspace clearly as uninitialised
         ADRL    r0,bitblockmove           ; ensure C code has access to bitblockmove
         STR     r0,ccompiler_bitblockmove
-      ]
 
       [ jpeg
 ;        MOV     R7,#-1
@@ -695,10 +683,8 @@ trns_flags2     #       4
 BPC             #       4
 BPP             #       4
 
-                [ ccompiler
 ccompiler_bitblockmove # 4      ; routine for C to call back into assembler.
 calibration_table # 4           ; printer calibration table
-                ]
 
               [ jpeg
 is_it_jpeg      #       4       ; BOOL - is this sprite JPEG?
@@ -835,12 +821,10 @@ sprite_doesnt_exist_error # 4   ; OSS Pointer to error block in RMA
 
 ; Private space for use by compiled C.
 ; If the C code needs more than this then this area must be extended.
-                [ ccompiler
 ccompiler_sp    #       4       ; for unexpected jumps out of compiled C
 ccompiler_space #       9392    ; C code checks at run-time for there being enough.
 ccompiler_end   #       0
 ccompiler_errptr #      0       ; os_error pointer for if an OS error lead to exit from C code.
-                ]
 
 enddata         #       0
 
@@ -1713,22 +1697,6 @@ readvduvars
         LDR     R14,Log2bpp
         MOV     R14,R0,ASL R14
         STR     R14,BPP                 ; bpp = 2^log2bpp
-;
-      [ {FALSE}
-        ; This rather weak test was to work around a bug in RISC OS 2.00 where MODE 22
-        ; would return X & Y window limit of zero. MODE 22 was 320x1024.
-        ; In RISC OS 3.xx MODE 22 was redefined as 768x288 and the mode variable bug fixed.
-        ; However, this override code stops redirection to 1 line high sprites since
-        ; the variable ywindlimit is zero based (ie. y-1) as all the blitting code
-        ; would assume there was a 1024 line screen to write to, resulting in an abort!
-        LDR     R14,ywindlimit
-        TEQ     R14,#0                  ; impossible!
-        MOVEQ   R14,#1024               ; bodge for old OS versions
-        LDREQ   R0,log2py               ; (goes wrong in mode 22)
-        MOVEQ   R14,R14,ASR R0
-        SUBEQ   R14,R14,#1
-        STREQ   R14,ywindlimit
-      ]
 ;
         Debug   sc,"ScreenStart,YWindLimit,LineLength,bpc =",#screenstart,#ywindlimit,#linelength,#BPC
 99
@@ -2112,9 +2080,7 @@ Go_PutSpriteScaled
         ]
         AND     R5,R5,#&0F              ; only bottom 4 bits are interesting
 
-        [       ccompiler
         STR     R8,calibration_table
-        ]
 
 ;
 ; Check to see if truecolour sprites should be dithered
@@ -2761,259 +2727,7 @@ cantdoinOS
         MOV     R14,#0
         STR     R14,save_vcount         ; bodge for 1st row
 
-      [ ccompiler
-;        LDR     R14,spritecode
-;        AND     R14,R14,#255
-;        CMP     R14,#SpriteReason_PutSpriteScaled
-;        BEQ     new_putscaled_compiler
         B       new_putscaled_compiler
-      ]
-
-      [ remoldcompiler
-      |
-;
-; compile appropriate macro (if not already done)
-;
-        BL      compilemacro
-
-;
-; remove cursors, since we are about to stomp on the screen!
-;
-        SWI     XOS_RemoveCursors
-        BVS     exitbiggie              ; last chance to go to exitbiggie!
-;
-; copy relevant variables onto the stack, so that R12 is free
-;
-        LDR     R0,BPP
-        LDR     R1,save_outoffset
-        LDR     R2,save_inbpp
-        LDR     R3,ColourTTR
-        LDR     R4,save_masko
-        LDR     R5,save_calladdr
-        LDR     R6,save_calladdr2
-        LDR     R9,save_maskinptr
-        LDR     R10,save_maskinshift
-;
-        MVN     R8,#0                     ;fixes for 32bpp, amg
-        CMP     R0,#32
-        RSBLT   R14,R0,#32
-        MOVLT   R8,R8,ASL R14           ; setup a suitable mask
-        Debug   cn,"maskword ",R8
-;
-        Push    "R0-R12"                 ; R7 = space for stack_returnaddr
-;
-        ADR     R14,save_block
-        LDMIA   R14,{R0-R9}             ; R10 irrelevant, R12 set up already
-        Push    "R0-R10,R12"            ; create space on stack
-;
-; these variables are not reloaded at the start of the loop
-;
-        LDR     xdiv,save_xdiv
-        LDR     xadd,save_xadd
-        LDR     masko,save_masko
-;
-        LDR     R14,spritecode
-        AND     R14,R14,#&FF
-        TEQ     R14,#SpriteReason_PutSpriteScaled
-        BEQ     gonextrow               ; loads up inptr, outptr
-        TEQ     R14,#SpriteReason_PutSpriteGreyScaled
-        BEQ     gogreyscale
-;
-; if plotting a mask, inptr --> mask itself
-;
-        LDR     R14,save_inptr          ; inptr --> mask instead of pixels
-        ADD     R14,R14,masko
-        STR     R14,save_inptr          ; *** R12 not corrupted yet !!!
-
-        B       gonextmaskrow
-
-nextrow
-        LDMIA   R13,{inshift,outword,outmask,xsize,xcount}  ; unchangeable!
-
-        STR     PC,stack_returnaddr
-        LDR     PC,stack_calladdr
-        NOP
-;
-        TEQ     outword,#&80000000
-        BEQ     %FT02
-;
-        LDR     R14,stack_BPP                   ; R14 = bpp
-        RSB     R14,R14,#32
-        MVN     im1,#0
-        MOV     im1,im1,ASL R14
-;
-        LDR     R14,stack_BPP                   ; prep up another register
-01
-        CMP     R14,#32
-        MOVEQ   outmask,im1
-        BEQ     %FT03                           ; AMG special case for 32BPP
-
-        MOVS    outword,outword,LSR R14
-        ORR     outmask,im1,outmask,LSR R14     ; set all bits from here
-        BCC     %BT01
-;
-03      STR     PC,stack_returnaddr
-        LDR     PC,stack_calladdr2              ; call 'putword'
-        NOP
-02
-;
-; go on to next row (including the first time)
-;
-gonextrow
-        LDR     R12,stack_wsptr
-        LDMIA   R12,{outoffset,inoffset,inptr,outptr,ydiv,yadd,ysize,ycount}
-        LDR     R14,stack_vcount                ; =0 first time round
-        SUBS    ysize,ysize,R14
-        BEQ     donesprite                      ; finished!
-;
-        TEQ     R14,#0
-01
-        SUBNE   outptr,outptr,outoffset         ; move up appropriate amount
-        SUBNES  R14,R14,#1
-        BNE     %BT01
-;
-02
-        SUBS    ycount,ycount,ydiv              ; room for an output row?
-        ADDCS   R14,R14,#1                      ; yes
-        BCS     %BT02
-        ADD     ycount,ycount,ydiv              ; oops!
-;
-        TEQ     R14,#0                          ; any to do?
-        BNE     %FT11
-
-        STR     R0,stack_temp1
-        STR     R1,stack_temp2
-
-        LDR     R0,save_maskinptr
-        LDR     R1,save_maskinoffset
-        SUB     R0,R0,R1
-        STR     R0,stack_maskinptr
-        STR     R0,save_maskinptr
-        LDR     R0,save_maskinshift
-        STR     R0,stack_maskinshift
-
-        LDR     R0,stack_temp1
-        LDR     R1,stack_temp2
-
-        SUB     inptr,inptr,inoffset            ; inptr --> row above
-        ADD     ycount,ycount,yadd              ; if input row is not enough,
-        B       %BT02                           ; try again
-11
-;
-        CMP     R14,ysize
-        MOVGT   R14,ysize
-        STR     R14,stack_vcount
-;
-        ADR     R12,save_inptr
-        STMIA   R12,{inptr,outptr,ydiv,yadd,ysize,ycount}
-        B       nextrow
-;
-donesprite
-        LDR     R12,stack_wsptr
-        ADD     R13,R13,#:INDEX:stack_end       ; restore stack frame
-;
-        Push    "PC"
-        SWI     XOS_RestoreCursors              ; preserve error state
-        Pull    "LR"
-        TEQP    LR,#0
-;
-        B       exitbiggie
-
-;
-; equivalent code for mask plotting (using background GCOL action)
-;
-
-nextmaskrow
-        LDMIA   R13,{inshift,outword,outmask,xsize,xcount,ecfptr}  ; constant!
-;
-        ;if doing a new format mask sprite need to change inshift
-        LDR     R12,stack_wsptr               ; get back the workspace base
-        LDR     R11,save_spr_type             ; fetch the sprite type
-        MOVS    R11,R11,LSR #27               ; test for T=0
-        LDRNE   inshift,save_maskinshift      ; if T>0 need to change the inshift
-        STRNE   inshift,save_inshift          ;   that we use to suit the 1bpp data
-
-        STR     PC,stack_returnaddr
-        LDR     PC,stack_calladdr
-        MOV     R0,R0
-;
-
-        TEQ     outword,#&80000000
-        BEQ     %FT02
-        LDR     R14,stack_BPP
-01
-        MOVS    outword,outword,LSR R14
-        BCC     %BT01
-;
-
-        STR     PC,stack_returnaddr
-        LDR     PC,stack_calladdr2              ; call 'putword'
-        MOV     R0,R0
-02
-;
-; go on to next row (including the first time)
-;
-gonextmaskrow
-        LDR     R14,stack_vcount                      ; =0 first time round
-        LDR     ecfptr,stack_ecfptr
-        LDR     yadd,stack_ecflimit
-        SUB     ecfptr,ecfptr,R14,ASL #3              ; 8 bytes per pixel row
-        SUB     ecfptr,ecfptr,yadd
-        ANDS    ecfptr,ecfptr,#4*16-1
-        ADDEQ   ecfptr,ecfptr,#4*16
-        ADD     ecfptr,ecfptr,yadd
-        STR     ecfptr,stack_ecfptr
-;
-        LDR     R12,stack_wsptr
-        LDMIA   R12,{outoffset,inoffset,inptr,outptr,ydiv,yadd,ysize,ycount}
-        SUBS    ysize,ysize,R14
-        BEQ     donesprite                      ; finished!
-;
-        MUL     R14,outoffset,R14
-        SUB     outptr,outptr,R14               ; move up appropriate amount
-;
-        MOV     R14,#0
-02
-        SUBS    ycount,ycount,ydiv              ; room for an output row?
-        ADDCS   R14,R14,#1                      ; yes
-        BCS     %BT02
-        ADD     ycount,ycount,ydiv              ; oops!
-;
-        TEQ     R14,#0                          ; any to do?
-        BNE     %FT03
-
-        LDR     R11,save_spr_type               ; needs R12 to be right
-        MOVS    R11,R11,LSR #27
-        BEQ     %FT04                           ; skip 1bpp mask stuff if old format
-
-        STR     R0,stack_temp1
-        STR     R1,stack_temp2
-
-        LDR     R0,save_maskinptr
-        LDR     R1,save_maskinoffset
-        SUB     R0,R0,R1
-        STR     R0,stack_maskinptr
-        STR     R0,save_maskinptr
-        LDR     R0,save_maskinshift
-        STR     R0,stack_maskinshift
-
-        LDR     R0,stack_temp1
-        LDR     R1,stack_temp2
-04
-        SUB     inptr,inptr,inoffset            ; inptr --> row above
-        ADD     ycount,ycount,yadd              ; if input row is not enough,
-        B       %BT02                           ; try again
-;
-03
-        CMP     R14,ysize
-        MOVGT   R14,ysize
-        STR     R14,stack_vcount
-;
-        ADR     R12,save_inptr
-        STMIA   R12,{inptr,outptr,ydiv,yadd,ysize,ycount}
-        B       nextmaskrow
-
-      ]
 
 ;;-----------------------------------------------------------------------------
 ;; Function to validate the pixel translation table, remapping as required
@@ -3248,227 +2962,6 @@ checktrans_exitok
         CLRV
         EXIT
 
-
-      [ remoldcompiler
-      |
-
-;;----------------------------------------------------------------------------
-;; Scale 4-bits-per-pixel greyscale sprite into another
-;; parameters set up as for the other types of sprite plotting
-;;----------------------------------------------------------------------------
-
-fcolbit         *       &80000000
-frowbit         *       &40000000
-
-; z zf zyf zs zys
-; xcount ycount
-; inputcell outword outptr
-; flags
-; Ra (Rb=zyf) (Rc=z)
-
-; nextrowdata (12)
-; nextcoldata (12)
-; TOTAL
-; XTOTAL
-
-        MakeSpriteErrorBlock BadGreyScale,,BadGScl
-
-defaultpixeltable
-        DCB     0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-
-gogreyscale
-        LDR     R14,save_inlog2bpp
-        TEQ     R14,#2
-        ADRNE   R0, ErrorBlock_BadGreyScale
-        addr    r1, Title, NE
-        BLNE    copy_error_one                  ; Always sets the V bit
-        BVS     donesprite                      ; restore cursors & stack
-;
-        LDR     Ra,ColourTTR                    ; pointer to pixel table?
-        CMP     Ra,#0
-        ADRNE   Ra,defaultpixeltable
-        STRNE   Ra,ColourTTR
-;
-        LDR     Ra,save_xdiv
-        LDR     Rb,save_ydiv
-        MUL     R14,Ra,Rb
-        STR     R14,save_xftimesyf
-;
-        LDR     inputcell,save_inptr
-        MOV     inputcell,inputcell,LSL #3-2
-        LDR     R14,save_inshift
-        ADD     inputcell,inputcell,R14,LSR #2  ; 4 bits per pixel
-;
-        LDR     outptr,save_outptr
-;
-        LDR     zys,save_ycount
-        LDR     ycounter,save_inputysize
-        LDR     R14,save_ysize
-        STR     R14,save_tempysize
-nextgsrow
-        LDR     outword,save_outword
-        LDR     R14,[outptr]
-01
-        MOV     R14,R14,LSL #4
-        MOVS    outword,outword,LSR #4
-        BCC     %BT01
-        LDR     outword,save_outword
-        ORR     outword,outword,R14             ; initial output word
-;
-        LDR     zyf,save_ydiv
-;
-        ORR     flags,flags,#fcolbit            ; firstcolumn := true
-        LDR     zs,save_xcount
-        LDR     xcounter,save_inputxsize
-        LDR     R14,save_xsize
-        STR     R14,save_tempxsize
-nextgscolumn
-        LDR     zf,save_xdiv
-        MOV     R14,#0
-        STR     R14,TOTAL
-        ORR     flags,flags,#frowbit            ; firstrow := true
-        Push    "ycounter,zys,zyf"
-mainloop1
-        MOV     R14,#0                          ; sub-pixel total
-        STR     R14,XTOTAL
-        Push    "inputcell,xcounter,zs,zf"
-mainloop2
-        CMP     zs,zf
-        MOVCC   z,zs
-        MOVCS   z,zf
-;
-; add weighted input cell to row total
-;
-        MOVS    R14,inputcell,LSR #1            ; get pixel address
-        LDRB    R14,[R14]
-        ANDCC   R14,R14,#&0F                    ; low-order pixel
-        MOVCS   R14,R14,LSR #4                  ; high-order pixel
-;
-        LDR     Ra,XTOTAL
-        MLA     Ra,z,R14,Ra
-        STR     Ra,XTOTAL
-;
-        SUBS    zs,zs,z
-        LDREQ   zs,save_xmag
-        ADDEQ   inputcell,inputcell,#1          ; go right 1 column
-        SUBEQ   xcounter,xcounter,#1
-        SUBS    zf,zf,z
-
-        TEQNE   xcounter,#0
-        BNE     mainloop2
-;
-        TST     flags,#frowbit                  ; if first row,
-        BICNE   flags,flags,#frowbit
-        ADRNE   R14,nextcoldata
-        STMNEIA R14,{inputcell,zs,xcounter}       ; save for later.
-;
-; add row total into cell total
-;
-        Pull    "inputcell,xcounter,zs,zf"
-;
-        CMP     zys,zyf
-        MOVCC   z,zys
-        MOVCS   z,zyf
-;
-        LDR     Ra,TOTAL
-        LDR     R14,XTOTAL
-        MLA     Ra,R14,z,Ra
-        STR     Ra,TOTAL
-;
-        SUBS    zys,zys,z
-        LDREQ   zys,save_ymag
-        LDREQ   R14,save_inoffset
-        SUBEQ   inputcell,inputcell,R14,LSL #3-2   ; go up 1 row
-        SUBEQ   ycounter,ycounter,#1
-        SUBS    zyf,zyf,z
-        TEQNE   ycounter,#0
-        BNE     mainloop1
-;
-; now divide total for this cell by (xf*yf)
-;
-        LDR     Ra,TOTAL
-        LDR     Rb,save_xftimesyf               ; zyf not used
-        ADD     Ra,Ra,Rb,ASR #1                         ; round to nearest
-        DivRem  Rc,Ra,Rb, R14                   ; z not used
-        CMP     Rc,#16
-        MOVCS   Rc,#15                                  ; 4-bit answer
-;
-        LDR     R14,ColourTTR           ; pixel look-up
-        LDRB    Rc,[R14,Rc]
-        LDR     R14,BPP
-        MOV     Rc,Rc,ROR R14
-        ORRS    outword,Rc,outword,LSR R14
-        STRCS   outword,[outptr],#4
-        MOVCS   outword,#&80000000
-;
-; if first column, save data for nextgsrow
-;
-        TST     flags,#fcolbit                  ; if first column,
-        BICNE   flags,flags,#fcolbit
-        ADRNE   R14,nextrowdata
-        STMNEIA R14,{inputcell,zys,ycounter}      ; save for later.
-;
-; move right one output pixel
-;
-        Pull    "ycounter,zys,zyf"
-        ADR     R14,nextcoldata
-        LDMIA   R14,{inputcell,zs,xcounter}
-        LDR     R14,save_tempxsize
-        SUBS    R14,R14,#1
-        STR     R14,save_tempxsize
-        BGT     nextgscolumn
-;
-        TEQ     outword,#&80000000
-        BEQ     %FT02
-        MOV     Ra,#&FFFFFFFF
-        LDR     R14,BPP
-01
-        MOV     Ra,Ra,LSR R14
-        MOVS    outword,outword,LSR R14
-        BCC     %BT01
-        LDR     Rb,[outptr]
-        BIC     Rb,Rb,Ra                ; should really depend on GCOL action
-        ORR     Rb,Rb,outword
-        STR     Rb,[outptr]
-02
-        LDR     R14,save_outoffset
-        LDR     outptr,save_outptr
-        SUB     outptr,outptr,R14
-        STR     outptr,save_outptr
-;
-        ADR     R14,nextrowdata
-        LDMIA   R14,{inputcell,zys,ycounter}
-        LDR     R14,save_tempysize
-        SUBS    R14,R14,#1
-        STR     R14,save_tempysize
-        BGT     nextgsrow
-;
-        B       donesprite
-
-
-;;-----------------------------------------------------------------------------
-;; Compile appropriate 'macro' for doing scaled SpriteOp's
-;; Entry:  [macroword] = bits indicating state of macro
-;;                0..2 = gcol action
-;;                   3 = mask / no mask (used for input masking)
-;;                   4 = ttr / no ttr
-;;                   5 = plotmask / putsprite
-;;                   6 = transformed / scaled
-;; ( if ignore_ttr)  7 = use palette entries and ignore ttr (<16 to >8bpp only)
-;;               8..15 = inbpp
-;;              16..23 = outbpp
-;;                  24 = transformed sprite routine/scaled sprite routine (version 23 and above)
-;;         ColourTTR
-;;         spritecode
-;;         save_inshift
-;;         save_inbpp
-;;         BPP
-;;         R5          = gcol action
-;; Exit:   code recompiled if necessary
-;;         ecflimit, outoffset updated inside code
-;;-----------------------------------------------------------------------------
-
-      ]
       ; some of these values used in SprTrans
 mc_gcol         *       2_00000111              ; bits 0..2 of R5
 mc_hasmask      *       2_00001000              ; bit 3 of R5
@@ -3484,22 +2977,8 @@ mcb_inbpp       *       8
 mcb_outbpp      *       16
 mcb_sprtype     *       24
 
-                ^       0
-l_newword       #       4
-l_newpixel      #       4
-l_tryoutput     #       4
-l_fref          #       4               ; forward reference
-l_putmany       #       4
-l_vloop         #       4
-l_putword       #       4
-l_max           #       0
-
-vv_inbpp        RN      R6
-vv_inbpp1       RN      R7
-vv_outbpp       RN      R8
-vv_outbpptop    RN      R9
-
-BLEQ            *       &0B000000
+xxx             *       2
+
 BNE             *       &1A000000
 BCS             *       &2A000000
 BCC             *       &3A000000
@@ -3516,1408 +2995,6 @@ BLE             *       &DA000000
 BAL             *       &EA000000
 BNV             *       &FA000000
 
-        GBLA    ldmreg
-        GBLS    ldmreg2
-
-xxx     *       2
-
-        MACRO
-$l      Asm     $label,$cc
-$l      GetAsm  $label,$cc
-        PutAsm  $label,$cc
-        MEND
-
-        MACRO
-$l      GetAsm  $label,$cc
-ldmreg  SETA    ($label.end-$label+4):SHR:2
-ldmreg2 SETS    "$ldmreg":RIGHT:1
-      [ ldmreg>1
-$l      ADR$cc  R1,$label
-        LDM$cc.IA R1,{R1-R$ldmreg2}
-      |
-$l      LDR$cc  R1,$label
-      ]
-        MEND
-
-        MACRO
-$l      SetImm  $reg,$value,$cc
-$l      EOR$cc  $reg,$reg,#xxx
-        EOR$cc  $reg,$reg,$value
-        MEND
-
-        MACRO
-$l      SetLsr  $reg,$value,$cc
-$l      EOR$cc  $reg,$reg,#xxx:SHL:7
-        EOR$cc  $reg,$reg,$value,LSL #7
-        MEND
-
-        MACRO
-$l      SetLsl  $reg,$value,$cc
-$l      EOR$cc  $reg,$reg,#xxx:SHL:7
-        EOR$cc  $reg,$reg,$value,LSL #7
-        MEND
-
-        MACRO
-$l      PutAsm  $label,$cc
-ldmreg  SETA    ($label.end-$label+4):SHR:2
-ldmreg2 SETS    "$ldmreg":RIGHT:1
-        [ debugcg
-        STMFD R13!,{R9,R14}
-        MOV R9,#$ldmreg2
-        BL ag_disasm
-        LDMFD R13!,{R9,R14}
-        ]
-$l      STM$cc.IA R10!,{R1-R$ldmreg2}
-        MEND
-
-        MACRO
-$l      Label   $lab
-$l      STR     R10,[sp,#$lab]
-        MEND
-
-        MACRO
-$l      Branch  $op,$lab
-$l      LDR     R0,[sp,#$lab]
-        SUB     R0,R0,R10
-        SUB     R0,R0,#8
-        MOV     R0,R0,LSL #6
-        MOV     R0,R0,LSR #8
-        ORR     R0,R0,#$op
-        STR     R0,[R10],#4
-        MEND
-
-      [ remoldcompiler
-      |
-
-compilemacro
-        Push    "R11,LR"
-        [ multibuffer
-        Debug    mb,""
-        Debug    mb,"Multibuffer code is enabled...."
-        ]
-;
-        AND     R11,R5,#mc_gcol:OR:mc_hasmask
-        LDR     R14,ColourTTR
-        CMP     R14,#0
-        ORRNE   R11,R11,#mc_ttr
-        LDR     R14,spritecode
-        AND     R14,R14,#&FF
-        TEQ     R14,#SpriteReason_PlotMaskScaled
-        ORREQ   R11,R11,#mc_plotmask
-        BICEQ   R11,R11,#mc_ttr
-        LDR     R14,BPP
-        ORR     R11,R11,R14,LSL #mcb_outbpp
-        LDR     R14,[R1,#spMode]
-        MOV     R14,R14,LSR #27
-        ORR     R11,R11,R14,LSL #mcb_sprtype   ;include sprite type
-        LDR     R14,save_inbpp
-        ORR     R11,R11,R14,LSL #mcb_inbpp
-
-        ; from the addition of 1bpp mask handling the macroword generated by both
-        ; macro generators adds the sprite type to the information in the macro
-        ; word, at bit 24 up. this is necessary to ensure that a mask routine for
-        ; a 1bpp mask can be distinguished from a mask routine for old mask format.
-
-        [ ignore_ttr
-        TST     R11,#mc_plotmask
-        BNE     %FT21
-        LDR     R14,trns_palette
-        TEQ     R14,#0
-        ORRNE   R11,R11,#mc_ttrispalette
-21
-        ]
-;
-        [ multibuffer
-
-        STMFD   R13!,{R6-R10}
-        Debug   mb,"Macroword is ",R11
-        ;usage of registers....
-        ;r6 - slot to overwrite
-        ;r7 - least used count so far
-        ;r8 - buffer number
-        ;r11 - macroword
-        ;r9 & r14 available
-
-        MOV     R6,#0
-        MOV     R7,#bignum
-        MOV     R8,#0
-
-        ADR     R9,buffer0mask
-        ADR     R10,buffer0count
-
-        Debug   mb,"Looking at entry ",R8
-40
-        LDR     R14,[R9,R8]     ;fetch the macroword used for the routine
-        Debug   mb,"Current macroword in this slot ",R14
-        TEQ     R11,R14
-        BEQ     %FT41           ;this routine has already been built
-                                ;increment its usage count and use it
-        LDR     R14,[R10,R8]     ;fetch the count for the routine
-        Debug   mb,"Usage count ",R14
-        CMP     R14,R7          ;has this been used less than the maximum?
-        MOVCC   R6,R8           ;if so, it's the one to build over
-        MOVCC   R7,R14          ;and reduce the limit
-
-        Debug   mb,"Slot to overwrite ",R6
-        ADD     R8,R8,#4
-        CMP     R8,#(nbuffers :SHL: 2) ;done all buffers yet ?
-        BNE     %BT40           ;no, so go back and try again
-
-        ;there isn't a matching routine. R6 is the slot number to overwrite
-        Debug   mb,"About to replace routine in slot ",R6
-        Debug   ms,"Building code for ",R11
-        [ debugms
-        LDR     R14,[R9,R6]
-        Debug   ms,"Discarding ",R14
-        ]
-        STR     R11,[R9,R6]     ;update the macroword for the slot
-        ADR     R9,buffer0count
-        MOV     R14,#1
-        STR     R14,[R9,R6]     ;and set its usage count
-        STR     R11,macroword
-        STR     R6,thisslot     ;save the slot number for 'fillins'
-        LDMFD   R13!,{R6-R10}
-        B       %FT42           ;and go and compile the routine
-
-41
-        Debug   mb,"The routine already exists..."
-        ;Debug   ms,"Code already built for ",R11
-        LDR     R14,[R10,R8]
-        ADD     R14,R14,#1
-        STR     R14,[R10,R8]
-        Debug   mb,"New usage count for this routine ",R14
-        STR     R8,thisslot
-        STR     R11,macroword
-        LDMFD   R13!,{R6-R10}
-        B       do_fillins
-42
-        |
-        LDR     R14,macroword
-        TEQ     R11,R14        ;is code already built ?
-        BEQ     do_fillins     ;EQ: it is, so just update values in it
-;
-        STR     R11,macroword
-        ]
-;
-; compile appropriate code, depending on value of R11 (macroword)
-;
-        Push    "R1-R10"
-        SUB     sp,sp,#l_max            ; create local stack frame
-        [ multibuffer
-        ADR     R10,codebuffer0
-        Debug   mb,"Codebuffer is at ",R10
-        LDR     R14,thisslot            ;presently 0,4,8 or 12
-        Debug   mb,"Slot number ",R14
-                                        ;need 0,&200,&400,&600
-        ADD     R10,R10,R14,LSL #7      ;R10 is now the correct buffer
-        Debug   mb,"Codebuffer being used: ",R10
-        |
-        ADR     R10,codebuffer
-        ]
-;
-        Debug   mc,"Compilemacro: R10,R11 =",R10,R11
-        Debug   cg,"Compilemacro: R10,R11 =",R10,R11
-;
-        MOV     R14,R11,LSR #mcb_inbpp
-        AND     vv_inbpp,R14,#&FF
-        MOV     R14,R11,LSR #mcb_outbpp
-        AND     vv_outbpp,R14,#&FF
-        MOV     R14,#1
-        MOV     R14,R14,LSL vv_inbpp
-        SUB     vv_inbpp1,R14,#1        ; inbpp1 = 2^inbpp-1
-
-        MOV     R14,#1:SHL:31
-        MOV     R14,R14,ASR vv_outbpp
-        MOV     R0,R14,LSL #1           ; outbpptop = 2^31 >> outbpp << 1
-        BL      convert_ROR
-        MOV     vv_outbpptop,R0         ; convert to opcode form
-;
-        Debug   cg,"{{{{{{{{{{{{{{{{{{{ Recompiling code }}}}}}}}}}}}}}}}}}}}"
-        Debug   cg,""
-        Debug   cw,"###### asm_newword ######"
-        BL      asm_newword
-        Debug   cw,""
-        Debug   cs,"###### asm_start ######"
-        BL      asm_start
-        Debug   cs,""
-        Debug   cn,"###### asm_newpixel ######"
-        BL      asm_newpixel
-        Debug   cn,""
-        Debug   co,"###### asm_tryoutput ######"
-        BL      asm_tryoutput
-        Debug   co,""
-        Debug   cp,"###### asm_putmany ######"
-        BL      asm_putmany
-        Debug   cp,""
-        Debug   cu,"###### asm_putword ######"
-        BL      asm_putword
-        Debug   cu,""
-        Debug   cg,"###### code built ######"
-;
-        Debug   cg,"End of Compiled code:",R10
-;
-        LDR     R10,[sp,#l_fref]        ; complete the forward reference
-        Branch  BCS,l_putword
-;
-        ADD     sp,sp,#l_max
-        Pull    "R1-R10"
-
-do_fillins
-        [ multibuffer
-        ADR     R14,pc_ecflimit0
-        LDR     R11,thisslot
-        Debug   mb,"Doing fillins for routine ",R11
-        LDR     R11,[R14,R11]
-        CMP     R11,#0
-        Debug   mb,"pc_ecflimit for this routine ",R11
-        LDRNE   R0,save_ecflimit
-        BLNE    convert_ROR
-        LDRNE   R14,m_ecflimit
-        SetImm  R14,R0,NE
-        STRNE   R14,[R11]
-
-        [ debugmb
-        Debug   mb,"save_ecflimit (as imm)",R0
-        Debug   mb,"composite word to store",R14
-        ]
-;
-        |
-        LDR     R11,pc_ecflimit
-        CMP     R11,#0
-        LDRNE   R0,save_ecflimit
-        BLNE    convert_ROR
-        LDRNE   R14,m_ecflimit
-        SetImm  R14,R0,NE
-        STRNE   R14,[R11]
-;
-        ]
-;
-        [ multibuffer
-        ;set up the correct calladdr and calladdr2 for now...
-        LDR     R14,thisslot
-        Debug   mb,"Setting up calladdrs, slot=",R14
-        ADR     R0,calladdr0
-        LDR     R0,[R0,R14]
-        Debug   mb,"Calladdr = ",R0
-        STR     R0,save_calladdr
-
-        ADR     R0,calladdr20
-        LDR     R0,[R0,R14]
-        Debug   mb,"Calladdr2 = ",R0
-        STR     R0,save_calladdr2
-        ]
-
-        Pull    "R11,PC"
-
-;
-; Entry:  R0 = immediate constant
-; Exit:   R0 = value to ORR into instruction opcode
-;
-
-convert_ROR
-        EntryS
-      [ {TRUE}
-        BIC     R0, R0, #3:SHL:0
-      ]
-        MOV     R14,#16                 ; assume R0 bits 0,1 unset on entry
-01
-        TST     R0,#3                   ; assume R0<>0 on entry
-        MOVEQ   R0,R0,LSR #2
-        SUBEQ   R14,R14,#1
-        BEQ     %BT01
-        ORR     R0,R0,R14,LSL #8
-
-        EXITS                           ; preserve flags
-
-
-; ############################## code fragments for newword
-
-pm_newword_ext          LDR     im1,[inptr,masko]
-                        MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-pm_newword_extend       LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-                        ASSERT  (pm_newword_extend -pm_newword_ext) = (pm_newwordend -pm_newword)
-
-
-tm1_newword1_ext        LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-tm1_newword1_extend     MOV     im1,im1,LSR im2          ; inbpp
-tm1_newword2_ext        MOVS    im1,im1,LSR #1
-                        MOVCS   im2,#0
-tm1_newword2_extend     LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-
-
-pm1_newword1_ext        LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-pm1_newword1_extend     MOV     im1,im1,LSR im2          ; inbpp
-pm1_newword2_ext        MOVS    im1,im1,LSR #1
-                        MOVCS   im2,#0
-pm1_newword2_extend     LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-
-
-tm_newword_ext          LDR     im1,stack_masko
-                        LDR     im1,[inptr,im1]
-                        MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-tm_newword_extend       LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-                        ASSERT  (tm_newword_extend -tm_newword_ext) = (tm_newwordend -tm_newword)
-
-; ### plot mask, old format mask
-
-pm_newword              LDR     im1,[inptr,masko]
-                        MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-pm_newwordend           MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-
-; ### plot mask, new format mask
-
-pm1_newword1            LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-pm1_newword1end         MOV     im1,im1,LSR im2
-pm1_newword2            MOVS    im1,im1,LSR #1
-                        MOVCS   im2,#0
-pm1_newword2end         MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-
-; ### plot mask, new format mask, 16/32bpp
-
-pm1_newword132          LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-pm1_newword132end       MOV     im1,im1,LSR im2
-pm1_newword232          MOVS    im1,im1,LSR #1
-                        MOVCS   im2,#0
-pm1_newword232end       LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-
-
-; ### new plot word
-
-p_newword               LDR     in1,[inptr],#4
-                        MOV     in2,in1,LSL #xxx        ; 32-inbpp
-                        MOVS    in1,in1,LSR #xxx        ; inbpp
-                        ORR     in1,in1,#1:SHL:31
-p_newwordend            MOV     PC,LR
-
-
-; ### new plot word, 32bpp
-
-p_newword32             LDR     in2,[inptr],#4
-                        MOV     in1,#1
-                        MOVS    in1,in1,LSR #1
-                        ORR     in1,in1,#&80000000
-p_newword32end          MOV     PC,LR
-
-
-; ### transform/mask new word, old mask
-
-tm_newword              LDR     im1,stack_masko
-                        LDR     im1,[inptr,im1]
-                        MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-tm_newwordend           MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-
-; ### transform/mask new word, new mask
-
-tm1_newword1            LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-                        MOV     im1,im1,LSR im2
-tm1_newword1end         MOVS    im1,im1,LSR #1
-tm1_newword2            MOVCS   im2,#0
-tm1_newword2end         MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-
-; ### transform/mask new word, new mask, 16/32bpp
-
-tm1_newword1ext         LDR     im1,stack_maskinptr
-                        LDR     im2,stack_maskinshift
-                        LDR     im1,[im1]
-                        MOV     im1,im1,LSR im2
-tm1_newword1extend      MOVS    im1,im1,LSR #1
-tm1_newword2ext         MOVCS   im2,#0
-tm1_newword2extend      LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-
-
-; ### transform new word 32bpp
-
-t_newword32             LDR     in2,[inptr],#4
-                        MOV     in1,#1
-                        MOV     in1,in1,LSR #1
-                        ORR     in1,in1,#1:SHL:31
-t_newword32end          MOV     PC,LR
-
-
-; ### transform new word 16bpp
-
-t_newword161            LDR     in1,[inptr],#4
-                        MOV     in2,in1,LSL #16
-t_newword161end         MOV     in2,in2,LSR #16
-t_newword162            MOV     in1,in1,LSR #16         ; inbpp
-                        ORR     in1,in1,#1:SHL:31
-t_newword162end         MOV     PC,LR
-
-
-; ### transform new word <16bpp
-
-t_newword               LDR     in1,[inptr],#4
-                        AND     in2,in1,#xxx            ; 2^inbpp-1
-                        MOV     in1,in1,LSR #xxx        ; inbpp
-                        ORR     in1,in1,#1:SHL:31
-t_newwordend            MOV     PC,LR
-
-
-; ### update 1bpp mask controls
-
-;code fragment for updating maskinptr and maskinshift.
-
-msk_increment1          STR     im1,stack_temp1
-                        STR     im2,stack_temp2
-                        LDR     im1,stack_maskinshift
-                        LDR     im2,stack_maskinptr
-msk_increment1end       ADD     im1,im1,#xxx             ;pixels per word
-msk_increment2          CMP     im1,#32
-                        ADDCS   im2,im2,#4
-                        MOVCS   im1,#0
-msk_increment2end       STR     im1,stack_maskinshift
-msk_increment3          STR     im2,stack_maskinptr
-                        LDR     im1,stack_temp1
-msk_increment3end       LDR     im2,stack_temp2
-
-
-; ### mask new word
-
-m_newword               LDR     in1,[inptr],#4
-                        MOVS    in1,in1,LSR #xxx        ; inbpp
-                        ORR     in1,in1,#1:SHL:31
-m_newwordend            MOV     PC,LR
-
-
-; ### new mask word for 1bpp
-
-m1_newword1             LDR     im2,stack_maskinptr
-                        LDR     im1,stack_maskinshift
-                        LDR     in1,[im2]
-                        MOV     in1,in1,LSR im1
-m1_newword1end          ADD     im1,im1,#xxx             ;pixels per word
-m1_newword2             CMP     im1,#32
-                        ADDCS   im2,im2,#4
-                        MOVCS   im1,#0
-                        STR     im1,stack_maskinshift
-m1_newword2end          STR     im2,stack_maskinptr
-m1_newword3             MOVS    in1,in1,LSR #1
-                        ORR     in1,in1,#1:SHL:31
-m1_newword3end          MOV     PC,LR
-
-
-asm_newword
-                        Debug   cw,"*** asm_newword"
-                        Label   l_newword
-;
-                        TST     R11,#mc_plotmask
-                        BNE     %FT02
-                        TST     R11,#mc_ttr
-                        BNE     %FT01
-;
-                        TST     R11,#mc_hasmask
-                        BEQ     %FT47
-;
-                        MOVS    R2,R11,LSR #mcb_sprtype
-                        BEQ     %FT46
-
-                        TST     R11,#mc_plotmask
-                        BNE     %FT46
-
-                        CMP     vv_outbpp,#16
-                        Asm     pm1_newword1,LT
-                        GetAsm  pm1_newword2,LT
-                        SetImm  R3,vv_outbpptop,LT
-                        PutAsm  pm1_newword2,LT
-
-                        Asm     pm1_newword132,GE
-                        Asm     pm1_newword232,GE
-
-                        B       %FT47
-46
-                        CMP     vv_outbpp,#16
-                        GetAsm  pm_newword,LT                   ; pick up code for 8 bit per pixel or less
-                        SetImm  R4,vv_outbpptop,LT             ; modify based on output pixels
-                        GetAsm  pm_newword_ext,GE               ; pick up code for 16 bit per pixel or greater
-;
-                        SetLsr  R2,vv_inbpp                     ; and write input information into it
-                        Debug   cw,"pm_newword"
-                        PutAsm  pm_newword, LT
-                        PutAsm  pm_newword_ext, GE
-47
-                        TST     R11,#mc_hasmask
-                        BEQ     %FT61
-
-                        ;if it has a new format mask, include the code to increment it
-                        MOVS    R1,R11,LSR #mcb_sprtype
-                        BEQ     %FT61
-
-                        TST     R11,#mc_plotmask
-                        BNE     %FT61
-
-                        LDR     R1,save_inlog2bpp
-                        MOV     R0,#32
-                        MOV     R0,R0,LSR R1
-
-                        GetAsm  msk_increment1
-                        SetImm  R5,R0
-                        PutAsm  msk_increment1
-
-                        Asm     msk_increment2
-                        Asm     msk_increment3
-
-61
-                        CMP     vv_inbpp,#32
-                        BCS     %FT48
-
-                        GetAsm  p_newword
-                        RSB     R0,vv_inbpp,#32                ; R0 = 32-inbpp
-                        SetLsl  R2,R0
-                        SetLsr  R3,vv_inbpp
-                        PutAsm  p_newword
-                        B %FT49
-48
-                        Asm     p_newword32
-49
-                        Debug   cw,"p_newword"
-                        MOV     PC,LR
-01
-                        TST     R11,#mc_hasmask
-                        BEQ     %FT47
-;
-                        MOVS    R1,R11,LSR #mcb_sprtype
-                        BEQ     %FT71
-
-                        CMP     vv_outbpp,#16
-                        Asm     tm1_newword1,LT
-                        GetAsm  tm1_newword2,LT
-                        SetImm  R2,vv_outbpptop,LT
-                        PutAsm  tm1_newword2,LT
-
-                        Asm     tm1_newword1ext,GE
-                        Asm     tm1_newword2ext,GE
-                        B       %FT47
-
-71
-                        CMP     vv_outbpp,#16
-                        Debug   cw,"tm_newword"
-                        GetAsm  tm_newword,LT                   ; pick up code for 8 bpp or less
-                        SetImm  R5,vv_outbpptop,LT              ; and modify the mask writing instruction
-                        GetAsm  tm_newword_ext,GE               ; otherwise pick up code for greater depths
-                        SetLsr  R3,vv_inbpp
-                        PutAsm  tm_newword,LT                   ; always modify based on input bpp and write instructions
-                        PutAsm  tm_newword_ext,GE
-47
-
-                        TST      R11,#mc_hasmask
-                        MOVNES   R1,R11,LSR #mcb_sprtype
-                        BEQ      %FT62
-                        TST      R11,#mc_plotmask
-                        BNE      %FT62
-
-                        LDR     R1,save_inlog2bpp
-                        MOV     R0,#32
-                        MOV     R0,R0,LSR R1
-                        GetAsm  msk_increment1
-                        SetImm  R5,R0
-                        PutAsm  msk_increment1
-                        Asm     msk_increment2
-                        Asm     msk_increment3
-62
-                        CMP     vv_inbpp,#16
-
-                        Asm     t_newword32,GT
-
-                        Asm     t_newword161,EQ
-                        Asm     t_newword162,EQ
-
-                        MOVCS   PC,LR
-
-                        Debug   cw,"t_newword"
-                        GetAsm  t_newword
-                        SetImm  R2,vv_inbpp1
-                        SetLsr  R3,vv_inbpp
-                        PutAsm  t_newword
-
-                        MOV     PC,LR
-02
-                        TST     R11,#mc_hasmask                 ; nothing at all if no mask
-                        [ debugcw
-                        BEQ     %FT03
-                        Debug   cw,"m_newword" ;debugging macro is not conditional. pah!
-03
-                        ]
-                        MOVEQ   PC,LR
-
-                        MOVS    R2,R11,LSR #mcb_sprtype
-
-                        GetAsm  m_newword,EQ
-                        SetLsr  R2,vv_inbpp,EQ
-                        PutAsm  m_newword,EQ
-
-                        MOVEQ   PC,LR
-
-                        MOV     R0,#32
-                        GetAsm  m1_newword1
-                        SetImm  R5,R0
-                        PutAsm  m1_newword1
-
-                        Asm     m1_newword2
-                        Asm     m1_newword3
-
-                        MOV     PC,LR
-
-; second version, for use with prevailing NE execution
-; unfortunately it has to change flags itself...
-
-msk_incrementne1        STRNE   im1,stack_temp1
-                        STRNE   im2,stack_temp2
-                        LDRNE   im1,stack_maskinshift
-                        BICNE   im1,im1,#xxx                 ;pixels per word -1
-msk_incrementne1end     LDRNE   im2,stack_maskinptr
-msk_incrementne2        ADDNE   im1,im1,#xxx             ;pixels per word
-                        BEQ     %FT98                    ;skip the next bit if not executing
-                        CMP     im1,#32
-                        ADDCS   im2,im2,#4
-msk_incrementne2end     MOVCS   im1,#0
-msk_incrementne3        STR     im1,stack_maskinshift
-                        CMP     R13,#0                   ;reset NE
-98
-                        STRNE   im2,stack_maskinptr
-                        LDRNE   im1,stack_temp1
-msk_incrementne3end     LDRNE   im2,stack_temp2
-
-
-t_start                 LDR     ttr,stack_colourttr
-t_startend              *       t_start
-
-pmt_start               TEQ     inshift,#0
-pmt_startend            MOVEQ   in1,#0
-
-p_start                 LDRNE   im1,[inptr,masko]
-p_startend              MOVNE   im1,im1,LSR inshift
-
-p1_start1               LDRNE   im1,stack_maskinptr
-                        LDRNE   im1,[im1]
-                        STRNE   im2,stack_temp1
-p1_start1end            LDRNE   im2,stack_maskinshift
-p1_start2               MOVNE   im1,im1,LSR im2
-p1_start2end            LDRNE   im2,stack_temp1
-
-
-t_start2                LDRNE   im1,stack_masko
-                        LDRNE   im1,[inptr,im1]
-t_start2end             MOVNE   im1,im1,LSR inshift
-
-
-t1_start212             STRNE   im2,stack_temp1
-                        LDRNE   im1,stack_maskinptr
-t1_start212end          LDRNE   im2,stack_maskinshift
-t1_start222             LDRNE   im1,[im1]
-                        MOVNE   im1,im1,LSR im2
-t1_start222end          LDRNE   im2,stack_temp1
-
-pmt_start2              LDRNE   in1,[inptr],#4
-pmt_start2end           MOVNE   in1,in1,LSR inshift
-
-pmt1_start2             LDRNE   im1,stack_maskinptr
-                        LDRNE   im2,stack_maskinshift
-                        LDRNE   in1,[im1]
-pmt1_start2end          MOVNE   in1,in1,LSR im2
-
-
-pt_start                ANDNE  in1,in1,im1
-pt_startend             *       pt_start
-
-pmt_start3              MOVNE   R14,#1
-                        ORRNE   in1,in1,R14,ROR inshift
-pmt_start3end           SUB     xcount,xcount,xadd
-
-mm_start                MOV     in2,#xxx                        ; outbpp_top
-mm_startend             SUB     xcount,xcount,xadd
-
-mm_start16              MOV     in2,#&FF000000
-                        ORR     in2,in2,in2,LSR #8
-mm_start16end           SUB     xcount,xcount,xadd
-
-mm_start32              MVN     in2,#0 ; &FFFFFFFF
-mm_start32end           SUB     xcount,xcount,xadd
-
-asm_start
-                        Debug   cs,"*** asm_start"
-
-                        [ multibuffer
-                        STMFD   R13!,{R1,R14}
-                        ADR     R1,calladdr0
-                        LDR     R14,thisslot
-                        STR     R10,[R1,R14]
-                        LDMFD   R13!,{R1,R14}
-                        |
-                        STR     R10,save_calladdr
-                        ]
-;
-                        AND     R0,R11,#mc_plotmask:OR:mc_hasmask
-                        TEQ     R0,#mc_plotmask
-                        BNE     %FT19
-                        [ debugcs
-                        Debug   cs,"mm_start(EQ)"
-                        ]
-                        CMP     vv_outbpp,#16
-                        Asm     mm_start16,EQ
-                        Asm     mm_start32,GT
-                        GetAsm  mm_start,LT            ; all we need is in2, if no mask
-                        SetImm  R1,vv_outbpptop,LT
-                        PutAsm  mm_start,LT
-
-                        MOV     PC,LR
-19
-;
-                        TST     R11,#mc_ttr
-
-                        Asm     t_start,NE
-;
-                        Debug   cs,"pmt_start"
-                        Asm     pmt_start
-                        TST     R11,#mc_plotmask
-                        BNE     %FT01
-                        TST     R11,#mc_hasmask
-                        BEQ     %FT01
-                        TST     R11,#mc_ttr
-                        [ debugcs
-                        B       %FT10
-11      ; code is at end of routine - breaks an ADR otherwise!
-                        ]
-                        BNE     %FT16
-                        MOVS    R1,R11,LSR #mcb_sprtype
-                        Asm     p_start,EQ
-                        Asm     p1_start1,NE
-                        Asm     p1_start2,NE
-                        B       %FT01
-16
-                        MOVS    R1,R11,LSR #mcb_sprtype
-                        Asm     t_start2,EQ
-                        Asm     t1_start212,NE
-                        Asm     t1_start222,NE
-01
-                        Debug   cs,"pmt_start2"
-
-        ; if plotting a 1bpp mask we don't use pmt_start2
-
-                        TST     R11,#mc_plotmask
-                        MOVNES  R2,R11,LSR #mcb_sprtype
-                        BEQ     %FT09
-
-                        Asm     pmt1_start2
-
-                        B       %FT08
-
-09
-                        Asm     pmt_start2
-08
-
-                        TST     R11,#mc_plotmask
-                        BNE     %FT02
-                        TST     R11,#mc_hasmask
-                        [ debugcs
-                        BNE     %FT05
-                        Debug   cs,"pt_start"
-05
-                        ]
-
-        ; this segment does nothing useful since mask and image data are combined
-        ; again below ... when dealing with 1bpp masks it becomes quite harmful
-        ; since we are directly applying 1bpp data to nbpp data!
-
-        ; Asm     pt_start,NE
-
-02
-                        TST     R11,#mc_hasmask
-                        MOVNES  R1,R11,LSR #mcb_sprtype
-                        BEQ     %FT17
-
-; AMG bug-fix from SprExtend 0.53 merged in by WRS:
-; changed assembler to reflect AMG bug fix in 0.62 (GPS)
-                        LDR     R1,save_inlog2bpp
-                        MOV     R0,#32
-                        TST     R11,#mc_plotmask
-                        MOVEQ   R0,R0,LSR R1        ; derive pix per word
-                        SUB     R0,R0,#1
-
-                        GetAsm  msk_incrementne1
-;                        MOV     R0,#&1F
-                        SetImm  R4,R0
-                        PutAsm  msk_incrementne1
-
-                        ADD     R0,R0,#1
-
-                        GetAsm  msk_incrementne2
-;                        MOV     R0,#32
-                        SetImm  R1,R0
-                        PutAsm  msk_incrementne2
-
-                        Asm     msk_incrementne3
-
-17
-                        Debug   cs,"pmt_start3"
-                        Asm     pmt_start3
-                        MOV     PC,LR
-
-                        [ debugcs
-10
-                        BNE     %FT03
-                        Debug   cs,"p_start (NE)"
-                        BEQ     %FT04
-03                      Debug   cs,"t_start2 (EQ)"
-04                      B       %BT11
-                        ]
-
-
-pmt_newpixel            ADD     xcount,xcount,xadd
-pmt_newpixelend         *       pmt_newpixel
-
-pt_newpixel             MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-pt_newpixelend          MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-pt1_newpixel            MOVS    im1,im1,LSR #1        ; inbpp
-                        MOVCS   im2,#0
-pt1_newpixelend         MOVCC   im2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-p_newpixel              MOV     in2,in1,LSL #xxx        ; 32-inbpp
-p_newpixelend           MOVS    in1,in1,LSR #xxx        ; inbpp
-
-t_newpixel              AND     in2,in1,#xxx            ; 2^inbpp-1
-t_newpixelend           MOVS    in1,in1,LSR #xxx        ; inbpp
-
-t_newpixel16            MOV     in2,in1
-t_newpixel16end         MOVS    in1,in1,LSR #16
-
-t_newpixel32            MOV     in2,in1
-                        MOV     in1,#1
-t_newpixel32end         MOVS    in1,in1,LSR #1
-
-m1_newpixel             MOVS    in1,in1,LSR #1       ; inbpp
-m1_newpixelend          *       m1_newpixel
-
-m_newpixel              MOVS    in1,in1,LSR #xxx        ; inbpp
-m_newpixelend           *       m_newpixel
-
-m_newpixel32            MOV     in1,#1
-m_newpixel32end         MOVS    in1,in1,LSR #1
-
-m_newpixel2             MOVCC   in2,#0
-m_newpixel2end          MOVCS   in2,#xxx                ; (2^outbpp-1) ROR outbpp
-
-; ##### the macro generator should not be thrown more than five instructions
-; ##### at a time, otherwise vv_inbpp (R6) gets cr*pped on !!!!!
-
-t_newpx_16to321
-                                                          ;       fedcba9876543210 fedcba9876543210
-                                                          ; in2 = 0bbbbbgggggrrrrr
-                        STR     im1,stack_temp1
-                        MOV     im1,in2,LSR #26           ; im1 =                            0bbbbb
-                        MOV     ttr,im1,LSL #19           ; ttr =        0bbbbb000 0000000000000000
-                        AND     im1,in2,#&03E00000        ; im1 = 000000ggggg00000
-t_newpx_16to321end      ORR     ttr,ttr,im1,LSR #10       ; ttr =        0bbbbb000 ggggg00000000000
-t_newpx_16to322         MOV     im1,in2,LSL #11           ; im1 = rrrrr00000000000 0000000000000000
-                        ORR     ttr,ttr,im1,LSR #24       ; ttr =        0bbbbb000 ggggg000rrrrr000
-        ;now copy the top three bits of each colour component into the bottom three
-                        MOV     im1,#&E0                  ;avoid an LDR for speed
-                        ORR     im1,im1,im1,LSL #8
-t_newpx_16to322end      ORR     im1,im1,im1,LSL #8        ; im1 = 0000000011100000 1110000011100000
-t_newpx_16to323         AND     im1,im1,ttr               ; im1 = 00000000bbb00000 ggg00000rrr00000
-                        ORR     in2,ttr,im1,LSR #5        ; in2 = 00000000bbbbbbbb ggggggggrrrrrrrr
-t_newpx_16to323end      LDR     im1,stack_temp1
-
-                                                              ;       fedcba9876543210 fedcba9876543210
-t_newpx_32to161
-                                                              ; in2 = 00000000bbbbbbbb ggggggggrrrrrrrr
-                        AND     xadd,in2,#&F80000             ; im1 = 00000000bbbbb000 0000000000000000
-                        MOV     ttr,xadd,LSL #7               ; ttr = 0bbbbb0000000000
-                        AND     xadd,in2,#&F800               ; im1 = 0000000000000000 ggggg00000000000
-t_newpx_32to161end      ORR     ttr,ttr,xadd,LSL #10          ; ttr = 0bbbbbggggg00000
-t_newpx_32to162         AND     xadd,in2,#&F8                 ; im1 = 0000000000000000 00000000rrrrr000
-                        ORR     in2,ttr,xadd,LSL #13          ; in2 = 0bbbbbgggggrrrrr
-                        LDR     xadd,stack_xadd
-t_newpx_32to162end      LDR     ttr,stack_colourttr
-
-t_newpixel2             LDRB    in2,[ttr,in2]
-t_newpixel2end          MOV     in2,in2,ROR #xxx        ; outbpp
-
-                        [ ignore_ttr
-t_newpixel3             LDR    in2,[ttr,in2,LSL #3]
-t_newpixel3end          MOV    in2,in2,LSR #8
-                 ; if 16 need to munge down into top two bytes, if 32 no
-                 ; adjustment needed
-                        ]
-
-pt_newpixel_ext         MOVS    im1,im1,LSR #xxx        ; inbpp
-                        MOVCS   im2,#0
-pt_newpixel_extend      LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-                        ASSERT  (pt_newpixel_extend -pt_newpixel_ext) = (pt_newpixelend -pt_newpixel)
-
-pt1_newpixel_ext        MOVS    im1,im1,LSR #1        ; inbpp
-                        MOVCS   im2,#0
-pt1_newpixel_extend     LDRCC   im2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-                        ASSERT  (pt_newpixel_extend -pt_newpixel_ext) = (pt_newpixelend -pt_newpixel)
-
-t_makeindex321          ;the 32K table use bits of r,g,b as the index, so 32bpp needs to
-                        ;be munged down into 5bits of each colour
-                        STR      im1,stack_temp1
-                        ;im1 is being used as a temporary register here
-                                                     ; in2 = 0000 0000 bbbb bbbb gggg gggg rrrr rrrr
-                        MOV      im1,in2,LSR #19     ; im1 = 0000 0000 0000 0000 0000 0000 000b bbbb
-                        MOV      im1,im1,LSL #5      ; im1 = 0000 0000 0000 0000 0000 00bb bbb0 0000
-t_makeindex321end       MOV      in2,in2,LSL #16     ; in2 = gggg gggg rrrr rrrr 0000 0000 0000 0000
-t_makeindex322          ORR      im1,im1,in2,LSR #27 ; im1 = 0000 0000 0000 0000 0000 00bb bbbg gggg
-                        MOV      im1,im1,LSL #5      ; im1 = 0000 0000 0000 0000 0bbb bbgg ggg0 0000
-                        MOV      in2,in2,LSL #8      ; in2 = rrrr rrrr 0000 0000 0000 0000 0000 0000
-                        ORR      in2,im1,in2,LSR #27 ; in2 = 0000 0000 0000 0000 0bbb bbgg gggr rrrr
-t_makeindex322end       LDR      im1,stack_temp1
-
-
-t_makeindex16           MOV      in2,in2,LSL #17
-t_makeindex16end        MOV      in2,in2,LSR #17
-
-t_use32Ktable           ;note, there is an additional indirection to play with here!
-                        STR     im1,stack_temp1
-                        LDR     im1,[ttr,#4]
-                        LDRB    in2,[im1,in2]
-                        LDR     im1,stack_temp1
-t_use32Ktableend        MOV     in2,in2,ROR #xxx ;outbpp
-
-
-t_newpixel216           LDR     in2,[ttr, in2, ASL #2]
-t_newpixel216end        MOV     in2,in2,ROR #xxx     ; outbpp
-                        ASSERT  (t_newpixel216end -t_newpixel216) = (t_newpixel2end -t_newpixel2)
-
-t_newpixel232           LDR     in2,[ttr, in2, ASL #2]
-t_newpixel232end        NOP
-                        ASSERT  (t_newpixel232end -t_newpixel232) = (t_newpixel2end -t_newpixel2)
-
-
-m_newpixel2_ext         MOVCC   in2,#0
-m_newpixel2_extend      LDRCS   in2,stack_maskword      ; (2^outbpp-1) ROR outbpp
-                        ASSERT  (m_newpixel2_extend -m_newpixel2_ext) = (m_newpixel2end -m_newpixel2)
-asm_newpixel
-                        Label   l_newpixel
-
-                        Debug   cn,"*** asm_newpixel"
-;
-                        Debug   cn,"pmt_newpixel"
-                        Asm     pmt_newpixel
-;
-                        TST     R11,#mc_plotmask
-                        BEQ     %FT01
-                        TST     R11,#mc_hasmask         ; if no mask, no code needed!
-                        MOVEQ   PC,LR
-
-                        MOVS    R2,R11,LSR #mcb_sprtype
-                        Asm     m1_newpixel,NE
-                        BNE     %FT02
-
-                        CMP     vv_inbpp,#32
-
-                        Debug   cn,"m_newpixel"
-
-                        Asm     m_newpixel32,CS
-                        BCS     %FT02
-
-                        GetAsm  m_newpixel
-                        SetLsr  R1,vv_inbpp
-                        PutAsm  m_newpixel
-                        B       %FT02
-01
-                        TST     R11,#mc_hasmask
-                        BEQ     %FT47
-
-                        MOVS    R1,R11,LSR #mcb_sprtype
-                        BEQ     %FT46
-
-                        CMP     vv_outbpp,#16
-
-                        GetAsm  pt1_newpixel,LT
-                        SetImm  R3,vv_outbpptop,LT
-                        PutAsm  pt1_newpixel,LT
-
-                        Asm     pt1_newpixel_ext,GE
-                        B       %FT47
-46
-                        CMP     vv_outbpp,#16
-                        Debug   cn,"newpixel"
-                        GetAsm  pt_newpixel,LT        ; pick up and modify the appropriate code
-                        GetAsm  pt_newpixel_ext,GE
-                        SetLsr  R1,vv_inbpp
-                        SetImm  R3,vv_outbpptop,LT
-                        PutAsm  pt_newpixel,LT
-                        PutAsm  pt_newpixel_ext,GE
-47
-                        Debug   cn,"adding two words for ttr"
-
-                        ;if doing 16->32 or 32->16
-
-                        TST     R11,#mc_ttr
-                        BNE     %FT51
-                        ADR     R1,p_newpixel
-                        LDMIA   R1,{R1,R2}
-                        RSB     R0,vv_inbpp,#32
-                        SetLsl  R1,R0
-                        SetLsr  R2,vv_inbpp
-                        STMIA   R10!,{R1-R2}
-                        B       %FT02
-51
-                        CMP     vv_inbpp,#16
-
-                        ADRCC   R1,t_newpixel
-                        ADREQ   R1,t_newpixel16
-                        ADRHI   R1,t_newpixel32
-                        LDMLSIA R1,{R1,R2}
-                        LDMHIIA R1,{R1-R3}
-                        SetImm  R1,vv_inbpp1,CC
-                        SetLsr  R2,vv_inbpp,CC
-52
-                        STMLSIA   R10!,{R1,R2}
-                        STMHIIA   R10!,{R1-R3}
-02
-                        Debug   cn,"Branch to l_newword"
-                        Branch  BLEQ,l_newword
-
-                        TST     R11,#mc_plotmask
-                        BEQ     %FT47
-;
-                        Debug   cn,"newpixel2"
-                        CMP     vv_outbpp,#16
-                        GetAsm  m_newpixel2,LT
-                        SetImm  R2,vv_outbpptop,LT
-                        PutAsm  m_newpixel2,LT
-                        Asm     m_newpixel2_ext,GE
-47
-;
-                        TST     R11,#mc_ttr                             ; is there a translation table?
-                        BNE     %FT53
-
-        ;if we are doing 16->32 or 32->16 there is no translation table - instead
-        ;a specific munger is used to bit shuffle the word.
-
-                        CMP     vv_inbpp,vv_outbpp
-                        BEQ     %FT54
-                        CMP     vv_outbpp,#16
-                        BCC     %FT54
-
-                        CMP     vv_inbpp,#16
-                        BCC     %FT54
-
-        ;if EQ we are doing 16->32 otherwise it is 32->16
-
-                        Asm     t_newpx_16to321,EQ
-                        Asm     t_newpx_16to322,EQ
-                        Asm     t_newpx_16to323,EQ
-                        Asm     t_newpx_32to161,NE
-                        Asm     t_newpx_32to162,NE
-54
-                        MOV   PC,LR
-53
-        ;if we are going from 16/32 to 8/less bpp we translate via a
-        ;32K table, so check for these cases....
-
-                        CMP     vv_outbpp,#16
-                        BCS     %FT56
-                        CMP     vv_inbpp,#16
-                        BCC     %FT56
-
-        ;if EQ it is input=16, else NE means 32 as input
-
-                        Asm     t_makeindex321,NE
-                        Asm     t_makeindex322,NE
-
-                        Asm     t_makeindex16 ;always include it, to chop any high
-                                              ;bits off
-
-                        GetAsm  t_use32Ktable
-                        SetLsr  R5,vv_outbpp
-                        PutAsm  t_use32Ktable
-
-                        MOV     PC,LR
-56
-                        [ ignore_ttr
-                        ;if doing <16 to >8 then use the palette instead
-                        CMP     vv_inbpp,#16
-                        BCS     %FT57
-                        CMP     vv_outbpp,#16
-                        BCC     %FT57
-                        TST     R11,#mc_ttrispalette
-                        BEQ     %FT57
-
-                        GetAsm  t_newpixel3
-                        PutAsm  t_newpixel3
-
-                        CMP     vv_outbpp,#32
-                        Asm     t_newpx_32to161,NE
-                        Asm     t_newpx_32to162,NE
-
-                        B       %FT03
-57
-                        ]
-                        CMP     vv_outbpp,#16                           ; decide which translation function
-
-                        GetAsm t_newpixel2,LT                          ; getting the one required
-                        GetAsm t_newpixel216,EQ
-                        Asm    t_newpixel232,GT
-                        SetLsr R2,vv_outbpp,LE
-                        PutAsm t_newpixel2,LT
-                        PutAsm t_newpixel216,EQ
-03
-                        MOV     PC,LR
-
-                        [ debugcn
-10
-                        Debug  cg,"t_newpixel2"
-                        B      %BT11
-                        ]
-
-pmt_tryoutput           SUBS    xcount,xcount,xdiv
-
-ptm_tryoutput           ORR     outmask,im2,outmask,LSR #xxx    ; outbpp
-pt_tryoutput            MOV     outmask,outmask,LSR #xxx        ; outbpp
-
-ptm32_tryoutput         MOV     outmask,im2
-pt32_tryoutput          MOV     outmask,#0
-
-pmt_tryout2             ORRS    outword,in2,outword,LSR #xxx    ; outbpp
-                        MOV     R14,R14         ; branch
-pmt_tryout2end          SUBS    xsize,xsize,#1
-
-pmt_tryout32            MOVS    outword,in2     ; nothing to mask through
-                        MOV     R14,R14         ; branch
-pmt_tryout32end         SUBS     xsize,xsize,#1
-
-pmt_tryoutput4          LDR     PC,stack_returnaddr
-
-asm_tryoutput
-                        Label   l_tryoutput
-                        Debug   co,"*** asm_tryoutput" ;
-                        Debug   co,"pmt_tryoutput (1 word)"
-                        LDR     R1,pmt_tryoutput
-                        STR     R1,[R10],#4
-                        Debug   co,"branch to l_newpixel"
-                        Branch  BCC,l_newpixel
-;
-                        TST     R11,#mc_plotmask
-                        BNE     %FT01
-;
-                        Debug   co,"ptm/pt_tryoutput (1 word)"
-
-                        CMP     vv_outbpp,#32
-                        BLT     %FT10
-                        ;new code to make 32 bit go
-                        TST     R11,#mc_hasmask
-                        LDRNE   R1,ptm32_tryoutput
-                        LDREQ   R1,pt32_tryoutput
-                        B       %FT11
-10
-                        TST     R11,#mc_hasmask
-                        LDRNE   R1,ptm_tryoutput
-                        LDREQ   R1,pt_tryoutput
-                        SetLsr  R1,vv_outbpp
-11
-                        STR     R1,[R10],#4
-01
-                        Debug   co,"Skipping a word"
-                        ADD     R0,R10,#4
-                        STR     R0,[sp,#l_fref]         ; forward reference filled in later
-                        Debug   co,"tryout2"
-                        CMP     vv_outbpp,#32
-                        GetAsm  pmt_tryout2,NE
-                        GetAsm  pmt_tryout32,EQ
-                        SetLsr  R1,vv_outbpp,NE
-                        PutAsm  pmt_tryout2,NE
-                        PutAsm  pmt_tryout32,EQ
-                        Debug   co,"branch l_tryoutput"
-                        Branch  BGT,l_tryoutput
-                        Debug   co,"pmt_tryoutput4 (1 word)"
-                        LDR     R1,pmt_tryoutput4
-                        STR     R1,[R10],#4
-;
-                        MOV     PC,LR
-
-pmt_putmany             MOV     vcount,R14
-pmt_putmanyend          MOV     xdiv,outptr
-
-m_putmany               LDMDB   ecfptr!,{ecfora,ecfeor}
-m_ecflimit              CMP     ecfptr,#xxx                     ; ecflimit
-                        ADDLS   ecfptr,ecfptr,#64
-                        AND     ecfora,ecfora,outword
-m_putmanyend            AND     ecfeor,ecfeor,outword
-
-pmt_putmany22           STR     R14,[outptr]                    ;   "
-                        LDR     R14,stack_outoffset             ;   "
-                        SUB     outptr, outptr, R14             ;   "
-pmt_putmany22end        SUBS    vcount,vcount,#1                ;   "
-m_putmany2              LDR     ecfptr,stack_ecfptr
-m_putmany2end           *       m_putmany2
-
-pmt_putmany3            ADD     outptr,xdiv,#4
-                        LDR     xdiv,stack_xdiv
-pmt_putmany3end         LDR     xadd,stack_xadd
-                        ASSERT  vcount = xadd
-
-asm_putmany
-                        Label   l_putmany
-                        Debug   cp,"*** asm_putmany"
-                        Debug   cp,"pmt_putmany"
-                        Asm     pmt_putmany
-                        Debug   cp,"Label l_vloop"
-                        Label   l_vloop
-;
-                        TST     R11,#mc_plotmask
-                        MOVEQ   R0,#0
-                        ADDNE   R0,R10,#4
-                        [ multibuffer
-                        STMFD   R13!,{R1,R14}
-                        LDR     R14,thisslot
-                        ADR     R1,pc_ecflimit0
-                        STR     R0,[R1,R14]
-                        LDMFD   R13!,{R1,R14}
-                        |
-                        STR     R0,pc_ecflimit                  ; remember for later
-                        ]
-                        Debug   cp,"m_putmany (NE)"
-                        Asm     m_putmany,NE
-;
-                        Push    "LR"
-                        Debug   cp,"asm_gcolaction"
-                        BL      asm_gcolaction                  ; depends on GCOL action
-                        [ multibuffer
-                        STMFD   R13!,{R1,R14}
-                        LDR     R14,thisslot
-                        ADR     R1,pc_outoffset0
-                        STR     R10,[R1,R14]
-                        LDMFD   R13!,{R1,R14}
-                        |
-                        STR     R10,pc_outoffset                ; remember for later
-                        ]
-
-                        ; new version to get over implicit limit in old code
-                        Asm     pmt_putmany22                   ; Merged from 0.62 (GPS)
-
-                        Debug   cp,"branch on NE to l_vloop+4"
-                        Branch  BNE,l_vloop+4                   ; allow for R14 on stack
-
-;
-                        TST     R11,#mc_plotmask
-                        Debug   cp,"m_putmany2 (NE)"
-                        Asm     m_putmany2,NE
-;
-                        Debug   cp,"pmt_putmany3"
-                        Asm     pmt_putmany3
-                        Debug   cp,"asm_nextword"
-                        BL      asm_nextword
-                        Pull    "PC"
-
-pt_gcolprelude1         MVN     outword,outmask         ; Invert
-pt_gcolprelude2         MVN     outword,outword         ; AND-NOT, ORR-NOT
-pt_gcolprelude3         ORR     outword,outword,outmask
-
-pt_putword              BIC     outword,outword,outmask
-pt_putwordend           *       pt_putword
-
-pmt_putword             LDR     R14,stack_vcount
-pmt_putwordend          CMP     R14,#1
-
-m_putword               LDMDB   ecfptr,{ecfora,ecfeor}
-                        AND     ecfora,ecfora,outword
-m_putwordend            AND     ecfeor,ecfeor,outword
-
-pmt_putword2            STR     R14,[outptr],#4
-pmt_putword2end         *       pmt_putword2
-
-asm_putword
-                        Debug   mc,"Putword is at",R10
-                        Debug   cg,"Putword is at",R10
-                        [ multibuffer
-                        STMFD   R13!,{R1,R14}
-                        ADR     R1,calladdr20
-                        LDR     R14,thisslot
-                        STR     R10,[R1,R14]
-                        LDMFD   R13!,{R1,R14}
-                        |
-                        STR     R10,save_calladdr2
-                        ]
-                        Label   l_putword
-                        TST     R11,#mc_plotmask
-                        BNE     %FT01
-                        AND     R0,R11,#mc_gcol
-                        CMP     R0,#4
-                        LDREQ   R1,pt_gcolprelude1              ; Invert
-                        LDRGT   R1,pt_gcolprelude2              ; AND-NOT, ORR-NOT
-                        STRGE   R1,[R10],#4
-                        CMP     R0, #2
-                        LDREQ   R1,pt_gcolprelude3              ; AND - bug fix
-                        STREQ   R1,[R10],#4
-                        CMPNE   R0, #6
-                        Asm     pt_putword,NE
-01
-                        Asm     pmt_putword
-                        Branch  BGT,l_putmany
-;
-                        TST     R11,#mc_plotmask
-                        Asm     m_putword,NE
-;
-                        Push    "LR"
-                        BL      asm_gcolaction                  ; depends on GCOL action
-                        Asm     pmt_putword2
-                        BL      asm_nextword
-                        Pull    "PC"
-
-pmt_nextword            MOV     outword,#&80000000
-                        MOV     outmask,#0
-pmt_nextwordend         SUBS    xsize,xsize,#1
-
-pmt_nextword2           LDR     PC,stack_returnaddr
-pmt_nextword2end        *     pmt_nextword2
-
-asm_nextword            Asm     pmt_nextword
-                        Branch  BGT,l_tryoutput+4               ; allow for R14 on stack
-                        Asm     pmt_nextword2
-                        MOV     PC,LR
-
-pmt_gcol                LDR     R14,[outptr]
-
-pt_gcolactions          AND     R14,R14,outmask         ; Store actually uses 2 instrs
-                        ORR     R14,R14,outword
-                        AND     R14,R14,outword
-                        EOR     R14,R14,outword
-                        EOR     R14,R14,outword         ; MVN outword,outmask
-                        MOVNV   R14,R14
-                        AND     R14,R14,outword         ; MVN outword,outword
-                        ORR     R14,R14,outword         ; MVN outword,outword
-
-m_gcolaction            ORR     R14,R14,ecfora
-                        EOR     R14,R14,ecfeor
-
-asm_gcolaction
-                        LDR     R1,pmt_gcol
-                        ADR     R2,pt_gcolactions
-                        EOR     R0,R11,#mc_plotmask
-                        TST     R0,#mc_plotmask
-                        ADREQ   R2,m_gcolaction
-                        ANDNES  R0,R11,#mc_gcol
-                        LDMEQIA R2,{R2,R3}                      ; 2 instructions for STORE/mask
-                        LDRNE   R2,[R2,R0,LSL #2]               ; 1 instruction for others
-                        STMEQIA R10!,{R1-R3}
-                        STMNEIA R10!,{R1-R2}
-                        MOV     PC,LR
-
-      ]
-
 ;;-----------------------------------------------------------------------------
 ;; Merge Sprites (horizontally or vertically)
 ;;
@@ -5750,28 +3827,6 @@ FindMaskWidth ROUT
         InsertHostDebugRoutines
       ]
 
-      [ debugcg
-ag_disasm
-      ;disassemble R1 to R[R9]
-      ;base for R1=R10
-      EntryS "R0-R12"
-      dreg R10,"At: " ;location
-      dreg R9,"#words = "
-      SUB R9,R9,#1
-01    STMFD R13!,{R1-R8}
-      LDMFD R13!,{R0-R7} ;move everything down one reg
-      STMFD R13!,{R0-R3} ;save registers the SWI will change
-      MOV R1,R10         ;get the location into place
-
-      SWI Debugger_Disassemble
-      dstring R1,"" ;disassembly
-      ADD R10,R10,#4
-      LDMFD R13!,{R0-R3}
-      SUBS R9,R9,#1
-      BPL %BT01
-      EXITS              ;ensure we return flags how they started....
-      ]
-
 Go_CheckSpriteArea
         Push    "R1-R2,SL,LR"
         MOV     r2, r0                  ; save r0 in r2
diff --git a/VersionASM b/VersionASM
index 45dd904..c1b5647 100644
--- a/VersionASM
+++ b/VersionASM
@@ -11,13 +11,13 @@
                         GBLS    Module_HelpVersion
                         GBLS    Module_ComponentName
                         GBLS    Module_ComponentPath
-Module_MajorVersion     SETS    "1.25"
-Module_Version          SETA    125
+Module_MajorVersion     SETS    "1.26"
+Module_Version          SETA    126
 Module_MinorVersion     SETS    ""
 Module_Date             SETS    "17 Sep 2010"
 Module_ApplicationDate  SETS    "17-Sep-10"
 Module_ComponentName    SETS    "SprExtend"
 Module_ComponentPath    SETS    "mixed/RiscOS/Sources/Video/Render/SprExtend"
-Module_FullVersion      SETS    "1.25"
-Module_HelpVersion      SETS    "1.25 (17 Sep 2010)"
+Module_FullVersion      SETS    "1.26"
+Module_HelpVersion      SETS    "1.26 (17 Sep 2010)"
                         END
diff --git a/VersionNum b/VersionNum
index 82b1469..55d5267 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,15 +1,15 @@
-/* (1.25)
+/* (1.26)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  * Last processed by srccommit version: 1.1.
  *
  */
-#define Module_MajorVersion_CMHG        1.25
+#define Module_MajorVersion_CMHG        1.26
 #define Module_MinorVersion_CMHG        
 #define Module_Date_CMHG                17 Sep 2010
 
-#define Module_MajorVersion             "1.25"
-#define Module_Version                  125
+#define Module_MajorVersion             "1.26"
+#define Module_Version                  126
 #define Module_MinorVersion             ""
 #define Module_Date                     "17 Sep 2010"
 
@@ -18,6 +18,6 @@
 #define Module_ComponentName            "SprExtend"
 #define Module_ComponentPath            "mixed/RiscOS/Sources/Video/Render/SprExtend"
 
-#define Module_FullVersion              "1.25"
-#define Module_HelpVersion              "1.25 (17 Sep 2010)"
-#define Module_LibraryVersionInfo       "1:25"
+#define Module_FullVersion              "1.26"
+#define Module_HelpVersion              "1.26 (17 Sep 2010)"
+#define Module_LibraryVersionInfo       "1:26"
-- 
GitLab