; oscilliscope
; ports: 26 output 80 for "mode 0:
;      B 20 to output voltage: 00(0V) - FF(5V)
    
;Peripherals--Oscillosocpe
Connect scope

;initialize 8255 for mode 0.  required
	MOV     AL,80
        OUT     26,AL
                
        MOV	DL,0	;0 is increasing, 1 is decreasing
        
                
BigLoop:		
        MOV     AL,AH	
        OUT     20,AL  	
	CALL KillTime
	
	CMP	DL,0	;if increasing
	JNZ	down
	CMP	AH,ff      ;if < ff
	JZ	todown
	INC	AH            	;ah++
	JMP	Bottom
todown: MOV	DL,1       ;else
	DEC	AH              ;switch to decreasing
	JMP	Bottom		;ah--
down:   CMP	AH,00	;else 
	JZ	toup       ;if > 0
	DEC	AH	         ;ah--
	JMP	Bottom
toup:	MOV	DL,0	   ;else
	INC	AH		;switch to increasing
				;ah++		
Bottom:	JMP	BigLoop
		
	HLT
		
				
PROC KillTime
	PUSH	DX	;save registers will use
	PUSH	BX
	PUSH	AX
		
	MOV	DX,ff
 burncpu:			
	mul	bl		;kill time
	mul	bl
	mul	bl
	dec	DX
	JNZ	burncpu
		
	POP 	AX				
	POP	BX	;restore registers
	POP	DX
	RET         