Files

26 lines
2.0 KiB
Plaintext

1 .module wc_gadrw
2 .area _CODE
00006006 3 WC_ENTRY = 0x6006
4 .globl _wc_gadrw
00000000 5 _wc_gadrw::
00000000 DD E5 [15] 6 push ix
00000002 E5 [11] 7 push hl ; save win (HL = 1st arg)
00000003 DD 21 00 00 [14] 8 ld ix, #0
00000007 DD 39 [15] 9 add ix, sp
00000009 DD 56 06 [19] 10 ld d, 6(ix) ; D = y
0000000C DD 5E 07 [19] 11 ld e, 7(ix) ; E = x
0000000F DD 6E 00 [19] 12 ld l, 0(ix)
00000012 DD 66 01 [19] 13 ld h, 1(ix) ; HL = win
00000015 E5 [11] 14 push hl
00000016 DD E1 [14] 15 pop ix ; IX = win
00000018 3E 05 [ 7] 16 ld a, #0x05
0000001A CD 06 60 [17] 17 call WC_ENTRY ; HL = result addr
0000001D EB [ 4] 18 ex de, hl ; DE = result (sdcccall(1) uint16)
0000001E E1 [10] 19 pop hl ; remove saved win (use HL, keep DE)
0000001F DD E1 [14] 20 pop ix ; restore caller IX
21 ; callee cleans 2 bytes (y+x); preserve DE = return value
00000021 E1 [10] 22 pop hl ; HL = return address
00000022 33 [ 6] 23 inc sp
00000023 33 [ 6] 24 inc sp ; discard y(1)+x(1)
00000024 E9 [ 4] 25 jp (hl) ; return, DE = result