ORG $B600 ; start of EEPROM * * read A/D from port E, pin 0-3, write to port B * port E pins 4-5 determine which A/D is read * ldx #$1000 ; needed for the brclr command ldaa #%10010000 ; Power up A/D with clock delay staa $39,x Main ldaa #%00010000 ; single scan, multi-mode, pins e0-3 staa $30,x ; write starts conversion Conversion_not_done brclr $30,x $80 Conversion_not_done ldab $0a,x ; get port E digital inputs lsrb lsrb lsrb lsrb andb #$03 ; set bits 4-5 to 0-1 and set all others to 0 abx ; x = x + b ldaa $31,x ; get value from pin E0, E1, E2, or E3 ldx #$1000 ; needed for the brclr command staa $04,x ; store it to port B bra Main ; let's do it again