Access over 20 million homework & study documents

Assembly Language X86. 31

Content type
User Generated
Subject
Computer Science
Type
Homework
Rating
Showing Page:
1/23
Running Head: ASSEMBLY LANGUAGE PROGRAMMING 1
CS 397 Assembly Language Programming
Spring 2016
York College, CUNY
Dr. John-Thones Amenyo
jta@york.cuny.edu
Quiz 4+ Take Home

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/23
ASSEMBLY LANGUAGE PROGRAMING 2
Source code:
BITS 16
start:
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
mov si, text_string ; Put string position into SI
call print_string ; Call our string-printing routine
jmp $ ; Jump here - infinite loop!
text_string db 'This is my cool new OS!', 0
print_string: ; Routine: output string in SI to screen
mov ah, 0Eh ; int 10h 'print char' function
.repeat:
lodsb ; Get character from string
cmp al, 0
je .done ; If char is zero, end of string
int 10h ; Otherwise, print it
jmp .repeat
.done:
ret
times 510-($-$$) db 0 ; Pad remainder of boot sector with 0s
dw 0xAA55 ; The standard PC boot signature

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/23

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 23 pages?
Access Now
Unformatted Attachment Preview
Running Head: ASSEMBLY LANGUAGE PROGRAMMING 1 CS 397 –Assembly Language Programming Spring 2016 York College, CUNY Dr. John-Thones Amenyo jta@york.cuny.edu Quiz 4+ Take Home ASSEMBLY LANGUAGE PROGRAMING Source code: BITS 16 start: mov add mov mov ax, ax, ss, sp, 07C0h 288 ax 4096 ; Set up 4K stack space after this bootloader ; (4096 + 512) / 16 bytes per paragraph mov ax, 07C0h mov ds, ax ; Set data segment to where we're loaded mov si, text_string call print_string ; Put string position into SI ; Call our string-printing routine jmp $ ; Jump here - infinite loop! text_string db 'This is my cool new OS!', 0 print_string: mov ah, 0Eh .repeat: lodsb cmp al, 0 je .done int 10h jmp .repeat ; Routine: output string in SI to screen ; int 10h 'print char' function ; Get character from string ; If char is zero, end of string ; Otherwise, print it .done: ret times 510-($-$$) db 0 dw 0xAA55 ; Pad remainder of boot sector with 0s ; The standard PC boot signature 2 ASSEMBLY LANGUAGE PROGRAMING 3 1. Write the AL application code that support the following pseudo-code Assume a procedure GetInteger exists. It returns in EAX an integer value input by the user. Syntax imul , imul , imul ,, imul ,, For instance imul eax, [var] — multiply the contents of EAX by the 32-bit contents of the memory location var. Store the result in EAX. imul esi, edi, 25 — ESI → EDI * 25 Assume a procedure PutInteger exist ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I needed…Fantastic!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4