diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-05-27 23:24:19 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-05-27 23:24:19 +0100 |
commit | 703ab56587aac0d79ccc0f72f2b8d9ee235e20a5 (patch) | |
tree | 32b186dc14c56fe19c004a403eeaaf7e2dd0b10f | |
parent | 420ac2c8f2307ddcbe551972544bbe11f05ee7ff (diff) | |
download | ubox-msx-lib-703ab56587aac0d79ccc0f72f2b8d9ee235e20a5.tar.gz ubox-msx-lib-703ab56587aac0d79ccc0f72f2b8d9ee235e20a5.zip |
Use SDCC's new calling convention
(this is an ABI breaking change, and will require changes to
user-written asm functions or their declarations)
33 files changed, 156 insertions, 199 deletions
@@ -1,3 +1,11 @@ +## Release 1.2.0 - 2022-??-?? + + - Support for the new SDCC calling convention (SDCC 4.2.0 or later) + - Small fixes in the build scripts + + For older versions of SDCC (or the old calling convention), please + use version 1.1.14. + ## Release 1.1.14 - 2023-06-17 - Small improvements in the API, around const parameters @@ -22,15 +22,19 @@ deep knowledge of the system. - GNU Make (others may work) - a POSIX compatible environment -The [SDCC](http://sdcc.sourceforge.net/) compiler is also needed. Check the -following table for some hints on compatibility. +The [SDCC](http://sdcc.sourceforge.net/) compiler is also needed, version 4.2.0 +or later (using the new calling convention). + +Check the following table for some hints on compatibility. | Version | Compatible | Comments | | --- | --- | --- | -| 3.9.0 | yes | - | -| 4.0.0 | yes | - | -| 4.1.0 | no | At least on Linux amd64 it generates broken Z80 code | -| 4.2.0 | yes | Needs option in `config.env`, edit the file for details | +| 4.2.0 | yes | - | +| 4.3.0 | ? | Untested | +| 4.4.0 | no | Generates broken Z80 code | + +To use an older version of SDCC (or the old calling convention), ubox MSX lib +1.1.14 is the latest supported version. If you want to build the example you will also need: @@ -3,5 +3,5 @@ # Size of the resulting ROM ROM_MAX=0x8000 -# uncomment for sdcc 4.2.0 or later -#EXTRA_CFLAGS += --sdcccall 0 +# To add extra flags +#EXTRA_CFLAGS += ??? diff --git a/game/src/helpers.c b/game/src/helpers.c index 9aa4785..295c504 100644 --- a/game/src/helpers.c +++ b/game/src/helpers.c @@ -7,7 +7,7 @@ /** * Put a zero terminated string on the screen using tiles. * - * The font starts on the tileset on tile 128 and the fist char in our has + * The font starts on the tileset on tile 128 and the fist char in our font has * ASCII value 31, so it is adjusted so we can use ASCII *uppercase* directly * in our C code. */ diff --git a/include/mplayer.h b/include/mplayer.h index c13ac56..3ec66db 100644 --- a/include/mplayer.h +++ b/include/mplayer.h @@ -77,7 +77,7 @@ void mplayer_init(const uint8_t *song, uint8_t sub_song); * See [exporting songs and effects](#exporting-songs-and-effects) for details * on how to add effects to your project. */ -void mplayer_init_effects(const uint8_t *effects) __z88dk_fastcall; +void mplayer_init_effects(const uint8_t *effects); // @Playback @@ -170,12 +170,12 @@ void mplayer_play_effect_p(uint8_t effect_no, uint8_t chan, uint8_t inv_vol); /** * Stops the effect being played on `chan` channel. */ -void mplayer_stop_effect_channel(uint8_t chan) __z88dk_fastcall; +void mplayer_stop_effect_channel(uint8_t chan); /** * Returns 0 if there's no sound effect being played on `chan` channel, or * a value different than 0 otherwise. */ -uint8_t mplayer_is_sound_effect_on(uint8_t chan) __z88dk_fastcall; +uint8_t mplayer_is_sound_effect_on(uint8_t chan); #endif // _MPLAYER_H diff --git a/include/ubox.h b/include/ubox.h index fa56741..ed8f651 100644 --- a/include/ubox.h +++ b/include/ubox.h @@ -64,7 +64,7 @@ * ubox_set_mode(2); * ``` */ -void ubox_set_mode(uint8_t mode) __z88dk_fastcall; +void ubox_set_mode(uint8_t mode); /** * Enables the screen. @@ -193,7 +193,7 @@ uint8_t ubox_get_vsync_freq(void); * All the tiles functions use an index in this tile set (usually via a `tile` * parameter). */ -void ubox_set_tiles(const uint8_t *tiles) __z88dk_fastcall; +void ubox_set_tiles(const uint8_t *tiles); /** * Sets the current color table for current tile set to the color table pointed @@ -203,7 +203,7 @@ void ubox_set_tiles(const uint8_t *tiles) __z88dk_fastcall; * of the tiles table (8 rows, 8 bytes per tile). The colors will be loaded into * the VDP in all three screen sections. */ -void ubox_set_tiles_colors(const uint8_t *colors) __z88dk_fastcall; +void ubox_set_tiles_colors(const uint8_t *colors); /** * Puts a tile from current tile set on the screen. The tile is identified by @@ -246,7 +246,7 @@ uint8_t ubox_get_tile(uint8_t x, uint8_t y); * See [ubox_set_tiles](#ubox_set_tiles) for for information on how to set a * tile set. */ -void ubox_fill_screen(uint8_t tile) __z88dk_fastcall; +void ubox_fill_screen(uint8_t tile); // @Interrupt and clock functions @@ -286,7 +286,7 @@ void ubox_fill_screen(uint8_t tile) __z88dk_fastcall; * are disabled, and because of that some BIOS functions, such as `CHGET`, * won't work. */ -void ubox_init_isr(uint8_t wait_ticks) __z88dk_fastcall; +void ubox_init_isr(uint8_t wait_ticks); /** * Installs a user interrupt handler. @@ -311,7 +311,7 @@ void ubox_init_isr(uint8_t wait_ticks) __z88dk_fastcall; * ubox_set_user_isr(my_isr); * ``` */ -void ubox_set_user_isr(void (*fn)(void)) __z88dk_fastcall; +void ubox_set_user_isr(void (*fn)(void)); /** * Waits for a maximum `wait_ticks` interrupts (see [ubox_init_isr](#ubox_init_isr)). @@ -364,7 +364,7 @@ void ubox_wait(void); * ubox_wait_for(250); * ``` */ -void ubox_wait_for(uint8_t frames) __z88dk_fastcall; +void ubox_wait_for(uint8_t frames); extern uint8_t ubox_tick; @@ -519,7 +519,7 @@ uint8_t ubox_select_ctl(void); * } * ``` */ -uint8_t ubox_read_ctl(uint8_t control) __z88dk_fastcall; +uint8_t ubox_read_ctl(uint8_t control); #define UBOX_MSX_CTL_CURSOR 0 #define UBOX_MSX_CTL_PORT1 1 @@ -554,7 +554,7 @@ uint8_t ubox_read_ctl(uint8_t control) __z88dk_fastcall; * } * ``` */ -uint8_t ubox_read_keys(uint8_t row) __z88dk_fastcall; +uint8_t ubox_read_keys(uint8_t row); // row 0 #define UBOX_MSX_KEY_7 0x80 diff --git a/src/ap/ap.z80 b/src/ap/ap.z80 index b968853..882c75e 100644 --- a/src/ap/ap.z80 +++ b/src/ap/ap.z80 @@ -18,16 +18,7 @@ .ez80 _ap_uncompress:: - ld hl, #2 - add hl, sp - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld a, (hl) - inc hl - ld h, (hl) - ld l, a + ex de, hl ap_uncompress:: ld ixl, #128 @@ -154,4 +145,3 @@ ap_getgammaloop: call ap_getbit jr c, ap_getgammaloop ret - diff --git a/src/mplayer/akm/akm_ubox.asm b/src/mplayer/akm/akm_ubox.asm index cbbf8af..39aef74 100644 --- a/src/mplayer/akm/akm_ubox.asm +++ b/src/mplayer/akm/akm_ubox.asm @@ -7,11 +7,10 @@ PLY_AKM_ROM_Buffer = #c000 include "PlayerAkm.asm" -; IN: L = channel +; IN: a = channel ; OUT: L = 0 if is not on PLY_AKM_IsSoundEffectOnDisarkGenerateExternalLabel: PLY_AKM_IsSoundEffectOn: - ld a,l add a,a add a,a add a,a @@ -22,6 +21,4 @@ PLY_AKM_IsSoundEffectOn: ld a,(hl) inc hl or (hl) - ld l,a ret - diff --git a/src/mplayer/mplayer_init.z80 b/src/mplayer/mplayer_init.z80 index 90b3824..ee922ca 100644 --- a/src/mplayer/mplayer_init.z80 +++ b/src/mplayer/mplayer_init.z80 @@ -5,13 +5,12 @@ _mplayer_init:: ld ix, #2 add ix, sp - - ld l, 0 (ix) - ld h, 1 (ix) - ld a, 2 (ix) + ld a, 0 (ix) di call _PLY_AKM_INIT ei - ret + pop hl + inc sp + jp (hl) diff --git a/src/mplayer/mplayer_play_effect.z80 b/src/mplayer/mplayer_play_effect.z80 index adf41b9..e2a233f 100644 --- a/src/mplayer/mplayer_play_effect.z80 +++ b/src/mplayer/mplayer_play_effect.z80 @@ -5,14 +5,13 @@ .globl _PLY_AKM_PLAYSOUNDEFFECT _mplayer_play_effect:: - ld hl, #2 - add hl, sp + ld c, l + ld ix, #2 + add ix, sp + ld b, 0 (ix) - ld a, (hl) - inc hl - ld c, (hl) - inc hl - ld b, (hl) - - jp _PLY_AKM_PLAYSOUNDEFFECT + call _PLY_AKM_PLAYSOUNDEFFECT + pop hl + inc sp + jp (hl) diff --git a/src/mplayer/mplayer_play_effect_p.z80 b/src/mplayer/mplayer_play_effect_p.z80 index 8efd705..9e428cd 100644 --- a/src/mplayer/mplayer_play_effect_p.z80 +++ b/src/mplayer/mplayer_play_effect_p.z80 @@ -7,39 +7,40 @@ .globl _PLY_AKM_PLAYSOUNDEFFECT _mplayer_play_effect_p:: + ld e, a + ld c, l + ld hl, #2 add hl, sp + ld b, (hl) - ld e, (hl) - inc hl - ld c, (hl) - inc hl - ld b, (hl) - - ; e effect no - ; bc: channel and volume - push bc - push de - ld l, c - call _mplayer_is_sound_effect_on + ; e effect no + ; bc: channel and volume + push bc + push de + ld a, c + call _mplayer_is_sound_effect_on - ld a, l or a - pop de - pop bc + pop de + pop bc jr z, play_efx ld a, (mplayer_current_efx) - ; comment out following line if you don't want to - ; replace current sound if is the same effect type - dec a + ; comment out following line if you don't want to + ; replace current sound if is the same effect type + dec a cp e - ret nc + jp nc, play_exit play_efx: ; all good, play the effect ld a, e ld (mplayer_current_efx), a - jp _PLY_AKM_PLAYSOUNDEFFECT + call _PLY_AKM_PLAYSOUNDEFFECT +play_exit: + pop hl + inc sp + jp (hl) diff --git a/src/mplayer/mplayer_stop_effect_channel.z80 b/src/mplayer/mplayer_stop_effect_channel.z80 index 82eb5d7..2b03954 100644 --- a/src/mplayer/mplayer_stop_effect_channel.z80 +++ b/src/mplayer/mplayer_stop_effect_channel.z80 @@ -5,6 +5,4 @@ .globl _PLY_AKM_STOPSOUNDEFFECTFROMCHANNEL _mplayer_stop_effect_channel:: - ld a, l jp _PLY_AKM_STOPSOUNDEFFECTFROMCHANNEL - diff --git a/src/ubox/ubox_fill_screen.z80 b/src/ubox/ubox_fill_screen.z80 index e803f76..f07218c 100644 --- a/src/ubox/ubox_fill_screen.z80 +++ b/src/ubox/ubox_fill_screen.z80 @@ -4,8 +4,6 @@ FILVRM = 0x0056 BG_TILE_MAP = 0x1800 _ubox_fill_screen:: - ld a, l ld hl, #BG_TILE_MAP ld bc, #768 jp FILVRM - diff --git a/src/ubox/ubox_get_tile.z80 b/src/ubox/ubox_get_tile.z80 index 3a6004d..9ea9b7b 100644 --- a/src/ubox/ubox_get_tile.z80 +++ b/src/ubox/ubox_get_tile.z80 @@ -4,13 +4,8 @@ RDVRM = 0x004a BG_TILE_MAP = 0x1800 _ubox_get_tile:: - ld hl, #2 - add hl, sp - - ld b, #0 - ld c, (hl) - inc hl - ld l, (hl) + ld b, l + ld c, a ld h, #0 add hl, hl @@ -23,7 +18,4 @@ _ubox_get_tile:: ld bc, #BG_TILE_MAP add hl, bc - call RDVRM - ld l, a - ret - + jp RDVRM diff --git a/src/ubox/ubox_get_vsync_freq.z80 b/src/ubox/ubox_get_vsync_freq.z80 index 681fe67..4a7f841 100644 --- a/src/ubox/ubox_get_vsync_freq.z80 +++ b/src/ubox/ubox_get_vsync_freq.z80 @@ -3,7 +3,6 @@ _ubox_get_vsync_freq:: ld a, (#0x002b) and #128 - ld l, a ret z - ld l, #1 + ld a, #1 ret diff --git a/src/ubox/ubox_isr.z80 b/src/ubox/ubox_isr.z80 index f25e35d..b8a19fe 100644 --- a/src/ubox/ubox_isr.z80 +++ b/src/ubox/ubox_isr.z80 @@ -12,7 +12,6 @@ REPCNT = 0xf3f7 _ubox_init_isr:: di - ld a, l ld (ubox_isr_wait_ticks), a xor a ld (ubox_isr_wait_tick), a diff --git a/src/ubox/ubox_put_tile.z80 b/src/ubox/ubox_put_tile.z80 index 24e58b2..718027d 100644 --- a/src/ubox/ubox_put_tile.z80 +++ b/src/ubox/ubox_put_tile.z80 @@ -4,14 +4,11 @@ WRTVRM = 0x004d BG_TILE_MAP = 0x1800 _ubox_put_tile:: + ld c, a + ld b, l + ld hl, #2 add hl, sp - - ld c, (hl) - inc hl - ld b, (hl) - inc hl - ld a, (hl) ld h, #0 @@ -27,5 +24,8 @@ _ubox_put_tile:: ld bc, #BG_TILE_MAP add hl, bc - jp WRTVRM + call WRTVRM + pop hl + inc sp + jp (hl) diff --git a/src/ubox/ubox_read_ctl.z80 b/src/ubox/ubox_read_ctl.z80 index ae4fff9..d6f6a07 100644 --- a/src/ubox/ubox_read_ctl.z80 +++ b/src/ubox/ubox_read_ctl.z80 @@ -5,7 +5,6 @@ WRTPSG = 0x0093 SNSMAT = 0x0141 _ubox_read_ctl:: - ld a, l or a jr z, is_keyb dec a @@ -13,7 +12,7 @@ _ubox_read_ctl:: dec a jr z, is_joy2 - ld l, #0 + xor a ret is_joy2: @@ -49,7 +48,6 @@ call_psg: xor a joy_extra_m: or e - ld l, a ret is_keyb: @@ -96,5 +94,4 @@ is_keyb_dir: or e ; added 2nd fire (M) - ld l, a ret diff --git a/src/ubox/ubox_read_keys.z80 b/src/ubox/ubox_read_keys.z80 index d32f2de..a8889fd 100644 --- a/src/ubox/ubox_read_keys.z80 +++ b/src/ubox/ubox_read_keys.z80 @@ -3,8 +3,6 @@ SNSMAT = 0x0141 _ubox_read_keys:: - ld a, l call SNSMAT cpl - ld l, a ret diff --git a/src/ubox/ubox_read_vm.z80 b/src/ubox/ubox_read_vm.z80 index 7ef0f41..78df980 100644 --- a/src/ubox/ubox_read_vm.z80 +++ b/src/ubox/ubox_read_vm.z80 @@ -3,21 +3,23 @@ LDIRMV = 0x0059 _ubox_read_vm:: + ex de, hl + ; dst -> de + ; len -> hl + ld c, l + ld b, h + ; len -> bc + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld c, (hl) - inc hl - ld b, (hl) - inc hl ld a, (hl) inc hl ld h, (hl) ld l, a + ; src -> hl - jp LDIRMV + call LDIRMV + pop hl + pop bc + jp (hl) diff --git a/src/ubox/ubox_select_ctl.z80 b/src/ubox/ubox_select_ctl.z80 index 9685bec..e313061 100644 --- a/src/ubox/ubox_select_ctl.z80 +++ b/src/ubox/ubox_select_ctl.z80 @@ -32,11 +32,11 @@ loop: or a jr nz, trigger_b - ld l, #0xff + ld a, #0xff ret trigger_b: dec b trigger: dec b - ld l, b + ld a, b ret diff --git a/src/ubox/ubox_set_colors.z80 b/src/ubox/ubox_set_colors.z80 index 74a5b7f..4b89c99 100644 --- a/src/ubox/ubox_set_colors.z80 +++ b/src/ubox/ubox_set_colors.z80 @@ -6,17 +6,17 @@ BAKCLR = 0xf3ea BDRCLR = 0xf3eb _ubox_set_colors:: - ld hl, #2 - add hl, sp - - ld a, (hl) - inc hl ld (FORCLR), a - ld a, (hl) - inc hl + ld a, l ld (BAKCLR), a + + ld hl, #2 + add hl, sp ld a, (hl) ld (BDRCLR), a + call CHGCLR - ret + pop hl + inc sp + jp (hl) diff --git a/src/ubox/ubox_set_mode.z80 b/src/ubox/ubox_set_mode.z80 index 4635d34..373a145 100644 --- a/src/ubox/ubox_set_mode.z80 +++ b/src/ubox/ubox_set_mode.z80 @@ -3,6 +3,4 @@ CHGMOD = 0x005f _ubox_set_mode:: - ld a, l jp CHGMOD - diff --git a/src/ubox/ubox_set_sprite_attr.z80 b/src/ubox/ubox_set_sprite_attr.z80 index 4e5c80e..ecf5952 100644 --- a/src/ubox/ubox_set_sprite_attr.z80 +++ b/src/ubox/ubox_set_sprite_attr.z80 @@ -4,14 +4,11 @@ SP_ATTRS = 0x1b00 _ubox_set_sprite_attr:: + ld e, l + ld d, h + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld l, (hl) sla l sla l @@ -20,12 +17,11 @@ _ubox_set_sprite_attr:: add hl, bc push de - ld bc, #4 - push bc - push hl + ld de, #4 + ; hl: dst, de: len, stack: src call _ubox_write_vm - pop af - pop af - pop af - ret + + pop hl + inc sp + jp (hl) diff --git a/src/ubox/ubox_set_sprite_pat16.z80 b/src/ubox/ubox_set_sprite_pat16.z80 index 59d7ccb..ee0f3c4 100644 --- a/src/ubox/ubox_set_sprite_pat16.z80 +++ b/src/ubox/ubox_set_sprite_pat16.z80 @@ -4,14 +4,11 @@ SP_PATTERNS = 0x3800 _ubox_set_sprite_pat16:: + ld e, l + ld d, h + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld l, (hl) ld h, #0 add hl, hl @@ -23,12 +20,10 @@ _ubox_set_sprite_pat16:: add hl, bc push de - ld bc, #32 - push bc - push hl + ld de, #32 + ; hl: dst, de: len, stack: src call _ubox_write_vm - pop af - pop af - pop af - ret + pop hl + inc sp + jp (hl) diff --git a/src/ubox/ubox_set_sprite_pat16_flip.z80 b/src/ubox/ubox_set_sprite_pat16_flip.z80 index 52f4ab7..7ac4077 100644 --- a/src/ubox/ubox_set_sprite_pat16_flip.z80 +++ b/src/ubox/ubox_set_sprite_pat16_flip.z80 @@ -4,14 +4,11 @@ WRTVRM = 0x004d SP_PATTERNS = 0x3800 _ubox_set_sprite_pat16_flip:: + ld e, l + ld d, h + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld l, (hl) ld h, #0 add hl, hl @@ -32,7 +29,9 @@ _ubox_set_sprite_pat16_flip:: pop de call flip - ret + pop hl + inc sp + jp (hl) flip: ld b, #16 diff --git a/src/ubox/ubox_set_sprite_pat8.z80 b/src/ubox/ubox_set_sprite_pat8.z80 index 06b484c..c48588e 100644 --- a/src/ubox/ubox_set_sprite_pat8.z80 +++ b/src/ubox/ubox_set_sprite_pat8.z80 @@ -4,14 +4,11 @@ SP_PATTERNS = 0x3800 _ubox_set_sprite_pat8:: + ld e, l + ld d, h + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld l, (hl) ld h, #0 add hl, hl @@ -21,12 +18,10 @@ _ubox_set_sprite_pat8:: add hl, bc push de - ld bc, #8 - push bc - push hl + ld de, #8 + ; hl: dst, de: len, stack: src call _ubox_write_vm - pop af - pop af - pop af - ret + pop hl + inc sp + jp (hl) diff --git a/src/ubox/ubox_set_sprite_pat8_flip.z80 b/src/ubox/ubox_set_sprite_pat8_flip.z80 index b453253..64451e4 100644 --- a/src/ubox/ubox_set_sprite_pat8_flip.z80 +++ b/src/ubox/ubox_set_sprite_pat8_flip.z80 @@ -4,14 +4,11 @@ WRTVRM = 0x004d SP_PATTERNS = 0x3800 _ubox_set_sprite_pat8_flip:: + ld e, l + ld d, h + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld l, (hl) ld h, #0 add hl, hl @@ -26,7 +23,10 @@ flip0: inc hl inc de djnz flip0 - ret + + pop hl + inc sp + jp (hl) flip_and_copy: ld a, (de) diff --git a/src/ubox/ubox_set_tiles.z80 b/src/ubox/ubox_set_tiles.z80 index 7e4f42e..726eaae 100644 --- a/src/ubox/ubox_set_tiles.z80 +++ b/src/ubox/ubox_set_tiles.z80 @@ -19,4 +19,3 @@ _ubox_set_tiles:: ld de, #BG_TILES + #256 * 8 * 2 ld bc, #256 * 8 jp LDIRVM - diff --git a/src/ubox/ubox_set_tiles_colors.z80 b/src/ubox/ubox_set_tiles_colors.z80 index 4c4591b..6ca5d36 100644 --- a/src/ubox/ubox_set_tiles_colors.z80 +++ b/src/ubox/ubox_set_tiles_colors.z80 @@ -19,4 +19,3 @@ _ubox_set_tiles_colors:: ld de, #BG_COLS + 256 * 8 * 2 ld bc, #256 * 8 jp LDIRVM - diff --git a/src/ubox/ubox_wait_for.z80 b/src/ubox/ubox_wait_for.z80 index 5cc4649..f1984c8 100644 --- a/src/ubox/ubox_wait_for.z80 +++ b/src/ubox/ubox_wait_for.z80 @@ -4,11 +4,10 @@ .globl ubox_isr_wait_tick _ubox_wait_for:: - ld b, l + ld b, a wait_for_loop: push bc call _ubox_wait pop bc djnz wait_for_loop ret - diff --git a/src/ubox/ubox_write_vm.z80 b/src/ubox/ubox_write_vm.z80 index 3d6606b..0daa7cc 100644 --- a/src/ubox/ubox_write_vm.z80 +++ b/src/ubox/ubox_write_vm.z80 @@ -3,21 +3,23 @@ LDIRVM = 0x005c _ubox_write_vm:: + ex de, hl + ; dst -> de + ; len -> hl + ld c, l + ld b, h + ; len -> bc + ld hl, #2 add hl, sp - - ld e, (hl) - inc hl - ld d, (hl) - inc hl - ld c, (hl) - inc hl - ld b, (hl) - inc hl ld a, (hl) inc hl ld h, (hl) ld l, a + ; src -> hl - jp LDIRVM + call LDIRVM + pop hl + pop af + jp (hl) diff --git a/src/ubox/ubox_wvdp.z80 b/src/ubox/ubox_wvdp.z80 index 90dfc86..b185f57 100644 --- a/src/ubox/ubox_wvdp.z80 +++ b/src/ubox/ubox_wvdp.z80 @@ -3,12 +3,6 @@ WRITEVDP = 0x0047 _ubox_wvdp:: - ld hl, #2 - add hl, sp - - ld c, (hl) - inc hl - ld b, (hl) - call WRITEVDP - ret - + ld c, a + ld b, l + jp WRITEVDP |