home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG062.ARC
/
FLASH2.ASC
< prev
next >
Wrap
Text File
|
1979-12-31
|
3KB
|
89 lines
; FLASH.BEE v3.12 by Alan Sheehan B.E. 23/2/86
; routine to flash characters in INVERSE or UNDERLINE mode
; in MicroWorld Basic.
; Rewritten to patch into the keyboard scan routine
; Modified to execute at 0900H and block move to top of 32K memory
;
BASIC EQU 8021H ;warm boot BASIC
KEYIN EQU 0A3E9H ;address of keyboard scan
TMEM EQU 0A0H ;BASIC top of memory pointer
IVECT EQU 0C2H ;keyboard scan vector
PCG EQU 0F800H ;start of PCG ram
BYTES EQU 7FFH ;number of bytes to invert
;
; block move routine
;
ORG 900H
LD SP,START-2 ;temporarily move stack
LD HL,BSTART ;point to start of block to move
LD DE,START ;point to destination
LD BC,ACOUNT-START+2 ;number of bytes to move
LDIR ;block move
JP START ;initialise flash routine
BSTART EQU $ ;move program to here with monitor
;
; Start of program proper: move top of memory pointer to
; protect the program from being over-written by BASIC.
;
ORG 07FA0H
START CALL INIT ;set up pointers to key scan patch
LD HL,START ;protect program
LD (TMEM),HL ;move T.O.M. below program
JP BASIC ;jump to BASIC
;
; Enable flash routine
;
INIT LD HL,PATCH ;point to key scan patch
LD (IVECT),HL ;set up patched scan
RET
;
; This is the patch in the keyboard scan routine.
;
PATCH CALL KEYIN ;scan keyboard
PUSH AF ; save accumulator
EXX ;swap for new registers
LD BC,(ACOUNT) ;get loop counter
DEC BC ;count down
LD (ACOUNT),BC ;save loop counter again
XOR A ;clear the accumulator
CP B ;test if counter = zero
JR NZ,SKIP ;skip if not ready to flash
CP C ;test if really ready
CALL Z,FLASH ;flash characters if ready
SKIP EXX ;swap back to old registers
POP AF ;restore accumulator
RET ;done!
;
; Disable the flash routine (so graphics don't flash too!!).
;
DFLASH LD HL,KEYIN ;set up ordinary key scan
LD (IVECT),HL
RET
;
; "Invert" every byte in PCG RAM: change from light to dark or
; dark to light.
;
FLASH LD HL,(DCOUNT) ;get init. loop count
LD (ACOUNT),HL ;restore loop counter
LD HL,PCG ;point to PCG ram
LD BC,BYTES ;use BC as counter
LOOP LD A,(HL) ;get byte of character
CPL ;complement accumulator
LD (HL),A ;store inverted byte back in memory
INC HL ;point to next byte
DEC BC ;count down characters inverted
XOR A ;zero accumulator
CP B ;test if <FF to go
JR NZ,LOOP ;go if more than FF bytes left
CP C ;test if finished
JR NZ,LOOP ;go if not finished
RET
;
; Key scan counter storage
; DCOUNT holds number of times key-scan is called between flashes.
; ACOUNT holds the actual counter used.
;
DCOUNT DW 400H ;delay counter initial value
ACOUNT DW 400H ;actual counter storage
END