|
[必读]新人导航和报到贴(报到时勿另发帖)
报道。。。 |
|
[原创]简单随即数抽取(16位实模式)
沙发。。。 如果大伙发现有错误和需要详细说明的地方,就请留下笔迹。我一定会加以改进的,并且一定给出最详细的说明。 补充一个疏漏,介绍一款16位的编译器 MasmEditor 作者是贺远毅,该编译器如果需要调试功能就必须注册。不注册只是少了一个调试的功能而已,咱们可以用里面的Debug去调试效果也是一样的。 |
|
[原创]简单随即数抽取(16位实模式)
子程序算法分析: ;子程序名:BCD_TO_HEX ;功 能:将接收到的BCD码转换成为可处理的数据 ;入口参数:AL = ;出口参数:BH = / BX = BCD_TO_HEX PROC xor bx, bx ;清零 mov cx, 8 lea si, array and al, 0fh ;只提取0-9的变化值,将其他数据屏蔽 repeat_: shr al, 1 jc pro inc si jmp tail ; shr 向右移位指令,其中的最低位在每次移位是进入标志寄存器CF中 ; jc 判断当 CF 中的数据为1的时候则跳 pro: mov bl, byte ptr [si] add bh, bl inc si ; array db 1, 2, 4, 8, 16, 32, 64, 128,'$' ^ ^ ^ ^ ^ ^ ^ ^ ; 0 1 2 3 4 5 6 7 ; 将数组中 si 对应的数据提取出来, si 的值是多少则对应的以 si 为下标取数 ; 比如 si = 2 则对应的数据为 4 ; 取出数据后将其与 bh 中的值相加,bh 初始值为 0 ;举例:比方说现在 al 实参的数据为 0000 1001 (al 中的数据范围永远是 0-9) ; 则可以根据以上的语句得到如下的式子:1+8=9 ; 经过以上分析可以证明,该子程序有将 BCD 码转换成为十进制数据的能力 tail: loop repeat_ xor bl, bl ret BCD_TO_HEX ENDP |
|
[下载]2010最新 价值上亿的黑客教程(XAHZAD)1
这个也得会点。。。 |
|
|
|
[原创]再议汇编判断闰年(16位实模式)
以上就是判断闰年程序修改后的全部代码,希望对大家有所帮助。 有一句话我想说给初学的朋友们听,把这段代码修改正确我是经过了很长的一段时间。原先以为修改对了,可是过段时间再调试的时候我依然发现了问题;间间断断的阅读和修改才终于将代码改正确了。我最初学C的时候曾经在某论坛某报纸某新闻中看到某某知名人士在毫无计算机基础的情况下学C语言只用了一个月就完全掌握了,然后立刻加入了某某开发团队开发出了某某大型的程序。如果粗俗一点我会对那家媒体说:你放屁。毕竟学编程不是一周不是一个月不是一年能学会的东西,它是需要靠长时间的积累和饱满的热情去对待的。所以当初学朋友看到类似以上媒体的言论请不要理会,他们只会误导你对学习编程的心态。 我相信大牛门都是经过自己长时间积累才能被人们称为大牛的,如果仅靠一个月就成为大牛我觉得中国的软件水平该有多发达。可看看事实却是截然不同的,中国的软件业和软件水平也只是刚刚起步。举个简单的例子国外(欧美)有个Demo大赛,里面的高手用汇编语言写3D动画仅仅不到90K而且还带有声音。放眼中国,基本上没有人可以做到。他们有今天的成就完全是一种责任和态度,较完善的教育体制和教材,成熟的团队优秀的老师等等了。我不是崇洋媚外,只是说明白事实,我觉得人只有看到自己的不足才可能采取措施。天天盯着自己的有点看,那此人就得去精神病院逛逛了;人亦如此,国家也亦是如此。 很感谢大家能看完这一堆的唠叨,我会陆续的发表新的内容。 如果大家发现以上程序有问题,很感谢你能回复给我。我会虚心的接受,并仔细的思考和修改的。 再次感谢大家。 |
|
[原创]再议汇编判断闰年(16位实模式)
判断闰年的算法:(year%4==0)&&(year%100!=0)||year%400==0 一个年份若它能被4整除同时不能被100整除,或能被400整除的年份是闰年 ;子程序名:Asc_to_Hex ;功 能:将以 ASCII形式输入的数据转换成为16进制表示的数据 ;入口参数:CX = Buf+1 ;出口参数: Asc_to_Hex PROC NEAR push cx dec cx lea si, Buf + 2 ;以上内容是将指针计数器 cx 减少一位,作为以后面算法的需要 Point_tail: inc si loop Point_tail ;此处就是执行将指针向后移动 ;例:首先假设我们输入的是4位数字的年份(例如:2004) cx=4 ;以上对CX必须自减1的原因是(以下模拟内存) ; | ? | 2 | 0 | 0 | 4 | ? | ; ^(lea si, Buf + 1 指针指向首地址) 如果我们不自减1 cx=4,而计算4次指针会指向未知数据 ;如 | ? | 2 | 0 | 0 | 4 | ? | ; ^ <-移动 cx=4 指针此时指向的是未知的数据,必然导致输出的错误 ;正确应该如下 ; | ? | 2 | 0 | 0 | 4 | ? | ; ^ <-cx=3 pop cx mov dh, 30h mov dl, 10 mov bx, 1 mov ax, 0 ; ;以上属于赋初值,每个寄存器均有独到的作用 ;mov dh, 30h 作用:因为键盘输入的内容属于ASCII码形式,可我们需要的数据是16进制形式,所以要进行转换 ;将原ASCII数据 减去 30h 就可以得到对应的16进制数据的形式 ;mov dl, 10 作用:作为一个固定的乘积,为以下算法分析铺垫 ;mov bx, 1 作用:乘数(数据会改变) ;mov ax, 0 作用:存数用的寄存器(数据会改变) To_Asc: mov al, byte ptr [si] sub al, dh push dx mul bx pop dx add Write, ax push ax mov ax, bx mul dl mov bx, ax pop ax dec si loop To_Asc ret Asc_to_Hex ENDP ;To_Asc的作用:是将每个输入的ASCII码数据提出并且将其变换成为16进制形式 ;当把所有数据转换成为16进制形式后,并将其求和计算出对应的数据 ;仍然以输入数据 2004 为例 ;键盘输入 2004 的数据形式如下: 2(32h) 0(30h) 0(30h) 4(34h) 这些数据都是独立的不能进行我们所需的处理 ;如果数据是ASCII码则不能进行闰年判断了,闰年的判断算法是一个年份若它能被4整除同时不能被100整除,或能被400整除的年份是闰年. ;我们需要得到的数据是 2004d(十进制) = 7d4h(十六进制) 而不是独立的ASCII码,所以要将输入的数据转换 这就是和高级语言的差别 ;虽然将独立的ASCII码转换成16进制数据,但是依然不能对其进行处理,因为它们仍然是独立的所以要将其合并 ;合并的算法: 个位*1 + 十位*10 + 百位*100 + 千位*1000 ... 以此类推 ;为什么不从最高位开始,那是因为你不知道输入的到底是哪个年份有可能输入的是 500年 也有可能输入的是10000年 ;以上为准备知识,现在对代码进行分析 ; mov al, byte ptr [si] ; sub al, dh ; 这段代码的主要作用就是将数据从最后一位开始读取,并且从ASCII形式转换成为16进制形式,然后将其送入寄存器al中 ; push dx ; mul bx ; pop dx ;由于在乘除法运算过程中 DX AX 会被作为同一个寄存器来处理,故 DX 中的数据会被改变 ;若不加数据保护 push pop 则 DX 中的数据会被清零,自然也达不到程序处理的要求 ; add Write, ax ;bx则是位后面的乘数(个位*1 + 十位*10...) ;Write 就是将一个个独立的数据相加求和 并且把最终的结果储存 ;例: (34h-30h)+(30h-30h)+(30h-30h)+(32h-30h) = 2004d = 7d4h ; push ax ;push dx 该句就可以添加保护 ; mov ax, bx ; mul dl ; mov bx, ax ;bx = 1 或 10 或 100 或 1000 ; pop ax ; bx就是乘数 但是最核心的地方在于它保证 bx 每次都是以10倍数增长 但又不破坏其他的数据,于是使用了中间变量dl ;提示:由于使用了寄存器DX,所以在定义数据大小时就限制了输入数据的长度 ;输入过长的数据必然导致DX被更改,那样将影响数据的正确性 ;该问题可以通过加寄存器保护(push)就可以升级输入数据的长度 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值