📄 sys_screenxx.s
字号:
EAX = 0x00 + 8
EBX = 0x04 + 8
ECX = 0x08 + 8
EDX = 0x0C + 8
ESI = 0x10 + 8
EDI = 0x14 + 8
EBP = 0x18 + 8
DS = 0x1C + 8
ES = 0x20 + 8
FS = 0x24 + 8
GS = 0x28 + 8
EIP = 0x2C + 8
CS = 0x30 + 8
EFLAGS = 0x34 + 8
OLDESP = 0x38 + 8
OLDSS = 0x3C + 8
.align 4
temp_screenbuf:
.long 0
.align 4
temp_long:
.long 0
current_screen_mode:
.long 2
current_mode_reg:
.byte 0x2D
current_color_reg:
.byte 0x00
current_status_reg:
.byte 0x00
current_R10_val:
.byte 0x06
current_color_val:
.byte 0x07
current_start_H:
.byte 0x00
current_start_L:
.byte 0x00
current_cursor_H:
.byte 0x00
current_cursor_L:
.byte 0x00
current_row:
.byte 0
current_col:
.byte 0
MAX_ROW:
.byte 25
MAX_COL:
.byte 80
.align 2
current_end_HL:
.word 6000
MAX_SIZE:
.word 960
screen_mode_tab:
.byte 0x2C,0x28,0x2D,0x29,0x2E,0x2A,0x1E
screen_mode_tab0:
.byte 0x00,0x00,0x00,0x00,0x00,0x00,0x07
.align 4
screen_mode_tab1:
.long screen_regs_tab0,screen_regs_tab0,screen_regs_tab1,screen_regs_tab1
.long screen_regs_tab2,screen_regs_tab2,screen_regs_tab2
screen_mode_tab2:
.byte 0x00,0x00,0x00,0x00,0x01,0x01,0x01
.align 4
screen_mode_tab3:
.long 0x07200720,0x07200720,0x07200720,0x07200720,0x0000,0x0000,0x0000
screen_mode_tab4:
.word 7000,7000,6000,6000,0,0,0
screen_mode_tab5:
.byte 0x07,0x07,0x07,0x07,0x00,0x00,0x00
screen_regs_tab0:
.byte 0x38,0x28,0x2D,0x0A,0x1F,0x06,0x19,0x1C,0x02,0x07,0x06,0x07,0x00,0x00,0x00,0x00
screen_regs_tab1:
.byte 0x71,0x50,0x5A,0x0A,0x1F,0x06,0x19,0x1C,0x02,0x07,0x06,0x07,0x00,0x00,0x00,0x00
screen_regs_tab2:
.byte 0x38,0x28,0x2D,0x0A,0x7F,0x06,0x64,0x70,0x02,0x01,0x06,0x07,0x00,0x00,0x00,0x00
.align 2
MAX_ROW_TAB:
.byte 25, 25, 25, 25, 0, 0, 0
MAX_COL_TAB:
.byte 40, 40, 80, 80, 0, 0, 0
MAX_SIZE_TAB:
.word 480,480,960,960,0, 0, 0
.globl current_color_val
.globl current_start_H, current_start_L, current_cursor_H, current_cursor_L
.globl current_row, current_col, MAX_ROW, MAX_COL
.globl current_end_HL, MAX_SIZE
.globl sys_screenNULL
.globl sys_screen00,sys_screen01,sys_screen02,sys_screen03
.globl sys_screen04,sys_screen05,sys_screen06,sys_screen07
.globl sys_screen08,sys_screen09,sys_screen10,sys_screen11
.globl sys_screen12,sys_screen13,sys_screen14,sys_screen15
.globl sys_screen16,sys_screen17,sys_screen18
.align 4
sys_screenNULL:
movl $-1,%eax
ret
.align 4
sys_screen00:
movl EBX(%esp),%ebx
cmpl $0x06,%ebx
jna sys_screen00_0
movl $-1,%eax
ret
sys_screen00_0:
movw $0x3DA,%dx
sys_screen00_1:
inb %dx,%al
testb $0x08,%al
je sys_screen00_1
movw $0x3D8,%dx
movb $0x00,%al
outb %al,%dx
movl screen_mode_tab3(,%ebx,4),%eax
movl $0xb8000,%edi
movl $4096,%ecx
cld
rep
stosl
movw $0x3D4,%dx
xorw %ax,%ax
movl screen_mode_tab1(,%ebx,4),%esi
movl $0x10,%ecx
sys_screen00_2:
movb %ah,%al
outb %al,%dx
incw %dx
movb (%esi),%al
outb %al,%dx
incb %ah
incl %esi
decw %dx
loop sys_screen00_2
movw $0x3D8,%dx
movb screen_mode_tab(%ebx),%al
outb %al,%dx
movw $0x3D9,%dx
movb screen_mode_tab0(%ebx),%al
outb %al,%dx
movl %ebx,current_screen_mode
movb screen_mode_tab(%ebx),%al
movb %al,current_mode_reg
movb screen_mode_tab0(%ebx),%al
movb %al,current_color_reg
movl screen_mode_tab1(,%ebx,4),%esi
movb 10(%esi),%al
movb %al,current_R10_val
movb screen_mode_tab5(%ebx),%al
movb %al,current_color_val
xorb %al,%al
movb %al,current_status_reg
movb %al,current_start_H
movb %al,current_start_L
movb %al,current_cursor_H
movb %al,current_cursor_L
movb %al,current_row
movb %al,current_col
movb MAX_ROW_TAB(%ebx),%al
movb %al,MAX_ROW
movb MAX_COL_TAB(%ebx),%al
movb %al,MAX_COL
movw screen_mode_tab4(,%ebx,2),%ax
movw %ax,current_end_HL
movw MAX_SIZE_TAB(,%ebx,2),%ax
movw %ax,MAX_SIZE
xorl %eax,%eax
ret
.align 4
sys_screen01:
xorl %eax,%eax
movb current_mode_reg,%al
ret
.align 4
sys_screen02:
movl EBX(%esp),%ebx
andl $0xff,%ebx
movb current_mode_reg,%al
andb $0xd7,%al
andb $0x28,%bl
orb %bl,%al
movw $0x3D8,%dx
outb %al,%dx
movb %al,current_mode_reg
xorl %eax,%eax
ret
.align 4
sys_screen03:
xorl %eax,%eax
movb current_color_reg,%al
ret
.align 4
sys_screen04:
movl EBX(%esp),%ebx
andl $0xff,%ebx
movb %bl,%al
andb $0x3f,%al
movw $0x3D9,%dx
outb %al,%dx
movb %al,current_color_reg
xorl %eax,%eax
ret
.align 4
sys_screen05:
xorl %eax,%eax
movw $0x3DA,%dx
inb %dx,%al
movb %al,current_status_reg
ret
.align 4
sys_screen06:
xorl %eax,%eax
movb current_start_L,%al
movb current_start_H,%ah
ret
.align 4
sys_screen07:
movl EBX(%esp),%ebx
andl $0xffff,%ebx
cmpw current_end_HL,%bx
jna sys_screen07_0
movl $-1,%eax
ret
sys_screen07_0:
movw $0x3D4,%dx
movb $13,%al
outb %al,%dx
incw %dx
movb %bl,%al
outb %al,%dx
decw %dx
movb $12,%al
outb %al,%dx
incw %dx
movb %bh,%al
outb %al,%dx
movb %bl,current_start_L
movb %bh,current_start_H
xorl %eax,%eax
ret
.align 4
sys_screen08:
xorl %eax,%eax
movb current_cursor_L,%al
movb current_cursor_H,%ah
ret
.align 4
sys_screen09:
movl EBX(%esp),%ebx
andl $0xffff,%ebx
cmpw $8000,%bx
jb sys_screen09_0
movl $-1,%eax
ret
sys_screen09_0:
movw $0x3D4,%dx
movb $15,%al
outb %al,%dx
incw %dx
movb %bl,%al
outb %al,%dx
decw %dx
movb $14,%al
outb %al,%dx
incw %dx
movb %bh,%al
outb %al,%dx
movb %bl,current_cursor_L
movb %bh,current_cursor_H
xorl %eax,%eax
ret
.align 4
sys_screen10:
movl EBX(%esp),%ebx
andl $0xff,%ebx
movb current_R10_val,%al
andb $0xdf,%al
andb $0x20,%bl
orb %bl,%al
movb %al,current_R10_val
movw $0x3D4,%dx
movb $10,%al
outb %al,%dx
incw %dx
movb current_R10_val,%al
outb %al,%dx
xorl %eax,%eax
ret
.align 4
sys_screen11:
movl EBX(%esp),%ebx
andl $0xff,%ebx
movb %bl,current_color_val
xorl %eax,%eax
ret
.align 4
sys_screen12:
movl EBX(%esp),%ebx
andl $0xff,%ebx
movl ECX(%esp),%ecx
cmpl $8000,%ecx
jb sys_screen12_0
movl $-1,%eax
ret
sys_screen12_0:
movb current_color_val,%bh
shll $1,%ecx
addl $0xb8000,%ecx
movw %bx,(%ecx)
xorl %eax,%eax
ret
.align 4
sys_screen13:
movl EBX(%esp),%ebx
andl $0xffff,%ebx
movl ECX(%esp),%ecx
cmpl $8000,%ecx
jb sys_screen13_0
movl $-1,%eax
ret
sys_screen13_0:
shll $1,%ecx
addl $0xb8000,%ecx
movw %bx,(%ecx)
xorl %eax,%eax
ret
.align 4
sys_screen14:
movl EBX(%esp),%ebx
movl ECX(%esp),%ecx
movl EDX(%esp),%edx
cmpl $8000,%ecx
jb sys_screen14_0
movl $-1,%eax
ret
sys_screen14_0:
cmpl $0,%edx
jne sys_screen14_1
xorl %eax,%eax
ret
sys_screen14_1:
movl $8000,%eax
subl %ecx,%eax
cmpl %eax,%edx
jna sys_screen14_2
movl %eax,%edx
sys_screen14_2:
movl %edx,temp_long
movb current_color_val,%ah
shll $1,%ecx
addl $0xb8000,%ecx
sys_screen14_3:
movb %gs:(%ebx),%al
movw %ax,(%ecx)
incl %ebx
incl %ecx
incl %ecx
decl %edx
jnz sys_screen14_3
movl temp_long,%eax
ret
.align 4
sys_screen15:
movl EBX(%esp),%ebx
movl ECX(%esp),%ecx
movl EDX(%esp),%edx
cmpl $8000,%ecx
jb sys_screen15_0
movl $-1,%eax
ret
sys_screen15_0:
cmpl $0,%edx
jne sys_screen15_1
xorl %eax,%eax
ret
sys_screen15_1:
movl $8000,%eax
subl %ecx,%eax
cmpl %eax,%edx
jna sys_screen15_2
movl %eax,%edx
sys_screen15_2:
movl %edx,temp_long
shll $1,%ecx
addl $0xb8000,%ecx
sys_screen15_3:
movw %gs:(%ebx),%ax
movw %ax,(%ecx)
incl %ebx
incl %ebx
incl %ecx
incl %ecx
decl %edx
jnz sys_screen15_3
movl temp_long,%eax
ret
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
.align 4
sys_screen16:
xorl %eax,%eax
movb current_col,%al
movb current_row,%ah
ret
.align 4
sys_screen17:
movl EBX(%esp),%ebx
andl $0xffff,%ebx
cmpb MAX_ROW,%bh
jb sys_screen17_0
movl $-1,%eax
ret
sys_screen17_0:
cmpb MAX_COL,%bl
jb sys_screen17_1
movl $-1,%eax
ret
sys_screen17_1:
movb %bl,current_col
movb %bh,current_row
xorl %eax,%eax
ret
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
.align 4
sys_screen18:
movl EBX(%esp),%ebx
movl %ebx,temp_screenbuf
sys_screen18_0:
movb %gs:(%ebx),%al
cmpb $0,%al
je sys_screen18_8
cmpb $0x0d,%al
jne sys_screen18_1
xorl %ebx,%ebx
movb current_cursor_L,%bl
movb current_cursor_H,%bh
subb current_col,%bl
sbbb $0,%bh
movb %bl,current_cursor_L
movb %bh,current_cursor_H
movb $0,current_col
jmp sys_screen18_4
sys_screen18_1:
cmpb $0x0a,%al
jne sys_screen18_2
xorl %ebx,%ebx
movb current_cursor_L,%bl
movb current_cursor_H,%bh
addb MAX_COL,%bl
adcb $0,%bh
movb %bl,current_cursor_L
movb %bh,current_cursor_H
incb current_row
jmp sys_screen18_4
sys_screen18_2:
cmpb $0x20,%al
jb sys_screen18_7
cmpb $0x7e,%al
ja sys_screen18_7
movb current_color_val,%ah
xorl %ebx,%ebx
movb current_cursor_L,%bl
movb current_cursor_H,%bh
movw %ax,0xb8000(,%ebx,2)
incl %ebx
movb %bl,current_cursor_L
movb %bh,current_cursor_H
movb current_col,%al
incb %al
cmpb MAX_COL,%al
jne sys_screen18_3
movb $0,%al
incb current_row
sys_screen18_3:
movb %al,current_col
sys_screen18_4:
movb current_row,%al
cmpb MAX_ROW,%al
jne sys_screen18_6
decb current_row
xorl %ebx,%ebx
movb current_start_L,%bl
movb current_start_H,%bh
addb MAX_COL,%bl
adcb $0,%bh
movb %bl,current_start_L
movb %bh,current_start_H
cmpw current_end_HL,%bx
jna sys_screen18_5
movl %ebx,%esi
addl %esi,%esi
addl $0xb8000,%esi
movl $0xb8000,%edi
xorl %ecx,%ecx
movw MAX_SIZE,%cx
cld
rep
movsl
xorl %eax,%eax
movb current_cursor_L,%al
movb current_cursor_H,%ah
subl %ebx,%eax
movb %al,current_cursor_L
movb %ah,current_cursor_H
movb $0,current_start_L
movb $0,current_start_H
sys_screen18_5:
xorl %ebx,%ebx
movb current_cursor_L,%bl
movb current_cursor_H,%bh
subb current_col,%bl
sbbb $0,%bh
movl %ebx,%edi
addl %edi,%edi
addl $0xb8000,%edi
movb current_color_val,%ah
movb $0x20,%al
shll $16,%eax
movb current_color_val,%ah
movb $0x20,%al
xorl %ecx,%ecx
movb MAX_COL,%cl
shrl $1,%ecx
cld
rep
stosl
movw $0x3D4,%dx
movb $13,%al
outb %al,%dx
incw %dx
movb current_start_L,%al
outb %al,%dx
decw %dx
movb $12,%al
outb %al,%dx
incw %dx
movb current_start_H,%al
outb %al,%dx
sys_screen18_6:
movw $0x3D4,%dx
movb $15,%al
outb %al,%dx
incw %dx
movb current_cursor_L,%al
outb %al,%dx
decw %dx
movb $14,%al
outb %al,%dx
incw %dx
movb current_cursor_H,%al
outb %al,%dx
sys_screen18_7:
incl temp_screenbuf
movl temp_screenbuf,%ebx
jmp sys_screen18_0
sys_screen18_8:
xorl %eax,%eax
ret
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -