Front page.
                                Disk Operating System and Bios Functions

The following page section contains some DOS functions for the 80x86 processor assembly  Computer Programming Lanquage.
These disk operating system or DOS functions can be used to get keyboard input, produce screen output (draw pixels), and to make and get files for assembly language computer programs. The characters to the left of symbol ";" may show how the assembly instructions may look like. The  characters to the right of the symbol ";" helps explain the function operation. Bios means basic input-output system in computers. Bios is a small uneraseble program in computer memory needed to begin computer operations, and controls the data flow between the operating system software, application programs and the computer hardware (circuits).
Some information are from the book: ISBN 0-89588-578-6. DOS is disk operating system.

Int 10h Graphics Functions
Interrupt 12h Memory Size Service
Interrupt 13h Diskette or Hard Disk Services 
Interrupt 14h Serial Ports
Inteerupt 15h: accessing expanded memory, reading the joystick/game adapter card
Interrupt 16h: Keyboard Services
Interrupt 17H: Printer Services
Interrupt 1Ah: Time of Day services, Real Time Clock
Interrupt 21h: MS-Dos
Interrupt 2fh: Dos protected mode interface.
Interrupt 31h Direct memory Access.
Interrupt 33h: Mouse Functions

Int 05h: Print Content of Screen On Printer.

Int 09h  Read Scan Code From Input Port

Int 10h Bios Graphics Functions
 This program section contains function numbers for video graphics or video services of int 10h or DOS interrupt 10h. Some codes should be used in a loop to keep graphics on the screen. The letter h after the function numbers indicates that it is
a hexadecimal number. Video memory stars at 0a000h. Parameters in ax, bx, cx,  es:bp.

Assembly codes:                    Explanations:
                                   Set video mode or image resolution, shows video screen.
   mov  ah,00h              ;Entry in register ah is function 00h.
   mov  al,0Eh               ;Entry al; 640 by 200 16-color graphics (EGA), al can have 00h to 0fh or 10h to 13h.
                                    ;The al is 13h for 320 by 200 pixel with 256-color graphics (VGA).
                                    ;Byte 00h to 03h for command prompt size for function 0Ah text mode; 04h ,05h for full screen.
                           ; The 09h, 0ah for no change.
                                    ; Byte 0bh for large screen with cursor.
   int 10h                      ;Start function, no return value, calls video bios interrupt.

                                   Set cursor type.
   mov ah,01h               ;Entry 01h, set cursor shape into register cx.
   mov ch, 1                  ;Entry in register ch is bits 0=4, starting line for cursor.
   mov cl,1                    ;Entry in register cl: bits 0-4, stopping line for cursor.
   int 10h                       ;Start function 01h, no return value.

                                   Set cursor position on screen on graphics screen.
   mov ah,02h                ;Entry function 02h set cursor position into ah, move cursor.
   mov bh,0                   ;Entry into register bh: video page number ; bh is 0 for graphics.
   mov dh,1                   ;Entry y in register dh: cursor row y=0 to 24.
   mov dl,1                    ;Entry x into register dl: cursor column x=0 to 39, or x=0 to 80.
   int 10h                       ;Start function 02h, no return value.

                                     ;Read cursor position of screen .
   mov  ah,03h               ;Entry in ah: function 03h for reading cursor position.
   mov bh,1                    ;Entry in bh: page number.
   int 10h                        ;Start 03h; returns are cursor row in dh and cursor column in dl.

                                     Read light Pen Position
   mov ah,04h                 ;Entry in ah: function 04h for reading light pen position.
   int 10h                         ;Start 04h, returns in:
                                      ; ah is 0 means light pen switch no down or not triggered, 1 means valid pen value in  
                                      ;registers,  ch receives pixel column 0 to 319 or 639, ch receives raster line 0-199,
                                      ;dh contains row of character light pen position 0-24, dl has column of character
                                      ;light pen position 0-39 or 0-79.

                                     Select Active Display Page
   mov  ah, 05h
   mov   al,1                     ;New display page. The ranges are: 0-7 for video modes 00h and 01h,
                                       ;al is 0-3 for video modes 02h and 03h.
   int   10h                        ;Start 05h, no return value.

                                       Scroll Active Page Upward
  mov  ah,06h
  mov  al,1                                   ;Entry in al: number of lines to scroll., blank lines are in set at the bottom,
                                                   ;0 means to blank the entire window.
  mov bh,1                                   ;Entry in bh: video display attribute to be used on blank lines.
  mov ch,1                                   ;Entry in ch: row of upper-left corner of window to scroll.
  mov cl,1                                    ;Entry in cl: column of upper-left corner of window to scroll.
  mov dh,2                                   ;entry in dh: row of lower-right corner of window to scroll.
  mov dl,2                                    ;Entry in dl: column of lower right corner of window to scroll.
  int 10h                                       ;Start 06h, no return value.

                                                  Scroll Active Page Down
  mov  ah,07h                     ;Entry into ah: function number for scroll active page up.
  mov  al,1                          ;Entry in al: number of lines to scroll blank lines are inserted at bottom, a value of 0
                                          ;means to blank the entire screen.
  mov  bh,1                         ;Entry into bh: video display attribute to be used on blank lines.
  mov  ch,1                         ;Entry in ch: row of upper-left corner of window to scroll.
  mov  cl,1                          ;Entry in cl: column of upper-left corner of window to scroll.
  mov  dh,2                         ;Entry in dh: row of lower-right corner of window to scroll.
  mov  dl,2                          ;Entry into dl: column of lower-right corner of window to scroll.
  int   10h                            ;Start 07h, no return value.

                                          Read Character or Attribute At Current Cursor Position
  mov ah, 08h                      ;Entry in ah: function 08h.
  mov bh,1                           ;Entry in bh: display page in text modes only, screen token into ax.
  int 10h                               ;Start 08h: return values are:
                                           ;returned character read stored in register al, attribute of character returned in ah.

                                                  Write character or attribute at cursor position
   mov  ah,09h                               ;Entry in ah: function 09h
   mov  al,39                                 ;Entry in al: character to write.
   mov  bh,1                                   ;Entry in bh display page.
   mov   bl,1                                   ;Entry in bl: the display attribute if in text mode if in graphics mode
                                                   ;the color 0-3 in 04h mode.
   mov  cx,1                                   ;Entry in cx: number of characters to write.
   int  10h                                    ;Start 09h, no return values.

                               Write character on screen only at cursor position
   mov ah,0Ah                ;Entry in ah: function 0Ah, needs point to .DATA segment with MOV ax,@data  MOV ds,ax
                                    ; Required for screen output: link to data in .DATA section with MOV ax,@data  MOV ds,ax. 
   mov al,59                   ;Entry in al: character to write as decimal or hexadecimal.
   mov bh,1                   ;Entry in bh: display page for text mode only.
   mov cx,2                    ;Entry in cx: number of character to write.
   int 10h                        ;Start 0Ah, no return value.

                               Set color palette
   mov ah,0Bh           ;Entry in ah: function 0Bh.
   mov bh,0               ;Entry in bh: request identification: 0 means the background or border color is to be set,
                                ;1 means that the color palette is to be selected; required for pixel or dot output for function 00h at al= 13h.
  mov bl,1                 ;Entry in bl: the color value; if bh is 0, bl has 0 to 31 to indicate color of background
  int 10h                    ;Start 0Bh, no return value.

                           Write pixel on screen
  mov ah,0Ch            ;Entry in ah: function 0Ch to write pixel on screen.
  mov al,1                 ;Entry in al: color of pixel to be written; color 0-3 for 04h video mode;
                                 ; 3= lightblue, 4=red, 5= purple.
  mov cx,1                 ;Entry in cx: column number in range 1-319 in 04h or 05h mode, 1-639 in 06h mode.
  mov dx,1                 ;Entry in dx: row number 1-199 in function 00h as 04h, 05h, or 06h mode.
  int 10h                    ;Start 0Ch, no return value. May have to be invoked twice with incementing cx and dx.
                                ; The pixel writing on screen must follow the video random access memory direction: left to right, up to down.

                                                  Read pixel from screen memory.
   mov ah,0Dh              ;Entry in ah: function 0Dh to read pixel.
   mov cx,1                  ;Horizontal pixel location entry in cx: column number with range 0-319 in 04h or
                                   ;05h mode, or 0-639 in 06h mode.
   mov dx,1                  ;Pixel verticle location entry in dx; row number in range of 0-199.
   int 10h                      ;Start 0Dh, eturned value is pixel read stored in register al.

                                                    Teletype style write to active page
   mov ah,0Eh                       ;Entry in ah: funtion number for write.
   mov al,67                          ;Entry into al: character to write to active page.
   mov bl,1                            ;Entry into bl: foreground color in graphics modes only.
   int 10h                                ;Start 0Eh, gives no return value.

                                                     Get current video state
  mov  ah,0Fh                                 ;Entry into ah: function number.
  int   10h                                       ;Start 0Fh, return values are: current number of text columns at ah,
  mov ds:[bx], bh                            ;Get current page into bh
  ;push al                                        ;current video mode in register al, and
  mov videomode,al
  ;push bh                                       ;current active display page in bh.

               Set palette registers, set intensity or blink attribute (EGA, MCGA and VDA)
  mov ah,10h       ;Entry into ah: function number
  mov al,0            ;Entry into al: indicate specific service requested 0-3.
                             ;0 is set individual palette register; register bl must contain the number of the palette    
                            ;register to be set, bh must contain the value that is to be assigned to the register;
                            ;1 is set overscan or border register, bh must contain the value to be assigned the over
                            ;scan register; 2 is set palette registers and overscan, registers es:bx must point to a
                            ;17-byte table of palette values, followed by the overscan register value;
                            ;3 is toggle intensity or blinking bit the bit 7 of the attribute code,  bl is set to 0 to  
                            ;enable intensity or to 1 to enable blinking.
  int 10h               ;Start 10h, gives no return value.

                                                     Character generator interface (EGA, MCGA and VCA)
   mov ah,11h                  ;Entry into ah; function number.
   mov al,1                       ;Entry into al; specifies the desired service, service numbers found in BIOS interface
                                       ;technical technical manual.
   int 10h                          ;Start 11h, return values found in BIOS interface reference.

                         Video configuration or alternate select (EGA, MCGA and VGA)
   mov ah,12h         ;Entry into ah: function number.
   mov bl,10h         ;entry into bl: bl receives 10h for return video configuration or
                             ;20h for selecting alternate print screen routine.
   int 10h                ;Start 12h, return values are:
   push bh               ;in bh as 0 for color mode in effect or 1 for monochrome mode is in effect;
   push bl                ;in bl as amount of EGA memory installed according to service codes:
                               ;00  064k,  01  128k, 10   192k,   11  256k; k is kilobytes of memory.
   push ch                ;feature bits in ch, switch setting in register cl.
                         Write dot on graphics 640 by 200 mode 06h= al and ah= 00.
   mov al,01              ;Set dot color: black=00h, white=01.
   mov dx,00              ;Set vertical start to left.
   mov cx,00              ;Set horizontal position at top of screen.
   mov ah,12              ;Bios write dot parameter 12h into ah.
   int 10h                   ;Bios interrupt call: invoke funtion 12h.
                                                      Write string (AT, EGA, and PS/2)
   mov ah,13h       ;Entry into ah: function number or address 13h.
   mov al, 0           ;Entry into al, entry 0 write string with a single specified attribute, 
                            ; without moving, mov bl, 00h             
                            ;the cursor, register bl should contain the attribute and the string should have format:
                            ;(char, char, char, etcetera); entry 1 writes string with a single specified attribute
                            ;and moves the cursor, bl contains the attribute, string has same format as before;
                            ;entry 2 writes a string that contains an attribute for each character without  moving
                            ;the cursor, the string formate is: (char, attribute, char, attribute, etcetera);
                            ;entry 3 writes a string that contains an attribute for each character and moves the
                            ;cursor, string format is same is in 2.
   mov bh,1                      ;video page number in bh, attribute if al in bl if 0 or 1, number of characters in string
   mov cx;14                    ;in cx with not including number of attributes,
   mov dh,1                      ; starting row in dh,
   mov dl,1                       ;starting column in dl,
   ;lea bp,string2
   mov es:[bp],23              ;entry in pair es:bp is pointer to string "string2" to be written.
   int  10h                         ;Start 13h, no return value.

                                        ; Interrupt 11h: Equipment List Service: Shows Installed Equipment
                                                       ;No entry in ah.
    int  11h                                         ;Start equipment list service, return values in ax are:
    push ax                         ;in ax: bits 15, 14 number of attached printers; bit 12 game input or output attached
                                        ;if bit=1; bits 11,10, 9 for number of RS-232 adapters; bits 7, 6 for number of
                                       ;diskette drives, if bit 0 is 1: code 00 is 1 drive, 01 is 2 drives, 01 is 3 drives,
                                        ;11 is 4 drives; bits 5,4 for initial video mode, code 01 for 40 x25 CGA card,
                                       ;10 for 80 x 25 CGA card; bits 3, 2 for amount of random access memory on    
                                       ;motherboard: code 00 for 16k, 01 for 32k 10 for 48k, 11 for 64k; bit 0 if bit =1,
                                                        ;one or more diskette drives are present of number in bits 7, 6.
                                       ;Bit 0 is for floppy disk drive installed, bit 1 is math copre4ssor installed. Bit 8 for DMA present.
                                       ;Bit bit 13 for serial printer attached; bits 14, 15 for number of printers installed.
                                       ; Bits 9, 10, 11 for number of RS-232 cards intalled.

