Full Code of WindowsNT/asm for AI

master dea912bccbda cached
162 files
1.1 MB
391.6k tokens
142 symbols
1 requests
Download .txt
Showing preview only (1,140K chars total). Download the full file or copy to clipboard to get everything.
Repository: WindowsNT/asm
Branch: master
Commit: dea912bccbda
Files: 162
Total size: 1.1 MB

Directory structure:
gitextract_9e9nie88/

├── .gitattributes
├── .gitignore
├── .gitmodules
├── Readme.md
├── a.img
├── a20.asm
├── acpi16.asm
├── acpi32.asm
├── acpi64.asm
├── asm.sln
├── asm.vcxproj
├── asm.vcxproj.filters
├── asmtest.vbox
├── asmtest.vbox-prev
├── bochsrc.bxrc
├── build.bat
├── bx_enh_dbg.ini
├── code16.asm
├── code32.asm
├── code64.asm
├── config.asm
├── data16.asm
├── data32.asm
├── data64.asm
├── debuggee.asm
├── directlong.asm
├── dis/
│   ├── Makefile.am
│   ├── Makefile.in
│   ├── d.lb1
│   ├── d.lib
│   ├── d.mk
│   ├── d.mk1
│   ├── d.tgt
│   ├── d.wpj
│   ├── decode.c
│   ├── decode.h
│   ├── dism.lk1
│   ├── dism.mk
│   ├── dism.mk1
│   ├── dism.sym
│   ├── dism.tgt
│   ├── dism.txt
│   ├── dism.wpj
│   ├── extern.h
│   ├── itab.c
│   ├── itab.h
│   ├── main.c
│   ├── stderr.txt
│   ├── stdout.txt
│   ├── syn-att.c
│   ├── syn-intel.c
│   ├── syn.c
│   ├── syn.h
│   ├── types.h
│   ├── udint.h
│   ├── udis86.c
│   └── udis86.err
├── dmmic.asm
├── dos32.asm
├── dpmi/
│   ├── DPMI.LOD
│   ├── DPMI.PRO
│   ├── DPMIONE.PRO
│   ├── LICENSE.TXT
│   ├── README.TXT
│   ├── UNCOMMIT.TXT
│   └── VERSION.TXT
├── dpmic.asm
├── entry.asm
├── gdt.asm
├── guest16.asm
├── guest32.asm
├── guest64.asm
├── himem16.asm
├── idt.asm
├── int16.asm
├── int32.asm
├── int64.asm
├── iso.ps1
├── leheader.asm
├── lemain.asm
├── mdebug.asm
├── mdebugcore.asm
├── mutex16.asm
├── mutex32.asm
├── mutex64.asm
├── opcodes.asm
├── page16.asm
├── page32.asm
├── qlink/
│   ├── QLINK.CFG
│   ├── QLINK.HTM
│   ├── QLINK.TXT
│   ├── W95DPMI.386
│   └── WINDPMI.386
├── reqdmmi.asm
├── runx.bat
├── stack16.asm
├── stack32.asm
├── stack64.asm
├── startbochs.bat
├── startvbox.bat
├── startvmware.bat
├── struct.asm
├── swat/
│   ├── 386SWAT
│   ├── 386SWAT.DOC
│   ├── 386SWAT.GRM
│   ├── 386SWAT.LOD
│   ├── FILELIST.TXT
│   ├── KEYBIN.COM
│   ├── KEYBIN.HTM
│   ├── KEYBIN.TXT
│   ├── SWAT.HTM
│   ├── SWATAFLT.HTM
│   ├── SWATBMRK.HTM
│   ├── SWATCMD.HTM
│   ├── SWATCMR.HTM
│   ├── SWATDEF.HTM
│   ├── SWATDISP.HTM
│   ├── SWATDOC.HTM
│   ├── SWATGRM.HTM
│   ├── SWATINST.HTM
│   ├── SWATINV.HTM
│   ├── SWATMAX.HTM
│   ├── SWATMON.HTM
│   ├── SWATNDP.HTM
│   ├── SWATPRO.HTM
│   ├── SWATREM.HTM
│   ├── SWATRMV.HTM
│   ├── SWATRUN.COM
│   ├── SWATSCR.HTM
│   ├── SWATSYM.DOC
│   ├── SWATSYM.HTM
│   ├── SWATVER.HTM
│   ├── SWATVXD.DOC
│   ├── SWATVXD.HTM
│   ├── SWATWDBG.HTM
│   ├── SWATWISH.HTM
│   ├── SWATWKD.HTM
│   ├── VCPIDBG.DOC
│   ├── VCPIDBG.HTM
│   ├── WHATSNEW
│   ├── WINKDBG.DOC
│   └── WINKDBG.HTM
├── switcher/
│   ├── main.cpp
│   ├── switcher.lk1
│   ├── switcher.mk
│   ├── switcher.mk1
│   ├── switcher.sym
│   ├── switcher.tgt
│   └── switcher.wpj
├── thread16.asm
├── thread32.asm
├── thread64.asm
├── unreal.asm
├── vbox.vbox-prev
├── vdebug.asm
├── vdebug64.asm
├── vdisplay.asm
├── vm.nvram
├── vm.vmsd
├── vm.vmx
├── vm.vmxf
└── vmxhost64.asm

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs     diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following 
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln       merge=binary
#*.csproj    merge=binary
#*.vbproj    merge=binary
#*.vcxproj   merge=binary
#*.vcproj    merge=binary
#*.dbproj    merge=binary
#*.fsproj    merge=binary
#*.lsproj    merge=binary
#*.wixproj   merge=binary
#*.modelproj merge=binary
#*.sqlproj   merge=binary
#*.wwaproj   merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg   binary
#*.png   binary
#*.gif   binary

###############################################################################
# diff behavior for common document formats
# 
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the 
# entries below.
###############################################################################
#*.doc   diff=astextplain
#*.DOC   diff=astextplain
#*.docx  diff=astextplain
#*.DOCX  diff=astextplain
#*.dot   diff=astextplain
#*.DOT   diff=astextplain
#*.pdf   diff=astextplain
#*.PDF   diff=astextplain
#*.rtf   diff=astextplain
#*.RTF   diff=astextplain


================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
*.iso

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/

# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/Dos622.img
/Logs
/CD
/vm.vmx.lck/M43884.lck


================================================
FILE: .gitmodules
================================================
[submodule "Int50"]
	path = Int50
	url = https://github.com/WindowsNT/Int50


================================================
FILE: Readme.md
================================================
# Assembly Manual
Welcome to my assembly tutorials.

# Update
Cleaner DMMI interface for you:
https://github.com/WindowsNT/Int50

Articles:
* Full article (all in one): https://www.codeproject.com/Articles/1273844/The-Intel-Assembly-Manual

Older Articles: 
* Real/Protected/Long mode : https://www.codeproject.com/Articles/45788/The-Real-Protected-Long-mode-assembly-tutorial-for
* Virtualization: https://www.codeproject.com/Articles/215458/Virtualization-for-System-Programmers
* Multicore DOS: https://www.codeproject.com/Articles/889245/Deep-inside-CPU-Raw-multicore-programming
* DMMI: https://www.codeproject.com/Articles/894522/Teh-Low-Level-M-ss-DOS-Multicore-Mode-Interface

At the moment, the first part is implemented (Real/Protected/Long mode), the Protected Mode Virtualization (working in Bochs), the third part (test SIPI multicore, working on Bochs and VMWare)
and the fourth part finished (DMMI). More to follow soon.

## Instructions
1. Edit build.bat to specify flat assembler (FASM) path.
2. Edit startbochs.bat, startvmware.bat and startvbox.bat to locate the executables of these applications. Bochs is included
in the repository.

Build and run, it will automatically start bochs/vmware/virtualbox with the included FreeDOS image. 
It will create a CD-ROM as D: and you can run it from d:\entry.exe, by default it is automatically run (autoexec.bat)

## 3rd Party Apps included
1. DOS32A - http://dos32a.narechk.net/index_en.html
2. 386SWAT - http://www.sudleyplace.com/swat/
3. UDIS86 - http://udis86.sourceforge.net/ , including an open watcom C project that is used by VDEBUG and MDEBUG
4. DPMIONE - http://www.sudleyplace.com/dpmione/
5. QLINK - http://www.sudleyplace.com/qlink/


## Tests performed
1. Real mode test
2. Protected mode test with or without paging
3. Long mode test with paging and PAE
4. Real mode thread calling
5. Real mode thread called from protected mode
6. Real mode thread called from long mode
7. Protected mode thread called from real mode
8. Long mode thread called from real mode
9. VMX is there
10. Spawn a Virtual Machine in Unrestricted guest mode. Paged Protected Mode guest also there.
11. Entry /r which installs as TSR the DMMI services
12. DPMI startup example taken from https://board.flatassembler.net/topic.php?t=7122
13. DMMIC app runs which demonstrates DMMI, launching real mode, protected mode, long mode and virtualized protected mode threads
14. DOS32A loads a linear executable created with FASM
15. VDEBUG Virtualized Debugger (Not fully implemented yet)
15. MDEBUG Multicore Debugger (Not fully implemented yet)
16. SWITCHER multitasker (Not fully implemented yet)

## DMMI
I've called it DOS Multicore Mode Interface. It is a driver which helps you develop 32 and 64 bit multicore applications for DOS, using int 0xF0. 
This interrupt is accessible from both real, protected and long mode. Put the function number to AH.

To check for existence, check the vector for INT 0xF0. It should not be pointing to 0 or to an IRET, ES:BX+2 should point to a dword 'dmmi'.

Int 0xF0 provides the following functions to all modes (real, protected, long)

1. AH = 0, verify existence. Return values, AX = 0xFACE if the driver exists, DL = total CPUs, DH = virtualization support (0 none, 1 PM only, 2 Unrestricted guest). This function is accessible from real, protected and long mode.
2. AH = 1, begin thread. BL is the CPU index (1 to max-1). The function creates a thread, depending on AL:
   * 0, begin (un)real mode thread. ES:DX = new thread seg:ofs. The thread is run with FS capable of unreal mode addressing, must use RETF to return.
   * 1, begin 32 bit protected mode thread. EDX is the linear address of the thread. The thread must return with RETF.
   * 2, begin 64 bit long mode thread. EDX holds the linear address of the code to start in 64-bit long mode. The thread must terminate with RET.
   * 3, begin virtualized thread. BH contains the virtualization mode (1 for unrestricted guest real mode thread, and 2 for protected mode), and EDX the virtualized linear stack (or in seg:ofs format if unrestricted guest). The thread must return with RETF or VMCALL.
3. AH = 5, mutex functions. This function is accessible from all modes.
    * AL = 0 => initialize mutex to ES:DI (real) , EDI linear (protected), RDI linear (long).
    * AL = 1 => Lock mutex
    * AL = 2 => Unlock mutex
    * AL = 3 => Wait for mutex
4. AH = 4, execute real mode interrupt. This function is accessible from all modes. AL is the interrupt number, BP holds the AX value and BX,CX,DX,SI,DI are passed to the interrupt. DS and ES are loaded from the high 16 bits of ESI and EDI.
4. AH = 9, Switch To Mode.
	* From real mode: AL = 0 (enter unreal), AL = 2 (enter long, ECX = linear address to start. Code must set IDT found at [rax] on entry)
	* From long mode: AL = 0, go back to real, ECX = linear. 

Now, if you have more than one CPU, your DOS applications/games can now directly access all 2^64 of memory and all your CPUs, while still being able to call DOS directly. 

In order to avoid calling int 0xF0 directly from assembly and to make the driver compatible with higher level languages, an INT 0x21 redirection handler is installed. 
If you call INT 0x21 from the main thread, INT 0x21 is executed directly. If you call INT 0x21 from protected or long mode thread, then INT 0xF0 function AX = 0x0421 is executed automatically.


## Virtualization Debugger
Debugging protected or long mode under DOS is next to impossible. I am now trying to create a simple DEBUG enhancement, called VDEBUG, which should be able to debug any DOS app in virtualization.

Compile it with config.asm VDEBUG = 1. This app does the following:

* Load the debugee (int 0x21, function 0x4B01)
* Enter long mode (int 0xf0, function 0x0902)
* Prepare virtualization structures (int 0xf0, function 0x0801)
* Launch an unrestricted guest VM
* In the VM, set the trap flag so each opcode causes a VMEXIT.
* Jump to the entry point of the debugee 
* When target process calls int 0x21 function 0x4C to terminate, control returns to the command next to the int 0x21 function 0x4B01 call. Check there if under virtual machine. If so, do VMCALL to exit.
* Go back to real mode and exit.
* At the moment, the implemented functions are:
	* r - (registers) - shows Control, General, Segment regs, Dissassembly and bytes using UDIS86
	* g - (go) - runs program
	* t - (trace) - traces commands 
	* h - (help) - shows help
	* q - (quit) - quits


## Multicore Debugger
Debugging protected or long mode under DOS is next to impossible (again). I am now trying to create a simple DEBUG enhancement, called MDEBUG, which should be able to debug any DOS app from another CPU core.

Compile it with config.asm MDEBUG = 1. This app should perform the following:

* Jump to another core
* Load the debugee (int 0x21, function 0x4B01)
* Set the trap flag
* On exception, HLT the first processor then go to the MDEBUG processor
* On resume, send resume IPI to the first processor

This project is not yet created, but I hope that it will be here soon!

## Switcher
Switcher is a DMMI client that is able to do multitasking in DOS using multiple cores and virtualization.
More to follow soon!








================================================
FILE: a20.asm
================================================
; --------------------------------------- A20 line routines ---------------------------------------
USE16
WaitKBC:
	mov cx,0ffffh
A20L:
	in al,64h
	test al,2
	loopnz A20L
ret

EnableA20:
	call WaitKBC
	mov al,0d1h
	out 64h,al
	call WaitKBC
	mov al,0dfh
	out 60h,al
ret


EnableA20f:
	call WaitKBC
	mov al,0d1h
	out 64h,al
	call WaitKBC
	mov al,0dfh
	out 60h,al
retf


DisableA20:
	call WaitKBC
	mov al,0d1h
	out 64h,al
	call WaitKBC
	mov al,0ddh
	out 60h,al
ret

CheckA20:
    PUSH ax 
    PUSH ds
    PUSH es 

    XOR ax,ax 
    MOV ds,ax 
    NOT ax 
    MOV es,ax 
    MOV ah,[ds:0] 
    CMP ah,[es:10h] 
    JNZ A20_ON 

    CLI 
    INC ah 
    MOV [ds:0],ah 
    CMP [es:10h],ah 
    PUSHF 
    DEC ah 
    MOV [ds:0],ah 
    STI 
    POPF 
    JNZ A20_ON 

    CLC 
    POP es
    POP ds
    POP ax 
    RET 

A20_ON: 
    STC 
    POP es
    POP ds
    POP ax 
RET



================================================
FILE: acpi16.asm
================================================
; --------------------------------------- 16 bit APIC functions ---------------------------------------
USE16

include 'mutex16.asm'


; Returns APIC in EBX
; implemented as FAR to allow calling from elsewhere
GetMyApic16f:
	push eax
	push ecx
	push edx
	mov eax,1
	cpuid
	and ebx,0xff000000
	shr ebx,24
	pop edx
	pop ecx
	pop eax
retf
	

;-------------------------------------------------------------------------------------------
; Function ChecksumValid : Check the sum. EDI physical addr, ECX count
;-------------------------------------------------------------------------------------------		
ChecksumValid:
	PUSH ECX
	PUSH EDI
	XOR EAX,EAX
	.St:
	ADD EAX,[FS:EDI]
	INC EDI
	DEC ECX
	JECXZ .End
	JMP .St
	.End:
	TEST EAX,0xFF
	JNZ .F
	MOV EAX,1
	.F:
	POP EDI
	POP ECX
	RETF

;-------------------------------------------------------------------------------------------
; Function FillACPI : Finds RDSP, and then RDST or XDST
;-------------------------------------------------------------------------------------------	
FillACPI:
	pushadxeax
	push es
	mov es,[fs:040eh]
	xor edi,edi
	mov di,[es:0]
	pop es
	mov edi, 0x000E0000	
	.s:
	cmp edi, 0x000FFFFF	; 
	jge .noACPI			; Fail.
	mov eax,[fs:edi]
	add edi,4
	mov edx,[fs:edi]
	add edi,4
	cmp eax,0x20445352
	jnz .s
	cmp edx,0x20525450
	jnz .s
	jmp .found
	.noACPI:
	popadxeax
	mov EAX,0xFFFFFFFF
RETF
	.found:

	; Found at EDI
	sub edi,8
	mov esi,edi
	; 36 bytes for ACPI 2
	mov ecx,36
	push cs
	call ChecksumValid
	cmp eax,1
	jnz .noACPI2
	mov eax,[fs:edi + 24]
	mov dword [ds:XsdtAddress],eax
	mov eax,[fs:edi + 28]
	mov dword [ds:XsdtAddress + 4],eax
	mov edi,dword [ds:XsdtAddress]
	mov eax,[fs:edi]
	cmp eax, 'XSDT'			; Valid?
	jnz .noACPI2
popadxeax
RETF
	.noACPI2:
	mov edi,esi
	mov ecx,20
	push cs
	call ChecksumValid
	cmp eax,1
	jnz .noACPI
	mov eax,[fs:edi + 16]
	mov dword [ds:XsdtAddress],eax
	mov edi,dword [ds:XsdtAddress]
	mov eax,[fs:edi]
	cmp eax, 'RSDT'			; Valid?
	jnz .noACPI

	mov edi,dword [ds:XsdtAddress]
	mov dword [ds:XsdtAddress],0
	mov dword [ds:RsdtAddress],edi

popadxeax
RETF


;-------------------------------------------------------------------------------------------
; Function FindACPITableX : Finds EAX Table,  edi is rsdt/xsdt address and ecx is 4 or 8
;-------------------------------------------------------------------------------------------		
FindACPITableX:
	cmp edi,0
	jz .f

	; len, must be more than 36
	mov ebx,[fs:edi + 4]
	cmp ebx,36
	jle .f
	sub ebx,36 
	xor edx,edx

	.loop:
	cmp edx,ebx
	jz .f
	mov esi,[fs:edi + 36 + edx]
	cmp eax,[fs:esi]
	jnz .c
	mov eax,esi
RETF
	.c:
	add edx,ecx
	jmp .loop
	.f:
	mov eax,0ffffffffh
RETF

	
;-------------------------------------------------------------------------------------------
; Function DumpMadt : Fills from  EAX MADT
;-------------------------------------------------------------------------------------------		
DumpMadt: ; EAX
		
	pushad
	mov edi,eax
	mov [ds:numcpus],0

	mov ecx,[fs:edi + 4] ; length
	mov eax,[fs:edi + 0x24] ; Local APIC 
	mov [ds:LocalApic],eax

	add edi,0x2C
	sub ecx,0x2C
	.l1:
			
		xor ebx,ebx
		mov bl,[fs:edi + 1] ; length
		cmp bl,0
		jz .end ; duh
		sub ecx,ebx
			
		mov al,[fs:edi] ; type
		cmp al,0
		jnz .no0
			
		; This is a CPU!
		xor eax,eax
		mov al,[ds:numcpus]
		inc [ds:numcpus]
		mov edx,cpusstructize
		mul edx
		xor esi,esi
		mov si,cpus
		add esi,eax
		mov al,[fs:edi + 2]; ACPI id
		mov byte [ds:si],al
		mov al,[fs:edi + 3]; APIC id
		mov byte [ds:si + 4],al
			

		.no0:
			
		add edi,ebx
		
	jecxz .end
	jmp .l1
	.end:
		
	popad
RETF


;-------------------------------------------------------------------------------------------
; Function DumpAll ; edi = xsdt or rsdt
;-------------------------------------------------------------------------------------------		
DumpAll:

mov ebp, 32 ; max count
	cmp edi,0
	jz .f

	; len, must be more than 36
	mov ebx,[fs:edi + 4]
	cmp ebx,36
	jle .f
	sub ebx,36 
	xor edx,edx

	.loop:
	cmp edx,ebx
	jz .f
	mov esi,[fs:edi + 36 + edx]
	mov eax,[fs:esi]

		; eax to show
	push edx
	mov edx,eax
	mov ah,2
	int 21h

	shr edx,8
	mov ah,2
	int 21h
	
	shr edx,8
	mov ah,2
	int 21h

	shr edx,8
	mov ah,2
	int 21h
	
	mov dl,' ';
	mov ah,2
	int 21h

	pop edx

	add edx,ecx

	dec ebp
	cmp ebp, 0
	jz .f

	jmp .loop
	.f:
RETF







;-------------------------------------------------------------------------------------------
; Function SendSIPIf : Sends SIPI. EBX = CPU Index, EAX = linear
;-------------------------------------------------------------------------------------------		
SendSIPIf:
	PUSHAD
	PUSH DS
	mov cx,DATA16
	mov ds,cx
		
	XOR ECX,ECX
	; Spurious
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x0F0
	MOV EDX,[FS:EDI]
	OR EDX,0x1FF
	MOV [FS:EDI],EDX
	; Vector
	.L1:
	MOV ECX,EAX
	TEST EAX,0xFFF
	JZ .L2
	INC EAX
	JMP .L1
	.L2:
	MOV ESI,EAX
	SHR ESI,12
	; Init
	MOV ECX,0x04500
	OR ECX,ESI
	push cs
	call SendIPI16
	; Delay 10 ms  = 0,01 s = (100 Hz)
	; 1193182/100
;		sleep16 11931
	MOV AH,86H
	MOV CX,0
	MOV DX,10*1000 ;10 ms
	INT 15H
	; SIPI 1
	MOV ECX,0x05600
	OR ECX,ESI
	push cs
	call SendIPI16
	; Delay 200 us = 0,2 ms = 0,0002 s = (5000 Hz)
	; 1193182/5000
;		sleep16 238
	MOV AH,86H
	MOV CX,0
	MOV DX,200 ; 200us
	INT 15H
	; SIPI 2
	MOV ECX,0x05600
	OR ECX,ESI
	push cs
	call SendIPI16
	POP DS
	POPAD
RETF


;-------------------------------------------------------------------------------------------
; Function SendIPI16 : Sends IPI. EBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------		
SendIPI16: ; EBX = CPU INDEX, ECX = IPI
	PUSHAD
	; Lock Mutex		
	mov ax,mut_ipi
	push cs
	call qwaitlock16

		
	; Write it to 0x310
	; EBX is CPU INDEX
	; MAKE IT APIC ID
	xor eax,eax
	mov ax,cpusstructize
	mul bx
	add ax,cpus
	mov di,ax
	add di,4
	mov bl,[ds:di]
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x310
	MOV EDX,[FS:EDI]
	AND EDX,0xFFFFFF
	XOR EAX,EAX
	MOV AL,BL
	SHL EAX,24
	OR EDX,EAX
	MOV [FS:EDI],EDX
		
		
	; Write it to 0x300
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x300
	MOV [FS:EDI],ECX
	; Verify it got delivered
	.Verify:
	 PAUSE
	MOV EAX,[FS:EDI];
	SHR EAX,12
	TEST EAX,1
	JNZ .Verify
	; Write it to 0xB0 (EOI)
 
;	MOV EDI,[DS:LocalApic]
;	ADD EDI,0xB0
;    MOV dword [FS:EDI],0
		
	; Release Mutex
	qunlock16 mut_ipi
	POPAD
RETF




================================================
FILE: acpi32.asm
================================================
; --------------------------------------- 32 bit APIC functions ---------------------------------------
USE32

include 'mutex32.asm'




;-------------------------------------------------------------------------------------------
; Function SendSIPI32f : Sends SIPI. EBX = CPU Index, EAX = linear
;-------------------------------------------------------------------------------------------		
SendSIPI32f:
	PUSHAD
	PUSH DS
	PUSH ES
	mov cx,page32_idx ; This is a base-0 segment, so "linear" for EDI positioning
	mov es,cx
	mov cx,data16_idx
	mov ds,cx
		
	XOR ECX,ECX
	; Spurious
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x0F0
	MOV EDX,[ES:EDI]
	OR EDX,0x1FF
	MOV [ES:EDI],EDX
	; Vector
	.L1:
	MOV ECX,EAX
	TEST EAX,0xFFF
	JZ .L2
	INC EAX
	JMP .L1
	.L2:
	MOV ESI,EAX
	SHR ESI,12
	; Init
	MOV ECX,0x04500
	OR ECX,ESI
	push cs
	call SendIPI32

	; SIPI 1
	MOV ECX,0x05600
	OR ECX,ESI
	push cs
	call SendIPI32

	; SIPI 2
	MOV ECX,0x05600
	OR ECX,ESI
	push cs
	call SendIPI32
	POP ES
	POP DS
	POPAD
RETF


;-------------------------------------------------------------------------------------------
; Function SendIPI32 : Sends IPI. EBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------		
SendIPI32: ; EBX = CPU INDEX, ECX = IPI
	PUSHAD
	; Lock Mutex		
	mov ax,mut_ipi
	push cs
	call qwaitlock32

	; Write it to 0x310
	; EBX is CPU INDEX
	; MAKE IT APIC ID
	xor eax,eax
	mov ax,cpusstructize
	mul bx
	add ax,cpus
	mov di,ax
	add di,4
	mov bl,[ds:di]
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x310
	MOV EDX,[ES:EDI]
	AND EDX,0xFFFFFF
	XOR EAX,EAX
	MOV AL,BL
	SHL EAX,24
	OR EDX,EAX
	MOV [ES:EDI],EDX
		
		
	; Write it to 0x300
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x300
	MOV [ES:EDI],ECX
	; Verify it got delivered
	.Verify:
	 PAUSE
	MOV EAX,[ES:EDI];
	SHR EAX,12
	TEST EAX,1
	JNZ .Verify
	; Write it to 0xB0 (EOI)
 
	MOV EDI,[DS:LocalApic]
	ADD EDI,0xB0
    MOV dword [ES:EDI],0
		
	; Release Mutex
	qunlock32 mut_ipi
	POPAD
RETF




================================================
FILE: acpi64.asm
================================================
; --------------------------------------- 64 bit APIC functions ---------------------------------------
USE64


include 'mutex64.asm'




;-------------------------------------------------------------------------------------------
; Function SendSIPI64 : Sends SIPI. RBX = CPU Index, EAX = linear
;-------------------------------------------------------------------------------------------		
SendSIPI64:
	PUSH RAX
	PUSH RBX
	PUSH RCX
	PUSH RDX
	PUSH RSI
	PUSH RDI
		
		
	linear edi,LocalApic
	mov ecx,[edi]

	; Spurious
	MOV EDI,[RCX]
	ADD EDI,0x0F0
	MOV EDX,[EDI]
	OR EDX,0x1FF
	MOV [EDI],EDX

	; Vector
	.L1:
	MOV ECX,EAX
	TEST EAX,0xFFF
	JZ .L2
	INC EAX
	JMP .L1
	.L2:
	MOV ESI,EAX
	SHR ESI,12
	; Init
	MOV ECX,0x04500
	OR ECX,ESI
	call SendIPI64
	; SIPI 1
	MOV ECX,0x05600
	OR ECX,ESI
	call SendIPI64

	; SIPI 2
	MOV ECX,0x05600
	OR ECX,ESI
	call SendIPI64


	POP RDI
	POP RSI
	POP RDX
	POP RCX
	POP RBX
	POP RAX
RET


;-------------------------------------------------------------------------------------------
; Function SendIPI64 : Sends IPI. EBX = CPU Index, ECX = IPI
;-------------------------------------------------------------------------------------------		
SendIPI64: ; EBX = CPU INDEX, ECX = IPI

PUSH RAX
	PUSH RBX
	PUSH RCX
	PUSH RDX
	PUSH RSI
	PUSH RDI

	; Lock Mutex		
    xor rax,rax
	mov ax,mut_ipi
	call qwaitlock64

	; Write it to 0x310
	; EBX is CPU INDEX
	; MAKE IT APIC ID
	xor eax,eax
	mov ax,cpusstructize
	mul bx
	add ax,cpus
	xor rdi,rdi
	mov di,ax
	add di,4
	linear esi,edi
	mov bl,[esi]

	linear edi,LocalApic
	mov edi,[edi]
	ADD EDI,0x310
	MOV EDX,[EDI]
	AND EDX,0xFFFFFF
	XOR EAX,EAX
	MOV AL,BL
	SHL EAX,24
	OR EDX,EAX
	MOV [EDI],EDX
		
		
	; Write it to 0x300
	linear edi,LocalApic
	mov edi,[edi]
	ADD EDI,0x300
	MOV [EDI],ECX


	; Verify it got delivered
	.Verify:
	 PAUSE
	MOV EAX,[EDI];
	SHR EAX,12
	TEST EAX,1
	JNZ .Verify
	; Write it to 0xB0 (EOI)
 
;	MOV EDI,[ecx]
;	ADD EDI,0xB0
;    MOV dword [EDI],0
		
	; Release Mutex
	qunlock64 mut_ipi

	POP RDI
	POP RSI
	POP RDX
	POP RCX
	POP RBX
	POP RAX
RET




