; pioml.asm ; 8255 assistance ; L. Stewart, February 7, 1983 7:47 PM ; L. Stewart, March 3, 1983 2:33 PM, GetPIOState $INCLUDE(Lark.d) CCClock EQU 010H CCData EQU 020H CCCBar EQU 0EFH CCDBar EQU 0DFH SynTSN EQU 002H C←CODE SEGMENT C←DATA SEGMENT ; char vpio[6]; ←vpio LABEL BYTE ←vpioa DB 00H ←vpiob DB 00H ←vpioc DB 00H ←vapioa DB 00H ←vapiob DB 00H ←vapioc DB 00H C←DATA ENDS ASSUME CS:C←CODE, DS:C←DATA pioports LABEL WORD DB pioa DB 0 DB piob DB 0 DB pioc DB 0 DB apioa DB 0 DB apiob DB 0 DB apioc DB 0 ; PIOOn(bits, port) ←PIOOn LABEL NEAR MOV DI,OFFSET ←vpio MOV AL,[DI][BX] OR AL,CL JMP piocom ; PIOOff(bits, port) ←PIOOff LABEL NEAR MOV DI,OFFSET ←vpio MOV AL,[DI][BX] XOR CL,0FFH AND AL,CL JMP piocom ; SetPIO(bits, port) ←SetPIO LABEL NEAR MOV DI,OFFSET ←vpio MOV AL,CL JMP piocom piocom: MOV [DI][BX],AL MOV SI,OFFSET pioports SAL BX,1 MOV DX,[SI][BX] OUT DX,AL RET ; int GetPIO(port) ←GetPIO PROC MOV SI,OFFSET pioports SAL BX,1 MOV DX,[SI][BX] XOR AX,AX IN AL,DX MOV BX,AX RET ←GetPIO ENDP ; Set up codec with time slot word passed in BX ; SetCodec(timeslot) ←SetCodec PROC NEAR MOV AL,←vapioa AND AL,CCCBar ; clear clock AND AL,CCDBar ; clear data OUT apioa,AL MOV CX,8 OR AL,CCClock ; set clock MOV DL,AL tsnlow: ; wait for not TSN IN AL,pioc TEST AL,SynTSN JNZ tsnlow tsnhigh: ; wait for TSN IN AL,pioc TEST AL,SynTSN JZ tsnhigh tsloop: MOV AL,DL OR BL,BL JNS tsl0 OR AL,CCData ; possibly set data tsl0: OUT apioa,AL AND AL,CCCBar ; clear clock OUT apioa,AL SAL BX,1 LOOP tsloop AND AL,CCDBar ; clear data OUT apioa,AL MOV ←vapioa,AL RET ←SetCodec ENDP ; returns pointer to core copy of pio state ←GetPIOState PROC NEAR MOV BX,OFFSET ←vpio RET ←GetPIOState ENDP PUBLIC ←vpio ; PUBLIC ←vpioa ; PUBLIC ←vpiob ; PUBLIC ←vpioc ; PUBLIC ←vapioa ; PUBLIC ←vapiob ; PUBLIC ←vapioc PUBLIC ←PIOOn PUBLIC ←PIOOff PUBLIC ←SetPIO PUBLIC ←GetPIO PUBLIC ←SetCodec PUBLIC ←GetPIOState C←CODE ENDS END