Interrupt
Interrupt
1.
2. Code:
mov ah, 0
int 10h ; AH=0, AL=13h, INT 10h to set graphics mode (Mode 13h, 320x200 resolution,
256 colors)
mov al, 0Eh ; Set color to Light Yellow (color code 0Eh) for the pixel
mov ah, 0Ch ; AH=0Ch, INT 10h to change pixel color at (x, y) = (CX, DX)
mov al, 0Ch ; Set color to Light Red (color code 0Ch)
; LIST OF COLORS
; The following are the colors in 4-bit format (N16 N2 color codes):
; 0 - 0000 BLACK
; 1 - 0001 BLUE
; 2 - 0010 GREEN
; 3 - 0011 CYAN
; 4 - 0100 RED
; 5 - 0101 MAGENTA
; 6 - 0110 BROWN
; E - 1110 YELLOW
; F - 1111 WHITE
mov ah, 1 ; AH=1, INT 21h to read a character from the keyboard
int 21h ; Wait for user input (key press) and show the character on the console
; mov ah, 39h ; AH=39h, INT 21h would be used to create a virtual drive folder (not
implemented)
; int 21h ; Execute the above command (which is currently commented out)
msg2 db 0dh, 0ah, "nextLine $" ; Message 2 with line break for next phase
msg3 db "nextPhase: $", 0dh, 0ah ; Message 3 with line break for the next phase
3. Which part of the code created the pixel color Light Magenta? Refer to the code.
The pixel color Light Magenta is created in the code by setting the AL register to `0Dh`,
which corresponds to the color code for Light Magenta in Mode 13h (256-color graphics
mode). The coordinates for the pixel are then adjusted by decrementing the CX (X-
coordinate) and DX (Y-coordinate) registers, which move the pixel position from `(10, 10)`
to `(9, 9)`. Finally, the `int 10h` instruction is used with `AH=0Ch` to set the pixel color at
the new coordinates `(9, 9)` to Light Magenta.