操作系统开发 – 婴儿教程 8
来源:互联网 发布:森口博子 知乎 编辑:程序博客网 时间:2024/04/28 04:23
32-bit printing
Here is the same non-BIOS screen print AsmExample as before, but adjusted to use 32-bit registers and offsets. The 'complex' string instructions have been replaced.
;----------------------dochar: call cprint ; print one charactersprint: mov eax, [esi] ; string char to AL lea esi, [esi+1] cmp al, 0 jne dochar ; else, we're done add byte [ypos], 1 ; down one row mov byte [xpos], 0 ; back to left ret cprint: mov ah, 0x0F ; attrib = white on black mov ecx, eax ; save char/attribute movzx eax, byte [ypos] mov edx, 160 ; 2 bytes (char/attrib) mul edx ; for 80 columns movzx ebx, byte [xpos] shl ebx, 1 ; times 2 to skip attrib mov edi, 0xb8000 ; start of video memory add edi, eax ; add y offset add edi, ebx ; add x offset mov eax, ecx ; restore char/attribute mov word [ds:edi], ax add byte [xpos], 1 ; advance to right ret ;------------------------------------ printreg32: mov edi, outstr32 mov eax, [reg32] mov esi, hexstr mov ecx, 8 ; eight nibbles hexloop: rol eax, 4 ; leftmost will mov ebx, eax ; become rightmost and ebx, 0x0f ; mov bl, [esi + ebx] ; index into hexstr mov [edi], bl inc edi dec ecx jnz hexloop mov esi, outstr32 call sprint ret ;------------------------------------ xpos db 0ypos db 0hexstr db '0123456789ABCDEF'outstr32 db '00000000', 0 ; register valuereg32 dd 0 ; pass values to printreg32 ;------------------------------------
- 操作系统开发 – 婴儿教程 8
- 操作系统开发 – 婴儿教程 1
- 操作系统开发 – 婴儿教程 2
- 操作系统开发 – 婴儿教程 3
- 操作系统开发 – 婴儿教程 4
- 操作系统开发 – 婴儿教程 5
- 操作系统开发 – 婴儿教程 6
- 操作系统开发 – 婴儿教程 7
- Google 手机操作系统 Android 开发教程 转载
- 简明教程:如何在Solaris操作系统上开发C 应用程序
- CentOS操作系统安装教程
- CentOS操作系统安装教程
- CentOS操作系统安装教程
- 【分享】操作系统 编写教程
- CentOS操作系统安装教程
- 计算机操作系统教程
- 64位win7操作系统 Android 开发环境配置图文教程(jdk+eclipse+android sdk)
- 计算机操作系统教程 2 操作系统概述
- 操作系统开发 – 婴儿教程 6
- Struts 2的property标签的原理
- [小e笔记]之一步一步学习备份恢复——第二篇备份恢复原理
- 操作系统开发 – 婴儿教程 7
- Android学前基础--Mars老师
- 操作系统开发 – 婴儿教程 8
- Android应用程序键盘(Keyboard)消息处理机制分析
- SQL多表连接查询
- test
- Hibernate事务并发问题处理(乐观锁与悲观锁)
- Android应用程序消息处理机制(Looper、Handler)分析
- 子类继承父类的私有属性
- hdu A/B
- poj 3468 A Simple Problem with Integers