Interrupt 12h Memory Size Service: Memory Size Available
                                                       ;Has no entries in ah
   int 12h                         ;Start funtion at 12h, return number of contiguous 1 kilobyte blocks of memory amount returned in ax.
   push ax                          ;Place the byte in ax the number of 1 kilobyte blocks of memory on top of stack.

  Interrupt 13h Diskette or Hard Disk Services
           Low level disk functions; parameters in : ax, es:bx, cx, dx.
                                             Reset Specific diskette or disk drive system .
    mov ah,00h              ;Entry into ah; function number 00h.
    mov dl,79h              ;Entry into dl; code indicating wheter to reset a diskette or a hard disk, dl less than  
                                   ;80h indicates a diskette, dl larger than or equal to 80h indicates a hard disk drive. 0 to 7fh is floppy fisk drive
                                   ;80h to ffh is hard disk drive.
    int 13h                     ;Start 00h, gives no return value.
                                                       ;Read diskette or hard disk status of previous disk operation
   mov  ah,01h                       ;Entry into ah: function number.
   move  dl,81h                     ;Entry into dl: if less than 80h get status of diskette, if dl>=80h get status of hard 
                                            ;disk drive.
   int  13h                              ;Start 01h, gives return value in al the status of last diskette or hard disk in                
   push al                               ;operation: FFh for sense operation failed for hard disk only;
                                            ;BBh undefined error for hard disk only; 80h for time out; 40 for insufficient seek;
                                            ;20h for controller has failed; 11h for ECC corrected a data eror for hard disk only,
                                            ;data were corrected by the ECC algorithm;
                                            ;Status output in al: 0=no error, 1=invalid command, 2=address mark not found, 3=disk write protected,
                                            ;4=could not find sector, 5=reset error, 6=removed media, 7=bad parameter table, 8=DMA over run,
                                            ;9=DMA operation crossed 64 kilobyte boundary, 10=illegal sector flag, 11=illegal track flag, 12=illegal media,
                                            ; 13=invalid number of sectors, 14=control data address mark encountered, 15=DMA error, 16=CEC data error,
                                            ; 17=WCC corrected data error, 32=disk controller failed, 64=seek error, 170=time out error,
                                            ; 187=undefined error, 204=write error, 224= status error, 255= sense error,

  mov  ah,02h            ;Read sectors into memory. Reads the specified number of 512 byte sectors from disk.
                                 ; Data read amount is 64 kilobytes or less. 
  mov  al,zz                ;Number of sectors to read: zz is 00h to 09h for for diskette, zz=00h to 08h
                                 ;or hard  disk
  mov ch, ww             ;for diskette the ch receives track number ww=0 to 39, for hard disk ch has
                                 ;cylinder  number ww=0 to 1023. Track bits0 to 7.
  mov cl, hh              ;Sector number: hh=0 to 09 for diskette, hh=0 to 17 for hard drive. Track bits 6 and/or7, track bits 7, 8; bits0 to 5 for sector number
  mov dh, kk             ;Head number: for diskette kk=0 to 1, for hard drive kk=0 to 7. Bit numbers 0 to 5 for head number. Bits 6 and 7 for track bits
                               ;10 and 11.
  mov dl,cc               ;Drive number: for diskette cc=00h to 03h, for hard drive cc=80h to 87h.
  mov es:[bx],bb         ;Address bb of buffer to receive data read.
                                 ; The es:bx means register pair es and bx becomes one double word with bx as
                                 ; offset in segment es; with least significant word in bx. Carry bit 0=success, 1= failure.
  int 13h
  push ah                   ;Output in ah: 0 if carry flag is clear.
  push al                    ;Output in al: number of disk sectors read if carry flag is clear.
  push ah                   ;Output in ah: error code if carry flag is set.

   mov  ah,03h          ;Write sectors to memory (disk) .
                                ;Verifies data in specified 512 byte long sector. Must be 64 kilobytes or less long.                      
   mov  al, hh            ;Entry into al: number of sectors to write: for diskette hh= 01h to 09h,
                                ;for hard drive hh=01h to 80h. 
   mov  ch,kk           ; entry into hh: track number: for diskette  kk=0 to 39, for hard drive kk=0 to 1032
   mov  cl,cc            ;Entry into cl; sector number: for diskette cc= 1 to 9, for hard drive cc=1 to 17.
   mov  dh,ww          ;Head number: for diskette ww =0 to 1, for hard drive ww=0 to 7.
   mov  dl, zz           ;drive number: for diskette zz=00h to 03h, for hard drive zz=80h to 87h.
   mov  es:[bx],bb     ;Entry into es:bx:  address bb of buffer to containing data to be written.
                              ; Segment and offset address in es:bx.
   int  13h
   push  ah               ;Output in ah: 0 when carry flag is clear.
   push  al                ;Output in al: number of disk sectors successfully written when carry flag is clear.
   push  ah               ;Output in ah: error code if carry flag is set.

  mov  ah,04h           ;Verify sectors
                                ;Verifies data in specified 512 byte long sector.
  mov  al,bb              ;Entry into al: number of sectors bb to verify: for diskette bb=01h to 09h,
                               ;for hard disk bb=01h to 80h. Hard drive 1 with bios number 80h, harddrive 2 wth 81h.
  mov  ch,zz             ;Entry in ch: track number zz: for diskette zz=0 to 39, for hard drive zz=0 to 1023.
  mov  cl,kk              ;Sector number: for diskette kk=1 to 9, for hatrd drive kk=1 to 17.
  mov  dh,ww            ;Head number ww: for diskette ww=0 to 1, for hard drive ww=0 to 7.
  mov  dl,cc              ;Drive number: for diskette cc =00h to 03h, for hard disk cc=80h to 87h.
  int 13h                   ; Same inputs as 02h except no need for a buffer
  push  ah                 ;Output in ah: 0 for carry flag is clear.
  push  al                  ;Output in al: number of disk sectors successfully verified if carry is clear.
  push  ah                 ;Output in ah: error code if carry flag is set.

mov ah,0ch             ; Sends disk head to a specific track on disk.
                               ; Register inputs and outputs same as 04h with sector number not required.

