;---------------------------------------------------------------------------------------- ; port C setup for SD card (and also for keyboard on port C0 C1 and LCD on port B0 to B5 ;---------------------------------------------------------------------------------------- setportc: ; the N8VEM startup code sets port A=in, B=out and C=in ; change this to port A=out, B=out and C=in ; Any pins can be used, but suggest A0 A1 A2 for the outputs and C2 for the input ld a,10001001B ; a=out b=out c=in http://www.datasheetcatalog.org/datasheet/oki/82C55.pdf p11 out (99),a ; 99=control ld a,00000000B ; put zero in A out (96),a ; 96=port A clear to zero out (97),a ; 97=port B clear to zero ; in a,(98) reads port C. Keyboard uses C0 and C1, so use C2 mask with 00000100B ret