Sfoglia il codice sorgente

M2.3: scrolling without tearing

The view is drawn in two halves (rows 0-11, rows 12-22), still column by
column at 14 cycles per tile. The frame starts at raster line 156: the
top half is drawn while the beam is in the lower half, the bottom half
after the beam has left row 22, each followed by its dwarves and cursor.
Input now runs after the draw; a scroll is set up (view_setup) and drawn
at the next line 156. The old cursor cell is repaired only when no redraw
follows. Static locals in main.c. Measured: no tear on PAL or NTSC;
realistic scroll frames fit PAL (18.8K of 19.7K cycles), NTSC scroll
steps take two frames. VIEW_TIMING build now only redraws; MT1.3 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
Daniel Covington 1 settimana fa
parent
commit
d87a552669
8 ha cambiato i file con 155 aggiunte e 57 eliminazioni
  1. +5
    -4
      docs/manual-tests.md
  2. +3
    -2
      docs/verification-status.md
  3. +5
    -4
      project.json
  4. +2
    -0
      src/frame.h
  5. +12
    -1
      src/frame.s
  6. +76
    -38
      src/main.c
  7. +7
    -0
      src/view.h
  8. +45
    -8
      src/view.s

+ 5
- 4
docs/manual-tests.md Vedi File

@@ -72,13 +72,14 @@ Setup: VICE x64sc, once with PAL and once with NTSC.
Start: `pwsh -File tools/run.ps1 -Target c64 -Define VIEW_TIMING`, then `pwsh -File tools/run.ps1 -Target c64 -Define VIEW_TIMING -Video ntsc`

Steps:
1. Wait for the map to appear and watch the border.
1. Wait for the map to appear and watch the side borders.
2. Close VICE and run `pwsh -File tools/build.ps1` so the normal build is back in build/.

Expected:
- The border shows a red band. It starts in the bottom border, continues through the top border and ends partway down the screen (PAL: about the middle of the screen; NTSC: just above the status line). Below it the border is black down to the bottom border.
- The border is never red all the way round (that would mean a redraw takes more than one frame)
- In this timing build the dwarves may flicker, because the view is redrawn over them every frame. The normal build does not do that.
- The timing build redraws the whole view every frame and does nothing else (keys and mouse do nothing in it)
- The side borders are red while the view is drawn: the red starts level with the middle of the map, runs down through the bottom border, round through the top border, and stops before it gets back to the middle
- PAL: a black gap of several map rows above the middle. NTSC: only a thin black line just above the middle
- The border is never red all the way round, and the picture is steady (no flicker between frames)
- Automated equivalent: `pwsh -File tools/smoke.ps1 -Video ntsc` passes the 'Full view redraw fits in one frame' check

Verifies: R3.3


+ 3
- 2
docs/verification-status.md Vedi File

