DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦ee4de7077⟧ TextFile

    Length: 11392 (0x2c80)
    Types: TextFile
    Names: »FUSRINT.MAC«

Derivation

└─⟦77f87173f⟧ Bits:30005981/disk3.imd Turn Key Data Entry System/Datenerfassungspaket - Vers. 1.90
    └─⟦this⟧ »FUSRINT.MAC« 

TextFile

;*************************************************
;*                                               *
;*	MODULE : FUSRINT.MAC       (RC-700)      *
;*	DATE   : 01.02.82                        *
;*	BY     : ASE GmbH , 6472 Altenstadt      *
;*	VERSION: 1.90                            *
;*                                               *
;*************************************************
;
; THIS MODULE SERVES AS AN INTERFACE TO THE APPLICATION PROGRAM
; (I.E.TKDES). ALL CALLS FOR THE DEP COME IN HERE AND RETURN 
; FROM HERE TO THE CALLING PROGRAM.
; THIS MODULE SUPPORTS THE 'FORMAT' AND 'FORMAT-UPDATE' MODE ONLY !!
;
	PUBLIC	USRABT
	PUBLIC	USRINT
	PUBLIC	ENTCPL
	PUBLIC	FRMCPL
	PUBLIC	ILLFRM
	PUBLIC	DELREC
	PUBLIC	XFMT
	PUBLIC	ENTSND
	PUBLIC	ENTHME
	PUBLIC	ENDFRM
	PUBLIC	ILLFNO
	PUBLIC	FLDBWD
	PUBLIC	FLDADV
	PUBLIC	INIT
	PUBLIC	ENT
;
	ext	FORMAT
	ext	FMTINT
	ext	UPFFLG
	ext	BFNO
	ext	CHKBTE
	ext	MSGTAB
	ext	MLNFLG
	ext	SOFCBA
	ext	SOFFBA
	ext	INCCRS
	ext	CHRRD
	ext	SOZ
	ext	FMDFLG
	ext	VFPCTR
	ext	FBFADD
	ext	DEMODE
	ext	INBUFF
	ext	CBFADD
	ext	FRMCHN
	ext	FRMLNG
	ext	SOFFBA
	ext	FFLFLG
	ext	FRMFLG
	ext	SOFCBA
	ext	CONBTA
	ext	ASXDEC
	ext	DGTCNT
	ext	UBFADD
	ext	EFOFLG
	ext	INITFL
	ext	AUTFLG
	ext	FTMFLG
	ext	EERCTR
	ext	VERCTR
	ext	NKECTR
	ext	NKVCTR
	ext	VCRCTR
	ext	NEFCTR
	ext	ECRCTR
	ext	FILCTR
	ext	BIOSBS
;
;
CCTRAD	equ	0ffcch		;start of asccii cursor counter on crt
STCRT	equ	0f800h		;physical start of crt-area in main mem
CRTN	equ	0dh		;
;
; decode the parameters given by the call
; (this adheres to the microsoft calling mechanism)
;
ENT:
USRINT:	push	bc	;pointer to userbuffer
	push	de	;pointer to user-buffer
	push	hl	;pointer to control-area Z
	ld	hl,0		;
	ld	(FFLFLG),hl	;
	ld	(FRMFLG),hl	;
	ld	(SOFCBA),hl	;
	ld	(SOFFBA),hl	;
	ld	hl,1920		;
	ld	(FRMLNG),hl	;
;
;calculate start of format-buffer address
;
	ld	bc,2		;***** offset only for TKDES *******
	pop	de		;
	ld	(USRSVE),de	;
	ld	hl,(USRSVE)	;
	ld	e,(hl)		;
	inc	hl		;
	ld	d,(hl)		;
	ld	h,d		;
	ld	l,e		;
	add	hl,bc		;calc. start-address of format-buffer
	ld	(FBFADD),hl	;and save it in CCB
;
;
;calculate start address of control-area Z
;
	ld	bc,62		;****** offset only for TKDES ******
	pop	hl		;
	ld	e,(hl)		;
	inc	hl		;
	ld	d,(hl)		;
	ld	(USRSVE),de	;
	ld	hl,(USRSVE)	;
	add	hl,bc		;calc start-address of control-area Z
	ld	(SOZ),hl	;and save it (Start of Z)
