Data Segment Welcome_Message DB 0AH,' ** Welcome to the PC Screen Demo **', 0DH, 0AH, 0AH DB 'Note: The "Welcome" line above, this one, and the one below were',0DH DB 0AH,' all typed on the screen with a single DOS Interrupt ---> 21H' DB 0AH,0DH,'$' Cont_Message DB '(Type any character to continue)$$$$$$$' ;$ Frustrated Cont_Message_2 DB ' ',0DH,0AH,0AH DB 0DH,0AH,'Screen will be cleared, then each charcter you type' DB 0DH,0AH,'will be placed by DOS at the Cursor location and by this' DB 0DH,0AH,'program starting at bottom-right of screen {in Bold' DB 0DH,0AH,'and moving left with each character entered.....ENJOY!!!' DB 0DH,0AH,' ' DB 0DH,0AH,'Note: Cursor will be moved by a BIOS interrupt to the' DB 0DH,0AH,'===== top left corner of the screen (Home)' DB 0DH,0AH,' ' DB 0DH,0AH,'(Type any key to Cont..... to Exit.....)$' M_AH DB 00H Data Ends Working_Storage Segment Stack DW 100H DUP(?) Working_Storage Ends Code Segment Assume DS:Data, SS:Working_Storage, CS:Code Prog_Start: Mov AX,Data ;Establish Data Segment register DS Mov DS,AX ; ;***************************************************************************** ;DOS Function Interrupt (Software)....types a String on the Screen, Starting ; at the current cursor position...string comes from the locations ; starting at the one pointed to by DX & continues until a '$' is ; encountered.... See Text P80-82 for more DOS Int 21H Functions Mov DX,Offset Welcome_Message Mov AH,9 ; Int 21H ; Lea DX, Cont_Message Mov AH,9 Int 21H Mov AH,1 ;Wait for any Int 21H ; Character to be typed to Continue ;***************************************************************************** ;Clear the Screen...The screen is a DMA Device...Direct Memory Access...in ; Character Mode, the screen has 25 lines of 80 Characters (2000) ; Char...They are located in memory at address 0B800H, and each ; Character takes (2) bytes...one for the character and one for ; the character attributes (Normal,Reverse,Bold,Blink). ; We will clear the screen by placing a ' ' (Space) in each ; Character position and (Normal) in each corresponding attribute ; Character....(we will write 2000 Words to memory) Lea DX, Cont_Message_2 Mov AH,9 Int 21H Mov AH,1 ;Wait for any Int 21H ; Character to be typed to Continue Mov AX,0B800H ;Move Screen Start Mov ES,AX ; address to Extra Segment register ; (Which STO uses in conjunction with DI) CLD ;Set Forward String Move direction Mov DI,0 ;Start at the first position Mov AL,' ' ; AL = Character for Screen (Space) Mov AH,07H ; AH = Character Attribute (07H=Normal) Mov CX,2000D ;Do all 2000D Screen Characters Rep StoSW ;Repeat 2000 times.... ;Now we will ask the BIOS (Basic Input Output System)..another type of ; interrupt processing....to move the Cursor to the top left corner of the ; screen Text: P549 Mov AH,2 ;Set Cursor on Screen Mov DH,0 ;Row Number = 0 (Line #...0-24) Mov DL,0 ;Column Number = 0 (0-80) Mov BH,0 ;Display Page Number Int 10H ;BIOS Interrupt (Not DOS) ;Now place characters into the Screen Memory....thru DOS....so it will be ; placed where ever the cursor is left....then we will take the same character ; and place it in the memory location corresponding to the lower right hand ; corner of the screen...moving left with each one type in by the user... Mov AH,00H ;Make character attribute 00H Mov M_AH, AH ;save it Mov DI,3998D ;Make DI to point to last byte Get_Char: ;ES already points to the Screen Loc... Mov AH,1 ;Wait for Character to be entered Int 21H ; get it (it goes into AL) Mov AH,M_AH Add AH,1 ;add 1 to attribute Mov M_AH,AH ; Mov AH,87H ;Set Char.Attribute = Blink (87H) ;Bit Table values P:565 including color!!!! Mov ES:[DI]+1,AH ;Mov the Attribute Mov ES:[DI],AL ;Mov the Character Dec DI ;Decrement Pointer Dec DI ;again....could have subtracted 2!! Cmp AL,27D ;Check for Character JNZ Get_Char ;DOS Interrupt to return to DOS from this running program Mov AX,4C00H ;setup for return to DOS Int 21H ;...do it! Code Ends End Prog_Start