Commit 2ef684d7 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Made 32-bit compatible.

  Removed assembler that can be imported from AsmUtils
Admin:
  Built.

Version 0.47. Tagged as 'Picker-0_47'
parent f78aad4f
......@@ -63,7 +63,7 @@ WFLAGS = f~c~vr
#
# Include files
#
INCLUDES= -ISupport011,icons,OS:,C:
INCLUDES= -IC:AsmUtils,Support011,icons,OS:,C:
#
# Libraries
......@@ -72,6 +72,7 @@ CLIB = Clib:o.Stubs
ROMCSTUBS = RISCOSLIB:o.romcstubs
ABSSYM = RISC_OSLib:o.AbsSym
OSLIB = OSLib:o.OSLib
ASMUTILS = C:AsmUtils.o.AsmUtilsZM
DEPEND = -depend !Depend
DBGFLAGS = -DTRACE
......@@ -79,10 +80,10 @@ DEFINES =
CENV = ${DEPEND} ${THROWBACK}
ASFLAGS = ${DEPEND} ${THROWBACK}
CFLAGS = -c -ffh -zM -zps1 -Wcp ${INCLUDES} ${DEFINES} ${CENV}
CFLAGS = -W -c -ffh -zM -zps1 -Wcp ${INCLUDES} ${DEFINES} ${CENV}
CMHGFLAGS = ${DEPEND} ${THROWBACK} -p
OTHER_OBJS = o.muldiv o.veneer o.header
OTHER_OBJS = o.veneer o.header
ROM_OBJS = or.cmyk or.dialogue or.helpreply or.hsv \
or.main or.model or.rgb or.tables \
......@@ -208,19 +209,19 @@ export:
#
# Targets
#
${RAM_MODULE}: ${RAM_OBJS} ${CLIB} ${OSLIB} ${ICONS}
${RAM_MODULE}: ${RAM_OBJS} ${CLIB} ${OSLIB} ${ICONS} ${ASMUTILS}
${MKDIR} rm
$(LD) -o $@ -rmf ${RAM_OBJS} ${CLIB} ${OSLIB}
$(LD) -o $@ -rmf ${RAM_OBJS} ${CLIB} ${OSLIB} ${ASMUTILS}
${MODSQZ} $@
Access $@ RW/R
${ROM_MODULE}: ${ROM_OBJS} ${OSLIB} ${ROMCSTUBS} ${ICONS}
${ROM_MODULE}: ${ROM_OBJS} ${OSLIB} ${ROMCSTUBS} ${ICONS} ${ASMUTILS}
${MKDIR} aof
$(LD) -o $@ -aof ${ROM_OBJS} ${OSLIB} ${ROMCSTUBS}
$(LD) -o $@ -aof ${ROM_OBJS} ${OSLIB} ${ROMCSTUBS} ${ASMUTILS}
${DBG_MODULE}: ${DBG_OBJS} ${CLIB} ${OSLIB} ${ICONS}
${DBG_MODULE}: ${DBG_OBJS} ${CLIB} ${OSLIB} ${ICONS} ${ASMUTILS}
${MKDIR} rm
$(LD) -o $@ -rmf ${DBG_OBJS} ${OSLIB} ${CLIB}
$(LD) -o $@ -rmf ${DBG_OBJS} ${OSLIB} ${CLIB} ${ASMUTILS}
Access $@ RW/R
${RESF}: ${RESOURCEFILES}
......
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef muldiv_H
#define muldiv_H
/*muldiv.h*/
extern int muldiv (int, int, int);
#endif
/* (0.46)
/* (0.47)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.46
#define Module_MajorVersion_CMHG 0.47
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Apr 2000
#define Module_Date_CMHG 08 May 2000
#define Module_MajorVersion "0.46"
#define Module_Version 46
#define Module_MajorVersion "0.47"
#define Module_Version 47
#define Module_MinorVersion ""
#define Module_Date "06 Apr 2000"
#define Module_Date "08 May 2000"
#define Module_FullVersion "0.46"
#define Module_FullVersion "0.47"
; Copyright 1999 Pace Micro Technology plc
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
a1 RN 0
a2 RN 1
a3 RN 2
a4 RN 3
v1 RN 4
v2 RN 5
ip RN 12
sp RN 13
lr RN 14
pc RN 15
AREA |C$$code|, CODE, READONLY
EXPORT muldiv
;;;; IMPORT raise
muldiv
; muldiv(a, b, c)
; result = a*b/c
; the intermediate product is 64 bits long
; do everything using moduluses, and sort out signs later
STMFD sp!, {a1, a2, a3, a4, v1, v2, lr}
; first, the double-length product, returned in a3 & a4
; uses ip, a1 and a2 as workspace
MOV a3, #0
MOV a4, #0
MOV ip, #0
CMPS a2, #0
RSBLT a2, a2, #0 ; abs b
MOV v2, a2
CMPS a1, #0
RSBLT a1, a1, #0 ; abs a
muldiv0
MOVS a2, a2, LSR #1
BCC muldiv1
ADDS a4, a4, a1
ADC a3, a3, ip
muldiv1
MOVS a1, a1, ASL #1
ADC ip, ip, ip
CMPS a2, #0
BNE muldiv0
; now the 64*32 bit divide
; dividend in a3 and a4
; remainder ends up in a4; quotient in ip
; uses a1 and a2 to hold the (shifted) divisor;
; v1 for the current bit in the quotient
LDR a2, [sp, #8] ; recover divisor
CMPS a2, #0
LDMEQFD sp!, {a1-a4, v1, v2, pc}^
;;was BEQ muldiv_by_0, but we might be a module
RSBLT a2, a2, #0 ; abs c
MOV v2, a2
MOV ip, #0
MOV a1, #0
MOV v1, #0
MOV lr, #1
muldiv2
CMPS a1, #&80000000
BCS muldiv3
CMPS a1, a3
CMPEQS a2, a4 ; compare of [a1, a2] against [a3, a4]
BCS muldiv3
MOVS a2, a2, ASL #1
MOV a1, a1, ASL #1
ADC a1, a1, #0
ADD v1, v1, #1
B muldiv2
muldiv3
CMPS a1, a3
CMPEQS a2, a4
BHI muldiv4
CMPS v1, #31
ADDLE ip, ip, lr, ASL v1
SUBS a4, a4, a2
SBC a3, a3, a1
muldiv4
MOVS a1, a1, ASR #1
MOV a2, a2, RRX
SUBS v1, v1, #1
BGE muldiv3
; now all we need to do is sort out the signs.
LDMFD sp!, {a1, a2, a3, v1}
EOR a2, a2, a1 ; a2 has the sign of a*b: a3 is the sign of c
MOV a1, ip
TEQS a2, a3 ; if a*b and c have opposite signs,
RSBMI a1, a1, #0 ; negate the quotient
CMPS a2, #0 ; and if the dividend was negative,
RSBLT a4, a4, #0 ; negate the remainder
;;;; Now discard the remainder - J R C 19 March 1991
;;;; STR a4, [v1]
LDMFD sp!, {v1, v2, pc}^
muldiv_by_0 ;not used
;;;; LDMFD sp!, {a1-a4, v1, v2, lr}
;;;; MOV a1, #2 ; SIGFPE
;;;; B raise
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment