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/msxdos/___sdcc_bcall_abc.s

      1         .include "global.s"
      2 
      3         .area   _CODE
      4 
      5         .globl ___sdcc_bcall_abc
      6 	.globl .mapper_page_set
      7 
      8 ;
      9 ; trampoline to call banked functions with __z88dk_fastcall calling convention
     10 ; Usage:
     11 ;  ld   a, #<function_bank>
     12 ;  ld   bc, #<function>
     13 ;  call ___sdcc_bcall_abc
     14 ;
     15 ___sdcc_bcall_abc::
     16         push hl
     17         ld l, a
     18         ld a, (__current_bank)
     19         ld h, #>__banks_remap_table
     20         ld l, (hl)
     21         ld h, a
     22         call .mapper_page_set
     23         ex (sp), hl
     24 
     25         inc sp
     26         call ___sdcc_bjump_abc
     27         dec sp
     28 
     29         ex (sp), hl
     30         ld c, a
     31         ld a, h
     32         ld (__current_bank), a
     33         ld h, #>__banks_remap_table
     34         ld l, a
     35         ld a, (hl)
     36         call .mapper_page_set
     37         ld a, c
     38         pop hl
     39         ret
     40 ;
     41 ___sdcc_bjump_abc:
     42         push bc
     43         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.