mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] Add a VRAM offset roll macro
Part of P0235, funded by Ember2528.
This commit is contained in:
parent
6a92122432
commit
0e103c6f88
9
planar.h
9
planar.h
|
@ -84,6 +84,15 @@ typedef uint16_t uvram_offset_t;
|
||||||
#define VRAM_OFFSET_SHIFT(x, y) \
|
#define VRAM_OFFSET_SHIFT(x, y) \
|
||||||
(x >> BYTE_BITS) + (y << 6) + (y << 4)
|
(x >> BYTE_BITS) + (y << 6) + (y << 4)
|
||||||
|
|
||||||
|
// Adds [imm] to [vo] and rolls [vo] back to the top of VRAM if it crossed the
|
||||||
|
// bottom. Necessary with hardware scrolling.
|
||||||
|
#define vram_offset_add_and_roll(vo, imm) { \
|
||||||
|
vo += imm; \
|
||||||
|
if(static_cast<vram_offset_t>(vo) >= PLANE_SIZE) { \
|
||||||
|
vo -= PLANE_SIZE; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
// MODDERS: Replace with a single function
|
// MODDERS: Replace with a single function
|
||||||
static inline vram_offset_t vram_offset_shift(screen_x_t x, vram_y_t y) {
|
static inline vram_offset_t vram_offset_shift(screen_x_t x, vram_y_t y) {
|
||||||
|
|
|
@ -18,10 +18,7 @@ void pascal near pellet_render(screen_x_t left, vram_y_t top)
|
||||||
_CX = 8;
|
_CX = 8;
|
||||||
put_loop: {
|
put_loop: {
|
||||||
asm { movsw; }
|
asm { movsw; }
|
||||||
_DI += (ROW_SIZE - sizeof(dots16_t));
|
vram_offset_add_and_roll(_DI, (ROW_SIZE - sizeof(dots16_t)));
|
||||||
if(static_cast<int16_t>(_DI) >= PLANE_SIZE) {
|
asm { loop put_loop; }
|
||||||
_DI -= PLANE_SIZE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
asm { loop put_loop; }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue