flat assembler
Message board for the users of flat assembler.
Index
> DOS > How do I Screen delay and Cls Goto page Previous 1, 2 |
Author |
|
baldr 07 Mar 2010, 20:02
MeshNix,
It's simple: when you stop asking yourself such questions. |
|||
07 Mar 2010, 20:02 |
|
edfed 07 Mar 2010, 20:49
and i can say more:
when you can answer to advanced questions. one thing is sure, you SHOULD code A LOT to become an advanced programmer |
|||
07 Mar 2010, 20:49 |
|
adroit 09 Mar 2010, 21:09
Thanks guys, I think i've got a grip of the concept
|
|||
09 Mar 2010, 21:09 |
|
edfed 12 Mar 2010, 17:05
cool, welcome to code addicts.
|
|||
12 Mar 2010, 17:05 |
|
adroit 17 Mar 2010, 20:47
Thanks Guys
|
|||
17 Mar 2010, 20:47 |
|
adroit 04 Nov 2010, 03:32
OLD POST
Ok guys, I'm back again with the same question, but this time, a little less vague. I would like to know how to do a screen delay? Meaning, the program waiting for a given time before continuing onto the next instruction. For example: algorithm: 1. print "Please wait for 5 seconds..." 2. call delay(5000) ; do delay for 5000 microseconds 3. print "Thank you. The 5 seconds have passed." I want to know how to do something like that. (Thank in advance) |
|||
04 Nov 2010, 03:32 |
|
baldr 04 Nov 2010, 09:17
MeshNix,
For a simple solution you may wait for 5*18.2 timer ticks to pass using 0:46Ch in BIOS data area. RTC can be used too (ports 70h/71h). There is int 15h/86h BIOS service. |
|||
04 Nov 2010, 09:17 |
|
Picnic 05 Nov 2010, 08:12
Quick & dirty solution with this old gem.
Notice that both this and baldr's suggestion won't work on XP. Code: mov cx, 18 ; 1-second delay hlt loop $-1 |
|||
05 Nov 2010, 08:12 |
|
baldr 05 Nov 2010, 08:46
Picnic,
You should mask all IRQs except IRQ0 for this to work as expected. "Work on XP" — did you mean "in NTVDM"? It works there. |
|||
05 Nov 2010, 08:46 |
|
Picnic 05 Nov 2010, 08:59
I think that Windows XP does not support this interrupt 15h/86h.
|
|||
05 Nov 2010, 08:59 |
|
adroit 08 Nov 2010, 00:32
Unfortunately, I use XP.
I cannot recall properly, but I saw someone using a code similar to this, to delay the computer: Code: mov ax,0 mov cx,65365 .loop: mov [es:di],ax loop .loop [Don't quote me on this] |
|||
08 Nov 2010, 00:32 |
|
revolution 08 Nov 2010, 01:50
MeshNix wrote: [Don't quote me on this] |
|||
08 Nov 2010, 01:50 |
|
bitRAKE 08 Nov 2010, 04:10
http://ip-tietgennet.tietgen.dk/staff/mlha/PC/Prog/asm/int/21/index.htm#2C
DOS Services INT 21, AH=2C Should work from dosbox on WinXP. Get time, add delay, and wait for projected time. |
|||
08 Nov 2010, 04:10 |
|
rugxulo 08 Nov 2010, 15:07
Sorry guys, been preoccupied these past few days, kept forgetting to post this, hope it helps:
Code: ; wait_for_me wait_for_me: push cx ; CX = seconds to wait (max. 59) call scroll ; only scroll if at screen bottom mov si,offset pauze_msg call getlen ; mov bp,si ; add bp,ax ; dec bp ; dec bp xchg ax,bx lea bp,[si+bx-2] ; saves two bytes test word ptr [suboptions],(SUBOPT_H or SUBOPT_Y) jnz wait_for_me_no_msg cmp byte ptr [scroll_status],1 ; if scrolled, don't print CR+LF jz wait_for_me_no_crlf call print_crlf2 ; (non-redirectable) wait_for_me_no_crlf: call print2 ; (non-redirectable) wait_for_me_no_msg: pop cx cmp cl,60 ; jnb wait_for_me_goto_end ; (won't fit w/ some asms) jb wait_for_me_here jmp wait_for_me_ret ; cheesy workaround wait_for_me_here: xor ch,ch mov bx,cx mov ah,2Ch int 21h ; get current DOS time add bl,dh ; DH = seconds cmp bl,60 jb wait_for_me_check sub bl,60 wait_for_me_check: int 21h push ax push bx cmp bl,dh jae wait_for_me_okay add bl,60 wait_for_me_okay: sub bl,dh mov al,bl ; xor ah,ah ; = ; mov cl,10 ; = ; div cl ; = 6 bytes aam ; = xchg ah,al ; = 4 bytes or ax,'00' ; convert to ASCII mov di,bp mov si,di scasw ; prevents cursor flickering jz wait_for_me_no_print mov di,si stosw ; push ax ; this helps prove that it doesn't ; mov al,BEEP ; display more often than needed ; int 29h ; (i.e. only when secs. changed) ; pop ax test word ptr [suboptions],(SUBOPT_H or SUBOPT_Y) jnz wait_for_me_no_print mov al,BACKSPACE mov bx,offset print_char2 call bx call bx ; backup the cursor twice lodsb call bx ; overwrite countdown digits lodsb call bx wait_for_me_no_print: pop bx mov ah,0Bh int 21h ; check for keypress test al,al ; (and eat extended byte, if exists) pop ax jz wait_for_me_compare mov ah,8 int 21h ; get keypress w/o echo cmp al,ESCAPE_KEY ; on Esc, disable pauzing (/P) jnz wait_for_me_test or word ptr [options],OPT_P and word ptr [suboptions],not SUBOPT_H wait_for_me_test: cmp al,'p' ; 'p' or 'P' pauzes the countdown jz wait_for_me_really_wait cmp al,'P' jnz wait_for_me_test2 wait_for_me_really_wait: push ax ; mov ah,8 wait_for_me_test_again: int 21h ; get keypress w/o echo test al,al jz wait_for_me_test_again pop ax wait_for_me_test2: test al,al ; if zero, extended keypress jnz wait_for_me_ret int 21h ; so, eat next (extended) byte wait_for_me_goto_end: jmp short wait_for_me_ret wait_for_me_compare: cmp bl,dh jnz wait_for_me_check ; used to be too big for short jump ; jz wait_for_me_ret ; jmp wait_for_me_check wait_for_me_ret: ret |
|||
08 Nov 2010, 15:07 |
|
adroit 10 Nov 2010, 01:41
lol [b]revolution
bitRake, I'll see what I can do rugxolu, i've got to analyze this code ...ill be back |
|||
10 Nov 2010, 01:41 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.