by zantaz®

on internet june 2013
on gpl v.2
see copying file

 ; TESTPS9.A
 ; test program for mini Z80 board
 ;
 ; we13nov96 we20nov96 XD.
 ; th21nov96 fr22nov96 XD.
 ; mo25nov96 XD.
 ;
 ; now we use a 74164
 ; a serial to parralel converter
 ; 2 bit -> 8 bit on 8 led
 ; used a LS74 for 2 bit out
 ;
 ; A11 on        A12 off
 ; second 2K of 8k EPROM
 ;
 ; rev. 0.42     problem
 ;  XD. '96
 ;
RAMSTR	EQU 8000H ; start of RAM
RAMLEN	EQU 07F8H ; LENofRAM(2K-8)
 ;
WDOG	EQU 87FCH ; watchdog loc.B
DELAYL	EQU 87FDH ; delay loc   .B
MAGICL  EQU 87FEH ; magic locs  .W
 ;
INITSP	EQU 8400H ; initial SP
PORT	EQU 00H   ; y0 used
 ;
	ORG 0000H
 ;
	DI  ; disable interrupt
 ;
	LD SP,INITSP
 ;
	LD A,L
	CP 05AH
 ; now magic locs are verified
 ; this is a reset error
	LD C,0
 ;
ERR:	LD A,C ; load reg A
	CPL    ; toggle reg
	LD C,A ; store reg C
 ;
	OUT (PORT),A ; latch out
 ;
	LD HL,3FFFH ; 16383 times
DELAY:	DEC HL  ; delay loop
	LD A,H
	OR L
	JR NZ,DELAY ; 26 cycles
 ;
	JR ERR ; do forever

 ; a real cold reset
 ; do copy in ram of magic locs
OKCOLD:	LD HL,0A55AH ; magic locs
	LD (MAGICL),HL
 ;

START:	CALL SUPERC
 ;
	CALL SUPERC
 ;
	CALL SUPERC
 ;
 ;           76543210
	LD A,11111110B
 ;
	CALL PARSRD
 ;
	CALL DOEFF3
 ;
	JR START
 ;
 ; mk. II
 ; PARSR2 routine
 ; IN:  reg A data out serial
 ; OUT: none
 ; trash AF
 ;
PARSR2:	PUSH BC
	PUSH DE
 ;
	LD C,A ; save in
 ; eight bit xnfer
	LD B,8
 ; extract 1 bit
SE8:	LD A,C ; restore in
	RLCA   ; rotate left
	LD C,A ; save
 ;
	JR NC,SE2
 ;
	LD D,1
 ;
	JR SE3
 ;
SE2:	LD D,0
 ; trasmit 1 bit
SE3:    LD A,D
	SET 1,A
 ; clock high
	OUT (PORT),A
 ;
	LD A,D
 ; clock low
	OUT (PORT),A
 ;
	LD A,D
	SET 1,A
 ; clock high
	OUT (PORT),A
 ;
	DJNZ SE8
 ;
	POP DE
	POP BC
 ;
	RET
 ;
 ; DELay routine
 ; IN:  none
 ; OUT: none
 ; trash AF
 ;
DEL:    PUSH HL
 ;
	LD HL,3FFFH
 ;
DEL0:	DEC HL
	LD A,H
	OR L
	JR NZ,DEL0
 ;
	POP HL
 ;
	RET
 ;
 ; PAR SeR and Delay routine
 ; IN:  none
 ; OUT: none
 ; do not affect any register
 ;
PARSRD: PUSH AF
 ;
	CALL PARSR2
 ;
	CALL DEL
 ;
	POP AF
 ;
	RET
 ;
 ; a super car emulation
 ; on 8 led
 ; IN:  none
 ; OUT: none
 ; trash AF
 ;
SUPERC: PUSH BC
 ;
	LD B,8
 ;           76543210
	LD A,11111110B
 ;
LX0:	CALL PARSRD
 ;
	RLCA
 ;
	DJNZ LX0
 ;
	LD B,6
 ;           76543210
	LD A,10111111B
 ;
LX1:	CALL PARSRD
 ;
	RRCA
 ;
	DJNZ LX1
 ;
	POP BC
 ;
	RET
 ;
 ; DO EFFect 3 routine
 ; on 8 led
 ; IN:  none
 ; OUT: none
 ; trash AF
 ;
DOEFF3: PUSH BC
	PUSH HL
 ;
 ;	LD B,ENDTBL-TABLE
	LD B,23H
 ;
	LD HL,TABLE
 ;
EFF: 	LD A,(HL)
	INC HL
 ;
	CALL PARSRD
 ;
	DJNZ EFF
 ;
	POP HL
	POP BC
 ;
	RET
 ;
 ;
 ;           76543210
TABLE:	DEFB 11111111B
	DEFB 11111110B
	DEFB 11111100B
	DEFB 11111000B
	DEFB 11110000B
	DEFB 11100000B
	DEFB 11000000B
	DEFB 10000000B
	DEFB 00000000B
	DEFB 00000001B
	DEFB 00000011B
	DEFB 00000111B
	DEFB 00001111B
	DEFB 00011111B
	DEFB 00111111B
	DEFB 01111111B
	DEFB 11111111B
	DEFB 11111111B
	DEFB 01111111B
	DEFB 00111111B
	DEFB 00011111B
	DEFB 00001111B
	DEFB 00000111B
	DEFB 00000011B
	DEFB 00000001B
	DEFB 00000000B
	DEFB 10000000B
	DEFB 11000000B
	DEFB 11100000B
	DEFB 11110000B
	DEFB 11111000B
	DEFB 11111100B
	DEFB 11111110B
	DEFB 11111111B
 ;	DEFB 11111111B
 ;	DEFB 11111111B
 ;	DEFB 11111111B
 ;	DEFB 11111111B
ENDTBL: DEFB 11111111B

 ;