================================================
FILE: asm.sln
================================================

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asm", "asm.vcxproj", "{68FEA001-C33A-4EBC-A70F-9788736975B5}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Bochs|DOS = Bochs|DOS
		VirtualBox|DOS = VirtualBox|DOS
		VMWare|DOS = VMWare|DOS
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.Bochs|DOS.ActiveCfg = DOS|x64
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.Bochs|DOS.Build.0 = DOS|x64
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.VirtualBox|DOS.ActiveCfg = VirtualBox|x64
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.VirtualBox|DOS.Build.0 = VirtualBox|x64
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.VMWare|DOS.ActiveCfg = VMWare|x64
		{68FEA001-C33A-4EBC-A70F-9788736975B5}.VMWare|DOS.Build.0 = VMWare|x64
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {FA27BBE5-85B1-418A-9938-437642B9D60B}
	EndGlobalSection
EndGlobal


================================================
FILE: asm.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="BochsNoDebug|x64">
      <Configuration>BochsNoDebug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DOS|x64">
      <Configuration>DOS</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="VirtualBox|x64">
      <Configuration>VirtualBox</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="VMWare|x64">
      <Configuration>VMWare</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>15.0</VCProjectVersion>
    <ProjectGuid>{68FEA001-C33A-4EBC-A70F-9788736975B5}</ProjectGuid>
    <RootNamespace>asm</RootNamespace>
    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DOS|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <ConformanceMode>true</ConformanceMode>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <CustomBuild Include="entry.asm">
      <FileType>Document</FileType>
      <Command Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">build.bat</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">build.bat</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">build.bat</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">build.bat</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">entry.exe;dmmic.exe;le.exe;debuggee.exe;vdebug.exe;mdebug.exe</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">entry.exe;dmmic.exe;le.exe;debuggee.exe;vdebug.exe;mdebug.exe</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">entry.exe;dmmic.exe;le.exe;debuggee.exe;vdebug.exe;mdebug.exe</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">entry.exe;dmmic.exe;le.exe;debuggee.exe;vdebug.exe;mdebug.exe</Outputs>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">false</LinkObjects>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">false</LinkObjects>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">false</LinkObjects>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">false</LinkObjects>
      <TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">true</TreatOutputAsContent>
      <TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">true</TreatOutputAsContent>
      <TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">true</TreatOutputAsContent>
      <TreatOutputAsContent Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">true</TreatOutputAsContent>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">*.asm</AdditionalInputs>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">*.asm</AdditionalInputs>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">*.asm</AdditionalInputs>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">*.asm</AdditionalInputs>
    </CustomBuild>
  </ItemGroup>
  <ItemGroup>
    <None Include="a20.asm">
      <FileType>Document</FileType>
    </None>
    <None Include="acpi16.asm" />
    <None Include="acpi32.asm" />
    <None Include="acpi64.asm" />
    <None Include="asmtest.vbox" />
    <None Include="bochsrc.bxrc" />
    <None Include="build.bat" />
    <None Include="code16.asm" />
    <None Include="code32.asm" />
    <None Include="code64.asm" />
    <None Include="config.asm" />
    <None Include="data16.asm" />
    <None Include="data32.asm" />
    <None Include="data64.asm" />
    <None Include="directlong.asm" />
    <None Include="dmmic.asm" />
    <None Include="dpmic.asm" />
    <None Include="gdt.asm" />
    <None Include="guest16.asm" />
    <None Include="guest32.asm" />
    <None Include="guest64.asm" />
    <None Include="himem16.asm" />
    <None Include="idt.asm" />
    <None Include="int16.asm" />
    <None Include="int32.asm" />
    <None Include="int64.asm" />
    <None Include="iso.ps1" />
    <None Include="leheader.asm" />
    <None Include="lemain.asm" />
    <None Include="mdebug.asm" />
    <None Include="mdebugcore.asm" />
    <None Include="mutex16.asm" />
    <None Include="mutex32.asm" />
    <None Include="mutex64.asm" />
    <None Include="opcodes.asm" />
    <None Include="page16.asm" />
    <None Include="page32.asm" />
    <None Include="Readme.md" />
    <None Include="reqdmmi.asm" />
    <None Include="runx.bat" />
    <None Include="stack16.asm" />
    <None Include="stack32.asm" />
    <None Include="stack64.asm" />
    <None Include="startbochs.bat" />
    <None Include="startvbox.bat" />
    <None Include="startvmware.bat" />
    <None Include="struct.asm" />
    <None Include="switcher\switcher.mk1" />
    <None Include="switcher\switcher.wpj" />
    <None Include="thread16.asm" />
    <None Include="thread32.asm" />
    <None Include="thread64.asm" />
    <None Include="unreal.asm" />
    <None Include="vdebug.asm" />
    <None Include="debuggee.asm" />
    <None Include="vdebug64.asm" />
    <None Include="vdisplay.asm" />
    <None Include="vm.vmx" />
    <None Include="vmxhost64.asm" />
  </ItemGroup>
  <ItemGroup>
    <None Include="dos32.asm">
      <FileType>Document</FileType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Text Include="dis\main.c">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='VirtualBox|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DOS|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='VMWare|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='BochsNoDebug|x64'">false</ExcludedFromBuild>
      <FileType>CppCode</FileType>
    </Text>
  </ItemGroup>
  <ItemGroup>
    <None Include="switcher\main.cpp" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>

================================================
FILE: asm.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Configuration">
      <UniqueIdentifier>{f5fc6a1f-afcd-4e0e-999a-4740cb3500c2}</UniqueIdentifier>
    </Filter>
    <Filter Include="Data">
      <UniqueIdentifier>{f2ee1441-75fc-48c0-baec-44f7ad5f153f}</UniqueIdentifier>
    </Filter>
    <Filter Include="32 bit code">
      <UniqueIdentifier>{05819406-8f59-4c3a-a88d-6638e01bd070}</UniqueIdentifier>
    </Filter>
    <Filter Include="16 bit code">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="64 bit code">
      <UniqueIdentifier>{1f5ef5e6-1cd9-452e-b6d1-e803a1a2e812}</UniqueIdentifier>
    </Filter>
    <Filter Include="DMMI Client">
      <UniqueIdentifier>{3d1fb20d-d4c2-4578-9778-ec0c4531a433}</UniqueIdentifier>
    </Filter>
    <Filter Include="DPMI Client">
      <UniqueIdentifier>{19c81409-b80e-4267-80bc-95d0f74ac19d}</UniqueIdentifier>
    </Filter>
    <Filter Include="VDebug">
      <UniqueIdentifier>{0d5a1d9a-c2fb-4445-a6d7-4676170147c1}</UniqueIdentifier>
    </Filter>
    <Filter Include="MDebug">
      <UniqueIdentifier>{7f2ca36e-0cd5-4db7-ae28-3f94f4eb6f98}</UniqueIdentifier>
    </Filter>
    <Filter Include="Debuggee">
      <UniqueIdentifier>{189d96b4-2842-4505-805a-815b3b66bbd4}</UniqueIdentifier>
    </Filter>
    <Filter Include="Switcher">
      <UniqueIdentifier>{3d37bfd1-8ba1-4f5b-b5f5-5a30a1334465}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <CustomBuild Include="entry.asm">
      <Filter>16 bit code</Filter>
    </CustomBuild>
  </ItemGroup>
  <ItemGroup>
    <None Include="code16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="a20.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="gdt.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="idt.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="bochsrc.bxrc">
      <Filter>Configuration</Filter>
    </None>
    <None Include="build.bat">
      <Filter>Configuration</Filter>
    </None>
    <None Include="data16.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="data32.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="data64.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="struct.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="Readme.md">
      <Filter>Configuration</Filter>
    </None>
    <None Include="iso.ps1">
      <Filter>Configuration</Filter>
    </None>
    <None Include="vm.vmx">
      <Filter>Configuration</Filter>
    </None>
    <None Include="code32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="code64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="stack16.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="stack32.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="stack64.asm">
      <Filter>Data</Filter>
    </None>
    <None Include="page32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="startvbox.bat">
      <Filter>Configuration</Filter>
    </None>
    <None Include="startvmware.bat">
      <Filter>Configuration</Filter>
    </None>
    <None Include="startbochs.bat">
      <Filter>Configuration</Filter>
    </None>
    <None Include="asmtest.vbox">
      <Filter>Configuration</Filter>
    </None>
    <None Include="acpi16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="unreal.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="mutex16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="thread16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="config.asm">
      <Filter>Configuration</Filter>
    </None>
    <None Include="acpi32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="mutex32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="mutex64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="acpi64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="dos32.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="thread32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="thread64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="page16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="guest16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="guest32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="vmxhost64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="int16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="dmmic.asm">
      <Filter>DMMI Client</Filter>
    </None>
    <None Include="int32.asm">
      <Filter>32 bit code</Filter>
    </None>
    <None Include="himem16.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="int64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="directlong.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="guest64.asm">
      <Filter>64 bit code</Filter>
    </None>
    <None Include="lemain.asm">
      <Filter>DPMI Client</Filter>
    </None>
    <None Include="leheader.asm">
      <Filter>DPMI Client</Filter>
    </None>
    <None Include="opcodes.asm">
      <Filter>16 bit code</Filter>
    </None>
    <None Include="vdebug.asm">
      <Filter>VDebug</Filter>
    </None>
    <None Include="vdebug64.asm">
      <Filter>VDebug</Filter>
    </None>
    <None Include="debuggee.asm">
      <Filter>Debuggee</Filter>
    </None>
    <None Include="mdebug.asm">
      <Filter>MDebug</Filter>
    </None>
    <None Include="reqdmmi.asm">
      <Filter>DMMI Client</Filter>
    </None>
    <None Include="mdebugcore.asm">
      <Filter>MDebug</Filter>
    </None>
    <None Include="vdisplay.asm">
      <Filter>VDebug</Filter>
    </None>
    <None Include="runx.bat">
      <Filter>Configuration</Filter>
    </None>
    <None Include="dpmic.asm">
      <Filter>DPMI Client</Filter>
    </None>
    <None Include="switcher\switcher.mk1">
      <Filter>Switcher</Filter>
    </None>
    <None Include="switcher\switcher.wpj">
      <Filter>Switcher</Filter>
    </None>
    <None Include="switcher\main.cpp">
      <Filter>Switcher</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Text Include="dis\main.c">
      <Filter>16 bit code</Filter>
    </Text>
  </ItemGroup>
</Project>

================================================
FILE: asmtest.vbox
================================================
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.15-windows">
  <Machine uuid="{a436033c-67f8-4e9f-b0fe-0a7efbadb84d}" name="asmtest" OSType="Other_64" snapshotFolder="Snapshots" lastStateChange="2019-01-30T21:43:48Z">
    <MediaRegistry>
      <DVDImages>
        <Image uuid="{e6514449-af13-4958-9628-33af9ee8fa81}" location="d.iso"/>
      </DVDImages>
      <FloppyImages>
        <Image uuid="{3633dce4-e06c-456b-9a07-c48367a1e1a2}" location="a.img"/>
      </FloppyImages>
    </MediaRegistry>
    <ExtraData>
      <ExtraDataItem name="GUI/LastCloseAction" value="PowerOff"/>
      <ExtraDataItem name="GUI/LastNormalWindowPosition" value="450,261,720,442"/>
    </ExtraData>
    <Hardware>
      <CPU count="3">
        <PAE enabled="true"/>
        <LongMode enabled="true"/>
        <HardwareVirtExLargePages enabled="true"/>
      </CPU>
      <Memory RAMSize="64"/>
      <Paravirt provider="Default"/>
      <Display VRAMSize="6"/>
      <VideoCapture screens="1" file="." fps="25"/>
      <RemoteDisplay enabled="false"/>
      <BIOS>
        <IOAPIC enabled="true"/>
      </BIOS>
      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
        </Controllers>
      </USB>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="080027A516CD" cable="true" type="Am79C973">
          <NAT/>
        </Adapter>
      </Network>
      <AudioAdapter driver="DirectSound" enabled="true" enabledIn="false"/>
      <GuestProperties>
        <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1548884628564704400" flags=""/>
      </GuestProperties>
    </Hardware>
    <StorageControllers>
      <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
        <AttachedDevice passthrough="false" tempeject="true" type="DVD" hotpluggable="false" port="1" device="0">
          <Image uuid="{e6514449-af13-4958-9628-33af9ee8fa81}"/>
        </AttachedDevice>
      </StorageController>
      <StorageController name="Floppy" type="I82078" PortCount="1" useHostIOCache="true" Bootable="true">
        <AttachedDevice type="Floppy" hotpluggable="false" port="0" device="0">
          <Image uuid="{3633dce4-e06c-456b-9a07-c48367a1e1a2}"/>
        </AttachedDevice>
      </StorageController>
    </StorageControllers>
  </Machine>
</VirtualBox>


================================================
FILE: asmtest.vbox-prev
================================================
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.15-windows">
  <Machine uuid="{a436033c-67f8-4e9f-b0fe-0a7efbadb84d}" name="asmtest" OSType="Other_64" snapshotFolder="Snapshots" lastStateChange="2019-01-30T21:43:48Z">
    <MediaRegistry>
      <DVDImages>
        <Image uuid="{e6514449-af13-4958-9628-33af9ee8fa81}" location="d.iso"/>
      </DVDImages>
      <FloppyImages>
        <Image uuid="{3633dce4-e06c-456b-9a07-c48367a1e1a2}" location="a.img"/>
      </FloppyImages>
    </MediaRegistry>
    <ExtraData>
      <ExtraDataItem name="GUI/LastCloseAction" value="PowerOff"/>
      <ExtraDataItem name="GUI/LastNormalWindowPosition" value="0,23,640,522"/>
    </ExtraData>
    <Hardware>
      <CPU count="3">
        <PAE enabled="true"/>
        <LongMode enabled="true"/>
        <HardwareVirtExLargePages enabled="true"/>
      </CPU>
      <Memory RAMSize="64"/>
      <Paravirt provider="Default"/>
      <Display VRAMSize="6"/>
      <VideoCapture screens="1" file="." fps="25"/>
      <RemoteDisplay enabled="false"/>
      <BIOS>
        <IOAPIC enabled="true"/>
      </BIOS>
      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
        </Controllers>
      </USB>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="080027A516CD" cable="true" type="Am79C973">
          <NAT/>
        </Adapter>
      </Network>
      <AudioAdapter driver="DirectSound" enabled="true" enabledIn="false"/>
      <GuestProperties>
        <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1548215661025663900" flags=""/>
      </GuestProperties>
    </Hardware>
    <StorageControllers>
      <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
        <AttachedDevice passthrough="false" tempeject="true" type="DVD" hotpluggable="false" port="1" device="0">
          <Image uuid="{e6514449-af13-4958-9628-33af9ee8fa81}"/>
        </AttachedDevice>
      </StorageController>
      <StorageController name="Floppy" type="I82078" PortCount="1" useHostIOCache="true" Bootable="true">
        <AttachedDevice type="Floppy" hotpluggable="false" port="0" device="0">
          <Image uuid="{3633dce4-e06c-456b-9a07-c48367a1e1a2}"/>
        </AttachedDevice>
      </StorageController>
    </StorageControllers>
  </Machine>
</VirtualBox>


================================================
FILE: bochsrc.bxrc
================================================
# configuration file generated by Bochs
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1
config_interface: win32config
display_library: win32, options="gui_debug"
memory: host=32, guest=32
romimage: file="g:\bochs2/BIOS-bochs-latest", address=0x0, options=none
vgaromimage: file="g:\bochs2/VGABIOS-lgpl-latest"
boot: floppy
floppy_bootsig_check: disabled=0
floppya: type=1_44, 1_44="F:\TOOLS\ASM\full2\a.img", status=inserted, write_protected=0
# no floppyb
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=none
ata0-slave: type=cdrom, path="F:\TOOLS\ASM\full2\d.iso", status=inserted, model="Generic 1234", biosdetect=auto
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=none
ata1-slave: type=none
ata2: enabled=0
ata3: enabled=0
optromimage1: file=none
optromimage2: file=none
optromimage3: file=none
optromimage4: file=none
optramimage1: file=none
optramimage2: file=none
optramimage3: file=none
optramimage4: file=none
pci: enabled=1, chipset=i440fx
vga: extension=vbe, update_freq=5, realtime=1
cpu: count=2:2:2, ips=4000000, quantum=16, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string="              Intel(R) Pentium(R) 4 CPU        "
cpuid: mmx=1, apic=x2apic, simd=ssse3, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
cpuid: aes=1, sha=0, xsave=0, xsaveopt=0, x86_64=1, 1g_pages=1, pcid=0, fsgsbase=0
cpuid: smep=0, smap=0, mwait=1, vmx=2
print_timestamps: enabled=0
debugger_log: -
magic_break: enabled=1
port_e9_hack: enabled=0
private_colormap: enabled=0
clock: sync=none, time0=local, rtc_sync=0
# no cmosimage
# no loader
log: -
logprefix: %t%e%d
debug: action=ignore
info: action=report
error: action=report
panic: action=ask
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
sound: waveoutdrv=win, waveout=none, waveindrv=win, wavein=none, midioutdrv=win, midiout=none
speaker: enabled=1, mode=sound
parport1: enabled=1, file=none
parport2: enabled=0
com1: enabled=1, mode=null
com2: enabled=0
com3: enabled=0
com4: enabled=0


================================================
FILE: build.bat
================================================
del d.iso
fasm entry.asm
fasm dpmic.asm
fasm dmmic.asm
fasm vdebug.asm
fasm mdebug.asm
fasm debuggee.asm
fasm leheader.asm le.exe

REM Wmake
REM Replace G:\WATCOM with your OpenWatcom Path
cd switcher
g:\watcom\binnt\wpp main.cpp -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml
g:\WATCOM\binnt\wlink libpath g:\watcom\lib286 libpath g:\watcom\lib286\dos name switcher d all op m op maxe=25 op q op symf file main.obj format dos 
cd ..

REM upx --best entry.exe
mkdir CD
copy /y vdebug.exe .\CD\
copy /y mdebug.exe .\CD\mdebug.exe 
copy /y debuggee.exe .\CD\debuggee.exe 
copy /y entry.exe .\CD\entry.exe 
copy /y dmmic.exe .\CD\dmmic.exe
copy /y dpmic.exe .\CD\dpmic.exe
copy /y .\switcher\switcher.exe .\CD\switcher.exe
copy /y le.exe .\CD\le.exe
copy /y runx.bat .\CD\runx.bat
powershell -ExecutionPolicy RemoteSigned -File "iso.ps1"
del .\CD\386swat.lod
copy swat\386swat.lod .\CD\386swat.lod
copy /y dos32a\* .\CD\ 
xcopy /y /s /e /i swat\* .\CD\swat
xcopy /y /s /e /i qlink\* .\CD\qlink
xcopy /y /s /e /i dpmi\* .\CD\dpmi
copy /y dis\dism.exe .\CD\

	

================================================
FILE: bx_enh_dbg.ini
================================================
# bx_enh_dbg_ini
SeeReg[0] = TRUE
SeeReg[1] = TRUE
SeeReg[2] = TRUE
SeeReg[3] = TRUE
SeeReg[4] = FALSE
SeeReg[5] = FALSE
SeeReg[6] = FALSE
SeeReg[7] = FALSE
SingleCPU = FALSE
ShowIOWindows = TRUE
ShowButtons = TRUE
SeeRegColors = TRUE
ignoreNxtT = TRUE
ignSSDisasm = TRUE
UprCase = 1
DumpInAsciiMode = 2
isLittleEndian = TRUE
DefaultAsmLines = 512
DumpWSIndex = 0
DockOrder = 0x123
ListWidthPix[0] = 561
ListWidthPix[1] = 446
ListWidthPix[2] = 382
FontName = System
FontSize = -16
MainWindow = 307, 106, 1712, 956


================================================
FILE: code16.asm
================================================
SEGMENT CODE16 USE16
ORG 0h

macro break16
{
	xchg bx,bx
}

INCLUDE 'himem16.asm'
INCLUDE 'unreal.asm'
INCLUDE 'page16.asm'
INCLUDE 'acpi16.asm'
INCLUDE 'thread16.asm'
INCLUDE 'opcodes.asm'


macro EnterProtected ofs32 = Start32,codeseg = code32_idx,noinits = 0
{
    mov ax,noinits
	cmp ax,1
	jz .noinitg
	mov ax,DATA16
	mov ds,ax
	call far CODE16:GDTInit
	call far CODE16:IDTInit
	call far CODE16:IDTInit64
	.noinitg:
	cli
	mov bx,gdt_start
	lgdt [bx]
	mov bx,idt_PM_start

	; = NO DEBUG HERE =
	lidt [bx]
	mov eax,cr0
	or al,1
	mov cr0,eax 

	; gs load with linear data so DMMI knows
	mov ax,page32_idx
	mov gs,ax

	db  066h  
	db  0eah 
	dd  ofs32
	dw  codeseg

	NOP ; never executed
}


INCLUDE 'int16.asm'

; --------------------------------------- This is where the application starts ---------------------------------------
start16:

; --------------------------------------- Initialization of our segments ---------------------------------------
cli

; Overriden by HEAP 0 in entry.asm
;mov ax,0x4A00
;mov bx,ENDS
;int 0x21



mov ax,DATA16
mov ds,ax
mov es,ax
mov ax,STACK16
mov sp,stack16_end
mov ss,ax
sti
mov bx,idt_RM_start
sidt [bx] 

; --------------------------------------- HIMEM.SYS test ---------------------------------------

call himemthere
mov edx,1024
call allochigh
mov dx,cx
call freehigh

; --------------------------------------- A20 line  ---------------------------------------

mov [ds:a20enabled],0
call CheckA20
jc A20AlreadyOn
call EnableA20
mov [ds:a20enabled],1
A20AlreadyOn:

; --------------------------------------- Opcode tests ---------------------------------------
call OpcodeTest


; --------------------------------------- Prepare Long Mode  ---------------------------------------

if TEST_LONG > 0 

; Supported?
mov [LongModeSupported],0
mov eax, 0x80000000 
cpuid
cmp eax, 0x80000001
jb .NoLongMode         
mov [LongModeSupported],1
mov dx,supportlm
mov ax,0x0900
int 0x21

xor eax,eax
mov ax,CODE64
shl eax,4
add eax,Start64
push fs
mov bx,CODE32
mov fs,bx
mov dword [fs:PutLinearStart64],eax
pop fs

; And Page 1GB Support
mov [Support1GBPaging],0
mov eax,80000001h
cpuid
bt edx,26
jnc .no1gbpg
mov [Support1GBPaging],1
mov dx,support1gb
mov ax,0x0900
int 0x21
.no1gbpg:
.NoLongMode:

end if




; --------------------------------------- Protected Mode Find Page Entry  ---------------------------------------
xor ecx,ecx

; Alloc 32 Pages high, preserve low ram
mov edx,1024*100
call allochigh
mov [Paging32InXMSH],cx
mov [Paging32InXMS],edi

LoopPMR:
xor eax,eax
mov eax,[Paging32InXMS]

add eax,ecx
mov ebx,eax
shr eax,12
shl eax,12
cmp eax,ebx
jz LoopPRMFound
inc ecx
jmp LoopPMR
LoopPRMFound:
mov [PhysicalPagingOffset32],eax


; --------------------------------------- Long Mode Find Page Entry  ---------------------------------------
if TEST_LONG > 0 

; Alloc 64 Pages high, preserve low ram
mov edx,1024*100
call allochigh
mov [Paging64InXMSH],cx
mov [Paging64InXMS],edi


xor ecx,ecx
LoopPMR2:
xor eax,eax
mov eax,[Paging64InXMS]
add eax,ecx
mov ebx,eax
shr eax,12
shl eax,12
cmp eax,ebx
jz LoopPRMFound2
inc ecx
jmp LoopPMR2
LoopPRMFound2:
mov [PhysicalPagingOffset64],eax


end if

; --------------------------------------- VMX EPT Find Page Entry  ---------------------------------------
if TEST_VMX > 0 


mov [VMXSupported],0
mov [VMXUnrestrictedSupported],0
mov eax,1
cpuid
bt ecx,5
jnc VMX_NotSupported 
mov [VMXSupported],1
mov dx,supportvm
mov ax,0x0900
int 0x21

; Unrestricted guest also
xor eax,eax
xor edx,edx
mov ecx,0x48B ; IA32_VMX_PROCBASED_CTLS2
rdmsr
bt edx,7
jnc VMX_NoUR

mov [VMXUnrestrictedSupported],1

VMX_NoUR:
VMX_NotSupported:

; Alloc VMX Pages high, preserve low ram
mov edx,1024*100
call allochigh
mov [PagingVMInXMSH],cx
mov [PagingVMInXMS],edi

xor ecx,ecx
LoopPMR5:
xor eax,eax

mov eax,[PagingVMInXMS]
add eax,ecx
mov ebx,eax
shr eax,12
shl eax,12
cmp eax,ebx
jz LoopPRMFound5
inc ecx
jmp LoopPMR5
LoopPRMFound5:
mov dword [PhysicalEptOffset64],eax


end if

; --------------------------------------- Quick Unreal ---------------------------------------



push cs
cli
call EnterUnreal
sti

push cs
call InitPageTableFor64

mov ax,CODE16
mov ds,ax
linear eax,Thread64P,CODE16
mov [Thread64Ptr1],eax
mov ax,CODE64
mov ds,ax
linear eax,Thread64_1a,CODE64
mov [Thread64Ptr2],eax
mov ax,CODE16
mov ds,ax
linear eax,BackFromExecutingInterruptLM,CODE64
mov [Thread64Ptr3],eax
mov ax,CODE16
mov ds,ax
linear eax,Thread64PV,CODE16
mov [Thread64Ptr4],eax
mov ax,CODE16
mov ds,ax
linear eax,UR_Mode_2,CODE16
mov [Thread64Ptr1V],eax

mov ax,CODE16
mov ds,ax
linear eax,VMX_Init_Structures,CODE64
mov [cv64_vmxinitstructures],eax
linear eax,VMX_Enable,CODE64
mov [cv64_vmxenable],eax
linear eax,VMX_Disable,CODE64
mov [cv64_vmxdisable],eax
linear eax,VMX_Initialize_Host,CODE64
mov [cv64_vmxinithost],eax
linear eax,VMX_Initialize_Guest2,CODE64
mov [cv64_vmxinitguest2],eax
linear eax,VMX_Initialize_UnrestrictedGuest,CODE64
mov [cv64_vmxinitguest1],eax
linear eax,VMX_InitializeEPT,CODE64
mov [cv64_vmxinitept],eax
linear eax,VMX_Initialize_VMX_Controls,CODE64
mov [cv64_vmxinitcontrols1],eax
mov [cv64_vmxinitcontrols2],eax


; --------------------------------------- Find ACPI  ---------------------------------------
if TEST_MULTI > 0 

mov ax,DATA16
mov ds,ax
push cs
call GetMyApic16f
mov [ds:MainCPUAPIC],bl

push cs

call FillACPI
cmp eax,0xFFFFFFFF
jnz .coo
jmp .noacpi
.coo:

cmp eax, 'XSDT'
jz .ac2

mov eax,'APIC'
push cs
mov ecx,4
mov edi,[RsdtAddress]
call FindACPITableX
jmp .eac

.ac2:
mov eax,'APIC'
push cs
mov ecx,8
mov edi,dword [XsdtAddress]
call FindACPITableX

.eac:
cmp eax,0xFFFFFFFF
jnz .coo2
jmp .noacpi
.coo2:
push cs
call DumpMadt
.noacpi:

end if


; Resident test /r cmdline
mov ax,0x6200
int 0x21
push ds
mov ds,bx
mov al,[0x80]
cmp al,3
jnz .nores

mov al,[0x82]
cmp al,'/'
jnz .nores
mov al,[0x83]
cmp al,'r'
jnz .nores

; Resident
    pop ds

if RESIDENT = 0
	mov ax,0x4c00
	int 0x21
end if

	; Check if there first
	mov ax,0x35F0
	int 0x21
	cmp dword [es:bx + 2],'dmmi'
	jz .yres
	jmp .fres

	.yres:
	mov ax,0
	int 0xF0
	cmp ax,0xFACE
	jnz .fres

	mov ax,DATA16
	mov ds,ax
    mov ax,0x0900
	mov dx,resm2
	int 0x21
	
	mov ax,0x4C00
	int 0x21
	


	.fres:
    mov ax,0x35F0
	int 0x21
	mov ax,DATA16
	mov ds,ax
	mov [of0s],es
	mov [of0o],bx

	mov ax,CODE16
	mov ds,ax
    mov ax,0x25F0
	mov dx,int16
	int 0x21

	mov ax,DATA16
	mov ds,ax
    mov ax,0x0900
	mov dx,resm
	int 0x21
	
	mov dx,ENDS
	mov ax,0x3100
	int 0x21



.nores:
pop ds



; --------------------------------------- Protected Mode Test ---------------------------------------

EnterProtected
 
; --------------------------------------- Exit ---------------------------------------

exit16:
mov     eax,cr0         
and     al,not 1        
mov     cr0,eax         
db      0eah
dw      flush_ipq,CODE16
flush_ipq:
mov     ax,STACK16 
mov     ss,ax
mov     sp,stack16_end
mov ax, DATA16
mov     ds,ax
mov     es,ax
mov     di,idt_RM_start
lidt    [di]
sti
; = END NO DEBUG HERE =

