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/vmemcpy.s

      1         .include        "global.s"
      2 
      3         .title  "VRAM utilities"
      4         .module VRAMUtils
      5         .area   _HOME
      6 
      7         .ez80
      8 
      9 ; void vmemcpy (unsigned int dst, const void *src, unsigned int size) __z88dk_callee __preserves_regs(iyh,iyl);
     10 _set_data::
     11 _vmemcpy::
     12         DISABLE_VBLANK_COPY
     13 
     14         pop de          ; pop ret address
     15         pop hl          ; dst
     16         
     17         VDP_WRITE_CMD h, l
     18         
     19         pop hl          ; src
     20         pop bc          ; size
     21         
     22         ld a, b         ; HI(size)
     23         ld b, c         ; LO(size)
     24         
     25         ld c, #.VDP_DATA
     26 
     27         rlc b
     28         rrc b           ; check b is zero
     29         jr  z, 2$ 
     30 1$:
     31         outi
     32         jp  nz, 1$      ; 10 = 26 (VRAM safe)
     33 2$:
     34         inc a
     35         jp  4$          
     36 3$:
     37         outi
     38         jp  nz, 3$      ; 10 = 26 (VRAM safe)
     39 4$:
     40         dec a
     41         jp  nz, 3$
     42 
     43         ENABLE_VBLANK_COPY
     44 
     45         ld h, d
     46         ld l, e
     47         jp (hl)

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