;
;
;calculate start address to user-buffer (data-buffer)
;
	ld	bc,0h		;
	pop	hl		;
	ld	e,(hl)		;
	inc	hl		;
	ld	d,(hl)		;
	ld	(USRSVE),de	;
	ld	hl,(USRSVE)	;
	add	hl,bc		;
	ld	(UBFADD),hl	;
;
;
;load physical start address of crt-map in main memory
;
	ld	hl,STCRT	;load crt buffer
	ld	(CBFADD),hl	;to CCB
;
;
;the following will check the clear-z flag and branch off to  
;clear (zero) the control-area Z if it is set.
;
CLRZ:	ld	hl,(SOZ)	;
	ld	bc,6		;
	add	hl,bc		;
	ld	a,(hl)		;
	cp	31h		;flag set?
	jp	z,CLRZ1		;yes
;
;the following will check the form-mod flag .
;
FRMMD:	ld	hl,(SOZ)	;
	ld	bc,7		;
	add	hl,bc		;
	ld	a,(hl)		;
	cp	31h		;
	jp	z,FRMMD1	;
	cp	30h		;
	jp	z,FRMMD2	;clear the flag
;
;the following checks the mode and branches off to the
;respective routine.
;
MDCHK:	ld	hl,(SOZ)	;
	ld	c,(hl)		;
	inc	hl		;
	ld	b,(hl)		;
	ld	hl,3330h	;test for 'format-mode'
	and	a		;
	sbc	hl,bc		;
	jp	z,SETMDE	;
	ld	hl,3430h	;test for 'format-update-mode'
	and	a		;
	sbc	hl,bc		;
	jp	z,SETFUM	;
;
;the following checks for an initialized format before allowing to
;go on , if no initialized format is available an illegal-entry
;error will be processed .
;
	ld	a,(INTCLL)	;
	cp	0ffh		;
	jp	z,MDCHK1	;
	ld	a,(INITFL)	;
	cp	0ffh		;
	jp	nz,ILLDEP	;illegal entry!
;
MDCHK1:	ld	a,00h		;clear the
	ld	(INTCLL),a	;init-call flag.
	ld	hl,3030h	; test for 'entry-mode'
	and	a		;
	sbc	hl,bc		;
	jp	z,SETENT	;
;
;coming here means dealing with an illegal mode error ,
;which involves setting appropriate status in Z and
;returning to the user.
;
	ld	hl,00h		;
	call	MVESTT		;
	jp	ERRCPL		;
;
;upon format complete the format routine will return here
;to set the format complete status and to move the
;format-chaining-key to the control-area Z , before finally returning
;to the application program.
;
;
FRMCPL:	ld	hl,06h		;
	call	MVESTT		;
ERRCPL:	call	MVEFCK		;move format chain key to Z
	call	MVEVPC		;move and xlate the # var.pos.to Z
	call	MVECPC		;move cursor counter to Z
	ret			;return to the application program***
;
;the following sets illegal format status
;
ILLFRM:	ld	a,00h		;
	ld	(INITFL),a	;reset the format-initialized flag
	ld	(INTCLL),a	;and init-call flag
	ld	hl,0ch		;
	call	MVESTT		;
	call	MVEFCK		;
	call	MVEVPC		;
	call	MVECPC		;
	ret			;
;
;status on format-not-initialized
;
ILLDEP:	ld	a,00h		;
	ld	(INTCLL),a	;clear the int call flag
	ld	(INITFL),a	;clear the format-initialized flag
	ld	hl,12h		;
	call	MVESTT		;
	ret			;
;
;the following moves the format chaining key
;
MVEFCK:	ld	hl,(SOZ)	;
	ld	bc,21		;
	add	hl,bc		;
	ld	d,h		;destination address
	ld	e,l		;in de
	ld	hl,FRMCHN	;source in hl
	ld	bc,3h		;# bytes in bc
	ldir			;move it!
	ld	a,20h		;
	ld	(de),a		;space 4th pos. of FCK
	ret			;return to user!!!
;
;the following will set the abort status in Z.
;
USRABT:	ld	a,00h		;
	ld	(INITFL),a	;clear the format initialized-flag
	ld	(INTCLL),a	;and the init-call flag
	ld	hl,18h		;
	call	MVESTT		;
	call	MVEVPC		;move and xlate the var.pos ctr to Z
	call	MVEFCK		;move the format chain key to Z
	call	MVECPC		;move cursor pos.ctr. to Z
	ret			;
