我必须创建一个矩阵屏幕保护程序的简单实现,就像电影中的汇编程序一样,只使用视频内存(文本)。除了随机数发生器用于获取随机字符外,我已经完成了大部分结构布局,但是我希望能够帮助缩小这些过程中的一些步骤及其实现。8086汇编语言创建矩阵屏幕保护程序
我必须使用类似下面的代码:
;Matrix
;This program displays a matrix wallpaper
.model small
.386
.stack 100h
.data
.code
main proc
mov ax, 0b800h
mov es, ax
mov bx, 39 ; row
mov cx, 12 ; colum
mov ax, 160
mul cx
shl bx,1
add bx, ax
mov al, 'A'
mov ah, 0ah
mov es:[bx], ax
mov ax, 4c00h
int 21h
main endp
end main
,但是这是我到目前为止有:
;Matrix
;This program creates a matrix wallpaper
.model small
.386
.stack 100h
.data
speed dword 2147483647
X dw, ?
Y dw, ?
ch dw, ?
att dw, ?
.code
main proc
mov ax, @data
mov ds, ax
; setup interrupt
push ds
mov ax, @code
mov ds, ax
mov ah, 25h
mov al, 9
mov dx, offset My_int
int 21h
pop ds
; matrix program, makes the rain effect
Loo2:
; for(y = 23; y > 0; y--)
L1:
; for(x = 0; x <= 79; x++)
L2:
; SgetCh(x, y, ch, attribute)
call SgetCh
; SputCh(x, y, ch, attribute)
call SgetCh
; BusyWait
call BusyWait
jmp Loo2
mov ax, 4c00h
int 21h
main endp
;***************
My_int proc
;cli ; diable interrupts
;mov ax, mystack ; reset SS
;mov ss, ax
;mov sp, 100h ; reset SP
;sti ; reenable interrupt
mov ax, 4c00h
int 21h
iret
My_int endp
;***************
BusyWait proc
ret
BusyWait endp
;***************
SgetCh proc
ret
SgetCh endp
;***************
SputCh proc
ret
SputCh endp
;***************
end main
这是一个很好的答案,但我不能使用dram的图形部分。我必须'mov ax,0b800h'和'mov es,ax'。 – Zen20636 2014-11-26 04:09:56