Skip to content

Commit

Permalink
Imported from svn tag fireworkz__2022_11_06__2_32_01
Browse files Browse the repository at this point in the history
  • Loading branch information
skswales committed Nov 6, 2022
1 parent 7497e8e commit 2a5edfb
Show file tree
Hide file tree
Showing 23 changed files with 309 additions and 36 deletions.
10 changes: 0 additions & 10 deletions README.md

This file was deleted.

2 changes: 1 addition & 1 deletion t5/Build/windows/OUTx86/BLDCD2.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
pushd %~dp0
IF NOT EXIST BLDCD2.BAT EXIT

set BLDCD2_DIR=fwin-23200
set BLDCD2_DIR=fwin-23201

rmdir /s /q %BLDCD2_DIR%
@del %BLDCD2_DIR%.zip
Expand Down
4 changes: 2 additions & 2 deletions t5/Build/windows/OUTx86/firewrkz-x86.iss
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ MinVersion=5.1sp3
; Require XP SP3
; AppVersion=2.xx.yy
; AppVerName=Colton Software Fireworkz 2.xx.yy
AppVersion=2.32.00
AppVerName=Colton Software Fireworkz 2.32.00
AppVersion=2.32.01
AppVerName=Colton Software Fireworkz 2.32.01
AppCopyright=Copyright (C) 1992-2022 Colton Software
AppId=Colton Fireworkz for Windows (32-bit)
AppName=Colton Software Fireworkz for Windows (32-bit)
Expand Down
2 changes: 1 addition & 1 deletion t5/Build/windows/firewrkz-vs2019.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug XP|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\cmodules\mathxcpx.c" />
<ClCompile Include="..\..\cmodules\muldiv64.c" />
<ClCompile Include="..\..\cmodules\muldiv86.c" />
<ClCompile Include="..\..\cmodules\riscos\myrand.s">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug XP ANSI|Win32'">true</ExcludedFromBuild>
Expand Down
2 changes: 1 addition & 1 deletion t5/Build/windows/firewrkz-vs2019.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@
<ClCompile Include="..\..\cmodules\ss_string.c">
<Filter>Source Files\ob_skel\ob_skel_cmodules</Filter>
</ClCompile>
<ClCompile Include="..\..\cmodules\muldiv64.c">
<ClCompile Include="..\..\cmodules\muldiv86.c">
<Filter>Source Files\ob_skel\ob_skel_cmodules</Filter>
</ClCompile>
</ItemGroup>
Expand Down
25 changes: 25 additions & 0 deletions t5/cmodules/gr_coord.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ gr_scale_from_s32_pair(
_InVal_ S32 numerator,
_InVal_ S32 denominator)
{
#if defined(PORTABLE_MULDIV64)
MULDIV64_REMOVF removf;
GR_SCALE num;

Expand All @@ -115,6 +116,30 @@ gr_scale_from_s32_pair(
}

return((removf.overflow < 0) ? -GR_SCALE_MAX : +GR_SCALE_MAX);
#else
GR_SCALE num;
S32 overflow;

if(numerator == 0)
return(GR_SCALE_ZERO);

num = muldiv64(numerator, GR_SCALE_ONE, denominator);

/* check not OTT */
overflow = muldiv64_overflow();

if(overflow > 0)
return(+GR_SCALE_MAX);

if(overflow < 0)
return(-GR_SCALE_MAX);

/* SKS create rounding scale (assumes denominator +ve) */
if((muldiv64_remainder() * 2) > denominator)
++num;

return(num);
#endif
}

/******************************************************************************
Expand Down
16 changes: 16 additions & 0 deletions t5/cmodules/muldiv.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ extern void
muldiv64_init(void);
#endif

#if !defined(PORTABLE_MULDIV64)

/* the overflow from a prior muldiv64() */

_Check_return_
extern S32
muldiv64_overflow(void);

/* the remainder from a prior muldiv64() */

_Check_return_
extern S32
muldiv64_remainder(void);

#endif /* PORTABLE_MULDIV64 */

#if defined(__cplusplus)
}
#endif
Expand Down
237 changes: 237 additions & 0 deletions t5/cmodules/muldiv86.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
/* muldiv86.c */

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Copyright (C) 1993-1998 Colton Software Limited
* Copyright (C) 1998-2015 R W Colton */

