DataMuseum.dk

Presents historical artifacts from the history of:

RegneCentralen RC850

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

See our Wiki for more about RegneCentralen RC850

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦9d121b8da⟧ TextFile

    Length: 10624 (0x2980)
    Types: TextFile
    Names: »CONDICPM.MAC«

Derivation

└─⟦9f46c4107⟧ Bits:30005988 Sources for TurboDOS ver. 1.30 device drivers
    └─⟦this⟧ »CONDICPM.MAC« 

TextFile

;	console initialization routines
;	version 31.12.83
;
;	.XLIST
; sio (keyboard) channel b
;
KBDATA	EQU	31H		; data port
KBCOMM	EQU	33H		; command port
SIO3C	EQU	KBCOMM
;
; double keys on keyboard (octal value)
;
SHRE		EQU	263Q		; release shift key
SHPR1		EQU	306Q		; press 1st shift key
SHPR2		EQU	240Q		; press 2nd shift key
CTRLRE		EQU	264Q		; release ctrl key
CTRLPR		EQU	200Q		; press ctrl key
;
; lamp keys - press value
;
ALPLCK		EQU	201Q		; lamp no. 12 - alpha lock key
;
; display constants
;
DMARD		EQU	00011000B	; dma-read-mode, autoinit. enable
DMASET		EQU	00000100B	; dma-set-mask
DMACLR		EQU	00000000B	; dma-clear-mask
DMAMSK		EQU	0FAH		; dma-mask-addr
DMAMDE		EQU	0FBH		; dma-mode-addr
DMAFFA		EQU	0FCH		; dma-ff-addr
DMADDR		EQU	0F0H		; dma-addr-addr
DMACNT		EQU	0F1H		; dma-count-addr
DMASTT		EQU	0F8H		; dma-status-addr
DMAKCK		EQU	20H		; dma-kick-addr
DMARES		EQU	0FDH		; dma-reset-addr
DSPLSE		EQU	24H		; displ-sel
DSPLDA		EQU	25H		; displ-data
DSPLBL		EQU	2Ch		; displ-blocade
CTC		EQU	0CH		; ctc-channel-0
CTC2		EQU	0EH		; ctc-channel-2
DSPLCL		EQU	00000000B	; displ-cl-blcde
DSPLST		EQU	00000100B	; displ-st-blcde
CRFCNT		EQU	4096		; refresh-count
CBLANK		EQU	32		; blank
BLANK		EQU	CBLANK
NOATRB		EQU	0
LINE25		EQU	0FF00H		; start address of line 25
LNPSC		EQU	25		; lines per screen
COPLN		EQU	80		; number of columns per line
SELDSP		EQU	0B5H	;8EH
DESDSP		EQU	0B2H	;8FH
W4		EQU	100		; 4 ms delay
W200		EQU	5000		; 200 ms delay
W300		EQU	7500		; 300 ms delay
DSPRAM		EQU	0F000H		;work area for conout driver
EPICT		EQU	DSPRAM
;
	PAGE
;
	EXT 	INTSP,INTSTK,DLYTIC,RTCSEC,ISRXIT,WAIT,SIGNAL,DELAY
	EXT	CONVTB,LNKPOL,UNLINK,ALLOC
;
;	Initialize CRT,Keyboard,print signon message *****
;
	COMMON	/?INIT?/
;
CRTNIT::XOR	A		; master reset DMA
	OUT	(DMARES),A	;
	LD	A,00010000B	; set command register
	OUT	(DMASTT),A	;
;
	LD	HL,CONVTB+128	;
	LD	A,(HL)		; A = alfa-low value
	LD	(ALFLOW),A	;
	LD	DE,141		;
	ADD	HL,DE		;
	LD	A,(HL)		; A = alfa-high value
	INC	A		;
	LD	(ALFHGH),A	;
