git.y1.nz

gbdk-2020

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

commit 3ef0e5764974d3ca868ff1959b5895e76e3b161e
parent 8742d5bc5f1c148345c64152d72f00514012a98e
Author: Toxa <56631470+untoxa@users.noreply.github.com>
Date:   Fri,  3 Jun 2022 21:10:43 +0300

Merge pull request #349 from asiekierka/feature/minor-oldcall-optimizations

GB: remove OLDCALL from some commonly used functions
Diffstat:
Mgbdk-lib/include/gb/gb.h10+++++-----
Mgbdk-lib/libc/targets/sm83/delay.s5-----
Mgbdk-lib/libc/targets/sm83/get_tile.s6+-----
Mgbdk-lib/libc/targets/sm83/pad.s3+--
Mgbdk-lib/libc/targets/sm83/pad_ex.s5-----
5 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -570,7 +570,7 @@ __endasm; \ Uses no timers or interrupts, and can be called with interrupts disabled */ -void delay(uint16_t d) OLDCALL; +void delay(uint16_t d) PRESERVES_REGS(h, l); @@ -584,7 +584,7 @@ void delay(uint16_t d) OLDCALL; @see J_START, J_SELECT, J_A, J_B, J_UP, J_DOWN, J_LEFT, J_RIGHT */ -uint8_t joypad() OLDCALL PRESERVES_REGS(b, c, h, l); +uint8_t joypad() PRESERVES_REGS(b, c, h, l); /** Waits until at least one of the buttons given in mask are pressed. @@ -598,7 +598,7 @@ uint8_t joypad() OLDCALL PRESERVES_REGS(b, c, h, l); @see joypad @see J_START, J_SELECT, J_A, J_B, J_UP, J_DOWN, J_LEFT, J_RIGHT */ -uint8_t waitpad(uint8_t mask) OLDCALL PRESERVES_REGS(b, c); +uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b, c, h, l); /** Waits for the directional pad and all buttons to be released. @@ -639,7 +639,7 @@ uint8_t joypad_init(uint8_t npads, joypads_t * joypads) OLDCALL; @see joypad_init(), joypads_t */ -void joypad_ex(joypads_t * joypads) OLDCALL PRESERVES_REGS(b, c); +void joypad_ex(joypads_t * joypads) PRESERVES_REGS(b, c); @@ -804,7 +804,7 @@ void set_vram_byte(uint8_t * addr, uint8_t v) OLDCALL PRESERVES_REGS(b, c); * @param addr address to read from * @return read value */ -uint8_t get_vram_byte(uint8_t * addr) OLDCALL PRESERVES_REGS(b, c); +uint8_t get_vram_byte(uint8_t * addr) PRESERVES_REGS(b, c, h, l); /** diff --git a/gbdk-lib/libc/targets/sm83/delay.s b/gbdk-lib/libc/targets/sm83/delay.s @@ -11,11 +11,6 @@ .CPMS = 4194/4 ; 4.194304 MHz _delay:: - LDA HL,2(SP) ; Skip return address - LD E,(HL) ; DE = delay - INC HL - LD D,(HL) - .delay:: ; 6 cycles for the CALL PUSH BC ; 4 cycles CALL .dly ; 12 cycles to return from .dly (6+1+5) diff --git a/gbdk-lib/libc/targets/sm83/get_tile.s b/gbdk-lib/libc/targets/sm83/get_tile.s @@ -3,12 +3,8 @@ .area _CODE _get_vram_byte:: - ldhl sp,#2 - ld a,(hl+) - ld h,(hl) - ld l,a WAIT_STAT - ld e,(hl) + ld a,(de) ret _get_win_tile_xy:: diff --git a/gbdk-lib/libc/targets/sm83/pad.s b/gbdk-lib/libc/targets/sm83/pad.s @@ -56,8 +56,7 @@ _joypad:: ;; Wait for the key to be pressed _waitpad:: - LDA HL,2(SP) ; Skip return address - LD D,(HL) + LD D,A ;; Wait for the key in D to be pressed .wait_pad:: 1$: diff --git a/gbdk-lib/libc/targets/sm83/pad_ex.s b/gbdk-lib/libc/targets/sm83/pad_ex.s @@ -68,11 +68,6 @@ _joypad_init:: ret _joypad_ex:: - lda hl, 2(sp) - ld a, (hl+) - ld e, a - ld d, (hl) - .joypad_ex:: ld a, (de) inc de

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