; Free Paging 32 bit reserved in XMS
mov dx,[Paging32InXMSH]
call freehigh

; Free Paging 64 bit reserved in XMS
mov dx,[Paging64InXMSH]
call freehigh

; Free Paging VM bit reserved in XMS
mov dx,[PagingVMInXMSH]
call freehigh

; --------------------------------------- Quick Unreal ---------------------------------------
push cs
cli
call EnterUnreal
sti

if TEST_LONG > 0 
; Restore screen (long mode bug) -- Fixed :)
;mov ax,3
;int 10h
end if




; --------------------------------------- ACPI tests ---------------------------------------
if TEST_MULTI > 0 
if TEST_RM_SIPI > 0 


qlock16 mut_1
qlock16 mut_1
qlock16 mut_1
qlock16 mut_1

xor eax,eax
mov ax,DATA16
mov ds,ax
linear eax,Thread16_1,CODE16
mov ebx,1
call far CODE16:SendSIPIf

xor eax,eax
mov ax,DATA16
mov ds,ax
linear eax,Thread16_2,CODE16
mov ebx,2
call far CODE16:SendSIPIf

xor eax,eax
mov ax,DATA16
mov ds,ax
linear eax,Thread32_1,CODE32
mov ebx,3
call far CODE16:SendSIPIf

xor eax,eax
mov ax,DATA16
mov ds,ax
linear eax,Thread64_1,CODE64
mov ebx,1 ; Back to 1 core
call far CODE16:SendSIPIf


mov ax,mut_1
push cs
call qwait16
mov ax,mut_1
push cs
call qwait16
mov ax,mut_1
push cs
call qwait16
mov ax,mut_1
push cs
call qwait16

end if
end if



; --------------------------------------- Tests ---------------------------------------



if TEST_MULTI > 0 

; NumCpus
xor cx,cx
mov cl,[ds:numcpus]
.cpul:
cmp cx,0
je .endr
dec cx
mov ax,0900h
mov dx,cpuf
int 21h
jmp .cpul
.endr:
mov ax,0900h
mov dx,crlf
int 21h


end if

push cs
call EnterUnreal

if TEST_MULTI > 0 

; Apic test
cmp dword [ds:RsdtAddress],0
jz .noa1
mov ax,0900h
mov dx,ap1
int 21h
mov edi, [ds:RsdtAddress]
push cs
mov ecx,4
call DumpAll
mov ax,0900h
mov dx,crlf
int 21h
.noa1:

cmp dword [ds:XsdtAddress],0
jz .noa2
mov ax,0900h
mov dx,ap2
int 21h
mov edi, dword [ds:XsdtAddress]
mov ecx,8
push cs 
call DumpAll
mov ax,0900h
mov dx,crlf
int 21h
.noa2:


macro thrtest too,msg
{
    local .fx
	mov ax,DATA16
	mov gs,ax
	cmp [gs:too],1
	jnz .fx
	mov dx,msg
	mov ax,0900h
	int 21h
	.fx:
}

thrtest FromThread1,thr1
thrtest FromThread2,thr2
thrtest FromThread3,thr3
thrtest FromThread4,thr4
thrtest FromThread5,thr5
thrtest FromThread6,thr6
mov ax,0x900
mov dx,crlf
int 0x21

end if

; Real mode test
mov ax,0900h
mov dx,rm1
int 21h

; PM mode test

mov ax,DATA32
mov gs,ax
cmp [gs:d32],1
jnz fail_1
mov dx,pm1
mov ax,0900h
int 21h
fail_1:

if TEST_LONG > 0 

; Long mode test
mov ax,DATA64
mov gs,ax
cmp [gs:d64],1
jnz fail_2
mov dx,lm1
mov ax,0900h
int 21h
fail_2:

end if

; VMX test
macro vmxshow vmt,vmm
{
    local .ffx
	cmp [vmt],1
	jnz .ffx
	mov dx,vmm
	mov ax,0900h
	int 21h
	.ffx:
}
vmxshow vmt1,vmm1
vmxshow vmt2,vmm2
vmxshow vmt3,vmm2


mov ax,0900h
mov dx,crlf
int 21h

; A20 off if enabled

cmp [ds:a20enabled],1
jnz SkipA20Disable

mov ax,0900h
mov dx,a20off
int 21h

call DisableA20
SkipA20Disable:

; --------------------------------------- Bye! ---------------------------------------
mov ax,4c00h
int 21h



================================================
FILE: code32.asm
================================================
; --------------------------------------- 32 bit Code ---------------------------------------
SEGMENT CODE32 USE32
ORG 0h

macro break32
{
	xchg bx,bx
}



; --------------------------------------- One interrupt definition ---------------------------------------
intr00:
	IRETD

INCLUDE 'acpi32.asm'
INCLUDE 'page32.asm'
include 'thread32.asm'
INCLUDE 'int32.asm'


; --------------------------------------- Entry Point ---------------------------------------
Start32:
	mov     ax,stack32_idx          
	mov     ss,ax                   
	mov     esp,stack32_end  
	mov     ax,data32_idx           
	mov     ds,ax
	mov     es,ax
	mov     ax,data16_idx
	mov     gs,ax
	mov     fs,ax
	;jmp ToBack16
	
; --------------------------------------- Data stuff ---------------------------------------
	mov eax,1
	mov [ds:d32],eax
	mov ebx,[ds:d32]

; --------------------------------------- Interrupt Test ---------------------------------------
	int 0x0;

; --------------------------------------- SIPI to real mode test ---------------------------------------
if TEST_PM_SIPI > 0 

qlock32 mut_1

xor eax,eax
mov ax,data16_idx
mov ds,ax
linear eax,Thread16_3,CODE16
mov ebx,1
push cs
call SendSIPI32f

mov ax,mut_1
push cs
call qwait32


end if

; --------------------------------------- LLDT ---------------------------------------
	mov ax,ldt_idx
	lldt ax
	mov ax,data32_ldt_idx
	mov gs,ax
	push ds
	pop gs 

; --------------------------------------- Page Tests---------------------------------------
	call InitPageTable32a
	mov ax,data16_idx
	push gs
	mov gs,ax
	mov edx,[gs:PhysicalPagingOffset32]
	pop gs

	mov CR3,edx
	mov eax,cr4
	bts eax,4
	mov cr4,eax
	mov eax, cr0
	or eax,80000000h
	mov cr0, eax
	; Paging is now enabled
	nop
	nop
	nop
	; Disable Paging
	mov eax, cr0 ; Read CR0.
	and eax,7FFFFFFFh; Set PE=0
	mov cr0, eax ; Write CR0.
;	jmp ToBack16

; --------------------------------------- Prepare Long Mode ---------------------------------------
if TEST_LONG > 0 
    
if TEST_LM_SIPI > 0 
    
	mov ax,data16_idx
	push gs
	mov gs,ax
	mov dl,[gs:Support1GBPaging]
	mov dh,[gs:LongModeSupported]
	pop gs
	cmp dh,1
	jnz ToBack16
	cmp dl,1
	jnz .no1GB
	call InitPageTable643 ; 1gb pages, map entire 4gb
	jmp .okPaging
	.no1GB:
	call InitPageTable642 ; Small pages

else
	call InitPageTable642
end if

	.okPaging:
    ; Enable PAE
    mov eax, cr4
    bts eax, 5
    mov cr4, eax
    
	; Load new page table
   	mov ax,data16_idx
	push gs
	mov gs,ax
	mov edx,[gs:PhysicalPagingOffset64]
	pop gs
    mov cr3,edx

	; Enable Long Mode
    mov ecx, 0c0000080h ; EFER MSR number. 
    rdmsr ; Read EFER.
    bts eax, 8 ; Set LME=1.
    wrmsr ; Write EFER.
	; Enable Paging to activate Long Mode
    mov eax, cr0 ; Read CR0.
    or eax,80000000h ; Set PE=1.
    mov cr0, eax ; Write CR0.
	nop
	nop
	nop
        
	; We are now in Long Mode / Compatibility mode
    ; Jump to an 64-bit segment to enable 64-bit mode
    db 0eah
    PutLinearStart64 dd 0
    dw code64_idx
else
    jmp ToBack16
end if 

; --------------------------------------- Back from Long Mode ---------------------------------------
Back32:
; We are now in Compatibility mode again
	mov     ax,stack32_idx          
	mov     ss,ax                   
	mov     esp,stack32_end  
	mov     ax,data32_idx           
	mov     ds,ax
	mov     es,ax
	mov     ax,data16_idx
	mov     gs,ax
	mov     fs,ax

; Disable Paging to get out of Long Mode
	mov eax, cr0
	and eax,7fffffffh 
	mov cr0, eax
  
; Deactivate Long Mode
	mov ecx, 0c0000080h
	rdmsr
	btc eax, 8
	wrmsr
 
; Disable PAE
	mov eax, cr4
	btc eax, 5
	mov cr4, eax

; --------------------------------------- Back to Real mode ---------------------------------------
ToBack16:
; = Give FS the abs32 segment
; To test unreal mode 
	mov ax,absd32_idx
	mov fs,ax

; Go back
	db 066h ; because we are in a 32bit segment
	db 0eah
	dw exit16
	dw code16_idx




================================================
FILE: code64.asm
================================================
; --------------------------------------- 64 bit Code ---------------------------------------
SEGMENT CODE64 USE64
ORG 0h


macro break64
{
	xchg bx,bx
}

include 'guest64.asm'
include 'acpi64.asm'
include 'thread64.asm'
INCLUDE 'int64.asm'
include 'vmxhost64.asm'

; --------------------------------------- One interrupt definition ---------------------------------------
intr6400:
    nop
	nop
	IRETQ

Start64:

	xor r8d,r8d
	linear rsp,stack64_end  
	push rax
	mov rax,0
	pop rax

	; access d64 using linear, ds not used
	xor rax,rax
	mov ax,DATA64
	shl rax,4
	add rax,d64
	mov byte [rax],1


; --------------------------------------- Interrupt Test ---------------------------------------
   linear rax,idt_LM_start
   lidt [rax]
   int 0x1;

; --------------------------------------- SIPI to real mode test ---------------------------------------
if TEST_LM_SIPI > 0 

	qlock64 mut_1

	linear rax,Thread16_4,CODE16
	mov rbx,1
	call SendSIPI64
	
	mov rax,mut_1
	call qwait64

end if

if TEST_VMX > 0
; VMX operations

	call VMX_Host

end if 

	; Back to Compatibility Mode
	push code32_idx
	xor rcx,rcx
	mov ecx,Back32
	push rcx
	retf





================================================
FILE: config.asm
================================================
TEST_LONG = 1
TEST_MULTI = 1
TEST_RM_SIPI = 1
TEST_PM_SIPI = 1
TEST_LM_SIPI = 1
TEST_VMX = 1

RESIDENT = 1


VDEBUG = 0
MDEBUG = 0



================================================
FILE: data16.asm
================================================
SEGMENT DATA16 USE16



; --------------------------------------- 16 bit data ---------------------------------------
a20enabled db 0
numcpus db 0
somecpu A_CPU 0,0,0,0
cpusstructize = $-(somecpu)
CpusOfs:
cpus db cpusstructize*64 dup(0)
MainCPUAPIC db 0
LocalApic dd 0xFEE00000
RsdtAddress dd 0
XsdtAddress dq 0
ProcedureStart dd 0
FromThread1 db 0 
FromThread2 db 0 
FromThread3 db 0 
FromThread4 db 0 
FromThread5 db 0 
FromThread6 db 0 
of0s dw 0
of0o dw 0

LongModeSupported db 0
Support1GBPaging db 0 
VMXSupported db 0 
VMXUnrestrictedSupported db 0

Paging32InXMS dd 0
Paging32InXMSH dw 0

Paging64InXMS dd 0
Paging64InXMSH dw 0

PagingVMInXMS dd 0
PagingVMInXMSH dw 0

; --------------------------------------- VMX tests---------------------------------------
vmt1 db 0 ; existence
vmt2 db 0 ; protected mode guest
vmt3 db 0 ; unrestricted guest

vmm1 db "[VMX] ","$"
vmm2 db "[VMX Launch] ","$"

; --------------------------------------- 16 bit mutexes ---------------------------------------
mut_ipi db 0xFF
mut_1 db 0xFF
mut_i21 db 0xFF

; --------------------------------------- Messages ---------------------------------------
rm1 db "[Real mode] ","$"
pm1 db "[Protected mode] ","$"
lm1 db "[Long mode] ","$"
ap1 db "Apic 1 found ","$"
ap2 db "Apic 2 found ","$"

cpuf db "CPU $"
thrm1 db "Message from real mode thread",0dh,0ah,"$"
thrm2 db "Message from real mode thread called from protected mode",0dh,0ah,"$"
thrm3 db "Message from real mode thread called from long mode",0dh,0ah,"$"
thr1 db "[T1 RM] $"
thr2 db "[T2 RM] $"
thr3 db "[T3 PM->RM] $"
thr4 db "[T4 LM->RM] $"
thr5 db "[T5 RM->PM] $"
thr6 db "[T6 RM->LM] $"

resm db "DMMI Server Active",0dh,0ah,"$"
resm2 db "DMMI Server Already installed",0dh,0ah,"$"

a20off db "Restoring A20",0dh,0ah,"$"

crlf db 0dh,0ah,"$"


; --------------------------------------- GDT ---------------------------------------
gdt_start dw gdt_size
gdt_ptr dd 0
dummy_descriptor   GDT_STR 0,0,0,0,0,0
code32_descriptor  GDT_STR 0ffffh,0,0,9ah,0cfh,0 ; 4GB 32-bit code , 9ah = 10011010b = Present, DPL 00,No System, Code Exec/Read. 0cfh access = 11001111b = Big,32bit,<resvd 0>,1111 more size
data32_descriptor  GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data,   92h = 10010010b = Presetn , DPL 00, No System, Data Read/Write
stack32_descriptor GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit stack
code16_descriptor  GDT_STR 0ffffh,0,0,9ah,0,0    ; 64k 16-bit code
data16_descriptor  GDT_STR 0ffffh,0,0,92h,0,0    ; 64k 16-bit data
stack16_descriptor GDT_STR 0ffffh,0,0,92h,0,0    ; 64k 16-bit data
ldt_descriptor     GDT_STR ldt_size,0,0,82h,0,0  ; pointer to LDT,  82h = 10000010b = Present, DPL 00, System , Type "0010b" = LDT entry
code64_descriptor  GDT_STR 0ffffh,0,0,9ah,0afh,0 ; 16TB 64-bit code, 08cfh access = 01001111b = Big,64bit (0), 1111 more size
page32_descriptor  GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data,   92h = 10010010b = Presetn , DPL 00, No System, Data Read/Write
page64_descriptor  GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data,   92h = 10010010b = Presetn , DPL 00, No System, Data Read/Write
absd32_descriptor  GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data,   92h = 10010010b = Presetn , DPL 00, No System, Data Read/Write
data64_descriptor  GDT_STR 0ffffh,0,0,92h,0afh,0 ; 16TB 64-bit data, 08cfh access = 10001111b = Big,64bit (0), 1111 more size
absd64_descriptor  GDT_STR 0ffffh,0,0,92h,0afh,0 ; 16TB 64-bit data, 08cfh access = 10001111b = Big,64bit (0), 1111 more size
tssd32_descriptor  GDT_STR 0h,0,0,89h,040h,0 ; TSS segment in GDT
vmx32_descriptor   GDT_STR 0ffffh,0,0,9ah,0cfh,0 ; 4GB 32-bit code , 9ah = 10011010b = Present, DPL 00,No System, Code Exec/Read. 0cfh access = 11001111b = Big,32bit,<resvd 0>,1111 more size
raw32_descriptor   GDT_STR 0ffffh,0,0,9ah,0cfh,0 ; 4GB 32-bit code , 9ah = 10011010b = Present, DPL 00,No System, Code Exec/Read. 0cfh access = 11001111b = Big,32bit,<resvd 0>,1111 more size
tssd64_descriptor  GDT_STR 0h,0,0,89h,040h,0 ; TSS segment in GDT
gdt_size = $-(dummy_descriptor)

dummy_idx       = 0h    ; dummy selector
code32_idx      =       08h             ; offset of 32-bit code  segment in GDT
data32_idx      =       10h             ; offset of 32-bit data  segment in GDT
stack32_idx     =       18h             ; offset of 32-bit stack segment in GDT
code16_idx      =       20h             ; offset of 16-bit code segment in GDT
data16_idx      =       28h             ; offset of 16-bit data segment in GDT
stack16_idx     =       30h             ; offset of 16-bit stack segment in GDT
ldt_idx         =       38h             ; offset of LDT in GDT
code64_idx      =       40h             ; offset of 64-bit code segment in GDT
page32_idx      =       48h             ; offset of 32-bit data segment in GDT
page64_idx      =       50h             ; offset of 64-bit data segment in GDT
absd32_idx      =       58h             ; offset of 32-bit data  segment in GDT
data64_idx      =       60h             ; offset of 64-bit data segment in GDT
absd64_idx      =       68h             ; offset of 64-bit data segment in GDT
tssd32_idx      =       70h             ; TSS descriptor
vmx32_idx       =       78h             ; offset of 32-bit code  segment in GDT
raw32_idx       =       80h             ; offset of 32-bit code  segment in GDT
tssd64_idx      =       88h             ; TSS descriptor

data32_ldt_idx  =       04h             ; offset of 32-bit data  segment in LDT


; And For Quick Unreal
gdt_startUNR dw gdt_sizeUNR
gdt_ptrUNR dd 0
dummy_descriptorUNR GDT_STR 0,0,0,0,0,0
code16_descriptorUNR  GDT_STR 0ffffh,0,0,9ah,0,0
data32_descriptorUNR  GDT_STR 0ffffh,0,0,92h,0cfh,0
gdt_sizeUNR = $-(dummy_descriptorUNR)


; --------------------------------------- IDT ---------------------------------------

idt_RM_start      dw 0
idt_RM_ptr dd 0

idt_PM_start      dw             idt_size
idt_PM_ptr dd 0
interruptsall rb 256*8
;interruptsall IDT_STR 0,0,0,0,0
; rb 256 * 8
idt_size=$-(interruptsall)


idt_LM_start      dw             idtl_size
idt_LM_ptr db 0 dup(8)
interruptsall64 rb 256*16
idtl_size=$-(interruptsall64)



; --------------------------------------- PAGE ---------------------------------------
PhysicalPagingOffset32 dd 0
PhysicalPagingOffset64 dd 0
PhysicalEptOffset64 dq 0

; --------------------------------------- Supported ---------------------------------------
supportlm db "[Long Mode] ","$"
support1gb db "[1GB Paging] ","$"
supportvm db "[VM] ",0x0d,0x0a,"$"
;supportvmu db "VM Unrestricted Supported",0x0d,0x0a,"$"

; --- DISM
dismdata db 1000 dup (0) ; 1 type byte, 2 length, 3+data
dismdatac dd 0
dismdata2 db 2000 dup (0) ; Result


================================================
FILE: data32.asm
================================================
; --------------------------------------- 32 bit Data ---------------------------------------
SEGMENT DATA32 USE32

ldt_start:
ldt_1_descriptor  GDT_STR 0ffffh,0,0,92h,0cfh,0 ; 4GB 32-bit data
ldt_size=$-(ldt_1_descriptor)
; unlike the GDT , LDT does not have a 6-byte header to indicate its absolute address and limit ; these are specified into its GDT entry.
      
tssdata db 2048 dup (0) ; for some empty TSS
d32 dd 0


; --------------------------------------- MOVEMENTS FOR INT0xF0 ---------------------------------------
From32To16Regs db 64 dup (0)




================================================
FILE: data64.asm
================================================
; --------------------------------------- 64 bit Data ---------------------------------------
SEGMENT DATA64 USE64
ORG 0

d64 db 0


SEGMENT VMXDATA64 USE64

; --------------------------------------- VMX Data ---------------------------------------
ALIGN 4096
VMXStructureData db 20000 dup (0)
VMXStructureData1 dq 0 ; Used for VMXON
VMXStructureData2 dq 0 ; First VMCS
;VMXStructureData3 dq 0 ; Second VMCS
VMXRevision dd 0 ; Save Revision here
VMXStructureSize dd 0 ; Save structure size here

; Temp Data
TempData db 128 dup(0)



; --------------------------------------- MOVEMENTS FOR INT0xF0 ---------------------------------------
From64To16Regs db 64 dup (0)

; --------------------------------------- 64 bit Data another segment---------------------------------------
SEGMENT ABSD64 USE64




================================================
FILE: debuggee.asm
================================================
FORMAT MZ
HEAP 0

macro linear reg,trg,seg = DATA16
	{
	mov reg,seg
	shl reg,4
	add reg,trg
	}
struc GDT_STR s0_15,b0_15,b16_23,flags,access,b24_31
        {
		.s0_15   dw s0_15
		.b0_15   dw b0_15
		.b16_23  db b16_23
		.flags   db flags
		.access  db access
		.b24_31  db b24_31
        }



segment DATA16
USE16

; And For Quick Unreal
gdt_startUNR dw gdt_sizeUNR
gdt_ptrUNR dd 0
dummy_descriptorUNR GDT_STR 0,0,0,0,0,0
code16_descriptorUNR  GDT_STR 0ffffh,0,0,9ah,0,0
data32_descriptorUNR  GDT_STR 0ffffh,0,0,92h,0cfh,0
gdt_sizeUNR = $-(dummy_descriptorUNR)




; main
segment CODE16
USE16

m1 db "Hello",0xD,0xA,"$"

include 'unreal.asm'

start16:
    mov ax,CODE16
	mov ds,ax
	mov ax,0x0900
	mov dx,m1
	int 0x21
	nop
	nop

	; Enter Unreal
	;call EnterUnreal
	
	mov ax,0x4C00
	int 0x21

SEGMENT ENDS 
entry CODE16:start16




================================================
FILE: directlong.asm
================================================


macro thread64header brk=0
{
   local nobrk

	USE16 
	; Remember CPU starts in real mode
	db 4096 dup (144) ; // fill NOPs

	cli

	


	; Stack
	mov ax,STACK16T5
	mov ss,ax
	mov sp,stack16t5_end

	; A20
	call FAR CODE16:EnableA20f

	; Unreal
	call FAR CODE16:EnterUnreal


	; GDT and IDT
	mov ax,DATA16
	mov ds,ax
	call far CODE16:GDTInit
	call far CODE16:IDTInit
	call far CODE16:IDTInit64
	mov bx,gdt_start
	lgdt [bx]


	; Prepare Paging
	nop
	nop
	call FAR CODE16:InitPageTableFor64


	; Spurious, APIC		
	MOV EDI,[DS:LocalApic]
	ADD EDI,0x0F0
	MOV EDX,[FS:EDI]
	OR EDX,0x1FF
	push dword 0
	pop fs
	MOV [FS:EDI],EDX

	MOV EDI,[DS:LocalApic]
	ADD EDI,0x0B0
	MOV dword [FS:EDI],0

	; Breakpoint
	mov ax,brk
	cmp ax,1
	jnz nobrk
	xchg bx,bx
	nobrk:


	; Enter Long Mode
    mov eax, cr4
    bts eax, 5
    mov cr4, eax
    
	; Load new page table
   	mov ax,DATA16
	push gs
	mov gs,ax
	mov edx,[gs:PhysicalPagingOffset64]
	pop gs
    mov cr3,edx
    
	; Enable Long Mode
    mov ecx, 0c0000080h ; EFER MSR number. 
    rdmsr ; Read EFER.
    bts eax, 8 ; Set LME=1.
    wrmsr ; Write EFER.

	; Enable both PM and Paging to activate Long Mode from Real Mode
    mov eax, cr0 ; Read CR0.
    or eax,80000000h ; Set PE=1.
	or eax,1 ; Also PM=1
    mov cr0, eax ; Write CR0.
	nop
	nop
	nop

	
	

	; We are now in Long Mode / Compatibility mode
    ; Jump to an 64-bit segment to enable 64-bit mode

}


================================================
FILE: dis/Makefile.am
================================================
#
# -- udis86/libudis86
#

PYTHON  = @PYTHON@
OPTABLE = @top_srcdir@/docs/x86/optable.xml

MAINTAINERCLEANFILES = Makefile.in

lib_LTLIBRARIES	= libudis86.la

libudis86_la_SOURCES =	\
    itab.c \
    decode.c \
    syn.c \
    syn-intel.c \
    syn-att.c \
    udis86.c \
	udint.h \
    syn.h \
    decode.h

include_ladir = ${includedir}/libudis86
include_la_HEADERS = \
    types.h \
    extern.h \
    itab.h


BUILT_SOURCES = \
    itab.c \
    itab.h

#
# DLLs may not contain undefined symbol references.  
# We have the linker check this explicitly.
#
if TARGET_WINDOWS
libudis86_la_LDFLAGS = -no-undefined -version-info 0:0:0
endif

itab.c itab.h: $(OPTABLE) \
			   $(top_srcdir)/scripts/ud_itab.py \
               $(top_srcdir)/scripts/ud_opcode.py \
               $(top_srcdir)/scripts/ud_optable.py
	$(PYTHON) $(top_srcdir)/scripts/ud_itab.py $(OPTABLE) $(srcdir)


clean-local:
	rm -rf $(BUILT_SOURCES)

maintainer-clean-local:


================================================
FILE: dis/Makefile.in
================================================
# Makefile.in generated by automake 1.13.1 from Makefile.am.
# @configure_input@

# Copyright (C) 1994-2012 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

#
# -- udis86/libudis86
#


