«e¤@³¹¤¶²Ð¤F¦p¦ó§Q¥Î AH¡×3EH/INT 21H ¤Î AH¡×3FH/INT 21H Àò±o¤@ӥؿý¸Ì©Ò«ü©wªºÀɮצWºÙ¡A¦b³o¤@³¹¸Ì¤p¤ì°¸n¤¶²Ð§Q¥Î DOS ªA°Èµ{¦¡Åª¨ú«ü©wÀɮתº¤º®e¡A¨ÃÅã¥Ü©ó¿Ã¹õ¤§¤W¡Aµ{¦¡¦WºÙ¬O VIEW.ASM¡A²ÕĶ³sµ²«á¥Í¦¨ VIEW.EXE¡A¦Ó¤U¹Ï«o¬O§Q¥Î VIEW.EXE Æ[¹î¦Û¤vªº¤º®e¡G ¤@¯ëÀɮפj¬ù¦³´X¦Ê KB¡A¦hªº¤]¥i¹F¼Æ¦Ê MB¡A¦Ó DOS ³Ì¦h¯à³B²z 2GB ªºÀɮסA¤£ºÞ¬O«ezªºþ¤@ºØ±¡§Î¡A³£µLªk¤@¦¸Åã¥Ü¦b¿Ã¹õ¤W¡C¤p¤ì°¸¼Ò¥é PCTOOLS ªºµe±¡A¤@¦¸¥uÅã¥Ü 256 Ӧ줸²Õ ( 100H¡A§Y¤Q¤»¶i¦ìªº 100 )¡A¦b¥»³¹¤p¤ì°¸ºÙ¬°¡u¤@¶¡v¡C
¥Ñ¤W¹Ï¥i¥H±oª¾ VIEW.EXE ¦³¤»¶µ¥\¯à¡A«ö¡uEsc¡vÁä°h¥Xµ{¦¡¡B«ö¡uJ¡vÁäÅý¨Ï¥ÎªÌ¿é¤JnÆ[¬ÝÀɮתºþ¤@¬q¤º®e¡B«ö¡uPgUp¡v©Î¡uPgDn¡vÁäÆ[¬Ý©¹«e©Î©¹«á 100H Ӧ줸²Õªº¸ê®Æ¡B«ö¡uHome¡v©Î¡uEnd¡vÁäÆ[¬ÝÀÉ®×ÀY©ÎÀɮקÀªº¤º®e¡C¦³³o¨Ç¥\¯à¡A¥i·Q¦Óª¾¡AVIEW.ASM Àɮפ@©w¤£·|«Ü¤p¡A©Ò¥HÀ³¸Ó¦n¦n³W¹º¬yµ{¡C¤p¤ì°¸³W¹ºªº¥Dn¬yµ{¹Ï¦p¥k¹Ï¡G
¾ãÓ¬yµ{¥i¥H¤Á³Î¦¨¼ÆÓ¡u¤pªºµ{¦¡¤ù¬q¡v¡A§â¨CÓ¤pªºµ{¦¡¤ù¬q¤À§O¼g¦n¦A¦ê±µ¦b¤@°_¡A´N¤j¥\§i¦¨¤F¡C³o¨Ç¤pªºµ{¦¡¤ù¬q¡A¥i¤À¬°¤U±´X³¡¤À¡G
³o¬qµ{¦¡«Ü®e©ö¡A¤£¥~¥G¬O©I¥s AH¡×0AH/INT 21H ¿é¤JÀɦW»P AH¡×3DH/INT 21H ¶}±ÒÀɮסC
©I¥s AH¡×3FH/INT 21H ¥i¦ÛÀɮ׫ü¼Ð³BŪ¨úÀɮפº®e¡A¦ý¬O¨Ï¥ÎªÌ¤£¤@©w¬O·Ó¶¶§ÇŪ¨úÀɮרÓÆ[¹î¡A©Ò¥Hn¥ý©I¥s AH¡×42H/INT 21H ³]¦nÀɮ׫ü¼Ð¡A¥un³]¦nÀɮ׫ü¼Ð¡An¼¶¼gŪ¨úÀɮרÃÅã¥Üªºµ{¦¡¤£·|¤Ó§xÃø¡C
¦ý°ÝÃD¦b©ónÅã¥ÜÀɮפº®e®É¡A³s±anÅã¥Ü³o¨Ç¤º®e¦ì©óÀɮצó³B¡A³o¤]´N¬OnÅã¥ÜÀɮ׫ü¼Ð¡C¤£©¯ªº¬O¡A¨S¦³¤@Ó DOS ªA°Èµ{¦¡¯à°÷Ū¨úÀɮ׫ü¼Ð¡A©Ò¥H±o¥t¥~©w¸qÅܼƨӰO¿ýÀɮ׫ü¼Ð¡CÀɮ׫ü¼Ð¬O¤T¤Q¤G¦ì¤¸¡A¦Ó¦b¯u¹ê¼Ò¦¡¤U¹B¦æªº DOS µ{¦¡¬O¤Q¤»¦ì¤¸¡A©Ò¥H©w¸q¨âÓ¤Q¤»¦ì¤¸ªºÅܼơA¤p¤ì°¸´À³o¨âÓÅܼƨú¦W¬° fp_low »P fp_high¡A«eªÌ¬O§C¦r²Õ¡A«áªÌ¬O°ª¦r²Õ ( §C¦r²Õ¦ì©ó§C¦ì§}¡B°ª¦r²Õ¦ì©ó°ª¦ì§}¡Afp ¬O file pointer ªº·N«ä )¡C³]©wÀɮ׫ü¼Ð¡BŪ¨ú¨ÃÅã¥Üªºµ{¦¡¦p¤U¡G
set_fp_on_bgn: mov cx,fp_high mov dx,fp_low mov al,0 ;¥HÀÉ®×°_ÀY¬°°ò·Ç set_fp: mov ah,42h ;³]©wÀɮ׫ü¼Ð¦bCX:DX³B mov bx,f_handle int 21h read_file: mov ah,3fh mov bx,f_handle mov cx,100h ;Ū¨ú100HӦ줸²Õ mov dx,OFFSET buffer int 21h INVOKE print_data,4,OFFSET buffer,fp_low,fp_high,ax
¦pªG¨Ï¥ÎªÌ«ö¤U¬Y¨ÇÁä¡A¨Ò¦p¡uPgDn¡vÁä¡B¡uPgUp¡vÁä©Î¨ä¥L VIEW ©ÒÃöª`ªº«öÁä¡A¥Ñ¨ä¥Lµ{¦¡¤ù¬q³]©w¦n·sªº fp_high:fp_low¡AµM«á¸õ¦Ü¡uset_fp_on_bgn:¡v¼Ð°O³B³]©wÀɮ׫ü¼Ð¡C¨Ò¦p¨Ï¥ÎªÌ«ö¤U¡uHome¡vÁä¡A¨º´N§â fp_high:fp_low ³]¬°¹s¡AµM«á¸õ¦Ü¡uset_fp_on_bgn:¡v¼Ð°O³B§Y¥i¡C¤£ºÞþ¤@Ó«öÁä¡A³B²z§¹ fp_high:fp_low ¤§«á³£·|¸õ¦Ü¡uset_fp_on_bgn:¡v¼Ð°O³B¡A³]©w¥HÀÉ®×ÀY¬°°ò·Ç¡A²¾°ÊÀɮ׫ü¼Ð¡A±µµÛŪ¨úÀɮרÃÅã¥Ü¡C
print_data ¬O§âŪ¨ú¨ìªºÀɮפº®eÅã¥Ü¦b¿Ã¹õ¤W¡C²Ä¤@ӰѼơA4¡A¥Nªí¥Ñ¿Ã¹õ²Ä¥|¦C¶}©lÅã¥Ü¡F²Ä¤GӰѼơAOFFSET buffer¡A¥NªínÅã¥Üªº¸ê®Æ¦ì©ó¦ì§} buffer ©Ò«ü¤§³B¡F²Ä¤T¡B¥|ӰѼơAfp_high:fp_low¡Aªí¥ÜÅã¥ÜªºÀɮפº®e¦ì©óÀɮצó³B¡F³Ì«á¤@ӰѼơAAX¡Aªí¥ÜnÅã¥ÜªºÀɮפº®e¦³¦h¤ÖӦ줸²Õ¡C¤@¯ë¨Ó»¡¡AAX ¬O 100H¡A¦ý¦pªGÀɮ׫ü¼Ð±µªñÀɮקÀºÝ¡A´N¦³¥i¯à·|¤p©ó 100H¡C
nÅý¨Ï¥ÎªÌ¿é¤J«öÁä¥i©I¥s AH¡×00H/INT 16H¡A¤§©Ò¥H¤£©I¥s DOS ªA°Èµ{¦¡¡A¬O¦]¬°µ{¦¡»Ýn³B²z¹³¡uHome¡vÁä¡B¡uEnd¡vÁä³oÃþ¤£±a ASCII ªº«öÁä¡A¥B¤S¤£¶·§â«öÁä¦L¦b¿Ã¹õ¤W¡C¨ú±o¨Ï¥ÎªÌ¿é¤Jªº«öÁä«á¡A®Ú¾Ú¨ä±½´y½X°õ¦æ¤£¦Pªºµ{¦¡¤ù¬q¡A¥H§ó§ïÀɮ׫ü¼Ð¡A³o¬qµ{¦¡¥i¥H§Q¥Î .IF/.ELSEIF/.ELSE/.ENDIF °²«ü¥O¨Ó¼¶¼g¡A³o¼Ë·|¸û¬°Â²¼ä¡C¤U±´N¬O³o¬qµ{¦¡ªº¼Ë¤l¡G
get_key: mov ah,0 int 16h ;¨Ï¥ÎªÌ¿é¤J«öÁä .IF ah==24h ;¨Ï¥ÎªÌ«ö¤U¡uJ¡vÁä ¦¹³B¬°³B²z«öÁä¡uJ¡vªºµ{¦¡ .ELSEIF ah==49h ;¨Ï¥ÎªÌ«ö¤U¡uPgUp¡vÁä ¦¹³B¬°³B²z«öÁä¡uPgUp¡vªºµ{¦¡ .ELSEIF ah==51h ;¨Ï¥ÎªÌ«ö¤U¡uPgDN¡vÁä ¦¹³B¬°³B²z«öÁä¡uPgDn¡vªºµ{¦¡ .ELSEIF ah==47h ;¨Ï¥ÎªÌ«ö¤U¡uHome¡vÁä ¦¹³B¬°³B²z«öÁä¡uHome¡vªºµ{¦¡ .ELSEIF ah==4fh ;¨Ï¥ÎªÌ«ö¤U¡uEnd¡vÁä ¦¹³B¬°³B²z«öÁä¡uEnd¡vªºµ{¦¡ .ELSEIF ah==1 ;¨Ï¥ÎªÌ«ö¤U¡uEsc¡vÁä ¦¹³B¬°³B²z«öÁä¡uEsc¡vªºµ{¦¡ .ELSE jmp get_key ;¨Ï¥ÎªÌ«ö¤U¨ä¥L«öÁä .ENDIF jmp read_file
.IF/.ELSEIF/.ELSE/.ENDIF ³B²z¤»ºØ«öÁä¡A¨ä³B²zµ{¦¡¤À§O©ñ¦b¤£¦Pªº¡u.ESLEIF¡v°Ï¶¡¤§¤¤¡C¦Ü©ó¨ä¾l«öÁä³£¥æ¥Ñ¡u.ELSE¡v³B²z¡A¨ä¾l«öÁ䪺³B²z¤è¦¡«Ü²³æ¡A¦]¬°³oºØ«öÁ䤣¬O VIEW n³B²zªº¡A¬Gª½±µ¸õ¨ì¡uget_key:¡v¼Ð°O¡AÅý¨Ï¥ÎªÌ«·s«ö«öÁä¡C¦Ü©ó¡uAH==¡v¤§«áªº¼ÆÈ¡A¬O¤ñ¹ï©I¥s AH¡×00H/INT 16H «á¶Ç¦^¨Ó«öÁ䪺±½´y½X¡AÁä½L¤W«öÁ䪺±½´y½X½Ð°Ñ¦Ò²Ä¤Q¤T³¹µù¤@¡C
¦pªG¨Ï¥ÎªÌ·QnÆ[¹îÀɮתº¥ô¤@³B¡A¨º»ò«ö¤U¡uJ¡vÁä¡AJ ¥Nªí Jump¡A¸õ¨ì¨º¤@³BÆ[¹îªº·N«ä¡C³o®ÉÔ¡AVIEW °£¤FÅý¨Ï¥ÎªÌ¿é¤J¼ÆȤ§¥~¡A¤]À³¸Ón¦L¥X´£¥Ü¡C¹ï©ó¸û¤Íµ½¥B¤H©Ê¤Æªºµ{¦¡¡A´£¥Ün»¡©ú¨Ï¥ÎªÌÀ³¸Ó¿éªºª`·N¨Æ¶µ¤~¹ï¡C¹ï©ó VIEW ¦Ó¨¥¡A¸Ó´£¥ÜÀ³¸Ón»¡©ú¡G
µ¥¿é¤J§¹²¦¡AÁÙnÀˬd¨Ï¥ÎªÌ¿é¤Jªº¥¿½T»P§_¡A³Ì«á¤£ºÞ¥¿½T©Î¤£¥¿½T³£n²M°£´£¥Ü»P¨Ï¥ÎªÌ¿é¤Jªº¼ÆÈ¡C³o¤@¬q¹Lµ{¡A¤p¤ì°¸§â¥¦»s§@¦¨¤@Ó input_number °Æµ{¦¡¡C¦pªG¨Ï¥ÎªÌ¿é¤Jªº¼ÆȦb¦¹½d³ò¤º¡A´N·|²M°£¶i¦ìºX¼Ð¨Ã³]©w·sªº p_high:p_low¡F¦pªG¨Ï¥ÎªÌ¿é¤J¤F¤£¦Xªkªº¦r¤¸¡A¨Ò¦p¤£¬O¼Æ¦r¡A©Î¶W¥X½d³ò¡Ainput_number ·|³]©w¶i¦ìºX¼Ð¡C©³¤U´N¬O³o¤@¬qµ{¦¡ªº¼Ë¤l¡G
.IF ah==24h ;¨Ï¥ÎªÌ«ö¤U¡uJ¡vÁä
call input_number
jc get_key
mov p_high,cx
mov p_low,dx
jmp st_fp_on_bgn
¨Ï¥ÎªÌ«ö¤U¡uPgUp¡vÁä®É¡A¥i¯à¦³¨âºØª¬ªp¡A±¡§Î¤£¦P¡A³B²z¤è¦¡¤]¤£¦P¡C
²Ä¤@ºØ±¡§Î¬O¦pªGÀɮ׫ü¼Ð¤w¸g¦bÀÉ®×ÀY¤F¡A¨º»ò§Y¨Ï«ö¤U¡uPgUp¡vÁä¡A¤]¤£¯à¦AŪ¨úÀɮפ¤ªº¸ê®Æ¡A©Ò¥HÀ³¸Ó¤£³B²z¡A¸ò«ö¤U«D VIEW n³B²zªº¤»ºØÁä¤@¼Ë¡Aª½±µ¸õ¦Ü¡uget_key:¡v¼Ð°O¡AÅý¨Ï¥ÎªÌ«·s«ö«öÁä¡C³oºØ±¡§Î¥unÀˬd fp_high ¤Î fp_low ¬O§_§¡¬°¹s¡A¥u¦³¨âªÌ³£¬O¹sªº®ÉÔ¤~¸õ¦Ü get_key: ¼Ð°O³B¡F¨âªÌ¤¤¥un¦³¤@Ó¤£¬°¹s¡A´N¬O²Ä¤GºØ±¡§Î¡C
²Ä¤GºØ±¡§Î¬O¤@¯ëªº±¡§Î¡A´N¬OÀɮ׫ü¼Ð¤£¦bÀÉ®×ÀY¡A³o®ÉÔ¦pªG«ö¤U¡uPgUp¡vÁä®É¡A¬OÅã¥Ü¤W¤@¶ªº¸ê®Æ¡A©Ò¥H¥un§â p_high:p_low ´î¥h 100H §Y¥i ( ¶·¦Ò¼{¨ìɦ쪺°ÝÃD¡A»Ý¥Î SBB «ü¥O )¡AµM«á¸õ¦Ü¡uset_fp_on_bgn:¡v¼Ð°O³B«·s³]©wÀɮ׫ü¼Ð¡Cºî¦X³o¨âºØ±¡§Î¡A³B²z¨Ï¥ÎªÌ«ö¤U¡uPgUp¡vÁ䪺µ{¦¡¬°¡G
.ELSEIF ah==49h ;¨Ï¥ÎªÌ«ö¤U¡uPgUp¡vÁä cmp fp_high,0 ;ÀˬdÀɮ׫ü¼Ð¬O§_¦bÀÉ®×ÀY¡A§YÀˬd jnz not_bgn ;fp_high:fp_low¬O§_¬°0:0¡AY¬°¹sªí¥Ü cmp fp_low,0 ;¦bÀÉ®×ÀY¡A§Y¨Ï«ö¤U¡uPgUp¡vÁä¡A¤] jz get_key ;µL§@¥Î¡A¸õ¦Üget_key:³B not_bgn: sub fp_low,100h ;Y¤£¦bÀÉ®×ÀY¡A¨ÏÀɮ׫ü¼Ð©¹ÀÉ®×ÀY sbb fp_high,0 ;²¾100HӦ줸²Õ jmp set_fp_on_bgn
¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä®É¡A±¡ªp¸û¬°½ÆÂø¡A¤p¤ì°¸Á|´XÓ¹ê¨Ò»¡©ú¡A¤j·§¤ñ¸û®e©öÁA¸Ñ¡C
°²¦p¦³ÓÀɮתø«×¬O 210H Ӧ줸²Õ¡A²{¦bÀɮ׫ü¼Ð«ü¦b 100H ªº¦ì¸m¡C·í¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä®É¡A²@µLÄa©À¡AÅýÀɮ׫ü¼Ð¥[ 100H¡AÅܦ¨ 200H¡A±µµÛª½±µ¸õ¦Ü¡uread_file:¡v¼Ð°O³BŪ¨úÀɮקY¥i¡C¦pªG³o®ÉÔ¦A«ö¤@¦¸¡uDgDn¡vÁä¡A¨º»ò¦¹¨èÀɮ׫ü¼Ð¤w¸g¬O¦b³Ì«á¤@¶¤F ( ³o¤@¶¥uÅã¥Ü 10H Ӧ줸²Õªº¸ê®Æ )¡A©Ò¥H¤£¥²³B²z¡Aª½±µ¸õ¦Ü¡uget_key:¡v¼Ð°O¡AÅý¨Ï¥ÎªÌ«·s«ö«öÁä¡C
AH¡×3FH/INT 21H ¥Dn¬O¥Î¨ÓŪ¨úÀɮסA¦ý¬O¦¹ DOS ªA°Èµ{¦¡¤]·|ÀqÀq¦a±NÀɮ׫ü¼Ð²¾¨ìŪ¨úµ²§ôªº¦ì¸m¡C©Ò¥H¤£¥²¯uªº¥h©I¥s AH¡×42H/INT 21H ³]©wÀɮ׫ü¼Ð¡A¤]´N¬O¤W¤@¬q»¡ªº¡§ª½±µ¸õ¦Ü¡uread_file:¡v¼Ð°O³BŪ¨úÀɮקY¥i¡¨¡C¤£¹L¡A§Ú̦ۦæ©w¸qn°O¿ýÀɮ׫ü¼Ðªº fp_high:fp_low ¨âÅܼơA¥²¶·n¥Ñ¦Û¤vªºµ{¦¡¥[¤W 100H¡C
°²¦pÀɮתø«×¬O 200H Ӧ줸²Õ¡A²{¦bÀɮ׫ü¼Ð«ü¦b 100H ªº¦ì¸m¡C·í¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä®É¡A³B²z¤è¦¡«o¸ò¤W±¤£¤Ó¤@¼Ë¡C³o¬O¦]¬°Àɮ׫ü¼Ð¦b 100H ®É¡A¦b¿Ã¹õ¤W©ÒÅã¥ÜªºÀɮפº®e¬O±q 100H ¨ì 1FFH¡A¨ä³Ì«á¤@Ӧ줸²Õ«ê¦n¬OÀɮקÀ¡A¤]´N¬O»¡¦pªGÁÙnÅýÀɮ׫ü¼Ð¦A¥[¤W 100H¡Aµ²ªGÁÙ¬O¦bÀɮקÀ¡A®Ú¥»Åª¤£¨ìÀɮפº®e¡C°ò©ó¥H¤Wì¦]¡A¤p¤ì°¸ÁÙ¬O§âÀɮ׫ü¼Ð¥[¤W 100H ¤§«á¡A¦AÀˬdÀɮתø«×¬O§_¯à³Q 100H ¾ã°£¡A¦pªG¤£¯à´N¸õ¦Ü¡uread_file:¡v³B¡F¦pªG¯à¾ã°£¡A¦AÀˬd¬O§_¤w¨ìÀɮקÀ¡A¦pªG©|¥¼¨ìÀɮקÀ¡A¤]¸õ¦Ü¡uread_file:¡v³B¡A¦pªG¨ìÀɮקÀ¡A´Nªí¥Ü¤£¥²³B²z¡A¦ýèè¤w¸gÅý fp_high:fp_low ¥[¤W 100H¡A©Ò¥H±N¨äÁÙì§Y¥i¡C¦Ó³o¬qµ{¦¡»P«ö¤U¡uEnd¡vÁ䪺¤@¼Ë¡A¬GµL±ø¥ó¸õ¦Ü¡udivisible:¡v¼Ð°O³B¡C
¸g¹L¥H¤W¤ÀªR¡A¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä®É¡Aµ{¦¡¦p¤U¡G
.ELSEIF ah==51h ;¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä mov dx,f_len_low mov cx,f_len_high mov ax,dx and dx,0ff00h ;CX:DX¡×³Ì«á¤@¶ cmp cx,fp_high ja next_page cmp dx,fp_low ;¦pªGCX:DX¡×fp_high:fp_low¡Aªí¥Ü je get_key ;¤w¨ì³Ì«á¤@¶¸õ¦Üget_key:³B next_page: add fp_low,100h ;¦pªG¦pªGCX:DX¡Õfp_high:fp_low¡A adc fp_high,0 ;ªí¥Ü¥¼¨ì³Ì«á¤@¶ test ax,0ffh ;ÀˬdÀɮפj¤p¬O§_¯à³Q100H¾ã°£ jnz read_file ;¦pªG¤£¯à¾ã°£¡A´NŪ¨úÀÉ®× cmp cx,fp_high ;¦pªG¯à¾ã°£¡AÀˬd¬O§_¤w¨ì«á¤@¶ ja read_file ;¦pªG¤£¬O¡AŪ¨úÀÉ®× cmp dx,fp_low ;¦pªG¬O¡A³Ì«á¤@¶nÅã¥Üªº¦ì¤¸²Õ jz divisible ;ӼƬ°¹s¡A»P¡uEnd¡vÁä¤@¼Ë
³B²z³oÓ«öÁ䪺¤è¦¡³Ì²³æ¡A¥u»Ý§â fp_high:fp_low ³]¬° 0:0 §Y¥i¡Aµ{¦¡½X¦p¤U¡G
.ELSEIF ah==47h ;¨Ï¥ÎªÌ«ö¤U¡uHome¡vÁä mov fp_low,0 ;³]©wÀɮ׫ü¼Ð¬°fp_high:fp_low¡×0:0 mov fp_high,0 jmp set_fp_on_bgn
¨Ï¥ÎªÌ«ö¤U¡uEnd¡vÁä®É¡A¦ü¥G¬O§âÀɮ׫ü¼Ð²¾¨ìÀɮקÀºÝ´N§¹¦¨¤F¡A¦ý¯uªº¬O¦p¦¹¶Ü¡H°²³]¯u¬O³o¼Ë¡A¨º»ò¥Î AH¡×3FH/INT 21H Ū¨ú®É¡A¦]¬°Àɮ׫ü¼Ð¤w¦bÀɮקÀºÝ¡A©Ò¥H¬OŪ¤£¨ìÀɮפº®eªº¡C«e±´£¹L¡AVIEW ¨C¦¸¥uÅã¥Ü 100H Ӧ줸²Õªº¤º®e¡A¦Ó¤j³¡¤ÀªºÀɮתø«×À³¸Ó¤£·|«ê¦n¬O 100H ªº¾ã¼Æ¿¡A©Ò¥H³Ì«á¤@¶¥i¯à¤£¬OÅã¥Ü 100H Ӧ줸²Õ¡A¦Ó¥B¥i¯à¤ñ³o¤p¡C©Ò¥H«ö¤U¡uEnd¡vÁ䪺³B²z¤è¦¡¥i¤À¦¨¨âºØ±¡§Î¡G
²Ä¤@ºØ±¡§Î¡C¹ï¤j³¡¤ÀÀɮתø«×¤£¯à¬° 100H ©Ò¾ã°£ªºÀɮצӨ¥¡Apºâ³Ì«á¤@¶ªºÀɮ׫ü¼Ð¨Ã¤£Ãø¡C¨Ò¦p¦³ÓÀɮרäªø«×¬° 2197 Ӧ줸²Õ¡A´«¦¨¤Q¤»¶i¦ì¬O 895H¡A©Ò¥H³Ì«á¤@¶ªºÀɮ׫ü¼ÐÀ³«ü¦b 800H ³B¡A¤]´N¬O§âÀɮתø«×ªº§C¦r²Õ 0¡ã7 ¦ì¤¸¾B¸n±¼§Y¥i¡A§Q¥Î AND «ü¥O´N¯à¹F¨ì¥Øªº¡C
¦ý¬O¹ï©óÀɮתø«×¯à³Q 100H ¾ã°£ªºÀɮצӨ¥¡A´N¤£¯à³o¼Ëpºâ¤F¡C¦]¬°§â 0¡ã7 ¦ì¤¸¾B¸n±¼«á¡AÀɮ׫ü¼Ð·|²¾¨ìÀɮקÀ¡A¸Ñ¨Mªº¤èªk¬O³Ì«á¤@¶¥²¶·©¹«e²¾¤@¶¡C¨Ò¦p¦³ÓÀɮתø«×¬O 2048¡A´«¦¨¤Q¤»¶i¦ì¬O 800H¡A¾B¸n 0¡ã7 ¦ì¤¸«á¡AÀɮ׫ü¼ÐÅܦ¨ 800H¡Aµ²ªG´N²¾¨ìÀɮקÀ¡A³o·íµM¤£¹ï¡AÀ³¸Ón§â«ü¼Ð²¾¨ì 700H ¤~¹ï¡A¤]´N¬O¦A´î¥h 100H¡Cºî¦X¥H¤W°Q½×¡A³B²z«ö¤U¡uEnd¡vÁ䪺µ{¦¡¦p¤U¡G
.ELSEIF ah==4fh ;¨Ï¥ÎªÌ«ö¤U¡uEnd¡vÁä mov cx,f_len_high ;³]©wÀɮ׫ü¼Ð¬°¶ZÂ÷ÀɮקÀ mov dx,f_len_low ;(Àɮתø/100h¤§¾l¼Æ)Ӧ줸²Õ¡A¤]¥i¥H»¡ and dx,0ff00h ;¶ZÂ÷ÀÉ®×ÀY(f_len_high:f_len_low AND mov fp_high,cx ;FF00)Ӧ줸²Õ mov fp_low,dx test f_len_low,0ffh ;ÀˬdÀɮתø«×¬O§_¯à³Q100H¾ã°£ jnz set_fp_on_bgn ;¦pªG¤£¯à¡A¸õ¦Üset_fp_on_bgn:³B divisible: sub fp_low,100h ;¦pªG¯à¡AÀɮ׫ü¼Ð©¹ÀÉ®×ÀY²¾100H sbb fp_high,0 jmp set_fp_on_bgn
«e±´XÓ³B²z«öÁ䪺¤èªk¡A¦b³]©wÀɮ׫ü¼Ð®É¡A³£¬O¥HÀÉ®×ÀY¬°°ò·Ç¡A³B²z¡uEnd¡v«öÁä¤]¬O¦p¦¹¡F¦ý¨ä¹ê¤£¤@©w³£¥²¶·¥HÀÉ®×ÀY¬°°ò·Ç¡A¤p¤ì°¸·Q¥H¡uEnd¡v«öÁ䬰¨Ò¤l¡A»¡¤@»¡¦pªGn¥HÀɮקÀ¬°°ò·Ç¡A¸Ó¦p¦ó³B²z¡C§ÚÌ¥ý¬Ý¬Ýµ{¦¡½X¡G
.ELSEIF ah==4fh ;¨Ï¥ÎªÌ«ö¤U¡uEnd¡vÁä mov cx,f_len_high mov ax,f_len_low mov fp_high,cx mov fp_low,ax ;¨Ïfp_high:fp_low¡×ÀɮקÀ and ax,0ffh ;ÀˬdÀɮתø«×¬O§_¯à³Q100H¾ã°£ jz divisible ;¦pªG¯à¾ã°£¡A¸õ¦Üdivisible: and fp_low,0ff00h ;³]©wÀɮ׫ü¼Ð¬°¶ZÂ÷ÀÉ®×ÀY(f_len_high sub cx,cx ;:f_len_low AND FF00)Ӧ줸²Õ sub dx,dx sub dx,ax ;CX:DX¡×0-(f_len_low AND FF) sbb cx,0 mov al,2 jmp set_fp divisible: sub fp_low,100h sbb fp_high,0 jmp set_fp_on_bgn
Æ[¹î¤W±ªºµ{¦¡½X¡A«Ü©úÅã¡A¤@¼Ë¥i¤À¦¨¨âºØ±¡§Î¡G¤@ºØ¬OÀɮתø«×«ê¦n¯à³Q 100H ¾ã°£¡F¥t¤@ºØ¬O¤£¯à³Q 100H ¾ã°£¡C¤p¤ì°¸¨Ã¨S¦³§ï¼g«eªÌªº³B²z¤è¦¡¡An°µ¤]¤£¬O¤£¥i¥H¥u¬O¤p¤ì°¸°½Ãi¨S°µ¡C§ï¼g«áªÌªº¤è¦¡¤]¤£Ãø¡A¥u¶·¦b©I¥s AH¡×42H/INT 21H «e¡A¨Ï CX:DX Åܬ°t¼Æ§Y¥i¡C¤]¦³¨âºØ¤èªk¥i¨Ï±o CX:DX Åܬ°t¼Æ¡GⒶ¦b³o¸Ì¤p¤ì°¸¥Î 0 ´î¥h AX ¤§È¡A¦A¥Î SBB «ü¥O¨Ï°ª¦r²Õ¬° ¡Ð1 ( ¨£¥Õ¦âªºµ{¦¡½X )¡FⒷ§Q¥Î²Ä¤»³¹©Ò»¡ªº¡A¬Y¼Æªº¤G¸É¼Æ´N¬O¨ät¼Æ¡C§Q¥Î NEG «ü¥Opºâ¨ä¤G¸É¼Æ¡A¥i¥H´î¤Öµ{¦¡½X¡A¦p¤U¡C¥i¥H¥Î©³¤Uªº¤T¦æ¥N´À¤W±ªº¥Õ¦âµ{¦¡½X¡G
mov dx,ax mov cx,-1 neg dx
¨ì¦¹¡AVIEW.ASM ªº¥Dn¬[ºc¤w¸Ñ»¡§¹²¦¡A¨Ó¬Ý¬Ý§¹¾ãªºì©lµ{¦¡¡C
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
33 34 35 36
37 38 39 40
41 42 43 44
45 46 47 48
49 50 51 52
53 54 55 56
57 58 59 60
61 62 63 64
65 66 67 68
69 70 71 72
73 74 75 76
77 78 79 80
81 82 83 84
85 86 87 88
89 90 91 92
93 94 95 96
97 98 99 100
101 102 103 104
105 106 107 108
109 110 111 112
113 114 115 116
117 118 119 120
121 122 123 124
125 126 127 128
129 130 131 132
133 134 135 136
137 138 139 140
141 142 143 144
145 146 147 148
149 150 151 152
153 154 155 156
157 158 159 160
161 162 163 164
165 166 167 168
169 170 171 172
173 174 175 176
177 178 179 180
181 182 183 184
185 186 187 188
189 190 191 192
193 194 195 196
197 198 199 200
201 202 203 204
205 206 207 208
209 210 211 212
213 214 215 216
217 218 219 220
221 222 223 224
225 226 227 228
229 230 231 232
233 234 235 236
237 238 239 240
241 242 243 244
245 246 247 248
249 250 251 252
253 254 255 256
257 258 259 260
261 262 263 264
265 266 267 268
269 270 271 272
273 274 275 276
277 278 279 280
281 282 283 284
285 286 287 288
289 290 291 292
293 294 295 296
297 298 299 300
301 302 303 304
305 306 307 308
309 310 311 312
313 314 315 316
317 318 319 320
321 322 323 324 |
;VIEW ¯àÅý¨Ï¥ÎªÌ¿é¤JÀɦW¡A¦Ó«áÅã¥Ü³oÓÀɮתº¤º®e
;²ÕĶ¡Gml view.asm
.MODEL SMALL,C
.386
;*******************************************************************************
.STACK
;*******************************************************************************
video SEGMENT PARA AT 0b800h ;µø°T°O¾ÐÅé°Ï¬q
video ENDS
;*******************************************************************************
.DATA
f_handle DW ? ;ÀÉ®×¥N½X
fp_low DW 0 ;Àɮ׫ü¼Ð¡A§C¦r²Õ
fp_high DW 0 ;Àɮ׫ü¼Ð¡A°ª¦r²Õ
f_len_low DW ? ;Àɮפj¤p¡A§C¦r²Õ
f_len_high DW ? ;Àɮפj¤p¡A°ª¦r²Õ
field_name DB " Offset 00 01 02 03 04 05 06 07-08 09 0A 0B 0C 0D ",
"0E 0F 01234567-89ABCDEF"
line DB 78 DUP (0c4h)
help_text DB "Esc=Exit J=Jump PgDn/PgUp=Forward/Backward Home/",
"End=Begin/End"
msg00 DB "No assign file. Usage:",0dh,0ah," VIEWFILE filename$"
msg01 DB "Input filename to view : $"
msg02 DB "Input file pointer (range:0-12345678) : "
msg03 DB "Only Arabic number or English A-F. Press any key."
msg04 DB "Input too large number. Press any key. "
msg05 DB 50 DUP (" ")
msg06 DB 13,10,"Can not ope"
filename DB 66,?,64 DUP ("$")
buffer DB 256 DUP (0)
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
;¦b²Ärw¦C¤¤¥HcolorªºÃC¦âÅã¥Ü¤@¦r¦ê¡A¦¹¦r¦ê¦ì§}¦bpstr³B¡Aªø«×¬°len¦ì¤¸²Õ
print_a_line PROC rw:WORD, pstr:WORD, len:WORD, color:BYTE
mov ax,rw ;pºâ²Ärw¦C²Ä¹s¦æ¦bµø°T°O
call video_address ;¾ÐÅ餤ªº¦ì§}¡A¨Ã¦s©óDIùØ
mov ah,color
mov si,pstr
next: lodsb
stosw
dec len
jnz next
ret
print_a_line ENDP
;-------------------------------------------------------------------------------
;Åý¨Ï¥ÎªÌ¿é¤J32¦ì¤¸ªº¤Q¤»¶i¦ì¼Æ¡C¥¿½T¡GNC¡ACX:DX¡×¨Ï¥ÎªÌ¿é¤Jªº32¦ì¤¸¼Æ¡F¿ù»~¡GCY
input_number PROC
INVOKE print_a_line,22,OFFSET msg02,SIZEOF msg02,7
sub di,24 ;§âµø°T°O¾ÐÅé¦ì§}³]©w¬°¡u©Ò¯à¿é¤Jªº³Ì¤j
mov dx,f_len_high ;½d³ò¦r¦ê¡vªº¦ì§}
call print_dx ;¦L¥X¨Ï¥ÎªÌ©Ò¯à¿é¤Jªº³Ì¤j°ª¦r²Õ
mov dx,f_len_low
dec dx
call print_dx ;¦L¥X¨Ï¥ÎªÌ©Ò¯à¿é¤Jªº³Ì¤j§C¦r²Õ
mov dx,1628h
mov bh,0
mov ah,2
int 10h ;³]©w´å¼Ð¦ì¸m©ó²Ä16H¦C²Ä28H¦æ
mov bx,8 ;¤@Ó¦r²Õªº¤Q¤»¶i¦ì¼Æ¦³¥|¦ì
xor cx,cx ;¨ÏCX:DXÂk¹s¡A¨Ï¥ÎªÌ¿é¤Jªº¼ÆȦs©ó¦¹
sub dx,dx
next_digit: mov ah,1 ;DOSªA°Èµ{¦¡¡AÁä½L¿é¤J¦r¤¸
int 21h ;AL¡×¿é¤J¦r¤¸ªºASCII½X
.IF (al>="0")&&(al<="9")
sub al,"0"
.ELSEIF (al>="A")&&(al<="F")
sub al,37h
.ELSEIF (al>="a")&&(al<="f")
sub al,57h
.ELSEIF al==0dh
jmp input_ok
.ELSE
mov dx,OFFSET msg03
mov cx,SIZEOF msg03
print_err_msg: INVOKE print_a_line,22,dx,cx,7
mov ah,0
int 16h
INVOKE print_a_line,22,OFFSET msg05,SIZEOF msg05,7
stc
jmp exit_input
.ENDIF
shld cx,dx,4 ;¦¹¦æ¸ò¤U¤@¦æ°õ¦æCX:DX¡×CX:DX¡Ñ10H
shl dx,4
add dl,al ;CX:DX¡×CX:DX¡ÏAL
dec bx
jnz next_digit
input_ok: cmp f_len_high,cx
ja finish
jb too_large
mov ax,f_len_low
dec ax
cmp dx,ax
jbe finish
too_large: mov dx,OFFSET msg04
mov cx,SIZEOF msg04
jmp print_err_msg
finish: and dx,0ff00h
INVOKE print_a_line,22,OFFSET msg05,SIZEOF msg05,7
clc
exit_input: ret
input_number ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õ¤W¦L¥XDLªº¤Q¤»¶i¦ì¼ÆÈ
print_dl PROC
rol dl,4
call print_4_bits
rol dl,4
print_4_bits:: mov al,dl
and al,0fh
add al,30h
cmp al,39h
jbe ok
add al,7
ok: stosw
ret
print_dl ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õ¤W¦L¥XDX¤§¤Q¤»¶i¦ì¼ÆÈ
print_dx PROC
mov cx,4
next: rol dx,4
call print_4_bits
loop next
ret
print_dx ENDP
;-------------------------------------------------------------------------------
video_address PROC ;pºâ²ÄAX¦C²Ä¹s¦æ¦bµø°T°O¾ÐÅ餤ªº¦ì§}«á¦s©óDIªð¦^
mov bl,160 ;¨C¤@¦C¦³80Ó¦r¤¸¡A¨C¦r¤¸¦û¥Î¤@ÓASCII½X¤ÎÃC¦â
mul bl ;¦]¦¹¨C¤@¦C¦û¥Î160Ӧ줸²Õ
mov di,ax
ret
video_address ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õªº²Ärw¦C¦L¥Xpdata©Ò«ü¦ì§}ªºlnӦ줸²Õªº¸ê®Æ¡A¦Ó³Ì¥ªÄæ¦L¥Xpt_hi:pt_lw
print_data PROC rw:WORD, pdata:WORD, pt_lw:WORD, pt_hi:WORD, ln:WORD
LOCAL clm:WORD ;²Ä´X¦æ
;²M°£²Ä¥|¦C¨ì²Ä¤Q¤E¦C¡A¦@16¦C¡A¨C¦C80Ó¦r¤¸¡A¨CÓ¦r¤¸¦³ASCII½X¤ÎÃC¦â¨âӦ줸²Õ
mov ax,rw
call video_address
mov cx,16*80
mov ax,720h ;20h¡×ªÅ¥Õ¦r¤¸¡A7ªí¥Ü«e´º¦Ç¦âI´º¶Â¦â
rep stosw
;³]©wclm¬°¹s¡ASI¬°Åª¨úÀɮ׫᪺¦s©ñ¦ì§}
mov clm,cx ;¨ÏclmÂk¹s
mov si,pdata
;pºâ¨C¦Cµø°T°O¾ÐÅé°_©l¦ì§}¤Î¦L¥XASCII¦r¤¸ªº°_©l¦ì§}¡]§Y¨C¦C²Ä59¦æªº¦ì§}¡^
next_row: mov ax,rw
call video_address
mov bx,di ;ES:DI¡×¨C¦Cµø°T°O¾ÐÅé°_©l¦ì§}
add bx,118 ;ES:BX¡×¨C¦C¦L¥XASCII¦r¤¸ªº°_©l¦ì§}
;¦L¥Xn¶É¦LªºÀɮפº®e¦ì¸m
mov dx,pt_hi ;¦L¥Xn¶É¦LªºÀɮפº®e¦ì¸m¡]¸û°ª¦r²Õ¡^
mov ah,0fh ;AH¡×0FHªí¥Ü«e´º¥Õ¦â¡AI´º¶Â¦â
call print_dx
mov al,":" ;¦L¥X¡u:¡v
stosw
mov dx,pt_lw ;¦L¥Xn¶É¦LªºÀɮפº®e¦ì¸m¡]¸û§C¦r²Õ¡^
mov ah,0fh
call print_dx
;¥H¤Q¤»¶i¦ì¦L¥XÀɮרCӦ줸²Õªº¤º®e¡A¤Î¨äASCII¦r¤¸
next_byte: mov ax,0e20h
cmp clm,8 ;Àˬd¬O§_¨C¦æ¤w¦L¥X¤KӦ줸²Õ¤F
jne print_it ;Y¬O¡A¦L¥X¤À¹j²Å¸¹¡u-¡v
mov WORD PTR es:[bx],0d2dh
mov ax,0d2dh
add bx,2
print_it: stosw ;Y§_¡A¦L¥XªÅ¥Õ©Î¤£¦L
mov cx,4
self: loop self
mov dl,[si] ;¨ú±o¤@Ӧ줸²ÕªºÀɮפº®e
mov dh,0bh
mov es:[bx],dx ;¦L¦b¥kÃä¥HASCII¦r¤¸ªí¥ÜªºÀɮפº®e
mov ah,0eh
call print_dl ;¦L¦b¤¤¶¡¥H¤Q¤»¶i¦ìªí¥ÜªºÀɮפº®e
inc si ;«ü¦V¤U¤@Ӧ줸²ÕªºÀɮפº®e
add bx,2
inc clm
dec ln ;¦pªGln¬°¹s¡Aªí¥Ü¤w¸g¦L§¹¤F
jz finish
cmp clm,10h ;Yclm¡×10h¡Aªí¥Ü¤w¦L§¹¤@¦C¤F
jne next_byte
inc rw
mov clm,0
add pt_lw,10h
adc pt_hi,0
jmp next_row
finish: ret
print_data ENDP
;-------------------------------------------------------------------------------
.STARTUP
mov ah,9
mov dx,OFFSET msg01
int 21h
mov ah,0ah ;¿é¤JnÆ[¹î¤º®eªºÀÉ®×
mov dx,OFFSET filename
int 21h
mov bx,OFFSET filename+1
movzx cx,BYTE PTR [bx] ;CX¡×ÀɮצWºÙªø«×
add bx,cx
mov BYTE PTR [bx+1],0 ;§âfilename¸Ìªº¦r¦êÅܦ¨ASCIZ
mov dx,OFFSET filename+2 ;¶}±ÒÀÉ®×
mov ax,3d00h
int 21h
jnc set_video ;Y¥¿½T¶}±ÒÀɮסA¸õ¦Üset_video
mov bx,OFFSET filename ;YµLªk¶}±ÒÀɮסA§âmsg06»P
mov WORD PTR [bx],206eh ;filename¨â¦r¦ê³s¦b¤@°_¡A¦¨¬°
mov dx,OFFSET msg06 ;¡uCan not open xxxx¡v¡AµM«á¦L¥X
mov ah,9 ;¨Ó¡Aµ²§ôµ{¦¡
int 21h
jmp exit
set_video: mov f_handle,ax
mov ax,3 ;§â¿Ã¹õ³]¬°16¦â80¡Ñ25¤å¦r¼Ò¦¡
int 10h
;¦L¥XnÆ[¹îªºÀɮצWºÙ¡BÄæ¦ì¡B¤W¤U¨â±ø¤À¹j½u¤Î«öÁ仡©ú
cld
mov ax,video
mov di,80 ;§âÀɮצWºÙ¦L¦b¿Ã¹õ²Ä¹s¦Cªº¤¤¶¡
mov es,ax
mov si,OFFSET filename+2
sub di,cx ;ÀɦW¦b¿Ã¹õªº¦æ¼Æ¡×(80-ÀɦWªø)/2
mov ah,0fh ;¦ý¨CÓ¦r¤¸¦û¥Î¨âӦ줸²Õ¡A¤@¬O
and di,0fffeh ;ASCII½X¡A¥t¤@Ó¬OÃC¦â¡A©Ò¥HÁÙn¦A
nxt_chr_of_fn: lodsb ;¼¥H2¡Aè¦n©è®ø¡A¦ý©_¼Æ¦ì§}¬OÃC¦â
cmp al,"a" ;¬G¥Î¡uAND DI,0FFFEh¡vÅÜ°¸¼Æ¦ì§}
jb @f
cmp al,"z"
ja @f
and al,0dfh ;§ï¦¨¤j¼g
@@: stosw
loop nxt_chr_of_fn
INVOKE print_a_line,2,OFFSET field_name,SIZEOF field_name,7
INVOKE print_a_line,3,OFFSET line,SIZEOF line,9
INVOKE print_a_line,20,OFFSET line,SIZEOF line,9
INVOKE print_a_line,21,OFFSET help_text,SIZEOF help_text,7
;¨ú±oÀɮתø«×¡A¨Ã¦s¤Jf_len_high:f_len_low
mov ax,4202h
mov bx,f_handle
xor cx,cx
xor dx,dx
int 21h
mov f_len_high,dx
mov f_len_low,ax
set_fp_on_bgn: mov cx,fp_high
mov dx,fp_low
mov al,0 ;¥HÀÉ®×°_ÀY¬°°ò·Ç
set_fp: mov ah,42h ;³]©wÀɮ׫ü¼Ð¦bCX:DX³B
mov bx,f_handle
int 21h
read_file: mov ah,3fh
mov bx,f_handle
mov cx,100h ;Ū¨ú100HӦ줸²Õ
mov dx,OFFSET buffer
int 21h
INVOKE print_data,4,OFFSET buffer,fp_low,fp_high,ax
get_key: mov ah,0
int 16h ;¨Ï¥ÎªÌ¿é¤J«öÁä
.IF ah==24h ;¨Ï¥ÎªÌ«ö¤U¡uJ¡vÁä
call input_number
jc get_key
mov fp_high,cx
mov fp_low,dx
jmp set_fp_on_bgn
.ELSEIF ah==49h ;¨Ï¥ÎªÌ«ö¤U¡uPgUp¡vÁä
cmp fp_high,0 ;ÀˬdÀɮ׫ü¼Ð¬O§_¦bÀÉ®×ÀY¡A§YÀˬd
jnz not_bgn ;fp_high:fp_low¬O§_¬°0:0¡AY¬°¹sªí¥Ü
cmp fp_low,0 ;¦bÀÉ®×ÀY¡A§Y¨Ï«ö¤U¡uPgUp¡vÁä¡A¤]
jz get_key ;µL§@¥Î¡A¸õ¦Üget_key:³B
not_bgn: sub fp_low,100h ;Y¤£¦bÀÉ®×ÀY¡A¨ÏÀɮ׫ü¼Ð©¹ÀÉ®×ÀY
sbb fp_high,0 ;²¾100HӦ줸²Õ
jmp set_fp_on_bgn
.ELSEIF ah==51h ;¨Ï¥ÎªÌ«ö¤U¡uPgDn¡vÁä
mov dx,f_len_low
mov cx,f_len_high
mov ax,dx
and dx,0ff00h ;CX:DX¡×³Ì«á¤@¶
cmp cx,fp_high
ja next_page
cmp dx,fp_low ;¦pªGCX:DX¡×fp_high:fp_low¡Aªí¥Ü
je get_key ;¤w¨ì³Ì«á¤@¶¸õ¦Üget_key:³B
next_page: add fp_low,100h ;¦pªG¦pªGCX:DX¡Õfp_high:fp_low¡A
adc fp_high,0 ;ªí¥Ü¥¼¨ì³Ì«á¤@¶
test ax,0ffh ;ÀˬdÀɮפj¤p¬O§_¯à³Q100H¾ã°£
jnz read_file ;¦pªG¤£¯à¾ã°£¡A´NŪ¨úÀÉ®×
cmp cx,fp_high ;¦pªG¯à¾ã°£¡AÀˬd¬O§_¤w¨ì«á¤@¶
ja read_file ;¦pªG¤£¬O¡AŪ¨úÀÉ®×
cmp dx,fp_low ;¦pªG¬O¡A³Ì«á¤@¶nÅã¥Üªº¦ì¤¸²Õ
jz divisible ;ӼƬ°¹s¡A»P¡uEnd¡vÁä¤@¼Ë
.ELSEIF ah==47h ;¨Ï¥ÎªÌ«ö¤U¡uHome¡vÁä
mov fp_low,0 ;³]©wÀɮ׫ü¼Ð¬°fp_high:fp_low¡×0:0
mov fp_high,0
jmp set_fp_on_bgn
.ELSEIF ah==4fh ;¨Ï¥ÎªÌ«ö¤U¡uEnd¡vÁä
mov cx,f_len_high
mov ax,f_len_low
mov fp_high,cx
mov fp_low,ax ;¨Ïfp_high:fp_low¡×ÀɮקÀ
and ax,0ffh ;ÀˬdÀɮתø«×¬O§_¯à³Q100H¾ã°£
jz divisible ;¦pªG¯à¾ã°£¡A¸õ¦Üdivisible:
and fp_low,0ff00h ;³]©wÀɮ׫ü¼Ð¬°¶ZÂ÷ÀÉ®×ÀY(f_len_high
sub cx,cx ;:f_len_low AND FF00)Ӧ줸²Õ
sub dx,dx
sub dx,ax ;CX:DX¡×0-(f_len_low AND FF)
sbb cx,0
mov al,2
jmp set_fp
divisible: sub fp_low,100h
sbb fp_high,0
jmp set_fp_on_bgn
divisible: sub fp_low,100h ;¦pªG¯à¡AÀɮ׫ü¼Ð©¹ÀÉ®×ÀY²¾100H
sbb fp_high,0
jmp set_fp_on_bgn
.ELSEIF ah==1 ;¨Ï¥ÎªÌ«ö¤UEscÁä
mov ah,3eh ;Ãö³¬ÀɮסA°h¥Xµ{¦¡
mov bx,f_handle
int 21h
jmp exit
.ELSE
jmp get_key
.ENDIF
jmp read_file
exit: .EXIT 0
;*******************************************************************************
END |
VIEW.ASM ÁöµM¦³¤T¦Ê¦h¦æ¡A¦ý¦³³\¦h°Æµ{¦¡¡A¦b«e±ªº³¹¸`³£¤w¤¶²Ð¹L¤F¡A¦Ó¥Dµ{¦¡ªº¬[ºc¤]¤wÁ¿§¹¡C¤p¤ì°¸Ä±±o¦³¥²n¤¶²Ðªº¬O¦b¡uinput_number¡v°Æµ{¦¡¤¤¡A¿é¤J¤@Ó¤T¤Q¤G¦ì¤¸ªº¼ÆÈ¡AÀx¦s¦b¨âÓ¤Q¤»¦ì¤¸ªº¼È¦s¾¹¡ACX:DX¡Aªº«ü¥O¡ASHLD¡C
SHLD ¬O«üÂùºë«×¦V¥ª²¾ªºÁY¼g¡Aì¤å¬O double precision shift left¡A¨ä¤¤¡udouble precision¡v¬O«üÂùºë«×¡A·N«ä¬O¥Î 64 ¦ì¤¸ªº¤G¶i¦ì¼Æ¨Óªí¥Ü¯BÂI¼Æ©Î¾ã¼Æ¡A¶¶±a»¡¤@»¡³æºë«×¬O¥Î 32 ¦ì¤¸ªí¥Ü¡C¦b³o¸ÌªºÂùºë«×«h¬Oªí¥Ü¡ASHLD «ü¥O³Ì¦h¥i¥H³B²z 64 ¦ì¤¸ªº°O¾ÐÅéÅܼƩμȦs¾¹¡CSHLD «ü¥O»yªk¬O¡G
SHLD ¥Øªº¹Bºâ¤¸,¨Ó·½¹Bºâ¤¸,p¼Æ¹Bºâ¤¸
SHLD ·|§â¥Øªº¹Bºâ¤¸¦V¥ª²¾´XӦ줸¡A¦Ü©ó²¾´XӦ줸¦bp¼Æ¹Bºâ¤¸¤¤«ü©w¡F¥Øªº¹Bºâ¤¸¥ª²¾¼ÆӦ줸«á¡A¥kÃä¦h¥X¨Óªº¼ÆӦ줸¥Ñ¨Ó·½¹Bºâ¤¸¸û°ªªº¼ÆӦ줸¶ñº¡¡A¥ªÃä²¾¥Xªº¦ì¤¸³£²¾¤J¶i¦ìºX¼Ð¤¤¥B·|Âмg«e¦¸ªºµ²ªG¡A¦Ó¨Ó·½¹Bºâ¤¸¦b¾ãÓ¹Lµ{¤¤¨äȤ£ÅÜ¡C
¥Øªº¹Bºâ¤¸¥i¥H¬O 16¡B32¡B64 ¦ì¤¸ªº¼È¦s¾¹©Î°O¾ÐÅéÅܼơA¨Ó·½¹Bºâ¤¸¥u¯à¬O»P¥Øªº¹Bºâ¤¸¬Û¦P¦ì¤¸¼Æªº¼È¦s¾¹ ( ·N«ä¬O¥Øªº¹Bºâ¤¸¬O 16 ¦ì¤¸¡A¨Ó·½¹Bºâ¤¸¥u¯à¬O 16 ¦ì¤¸ªº¼È¦s¾¹¡FY¥Øªº¹Bºâ¤¸¬O 32 ¦ì¤¸¡A¨Ó·½¹Bºâ¤¸¥u¯à¬O 32 ¦ì¤¸ªº¼È¦s¾¹¡K¡K)¡C
p¼Æ¹Bºâ¤¸¥u¯à¬O CL ¼È¦s¾¹©Î¤K¦ì¤¸ªº±`¼Æ¡A¦b 64 ¦ì¤¸¹w³]¼Ò¦¡¤U©Î«D 64 ¦ì¤¸ ( ¥]§t¯u¹ê¼Ò¦¡¡B32 ¦ì¤¸«OÅ@¼Ò¦¡ ) ®É¡Ap¼Æ¦ì¤¸³Ì¦h¬O 1Fh¡A¥ç§Y³Ì¦h¥u¯à¦V¥ª¦ì²¾ 31 ¦ì¤¸¡C¦pªG¥ª²¾¶W¹L 31 ¦ì¤¸¡A¨º»òpºâµ²ªG¥¼©w¸q¡C
¦pªGp¼Æ¹Bºâ¤¸µ¥©ó¤@©Î¶W¹L¤@¡A¶i¦ìºX¼Ð¬O³Ì«á¤@¦¸±q¥Øªº¹Bºâ¤¸²¾¥Xªºµ²ªG¡C¦pªG¹Bºâ«á¡A¥Øªº¹Bºâ¤¸¬°¹s¡A¹sȺX¼Ð³]¬°¤@¡A§_«h³]¬°¹s¡C¦pªG¹Bºâµ²ªG¡A³Ì°ª¦ì¤¸¬°¤@¡A²Å¸¹ºX¼Ð³]¬°¤@¡A§_«h³]¬°¹s¡C¦pªGp¼Æ¹Bºâ¤¸¬°¤@¡A¥B¥Øªº¹Bºâ¤¸µo¥ÍÅܸ¹¡A·¸¦ìºX¼Ð³]¬°¤@¡A§_«h³]¬°¹s¡F¦pªGp¼Æ¦ì¤¸¶W¹L¤@¡A·¸¦ìºX¼Ðªºµ²ªG¬°¥¼©w¸q¡C
SHRD ªº¹Bºâ¹Lµ{»P SHLD Ãþ¦ü¡A¥u¦³¤@Ó¦a¤è¤£¦P¡ASHRD ¬O§â¥ØªººX¼Ð¦V¥k²¾°Ê¼ÆӦ줸¡A¨ä¾l³£»P SHLD ¤@¼Ë¡CSHRD ªº»yªk¬O¡G
SHRD ¥Øªº¹Bºâ¤¸,¨Ó·½¹Bºâ¤¸,p¼Æ¹Bºâ¤¸
SHLD »P SHRD ¨â«ü¥Oªº¤u§@¤è¦¡¤w¤¶²Ð§¹¡A©³¤UÁ|¤@Ó¨Ò¤l»¡©ú SHLD¡A¨ÏŪªÌ§ó¥[ÁA¸Ñ¡G
mov dx,876h mov ax,0abcdh shld dx,ax,4
°Ñ¦Ò¤U¹Ï¡ADX Åܦ¨¤G¶i¦ì¼Æ¤§«á¬O¡u0000 1000 0111 0110¡v¡AAX ¬O¡u1010 1011 1100 1101¡v¡C°õ¦æ¡ushld dx,ax,4¡v®É¡ADX ©Ò¦³¦ì¤¸§¡¦V¥ª²¾¥|¦¸¨C¦¸¥ª²¾¤@Ӧ줸¡C²Ä¤@¦¸¥ª²¾®É¡A²Ä 15 ¦ì¤¸ ( ¨£µµ¦â¦r¡A15 ) ²¾¥X DX ¦Ü¶i¦ìºX¼Ð ( CF )¡A²Ä 14 ¦ì¤¸²¾¦Ü²Ä 15 ¦ì¤¸¡B²Ä 13 ¦ì¤¸²¾¦Ü²Ä 14 ¦ì¤¸¡K¡K¡A¦p¤U¹Ï¤¤ªº³Ì¤W¹Ï¬õ¦â½bÀY¡Aµ²ªGÅܦ¨¤U¹Ï¡u²Ä¤@¦¸¥ª²¾«á¡v¡C¦ý¦¹«ü¥Oªºp¼Æ¹Bºâ¤¸¬O 4¡A©Ò¥HÁÙn¥ª²¾¤T¦¸¡A¦p¤U¹Ï©Ò¥Ü¡u³Ì«áµ²ªG¡vÁ`µ²¨Ó»¡¡ADX ¥Ñ 0876H Åܦ¨ 876AH¡A¥ª²¾«áªÅ¥X¨Óªº³Ì§C¥|Ӧ줸¡A¥Ñ AX ³Ì°ª¥|Ӧ줸¶ñ¸É¡A¦Ó AX ¦b¾ãÓ¹Lµ{¤¤¤£ÅÜ¡C¶i¦ìºX¼Ð¬O³Ì«á¤@¦¸¥ª²¾ªºµ²ªG¡A·|³Q²M°£ ( ¶i¦ìºX¼Ð¬°¹s )¡C²Å¸¹ºX¼Ð·|³Q³]©w ( ªí¥Ü²Å¸¹ºX¼Ð¬°¤@ )¡A¦]¬°¥Øªº¹Bºâ¤¸³Ì°ª¦ì¬O¤@¡C¹sȺX¼Ð³Q²M°£ ( ¹sȺX¼Ð¬°¹s )¡A¦]¬°¥Øªº¹Bºâ¤¸¤£¬°¹s¡C