[Maintenance] Only use the `far` keyword to declare intent

Part of P0134, funded by [Anonymous].
This commit is contained in:
nmlgc 2021-02-04 20:16:03 +01:00
parent 604b2c83ac
commit 59fb8753bc
12 changed files with 21 additions and 18 deletions

View File

@ -233,6 +233,14 @@ C++, Open Watcom, and Visual C++, which will ease future third-party ports.
}
```
* All original `.EXE` binaries use the *large* memory model, meaning that both
function and data pointers are `far` by default. Therefore, pointers and
references should only explicitly be declared `far` if
1. they are actually constructed from a segment and an offset via the two
methods above, or
2. the code performs segment/offset arithmetic on them.
## Naming conventions
* ASM file extensions: `.asm` if they emit code, `.inc` if they don't

View File

@ -3,7 +3,7 @@
#define z_vsync_reset1() (vsync_frame = 0)
// #define z_vsync_reset2() (vsync_unused = 0)
void far frame_delay(unsigned int frames)
void frame_delay(unsigned int frames)
{
while(vsync_frame < frames) {}
z_vsync_reset1();

View File

@ -741,7 +741,7 @@ void graph_putsa_fx(
register screen_x_t x = left;
uint16_t codepoint;
dots16_t glyph_row;
unsigned char far *vram;
dots8_t far *vram;
int fullwidth;
int first_bit;
int weight = fx_weight_from(col_and_fx);

View File

@ -7,8 +7,6 @@
// each animation frame.
void pagetrans_diagonal_8x8(unsigned int step_ms);
void pagetrans_diagonal_8x8_with_palette(
unsigned int step_ms,
Palette4 far &pal_cur,
const Palette4 far &pal_target
unsigned int step_ms, Palette4 &pal_cur, const Palette4 &pal_target
);
// -----------------------------------------------

View File

@ -44,9 +44,7 @@ static const int FRAME_COUNT = (
);
void pagetrans_diagonal_8x8_with_palette(
unsigned int step_ms,
Palette4 far &pal_cur,
const Palette4 far &pal_target
unsigned int step_ms, Palette4 &pal_cur, const Palette4 &pal_target
)
{
int comp;

View File

@ -1,5 +1,5 @@
#include "th01/main/boss/boss.hpp"
void far boss_nop(void)
void boss_nop(void)
{
}

View File

@ -3,7 +3,7 @@
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
void pascal far frame_delay_2(int frames)
void pascal frame_delay_2(int frames)
{
vsync_reset1();
while(vsync_Count1 < frames) {}

View File

@ -1,2 +1,2 @@
void pascal far frame_delay(int frames);
void pascal far frame_delay_2(int frames);
void pascal frame_delay(int frames);
void pascal frame_delay_2(int frames);

View File

@ -1,6 +1,6 @@
extern bb_seg_t bb_stage_seg;
void pascal near bb_stage_load(const char far* fn)
void pascal near bb_stage_load(const char *fn)
{
#if GAME == 5
bb_stage_seg = bb_load(fn);

View File

@ -5,7 +5,7 @@
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
void pascal far frame_delay_2(int frames)
void pascal frame_delay_2(int frames)
{
vsync_reset1();
while(vsync_Count1 < frames) {}

View File

@ -2,7 +2,6 @@
extern unsigned char rank;
int pascal far select_for_rank(
int for_easy, int for_normal,
int for_hard, int for_lunatic
int pascal select_for_rank(
int for_easy, int for_normal, int for_hard, int for_lunatic
);

View File

@ -5,7 +5,7 @@ extern "C" {
#include "master.hpp"
#include "th02/hardware/frmdelay.h"
void pascal far frame_delay(int frames)
void pascal frame_delay(int frames)
{
_BX = _SP;
__asm { mov bx, ss:[bx+4]; } /* = */ (frames);