提交 36dcae0a 创建 作者: 赵鹏翀's avatar 赵鹏翀

init template

上级
/*.img
/bochs
/Debug
/Release
bochsout.txt
\ No newline at end of file
<?xml version="1.0" encoding="gb2312"?>
<ASMProject Version="1.00" Name="Demo052">
<Configurations>
<Configuration Name="Debug" ConfigurationType="2">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool"/>
<Tool Name="JWASMAssemblerTool" ObjectFormate="5" GenerateDebugInformation="-1" VersionDebugInfo="-1" AdditionalOptions="/W0"/>
<Tool Name="PreLinkEventTool"/>
<Tool Name="GCCLinkerTool"/>
<Tool Name="JWlinkLinkerTool" AdditionalOptions="disable 1014"/>
<Tool Name="PostBuildEventTool"/>
</Configuration>
</Configurations>
<Files>
<Filter Name="Դļ" Filter="asm">
<File RelativePath=".\main.asm">
</File>
</Filter>
</Files>
</ASMProject>
添加文件
assume cs:codesg
datasg segment
db '0123456789ABCDEF'
datasg ends
codesg segment
start:
mov ax, datasg
mov ds, ax
mov bx, 0
mov cx, 16
s:
mov al, [bx]
call showbyte
mov [bx], al
inc bx
loop s
mov ax, 4c00h
int 21h
showbyte: ;子程序如下
jmp short show
table db '0123456789ABCDEF' ;字符表
show:
push bx
push es
mov ah, al
shr ah, 1
shr ah, 1
shr ah, 1
shr ah, 1 ;右移4位,ah中得到高4位的值
and al, 00001111b ;al中为低4位的值
mov bl, ah
mov bh, 0
mov ah, table[bx] ;用高4位的值作为相对于table的偏移,取得对应的字符
mov bx, 0b800h
mov es, bx
mov es:[160*12+40*2], ah
mov bl, al
mov bh, 0
mov al, table[bx] ;用低4位的值作为相对于table的偏移,取得对应的字符
mov es:[160*12+40*2+2], al
pop es
pop bx
ret
codesg ends
end start
\ No newline at end of file
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论