[Maintenance] Fix another bunch of accumulated typos

Part of P0161, funded by [Anonymous].
This commit is contained in:
nmlgc 2021-10-04 20:53:23 +02:00
parent b9f1fefb84
commit a317cb49fc
11 changed files with 37 additions and 42 deletions

View File

@ -290,10 +290,10 @@ C++, Open Watcom, and Visual C++, which will ease future third-party ports.
void resident_set(resident __seg *seg)
{
// Redundant, and requires the MK_FP() macro to be declared
resident_t far *resident = MK_FP(resident_seg, 0);
resident_t far *resident = MK_FP(seg, 0);
// Does the same, without requiring a macro
resident_t far *resident = resident_seg;
resident_t far *resident = seg;
}
```

View File

@ -45,7 +45,7 @@ where the scalar-type variable is declared in relation to them.
| `CWD`<br />`SUB AX, DX`<br />`SAR AX, 1` | `AX / 2`, `AX` is *int* |
| `MOV [new_var], AX`<br />`CWD`<br />`XOR AX, DX`<br />`SUB AX, DX` | `abs(AX)`, defined in `<stdlib.h>`. `AX` is *int* |
* When bit-testing the a variable with a 16-bit mask via `&` in a conditional
* When bit-testing a variable with a 16-bit mask via `&` in a conditional
expression, the `TEST` is optimized to cover just the high or low byte, if
possible:
```c
@ -231,10 +231,10 @@ Calling conventions can be added before the `*`.
cause a fixup overflow error at link time. The reason for that is pointed
out in the compiler's assembly output (`-S)`:
| C | ASM |
|--------------------------|----------------------------------------------------------------------------------------|
| `void near bar();` | `extrn _bar:near` |
| `static nn_t foo = bar;` | `mov word ptr DGROUP:_popup, offset CURRENTLY_COMPILED_BUT_NOT_ACTUAL_GROUP_OF:_bar` |
| C | ASM |
|--------------------------|--------------------------------------------------------------------------------------|
| `void near bar();` | `extrn _bar:near` |
| `static nn_t foo = bar;` | `mov   word ptr DGROUP:_foo, offset CURRENTLY_COMPILED_BUT_NOT_ACTUAL_GROUP_OF:_bar` |
The only known way of enforcing this assignment involves declaring `bar()` as
a far function and then casting its implicit segment away:
@ -357,17 +357,17 @@ void foo(int i) {
* Replaces
```asm
ENTER <stack size>, 0
```
```asm
ENTER <stack size>, 0
```
with
with
```asm
PUSH BP
MOV BP, SP
SUB SP, <stack size>
```
```asm
PUSH BP
MOV BP, SP
SUB SP, <stack size>
```
### `-Z` (Suppress register reloads)
@ -635,7 +635,7 @@ contains one of the following:
**Certainty:** Confirmed through reverse-engineering `TCC.EXE`, no way
around it.
### Compiler bugs
## Compiler bugs
* Dereferencing a `far` pointer constructed from the `_FS` and `_GS`
pseudoregisters emits wrong segment prefix opcodes 0x46 (`INC SI`) and

View File

@ -40,7 +40,7 @@ void z_palette_black_in(void);
void z_palette_white_in(void);
// Fades all hardware colors from their value in z_Palettes to #000 or #FFF,
// without modifiying z_Palettes;
// without modifiying z_Palettes.
void z_palette_black_out(void);
void z_palette_white_out(void);

View File

@ -39,9 +39,9 @@ public:
// Calls putkanji() for the next 5 TRAM rows.
void putkanji_for_5_rows(uint16_t jis_kanji, int atrb);
// This is always called at line 21, and therefore always ends up writing
// into the second TRAM page. Luckily, that page is used, and no code cares
// about it...
// This is always called at the (0-based) line 21, and therefore always
// ends up writing into the second TRAM page. Luckily, that page is used,
// and no code cares about it...
void putkanji_until_end(uint16_t jis_kanji, int atrb) {
putkanji_for_5_rows(jis_kanji, atrb);
}

View File

@ -350,12 +350,9 @@ void alphabet_put_at(screen_x_t left, screen_y_t top, bool16 is_selected)
egc_copy_rect_1_to_0_16(left, top, KANJI_PADDED_W, GLYPH_H);
// TODO OCTOBER 2020: Try flipping
int16_t col_and_fx = (
FX_WEIGHT_BOLD | (
!is_selected ? (COL_REGULAR) : (FX_REVERSE | COL_SELECTED)
)
);
int16_t col_and_fx = (FX_WEIGHT_BOLD | (
!is_selected ? COL_REGULAR : (FX_REVERSE | COL_SELECTED)
));
alphabet_if(kanji, left, top,
{ graph_printf_fx(left, top, col_and_fx, ALPHABET_SPACE_0); },

View File

@ -43,7 +43,7 @@ extern "C" {
#include "th01/main/bullet/laser_s.hpp"
#include "th01/main/hud/hp.hpp"
static const char* unused_redletters_maybe[] = { "ANGEL", "OF", "DEATH" };
static const char* unused_entrace_letters_maybe[] = { "ANGEL", "OF", "DEATH" };
// Coordinates
// -----------
@ -998,7 +998,7 @@ void pattern_four_homing_snakes(void)
for(i = 1; i < snakes.count(); i++) {
snakes.left[i][0] = -PIXEL_NONE;
}
konngara_select_for_rank(pattern_state.unused, 18, 16, 14, 12);
select_for_rank(pattern_state.unused, 18, 16, 14, 12);
mdrv2_se_play(12);
return;
}
@ -1411,7 +1411,7 @@ void pattern_slash_aimed(void)
face_direction_can_change = false;
spawner_left = SWORD_CENTER_X;
spawner_top = SWORD_CENTER_Y;
konngara_select_for_rank(pattern_state.speed,
select_for_rank(pattern_state.speed,
to_sp(4.0f), to_sp(5.0f), to_sp(5.5f), to_sp(6.0f)
);
}
@ -1788,7 +1788,7 @@ void konngara_main(void)
//
// "Graph mode" (as opposed to "kanji mode") disables Shift-JIS decoding
// inside NEC's IO.SYS. This allows new half-width glyphs at the
// Shift-JIS lead byte codepoints, 0x81-0x9F and 0xE0-0xFF, to be
// Shift-JIS lead byte code points, 0x81-0x9F and 0xE0-0xFF, to be
// accessed via regular INT 29h text output, and consequently, printf().
// Had to reverse-engineer that, only to find out that it has exactly
// zero effect when printing spaces...

View File

@ -25,8 +25,8 @@
#endif
#define playfield_encloses_yx_lt_ge(center_x, center_y, w, h) ( \
/* Casting the center coordinate allows macro to easily be used with */ \
/* the _AX and _DX pseudoregisters after motion_update(). */ \
/* Casting the center coordinate allows this macro to easily be used */ \
/* with the _AX and _DX pseudoregisters after motion_update(). */ \
(static_cast<subpixel_t>(center_y) >= to_sp(0 - (h / 2))) && \
(static_cast<subpixel_t>(center_y) < to_sp(PLAYFIELD_H + (h / 2))) && \
(static_cast<subpixel_t>(center_x) >= to_sp(0 - (w / 2))) && \
@ -34,8 +34,8 @@
)
#define playfield_encloses(center_x, center_y, w, h) ( \
/* Casting the center coordinate allows macro to easily be used with */ \
/* the _AX and _DX pseudoregisters after motion_update(). */ \
/* Casting the center coordinate allows this macro to easily be used */ \
/* with the _AX and _DX pseudoregisters after motion_update(). */ \
(static_cast<subpixel_t>(center_x) > to_sp(0 - (w / 2))) && \
(static_cast<subpixel_t>(center_x) < to_sp(PLAYFIELD_W + (w / 2))) && \
(static_cast<subpixel_t>(center_y) > to_sp(0 - (h / 2))) && \

View File

@ -1,3 +1,6 @@
/// Everything here needs to be kept in sync with the ASM versions in
/// bullet.inc!
#include "th04/sprites/cels.h"
/// Game-specific group and spawn types
@ -11,8 +14,6 @@
/// States and modes
/// ----------------
/// Everything here needs to be kept in sync with the ASM versions in
/// bullet.hpp!
static const int BMS_DECAY_FRAMES_PER_CEL = 4;
#define BSS_CLOUD_FRAMES (BULLET_CLOUD_CELS * 4)
#define BMS_DECAY_FRAMES (BULLET_DECAY_CELS * BMS_DECAY_FRAMES_PER_CEL)
@ -69,7 +70,6 @@ enum bullet_special_motion_t {
};
/// ----------------
// Needs to be kept in sync with the ASM version in bullet.inc!
struct bullet_t {
unsigned char flag;
char age;
@ -193,7 +193,6 @@ void near pellets_render_bottom();
/// Template
/// --------
// Needs to be kept in sync with the ASM version in bullet.inc!
struct bullet_template_t {
uint8_t spawn_type;
unsigned char patnum; // TH05: 0 = pellet

View File

@ -21,7 +21,7 @@ void pascal hud_hp_put(int bar_value);
// High-level
// ----------
// Renders the HP bar at the fraction of ([hp_cur] / [hp_max]), or instead
// takes asingle fill step if the previous bar value was lower.
// fills up the bar by a single fill step if its previous value was lower.
void pascal hud_hp_update_and_render(int hp_cur, int hp_max);
// Displays [stage_graze] in the graze row.

View File

@ -239,7 +239,6 @@ void near shinki_bg_type_a_update_part1(void)
linesets[1].angle[0] -= 0x02;
}
}
#undef PARTICLES_UNINITIALIZED
}
// Draws the given line out of [set] with the current GRCG tile and color.

View File

@ -11,7 +11,7 @@ extern "C" {
/// String-to-color map
/// -------------------
/// Used to automatically change the text color whenever a specific
/// Shift-JIS codepoint is encountered.
/// Shift-JIS code point is encountered.
static const int COLMAP_COUNT = 8;
typedef struct {