Mov ah,0dh            ;Reset hard disk controller.
                              ; In dl is drive number 80f or 81h.
                              ;Return status in ah. Carry bit 0=no error, 1= error.

  Interrupt 14h Communications Services: Serial Inputs/outputs
    Com1, com2 ports are used by mouse and modems, Recommended Standard 232 (RS-232 standard), DE-9 nine pin plug hardware type in IBM
    personal computer. From pin operations below, can see that the computer (DTE) governs the port operations.
                             RS-232 nine pin (looking at DE-9 pin points):

                                    1 2  3  4 5
                                       6 7 8 9

                      Pins:    operations:                                                       Pins:       Operations by data terminal equipment (DTE):
                       1        carrier detect (connect to telephone line)                6     data set ready (receiver ready to receive commands or data)                            
                       2        received data (data bit from receiver)                     7     request to send (request to receiver to receive data bit)
                       3        transmited data  (data bit to receiver)                     8     clear to send (receiver ready to accept data bit)
                       4        data terminal ready (indicates presence of DTE)     9     ring indicator (telephone ring detector by receiver).
                       5        signal ground (ground connection)

           RS-232 twenty five pin DE-25 (looking at pin points), personal computer printer:

                              1  2  3  4  5  6  7  8  9  10  11  12  13
                                14 15 16 17 18 19 20 21 23 24 25

                           Pins:       operations:                          Pins:      Operations:                          Pins:     operations:
                             1      protected ground                     9       + voltage testing                        17       receiver clock
                             2      transmitted data                       10     - voltage testing                         18
                             3      received data                           11                                                      19      secondary (other port) request to send
                             4      request to send                        12    seconday carrier detect               20      data terminal ready
                             5      clear to send                            13    secondary clear to send               21     signal quality detector
                             6      data set ready                          14    seconday transmitted data           22      ring indicator
                             7      signal ground                           15     transmitted clock                        23      data rate select
                             8      carrier detect                           16     secondary received data             24      extermal clock
                                                                                                                                               25        .

 mov   ah,00h           ; Initialize communications port
  mov al,10100111b         ;Entry qq into al : bits 7, 6 and 5 for baud
                                 ; rate, bits 4 and 3 for parity,bit 2 for number                        
  mov dx,0                        ;of stop bits. mov dx,zz  ;Entry into dx:specifiesserialportnumber0to3:zz=0= COM1,zz=1=COM2.
  int  14h                   ; Bits 5 to 7 for baud rate: 000=110 baud, 110=480 baud, 111=9600 baud rate.z
                                 ; Bits 0 and 1 for character size:  10=7 bits, 11=8 bits.
                                 : Bits 3 and 4 for select parity: 00=no parity, 01=odd parity, 11=even parity. Bit 2 for stop bits: 0=one stop bit, 1= two stop bits.
  push ax                    ; Return in ax: serial port status: ah contains line status, al contains modem status.

  mov ah,01h      ;Send character to communications port 
  mov al,57         ;Entry into al: character or byte tosend.    <BR> ;moval,"b"<BR>  mov dx,zz        ;Serial port number: zz=0= COM1, zz=1=COM2.
  int  14h
  push  ah            ;Return in ah: bit 7=1 for routine was unable to transmitt the character,
                          ;bit 7= 0  for remainder of ah contains the current status line, bit 6 for transmission shift;  register empty, bit 5 for 
                          ;transmission hold, register empty, bit 4 for break detected,
                          ; bit 3 for framing error, bit 2 for parity error, bit 1 for overrun error, bit 0 for data  ready.
  test ah,80h       ; Check for error and if so
  jnz Serialerror  ; go to routine.
  mov ah,02h    ;Receive character from communications port . 
  mov dx;zz                 ;Entry  into dx: serial portnumber: zz=0= COM1, zz=1=COM2
  int  14h
  push  ah             ;Return in ah: bit 7=1 for a time out occured and the remaining status bits an ah are unreliable,
                           ;bit 7=0 for no time out, then the other error bits in ah reliably indicate the occurance of
                           ;errors, bit 4 for break detected, bit 3 for framing error, bit 2 for parity error,
                           ;bit 1 for overrun error. Resul or character in al.
  test ah,90h        ; Error code in ah if any.

 mov ah, 0                      ;Initialize serial port
 mov al,10100111b                    ;Parameter.
 mov dx, 0                         ; Port selct, 0=COM1: port.
 int 14h

                           ;Parameter in al: Bits 5 through. 7 bauds: 000-= 110baud,  001=150,    010= 300, 011= 600, 100-= 1200, 101= 2400,110-= 4800,
                            ;111= 9600 baud.
                            ;Bits 3  through. 4 :  00-=No parity, 01-=Odd parity,  10= Noparity ,  11= Evenparity; see Windows Device ManagerPort Settings.
                            ;Bit 2 :  0=One stop bit, 1=Two stop bits.
                            ;Bits 0 through 1: character size: 10=7 bits,11- 8 bits.

                     ;Write or Transmit To Serial Port
mov dx,0                  ;Port select, 0=COM1, 1=COM2
mov al,"x"                          ;Character to write
mov ah,01h        ;01h for transmit
test ah, 080h              ;error code return in ah; check for error.
jnz showerror

                    ;Receiver character from serial port.
mov dx, 0   ;Select COM1: mov ah, 2 ;Receive opcode int 14h test ah, 80h ;Check for error jnz SerialError 
mov dx,0    ;Select a serial port 0=COM1
mov ah,2
int 14h
test ah,080           Error status in ah; received data in al.

mov ah,03h     ;Serial port status .
mov dx,0      ;Serial port number in dx. Results in ax.
int 14h          ;Status codes in ax: 15=time out error, 14=transmitter shift register empty,13=transmitter holding register empty, 12=break detectio error
                    ;11=framing error, 10=parity wrror, 9=over run error, 8=data available, 7=receive line signal detect, 6=ring indicator,
                    ;5= data set ready (DSR), 4=clear to send, 3=receive line signal, 2= trailing dge ring detector, 1=data set ready, 0= clear to send.

                   Interrupt 16h: Keyboard Services With Low Level Bios

   mov  ah,00h       ;Return next character entered from keyboard
   int  16h
   push ah              ;Return in ah: extended code,
   push  al              ;Return in al: ascii code.

  ; Bios data are in segment  040h.

   mov  ah,01h         ;Test if character is ready, keyboard status function.
   int  16h              ; See if key is present at keyboard.
                             ;Return at status flags register: zero flag=1 for no character is ready, zero flag=0
                             ;for a character is ready. If character is ready it is placed in register ax as function 00h,
                             ;but it is not removed from the keyboard buffer an so is read by the next invocation
                             ;of function 00h.

   mov ah,02h          ;Read shift Key flag status function without stopping program.
   int 16h                 ;Return in al,  perhaps in bp. Bit 7 for Insert key state( press Insert to toggle); bit 6 for capitals lock (1 is on), 
                              ; bit 5 for Num Lock (1 is on), bit 4 forScroll lock (1 is scroll lock on), bit 3 for Alt key (1 is key on), bit 2 for Cntrl (control)
                              ; key (1=key down or on).
                              ; bit 1 for left shift key (1=down), bit 0 for right shift key (1=down or on).

   mov  ah,03h        ;Return current shift or shift key status
   int  16h
   push  al               ;Return in al: current shift status: 0 for right-shift depressed, 1 for left-shift depressed,
                             ;bit 2 for Ctrl-Shift depressed, bit 3 for Alt-Shift depressed, bit 4 for Scroll Lock active,
                             ;bit 5 for Num Lock active, bit 6 for Caps lock, bit 7 for Ins key active.

mov ah,05h        ; push key into keyboard buffer

mov ah,10h       ; wait for key
mov ah,11h      ; check keyboard buffer, return in ax with zf=0
mov ah,12h       ; get keyboatf flags.

                           Interrupt 17h: Print Services

   mov ah, 00h       ;Print character
   mov al,zz           ;Entry into al: character zz to be printed.
   mov dx,xx          ;Entry into dx: printer xx to use, xx=0, 1, 2.
   int 17h
   push ah              ;Return in ah: printer status: bit 7 on for not busy, bit 6 on for acknowledge,
                             ;bit 5 for out of paper, bit 4 for selected, bit 3 for input/output error,
                             ;bit 2 is unused, bit 1 is unused, bit 0 on for time out.

    mov ah,02h       ;Initialize the printer port.
    mov dx,xx         ;Entry into dx: printer xx in use: xx=0, 1, 2.
    int 17h
    push ah             ;Return in ah: printer status: bits same as in function 00h.

    mov ah,02h        ;Read printer status
    mov dx,xx          ;Printer xx in use: xx=0, 1, 2.
    int 17h
    push ah               ;Return in ah: printer status: bits same as in function 00h.

    int 18h               ;Interrupt 18h: Load from read only memory the BASIC programming language.

     int 19h             ;Boot strap loader: routine  restarts the system by powering down the computer.

Int 19 Restart System (Reboot system)

                          Interrupt 1Ah: Time of Day services, Real Time Clock