VPATH = @srcdir@
am__make_dryrun = \
  { \
    am__dry=no; \
    case $$MAKEFLAGS in \
      *\\[\ \	]*) \
        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
      *) \
        for am__flg in $$MAKEFLAGS; do \
          case $$am__flg in \
            *=*|--*) ;; \
            *n*) am__dry=yes; break;; \
          esac; \
        done;; \
    esac; \
    test $$am__dry = yes; \
  }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libudis86
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
	$(top_srcdir)/build/depcomp $(include_la_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/build/m4/libtool.m4 \
	$(top_srcdir)/build/m4/ltoptions.m4 \
	$(top_srcdir)/build/m4/ltsugar.m4 \
	$(top_srcdir)/build/m4/ltversion.m4 \
	$(top_srcdir)/build/m4/lt~obsolete.m4 \
	$(top_srcdir)/m4/ax_compare_version.m4 \
	$(top_srcdir)/m4/ax_prog_sphinx_version.m4 \
	$(top_srcdir)/m4/ax_prog_yasm_version.m4 \
	$(top_srcdir)/m4/ax_with_prog.m4 \
	$(top_srcdir)/m4/ax_with_python.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    if (++n[$$2] == $(am__install_max)) \
      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    END { for (dir in files) print dir, files[dir] }'
am__base_list = \
  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
  test -z "$$files" \
    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
         $(am__cd) "$$dir" && rm -f $$files; }; \
  }
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(include_ladir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libudis86_la_LIBADD =
am_libudis86_la_OBJECTS = itab.lo decode.lo syn.lo syn-intel.lo \
	syn-att.lo udis86.lo
libudis86_la_OBJECTS = $(am_libudis86_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 = 
libudis86_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(libudis86_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo "  GEN     " $@;
am__v_GEN_1 = 
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 = 
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
	$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo "  CC      " $@;
am__v_CC_1 = 
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo "  CCLD    " $@;
am__v_CCLD_1 = 
SOURCES = $(libudis86_la_SOURCES)
DIST_SOURCES = $(libudis86_la_SOURCES)
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac
HEADERS = $(include_la_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates.  Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
  BEGIN { nonempty = 0; } \
  { items[$$0] = 1; nonempty = 1; } \
  END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique.  This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PYTHON = @PYTHON@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SPHINX_BUILD = @SPHINX_BUILD@
SPHINX_VERSION = @SPHINX_VERSION@
STRIP = @STRIP@
VERSION = @VERSION@
YASM = @YASM@
YASM_VERSION = @YASM_VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
OPTABLE = @top_srcdir@/docs/x86/optable.xml
MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libudis86.la
libudis86_la_SOURCES = \
    itab.c \
    decode.c \
    syn.c \
    syn-intel.c \
    syn-att.c \
    udis86.c \
	udint.h \
    syn.h \
    decode.h

include_ladir = ${includedir}/libudis86
include_la_HEADERS = \
    types.h \
    extern.h \
    itab.h

BUILT_SOURCES = \
    itab.c \
    itab.h


#
# DLLs may not contain undefined symbol references.  
# We have the linker check this explicitly.
#
@TARGET_WINDOWS_TRUE@libudis86_la_LDFLAGS = -no-undefined -version-info 0:0:0
all: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) all-am

.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
	        && { if test -f $@; then exit 0; else break; fi; }; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libudis86/Makefile'; \
	$(am__cd) $(top_srcdir) && \
	  $(AUTOMAKE) --foreign libudis86/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure:  $(am__configure_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):

install-libLTLIBRARIES: $(lib_LTLIBRARIES)
	@$(NORMAL_INSTALL)
	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
	list2=; for p in $$list; do \
	  if test -f $$p; then \
	    list2="$$list2 $$p"; \
	  else :; fi; \
	done; \
	test -z "$$list2" || { \
	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
	}

uninstall-libLTLIBRARIES:
	@$(NORMAL_UNINSTALL)
	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
	done

clean-libLTLIBRARIES:
	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
	@list='$(lib_LTLIBRARIES)'; \
	locs=`for p in $$list; do echo $$p; done | \
	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
	      sort -u`; \
	test -z "$$locs" || { \
	  echo rm -f $${locs}; \
	  rm -f $${locs}; \
	}
libudis86.la: $(libudis86_la_OBJECTS) $(libudis86_la_DEPENDENCIES) $(EXTRA_libudis86_la_DEPENDENCIES) 
	$(AM_V_CCLD)$(libudis86_la_LINK) -rpath $(libdir) $(libudis86_la_OBJECTS) $(libudis86_la_LIBADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itab.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syn-att.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syn-intel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udis86.Plo@am__quote@

.c.o:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c $<

.c.obj:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`

.c.lo:
@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs
install-include_laHEADERS: $(include_la_HEADERS)
	@$(NORMAL_INSTALL)
	@list='$(include_la_HEADERS)'; test -n "$(include_ladir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(include_ladir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(include_ladir)" || exit 1; \
	fi; \
	for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(include_ladir)'"; \
	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(include_ladir)" || exit $$?; \
	done

uninstall-include_laHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(include_la_HEADERS)'; test -n "$(include_ladir)" || list=; \
	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
	dir='$(DESTDIR)$(include_ladir)'; $(am__uninstall_files_from_dir)

ID: $(am__tagged_files)
	$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags

tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
	set x; \
	here=`pwd`; \
	$(am__define_uniq_tagged_files); \
	shift; \
	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  if test $$# -gt 0; then \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      "$$@" $$unique; \
	  else \
	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	      $$unique; \
	  fi; \
	fi
ctags: ctags-am

CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
	$(am__define_uniq_tagged_files); \
	test -z "$(CTAGS_ARGS)$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && $(am__cd) $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am

cscopelist-am: $(am__tagged_files)
	list='$(am__tagged_files)'; \
	case "$(srcdir)" in \
	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
	  *) sdir=$(subdir)/$(srcdir) ;; \
	esac; \
	for i in $$list; do \
	  if test -f "$$i"; then \
	    echo "$(subdir)/$$i"; \
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	list='$(DISTFILES)'; \
	  dist_files=`for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
	case $$dist_files in \
	  */*) $(MKDIR_P) `echo "$$dist_files" | \
			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
			   sort -u` ;; \
	esac; \
	for file in $$dist_files; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  if test -d $$d/$$file; then \
	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
	    if test -d "$(distdir)/$$file"; then \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
	    fi; \
	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
	  else \
	    test -f "$(distdir)/$$file" \
	    || cp -p $$d/$$file "$(distdir)/$$file" \
	    || exit 1; \
	  fi; \
	done
check-am: all-am
check: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(include_ladir)"; do \
	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
	done
install: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	if test -z '$(STRIP)'; then \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	      install; \
	else \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
	fi
mostlyclean-generic:

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am

clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
	mostlyclean-am

distclean: distclean-am
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-tags

dvi: dvi-am

dvi-am:

html: html-am

html-am:

info: info-am

info-am:

install-data-am: install-include_laHEADERS

install-dvi: install-dvi-am

install-dvi-am:

install-exec-am: install-libLTLIBRARIES

install-html: install-html-am

install-html-am:

install-info: install-info-am

install-info-am:

install-man:

install-pdf: install-pdf-am

install-pdf-am:

install-ps: install-ps-am

install-ps-am:

installcheck-am:

maintainer-clean: maintainer-clean-am
	-rm -rf ./$(DEPDIR)
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
	maintainer-clean-local

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
	mostlyclean-libtool

pdf: pdf-am

pdf-am:

ps: ps-am

ps-am:

uninstall-am: uninstall-include_laHEADERS uninstall-libLTLIBRARIES

.MAKE: all check install install-am install-strip

.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
	clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \
	ctags ctags-am distclean distclean-compile distclean-generic \
	distclean-libtool distclean-tags distdir dvi dvi-am html \
	html-am info info-am install install-am install-data \
	install-data-am install-dvi install-dvi-am install-exec \
	install-exec-am install-html install-html-am \
	install-include_laHEADERS install-info install-info-am \
	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
	install-ps install-ps-am install-strip installcheck \
	installcheck-am installdirs maintainer-clean \
	maintainer-clean-generic maintainer-clean-local mostlyclean \
	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
	pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
	uninstall-include_laHEADERS uninstall-libLTLIBRARIES


itab.c itab.h: $(OPTABLE) \
			   $(top_srcdir)/scripts/ud_itab.py \
               $(top_srcdir)/scripts/ud_opcode.py \
               $(top_srcdir)/scripts/ud_optable.py
	$(PYTHON) $(top_srcdir)/scripts/ud_itab.py $(OPTABLE) $(srcdir)

clean-local:
	rm -rf $(BUILT_SOURCES)

maintainer-clean-local:

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:


================================================
FILE: dis/d.lb1
================================================
+'decode.obj'
+'itab.obj'
+'syn-att.obj'
+'syn-intel.obj'
+'syn.obj'
+'udis86.obj'


================================================
FILE: dis/d.mk
================================================
project : F:\TOOLS\ASM\full2\dis\d.lib .SYMBOLIC

!include F:\TOOLS\ASM\full2\dis\d.mk1


================================================
FILE: dis/d.mk1
================================================
!define BLANK ""
F:\TOOLS\ASM\full2\dis\decode.obj : F:\TOOLS\ASM\full2\dis\decode.c .AUTODEP&
END
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc decode.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\itab.obj : F:\TOOLS\ASM\full2\dis\itab.c .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc itab.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn-att.obj : F:\TOOLS\ASM\full2\dis\syn-att.c .AUTOD&
EPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn-att.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn-intel.obj : F:\TOOLS\ASM\full2\dis\syn-intel.c .A&
UTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn-intel.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn.obj : F:\TOOLS\ASM\full2\dis\syn.c .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\udis86.obj : F:\TOOLS\ASM\full2\dis\udis86.c .AUTODEP&
END
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc udis86.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\d.lib : F:\TOOLS\ASM\full2\dis\decode.obj F:\TOOLS\AS&
M\full2\dis\itab.obj F:\TOOLS\ASM\full2\dis\syn-att.obj F:\TOOLS\ASM\full2\d&
is\syn-intel.obj F:\TOOLS\ASM\full2\dis\syn.obj F:\TOOLS\ASM\full2\dis\udis8&
6.obj .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 %create d.lb1
!ifneq BLANK "decode.obj itab.obj syn-att.obj syn-intel.obj syn.obj udis86.o&
bj"
 @for %i in (decode.obj itab.obj syn-att.obj syn-intel.obj syn.obj udis86.ob&
j) do @%append d.lb1 +'%i'
!endif
!ifneq BLANK ""
 @for %i in () do @%append d.lb1 +'%i'
!endif
 *wlib -b -c -n -q -p=512 d.lib @d.lb1



================================================
FILE: dis/d.tgt
================================================
40
targetIdent
0
MProject
1
MComponent
0
2
WString
3
LIB
3
WString
5
d_6sn
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
5
d.lib
7
WString
3
LIB
8
WVList
0
9
WVList
0
-1
1
1
0
10
WPickList
7
11
MItem
3
*.c
12
WString
4
COBJ
13
WVList
0
14
WVList
0
-1
1
1
0
15
MItem
8
decode.c
16
WString
4
COBJ
17
WVList
0
18
WVList
0
11
1
1
0
19
MItem
6
itab.c
20
WString
4
COBJ
21
WVList
0
22
WVList
0
11
1
1
0
23
MItem
9
syn-att.c
24
WString
4
COBJ
25
WVList
0
26
WVList
0
11
1
1
0
27
MItem
11
syn-intel.c
28
WString
4
COBJ
29
WVList
0
30
WVList
0
11
1
1
0
31
MItem
5
syn.c
32
WString
4
COBJ
33
WVList
0
34
WVList
0
11
1
1
0
35
MItem
8
udis86.c
36
WString
4
COBJ
37
WVList
0
38
WVList
0
11
1
1
0


================================================
FILE: dis/d.wpj
================================================
40
projectIdent
0
VpeMain
1
WRect
0
0
7680
9210
2
MProject
3
MCommand
0
4
MCommand
0
1
5
WFileName
5
d.tgt
6
WVList
1
7
VComponent
8
WRect
0
0
5666
4280
0
0
9
WFileName
5
d.tgt
0
0
7


================================================
FILE: dis/decode.c
================================================
/* udis86 - libudis86/decode.c
 * 
 * Copyright (c) 2002-2009 Vivek Thampi
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 *     * Redistributions of source code must retain the above copyright notice, 
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright notice, 
 *       this list of conditions and the following disclaimer in the documentation 
 *       and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#include "udint.h"
#include "types.h"
#include "decode.h"

#ifndef __UD_STANDALONE__
# include <string.h>
#endif /* __UD_STANDALONE__ */

/* The max number of prefixes to an instruction */
#define MAX_PREFIXES    15

/* rex prefix bits */
#define REX_W(r)        ( ( 0xF & ( r ) )  >> 3 )
#define REX_R(r)        ( ( 0x7 & ( r ) )  >> 2 )
#define REX_X(r)        ( ( 0x3 & ( r ) )  >> 1 )
#define REX_B(r)        ( ( 0x1 & ( r ) )  >> 0 )
#define REX_PFX_MASK(n) ( ( P_REXW(n) << 3 ) | \
                          ( P_REXR(n) << 2 ) | \
                          ( P_REXX(n) << 1 ) | \
                          ( P_REXB(n) << 0 ) )

/* scable-index-base bits */
#define SIB_S(b)        ( ( b ) >> 6 )
#define SIB_I(b)        ( ( ( b ) >> 3 ) & 7 )
#define SIB_B(b)        ( ( b ) & 7 )

/* modrm bits */
#define MODRM_REG(b)    ( ( ( b ) >> 3 ) & 7 )
#define MODRM_NNN(b)    ( ( ( b ) >> 3 ) & 7 )
#define MODRM_MOD(b)    ( ( ( b ) >> 6 ) & 3 )
#define MODRM_RM(b)     ( ( b ) & 7 )

static int decode_ext(struct ud *u, uint16_t ptr);

enum reg_class { /* register classes */
  REGCLASS_GPR,
  REGCLASS_MMX,
  REGCLASS_CR,
  REGCLASS_DB,
  REGCLASS_SEG,
  REGCLASS_XMM
};

 /* 
 * inp_start
 *    Should be called before each de-code operation.
 */
static void
inp_start(struct ud *u)
{
  u->inp_ctr = 0;
}

   
static uint8_t
inp_next(struct ud *u)
{
  if (u->inp_end == 0) {
    if (u->inp_buf != NULL) {
      if (u->inp_buf_index < u->inp_buf_size) {
        u->inp_ctr++;
        return (u->inp_curr = u->inp_buf[u->inp_buf_index++]);
      }
    } else {
      int c;
      if ((c = u->inp_hook(u)) != UD_EOI) {
        u->inp_curr = c;
        u->inp_sess[u->inp_ctr++] = u->inp_curr;
        return u->inp_curr;
      }
    }
  }
  u->inp_end = 1;
  UDERR(u, "byte expected, eoi received\n");
  return 0;
}

static uint8_t
inp_curr(struct ud *u)
{
  return u->inp_curr;
}


/*
 * inp_uint8
 * int_uint16
 * int_uint32
 * int_uint64
 *    Load little-endian values from input
 */
static uint8_t 
inp_uint8(struct ud* u)
{
  return inp_next(u);
}

static uint16_t 
inp_uint16(struct ud* u)
{
  uint16_t r, ret;

  ret = inp_next(u);
  r = inp_next(u);
  return ret | (r << 8);
}

static uint32_t 
inp_uint32(struct ud* u)
{
  uint32_t r, ret;

  ret = inp_next(u);
  r = inp_next(u);
  ret = ret | (r << 8);
  r = inp_next(u);
  ret = ret | (r << 16);
  r = inp_next(u);
  return ret | (r << 24);
}

static uint64_t 
inp_uint64(struct ud* u)
{
  uint64_t r, ret;

  ret = inp_next(u);
  r = inp_next(u);
  ret = ret | (r << 8);
  r = inp_next(u);
  ret = ret | (r << 16);
  r = inp_next(u);
  ret = ret | (r << 24);
  r = inp_next(u);
  ret = ret | (r << 32);
  r = inp_next(u);
  ret = ret | (r << 40);
  r = inp_next(u);
  ret = ret | (r << 48);
  r = inp_next(u);
  return ret | (r << 56);
}


static inline int
eff_opr_mode(int dis_mode, int rex_w, int pfx_opr)
{
  if (dis_mode == 64) {
    return rex_w ? 64 : (pfx_opr ? 16 : 32);
  } else if (dis_mode == 32) {
    return pfx_opr ? 16 : 32;
  } else {
    UD_ASSERT(dis_mode == 16);
    return pfx_opr ? 32 : 16;
  }
}


static inline int
eff_adr_mode(int dis_mode, int pfx_adr)
{
  if (dis_mode == 64) {
    return pfx_adr ? 32 : 64;
  } else if (dis_mode == 32) {
    return pfx_adr ? 16 : 32;
  } else {
    UD_ASSERT(dis_mode == 16);
    return pfx_adr ? 32 : 16;
  }
}


/* 
 * decode_prefixes
 *
 *  Extracts instruction prefixes.
 */
static int 
decode_prefixes(struct ud *u)
{
  int done = 0;
  uint8_t curr, last = 0;
  UD_RETURN_ON_ERROR(u);

  do {
    last = curr;
    curr = inp_next(u); 
    UD_RETURN_ON_ERROR(u);
    if (u->inp_ctr == MAX_INSN_LENGTH) {
      UD_RETURN_WITH_ERROR(u, "max instruction length");
    }
   
    switch (curr)  
    {
    case 0x2E: 
      u->pfx_seg = UD_R_CS; 
      break;
    case 0x36:     
      u->pfx_seg = UD_R_SS; 
      break;
    case 0x3E: 
      u->pfx_seg = UD_R_DS; 
      break;
    case 0x26: 
      u->pfx_seg = UD_R_ES; 
      break;
    case 0x64: 
      u->pfx_seg = UD_R_FS; 
      break;
    case 0x65: 
      u->pfx_seg = UD_R_GS; 
      break;
    case 0x67: /* adress-size override prefix */ 
      u->pfx_adr = 0x67;
      break;
    case 0xF0: 
      u->pfx_lock = 0xF0;
      break;
    case 0x66: 
      u->pfx_opr = 0x66;
      break;
    case 0xF2:
      u->pfx_str = 0xf2;
      break;
    case 0xF3:
      u->pfx_str = 0xf3;
      break;
    default:
      /* consume if rex */
      done = (u->dis_mode == 64 && (curr & 0xF0) == 0x40) ? 0 : 1;
      break;
    }
  } while (!done);
  /* rex prefixes in 64bit mode, must be the last prefix */
  if (u->dis_mode == 64 && (last & 0xF0) == 0x40) {
    u->pfx_rex = last;  
  }
  return 0;
}


static inline unsigned int modrm( struct ud * u )
{
    if ( !u->have_modrm ) {
        u->modrm = inp_next( u );
        u->have_modrm = 1;
    }
    return u->modrm;
}


static unsigned int
resolve_operand_size( const struct ud * u, unsigned int s )
{
    switch ( s ) 
    {
    case SZ_V:
        return ( u->opr_mode );
    case SZ_Z:  
        return ( u->opr_mode == 16 ) ? 16 : 32;
    case SZ_Y:
        return ( u->opr_mode == 16 ) ? 32 : u->opr_mode;
    case SZ_RDQ:
        return ( u->dis_mode == 64 ) ? 64 : 32;
    default:
        return s;
    }
}


static int resolve_mnemonic( struct ud* u )
{
  /* resolve 3dnow weirdness. */
  if ( u->mnemonic == UD_I3dnow ) {
    u->mnemonic = ud_itab[ u->le->table[ inp_curr( u )  ] ].mnemonic;
  }
  /* SWAPGS is only valid in 64bits mode */
  if ( u->mnemonic == UD_Iswapgs && u->dis_mode != 64 ) {
    UDERR(u, "swapgs invalid in 64bits mode\n");
    return -1;
  }

  if (u->mnemonic == UD_Ixchg) {
    if ((u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_AX  &&
         u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_AX) ||
        (u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_EAX &&
         u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_EAX)) {
      u->operand[0].type = UD_NONE;
      u->operand[1].type = UD_NONE;
      u->mnemonic = UD_Inop;
    }
  }

  if (u->mnemonic == UD_Inop && u->pfx_repe) {
    u->pfx_repe = 0;
    u->mnemonic = UD_Ipause;
  }
  return 0;
}


/* -----------------------------------------------------------------------------
 * decode_a()- Decodes operands of the type seg:offset
 * -----------------------------------------------------------------------------
 */
static void 
decode_a(struct ud* u, struct ud_operand *op)
{
  if (u->opr_mode == 16) {  
    /* seg16:off16 */
    op->type = UD_OP_PTR;
    op->size = 32;
    op->lval.ptr.off = inp_uint16(u);
    op->lval.ptr.seg = inp_uint16(u);
  } else {
    /* seg16:off32 */
    op->type = UD_OP_PTR;
    op->size = 48;
    op->lval.ptr.off = inp_uint32(u);
    op->lval.ptr.seg = inp_uint16(u);
  }
}

/* -----------------------------------------------------------------------------
 * decode_gpr() - Returns decoded General Purpose Register 
 * -----------------------------------------------------------------------------
 */
static enum ud_type 
decode_gpr(register struct ud* u, unsigned int s, unsigned char rm)
{
  switch (s) {
    case 64:
        return UD_R_RAX + rm;
    case 32:
        return UD_R_EAX + rm;
    case 16:
        return UD_R_AX  + rm;
    case  8:
        if (u->dis_mode == 64 && u->pfx_rex) {
            if (rm >= 4)
                return UD_R_SPL + (rm-4);
            return UD_R_AL + rm;
        } else return UD_R_AL + rm;
    case 0:
        /* invalid size in case of a decode error */
        UD_ASSERT(u->error);
        return UD_NONE;
    default:
        UD_ASSERT(!"invalid operand size");
        return UD_NONE;
  }
}

static void
decode_reg(struct ud *u, 
           struct ud_operand *opr,
           int type,
           int num,
           int size)
{
  int reg;
  size = resolve_operand_size(u, size);
  switch (type) {
    case REGCLASS_GPR : reg = decode_gpr(u, size, num); break;
    case REGCLASS_MMX : reg = UD_R_MM0  + (num & 7); break;
    case REGCLASS_XMM : reg = UD_R_XMM0 + num; break;
    case REGCLASS_CR : reg = UD_R_CR0  + num; break;
    case REGCLASS_DB : reg = UD_R_DR0  + num; break;
    case REGCLASS_SEG : {
      /*
       * Only 6 segment registers, anything else is an error.
       */
      if ((num & 7) > 5) {
        UDERR(u, "invalid segment register value\n");
        return;
      } else {
        reg = UD_R_ES + (num & 7);
      }
      break;
    }
    default:
      UD_ASSERT(!"invalid register type");
      return;
  }
  opr->type = UD_OP_REG;
  opr->base = reg;
  opr->size = size;
}


/*
 * decode_imm 
 *
 *    Decode Immediate values.
 */
static void 
decode_imm(struct ud* u, unsigned int size, struct ud_operand *op)
{
  op->size = resolve_operand_size(u, size);
  op->type = UD_OP_IMM;

  switch (op->size) {
  case  8: op->lval.sbyte = inp_uint8(u);   break;
  case 16: op->lval.uword = inp_uint16(u);  break;
  case 32: op->lval.udword = inp_uint32(u); break;
  case 64: op->lval.uqword = inp_uint64(u); break;
  default: return;
  }
}


/* 
 * decode_mem_disp
 *
 *    Decode mem address displacement.
 */
static void 
decode_mem_disp(struct ud* u, unsigned int size, struct ud_operand *op)
{
  switch (size) {
  case 8:
    op->offset = 8; 
    op->lval.ubyte  = inp_uint8(u);
    break;
  case 16:
    op->offset = 16; 
    op->lval.uword  = inp_uint16(u); 
    break;
  case 32:
    op->offset = 32; 
    op->lval.udword = inp_uint32(u); 
    break;
  case 64:
    op->offset = 64; 
    op->lval.uqword = inp_uint64(u); 
    break;
  default:
      return;
  }
}


/*
 * decode_modrm_reg
 *
 *    Decodes reg field of mod/rm byte
 * 
 */
static inline void
decode_modrm_reg(struct ud         *u, 
                 struct ud_operand *operand,
                 unsigned int       type,
                 unsigned int       size)
{
  uint8_t reg = (REX_R(u->pfx_rex) << 3) | MODRM_REG(modrm(u));
  decode_reg(u, operand, type, reg, size);
}


/*
 * decode_modrm_rm
 *
 *    Decodes rm field of mod/rm byte
 * 
 */
static void 
decode_modrm_rm(struct ud         *u, 
                struct ud_operand *op,
                unsigned char      type,    /* register type */
                unsigned int       size)    /* operand size */

{
  size_t offset = 0;
  unsigned char mod, rm;

  /* get mod, r/m and reg fields */
  mod = MODRM_MOD(modrm(u));
  rm  = (REX_B(u->pfx_rex) << 3) | MODRM_RM(modrm(u));

  /* 
   * If mod is 11b, then the modrm.rm specifies a register.
   *
   */
  if (mod == 3) {
    decode_reg(u, op, type, rm, size);
    return;
  }

  /* 
   * !11b => Memory Address
   */  
  op->type = UD_OP_MEM;
  op->size = resolve_operand_size(u, size);

  if (u->adr_mode == 64) {
    op->base = UD_R_RAX + rm;
    if (mod == 1) {
      offset = 8;
    } else if (mod == 2) {
      offset = 32;
    } else if (mod == 0 && (rm & 7) == 5) {           
      op->base = UD_R_RIP;
      offset = 32;
    } else {
      offset = 0;
    }
    /* 
     * Scale-Index-Base (SIB) 
     */
    if ((rm & 7) == 4) {
      inp_next(u);
      
      op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
      op->index = UD_R_RAX + (SIB_I(inp_curr(u)) | (REX_X(u->pfx_rex) << 3));
      op->base  = UD_R_RAX + (SIB_B(inp_curr(u)) | (REX_B(u->pfx_rex) << 3));

      /* special conditions for base reference */
      if (op->index == UD_R_RSP) {
        op->index = UD_NONE;
        op->scale = UD_NONE;
      }

      if (op->base == UD_R_RBP || op->base == UD_R_R13) {
        if (mod == 0) {
          op->base = UD_NONE;
        } 
        if (mod == 1) {
          offset = 8;
        } else {
          offset = 32;
        }
      }
    }
  } else if (u->adr_mode == 32) {
    op->base = UD_R_EAX + rm;
    if (mod == 1) {
      offset = 8;
    } else if (mod == 2) {
      offset = 32;
    } else if (mod == 0 && rm == 5) {
      op->base = UD_NONE;
      offset = 32;
    } else {
      offset = 0;
    }

    /* Scale-Index-Base (SIB) */
    if ((rm & 7) == 4) {
      inp_next(u);

      op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
      op->index = UD_R_EAX + (SIB_I(inp_curr(u)) | (REX_X(u->pfx_rex) << 3));
      op->base  = UD_R_EAX + (SIB_B(inp_curr(u)) | (REX_B(u->pfx_rex) << 3));

      if (op->index == UD_R_ESP) {
        op->index = UD_NONE;
        op->scale = UD_NONE;
      }

      /* special condition for base reference */
      if (op->base == UD_R_EBP) {
        if (mod == 0) {
          op->base = UD_NONE;
        } 
        if (mod == 1) {
          offset = 8;
        } else {
          offset = 32;
        }
      }
    }
  } else {
    const unsigned int bases[]   = { UD_R_BX, UD_R_BX, UD_R_BP, UD_R_BP,
                                     UD_R_SI, UD_R_DI, UD_R_BP, UD_R_BX };
    const unsigned int indices[] = { UD_R_SI, UD_R_DI, UD_R_SI, UD_R_DI,
                                     UD_NONE, UD_NONE, UD_NONE, UD_NONE };
    op->base  = bases[rm & 7];
    op->index = indices[rm & 7];
    if (mod == 0 && rm == 6) {
      offset = 16;
      op->base = UD_NONE;
    } else if (mod == 1) {
      offset = 8;
    } else if (mod == 2) { 
      offset = 16;
    }
  }

  if (offset) {
    decode_mem_disp(u, offset, op);
  }
}


/* 
 * decode_moffset
 *    Decode offset-only memory operand
 */
static void
decode_moffset(struct ud *u, unsigned int size, struct ud_operand *opr)
{
  opr->type = UD_OP_MEM;
  opr->size = resolve_operand_size(u, size);
  decode_mem_disp(u, u->adr_mode, opr);
}


/* -----------------------------------------------------------------------------
 * decode_operands() - Disassembles Operands.
 * -----------------------------------------------------------------------------
 */
static int
decode_operand(struct ud           *u, 
               struct ud_operand   *operand,
               enum ud_operand_code type,
               unsigned int         size)
{
  operand->_oprcode = type;

  switch (type) {
    case OP_A :
      decode_a(u, operand);
      break;
    case OP_MR:
      decode_modrm_rm(u, operand, REGCLASS_GPR, 
                      MODRM_MOD(modrm(u)) == 3 ? 
                        Mx_reg_size(size) : Mx_mem_size(size));
      break;
    case OP_F:
      u->br_far  = 1;
      /* intended fall through */
    case OP_M:
      if (MODRM_MOD(modrm(u)) == 3) {
        UDERR(u, "expected modrm.mod != 3\n");
      }
      /* intended fall through */
    case OP_E:
      decode_modrm_rm(u, operand, REGCLASS_GPR, size);
      break;
    case OP_G:
      decode_modrm_reg(u, operand, REGCLASS_GPR, size);
      break;
    case OP_sI:
    case OP_I:
      decode_imm(u, size, operand);
      break;
    case OP_I1:
      operand->type = UD_OP_CONST;
      operand->lval.udword = 1;
      break;
    case OP_N:
      if (MODRM_MOD(modrm(u)) != 3) {
        UDERR(u, "expected modrm.mod == 3\n");
      }
      /* intended fall through */
    case OP_Q:
      decode_modrm_rm(u, operand, REGCLASS_MMX, size);
      break;
    case OP_P:
      decode_modrm_reg(u, operand, REGCLASS_MMX, size);
      break;
    case OP_U:
      if (MODRM_MOD(modrm(u)) != 3) {
        UDERR(u, "expected modrm.mod == 3\n");
      }
      /* intended fall through */
    case OP_W:
      decode_modrm_rm(u, operand, REGCLASS_XMM, size);
      break;
    case OP_V:
      decode_modrm_reg(u, operand, REGCLASS_XMM, size);
      break;
    case OP_MU:
      decode_modrm_rm(u, operand, REGCLASS_XMM, 
                      MODRM_MOD(modrm(u)) == 3 ? 
                        Mx_reg_size(size) : Mx_mem_size(size));
      break;
    case OP_S:
      decode_modrm_reg(u, operand, REGCLASS_SEG, size);
      break;
    case OP_O:
      decode_moffset(u, size, operand);
      break;
    case OP_R0: 
    case OP_R1: 
    case OP_R2: 
    case OP_R3: 
    case OP_R4: 
    case OP_R5: 
    case OP_R6: 
    case OP_R7:
      decode_reg(u, operand, REGCLASS_GPR, 
                 (REX_B(u->pfx_rex) << 3) | (type - OP_R0), size);
      break;
    case OP_AL:
    case OP_AX:
    case OP_eAX:
    case OP_rAX:
      decode_reg(u, operand, REGCLASS_GPR, 0, size);
      break;
    case OP_CL:
    case OP_CX:
    case OP_eCX:
      decode_reg(u, operand, REGCLASS_GPR, 1, size);
      break;
    case OP_DL:
    case OP_DX:
    case OP_eDX:
      decode_reg(u, operand, REGCLASS_GPR, 2, size);
      break;
    case OP_ES: 
    case OP_CS: 
    case OP_DS:
    case OP_SS: 
    case OP_FS: 
    case OP_GS:
      /* in 64bits mode, only fs and gs are allowed */
      if (u->dis_mode == 64) {
        if (type != OP_FS && type != OP_GS) {
          UDERR(u, "invalid segment register in 64bits\n");
        }
      }
      operand->type = UD_OP_REG;
      operand->base = (type - OP_ES) + UD_R_ES;
      operand->size = 16;
      break;
    case OP_J :
      decode_imm(u, size, operand);
      operand->type = UD_OP_JIMM;
      break ;
    case OP_R :
      if (MODRM_MOD(modrm(u)) != 3) {
        UDERR(u, "expected modrm.mod == 3\n");
      }
      decode_modrm_rm(u, operand, REGCLASS_GPR, size);
      break;
    case OP_C:
      decode_modrm_reg(u, operand, REGCLASS_CR, size);
      break;
    case OP_D:
      decode_modrm_reg(u, operand, REGCLASS_DB, size);
      break;
    case OP_I3 :
      operand->type = UD_OP_CONST;
      operand->lval.sbyte = 3;
      break;
    case OP_ST0: 
    case OP_ST1: 
    case OP_ST2: 
    case OP_ST3:
    case OP_ST4:
    case OP_ST5: 
    case OP_ST6: 
    case OP_ST7:
      operand->type = UD_OP_REG;
      operand->base = (type - OP_ST0) + UD_R_ST0;
      operand->size = 80;
      break;
    default :
      break;
  }
  return 0;
}


/* 
 * decode_operands
 *
 *    Disassemble upto 3 operands of the current instruction being
 *    disassembled. By the end of the function, the operand fields
 *    of the ud structure will have been filled.
 */
static int
decode_operands(struct ud* u)
{
  decode_operand(u, &u->operand[0],
                    u->itab_entry->operand1.type,
                    u->itab_entry->operand1.size);
  decode_operand(u, &u->operand[1],
                    u->itab_entry->operand2.type,
                    u->itab_entry->operand2.size);
  decode_operand(u, &u->operand[2],
                    u->itab_entry->operand3.type,
                    u->itab_entry->operand3.size);
  return 0;
}
    
/* -----------------------------------------------------------------------------
 * clear_insn() - clear instruction structure
 * -----------------------------------------------------------------------------
 */
static void
clear_insn(register struct ud* u)
{
  u->error     = 0;
  u->pfx_seg   = 0;
  u->pfx_opr   = 0;
  u->pfx_adr   = 0;
  u->pfx_lock  = 0;
  u->pfx_repne = 0;
  u->pfx_rep   = 0;
  u->pfx_repe  = 0;
  u->pfx_rex   = 0;
  u->pfx_str   = 0;
  u->mnemonic  = UD_Inone;
  u->itab_entry = NULL;
  u->have_modrm = 0;
  u->br_far    = 0;

  memset( &u->operand[ 0 ], 0, sizeof( struct ud_operand ) );
  memset( &u->operand[ 1 ], 0, sizeof( struct ud_operand ) );
  memset( &u->operand[ 2 ], 0, sizeof( struct ud_operand ) );
}


static inline int
resolve_pfx_str(struct ud* u)
{
  if (u->pfx_str == 0xf3) {
    if (P_STR(u->itab_entry->prefix)) {
        u->pfx_rep  = 0xf3;
    } else {
        u->pfx_repe = 0xf3;
    }
  } else if (u->pfx_str == 0xf2) {
    u->pfx_repne = 0xf3;
  }
  return 0;
}


static int
resolve_mode( struct ud* u )
{
  int default64;
  /* if in error state, bail out */
  if ( u->error ) return -1; 

  /* propagate prefix effects */
  if ( u->dis_mode == 64 ) {  /* set 64bit-mode flags */

    /* Check validity of  instruction m64 */
    if ( P_INV64( u->itab_entry->prefix ) ) {
      UDERR(u, "instruction invalid in 64bits\n");
      return -1;
    }

    /* effective rex prefix is the  effective mask for the 
     * instruction hard-coded in the opcode map.
     */
    u->pfx_rex = ( u->pfx_rex & 0x40 ) | 
                 ( u->pfx_rex & REX_PFX_MASK( u->itab_entry->prefix ) ); 

    /* whether this instruction has a default operand size of 
     * 64bit, also hardcoded into the opcode map.
     */
    default64 = P_DEF64( u->itab_entry->prefix ); 
    /* calculate effective operand size */
    if ( REX_W( u->pfx_rex ) ) {
        u->opr_mode = 64;
    } else if ( u->pfx_opr ) {
        u->opr_mode = 16;
    } else {
        /* unless the default opr size of instruction is 64,
         * the effective operand size in the absence of rex.w
         * prefix is 32.
         */
        u->opr_mode = default64 ? 64 : 32;
    }

    /* calculate effective address size */
    u->adr_mode = (u->pfx_adr) ? 32 : 64;
  } else if ( u->dis_mode == 32 ) { /* set 32bit-mode flags */
    u->opr_mode = ( u->pfx_opr ) ? 16 : 32;
    u->adr_mode = ( u->pfx_adr ) ? 16 : 32;
  } else if ( u->dis_mode == 16 ) { /* set 16bit-mode flags */
    u->opr_mode = ( u->pfx_opr ) ? 32 : 16;
    u->adr_mode = ( u->pfx_adr ) ? 32 : 16;
  }

  return 0;
}


static inline int
decode_insn(struct ud *u, uint16_t ptr)
{
  UD_ASSERT((ptr & 0x8000) == 0);
  u->itab_entry = &ud_itab[ ptr ];
  u->mnemonic = u->itab_entry->mnemonic;
  return (resolve_pfx_str(u)  == 0 &&
          resolve_mode(u)     == 0 &&
          decode_operands(u)  == 0 &&
          resolve_mnemonic(u) == 0) ? 0 : -1;
}


/*
 * decode_3dnow()
 *
 *    Decoding 3dnow is a little tricky because of its strange opcode
 *    structure. The final opcode disambiguation depends on the last
 *    byte that comes after the operands have been decoded. Fortunately,
 *    all 3dnow instructions have the same set of operand types. So we
 *    go ahead and decode the instruction by picking an arbitrarily chosen
 *    valid entry in the table, decode the operands, and read the final
 *    byte to resolve the menmonic.
 */
static inline int
decode_3dnow(struct ud* u)
{
  uint16_t ptr;
  UD_ASSERT(u->le->type == UD_TAB__OPC_3DNOW);
  UD_ASSERT(u->le->table[0xc] != 0);
  decode_insn(u, u->le->table[0xc]);
  inp_next(u); 
  if (u->error) {
    return -1;
  }
  ptr = u->le->table[inp_curr(u)]; 
  UD_ASSERT((ptr & 0x8000) == 0);
  u->mnemonic = ud_itab[ptr].mnemonic;
  return 0;
}


static int
decode_ssepfx(struct ud *u)
{
  uint8_t idx;
  uint8_t pfx;
 
  /*
   * String prefixes (f2, f3) take precedence over operand
   * size prefix (66).
   */
  pfx = u->pfx_str;
  if (pfx == 0) {
    pfx = u->pfx_opr;
  }
  idx = ((pfx & 0xf) + 1) / 2;
  if (u->le->table[idx] == 0) {
    idx = 0;
  }
  if (idx && u->le->table[idx] != 0) {
    /*
     * "Consume" the prefix as a part of the opcode, so it is no
     * longer exported as an instruction prefix.
     */
    u->pfx_str = 0;
    if (pfx == 0x66) {
        /* 
         * consume "66" only if it was used for decoding, leaving
         * it to be used as an operands size override for some
         * simd instructions.
         */
        u->pfx_opr = 0;
    }
  }
  return decode_ext(u, u->le->table[idx]);
}


/*
 * decode_ext()
 *
 *    Decode opcode extensions (if any)
 */
static int
decode_ext(struct ud *u, uint16_t ptr)
{
  uint8_t idx = 0;
  if ((ptr & 0x8000) == 0) {
    return decode_insn(u, ptr); 
  }
  u->le = &ud_lookup_table_list[(~0x8000 & ptr)];
  if (u->le->type == UD_TAB__OPC_3DNOW) {
    return decode_3dnow(u);
  }

  switch (u->le->type) {
    case UD_TAB__OPC_MOD:
      /* !11 = 0, 11 = 1 */
      idx = (MODRM_MOD(modrm(u)) + 1) / 4;
      break;
      /* disassembly mode/operand size/address size based tables.
       * 16 = 0,, 32 = 1, 64 = 2
       */
    case UD_TAB__OPC_MODE:
      idx = u->dis_mode != 64 ? 0 : 1;
      break;
    case UD_TAB__OPC_OSIZE:
      idx = eff_opr_mode(u->dis_mode, REX_W(u->pfx_rex), u->pfx_opr) / 32;
      break;
    case UD_TAB__OPC_ASIZE:
      idx = eff_adr_mode(u->dis_mode, u->pfx_adr) / 32;
      break;
    case UD_TAB__OPC_X87:
      idx = modrm(u) - 0xC0;
      break;
    case UD_TAB__OPC_VENDOR:
      if (u->vendor == UD_VENDOR_ANY) {
        /* choose a valid entry */
        idx = (u->le->table[idx] != 0) ? 0 : 1;
      } else if (u->vendor == UD_VENDOR_AMD) {
        idx = 0;
      } else {
        idx = 1;
      }
      break;
    case UD_TAB__OPC_RM:
      idx = MODRM_RM(modrm(u));
      break;
    case UD_TAB__OPC_REG:
      idx = MODRM_REG(modrm(u));
      break;
    case UD_TAB__OPC_SSE:
      return decode_ssepfx(u);
    default:
      UD_ASSERT(!"not reached");
      break;
  }

  return decode_ext(u, u->le->table[idx]);
}


static int
decode_opcode(struct ud *u)
{
  uint16_t ptr;
  UD_ASSERT(u->le->type == UD_TAB__OPC_TABLE);
  UD_RETURN_ON_ERROR(u);
  u->primary_opcode = inp_curr(u);
  ptr = u->le->table[inp_curr(u)];
  if (ptr & 0x8000) {
    u->le = &ud_lookup_table_list[ptr & ~0x8000];
    if (u->le->type == UD_TAB__OPC_TABLE) {
      inp_next(u);
      return decode_opcode(u);
    }
  }
  return decode_ext(u, ptr);
}

 
/* =============================================================================
 * ud_decode() - Instruction decoder. Returns the number of bytes decoded.
 * =============================================================================
 */
unsigned int
ud_decode(struct ud *u)
{
  inp_start(u);
  clear_insn(u);
  u->le = &ud_lookup_table_list[0];
  u->error = decode_prefixes(u) == -1 || 
             decode_opcode(u)   == -1 ||
             u->error;
  /* Handle decode error. */
  if (u->error) {
    /* clear out the decode data. */
    clear_insn(u);
    /* mark the sequence of bytes as invalid. */
    u->itab_entry = &ud_itab[0]; /* entry 0 is invalid */
    u->mnemonic = u->itab_entry->mnemonic;
  } 

    /* maybe this stray segment override byte
     * should be spewed out?
     */
    if ( !P_SEG( u->itab_entry->prefix ) && 
            u->operand[0].type != UD_OP_MEM &&
            u->operand[1].type != UD_OP_MEM )
        u->pfx_seg = 0;

  u->insn_offset = u->pc; /* set offset of instruction */
  u->asm_buf_fill = 0;   /* set translation buffer index to 0 */
  u->pc += u->inp_ctr;    /* move program counter by bytes decoded */

  /* return number of bytes disassembled. */
  return u->inp_ctr;
}

/*
vim: set ts=2 sw=2 expandtab
*/


================================================
FILE: dis/decode.h
================================================
/* udis86 - libudis86/decode.h
 *
 * Copyright (c) 2002-2009 Vivek Thampi
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 *     * Redistributions of source code must retain the above copyright notice, 
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright notice, 
 *       this list of conditions and the following disclaimer in the documentation 
 *       and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef UD_DECODE_H
#define UD_DECODE_H

#include "types.h"
#include "itab.h"

#define MAX_INSN_LENGTH 15

/* itab prefix bits */
#define P_none          ( 0 )
#define P_cast          ( 1 << 0 )
#define P_CAST(n)       ( ( n >> 0 ) & 1 )
#define P_rexb          ( 1 << 1 )
#define P_REXB(n)       ( ( n >> 1 ) & 1 )
#define P_inv64         ( 1 << 4 )
#define P_INV64(n)      ( ( n >> 4 ) & 1 )
#define P_rexw          ( 1 << 5 )
#define P_REXW(n)       ( ( n >> 5 ) & 1 )
#define P_def64         ( 1 << 7 )
#define P_DEF64(n)      ( ( n >> 7 ) & 1 )
#define P_rexr          ( 1 << 8 )
#define P_REXR(n)       ( ( n >> 8 ) & 1 )
#define P_oso           ( 1 << 9 )
#define P_OSO(n)        ( ( n >> 9 ) & 1 )
#define P_aso           ( 1 << 10 )
#define P_ASO(n)        ( ( n >> 10 ) & 1 )
#define P_rexx          ( 1 << 11 )
#define P_REXX(n)       ( ( n >> 11 ) & 1 )
#define P_ImpAddr       ( 1 << 12 )
#define P_IMPADDR(n)    ( ( n >> 12 ) & 1 )
#define P_seg           ( 1 << 13 )
#define P_SEG(n)        ( ( n >> 13 ) & 1 )
#define P_str           ( 1 << 14 )
#define P_STR(n)        ( ( n >> 14 ) & 1 )
#define P_strz          ( 1 << 15 )
#define P_STR_ZF(n)     ( ( n >> 15 ) & 1 )

/* operand type constants -- order is important! */

enum ud_operand_code {
    OP_NONE,

    OP_A,      OP_E,      OP_M,       OP_G,       
    OP_I,      OP_F,

    OP_R0,     OP_R1,     OP_R2,      OP_R3,
    OP_R4,     OP_R5,     OP_R6,      OP_R7,

    OP_AL,     OP_CL,     OP_DL,
    OP_AX,     OP_CX,     OP_DX,
    OP_eAX,    OP_eCX,    OP_eDX,
    OP_rAX,    OP_rCX,    OP_rDX,

    OP_ES,     OP_CS,     OP_SS,      OP_DS,  
    OP_FS,     OP_GS,

    OP_ST0,    OP_ST1,    OP_ST2,     OP_ST3,
    OP_ST4,    OP_ST5,    OP_ST6,     OP_ST7,

    OP_J,      OP_S,      OP_O,          
    OP_I1,     OP_I3,     OP_sI,

    OP_V,      OP_W,      OP_Q,       OP_P, 
    OP_U,      OP_N,      OP_MU,

    OP_R,      OP_C,      OP_D,       

    OP_MR
} UD_ATTR_PACKED;


/* operand size constants */

enum ud_operand_size {
    SZ_NA  = 0,
    SZ_Z   = 1,
    SZ_V   = 2,
    SZ_RDQ = 7,

    /* the following values are used as is,
     * and thus hard-coded. changing them 
     * will break internals 
     */
    SZ_B   = 8,
    SZ_W   = 16,
    SZ_D   = 32,
    SZ_Q   = 64,
    SZ_T   = 80,
    SZ_O   = 128,

    SZ_Y   = 17,

    /*
     * complex size types, that encode sizes for operands
     * of type MR (memory or register), for internal use
     * only. Id space 256 and above.
     */
    SZ_BD  = (SZ_B << 8) | SZ_D,
    SZ_BV  = (SZ_B << 8) | SZ_V,
    SZ_WD  = (SZ_W << 8) | SZ_D,
    SZ_WV  = (SZ_W << 8) | SZ_V,
    SZ_WY  = (SZ_W << 8) | SZ_Y,
    SZ_DY  = (SZ_D << 8) | SZ_Y,
    SZ_WO  = (SZ_W << 8) | SZ_O,
    SZ_DO  = (SZ_D << 8) | SZ_O,
    SZ_QO  = (SZ_Q << 8) | SZ_O,

} UD_ATTR_PACKED;


/* resolve complex size type.
 */
static inline enum ud_operand_size
Mx_mem_size(enum ud_operand_size size)
{
    return (size >> 8) & 0xff;
}

static inline enum ud_operand_size
Mx_reg_size(enum ud_operand_size size)
{
    return size & 0xff;
}

/* A single operand of an entry in the instruction table. 
 * (internal use only)
 */
struct ud_itab_entry_operand 
{
  enum ud_operand_code type;
  enum ud_operand_size size;
};


/* A single entry in an instruction table. 
 *(internal use only)
 */
struct ud_itab_entry 
{
  enum ud_mnemonic_code         mnemonic;
  struct ud_itab_entry_operand  operand1;
  struct ud_itab_entry_operand  operand2;
  struct ud_itab_entry_operand  operand3;
  uint32_t                      prefix;
};

struct ud_lookup_table_list_entry {
    const uint16_t *table;
    enum ud_table_type type;
    const char *meta;
};
     


static inline int
ud_opcode_field_sext(uint8_t primary_opcode)
{
  return (primary_opcode & 0x02) != 0;
}

extern struct ud_itab_entry ud_itab[];
extern struct ud_lookup_table_list_entry ud_lookup_table_list[];

#endif /* UD_DECODE_H */

/* vim:cindent
 * vim:expandtab
 * vim:ts=4
 * vim:sw=4
 */


================================================
FILE: dis/dism.lk1
================================================
FIL decode.obj,itab.obj,main.obj,syn-att.obj,syn-intel.obj,syn.obj,udis86.obj



================================================
FILE: dis/dism.mk
================================================
project : F:\TOOLS\ASM\full2\dis\dism.exe .SYMBOLIC

!include F:\TOOLS\ASM\full2\dis\dism.mk1


================================================
FILE: dis/dism.mk1
================================================
!define BLANK ""
F:\TOOLS\ASM\full2\dis\decode.obj : F:\TOOLS\ASM\full2\dis\decode.c .AUTODEP&
END
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc decode.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\itab.obj : F:\TOOLS\ASM\full2\dis\itab.c .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc itab.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\main.obj : F:\TOOLS\ASM\full2\dis\main.c .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc main.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn-att.obj : F:\TOOLS\ASM\full2\dis\syn-att.c .AUTOD&
EPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn-att.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn-intel.obj : F:\TOOLS\ASM\full2\dis\syn-intel.c .A&
UTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn-intel.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\syn.obj : F:\TOOLS\ASM\full2\dis\syn.c .AUTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc syn.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\udis86.obj : F:\TOOLS\ASM\full2\dis\udis86.c .AUTODEP&
END
 @F:
 cd F:\TOOLS\ASM\full2\dis
 *wcc udis86.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml

F:\TOOLS\ASM\full2\dis\dism.exe : F:\TOOLS\ASM\full2\dis\decode.obj F:\TOOLS&
\ASM\full2\dis\itab.obj F:\TOOLS\ASM\full2\dis\main.obj F:\TOOLS\ASM\full2\d&
is\syn-att.obj F:\TOOLS\ASM\full2\dis\syn-intel.obj F:\TOOLS\ASM\full2\dis\s&
yn.obj F:\TOOLS\ASM\full2\dis\udis86.obj F:\TOOLS\ASM\full2\dis\decode.h F:\&
TOOLS\ASM\full2\dis\extern.h F:\TOOLS\ASM\full2\dis\itab.h F:\TOOLS\ASM\full&
2\dis\syn.h F:\TOOLS\ASM\full2\dis\types.h F:\TOOLS\ASM\full2\dis\udint.h .A&
UTODEPEND
 @F:
 cd F:\TOOLS\ASM\full2\dis
 @%write dism.lk1 FIL decode.obj,itab.obj,main.obj,syn-att.obj,syn-intel.obj&
,syn.obj,udis86.obj
 @%append dism.lk1 
 *wlink name dism d all sys dos op m op maxe=25 op q op symf @dism.lk1



================================================
FILE: dis/dism.tgt
================================================
40
targetIdent
0
MProject
1
MComponent
0
2
WString
3
EXE
3
WString
5
de6en
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
8
dism.exe
7
WString
3
EXE
8
WVList
0
9
WVList
0
-1
1
1
0
10
WPickList
15
11
MItem
3
*.c
12
WString
4
COBJ
13
WVList
0
14
WVList
0
-1
1
1
0
15
MItem
8
decode.c
16
WString
4
COBJ
17
WVList
0
18
WVList
0
11
1
1
0
19
MItem
6
itab.c
20
WString
4
COBJ
21
WVList
0
22
WVList
0
11
1
1
0
23
MItem
6
main.c
24
WString
4
COBJ
25
WVList
0
26
WVList
0
11
1
1
0
27
MItem
9
syn-att.c
28
WString
4
COBJ
29
WVList
0
30
WVList
0
11
1
1
0
31
MItem
11
syn-intel.c
32
WString
4
COBJ
33
WVList
0
34
WVList
0
11
1
1
0
35
MItem
5
syn.c
36
WString
4
COBJ
37
WVList
0
38
WVList
0
11
1
1
0
39
MItem
8
udis86.c
40
WString
4
COBJ
41
WVList
0
42
WVList
0
11
1
1
0
43
MItem
3
*.h
44
WString
3
NIL
45
WVList
0
46
WVList
0
-1
1
1
0
47
MItem
8
decode.h
48
WString
3
NIL
49
WVList
0
50
WVList
0
43
1
1
0
51
MItem
8
extern.h
52
WString
3
NIL
53
WVList
0
54
WVList
0
43
1
1
0
55
MItem
6
itab.h
56
WString
3
NIL
57
WVList
0
58
WVList
0
43
1
1
0
59
MItem
5
syn.h
60
WString
3
NIL
61
WVList
0
62
WVList
0
43
1
1
0
63
MItem
7
types.h
64
WString
3
NIL
65
WVList
0
66
WVList
0
43
1
1
0
67
MItem
7
udint.h
68
WString
3
NIL
69
WVList
0
70
WVList
0
43
1
1
0


================================================
FILE: dis/dism.txt
================================================
cd F:\TOOLS\ASM\full2\dis
wmake -f F:\TOOLS\ASM\full2\dis\dism.mk -h -e
wcc main.c -i="G:\WATCOM/h" -w4 -e25 -zq -od -d2 -bt=dos -fo=.obj -ml
wlink name dism d all sys dos op m op maxe=25 op q op symf @dism.lk1
Execution complete


================================================
FILE: dis/dism.wpj
================================================
40
projectIdent
0
VpeMain
1
WRect
0
0
7680
9210
2
MProject
3
MCommand
0
4
MCommand
0
1
5
WFileName
8
dism.tgt
6
WVList
1
7
VComponent
8
WRect
0
0
5666
4280
0
0
9
WFileName
8
dism.tgt
0
3
7


================================================
FILE: dis/extern.h
================================================
/* udis86 - libudis86/extern.h
 *
 * Copyright (c) 2002-2009, 2013 Vivek Thampi
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 *     * Redistributions of source code must retain the above copyright notice, 
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright notice, 
 *       this list of conditions and the following disclaimer in the documentation 
 *       and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef UD_EXTERN_H
#define UD_EXTERN_H

#ifdef __cplusplus
extern "C" {
#endif

#include "types.h"

/* ============================= PUBLIC API ================================= */

extern void ud_init(struct ud*);

extern void ud_set_mode(struct ud*, uint8_t);

extern void ud_set_pc(struct ud*, uint64_t);

extern void ud_set_input_hook(struct ud*, int (*)(struct ud*));

extern void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);

#ifndef __UD_STANDALONE__
extern void ud_set_input_file(struct ud*, FILE*);
#endif /* __UD_STANDALONE__ */

extern void ud_set_vendor(struct ud*, unsigned);

extern void ud_set_syntax(struct ud*, void (*)(struct ud*));

extern void ud_input_skip(struct ud*, size_t);

extern int ud_input_end(const struct ud*);

extern unsigned int ud_decode(struct ud*);

extern unsigned int ud_disassemble(struct ud*);

extern void ud_translate_intel(struct ud*);

extern void ud_translate_att(struct ud*);

extern const char* ud_insn_asm(const struct ud* u);

extern const uint8_t* ud_insn_ptr(const struct ud* u);

extern uint64_t ud_insn_off(const struct ud*);

extern const char* ud_insn_hex(struct ud*);

extern unsigned int ud_insn_len(const struct ud* u);

extern const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n);

extern int ud_opr_is_sreg(const struct ud_operand *opr);

extern int ud_opr_is_gpr(const struct ud_operand *opr);

extern enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u);

