在视频ram上的随机位置显示字符

时间:2015-12-18 22:11:25

标签: assembly masm x86-16 dosbox

我试图在屏幕上的随机位置显示一个角色。如果有人解释为什么这段代码不起作用,我将非常感激。

call frandom

frandom proc near         ;random fruit procedure
push ax
mov ah,2ch
int 21h
xor ah,ah
mov al,dl  ;save 1/100 seconds
mov bl,5
div bl

mov di,ax
mov AX,Data_segment_name  ;load the starting address of the data
mov DS,AX                 ; segment into DS reg.
mov ax,0b800h
mov es,ax
mov ax,'a'
stosw

pop ax
frandom endp

1 个答案:

答案 0 :(得分:4)

VGA文本内存包含属性字节。 mov ax, 'a'将在黑色上使用黑色,所以没什么可看的。尝试mov ax, 0x0f61为黑色白色。