mov  ah,00h        ;Read clock count.
   int  1Ah
   push  al              ;return in al: 1 for timer has passed 24 hours since last time the service was invoked,
   push  cx             ;Return incx: upper word of count (clock),
   push  dx             ;Return in dx: lower word of count.

  mov  ah,01h         ;Set clock count.
  mov  cx, zz          ;Entry in cx: upper word count zz
  mov  dx, cc          ;Entry into dx: lower word count cc.
  int  1Ah                ;Start function 01h, gives no return.

  mov  ah,02h         ;Read realtime clock
  int 1Ah
  push  ch               ;Return in ch: hours,
  push  cl                ;Return in cl: minutes,
  push dh                ;Return in dh: seconds,
  push  dl                ;Return in dl: daylight savings enable 00 to 01.

  mov  ah,03h         ;Set realtime clock.
  mov  ch,h             ;Entry into ch: hours h,
  mov  cl,m             ;Entry into cl: minutes m.
  mov  dh,s             ;Entry into dh: seconds s
  mov dl, en            ;Entry into dl: en=1 to enable automatic daylight savings time update,
                             ;en=0 to disable daylight savings time update.
  int 1Ah                 ;Start o3h, gives no return.

  mov  ah,04h         ;Read date from realtime clock.
  int  1Ah
  push ch                ;Return in ch: century 1900 to 2000.
  push  cl                ;Return in cl: year,
  push  dh               ;Return in dh: month,
  push  dl                ;Return in dl: day.

  mov  ah,05h          ;Set date for realtime clock.
  mov  ch,cc            ;Entry into cc: century cc,
  mov  cl,yy             ;entry into cl: year yy,
  mov  dh, m            ;entry into dh: month m,
  mov  dl, d              ;entry intodl: day d.
  int  1Ah                 ;Start 1Ah, gives no return.

  mov  ah,06h          ;Set alarm.
  mov  ch,h              ;entry into ch: hours h,
  mov  cl,m              ;entry into cl: minutes,
  mov  dh,s              ;entry into dh,: seconds s.
  int  1Ah                 ;Start 06h, gives no return.

  mov  ah,07h           ;Reset alarm.
  int  1Ah                 ;Starts 07h, gives no return.

                                                DOS Interrupt 21 Functions

    mov  ah,00h                                   ;Program terminate
    mov  cs,xx                                     ;Segment address of program segment prefix in xx.
    int 21h                        ; Use MS Dos (Microsft Dos) routines.

    mov  ah,01h                                    ;Console input from keyboard with echo or show input.
    int 21h                                          
    push al                                           ;Character returned in al to stack top.
    ;MOV character_2,al

    mov  ah,02h                            ;Display output on screen or standard output. Requires function 4ch at program finish
    mov dl, 50                                      ;Character to display is send to dl. mov dl,'x'
    int 21h                                           ;Start 02h, no register output from function 02h.

    mov ah,03h                            ;Auxiliary input: read character from standard auxiliary device, wait for asynchronous
                                                          ;input character
    int 21h                               
    push al                                           ;Character returned in al to stack top.

   mov ah,04h                                      ;Auxiliary output: send character to a standard asynchronous output device.
   mov dl,50                                        ;Character to send is placed in dl.
   int 21h                                            ;Start 04h, no output from function.

   mov ah,05h                                      ;Printer output: character to standard printer the PRN:device.
   mov dl,50                                        ;Character to be send placed in dl.
   int 21h                                            ;Start 05h, no output from function.

   mov ah,06h                      ;Direct console input or output: reads or write character.
   mov dl,FFh                      ;Function selector in dl: FFh read character, not FFh for display dl.
   int 21h
   push zf                         ;Output in zf: on read only: 0= character returned, 1=no character ready.
   push dl                         ;Output in dl: character returned on reads only.

   mov ah,07h                  ;Direct console input without echoing to standard output: read character from 
                                   ;keyboard; Crtl+Break, Crtl+S, Ctrl+Q, Crtl+P and Crtl+PrtSc are not processed.
   int 21h
   push al                                             ;Character returned in al, then placed on stack.

   mov ah,08h                                       ;Console input without echo: reads character from standard input.
   int 21h
   push al                                             ;Character returned in al send to stack.

   xx   DB   "String of characters."       ;Define xx in .DATA.
         DB    "bb5" 

   mov ax,@data                                  ; Start of data section into ax.
   mov ds,ax
   mov ah, 09h                    ;Display string of characters to standard output, string terminated at $ or 24h set write code.
   mov ds:[dx],OFFSET xx              ;Entry in ds and dx: start address of string of symbol xx into ds and dx.
  ; mov dx,ds
   int 21h                                    ;Start 09h, no return from function. Format at the buffer at ds:dx:
                                                  ;STRING  DB "Text ...", "$"  in .DATA.      
                                                                    ;Buffered keyboard input.
   KB_BUF  LABEL BYTE                         ;Format of buffer at ds:[dx], array symbol or label.
    MAX_LEN     DB   m                             ;Maximum length m of returned text including a carriage return 0Dh.
    CUR_LENG   DB   n                              ;Length n of actual returned text following buffer pointed to by "CUR_LENG",
    CUR_TEXT    DB  x DUP(?),0Dh          ;Return text, size of array x for storing string ascii characters.
                         DB   (m-n-1) DUPO (?)     ;unused.
    mov ah,0Ah                                             ;Buffered keyboard input: saves character entered from a standard input
                                                                    ;usually the CON device in a buffer supplied by the caller and echoes
                                                                    ;characters  to standard output.
   mov ds:[dx],KB_BUF                   ;Entry into ds and dx: address of buffer, start address of string in ds:[dx] assigned
                                                                     ;to symbol   ;"KB_BUF"
                                                                     ;into register dx.
   int 21h                                                       ;Start 0Ah, no return value, stop function by pressing "Enter".

   mov ah,0Bh                        ;Check standard input status: determine if character is available on standard input.
   int 21h
   push al           ;Character available indicator: FFh in al for character is ready, no FFh for no                 
                     ;character; place content in al in stack.

   mov ah,0Ch                 ;Clear keyboard buffer and invoke keyboard function: clears standard input of                                      
                             ;characters in BIOS type-ahead buffer and executes a specific keyboard funtion.
   mov al, 00h           ;Entry into al: 00h for just clear the buffer, 01h for console clear the buffer, 06h                        
                                      ;for direct console input or output, 07h for direct console input without echo,  08h                                      
                                      ;for console input without echo, 0Ah for buffered keyboard input.
   int 21h                         ;Start 0Ch, for return value registers and values see appropriate function.

   mov ah,0Dh                                      ;Disk reset: used before requesting change of removable media.
   int 21h                                             ;Start 0Dh, no return value.

   mov ah,0Eh                                       ;Select disk: function selects the current default drive.
   mov dl,0                                           ;Entry in dl, select the drive: 0= A drive, 1= B drive, 2= C drive, 3= D drive, 4=E drive.
   int 21h                                              ;
   push al                                 ;Combined available drives return: 1=A, 2=B, number of disk drives, 2 for single drive
                                                                ;FCB open file: opens a file in the current directory of a specifieddrive. <br>  INPUT_FCBLABELBYTE               ;Variableformatofbufferatds:dx,variable"INPUT_FCB" becomes  <BR>                            ;locationoffirstbyteofarray.      <BR>      DB 0              ;Drive:0=default,1=A drive, 2=B drive, etcetera.
       DB  "filename"                                 ;8 character filename.
       DB  "ext"                                         ;Three character filename extension like "txt", "ext" , "dll", "exe", etcetera.  
       DB   25 DUP(0)                              ;Array initialize by DOS to (0). FCB= file control block.
                                                             ; The 25 DUP(9) is duplicate or array
                                                               ;size for 25 bytes. Used with INT 21 function 0Fh.

   OUTPUT_FCB LABEL BYTE            ; File label. File label array declared in ".DATA" segment:
       DB         ?                                         ;drive: 1=A, 2=B, etcetera ,
       DB    "filename"                                 ;8 character filename,
       DB    "EXT"                                      ;EXT is a three character file name extension like: exe, txt, dll, etcetera;
                                                                ;example:  can use filename.exe for storing  machine code as an executable
                                                                ;file  in Windows XP;
       DW      0                                          ;current block,   
       DW  128                                          ;record size,
       DD   ?                                              ;double word file size from the, "?" means empty variable declaration.
       DW    ?                                            ;file date file's    
       DW    ?                                            ;file time directory,
       DB    8 DUP(?)                                ;reserved for DOS,
       DB    0                                             ;current record number,
       DD   0                                              ;random record number.   

   filename DB "C:\test.txt",0           ; Declare file test.txt with or without path C:\ in data segment.  
   filename_2 DB "C:\*.*",0            ; For a file name in directory C:\. 
   buffer DB 100 DUP (?)
   filehandle DW ?
   mov ah,0Fh                                          ;FCB open file: opens file in current directory of specified drive.
   ;mov ds:[dx],OFFSET INPUT_FCB       ;Array label entry into ds and dx: address in xx of an
                                                             ; unopen FCB, start of file placed in dx and ds
                                                                ;Pointer to fcb in to ds:[dx]. 0FH Open file
   int 21h                            ;assigned to by INPUT_FCB, file placed in main memory starting at ds:dx value.
   push al                ;Error code output in al: 00h for file opened,  FFh for file not found. al= 0 if there were no errors.
   mov ah,10h                                        ;FCB closew file: function closes an open file.
   ;mov ds:[dx],xx                                   ;Entry into ds and dx: addressib xx of an open FCB . 
   int 21h
   push al                                              ;Function output in al: 00h for file closed, FFh for file not found.    

   mov ah,11h                 ;FCB search for first entry:searches for first match of specified filename in current
                                                           ;directory of specified drive.
  ; mov ds:[dx],xx                                  ;Entry into ds and dx: address of an unopen FCB.
   int 21h
   push al                      ;Return is al: error code: 00h for file found, FFh for file not found DTA for found  ;file information  

   mov  ah,12h                        ;FCB search for next entry: search for next matching file as specified by a prior
                                                          ;search for first entry.
   mov ds:[dx],xx                              ;Entry xx into ds:[dx:] address of search FCB.
   int  21h
   push al            ;Output in al: error code: 00h for file found, FFh for file not found,

                             ;DTA found file information. File tranfer area DTA. 
   mov  ah,13h                                       ;FCB delete file.
   mov ds,PCB                                    ;Entry of PCB and zz into ds:dx: address of an unopen FCB
   mov  dx, zz
   int 21h
   push al                    ;Output in al: error code; 00h for file or files found, FFh file not found.
                                 ;Format of the buffer at ds:dx: normal PCB definition:
                                 ;PCB  LABEL BYTE
                                    ;DB        0                   ;drive: 1=A, 2=B, etcetera,
                                    ;DB       "filename"       ;8 character filename  (?allowed),
                                    ;DB      "ext"             ;3 character file name extension like: txt, exe, dll, cpp,
                                                                               ; etcetera(? allowed),
                                    ;DB    25  DUP(0)        ;reserved for DOS.

   mov  ah,14h             ;FCB sequential read: DOS sequential file read of an open fle reading
                                 ;the record addressed by
                                ; the FCB current-block and current record number fields into the DTA buffer. 14H Sequential reading
   ;mov ds:[dx],PCB        ;Entry of symbol PCB into ds and dx: address of an open FCB. 15H Sequential writing

   int  21h
   push  al              ;Output in al: error code:  00h for no error, 01h for end of file EOF,
                            ; 02h  for DTA segment wrap.
                                 ;Format of the buffer at ds:[dx]; file control block FCB:
                                  ;FCB  LABEL BYTE
                                     ;     DB              ?            ;drive: 1=A, 2=B, etcetera,
                                     ;     DB    "filename"         ; 8 character filename,
                                     ;     DB    "ext"                 ;3 character file name extension like: txt, exe, dll, etcetera;
                                     ;     DW     0                    ;current block,
                                     ;     DW     128                 ;record size,
                                     ;     DD       ?                   ;file size from the
                                     ;     DW      ?                   ;file date  file's
                                     ;     DW      ?                   ;file time directory,
                                     ;     DB   8 DUP(?)            ;reserved for DOS, duplicate process 8 times to store bytes in this case,
                                     ;     DB   0                       ;current record number,
                                     ;     DD   0                       ;random record number. 

   mov  ah,15h              ;FCB sequential write: write to an open file, writing the record address by the FCB                                            
                                      ;current-block and current record number fields into the DTA buffer.
   mov  ds:[dx],FCB         ;Entry of FCB into ds:[dx]: address of an open FCB
   int  21h
   push al                     ;Output in al:error code: 00h for no error, 01h for disk is full or read-only file,
                                        ;02h for DTA segment wrap, 03h for partial record read.
                                   ;Format of the buffer at ds:dx: same as funtion 14h with 21h.
                                     ;FCB    LABEL BYTE
                                        ;  DB       ?                 ;drive: 1=A, 2=B, etcetera,
                                        ;  DB  "filename"         ;8 character filename,
                                        ;  DB   "ext"                ;3 character file name extension,
                                        ;  DW   0                    ;current block,
                                        ;  DW    128               ;record size,
                                        ;  DD       ?                 ;

    mov  ah,16h                                     ;FCB make a file in current directory of specified drive and opens
                                                          ;the file for read and write access. 16H Create file
    ;mov ds:[dx],xx                                  ;Entry of xx into ds:[dx] address of an unopen FCB
    int  21h
    push  al                          ;Output in al: error code: 00h for file made, FFh for no room in directory.
                                         ;Format of the buffer at ds:dx: similar to 14h.

    mov  ah,17h                                     ;Rename a file: changes matching filenames in current directory of  
                                                        ;specified directory to a new filename.   
   ; mov ds:[dx],xx                                     ;Entry of xx into ds:dx: address of an unopen FCB
    int  21h
    push al                                      ;Output in al: error code: 00h for file or files renamed, FFh for file not   ;found or new name exists.

   mov   ah,19h                                       ;Current disk: return the current drive
   int  21h
   push al                                               ;Output in al: 0 for A drive, 1 for B drive ,2 for c drive.
  mov ax,@data                               ;Move data in @data to word register ax.
  mov ds,ax                                  ;Set DS to point to the data segment; move data address in ax to dx.              
  mov dx,OFFSET NumberPrompt     ;Move start address of time prompt string to dx: point to the time prompt.
  mov ah,20h                                 ;DOS: print string on screen: move function 9 to ah.
  int 21h                                    ;Start interupt handler: display user time prompt on screen.

   mov  ah,1Ah                     ;Set disk transfer address DTA.Set a pointer to a 43-byte buffer area. 
                                            ;Done before functions 4Eh and 4Fh. 1Ah Entry parameters: ds:dx pointer to DTA. 
        ; See .
   mov ds,xx                           ;Entry of xx and zz into ds:dx: address of DTA buffer, ds:[dx] is pointer to DTA 
                                                 ; (43 byte buffer area).
   mov dx,zz                                       ;
   int  21h                                               ;Start 1Ah, no return byte.

   mov  ah,1Bh                                        ;Allocation table information:returns information concerning the current                                                            ;defualt drive's file allocation table FAT.
   mov  ds:[dx],xx                                    ;Entry of xx into ds:dx: address of DTA buffer, buffer format: DAT                                                         
                                               ;LABEL BYTE ... .
   int  21h
   push al                                              ;Output in al: sectors per cluster, Fh is dik error, or
   push cx                                              ;Output in cx: bytes per sector.
   push dx                                              ;Output in dx: number of clusters
   ;push ds:[bx]                                          ;Output in ds and bx: address of media type, buffer format at ds:bx:  
   push ds
   push dx                                                          
