Hi Peter,
The o2 assembler is unwilling to push/pop 16 bits. - I can fix this behaviour. A simple workaround is to put in a data size prefix in a line preceding the push/pop:
o2 66
push eax
o2 66
pop eax
I have checked the encoding against the Intel Manual and it all appears valid.
However the main problem is that the system does not allow access into this area, not for the unpriviledged anyway.
Do you agree with this?
Charles
Function FlushKey()
push gs
push eax
mov ax,0
mov gs,ax
pop eax
mov ax,gs:[0x041A] 'Head
mov gs:[0x041C],ax 'Tail
pop gs
End Function
Encoding
E9 gf _endp ' jmp fwd _endp
!10 '
.flushkey ' .flushkey '
( ' (
0F A8 ' push gs
50 ' push eax
66 C7 C0 00 00 ' mov ax,0
8E E8 ' mov gs,ax
58 ' pop eax
65 66 8B 04 25 1A 04 00 00 ' mov ax,gs: [0x041A] 'Head
66 65 89 04 25 1C 04 00 00 ' mov gs: [0x041C],ax 'Tail
0F A9 ' pop gs
.end_proc ' .end_proc
.end_return ' .end_return
C3 ' ret
) ' )
._endp ' ._endp