CLLNVM:	
	XOR	A		;set coursor presentation, line speed etc.
	LD	A,(CURPRE)	; (no nvm)
	AND	11000000B	; cursor presentation
	RLCA			;
	RLCA			; bit 7,6 to 1,0
	LD	E,A		;
	LD	D,0		;
	LD	HL,CURTAB	;
	ADD	HL,DE		;
	ADD	HL,DE		; actual cursor pres.
	LD	DE,CURPR	; 
	LD	BC,2		; 2 bytes to move
	LDIR			;
	LD	A,(ASYN)	; ext async/sync load mode (no nvm)
	LD	L,A		; (no nvm)
	XOR	A		; A = 0
	BIT	5,L		;
	JR	Z,ASYNC		;
	LD	A,10000000B	; DTR = 1
ASYNC:	LD	(LMDTR),A	; line mode = 0 or 1
	LD	HL,LBYTE2-1	;
	XOR	A		;
	LD	(HL),A		;
	DEC	HL		;
	LD	(HL),A		;
	DEC	HL		;
	LD	(HL),A		;
	CALL	EBLCRT		; begin out(dipl-blocade,displ-st-blcde)
	CALL	INTSIO		; init SIO (keyboard)
;
;	test wether the CRT controler is 50 or 60 herz
;
	DI			;
	LD	HL,0		;clear counter
	LD	A,10H		;reset external status
	OUT	(SIO3C),A	;
	IN	A,(SIO3C)	;get SIO status
	LD	B,A		;
TIMLP1:	LD	A,10H		;trigger loop starts here
	OUT	(SIO3C),A	;
	IN	A,(SIO3C)	;
	CP	B		;still the same value ?
	JR	Z,TIMLP1	;
	LD	B,A		;set new value (trigger)
TIMLP2:	LD	A,10H		;now count out the change time
	OUT	(SIO3C),A	;
	IN	A,(SIO3C)	;
	CP	B		;still the same value ?
	INC	HL		;
	JR	Z,TIMLP2	;
	XOR	A		;clear carry bit
	LD	BC,1200		;set compare value
	SBC	HL,BC		;
	LD	A,0FFH		;
	JR	C,CRTNI0	;on carry, we have a 60 Hz controler
	LD	A,0		;
CRTNI0:	LD	(CRT60),A	;set CRT flag for further access
	CALL	EDSPGO		; init display
	DI			;
	XOR	A		; A = 0
	LD	A,(LBYTE0)	;
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,(LBYTE1)	;
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,(LBYTE2)	;
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	CALL	KBINTV		; init. keyboard interrupt vec.
	EI			;
	RET			;CRT,Keyboard initialized -> back to caller