;FAT_  DB  , FAT (file format) media type.
   mov ah,1Ch                    ;Allocation table information for specific device: returns information     
                                    ;convering the specified drive's file allocation table FAT,
   mov dl,0                ;Entry into dl: drive selector: 0=current, 1= A drive, 2=B drive.
   int  21h
   push al                    ;Output in al: sector per cluster, FFh =disk error, or
   push  cx                                              ;output in cx: bytes per sector.
   push  dx                                              ;Output in dx: number of cluster.
   push  ds:[dx],xx                                     ;Output in ds:dx: address of media; memory segment prefix: ds:.   

   mov  ah,1Fh               ;Get default device parameter block: returns address of the device parameter block DPB
                                   ;for current drive.     
   int  21h
   push al,0                   ;Output in al: return code: 0 for no error.
   push ds:[bx]               ;Output in ds:dx: DPB return address.

   mov  ah,21h           ;Random read: performs a random file read from an open file by reading the record             
                                          ;addressed by the FCB current block and current record fields from the DTA buffer.
                                  ; 21H Random reading.
   mov ds:[dx],xx                                         ;Entry of xx into ds:[dx]: address of an open file
   int  21h
   push al          ;Output in al: error code: 00h for no error, 01h for end of file EOF, 02h for DTA
                       ;segment wrap, 03h for partial record read. Use relative record field function 24h.
                                                               ;Format for buffer at ds:dx in data segment:
                                                               ;FCB  LABEL  BYTE
                                                                       ;DB    ?                          ;drive 1=A, 2=B, etcetera
                                                                       ;DB   "filename"              ;8 character filename
                                                                       ;DB   "EXT"                    ;3 character file name extension
                                                                       ;DW    0                          ;current block
                                                                       ;DW    128                      ;record size
                                                                       ;DD      ?                         ;filesize
                                                                       ;DW     ?                         ;file date
                                                                       ;DW     ?                         ;file time
                                                                       ;DB       8 DUP(?)             ;reserved for DOS
                                                                       ;DB       0                         ;current record number
                                                                       ;DD       0                        ;random record number.

   mov  ah,22h                 ;FCB random write: performs random file write to an open file by writing the record
                                   ;address by the FCB current block and current record fields from the DTA buffer.
   mov  ds:[dx],xx                          ;Entry of xx into ds:dx: addrrss of an opent FCB. 22H Random writing
.   int  21h
   push al                     ;Output in al:error code: 00h for  o error, 01h for disk full, 02h for DTA segment wrap.
    mov  ah,35h                                       ;Get interrupt vector: gets contents of an interrupt vector.
    mov  al,nn                                          ;Entry of nn into al: interrupt vector number.
    int  21h
    push es:[bx]                                       ;Output in es:bx: address of IN_DOS flag.  

   mov  ah,25h                             ;Set interrupt vector: sets an interrupt vector to a specified interrupt
                                                   ;handling routine.
   mov al,zz                                 ;Entry of zz into al: interrupt vector number.
   mov ds:[dx],xx            ;Entry xx into ds:dx=vector address: address of new interrupt handler which receives control.
   int  21h                                     ;start function 25h, no return value.   

   mov   ah,26h          ;Make new program segment prefix: makes and initializes a new program segment                
                                       ;prefix PSP at the specified address by copying the current program's PSP.
   mov  dx,zz                    ;Entry of zz into dx: segment of new PSP.
   int  21h

    mov  ah,27h                 ;FCB random block read: performs a random file read of consecutive records from
                                       ;an open file by reading the record address by the FCB into the DTA buffer.
    mov  ds:[dx],xx            ;Entry of xx into ds:dx: address of an open FCB.
    mov  cx,1                     ;Number of records to read.
    int  21h
    push al                        ;Output in al: error code: 00h for no error, 01h for end of file EOF, 02h for
                                      ;DTA segment wrap, 03h for partial record read.
    push  cx                      ;Output in cx: number of records read.
                                      ;Buffer format at ds:dx:
                                          FCB  LABEL BYTER
                                                 DB     ?                           ;Drive 1=A, 2=B, etcetera.
                                                 DB      "filename"             ;8 character filename. Declare in .DATA segment.
                                                 DB      "EXT"                   ;3 character file name extension.

    mov  ah,28h                ;FCB random block write: performs a random file write of consecutive
                                        ;random records                                     
                                      ;from an open file by writing the record address by the FCB from the DTA buffer.
    mov  ds:[dx],xx           ;Entry of xx into register pair ds:dx: address of an open FCB.
    mov cs,zz                   ;Entry of zz into cs: number of records to write.
    int  21h
    push al                       ;Output in al: error code: 00h for no error, 01h for disk full, 02h for DTA segment wrap.

   move  ah,29h              ;Parse filename : funtion 29h parses a filename text string into a FCB.
   mov  al,0                    ;Entry into al: function bits: 0 for 1-scan off leading separators, 1 for 1=set FCB
                                    ; drive identification if present, 2 for 1=set FCB filename if present,
                                    ;3 for 1=set FCB extension if prsent, 7-4 for reserved must be set to 0.
   mov  ds:[si],zz            ;Entry of zz into register pair ds:si: address of source filename.
   mov  es:[di],xx            ;Entry of xx into es:di: address of destination FCB.
   int  21h
   push  al                      ;Output in al: error code; 00h for no * or ? in name, 01h for * or ? in name,
                                    ;FFh for invalid drive specified.

   mov  ah,2Ah                ;Get date : returns date information: day of month, month, year.
   int  21h
   push al                       ;Output in al: day of the week
   push cx                      ;year (16 bit value) in cx
   push dh                      ;month in dh
   push dl                       ;day in dl.

   mov  ah,2Bh                ;Set date
   mov  cx,2003              ;Entry into cx: year
   mov  dh, 4                   ;Entry into dh: month
   mov  dl,15                    ;Entry into dl: day,
   int  21h
   push  al                        ;Output in al: error code: 00h for no error, FFh for invalid date.

   mov  ah,2Ch                  ;Get time: returns hours, minutes,seconds, and hundredths of seconds.
   int  21h
   push  ch                       ;Output in ch: hour
   push  cl                        ;Output in cl: minute
   push  dh                       ;Output in dh:second
   push  dl                        ;Output in dl: hundredths of a second.

   mov  ah,2Dh                 ;Set time:sets hours, minutes, seconds, and hundredths of seconds.
   mov  ch,3                     ;Entry into ch: hour
   mov  cl,20                    ;Entry into cl: minute
   mov  dh,23                   ;Entry into dh: second
   mov  dl,11                    ;Entry into dl: hunderedth of a second: 0 -99.

   mov ah,2Eh                  ;Set verify state
   mov dl,0                       ;0 in al to turn verify off, 1 in al to turn verify on.
   int 21h                          

   mov  ah,2E00h             ;Reset verify state: resets the disk write verfification state.
   int  21h

   mov  ax,2E01h              ;Set verifiy state:sets write verfication state.
   int 21h

    mov  ah,2Fh                 ;Get disk transfer address DTA: returns the current disk transfer address DTA
    int  21h
    push  es:[bx],zz           ;Entry of zz into pair es:bx: address of current DTA.  The DTA begins at address
                                      ;defined by es:bx and extnds to the end of the data segment. Disk transfer address.

    mov  ah,30h                 ;Get DOS  disk operating system version number.
    int  21h
    push  ax             ;Output in ax: DOS function numer: ah=minor version or revision number, al=major version,           
                                       ;1B03h implies DOS 3.30, bx,cx=0
    push  bx                       ;Output in bx: indicates DOS destroyed
    push  cx                       ;Output in cx: indicates DOS destroyed.

    mov  ah,31h                  ;Terminate current number and return control to parent programs or stay resident.
                                        ;Process management funtion: keep process
                                        ;Open files and memory blocks allocated to the programs are retained.
    mov  al, xx                   ;Entry of xx into al= return code
    mov dx,21                    ;Entry into dx: memory size of program and data in paragraphs.
    int  21h                        ;Start function 31h, no return value given.

    mov ah,32h                  ;Get device parameter block: returns address of the device parameter block DPB
                                        ;for specified drive.
    mov dl,0                       ;Entry into dl: drive: 0=current, 1=drive A, 2=drive B, etcetera
    int 21h
    push al                          ;Ouput in al: return code: 00f for no error, FFh for insufficient drive.
    push ds:[bx]                 ;Output in ds:bx: DPB address.

    mov  ax,3300h        ;Get break state: this function gets the break state; when break is on, entry               
                                         ;Crtl+break  runs the int 23h Crtl+break handler which may stop the current
                                         ;procces information.
    int  21h
    push  dl                           ;Ouput in dl: current break state: 0 for off, 1 for on 

    mov  ax,3301h                 ;Set break state
    int  21h
    push  dl                            ;Output in dl: new break state: 0 for off, 1 for on.

    mov  ax,3305h                 ;Get boot drive number.
    int  21h
    push  dl                           ;Output in dl: boot drive: 1=A, 2= B, 3=C, 4=D drive, etcetera.

    mov ah,31h                     ;Terimiate program, and set stay resident .
    int 21h                             ;Return code in al; entry in dx for memory size in paragraphs.

    mov  ah,34h                     ;Get in_DOS flagg address.
    int  21h
    push  es:bx                      ;Ouput in es:bx: address of in_DOS flag.

    mov ah,35h               ;Get interrupt vector: gets content of an interrupt vector , get or read interupt vector address
    mov al, 10h                    ;Entry into al: interrupt vector number.
    int 21h
    push es:[bx]                     ;Output in es:bx: contents of interrupt. es:bx=vector address.

    mov ah,36h                     ;Get disk's free space; returns available free space on specified disk.
    mov dl,0                         ;Entry into dl: drive selector: 0=current drive, 1=A, 2=B, etcetera.
    int 21h
    push ax                    ;Ouput in ax: sectors per cluster, 0FFFFh=disk error if invalid or sectors per cluster in disk, or
    push cx                          ;Output in cx: bytes per sector
    push bx                          ;Output in bx: number of disk clusters
    push dx                          ;Output in dx: number of free clusters: space=cx*ax*bx, free space=cx*ax*dx.

    mov ax,3700h                ;Get current switch character
    int 21h
    push dl                           ;Ouput in dl: current switch character; the switch character is the character
                                ;used to identify switches in instruction paramters.The default character for DOS                         
                                          ;is "/". This character can be altered.

     mov ax,3701h                ;Set new switch character.
     mov dl,56                      ;Entry into dl: new switch character.
     int 21h

     mov  ah,38h                ;Get or set country dependent information: set active country code or return
                                       ;country dependedt information.
     mov  al,0                          ;Entry into al: country identification: 0=current, FFh=use bx, or
     mov  bx,0                         ;entry into bx: country identification; 0=current.
    ;mov  dx,FFFFh                 ;Used to set country information only.
     mov  ds:[dx],CTY_INFO      ;Entry into ds:dx: address CTY of information buffer; get country information only.
     int  21h
     push ax                       ;Return in ax: error code if Cf set. Fromat of buffer at ds:dx:
                                         ;CTY_INFO LABEL BYTE
                                               ;DB       1                     ;Selected country identification.
                                               ;DB       0                     ;Date format: 0=month-day-year, 1=day-month-year,
                                               ;DB  "$",0,0,0,0            ;Currency symbol: "day-month", 0, ?, ?.
                                               ;DB    ",",0                    ;thousands operator,
                                               ;DB    ".",0                    ;decimal separator,
                                               ;DB    "/",0                   ;Time separator,
                                               ;DB    ":",0                    ;position currency number and symbol:
                                                                                   ;0=symbol, value
                                                                                   ;1=value, symbol
                                                                                   ;2=symbol, space, value
                                                                                   ;3=value, space, symbol
                                                                                   ;4=symbol is decimal separator.

    ; lea dx,zz
    mov ah,39h            ;Make a specified subdirectory: MKDIR.
    mov ds:[dx],zz        ;Entry into ds:dx: start address zz of ASCIIZ name or string for directory with a
                                   ; maximum of 128 ; characters and terminated with a null character.
    int 21h
    push  ax                 ;Return in ax: error code carry flag set.

    mov ah,040h         ; 40H writing in file/device. Execute a Progam
                                 ; Entry in ds:dx for poimter to pathname of program to be runned. File pathname defined in data section: "C:\w.exe", and open file.
                                 ; Entry in es:bx for pointer of parameter block.
                                 ; In al: 0 for load and execute, 1 for load only, 3 for load overlay.
                                 ; If carry bit is 1 error code in ax: 1 for invalid function, 2 for file not found, 5 for access denied,
                                 ; 8 for not enough memory, 10 for inadequate envirnoment, 11  for inadequate format.

    mov  ah,3Ah           ;Remove a specified subdirectory: RMDIR.
    mov  ds:[dx],zz       ;Entry into ds:[dx]: start address of ASCIIZ name; ds:dx=address of ASCIIZ string for directory,
    int  21h
    push  ax                 ;Return in ax: error code when carry flag is set.

    mov  ah,3Bh           ;Change current directory of a specified drive: CHDIR.
    mov  ds:[dx],zz       ;Entry in register pair ds:dx: address of ASCIIZ name; ds:dx=address of
                                  ; ASCIIZ string for new directory.
    int  21h
    push  ax                 ;Return in ax: error code when carry flag is set.

    mov  ah,3Ch           ;Make a File. Make a file in specified directory and opens the file for read and write access.
                                 ;Handle: 3CH Create file.
    mov  cx,xx             ;Entry into cx: file attribute xx: bit 0 on in cx for read only or normal, bit 1 on of cx for hidden,
                                 ;bit 2 on for system, bit 3 on for volume label, bit 4 on for reserved, bit 6 setting for file archived
    ;mov pathname,ds:[dx]     ;bit 5 on for archive, bits 6 to 15 are reserved. ds:dx= address of ASCIIZ pathname string
   mov dx, offset pathname 
     ;mov ax,handle
    int  21h
    push  ax                 ;Return or file handle in ax if CF (carry flag) is clear; error code if carry flag CF is set:
                                 ; 3 for path not found, 4=too may open files, 5= access denied
                                 ;0 File is a Read-Only file, 1 File is a hidden file, 2 File is a system file, 3 File is a volume label name 
                                 ;4 File is a subdirectory, 5 File has been archived.
            ;   ds:dx is address of zero terminated pathname, cx is file attribute. The name of the file is specified on an ;
               ;ASCII chain, which has as a characteristic being a conventional chain of bytes ended with a 0 character: 
                               pathname DB "C:\new.txt",0                         < BR>                                handle DW ?
    ;jc ShowError    ;Show error in al if CF=1.

    mov  ah,03Dh           ;