;
;status on change format chain key
;
XFMT:	ld	a,0ffh		;
	ld	(EFOFLG),a
	ld	hl,1eh		;
	call	MVESTT		;
	jp	ENDFR1		;
;
;
;status on send-key
;
ENTSND:	ld	a,0ffh		;
	ld	(EFOFLG),a	;
	ld	hl,24h		;
	call	MVESTT		;
	jp	ENDFR1		;
;
;status on home-key (non-formatting modes)
;
ENTHME:	ld	hl,2ah		;
	call	MVESTT		;
	jp	ENDFR1		;
;
;status on end of format , routine also used by the
;3 previous routines to set common status
;
ENDFRM:	ld	hl,30h		;
	call	MVESTT		;
ENDFR1:	ld	hl,01h		;
	ld	(BFNO),hl	;
	call	XFNO		;
	call	MVEVPC		;
	call	MVEFCK		;
	call	MVECPC		;
	ret			;
;
;status on illegal field number
;
ILLFNO:	ld	hl,36h		;
	call	MVESTT		;
	ret			;
;
;status on field backward , also used by field forward status.
;
FLDBWD:	ld	hl,3ch		;
	call	MVESTT		;
FLD1:	call	XFNO		;
	call	MVEVPC		;
	call	MVEFCK		;
	call	MVECPC		;
	ret			;
;
FLDADV:	ld	hl,42h		;
	call	MVESTT		;
	jp	FLD1		;
;
;
;status on end of field
;
ENTCPL:	ld	hl,48h		;
	call	MVESTT		;
	call	XFNO		;xlate and store working field number
	call	MVEVPC		;
	call	MVEFCK		;
	call	MVECPC		;
	ret			;
;
;this sets status on delete record (control-d)
;
DELREC:	ld	hl,4eh		;
	call	MVESTT		;
	ld	hl,1h		;
	ld	(BFNO),hl	;set field number to 1
	call	XFNO		;xlate and store the working field #.
	ld	a,0ffh		;
	ld	(EFOFLG),a	;set end of form flag
	jp	ERRCPL		;
;
;the following sets the  mode on format-mode (03)
;
SETMDE:	ld	a,03h		;
	ld	(DEMODE),a	;
	ld	a,0h		;reset the
	ld	(UPFFLG),a	;format-update flag
	call	CAUTFL		;check the authorized flag
	jp	FORMAT		;
;
;the following sets the  mode on format-update and
;sets the format-update flag
;
SETFUM:	ld	a,04h		;
	ld	(DEMODE),a	;
	ld	a,0ffh		;set the
	ld	(UPFFLG),a	;format-update flag
	jp	FORMAT		;
;
;the following sets mode on entry-mode (00).
;
SETENT:	ld	a,0h		;set entry-mode
	ld	(DEMODE),a	;
SETEN2:	ld	a,3h		;
	ld	(DGTCNT),a	;
	ld	ix,(SOZ)	;
	ld	de,2h		;
	add	ix,de		;
	call	ASXDEC		;xlate field number to binary.
	ld	(BFNO),hl	;
	call	CAUTFL		;check authorized flag
	ld	a,(EFOFLG)	;
	cp	0ffh		;
	jp	z,SETEN1	;
;	jp	ENTRY		;
	jp	ILLFRM		;repl.previous instr.(format version)
SETEN1:	ld	a,0h		;
	ld	(EFOFLG),a	;
	jp	FMTINT		;
;
;the following moves and xlates the number of variable positions
;to Z.
;
MVEVPC:	ld	hl,(VFPCTR)	;
	ld	ix,VPCWRK	;
	call	CONBTA		;
	dec	ix		;
	dec	ix		;
	dec	ix		;
	dec	ix		;
	ld	hl,(SOZ)	;
	and	a		;
	ld	bc,17		;
	add	hl,bc		;
	ex	de,hl		;start of # of var.pos in Z now in de
	ld	(IXSVE),ix	;
	ld	hl,(IXSVE)	;
	ld	bc,04h		;
	ldir			;
	ret			;
