Lab 3

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lab 3 as PDF for free.

More details

  • Words: 573
  • Pages: 2
;============================================ ============================== ; ** LAB - 3 ** Set colortext mode ;============================================ ============================== TITLE COLORTEXTMODE .model small .stack 100h .data MAX EQU 12 ACT EQU 10 NAMEPAR LABEL BYTE MAXLEN DB MAX ACTLEN DB ACT CHARINPUT DB MAX dup('$') COLORS DB 01, 02, 03, 04, 05, 06, 08, 09, 10, 11 ROW DB 00 COLUMN DB 00 .code BEGIN PROC FAR mov ax, @data mov ds, ax mov es, ax call DISCLEAR call SETCOLORMODE mov dx, 0000 ; cursor-iig hamgiin deed, zuun zahiin(ehnii) call SETCURSOR ; tsegt bairluulna call INPUT call DISCLEAR mov dh, 12 ; cursor-iig mov dl, 40 ; delgetsiin gold call SETCURSOR ; bairluulna call PRINT ;========================== ; ** Press Keys ** ;========================== start: mov ah, 00 ; neg temdegtiig garaas unshuulah huselt (BIOS-iin 16h tasaldal) int 16h cmp ah, 16h ; 16h-n "U" tovchluuriin scan code je up cmp ah, 20h ; 20h-n "D" tovchluuriin scan code je down cmp ah, 26h ; 26h-n "L" tovchluuriin scan code je left cmp ah, 13h ; 13h-n "R" tovchluuriin scan code je right cmp ah, 01h ; 01h-n "Esc" tovchluuriin scan code je ENDING1 jmp start

up: cmp dh, 00 je start mov ROW, dh mov COLUMN, dl call DISCLEAR mov dh, ROW mov dl, COLUMN dec dh call SETCURSOR call PRINT jmp start down: cmp dh, 24 je start mov ROW, dh mov COLUMN, dl call DISCLEAR mov dh, ROW mov dl, COLUMN inc dh call SETCURSOR call PRINT jmp start start1: cmp dl, 00 je start ENDING1: cmp ah, 01h je ENDING right: cmp dl, 70 je start mov ROW, dh mov COLUMN, dl call DISCLEAR mov dh, ROW mov dl, COLUMN inc dl call SETCURSOR call PRINT jmp start left: cmp dl, 00 je start1 mov ROW, dh mov COLUMN, dl call DISCLEAR mov dh, ROW mov dl, COLUMN dec dl call SETCURSOR call PRINT jmp start

;========================== ; ** EXIT ** ;========================== ENDING: mov ah, 4ch int 21h BEGIN ENDP ;======================================= ; ** 80x25 set colortext mode ** ;======================================= SETCOLORMODE PROC NEAR mov ah, 00 ; gorim togtoono mov al, 03 ; 16 ungutei, 80*25 hemjeetei text gorim int 10h RET SETCOLORMODE ENDP ;======================================= ; ** clear screen ** ;======================================= DISCLEAR PROC NEAR mov ax, 0600h ; delgets hoosolno mov bh, 07 ; Engiin (har) atribut mov cx, 0000h ; delgetsiin hamgiin ehnii tseg mov dx, 184Fh ; delgetsiin hamgiin suulchiin tseg int 10h RET DISCLEAR ENDP ;======================================= ; ** set cursor position ** ;======================================= SETCURSOR PROC NEAR mov ah, 02 ; cursor bairluulah huselt mov bh, 00 ; delgetsiin dugaar int 10h ; BIOS-iin 10h tasaldal (interrupt) RET SETCURSOR ENDP ;======================================= ; ** Gets string from keyboard ** ;======================================= INPUT PROC NEAR mov ah, 0Ah ; orolt huseh lea dx, NAMEPAR int 21h RET INPUT ENDP ;========================================== =========== ; ** print by other colors on display center ** ;========================================== =========== PRINT PROC NEAR lea si, CHARINPUT

mov COLUMN, dl repeat: mov ah, 09 ; delgetsend hevleh huselt mov al, [si] cmp al, 0Dh ; "Enter" tovchluuriin scan code je ENDPRINT inc si mov bh, 00 ; 0-dugaar huudasiig songono mov bl, COLORS ; ungunii atributiig bl-d olgono mov cx, 01 ; 1 udaa int 10h inc dl ; daraagiin temdegtiig hevlehed beldej baganiin dugaariig 1-eer call SETCURSOR ; nemegduulne inc COLORS ; daraagiin ungiig songono jmp repeat ENDPRINT: mov COLORS, 01 mov dl, COLUMN call SETCURSOR RET PRINT ENDP END BEGIN

Дүгнэлт Би энэхүү лабороторын ажилаар

Related Documents

Lab 3
November 2019 21
Lab 3
November 2019 22
Lab 3
April 2020 12
Lab-3-
June 2020 10
Lab 3
November 2019 36
Lab 3
June 2020 6