Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosQCurDisk mapper                                   Page     1-1


				;0
				page 80,132
				;
				title CP/DOS DosQCurDisk mapper
				
					    extrn    dosqcurdir:far
					    extrn    dosdevconfig:far
				
 0000				buffer	segment word public 'buffer'
 0000  0000			drive	dw	?	      ; driver number
 0002  0014[			buffr	db	20 dup(?)     ; buffer
	   ??			
			 ]	
				
 0016  0014			bufflng dw	20	      ; buffer length
 0018  0002[			map	dw	2 dup(?)      ; map area
	   ????			
			 ]	
				
 001C  00			dsket	db	?	      ;
 001D				buffer	ends
				
				
				
 0000				dosxxx	segment byte public 'dos'
					assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				
				;
				;**********************************************************************
				;*
				;*   MODULE:   dosqcurdisk
				;*
				;*   FILE NAME: dos037.asm
				;*
				;*   CALLING SEQUENCE:
				;*
				;*	 push@	   dword   drive number return location pointer
				;*	 push@	   dword   drive map area  pointer
				;*	 call	   dosqcurdisk
				;*
				;*   MODULES CALLED:  PC-DOS Int 21h, AH=19h, get current disk
				;*		      Rom Bios Int 11 (called by DosDevConfig)
				;*
				;*********************************************************************
				;
					    public   dosqcurdisk
					    .sall
					    .list
				
				str	    struc
 0000  0000			old_bp	    dw	     ?
 0002  00000000			return	    dd	     ?
 0006  00000000			Drvmap	    dd	     ?	     ; drive map pointer
 000A  00000000			Drvnbr	    dd	     ?	     ; drive number
 000E				str	    ends
				
				
 0000  00			defdrive	db	?	; Save area for default drive -->RW
				
				
				
 0001				dosqcurdisk proc     far
				
					    Enter    Dosqcurdisk	 ; push registers
				
 000D  B4 19				    mov      ah,19h		 ; get current default drive
 000F  CD 21				    int      21h
 0011  2E: A2 0000 R			    mov      defdrive,al	; Save default drive
				
 0015  98				    cbw 			 ; fill ax with drive #
 0016  C5 76 0A				    lds      si,[bp].drvnbr	 ; output address
 0019  40				    inc      ax 		 ; set drive A = 1
 001A  89 04				    mov      word ptr [si],ax	 ; drive number
				
 001C  B8 ---- R			    mov      ax,buffer		 ; prepare data segment
 001F  8E D8				    mov      ds,ax		 ; register for calls
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosQCurDisk mapper                                   Page     1-2


				
					    assume   ds:buffer
				
 0021  8D 3E 001C R			    lea      di,dsket		 ; diskette address
 0025  1E				    push     ds
 0026  57				    push     di
 0027  B8 0002				    mov      ax,2		 ; request diskette count
 002A  50				    push     ax
 002B  2B C0				    sub      ax,ax		 ; reserved parm
 002D  50				    push     ax
				
 002E  9A 0000 ---- E			    call     dosdevconfig	 ; get number of drives
				
 0033  80 3E 001C R 00			    cmp      dsket,0		 ; if none, jump
 0038  74 03				    je	     nodisk
 003A  F9				    stc 			 ; else set flag
 003B  EB 01				    jmp      short dskbits
				
 003D  F8			nodisk:     clc 			 ; clear flag
				
 003E  C7 06 001A R 0000	dskbits:    mov      map+2,0		 ; clear output areas
 0044  C7 06 0018 R 0000		    mov      map,0
 004A  9C				    pushf			 ; save carry status, then
 004B  D1 1E 001A R			    rcr      map+2,1		 ; set flags for devices
 004F  9D				    popf			 ; A and B
 0050  D1 1E 001A R			    rcr      map+2,1
				
 0054  C7 06 0000 R 0002		    mov      drive,2		 ; start at C  -->RW --> Changed 3 to 2
 005A  BF 0002				    mov      di,2		 ; start with low-order
 005D				loopx:
 005D  B4 0E				mov	ah,0eh			; DOS Select Disk -->RW
 005F  8B 16 0000 R			mov	dx,drive		; Drive number in DL -->RW
 0063  CD 21				int	021h			;  -->RW
				
 0065  B4 19				mov	ah,019h 		; DOS Get Current Disk -->RW
 0067  CD 21				int	021h			;  -->RW
 0069  32 E4				xor	ah,ah			; Clear AH -->RW
 006B  3B 06 0000 R			cmp	ax,drive		; Drive now in AX -->RW
				
 006F  74 03				    je	     driveok		 ; drive at this number
 0071  F8				    clc 			 ; else drive no good
 0072  EB 01				    jmp      short rotate
				
 0074  F9			driveok:    stc
				
 0075  D1 9D 0018 R		rotate:     rcr      map[di],1		 ; shift bit in
 0079  FF 06 0000 R			    inc      drive
 007D  83 3E 0000 R 11			    cmp      drive,17		 ; finished first word?
 0082  7C D9				    jl	     loopx		  ; if no, jump
 0084  BF 0000				    mov      di,0		 ; if so, switch to high
 0087  83 3E 0000 R 1A			    cmp      drive,26		 ; order word, and check
 008C  7E CF				    jle      loopx		  ; for last drive.
								;restore current drive
 008E  B4 0E				mov	ah,0eh			; DOS Select Disk -->RW
 0090  2E: 8A 16 0000 R			mov	dl,defdrive		; Drive number in DL -->RW
 0095  CD 21				int	021h			;  -->RW
				
 0097  B1 06				    mov      cl,6		 ; only ten bits used
 0099  D3 2E 0018 R			    shr      map,cl		 ; in high-order word.
 009D  A1 0018 R			    mov      ax,map		 ; Now put in registers
 00A0  8B 1E 001A R			    mov      bx,map+2		 ; for shift into output
 00A4  0E				    push     cs 		 ; area.
 00A5  1F				    pop      ds
 00A6  C5 76 06				    lds      si,[bp].drvmap	 ;
 00A9  89 04				    mov      [si],ax
 00AB  89 5C 02				    mov      [si]+2,bx		 ;
									 ; Set good return code -->RW
 00AE  33 C0				    xor      ax,ax
 00B0				exit:	    mexit			 ; pop registers
 00BC  CA 0008				    ret      size str - 6	 ; return
				
 00BF				dosqcurdisk endp
				
 00BF				dosxxx	    ends
				
					    end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosQCurDisk mapper                                   Symbols-1