extern const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);

extern void ud_set_user_opaque_data(struct ud*, void*);

extern void* ud_get_user_opaque_data(const struct ud*);

extern uint64_t ud_insn_sext_imm(const struct ud*, const struct ud_operand*);

extern void ud_set_asm_buffer(struct ud *u, char *buf, size_t size);

extern void ud_set_sym_resolver(struct ud *u, 
                                const char* (*resolver)(struct ud*, 
                                                        uint64_t addr,
                                                        int64_t *offset));

/* ========================================================================== */

#ifdef __cplusplus
}
#endif
#endif /* UD_EXTERN_H */


================================================
FILE: dis/itab.c
================================================
/* itab.c -- generated by udis86:scripts/ud_itab.py, do no edit */
#include "decode.h"

#define GROUP(n) (0x8000 | (n))


static const uint16_t ud_itab__1[] = {
  /*  0 */           7,           0,
};

static const uint16_t ud_itab__2[] = {
  /*  0 */           8,           0,
};

static const uint16_t ud_itab__3[] = {
  /*  0 */          15,           0,
};

static const uint16_t ud_itab__6[] = {
  /*  0 */          16,           0,           0,           0,
};

static const uint16_t ud_itab__7[] = {
  /*  0 */          17,           0,           0,           0,
};

static const uint16_t ud_itab__8[] = {
  /*  0 */          18,           0,           0,           0,
};

static const uint16_t ud_itab__9[] = {
  /*  0 */          19,           0,           0,           0,
};

static const uint16_t ud_itab__10[] = {
  /*  0 */          20,           0,           0,           0,
};

static const uint16_t ud_itab__11[] = {
  /*  0 */          21,           0,           0,           0,
};

static const uint16_t ud_itab__5[] = {
  /*  0 */    GROUP(6),    GROUP(7),    GROUP(8),    GROUP(9),
  /*  4 */   GROUP(10),   GROUP(11),           0,           0,
};

static const uint16_t ud_itab__15[] = {
  /*  0 */          22,           0,
};

static const uint16_t ud_itab__14[] = {
  /*  0 */   GROUP(15),           0,           0,           0,
};

static const uint16_t ud_itab__17[] = {
  /*  0 */          23,           0,
};

static const uint16_t ud_itab__16[] = {
  /*  0 */   GROUP(17),           0,           0,           0,
};

static const uint16_t ud_itab__19[] = {
  /*  0 */          24,           0,
};

static const uint16_t ud_itab__18[] = {
  /*  0 */   GROUP(19),           0,           0,           0,
};

static const uint16_t ud_itab__21[] = {
  /*  0 */          25,           0,
};

static const uint16_t ud_itab__20[] = {
  /*  0 */   GROUP(21),           0,           0,           0,
};

static const uint16_t ud_itab__23[] = {
  /*  0 */          26,           0,
};

static const uint16_t ud_itab__22[] = {
  /*  0 */   GROUP(23),           0,           0,           0,
};

static const uint16_t ud_itab__25[] = {
  /*  0 */          27,           0,
};

static const uint16_t ud_itab__24[] = {
  /*  0 */   GROUP(25),           0,           0,           0,
};

static const uint16_t ud_itab__27[] = {
  /*  0 */          28,           0,
};

static const uint16_t ud_itab__26[] = {
  /*  0 */   GROUP(27),           0,           0,           0,
};

static const uint16_t ud_itab__13[] = {
  /*  0 */   GROUP(14),   GROUP(16),   GROUP(18),   GROUP(20),
  /*  4 */   GROUP(22),           0,   GROUP(24),   GROUP(26),
};

static const uint16_t ud_itab__32[] = {
  /*  0 */           0,          29,           0,
};

static const uint16_t ud_itab__31[] = {
  /*  0 */           0,   GROUP(32),
};

static const uint16_t ud_itab__30[] = {
  /*  0 */   GROUP(31),           0,           0,           0,
};

static const uint16_t ud_itab__35[] = {
  /*  0 */           0,          30,           0,
};

static const uint16_t ud_itab__34[] = {
  /*  0 */           0,   GROUP(35),
};

static const uint16_t ud_itab__33[] = {
  /*  0 */   GROUP(34),           0,           0,           0,
};

static const uint16_t ud_itab__38[] = {
  /*  0 */           0,          31,           0,
};

static const uint16_t ud_itab__37[] = {
  /*  0 */           0,   GROUP(38),
};

static const uint16_t ud_itab__36[] = {
  /*  0 */   GROUP(37),           0,           0,           0,
};

static const uint16_t ud_itab__41[] = {
  /*  0 */           0,          32,           0,
};

static const uint16_t ud_itab__40[] = {
  /*  0 */           0,   GROUP(41),
};

static const uint16_t ud_itab__39[] = {
  /*  0 */   GROUP(40),           0,           0,           0,
};

static const uint16_t ud_itab__29[] = {
  /*  0 */           0,   GROUP(30),   GROUP(33),   GROUP(36),
  /*  4 */   GROUP(39),           0,           0,           0,
};

static const uint16_t ud_itab__44[] = {
  /*  0 */           0,          33,
};

static const uint16_t ud_itab__43[] = {
  /*  0 */   GROUP(44),           0,           0,           0,
};

static const uint16_t ud_itab__46[] = {
  /*  0 */           0,          34,
};

static const uint16_t ud_itab__45[] = {
  /*  0 */   GROUP(46),           0,           0,           0,
};

static const uint16_t ud_itab__42[] = {
  /*  0 */   GROUP(43),   GROUP(45),           0,           0,
  /*  4 */           0,           0,           0,           0,
};

static const uint16_t ud_itab__49[] = {
  /*  0 */           0,          35,
};

static const uint16_t ud_itab__48[] = {
  /*  0 */   GROUP(49),           0,           0,           0,
};