;
VPCWRK:	ds	6		;
IXSVE:	ds	2		;
;
;
;the following will move the cursor position counter to Z.
;
MVECPC:	ld	de,(SOZ)	;
	ld	hl,25		;
	and	a		;
	add	hl,de		;
	ex	de,hl		;
	ld	hl,CCTRAD	;load start of cursor counter
	ld	bc,04h		;
	ldir			;
	ret			;
;
USRSVE:	ds	2	;
;
;
;the following will xlate the field number from binary to ascci
;and store it into Z . the IXFNO entrance will also increment
;the field number , the XFNO will not.
;
IXFNO:	ld	hl,(BFNO)	;
	inc	hl		;
	ld	(BFNO),hl	;inc the b-field number
XFNO:	ld	hl,(BFNO)	;
	ld	ix,XBUFF	;
	call	CONBTA		;xlate to asccii
	dec	ix		;
	dec	ix		;
	dec	ix		;set pointer to 3-digit fld-number.
	ld	hl,(SOZ)	;
	ld	bc,14		;
	add	hl,bc		;build offset into Z
	ex	de,hl		;
	ld	(IXSVE),ix	;
	ld	hl,(IXSVE)	;
	ld	bc,03h		;
	ldir			;store number into Z
	ret			;
;
XBUFF:	ds	6		;
;
;INIT is used when a call from the application program is to
;include the initialization of a new format
;
;
INIT:	ld	a,0ffh	;
	ld	(INTCLL),a	;
	ld	(EFOFLG),a	;
	ld	a,0ffh		;
	ld	(FTMFLG),a	;set first time flag
	push	hl		;
	push	de		;
	ld	hl,02h		;
	ld	a,(hl)		;
	ld	d,a		;
	inc	hl		;
	ld	a,(hl)		;
	ld	e,a		;
	ld	(BIOSBS),de	;save start of bios
	pop	de		;
	pop	hl		;
	jp	ENT		;
;
INTCLL:	db	0h		;init call flag
;
;
;the following will check and xlate the authorized flag
;
CAUTFL:	ld	hl,(SOZ)	;
	ld	bc,5h		;
	add	hl,bc		;
	ld	a,(hl)		;
	cp	30h		;clear flag?
	jp	z,CAUTF1	;
	cp	31h		;
	jp	z,CAUTF2	;
	ret			;
;
CAUTF1:	ld	a,0h		;
	ld	(AUTFLG),a	;clear the authorized flag
	ret			;
;
CAUTF2:	ld	a,0ffh		;
	ld	(AUTFLG),a	;set the authorized flag
	ret			;
;
;the following will reset the clear-z flag if it was set and perform
;the clearing of the control-area Z.
;
CLRZ1:	ld	a,30h		;
	ld	(hl),a		;
	inc	hl		;
	ld	(hl),a		;
	ld	bc,7h		;
	add	hl,bc		;
	push	hl		;
	pop	bc		;
	ld	hl,436		;
	call	INBUFF		;
	jp	FRMMD		;
;
;
;the following will set the form-mod flag in the ccb
;
FRMMD1:	ld	a,0ffh		;
	ld	(FMDFLG),a	;
	jp	MDCHK		;
;
FRMMD2:	ld	a,00h		;
	ld	(FMDFLG),a	;
	jp	MDCHK		;
;
;
;the following will set the appropriate ascci status in Z
;
MVESTT:	ld	de,STTAB	;get status table
	add	hl,de		;add given offset to it
	ex	de,hl		;save result in de
	ld	bc,(SOZ)	;get start of Z
	ld	hl,8h		;get offset to status
	add	hl,bc		;
	ex	de,hl		;move it to de
	ld	bc,6h		;set byte count
	ldir			;and move it to Z
	ret			;
;
;
;the following is the status-table 
;(used by the outside world)
;
STTAB:	db	"020800"	;mode-error
	db	"010300"	;format complete
	db	"070800"	;illegal format
	db	"040800"	;format not initialized
	db	"010800"	;legal abort (user cancelled)
	db	"010900"	;form.chain key modified
	db	"010300"	;send key
	db	"011300"	;home key
	db	"010200"	;end of format reached
	db	"030800"	;illegal field number
	db	"011200"	;field backward
	db	"011100"	;field forward
	db	"010100"	;end of field
	db	"010600"	;delete record
	db	"011408"	;display mode complete
;
;
	end
;
«eof»