;
; init display
;
EDSPGO:	LD	HL,PINTP2	;set interupt address during init.
	LD	(DSPVEC##),HL	;
	EI			;
	LD	A,11000101B	;refresh RAMs; start displ. DMA transfer
	OUT	(CTC2),A	;
	LD	A,1		;
	OUT	(CTC2),A	;
	LD	BC,(CURPR)	; cursor presentation
	CALL	ESTMDE		; set cursor
	LD	A,2		;
	OUT	(DMAKCK),A	; kick-dma2; attribute RAM
	LD	BC,ATRRAM	;
	LD	DE,32		;
	LD	A,8		;
	CALL	PSTDMA		; setupdma(pictutre,32,dma-read-mode)
	HALT			;
	LD	BC,SHADOW	;
	LD	DE,128		;
	LD	A,8		;
	CALL	PSTDMA		; setupdma(picture,32,dma-read-mode)
	LD	A,3		;
	OUT	(DMAKCK),A	;
	HALT			;
	DI			;
	LD	HL,PINTP1	;initialize display vector in INTTAB
	LD	(DSPVEC##),HL	;
;
	LD	BC,2048		;clear display memory area
	LD	HL,DSPRAM	;get bottom of display area
	LD	D,BLANK		;set default init. values
	LD	E,0		;
	IN	A,(SELDSP)	;select display memory
CLRLOP:	LD	(HL),D		;
	INC	HL		;
	LD	(HL),E		;
	INC	HL		;
	DEC	BC		;
	LD	A,B		;BC registers equal zero ?
	OR	C		;
	JR	NZ,CLRLOP	;if not, loop
	IN	A,(DESDSP)	;deselect display memory
	EI			;
	CALL	DDELAY		;delay for DAM move
;
	LD	BC,0		;
	LD	(ECRPOS),BC	; cursorpos = logpos =
	LD	(ELGPOS),BC	; curx = cury = 0
	LD	(ECURX),BC	;
	CALL	ESTPOS		;
	CALL	ESTBSE		;
	LD	BC,24		;
	LD	(VMXLIN),BC	; maxlin = 24
	CALL	EUBCRT		; unblock-display
	XOR	A		;
	LD	(ECRATR),A	;
	RET			;
;
; all registers and flags unchanged	; procedure set-up dma
; at return				; addr,count: integer; mode:byte)
; mode = A, addr = BC, count = DE	; begin
;
PSTDMA:
	PUSH	AF		; 
	LD	A,DMASET	;
	OUT	(DMAMSK),A	;   out(dma-mask-addr,dma-set-mask)
	POP	AF		;
	PUSH	AF		;   (* set mode register *)
	OUT	(DMAMDE),A	;   out(dma-mode-addr,mode)
	OUT	(DMAFFA),A	;   out(dma-ff-addr,?)  (* rest ff *)
	LD	A,C		;   (* set addres reg. low,high *)
	OUT	(DMADDR),A	;   out(dma-addr-addr,lowbyte(addr))
	LD	A,B		;
	OUT	(DMADDR),A	;   out(dma-addr-addr,highbyte(addr))
	DEC	DE		;   count = count - 1
	LD	A,E		;   (* set count reg. low,high *)
	OUT	(DMACNT),A	;   out(dma-count-addr,lowbyte(count))
	LD	A,D		;
	OUT	(DMACNT),A	;   out(dma-count-addr,highbyte(count))
	LD	A,DMACLR	;   (* clear mask bit for dma chnl 0 *)
	OUT	(DMAMSK),A	;   out(dma-mask-addr,dma-clear-mask)
	POP	AF		;
	RET			; end
;
DDELAY:	LD	C,150		;
DELAY0:	LD	B,255		;
DELAYI:	DJNZ	DELAYI		; delay = 150 * 255 * 3,25 micro sec.
	DEC	C		;
	JR	NZ,DELAY0	;
	RET			;
;
; *** init sio procedure ***
;
INTSIO:				;
	LD	A,4		;
	OUT	(KBCOMM),A	; select reg. 4
	LD	A,11000111B	;
	OUT	(KBCOMM),A	; asyn. parity, stop bits, clock
	LD	A,3		;
	OUT	(KBCOMM),A	; select reg. 3
	LD	A,11000001B	;
	OUT	(KBCOMM),A	; 8 bits/char., recive enable
	LD	A,5		;
	OUT	(KBCOMM),A	; select reg. 5
	LD	A,(LMDTR)	; A = line mode (DTR = 0 or 1, bit 7)
	OR	01101000B	; set remaining bits
	OUT	(KBCOMM),A	; transmitter enable, 8 bits/char, sync
;
; set double keys
;
	LD	A,0F0H		; dummy value - init. dkeys
	OUT	(KBDATA),A	;
	CALL	WAITTR		; wait transmitter-buffer empty
	LD	A,0F0H		;
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,0D5H		; reset all dkeys value
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	HL,DKEYS	; init, function keys
	LD	B,4		; 1 reset val. + 3 functionkeys
LOOP:	LD	D,(HL)		;
	INC	HL		;
	LD	E,(HL)		;
	INC	HL		;
	CALL	STDKEY		;
	DJNZ	LOOP		; all function keys initilized
	LD	A,0F0H		; dummy value - finish init kexs
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,0F0H		;
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	RET			;
;
; STDKEY procedure
; the procedure assigns a value to a double key
; D = the key (octal) position
; E = the key value (octal) when released
;
STDKEY:	LD	A,11000000B	; byte1; init
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,D		; key pos. value
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	LD	A,E		; release value
	OUT	(KBDATA),A	;
	CALL	WAITTR		;
	RET			;
;
;***   WAITTR   ***
; wait transmitter buffer empy
;
WAITTR:		IN	A,(KBCOMM)	; read R0
		AND	00000100B	; transmitter buffer empty flag
		CP	00000100B	
		JR	NZ,WAITTR	;
		PUSH	BC		;
		LD	C,50		;
OLOOP:		DEC	C		;
		LD	B,255		; executiontime = 50 x 255 x 3.25
WTLOOP:		DJNZ	WTLOOP		;
		LD	A,C		;
		CP	0		;
		JR	NZ,OLOOP	;
		POP	BC		;
		RET			;
;
; set keyboard sio interrupt-vector
;
KBINTV:
	DI
	LD	HL,KBRISR	;SET RECEIVE INTERRUPT VECTOR ADDRESS
	LD	(SIO3V##+04H),HL	;
	LD	(SIO3V##+06H),HL	;
;
	LD	A,1		;SELECT REG. 1
	OUT	(KBCOMM),A	;
	LD	A,1CH		;INTERRUPTS ENABLE 
	OUT	(KBCOMM),A	;
;
; initialize keyboard input buffer
;
	LD	HL,(KYBBSZ)	;get input buffer size
	CALL	ALLOC		;allocate packet for keyboard input buffer
	LD	(KYBBUF),HL	;save input buffer address
	LD	(KYBPTR),HL	;set input pointer
	LD	(KBOPTR),HL	;set output pointer
	EI	
	RET			;done
;
;
;
EBLCRT:		LD	A,DSPLST	; procedure entry blockdisplay
		OUT	(DSPLBL),A	; begin
		RET			;   out(displ-blocade,displ-st-blcde)
					; end
EUBCRT:		LD	A,DSPLCL	; procedure entry unblockdisplay
		OUT	(DSPLBL),A	; begin
		RET			;   out(displ-plocade,displ-cl-plcde)
;
ESTMDE:		PUSH	AF		;
		LD	A,10		;
		OUT	(DSPLSE),A	;   out(displ-sel,10)
		LD	A,B		;
		OUT	(DSPLDA),A	;   out(displ-data,highbyte(mode))
		LD	A,11		;
		OUT	(DSPLSE),A	;   out(displ-sel,11)
		LD	A,C		;
		OUT	(DSPLDA),A	;   out(displ-data,lowbyte(mode))
		POP	AF		;
		RET			; end
;
NVMADR:		DB	0		; save nvmadr
DATA:		DB	0		;
DATAHI:		DB	0		;
TEMPDA:		DB	0		;
LMDTR:	DB	0
;
CURTAB:	DW	0D0DH		; non blink, line   - 0
	DW	4D0DH		; blink    , line   - 1
	DW	000DH		; non blink, block  - 2
	DW	400DH		; blink    , block  - 3
;
CURPR:	DW	0		; cursor representation (blink-block)
;
; *****  shadow initialization  *****
; first shadow = dummy
;
SHADOW:		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;
; ** unterlining **
;
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0
		DB	11111111B, 11111111B  ; underlining
		DB	0,0,0,0
;
; dummy
;
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;
; dummy
;
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
		DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;
; initialization of attribute ram
;
ATRRAM:		DB	0
		DB	00000001B	;
		DB	00000010B	;
		DB	00000011B	;
		DB	00000100B	;
		DB	00000101B	;
		DB	00000110B	;
		DB	00000111B	;
		DB	00001000B	;
		DB	00001001B	;
		DB	00001010B	;
		DB	00001011B	;
		DB	00001100B	;
		DB	00001101B	;
		DB	00001110B	;
		DB	00001111B	;
		DB	0		;
		DB	00000001B	;
		DB	00000010B	;
		DB	00000011B	;
		DB	00000100B	;
		DB	00000101B	;
		DB	00000110B	;
		DB	00000111B	;
		DB	00001000B	;
		DB	00001001B	;
		DB	00001010B	;
		DB	00001011B	;
		DB	00001100B	;
		DB	00001101B	;
		DB	00001110B	;
		DB	00001111B	;
;
;************ end of initialzation routines **************
«eof»