| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- ;
- ; Command & Conquer Red Alert(tm)
- ; Copyright 2025 Electronic Arts Inc.
- ;
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 3 of the License, or
- ; (at your option) any later version.
- ;
- ; This program is distributed in the hope that it will be useful,
- ; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see <http://www.gnu.org/licenses/>.
- ;
- IDEAL
- P386
- MODEL USE32 FLAT
- LOCALS ??
- DPMI_INTR equ 031h
- GLOBAL DPMI_real_alloc : near
- GLOBAL DPMI_real_free : near
- GLOBAL DPMI_real_intr : near
- GLOBAL DPMI_real_call : near
- STRUC SEGSEL
- segmen dw ?
- select dw ?
- ENDS
- STRUC REGS
- _eax dd ?
- _ebx dd ?
- _ecx dd ?
- _edx dd ?
- _esi dd ?
- _edi dd ?
- _cflag dd ?
- ENDS
- STRUC SREGS
- _es dw ?
- _cs dw ?
- _ss dw ?
- _ds dw ?
- _fs dw ?
- _gs dw ?
- ENDS
- STRUC DPMI_REGS
- _edi dd ?
- _esi dd ?
- _ebp dd ?
- dd ?
- _ebx dd ?
- _edx dd ?
- _ecx dd ?
- _eax dd ?
- Flags dw ?
- _es dw ?
- _ds dw ?
- _fs dw ?
- _gs dw ?
- _ip dw ?
- _cs dw ?
- _sp dw ?
- _ss dw ?
- dd ?
- dd ?
- size_ref db ?
- ENDS
-
-
- CODESEG
- ; int DPMI_real_alloc ( UINT , SEGREG * , USHORT * ) ;
- PROC DPMI_real_alloc C near
- USES ebx , edx
- ARG paragra : DWORD
- ARG blk_segptr : DWORD
- ARG largest_blkptr : DWORD
- mov eax, 0100h
- mov ebx, [paragra]
- int DPMI_INTR
- jnc ??dpmi_succed
- mov ebx, [largest_blkptr]
- mov [ word ptr ebx ] , bx
- movzx eax , al
- ret
- ??dpmi_succed:
- mov ebx, [blk_segptr]
- mov [(type SEGSEL ptr ebx). segmen ] , ax
- mov [(type SEGSEL ptr ebx). select ] , dx
- xor eax , eax
- ret
-
- ENDP DPMI_real_alloc
- ;**************************************************************************
- ; int DPMI_real_free ( UINT ) ;
- PROC DPMI_real_free C near
- USES eax , edx
- ARG blk_selec : DWORD
- mov eax, 0101h
- mov edx, [blk_selec]
- shr edx , 16
- int DPMI_INTR
- ret
- ENDP DPMI_real_free
- PROC DPMI_real_intr C near
- USES eax , ebx , ecx , edx , edi , esi
- ARG vector : dword
- ARG regs_ptr: dword
- ARG sreg_ptr: dword
- LOCAL regblk : DPMI_REGS
- lea edi , [ regblk ]
- xor eax , eax
- lea ecx , [ regblk . size_ref ]
- sub ecx , edi
- shr ecx , 2
- rep stosd
- mov ebx , [ regs_ptr ]
- mov eax , [ (type REGS ptr ebx) . _eax ]
- mov [ regblk . _eax ] , eax
- mov eax , [ (type REGS ptr ebx) . _ebx ]
- mov [ regblk . _ebx ] , eax
- mov eax , [ (type REGS ptr ebx) . _ecx ]
- mov [ regblk . _ecx ] , eax
- mov eax , [ (type REGS ptr ebx) . _edx ]
- mov [ regblk . _edx ] , eax
- mov eax , [ (type REGS ptr ebx) . _esi ]
- mov [ regblk . _esi ] , eax
- mov eax , [ (type REGS ptr ebx) . _edi ]
- mov [ regblk . _edi ] , eax
- mov ebx , [ sreg_ptr ]
- mov ax , [ (type SREGS ptr ebx) . _es ]
- mov [ regblk . _es ] , ax
- mov ax , [ (type SREGS ptr ebx) . _ds ]
- mov [ regblk . _ds ] , ax
- mov eax , 0300h
- mov ebx , [ vector ]
- xor bh , bh
- xor ecx , ecx
- lea edi , [ regblk ]
- int DPMI_INTR
- mov ebx , [ regs_ptr ]
- mov eax , [ regblk . _eax ]
- mov [ (type REGS ptr ebx) . _eax ] , eax
- mov eax , [ regblk . _ebx ]
- mov [ (type REGS ptr ebx) . _ebx ] , eax
- mov eax , [ regblk . _ecx ]
- mov [ (type REGS ptr ebx) . _ecx ] , eax
- mov eax , [ regblk . _edx ]
- mov [ (type REGS ptr ebx) . _edx ] , eax
- mov eax , [ regblk . _esi ]
- mov [ (type REGS ptr ebx) . _esi ] , eax
- mov eax , [ regblk . _edi ]
- mov [ (type REGS ptr ebx) . _edi ] , eax
- mov ebx , [ sreg_ptr ]
- mov ax , [ regblk . _es ]
- mov [ (type SREGS ptr ebx) . _es ] , ax
- mov ax , [ regblk . _ds ]
- mov [ (type SREGS ptr ebx) . _ds ] , ax
- ret
- ENDP DPMI_real_intr
- PROC DPMI_real_call C near
- USES eax , ebx , ecx , edx , edi , esi
- ARG vector : dword
- ARG regs_ptr: dword
- ARG sreg_ptr: dword
- LOCAL regblk : DPMI_REGS
- lea edi , [ regblk ]
- xor al , al
- lea ecx , [ regblk . size_ref ]
- sub ecx , edi
- rep movsb
- mov ebx , [ regs_ptr ]
- mov eax , [ (type REGS ptr ebx) . _eax ]
- mov [ regblk . _eax ] , eax
- mov eax , [ (type REGS ptr ebx) . _ebx ]
- mov [ regblk . _ebx ] , eax
- mov eax , [ (type REGS ptr ebx) . _ecx ]
- mov [ regblk . _ecx ] , eax
- mov eax , [ (type REGS ptr ebx) . _edx ]
- mov [ regblk . _edx ] , eax
- mov eax , [ (type REGS ptr ebx) . _esi ]
- mov [ regblk . _esi ] , eax
- mov eax , [ (type REGS ptr ebx) . _edi ]
- mov [ regblk . _edi ] , eax
- mov ebx , [ sreg_ptr ]
- mov ax , [ (type SREGS ptr ebx) . _es ]
- mov [ regblk . _es ] , ax
- mov ax , [ (type SREGS ptr ebx) . _ds ]
- mov [ regblk . _ds ] , ax
- ; mov eax , 0300h
- ; mov ebx , [ vector ]
- ; xor bh , bh
- ; xor ecx , ecx
- ; lea edi , [ regblk ]
- ; int DPMI_INTR
- mov ebx , [ regs_ptr ]
- mov eax , [ regblk . _eax ]
- mov [ (type REGS ptr ebx) . _eax ] , eax
- mov eax , [ regblk . _ebx ]
- mov [ (type REGS ptr ebx) . _ebx ] , eax
- mov eax , [ regblk . _ecx ]
- mov [ (type REGS ptr ebx) . _ecx ] , eax
- mov eax , [ regblk . _edx ]
- mov [ (type REGS ptr ebx) . _edx ] , eax
- mov eax , [ regblk . _esi ]
- mov [ (type REGS ptr ebx) . _esi ] , eax
- mov eax , [ regblk . _edi ]
- mov [ (type REGS ptr ebx) . _edi ] , eax
- mov ebx , [ sreg_ptr ]
- mov ax , [ regblk . _es ]
- mov [ (type SREGS ptr ebx) . _es ] , ax
- mov ax , [ regblk . _ds ]
- mov [ (type SREGS ptr ebx) . _ds ] , ax
- ret
- ENDP DPMI_real_call
- END
|