	.module crap.c
	.dbfile crap.c
	.area text
;  IX -> 0,x
_SCI_isr::
	.dbfile C:\ICCTJP\include/isrdecl.h
	.dbfunc SCI_isr
	.dbline 41
; /************************************************************************************************************************
; *	Program:		crap.c							*
; *	Description:	This program was written to test the pneumatic		                *
; *					valves and cylinders.  It will prompt the user	*
; *					to select the desired function (manual or 		*
; *					automatic positioning) and to select the desired      *
; *					characteristics of the PWM signal for the		*
; *					valves.					*
; *	Programmer:		Scott Nortman					*
; *	Date:			March 16, 2000					*
; ************************************************************************************************************************/
; 
; /**************************** Constants *********************************/
; #define pulse_handler TOC2_isr
; #define valve_sensor analog(1)
; #define in	0
; #define out 1
; #define P 0
; #define I 1
; #define D 2
; #define dt 4096
; /**************************** End of Constants **************************/
; 
; /*************************** Interrupts *********************************/
; 
; /*************************** End of Interrupts **************************/
; #pragma interrupt_handler TOC2_isr, RTI_isr;
; /************************** Includes ************************************/
; #include <tjpbase.h>
; #include <analog.h>
; #include <vectors.h>
; #include <mil.h>
; #include <hc11.h>
; /************************ End of includes *******************************/
; 
; /************************** Global Variables*****************************/
; long duty_cycle;	//duty_cycle in e clocks
; long period;		//period in e clocks
; int desired_position;
; int error[3] = {0};
; int k[3] = {500, 0, 0};
L2:
	rti
;  IX -> 0,x
_SPI_isr::
	.dbfunc SPI_isr
	.dbline 47
; 
; /************************ End of Global Variables ***********************/
; 
; 
; /************************** Function Declarations  **********************/
; 
L3:
	rti
;  IX -> 0,x
_PAIE_isr::
	.dbfunc PAIE_isr
	.dbline 53
; /******************** End of Function Declarations  *********************/
; 
; 
; /**************************** Main **************************************/
; 
; void main(void)
L4:
	rti
;  IX -> 0,x
_PAV_isr::
	.dbfunc PAV_isr
	.dbline 59
; {
; 	/* VT100 clear screen */ 
; 	char clear[]= "\x1b\x5B\x32\x4A\x04"; 
; 	
; 	/* VT100 position cursor at (x,y) = (3,12) command is "\x1b[3;12H"*/
;   	char place_home[]= "\x1b[1;1H";	/*Home*/
L5:
	rti
;  IX -> 0,x
_TOF_isr::
	.dbfunc TOF_isr
	.dbline 65
;   	
;   	char place_text[] = "\x1b[10;1H";/*position for text to be entered*/
; init_analog();
;   	init_serial();
; while(1){  	
;   	duty_cycle = 500 * valve_sensor;
L6:
	rti
;  IX -> 0,x
_TOC3_isr::
	.dbfunc TOC3_isr
	.dbline 89
;   	
;   	printf("%s", clear);
;   	printf("%s", place_home);
;   	
;   	printf("%d\n", duty_cycle);
;   	}
; } 
; 
; void TOC2_isr(void){
; CLEAR_FLAG(TFLG1, 0x40);
; }
; 
; void RTI_isr(void){
; CLEAR_FLAG(TFLG2, 0x40);
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
L7:
	rti
;  IX -> 0,x
_TIC3_isr::
	.dbfunc TIC3_isr
	.dbline 101
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
L8:
	rti
;  IX -> 0,x
_TIC2_isr::
	.dbfunc TIC2_isr
	.dbline 107
; }
; }
; }
; }
; }
; }
L9:
	rti
;  IX -> 0,x
_TIC1_isr::
	.dbfunc TIC1_isr
	.dbline 113
; }
; }
; }
; }
; }
; }
L10:
	rti
;  IX -> 0,x
_IRQ_isr::
	.dbfunc IRQ_isr
	.dbline 125
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
L11:
	rti
;  IX -> 0,x
_XIRQ_isr::
	.dbfunc XIRQ_isr
	.dbline 131
