git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/libc/targets/z80/cls.s

      1         .include        "global.s"
      2 
      3         .title  "console utilities"
      4         .module ConsoleUtils
      5 
      6         .globl  .curx, .cury
      7 
      8         .area   _HOME
      9 
     10 _cls::
     11         ld a, #.SCREEN_X_OFS
     12         ld (.curx), a
     13         ld a, #.SCREEN_Y_OFS
     14         ld (.cury), a
     15 
     16         DISABLE_VBLANK_COPY     ; switch OFF copy shadow SAT
     17 
     18         ld a, (_shadow_VDP_R2)
     19         rlca
     20         rlca
     21         and #0b01111000
     22         ld d, a
     23         ld e, #0
     24         ld hl, #((.SCREEN_Y_OFS * .VDP_MAP_WIDTH) * 2)
     25         add hl, de
     26 
     27         WRITE_VDP_CMD_HL
     28 
     29         ld hl, #.SPACE
     30         ld bc, #(.SCREEN_HEIGHT * .VDP_MAP_WIDTH)
     31         inc b
     32         inc c
     33         jr 1$
     34 2$:
     35         WRITE_VDP_DATA_HL
     36 1$:
     37         dec c
     38         jr nz, 2$
     39         djnz 2$
     40 
     41         ENABLE_VBLANK_COPY         ; switch ON copy shadow SAT
     42         ret

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.