static const uint16_t ud_itab__51[] = {
  /*  0 */           0,          36,
};

static const uint16_t ud_itab__50[] = {
  /*  0 */   GROUP(51),           0,           0,           0,
};

static const uint16_t ud_itab__47[] = {
  /*  0 */   GROUP(48),   GROUP(50),           0,           0,
  /*  4 */           0,           0,           0,           0,
};

static const uint16_t ud_itab__55[] = {
  /*  0 */          37,           0,           0,
};

static const uint16_t ud_itab__54[] = {
  /*  0 */           0,   GROUP(55),
};

static const uint16_t ud_itab__53[] = {
  /*  0 */   GROUP(54),           0,           0,           0,
};

static const uint16_t ud_itab__58[] = {
  /*  0 */          38,           0,           0,
};

static const uint16_t ud_itab__57[] = {
  /*  0 */           0,   GROUP(58),
};

static const uint16_t ud_itab__56[] = {
  /*  0 */   GROUP(57),           0,           0,           0,
};

static const uint16_t ud_itab__61[] = {
  /*  0 */          39,           0,           0,
};

static const uint16_t ud_itab__60[] = {
  /*  0 */           0,   GROUP(61),
};

static const uint16_t ud_itab__59[] = {
  /*  0 */   GROUP(60),           0,           0,           0,
};

static const uint16_t ud_itab__64[] = {
  /*  0 */          40,           0,           0,
};

static const uint16_t ud_itab__63[] = {
  /*  0 */           0,   GROUP(64),
};

static const uint16_t ud_itab__62[] = {
  /*  0 */   GROUP(63),           0,           0,           0,
};

static const uint16_t ud_itab__67[] = {
  /*  0 */          41,           0,           0,
};

static const uint16_t ud_itab__66[] = {
  /*  0 */           0,   GROUP(67),
};

static const uint16_t ud_itab__65[] = {
  /*  0 */   GROUP(66),           0,           0,           0,
};

static const uint16_t ud_itab__70[] = {
  /*  0 */          42,           0,           0,
};

static const uint16_t ud_itab__69[] = {
  /*  0 */           0,   GROUP(70),
};

static const uint16_t ud_itab__68[] = {
  /*  0 */   GROUP(69),           0,           0,           0,
};

static const uint16_t ud_itab__73[] = {
  /*  0 */          43,           0,           0,
};

static const uint16_t ud_itab__72[] = {
  /*  0 */           0,   GROUP(73),
};

static const uint16_t ud_itab__71[] = {
  /*  0 */   GROUP(72),           0,           0,           0,
};

static const uint16_t ud_itab__76[] = {
  /*  0 */          44,           0,           0,
};

static const uint16_t ud_itab__75[] = {
  /*  0 */           0,   GROUP(76),
};

static const uint16_t ud_itab__74[] = {
  /*  0 */   GROUP(75),           0,           0,           0,
};

static const uint16_t ud_itab__52[] = {
  /*  0 */   GROUP(53),   GROUP(56),   GROUP(59),   GROUP(62),
  /*  4 */   GROUP(65),   GROUP(68),   GROUP(71),   GROUP(74),
};

static const uint16_t ud_itab__78[] = {
  /*  0 */           0,          45,
};

static const uint16_t ud_itab__77[] = {
  /*  0 */   GROUP(78),           0,           0,           0,
};

static const uint16_t ud_itab__80[] = {
  /*  0 */           0,          46,
};

static const uint16_t ud_itab__79[] = {
  /*  0 */   GROUP(80),           0,           0,           0,
};

static const uint16_t ud_itab__83[] = {
  /*  0 */           0,          47,
};

static const uint16_t ud_itab__82[] = {
  /*  0 */   GROUP(83),           0,           0,           0,
};

static const uint16_t ud_itab__86[] = {
  /*  0 */          48,           0,           0,
};

static const uint16_t ud_itab__85[] = {
  /*  0 */           0,   GROUP(86),
};

static const uint16_t ud_itab__84[] = {
  /*  0 */   GROUP(85),           0,           0,           0,
};

static const uint16_t ud_itab__81[] = {
  /*  0 */   GROUP(82),   GROUP(84),           0,           0,
  /*  4 */           0,           0,           0,           0,
};

static const uint16_t ud_itab__28[] = {
  /*  0 */   GROUP(29),   GROUP(42),   GROUP(47),   GROUP(52),
  /*  4 */   GROUP(77),           0,   GROUP(79),   GROUP(81),
};

static const uint16_t ud_itab__12[] = {
  /*  0 */   GROUP(13),   GROUP(28),
};

static const uint16_t ud_itab__87[] = {
  /*  0 */          49,           0,           0,           0,
};

static const uint16_t ud_itab__88[] = {
  /*  0 */          50,           0,           0,           0,
};

static const uint16_t ud_itab__89[] = {
  /*  0 */          51,           0,           0,           0,
};

static const uint16_t ud_itab__90[] = {
  /*  0 */          52,           0,           0,           0,
};

static const uint16_t ud_itab__91[] = {
  /*  0 */          53,           0,           0,           0,
};

static const uint16_t ud_itab__92[] = {
  /*  0 */          54,           0,           0,           0,
};

static const uint16_t ud_itab__93[] = {
  /*  0 */          55,           0,           0,           0,
};

static const uint16_t ud_itab__94[] = {
  /*  0 */          56,           0,           0,           0,
};

static const uint16_t ud_itab__96[] = {
  /*  0 */          57,           0,           0,           0,
};

static const uint16_t ud_itab__97[] = {
  /*  0 */          58,           0,           0,           0,
};

static const uint16_t ud_itab__98[] = {
  /*  0 */          59,           0,           0,           0,
};

static const uint16_t ud_itab__99[] = {
  /*  0 */          60,           0,           0,           0,
};

static const uint16_t ud_itab__100[] = {
  /*  0 */          61,           0,           0,           0,
};

static const uint16_t ud_itab__101[] = {
  /*  0 */          62,           0,           0,           0,
};

static const uint16_t ud_itab__102[] = {
  /*  0 */          63,           0,           0,           0,
};

static const uint16_t ud_itab__103[] = {
  /*  0 */          64,           0,           0,           0,
};

static const uint16_t ud_itab__95[] = {
  /*  0 */   GROUP(96),   GROUP(97),   GROUP(98),   GROUP(99),
  /*  4 */  GROUP(100),  GROUP(101),  GROUP(102),  GROUP(103),
};

static const uint16_t ud_itab__104[] = {
  /*  0 */          65,           0,           0,           0,
};

static const uint16_t ud_itab__105[] = {
  /*  0 */           0,           0,           0,           0,
  /*  4 */           0,           0,           0,           0,
  /*  8 */           0,           0,           0,           0,
  /*  c */          66,          67,           0,           0,
  /* 10 */           0,           0,           0,           0,
  /* 14 */           0,           0,           0,           0,
  /* 18 */           0,           0,           0,           0,
  /* 1c */          68,          69,           0,           0,
  /* 20 */           0,           0,           0,           0,
  /* 24 */           0,           0,           0,           0,
  /* 28 */           0,           0,           0,           0,
  /* 2c */           0,           0,           0,           0,
  /* 30 */           0,           0,           0,           0,
  /* 34 */           0,           0,           0,           0,
  /* 38 */           0,           0,           0,           0,
  /* 3c */           0,           0,           0,           0,
  /* 40 */           0,           0,           0,           0,
  /* 44 */           0,           0,           0,           0,
  /* 48 */           0,           0,           0,           0,
  /* 4c */           0,           0,           0,           0,
  /* 50 */           0,           0,           0,           0,
  /* 54 */           0,           0,           0,           0,
  /* 58 */           0,           0,           0,           0,
  /* 5c */           0,           0,           0,           0,
  /* 60 */           0,           0,           0,           0,
  /* 64 */           0,           0,           0,           0,
  /* 68 */           0,           0,           0,           0,
  /* 6c */           0,           0,           0,           0,
  /* 70 */           0,           0,           0,           0,
  /* 74 */           0,           0,           0,           0,
  /* 78 */           0,           0,           0,           0,
  /* 7c */           0,           0,           0,           0,
  /* 80 */           0,           0,           0,           0,
  /* 84 */           0,           0,           0,           0,
  /* 88 */           0,           0,          70,           0,
  /* 8c */           0,           0,          71,           0,
  /* 90 */          72,           0,           0,           0,
  /* 94 */          73,           0,          74,          75,
  /* 98 */           0,           0,          76,           0,
  /* 9c */           0,           0,          77,           0,
  /* a0 */          78,           0,           0,           0,
  /* a4 */          79,           0,          80,          81,
  /* a8 */           0,           0,          82,           0,
  /* ac */           0,           0,          83,           0,
  /* b0 */          84,           0,           0,           0,
  /* b4 */          85,           0,          86,          87,
  /* b8 */           0,           0,           0,          88,
  /* bc */           0,           0,           0,          89,
  /* c0 */           0,           0,           0,           0,
  /* c4 */           0,           0,           0,           0,
  /* c8 */           0,           0,           0,           0,
  /* cc */           0,           0,           0,           0,
  /* d0 */           0,           0,           0,           0,
  /* d4 */           0,           0,           0,           0,
  /* d8 */           0,           0,           0,           0,
  /* dc */           0,           0,           0,           0,
  /* e0 */           0,           0,           0,           0,
  /* e4 */           0,           0,           0,           0,
  /* e8 */           0,           0,           0,           0,
  /* ec */           0,           0,           0,           0,
  /* f0 */           0,           0,           0,           0,
  /* f4 */           0,           0,           0,           0,
  /* f8 */           0,           0,           0,           0,
  /* fc */           0,           0,           0,           0,
};

static const uint16_t ud_itab__106[] = {
  /*  0 */          90,          91,          92,          93,
};

static const uint16_t ud_itab__107[] = {
  /*  0 */          94,          95,          96,          97,
};

static const uint16_t ud_itab__110[] = {
  /*  0 */          98,           0,
};

static const uint16_t ud_itab__111[] = {
  /*  0 */          99,           0,
};

static const uint16_t ud_itab__112[] = {
  /*  0 */         100,           0,
};

static const uint16_t ud_itab__113[] = {
  /*  0 */         101,           0,
};

static const uint16_t ud_itab__109[] = {
  /*  0 */  GROUP(110),  GROUP(111),  GROUP(112),  GROUP(113),
};

static const uint16_t ud_itab__115[] = {
  /*  0 */           0,         102,
};

static const uint16_t ud_itab__116[] = {
  /*  0 */           0,         103,
};

static const uint16_t ud_itab__117[] = {
  /*  0 */           0,         104,
};

static const uint16_t ud_itab__114[] = {
  /*  0 */  GROUP(115),  GROUP(116),  GROUP(117),           0,
};

static const uint16_t ud_itab__108[] = {
  /*  0 */  GROUP(109),  GROUP(114),
};

static const uint16_t ud_itab__118[] = {
  /*  0 */         105,           0,           0,         106,
};

static const uint16_t ud_itab__119[] = {
  /*  0 */         107,           0,           0,         108,
};

static const uint16_t ud_itab__120[] = {
  /*  0 */         109,           0,           0,         110,
};

static const uint16_t ud_itab__123[] = {
  /*  0 */         111,           0,
};

static const uint16_t ud_itab__124[] = {
  /*  0 */         112,           0,
};

static const uint16_t ud_itab__125[] = {
  /*  0 */         113,           0,
};

static const uint16_t ud_itab__122[] = {
  /*  0 */  GROUP(123),           0,  GROUP(124),  GROUP(125),
};

static const uint16_t ud_itab__127[] = {
  /*  0 */           0,         114,
};

static const uint16_t ud_itab__128[] = {
  /*  0 */           0,         115,
};

static const uint16_t ud_itab__126[] = {
  /*  0 */  GROUP(127),           0,  GROUP(128),           0,
};

static const uint16_t ud_itab__121[] = {
  /*  0 */  GROUP(122),  GROUP(126),
};

static const uint16_t ud_itab__129[] = {
  /*  0 */         116,           0,           0,         117,
};

static const uint16_t ud_itab__131[] = {
  /*  0 */         118,           0,           0,           0,
};

static const uint16_t ud_itab__132[] = {
  /*  0 */         119,           0,           0,           0,
};

static const uint16_t ud_itab__133[] = {
  /*  0 */         120,           0,           0,           0,
};

static const uint16_t ud_itab__134[] = {
  /*  0 */         121,           0,           0,           0,
};

static const uint16_t ud_itab__130[] = {
  /*  0 */  GROUP(131),  GROUP(132),  GROUP(133),  GROUP(134),
  /*  4 */           0,           0,           0,           0,
};

static const uint16_t ud_itab__135[] = {
  /*  0 */         122,           0,           0,           0,
};

static const uint16_t ud_itab__136[] = {
  /*  0 */         123,           0,           0,           0,
};

static const uint16_t ud_itab__137[] = {
  /*  0 */         124,           0,           0,           0,
};

static const uint16_t ud_itab__138[] = {
  /*  0 */         125,           0,           0,           0,
};

static const uint16_t ud_itab__139[] = {
  /*  0 */         126,           0,           0,           0,
};

static const uint16_t ud_itab__140[] = {
  /*  0 */         127,           0,           0,           0,
};

static const uint16_t ud_itab__141[] = {
  /*  0 */         128,           0,           0,           0,
};

static const uint16_t ud_itab__142[] = {
  /*  0 */         129,           0,           0,           0,
};

static const uint16_t ud_itab__143[] = {
  /*  0 */         130,           0,           0,           0,
};

static const uint16_t ud_itab__144[] = {
  /*  0 */         131,           0,           0,           0,
};

static const uint16_t ud_itab__145[] = {
  /*  0 */         132,           0,           0,           0,
};

static const uint16_t ud_itab__146[] = {
  /*  0 */         133,           0,           0,         134,
};

static const uint16_t ud_itab__147[] = {
  /*  0 */         135,           0,           0,         136,
};

static const uint16_t ud_itab__148[] = {
  /*  0 */         137,         138,         139,         140,
};

static const uint16_t ud_itab__149[] = {
  /*  0 */         141,           0,           0,         142,
};

static const uint16_t ud_itab__150[] = {
  /*  0 */         143,         144,         145,         146,
};

static const uint16_t ud_itab__151[] = {
  /*  0 */         147,         148,         149,         150,
};

static const uint16_t ud_itab__152[] = {
  /*  0 */         151,           0,           0,         152,
};

static const uint16_t ud_itab__153[] = {
  /*  0 */         153,           0,           0,         154,
};

static const uint16_t ud_itab__154[] = {
  /*  0 */         155,           0,           0,           0,
};

static const uint16_t ud_itab__155[] = {
  /*  0 */         156,           0,           0,           0,
};

static const uint16_t ud_itab__156[] = {
  /*  0 */         157,           0,           0,           0,
};

static const uint16_t ud_itab__157[] = {
  /*  0 */         158,           0,           0,           0,
};

static const uint16_t ud_itab__160[] = {
  /*  0 */           0,         160,           0,
};

static const uint16_t ud_itab__159[] = {
  /*  0 */         159,  GROUP(160),
};

static const uint16_t ud_itab__158[] = {
  /*  0 */  GROUP(159),           0,           0,           0,
};

static const uint16_t ud_itab__163[] = {
  /*  0 */           0,         162,           0,
};

static const uint16_t ud_itab__162[] = {
  /*  0 */         161,  GROUP(163),
};

static const uint16_t ud_itab__161[] = {
  /*  0 */  GROUP(162),           0,           0,           0,
};

static const uint16_t ud_itab__164[] = {
  /*  0 */         163,           0,           0,           0,
};

static const uint16_t ud_itab__166[] = {
  /*  0 */         164,           0,           0,         165,
};

static const uint16_t ud_itab__167[] = {
  /*  0 */         166,           0,           0,         167,
};

static const uint16_t ud_itab__168[] = {
  /*  0 */         168,           0,           0,         169,
};

static const uint16_t ud_itab__169[] = {
  /*  0 */         170,           0,           0,         171,
};

static const uint16_t ud_itab__170[] = {
  /*  0 */         172,           0,           0,         173,
};

static const uint16_t ud_itab__171[] = {
  /*  0 */         174,           0,           0,         175,
};

static const uint16_t ud_itab__172[] = {
  /*  0 */         176,           0,           0,         177,
};

static const uint16_t ud_itab__173[] = {
  /*  0 */         178,           0,           0,         179,
};

static const uint16_t ud_itab__174[] = {
  /*  0 */         180,           0,           0,         181,
};

static const uint16_t ud_itab__175[] = {
  /*  0 */         182,           0,           0,         183,
};

static const uint16_t ud_itab__176[] = {
  /*  0 */         184,           0,           0,         185,
};

static const uint16_t ud_itab__177[] = {
  /*  0 */         186,           0,           0,         187,
};

static const uint16_t ud_itab__178[] = {
  /*  0 */           0,           0,           0,         188,
};

static const uint16_t ud_itab__179[] = {
  /*  0 */           0,           0,           0,         189,
};

static const uint16_t ud_itab__180[] = {
  /*  0 */           0,           0,           0,         190,
};

static const uint16_t ud_itab__181[] = {
  /*  0 */           0,           0,           0,         191,
};

static const uint16_t ud_itab__182[] = {
  /*  0 */         192,           0,           0,         193,
};

static const uint16_t ud_itab__183[] = {
  /*  0 */         194,           0,           0,         195,
};

static const uint16_t ud_itab__184[] = {
  /*  0 */         196,           0,           0,         197,
};

static const uint16_t ud_itab__185[] = {
  /*  0 */           0,           0,           0,         198,
};

static const uint16_t ud_itab__186[] = {
  /*  0 */           0,           0,           0,         199,
};

static const uint16_t ud_itab__187[] = {
  /*  0 */           0,           0,           0,         200,
};

static const uint16_t ud_itab__188[] = {
  /*  0 */           0,           0,           0,         201,
};

static const uint16_t ud_itab__189[] = {
  /*  0 */           0,           0,           0,         202,
};

static const uint16_t ud_itab__190[] = {
  /*  0 */           0,           0,           0,         203,
};

static const uint16_t ud_itab__191[] = {
  /*  0 */           0,           0,           0,         204,
};

static const uint16_t ud_itab__192[] = {
  /*  0 */           0,           0,           0,         205,
};

static const uint16_t ud_itab__193[] = {
  /*  0 */           0,           0,           0,         206,
};

static const uint16_t ud_itab__194[] = {
  /*  0 */           0,           0,           0,         207,
};

static const uint16_t ud_itab__195[] = {
  /*  0 */           0,           0,           0,         208,
};

static const uint16_t ud_itab__196[] = {
  /*  0 */           0,           0,           0,         209,
};

static const uint16_t ud_itab__197[] = {
  /*  0 */           0,           0,           0,         210,
};

static const uint16_t ud_itab__198[] = {
  /*  0 */           0,           0,           0,         211,
};

static const uint16_t ud_itab__199[] = {
  /*  0 */           0,           0,           0,         212,
};

static const uint16_t ud_itab__200[] = {
  /*  0 */           0,           0,           0,         213,
};

static const uint16_t ud_itab__201[] = {
  /*  0 */           0,           0,           0,         214,
};

static const uint16_t ud_itab__202[] = {
  /*  0 */           0,           0,           0,         215,
};

static const uint16_t ud_itab__203[] = {
  /*  0 */           0,           0,           0,         216,
};

static const uint16_t ud_itab__204[] = {
  /*  0 */           0,           0,           0,         217,
};

static const uint16_t ud_itab__205[] = {
  /*  0 */           0,           0,           0,         218,
};

static const uint16_t ud_itab__206[] = {
  /*  0 */           0,           0,           0,         219,
};

static const uint16_t ud_itab__207[] = {
  /*  0 */           0,           0,           0,         220,
};

static const uint16_t ud_itab__208[] = {
  /*  0 */           0,           0,           0,         221,
};

static const uint16_t ud_itab__209[] = {
  /*  0 */           0,           0,           0,         222,
};

static const uint16_t ud_itab__210[] = {
  /*  0 */           0,           0,           0,         223,
};

static const uint16_t ud_itab__211[] = {
  /*  0 */           0,           0,           0,         224,
};

static const uint16_t ud_itab__214[] = {
  /*  0 */           0,         225,           0,
};

static const uint16_t ud_itab__213[] = {
  /*  0 */           0,  GROUP(214),
};

static const uint16_t ud_itab__212[] = {
  /*  0 */           0,           0,           0,  GROUP(213),
};

static const uint16_t ud_itab__217[] = {
  /*  0 */           0,         226,           0,
};

static const uint16_t ud_itab__216[] = {
  /*  0 */           0,  GROUP(217),
};

static const uint16_t ud_itab__215[] = {
  /*  0 */           0,           0,           0,  GROUP(216),
};

static const uint16_t ud_itab__218[] = {
  /*  0 */           0,           0,           0,         227,
};

static const uint16_t ud_itab__219[] = {
  /*  0 */           0,           0,           0,         228,
};

static const uint16_t ud_itab__220[] = {
  /*  0 */           0,           0,           0,         229,
};

static const uint16_t ud_itab__221[] = {
  /*  0 */           0,           0,           0,         230,
};

static const uint16_t ud_itab__222[] = {
  /*  0 */           0,           0,           0,         231,
};

static const uint16_t ud_itab__223[] = {
  /*  0 */         232,         233,           0,           0,
};

static const uint16_t ud_itab__224[] = {
  /*  0 */         234,         235,           0,           0,
};

static const uint16_t ud_itab__165[] = {
  /*  0 */  GROUP(166),  GROUP(167),  GROUP(168),  GROUP(169),
  /*  4 */  GROUP(170),  GROUP(171),  GROUP(172),  GROUP(173),
  /*  8 */  GROUP(174),  GROUP(175),  GROUP(176),  GROUP(177),
  /*  c */           0,           0,           0,           0,
  /* 10 */  GROUP(178),           0,           0,           0,
  /* 14 */  GROUP(179),  GROUP(180),           0,  GROUP(181),
  /* 18 */           0,           0,           0,           0,
  /* 1c */  GROUP(182),  GROUP(183),  GROUP(184),           0,
  /* 20 */  GROUP(185),  GROUP(186),  GROUP(187),  GROUP(188),
  /* 24 */  GROUP(189),  GROUP(190),           0,           0,
  /* 28 */  GROUP(191),  GROUP(192),  GROUP(193),  GROUP(194),
  /* 2c */           0,           0,           0,           0,
  /* 30 */  GROUP(195),  GROUP(196),  GROUP(197),  GROUP(198),
  /* 34 */  GROUP(199),  GROUP(200),           0,  GROUP(201),
  /* 38 */  GROUP(202),  GROUP(203),  GROUP(204),  GROUP(205),
  /* 3c */  GROUP(206),  GROUP(207),  GROUP(208),  GROUP(209),
  /* 40 */  GROUP(210),  GROUP(211),           0,           0,
  /* 44 */           0,           0,           0,           0,
  /* 48 */           0,           0,           0,           0,
  /* 4c */           0,           0,           0,           0,
  /* 50 */           0,           0,           0,           0,
  /* 54 */           0,           0,           0,           0,
  /* 58 */           0,           0,           0,           0,
  /* 5c */           0,           0,           0,           0,
  /* 60 */           0,           0,           0,           0,
  /* 64 */           0,           0,           0,           0,
  /* 68 */           0,           0,           0,           0,
  /* 6c */           0,           0,           0,           0,
  /* 70 */           0,           0,           0,           0,
  /* 74 */           0,           0,           0,           0,
  /* 78 */           0,           0,           0,           0,
  /* 7c */           0,           0,           0,           0,
  /* 80 */  GROUP(212),  GROUP(215),           0,           0,
  /* 84 */           0,           0,           0,           0,
  /* 88 */           0,           0,           0,           0,
  /* 8c */           0,           0,           0,           0,
  /* 90 */           0,           0,           0,           0,
  /* 94 */           0,           0,           0,           0,
  /* 98 */           0,           0,           0,           0,
  /* 9c */           0,           0,           0,           0,
  /* a0 */           0,           0,           0,           0,
  /* a4 */           0,           0,           0,           0,
  /* a8 */           0,           0,           0,           0,
  /* ac */           0,           0,           0,           0,
  /* b0 */           0,           0,           0,           0,
  /* b4 */           0,           0,           0,           0,
  /* b8 */           0,           0,           0,           0,
  /* bc */           0,           0,           0,           0,
  /* c0 */           0,           0,           0,           0,
  /* c4 */           0,           0,           0,           0,
  /* c8 */           0,           0,           0,           0,
  /* cc */           0,           0,           0,           0,
  /* d0 */           0,           0,           0,           0,
  /* d4 */           0,           0,           0,           0,
  /* d8 */           0,           0,           0,  GROUP(218),
  /* dc */  GROUP(219),  GROUP(220),  GROUP(221),  GROUP(222),
  /* e0 */           0,           0,           0,           0,
  /* e4 */           0,           0,           0,           0,
  /* e8 */           0,           0,           0,           0,
  /* ec */           0,           0,           0,           0,
  /* f0 */  GROUP(223),  GROUP(224),           0,           0,
  /* f4 */           0,           0,           0,           0,
  /* f8 */           0,           0,           0,           0,
  /* fc */           0,           0,           0,           0,
};

static const uint16_t ud_itab__226[] = {
  /*  0 */           0,           0,           0,         236,
};

static const uint16_t ud_itab__227[] = {
  /*  0 */           0,           0,           0,         237,
};

static const uint16_t ud_itab__228[] = {
  /*  0 */           0,           0,           0,         238,
};

static const uint16_t ud_itab__229[] = {
  /*  0 */           0,           0,           0,         239,
};

static const uint16_t ud_itab__230[] = {
  /*  0 */           0,           0,           0,         240,
};

static const uint16_t ud_itab__231[] = {
  /*  0 */           0,           0,           0,         241,
};

static const uint16_t ud_itab__232[] = {
  /*  0 */           0,           0,           0,         242,
};

static const uint16_t ud_itab__233[] = {
  /*  0 */         243,           0,           0,         244,
};

static const uint16_t ud_itab__234[] = {
  /*  0 */           0,           0,           0,         245,
};

static const uint16_t ud_itab__235[] = {
  /*  0 */           0,           0,           0,         246,
};

static const uint16_t ud_itab__237[] = {
  /*  0 */         247,         248,         249,
};

static const uint16_t ud_itab__236[] = {
  /*  0 */           0,           0,           0,  GROUP(237),
};

static const uint16_t ud_itab__238[] = {
  /*  0 */           0,           0,           0,         250,
};

static const uint16_t ud_itab__239[] = {
  /*  0 */           0,           0,           0,         251,
};

static const uint16_t ud_itab__240[] = {
  /*  0 */           0,           0,           0,         252,
};

static const uint16_t ud_itab__242[] = {
  /*  0 */         253,         254,         255,
};

static const uint16_t ud_itab__241[] = {
  /*  0 */           0,           0,           0,  GROUP(242),
};

static const uint16_t ud_itab__243[] = {
  /*  0 */           0,           0,           0,         256,
};

static const uint16_t ud_itab__244[] = {
  /*  0 */           0,           0,           0,         257,
};

static const uint16_t ud_itab__245[] = {
  /*  0 */           0,           0,           0,         258,
};

static const uint16_t ud_itab__246[] = {
  /*  0 */           0,           0,           0,         259,
};

static const uint16_t ud_itab__247[] = {
  /*  0 */           0,           0,           0,         260,
};

static const uint16_t ud_itab__248[] = {
  /*  0 */           0,           0,           0,         261,
};

static const uint16_t ud_itab__249[] = {
  /*  0 */           0,           0,           0,         262,
};

static const uint16_t ud_itab__250[] = {
  /*  0 */           0,           0,           0,         263,
};

static const uint16_t ud_itab__251[] = {
  /*  0 */           0,           0,           0,         264,
};