; }
; }
; }
; }
; }
; }
L12:
	rti
;  IX -> 0,x
_SWI_isr::
	.dbfunc SWI_isr
	.dbline 137
; }
; }
; }
; }
; }
; }
L13:
	rti
;  IX -> 0,x
_ILLOP_isr::
	.dbfunc ILLOP_isr
	.dbline 143
; }
; }
; }
; }
; }
; }
L14:
	rti
;  IX -> 0,x
_COP_isr::
	.dbfunc COP_isr
	.dbline 149
; }
; }
; }
; }
; }
; }
L15:
	rti
;  IX -> 0,x
_CLMON_isr::
	.dbfunc CLMON_isr
	.dbline 155
; }
; }
; }
; }
; }
; }
L16:
	rti
	.area data
_drew::
	.blkw 1
	.area idata
	.word _interrupt_vectors
	.area data
_error::
	.blkb 2
	.area idata
	.word 0
	.area data
	.blkb 4
	.area idata
	.byte 0,0,0,0
	.area data
_k::
	.blkb 2
	.area idata
	.word 500
	.area data
	.blkb 2
	.area idata
	.word 0
	.area data
	.blkb 2
	.area idata
	.word 0
	.area text
L18:
	.byte 27,91,50,'J,4,0
L19:
	.byte 27,91,49,59,49,'H,0
L20:
	.byte 27,91,49,48,59,49,'H,0
;  lreg1 -> -4,x
;  lreg2 -> -8,x
;  IX -> 0,x
;  func temp: 2,x - 4,x
;     place_text -> 5,x
;     place_home -> 13,x
;          clear -> 20,x
_main::
	jsr __enterb
	.byte 0x9a
	.dbfile crap.c
	.dbfunc main
	.dbline 56
	ldd 0,x
	addd #20
	ldy #L18
	pshx
	xgdx
	ldd #6
	jsr __asgnblk
	pulx
	.dbline 59
	ldd 0,x
	addd #13
	ldy #L19
	pshx
	xgdx
	ldd #7
	jsr __asgnblk
	pulx
	.dbline 61
	ldd 0,x
	addd #5
	ldy #L20
	pshx
	xgdx
	ldd #8
	jsr __asgnblk
	pulx
	.dbline 62
	jsr _init_analog
	.dbline 63
	jsr _init_serial
	bra L22
L21:
	.dbline 65
	ldd #1
	jsr _analog
	std 2,x
	ldd #500
	ldy 2,x
	jsr __muli
	jsr __d2lreg
	ldy #_duty_cycle
	jsr __lreg2y
	.dbline 67
	ldd 0,x
	addd #20
	pshb
	psha
	ldd #L24
	jsr _printf
	puly
	.dbline 68
	ldd 0,x
	addd #13
	pshb
	psha
	ldd #L24
	jsr _printf
	puly
	.dbline 70
	ldy #_duty_cycle
	jsr __ly2reg
	pshy
	pshy
	tsy
	jsr __lreg2y
	ldd #L25
	jsr _printf
	puly
	puly
	.dbline 71
L22:
	bra L21
L17:
	xgdx
	addd #26
	xgdx
	txs
	pulx
	rts
;  IX -> 0,x
_TOC2_isr::
	.dbfunc TOC2_isr
	.dbline 75
	ldy #0x1023
	bclr 0,y,#0xbf
	.dbline 76
L26:
	rti
;  IX -> 0,x
_RTI_isr::
	.dbfunc RTI_isr
	.dbline 79
	ldy #0x1025
	bclr 0,y,#0xbf
	.dbline 80
L27:
	rti
	.area bss
_desired_position::
	.blkb 2
_period::
	.blkb 4
_duty_cycle::
	.blkb 4
_timertjp::
	.blkb 2
_days::
	.blkb 2
_hours::
	.blkb 2
_minutes::
	.blkb 2
_seconds::
	.blkb 2
_msec::
	.blkb 2
	.area text
L25:
	.byte 37,'d,10,0
L24:
	.byte 37,'s,0
