¦b³o¤@³¹ùØ¡A¤p¤ì°¸±N¼¶¼g¤@Ó¥i¥H§â¤T¤S¤G¤À¤§¤@^¦T³nºÐªººÏ°Ï¨Ï¥Î±¡§Î¡AÅã¥Ü¦b¿Ã¹õ¤Wªºµ{¦¡¡A§ÚºÙ¤§¬°ºÏ¤ù¦a¹Ï¡A³oÓµ{¦¡ªºì²z«e¤@³¹¤w¸g¸Ôz¹L¤F¡A±z¥i¯à±oÀH®É°Ñ¦Ò«e¤@³¹¡C¥ý»¡©ú³oÓµ{¦¡·|¥Î¨ìªº¤¤Â_ªA°Èµ{¦¡¡C
³o¨âÓ¬O DOS ©Ò´£¨ÑªºªA°Èµ{¦¡¡AINT 25H ªº¥\¥Î¬OŪ¨úµ´¹ïºÏ°Ï¡A¦Ó INT 26H ¬O¼g¤Jµ´¹ïºÏ°Ï¡C©Ò¿×µ´¹ïºÏ°Ï´N¬O«e³¹©Ò»¡ªºÅÞ¿èºÏ°Ï¡A¥H 1.44MB 3.5 ^¦T³nºÐ¤ù¨Ó»¡¡A¥Ñ½s¸¹ 0 ¨ì½s¸¹ 2879 ºÏ°ÏÁ`¦@¦³ 2880 ӺϰϡC¦ý¤U±©Ò´£¨ìªº INT 25H/26H ªA°Èµ{¦¡¨Ã¤£©ó³nºÐ¡AµwºÐ¤]¥i¨Ï¥Î¡C
·í©I¥s INT 25H ¤¤Â_¤§«e¡AAL ¥Nªí±ýŪ¨úºÏºÐ¾÷¡A0 ªí¥Ü A: ºÏºÐ¾÷¡A1 ªí¥Ü B: ºÏºÐ¾÷¡A2 ªí¥Ü C: ºÏºÐ¾÷¨ä¾l¨Ì¦¹Ãþ±À¡ACX ªí¥Ü±ýŪ¨ú¤§ºÏ°Ï¼Æ¡ADX ªí¥Ü±ýŪ¨ú¤§¶}©lºÏ°Ï½s¸¹¡A¦Ó DS:BX ¬Oªí¥Ü¥ÑºÏ¤ùŪ¥X¤§¸ê®Æ¦s©ñªº¦ì§}¡C§â¤Wz AL¡NBX¡NCX¡NDX¡NDS ³]©w¦n¤§«á©I¥s INT 25H °õ¦æ¡A°²¦pŪ¨ú¦¨¥\«h¶i¦ìºX¼Ð·|³Q²M°£ (NC)¡A§_«h¶i¦ìºX¼Ð·|³Q³]©w (CY)¡A³o®É AH ¬°¿ù»~½X¡A¦p¤Uªí¡G
80H ¦^À³¥¢±Ñ 10H ¸ê®Æ¿ù»~ 03H ¼g¤J«OÅ@ 40H ´M§ä°Ê§@¥¢±Ñ 08H DMA ¿ù»~ 02H ¤£¨}¦ì§}°O¸¹ 20H ±±¨î¾¹¬G»Ù 04H §ä¤£¨ìºÏ°Ï 01H ¤£¨}©R¥O
°²¦p±z¥Î INT 25H ¦b Win 9x/Me ¤¤Åª¨ú FAT32 ¤À³Î¡A«h¦¹®É¶i¦ìºX¼Ð¤]·|³]©w¡A¨Ã¥B AX=0207H¡C
¦ý¬O¥H«ez¤§¤è¦¡Åª¨úºÏ°Ï¦³Ó¤j¯ÊÂI¡A¦] DX ³Ì¦h¥u¯à¦³ 16 ¦ì¤¸¡A©Ò¥H³Ì¦h¥u¯àŪ¨ú 0FFFFH ӺϰϽs¸¹¡C¥Ñ¨CºÏ°Ï¦³ 512 Ӧ줸²Õ¡A´«ºâ¦¨ºÏºÐ®e¶q¡A³Ì¦h¥u¯à³B²z 32MB ¥H¤UªººÏºÐ¡A¦ýÀHµÛµwºÐ¶V¨Ó¶V¤j¡AÅãµM³oӨ¶·¬ð¯}¡A¨ì¤F DOS 3.31 ¤§«á¡AINT 25H «·s§ï¼g¡A¥¦ªº¿é¤J¼È¦s¾¹µy¦³¤£¦P¡C°²¦p CX ¤§È¤£¬° 0FFFFH¡A«h©I¥s¤è¦¡¦p¦P«ez¡F°²¦p CX ¤§È¬° 0FFFFH¡A«h DS:BX ¤£¬O«ü¦V¸ê®Æ¦s©ñ³B¡A¦Ó¬O«ü¦V¤@¶ô 10 Ӧ줸²Õªº°O¾ÐÅéªÅ¶¡¡A³o¶ô°O¾ÐÅéªÅ¶¡¤~¬O¥Nªí¯u¥¿ªº¿é¤J°Ñ¼Æ¡C¦¹°O¾ÐÅéªÅ¶¡ªº«e¨âÓ¦r²Õ¥Nªí±ýŪ¨ú¤§¶}©lºÏ°Ï½s¸¹¡A±µ¤U¨Óªº¤@Ó¦r²Õ¬°±ýŪ¨ú¤§ºÏ°Ï¼Æ¡A¦A¤U¨Óªº¨âÓ¦r²Õ¬°¦s©ñ¦ì§}¡C¦p¤Uªí¡G
dd ? ;sector number dw ? ;number of sectors to read dd ? ;transfer address
DD ªº·N«ä©M DB¡NDW Ãþ¦ü¡A¬O©w¸q 2 Ó¦r²ÕªºªÅ¶¡¡A¤]´N¬O 4 Ӧ줸²Õ¡A¤¤¤åºÙ¬°¡yÂù¦r²Õ¡z¡C¦pªGªí¥Ü¦ì§}¡A°ª¦ì§}ªí¥Ü°Ï¬q¡A¦ý¬O«o¼g¦b«á±¡C
INT 26H ¬O¥Î¨Ó§â¸ê®Æ¼g¤JºÏ°Ïªº¡A¨ä¿é¤J°Ñ¼Æ¤è¦¡©M INT 25H ¬Û¦P¡A¤]¬O¤À¦¨¨âºØ¡A´N¤£ÂØz¤F¡C
¨ì¤F Win 9x/Me ªº®É¥N¡A«h¬O¥Î AX=7305H/INT 21H ¨ÓŪ¼g FAT32 ªººÏ°Ï¡C¨ä¿é¤J°Ñ¼Æ¬° AX ¥²©w¬O 7305H¡ACX ¥²©w¬O 0FFFFH¡CDL ªí¥Ü±ýŪ¼gªººÏºÐ¾÷¡A1 ªí¥Ü A: ºÏºÐ¾÷¡A2 ªí¥Ü B: ºÏºÐ¾÷¡A3 ªí¥Ü C: ºÏºÐ¾÷¡K¡K¡A¦¹³B©M INT 25H/INT 26H ¤£¦P¡CDS:BX ¤]¬O«ü¦V¤@¶ô©MºÏ°Ï½s¸¹¡NºÏ°Ï¼Æ¡N¶Ç°e¦ì§}¦³Ãöªº°O¾ÐÅéªÅ¶¡¡A©M¤Wz INT 25H/INT 26H ¬Û¦P¡CSI ¬O¥Î¨Óªí¥ÜŪ©Î¼gªººX¼Ð¡A¨ä·N¸q¦p¤U¡G
¦ì ¤¸ ´y z 00 0 ªí¥ÜŪ¨ú¡A1 ªí¥Ü¼g¤J 12-01 «O¯d¡AÀ³¬° 0 14-13 Ū¨ú®ÉÀ³¬° 00 ¼g¤J®É 00 ªí¥Ü¥¼ª¾ªº¸ê®Æ 01 ªí¥Ü¼g¤J¸ê®Æ¬° FAT 10 ªí¥Ü¼g¤J¸ê®Æ¬°¥Ø¿ý¸ê®Æ 11 ªí¥Ü¼g¤J¸ê®Æ¬°Àɮ׸ê®Æ 15 «O¯d¡AÀ³¬° 0
¥»µ{¦¡¥Î¨ì´XÓ INT 10H ªº¤¤Â_ªA°Èµ{¦¡¡A¦¹ªA°Èµ{¦¡¬O BIOS ©Ò´£¨Ñªº¡A¥¦³B²z©M¿Ã¹õ¦³ÃöªºªA°È¡A¸Ô²Ó±¡§Î¨£ªþ¿ý¤C¡A¦¹³B»¡©ú AH=2¡NAH=6¡NAH=9 ªº¥Îªk¡A°Ñ¦Ò¤Uªí¡G
¥Øªº | AH | ¿é¤J | ¿é¥X |
±N´å¼Ð©w¦ì©ó¿Ã¹õ¤W | AH=2 | BH=Åã¥Ü¶ DH=¦C (Y®y¼Ð) DL=¦æ (X®y¼Ð) |
µL |
¨Ï¤@Óµøµ¡(¬Y¤@Ó«ü©wªº¯x§Î½d³ò)¤ºªº¤å¦r¦V¤W±²°Ê | AH=6 | AL=±²°Ê¦C¼Æ(AL=0®Éªí¥Ü¾ãÓµøµ¡³Q²M°£) BH=±²°Ê«á¤U±¶ñ¤JªÅ¥ÕªºÃC¦â CX=¸Óµøµ¡¥ª¤W¨¤¦ì¸m ¡@¡@CH=¦C (Y®y¼Ð)¡ACL=¦æ (X®y¼Ð) DX=¸Óµøµ¡¥k¤U¨¤¦ì¸m ¡@¡@DH=¦C (Y®y¼Ð)¡ADL=¦æ (X®y¼Ð) |
µL |
¦b²{¦b´å¼Ðªº¦ì¸mÅã¥Ü ASCII ¦r¤¸ | AH=9 | AL=ASCII ¦r¤¸ BH=Åã¥Ü¶ CX=±ýÅã¥Ü¦r¤¸¼Æ BL=¦r¤¸ÄÝ©Ê |
µL |
¤Wªí¤¤ªº¦r¤¸ÄÝ©Ê¡A«üªº¬OÃC¦â¡A¦pªG¬O¦b³æ¦â¿Ã¹õ¬O«ü¦³¨S¦³©³½u¡N°{Ã{ªº·N«ä¡C¦ý¬O²{¦b¤w¨S¦³¤HÁÙ¦b¥Î³æ¦â¿Ã¹õ¡A©Ò¥H¤p¤ì°¸¶È¤¶²ÐÃC¦â¡CÃC¦â¤À¬°«e´º»PI´º¡A¦b DOS ¤å¦r¼Ò¦¡©³¤U¡A¥u¥i¥HÅã¥Ü¤Q¤»ºØÃC¦â¡A©Ò¥H¥Î 4 Ӧ줸´N¨¬°÷¤F¡C«e´º¬O«ü¦rªºÃC¦â¡A¬O¥Î¸û§Cªº¥|Ӧ줸ªí¥Ü¡FI´º¬O«ü¡y¯È¡zªºÃC¦â´N¬O¦r¥H¥~ªºÃC¦â¡A¥H¸û°ªªº¥|Ӧ줸ªí¥Ü¡C©Ò¥H¦pªG¦r¤¸Äݩʬ° 40H¡A°Ñ¦Ò¤Uªí±oª¾¦¹¦r¤¸¬O¬õ©³¶Â¦r¡C
ÃC¦â | ¼ÆÈ | ÃC¦â | ¼ÆÈ | ÃC¦â | ¼ÆÈ | ÃC¦â | ¼ÆÈ | |||
¶Â¦â | 0 | ¬õ¦â | 4 | ²`¦Ç¦â | 8 | ²H¬õ¦â | C | |||
ÂŦâ | 1 | µµ¦â | 5 | ²HÂŦâ | 9 | ²Hµµ¦â | D | |||
ºñ¦â | 2 | ´Ä¦â | 6 | ²Hºñ¦â | A | ¶À¦â | E | |||
«C¦â | 3 | ¦Ç¦â | 7 | ²H«C¦â | B | ¥Õ¦â | F |
¦b DOS ¤å¦r¼Ò¦¡©³¤U¡A¦³½s¸¹ 0 ¨ì 3 Á`¦@¥|ÓÅã¥Ü¶¡A¤@¯ë§Ú̥νs¸¹ 0 ªºÅã¥Ü¶§Y¥i¡C
©³¤U¬OºÏ¤ù¦a¹Ïªºì©lµ{¦¡¡A¤p¤ì°¸±N¥¦©R¦W¬° DISKMAP.ASM¡G
sector_bytes equ 512 ;01 ¨CºÏ°Ï©Ò§t¦ì¤¸²Õ¼Æ start_y equ 1 ;02 ¥Ñ¿Ã¹õ²Ä¤@¦C¶}©l¦L packet struc ;04 µ´¹ïºÏ°ÏŪ¨ú±±¨î°Ï¶ôµ²ºc sector_no dd ? ;05 ºÏ°Ï½s¸¹ number_sector dw ? ;06 Ū¨úºÏ°Ï¼Æ tran_offset dw ? ;07 Ū¨ú«á¦s©ñ³B¤§°¾²¾¦ì§} tran_segment dw ? ;08 Ū¨ú«á¦s©ñ³B¤§°Ï¬q¦ì§} packet ends ;*************************************** data segment ;11 ¸ê®Æ°Ï¬q driver db 0 ;12 A: ºÏºÐ¾÷ fat packet <1,9,offset fat_data,seg data> ;13 Ū¨ú FAT ¤§±±¨î°Ï¶ô org 20h fat_data db 9*sector_bytes dup (0) ;15 FAT ¦s©ñ³B mes1 db ':BOOT sector :FAT sector$' mes2 db ':ROOT directory :bad sector$' mes3 db ':uesd sector :un-used sector$' data ends ;*************************************** code segment assume cs:code,ds:data ;--------------------------------------- main proc far start: push ds sub ax,ax push ax mov ax,data mov ds,ax mov ax,600h ;31 ²M°£¿Ã¹õ mov bh,0fh sub cx,cx mov dx,184fh int 10h mov al,driver ;37 Ū¨úFAT mov bx,offset fat mov cx,0ffffh int 25h popf jnc draw exit: ret draw: sub bx,bx ;45 ±N¥Ñ¼Ð©w¦ì©ó²Ä¤@¦C²Ä¹s¦æ mov ah,2 mov dh,start_y mov dl,bl int 10h mov ax,942h ;50 ©ó¦¹³B¦L¥X¤@ÓÂÅ©³¬õ¦rªº B mov bx,01ch mov cx,1 int 10h inc dx ;55 ±N¥Ñ¼Ð©w¦ì©ó²Ä¤@¦C²Ä¤@¦æ mov ah,2 sub bx,bx int 10h mov ax,946h ;59 ©ó¦¹³B¦L¥X¤EÓ¥Õ©³¬õ¦rªº F mov bx,0fch mov cx,9 int 10h mov ah,2 ;64 ±N¥Ñ¼Ð©w¦ì©ó²Ä¤@¦C²Ä¤Q¦æ mov bh,0 mov dl,0ah mov dh,start_y int 10h mov ax,952h ;69 ©ó¦¹³B¦L¥X¤EÓ²`¬õ©³¥Õ¦rªº R mov bx,4fh mov cx,7 int 10h call draw_fat ;74 ¦L¥XºÏ°Ï¤À¥¬¹Ï mov ah,2 mov bh,0 mov dh,19+start_y mov dl,bh int 10h mov ax,942h ;81 ©ó¦¹³B¦L¥X¤@ÓÂÅ©³¬õ¦rªº B mov bx,01ch ;82 ªí¥Ü±Ò°ÊºÏ°Ï mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,19+start_y mov dl,1 int 10h mov ah,9 mov dx,offset mes1 int 21h mov ah,2 ;93 ©ó¦¹³B¦L¥X¤@Ó¥Õ©³¬õ¦rªº F mov bh,0 ;94 ªí¥Ü FAT ºÏ°Ï mov dh,19+start_y mov dl,23h int 10h mov ax,946h mov bx,0fch mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,20+start_y mov dl,bh int 10h mov ax,952h ;108 ©ó¦¹³B¦L¥X¤@Ó²`¬õ©³¥Õ¦rªº R mov bx,04fh ;109 ªí¥Ü®Ú¥Ø¿ýºÏ°Ï mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,20+start_y mov dl,1 int 10h mov ah,9 mov dx,offset mes2 int 21h mov ah,2 ;120 ©ó¦¹³B¦L¥X¤@Ó¬õ©³¶Â¦rªº B mov bh,0 ;121 ªí¥Ü·lÃaªººÏ°Ï mov dh,20+start_y mov dl,23h int 10h mov ax,942h mov bx,0c0h mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,21+start_y mov dl,bh int 10h mov ax,941h ;135 ©ó¦¹³B¦L¥X¤@Óºñ©³¶À¦rªº A mov bx,02eh ;136 ªí¥Ü¤w¨Ï¥ÎªººÏ°Ï mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,21+start_y mov dl,1 int 10h mov ah,9 mov dx,offset mes3 int 21h mov ah,2 ;147 ©ó¦¹³B¦L¥X¤@Óºñ©³¶Â¦rªº . mov bh,0 ;148 ªí¥Ü¥¼¨Ï¥ÎºÏ°Ï mov dh,21+start_y mov dl,23h int 10h mov ax,92eh mov bx,020h mov cx,1 int 10h mov ah,2 mov bh,0 mov dh,21+start_y mov dl,0 int 10h ret main endp ;--------------------------------------- ;±N½s¸¹¬°°¸¼ÆªºÅÞ¿èºÏ°Ï¦L¦b¿Ã¹õ¤W¾A·í¦ì¸m(x,y)¡A ;¾A·í¦ì¸m¶È©MÅÞ¿èºÏ°Ï½s¸¹(AX)¦³Ãö¡A§â AX °£¥H 160 ;©Ò±oªº°Ó¦s©ó AL¡A¾l¼Æ¦s©ó AH¡A«h (x,y)=( AH/2, AL+start_y ) ;¿é¤J¡GAX¡GÅÞ¿èºÏ°Ï½s¸¹ ; DX¡G¸ÓÅÞ¿èºÏ°Ï½s¸¹©Ò¹ïÀ³¤§FATÈ ;¿é¥X¡GY DX=0FF7H¡A¦L¥X¬õ©³¶Â¦rªº¡yB¡z ; Y DX=0000H¡A¦L¥XÂÅ©³¦Ç¦rªº¡y.¡z ; DX«D¥H¤W¨âªÌ¡A¦L¥Xºñ©³¶À¦rªº¡yA¡z print_even_sector proc near push dx mov bl,160 ;175 ¨Ì¤W¤K¦æ¼Æ¾Ç¦¡¨D¥X (x,y) div bl mov dl,ah mov dh,al shr dl,1 add dh,start_y sub bx,bx mov ah,2 int 10h ;183 §â¥Ñ¼Ð©w¦ì©ó¾A·í¦ì¸m pop dx ;184 ¥Ñ DX ȦL¥X B¡NA ©Î . mov ax,941h mov bx,02eh mov cx,1 cmp dx,0ff7h jne psm0 mov al,'B' mov bx,0c0h jmp short psm1 psm0: cmp dx,0 jne short psm1 mov al,'.' mov bx,020h psm1: int 10h ret print_even_sector endp ;--------------------------------------- ;¥H FAT ¸ê®Æ¦L¥X¾ã±iºÏ¤ùªºÀɮפÀ¥¬¹Ï®× ;¿é¤J¡GDS:SI¡GFAT ¦s©ñ³B ; AX¡GÅÞ¿èºÏ°Ï½s¸¹ draw_fat proc near mov si,offset fat_data+4 mov ax,34 ;206 ¸ê®Æ¥Ñ²Ä 34 Ӻϰ϶}©l df0: push ax ;207 SI=²Ä´XÓ FAT ¦ì¤¸²Õ mov dx,[si] ;208 ¥Ñ SI ¨ú±o FAT ¤º®e mov cl,4 ;209 ¨Ã¦s©ó DX shr dx,cl call print_even_sector pop ax add si,3 inc ax inc ax cmp ax,2880 jnz df0 ret draw_fat endp ;--------------------------------------- code ends ;*************************************** stack segment stack db 20h dup ('STACK ') stack ends ;*************************************** end start
¦pªG±z¥Î MASM 5.0 ¨Ó²ÕĶ³oÓµ{¦¡¡A·Ó¥¿±`¤èªk²ÕĶ§¹¥þ¤£¥Îקï´N¥i¥H¤F¡A¦p¤U¡G
H:\HomePage\SOURCE>..\masm50\masm diskmap; [Enter] Microsoft (R) Macro Assembler Version 5.00 Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved. 51170 + 349374 Bytes symbol space free 0 Warning Errors 0 Severe Errors H:\HomePage\SOURCE>..\masm50\link diskmap; [Enter] Microsoft (R) Personal Computer Linker Version 2.40 Copyright (C) Microsoft Corp 1983, 1984, 1985. All rights reserved.
¦ý¦pªG±z¥Î MASM 6.xx ²ÕĶªº¸Ü¡A½Ð±z¥Î¬Û®e©ó 5.0 ª©ªº¤è¦¡²ÕĶ¡A´N¬On¥[¤W¡y/Zm¡z°Ñ¼Æ¡G
H:\HomePage\SOURCE>path h:\homepage\masm611d;%path% [Enter] H:\HomePage\SOURCE>ml /Zm diskmap.asm [Enter] Microsoft (R) Macro Assembler Version 6.11d Copyright (C) Microsoft Corp 1981-1995. All rights reserved. Assembling: diskmap.asm Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994 Copyright (C) Microsoft Corp 1984-1993. All rights reserved. LINK : warning L4017: /r : unrecognized option name; option ignored Object Modules [.obj]: /r diskmap.obj Run File [diskmap.exe]: "diskmap.exe" List File [nul.map]: NUL Libraries [.lib]: Definitions File [nul.def]:
±o¨ì DISKMAP.EXE ´N¥i¥H¸Õ¸Õ¬Ý°õ¦æ¥¦¤F¡A¦b°õ¦æ³oÓµ{¦¡¤§«e¡An¥ý§â¤T¤S¤G¤À¤§¤@^¦Tªº³nºÐ¤ù©ñ¦b A: ºÏºÐ¾÷¡A¤U¹Ï¬O¤p¤ì°¸ªº¤@±i³nºÐ¤ù¨Ï¥Î±¡§Î¡G
¥Ñ¤W¹Ï¥i¥H¬Ý¥X¡A³o±iºÏ¤ù¤¤¶¡¦³¤@¤j¬q¬O¨S¨Ï¥ÎªºªÅ¶¡¡A«á±¤S¦³¤@¶ô¬O¤w¸g¨Ï¥ÎªºªÅ¶¡¡A«e±ÁÙ¦³¤w·lÃaªººÏ°Ï¡C
³oÓµ{¦¡¦³«Ü¤j¤@³¡¥÷¬O³B²z¦b¿Ã¹õ¤Wªº¬Y¤@Ó¦ì¸m¦L¥X±a¦³ÃC¦âªº¤å¦r¨Ó¡A³o¨Ç°Ñ¦Ò¤W±ªº¤¤Â_©I¥sµ{¦¡À³¸Ó¨Ã¤£ÃøÁA¸Ñ¡C©Ò¥H¤p¤ì°¸¤£¸Ô²Ó¤¶²Ð³o¨Ç¹Lµ{¡A¶È´NÆ[©À¤W¤Îµ²ºcÅ餶²Ð¡C
STRUC ¬O¤@Ó°²«ü¥O¡A¥¦¨Ï²ÕĶ¾¹«O¯d¤@¶ô°O¾ÐÅéªÅ¶¡µ¹¤@¨Ç¸ê®Æ¨Ï¥Î¡CMASM ²ÕĶ¾¹±N¥¦¥]¸Ë¦¨¤@Ó·sªº¸ê®Æ«¬ºA¡A³oºØµ²ºcÅé¥i¥H¬Ý¦¨¬O¤@¶ô³sÄòªº°O¾ÐÅéªÅ¶¡¡A³oӪŶ¡¤ºªº°O¾ÐÅé¥i¥H¬O¦UºØ¤w¸g©w¸q¦nªº¸ê®Æ«¬ºA¡A¦p DB¡BDW µ¥µ¥¡C¦b¬Y¨Ç®ÉÔ¡Aµ²ºcÅé¯S§O¦n¥Î¡A¨Ò¦p³B²z CX=0FFFFH ªºµ´¹ïºÏ°ÏªºÅª¨ú´N¬O¤@ӫܦnªº¨Ò¤l¡C·í§Ú̥Φ¹¤¤Â_µ{¦¡¡ADS:BX ¬O«ü¦V¤@¶ô¤QӦ줸²Õªº°O¾ÐÅéªÅ¶¡¡A³oÓ°O¾ÐÅéªÅ¶¡¥Nªí¯u¥¿ªº¿é¤J°Ñ¼Æ¡A¦]¦¹¤p¤ì°¸´N§â³o¤QӦ줸²Õ¥]¸Ë¦¨¤@Óµ²ºcÅé¡A¦Ü©ó¦p¦ó©w¸qµ²ºcÅé¡A½Ð°Ñ¦Òµ{¦¡²Ä 4 ¨ì²Ä 9 ¦æ¡A
packet struc ;04 µ´¹ïºÏ°ÏŪ¨ú±±¨î°Ï¶ôµ²ºc sector_no dd ? ;05 ºÏ°Ï½s¸¹ number_sector dw ? ;06 Ū¨úºÏ°Ï¼Æ tran_offset dw ? ;07 Ū¨ú«á¦s©ñ³B¤§°¾²¾¦ì§} tran_segment dw ? ;08 Ū¨ú«á¦s©ñ³B¤§°Ï¬q¦ì§} packet ends
packet ªº¦WºÙ¥i¥H¥ô·N¨ú¡A«á±±µµÛ struc ³oÓ«O¯d¦r¡Aªí¥Ü³o¸Ì¦³¤@Óµ²ºcÅé©w¸q¶}©l¤F¡A¦Ó´X¦æ¤§«á¥²©w¦³¤@Ó ends¡A³oÓ ends ±zÀ³¸Ó²q±o¥X¨Ó´N¬Oµ²ºcÅéµ²§ô¡AÁöµM©M°Ï¬qµ²§ô¬Û¦P¡A¦ý¬O MASM ·|¦Û°Ê°t¦X¡A¤£¥Î¨Ï§Ú̾á¤ß¡C©Ò¥Hµ²ºcÅ骺§Î¦¡¬O¡G
¦WºÙ struc Äæ¦ì1 d* ? Äæ¦ì2 d* ? ¡K¡K¡K¡K¡K¡K¡K¡K¡K ¦WºÙ ends
¦b struc ©M ends ³o¨â¦æ¤§¶¡ªº¸ê®Æ«¬ºA©w¸q¥i¥Hµøµ{¦¡³]p®v»Ýn½Õ¾ã¡A·íµ{¦¡³]p®v¹³¤W±©w¸q¦nµ²ºcÅé«á¡AMASM ·|°O¦í¦³¤@Ó·sªº¸ê®Æ«¬ºA²£¥Í (¥H³oÓµ{¦¡¬°¨Ò¡Apacket ´N¬O·sªº¸ê®Æ«¬ºA)¡A¦ý¬O³o®ÉÔ MASM ¨Ã¤£·|¤À¥X¤@¶ô°O¾ÐÅéµ¹¥¦¨Ï¥Î¡A´«¥y¸Ü»¡³o®É¶È¶È¬O¡y«Å§i¡z·sªº¸ê®Æ«¬ºA¦Ó¤w¡C¨ìµ{¦¡²Ä 13 ¦æ¡AMASM ¤~¹º¤À¥X¤@¶ô°O¾ÐÅéµ¹ fat ¨Ï¥Î¡A¦Ó fat ªº¸ê®Æ«¬ºA´N¬O¤Wzªº packet¡A½Ð°Ñ¦Ò¤U¤@¦æ¡A·í§ÚÌ©w¸qµ²ºcÅ骺¼ÆȮɻݥΤ@¹ï¡y<¡z¡B¡y>¡z¬A°_¨Ó¡G
fat packet <1,9,offset fat_data,seg data>
fat Åܼƨƹê¤W¥]§t¤QӦ줸²Õ¡A«e¥|Ӧ줸²Õªí¥ÜºÏ°Ï½s¸¹¡AºÙ¬° sector_no¡F±µ¤U¨Óªº¨âӦ줸²Õªí¥Ü¨úºÏ°Ï¼Æ¡AºÙ¬° sector_number¡K¡K¡C¹³µ{¦¡²Ä 13 ¦æªº±Ôz´N·|²£¥Í
dd 1 dw 9 dw offset fat_data dw seg data
ªº¸ê®Æ¡C·í§ÚÌn¦bµ{¦¡¤¤§ïÅܨä¼ÆȮɡA¥i¥H¥Î
mov cx,fat.number_sector mov fat.tran_segment,dx
ªº¤è¦¡§ïÅÜ¡A¤W±´N¬O§â fat µ²ºcÅ餺ªººÏ°Ï¼Æ¦s¤J CX ¼È¦s¾¹¡A¸ò§â DX ¼È¦s¾¹ªº¼ÆȦs¤J fat µ²ºcÅ餺ªº½w½Ä°Ï°Ï¬q¦ì§}¡C
ȱo¤@´£ªºÁÙ¦³¦b MASM 6.0 ª©¥H«á¤]¥i¥H¥Î STRUCT ¨Ó¥N´À STRUC¡A°£¦¹¤§¥~¡A¦b MASM 6.0 ª©¥H«á¡ASTRUC ¤§«á¥i¥H±µ¤W¤@Ó¥i¥H¬Ù²¤ªº alignment ¿ï¶µ»P NONUNIQUE ¿ï¶µ¡A¦p¤U±¡G¡C
¦WºÙ STRUC [alignment][,NONUNIQUE] Äæ¦ì1 d* ? Äæ¦ì2 d* ? ¡K¡K¡K¡K¡K¡K¡K¡K¡K ¦WºÙ ENDS
alignment ¥i¥H¬O 1¡B2 ©Î 4¡A³o¨ÇȬOªí¥Ü²ÕĶ¾¹¬° STRUC ¤ºªº¦UÄæ¦ì¦b°O¾ÐÅé¦w±Æªº¦ì§}¡C¦b 32 ¦ì¤¸ªº CPU ¦s¨ú°O¾ÐÅé¸ê®Æ®É¡A¦pªG°O¾ÐÅé¦ì§}¯à¬°¥|¾ã°£®É¡A¦s¨ú³t«×¸û§Ö¡F¦Ó 16 ¦ì¤¸ªº CPU «h¬O¥H©ÒŪ¨úªº°O¾ÐÅé¦ì§}¯à¬° 2 ¾ã°£¸û§Ö¡C¦]¦¹¦³®É¬°¤F³t²v¡A¥i¥H±j¢¨CÓÄæ¦ìªº¦ì§}¥Ñ°¾²¾¦ì§} 2¡B4 ªº¿¼Æ¶}©l¡A¦¹³Bªº°¾²¾¦ì§}¬O¬Û¹ï©óµ²ºcÅé°_©l¡A¨Ã«D°O¾ÐÅé°_©l³B¡C¨Ò¦p alignment ¬° 2 ®É¡Aªí¥Ü¨CÓÄæ¦ì¥H°¸¼Æ¦ì§}¶}©l¡AY¤£¬O°¸¼Æ®É¡A«h²ÕĶ¾¹·|¦Û°Ê¶ñ¤W¤@ӪŮæ¡CY alignment ¬° 4 ®É¡A«h¨CÓÄæ¦ì¥Ñ¥|ªº¿¼Æ¶}©l¡A¦ý¬O¦pªG¦³¨âÓÄæ¦ì¥[°_¨Óªºªø«×¤p©ó¥|¡A«h¥i¯à·|§â³o¨ÇÄæ¦ì¥H°¸¼Æ¶}©l¡A¦Ó¦X°_¨Ó¦¨¬°¥|ªº¿¼Æ¡A¥ç§Y¨Ï¤U¤@Äæ¦ì¥Ñ¥|ªº¿¼Æ¶}©l¡C¨Ò¦p¦³¤@µ²ºcÅé¡Astudent¡A«Å§i¬°¡G
student STRUCT 4 lname DW ? fname DD ? year DW ? id DB ? student ENDS
lname ¦û¥h 2 Ӧ줸²Õ¡A¦]¦¹²ÕĶ¾¹·|¸É¤W 2 Ӧ줸²ÕªºªÅ¦ì¡C¦A±µ¤U¨Óªº fname ¦û¥h 4 Ӧ줸²Õ¡A¤£¸ÉªÅ¦ì¡C¦A±µ¤U¥hªº year ©M«á±ªº id ¦@¦û 3 Ӧ줸²Õ¡A¦]¦¹¸É 1 Ӧ줸²ÕªºªÅ¦ì¡C¦p¤U¹Ï¤À¥¬¡G
¦³®É§ÚÌ·|»Ýn¨ú±oµ²ºcÅé¬YÓÄæ¦ìªº¦ì§}¡A¥H¤U±ªºµ{¦¡¤ù¬q¬°¨Ò¡Cº¥ý§ÚÌ¥ý©w¸q¤@Ó¦W¬° packet ªºµ²ºcÅé¡AµM«á¦b¸ê®Æ¬q¤¤©w¸q fat ÅܼơA¦¹Åܼƪº¸ê®Æ§ÎºA§Y¬° packet µ²ºcÅé¡C
packet struc ;µ´¹ïºÏ°ÏŪ¨ú±±¨î°Ï¶ôµ²ºc sector_no dd ? number_sector dw ? tran_offset dw ? tran_segment dw ? packet ends ;*************************************** data segment driver db 0 fat packet <1,9,offset fat_data,seg data> ;*************************************** ¡K¡K¡K¡K¡K¡K¡K¡K¡K¡K mov si,offset fat.sector_no mov dx,packet.sector_no
³Ì«á¨â¦æµ{¦¡¤¤¦³Ãö¦ì§}ªº·N¸q¨Ã¤£¬Û¦P¡A²Ä¤@¦æ·|³Q²ÕĶ¾¹²ÕĶ¦¨¨ú±o fat ÅܼƤ¤ªº sector_no Äæ¦ì¦ì§}¡A³oÓ¦ì§}¬O±q¸ê®Æ¬q¶}©lºâ°_¡A¦]¦¹°õ¦æ§¹²Ä¤@¦æ«á¡ASI ¬° 1¡F¦pªG±Ä¥Î³Ì«á¤@¦æªº¤è¦¡¡A«h²ÕĶ¾¹·|²ÕĶ¦¨¨ú±o packet µ²ºcÅ骺 sector_no ¦ì§}¡A¦Ó¦¹¦ì§}¬O¥Ñµ²ºcÅ骺°_©l¦ì§}ºâ°_¡A¦]¦¹ DX ¬°¹s¡C¦b Win32 Àô¹Ò¤U¡A¨Ï¥Î¬Û·í¦hªºµ²ºcÅé¡AY±z·QÄ~Äò¶i¶¥ Win32 ²Õ¦X»y¨¥µ{¦¡³]p¡A´N±oÁA¸Ñµ²ºcÅé¡C
µ{¦¡²Ä 31 ¦æ¨ì²Ä 35 ¦æ¬O²M°£¿Ã¹õ¡Aµ{¦¡²Ä 37 ¨ì²Ä 41 ¦æ¬OŪ¨ú³nºÐ¤ù FAT ªº¸ê®Æ¡AnŪ¨úªººÏ°Ï½s¸¹¡BŪ¨úªººÏ°Ï¼Æ¡B¦s©ñ FAT ¸ê®Æ¦ì§}§¡¦b fat µ²ºcÅ餺©w¸q¡A¤À§O¦bµ{¦¡ªº²Ä 4 ¦æ¨ì²Ä 9¦æ¡A¤Î²Ä 13 ¦æ¡C²Ä 45 ¦æ¨ì²Ä 72 ¦æ¬O§â±Ò°ÊºÏ°Ï¡BFAT ºÏ°Ï¡B®Ú¥Ø¿ýºÏ°Ïµe¦b¿Ã¹õ¤W¡A¦]¬°³o¨Ç³£¬O©T©wªº¡A©Ò¥H¤p¤ì°¸ª½±µµe¤W¥h¡A¨Ã¨S¦³°µÀˬd¡C
µ{¦¡²Ä 74 ¦æ©I¥s draw_fat °Æµ{¦¡¡A³oӰƵ{¦¡¬O®Ú¾Úè¤~¥Ñ³nºÐ¤WŪ¤Jªº FAT ¸ê®Æ¡A§âºÏ°Ïµe¦b¿Ã¹õ¤W¡C¿Ã¹õ¤WÁ`¦@¥i¥HÅã¥Ü 80*25 Ó¦r ( §Y2000Ó¦r )¡A¦Ó³nºÐ¤ù¤W¦³ 2880 ӺϰϡAµLªk¥þ³¡Åã¥Ü¦b¿Ã¹õ¤W¡A©Ò¥H¤p¤ì°¸¥u¦n§â½s¸¹¬O°¸¼ÆªººÏ°ÏÅã¥Ü¦b¿Ã¹õ¤W¡A³o¼Ë´N¥unÅã¥Ü 1440 ӺϰϴN¥i¥H¤F¡A¦pªG¨C¦æÅã¥Ü 80 Ó¦r¡A¨º¥u»Ýn 18 ¦æ´N¥i¥HÅã¥Ü§¹²¦¡A¨ä¾l³Ñ¤UªºªÅ¶¡¥i¥H¥Î¨ÓÅã¥Ü¹³¡y¨Ï¥ÎªººÏ°Ï¦p¦óªí¥Ü¡z¡N¡y·lÃaªººÏ°Ï¦p¦óªí¥Ü¡zµ¥¸ê°T¡C
¦Ü©ó¦p¦ó¦w±Æ¼Ð¸¹°¸¼ÆªººÏ°Ï¦b¿Ã¹õ¤Wªº¦ì¸m©O¡H¤p¤ì°¸¥Î¤@Ó¦W¬° print_even_sector ªº°Æµ{¦¡¨Ó³B²z¡C½Ð¥ý°Ñ¦Ò¤U¹Ï¡G
¹Ï¤¤¨C¤@Ó¯»¬õ¦â¤pªø¤è§Î®Ø®Ø¥Nªí¦b¿Ã¹õ¤Wªº¤@Ó¦r¡A·Óè¤~©Ò»¡¡AÀ³¸ÓÅã¥Ü 18 ¦C¤~¹ï¡A¦ý¬O¬°¸`¬ÙªÅ¶¡¡A©Ò¥H¤p¤ì°¸¶Èµe¨â¦C¥Nªí¡C¨C¤@¦C³£¦³ 80 Ó¦r¡A¨C¤@Ó¦rªí¥Ü¨âӺϰϡA³o¨âӺϰϪº½s¸¹¤p¤ì°¸¥Î¬õ¦â¦r¼g¦b¤W¤è¡A¤U¤èªº¶À¦â¼Æ¦r¨Óªí¥Ü¥¦¦b¿Ã¹õ¤Wªº X ®y¼Ð (¥Ñ 0 ¨ì 79 ¦@ 80 Ó¦r¡AY ®y¼Ð¨Ã¨S¦³¦b¹Ï¤Wªí¥Ü¥X¨Ó)¡C
¦]¬°¨CÓ¦rªí¥Ü¨âӺϰϡA©Ò¥H¤p¤ì°¸·Q¡A´N¬Ý¬Ý°¸¼Æ½s¸¹ªººÏ°Ï§Y¥i¡A±zÀ³¸Ó¥i¥Hµo²{¡A¨C¤@¦Cªº²Ä¹sӺϰϤÀ§O¬O 0¡N160¡N320¡K¡K¡AÁöµM 320 ·¥¨ä¥H«á¨Ã¨S¦³Åã¥Ü¦b¹Ï¤W¡A¦ý¬O¤p¤ì°¸·Q¡A±zÀ³¸Ó¥i¥H¥Ñ¡y¨C¦C 80 ¦r¡A¨C¦r¨âºÏ°Ï¡z±Àºâ¥X¨Ó¡A©Ò¥H¦rªº Y ®y¼Ð¥i¥H±Àºâªº¥X¨Ó¡AÀ³¸Óµ¥©óºÏ°Ï½s¸¹°£¥H 160 ©Ò±oªº°Ó¡A¦ý¬O¦pªG¤£¬O¥Ñ¿Ã¹õ²Ä¤@¦C¶}©lÅã¥Ü¡AÀ³¸Ó¦A¥[¤W¤@Ó°_©lÅã¥Üªº¦C¼Æ¡A³o¤]´N¬O Y=AL+start_y ªºì¦]¡C
¦AÆ[¹î²Ä¹s¦Cªº¨C¤@Ó¦r¡A¤p¤ì°¸·Q±z¤]À³¸Ó¥i¥H¬Ý¨ì¡AX ®y¼Ð«ê¦n¬OºÏ°Ï½s¸¹ªº¤@¥b¡A¦Ó²Ä¤@¦Cªº X ®y¼Ð«h¬OºÏ°Ï½s¸¹´î¥h 160 «áªº¤@¥b¡A©Ò¥H X ®y¼Ð´N¬OºÏ°Ï½s¸¹°£¥H 160 «áªº¾l¼Æ¤§¥b¡A³o´N¬O X=AH/2 ªºì¦]¤F¡C©Ò¥Hµ{¦¡²Ä 175 ¦æ¨ì²Ä 183 ¦æ´N¥i¨Ì¤Wz³W«h©w¥X´å¼Ð¦ì¸m¡C
µ{¦¡ 189 ¦æ¨ì²Ä 198 ¦æ¬O®Ú¾Ú FAT ¤ºªº¼ÆȦL¥X¦r¤¸¡A¦pªG¬O¡y0FF7H¡z«hªí¥ÜÃaºÏ°Ï¦L¥X¡yB¡z¡F¦pªG¬O¡y000H¡z¡Aªí¥Ü¥¼¨Ï¥Î¡A¦L¥X¡y.¡z¡F¦pªG¬O¨ä¥L¼Æ«hªí¥Ü¬O³Q¨Ï¥ÎªººÏ°Ï¡A¦L¥X¡yA¡z¡C©Ò¥H print_even_sector °Æµ{¦¡¦³¨âÓ«nªº°Ñ¼Æ¡A¤À§O¬OºÏ°Ï½s¸¹¤Î¸ÓºÏ°Ï½s¸¹ªº FAT ¼ÆÈ¡AºÏ°Ï½s¸¹¥Î¨Ópºâ¦r¤¸¦ì¸m¡AFAT ¤ºªº¼ÆȥΨÓÅã¥Ü¸Ó¥H¤°»ò¼Ëªº¦r¤¸Åã¥Ü¡C³o¨âӰѼƤÀ§O¥Î AX¡ADX ªí¥Ü¡A¨Ã¥B¥Ñ print_even_sector ªº¡y¤÷¡zµ{¦¡¡Adraw_fat¡A¶Çµ¹¥¦¡C
³oӰƵ{¦¡¬Oµe¥X¾ãӺϤù¨Ï¥Î¤À¥¬¡A¤p¤ì°¸¥Î SI ¨Óªí¥ÜŪ¨ì²Ä´XÓ FAT ¦ì¤¸²Õ¡A¥Î AX ªí¥ÜºÏ°Ï½s¸¹¡A¨Æ¹ê¤W³o¨âªÌ¬O¬ÛÃöªº¡A¥i¥H¥Î SI ¨Ó¨D¥X AX¡A¦ý¤p¤ì°¸¬°Â²¤Æµ{¦¡¡A©Ò¥H±Ä¥Î¤À§Opºâ¡C
¥Ñ©ó¤T¤S¤G¤À¤§¤@^¦Tªº³nºÐ¤ù¬O¥Ñ²Ä 33 Ӻϰ϶}©l¦s©ñ¸ê®Æ¡A³o¤£¬O¤p¤ì°¸nÅã¥ÜªººÏ°Ï¡A¤p¤ì°¸±q²Ä 34 Ӻϰ϶}©lÅã¥Ü (°Ñ¦Ò²Ä¤Q¤K³¹)¡A²Ä 34 ӺϰϬO FAT ªº²Ä 3 ÓÄæ¦ì¡A¤]´N¬O²Ä 4 Ӧ줸²Õ¶}©l¡A©Ò¥Hµ{¦¡²Ä 205 ¦æ·|¥[¤W 4 ªºì¦]¦b¦¹¡A¦Ü©ó¥Ñ SI ¨ú±o FAT ¦ì¤¸²Õ«á¡A¦A±o¨ì FAT ¼ÆÈ©M FAT ªº½s±Æ¤è¦¡¦³Ãö¡A½Ð°Ñ¦Ò²Ä¤Q¤K³¹¡A¸g¹L¹Bºâ (µ{¦¡²Ä 208 ¨ì²Ä 210 ¦æ) ¤~¯à±o¨ì FAT ¼ÆÈ¡ADX¡C¦ÓºÏ°Ï½s¸¹´N¥Ñ 34 ¶}©l¡A³oÀ³¸Ó²@µLºÃ°Ý¡C
¨C¦¸Åã¥Ü§¹¤@Ó¦r¡AºÏ°Ï½s¸¹À³¼W¥[ 2¡A³o¬O¦]¬°¨CÓ¦rªí¥Ü¨âӺϰϡA¦Ó SI À³¸Ó¼W¥[ 3¡Aª½¨ìºÏ°Ï½s¸¹¨ì³Ì«á± 2880 ¬°¤î¡C