#include "common/gflags.h"

#if defined(_WINDOWS)

#pragma warning(push)
#pragma warning(disable: 4255) /* '__getcallerseflags' : no function prototype given: converting '()' to '(void)' */
#pragma warning(disable: 4668) /* '_M_IA64' is not defined as a preprocessor macro */
#include <intrin.h>
#pragma warning(pop)

#pragma intrinsic(__emul)

static
struct MULDIV64_STATICS
{
int32_t remainder;
int32_t overflow;
}
muldiv64_statics;

_Check_return_
extern int32_t
muldiv64_overflow(void)
{
return(muldiv64_statics.overflow);
}

_Check_return_
extern int32_t
muldiv64_remainder(void)
{
return(muldiv64_statics.remainder);
}

/*
* result = (dividend * multiplier) / divisor with 64-bit intermediate calculation
*
* notes:
* 1 Will give INT 0 trap if divisor == 0
* 2 divisor must be +ve
*
*/

/* rounds towards -inf, remainder always +ve */

_Check_return_
extern int32_t
muldiv64(
_InVal_ int32_t dividend,
_InVal_ int32_t multiplier,
_InVal_ int32_t divisor)
{
int64_t product_s64;
int64_t quotient_s64;
int32_t quotient_int32_t;

muldiv64_statics.remainder = 0;
muldiv64_statics.overflow = 0;

#if 1
product_s64 = __emul(dividend, multiplier); /* __int64 mul of two 32-bit values wasteful */
#else
product_s64 = (S64) dividend * multiplier;
#endif

/* like idiv_floor */
if(product_s64 >= 0)
quotient_s64 = product_s64 / divisor;
else
quotient_s64 = (product_s64 - (divisor - 1)) / divisor;

if(quotient_s64 < INT32_MIN)
{
quotient_int32_t = INT32_MIN;
muldiv64_statics.overflow = -1;
}
else if(quotient_s64 > INT32_MAX)
{
quotient_int32_t = INT32_MAX;
muldiv64_statics.overflow = 1;
}
else
{
quotient_int32_t = (int32_t) quotient_s64;
#if 1
muldiv64_statics.remainder = (int32_t) (product_s64 - __emul(quotient_int32_t, divisor)); /* always +ve */
#else
muldiv64_statics.remainder = (int32_t) (product_s64 - ((S64) quotient_int32_t * divisor)); /* always +ve */
#endif
assert(muldiv64_statics.remainder >= 0);
}

return(quotient_int32_t);
}

/*
round result towards +inf as ceil()
result =
(sgn(a*b*divisor) -ve)
? (a*b) / divisor
: ((a*b) + (divisor-1)) / divisor
*/

_Check_return_
extern int32_t
muldiv64_ceil(
_InVal_ int32_t dividend,
_InVal_ int32_t multiplier,
_InVal_ int32_t divisor)
{
int32_t res = muldiv64(dividend, multiplier, divisor);

if(muldiv64_statics.remainder != 0)
{
const U32 sign_bit = (dividend ^ multiplier ^ divisor) & 0x80000000U;
assert(0 == muldiv64_statics.overflow);
assert(muldiv64_statics.remainder > 0);
muldiv64_statics.remainder = 0;
if(sign_bit)
{ /*EMPTY*/
}
else
{
assert(res != INT32_MAX);
res += 1;
}
}

return(res);
}

/*
round result towards -inf as floor()
result =
(sgn(a*b*divisor) +ve)
? (a*b) / divisor
: ((a*b) - (divisor-1)) / divisor
*/

_Check_return_
extern int32_t
muldiv64_floor(
_InVal_ int32_t dividend,
_InVal_ int32_t multiplier,
_InVal_ int32_t divisor)
{
int32_t res = muldiv64(dividend, multiplier, divisor);

if(muldiv64_statics.remainder != 0)
{
const U32 sign_bit = (dividend ^ multiplier ^ divisor) & 0x80000000U;
assert(0 == muldiv64_statics.overflow);
assert(muldiv64_statics.remainder > 0);
muldiv64_statics.remainder = 0;
if(sign_bit)
{
assert(res != INT32_MIN);
res -= 1;
}
else
{ /*EMPTY*/
}
}

return(res);
}

