; AGC test (file:div1.asm)
;
; Test values
;
; A=quotient, Q=remainder, 
; LP>0 if quotient is positive, LP<0 if quotient is negative

; Results in A are fractional, where:

; 16, 15,  14,   13,   12,   11,   10,    9,    8,    7,
;           1     1     1     1     1     1     1     1
; SG  US   --- + --- + --- + --- + --- + --- + --- + --- +
;           2     4     8    16    32    64    128   256

;           6,    5,    4,    3,    2,    1
            1     1     1     1     1     1
;          --- + --- + --- + --- + --- + ---
;          512  1024  2048  4096  8192 16384

; Results (15 bits, MSB is sign)
;
; These tests check boundary conditions.
;
;  C(A)     C(K)
; %00000 / %00000 = A:37777 Q:77777 LP:00001   (+0/+0)
; %00000 / %77777 = A:40000 Q:77777 LP:40000   (+0/-0)
; %77777 / %00000 = A:40000 Q:77777 LP:40001   (-0/+0)
; %77777 / %77777 = A:37777 Q:77777 LP:00001   (-0/-0)

; %00000 / %00001 = A:00000 Q:77777 LP:00001   (+0/+1)
; %00000 / %77776 = A:77777 Q:77777 LP:40000   (+0/-1)
; %77777 / %00001 = A:77777 Q:77777 LP:40001   (-0/+1)
; %77777 / %77776 = A:00000 Q:77777 LP:00001   (-0/-1)

; %00000 / %37777 = A:00000 Q:77777 LP:00001   (+0/+16383)
; %00000 / %40000 = A:77777 Q:77777 LP:40000   (+0/-16383)
; %77777 / %37777 = A:77777 Q:77777 LP:40001   (-0/+16383)
; %77777 / %40000 = A:00000 Q:77777 LP:00001   (-0/-16383)

; %37776 / %37777 = A:37776 Q:40001 LP:00001   (+16382/+16383)
; %37776 / %40000 = A:40001 Q:40001 LP:40000   (+16382/-16383)
; %40001 / %37777 = A:40001 Q:40001 LP:40001   (-16382/+16383)
; %40001 / %40000 = A:37776 Q:40001 LP:00001   (-16382/-16383)

; %37777 / %37777 = A:37777 Q:40000 LP:00001   (+16383/+16383)
; %37777 / %40000 = A:40000 Q:40000 LP:40000   (+16383/-16383)
; %40000 / %37777 = A:40000 Q:40000 LP:40001   (-16383/+16383)
; %40000 / %40000 = A:37777 Q:40000 LP:00001   (-16383/-16383)

; Check various ratios:
; example: the total range of 14 bits is 0-37777 octal or 
; 0-16383 decimal, which is 16384 units (inclusive). 
; Therefore:
;	1/3 = x/16384, so 
;	3x = 16384, therefore
;	x = 5461.333...
;	5461 (decimal) is 12525 octal.
; And:
;	1/5 = x/16384, so
;	5x = 16384, therefore
;	x = 3276.8
;	3276 (decimal) is 6314 octal.
; %00001 / %00002 = A:20000 Q:77777 LP:00001   (+1/+2)
; %00001 / %00003 = A:12525 Q:77776 LP:00001   (+1/+3)
; %00001 / %00004 = A:10000 Q:77777 LP:00001   (+1/+4)
; %00001 / %00005 = A:06314 Q:77773 LP:00001   (+1/+5)
; %00001 / %00006 = A:05252 Q:77773 LP:00001   (+1/+6)
; %00001 / %00007 = A:04444 A:77773 LP:00001   (+1/+7)
; %00001 / %00010 = A:04000 Q:77777 LP:00001   (+1/+8)

; %00001 / %00006 = A:05252 Q:77773 LP:00001   (+1/+6)
; %00002 / %00014 = A:05252 Q:77767 LP:00001   (+2/+12)
; %00004 / %00030 = A:05252 Q:77757 LP:00001   (+4/+24)
; %00010 / %00060 = A:05252 Q:77737 LP:00001   (+8/+48)
; %00020 / %00140 = A:05252 Q:77677 LP:00001   (+16/+96)

; %00113 / %00144 = A:30000 Q:77777 LP:00001   (+75/+100)
; %00114 / %00144 = A:30243 Q:77653 LP:00001   (+76/+100)


		ORG	EXTENDER
		DS	%47777	; needed for EXTEND

		ORG	%100

	; ----------------------------------------------
		ORG	GOPROG
		TC	chkDV

	; DV test values
div1		DS	16
div2		DS	96

chkDV		EQU	*

		CAF	div1
		EXTEND
		DV	div2
	
	; ----------------------------------------------

loop1		EQU	*
		TC	loop1

