; IO Program... Allows individual IO using the TI-92 Link Port. ; By Bryan Rittmeyer - Control first discovered by Bryan Turner ; Features latching to prevent LCD from flashing. include "flib.h" include "tios.h" include "gray4lib.h" include "macros.h" ; Macros used by program xdef _main xdef _comment _main: jsr flib::clr_scr ; Clear the screen SetFont #1 select_top: WriteStr #10,#10,#4,mode jsr flib::idle_loop cmp.w #105,d0 beq input cmp.w #111,d0 beq output cmp.w #264,d0 beq exit_prog bra select_top input: jsr flib::clr_scr bsr screen_put clr.b $60000C bset.b #6,$60000C ; Turn on control mode move.w #0,red ; We will just assume that they are off move.w #0,white ; Even if we aren't right, this will be ; fixed as soon as the update routine is ; called check_stat: tst.w ($75B0) beq update_stat move.w ($75B2),d0 clr.w ($75B0) cmp.w #264,d0 beq exit_prog bra check_stat update_stat: btst.b #3,$60000E ; This tests bit zero of $60000E bne white_on2 ; If it equals 1, then LED is on cmp.w #0,white ; If we are ALREADY off, don't update beq red_test move.w #0,white WriteStr #70,#10,#4,space ; Clear area for update WriteStr #70,#10,#4,off bra red_test white_on2: cmp.w #1,white beq red_test move.w #1,white WriteStr #70,#10,#4,space ; Clear area for update WriteStr #70,#10,#4,on red_test: btst.b #2,$60000E bne red_on2 ; This might need to be bne, not sure cmp.w #0,red beq exit_upd move.w #0,red WriteStr #70,#20,#4,space WriteStr #70,#20,#4,off bra exit_upd red_on2: cmp.w #1,red beq exit_upd move.w #1,red WriteStr #70,#20,#4,space WriteStr #70,#20,#4,on exit_upd: bra check_stat ; Output section output: jsr flib::clr_scr bsr screen_put move.w #0,red ; Turn flags off move.w #0,white clr.b $60000C bset.b #6,$60000C ; Turn on control mode bclr.b #0,$60000E ; Turn off both LEDs bclr.b #1,$60000E main_output: tst.w ($75B0) beq main_output move.w #0,d0 move.w ($75B2),d0 clr.w ($75B0) cmp.w #114,d0 ; Compare to r key beq red_tog ; Toggle red wire's LED cmp.w #119,d0 ; Compare to w key beq white_tog ; Compare to white tog cmp.w #264,d0 ; Exit? bne main_output bra exit_prog red_tog: WriteStr #70,#10,#4,space cmp.w #0,red ; Determine how to toggle beq red_on bgt red_off red_on: WriteStr #70,#10,#4,on bset.b #1,$60000E ; Turn red line on move.w #1,red bra main_output red_off: WriteStr #70,#10,#4,off bclr #1,$60000E ; Turn red line off move.w #0,red bra main_output white_tog: ; Same shit, different name WriteStr #70,#20,#4,space cmp.w #0,white beq white_on bgt white_off white_on: WriteStr #70,#20,#4,on bset.b #0,$60000E ; Turn white line on move.w #1,white bra main_output white_off: WriteStr #70,#20,#4,off bclr #0,$60000E ; Turn white line off move.w #0,white bra main_output screen_put: WriteStr #10,#10,#4,redt WriteStr #10,#20,#4,whitet WriteStr #70,#10,#4,off WriteStr #70,#20,#4,off WriteStr #10,#90,#4,_comment WriteStr #10,#100,#4,bry1 WriteStr #10,#110,#4,bry2 rts exit_prog: move.b #$8D,($60000C) ; Reset link port for normal ops rts ; Exit the program ; Define strings used redt dc.b "Red :",0 whitet dc.b "White :",0 on dc.b "Low",0 off dc.b "High",0 ; Lines are ACTIVE LOW! space dc.b " ",0 mode dc.b "Select a mode (I or O):",0 bry1 dc.b "By Bryan Rittmeyer",0 bry2 dc.b "Method by Bryan Turner",0 ; Define word values to hold status red dc.w 0 white dc.w 0 _comment: dc.b "I/O Test v1.00",0 end