Delay goes where 
Author Message
 Delay goes where

IDWI,BIFI
When I increase Delaytime to 50,000 this thing still goes too fast. I tried
adding an Int 1a delay but can't figure out where to
put it.

; zoom.asm    

     .MODEL    SMALL
     .CODE
      ORG       100H

 Num         equ    40                ;Length of the colored bar.
 DelayTime   equ    10000             ;Slows things down...

 Program:

   ;  First, check the current video display mode.  If it's not
   ;  mode 02h or 03h, terminate the program.

     mov    ah,0fh        ;Request Function 0Fh.
     int    10h           ;Bios's Get Current Display Mode.
     cmp    al,3          ;Is the system in mode 03h?
     je     OK            ;If so, start the program.
     cmp    al,2          ;Is it video (text) mode 02h?
     je     OK
     jmp    short   Exit  ;Non-supported video mode.

 ;  Video refresh buffer segment address is b800h.
 ;  Bits 4, 5, and 6 of the attribute byte control the
 ;  background color.  Background colors are as follows:
 ;  1 blue   2 green   3 cyan   4 red   5 magenta   6 brown

 OK:
     mov    ax,0b800h           ;segment address of video mem.
     mov    ds,ax               ;Set up my data segment.
     mov    bx,1                ;this points into video mem.
     mov    cx,2000             ;CX is the loop counter. (80 x 25 = 2000)
     mov    ah,00000111b        ;This is white on black text.

 ClearLoop:                     ;Sets every screen position to attribute
7.
     mov    byte ptr[bx],ah     ;Set the attribute byte.
     add    bx,2                ;Go to the next attribute byte.
     loop   ClearLoop           ;Loop through the 80*25 screen.

 ; Now, the entire screen should be white text/black background.

     mov    dh,23               ;DH will store the color.(23=blue)

 Cycle:
     mov    bx,1                ;Pointer into video memory.
     mov    cx,Num              ;This will be a loop counter.

 ColorLoop:
     mov    byte ptr[bx],dh     ;poke the attribute into video mem.
     add    bx,2                ;Point to next attrib. byte.
     loop   ColorLoop           ;Put the colored bar on screen.

 MoveBar:
     sub    bx,2*Num            ;Go to beginning of the bar.
     mov    byte ptr[bx],7      ;Change back to white on black.
     cmp    bx,4000             ;End of the screen?
     jae    NextColor
     add    bx,(2*Num)+2        ;Go to front of the bar.
     mov    byte ptr[bx],dh     ;Add a character to front of bar.
     mov    ah,01h              ;Request function 01h.
     int    16h                 ;Bios's Read Keyboard Character.
     jnz    Exit                ;If user pressed a key, quit...
     mov    cx,DelayTime

 Delay:    
     loop   Delay               ;Slow things down so bar is visible.
     jmp    short   MoveBar

 NextColor:
     add    dh,16               ;change to the 'next' color.
     cmp    dh,103              ;103 is the 'last' color I want to use.
     jle    Cycle               ;Start anew!
     mov    dh,23               ;Start back at blue!
     jmp    short   Cycle

 Exit:
     xor    ax,ax               ;Request function 00h.
     int    16h                 ;Clear Keyboard Buffer.
     mov    ax,4c00h
     int    21h                 ;Exit to DOS
     END    Program



Mon, 04 Jul 2005 20:25:49 GMT  
 Delay goes where

Quote:

> IDWI,BIFI
> When I increase Delaytime to 50,000 this thing still goes too fast. I tried
> adding an Int 1a delay but can't figure out where to
> put it.

You could do it with int 1Ah, I guess. I think you've got it in the
right place. If you don't mind restricting yourself to AT+, int 15h has
a perfect function for this... Delays cx:dx microseconds (approximately).

; Delay:
;     loop   Delay               ;Slow things down so bar is visible.
      push dx
      mov dx, cx
      xor cx, cx
      mov ah, 86h
      int 15h
      pop dx

Obviously, the "mov cx, Delaytime"/.../"mov dx, cx" is redundant, but I
tried to fit it in with what you had. I don't know what you had in mind
for "units", but this seems like a "reasonable" delay...

Best,
Frank



Mon, 04 Jul 2005 21:11:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. URLs - how to automatically go to after a time delay

2. Delays, verilog ignores my delays?

3. Unit Delay vs. Zero Delay

4. Avoiding inertial delay in delay lines

5. Transport Delay and Inertial Delay

6. delay until vs. delay relative

7. QSCGZ delay problem (was: strange memory-access-delay)

8. Transport Delay Vs Inertial Delay

9. CLP(R): delay or not delay?

10. Windows Installer - a go/no-go (in)decision

11. Going (Gone) Nuts !!!

12. LOGO-L> go turtle go

 

 
Powered by phpBB® Forum Software