Open a file.
    mov  al,xx              ;Entry into al: access mode xx: bits 2 to 0 has access code: 000 open for for reading, 
                                       ; 001 for write, handle 3DH open file. 002 for reading or writing to file.
                                 ;010 for read or write; bit 3 is reserved; bits 6 to 4 for sharing mode: 000 for
                                 ;compatibility, 001 for deny read or write, 010 for deny write, 011 for deny read,
                                 ;100 for deny none; bit 7 for handle inheritence: 0 for child inherits,
                                 ;1 for child does not inherit. al= 2 to open for reading and writing, al= 0 for reading, al= 1
                                ; for reading, al-2 for reading  and writing to file.
                                  ;  < FONT size= 4> Prepares a for file reading or writing; use function 03Fh next to read this file.
    mov ds:[dx],zz         ;Entry into ds:dx= address of zz (ASCIIZ name). LEA dx,filename. ds:dx is ds or dx.
                                  ; MOV dl,filelabel ;LEA dx,zz.
                                 ; segment offset of asciiz path name in ds and dx.    
                                ;segment offset of asciiz pathname, asciiz is strig with an 0 at end.  
    int  21h
    mov filehandle,ax        ;Return in ax: error code if CF is set (CF=1): 3=path not found,
                                   ; 4=too many open files, al= 2= file not found, 5=access denied
                                  ; or file handle if CF is clear. MOV filehandle,ax if carry flag CF= 0. FFH in ah means file not found.

                                ;At .data section for Windows: Filename_2 DB "C:\test.txt",0,128  
                                         filehandle DW ? .
   mov ax,@data           ;Base address of data segment
   mov ds,ax                            ;put this in ds
   mov dx,OFFSET Filename_2      ;put state address of filename in data section in dx ,
   mov al,2                               ;access mode: 2=read and write,
   mov ah,3Dh                           ;function 3Dh for open a file, 
   int 21h                                ;call DOS service.

    mov  ah, 3Eh          ;Close a file handle: forces the physical write of buffered data, updates the file's
                                 ;directory and frees the file handle. Handle: 3EH close file driver.
    int  21h
    push  ax                ;Return in ax: error code if CF is set.

Read From A file
   mov ax,@data          ; Start of data memory segment into ax with Turbo Assembler 5.
   mov ds,ax                ; Transfer address of .DATA memory segment into ds. 
   mov ah,3Fh              ;Read from a file or device: performs read from an open file at curent file pointer
                                  ;location by reading the number of bytes specified into a buffer.
                                            ; Must first open a file with function 3dh. Handle: 3FH reading from file/device.
    ;mov bx,OFFSET buffer      ;Entry in dx: file handle zz= buffer into dx. Number of device into bx.
                                            ; Offset OFFSET (start of buffer) in memory segment. ds:dx points to filename.
    mov cx,xx                      ;Entry into cx: number of bytes xx to read. Use with loop loop_2
   ; mov ds:[dx],cc                ;Entry into ds:dx: address cc (of first byte of storage area) of buffer; ds:dx=buffer address
    mov dx,OFFSET buffer       ;ax=number of bytes read, ax=0, if  read  from end of file.                               < BR>                                          ;lea dx,buffer, ;ax=01h for mising file sharing software,
                                    ;ax=02h for file not found, ax=03h for path not found or file does not exist,< BR>                                              ; ax=04h for no handle available
                                    ;ax=05h for access denied, ax= 0ch for access more not permitted.< BR>                                      ;Front characters in buffer is file name.
   mov dx,OFFSET filename 
   int   21h
   mov filehandle,ax   ;Return in ax as error code if Cf is set (bit 1) or gives number of bytes read if CF is clear.
                                 ; jc error_codes

Write To A File
    mov ah,40h       ;Write to a file or device: performs a write to an open file at the current file pointer
                             ;location by writing the number of bytes specified from a buffer. File must first be opened with 03ch.
    mov bx,zz              ;Has same inputs and return as 3Fh. bx= file handle zz, path of cummunicationin bx
    mov cx,xx                      ;cx=number of bytes to write; same size as buffer cc.  
    mov ds:dx,offset cc              ds:dx= buffer cc address,            
    ; mov dx,offset buffer    ; address of the begining of data to write, write content of buffer into file.
    int 21h
    push  ax                 ;ax=number of bytes written. cf= 0 with no mistakes, ax may have error
                                ; code or number of bytes writen.

