4、方程AX2+BX+C=0是否有实根。若有实根,则将字节变量tag置1,否则置0。假设A、B、C均为字节变量,数据范围为-128~127。流程图:开始输入A,B,C计算B*B和4*A*CB*B>=4*A*CNY输出:TAG=1输出:TAG=0结束(2)程序代码:DATASSEGMENTA1DB?B1DB?C1DB?TAGDB?;此处输入数据段代码DATASENDSCODESSEGMENTASSUMECS:CODES,DS:DATASSTART:MOVAX,DATASMOVDS,AXMOVAH,01H;输入第一个数据INT21HSUBAL,30H;输
5、入数据存入A,并转化为十进制数MOVA1,ALMOVAH,01H;输入第二个数据INT21HSUBAL,30HMOVB1,ALMOVAH,01H;输入第三个数据INT21HSUBAL,30H;输入数据存入C,并转化为十进制数MOVC1,ALMOVAL,B1MULAL;计算B*B,结果存入AXMOVBX,AX;B*B结果存入BXMOVAL,A1IMULC1MOVCL,4IMULCL;计算4*A*CCMPBX,AXJGET1MOVTAG,0JMPNEXT1T1:MOVTAG,1;有根,将TAG赋值为1NEXT1:ADDTAG,30HMOVDL,TAG
6、;输出TAG的值MOVAH,02HINT21HMOVAH,4CHINT21HCODESENDSENDSTART程序结果:B*B-4AC=0,>0,<0的三种情况2、编写一个程序,判别键盘上输入的字符;若是1-9字符,则显示之;若为A-Z字符,显示“C”;若为a-z字符,显示“c”;若是回车字符(其ASCII码为0DH),则结束程序,若为其它字符则显示显示“R”。流程图:DATASSEGMENT;此处输入数据段代码结果DATASENDSCODESSEGMENTASSUMECS:CODES,DS:DATASSTART:MOVAX,DATASM
7、OVDS,AXMOVAH,01HINT21HCMPAL,'1';同1比较JNBONEONE:CMPAL,'9';同9比较JLREADJGETOWREAD:MOVDL,ALMOVAH,02HINT21HMOVAH,4CHINT21HTOW:CMPAL,'A';同A比较JGEAA:CMPAL,'Z';同Z比较JLREAD1JGETHREEREAD1:MOVDL,'C'MOVAH,02HINT21HMOVAH,4CHINT21HTHREE:CMPAL,'a';同a比较JGEB;>a则转到BB:CMPAL,'z';同z比较JLREAD2JGEFOURRE
8、AD2:MOVDL,'c'MOVAH,02HINT21HMOVAH,4CHINT21HFOUR:CMPAL,0DHJZCRJNZFIVE