home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / asm / 80x0393 / a20.txt next >
Encoding:
Text File  |  1994-03-15  |  3.7 KB  |  123 lines

  1. (3045)  Sat 12 Mar 94 10:58a
  2. By: James Vahn
  3. To: Terry Carmen
  4. Re: A20
  5. St: Rcvd
  6. ---------------------------------------------------------------------------
  7. @MSGID: 1:346/10.0 2d8210be
  8. Comments appreciated. If appropriate, please include this in the
  9. snippets file.
  10.  
  11. ;--------------------
  12. ; a20.asm  toggles the A20 line in a timed loop.
  13. ; Purpose: To test for the optimum setting of the A20 handler.
  14. ; Example: Himem.Sys allows /M:<1-14> and this might help determine which.
  15. ; This BENCHMARK <ugh> is exactly that- only a benchmark.
  16. ; My 386SX/16, UMBDRVR.SYS, HIMEM.SYS and DOS=HIGH,UMB shows 13.6 seconds.
  17. ; 3 megs o' RAM.
  18. ;
  19. ;               By James Vahn - Email to:
  20. ;                       Fidonet 1:346/10.20
  21. ;                       WWIVnet #213 @5930
  22. ;                       Internet james_vahn@moonflower.spk.wa.us
  23. ;
  24.  
  25. cseg segment
  26. assume cs:cseg, ds:cseg
  27. org 100h                        ; .COM, of course.
  28.  
  29. Begin:
  30.         mov ax,4300h
  31.         int 2Fh                 ; A20 handler installed?
  32.         cmp al,80h
  33.         jne Exit
  34.  
  35.         mov ax,cs
  36.         mov ds,ax
  37.         mov dx,offset Msg       ; Prints the message.
  38.         mov ah,09h
  39.         int 21h
  40.  
  41.         mov ah,0h
  42.         int 1Ah                 ; get low order word of clock counter
  43.         push dx                 ; and save it.
  44.  
  45.         mov ax,4310h
  46.         int 2Fh                 ; Get the address in ES:BX
  47.         mov word ptr [xms],bx
  48.         mov word ptr [xms+2],es
  49.  
  50.         mov tmp, 02h            ; increase this for faster machines.
  51.         mov cx, 0FFFFh          ; make a loop FFFF x 2 times
  52.  
  53.    lo1: mov ah,05h
  54.         call cs:[xms]           ; Enable A20
  55.         mov ah,06h
  56.         call cs:[xms]           ; Disable A20
  57.         loop lo1
  58.         dec tmp
  59.         jnz lo1
  60.  
  61.         mov ah,0h
  62.         int 1Ah                 ; Get current time
  63.         pop bx                  ; Get starting time
  64.         sub dx,bx               ; Find the difference
  65.         mov ax,dx
  66.         mov bx,10000d           ; tenths of a second.
  67.         mul bx                  ; ticks / 18.207
  68.         mov bx,18207d
  69.         div bx                  ; Answer in AX, seconds elapsed.
  70.  
  71. ;------------------------
  72. ; Convert AX to unsigned decimal ASCII output
  73. ; Uses AX, BX, CX, DX
  74. ; Thanks Mitch!
  75.  
  76.         mov cx,5                ; maximum of 5 decimal digits
  77.         mov bx,10d              ; divisor
  78. bin2a1: xor dx,dx               ; zero DX for 16 bit divide
  79.         div bx                  ; leaves quotient in AX
  80.         add dl,'0'              ; convert remainder to ASCII
  81.         push dx                 ; put on stack
  82.         loop bin2a1             ; repeat
  83.         mov cx,5
  84.         mov bl,'0'              ; suppress leading zeros
  85. bin2a2: pop ax                  ; pop most significant digit first
  86.         or bl,al                ; sets bits 0-4 after first non-zero digit
  87.         test bl,0Fh             ; skip leading zeros
  88.         jz bin2a4
  89.         mov dl,al               ; Print results to screen.
  90.         mov ah,2h
  91.         int 21h
  92. bin2a4: loop bin2a2
  93.         mov ax,4C00h
  94.         int 21h
  95.  
  96. Exit:   mov ax,cs
  97.         mov ds,ax
  98.         mov dx,offset Msg2      ; Prints the message.
  99.         mov ah,09h
  100.         int 21h
  101.         mov ax,4C00h
  102.         int 21h
  103.  
  104.   xms   dd ?
  105.   tmp   db ?
  106.  
  107.   msg  db 'Tests the speed of the A20 handler.', 13,10
  108.        db ' For reference, my 386SX/16 shows 136. Smaller is faster.',13,10
  109.        db ' Testing- please wait. Tenths of a second: ',36
  110.  
  111.   msg2 db ' No A20 handler (like himem.sys) detected!',13,10,36
  112.  
  113. cseg ends
  114. end Begin
  115.  
  116.  
  117.  * SLMR 2.1a *
  118.  
  119. --- Maximus 2.01wb
  120.  * Origin: Inland Empire Archive (1:346/10)
  121.  
  122. @PATH: 346/10 105/200 30 209/209 270/101 260/1 362
  123.