static const uint16_t ud_itab__225[] = {
  /*  0 */           0,           0,           0,           0,
  /*  4 */           0,           0,           0,           0,
  /*  8 */  GROUP(226),  GROUP(227),  GROUP(228),  GROUP(229),
  /*  c */  GROUP(230),  GROUP(231),  GROUP(232),  GROUP(233),
  /* 10 */           0,           0,           0,           0,
  /* 14 */  GROUP(234),  GROUP(235),  GROUP(236),  GROUP(238),
  /* 18 */           0,           0,           0,           0,
  /* 1c */           0,           0,           0,           0,
  /* 20 */  GROUP(239),  GROUP(240),  GROUP(241),           0,
  /* 24 */           0,           0,           0,           0,
  /* 28 */           0,           0,           0,           0,
  /* 2c */           0,           0,           0,           0,
  /* 30 */           0,           0,           0,           0,
  /* 34 */           0,           0,           0,           0,
  /* 38 */           0,           0,           0,           0,
  /* 3c */           0,           0,           0,           0,
  /* 40 */  GROUP(243),  GROUP(244),  GROUP(245),           0,
  /* 44 */  GROUP(246),           0,           0,           0,
  /* 48 */           0,           0,           0,           0,
  /* 4c */           0,           0,           0,           0,
  /* 50 */           0,           0,           0,           0,
  /* 54 */           0,           0,           0,           0,
  /* 58 */           0,           0,           0,           0,
  /* 5c */           0,           0,           0,           0,
  /* 60 */  GROUP(247),  GROUP(248),  GROUP(249),  GROUP(250),
  /* 64 */           0,           0,           0,           0,
  /* 68 */           0,           0,           0,           0,
  /* 6c */           0,           0,           0,           0,
  /* 70 */           0,           0,           0,           0,
  /* 74 */           0,           0,           0,           0,
  /* 78 */           0,           0,           0,           0,
  /* 7c */           0,           0,           0,           0,
  /* 80 */           0,           0,           0,           0,
  /* 84 */           0,           0,           0,           0,
  /* 88 */           0,           0,           0,           0,
  /* 8c */           0,           0,           0,           0,
  /* 90 */           0,           0,           0,           0,
  /* 94 */           0,           0,           0,           0,
  /* 98 */           0,           0,           0,           0,
  /* 9c */           0,           0,           0,           0,
  /* a0 */           0,           0,           0,           0,
  /* a4 */           0,           0,           0,           0,
  /* a8 */           0,           0,           0,           0,
  /* ac */           0,           0,           0,           0,
  /* b0 */           0,           0,           0,           0,
  /* b4 */           0,           0,           0,           0,
  /* b8 */           0,           0,           0,           0,
  /* bc */           0,           0,           0,           0,
  /* c0 */           0,           0,           0,           0,
  /* c4 */           0,           0,           0,           0,
  /* c8 */           0,           0,           0,           0,
  /* cc */           0,           0,           0,           0,
  /* d0 */           0,           0,           0,           0,
  /* d4 */           0,           0,           0,           0,
  /* d8 */           0,           0,           0,           0,
  /* dc */           0,           0,           0,  GROUP(251),
  /* e0 */           0,           0,           0,           0,
  /* e4 */           0,           0,           0,           0,
  /* e8 */           0,           0,           0,           0,
  /* ec */           0,           0,           0,           0,
  /* f0 */           0,           0,           0,           0,
  /* f4 */           0,           0,           0,           0,
  /* f8 */           0,           0,           0,           0,
  /* fc */           0,           0,           0,           0,
};

static const uint16_t ud_itab__252[] = {
  /*  0 */         265,           0,           0,           0,
};

static const uint16_t ud_itab__253[] = {
  /*  0 */         266,           0,           0,           0,
};

static const uint16_t ud_itab__254[] = {
  /*  0 */         267,           0,           0,           0,
};

static const uint16_t ud_itab__255[] = {
  /*  0 */         268,           0,           0,           0,
};

static const uint16_t ud_itab__256[] = {
  /*  0 */         269,           0,           0,           0,
};

static const uint16_t ud_itab__257[] = {
  /*  0 */         270,           0,           0,           0,
};

static const uint16_t ud_itab__258[] = {
  /*  0 */         271,           0,           0,           0,
};

static const uint16_t ud_itab__259[] = {
  /*  0 */         272,           0,           0,           0,
};

static const uint16_t ud_itab__260[] = {
  /*  0 */         273,           0,           0,           0,
};

static const uint16_t ud_itab__261[] = {
  /*  0 */         274,           0,           0,           0,
};

static const uint16_t ud_itab__262[] = {
  /*  0 */         275,           0,           0,           0,
};

static const uint16_t ud_itab__263[] = {
  /*  0 */         276,           0,           0,           0,
};

static const uint16_t ud_itab__264[] = {
  /*  0 */         277,           0,           0,           0,
};

static const uint16_t ud_itab__265[] = {
  /*  0 */         278,           0,           0,           0,
};

static const uint16_t ud_itab__266[] = {
  /*  0 */         279,           0,           0,           0,
};

static const uint16_t ud_itab__267[] = {
  /*  0 */         280,           0,           0,           0,
};

static const uint16_t ud_itab__268[] = {
  /*  0 */         281,           0,           0,         282,
};

static const uint16_t ud_itab__269[] = {
  /*  0 */         283,         284,         285,         286,
};

static const uint16_t ud_itab__270[] = {
  /*  0 */         287,           0,         288,           0,
};

static const uint16_t ud_itab__271[] = {
  /*  0 */         289,           0,         290,           0,
};

static const uint16_t ud_itab__272[] = {
  /*  0 */         291,           0,           0,         292,
};

static const uint16_t ud_itab__273[] = {
  /*  0 */         293,           0,           0,         294,
};

static const uint16_t ud_itab__274[] = {
  /*  0 */         295,           0,           0,         296,
};

static const uint16_t ud_itab__275[] = {
  /*  0 */         297,           0,           0,         298,
};

static const uint16_t ud_itab__276[] = {
  /*  0 */         299,         300,         301,         302,
};

static const uint16_t ud_itab__277[] = {
  /*  0 */         303,         304,         305,         306,
};

static const uint16_t ud_itab__278[] = {
  /*  0 */         307,         308,         309,         310,
};

static const uint16_t ud_itab__279[] = {
  /*  0 */         311,           0,         312,         313,
};

static const uint16_t ud_itab__280[] = {
  /*  0 */         314,         315,         316,         317,
};

static const uint16_t ud_itab__281[] = {
  /*  0 */         318,         319,         320,         321,
};

static const uint16_t ud_itab__282[] = {
  /*  0 */         322,         323,         324,         325,
};

static const uint16_t ud_itab__283[] = {
  /*  0 */         326,         327,         328,         329,
};

static const uint16_t ud_itab__284[] = {
  /*  0 */         330,           0,           0,         331,
};

static const uint16_t ud_itab__285[] = {
  /*  0 */         332,           0,           0,         333,
};

static const uint16_t ud_itab__286[] = {
  /*  0 */         334,           0,           0,         335,
};

static const uint16_t ud_itab__287[] = {
  /*  0 */         336,           0,           0,         337,
};

static const uint16_t ud_itab__288[] = {
  /*  0 */         338,           0,           0,         339,
};

static const uint16_t ud_itab__289[] = {
  /*  0 */         340,           0,           0,         341,
};

static const uint16_t ud_itab__290[] = {
  /*  0 */         342,           0,           0,         343,
};

static const uint16_t ud_itab__291[] = {
  /*  0 */         344,           0,           0,         345,
};

static const uint16_t ud_itab__292[] = {
  /*  0 */         346,           0,           0,         347,
};

static const uint16_t ud_itab__293[] = {
  /*  0 */         348,           0,           0,         349,
};

static const uint16_t ud_itab__294[] = {
  /*  0 */         350,           0,           0,         351,
};

static const uint16_t ud_itab__295[] = {
  /*  0 */         352,           0,           0,         353,
};

static const uint16_t ud_itab__296[] = {
  /*  0 */           0,           0,           0,         354,
};

static const uint16_t ud_itab__297[] = {
  /*  0 */           0,           0,           0,         355,
};

static const uint16_t ud_itab__298[] = {
  /*  0 */         356,           0,           0,         357,
};

static const uint16_t ud_itab__299[] = {
  /*  0 */         358,           0,         359,         360,
};

static const uint16_t ud_itab__300[] = {
  /*  0 */         361,         362,         363,         364,
};

static const uint16_t ud_itab__302[] = {
  /*  0 */         365,           0,           0,         366,
};

static const uint16_t ud_itab__303[] = {
  /*  0 */         367,           0,           0,         368,
};

static const uint16_t ud_itab__304[] = {
  /*  0 */         369,           0,           0,         370,
};

static const uint16_t ud_itab__301[] = {
  /*  0 */           0,           0,  GROUP(302),           0,
  /*  4 */  GROUP(303),           0,  GROUP(304),           0,
};

static const uint16_t ud_itab__306[] = {
  /*  0 */         371,           0,           0,         372,
};

static const uint16_t ud_itab__307[] = {
  /*  0 */         373,           0,           0,         374,
};

static const uint16_t ud_itab__308[] = {
  /*  0 */         375,           0,           0,         376,
};

static const uint16_t ud_itab__305[] = {
  /*  0 */           0,           0,  GROUP(306),           0,
  /*  4 */  GROUP(307),           0,  GROUP(308),           0,
};

static const uint16_t ud_itab__310[] = {
  /*  0 */         377,           0,           0,         378,
};

static const uint16_t ud_itab__311[] = {
  /*  0 */           0,           0,           0,         379,
};

static const uint16_t ud_itab__312[] = {
  /*  0 */         380,           0,           0,         381,
};

static const uint16_t ud_itab__313[] = {
  /*  0 */           0,           0,           0,         382,
};

static const uint16_t ud_itab__309[] = {
  /*  0 */           0,           0,  GROUP(310),  GROUP(311),
  /*  4 */           0,           0,  GROUP(312),  GROUP(313),
};

static const uint16_t ud_itab__314[] = {
  /*  0 */         383,           0,           0,         384,
};

static const uint16_t ud_itab__315[] = {
  /*  0 */         385,           0,           0,         386,
};

static const uint16_t ud_itab__316[] = {
  /*  0 */         387,           0,           0,         388,
};

static const uint16_t ud_itab__317[] = {
  /*  0 */         389,           0,           0,           0,
};

static const uint16_t ud_itab__319[] = {
  /*  0 */           0,         390,           0,
};

static const uint16_t ud_itab__318[] = {
  /*  0 */  GROUP(319),           0,           0,           0,
};

static const uint16_t ud_itab__321[] = {
  /*  0 */           0,         391,           0,
};

static const uint16_t ud_itab__320[] = {
  /*  0 */  GROUP(321),           0,           0,           0,
};

static const uint16_t ud_itab__322[] = {
  /*  0 */           0,         392,           0,         393,
};

static const uint16_t ud_itab__323[] = {
  /*  0 */           0,         394,           0,         395,
};

static const uint16_t ud_itab__324[] = {
  /*  0 */         396,           0,         397,         398,
};

static const uint16_t ud_itab__325[] = {
  /*  0 */         399,           0,         400,         401,
};

static const uint16_t ud_itab__326[] = {
  /*  0 */         402,           0,           0,           0,
};

static const uint16_t ud_itab__327[] = {
  /*  0 */         403,           0,           0,           0,
};

static const uint16_t ud_itab__328[] = {
  /*  0 */         404,           0,           0,           0,
};

static const uint16_t ud_itab__329[] = {
  /*  0 */         405,           0,           0,           0,
};

static const uint16_t ud_itab__330[] = {
  /*  0 */         406,           0,           0,           0,
};

static const uint16_t ud_itab__331[] = {
  /*  0 */         407,           0,           0,           0,
};

static const uint16_t ud_itab__332[] = {
  /*  0 */         408,           0,           0,           0,
};

static const uint16_t ud_itab__333[] = {
  /*  0 */         409,           0,           0,           0,
};

static const uint16_t ud_itab__334[] = {
  /*  0 */         410,           0,           0,           0,
};

static const uint16_t ud_itab__335[] = {
  /*  0 */         411,           0,           0,           0,
};

static const uint16_t ud_itab__336[] = {
  /*  0 */         412,           0,           0,           0,
};

static const uint16_t ud_itab__337[] = {
  /*  0 */         413,           0,           0,           0,
};

static const uint16_t ud_itab__338[] = {
  /*  0 */         414,           0,           0,           0,
};

static const uint16_t ud_itab__339[] = {
  /*  0 */         415,           0,           0,           0,
};

static const uint16_t ud_itab__340[] = {
  /*  0 */         416,           0,           0,           0,
};

static const uint16_t ud_itab__341[] = {
  /*  0 */         417,           0,           0,           0,
};

static const uint16_t ud_itab__342[] = {
  /*  0 */         418,           0,           0,           0,
};

static const uint16_t ud_itab__343[] = {
  /*  0 */         419,           0,           0,           0,
};

static const uint16_t ud_itab__344[] = {
  /*  0 */         420,           0,           0,           0,
};

static const uint16_t ud_itab__345[] = {
  /*  0 */         421,           0,           0,           0,
};

static const uint16_t ud_itab__346[] = {
  /*  0 */         422,           0,           0,           0,
};

static const uint16_t ud_itab__347[] = {
  /*  0 */         423,           0,           0,           0,
};

static const uint16_t ud_itab__348[] = {
  /*  0 */         424,           0,           0,           0,
};

static const uint16_t ud_itab__349[] = {
  /*  0 */         425,           0,           0,           0,
};

static const uint16_t ud_itab__350[] = {
  /*  0 */         426,           0,           0,           0,
};

static const uint16_t ud_itab__351[] = {
  /*  0 */         427,           0,           0,           0,
};

static const uint16_t ud_itab__352[] = {
  /*  0 */         428,           0,           0,           0,
};

static const uint16_t ud_itab__353[] = {
  /*  0 */         429,           0,           0,           0,
};

static const uint16_t ud_itab__354[] = {
  /*  0 */         430,           0,           0,           0,
};

static const uint16_t ud_itab__355[] = {
  /*  0 */         431,           0,           0,           0,
};

static const uint16_t ud_itab__356[] = {
  /*  0 */         432,           0,           0,           0,
};

static const uint16_t ud_itab__357[] = {
  /*  0 */         433,           0,           0,           0,
};

static const uint16_t ud_itab__358[] = {
  /*  0 */         434,           0,           0,           0,
};

static const uint16_t ud_itab__359[] = {
  /*  0 */         435,           0,           0,           0,
};

static const uint16_t ud_itab__360[] = {
  /*  0 */         436,           0,           0,           0,
};

static const uint16_t ud_itab_
Download .txt
gitextract_9e9nie88/

├── .gitattributes
├── .gitignore
├── .gitmodules
├── Readme.md
├── a.img
├── a20.asm
├── acpi16.asm
├── acpi32.asm
├── acpi64.asm
├── asm.sln
├── asm.vcxproj
├── asm.vcxproj.filters
├── asmtest.vbox
├── asmtest.vbox-prev
├── bochsrc.bxrc
├── build.bat
├── bx_enh_dbg.ini
├── code16.asm
├── code32.asm
├── code64.asm
├── config.asm
├── data16.asm
├── data32.asm
├── data64.asm
├── debuggee.asm
├── directlong.asm
├── dis/
│   ├── Makefile.am
│   ├── Makefile.in
│   ├── d.lb1
│   ├── d.lib
│   ├── d.mk
│   ├── d.mk1
│   ├── d.tgt
│   ├── d.wpj
│   ├── decode.c
│   ├── decode.h
│   ├── dism.lk1
│   ├── dism.mk
│   ├── dism.mk1
│   ├── dism.sym
│   ├── dism.tgt
│   ├── dism.txt
│   ├── dism.wpj
│   ├── extern.h
│   ├── itab.c
│   ├── itab.h
│   ├── main.c
│   ├── stderr.txt
│   ├── stdout.txt
│   ├── syn-att.c
│   ├── syn-intel.c
│   ├── syn.c
│   ├── syn.h
│   ├── types.h
│   ├── udint.h
│   ├── udis86.c
│   └── udis86.err
├── dmmic.asm
├── dos32.asm
├── dpmi/
│   ├── DPMI.LOD
│   ├── DPMI.PRO
│   ├── DPMIONE.PRO
│   ├── LICENSE.TXT
│   ├── README.TXT
│   ├── UNCOMMIT.TXT
│   └── VERSION.TXT
├── dpmic.asm
├── entry.asm
├── gdt.asm
├── guest16.asm
├── guest32.asm
├── guest64.asm
├── himem16.asm
├── idt.asm
├── int16.asm
├── int32.asm
├── int64.asm
├── iso.ps1
├── leheader.asm
├── lemain.asm
├── mdebug.asm
├── mdebugcore.asm
├── mutex16.asm
├── mutex32.asm
├── mutex64.asm
├── opcodes.asm
├── page16.asm
├── page32.asm
├── qlink/
│   ├── QLINK.CFG
│   ├── QLINK.HTM
│   ├── QLINK.TXT
│   ├── W95DPMI.386
│   └── WINDPMI.386
├── reqdmmi.asm
├── runx.bat
├── stack16.asm
├── stack32.asm
├── stack64.asm
├── startbochs.bat
├── startvbox.bat
├── startvmware.bat
├── struct.asm
├── swat/
│   ├── 386SWAT
│   ├── 386SWAT.DOC
│   ├── 386SWAT.GRM
│   ├── 386SWAT.LOD
│   ├── FILELIST.TXT
│   ├── KEYBIN.COM
│   ├── KEYBIN.HTM
│   ├── KEYBIN.TXT
│   ├── SWAT.HTM
│   ├── SWATAFLT.HTM
│   ├── SWATBMRK.HTM
│   ├── SWATCMD.HTM
│   ├── SWATCMR.HTM
│   ├── SWATDEF.HTM
│   ├── SWATDISP.HTM
│   ├── SWATDOC.HTM
│   ├── SWATGRM.HTM
│   ├── SWATINST.HTM
│   ├── SWATINV.HTM
│   ├── SWATMAX.HTM
│   ├── SWATMON.HTM
│   ├── SWATNDP.HTM
│   ├── SWATPRO.HTM
│   ├── SWATREM.HTM
│   ├── SWATRMV.HTM
│   ├── SWATRUN.COM
│   ├── SWATSCR.HTM
│   ├── SWATSYM.DOC
│   ├── SWATSYM.HTM
│   ├── SWATVER.HTM
│   ├── SWATVXD.DOC
│   ├── SWATVXD.HTM
│   ├── SWATWDBG.HTM
│   ├── SWATWISH.HTM
│   ├── SWATWKD.HTM
│   ├── VCPIDBG.DOC
│   ├── VCPIDBG.HTM
│   ├── WHATSNEW
│   ├── WINKDBG.DOC
│   └── WINKDBG.HTM
├── switcher/
│   ├── main.cpp
│   ├── switcher.lk1
│   ├── switcher.mk
│   ├── switcher.mk1
│   ├── switcher.sym
│   ├── switcher.tgt
│   └── switcher.wpj
├── thread16.asm
├── thread32.asm
├── thread64.asm
├── unreal.asm
├── vbox.vbox-prev
├── vdebug.asm
├── vdebug64.asm
├── vdisplay.asm
├── vm.nvram
├── vm.vmsd
├── vm.vmx
├── vm.vmxf
└── vmxhost64.asm
Download .txt
SYMBOL INDEX (142 symbols across 13 files)

