qt SCO XENIX 386 8086/8087 assembly source

Carmen Hardina bt455s39 at uhccux.uhcc.hawaii.edu
Mon Jul 24 12:41:38 AEST 1989


This is the SCO XENIX 386 System V 8086/8087 assembly language version of
qt, a program that displays the time of day in real english and also chimes.
As far as I know, the C version was originally wrapped by smeg at malibu on
Tuesday, March 28th, 1989 and posted to the net.  This is the latest version.
It has been successfully assembled under SCO XENIX 386 2.3.1, it is unknown
at this time whether it can assemble under other flavors of UNIX.

Please mail any bug reports, successful assembly on other systems, etc. to
me and I will pass them on to Paul Telles, as he does not have access to the
net at this time.  To assemble, just undo this shell archive and then type
make all on the command line.  Like so...

# make all

That's it!  Place qt in your favorite depository for local binaries and your
good to go...  Enjoy!  And hopefully we'll see more assembler source posted!

						--Carmen

--
Carmen Maria Hardina, University of Hawaii at Manoa...
UUCP: {uunet,ucbvax,dcdwest}!ucsd!nosc!uhccux!bt455s39
ARPA: uhccux!bt455s39 at nosc.MIL BITNET: bt455s39 at uhccux
INET: bt455s39 at uhccux.UHCC.HAWAII.EDU <-- It may work.

