flat assembler
Message board for the users of flat assembler.

Index > DOS > 2-digit number loop

Author
Thread Post new topic Reply to topic
jharvey



Joined: 31 Aug 2007
Posts: 2
jharvey
Hi

How do you write .asm code to show 2-digit number looping every half a second from 00,01,02,03,04,05,06,07,08,09,10,11,12......,99.

The screen should show a minus sign if there is a keyboard interrupt during the loop.

I need it urgently, would be very thankfullllll if someone could help.
Post 31 Aug 2007, 23:22
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> I need it urgently

Homework ?? Typical for PASCAL forums Sad

> .asm code to show 2-digit number

Use DIV instruction, 16-bit dividend , 8-bit divisor (10) Wink

> every half a second

$046C , see RBIL memory map

http://board.flatassembler.net/download.php?id=3093
Post 01 Sep 2007, 09:45
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
Here's one way to count from 00 to 99:
Code:
org 100h

xor ax,ax

go:
push ax
add  ax,3030h
xchg ah,al
int  29h
xchg ah,al
int  29h
mov  al,0dh
int  29h
mov  al,0ah
int  29h
pop ax
inc  al
aaa
cmp  ax,0909h
jbe  go
ret
    
Post 01 Sep 2007, 10:06
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1
Do this:
$|=1; for ('00' .. '99') { select(undef, undef, undef, 0.5); print("$_ "; }

PS: Sorry BAD joke!
Post 01 Sep 2007, 10:41
View user's profile Send private message Reply with quote
eek



Joined: 21 Oct 2006
Posts: 24
eek
This will do the counting bit for ya.

ZONE S L
org cs:100

mov bp,B800 ;printing
mov es,bp ;bit
mov di,722 ;
;
mov ax,9030
mov bx,11110000b
mov cx,9030

loop
es:mov [di],al
cmp al,39
jz Tens
inc di
inc di
es:mov b[di],","
inc di
inc di
inc ax
jmp loop
;
Tens
inc cx
inc di
inc di
es:mov b[di],","
inc di
inc di
and ax,bx
es:mov [di],cl


loop2
inc di
inc di
es:mov [di],al
cmp al,39
jz Tens
inc di
inc di
es:mov b[di],","
inc di
inc di
inc ax
mov bp,sp
mov dx,[bp]
es:mov b[di],cl
jmp loop2
;


END
[color=#][/color][color=#][/color][color=#][/color][color=#][/color][color=#][/color][color=#][/color]
Post 01 Sep 2007, 13:27
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 693
Location: Adelaide
sinsi
Code:
for x=0 to 9
  for y=0 to 9
    print str$("0"+x & "0"+y);" ";
    if user_pressed_a_key then print_a_minus
    wait(half_a_sec)
  next y
next x

print "this is my homework"
print "answer is from several ASM programming sites"
print "but (C)(R)(Tm) the_drunk_sinsi"
    

loser
Post 01 Sep 2007, 15:11
View user's profile Send private message Reply with quote
jharvey



Joined: 31 Aug 2007
Posts: 2
jharvey
Thank you guys!!!
Post 02 Sep 2007, 02:58
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.