;80x86汇编屏保程序_翻卷式旋转_Hello_world! ; ;旋转的文字[汇编]
code Segment
.386P
org 100h
assume cs:code,ds:code,es:code
start:
push cs
pop ds
push ds
pop es
call csh
mov ax,13h
int 10h
mov ax,1300h
mov bx,000eh ;BH=页码 BL=属性(若AL=00H或01H)
mov cx,cnt ;0014h ;CX=显示字符串长度
mov dx,100h ;010ah ;DH,DL=起始行,列
mov bp,offset hello ;ES:BP=显示字符串的地址
int 10h
call read
call clear
kll:
mov bp,1000h
hhh:call write
mov ah,1
int 16h
jz ppp
mov ah,0
int 16h
cmp al,1bh
jz exit
ppp:call delay
call delay
add bp,2
cmp bp,1000h+360*2
jbe hhh
jmp kll
exit:
mov ax,3
int 10h
mov ah,4ch
int 21h
csh:
cld
MOV DI,1000H
MOV CX,360
@csh:
INC ROT
FLDPI
FIDIV RRR
FIMUL ROT
FSINCOS
FIMUL RX
FISTP XX
FIMUL RY
FISTP YY
ADD XX, 160 ;120
ADD YY, 90 ;100
MOV AX, YY
imul ax,320
add ax,XX
stosw
LOOP @csh
ret
;===========
color DB 2
RRR DW 180
YY DW 100
XX DW 160
RX DW 110 ;120
RY DW 60 ;90
ROT DW ?
;------------
Delay:
push dx
push ax
t_a: mov dx,3dah
in al, dx
test al, 8
Jnz t_a
t_b: in al, dx
test al, 8
Jz t_b
pop ax
pop dx
ret
clear:
mov ax,0a000h
mov es,ax
xor di,di
mov ax,di
mov cx,320*200
rep stosb
ret
;----------------
read:
mov ax,0a000h
mov ds,ax
push cs
pop es
cld
mov di,2000h
xor si,si
mov bx,14*8 ;字符串长度
nt1: push si
mov cx,20 ;字符高度
nt2:
lodsb
stosb
add si,320-1
loop nt2
pop si
inc si
dec bx
jnz nt1
ret
;
;----------------
write:
push cs
pop ds
mov ax, 0a000h
mov es, ax
mov bx,bp
mov dx,14*8 ;字符串长度
mov si,2000h
wr1: push bx
mov di,[bx]
mov cx,20 ;字符高度
wr2: lodsb
stosb
add di,320-1
loop wr2
pop bx
add bx,2
cmp bx,1000h+359*2
jbe rrp
mov bx,1000h
rrp:
dec dx
jnz wr1
ret
;--------------
hello db ' Hello World! '
cnt equ $- hello
code ends
end start
code Segment
.386P
org 100h
assume cs:code,ds:code,es:code
start:
push cs
pop ds
push ds
pop es
call csh
mov ax,13h
int 10h
mov ax,1300h
mov bx,000eh ;BH=页码 BL=属性(若AL=00H或01H)
mov cx,cnt ;0014h ;CX=显示字符串长度
mov dx,100h ;010ah ;DH,DL=起始行,列
mov bp,offset hello ;ES:BP=显示字符串的地址
int 10h
call read
call clear
kll:
mov bp,1000h
hhh:call write
mov ah,1
int 16h
jz ppp
mov ah,0
int 16h
cmp al,1bh
jz exit
ppp:call delay
call delay
add bp,2
cmp bp,1000h+360*2
jbe hhh
jmp kll
exit:
mov ax,3
int 10h
mov ah,4ch
int 21h
csh:
cld
MOV DI,1000H
MOV CX,360
@csh:
INC ROT
FLDPI
FIDIV RRR
FIMUL ROT
FSINCOS
FIMUL RX
FISTP XX
FIMUL RY
FISTP YY
ADD XX, 160 ;120
ADD YY, 90 ;100
MOV AX, YY
imul ax,320
add ax,XX
stosw
LOOP @csh
ret
;===========
color DB 2
RRR DW 180
YY DW 100
XX DW 160
RX DW 110 ;120
RY DW 60 ;90
ROT DW ?
;------------
Delay:
push dx
push ax
t_a: mov dx,3dah
in al, dx
test al, 8
Jnz t_a
t_b: in al, dx
test al, 8
Jz t_b
pop ax
pop dx
ret
clear:
mov ax,0a000h
mov es,ax
xor di,di
mov ax,di
mov cx,320*200
rep stosb
ret
;----------------
read:
mov ax,0a000h
mov ds,ax
push cs
pop es
cld
mov di,2000h
xor si,si
mov bx,14*8 ;字符串长度
nt1: push si
mov cx,20 ;字符高度
nt2:
lodsb
stosb
add si,320-1
loop nt2
pop si
inc si
dec bx
jnz nt1
ret
;
;----------------
write:
push cs
pop ds
mov ax, 0a000h
mov es, ax
mov bx,bp
mov dx,14*8 ;字符串长度
mov si,2000h
wr1: push bx
mov di,[bx]
mov cx,20 ;字符高度
wr2: lodsb
stosb
add di,320-1
loop wr2
pop bx
add bx,2
cmp bx,1000h+359*2
jbe rrp
mov bx,1000h
rrp:
dec dx
jnz wr1
ret
;--------------
hello db ' Hello World! '
cnt equ $- hello
code ends
end start