Macros:

		N a m e			Lines

ENTER  . . . . . . . . . . . . .  	   3
MEXIT  . . . . . . . . . . . . .  	   3
POPAL  . . . . . . . . . . . . .  	   9
PUSHAL . . . . . . . . . . . . .  	   9

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

STR  . . . . . . . . . . . . . .  	000E	0004
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  DRVMAP . . . . . . . . . . . .  	0006
  DRVNBR . . . . . . . . . . . .  	000A

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

BUFFER . . . . . . . . . . . . .  	001D	WORD	PUBLIC	'BUFFER'
DOSXXX . . . . . . . . . . . . .  	00BF	BYTE	PUBLIC	'DOS'

Symbols:            

                N a m e         	Type	 Value	 Attr

BUFFLNG  . . . . . . . . . . . .  	L WORD	0016	BUFFER
BUFFR  . . . . . . . . . . . . .  	L BYTE	0002	BUFFER	Length = 0014

DEFDRIVE . . . . . . . . . . . .  	L BYTE	0000	DOSXXX
dosdevconfig . . . . . . . . . .  	L FAR 	0000		External
dosqcurdir . . . . . . . . . . .  	L FAR 	0000		External
dosqcurdisk  . . . . . . . . . .  	F PROC	0001	DOSXXX	Global	Length = 00BE
DRIVE  . . . . . . . . . . . . .  	L WORD	0000	BUFFER
DRIVEOK  . . . . . . . . . . . .  	L NEAR	0074	DOSXXX
DSKBITS  . . . . . . . . . . . .  	L NEAR	003E	DOSXXX
DSKET  . . . . . . . . . . . . .  	L BYTE	001C	BUFFER

EXIT . . . . . . . . . . . . . .  	L NEAR	00B0	DOSXXX

LOOPX  . . . . . . . . . . . . .  	L NEAR	005D	DOSXXX

MAP  . . . . . . . . . . . . . .  	L WORD	0018	BUFFER	Length = 0002

NODISK . . . . . . . . . . . . .  	L NEAR	003D	DOSXXX

ROTATE . . . . . . . . . . . . .  	L NEAR	0075	DOSXXX

@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  qcurdsk		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    194 Source  Lines
    218 Total   Lines
     32 Symbols

  47456 + 308829 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
