29. User port experimenting (2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The previous program examines the User Port inputs via location &FE60. However, by writing to &FE62 you can nominate pins as outputs instead, and they will default to logic LO, which you can check with the previous program, and confirm with a multimeter. This program asks you which bits are to be outputs, so enter 0237 or 134 or whichever bits you want, in any order. If you just press without entering anything, all pins will be reset as inputs. Strangely, so it might seem, you alter the output states by writing to &FE60; the pins set as inputs will ignore this, so no need to worry on that score. In other words, ?&FE60=255 would set all outputs to logic HI without affecting the inputs, and so if you PRINT ?&FE60 afterwards, you will see the effect. Try combining the two programs, and add a few bits of your own to make a more complete experimenting program. 10 PRINT ?&FE62:INPUT"Which ones for output? " output$ 20 FOR pb%=0 TO 7:power%=2^pb% 30 IF INSTR(output$,STR$(pb%))>0 THEN ?&FE62=?&FE62 OR power% ELSE ?&FE62=?&FE62 AND (255-power%) 40 NEXT:PRINT ?&FE62