FILE: dis/decode.c
  type ud (line 58) | struct ud
  type reg_class (line 60) | enum reg_class { /* register classes */
  function inp_start (line 73) | static void
  function inp_next (line 80) | static uint8_t
  function inp_curr (line 103) | static uint8_t
  function inp_uint8 (line 117) | static uint8_t
  function inp_uint16 (line 123) | static uint16_t
  function inp_uint32 (line 133) | static uint32_t
  function inp_uint64 (line 147) | static uint64_t
  function eff_opr_mode (line 170) | static inline int
  function eff_adr_mode (line 184) | static inline int
  function decode_prefixes (line 203) | static int
  function modrm (line 267) | static inline unsigned int modrm( struct ud * u )
  function resolve_operand_size (line 277) | static unsigned int
  function resolve_mnemonic (line 296) | static int resolve_mnemonic( struct ud* u )
  function decode_a (line 331) | static void
  function decode_gpr (line 353) | static enum ud_type
  function decode_reg (line 379) | static void
  function decode_imm (line 421) | static void
  function decode_mem_disp (line 442) | static void
  function decode_modrm_reg (line 474) | static inline void
  function decode_modrm_rm (line 491) | static void
  function decode_moffset (line 624) | static void
  function decode_operand (line 637) | static int
  function decode_operands (line 798) | static int
  function clear_insn (line 817) | static void
  function resolve_pfx_str (line 841) | static inline int
  function resolve_mode (line 857) | static int
  function decode_insn (line 910) | static inline int
  function decode_3dnow (line 934) | static inline int
  function decode_ssepfx (line 952) | static int
  function decode_ext (line 994) | static int
  function decode_opcode (line 1053) | static int
  function ud_decode (line 1076) | unsigned int

FILE: dis/decode.h
  type ud_operand_code (line 65) | enum ud_operand_code {
  type ud_operand_size (line 99) | enum ud_operand_size {
  function Mx_mem_size (line 138) | static inline enum ud_operand_size
  function Mx_reg_size (line 144) | static inline enum ud_operand_size
  type ud_itab_entry_operand (line 153) | struct ud_itab_entry_operand
  type ud_itab_entry (line 163) | struct ud_itab_entry
  type ud_lookup_table_list_entry (line 172) | struct ud_lookup_table_list_entry {
  function ud_opcode_field_sext (line 180) | static inline int
  type ud_itab_entry (line 186) | struct ud_itab_entry
  type ud_lookup_table_list_entry (line 187) | struct ud_lookup_table_list_entry

FILE: dis/extern.h
  type ud (line 37) | struct ud
  type ud (line 39) | struct ud
  type ud (line 41) | struct ud
  type ud (line 43) | struct ud
  type ud (line 43) | struct ud
  type ud (line 45) | struct ud
  type ud (line 48) | struct ud
  type ud (line 51) | struct ud
  type ud (line 53) | struct ud
  type ud (line 53) | struct ud
  type ud (line 55) | struct ud
  type ud (line 57) | struct ud
  type ud (line 59) | struct ud
  type ud (line 61) | struct ud
  type ud (line 63) | struct ud
  type ud (line 65) | struct ud
  type ud (line 67) | struct ud
  type ud (line 69) | struct ud
  type ud (line 71) | struct ud
  type ud (line 73) | struct ud
  type ud (line 75) | struct ud
  type ud_operand (line 77) | struct ud_operand
  type ud (line 77) | struct ud
  type ud_operand (line 79) | struct ud_operand
  type ud_operand (line 81) | struct ud_operand
  type ud_mnemonic_code (line 83) | enum ud_mnemonic_code
  type ud (line 83) | struct ud
  type ud_mnemonic_code (line 85) | enum ud_mnemonic_code
  type ud (line 87) | struct ud
  type ud (line 89) | struct ud
  type ud (line 91) | struct ud
  type ud_operand (line 91) | struct ud_operand
  type ud (line 93) | struct ud
  type ud (line 95) | struct ud
  type ud (line 96) | struct ud

FILE: dis/itab.c
  type ud_lookup_table_list_entry (line 5031) | struct ud_lookup_table_list_entry
  type ud_itab_entry (line 6297) | struct ud_itab_entry

FILE: dis/itab.h
  type ud_table_type (line 7) | enum ud_table_type {
  type ud_mnemonic_code (line 24) | enum ud_mnemonic_code {

FILE: dis/main.c
  function hook (line 22) | int hook(struct ud_t *ud_obj)
  function main (line 35) | int main(int argc,char** argv)

FILE: dis/syn-att.c
  function opr_cast (line 37) | static void
  function gen_operand (line 51) | static void
  function ud_translate_att (line 122) | extern void

FILE: dis/syn-intel.c
  function opr_cast (line 37) | static void
  function gen_operand (line 57) | static void gen_operand(struct ud* u, struct ud_operand* op, int syn_cast)
  function ud_translate_intel (line 124) | extern void

FILE: dis/syn.c
  function ud_syn_rel_target (line 86) | uint64_t
  function ud_asmprintf (line 107) | int
  function ud_syn_print_addr (line 126) | void
  function ud_syn_print_imm (line 146) | void
  function ud_syn_print_mem_disp (line 173) | void

FILE: dis/syn.h
  type ud (line 36) | struct ud
  type ud_operand (line 36) | struct ud_operand
  type ud (line 39) | struct ud
  type ud (line 42) | struct ud
  type ud (line 45) | struct ud
  type ud (line 46) | struct ud
  type ud_operand (line 46) | struct ud_operand
  type ud (line 47) | struct ud
  type ud_operand (line 47) | struct ud_operand

FILE: dis/types.h
  type ud_type (line 61) | enum ud_type
  type ud_operand (line 148) | struct ud_operand {
  type ud (line 167) | struct ud
  type ud_type_t (line 232) | typedef enum ud_type          ud_type_t;
  type ud_mnemonic_code_t (line 233) | typedef enum ud_mnemonic_code ud_mnemonic_code_t;
  type ud_t (line 235) | typedef struct ud             ud_t;
  type ud_operand_t (line 236) | typedef struct ud_operand     ud_operand_t;

FILE: dis/udis86.c
  type ud (line 37) | struct ud
  function ud_init (line 44) | extern void
  function ud_disassemble (line 65) | extern unsigned int
  function ud_set_mode (line 86) | extern void
  function ud_set_vendor (line 101) | extern void
  function ud_set_pc (line 120) | extern void
  function ud_set_syntax (line 130) | extern void
  type ud (line 141) | struct ud
  function ud_insn_off (line 150) | uint64_t
  type ud (line 162) | struct ud
  type ud (line 188) | struct ud
  function ud_insn_len (line 200) | extern unsigned int
  type ud_operand (line 214) | struct ud_operand
  type ud (line 215) | struct ud
  function ud_opr_is_sreg (line 230) | int
  function ud_opr_is_gpr (line 245) | int
  function ud_set_user_opaque_data (line 260) | void
  type ud (line 267) | struct ud
  function ud_set_asm_buffer (line 279) | void
  function ud_set_sym_resolver (line 306) | void
  function ud_insn_mnemonic (line 320) | enum ud_mnemonic_code
  type ud_mnemonic_code (line 334) | enum ud_mnemonic_code
  function ud_inp_init (line 348) | static void
  function ud_set_input_hook (line 367) | void
  function ud_set_input_buffer (line 379) | void
  function inp_file_hook (line 395) | static int
  function ud_set_input_file (line 401) | void
  function ud_input_skip (line 416) | void
  function ud_input_end (line 451) | int

FILE: switcher/main.cpp
  function main (line 22) | int main(int,char**)
Condensed preview — 162 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,178K chars).
[
  {
    "path": ".gitattributes",
    "chars": 2518,
    "preview": "###############################################################################\n# Set default behavior to automatically "
  },
  {
    "path": ".gitignore",
    "chars": 4357,
    "preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
  },
  {
    "path": ".gitmodules",
    "chars": 76,
    "preview": "[submodule \"Int50\"]\n\tpath = Int50\n\turl = https://github.com/WindowsNT/Int50\n"
  },
  {
    "path": "Readme.md",
    "chars": 7217,
    "preview": "# Assembly Manual\nWelcome to my assembly tutorials.\n\n# Update\nCleaner DMMI interface for you:\nhttps://github.com/Windows"
  },
  {
    "path": "a20.asm",
    "chars": 875,
    "preview": "; --------------------------------------- A20 line routines ---------------------------------------\nUSE16\nWaitKBC:\n\tmov "
  },
  {
    "path": "acpi16.asm",
    "chars": 6240,
    "preview": "; --------------------------------------- 16 bit APIC functions ---------------------------------------\nUSE16\n\ninclude '"
  },
  {
    "path": "acpi32.asm",
    "chars": 1972,
    "preview": "; --------------------------------------- 32 bit APIC functions ---------------------------------------\nUSE32\n\ninclude '"
  },
  {
    "path": "acpi64.asm",
    "chars": 2045,
    "preview": "; --------------------------------------- 64 bit APIC functions ---------------------------------------\nUSE64\n\n\ninclude "
  },
  {
    "path": "asm.sln",
    "chars": 1217,
    "preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.168\nMi"
  },
  {
    "path": "asm.vcxproj",
    "chars": 11577,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"15.0\" xmlns=\"http://schemas.microso"
  },
  {
    "path": "asm.vcxproj.filters",
    "chars": 6730,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
  },
  {
    "path": "asmtest.vbox",
    "chars": 2646,
    "preview": "<?xml version=\"1.0\"?>\n<!--\n** DO NOT EDIT THIS FILE.\n** If you make changes to this file while any VirtualBox related ap"
  },
  {
    "path": "asmtest.vbox-prev",
    "chars": 2643,
    "preview": "<?xml version=\"1.0\"?>\n<!--\n** DO NOT EDIT THIS FILE.\n** If you make changes to this file while any VirtualBox related ap"
  },
  {
    "path": "bochsrc.bxrc",
    "chars": 2249,
    "preview": "# configuration file generated by Bochs\nplugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1"
  },
  {
    "path": "build.bat",
    "chars": 1067,
    "preview": "del d.iso\nfasm entry.asm\nfasm dpmic.asm\nfasm dmmic.asm\nfasm vdebug.asm\nfasm mdebug.asm\nfasm debuggee.asm\nfasm leheader.a"
  },
  {
    "path": "bx_enh_dbg.ini",
    "chars": 514,
    "preview": "# bx_enh_dbg_ini\nSeeReg[0] = TRUE\nSeeReg[1] = TRUE\nSeeReg[2] = TRUE\nSeeReg[3] = TRUE\nSeeReg[4] = FALSE\nSeeReg[5] = FALSE"
  },
  {
    "path": "code16.asm",
    "chars": 9932,
    "preview": "SEGMENT CODE16 USE16\nORG 0h\n\nmacro break16\n{\n\txchg bx,bx\n}\n\nINCLUDE 'himem16.asm'\nINCLUDE 'unreal.asm'\nINCLUDE 'page16.a"
  },
  {
    "path": "code32.asm",
    "chars": 3869,
    "preview": "; --------------------------------------- 32 bit Code ---------------------------------------\nSEGMENT CODE32 USE32\nORG 0"
  },
  {
    "path": "code64.asm",
    "chars": 1142,
    "preview": "; --------------------------------------- 64 bit Code ---------------------------------------\nSEGMENT CODE64 USE64\nORG 0"
  },
  {
    "path": "config.asm",
    "chars": 132,
    "preview": "TEST_LONG = 1\nTEST_MULTI = 1\nTEST_RM_SIPI = 1\nTEST_PM_SIPI = 1\nTEST_LM_SIPI = 1\nTEST_VMX = 1\n\nRESIDENT = 1\n\n\nVDEBUG = 0\n"
  },
  {
    "path": "data16.asm",
    "chars": 6618,
    "preview": "SEGMENT DATA16 USE16\n\n\n\n; --------------------------------------- 16 bit data ---------------------------------------\na2"
  },
  {
    "path": "data32.asm",
    "chars": 559,
    "preview": "; --------------------------------------- 32 bit Data ---------------------------------------\nSEGMENT DATA32 USE32\n\nldt_"
  },
  {
    "path": "data64.asm",
    "chars": 800,
    "preview": "; --------------------------------------- 64 bit Data ---------------------------------------\nSEGMENT DATA64 USE64\nORG 0"
  },
  {
    "path": "debuggee.asm",
    "chars": 829,
    "preview": "FORMAT MZ\nHEAP 0\n\nmacro linear reg,trg,seg = DATA16\n\t{\n\tmov reg,seg\n\tshl reg,4\n\tadd reg,trg\n\t}\nstruc GDT_STR s0_15,b0_15"
  },
  {
    "path": "directlong.asm",
    "chars": 1398,
    "preview": "\n\nmacro thread64header brk=0\n{\n   local nobrk\n\n\tUSE16 \n\t; Remember CPU starts in real mode\n\tdb 4096 dup (144) ; // fill "
  },
  {
    "path": "dis/Makefile.am",
    "chars": 944,
    "preview": "#\n# -- udis86/libudis86\n#\n\nPYTHON  = @PYTHON@\nOPTABLE = @top_srcdir@/docs/x86/optable.xml\n\nMAINTAINERCLEANFILES = Makefi"
  },
  {
    "path": "dis/Makefile.in",
    "chars": 21833,
    "preview": "# Makefile.in generated by automake 1.13.1 from Makefile.am.\n# @configure_input@\n\n# Copyright (C) 1994-2012 Free Softwar"
  },
  {
    "path": "dis/d.lb1",
    "chars": 83,
    "preview": "+'decode.obj'\n+'itab.obj'\n+'syn-att.obj'\n+'syn-intel.obj'\n+'syn.obj'\n+'udis86.obj'\n"
  },
  {
    "path": "dis/d.mk",
    "chars": 88,
    "preview": "project : F:\\TOOLS\\ASM\\full2\\dis\\d.lib .SYMBOLIC\n\n!include F:\\TOOLS\\ASM\\full2\\dis\\d.mk1\n"
  },
  {
    "path": "dis/d.mk1",
    "chars": 1739,
    "preview": "!define BLANK \"\"\nF:\\TOOLS\\ASM\\full2\\dis\\decode.obj : F:\\TOOLS\\ASM\\full2\\dis\\decode.c .AUTODEP&\nEND\n @F:\n cd F:\\TOOLS\\ASM"
  },
  {
    "path": "dis/d.tgt",
    "chars": 677,
    "preview": "40\ntargetIdent\n0\nMProject\n1\nMComponent\n0\n2\nWString\n3\nLIB\n3\nWString\n5\nd_6sn\n1\n0\n1\n4\nMCommand\n0\n5\nMCommand\n0\n6\nMItem\n5\nd.l"
  },
  {
    "path": "dis/d.wpj",
    "chars": 183,
    "preview": "40\nprojectIdent\n0\nVpeMain\n1\nWRect\n0\n0\n7680\n9210\n2\nMProject\n3\nMCommand\n0\n4\nMCommand\n0\n1\n5\nWFileName\n5\nd.tgt\n6\nWVList\n1\n7\n"
  },
  {
    "path": "dis/decode.c",
    "chars": 27400,
    "preview": "/* udis86 - libudis86/decode.c\n * \n * Copyright (c) 2002-2009 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution"
  },
  {
    "path": "dis/decode.h",
    "chars": 5403,
    "preview": "/* udis86 - libudis86/decode.h\n *\n * Copyright (c) 2002-2009 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution "
  },
  {
    "path": "dis/dism.lk1",
    "chars": 79,
    "preview": "FIL decode.obj,itab.obj,main.obj,syn-att.obj,syn-intel.obj,syn.obj,udis86.obj\n\n"
  },
  {
    "path": "dis/dism.mk",
    "chars": 94,
    "preview": "project : F:\\TOOLS\\ASM\\full2\\dis\\dism.exe .SYMBOLIC\n\n!include F:\\TOOLS\\ASM\\full2\\dis\\dism.mk1\n"
  },
  {
    "path": "dis/dism.mk1",
    "chars": 2025,
    "preview": "!define BLANK \"\"\nF:\\TOOLS\\ASM\\full2\\dis\\decode.obj : F:\\TOOLS\\ASM\\full2\\dis\\decode.c .AUTODEP&\nEND\n @F:\n cd F:\\TOOLS\\ASM"
  },
  {
    "path": "dis/dism.tgt",
    "chars": 1228,
    "preview": "40\ntargetIdent\n0\nMProject\n1\nMComponent\n0\n2\nWString\n3\nEXE\n3\nWString\n5\nde6en\n1\n0\n1\n4\nMCommand\n0\n5\nMCommand\n0\n6\nMItem\n8\ndis"
  },
  {
    "path": "dis/dism.txt",
    "chars": 230,
    "preview": "cd F:\\TOOLS\\ASM\\full2\\dis\nwmake -f F:\\TOOLS\\ASM\\full2\\dis\\dism.mk -h -e\nwcc main.c -i=\"G:\\WATCOM/h\" -w4 -e25 -zq -od -d2"
  },
  {
    "path": "dis/dism.wpj",
    "chars": 189,
    "preview": "40\nprojectIdent\n0\nVpeMain\n1\nWRect\n0\n0\n7680\n9210\n2\nMProject\n3\nMCommand\n0\n4\nMCommand\n0\n1\n5\nWFileName\n8\ndism.tgt\n6\nWVList\n1"
  },
  {
    "path": "dis/extern.h",
    "chars": 3625,
    "preview": "/* udis86 - libudis86/extern.h\n *\n * Copyright (c) 2002-2009, 2013 Vivek Thampi\n * All rights reserved.\n * \n * Redistrib"
  },
  {
    "path": "dis/itab.c",
    "chars": 316845,
    "preview": "/* itab.c -- generated by udis86:scripts/ud_itab.py, do no edit */\n#include \"decode.h\"\n\n#define GROUP(n) (0x8000 | (n))\n"
  },
  {
    "path": "dis/itab.h",
    "chars": 10738,
    "preview": "#ifndef UD_ITAB_H\n#define UD_ITAB_H\n\n/* itab.h -- generated by udis86:scripts/ud_itab.py, do no edit */\n\n/* ud_table_typ"
  },
  {
    "path": "dis/main.c",
    "chars": 1255,
    "preview": "#include <stdio.h>\n\n#include <dos.h>\n#include \"types.h\"\n#include \"extern.h\"\n\nextern char far *get_ptr_1(char far* x,int "
  },
  {
    "path": "dis/stderr.txt",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "dis/stdout.txt",
    "chars": 560,
    "preview": "DOSBox version 0.74-2\nCopyright 2002-2018 DOSBox Team, published under GNU GPL.\n---\nSDL_Init: Starting up with SDL windi"
  },
  {
    "path": "dis/syn-att.c",
    "chars": 5900,
    "preview": "/* udis86 - libudis86/syn-att.c\n *\n * Copyright (c) 2002-2009 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution"
  },
  {
    "path": "dis/syn-intel.c",
    "chars": 6364,
    "preview": "/* udis86 - libudis86/syn-intel.c\n *\n * Copyright (c) 2002-2013 Vivek Thampi\n * All rights reserved.\n * \n * Redistributi"
  },
  {
    "path": "dis/syn.c",
    "chars": 6231,
    "preview": "/* udis86 - libudis86/syn.c\n *\n * Copyright (c) 2002-2013 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution and"
  },
  {
    "path": "dis/syn.h",
    "chars": 2085,
    "preview": "/* udis86 - libudis86/syn.h\n *\n * Copyright (c) 2002-2009\n * All rights reserved.\n * \n * Redistribution and use in sourc"
  },
  {
    "path": "dis/types.h",
    "chars": 7342,
    "preview": "/* udis86 - libudis86/types.h\n *\n * Copyright (c) 2002-2013 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution a"
  },
  {
    "path": "dis/udint.h",
    "chars": 2695,
    "preview": "/* udis86 - libudis86/udint.h -- definitions for internal use only\n * \n * Copyright (c) 2002-2009 Vivek Thampi\n * All ri"
  },
  {
    "path": "dis/udis86.c",
    "chars": 12768,
    "preview": "/* udis86 - libudis86/udis86.c\n *\n * Copyright (c) 2002-2013 Vivek Thampi\n * All rights reserved.\n * \n * Redistribution "
  },
  {
    "path": "dis/udis86.err",
    "chars": 70,
    "preview": "udis86.c(47): Warning! W131: No prototype found for function 'memset'\n"
  },
  {
    "path": "dmmic.asm",
    "chars": 4028,
    "preview": "FORMAT MZ\n\ninclude 'config.asm'\n\nmacro linear reg,trg,seg\n\t{\n\txor reg,reg\n\tmov reg,seg\n\tshl reg,4\n\tadd reg,trg\n\t}\n\nmacro"
  },
  {
    "path": "dos32.asm",
    "chars": 25,
    "preview": "USE32\n\ncalldos32:\n\n\n\nretf"
  },
  {
    "path": "dpmi/DPMI.PRO",
    "chars": 2417,
    "preview": "; Profile for DPMI.LOD\n;\n; Options currently in effect are\n\n\n;\n; Default options are\n\n; dpmimem=616,1024,4096,32,32,1,20"
  },
  {
    "path": "dpmi/DPMIONE.PRO",
    "chars": 511,
    "preview": "; Profile for DPMIONE.EXE\n\n  LOAD=dpmi.lod pro=dpmi.pro\n\n;\n; The default options are\n;\n; DEBUG=QSWAT\t\t\tDon't signal INT "
  },
  {
    "path": "dpmi/LICENSE.TXT",
    "chars": 628,
    "preview": "DPMIONE  -- A DPMI 1.0 Host -- Version 0.91\n(C) Copyright 1990-2004 Qualitas, Inc.\tAll Rights Reserved.\n\n\nAuthor & Copyr"
  },
  {
    "path": "dpmi/README.TXT",
    "chars": 4981,
    "preview": "DPMIONE  -- A DPMI 1.0 Host -- Version 0.91\n(C) Copyright 1990-2004 Qualitas, Inc.\tAll Rights Reserved.\n\n\nOverview\n-----"
  },
  {
    "path": "dpmi/UNCOMMIT.TXT",
    "chars": 2387,
    "preview": "\t\tHow to Use Uncommitted Memory\n\nOverview\n--------\n\nOne of the really nice features of DPMI 1.0 is its support of\nuncomm"
  },
  {
    "path": "dpmi/VERSION.TXT",
    "chars": 1366,
    "preview": "Version History for DPMIONE\n---------------------------\n\n0.91 -- 22 April 2004\n    * Fix bugs when loading as device dri"
  },
  {
    "path": "dpmic.asm",
    "chars": 852,
    "preview": "FORMAT MZ\nHEAP 0\n\n\nsegment DATA16\nUSE16\n\n\n; main\nsegment CODE16\nUSE16\n\nerror:\n\nmov ax,0x4C00\nint 0x21\n\n\tmodesw\tdd\t0\n\nsta"
  },
  {
    "path": "entry.asm",
    "chars": 391,
    "preview": "FORMAT MZ\nHEAP 0\n\nINCLUDE 'config.asm'\nINCLUDE 'struct.asm'\nINCLUDE 'data16.asm'\nINCLUDE 'guest32.asm'\nINCLUDE 'data32.a"
  },
  {
    "path": "gdt.asm",
    "chars": 1276,
    "preview": "; --------------------------------------- GDT routines ---------------------------------------\nUSE16\n\nmacro gdt_initiali"
  },
  {
    "path": "guest16.asm",
    "chars": 415,
    "preview": "SEGMENT VMX16 USE16\n\n\n\n; VMX Entry for our Virtual Machine\n; This is a Real Mode segment\n\n; Note that since the memory i"
  },
  {
    "path": "guest32.asm",
    "chars": 256,
    "preview": "SEGMENT VMX32 USE32\n\n; VMX Entry for our Virtual Machine\n; This is a Protected Mode segment\n\nStartVM2: ; This is a prote"
  },
  {
    "path": "guest64.asm",
    "chars": 190,
    "preview": "\n; VMX Entry for our Virtual Machine\n; This is a Protected Mode segment\n\nStartVM3: ; This is a protected mode start - 32"
  },
  {
    "path": "himem16.asm",
    "chars": 777,
    "preview": "\nhimaddrx:\nhimaddr dd 0\n\nhimemthere:\n\nmov ax,0x4300\nint 0x2F\ncmp al,0x80\njz .hi\n\nret\n.hi:\n\nmov ax,0x4310\nint 0x2F\nmov wo"
  },
  {
    "path": "idt.asm",
    "chars": 2443,
    "preview": "; --------------------------------------- IDT routines ---------------------------------------\nUSE16\nIDTInit2:\n\n ; Base "
  },
  {
    "path": "int16.asm",
    "chars": 12067,
    "preview": "; --------------------------------------- int 0xF0 real ---------------------------------------\n\nc16o dw 0\nc16s dw 0\nc16"
  },
  {
    "path": "int32.asm",
    "chars": 3136,
    "preview": "; --------------------------------------- int 0xF0 protected ---------------------------------------\n\nint32_21:\n\n\tmov bp"
  },
  {
    "path": "int64.asm",
    "chars": 2603,
    "preview": "; --------------------------------------- int 0xF0 long ---------------------------------------\n\nint64_21:\n\n\tmov bp,ax\n\t"
  },
  {
    "path": "iso.ps1",
    "chars": 4773,
    "preview": "function New-IsoFile\n{  \n  <# .Synopsis Creates a new .iso file .Description The New-IsoFile cmdlet creates a new .iso f"
  },
  {
    "path": "leheader.asm",
    "chars": 4022,
    "preview": ";\n; FASM example of creation of a linear ( exponential soon Very Happy )\n; executable (\"LE\") for running on DOS/32A exte"
  },
  {
    "path": "lemain.asm",
    "chars": 233,
    "preview": "; le-main, 32-bit flat, everything is inside here\n\njmp main\n\ntx1b db 'Hello from protected mode, using DOS/32A, coded wi"
  },
  {
    "path": "mdebug.asm",
    "chars": 1488,
    "preview": "FORMAT MZ\nHEAP 0\n\ninclude 'struct.asm'\n\n\n\n; stack\nsegment STACK16\nUSE16\n\ndw 128 dup(0)\nstre:\n\ndw 128 dup(0)\nstx1e:\n\n; da"
  },
  {
    "path": "mdebugcore.asm",
    "chars": 97,
    "preview": "\n\nThr:\n\n\t; mutex release\n\tmov ax,DATA16\n\tmov es,ax\n\tmov ax,0x0503\n\tmov di,mut0\n\tint 0xF0\n\n\n\nretf\n"
  },
  {
    "path": "mutex16.asm",
    "chars": 874,
    "preview": "USE16\n\n\n\n\n\nmacro qlock16 trg,del = -1\n\t{\n\tpush ds\n\tpush di\n\tpush ecx\n\tMOV DI,DATA16\n\tMOV DS,DI\n\tMOV DI,trg\n\tdec byte [ds"
  },
  {
    "path": "mutex32.asm",
    "chars": 881,
    "preview": "USE32\n\n\n\n\n\nmacro qlock32 trg\n\t{\n\tpush ds\n\tpush di\n\tpush ecx\n\tMOV DI,data16_idx\n\tMOV DS,DI\n\tMOV DI,trg\n\tdec byte [ds:di]\n"
  },
  {
    "path": "mutex64.asm",
    "chars": 691,
    "preview": "USE64\n\nmacro qlock64 trg\n\t{\n\tpush rcx\n\tlinear rcx,trg\n\tdec byte [rcx]\n\tpop rcx\n\t}\n\nmacro qunlock64 trg\n\t{\n\tpush rcx\n\tlin"
  },
  {
    "path": "opcodes.asm",
    "chars": 47,
    "preview": "op1:\n\n\nrdtscp\nret\n\n\n\n\nOpcodeTest:\n\ncall op1\nret"
  },
  {
    "path": "page16.asm",
    "chars": 787,
    "preview": "; --------------------------------------- 16 bit Paging routines to map 1GB ---------------------------------------\nUSE1"
  },
  {
    "path": "page32.asm",
    "chars": 2857,
    "preview": "; --------------------------------------- Paging routines ---------------------------------------\nUSE32\n\nInitPageTable32"
  },
  {
    "path": "qlink/QLINK.CFG",
    "chars": 9805,
    "preview": "# QLINK Configuration File\n# Put additional switches here rather than the command line\n# to avoid cluttering up that res"
  },
  {
    "path": "qlink/QLINK.HTM",
    "chars": 23699,
    "preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\t\t \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.d"
  },
  {
    "path": "qlink/QLINK.TXT",
    "chars": 17061,
    "preview": "QLINK Documentation File\n\nOverview\n--------\n\nQLINK is a DOS linker and analysis tool designed to link together\nMS-DOS co"
  },
  {
    "path": "reqdmmi.asm",
    "chars": 422,
    "preview": "\n\nmacro RequireDMMI\n{\n\tlocal FailX\n\tlocal SuccX\n\tlocal FailErr\n\n\tpushad\n\tpush es\n\tpush ds\n\n\tmov ax,0x35F0\n\tint 0x21\n\tcmp"
  },
  {
    "path": "runx.bat",
    "chars": 176,
    "preview": "\n@echo off\nD:\n\n\nentry.exe\nentry.exe /r\ndmmic.exe\ndos32a.exe le.exe\n\n\nrem cd dpmi\nrem dpmione pro=dpmione.pro\nrem cd ..\n\n"
  },
  {
    "path": "stack16.asm",
    "chars": 1102,
    "preview": "; --------------------------------------- 16 bit stack ---------------------------------------\nSEGMENT STACK16 USE16\nsse"
  },
  {
    "path": "stack32.asm",
    "chars": 167,
    "preview": "; --------------------------------------- 32 bit stack ---------------------------------------\nSEGMENT STACK32 USE32\nsta"
  },
  {
    "path": "stack64.asm",
    "chars": 243,
    "preview": "; --------------------------------------- 64 bit stack ---------------------------------------\n\nSEGMENT STACK64 USE64\nOR"
  },
  {
    "path": "startbochs.bat",
    "chars": 21,
    "preview": "bochs.exe -q -f \"%1\"\n"
  },
  {
    "path": "startvbox.bat",
    "chars": 262,
    "preview": "g:\\virtualbox\\VBoxManage.exe unregistervm asmtest\ng:\\virtualbox\\VBoxManage.exe registervm \"%1\"\nset VBOX_GUI_DBG_AUTO_SHO"
  },
  {
    "path": "startvmware.bat",
    "chars": 73,
    "preview": "\"C:\\Program Files (x86)\\VMware\\VMware Workstation\\vmware.exe\" -q -x \"%1\"\n"
  },
  {
    "path": "struct.asm",
    "chars": 2299,
    "preview": "; --------------------------------------- Macro and Structure Definitions ---------------------------------------\n\nmacro"
  },
  {
    "path": "swat/386SWAT",
    "chars": 6795,
    "preview": ";\n; Recommended options are\n\n  trapdiv\t\t; Direct INT 00h to 386SWAT (Divide Overflow Fault)\n  trapnmi\t\t; Direct INT 02h "
  },
  {
    "path": "swat/386SWAT.DOC",
    "chars": 55711,
    "preview": "386SWAT   -- A Debugger for All Modes\n   (C) Copyright 1988-2001 Qualitas, Inc.  All rights reserved.\n\nThis protected mo"
  },
  {
    "path": "swat/386SWAT.GRM",
    "chars": 7511,
    "preview": "'$Header:   P:/PVCS/386SWAT/386SWAT.GRV   1.32   10 Aug 1998 11:00:44   BOB  $\n\t\t   GRAMMAR FOR 386SWAT COMMAND LINE\n\n//"
  },
  {
    "path": "swat/FILELIST.TXT",
    "chars": 1993,
    "preview": "This file contains a list of all files included in 386SWAT.ZIP along\nwith a brief description of each file's contents.\n\n"
  },
  {
    "path": "swat/KEYBIN.HTM",
    "chars": 2418,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "swat/KEYBIN.TXT",
    "chars": 1234,
    "preview": "Documentation for KEYBIN.COM\n\nUse this program on an international keyboard to help the author of\n386SWAT support your k"
  },
  {
    "path": "swat/SWAT.HTM",
    "chars": 3352,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATAFLT.HTM",
    "chars": 1182,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATBMRK.HTM",
    "chars": 2301,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATCMD.HTM",
    "chars": 36578,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATCMR.HTM",
    "chars": 8165,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATDEF.HTM",
    "chars": 13637,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATDISP.HTM",
    "chars": 2013,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATDOC.HTM",
    "chars": 2875,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATGRM.HTM",
    "chars": 32231,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "swat/SWATINST.HTM",
    "chars": 1845,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATINV.HTM",
    "chars": 2246,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATMAX.HTM",
    "chars": 2505,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATMON.HTM",
    "chars": 1862,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATNDP.HTM",
    "chars": 842,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATPRO.HTM",
    "chars": 22067,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATREM.HTM",
    "chars": 2903,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATRMV.HTM",
    "chars": 2482,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/x-server-parsed-html; charset=iso-8859-1\">\n   <META NAME="
  },
  {
    "path": "swat/SWATSCR.HTM",
    "chars": 17427,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATSYM.DOC",
    "chars": 13695,
    "preview": "386SWAT symbolic debugging\n\nThis document covers the basics of symbolic debugging support for\n386SWAT.  The 386SWAT API "
  },
  {
    "path": "swat/SWATSYM.HTM",
    "chars": 25557,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "swat/SWATVER.HTM",
    "chars": 49150,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATVXD.DOC",
    "chars": 6594,
    "preview": "SWATVXD  -- Version 3.02 -- A Debugger for WIN386\n   (C) Copyright 1990-8 Qualitas, Inc.\tAll rights reserved.\n\nThe SWATV"
  },
  {
    "path": "swat/SWATVXD.HTM",
    "chars": 13720,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "swat/SWATWDBG.HTM",
    "chars": 989,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/SWATWISH.HTM",
    "chars": 1484,
    "preview": "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n<html>\n<head>\n   <meta http-equiv=\"Content-Type\" content="
  },
  {
    "path": "swat/SWATWKD.HTM",
    "chars": 1075,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"GENERATOR\" CONT"
  },
  {
    "path": "swat/VCPIDBG.DOC",
    "chars": 16307,
    "preview": "\t\t\t Preliminary Proposal\n\t\t\t\t For\n\t\t\t Debugger Extensions\n\t\t\t\t  to\n\t\t\t  VCPI Specification\n\t\t\t      30 May 89\n\t\t\t  Amend"
  },
  {
    "path": "swat/VCPIDBG.HTM",
    "chars": 30269,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "swat/WHATSNEW",
    "chars": 38820,
    "preview": "Version 6.04\n\n* Implement UNREAL as keyword in the 386SWAT.PRO file.\n\n\nVersion 6.03\n\n* Support for display of MMX & SSE "
  },
  {
    "path": "swat/WINKDBG.DOC",
    "chars": 9991,
    "preview": "\t\t  Notes on Windows Kernel Debugging\n\t\t  ---------------------------------\n\nWindows implements a low-level debugging in"
  },
  {
    "path": "swat/WINKDBG.HTM",
    "chars": 14350,
    "preview": "<HTML>\n<HEAD>\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n   <META NAME=\"Author\" CONTENT"
  },
  {
    "path": "switcher/main.cpp",
    "chars": 1156,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <dos.h>\n#include <string>\n#include <iostream>\nusing namespace std;\n\nexte"
  },
  {
    "path": "switcher/switcher.lk1",
    "chars": 14,
    "preview": "FIL main.obj\n\n"
  },
  {
    "path": "switcher/switcher.mk",
    "chars": 112,
    "preview": "project : F:\\TOOLS\\ASM\\full2\\switcher\\switcher.exe .SYMBOLIC\n\n!include F:\\TOOLS\\ASM\\full2\\switcher\\switcher.mk1\n"
  },
  {
    "path": "switcher/switcher.mk1",
    "chars": 501,
    "preview": "!define BLANK \"\"\nF:\\TOOLS\\ASM\\full2\\switcher\\main.obj : F:\\TOOLS\\ASM\\full2\\switcher\\main.cpp &\n.AUTODEPEND\n @F:\n cd F:\\T"
  },
  {
    "path": "switcher/switcher.tgt",
    "chars": 336,
    "preview": "40\ntargetIdent\n0\nMProject\n1\nMComponent\n0\n2\nWString\n3\nEXE\n3\nWString\n5\nde6en\n1\n0\n1\n4\nMCommand\n0\n5\nMCommand\n0\n6\nMItem\n12\nsw"
  },
  {
    "path": "switcher/switcher.wpj",
    "chars": 199,
    "preview": "40\nprojectIdent\n0\nVpeMain\n1\nWRect\n0\n0\n7680\n9178\n2\nMProject\n3\nMCommand\n0\n4\nMCommand\n0\n1\n5\nWFileName\n12\nswitcher.tgt\n6\nWVL"
  },
  {
    "path": "thread16.asm",
    "chars": 1066,
    "preview": "USE16\n\nmacro thread16header sts,sto\n{\n\tdb 4096 dup (144) ; // fill NOPs\n\t\n\t; Load IDT\n\tCLI\n\tmov di,DATA16\n\tmov ds,di\n\tli"
  },
  {
    "path": "thread32.asm",
    "chars": 667,
    "preview": "USE16 \n\nmacro thread32header ofs,seg\n{\n\tUSE16 \n\t; Remember CPU starts in real mode\n\tdb 4096 dup (144) ; // fill NOPs\n\n\t;"
  },
  {
    "path": "thread64.asm",
    "chars": 214,
    "preview": "USE16 \ninclude 'directlong.asm'\n\nThread64_1:\n\n\tthread64header\n\tdb 066h\n\tdb 0eah\n\tThread64Ptr2 dd 0\n\tdw code64_idx\n\n\n\tUSE"
  },
  {
    "path": "unreal.asm",
    "chars": 652,
    "preview": "USE16\n\n; Leaves FS in unreal mode\nEnterUnreal:\n    cli\n\tPUSHAD\n\tMOV AX,DATA16\t\n\tMOV FS,AX\n\tlinear eax,0,CODE16\n\tmov     "
  },
  {
    "path": "vbox.vbox-prev",
    "chars": 2671,
    "preview": "<?xml version=\"1.0\"?>\n<!--\n** DO NOT EDIT THIS FILE.\n** If you make changes to this file while any VirtualBox related ap"
  },
  {
    "path": "vdebug.asm",
    "chars": 1694,
    "preview": "FORMAT MZ\nHEAP 0\n\ninclude 'config.asm'\ninclude 'struct.asm' \n   \n\n\n; stack\nsegment STACK16\nUSE16 \n\ndw 128 dup(0)\nstre:\n\n"
  },
  {
    "path": "vdebug64.asm",
    "chars": 1529,
    "preview": "segment V\nUSE16\n\nfirstcall db 0\n\nve:\n\tmov ax,DATA16\n\tmov ds,ax\n\tmov ax,[bbb.sp]\n\tmov sp,ax\n\tmov ax,[bbb.ss]\n\tmov ss,ax\n\t"
  },
  {
    "path": "vdisplay.asm",
    "chars": 7945,
    "preview": "\n\ndisp64:\n\tpush rax\n\tshr rax,32\n\tcall disp32\n\tpop rax\ndisp32:\n\tpush rax\n\tshr eax,16\n\tcall disp16\n\tpop rax\ndisp16:\n\tpush "
  },
  {
    "path": "vm.vmsd",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "vm.vmx",
    "chars": 2122,
    "preview": ".encoding = \"UTF-8\"\nconfig.version = \"8\"\nvirtualHW.version = \"12\"\nnumvcpus = \"8\"\ncpuid.coresPerSocket = \"1\"\nscsi0.presen"
  },
  {
    "path": "vm.vmxf",
    "chars": 257,
    "preview": "<?xml version=\"1.0\"?>\n<Foundry>\n<VM>\n<VMId type=\"string\">52 02 53 21 5d ef 94 b8-dc 4b 85 9c d9 6d f4 1b</VMId>\n<ClientM"
  },
  {
    "path": "vmxhost64.asm",
    "chars": 11375,
    "preview": "USE64\n\n; https://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-v"
  }
]

// ... and 11 more files (download for full content)

About this extraction

This page contains the full source code of the WindowsNT/asm GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 162 files (1.1 MB), approximately 391.6k tokens, and a symbol index with 142 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!