;;; -*-asm-*- ;;; ;;; s16struc.inc - the declaration of S16_InfoBlock ;;; ;;; Defines the System16 Info Block which contains critical data for the ;;; v2os-system ;;; ;;; my commenting style is weird but caused by emacs asm-mode. ;;; i'd be glad to use some other asm-mode, cause this one isn't perfect. ;;; but as far as i don't have any other i'd use three semicolons for ;;; leftaligned comments. ;;; ;;; well, what's .inc and what's .asm? ;;; ;;; .inc or is the file to be included in different others files (.incs or ;;; .asms) usually .inc file contains only definitions of various ;;; constants, macros and strucs, although sometimes it could contain ;;; data or even code to be assembled (some module or application header ;;; file?) ;;; ;;; .asm is file to be assembled, i.e. file wich contains instructions and ;;; data which would appear in the binary file. ;;; ;;; splitting this (and others) structure definition into two files let us use ;;; .inc file in other V2_OS projects. ;;; ;;; artm %ifndef __s16struc_inc__ %define __s16struc_inc__ ;; The world famous System16Infoblock, tada ! struc S16IB InitialJump: resd 1 ; in Joost's code there was a dummy byte here System16Sectors: resb 1 System32Sectors: resb 1 System16Addr: resd 1 System32Addr: resd 1 PM2RMPortalSeg: resw 1 PM2RMPortalOffs: resw 1 IDTLength: resw 1 IDTAddr: resd 1 GDTLength: resw 1 GDTAddr: resd 1 StackAddr: resd 1 StackSize: resd 1 System16FuncOffs: resw 1 System16FuncReturnAddr: resd 1 RealEAX: resd 1 RealEBX: resd 1 RealECX: resd 1 RealEDX: resd 1 RealESI: resd 1 RealEDI: resd 1 RealDS: resw 1 RealES: resw 1 RealFS: resw 1 KbArea: resd 1 BootupGDT: resw 1 GDTEntries: resw 1 DiskBufferSegment: resw 1 DiskBufferSize: resd 1 NumberOfDrives: resw 1 DiskInfoOffset: resw 1 FillWord: resw 1 BootDisk: resb 1 CMOSOffset: resd 1 AlignByte: resb 1 FoundCylinder: resd 1 FoundHead: resd 1 FoundSector: resd 1 PartListOffset: resw 1 NumberOfFloppies: resw 1 ModListOffset: resd 1 ModListSize: resd 1 ServerListOffset: resd 1 ServerListSize: resd 1 Counter: resd 1 PCIOK: resb 1 PCIChar: resb 1 PCIVerHi: resb 1 PCIVerLo: resb 1 PCIHiBus: resb 1 TimerCounter: resb 1 CursorBlink: resb 1 PCEmulator: resb 1 ExtMem: resd 1 VideoSegment: resw 1 VideoAddr: resd 1 VideoPort: resw 1 VideoRow: resw 1 VideoCol: resw 1 ReturnCode: resb 1 MemoryTop_Lo: resd 1 ; VP MemoryTop_Hi: resd 1 ; VP BootPart: resb 1 endstruc ;;; macros for simple access to System16InfoBlock: ;;; ;;; in System16 itself infoblock is in segment selected by ds, ;;; the origin of info block is symbol System16InfoBlock ;;; ;;; in other modules (in 32bit pmode) info block is accessed ;;; by its absolute address so you need to use a segment register ;;; which selects a segment with base address 0 and big enough limit ;;; (e.g. gs, which in v2_os contains 4Gb segment with zero base) ;;; ;;; the macros itself returns offset, if you want to access the field ;;; itself you shoud write something like: ;;; ;;; mov [GetS16IB(TimerCounter)],100h ; (in System16) ;;; ;;; or ;;; ;;; mov [gs:GetS16IB(TimerCounter)],100h ; (in the program) %ifdef __system16__ %define GetS16IB(field) System16InfoBlock + field %else %define GetS16IB(field) 600h + field %endif %endif