.ORG 100h ; CP/M programs start address JP START ; Go to program start ; ; Variable storage space ; Stack1 .DW 0 ; Place to save old stack Sbot .DS 64 ; Temp stack for us to use ; ; Constants ; STOP .EQU $-1 ; Top of our stack BDOS .EQU 5 ; Address of BDOS entry LEDS .EQU 00H ; Digital I/O board ; ; Start of code segment ; START: LD HL, 0000H ; HL = 0 ADD HL, SP ; HL = SP LD (Stack1), HL ; Save original stack LD HL, STOP ; HL = address of new stack LD SP, HL ; Stack pointer = our stack LD B, 0FH REPEAT: LD A, 01010101B OUT (LEDS), A ; Send the pattern to the port CALL DELAY ; A little delay CALL DELAY LD A, 10101010B OUT (LEDS), A ; Send the pattern to the port CALL DELAY ; A little delay CALL DELAY DJNZ REPEAT ; ------------------------------------------------------------ ; Finish and return to CP/M EXIT: LD HL, (Stack1) ; HL = entry stack address LD SP, HL ; SP = value on entry RET ; Return control back to CP/M ;-------------------------------------------------------------------------------------- ; DELAY: ; Routine to add a delay ; PUSH BC LD C, 0FFH DELAY1: LD B, 0FFH DELAY2: NOP DJNZ DELAY2 DEC C JR NZ, DELAY1 POP BC RET ;-------------------------------------------------------------------------------------- .END