skip to main |
skip to sidebar
Pages
Empires of the mind powered by passion...
Thursday, March 31, 2011
Friday, March 25, 2011
Sample program in assembly language using a86.com (4)
A program that will print ASCII characters on screen w/ the ff. conditions:
--if the cursor passes letter R or r; the ascii will become red
--if the cursor passes letter B or b; the ascii will become blue
--if the cursor passes letter G or g; the ascii will become green
--if the cursor passes letter L or l; the ascii will blink
and the color will be combined if the cursor passes another letter with the corresponding color above....( the cursor will be set at the center of the screen; it will move using letters w-up;s-down;d-right;a-left)
.model small
.code
org 100h
jmp main
asc db 00,'$'
row db 08
col db 39
temp db 00
main proc near
call clr
mov ah, 03h
int 10h
ascii:
mov dx, 0100h
call setcur
mov cx, 1024
lea dx, asc
again:
mov ah, 09h
int 21h
inc asc
loop again
center:
mov dh, row
mov dl, col
call setcur
key:
mov dh, 07h
int 21h
cmp al, 'w'
if e jmp up
cmp al, 's'
if e jmp down
cmp al, 'd'
if e jmp right
cmp al, 'a'
if e jmp left
cmp al, 'x'
if e jmp exit
jmp key
up:
dec row
cmp row, 00
if e jmp down
call read
jmp center
down:
inc row
cmp row, 24
if e jmp up
call read
jmp center
right:
inc col
cmp col, 79
if e jmp left
call read
jmp center
left:
dec col
cmp col, 00
if e jmp right
call read
jmp center
terminate:
int 20h
setcur proc near
mov ah, 02
mov bh, 00
int 10h
ret
setcur endp
read proc near
mov ah, 08h
mov bh, 00
int 10h
cmp al, 'r'
if e jmp red
cmp al, 'R'
if e jmp red
cmp al, 'b'
if e jmp blue
cmp al, 'B'
if e jmp blue
cmp al, 'g'
if e jmp green
cmp al, 'G'
if e jmp green
cmp al, 'l'
if e jmp blink
cmp al, 'L'
if e jmp blink
red:
add temp, 04
call color
jmp ascii
blue:
add temp, 01
call color
jmp ascii
green:
add temp, 02
call color
jmp ascii
blink:
add temp, 80h
call color
jmp ascii
read endp
color proc near
mov ah, 06
mov al, 00
mov bh, temp
mov cx, 0000h
mov dx, 184fh
int 10h
ret
color endp
clr proc near
mov ah, 06h
mov al, 00
movbh, 07h
mov cx, 0000h
mov dx, 184fh
int 10h
ret
clr endp
--if the cursor passes letter R or r; the ascii will become red
--if the cursor passes letter B or b; the ascii will become blue
--if the cursor passes letter G or g; the ascii will become green
--if the cursor passes letter L or l; the ascii will blink
and the color will be combined if the cursor passes another letter with the corresponding color above....( the cursor will be set at the center of the screen; it will move using letters w-up;s-down;d-right;a-left)
.model small
.code
org 100h
jmp main
asc db 00,'$'
row db 08
col db 39
temp db 00
main proc near
call clr
mov ah, 03h
int 10h
ascii:
mov dx, 0100h
call setcur
mov cx, 1024
lea dx, asc
again:
mov ah, 09h
int 21h
inc asc
loop again
center:
mov dh, row
mov dl, col
call setcur
key:
mov dh, 07h
int 21h
cmp al, 'w'
if e jmp up
cmp al, 's'
if e jmp down
cmp al, 'd'
if e jmp right
cmp al, 'a'
if e jmp left
cmp al, 'x'
if e jmp exit
jmp key
up:
dec row
cmp row, 00
if e jmp down
call read
jmp center
down:
inc row
cmp row, 24
if e jmp up
call read
jmp center
right:
inc col
cmp col, 79
if e jmp left
call read
jmp center
left:
dec col
cmp col, 00
if e jmp right
call read
jmp center
terminate:
int 20h
setcur proc near
mov ah, 02
mov bh, 00
int 10h
ret
setcur endp
read proc near
mov ah, 08h
mov bh, 00
int 10h
cmp al, 'r'
if e jmp red
cmp al, 'R'
if e jmp red
cmp al, 'b'
if e jmp blue
cmp al, 'B'
if e jmp blue
cmp al, 'g'
if e jmp green
cmp al, 'G'
if e jmp green
cmp al, 'l'
if e jmp blink
cmp al, 'L'
if e jmp blink
red:
add temp, 04
call color
jmp ascii
blue:
add temp, 01
call color
jmp ascii
green:
add temp, 02
call color
jmp ascii
blink:
add temp, 80h
call color
jmp ascii
read endp
color proc near
mov ah, 06
mov al, 00
mov bh, temp
mov cx, 0000h
mov dx, 184fh
int 10h
ret
color endp
clr proc near
mov ah, 06h
mov al, 00
movbh, 07h
mov cx, 0000h
mov dx, 184fh
int 10h
ret
clr endp
Welcome!!!
This blog contains my notes from the lessons in my studies that I've learned, my favorites, past time and all the events in my life......hope you'll like it...
About Me
Blog Archive
-
▼
2011
(51)
-
▼
March
(10)
- Kim Tae Woo - Dropping Rain (Personal Taste OST)
- Younha - Can't Believe It (Personal Taste OST)
- My Heart is Touched - SeeYa(Personal Taste OST Par...
- Personal Taste OST - 2AM "Like A Fool 바보처럼" (Sing...
- Perfect Taste(개인의 취향) OST [I Can't Believe it(말도 안돼)]
- Shin Min Ah - Sha La La [Eng. Sub]
- Starting Now I love You (Eng Subbed) - Lee seung G...
- Lee Seung Gi - Losing My Mind [Eng. Sub]
- Lee Sun Hee - Fox Rain [Eng. Sub]
- Sample program in assembly language using a86.com (4)
-
▼
March
(10)
Followers
Total Pageviews
Powered by Blogger.
You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "
Franz Schubert, Serenade Op. 90, No. 11