2011.09.29 Thursday
アセンブリ言語(4)
前回の応用でちょっと数値計算っぽいことを。
今回は01-FFまでを出力する。
bits 16
org 0x100
mov dx,file
mov cx,0
mov ah,0x3c
int 0x21;ファイルを開く
mov [fh],ax;ファイルハンドラをとっとく
mov bx,[fh]
mov dx,buf
doit:
inc byte [buf];インクリメント
mov cx,1;書き込みサイズ
mov ah,0x40
int 0x21;書き込み
cmp byte [buf],0xff;比較
mov cx,10;終了しないように
loopne doit
;ファイル終了処理
mov ah,0x3e
int 0x21
mov ah,0x4c
mov al,0
int 0x21
file db "hello.txt",0
fh dw 0
buf db 0
今回は01-FFまでを出力する。
bits 16
org 0x100
mov dx,file
mov cx,0
mov ah,0x3c
int 0x21;ファイルを開く
mov [fh],ax;ファイルハンドラをとっとく
mov bx,[fh]
mov dx,buf
doit:
inc byte [buf];インクリメント
mov cx,1;書き込みサイズ
mov ah,0x40
int 0x21;書き込み
cmp byte [buf],0xff;比較
mov cx,10;終了しないように
loopne doit
;ファイル終了処理
mov ah,0x3e
int 0x21
mov ah,0x4c
mov al,0
int 0x21
file db "hello.txt",0
fh dw 0
buf db 0