数週間前にアセンブリの学習を開始し、ユーザー入力を取得するためにこのプログラムを作成しました。msgOut を宣言した後、プログラムが DOS ボックスをフリーズするため、ハングアップしました。ただし、印刷するコードと一緒にコメントアウトしたままにしておくと、問題なく動作します。どんな助けでも大歓迎です。
; This program gets a character from the user and prints it out
org 100h ; program start point
section .data
msgIn: DB "Enter a character: $"
msgOut: DB 13, 10, "Character value: $"
section .bss
char resb 1 ; storage for input character
section .txt
; print enter message
mov dx, msgIn ; offset address of message to display
mov ah, 9 ; print string function
int 21h
; get user input
mov ah, 1 ; keyboard input sub-program
int 21h ; read character into al
; store character in char variable
mov [char], al ; move entered char into char variable
; print second message
mov dx, msgOut ; offset of second message
mov ah, 9 ; print string function
int 21h ; display message
; display character
mov dl, [char] ; char to display
mov ah, 2 ; print char function
int 21h
; exit program
mov ah, 4ch ; exit to DOS function
int 21h ; see you later!