page 64 title 'Simple terminal emulator - SCREEN part' maclib term ; -->> File : SCREEN.ASM ; ========== ; Copyright (c) Werner Cirsovius ; Hohe Weide 44 ; D-2000 Hamburg 20 ; Federal Republic of Germany ; Tel.: 040/4223247 ; Version 1.0, January 1988 ; ===== Externals ===== ; From LIB BASELIB extrn userf,condir,conchd,strbi0,escchr,subhd2 ; From LIB HILIB extrn gotoxy ; From main module TERMINAL extrn header,comstr ; To TERMINAL public scrn1,scrn2,vidini,savwn1,savwn2,cursof,curson ; ===== THE TERMINAL SCREEN INTERFACE ===== ; (NOTE : These routines are absolutely UNNECESSARY ; .. but good for filling the screen) ; Let's hope we'll get some usefull routines yet vidini: ; Initialize the video system ; if not debug lhld bdos+1 ; Get top lxi d,comram+vidlen+vidlln*ybig call subhd2 ; Check enough memory lxi d,novidr jc comstr ; Tell not enough room lxi d,comram lxi h,vidrot lxi b,vidlen ldir ; Move routine into COMMON xchg shld vidsav ; .. and save top for our use pop b ; Get return lxi sp,comram push b ; Return new stack endif;NOT debug ret ; dseg if german novidr db 'Nicht genug Platz f}r Video RAM Kopie',cr,lf,0 else novidr db 'Not enough room saving screen memory',cr,lf,0 endif;german cseg if not debug ; vidrot: ; The screen saver ; ENTRY : Reg pair HL points to buffer in COMMON ; Reg E holds line number to be saved ; Reg D holds mode (0 is get, other put) ; EXIT : None ; mov c,d ; Save mode push h ; .. and pointer mvi h,0 mov l,e dad h ; Get ROLLER access dad h dad h dad h lxi d,roller dad d ; Make pointer mov e,m ; .. and fetch content inx h mov d,m mov a,e ani 0111b ; Mask something mov l,a mov a,e ral mov e,a mov a,d ral mov d,a mov a,e ani 1111$0000b ora l ; Make real address mov e,a pop h mov a,c ; Decide what to do ora a jrnz sk ; NOTE the relative Z80 instruction xchg ; Swap for PUT or GET sk: lxi b,vidlln ldir ; Move to anywhere ret vidlen equ $-vidrot endif;NOT debug ; vidacc: ; Save or restore screen memory ; ENTRY : Reg D holds mode ; EXIT : None ; if not debug mvi e,1 ; Set start line lhld vidsav ; Get buffer in COMMON lxi b,vidlln vidlop: push b push d push h lxi b,comram call userf ; Do thru XBIOS dw scrrun pop h pop d pop b dad b ; Fix buffer inr e mov a,e cpi ybig+1 ; Test max jnz vidlop endif;NOT debug ret ; scrn1: ; Execute the saver routine ; call cursof ; Turn cursor off if not debug call userf ; Get my current cursor dw teask shld cursav endif;NOT debug mvi d,0 call vidacc ; Save all the lines lxi d,savwn1 call strbi0 ; Set window lxi d,savwn2 call strbi0 ; Set smaller window call curson ; Turn cursor on again ret ; scrn2: ; Execute the restorer routine ; call cursof ; Turn cursor off mvi d,1 call vidacc ; Restore previous saved screen call header ; Give state and set window if not debug lhld cursav call gotoxy ; .. restore cursor, too endif;NOT debug ; curson: ; Turn ON the cursor ; if debug ret else mvi a,'e' jmp escchr endif;debug ; cursof: ; Turn OFF the cursor ; if debug ret else mvi a,'f' jmp escchr ; Turn cursor off endif;debug ; dseg vidsav ds 2 cursav ds 2 savwn1 window 1,0,ybig,xbig+2 ; Set full command window if not debug db esc,'H' ; Set cursor to top db esc,'E' ; .. clear screen endif;NOT debug db 0 savwn2 window 2,2,ysmall-1,xsmall if not debug db esc,'H' ; .. set cursor to top endif;NOT debug db 0 ; ===== END OF TERMINAL SCREEN INTERFACE ===== end