@@ -15,7 +15,7 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n
| M1.4 Keyboard cursor (cursor keys and W/A/S/D) with edge scrolling and map-border clamping. Status line: 'STONE 000 SEED nnnnn RUN'. | passed (2026-11-26): `pwsh -File tools/build.ps1` exit 0, no warnings; `pwsh -File tools/smoke.ps1 -Video pal` and `-Video ntsc` exit 0, [PASS] c64 7/7 each (adds 'RUN' on row 24). Scripted VICE runs that hold one cursor key (a key put into the KERNAL buffer every frame) reached every edge on PAL: view (88,y)/cursor x=127 right, (0,y)/x=0 left, (x,105)/y=127 down, (x,0)/y=0 up; right and down repeated on NTSC. Worst frame while scrolling: 19,581 cycles PAL (frame 19,656), 19,354 NTSC (frame 17,095): a scroll frame on NTSC runs one frame over, see Notes. | confirmed by user (2026-11-26) |
| M2.1 Mark/unmark with RETURN on rock tiles only; marked-rock glyph. Joystick port 2 cursor movement with key repeat and fire to mark. | passed (2026-11-26): `pwsh -File tools/build.ps1` exit 0, no warnings; `pwsh -File tools/smoke.ps1 -Video pal` and `-Video ntsc` exit 0, [PASS] c64 8/8 each (adds joy_ok = 01). Scripted VICE runs (FIXED_SEED=4242, keys put into the KERNAL buffer) compared with an untouched run: RETURN on the floor start tile changed nothing (R4.2); 6x down + RETURN turned soft rock (62,67) $99 into marked $97 and changed nothing else (R4.1); RETURN twice left the map byte-identical (R4.1). With no joystick input there were no phantom moves or marks. Joystick movement and fire cannot be scripted: manual only (MT2.1). | confirmed by user (2026-11-26) |
| M2.2 1351 mouse via the game's own POT reader in assembly (src/mouse1351.s; changed from cc65 c64_1351_mou with user approval on 2026-11-26 because that driver read garbage POT values in VICE 3.10): sprite 0 pointer, dig cursor = tile under the pointer tip, left button marks/unmarks, pointer at a view edge scrolls. Verify A1/A2 and record the exact VICE options in docs/. | passed (2026-11-26): `pwsh -File tools/build.ps1` exit 0, no warnings; `pwsh -File tools/smoke.ps1 -Video pal` and `-Video ntsc` exit 0, [PASS] c64 9/9 each (adds sprite 0 on, $D015 = 01). Scripted VICE runs (`-controlport1device 3`, no host mouse): with no input the pointer stayed at (162,98) on the cursor tile at 9M, 13M and 17M cycles; after keyboard moves the pointer was on the cursor tile (23,14); with the pointer placed on the rightmost column the view scrolled to x = 88 and the cursor reached tile x = 127 (R5.4). Real mouse movement, buttons and keyboard blinding cannot be scripted: manual only (MT2.2). Worst frame while scrolling is now 21,853 PAL / 21,961 NTSC cycles (over one frame on both), see Notes. | confirmed by user (2026-11-26) |
| M2.3 Scrolling without tearing: draw_view writes the view row by row behind the raster beam, so no row is shown half old, half new; trim the per-frame work so a frame with a scroll fits in one PAL frame, and measure NTSC. View still moves in whole tiles (R3 unchanged). Added at the user's request on 2026-11-26. | not run | pending |
| M2.3 Scrolling without tearing: draw_view writes the view row by row behind the raster beam, so no row is shown half old, half new; trim the per-frame work so a frame with a scroll fits in one PAL frame, and measure NTSC. View still moves in whole tiles (R3 unchanged). Added at the user's request on 2026-11-26. | passed (2026-11-26): `pwsh -File tools/build.ps1` exit 0, no warnings (VIEW_TIMING build also clean); `pwsh -File tools/smoke.ps1 -Video pal` and `-Video ntsc` exit 0, [PASS] c64 9/9 each. Instrumented VICE runs with a key held: in every scroll frame the top half ended at most 7,844 cycles after line 156 (beam reaches the top rows at 13,545 PAL / 10,790 NTSC), the bottom half started at least 8,123 cycles after (beam leaves row 22 at 5,481 / 5,655) and ended at most 16,305 (beam returns to row 12 at 19,593 / 17,030): no tear on PAL or NTSC. Realistic scrolling (mouse resting on an edge, one scroll every 4 frames): worst frame 18,802 of 19,656 cycles on PAL (fits), 18,781 of 17,095 on NTSC (over by about 1,700, so a scroll step there takes two frames). Regression runs: hold-key scrolling reached all four edges; RETURN marking unchanged. | pending |
| M3.1 Dwarf job system: idle dwarves claim the nearest reachable marked tile via a windowed breadth-first search (one search per frame at most), walk there, mine for a time that depends on the rock type, turn it into floor. | not run | pending |
| M3.2 Stone counter increments per mined tile; SPACE pauses and resumes; marking still works while paused. | not run | pending |
| M3.3 Frame-based timers scaled for PAL and NTSC using get_tv(). | not run | pending |
@@ -29,5 +29,6 @@ manual = `pending`, `confirmed by user (<date>)`, `problem reported (<date>): <n
- 2026-11-26: requirement change approved by the user: RETURN marks/unmarks instead of D (R4.1-R4.3, Controls, M2.1, MT2.1). D stays 'move right'. Not yet implemented; marking arrives in M2.1.
- 2026-11-26, M1.4: a frame in which the view scrolls costs about 19,400-19,600 cycles: draw_view (~15,000) plus key handling, cursor/dwarf drawing and the KERNAL IRQ that draw_view holds off. That fits a PAL frame and runs over an NTSC frame (17,095), so on NTSC the next frame is skipped after each scroll. With KERNAL key repeat a scroll happens at most every few frames, so the speed should look the same; review in M3, when dwarves and pathfinding share the frame.
- 2026-11-26, M2.2 / assumption A1 FAILED in VICE 3.10: with the cc65 c64-1351 driver installed (static, mouse_def_callbacks), the pointer random-walks with no mouse input. Reproduced with a minimal cc65 program (mouse_install + mouse_show only): 228 different positions in 237 frames. A monitor trace after the driver's `lda $D419` in its IRQ showed garbage values (255 in 51 of 175 reads, the rest scattered), which its delta maths turns into jumps. A prototype that selects port 1 ($DC00 = $7F) and waits 10 raster lines with IRQs off before reading POTX/POTY read only 64/65, and the pointer did not move. The user chose the game's own reader (src/mouse1351.s), implemented in M2.2.
- 2026-11-26, M2.2: the mouse read (about 800 cycles with IRQs off) and the mouse handling push the worst scroll frame to about 21,900 cycles, over one frame on PAL and NTSC. The next frame is skipped after a scroll, with no wrong drawing. Recommended before M3: a frame-budget task (cheaper cursor/dwarf drawing, smaller C overhead in the frame loop).
- 2026-11-26, M2.2: the mouse read (about 800 cycles with IRQs off) and the mouse handling push the worst scroll frame to about 21,900 cycles, over one frame on PAL and NTSC. The next frame is skipped after a scroll, with no wrong drawing. Addressed by M2.3.
- 2026-11-26, M2.3: the redraw (about 15,000 cycles) plus the KERNAL IRQ it holds off (about 1,500) leave less than 1,000 cycles of an NTSC frame (17,095) for everything else, so on NTSC a frame with a scroll still takes two frames. Drawing stays tear-free. Making NTSC fit would need a cheaper keyboard scan than the KERNAL's, or pixel scrolling (M5), which redraws less often. M3 must keep its per-frame work small: on PAL a scroll frame has about 850 cycles to spare.
- Generated 2026-11-26. Starter verification at generation time is reported by the Foundry; re-run `pwsh -File tools/smoke.ps1` on your machine and record the result in row M0.1.

+ 5
- 4
project.json Vedi File

@@ -459,13 +459,14 @@
"target": "c64",
"setup": "VICE x64sc, once with PAL and once with NTSC.",
"steps": [
"Wait for the map to appear and watch the border.",
"Wait for the map to appear and watch the side borders.",
"Close VICE and run `pwsh -File tools/build.ps1` so the normal build is back in build/."
],
"expected": [
"The border shows a red band. It starts in the bottom border, continues through the top border and ends partway down the screen (PAL: about the middle of the screen; NTSC: just above the status line). Below it the border is black down to the bottom border.",
"The border is never red all the way round (that would mean a redraw takes more than one frame)",
"In this timing build the dwarves may flicker, because the view is redrawn over them every frame. The normal build does not do that.",
"The timing build redraws the whole view every frame and does nothing else (keys and mouse do nothing in it)",
"The side borders are red while the view is drawn: the red starts level with the middle of the map, runs down through the bottom border, round through the top border, and stops before it gets back to the middle",
"PAL: a black gap of several map rows above the middle. NTSC: only a thin black line just above the middle",
"The border is never red all the way round, and the picture is steady (no flicker between frames)",
"Automated equivalent: `pwsh -File tools/smoke.ps1 -Video ntsc` passes the 'Full view redraw fits in one frame' check"
],
"requirements": [


+ 2
- 0
src/frame.h Vedi File

@@ -2,4 +2,6 @@
#define FRAME_H
/* Wait until the raster beam reaches the bottom border once (one video frame). */
void __fastcall__ wait_frame(void);
/* Wait until the raster reaches line (0-255). */
void __fastcall__ wait_line(unsigned char line);
#endif

+ 12
- 1
src/frame.s Vedi File

@@ -1,6 +1,6 @@
; wait_frame: block until the VIC-II raster reaches line 251 (bottom border), once per frame.
; Works on PAL and NTSC because line 251 exists on both.
.export _wait_frame
.export _wait_frame, _wait_line

VIC_RASTER = $D012
VIC_CTRL1 = $D011
@@ -16,3 +16,14 @@ _wait_frame:
cmp #251
bne @wait
rts

; wait_line(line): block until the raster reaches line (0-255) of the current or next frame.
; C prototype: void __fastcall__ wait_line(unsigned char line);
_wait_line:
sta @cmp+1
@wait: lda VIC_CTRL1 ; lines 256+ (PAL/NTSC bottom border): keep waiting
bmi @wait
lda VIC_RASTER
@cmp: cmp #$00 ; operand patched above
bne @wait
rts

+ 76
- 38
src/main.c Vedi File

@@ -13,8 +13,9 @@
** row 24 status line
**
** Build with -D FIXED_SEED=n (tools/build.ps1 -Define FIXED_SEED=n) to always generate seed n.
** Build with -D VIEW_TIMING to redraw the view every frame with a red border while it draws
** (timing bar for R3.3: the red band must end before the next frame starts at the bottom border).
** Build with -D VIEW_TIMING to redraw the view every frame (and do nothing else) with a red
** border while it draws: timing bar for R3.3. The band starts at DRAW_LINE (middle of the map)
** and must stop before it reaches that line again.
*/
#include <conio.h>
#include <joystick.h>
@@ -27,6 +28,14 @@
#include "cycles.h"
#include "mouse1351.h"

/* The frame loop is not recursive; static locals make cc65 code much faster (M2.3). */
#pragma static-locals (on)
#ifdef VIEW_TIMING
/* The timing build compiles out the input handling, so these are expected there. */
#pragma warn (unused-func, off)
#pragma warn (unused-var, off)
#endif

#define SCREEN ((unsigned char *)0x0400)
#define COLRAM ((unsigned char *)0xD800)
#define JIFFY_LO (*(volatile unsigned char *)0xA2)
@@ -67,6 +76,12 @@ static unsigned jiffies(void)
/* Cursor blink: shown for CURSOR_ON_FRAMES of every 32 frames, the tile shows the rest. */
#define CURSOR_ON_FRAMES 20u

/* Tear-free redraw (M2.3): the frame starts when the raster reaches DRAW_LINE, just below
** view row 11 (screen row 12 ends at line 154). The top half (view rows 0-11) is drawn while
** the beam is in the lower half; by the time it is done the beam has left row 22 (line 242),
** and the bottom half is drawn before the beam comes back to row 12 (line 155). */
#define DRAW_LINE 156u

/* Joystick in port 2 (R4.3): move at once, then repeat after JOY_REPEAT_DELAY frames
** every JOY_REPEAT_RATE frames while held. Fire marks/unmarks once per press. */
#define JOY_REPEAT_DELAY 15u
@@ -91,9 +106,10 @@ static unsigned char mouse_timer; /* frames until the next edge scroll *
static int mouse_last_x, mouse_last_y; /* pointer position last frame */

/* Set by the input handlers each frame. */
static unsigned char moved; /* cursor moved (old cell already restored) */
static unsigned char need_redraw; /* view scrolled: full redraw */
static unsigned char moved; /* cursor moved this frame */
static unsigned char need_redraw; /* view scrolled this frame */
static unsigned char toggled; /* a mark was set or cleared */
static unsigned char redraw_pending; /* draw the view at the next DRAW_LINE */

/* Read by tools/smoke.ps1 / test runs: worst cycles spent in one frame's work (input + redraw). */
unsigned frame_max_cycles;
@@ -126,36 +142,42 @@ static unsigned char dwarf_at(unsigned char x, unsigned char y)
return i;
}

static void draw_dwarves(void)
/* What view cell of map tile (x, y) shows without the cursor: a dwarf or the tile. */
static unsigned char cell_code(unsigned char x, unsigned char y)
{
if (dwarf_at(x, y) < DWARF_COUNT) {
return GLYPH_DWARF;
}
return *MAP_PTR(x, y);
}

static unsigned char cursor_shown(void)
{
return (unsigned char)((blink & 31u) < CURSOR_ON_FRAMES);
}

/* Dwarves and the cursor over view rows r0 .. r1-1 (after view_draw_top/bottom). */
static void draw_overlays(unsigned char r0, unsigned char r1)
{
unsigned char i, sx, sy;
for (i = 0; i < DWARF_COUNT; ++i) {
sx = (unsigned char)(map_dwarf_x[i] - view_x);
sy = (unsigned char)(map_dwarf_y[i] - view_y);
if (sx < VIEW_W && sy < VIEW_H) {
if (sx < VIEW_W && sy >= r0 && sy < r1) {
put_cell(sx, sy, GLYPH_DWARF);
}
}
}

/* Draw the cursor cell: the cursor glyph, or what lies under it (dwarf or tile). */
static void draw_cursor_cell(unsigned char show)
{
unsigned char sx = (unsigned char)(cur_x - view_x);
unsigned char sy = (unsigned char)(cur_y - view_y);
if (show) {
put_cell(sx, sy, GLYPH_CURSOR);
} else if (dwarf_at(cur_x, cur_y) < DWARF_COUNT) {
put_cell(sx, sy, GLYPH_DWARF);
} else {
put_cell(sx, sy, *MAP_PTR(cur_x, cur_y));
sy = (unsigned char)(cur_y - view_y);
if (sy >= r0 && sy < r1 && cursor_shown()) {
put_cell((unsigned char)(cur_x - view_x), sy, GLYPH_CURSOR);
}
}

static void redraw_all(void)
/* Draw the cursor cell for the current blink phase (view unchanged this frame). */
static void draw_cursor_cell(void)
{
draw_view(view_x, view_y);
draw_dwarves();
put_cell((unsigned char)(cur_x - view_x), (unsigned char)(cur_y - view_y),
cursor_shown() ? GLYPH_CURSOR : cell_code(cur_x, cur_y));
}

/* Top-left of a view centred on (x, y), kept inside the map. */
@@ -205,13 +227,11 @@ static void toggle_mark(void)
toggled = 1;
}

/* Restore the old cursor cell once per frame, before the cursor or the view changes. */
/* The cursor or the view is about to change. The old cursor cell is repaired at the end of
** the frame (or by the redraw), not here, so a scroll frame does not pay for it. */
static void begin_move(void)
{
if (!moved) {
moved = 1;
draw_cursor_cell(0);
}
moved = 1;
}

/* Move the cursor one step from keyboard or joystick. */
@@ -279,8 +299,8 @@ static void pointer_to_cursor(void)
if (!mouse_ok) {
return;
}
mouse_last_x = (int)((unsigned char)(cur_x - view_x)) * 8 + 2;
mouse_last_y = (int)((unsigned char)(cur_y - view_y) + VIEW_TOP) * 8 + 2;
mouse_last_x = (int)(((unsigned)(unsigned char)(cur_x - view_x) << 3) | 2u);
mouse_last_y = (int)(((unsigned)(unsigned char)(cur_y - view_y + VIEW_TOP) << 3) | 2u);
ms_move(mouse_last_x, mouse_last_y);
}

@@ -346,7 +366,7 @@ static void handle_mouse(void)
int main(void)
{
unsigned seed, t0, c;
unsigned char moved_by_mouse;
unsigned char moved_by_mouse, old_x, old_y;

bordercolor(COLOR_BLACK);
bgcolor(COLOR_BLACK);
@@ -390,7 +410,7 @@ int main(void)
draw_view(view_x, view_y);
view_cycles = cycles_read();
view_fast = view_cycles < (get_tv() == TV_NTSC ? FRAME_CYCLES_NTSC : FRAME_CYCLES_PAL);
draw_dwarves();
draw_overlays(0, VIEW_H);

gotoxy(0, 24);
cprintf("STONE 000 SEED %05u RUN", map_seed);
@@ -409,13 +429,24 @@ int main(void)
smoke_ready();

for (;;) {
wait_frame();
wait_line(DRAW_LINE);
cycles_start();
#ifdef VIEW_TIMING
redraw_pending = 1; /* timing build: redraw every frame */
bordercolor(COLOR_RED);
redraw_all();
bordercolor(COLOR_BLACK);
#endif
if (redraw_pending) {
view_draw_top();
draw_overlays(0, VIEW_SPLIT);
view_draw_bottom();
draw_overlays(VIEW_SPLIT, VIEW_H);
redraw_pending = 0;
}
#ifdef VIEW_TIMING
bordercolor(COLOR_BLACK); /* timing build: redraw only, no input */
#else
old_x = cur_x;
old_y = cur_y;
moved = need_redraw = toggled = 0;
handle_mouse();
moved_by_mouse = moved;
@@ -424,16 +455,23 @@ int main(void)
if (moved && !moved_by_mouse) {
pointer_to_cursor(); /* keyboard/joystick moved: pointer follows */
}
if (need_redraw) {
redraw_all();
}
if (toggled) {
blink = CURSOR_ON_FRAMES; /* show the changed tile for a moment */
} else if (moved) {
blink = 0; /* show the cursor at once after a move */
}
++blink;
draw_cursor_cell((blink & 31u) < CURSOR_ON_FRAMES);
if (need_redraw) {
view_setup(view_x, view_y); /* drawn, cursor included, at the next DRAW_LINE */
redraw_pending = 1;
} else {
if (moved) { /* repair the old cursor cell */
put_cell((unsigned char)(old_x - view_x), (unsigned char)(old_y - view_y),
cell_code(old_x, old_y));
}
draw_cursor_cell();
}
#endif
c = cycles_read();
if (c > frame_max_cycles) {
frame_max_cycles = c;


+ 7
- 0
src/view.h Vedi File

@@ -11,4 +11,11 @@
** IRQs are held off while it runs. */
void __fastcall__ draw_view(unsigned char vx, unsigned char vy);

/* The same in steps, so the caller can keep each half away from the raster beam (M2.3):
** view_setup() once, then view_draw_top() (rows 0..VIEW_SPLIT-1) and view_draw_bottom(). */
#define VIEW_SPLIT 12u
void __fastcall__ view_setup(unsigned char vx, unsigned char vy);
void view_draw_top(void);
void view_draw_bottom(void);

#endif

+ 45
- 8
src/view.s Vedi File

@@ -8,10 +8,19 @@
; into the code (self-modifying) once per call. vx <= 88 keeps map row reads inside one page,
; so no indexed read crosses a page.
;
; C prototype (view.h): void __fastcall__ draw_view(unsigned char vx, unsigned char vy);
; Tearing (M2.3): the view is drawn in two halves, rows 0-11 and rows 12-22, each column by
; column. The caller starts the top half while the raster beam is below row 11 and the bottom
; half once the beam has left row 22 (see main.c), so the beam never shows a half drawn
; row. view_setup() patches the source addresses; view_draw_top()/view_draw_bottom() copy.
;
; C prototypes (view.h):
; void __fastcall__ draw_view(unsigned char vx, unsigned char vy); setup + both halves
; void __fastcall__ view_setup(unsigned char vx, unsigned char vy);
; void view_draw_top(void);
; void view_draw_bottom(void);
; vy arrives in A, vx on the C stack.

.export _draw_view
.export _draw_view, _view_setup, _view_draw_top, _view_draw_bottom
.importzp c_sp
.import incsp1

@@ -20,6 +29,7 @@ COLRAM = $D800
VIEW_TOP = 1
VIEW_H = 23
VIEW_W = 40
SPLIT = 12 ; rows 0..SPLIT-1 are the top half
MAP_HI = $40 ; map at $4000

.segment "BSS"
@@ -29,6 +39,11 @@ src_hi: .res 1
.segment "CODE"

_draw_view:
jsr _view_setup
jsr _view_draw_top
jmp _view_draw_bottom

_view_setup:
; Row 0 source address = $4000 + vy*128 + vx -> hi = $40 + vy/2, lo = (vy odd ? $80 : 0) + vx
lsr a ; A = vy/2, C = vy & 1
tax
@@ -56,20 +71,42 @@ _draw_view:
inc src_hi
:
.endrep
rts

; Rows 0 .. SPLIT-1.
_view_draw_top:
php
sei ; keep timing steady; a pending IRQ runs after plp
ldy #VIEW_W - 1
col_loop:
.repeat VIEW_H, R
top_loop:
.repeat SPLIT, R
.ident(.sprintf("src%d", R)):
lda $4000,y ; operand patched above
lda $4000,y ; operand patched by view_setup
sta SCREEN + (VIEW_TOP + R) * 40,y
sta COLRAM + (VIEW_TOP + R) * 40,y
.endrep
dey
bmi done
jmp col_loop
done:
bmi top_done
jmp top_loop
top_done:
plp
rts

; Rows SPLIT .. VIEW_H-1.
_view_draw_bottom:
php
sei
ldy #VIEW_W - 1
bottom_loop:
.repeat VIEW_H - SPLIT, K
.ident(.sprintf("src%d", K + SPLIT)):
lda $4000,y ; operand patched by view_setup
sta SCREEN + (VIEW_TOP + SPLIT + K) * 40,y
sta COLRAM + (VIEW_TOP + SPLIT + K) * 40,y
.endrep
dey
bmi bottom_done
jmp bottom_loop
bottom_done:
plp
rts

Loading…
Annulla
Salva

Powered by TurnKey Linux.