/*
round result towards -inf
result =
(sgn(a*b*divisor) +ve)
? ((a*b) + divisor/2) / divisor
: ((a*b) - divisor/2) / divisor
*/

_Check_return_
extern int32_t
muldiv64_round_floor(
_InVal_ int32_t dividend,
_InVal_ int32_t multiplier,
_InVal_ int32_t divisor)
{
int32_t res = muldiv64(dividend, multiplier, divisor);

if(muldiv64_statics.remainder != 0)
{
const U32 sign_bit = (dividend ^ multiplier ^ divisor) & 0x80000000U;
const int32_t threshold = divisor / 2;
assert(0 == muldiv64_statics.overflow);
assert(muldiv64_statics.remainder > 0);
if(muldiv64_statics.remainder >= threshold)
{
if(sign_bit)
{
assert(res != INT32_MIN);
res -= 1;
}
else
{
assert(res != INT32_MAX);
res += 1;
}
}
muldiv64_statics.remainder = 0;
}

return(res);
}

#else

/* keep compilers happy */

extern void
muldiv86(void);

extern void
muldiv86(void)
{
return;
}

#endif /*WINDOWS*/

/* end of muldiv86.c */
4 changes: 2 additions & 2 deletions t5/common/mf_mid
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

#TEXTUAL_VERSION_NUMBER=2.xx.yy (yy usually omitted when 00)
TEXTUAL_VERSION_NUMBER=2.32
#TEXTUAL_VERSION_NUMBER=2.32.01
TEXTUAL_VERSION_NUMBER=2.32.01
# this goes in !Boot/!Run/Config files

STUBS_VERSION_NUMBER=0x23200
STUBS_VERSION_NUMBER=0x23201
# when changing version number for release, remember:
# common.mf_mid
# ob_skel.version.h
Expand Down
5 changes: 5 additions & 0 deletions t5/firewrkz/RelNotes.htm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ <h2 id="ReleaseHistory">Release History</h2>
<p>Please refer to the <a href="https://croftnuisk.co.uk/coltsoft/fireworkz/addenda_and_errata/">Addenda and Errata</a> for details of changes to functionality.</p>


<h3>2.32.01 (06 Nov 2022)</h3>

<p>RISC OS: Screen rendering issue (introduced in 2.32) at some zoom factors fixed.</p>


<h3>2.32 (05 Nov 2022)</h3>

<p>More consistent use of https:// vs. http:// in URLs.</p>
Expand Down
2 changes: 1 addition & 1 deletion t5/firewrkz/Resources/Windows/France/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{Version:2.32;05 Nov 2022;Fireworkz for Windows (France);Colton Software;Windows-1252}
{Version:2.32.01;06 Nov 2022;Fireworkz for Windows (France);Colton Software;Windows-1252}
{RowTable:1}
{BindFileType:1;0;All files;(*.*);*.*}
{BindFileType:1;0xBDF;Colton Software Fireworkz;(*.fwk,*.fwkh);*.fwk\\\;*.fwkh}
Expand Down
4 changes: 2 additions & 2 deletions t5/firewrkz/Resources/Windows/France/res00.rci
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ BEGIN
// The definitive list of files is in common.mf_mid
//1:2.xx.yy
//1:2.xx
0x1, L"2.32"
0x1, L"2.32.01"
// UK 2:dd mmm yyyy
0x2, L"05 nov. 2022"
0x2, L"06 nov. 2022"
//
0x3, L"© 1992-2022 Colton Software"
// UK w1037:The product uses the following components
Expand Down
2 changes: 1 addition & 1 deletion t5/firewrkz/Resources/Windows/Germany/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{Version:2.32;05 Nov 2022;Fireworkz for Windows (Germany);Colton Software;Windows-1252}
{Version:2.32.01;06 Nov 2022;Fireworkz for Windows (Germany);Colton Software;Windows-1252}
{RowTable:1}
{BindFileType:1;0;All files;(*.*);*.*}
{BindFileType:1;0xBDF;Colton Software Fireworkz;(*.fwk,*.fwkh);*.fwk\\\;*.fwkh}
Expand Down
Loading

0 comments on commit 2a5edfb

Please sign in to comment.