Assembly Language
Homework 10, Due 2010/6/7
Problem 1
ReadString (Page 400, Problem 1)
Implement your own version of the ReadString procedure, using stack parameters. Pass it a pointer to a string and an integer indicating the maximum number of characters to be entered. Return a count (in EAX) of the number of characters actually entered. The procedure must input a string from the console and insert a null byte
at the end of the string (in the position occupied by 0Dh). Write a short program that tests your procedure.
(Hint: INVOKE ReadConsole, stdInHandle, bufferPtr,bufferSize, ADDR bytesRead, 0)
Problem 2
DrawBox (Page 400, Problem 5)
Draw a box on the screen using line-drawing characters from the character set listed on the inside back cover of your book.
Hint: Use the WriteConsoleOutputCharacter function.
INVOKE WriteConsoleOutputCharacter,
outputHandle, ; console output handle
ADDR boxTop, ; pointer to the top box line
BoxWidth, ; size of box line
xyPosition, ; coordinates of first char
ADDR count ; output count
Problem 3
WinApp
Change /SUBSYSTEM:CONSOLE to /SUBSYSTEM:WINDOWS
Textbook example: WinApp.asm
MASM32 example: winenum\winenum.asm, winenum\rsrc.rc, winenum\mainicon.ico
Save the files in c:\masm32\include: gdi32.inc, kernel32.inc, masm32.inc, RESOURCE.H, user32.inc, windows.inc
Save the files in c:\masm32\lib: gdi32.lib, kernel32.lib, masm32.lib, user32.lib
Complete the program: resdlg2\resdlg2.asm, resdlg2\rsrc.rc, resdlg2\icon1.ico
ftp your homework to
ftp://alasp10@140.127.208.168/
in the directory \HW10
by the following format:
檔案名稱:hw#_學號.zip
例如:資工同學,作業4
檔案名稱:hw4_a09755xx.zip. (注意:檔案名稱不能有中文)
The password is given in class.