;        ﾚﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄｿ
;ﾚﾄﾄﾄﾄﾄﾄﾄｴ ASM Source created with BASM v3.0 (c) 1995 Kevin T. Diggins ﾃﾄﾄﾄﾄﾄﾄｿ
;ｳ       ﾀﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾙ      ｳ
;ｳ     File Name: BLANK.ASM                                                   ｳ
;ｳ Creation Date: 01-05-1996                                                  ｳ
;ｳ Creation Time: 23:44:49                                                    ｳ
;ﾀﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾙ

.286p

MaxString Equ 81 

Code Segment Byte Public
Assume CS:Code,DS:Code,ES:Code
           Org 256
_StartProgram:

;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ
;                    Release Unused Memory
;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ

Mov  BX,Offset _EndProgram
Add  BX,256              ;Room for our stack
Mov  SP,BX               ;Set stack pointer
Shr  BX,4                ;Convert to paragraphs
Inc  BX                  ;Round up
Mov  AH,4Ah              ;Shrink mem
Int  21h                 ;Thru DOS
Push DS                  
Pop  AX                  
Mov  DefSeg,AX           ;Set DefSeg to DATA
;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ
Call GetCursor
;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ
;                        ;Translation begins
;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ
;
;Newseg = ALLOC 4000 
;
     Xor  AX,AX
     Mov  $Var0,AX
     Mov  AX,4000
     Call Alloc
     Add  AX,$Var0
     Mov  NEWSEG,AX
;
;Monitor = VIDEOCARD 
;
     Xor  AX,AX
     Call VideoCard
     Mov  MONITOR,AX
;
;MOVEMEM Monitor 0 newseg 0 4000 
;
     Push  4000
     Push  0
     Push  NEWSEG
     Push  0
     Push  MONITOR
     Call MoveMem
;
;x = POS 
;
     Xor  AX,AX
     Call GetCursor
     Mov  AX,$Xcur
     Mov  X,AX
;
;y = CSRLIN -1 
;
     Xor  AX,AX
     Mov  $Var0,AX
     Call GetCursor
     Mov  AX,$Ycur
     Add  AX,$Var0
     Add  AX,-1
     Mov  Y,AX
;
;COLOR 7 0 
;
     Mov  FgColor,7
     Mov  BgColor,0
     Call SetAttribute
;
;CLS 
;
     Call Cls
;
;LOCATE 12 25 0 
;
     Mov  $Ycur,12
     Mov  $Xcur,25
     Mov  AX,0
     Call ShowHideCursor
;
;COLOR 10 0 
;
     Mov  FgColor,10
     Mov  BgColor,0
     Call SetAttribute
;
;PRINT "Press a key to restore the screen" 
;
     Mov  SI,Offset $tring_05
     Call PrintStr
     Call SetCursor
     
     Call DoCrLf
;
;a = GETKEY 
;
     Xor  AX,AX
     Call GetKey
     Mov  A,AX
;
;MOVEMEM Newseg 0 Monitor 0 4000 
;
     Push  4000
     Push  0
     Push  MONITOR
     Push  0
     Push  NEWSEG
     Call MoveMem
;
;LOCATE y x 1 
;
     Mov  AX,Y
     Mov  $Ycur,AX
     Mov  AX,X
     Mov  $Xcur,AX
     Mov  AX,1
     Call ShowHideCursor
;
;PRINT  ;
;
     Call SetCursor
     
ExitToDos:
     
     Mov  AH,4Ch
     Xor  AL,AL
     Int  21h
     
     
     
     
     GetCursor Proc Near
     Mov  AH,3
     Xor  BH,BH
     Int  10h
     Xor  AX,AX
     Mov  AL,DL
     Inc  AL
     Mov  $Xcur,AX
     Mov  AL,DH
     Inc  AL
     Mov  $Ycur,AX
     Ret
     GetCursor Endp
     
     
     
     
     SetCursor Proc Near
     Mov  AX,$Xcur
     Mov  DL,AL
     Dec  DL
     Mov  AX,$Ycur
     Mov  DH,AL
     Dec  DH
     Mov  AH,2
     Int  10h
     Ret
     SetCursor Endp
     
     
     
     
     Len Proc Near
     Push CX
     Push SI
     Push DI
     Mov  DI,SI
     Xor  AL,AL
     Mov  CX,0ffffh
     Cld
     Repnz Scasb
     Not  CX
     Dec  CX
     Mov  AX,CX
     Pop  DI
     Pop  SI
     Pop  CX
     Ret
     Len Endp
     
     
     
     
     SetAttribute Proc Near
     Push CX
     Mov  AX,BgColor
     Mov  BX,FgColor
     Shl  AX,4
     Add  AX,BX
     Xor  Ah,Ah
     Cmp  AX,128
     Jl   SkipXor
     Xor  AX,128
SkipXor:
     Mov  $Attr,AX
     Pop  CX
     Ret
     SetAttribute Endp
     
     
     
     
     VideoCard Proc Near
     Mov  AH,0FH
     Int  10H
     And  AL,0FFH
     Cmp  AL,7
     Je   VC1
     Mov  AX,0B800H
     Jmp  VC2
VC1:
     Mov  AX,0B000H
VC2:
     Ret
     VideoCard Endp
     
     
     
     
     Getkey Proc Near
     Xor  AX,AX
     Int  16h
     Cmp  AL,0
     Je   _XtndKey
     Xor  AH,AH
     Jmp  _RegKey