Delete A File
    mov  ah,41h            ;Delete a file: deletes a file from the specified directory.
    mov  ds:[dx],zz        ;Entry into ds:dx: address zz of ASCIIZ name. ds:dx=address of ASCIIZ string.
    int  21h
    push  ax                  ;Return in ax: error code if CF is set.

                                    ;Seek (move file pointer)                                     
    mov  ah,42h             ;Seek (move file pointer) move file read or write pointer in a random access file.
    mov  al,xx                ;Entry into al: location choice xx: 00h for cx:dx to beginning of file, 01h for add
                                   ;cx:dx to last access offset, 02h for add cx:dx to end of file. Absolute file position in al.
                                   ;42H move pointer of reading/writing in file  
    mov  bx,zz               ;Entry into bx: file handle zz.
    ;assume cx:DGROUP  ; Assign data section DGROUP to register cx.
    mov  cx:[dx],cc         ;Entry into pair cx:dx: file offset cc. File handle in dx.
    int   21h
    push ax                    ;Return in ax: error code if CF is set.
    push  dx:[ax]            ;Return in dx:ax: new file position.

    mov ax,@data
    mov ds,ax
    mov ah, 43h                      ;Get file attribute.
    mov al, 0                           ;ds:dx=address of ASCIIZ string for file.
    mov dx,OFFSET string2   ;address of first byte of string2
    int 21h
                                            ;Return cx= attribute.
    mov ah,45h             ;Duplicate an open file handle.
    mov bx,zz               ;Existing file handle zz.
    int 21h
    push ax                   ;Return in ax: error code if CF is set or new file handle.

   mov ah,46h              ;Force duplicate file handle: duplicates a source handle
                                    ; reference to another target                                            
                                    ;handle. If arget handle is open it is closed prior to being replaced.
   mov bx,zz                ;Source file handle zz,
   mov cx,xx                ;target file handle xx.
   int 21h
   push ax                    ;Return in ax: error code if CFis set.

   mov ah,47h              ;Get current directory: returns current directory of specified drive.
   mov dl,zz                 ;Drive number zz: zz= 0forcurrentdrive,zz=1=A drive, etecera; ds:si=address of 64 byte buffer.
   int 21h
   push  ax                    ;Return in ax: error code if CF is set; return in ds:si=address of ASCIIZ  string.

  mov ah,48h            ;Allocate memory: returns the address of a contiguous block of system memory.
                               ; One paragraph is 16 bytes.
  mov bx,zz              ;Entry into bx: number of paragraphs requested. Block size in paragraphs
  int 21h
  push ax                   ;Return in ax: error code if CF is set to 1 or segment of memory block. Return in
                                 ;ax=segment address of allocated memory. Ax points to allocated memory block if carry is 0
                                 ;Carry is 1 for bx=maximum possible allocation size and ax witherror code in 7, 8..
  push  bx                  ; Return in bx: available paragraphs.

  mov ah,49h             ;Free allocated  memory block, deallocate memory: releases the specified allocated memory block.
  mov bs,zz               ;Segment of memory to release.
  mov es,xx                ;Segment address xx of memory to be free. es:0 for address block deallocated; must be returnd by function 48h.
  int  21h
  push  ax                  ;Return in ax: error code if CF is set.

  mov  ah,4Ah         ;Modify allocated memory blocks: is used to change the size 
                              ; of an allocated block of memory. Set block
  mov bx,zz            ;Entry into zz: new size zz in paragraphs. bx= nember of paragraphs; sizeof new block
  mov es,xx            ;Segment of memory to change. es= segment address of memory for address of block
                             ;to modify allocation size.
  int 21h
  push ax               ;Return in ax: error code if CF (carry) is set: ax conteains error codes in 7, 8, 9, bx contains the maximum possible size..
  push bx               ;Return in bx: available paragraphs.

  mov ax,4B00h      ;Execute a program: loads and begins execution of a child program without terminating
                               ;current program. Dos kernel program load and/or execute a program.
                               ; Try 4Bh into ax. If 4Bh  for load and execute a program is used 4Bh in ah, al=0.
                               ;For load overlay is al=3, al=0  is load into main memory and< BR>                                ; execute program, al=01h load but do not execute, al=04h is
                               ; load and execute in background; ah=4bh                               
  mov es:[bx],zz         ;Address zz of parameters. es:bx=address of parameter block.
  mov ds:[dx],xx        ;Entry into ds;dx: address xx of ASCIIZ program name,  include.EXE or
                               ; .COM after program name
                               ;must be provided. cx contains mode: 0000h for child program in sleep mode after termination,
                               ; 0001h is child's return code discarded or terminated. CF=0 if successful, < BR>                                ; CF=1 if error with error in ax.
                               ; If subfunction is 01h, process identification set to new programs PSP 
                               ; with int 21h function ah= 62h.
  int 21h
  push  ax                ;Return in ax: error code if CF is set. Format of the buffer at es:bx:

                                  ;zz  dw               ;environment segment
                                      ;  dd               ;instruction line address
                                      ;  dd               ;FCB1 address
                                      ;  dd               ;FCB2 address.

  mov  ax,4B01h       ;Load a program: loads a child program without terminating the current program without
                               ;beginning execution.
  mov es:[bx],zz        ;Address zz of parameters, start address of zz into dx.
  mov ds:[dx],xx        ;Entry into ds:dx: address xx of ASCIIZ name, .EXE or .COM must be provided.
  int  21h
  push ax                  ;Return in ax: error code if CF is set. Format of the buffer at ex:bx:
                                  zz   dw ?             ;environment segment
                                        dd 0             ;instruction line address
                                        dd 0             ;FCB1 address
                                        dd 0             ;FCB2 address
                                        dd 0             ;returned cs:ip value
                                        dd 0             ;returned ss:sp value.

  mov ax,4B03h       ;Load an overlay into memory without beginning execution of a program.
  mov es:[bx],zz       ;Entry into es:bx: address of paramemters.
  mov ds:[dx],xx       ;Address of ASCIIZ name.
  int 21h
  push ax                 ;Return in ax: error code if CF is set. Format of the buffer ar es:bx:
                                 ;zz  DW                 ;overlay load segment address,
                                        DW                 ;overlay relocation factor for .EXE files.

