scroll.s (1203B)
1 .include "global.s" 2 3 .title "console utilities" 4 .module ConsoleUtils 5 6 .globl .curx, .cury 7 8 .area _HOME 9 10.scroll_viewport:: 11 DISABLE_VBLANK_COPY ; switch OFF copy shadow SAT 12 ld hl, #(.VDP_TILEMAP + ((.SCREEN_Y_OFS + 1) * .VDP_MAP_WIDTH * 2)) 13 14 ld bc, #((.SCREEN_HEIGHT - 1) * .VDP_MAP_WIDTH * 2) 15 inc b 16 inc c 17 jr 1$ 182$: 19 res 6, h 20 WRITE_VDP_CMD_HL 21 nop 22 nop 23 in a, (.VDP_DATA) 24 ld e, a 25 26 ld a, l 27 sub #(.VDP_MAP_WIDTH * 2) 28 ld l, a 29 ld a, h 30 sbc #0 31 ld h, a 32 33 set 6, h 34 WRITE_VDP_CMD_HL 35 nop 36 ld a, e 37 out (.VDP_DATA), a 38 39 ld a, #((.VDP_MAP_WIDTH * 2) + 1) 40 add l 41 ld l, a 42 adc h 43 sub l 44 ld h, a 45 461$: 47 dec c 48 jr nz, 2$ 49 djnz 2$ 50 51 ld hl, #(.VDP_TILEMAP + ((.SCREEN_Y_OFS + .SCREEN_HEIGHT - 1) * .VDP_MAP_WIDTH * 2)) 52 WRITE_VDP_CMD_HL 53 54 ld hl, #.SPACE 55 ld b, #.VDP_MAP_WIDTH 563$: 57 WRITE_VDP_DATA_HL 58 djnz 3$ 59 60 ENABLE_VBLANK_COPY ; switch ON copy shadow SAT 61 ret