-Cut Here--Cut Here--Cut Here--Cut Here--Cut Here--Cut Here--Cut Here--Cut Here-
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Makefile qt.s
# Wrapped by bt455s39 at uhccux on Sun Jul 23 15:58:21 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(534 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# THIS FILE CONTAINS CODE WHICH IS SPECIFIC TO THE
X# INTEL ARCHITECTURE AND MAY REQUIRE MODIFICATION
X# WHEN ADAPTING XENIX TO NEW HARDWARE.
X
XAS = masm
XCC = cc
X
X# If you lack a fpu, use these flags instead.
X# AFLAGS = -p -e -s -w1 -X -z
X
XAFLAGS = -p -r -s -w1 -X -z
XCFLAGS = -pack -i -M0s -Ox
X
XOBJECTS = qt.o
X
Xall: qt strip clean
X
X# We use cc only to avoid invoking the linker directly.
Xqt: $(OBJECTS)
X	$(CC) $(CFLAGS) $(OBJECTS) -o qt
X
X$(OBJECTS): qt.s
X	$(AS) $(AFLAGS) qt.s -o $(OBJECTS)
X
Xstrip:
X	strip qt
X
Xclean:
X	-rm -f $(OBJECTS)
END_OF_FILE
if test 534 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'qt.s' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'qt.s'\"
else
echo shar: Extracting \"'qt.s'\" \(7981 characters\)
sed "s/^X//" >'qt.s' <<'END_OF_FILE'
X	TITLE   qt.s
X	.8087
X;
X; MODIFICATION HISTORY
X;
X;	Originally written by Mike Cowlishaw (language unkown), December 1982
X;	Converted to C for UNIX by Mark Dapoz, April 1986
X;
X;	86-Nov-13	Major update by Mike Dapoz, cleaned up C source.
X;
X;	89-Jul-23	Converted to 8086/8087 assembly code for SCO XENIX
X;			386 System V by Paul Anthony Telles.
X;
X_TEXT	SEGMENT  WORD PUBLIC 'CODE'
X_TEXT	ENDS
X_DATA	SEGMENT  WORD PUBLIC 'DATA'
X_DATA	ENDS
XCONST	SEGMENT  WORD PUBLIC 'CONST'
XCONST	ENDS
X_BSS	SEGMENT  WORD PUBLIC 'BSS'
X_BSS	ENDS
XDGROUP	GROUP	CONST, _BSS, _DATA
X	ASSUME  CS: _TEXT, DS: DGROUP, SS: DGROUP
XPUBLIC  _h
XEXTRN	__acrtused:ABS
XEXTRN	_localtime:NEAR
XEXTRN	_time:NEAR
XEXTRN	__chkstk:NEAR
XEXTRN	_printf:NEAR
XEXTRN	_strcpy:NEAR
XEXTRN	_strcat:NEAR
X_DATA      SEGMENT
X$SG154	DB	'one',  00H
X$SG155	DB	'two',  00H
X$SG156	DB	'three',  00H
X$SG157	DB	'four',  00H
X$SG158	DB	'five',  00H
X$SG159	DB	'six',  00H
X$SG160	DB	'seven',  00H
X$SG161	DB	'eight',  00H
X$SG162	DB	'nine',  00H
X$SG163	DB	'ten',  00H
X$SG164	DB	'eleven',  00H
X$SG165	DB	00H
X$SG180	DB	'It''s ',  00H
X$SG190	DB	'just gone ',  00H
X$SG192	DB	'just after ',  00H
X$SG194	DB	'nearly ',  00H
X$SG196	DB	'almost ',  00H
X$SG204	DB	'five past ',  00H
X$SG206	DB	'ten past ',  00H
X$SG208	DB	'a quarter past ',  00H
X$SG210	DB	'twenty past ',  00H
X$SG212	DB	'twenty-five past ',  00H
X$SG214	DB	'half past ',  00H
X$SG216	DB	'twenty-five to ',  00H
X$SG218	DB	'twenty to ',  00H
X$SG220	DB	'a quarter to ',  00H
X$SG222	DB	'ten to ',  00H
X$SG224	DB	'five to ',  00H
X$SG231	DB	' o''clock',  00H
X$SG232	DB	'.',  00H
X$SG236	DB	0aH, '%s',  0aH,  0aH,  00H
X	ORG	$+26
X$SG241	DB	'Noon',  00H
X$SG243	DB	'Midnight',  00H
X$SG252	DB	'Bong',  00H
X$SG254	DB	'Ding-Dong',  00H
X$SG255	DB	'(',  00H
X$SG259	DB	',',  00H
X$SG260	DB	'!)',  00H
X$SG261	DB	0aH, '%s',  00H
X	ORG	$-66
X_h	DW	DGROUP:$SG154
X	DW	DGROUP:$SG155
X	DW	DGROUP:$SG156
X	DW	DGROUP:$SG157
X	DW	DGROUP:$SG158
X	DW	DGROUP:$SG159
X	DW	DGROUP:$SG160
X	DW	DGROUP:$SG161
X	DW	DGROUP:$SG162
X	DW	DGROUP:$SG163
X	DW	DGROUP:$SG164
X	DW	DGROUP:$SG165
X 	DB	2 DUP(0)
X_DATA      ENDS
X_TEXT      SEGMENT
X	ASSUME	CS: _TEXT
X;
X; Begin main code.
X;
X	PUBLIC	_main
X_main	PROC NEAR
X	push	bp
X	mov	bp,sp
X	mov	ax,96
X	call	__chkstk
X;
X;	argc = 4
X;	argv = 6
X;	ot = -84
X;	hr = -90
X;	mn = -92
X;	sc = -88
X;	mod = -2
X;	five_mn = -86
X;	clock = -96
X;	tm = -4
X;
X	mov	ax,OFFSET DGROUP:$SG180
X	push	ax
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcpy
X	add	sp,4
X	lea	ax,WORD PTR [bp-96]	; clock
X	push	ax
X	call	_time
X	add	sp,2
X	lea	ax,WORD PTR [bp-96]	; clock
X	push	ax
X	call	_localtime
X	add	sp,2
X	mov	WORD PTR [bp-4],ax	; tm
X	mov	bx,ax
X	mov	ax,WORD PTR [bx+4]
X	mov	WORD PTR [bp-90],ax	; hr
X	mov	ax,WORD PTR [bx+2]
X	mov	WORD PTR [bp-92],ax	; mn
X	mov	ax,WORD PTR [bx]
X	mov	WORD PTR [bp-88],ax	; sc
X	cmp	ax,29
X	jle	$I181
X	inc	WORD PTR [bp-92]	; mn
X$I181:
X	cmp	WORD PTR [bp-92],32	; mn
X	jle	$I182
X	inc	WORD PTR [bp-90]	; hr
X$I182:
X	mov	ax,WORD PTR [bp-92]	; mn
X	cwd	
X	mov	cx,5
X	idiv	cx
X	mov	ax,dx
X	or	ax,ax
X	je	$SC187
X	cmp	ax,1
X	je	$SC188
X	cmp	ax,2
X	je	$SC191
X	cmp	ax,3
X	je	$SC193
X	cmp	ax,4
X	je	$SC195
X$SC187:
X	mov	ax,WORD PTR [bp-92]	; mn
X	mov	WORD PTR [bp-86],ax	; five_mn
X	cwd	
X	mov	cx,5
X	idiv	cx
X	cmp	dx,3
X	jl	$I197
X	mov	ax,WORD PTR [bp-92]	; mn
X	add	ax,cx
X	mov	WORD PTR [bp-86],ax	; five_mn
X$I197:
X	mov	ax,WORD PTR [bp-86]	; five_mn
X	cwd	
X	mov	cx,5
X	idiv	cx
X	mov	ax,WORD PTR [bp-86]	; five_mn
X	sub	ax,dx
X	cmp	ax,25
X	jne	$JCC159
X	jmp	$SC211
X$JCC159:
X	jle	$JCC164
X	jmp	$L20001
X$JCC164:
X	or	ax,ax
X	je	$SC202
X	cmp	ax,cx
X	je	$SC203
X	cmp	ax,10
X	je	$SC205
X	cmp	ax,15
X	je	$SC207
X	cmp	ax,20
X	je	$SC209
X	jmp	SHORT $SC202
X	nop	
X	nop	
X$SC188:
X	mov	ax,OFFSET DGROUP:$SG190
X$L20004:
X	push	ax
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcat
X	add	sp,4
X	jmp	SHORT $SC187
X$SC191:
X	mov	ax,OFFSET DGROUP:$SG192
X	jmp	SHORT $L20004
X	nop	
X$SC193:
X	mov	ax,OFFSET DGROUP:$SG194
X	jmp	SHORT $L20004
X	nop	
X$SC195:
X	mov	ax,OFFSET DGROUP:$SG196
X	jmp	SHORT $L20004
X	nop	
X$SC203:
X	mov	ax,OFFSET DGROUP:$SG204
X$L20007:
X	push	ax
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcat
X	add	sp,4
X$SC202:
X	mov	ax,WORD PTR [bp-90]	; hr
X	cwd	
X	mov	cx,12
X	idiv	cx
X	or	dx,dx
X	jne	$I225
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	lea	ax,WORD PTR [bp-90]	; hr
X	push	ax
X	call	_midnoon
X	add	sp,4
X$I225:
X	cmp	WORD PTR [bp-90],12	; hr
X	jle	$I227
X	sub	WORD PTR [bp-90],12	; hr
X	jmp	SHORT $I229
X	nop	
X$SC205:
X	mov	ax,OFFSET DGROUP:$SG206
X	jmp	SHORT $L20007
X	nop	
X$SC207:
X	mov	ax,OFFSET DGROUP:$SG208
X	jmp	SHORT $L20007
X	nop	
X$SC209:
X	mov	ax,OFFSET DGROUP:$SG210
X	jmp	SHORT $L20007
X	nop	
X$SC211:
X	mov	ax,OFFSET DGROUP:$SG212
X	jmp	SHORT $L20007
X	nop	
X$SC213:
X	mov	ax,OFFSET DGROUP:$SG214
X	jmp	SHORT $L20007
X	nop	
X$SC215:
X	mov	ax,OFFSET DGROUP:$SG216
X	jmp	SHORT $L20007
X	nop	
X$SC217:
X	mov	ax,OFFSET DGROUP:$SG218
X	jmp	SHORT $L20007
X	nop	
X$SC219:
X	mov	ax,OFFSET DGROUP:$SG220
X	jmp	SHORT $L20007
X	nop	
X$SC221:
X	mov	ax,OFFSET DGROUP:$SG222
X	jmp	SHORT $L20007
X	nop	
X$SC223:
X	mov	ax,OFFSET DGROUP:$SG224
X	jmp	SHORT $L20007
X	nop	
X$L20001:
X	cmp	ax,40
X	je	$SC217
X	jg	$L20002
X	cmp	ax,30
X	je	$SC213
X	cmp	ax,35
X	je	$SC215
X	jmp	SHORT $SC202
X	nop	
X$L20002:
X	cmp	ax,45
X	je	$SC219
X	cmp	ax,50
X	je	$SC221
X	cmp	ax,55
X	je	$SC223
X	jmp	$SC202
X$I227:
X	cmp	WORD PTR [bp-90],0	; hr
X	jne	$I229
X	mov	WORD PTR [bp-90],12	; hr
X$I229:
X	mov	bx,WORD PTR [bp-90]	; hr
X	shl	bx,1
X	push	WORD PTR _h[bx-2]
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcat
X	add	sp,4
X	mov	ax,WORD PTR [bp-92]	; mn
X	cwd	
X	mov	cx,60
X	idiv	cx
X	or	dx,dx
X	jne	$I230
X	cmp	WORD PTR [bp-90],12	; hr
X	je	$I230
X	mov	ax,OFFSET DGROUP:$SG231
X	push	ax
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcat
X	add	sp,4
X$I230:
X	mov	ax,OFFSET DGROUP:$SG232
X	push	ax
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	call	_strcat
X	add	sp,4
X	mov	ax,WORD PTR [bp-92]	; mn
X	cwd	
X	mov	cx,15
X	idiv	cx
X	or	dx,dx
X	jne	$I233
X	lea	ax,WORD PTR [bp-92]	; mn
X	push	ax
X	lea	ax,WORD PTR [bp-90]	; hr
X	push	ax
X	call	_chime
X	add	sp,4
X$I233:
X	lea	ax,WORD PTR [bp-84]	; ot
X	push	ax
X	mov	ax,OFFSET DGROUP:$SG236
X	push	ax
X	call	_printf
X	mov	sp,bp
X	pop	bp
X	ret	
X	nop	
X_main	ENDP
X;
X; Begin midnoon function.
X;
X	PUBLIC	_midnoon
X_midnoon	PROC NEAR
X	push	bp
X	mov	bp,sp
X	xor	ax,ax
X	call	__chkstk
X;
X;	hr = 4
X;	ot = 6
X;
X	mov	bx,WORD PTR [bp+4]	; hr
X	cmp	WORD PTR [bx],12
X	jne	$I240
X	mov	ax,OFFSET DGROUP:$SG241
X	jmp	SHORT $L20017
X	nop	
X$I240:
X	mov	ax,OFFSET DGROUP:$SG243
X$L20017:
X	push	ax
X	push	WORD PTR [bp+6]		; ot
X	call	_strcat
X	add	sp,4
X	mov	bx,WORD PTR [bp+4]	; hr
X	mov	WORD PTR [bx],12
X	pop	bp
X	ret	
X_midnoon	ENDP
X;
X; Begin chime funtion.
X;
X	PUBLIC	_chime
X_chime	PROC NEAR
X	push	bp
X	mov	bp,sp
X	mov	ax,102
X	call	__chkstk
X	push	si
X;
X;	hr = 4
X;	mn = 6
X;	num = -82
X;	i = -84
X;	bell = -100
X;	ring = -80
X;
X	mov	bx,WORD PTR [bp+6]	; mn
X	mov	ax,WORD PTR [bx]
X	cwd	
X	mov	cx,60
X	idiv	cx
X	or	dx,dx
X	jne	$I251
X	mov	ax,OFFSET DGROUP:$SG252
X	push	ax
X	lea	ax,WORD PTR [bp-100]	; bell
X	push	ax
X	call	_strcpy
X	add	sp,4
X	mov	bx,WORD PTR [bp+4]	; hr
X	mov	ax,WORD PTR [bx]
X	mov	WORD PTR [bp-82],ax	; num
X	jmp	SHORT $I253
X	nop	
X$I251:
X	mov	ax,OFFSET DGROUP:$SG254
X	push	ax
X	lea	ax,WORD PTR [bp-100]	; bell
X	push	ax
X	call	_strcpy
X	add	sp,4
X	mov	bx,WORD PTR [bp+6]	; mn
X	mov	ax,WORD PTR [bx]
X	cwd	
X	mov	cx,15
X	idiv	cx
X	mov	WORD PTR [bp-82],dx	; num
X$I253:
X	mov	ax,OFFSET DGROUP:$SG255
X	push	ax
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	call	_strcpy
X	add	sp,4
X	lea	ax,WORD PTR [bp-100]	; bell
X	push	ax
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	call	_strcat
X	add	sp,4
X	mov	WORD PTR [bp-84],0	; i
X	cmp	WORD PTR [bp-82],1	; num
X	jle	$FB258
X	mov	si,WORD PTR [bp-82]	; num
X	dec	si
X	add	WORD PTR [bp-84],si	; i
X$L20003:
X	mov	ax,OFFSET DGROUP:$SG259
X	push	ax
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	call	_strcat
X	add	sp,4
X	lea	ax,WORD PTR [bp-100]	; bell
X	push	ax
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	call	_strcat
X	add	sp,4
X	dec	si
X	jne	$L20003
X$FB258:
X	mov	ax,OFFSET DGROUP:$SG260
X	push	ax
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	call	_strcat
X	add	sp,4
X	lea	ax,WORD PTR [bp-80]	; ring
X	push	ax
X	mov	ax,OFFSET DGROUP:$SG261
X	push	ax
X	call	_printf
X	add	sp,4
X	pop	si
X	mov	sp,bp
X	pop	bp
X	ret	
X_chime	ENDP
X_TEXT	ENDS
XEND
END_OF_FILE
if test 7981 -ne `wc -c <'qt.s'`; then
    echo shar: \"'qt.s'\" unpacked with wrong size!
fi
# end of 'qt.s'
fi
echo shar: End of shell archive.
exit 0
-- 
Carmen Maria Hardina, University of Hawaii at Manoa...
UUCP: {uunet,ucbvax,dcdwest}!ucsd!nosc!uhccux!bt455s39
ARPA: uhccux!bt455s39 at nosc.MIL BITNET: bt455s39 at uhccux
INET: bt455s39 at uhccux.UHCC.HAWAII.EDU <-- It may work.



More information about the Alt.sources mailing list