All pastes #741014 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-10-18 12:11 UTC
rendered paste body
.MODEL SMALL
.STACK 100h
.DATA
    bufDydis    DB    121 
    nuskaite    DB    ?
    buferis     DB    121 dup (?)
    aprasymas   DB    'Programa suskaiciuoja kiek yra skaiciu Jusu ivestoje eiluteje ', 13, 10, '$'
    ivesk       DB    'Iveskite eilute:', 13, 10, '$'
    rezult      DB    'Ivestoje eiluteje rasta skaitmenu: '
    kiek        DB    3 dup (' ')
    ikitaeilute        DB    13, 10, '$'
.CODE
Pradzia:
    
    mov ax, @data
    mov ds, ax
    
    mov ah, 09h
    mov dx, offset aprasymas
    int 21h

prasymas: 
    mov ah, 09h
    mov dx, offset ivesk
    int 21h
 
    mov ah, 0Ah
    mov dx, offset bufDydis
    int 21h
 
    mov ah, 09h
    mov dx, offset ikitaeilute
    int 21h
 
    xor ch, ch
    xor ax, ax
    mov cl, nuskaite
    mov bx, offset buferis
    mov dl, '0'
    mov dh, '9'
 
lyginimas:
    cmp cx, 0
    je prasymas
    cmp dl, [ds:bx]
    jg nelygu
    cmp dh, [ds:bx]
    jl nelygu
    inc ax
 
nelygu:
    inc bx
    dec cx
    cmp cx, 0
    jg lyginimas
 
    mov dl, 10
    div dl

    mov [kiek + 2], ah
    add [kiek + 2], 30h
    xor ah, ah
    div dl
    mov [kiek + 1], ah
    add [kiek + 1], 30h
    mov [kiek], al
    add [kiek], 30h
 
    mov ah, 09h
    mov dx, offset rezult
    int 21h
 
    mov ah, 4Ch
    mov al, 0
    int 21h
 
END    Pradzia