_XtndKey:
     Mov  AL,AH
     Xor  AH,AH
     Neg  AX
_RegKey:
     Ret
     GetKey Endp
     
     
     
     
     Cls Proc Near
     Push  BP
     Mov   AH,0Fh
     Int   10h
     Cmp   AL,4
     Je    ClsGraphics
     Cmp   AL,0dh
     Je    ClsGraphics
     Cmp   AL,0eh
     Je    ClsGraphics
     Cmp   AL,10h
     Je    ClsGraphics
     Cmp   AL,0fh
     Je    ClsGraphics
     Cmp   AL,11h
     Je    ClsGraphics
     Cmp   AL,12h
     Je    ClsGraphics
     Cmp   AL,13h
     Je    ClsGraphics
     Mov   AH,06
     Xor   AL,AL
     Mov   BX,$Attr
     Mov   BH,BL
     Xor   CX,CX
     Mov   DH,24
     Mov   DL,79
     Int   10h
     Xor   BX,BX
     Xor   DX,DX
     Mov   AH,02
     Int   10h
     Mov   $Xcur,1
     Mov   $Ycur,1
     Jmp   ClsEnd
ClsGraphics:
     Mov   $Xcur,1
     Mov   $Ycur,1
     Mov   BX,BgColor
     Xchg  BH,BL
     Xor   CX,CX
     Mov   DL,79
     Mov   DH,43
     Mov   AX,0600h
     Int   10h
ClsEnd:
     Pop   BP
     Ret
     Cls   Endp
     
     
     
     
     PrintStr Proc Near
     Call Len
     Push AX
     Mov  CX,AX
     Cmp  CX,0
     Jle  PS_3
     Mov  BX,$Attr
     Mov  AX,$Ycur
     Mov  DI,$Xcur
     Push DS
     Push ES
     Dec  AX
     Dec  DI
     Cmp  DI,0
     Jg   PS_1
     Xor  DI,DI
PS_1:
     Mov  DX,80
     Mul  DX
     Add  DI,AX
     Shl  DI,1
     Mov  AX,0B000H
     Mov  ES,AX
     Mov  AH,0FH
     Int  10H
     Cmp  AL,07H
     Je   PS_2
     Mov  AX,0B800H
     Mov  ES,AX
PS_2:
     Cld
     Movsb
     Mov  ES:[DI],BL
     Inc  DI
     Loop PS_2
     Pop  ES
     Pop  DS
PS_3:
     Pop  AX
     Add  $Xcur,AX
     Ret
     PrintStr Endp
     
     
     
     
     DoCrLf Proc Near
     Mov  $Xcur,1
     Inc  $Ycur
     Cmp  $Ycur,26
     Jne  CrLf_1
     Dec  $Ycur
CrLf_1:
     Mov  DX,Offset $CrLf
     Mov  AH,9
     Int  21h
     Mov  BX,$Xcur
     Mov  DL,BL
     Dec  DL
     Mov  BX,$Ycur
     Mov  DH,BL
     Dec  DH
     Xor  BX,BX
     Mov  AH,2
     Int  10h
     Ret
     DoCrLf Endp
     
     
     
     
     ShowHideCursor Proc Near
     Cmp  AX,0
     Je   Sh1
     Mov  CL,13
     Mov  CH,12
     Mov  AH,01
     Int  10h
     Jmp  Sh2
Sh1:
     Xor  CL,CL
     Mov  CH,1
     Mov  AH,1
     Int  10h
Sh2:
     Ret
     ShowHideCursor Endp
     
     
     
     
     Movemem Proc Near
     Push BP
     Mov  BP,SP
     Cld
     Push DS
     Push ES
     Push [BP+04]
     Pop  DS
     Mov  SI,[BP+06]
     Push [BP+08]
     Pop  ES
     Mov  DI,[BP+10]
     Mov  CX,[BP+12]
     Rep  Movs Byte Ptr ES:[DI],Byte Ptr DS:[SI]
     Pop  ES
     Pop  DS
     Pop  BP
     Ret  10
     MoveMem Endp
     
     
     
     
     Alloc Proc Near
     Mov  BX,AX
     Shr  BX,4
     Inc  BX
     Mov  DX,BX
     Shl  DX,4
     Mov  AH,48h
     Int  21h
     Jnc  AllocOk
     Xor  AX,AX
AllocOk:
     Clc
     Ret
     Alloc Endp
     
     

;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ System Initialized Data ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ

$Xcur        DW 1
$Ycur        DW 1
$Attr        DW 7
$CrLf        DB 13,10,'$'
FgColor      DW 7
BgColor      DW 0
Err          DW 0
DefSeg       DW 0
$Var0        DW 0
$Var1        DW 0
$Var2        DW 0
$Var3        DW 0
$Var4        DW 0
$Var5        DW 0
$Var6        DW 0
$Var7        DW 0
$Var8        DW 0
$Var9        DW 0
$Var10       DW 0
$Var11       DW 0
$Var12       DW 0

;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ Users Initialized Data ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ

NEWSEG       DW  0
MONITOR      DW  0
X            DW  0
Y            DW  0
$tring_05    DB "Press a key to restore the screen",0
A            DW  0

;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ System Un-Initialized Data ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ


;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ Users Un-Initialized Data ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ

;ﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄﾄ
_EndProgram Label Byte
 Code Ends

End _StartProgram