To dos
  mov ah,4Ch          ;Terminate a process or exit dos: is used to end execution of the current program and returns; 
                              ; exit dos for video mode, 
                              ;return to operating system shell, required function 02h text output.
  int 21h                  ;control to the parent program. Return code in al.
  push al                 ;Return  in al: return code zz.

 mov ax,4C00h      ;Return control to dos,
                               ;return to operating system shell, required function 02h text output.
  int  21h                 ;control to the parent program. Return code in al.
  push  al                 ;Return in al: return code zz.

  mov  ah,4Dh          ;Get return code of a subprocess or child, or wait: retrieves the user control code defined
                              ;during a terminate process ah=4Ch with int 21h.
  int  21h
  push  ah                ;Return in ah: exit type: 0 for normal exit, 1 for Ctrl+Break termination, 2 for critical
                              ;error termination, 3 for terminate and stay resident.
  push  al                 ;Return in al: return code. return in ax=return code process.

  mov  ah,4Eh          ;Find first matching file: searches for the first match of the specified file in specified
  mov  cx,zz            ;Entry into cx: file attribute zz: bit 0 for read only, bit 1 for hidden, 2 for system, 3 for
                              ;volume label, 4 for directory, 5 for archive, bits 6 to 15 are reserved.
  ;mov  ds:dx,xx        ;Entry into ds:dx: address xx of ASCIIZ name in .DATA section. Wildcard characters "*", "?".
  mov ax,@data
  mov ds,ax               ;ds part of ds:dx
  mov dx,OFFSET filename
  int  21h
  push  ax                ;Return in ax: found file information.

  mov  ah,4Fh           ;Find file; Find next matching file: searches for the next matching file; find next file in directory.
  mov  DTA              ;Restart information.
  int  21h
  push  ax                ;Return in ax: eror code if CF is set.
  push  DTA             ;Return: found file information. Format of the buffer at the DTA in .DATA segment:
  mov si,OFFSET DTA+30  ; Point to file name in DTA. DTA is disk transfer address.
                                 ;DTA    DB   21 DUP(0)          ;reserved,
                                    ;       DB   ?                         ;file attribute,
                                    ;        DW  ?                       ;file time,
                                    ;        DW  ?                       ;file date,
                                    ;        DD   x                        ;file size x,
                                    ;        DB "filename.EXE",0  ;file name.

   mov ah, 54           ;Get verify state
   int 21h                   ;Return in al is 0 if verify is off, or 1 if verify is on.

                               ;Rename A File
  mov  ah,56h          ;Rename or move a file or rename a directory: used to rename and/or move a file to
                              ;different directory on the same disk. In addition, it is possible to rename a directory
                              ;with this function.
  mov ds:[dx],zz       ;address zz of previous ASCIIZ name in dx, lea dx,zz.. The xx and  zz declared in .DATA section.
  mov es:[di],xx        ;address xx of new ASCIIZ name into es and di. lea di,xx
  int 21h
  push  ax                ;Return in ax: error code if CF is set.

  mov ax,5700h     ;Get a file's date and time stamp.
  mov bx,zz           ;File handle zz into bx.
  int 21h
  push ax               ;Return in ax: error code if CF is set,
  push cx               ;Return in cx: file time: bits 4 to 0 for 0 to 29 units of 2 seconds day, bits 8 to 5 for
                             ;0 to 59 minutes, 15 to 11 for 0 to 23 hours,
  push dx               ;Return in dx: bits 4 to 0 for 1 to 31 day, bits 8 to 5 for 1 to 12 month, bits 15 to 9
                             ;for year as 1980 to 2099.
  mov  ax,5701h      ;Set File's Date and Time
  mov  bx,zz           ;file handle zz,
  mov cx,time          ;time bits same as in 5700h,
  mov  dx,date        ;date bits same as in 5700h.
  int  21h
  push  ax               ;Return in ax: error code if CF is set.
  mov  ax,5800h      ;Get Current File Allocation Method
  int  21h
  push ax                 ;Return in ax: error code if CF is set.
  push  al,zz             ;Return in al: current allocation method: zz=0 for allocate low, zz=1 for allocate best,
                               ;zz=2 for allocate high.

  mov  ax,5801h      ;Set the new memory allocation method.
  mov  bl, zz             ;Allocation method: zz=0 for allocate low, zz=1 for allocate best, zz=2 for allocate high.
  int  21h.
  mov  ah,59h          ;Get extended error information: used to get additional information concening errors
                              ;returned during the execution of a DOS int 21h function invocation. Information returned
                              ; from this call includes the error, error class, suggested action, and error location.
  mov  bx,0
  int  21h
  push  ax                ;Return in ax: true error code, extended code
  push  bh                ;return in bh: error class,
  push  bl                 ;return in bl: error action, suggested action.
  push  ch                ;return locus.
  mov ah,56h          ;Rename or move a file:rename a directory: used to rename and/or move a file to a
                              ;deifferent directory on the same disk.
  mov ds:[dx],zz      ;Entry into ds:dx: address zz of previous ASCIIZ name.
  mov es:[di],xx       ;Entry into es:di: address xx of new ASCIIZ name
  int 21h
  push ax                ;Return in ax: error code if CF is set.

  mov ax,5700h       ;Get a file's date and time: used to get a file's date and time stamp.
  mov bx,zz             ;Entry into bx: file handle zz. mov bx,OFFSET zz
  int  21h
  push  ax                 ;Return in ax: error code if CF is set.
  push  cx                 ;Return in cx: file time: range and meaning: bit 4 to 0 for 0 to 29 units of 2 seconds,
                               ;bits 10 to 5 for 0 to 59 minutes, bits 15 to 11 for 0 to 23 hours.
  push  dx                 ;Return in dx: file date: range or meaning: bits 4 to 0 for 1 to 31 day, bits 8 to 5 for
                               ;1 to 12 month, bits 15 to 9 for 0 to 119 as 1980 to 2019 year. 

  mov  ax,5701h        ;Set file's date and time: used to set file's data and time stamp.
  mov  bx,zz             ;Entry into zz: file handle zz.
  mov  cx,xx             ;Entry into cx: file time bits xx same as in  5700h.
  mov  dx ,zz            ;Entry into dx: file date bits zz: same as in 5700h.
  int  21h
  push  ax                 ;Return in ax: error code if CF is set.

  mov  ah,67h            ;Set handle count: is used to set desired number of file handles from 20 to 32767 per
  mov  bx,zz              ;Entry into bx: new file handle count zz.
  int  21h
  push  ax                  ;Return in ax: error code of CF is set.

  mov  ah,68h            ;Commit file: is used to force the physical write to a device of buffered sata and
                                ;directory associated with a file handle.
  mov  bx,zz              ;Entry into bx: file handle zz.  
  int  21h
  push  ax                  ;Return in ax: error code if CF is set.   

  mov  ax,5D07h       ;Get print stream state: gets the current netwrok print stream state.
  int  21h
  push  ax                 ;Retrun in ax: error code if CF is set.
  push  dl                  ;return in in dl: print stream state; 0 for truncation is off, 1 for truncation is on.

  mov  ax,5D08h       ;Set print stream state: sets a new network print stream state.
  mov  dl, zz             ;Entry into dl: zz=0 for truncation is off, zz=1 for truncation is on.
  int  21h
  push  ax                 ;Return in ax: error code if CF is set.

  mov  ax,5D09         ;Truncate print stream: truncates network print streams
  int  21h
  push  ax                  ;Retrun in ax: error code if CF is set.

  mov  ax,5D0Ah       ;Set extended error information: sets the DOS extended or additional error information
                               ;concerning errors returned during execution of a DOS int 21h function call.
  mov  ds:[dx],zz       ;Address of DPL zz.
  int  21h
  push  ax                 ;Return in ax: error code if CFis set.
  mov  ax,5E00h       ;Get machine name: function is used to determine the computer name.
  mov  ds:[si],xx        ;Entry into ds:si: address xx of name buffer.
  int  21h
  push  ax                 ;Return in ax: error code if CF is set.
  push  ch                 ;Return in ch: name flag:bit 0 for 0=no name set, 1=name set.
  push  cl                  ;Return in cl: NETBIOS name number when ch bit 0 is 1. Format of the buffer at ds:si:
                                    ;xx  DB   "computer name ", 0  :15 character ASCIIZ string.

  mov  ax,5E01h       ;Set machine name: used to establish the computer name.
  mov  cl,zz              ;Entry into cl: NETBIOS name number zz.
  mov  ds:si, xx         ;Entry into ds:si: address of name.
  int  21h
  push  ax                 ;Return in ax: error code if CF is set. Format of the buffer at ds:si:
                                 ;xx   DB   "computer name",0   ;15 character ASCIIZ string.

  mov  ax,5E02h       ;Set printer setup: used to set a unique printer mode when multiple users are accessing
                               ;the same printer.
  mov  bx,zz             ;Redirection index zz.
  mov  cx,xx             ;String length xx.
  mov  ds:si,cc           ;Addtess cc of string.
  int   21h
  push  ax                 ;Return in ax: error code if CF is set.

  mov  ax,5E03h       ;Get printer setup: gets current printer setup string.
  mov  bx,zz             ;Redirection index zz.
  mov  ds:si,xx          ;Address xx of buffer.
  int  21h
  push  ax                ;Return in ax: error code if CF is set.
  push  cx                ;Return in cx: string length.

  mov  ax,5E04h      ;Set printer mode: used to set the current printer text or binary mode.
  mov  bx,zz            ;Redirection index zz.
  mov  dx,xx            ;Print stream mode: print stream mode: bot 0 for 0=print stream is text data,
                              ;1=print stream is binary data.
  int  21h
  push  ax                ;Return in ax: error code if CF is set.  

  mov  ax,5E05h      ;Get printer mode: used to get current printer text or binary data.
  mov  bx,zz            ;Redirection index zz.
  int  21h
  push  ax               ;Return in ax: error code if CF is set.
  push  dx               ;Return in dx: print stream mode: bit 0 for 0= text mode, 1=binary mode. 

  mov  ax,5F00h      ;Get redirection mode.
  mov  bl,zz             ;Redirerction type: zz=3 selects printers, 4 selects drives.
  mov  bh,xx            ;Redirection state: xx=0 for redirection off, xx=1 for redirection on.
  int  21h
  push  ax                ;Return in ax: error code if CF is set.
  push  bh                ;Return in bh: redirection state: 0=redirection off, 1=redirection on.

  mov  ax,5F01h       ;Set redirection mode: set a new redirection mode: when off the redirection of a
                              ;device is paused, when on the redirected local device is used.
  mov  bl,zz             ;Redirection type: zz=3 selects printers, 4=selects drives.
  mov  bh,xx            ;Redirection state: xx=0 for redirection off, xx=1 for redirection on.
  int  21h
  push  ax                ;error code if CF is set.

  mov  ax,5F03h      ;Redirect a device: used to connect a local device across a network by establishing a
                              ;redirector to server association.
  mov  bl,zz             ;Device type: zz=3 for device is a printer, zz=4 for device is a disk drive
  mov  cx,0                            ;User value set to 0.
  mov  ds:[si],NET_DEVICE   ; Address of device.
  mov  es:[di],xx                     ;Address xx of network definition.
  int  21h
  push  ax                ;Return in ax: error code if CF is set.
     NET_DEVICE   DB  "PRN",0                   ;1 to 8 characters: PRN, LPT1, LPT2, or LPT3.
     NET_DEST      DB  "\\computer name or drive name", 0 
                             DB  "password",  0           ;1 to 8 character password.

    NET_DRIVE    DB     'f:',0         ;1 character name,
    NET_DEST      DB   "\\computer or drive name",0
                           DB  "password",0                ;1 to 8 character password.

   mov ah,62h         ; Get PSP, PSP contains command line arguments starting at 54h from end of 
                             ; string  in Windows XP.
   int 21h                ; Return in bx=segment address of PSP.
  lea dx,address      ; Symbol: address in .DATA segment. Start location (offset) of "address" into register dx.
 ; mov dx,ds:[bx]   

  mov ax,xx              ;Turns text into uppcase letters: xx=6520h for capitalize dl, xx=6521h for capitalize  
                               ;fixed string, xx=6522h for captialize ASCIIZ string.
  mov dl,zz              ;caharcter zz for funtion 6520h only.
  mov cx,cc              ;String length cc for funtion 6521h only.
  mov ds:[dx],vv          ;Address vv of string for funtion 6521h or 6522h only.
  int  21h
  push  ax                 ;Return in ax: eror code if CF isset.
  push  dl                  ;Return in dl: capitalized character for funtion 6520h only.

  mov  ax,6523h        ;Yes or no check: used to determine if a character indicates a yes or no response.
  mov  dl,zz               ;Character zz.
  mov  dh,xx              ;Second character only if DBCS= double byte character support..
  int  21h
  push  ax                  ;Return in ax: CF set = not yes or no, 0=no, 1=yes.

    mov rr,dx                  ;Examples for storing into variables like rr, or ww.
    mov ww,ds

   mov ah, 54h      ; Get verify state in al: returns current state of write verfiy flag: 0=for off, 1 is for on.
   int   05h                    ;Interrupt 05h: print-screen service

                                    ;Obtain amount free space that is available on floppy disk drive A.
   mov   ah,36h               ;Entry in ah: function 36h.
   mov   dl,1                    ;Entry in dl, drive specification:  0=default, 1=drive A: want free space in drive A=1.
   int    21h                     ;Start 36h: invoke interupt.
   cmp   ax, 0ffffh           ;Test return code for error.
   je     err_rtn               ;Specified drive is invalid, if error is indicated branch to this error handler subpgrogram err_rtn .
   mov  sec_clu,ax           ;Return value is ax; sectors or clusters or FFFFh if drive
                                      ; specification is invalid; save                                    
                                              ;sectors per cluster in variable sec_clu.
   mov   avl_clu,bx          ;Return in ax; available clusters or free space: save available cluster in avl_clu.
   mov   byt_sec,cx         ;Reurn in cx; number of bytes or sector,save bytes per sector in variable byt_sec.
   mov   xx_h,dx             ;Return in dx: clusters or drive.

 mov ah,3Ch          ;Make a file.
  int 21h
  mov ah,5Bh          ;Make a new file and fail if file exists.
  mov ah,5Ah          ;Make a unique file.

  mov ah,3Dh          ;Open file.

  mov ah,6Ch          ;Extended open and make file: combines services of funtions
                              ;3Dh, 3Ch and 5Bh.

  mov ah,3Eh          ;Close file.

  mov ah,41h          ;Delete a file from a specific directory.

  mov ah,45h          ;Get new duplicate file handle.

  mov ah,43h          ;Change file mode.

  mov ah,46h          ;Force duplication of existing file handle.

  mov ah,4Eh          ;Find first matching file.

  mov ah,4Fh          ;Find next matching file.

  mov ah,56h          ;Rename a file.

  mov ah,57h          ;Get or set a file's date and time.

  mov ah,67h          ;Set file handle count.

  mov ah,68h          ;Clear file data and update directory entry.

 Int 31h Direct Memory Access

Dos protected mode interface.
mov ax,0002h  ; supply a segment, returns a selector for segment address in bx, selector return in ax                 ; segment address of video ram into bx
                           ; in protected mode. Video graphics accelerator vga start address
                           ; a000h:0000h=es:bx , ports 35h, 3c4h, or 3c5h.

mov ax,a000h
mov es,ax
mov bx,0000h
in 35h

                          Int 33h Mouse Input Device DOS Functions
   mov ax,0               ;Reset mouse (screen cursor control) function, initialize mouse .
   int 33h                   ;0 into ax if there is no mouse connection.
   mov ax,bx              ;Number of mouse butons into ax from bx

   mov ax,01h               ;Turn on mouse. Display text mode mouse cursor.
   int 33h
   mov ax,02h               ;Remove text mode cursor from screen.
   int 33h  

   mov ax,03h               ;Get mouse position and button status
   int 33h               
   mov ax,bx              ;Return button status from bx into ax, 1 for left button press, this may not work in Windows XP.
                                ; 2 for right mouse button press, 4 for center button press returned in bx.
   mov bx,x                           ;Return x=[EBP+8] mouse position
   mov WORD PTR [bx],cx   ;from cx.
   mov bx,y                          ;Return y= [EBP+12] mouse position .
   mov WORD PTR [bx],dx   ;from dx.

February 2004; page revised on February 19, 2012.