|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: |
title Count Down
.model small
.stack 100h
CR = 13
LF = 10
EOS = '$'
.data
prompt db "Enter second to count down? ", EOS
tminus db "T minus ", EOS
blastof db "blast off", EOS
newline db CR, LF, EOS
count dw ?
.code
main proc
mov ax, @data ; setup data segment reg
mov ds, ax
mov dx, offset prompt
mov ah, 9h ; display string function
int 21h ; call os
;
;getud
; read a number from the stdin, no error checking
mov dx, 0 ; running sum = sum * 10 + new digit
mov cx, 10 ; base 10
while1: mov ah, 01h ; get a digit
int 21h
cmp al, cr ; if cr, then done
je endw1
sub al, '0' ; turn ascii digit to binary
mov ah, 0 ; wordsize digit
mov bx, ax ; save new digit
mov ax, dx ; sum * 10
mul cx ;
mov dx, bx ; get back new digit
add dx, ax ; now + new digit
jmp while1 ; next digit...
endw1:
;;;number is in dx
mov count, dx
mov dx, offset newline
mov ah, 09h
int 21h
; main loop - output t minus <second> lef
while4: cmp count, 0
jz endw4
mov dx,offset tminus
mov ah, 09h
int 21h
mov bx, count
; number to output is in bx
mov cx, 10 ;
xor si, si ;
while2: mov ax, bx ;
xor dx, dx ;
div cx ;
mov bx, ax ;
add dl, '0' ;
push dx ;
inc si ;
cmp bx, 0 ;
jne while2 ;
while3: pop dx ;
;;output character in dl
mov ah, 02h
int 21h
dec si ;
jne while3 ;
mov dx, offset newline
mov ah, 09h
int 21h
dec count
jmp while4
endw4: mov dx,offset blastof
mov ah, 09h
int 21h
mov al, 0 ; exit code 0
mov ah, 4ch ; return to os
int 21h ; call os
main endp
end main ; execution entry point
|
Advertisement
| Hall of Fame |