1 ;-------------------------------------------------------- 2 ; File Created by SDCC : free open source ANSI-C Compiler 3 ; Version 3.6.0 #9615 (Linux) 4 ;-------------------------------------------------------- 5 .module pio 6 .optsdcc -mz80 7 8 ;-------------------------------------------------------- 9 ; Public variables in this module 10 ;-------------------------------------------------------- 11 .globl __pio_data 12 .globl __pio_control 13 .globl _pio_set_mode 14 .globl _pio_set_interrupts 15 .globl _pio_set_interrupts_mask 16 ;-------------------------------------------------------- 17 ; special function registers 18 ;-------------------------------------------------------- 19 ;-------------------------------------------------------- 20 ; ram data 21 ;-------------------------------------------------------- 22 .area _DATA 23 ;-------------------------------------------------------- 24 ; ram data 25 ;-------------------------------------------------------- 26 .area _INITIALIZED 0000 27 _pio_port: 0000 28 .ds 2 0002 29 _pio_ctrl: 0002 30 .ds 2 31 ;-------------------------------------------------------- 32 ; absolute external ram data 33 ;-------------------------------------------------------- 34 .area _DABS (ABS) 35 ;-------------------------------------------------------- 36 ; global & static initialisations 37 ;-------------------------------------------------------- 38 .area _HOME 39 .area _GSINIT 40 .area _GSFINAL 41 .area _GSINIT 42 ;-------------------------------------------------------- 43 ; Home 44 ;-------------------------------------------------------- 45 .area _HOME 46 .area _HOME 47 ;-------------------------------------------------------- 48 ; code 49 ;-------------------------------------------------------- 50 .area _CODE 51 ;pio.c:6: inline void _pio_data(int port, uint8_t data) 52 ; --------------------------------- 53 ; Function _pio_data 54 ; --------------------------------- 0000 55 __pio_data:: 56 ;pio.c:8: *(pio_port + port) = data; 0000 21 02 00 [10] 57 ld hl,#2 0003 39 [11] 58 add hl,sp 0004 FD 21r00r00 [14] 59 ld iy,#_pio_port 0008 FD 7E 00 [19] 60 ld a,0 (iy) 000B 86 [ 7] 61 add a, (hl) 000C 4F [ 4] 62 ld c,a 000D FD 7E 01 [19] 63 ld a,1 (iy) 0010 23 [ 6] 64 inc hl 0011 8E [ 7] 65 adc a, (hl) 0012 47 [ 4] 66 ld b,a 0013 21 04 00 [10] 67 ld hl, #4+0 0016 39 [11] 68 add hl, sp 0017 7E [ 7] 69 ld a, (hl) 0018 02 [ 7] 70 ld (bc),a 0019 C9 [10] 71 ret 72 ;pio.c:11: inline void _pio_control(int port, uint8_t cmd) 73 ; --------------------------------- 74 ; Function _pio_control 75 ; --------------------------------- 001A 76 __pio_control:: 77 ;pio.c:13: *(pio_ctrl + port) = cmd; 001A 21 02 00 [10] 78 ld hl,#2 001D 39 [11] 79 add hl,sp 001E FD 21r02r00 [14] 80 ld iy,#_pio_ctrl 0022 FD 7E 00 [19] 81 ld a,0 (iy) 0025 86 [ 7] 82 add a, (hl) 0026 4F [ 4] 83 ld c,a 0027 FD 7E 01 [19] 84 ld a,1 (iy) 002A 23 [ 6] 85 inc hl 002B 8E [ 7] 86 adc a, (hl) 002C 47 [ 4] 87 ld b,a 002D 21 04 00 [10] 88 ld hl, #4+0 0030 39 [11] 89 add hl, sp 0031 7E [ 7] 90 ld a, (hl) 0032 02 [ 7] 91 ld (bc),a 0033 C9 [10] 92 ret 93 ;pio.c:16: void pio_set_mode(int port, int mode, uint8_t io) 94 ; --------------------------------- 95 ; Function pio_set_mode 96 ; --------------------------------- 0034 97 _pio_set_mode:: 98 ;pio.c:19: _pio_control(port, ((mode << 6) | 0x0F)); 0034 21 04 00 [10] 99 ld hl, #4+0 0037 39 [11] 100 add hl, sp 0038 7E [ 7] 101 ld a, (hl) 0039 0F [ 4] 102 rrca 003A 0F [ 4] 103 rrca 003B E6 C0 [ 7] 104 and a,#0xc0 003D F6 0F [ 7] 105 or a, #0x0f 003F 4F [ 4] 106 ld c,a 0040 D1 [10] 107 pop de 0041 E1 [10] 108 pop hl 0042 E5 [11] 109 push hl 0043 D5 [11] 110 push de 111 ;pio.c:13: *(pio_ctrl + port) = cmd; 0044 FD 2Ar02r00 [20] 112 ld iy,(_pio_ctrl) 0048 5D [ 4] 113 ld e, l 0049 54 [ 4] 114 ld d, h 004A FD 19 [15] 115 add iy, de 004C FD 71 00 [19] 116 ld 0 (iy), c 117 ;pio.c:23: if (mode == PIO_MODE_BIT_IO) { 004F FD 21 04 00 [14] 118 ld iy,#4 0053 FD 39 [15] 119 add iy,sp 0055 FD 7E 00 [19] 120 ld a,0 (iy) 0058 D6 03 [ 7] 121 sub a, #0x03 005A C0 [11] 122 ret NZ 005B FD 7E 01 [19] 123 ld a,1 (iy) 005E B7 [ 4] 124 or a, a 005F C0 [11] 125 ret NZ 126 ;pio.c:24: _pio_control(port, io); 0060 FD 21 06 00 [14] 127 ld iy,#6 0064 FD 39 [15] 128 add iy,sp 0066 FD 4E 00 [19] 129 ld c,0 (iy) 130 ;pio.c:13: *(pio_ctrl + port) = cmd; 0069 ED 5Br02r00 [20] 131 ld de,(_pio_ctrl) 006D 19 [11] 132 add hl,de 006E 71 [ 7] 133 ld (hl),c 134 ;pio.c:24: _pio_control(port, io); 006F C9 [10] 135 ret 136 ;pio.c:28: void pio_set_interrupts(int port, int control) 137 ; --------------------------------- 138 ; Function pio_set_interrupts 139 ; --------------------------------- 0070 140 _pio_set_interrupts:: 141 ;pio.c:31: _pio_control(port, (control | 0x07)); 0070 21 04 00 [10] 142 ld hl, #4+0 0073 39 [11] 143 add hl, sp 0074 7E [ 7] 144 ld a, (hl) 0075 F6 07 [ 7] 145 or a, #0x07 0077 4F [ 4] 146 ld c,a 0078 D1 [10] 147 pop de 0079 E1 [10] 148 pop hl 007A E5 [11] 149 push hl 007B D5 [11] 150 push de 151 ;pio.c:13: *(pio_ctrl + port) = cmd; 007C ED 5Br02r00 [20] 152 ld de,(_pio_ctrl) 0080 19 [11] 153 add hl,de 0081 71 [ 7] 154 ld (hl),c 155 ;pio.c:31: _pio_control(port, (control | 0x07)); 0082 C9 [10] 156 ret 157 ;pio.c:34: void pio_set_interrupts_mask(int port, int control, uint8_t mask) 158 ; --------------------------------- 159 ; Function pio_set_interrupts_mask 160 ; --------------------------------- 0083 161 _pio_set_interrupts_mask:: 162 ;pio.c:38: _pio_control(port, (control | 0x17)); 0083 21 04 00 [10] 163 ld hl, #4+0 0086 39 [11] 164 add hl, sp 0087 7E [ 7] 165 ld a, (hl) 0088 F6 17 [ 7] 166 or a, #0x17 008A 4F [ 4] 167 ld c,a 008B D1 [10] 168 pop de 008C E1 [10] 169 pop hl 008D E5 [11] 170 push hl 008E D5 [11] 171 push de 172 ;pio.c:13: *(pio_ctrl + port) = cmd; 008F FD 2Ar02r00 [20] 173 ld iy,(_pio_ctrl) 0093 5D [ 4] 174 ld e, l 0094 54 [ 4] 175 ld d, h 0095 FD 19 [15] 176 add iy, de 0097 FD 71 00 [19] 177 ld 0 (iy), c 178 ;pio.c:39: _pio_control(port, mask); 009A FD 21 06 00 [14] 179 ld iy,#6 009E FD 39 [15] 180 add iy,sp 00A0 FD 4E 00 [19] 181 ld c,0 (iy) 182 ;pio.c:13: *(pio_ctrl + port) = cmd; 00A3 ED 5Br02r00 [20] 183 ld de,(_pio_ctrl) 00A7 19 [11] 184 add hl,de 00A8 71 [ 7] 185 ld (hl),c 186 ;pio.c:39: _pio_control(port, mask); 00A9 C9 [10] 187 ret 188 .area _CODE 189 .area _INITIALIZER 0000 190 __xinit__pio_port: 0000 00 42 191 .dw #0x4200 0002 192 __xinit__pio_ctrl: 0002 02 42 193 .dw #0x4202 194 .area _CABS (ABS)