1 ; **************************************************************************** 2 ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.10 3 ; ---------------------------------------------------------------------------- 4 ; Last Update: 10/02/2026 (Previous: 10/01/2026) 5 ; ---------------------------------------------------------------------------- 6 ; Beginning: 04/01/2016 7 ; ---------------------------------------------------------------------------- 8 ; Assembler: NASM version 2.15 (trdos386.s) 9 ; ---------------------------------------------------------------------------- 10 ; Turkish Rational DOS 11 ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 ; 13 ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 ; unix386.s (03/01/2016) 15 ; 16 ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 17 ; TRDOS2.ASM (09/11/2011) 18 ; 19 ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 20 ; **************************************************************************** 21 ; nasm trdos386.s -l trdos386.txt -o TRDOS386.SYS 22 23 KLOAD equ 10000h ; Kernel loading address 24 ; NOTE: Retro UNIX 8086 v1 boot code loads kernel at 1000h:0000h 25 KCODE equ 08h ; Code segment descriptor (ring 0) 26 KDATA equ 10h ; Data segment descriptor (ring 0) 27 ; 19/03/2015 28 UCODE equ 1Bh ; 18h + 3h (ring 3) 29 UDATA equ 23h ; 20h + 3h (ring 3) 30 ; 24/03/2015 31 TSS equ 28h ; Task state segment descriptor (ring 0) 32 ; 19/03/2015 33 CORE equ 400000h ; Start of USER's virtual/linear address space 34 ; (at the end of the 1st 4MB) 35 ECORE equ 0FFC00000h ; End of USER's virtual address space (4GB - 4MB) 36 ; ULIMIT = (ECORE/4096) - 1 = 0FFBFFh (in GDT) 37 ;; 27/12/2013 38 ;KEND equ KLOAD + 65536 ; (28/12/2013) (end of kernel space) 39 ; 04/07/2016 40 KEND equ KERNELFSIZE + KLOAD 41 42 ; IBM PC/AT BIOS ----- 10/06/85 (postequ.inc) 43 ;--------- CMOS TABLE LOCATION ADDRESS'S ------------------------------------- 44 CMOS_SECONDS EQU 00H ; SECONDS (BCD) 45 CMOS_SEC_ALARM EQU 01H ; SECONDS ALARM (BCD) 46 CMOS_MINUTES EQU 02H ; MINUTES (BCD) 47 CMOS_MIN_ALARM EQU 03H ; MINUTES ALARM (BCD) 48 CMOS_HOURS EQU 04H ; HOURS (BCD 49 CMOS_HR_ALARM EQU 05H ; HOURS ALARM (BCD) 50 CMOS_DAY_WEEK EQU 06H ; DAY OF THE WEEK (BCD) 51 CMOS_DAY_MONTH EQU 07H ; DAY OF THE MONTH (BCD) 52 CMOS_MONTH EQU 08H ; MONTH (BCD) 53 CMOS_YEAR EQU 09H ; YEAR (TWO DIGITS) (BCD) 54 CMOS_CENTURY EQU 32H ; DATE CENTURY BYTE (BCD) 55 CMOS_REG_A EQU 0AH ; STATUS REGISTER A 56 CMOS_REG_B EQU 0BH ; STATUS REGISTER B ALARM 57 CMOS_REG_C EQU 0CH ; STATUS REGISTER C FLAGS 58 CMOS_REG_D EQU 0DH ; STATUS REGISTER D BATTERY 59 CMOS_SHUT_DOWN EQU 0FH ; SHUTDOWN STATUS COMMAND BYTE 60 ;---------------------------------------- 61 ; CMOS EQUATES FOR THIS SYSTEM ; 62 ;----------------------------------------------------------------------------- 63 CMOS_PORT EQU 070H ; I/O ADDRESS OF CMOS ADDRESS PORT 64 CMOS_DATA EQU 071H ; I/O ADDRESS OF CMOS DATA PORT 65 NMI EQU 10000000B ; DISABLE NMI INTERRUPTS MASK - 66 ; HIGH BIT OF CMOS LOCATION ADDRESS 67 68 ; Memory Allocation Table Address 69 ; 05/11/2014 70 ; 31/10/2014 71 MEM_ALLOC_TBL equ 100000h ; Memory Allocation Table at the end of 72 ; the 1st 1 MB memory space. 73 ; (This address must be aligned 74 ; on 128 KB boundary, if it will be 75 ; changed later.) 76 ; ((lower 17 bits of 32 bit M.A.T. 77 ; address must be ZERO)). 78 ; ((((Reason: 32 bit allocation 79 ; instructions, dword steps))) 80 ; (((byte >> 12 --> page >> 5))) 81 ;04/11/2014 82 PDE_A_PRESENT equ 1 ; Present flag for PDE 83 PDE_A_WRITE equ 2 ; Writable (write permission) flag 84 PDE_A_USER equ 4 ; User (non-system/kernel) page flag 85 ; 86 PTE_A_PRESENT equ 1 ; Present flag for PTE (bit 0) 87 PTE_A_WRITE equ 2 ; Writable (write permission) flag (bit 1) 88 PTE_A_USER equ 4 ; User (non-system/kernel) page flag (bit 2) 89 PTE_A_ACCESS equ 32 ; Accessed flag (bit 5) ; 09/03/2015 90 91 ; 17/02/2015 (unix386.s) 92 ; 10/12/2014 - 30/12/2014 (0B000h -> 9000h) (dsectrm2.s) 93 DPT_SEGM equ 09000h ; FDPT segment (EDD v1.1, EDD v3) 94 ; 95 HD0_DPT equ 0 ; Disk parameter table address for hd0 96 HD1_DPT equ 32 ; Disk parameter table address for hd1 97 HD2_DPT equ 64 ; Disk parameter table address for hd2 98 HD3_DPT equ 96 ; Disk parameter table address for hd3 99 100 ; 15/11/2020 101 VBE3INFOSEG equ 97E0h ; 512 bytes before Video_Pg_Backup 102 ; 15/12/2020 103 VBE3MODEINFOSEG equ 97C0h ; 512 bytes before VBE3INFOBLOCK 104 105 ; 29/11/2020 106 VBE3INFOBLOCK equ 97E00h ; linear address (512 bytes) 107 VBE3MODEINFOBLOCK equ 97C00h ; linear address (256 bytes) 108 VBE3SAVERESTOREBLOCK equ 97600h ; linear address (2048 bytes) 109 VBE3CRTCINFOBLOCK equ 97D80h ; linear address (64 bytes) ; 17/01/2021 110 VBE3BIOSDATABLOCK equ 97000h ; linear address (1536 bytes) 111 VBE3STACKADDR equ 96000h ; linear address (1024 bytes) 112 ; VBE3 32 bit Protected Mode Interface (16 bit) Selectors (in GDT) 113 VBE3CS equ 30h ; _vbe3_CS: 114 VBE3BDS equ 38h ; _vbe3_BDS: 115 VBE3A000 equ 40h ; _A0000Sel: 116 VBE3B000 equ 48h ; _B0000Sel: 117 VBE3B800 equ 50h ; _B8000Sel: 118 VBE3DS equ 58h ; _vbe3_DS: 119 VBE3SS equ 60h ; _vbe3_SS: 120 VBE3ES equ 68h ; _vbe3_ES: 121 KCODE16 equ 70h ; _16bit_CS: 122 ; 14/01/2021 123 ; 06/12/2020 124 VBE3VIDEOSTATE equ 95800h ; 2048 bytes 125 ; 05/01/2021 126 VGAFONT16USER equ 94000h ; 8x16 pixels user font (256 chars) 127 ; (reserved/allocated font space: 4096 bytes) 128 129 VGAFONT8USER equ 95000h ; 8x8 pixels user font (256 chars) 130 ; (reserved/allocated font space: 2048 bytes) 131 ; 17/01/2021 132 ; temporary (initial) location for EDID information 133 VBE3EDIDINFOBLOCK equ 97D00h ; linear address (128 bytes) 134 135 ; FDPT (Phoenix, Enhanced Disk Drive Specification v1.1, v3.0) 136 ; (HDPT: Programmer's Guide to the AMIBIOS, 1993) 137 ; 138 FDPT_CYLS equ 0 ; 1 word, number of cylinders 139 FDPT_HDS equ 2 ; 1 byte, number of heads 140 FDPT_TT equ 3 ; 1 byte, A0h = translated FDPT with logical values 141 ; otherwise it is standard FDPT with physical values 142 FDPT_PCMP equ 5 ; 1 word, starting write precompensation cylinder 143 ; (obsolete for IDE/ATA drives) 144 FDPT_CB equ 8 ; 1 byte, drive control byte 145 ; Bits 7-6 : Enable or disable retries (00h = enable) 146 ; Bit 5 : 1 = Defect map is located at last cyl. + 1 147 ; Bit 4 : Reserved. Always 0 148 ; Bit 3 : Set to 1 if more than 8 heads 149 ; Bit 2-0 : Reserved. Always 0 150 FDPT_LZ equ 12 ; 1 word, landing zone (obsolete for IDE/ATA drives) 151 FDPT_SPT equ 14 ; 1 byte, sectors per track 152 153 ; Floppy Drive Parameters Table (Programmer's Guide to the AMIBIOS, 1993) 154 ; (11 bytes long) will be used by diskette handler/bios 155 ; which is derived from IBM PC-AT BIOS (DISKETTE.ASM, 21/04/1986). 156 157 ; 01/02/2016 158 Logical_DOSDisks equ 90000h + 100h ; 26*256 = 6656 bytes 159 Directory_Buffer equ 80000h ; max = 64K Bytes 160 FAT_Buffer equ 91C00h ; 1536 bytes (3 sectors) 161 ; 15/02/2016 162 Cluster_Buffer equ 70000h ; max = 64K Bytes ; buffer for file read & write 163 ; 11/04/2016 164 Env_Page equ 93000h ; 512 bytes (4096 bytes) 165 Env_Page_Size equ 512 ; (4096 bytes) 166 ; 30/07/2016 167 Video_Pg_Backup equ 98000h ; Mode 3h, video page backup (32K, 8 pages) 168 169 ; 29/11/2020 170 ; Free/Reserved memory blocks (in 1st 1MB): 93200h to 96000h (available) 171 ; 06/12/2020 172 ; Free/Reserved memory blocks (in 1st 1MB): 93200h to 95800h (available) 173 174 ; 15/12/2020 175 LFB_ADDR equ LFB_Info+LFBINFO.LFB_addr 176 LFB_SIZE equ LFB_Info+LFBINFO.LFB_size 177 178 ; 04/12/2023 - TRDOS 386 v2.0.7 179 SYSTEMSTACK_ADDR equ 97000h ; max. 3072 bytes (96400h-97000h) 180 VBE3BIOSCODE_ADDR equ 60000h ; Protected Mode Video Bios (64KB) 181 ;AC97DMABUFFR_ADDR equ 40000h ; AC97 & VIA VT8233 DMA Buffer (128KB) 182 SB16DMABUFFR_ADDR equ 50000h ; Sound Blaster 16 DMA Buffer (64KB) 183 sb16_dma_buffer equ SB16DMABUFFR_ADDR 184 185 ; 29/08/2023 - TRDOS 386 v2.0.6 186 ; 30/11/2020 187 ; 29/11/2020 - TRDOS 386 v2.0.3 188 189 struc PMInfo ; VESA VBE3 PMInfoBlock ('PMID' block) 190 191 00000000 ???????? .Signature: resb 4 ; db 'PMID' ; PM Info Block Signature 192 00000004 ???? .EntryPoint: resw 1 ; Offset of PM entry point within BIOS 193 00000006 ???? .PMInitialize: resw 1 ; Offset of PM initialization entry point 194 00000008 ???? .BIOSDataSel: resw 1 ; Selector to BIOS data area emulation block 195 0000000A ???? .A0000Sel: resw 1 ; Selector to access A0000h physical mem 196 0000000C ???? .B0000Sel: resw 1 ; Selector to access B0000h physical mem 197 0000000E ???? .B8000Sel: resw 1 ; Selector to access B8000h physical mem 198 00000010 ???? .CodeSegSel: resw 1 ; Selector to access code segment as data 199 00000012 ?? .InProtectMode: resb 1 ; Set to 1 when in protected mode 200 00000013 ?? .Checksum: resb 1 ; Checksum byte for structure 201 .size: 202 203 endstruc 204 205 [BITS 16] ; We need 16-bit intructions for Real mode 206 207 [ORG 0] 208 ; 12/11/2014 209 ; Save boot drive number (that is default root drive) 210 00000000 8816[8866] mov [boot_drv], dl ; physical drv number 211 212 ; Determine installed memory 213 ; 31/10/2014 214 ; 215 00000004 B801E8 mov ax, 0E801h ; Get memory size 216 00000007 CD15 int 15h ; for large configurations 217 00000009 7308 jnc short chk_ms 218 0000000B B488 mov ah, 88h ; Get extended memory size 219 0000000D CD15 int 15h 220 ; 221 ;mov al, 17h ; Extended memory (1K blocks) low byte 222 ;out 70h, al ; select CMOS register 223 ;in al, 71h ; read data (1 byte) 224 ;mov cl, al 225 ;mov al, 18h ; Extended memory (1K blocks) high byte 226 ;out 70h, al ; select CMOS register 227 ;in al, 71h ; read data (1 byte) 228 ;mov ch, al 229 ; 230 0000000F 89C1 mov cx, ax 231 00000011 31D2 xor dx, dx 232 chk_ms: 233 00000013 890E[8466] mov [mem_1m_1k], cx 234 00000017 8916[8666] mov [mem_16m_64k], dx 235 ; 24/11/2023 236 0000001B 8916[0E0F] mov [real_mem_16m_64k], dx 237 238 ; 05/11/2014 239 ;and dx, dx 240 ;jz short L2 241 0000001F 81F90004 cmp cx, 1024 242 ;jnb short L0 243 00000023 7351 jnb short V0 ; 14/11/2020 244 ; insufficient memory_error 245 ; Minimum 2 MB memory is needed... 246 ; 05/11/2014 247 ; (real mode error printing) 248 00000025 FB sti 249 00000026 BE[3A00] mov si, msg_out_of_memory 250 00000029 BB0700 mov bx, 7 251 0000002C B40E mov ah, 0Eh ; write tty 252 oom_1: 253 0000002E AC lodsb 254 0000002F 08C0 or al, al 255 00000031 7404 jz short oom_2 256 00000033 CD10 int 10h 257 00000035 EBF7 jmp short oom_1 258 oom_2: 259 00000037 F4 hlt 260 00000038 EBFD jmp short oom_2 261 262 ; 20/02/2017 263 ; 05/11/2014 264 msg_out_of_memory: 265 0000003A 070D0A db 07h, 0Dh, 0Ah 266 0000003D 496E73756666696369- db 'Insufficient memory !' 266 00000046 656E74206D656D6F72- 266 0000004F 792021 267 00000052 0D0A db 0Dh, 0Ah 268 _int13h_48h_buffer: ; 07/07/2016 269 00000054 284D696E696D756D20- db '(Minimum 2MB memory is needed.)' 269 0000005D 324D42206D656D6F72- 269 00000066 79206973206E656564- 269 0000006F 65642E29 270 00000073 0D0A00 db 0Dh, 0Ah, 0 271 V0: 272 ; 18/10/2023 - TRDOS 386 v2.0.7 273 ; set video mode to 03h again 274 ; (to reset video bios data in ROMBIOS DATA AREA) 275 00000076 B80300 mov ax, 3 276 00000079 CD10 int 10h 277 ; copy IVT and ROMBIOS DATA AREA to VBE3 BIOS data area 278 0000007B BF0097 mov di, VBE3BIOSDATABLOCK>>4 279 0000007E 8EC7 mov es, di 280 00000080 31F6 xor si, si 281 00000082 31FF xor di, di 282 00000084 8EDE mov ds, si ; 0 283 00000086 B90003 mov cx, 300h ; 600h / 2 284 00000089 F3A5 rep movsw 285 0000008B 0E push cs 286 0000008C 1F pop ds 287 288 ; 24/11/2023 289 ; 15/12/2020 290 ;mov si, [mem_16m_64k] 291 ;mov [real_mem_16m_64k], si 292 293 ; 15/11/2020 294 ; 14/11/2020 (TRDOS 386 v2.0.3) 295 ; check VESA (VBE) VIDEO BIOS version 296 297 0000008D B8034F mov ax, 4F03h ; Return current VBE mode 298 00000090 CD10 int 10h 299 00000092 83F84F cmp ax, 004Fh ; successful (vbe) function call 300 ;jne short L0 ; not a VESA VBE compatible bios 301 ; 18/10/2023 302 00000095 7561 jne short V1 ; restore es 303 304 ; 27/11/2023 305 ; 24/11/2023 - temporary 306 ;jmp short V1 307 308 ;mov ah, 3 309 ;;jmp short V1 310 311 ; 15/11/2020 312 00000097 BBE097 mov bx, VBE3INFOSEG ; 97E0h for current version 313 0000009A 8EC3 mov es, bx 314 0000009C 31FF xor di, di 315 0000009E 2666C70556424532 mov dword [es:di], 'VBE2' ; request VESA VBE3 info 316 ; es:di = buffer address (512 bytes) 317 ;mov ax, 4F00h ; Return VBE controller information 318 000000A6 86C4 xchg al, ah 319 000000A8 CD10 int 10h 320 321 ; dx = cs 322 ; es = VBE3INFOSEG (97E0h) 323 ; di = 0 324 ; ss = (endofkernelfile/16)+16 325 ; sp = 0FFFEh 326 327 000000AA 83F84F cmp ax, 004Fh 328 000000AD 7549 jne short V1 ; old vga bios (not VESA compatible) 329 330 ; 15/11/2020 331 000000AF 2666813D56455341 cmp dword [es:di], 'VESA' 332 000000B7 753F jne short V1 333 334 ;mov ax, [es:di+4] 335 ; ; ax = vbe version in BCD format (0200h or 0300h) 336 ;mov [vbe3], ah ; version number (major) 337 338 ; 15/11/2020 339 000000B9 268A4505 mov al, [es:di+5] 340 ; al = high byte of VBE version number (02h or 03h) 341 342 000000BD A2[7C09] mov [vbe3], al ; version number (major) 343 ; 02h or 03h is expected 344 ; 17/01/2021 345 ; Read EDID 346 000000C0 B301 mov bl, 01h ; Read EDID 347 000000C2 31C9 xor cx, cx ; Controller unit number 348 ; (00 = primary controller) 349 000000C4 31D2 xor dx, dx ; EDID block number = 0 350 000000C6 B8C097 mov ax, VBE3MODEINFOSEG ; 97C0h for current version 351 000000C9 8EC0 mov es, ax 352 000000CB BF0001 mov di, VBE3EDIDINFOBLOCK - VBE3MODEINFOBLOCK 353 ; es:di = temporary address of 128 bytes EDID information 354 000000CE B8154F mov ax, 4F15h ; VBE/DDC Services 355 000000D1 CD10 int 10h 356 ;cmp ax, 4Fh 357 ;jne short v2 358 000000D3 A2[1D42] mov [edid], al ; 4Fh > 0 359 ;V2: 360 ; 17/01/2021 361 000000D6 31FF xor di, di 362 ; 15/12/2020 363 ; Get linear frame buffer info (for VESA VBE mode 118h) 364 ;mov si, VBE3MODEINFOSEG ; 97C0h for current version 365 ;mov es, si 366 ; di = 0 367 000000D8 B91841 mov cx, 04118h ; 1024*768, 24 bpp, LFB 368 000000DB B8014F mov ax, 4F01h ; Return VBE mode information 369 000000DE CD10 int 10h 370 ;cmp ax, 4Fh 371 ;jne short V1 372 ; 19/12/2020 373 ;mov si, [es:di+MODEINFO.PhysBasePtr+2] 374 ; hw of LFB base address 375 ; MODEINFO structure starts from offset -2 376 000000E0 268B752A mov si, [es:di+MODEINFO.PhysBasePtr] ; hw of LFB addr 377 000000E4 8936[100F] mov [def_LFB_addr], si ; k_LFB_size = 3145728 bytes 378 000000E8 81EE0001 sub si, 256 379 380 ; 15/12/2020 381 ; check memory and decrease it to 3.5 GB if it is 4GB 382 ; (reserve upper memory for LFB) 383 000000EC 8B3E[8666] mov di, [mem_16m_64k] 384 ; 24/11/2023 385 ;mov [real_mem_16m_64k], di 386 387 000000F0 39F7 cmp di, si 388 000000F2 7604 jna short V1 389 390 000000F4 8936[8666] mov [mem_16m_64k], si 391 392 ; VESA VBE3 video hardware 393 ; (example: NVIDIA GEFORCE FX550, 256 MB) 394 ; uses upper memory from 0D0000000h to 0DFFFFFFFh 395 396 ;;cmp di, 0CF00h ; 3328 MB - 16MB 397 ;jna short V1 ; <= 3328 MB memory, it is not required 398 ; decrease 399 ;cmp al, 3 400 ;jb short V2 401 ; VESA VBE 3 402 ;mov word [mem_16m_64k], 0CF00h ; 3328 MB - 16MB 403 ;jmp short V1 404 ;V2: 405 ; VESA VBE 2 406 ; Check Bochs/Qemu/VirtualBox Emulator 407 ; LFB base address: 0E0000000h 408 ;sub ax, ax ; 0 409 ;mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 410 ;out dx, ax ; VBE_DISPI_INDEX_ID register 411 ;inc dx 412 ;in ax, dx 413 ;and al, 0F0h 414 ;cmp ax, 0B0C0h 415 ;jne short V1 416 ; 417 ; BOCHS/QEMU/VIRTUALBOX 418 ;mov word [mem_16m_64k], 0DF00h ; 3584 MB - 16MB 419 V1: 420 000000F8 1E push ds 421 000000F9 07 pop es ; restore extra data segment 422 L0: 423 424 %include 'diskinit.s' ; 07/03/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - diskinit.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 09/08/2022 (Previous: 29/08/2020 - Kernel v2.0.4) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; diskinit.inc (10/07/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - DISKINIT.INC 20 <1> ; Last Modification: 12/07/2022 (Previous: 10/07/2015) 21 <1> 22 <1> ; DISK I/O SYSTEM INITIALIZATION - Erdogan Tan (Retro UNIX 386 v1 project) 23 <1> 24 <1> ; ///////// DISK I/O SYSTEM STRUCTURE INITIALIZATION /////////////// 25 <1> 26 <1> ; 09/08/2022 27 <1> ; 08/08/2022 28 <1> ; 14/07/2022 (TRDOS 386 v2.0.5) 29 <1> ; 12/07/2022 (Retro UNIX 386 v1.2) 30 <1> ; 29/08/2020 31 <1> ; 17/07/2020 32 <1> ; 14/07/2020 (TRDOS 386 v2.0.2) 33 <1> ; 10/12/2014 - 02/02/2015 - dsectrm2.s 34 <1> ;L0: 35 <1> ; 12/11/2014 (Retro UNIX 386 v1 - beginning) 36 <1> ; Detecting disk drives... (by help of ROM-BIOS) 37 000000FA BA7F00 <1> mov dx, 7Fh 38 <1> L1: 39 000000FD FEC2 <1> inc dl 40 000000FF B441 <1> mov ah, 41h ; Check extensions present 41 <1> ; Phoenix EDD v1.1 - EDD v3 42 00000101 BBAA55 <1> mov bx, 55AAh 43 00000104 CD13 <1> int 13h 44 00000106 721A <1> jc short L2 45 <1> 46 00000108 81FB55AA <1> cmp bx, 0AA55h 47 0000010C 7514 <1> jne short L2 48 0000010E FE06[8B66] <1> inc byte [hdc] ; count of hard disks (EDD present) 49 00000112 8816[8A66] <1> mov [last_drv], dl ; last hard disk number 50 00000116 BB[0E66] <1> mov bx, hd0_type - 80h 51 00000119 01D3 <1> add bx, dx 52 0000011B 880F <1> mov [bx], cl ; Interface support bit map in CX 53 <1> ; Bit 0 - 1, Fixed disk access subset ready 54 <1> ; Bit 1 - 1, Drv locking and ejecting ready 55 <1> ; Bit 2 - 1, Enhanced Disk Drive Support 56 <1> ; (EDD) ready (DPTE ready) 57 <1> ; Bit 3 - 1, 64bit extensions are present 58 <1> ; (EDD-3) 59 <1> ; Bit 4 to 15 - 0, Reserved 60 0000011D 80FA83 <1> cmp dl, 83h ; drive number < 83h 61 00000120 72DB <1> jb short L1 62 <1> L2: 63 <1> ; 23/11/2014 64 <1> ; 19/11/2014 65 00000122 30D2 <1> xor dl, dl ; 0 66 <1> ; 04/02/2016 (esi -> si) 67 00000124 BE[8C66] <1> mov si, fd0_type 68 <1> L3: 69 <1> ; 14/01/2015 70 00000127 8816[8966] <1> mov [drv], dl 71 <1> ; 72 0000012B B408 <1> mov ah, 08h ; Return drive parameters 73 0000012D CD13 <1> int 13h 74 0000012F 7210 <1> jc short L4 75 <1> ; BL = drive type (for floppy drives) 76 <1> ; DL = number of floppy drives 77 <1> ; 78 <1> ; ES:DI = Address of DPT from BIOS 79 <1> ; 80 00000131 881C <1> mov [si], bl ; Drive type 81 <1> ; 4 = 1.44 MB, 80 track, 3 1/2" 82 <1> ; 14/01/2015 83 00000133 E8DD01 <1> call set_disk_parms 84 <1> ; 10/12/2014 85 00000136 81FE[8C66] <1> cmp si, fd0_type 86 0000013A 7705 <1> ja short L4 87 0000013C 46 <1> inc si ; fd1_type 88 0000013D B201 <1> mov dl, 1 89 0000013F EBE6 <1> jmp short L3 90 <1> L4: 91 00000141 B27F <1> mov dl, 7Fh 92 <1> ; 24/12/2014 93 00000143 803E[8B66]00 <1> cmp byte [hdc], 0 ; EDD present or not ? 94 <1> ;ja L10 ; yes, all fixed disk operations 95 <1> ; will be performed according to 96 <1> ; present EDD specification 97 <1> ; 14/07/2022 98 00000148 7603 <1> jna short L5 99 0000014A E98B00 <1> jmp L10 100 <1> 101 <1> L5: 102 <1> ; 17/07/2020 103 <1> ; Note: Virtual CPU will not come here while 104 <1> ; running in QEMU, Bochs, VirtualBox emulators !!! 105 <1> 106 <1> ; 17/07/2020 107 <1> ; Older BIOS (INT 13h, AH = 48h is not available) 108 <1> 109 0000014D FEC2 <1> inc dl 110 0000014F 8816[8966] <1> mov [drv], dl 111 00000153 8816[8A66] <1> mov [last_drv], dl ; 14/01/2015 112 00000157 B408 <1> mov ah, 08h ; Return drive parameters 113 00000159 CD13 <1> int 13h ; (conventional function) 114 <1> ;jc L13 ; fixed disk drive not ready 115 <1> ; 14/07/2022 116 0000015B 7303 <1> jnc short L6 117 0000015D E9A501 <1> jmp L13 118 <1> L6: 119 00000160 8816[8B66] <1> mov [hdc], dl ; number of drives 120 <1> ;; 14/01/2013 121 <1> ;;push cx 122 00000164 E8AC01 <1> call set_disk_parms 123 <1> ;;pop cx 124 <1> ; 125 <1> ;;and cl, 3Fh ; sectors per track (bits 0-6) 126 00000167 8A16[8966] <1> mov dl, [drv] 127 0000016B BB0401 <1> mov bx, 65*4 ; hd0 parameters table (INT 41h) 128 0000016E 80FA80 <1> cmp dl, 80h 129 00000171 7603 <1> jna short L7 130 00000173 83C314 <1> add bx, 5*4 ; hd1 parameters table (INT 46h) 131 <1> L7: 132 00000176 31C0 <1> xor ax, ax 133 00000178 8ED8 <1> mov ds, ax 134 0000017A 8B37 <1> mov si, [bx] 135 0000017C 8B4702 <1> mov ax, [bx+2] 136 0000017F 8ED8 <1> mov ds, ax 137 00000181 3A4C0E <1> cmp cl, [si+FDPT_SPT] ; sectors per track 138 <1> ;jne L12 ; invalid FDPT 139 <1> ; 14/07/2022 140 00000184 7403 <1> je short L7_8 141 00000186 E97801 <1> jmp L12 142 <1> L7_8: 143 00000189 BF0000 <1> mov di, HD0_DPT 144 0000018C 80FA80 <1> cmp dl, 80h 145 0000018F 7603 <1> jna short L8 146 00000191 BF2000 <1> mov di, HD1_DPT 147 <1> L8: 148 <1> ; 30/12/2014 149 00000194 B80090 <1> mov ax, DPT_SEGM 150 00000197 8EC0 <1> mov es, ax 151 <1> ; 24/12/2014 152 00000199 B90800 <1> mov cx, 8 153 0000019C F3A5 <1> rep movsw ; copy 16 bytes to the kernel's DPT location 154 0000019E 8CC8 <1> mov ax, cs 155 000001A0 8ED8 <1> mov ds, ax 156 <1> 157 <1> ; 02/02/2015 158 <1> ;mov cl, [drv] 159 <1> ;mov bl, cl 160 <1> ;mov ax, 1F0h 161 <1> ;and bl, 1 162 <1> ;jz short L9 163 <1> ;shl bl, 4 164 <1> ;sub ax, 1F0h-170h 165 <1> 166 <1> ; 17/07/2020 167 <1> ; (Only 1F0h port address must be valid for old ROM BIOSes) 168 000001A2 B8F001 <1> mov ax, 1F0h 169 000001A5 B3A0 <1> mov bl, 0A0h 170 000001A7 80FA80 <1> cmp dl, 80h 171 000001AA 7603 <1> jna short L9 172 <1> ; dl = 81h 173 000001AC 80C310 <1> add bl, 10h ; slave disk 174 <1> ;sub ax, 1F0h-170h 175 <1> L9: 176 000001AF AB <1> stosw ; I/O PORT Base Address (1F0h, 170h) 177 000001B0 050602 <1> add ax, 206h 178 000001B3 AB <1> stosw ; CONTROL PORT Address (3F6h, 376h) 179 000001B4 88D8 <1> mov al, bl ; bit 4, master/slave disk bit 180 <1> ;add al, 0A0h ; 17/07/2020 181 000001B6 AA <1> stosb ; Device/Head Register upper nibble 182 <1> ; 183 000001B7 FE06[8966] <1> inc byte [drv] 184 <1> ;mov bx, hd0_type - 80h 185 <1> ;add bx, cx 186 <1> ; 09/08/2022 - BugFix 187 000001BB 30FF <1> xor bh, bh 188 000001BD 88D3 <1> mov bl, dl 189 000001BF 81C3[0E66] <1> add bx, hd0_type - 80h 190 000001C3 800F80 <1> or byte [bx], 80h ; present sign (when lower nibble is 0) 191 000001C6 A0[8B66] <1> mov al, [hdc] 192 000001C9 FEC8 <1> dec al 193 <1> ;jz L13 194 <1> ; 14/07/2022 195 000001CB 7408 <1> jz short L9_10 196 000001CD 80FA80 <1> cmp dl, 80h 197 <1> ;jna L5 ; Max. 2 hard disks ; 17/07/2020 198 <1> ; 14/07/2022 199 000001D0 7703 <1> ja short L9_10 200 000001D2 E978FF <1> jmp L5 201 <1> L9_10: 202 000001D5 E92D01 <1> jmp L13 203 <1> L10: 204 000001D8 FEC2 <1> inc dl 205 <1> ; 25/12/2014 206 000001DA 8816[8966] <1> mov [drv], dl 207 000001DE B408 <1> mov ah, 08h ; Return drive parameters 208 000001E0 CD13 <1> int 13h ; (conventional function) 209 <1> ;jc L13 210 <1> ; 14/07/2022 211 000001E2 72F1 <1> jc short L9_10 212 <1> ; 14/01/2015 213 <1> ;mov dl, [drv] 214 <1> ; 09/08/2022 215 <1> ;push dx 216 000001E4 51 <1> push cx 217 000001E5 E82B01 <1> call set_disk_parms 218 000001E8 59 <1> pop cx 219 <1> ;pop dx 220 <1> ; 09/08/2022 221 000001E9 8A16[8966] <1> mov dl, [drv] 222 <1> ; 06/07/2016 (BugFix for >64K kernel files) 223 <1> ; 04/02/2016 (esi -> si) 224 <1> ;mov si, _end ; 30 byte temporary buffer address 225 <1> ; ; at the '_end' of kernel. 226 <1> ;mov word [si], 30 227 <1> ; 06/07/2016 228 000001ED BE[5400] <1> mov si, _int13h_48h_buffer 229 <1> ; 09/07/2016 230 000001F0 B81E00 <1> mov ax, 001Eh 231 000001F3 8824 <1> mov [si], ah ; 0 232 000001F5 46 <1> inc si 233 000001F6 8904 <1> mov [si], ax 234 <1> ; word [si] = 30 235 <1> ; 236 000001F8 B448 <1> mov ah, 48h ; Get drive parameters (EDD function) 237 000001FA CD13 <1> int 13h 238 <1> ;jc L13 239 <1> ; 14/07/2022 240 000001FC 72D7 <1> jc short L9_10 241 <1> 242 <1> ; 29/08/2020 243 <1> ; 04/02/2016 (ebx -> bx) 244 <1> ; 14/01/2015 245 000001FE 28FF <1> sub bh, bh 246 00000200 88D3 <1> mov bl, dl 247 <1> ;sub bl, 80h 248 <1> ; 29/08/2020 249 00000202 81C3[0E66] <1> add bx, (hd0_type - 80h) 250 <1> ;mov al, [bx] 251 00000206 8A07 <1> mov al, [bx] 252 00000208 0C80 <1> or al, 80h 253 0000020A 8807 <1> mov [bx], al 254 0000020C 81EB[8C66] <1> sub bx, hd0_type - 2 ; 15/01/2015 255 <1> ;add bx, drv.status 256 <1> ;mov [bx], al 257 <1> ; 29/08/2020 258 00000210 8887[AE66] <1> mov [bx+drv.status], al 259 <1> ; 04/02/2016 (eax -> ax) 260 <1> ;mov ax, [si+16] 261 <1> ; 14/07/2020 262 <1> ;mov di, [si+18] 263 <1> ;;test ax, [si+18] 264 <1> ;test ax, di ; 14/07/2020 265 <1> ;jz short L10_A0h ; (!) ; 17/07/2020 266 <1> ; 'CHS only' disks on EDD system 267 <1> ; are reported with ZERO disk size 268 <1> ; (if so, we must not overwrite 269 <1> ; calculated disk size in 'set_disk_parms') 270 <1> ; 29/08/2020 271 00000214 8B4410 <1> mov ax, [si+16] 272 00000217 8B7C12 <1> mov di, [si+18] 273 0000021A 09C0 <1> or ax, ax 274 0000021C 7504 <1> jnz short L10_LBA 275 0000021E 09FF <1> or di, di 276 00000220 740B <1> jz short L10_A0h 277 <1> L10_LBA: 278 <1> ;sub bx, drv.status 279 00000222 C1E302 <1> shl bx, 2 280 <1> ;add bx, drv.size ; disk size (in sectors) 281 <1> ;mov [bx], ax 282 <1> ; 29/08/2020 283 00000225 8987[9266] <1> mov [bx+drv.size], ax 284 <1> ;mov ax, [si+18] 285 <1> ;;mov [bx], ax 286 <1> ;mov [bx+2], ax ; BugFix ; 15/07/2020 287 <1> ; 14/07/2020 288 <1> ;mov [bx+2], di ; 15/07/2020 289 <1> ; 29/08/2020 290 00000229 89BF[9466] <1> mov [bx+drv.size+2], di 291 <1> L10_A0h: 292 <1> ; 17/07/2020 293 <1> ; Note: Virtual CPU will jump here from above (!) test 294 <1> ; while running in QEMU 295 <1> 296 <1> ; Jump here to fix a ZERO (LBA) disk size problem 297 <1> ; for CHS disks (28/02/2015) 298 <1> 299 <1> ; 30/12/2014 300 0000022D BF0000 <1> mov di, HD0_DPT 301 00000230 88D0 <1> mov al, dl 302 00000232 83E003 <1> and ax, 3 303 00000235 C0E005 <1> shl al, 5 ; * 32 304 00000238 01C7 <1> add di, ax 305 0000023A B80090 <1> mov ax, DPT_SEGM 306 0000023D 8EC0 <1> mov es, ax 307 <1> ; 308 0000023F 88E8 <1> mov al, ch ; max. cylinder number (bits 0-7) 309 00000241 88CC <1> mov ah, cl 310 00000243 C0EC06 <1> shr ah, 6 ; max. cylinder number (bits 8-9) 311 00000246 40 <1> inc ax ; logical cylinders (limit 1024) 312 00000247 AB <1> stosw 313 00000248 88F0 <1> mov al, dh ; max. head number 314 <1> ; 315 0000024A 30F6 <1> xor dh, dh ; 29/08/2020 (dh = 0 is needed here) 316 <1> ; 317 0000024C FEC0 <1> inc al 318 0000024E AA <1> stosb ; logical heads (limits 256) 319 0000024F B0A0 <1> mov al, 0A0h ; Indicates translated table 320 00000251 AA <1> stosb 321 00000252 8A440C <1> mov al, [si+12] 322 00000255 AA <1> stosb ; physical sectors per track 323 00000256 31C0 <1> xor ax, ax 324 <1> ;dec ax ; 02/01/2015 325 00000258 AB <1> stosw ; precompensation (obsolete) 326 <1> ;xor al, al ; 02/01/2015 327 00000259 AA <1> stosb ; reserved 328 0000025A B008 <1> mov al, 8 ; drive control byte 329 <1> ; (do not disable retries, 330 <1> ; more than 8 heads) 331 0000025C AA <1> stosb 332 0000025D 8B4404 <1> mov ax, [si+4] 333 00000260 AB <1> stosw ; physical number of cylinders 334 <1> ;push ax ; 02/01/2015 335 00000261 8A4408 <1> mov al, [si+8] 336 00000264 AA <1> stosb ; physical num. of heads (limit 16) 337 00000265 29C0 <1> sub ax, ax 338 <1> ;pop ax ; 02/01/2015 339 00000267 AB <1> stosw ; landing zone (obsolete) 340 00000268 88C8 <1> mov al, cl ; logical sectors per track (limit 63) 341 0000026A 243F <1> and al, 3Fh 342 0000026C AA <1> stosb 343 <1> ;sub al, al ; checksum 344 <1> ;stosb 345 <1> ; 346 0000026D 83C61A <1> add si, 26 ; (BIOS) DPTE address pointer 347 00000270 AD <1> lodsw 348 00000271 50 <1> push ax ; * ; (BIOS) DPTE offset 349 00000272 AD <1> lodsw 350 00000273 50 <1> push ax ; ** ; (BIOS) DPTE segment 351 <1> ; 352 <1> ; checksum calculation 353 00000274 89FE <1> mov si, di 354 00000276 06 <1> push es 355 00000277 1F <1> pop ds 356 <1> ;mov cx, 16 357 00000278 B90F00 <1> mov cx, 15 358 0000027B 29CE <1> sub si, cx 359 0000027D 30E4 <1> xor ah, ah 360 <1> ;del cl 361 <1> L11: 362 0000027F AC <1> lodsb 363 00000280 00C4 <1> add ah, al 364 00000282 E2FB <1> loop L11 365 <1> ; 366 00000284 88E0 <1> mov al, ah 367 00000286 F6D8 <1> neg al ; -x+x = 0 368 00000288 AA <1> stosb ; put checksum in byte 15 of the tbl 369 <1> ; 370 00000289 1F <1> pop ds ; ** ; (BIOS) DPTE segment 371 0000028A 5E <1> pop si ; * ; (BIOS) DPTE offset 372 <1> 373 <1> ; 08/08/2022 (TRDOS 386 v2.0.5) 374 <1> ; (Recent version of Retro UNIX 386 v1 'diskinit.s' file 375 <1> ; -12/07/2022- does not contain following 2020 code) (*) 376 <1> 377 <1> ; 14/07/2020 (TRDOS 386 v2.0.2) 378 <1> ; 0FFFFh:0FFFFh = invalid DPTE address 379 0000028B 8B0C <1> mov cx, [si] 380 0000028D 8B4402 <1> mov ax, [si+2] 381 00000290 21C1 <1> and cx, ax 382 00000292 41 <1> inc cx 383 00000293 7404 <1> jz short L11c ; 0FFFFh:0FFFFh 384 00000295 0B04 <1> or ax, [si] 385 00000297 752A <1> jnz short L11e ; <> 0 386 <1> L11c: 387 <1> ; 17/07/2020 388 <1> ; TRDOS 386 v2 DRVINIT assumptions: 389 <1> ; (also by regarding QEMU, Bochs and VirtualBox settings) 390 <1> ; Hard disk 0 port address: 1F0h 391 <1> ; Hard disk 1 port address: 1F0h 392 <1> ; Hard disk 2 port address: 170h 393 <1> ; Hard disk 3 port address: 170h 394 <1> 395 <1> ; in QEMU, hda=hd0 (1F0h) and hdb=hd1 (1F0h) -IRQ14- 396 <1> ; and hdc=hd2 (170h) and hdd=hd3 (170h) -IRQ15- 397 <1> 398 00000299 B8F001 <1> mov ax, 1F0h 399 <1> 400 <1> ; 15/07/2020 401 <1> ; 14/07/2020 402 <1> ; Invalid DPTE address... 403 <1> ; Default DPTE parms must be set for DISK_IO_CONT 404 <1> ; (diskio.s) 405 <1> ; 17/07/2020 406 <1> 407 <1> ;mov bl, dl 408 <1> ;and bl, 1 409 <1> ;jz short L11d 410 <1> 411 0000029C B3A0 <1> mov bl, 0A0h 412 <1> 413 0000029E F6C201 <1> test dl, 1 414 000002A1 7403 <1> jz short L11g ; Master (as default, for 80h & 82h)) 415 <1> ;shl bl, 4 ; bl = 16 (bit 4 = 1 -> slave) 416 000002A3 80C310 <1> add bl, 10h ; Slave (as default, for 81h & 83h) 417 <1> L11g: 418 <1> ; 17/07/2020 419 000002A6 80FA82 <1> cmp dl, 82h ; Hard disk 3 or 4 ? 420 000002A9 7203 <1> jb short L11d ; Primary ATA channel (hd0, hd1) 421 <1> ; (port address = 1F0h) 422 <1> 423 <1> ; Secondary ATA channel (hd2, hd3) 424 <1> ; (port address = 170h) 425 <1> 426 000002AB 2D8000 <1> sub ax, 1F0h-170h 427 <1> L11d: 428 <1> ; 14/07/2020 429 000002AE AB <1> stosw ; I/O PORT Base Address (1F0h, 170h) 430 000002AF 050602 <1> add ax, 206h 431 000002B2 AB <1> stosw ; CONTROL PORT Address (3F6h, 376h) 432 000002B3 88D8 <1> mov al, bl ; Master/Slave bit (0 = Master) 433 <1> ; 17/07/2020 434 <1> ;or al, 0A0h ; CHS (LBA enable bit = 0) 435 <1> ; (Bits 5&7, reserved bits = 1) 436 000002B5 30E4 <1> xor ah, ah 437 <1> ;stosb ; Device/Head Register upper nibble 438 000002B7 AB <1> stosw 439 000002B8 30C0 <1> xor al, al 440 000002BA B90500 <1> mov cx, 5 441 000002BD F3AB <1> rep stosw ; clear remain part of the (fake) DPTE 442 000002BF 0E <1> push cs 443 000002C0 1F <1> pop ds 444 000002C1 EB2E <1> jmp short L11f 445 <1> 446 <1> ; 08/08/2022 (TRDOS 386 v2.0.5) 447 <1> ; (Recent version of Retro UNIX 386 v1 'diskinit.s' file 448 <1> ; -12/07/2022- does not contain above 2020 code) (*) 449 <1> L11e: 450 <1> ; 23/02/2015 451 000002C3 57 <1> push di 452 <1> ; ES:DI points to DPTE (FDPTE) location 453 <1> ;;mov cx, 8 454 <1> ;mov cl, 8 455 000002C4 B90800 <1> mov cx, 8 ; 14/07/2020 456 000002C7 F3A5 <1> rep movsw 457 <1> ; 458 <1> ; 23/02/2015 459 <1> ; (P)ATA drive and LBA validation 460 <1> ; (invalidating SATA drives and setting 461 <1> ; CHS type I/O for old type fixed disks) 462 000002C9 5B <1> pop bx 463 000002CA 8CC8 <1> mov ax, cs 464 000002CC 8ED8 <1> mov ds, ax 465 000002CE 268B07 <1> mov ax, [es:bx] 466 000002D1 3DF001 <1> cmp ax, 1F0h 467 000002D4 7413 <1> je short L11a 468 000002D6 3D7001 <1> cmp ax, 170h 469 000002D9 740E <1> je short L11a 470 <1> ; invalidation 471 <1> ; (because base port address is not 1F0h or 170h) 472 <1> ;xor bh, bh 473 <1> ;mov bl, dl 474 <1> ; 29/08/2020 475 <1> ;xor dh, dh ; 0 476 000002DB 89D3 <1> mov bx, dx 477 <1> ;sub bl, 80h 478 <1> ;mov byte [bx+hd0_type], 0 ; not a valid disk drive ! 479 <1> ;or byte [bx+drv.status+2], 0F0h ; (failure sign) 480 <1> ; 29/08/2020 481 000002DD C687[0E66]00 <1> mov byte [bx+hd0_type-80h], 0 482 000002E2 808F[3066]F0 <1> or byte [bx+drv.status-7Eh], 0F0h 483 000002E7 EB0F <1> jmp short L11b 484 <1> L11a: 485 <1> ; LBA validation 486 000002E9 268A4704 <1> mov al, [es:bx+4] ; Head register upper nibble 487 000002ED A840 <1> test al, 40h ; LBA bit (bit 6) 488 000002EF 7507 <1> jnz short L11b ; LBA type I/O is OK! (E0h or F0h) 489 <1> L11f: 490 <1> ; force CHS type I/O for this drive (A0h or B0h) 491 <1> ;sub bh, bh 492 <1> ;mov bl, dl 493 <1> ; 29/08/2020 494 <1> ;xor dh, dh ; 0 495 000002F1 89D3 <1> mov bx, dx 496 <1> ;sub bl, 80h ; 26/02/2015 497 <1> ;and byte [bx+drv.status+2], 0FEh ; clear bit 0 498 <1> ; bit 0 = LBA ready bit 499 <1> ; 29/08/2020 500 000002F3 80A7[3066]FE <1> and byte [bx+drv.status-7Eh], 0FEh 501 <1> ; 'diskio' procedure will check this bit ! 502 <1> L11b: 503 000002F8 3A16[8A66] <1> cmp dl, [last_drv] ; 25/12/2014 504 000002FC 7307 <1> jnb short L13 505 000002FE E9D7FE <1> jmp L10 506 <1> 507 <1> L12: 508 <1> ; Restore data registers 509 00000301 8CC8 <1> mov ax, cs 510 00000303 8ED8 <1> mov ds, ax 511 <1> L13: 512 <1> ; 13/12/2014 513 00000305 0E <1> push cs 514 00000306 07 <1> pop es 515 <1> L14: 516 <1> ; clear keyboard buffer 517 00000307 B411 <1> mov ah, 11h 518 00000309 CD16 <1> int 16h 519 0000030B 7440 <1> jz short L16 ; no keys in keyboard buffer 520 0000030D B010 <1> mov al, 10h 521 0000030F CD16 <1> int 16h 522 00000311 EBF4 <1> jmp short L14 523 <1> 524 <1> set_disk_parms: 525 <1> ; 08/08/2022 - TRDOS 386 v2.0.5 526 <1> ; 09/05/2022 - Retro UNIX 386 v1.2 527 <1> ; 29/08/2020 - TRDOS 386 v2.0.2 528 <1> ; 04/02/2016 (ebx -> bx) 529 <1> ; 10/07/2015 530 <1> ; 14/01/2015 531 <1> ;push bx 532 00000313 28FF <1> sub bh, bh 533 00000315 8A1E[8966] <1> mov bl, [drv] 534 00000319 80FB80 <1> cmp bl, 80h 535 0000031C 7203 <1> jb short sdp0 536 0000031E 80EB7E <1> sub bl, 7Eh 537 <1> sdp0: 538 <1> ;add bx, drv.status 539 <1> ;mov byte [bx], 80h ; 'Present' flag 540 <1> ; 29/08/2020 541 00000321 C687[AE66]80 <1> mov byte [bx+drv.status], 80h 542 <1> ; 543 00000326 88E8 <1> mov al, ch ; last cylinder (bits 0-7) 544 00000328 88CC <1> mov ah, cl ; 545 0000032A C0EC06 <1> shr ah, 6 ; last cylinder (bits 8-9) 546 <1> ;sub bx, drv.status 547 0000032D D0E3 <1> shl bl, 1 548 <1> ;add bx, drv.cylinders 549 0000032F 40 <1> inc ax ; convert max. cyl number to cyl count 550 <1> ;mov [bx], ax 551 <1> ; 08/08/2022 552 <1> ; 29/08/2020 553 <1> ;mov [bx+drv.cylinders], ax 554 <1> ; 555 00000330 50 <1> push ax ; ** cylinders 556 <1> ;sub bx, drv.cylinders 557 <1> ;add bx, drv.heads 558 00000331 30E4 <1> xor ah, ah 559 00000333 88F0 <1> mov al, dh ; heads 560 00000335 40 <1> inc ax 561 <1> ;mov [bx], ax 562 <1> ; 08/08/2022 563 <1> ; 29/08/2020 564 <1> ;mov [bx+drv.heads], ax 565 <1> ;sub bx, drv.heads 566 <1> ;add bx, drv.spt 567 00000336 30ED <1> xor ch, ch 568 00000338 80E13F <1> and cl, 3Fh ; sectors (bits 0-6) 569 <1> ;mov [bx], cx 570 <1> ; 08/08/2022 571 <1> ; 29/08/2020 572 <1> ;mov [bx+drv.spt], cx 573 <1> ;sub bx, drv.spt 574 0000033B D1E3 <1> shl bx, 1 575 <1> ;add bx, drv.size ; disk size (in sectors) 576 <1> ; LBA size = cylinders * heads * secpertrack 577 0000033D F7E1 <1> mul cx 578 0000033F 89C2 <1> mov dx, ax ; heads*spt 579 00000341 58 <1> pop ax ; ** cylinders 580 <1> ; 09/05/2022 (fd0&fd1 drv.size = cyls*spt*heads) 581 <1> ;dec ax ; 1 cylinder reserved (!?) ; (*) 582 00000342 F7E2 <1> mul dx ; cylinders * (heads*spt) 583 <1> ;mov [bx], ax 584 <1> ;mov [bx+2], dx 585 <1> ; 29/08/2020 586 00000344 8987[9266] <1> mov [bx+drv.size], ax 587 00000348 8997[9466] <1> mov [bx+drv.size+2], dx 588 <1> ; 589 <1> ;pop bx 590 0000034C C3 <1> retn 591 <1> 592 <1> L16: ; 28/05/2016 425 426 ; 10/11/2014 427 0000034D FA cli ; Disable interrupts (clear interrupt flag) 428 ; Reset Interrupt MASK Registers (Master&Slave) 429 ;mov al, 0FFh ; mask off all interrupts 430 ;out 21h, al ; on master PIC (8259) 431 ;jmp $+2 ; (delay) 432 ;out 0A1h, al ; on slave PIC (8259) 433 ; 434 ; Disable NMI 435 0000034E B080 mov al, 80h 436 00000350 E670 out 70h, al ; set bit 7 to 1 for disabling NMI 437 ;23/02/2015 438 ;nop ; 439 ;in al, 71h ; read in 71h just after writing out to 70h 440 ; for preventing unknown state (!?) 441 ; 442 ; 20/08/2014 443 ; Moving the kernel 64 KB back (to physical address 0) 444 ; DS = CS = 1000h 445 ; 05/11/2014 446 00000352 31C0 xor ax, ax 447 00000354 8EC0 mov es, ax ; ES = 0 448 ; 449 ; 04/07/2016 - TRDOS 386 (64K - 128K kernel) 450 00000356 31F6 xor si, si 451 00000358 31FF xor di, di 452 ;mov cx, 16384 453 ;rep movsd 454 ; 02/12/2023 455 0000035A B90080 mov cx, 32768 456 0000035D F3A5 rep movsw 457 ; 458 0000035F 06 push es ; 0 459 00000360 68[6403] push L17 460 00000363 CB retf 461 L17: 462 00000364 B90010 mov cx, 1000h 463 00000367 8EC1 mov es, cx ; 1000h 464 00000369 01C9 add cx, cx 465 0000036B 8ED9 mov ds, cx ; 2000h 466 ;sub si, si 467 ;sub di, di 468 ;mov cx, 16384 469 ;rep movsd 470 ; 02/12/2023 471 ; si = di = 0 472 0000036D B90080 mov cx, 32768 473 00000370 F3A5 rep movsw 474 475 ; Turn off the floppy drive motor 476 00000372 BAF203 mov dx, 3F2h 477 00000375 EE out dx, al ; 0 ; 31/12/2013 478 479 ; Enable access to memory above one megabyte 480 L18: 481 00000376 E464 in al, 64h 482 00000378 A802 test al, 2 483 0000037A 75FA jnz short L18 484 0000037C B0D1 mov al, 0D1h ; Write output port 485 0000037E E664 out 64h, al 486 L19: 487 00000380 E464 in al, 64h 488 00000382 A802 test al, 2 489 00000384 75FA jnz short L19 490 00000386 B0DF mov al, 0DFh ; Enable A20 line 491 00000388 E660 out 60h, al 492 ;L20: 493 ; 494 ; Load global descriptor table register 495 496 ;mov ax, cs 497 ;mov ds, ax 498 499 0000038A 2E0F0116[F865] lgdt [cs:gdtd] 500 501 00000390 0F20C0 mov eax, cr0 502 ;or al, 1 ; 24/07/2023 503 00000393 40 inc ax 504 00000394 0F22C0 mov cr0, eax 505 506 ; Jump to 32 bit code 507 508 00000397 66 db 66h ; Prefix for 32-bit 509 00000398 EA db 0EAh ; Opcode for far jump 510 00000399 [9F030000] dd StartPM ; Offset to start, 32-bit 511 ; (1000h:StartPM = StartPM + 10000h) 512 0000039D 0800 dw KCODE ; This is the selector for CODE32_DESCRIPTOR, 513 ; assuming that StartPM resides in code32 514 515 ; 20/02/2017 516 517 518 [BITS 32] 519 520 StartPM: 521 ; Kernel Base Address = 0 ; 30/12/2013 522 0000039F 66B81000 mov ax, KDATA ; Save data segment identifier 523 000003A3 8ED8 mov ds, ax ; Move a valid data segment into DS register 524 000003A5 8EC0 mov es, ax ; Move data segment into ES register 525 000003A7 8EE0 mov fs, ax ; Move data segment into FS register 526 000003A9 8EE8 mov gs, ax ; Move data segment into GS register 527 000003AB 8ED0 mov ss, ax ; Move data segment into SS register 528 ;mov esp, 90000h ; Move the stack pointer to 090000h 529 ; 04/12/2023 - TRDOS 386 v2.0.7 530 ;mov esp, 97000h ; 3072 bytes system stack (96400h-97000h) 531 000003AD BC00700900 mov esp, SYSTEMSTACK_ADDR ; 97000h (max. 3072 bytes) 532 533 clear_bss: ; Clear uninitialized data area 534 ; 11/03/2015 535 000003B2 31C0 xor eax, eax ; 0 536 000003B4 B97B0A0000 mov ecx, (bss_end - bss_start)/4 537 ;shr ecx, 2 ; bss section is already aligned for double words 538 000003B9 BF[C3730100] mov edi, bss_start 539 000003BE F3AB rep stosd 540 541 memory_init: 542 ; Initialize memory allocation table and page tables 543 ; 04/12/2023 544 ; 29/11/2023 545 ; 27/11/2023 546 ; 23/11/2023 (TRDOS 386 v2.0.7) 547 ; 24/07/2022 (TRDOS 386 v2.0.5) 548 ; 18/04/2021 (TRDOS 386 v2.0.4) 549 ; 16/11/2014 550 ; 15/11/2014 551 ; 07/11/2014 552 ; 06/11/2014 553 ; 05/11/2014 554 ; 04/11/2014 555 ; 31/10/2014 (Retro UNIX 386 v1 - Beginning) 556 ; 557 ; xor eax, eax 558 ; xor ecx, ecx 559 000003C0 B108 mov cl, 8 560 000003C2 BF00001000 mov edi, MEM_ALLOC_TBL 561 000003C7 F3AB rep stosd ; clear Memory Allocation Table 562 ; for the first 1 MB memory 563 ; 564 000003C9 668B0D[84660000] mov cx, [mem_1m_1k] ; Number of contiguous KB between 565 ; 1 and 16 MB, max. 3C00h = 15 MB. 566 ;shr cx, 2 ; convert 1 KB count to 4 KB count 567 ; 24/07/2022 568 000003D0 C1E902 shr ecx, 2 569 000003D3 890D[B8760100] mov [free_pages], ecx 570 000003D9 668B15[86660000] mov dx, [mem_16m_64k] ; Number of contiguous 64 KB blocks 571 ; between 16 MB and 4 GB. 572 000003E0 6609D2 or dx, dx 573 000003E3 741A jz short mi_0 574 575 ; 09/02/2026 576 ; 04/12/2023 577 %if 0 578 ; 02/12/2023 - temporary (2816MB limit) 579 ;cmp dx, 44800 ; 0AF00h 580 cmp dx, 40704 ; (2560MB limit) 581 jna short mi_x 582 ;mov dx, 44800 583 mov dx, 40704 584 mi_x: 585 %endif 586 ; 23/11/2023 - temporary 587 ;and dx, 3FFFh 588 589 000003E5 668915[86660000] mov [mem_16m_64k], dx 590 591 000003EC 6689D0 mov ax, dx 592 000003EF C1E004 shl eax, 4 ; 64 KB -> 4 KB (page count) 593 000003F2 0105[B8760100] add [free_pages], eax 594 000003F8 0500100000 add eax, 4096 ; 16 MB = 4096 pages 595 000003FD EB06 jmp short mi_1 596 mi_0: 597 ;mov ax, cx 598 ; 24/07/2022 599 000003FF 89C8 mov eax, ecx 600 00000401 66050001 add ax, 256 ; add 256 pages for the first 1 MB 601 ;add eax, 256 602 mi_1: 603 00000405 A3[B4760100] mov [memory_size], eax ; Total available memory in pages 604 ; 1 alloc. tbl. bit = 1 memory page 605 ; 32 allocation bits = 32 mem. pages 606 ; 607 0000040A 05FF7F0000 add eax, 32767 ; 32768 memory pages per 1 M.A.T. page 608 0000040F C1E80F shr eax, 15 ; ((32768 * x) + y) pages (y < 32768) 609 ; --> x + 1 M.A.T. pages, if y > 0 610 ; --> x M.A.T. pages, if y = 0 611 00000412 66A3[C8760100] mov [mat_size], ax ; Memory Alloc. Table Size in pages 612 00000418 C1E00C shl eax, 12 ; 1 M.A.T. page = 4096 bytes 613 ; ; Max. 32 M.A.T. pages (4 GB memory) 614 0000041B 89C3 mov ebx, eax ; M.A.T. size in bytes 615 ; Set/Calculate Kernel's Page Directory Address 616 0000041D 81C300001000 add ebx, MEM_ALLOC_TBL 617 00000423 891D[B0760100] mov [k_page_dir], ebx ; Kernel's Page Directory address 618 ; just after the last M.A.T. page 619 ; 620 00000429 83E804 sub eax, 4 ; convert M.A.T. size to offset value 621 0000042C A3[C0760100] mov [last_page], eax ; last page offset in the M.A.T. 622 ; ; (allocation status search must be 623 ; stopped after here) 624 00000431 31C0 xor eax, eax 625 00000433 48 dec eax ; FFFFFFFFh (set all bits to 1) 626 ;push cx 627 ; 18/04/2021 628 00000434 51 push ecx 629 ; ecx = 3840 ; 27/11/2023 630 ; (Note: ecx < 3840 if the total memory is less than 16 MB) 631 00000435 C1E905 shr ecx, 5 ; convert 1 - 16 MB page count to 632 ; count of 32 allocation bits 633 ; ecx = 120 ; 27/11/2023 634 00000438 F3AB rep stosd 635 ;pop cx 636 ; 18/04/2021 637 0000043A 59 pop ecx 638 0000043B 40 inc eax ; 0 639 0000043C 80E11F and cl, 31 ; remain bits 640 0000043F 7412 jz short mi_4 641 00000441 8907 mov [edi], eax ; reset 642 mi_2: 643 00000443 0FAB07 bts [edi], eax ; 06/11/2014 644 00000446 FEC9 dec cl 645 00000448 7404 jz short mi_3 646 0000044A FEC0 inc al 647 0000044C EBF5 jmp short mi_2 648 mi_3: 649 0000044E 28C0 sub al, al ; 0 650 00000450 83C704 add edi, 4 ; 15/11/2014 651 mi_4: 652 00000453 6609D2 or dx, dx ; check 16 MB to 4 GB memory space 653 00000456 7421 jz short mi_6 ; max. 16 MB memory, no more... 654 ; 655 00000458 B900021000 mov ecx, MEM_ALLOC_TBL + 512 ; End of first 16 MB memory 656 ; 657 0000045D 29F9 sub ecx, edi ; displacement (to end of 16 MB) 658 0000045F 7406 jz short mi_5 ; jump if EDI points to 659 ; end of first 16 MB 660 00000461 D1E9 shr ecx, 1 ; convert to dword count 661 00000463 D1E9 shr ecx, 1 ; (shift 2 bits right) 662 00000465 F3AB rep stosd ; reset all bits for reserved pages 663 ; (memory hole under 16 MB) 664 mi_5: 665 00000467 6689D1 mov cx, dx ; count of 64 KB memory blocks 666 0000046A D1E9 shr ecx, 1 ; 1 alloc. dword per 128 KB memory 667 0000046C 9C pushf ; 16/11/2014 668 0000046D 48 dec eax ; FFFFFFFFh (set all bits to 1) 669 0000046E F3AB rep stosd 670 00000470 40 inc eax ; 0 671 00000471 9D popf ; 16/11/2014 672 00000472 7305 jnc short mi_6 673 00000474 6648 dec ax ; eax = 0000FFFFh 674 00000476 AB stosd 675 00000477 6640 inc ax ; 0 676 mi_6: 677 00000479 39DF cmp edi, ebx ; check if EDI points to 678 0000047B 730A jnb short mi_7 ; end of memory allocation table 679 ; ; (>= MEM_ALLOC_TBL + 4906) 680 0000047D 89D9 mov ecx, ebx ; end of memory allocation table 681 0000047F 29F9 sub ecx, edi ; convert displacement/offset 682 00000481 D1E9 shr ecx, 1 ; to dword count 683 00000483 D1E9 shr ecx, 1 ; (shift 2 bits right) 684 00000485 F3AB rep stosd ; reset all remain M.A.T. bits 685 mi_7: 686 ; Reset M.A.T. bits in M.A.T. (allocate M.A.T. pages) 687 00000487 BA00001000 mov edx, MEM_ALLOC_TBL 688 ;sub ebx, edx ; Mem. Alloc. Tbl. size in bytes 689 ;shr ebx, 12 ; Mem. Alloc. Tbl. size in pages 690 0000048C 668B0D[C8760100] mov cx, [mat_size] ; Mem. Alloc. Tbl. size in pages 691 00000493 89D7 mov edi, edx 692 00000495 C1EF0F shr edi, 15 ; convert M.A.T. address to 693 ; byte offset in M.A.T. 694 ; (1 M.A.T. byte points to 695 ; 32768 bytes) 696 ; Note: MEM_ALLOC_TBL address 697 ; must be aligned on 128 KB 698 ; boundary! 699 00000498 01D7 add edi, edx ; points to M.A.T.'s itself 700 ; eax = 0 701 0000049A 290D[B8760100] sub [free_pages], ecx ; 07/11/2014 702 mi_8: 703 000004A0 0FB307 btr [edi], eax ; clear bit 0 to bit x (1 to 31) 704 ;dec bl 705 000004A3 FEC9 dec cl 706 000004A5 7404 jz short mi_9 707 000004A7 FEC0 inc al 708 000004A9 EBF5 jmp short mi_8 709 mi_9: 710 ; 711 ; Reset Kernel's Page Dir. and Page Table bits in M.A.T. 712 ; (allocate pages for system page tables) 713 714 ; edx = MEM_ALLOC_TBL 715 000004AB 8B0D[B4760100] mov ecx, [memory_size] ; memory size in pages (PTEs) 716 000004B1 81C1FF030000 add ecx, 1023 ; round up (1024 PTEs per table) 717 000004B7 C1E90A shr ecx, 10 ; convert memory page count to 718 ; page table count (PDE count) 719 ; 720 000004BA 51 push ecx ; (**) PDE count (<= 1024) 721 ; 722 000004BB 41 inc ecx ; +1 for kernel page directory 723 ; 724 000004BC 290D[B8760100] sub [free_pages], ecx ; 07/11/2014 725 ; 726 000004C2 8B35[B0760100] mov esi, [k_page_dir] ; Kernel's Page Directory address 727 000004C8 C1EE0C shr esi, 12 ; convert to page number 728 mi_10: 729 000004CB 89F0 mov eax, esi ; allocation bit offset 730 000004CD 89C3 mov ebx, eax 731 000004CF C1EB03 shr ebx, 3 ; convert to alloc. byte offset 732 000004D2 80E3FC and bl, 0FCh ; clear bit 0 and bit 1 733 ; to align on dword boundary 734 000004D5 83E01F and eax, 31 ; set allocation bit position 735 ; (bit 0 to bit 31) 736 ; 737 000004D8 01D3 add ebx, edx ; offset in M.A.T. + M.A.T. address 738 ; 739 000004DA 0FB303 btr [ebx], eax ; reset relevant bit (0 to 31) 740 ; 741 000004DD 46 inc esi ; next page table 742 000004DE E2EB loop mi_10 ; allocate next kernel page table 743 ; (ecx = page table count + 1) 744 ; 745 000004E0 59 pop ecx ; (**) PDE count (= pg. tbl. count) 746 ; 747 ; Initialize Kernel Page Directory and Kernel Page Tables 748 ; 749 ; Initialize Kernel's Page Directory 750 000004E1 8B3D[B0760100] mov edi, [k_page_dir] 751 000004E7 89F8 mov eax, edi 752 000004E9 0C03 or al, PDE_A_PRESENT + PDE_A_WRITE 753 ; supervisor + read&write + present 754 000004EB 89CA mov edx, ecx ; (**) PDE count (= pg. tbl. count) 755 mi_11: 756 000004ED 0500100000 add eax, 4096 ; Add page size (PGSZ) 757 ; EAX points to next page table 758 000004F2 AB stosd 759 000004F3 E2F8 loop mi_11 760 000004F5 29C0 sub eax, eax ; Empty PDE 761 ;mov cx, 1024 ; Entry count (PGSZ/4) 762 ; 29/11/2023 763 000004F7 B504 mov ch, 4 ; cx = 4*256 = 1024 764 000004F9 29D1 sub ecx, edx 765 000004FB 7402 jz short mi_12 766 000004FD F3AB rep stosd ; clear remain (empty) PDEs 767 ; 768 ; Initialization of Kernel's Page Directory is OK, here. 769 mi_12: 770 ; Initialize Kernel's Page Tables 771 ; 772 ; (EDI points to address of page table 0) 773 ; eax = 0 774 000004FF 8B0D[B4760100] mov ecx, [memory_size] ; memory size in pages 775 00000505 89CA mov edx, ecx ; (***) 776 00000507 B003 mov al, PTE_A_PRESENT + PTE_A_WRITE 777 ; supervisor + read&write + present 778 mi_13: 779 00000509 AB stosd 780 0000050A 0500100000 add eax, 4096 781 0000050F E2F8 loop mi_13 782 ;and dx, 1023 ; (***) 783 ; 30/08/2023 784 00000511 81E2FF030000 and edx, 1023 785 00000517 7408 jz short mi_14 786 ;mov cx, 1024 787 ; 30/08/2023 788 00000519 B504 mov ch, 4 ; 4*256 = 1024 789 ;sub cx, dx ; from dx (<= 1023) to 1024 790 ; 24/07/2022 791 0000051B 29D1 sub ecx, edx 792 0000051D 31C0 xor eax, eax 793 0000051F F3AB rep stosd ; clear remain (empty) PTEs 794 ; of the last page table 795 mi_14: 796 ; Initialization of Kernel's Page Tables is OK, here. 797 ; 798 00000521 89F8 mov eax, edi ; end of the last page table page 799 ; (beginging of user space pages) 800 801 00000523 C1E80F shr eax, 15 ; convert to M.A.T. byte offset 802 00000526 24FC and al, 0FCh ; clear bit 0 and bit 1 for 803 ; aligning on dword boundary 804 00000528 A3[C4760100] mov [first_page], eax 805 0000052D A3[BC760100] mov [next_page], eax ; The first free page pointer 806 ; for user programs 807 ; (Offset in Mem. Alloc. Tbl.) 808 ; 809 ; Linear/FLAT (1 to 1) memory paging for the kernel is OK, here. 810 ; 811 812 ; Enable paging 813 ; 814 00000532 A1[B0760100] mov eax, [k_page_dir] 815 00000537 0F22D8 mov cr3, eax 816 0000053A 0F20C0 mov eax, cr0 817 0000053D 0D00000080 or eax, 80000000h ; set paging bit (bit 31) 818 00000542 0F22C0 mov cr0, eax 819 ;jmp KCODE:StartPMP 820 821 00000545 EA db 0EAh ; Opcode for far jump 822 00000546 [4C050000] dd StartPMP ; 32 bit offset 823 0000054A 0800 dw KCODE ; kernel code segment descriptor 824 825 StartPMP: 826 ; 06/11//2014 827 ; Clear video page 0 828 ; 829 ; Temporary Code 830 ; 831 0000054C B9E8030000 mov ecx, 80*25/2 832 00000551 BF00800B00 mov edi, 0B8000h 833 ; 30/01/2016 834 ;xor eax, eax ; black background, black fore color 835 00000556 B800070007 mov eax, 07000700h ; black background, light gray fore color 836 0000055B F3AB rep stosd 837 838 ; 19/08/2014 839 ; Kernel Base Address = 0 840 ; It is mapped to (physically) 0 in the page table. 841 ; So, here is exactly 'StartPMP' address. 842 843 ; 29/01/2016 (TRDOS 386 = TRDOS v2.0) 844 0000055D BE[5A390100] mov esi, starting_msg 845 ;; 14/08/2015 (kernel version message will appear 846 ;; when protected mode and paging is enabled) 847 00000562 BF00800B00 mov edi, 0B8000h ; 27/08/2014 848 849 ; 30/11/2020 850 ; 14/11/2020 (TRDOS 386 v2.0.3) 851 ;cmp byte [vbe3], 3 ; 03h 852 ;jne short pkv_1 853 ;;mov ah, 0Bh ; Black background, light cyan forecolor 854 ;; Light red TRDOS 386 version text shows VBE3 is ready ! 855 ;mov ah, 0Ch ; Black background, light red forecolor 856 ;jmp short pkv_2 857 ;pkv_1: 858 00000567 B40A mov ah, 0Ah ; Black background, light green forecolor 859 ;pkv_2: 860 ; 20/08/2014 861 00000569 E8BF030000 call printk 862 863 ; 'UNIX v7/x86' source code by Robert Nordier (1999) 864 ; // Set IRQ offsets 865 ; 866 ; Linux (v0.12) source code by Linus Torvalds (1991) 867 ; 868 ;; ICW1 869 0000056E B011 mov al, 11h ; Initialization sequence 870 00000570 E620 out 20h, al ; 8259A-1 871 ; jmp $+2 872 00000572 E6A0 out 0A0h, al ; 8259A-2 873 ;; ICW2 874 00000574 B020 mov al, 20h ; Start of hardware ints (20h) 875 00000576 E621 out 21h, al ; for 8259A-1 876 ; jmp $+2 877 00000578 B028 mov al, 28h ; Start of hardware ints (28h) 878 0000057A E6A1 out 0A1h, al ; for 8259A-2 879 ; 880 0000057C B004 mov al, 04h ;; ICW3 881 0000057E E621 out 21h, al ; IRQ2 of 8259A-1 (master) 882 ; jmp $+2 883 00000580 B002 mov al, 02h ; is 8259A-2 (slave) 884 00000582 E6A1 out 0A1h, al ; 885 ;; ICW4 886 00000584 B001 mov al, 01h ; 887 00000586 E621 out 21h, al ; 8086 mode, normal EOI 888 ; jmp $+2 889 00000588 E6A1 out 0A1h, al ; for both chips. 890 891 ;mov al, 0FFh ; mask off all interrupts for now 892 ;out 21h, al 893 ;; jmp $+2 894 ;out 0A1h, al 895 896 ; 02/04/2015 897 ; 26/03/2015 System call (INT 30h) modification 898 ; DPL = 3 (Interrupt service routine can be called from user mode) 899 ; 900 ;; Linux (v0.12) source code by Linus Torvalds (1991) 901 ; setup_idt: 902 ; 903 ;; 16/02/2015 904 ;;mov dword [DISKETTE_INT], fdc_int ; IRQ 6 handler 905 ; 21/08/2014 (timer_int) 906 0000058A BE[F8350100] mov esi, ilist 907 0000058F 8D3D[C8730100] lea edi, [idt] 908 ; 26/03/2015 909 00000595 B930000000 mov ecx, 48 ; 48 hardware interrupts (INT 0 to INT 2Fh) 910 ; 02/04/2015 911 0000059A BB00000800 mov ebx, 80000h 912 rp_sidt1: 913 0000059F AD lodsd 914 000005A0 89C2 mov edx, eax 915 000005A2 66BA008E mov dx, 8E00h 916 000005A6 6689C3 mov bx, ax 917 000005A9 89D8 mov eax, ebx ; /* selector = 0x0008 = cs */ 918 ; /* interrupt gate - dpl=0, present */ 919 000005AB AB stosd ; selector & offset bits 0-15 920 000005AC 89D0 mov eax, edx 921 000005AE AB stosd ; attributes & offset bits 16-23 922 000005AF E2EE loop rp_sidt1 923 ; 15/04/2016 924 ; TRDOS 386 (TRDOS v2.0) /// 32 sofware interrupts /// 925 ;mov cl, 16 ; 16 software interrupts (INT 30h to INT 3Fh) 926 000005B1 B120 mov cl, 32 ; 32 software interrupts (INT 30h to INT 4Fh) 927 rp_sidt2: 928 000005B3 AD lodsd 929 000005B4 21C0 and eax, eax 930 000005B6 7413 jz short rp_sidt3 931 000005B8 89C2 mov edx, eax 932 000005BA 66BA00EE mov dx, 0EE00h ; P=1b/DPL=11b/01110b 933 000005BE 6689C3 mov bx, ax 934 000005C1 89D8 mov eax, ebx ; selector & offset bits 0-15 935 000005C3 AB stosd 936 000005C4 89D0 mov eax, edx 937 000005C6 AB stosd 938 000005C7 E2EA loop rp_sidt2 939 000005C9 EB16 jmp short sidt_OK 940 rp_sidt3: 941 000005CB B8[A40D0000] mov eax, ignore_int 942 000005D0 89C2 mov edx, eax 943 000005D2 66BA00EE mov dx, 0EE00h ; P=1b/DPL=11b/01110b 944 000005D6 6689C3 mov bx, ax 945 000005D9 89D8 mov eax, ebx ; selector & offset bits 0-15 946 rp_sidt4: 947 000005DB AB stosd 948 000005DC 92 xchg eax, edx 949 000005DD AB stosd 950 000005DE 92 xchg edx, eax 951 000005DF E2FA loop rp_sidt4 952 sidt_OK: 953 000005E1 0F011D[FE650000] lidt [idtd] 954 ; 955 ; TSS descriptor setup ; 24/03/2015 956 000005E8 B8[48760100] mov eax, task_state_segment 957 000005ED 66A3[AA650000] mov [gdt_tss0], ax 958 000005F3 C1C010 rol eax, 16 959 000005F6 A2[AC650000] mov [gdt_tss1], al 960 000005FB 8825[AF650000] mov [gdt_tss2], ah 961 00000601 66C705[AE760100]68- mov word [tss.IOPB], tss_end - task_state_segment 961 00000609 00 962 ; 963 ; IO Map Base address (When this address points 964 ; to end of the TSS, CPU does not use IO port 965 ; permission bit map for RING 3 IO permissions, 966 ; access to any IO ports in ring 3 will be forbidden.) 967 ; 968 ;mov [tss.esp0], esp ; TSS offset 4 969 ;mov word [tss.ss0], KDATA ; TSS offset 8 (SS) 970 0000060A 66B82800 mov ax, TSS ; It is needed when an interrupt 971 ; occurs (or a system call -software INT- is requested) 972 ; while cpu running in ring 3 (in user mode). 973 ; (Kernel stack pointer and segment will be loaded 974 ; from offset 4 and 8 of the TSS, by the CPU.) 975 0000060E 0F00D8 ltr ax ; Load task register 976 ; 977 esp0_set0: 978 979 ; 29/11/2023 - Erdogan Tan 980 ; ------------------------ 981 ; If we read following -disabled- stack page setting code... 982 ; When the memory size >= 3GB, one of page tables conflicts with the stack page 983 ; at 4MB-4096 address. So, to leave stack pointer at 90000h is better/default. 984 ; (Problem may not appears for <= 2.5GB main memory but following code is also 985 ; defective because kernel stack page would be seen as unallocated in the M.A.T. 986 ; without by adding a memory allocation code.) 987 ; 988 ; 1st 4MB layout: 1MB kernel -base- reserved + max. 128 KB M.A.T. (at 100000h) 989 ; + Kernel's page directory (4KB) -just after the M.A.T.- 990 ; + Kernel's page tables (main memory size / 1024) 991 ; Note: 992 ; 1 or 2 additional kernel page table(s) may be needed for Linear Frame Buffer 993 ; .. but, it/they will not have to be contiguous with other kernel page tables. 994 ; ------------------------ 995 996 ; 27/11/2023 - TRDOS 386 v2.0.7 997 %if 0 998 ; 30/07/2015 999 mov ecx, [memory_size] ; memory size in pages 1000 shl ecx, 12 ; convert page count to byte count 1001 cmp ecx, CORE ; beginning of user's memory space (400000h) 1002 ; (kernel mode virtual address) 1003 jna short esp0_set1 1004 ; 1005 ; If available memory > CORE (end of the 1st 4 MB) 1006 ; set stack pointer to CORE 1007 ;(Because, PDE 0 is reserved for kernel space in user's page directory) 1008 ;(PDE 0 points to page table of the 1st 4 MB virtual address space) 1009 mov ecx, CORE 1010 esp0_set1: 1011 mov esp, ecx ; top of kernel stack (**tss.esp0**) 1012 %endif 1013 1014 esp0_set_ok: 1015 ; 30/07/2015 (**tss.esp0**) 1016 00000611 8925[4C760100] mov [tss.esp0], esp ; 90000h ; 29/11/2023 1017 ; <-- 97000h ; 04/12/2023 (max. 3072 bytes) 1018 00000617 66C705[50760100]10- mov word [tss.ss0], KDATA 1018 0000061F 00 1019 ; 14/08/2015 1020 ; 10/11/2014 (Retro UNIX 386 v1 - Erdogan Tan) 1021 ; 1022 ;cli ; Disable interrupts (for CPU) 1023 ; (CPU will not handle hardware interrupts, except NMI!) 1024 ; 1025 00000620 30C0 xor al, al ; Enable all hardware interrupts! 1026 00000622 E621 out 21h, al ; (IBM PC-AT compatibility) 1027 00000624 EB00 jmp $+2 ; (All conventional PC-AT hardware 1028 00000626 E6A1 out 0A1h, al ; interrupts will be in use.) 1029 ; (Even if related hardware component 1030 ; does not exist!) 1031 ; Enable NMI 1032 00000628 B07F mov al, 7Fh ; Clear bit 7 to enable NMI (again) 1033 0000062A E670 out 70h, al 1034 ; 23/02/2015 1035 0000062C 90 nop 1036 0000062D E471 in al, 71h ; read in 71h just after writing out to 70h 1037 ; for preventing unknown state (!?) 1038 ; 1039 ; Only a NMI can occur here... (Before a 'STI' instruction) 1040 ; 1041 ; 02/09/2014 1042 ;xor bx, bx 1043 ; 24/07/2022 1044 0000062F 31DB xor ebx, ebx 1045 00000631 66BA0002 mov dx, 0200h ; Row 2, column 0 ; 07/03/2015 1046 00000635 E83D1D0000 call _set_cpos ; 24/01/2016 1047 1048 ; 14/11/2020 (TRDOS 386 v2.0.3) 1049 ; Check VBE3 protected mode interface/feature(s) 1050 1051 ;cmp byte [vbe3], 3 ; 03h 1052 ;jne short display_mem_info 1053 1054 ; 20/11/2020 1055 0000063A 803D[7C090000]02 cmp byte [vbe3], 2 ; 02h 1056 00000641 7707 ja short vbe3_pmid_chk 1057 ;;jb short display_mem_info 1058 ;jb display_mem_info ; 02/12/2020 1059 00000643 7220 jb short jmp_display_mem_info ; 24/07/2022 1060 00000645 E9EF010000 jmp check_boch_plex86_vbe 1061 1062 vbe3_pmid_chk: 1063 0000064A B9EA7F0000 mov ecx, 32768 - (20+2) ; 32766 - PMInfoBlockSize 1064 0000064F BE02000C00 mov esi, 0C0002h ; 1st word of the video bios rom is 0AA55h 1065 1066 chk_pmi_sign: 1067 ;mov eax, [esi] 1068 ;cmp eax, 'PMID' 1069 ; 30/11/2020 1070 ;cmp al, 'P' 1071 ;jne short chk_pmi_sign_next 1072 00000654 813E504D4944 cmp dword [esi], 'PMID' 1073 ;je short display_vbios_product_name 1074 0000065A 740E je short verify_pmib_chksum ; 15/11/2020 1075 ;chk_pmi_sign_next: 1076 0000065C 46 inc esi ; inc si 1077 0000065D E2F5 loop chk_pmi_sign 1078 1079 not_valid_pmib: 1080 0000065F FE0D[7C090000] dec byte [vbe3] ; 2 = VBE2 compatible 1081 ; (vbe3 feature is defective in this vbios) 1082 ;jmp short display_mem_info 1083 jmp_display_mem_info: ; 24/07/2022 1084 ; 02/12/2020 1085 00000665 E988010000 jmp display_mem_info 1086 1087 verify_pmib_chksum: 1088 ; 18/10/2023 1089 ; (ATI RV370 video bios contains ZERO at Checksum offset.) 1090 0000066A 31C0 xor eax, eax 1091 0000066C 384613 cmp byte [esi+19], al ; 0 ; Checksum byte 1092 0000066F 7611 jna short skip_verify_pmib_chksum ; may be ATI video bios 1093 ;cmp dword [esi+16], 0C000h 1094 ; ; CodeSegSel = 0C000h, InProtectMode = 0, Checksum = 0 1095 ;je short skip_verify_pmib_chksum ; may be ATI video bios 1096 ; 18/10/2023 1097 ; 15/11/2020 1098 ;xor eax, eax 1099 ;;mov ecx, eax 1100 ;mov cl, 20 1101 00000671 66B91400 mov cx, 20 ; 30/11/2020 1102 00000675 56 push esi 1103 pmib_sum_bytes: 1104 00000676 AC lodsb 1105 00000677 00C4 add ah, al 1106 00000679 E2FB loop pmib_sum_bytes 1107 0000067B 5E pop esi 1108 0000067C 08E4 or ah, ah 1109 0000067E 75DF jnz short not_valid_pmib ; AH must be 0 1110 1111 ; 18/10/2023 1112 00000680 30C0 xor al, al ; eax = 0 1113 1114 ; 28/02/2021 1115 ; Set default (initial) truecolor bpp value to 32 1116 ; (for VBE3 video bios.. because vbe3 video bioses 1117 ; use 32bpp -for truecolor modes- instead of 24bpp) 1118 ; (This setting may be changed via 'sysvideo' bx=0908h) 1119 1120 skip_verify_pmib_chksum: ; 18/10/2023 1121 1122 00000682 C605[73730100]20 mov byte [truecolor], 32 ; (RGB: 00RRGGBBh) 1123 1124 display_vbios_product_name: ; 14/11/2020 1125 1126 ; ESI points to 'PMID' (0C0000h + 'PMID' offset) 1127 1128 ; 15/11/2020 1129 ;mov [pmid_addr], si ; PMInfoBlock offset 1130 ; ; (in VGA bios, 0C0000h + offset) 1131 ; 02/12/2020 1132 ;push esi ; * pmid_addr 1133 00000689 89F7 mov edi, esi 1134 1135 ;mov esi, [VBE3INFOBLOCK+22] ; 097E00h + 16h 1136 ; ; OemVendorNamePtr (seg16:off16) 1137 0000068B 8B35067E0900 mov esi, [VBE3INFOBLOCK+6] ; 097E00h + 06h 1138 ; OemStringPtr (seg16:off16) 1139 ; 18/10/2023 1140 ;xor al, al ; eax = 0 1141 00000691 6696 xchg ax, si ; ax = offset, si = 0 1142 00000693 C1EE0C shr esi, 12 ; (to convert segment to base addr) 1143 00000696 6601C6 add si, ax ; esi has an address < 1 MB limit 1144 ; (OemVendorName is in VBE3INFOBLOCK) 1145 ; Example: 1146 ; TRDOS 386 v2.0.3 VESA VBE3 protected mode 1147 ; interface development reference is ... 1148 ; NVIDIA GeForce FX5500 VGA BIOS -C000h:029Ch- 1149 ; Version 4.34.20.54.00 -C000h:02EDh- 1150 ; ((OemString is 'NVIDIA')) 1151 ; ((OemVendorName is 'NVIDIA Corporation')) 1152 ; ((OemProductName is 'NV34 Board - p162-1nz)) 1153 1154 ;mov ah, 0Eh ; Black background, yellow forecolor 1155 ; 30/11/2020 1156 00000699 B40C mov ah, 0Ch ; Black background, light red forecolor 1157 1158 0000069B E8E53A0000 call print_kmsg 1159 1160 ;mov ah, 07h 1161 1162 000006A0 BE[55730100] mov esi, vesa_vbe3_bios_msg 1163 ;call print_kmsg 1164 000006A5 E8E13A0000 call pkmsg_loop ; 30/11/2020 1165 1166 ; 02/12/2020 1167 ;pop edi ; * pmid_addr 1168 1169 ; 04/12/2023 - TRDOS 386 v2.0.7 1170 %if 0 1171 ; 24/07/2022 1172 ; 29/11/2020 1173 vbe3pminit: 1174 ; 30/11/2020 1175 ;cmp byte [vbe3], 3 ; is VESA VBE3 PMI ready ? 1176 ;jne short di4 1177 1178 ; Allocate 64KB contiguous (kernel) memory block 1179 xor eax, eax 1180 mov ecx, 65536 1181 call allocate_memory_block 1182 ;jc short di4 1183 ;jc di0 ; 30/11/2020 1184 ; 24/07/2022 1185 jnc short vbe3pminit0 1186 jmp di0 1187 1188 vbe3pminit0: 1189 ; of course this block must be in the 1st 16MB 1190 ; because vbe3 pmi segments will be 16 bit segments 1191 ; (80286 type segment descriptors in GDT) 1192 1193 mov [vbe3bios_addr], eax 1194 %endif 1195 1196 ; 04/12/2023 - TRDOS 386 v2.0.7 ; (+!*!+) 1197 ; fixed PM-VBIOS address (no need to add a memory block) 1198 ; in the reserved -and already allocated- area under 1MB 1199 ; (purpose: to prevent page faults if memory size > 2.5GB) 1200 ; ((User's page dir contains only the 1st 4MB of system mem 1201 ; as PDE. So, this causes to page faults during an interrupt 1202 ; in user mode, because if memory size > 2.5GB, kernel 1203 ; page tables overs/passes 4MB limit and PM-VBIOS 1204 ; is located after kernel page tables.)) 1205 vbe3pminit: 1206 000006AA B800000600 mov eax, VBE3BIOSCODE_ADDR ; 60000h ; (+!*!+) 1207 1208 ; set [pmid_addr] to the new location 1209 000006AF BE00000C00 mov esi, 0C0000h 1210 1211 ; 30/11/2020 1212 000006B4 29F7 sub edi, esi ; izolate offset 1213 000006B6 01C7 add edi, eax ; new address 1214 000006B8 893D[2C9D0100] mov [pmid_addr], edi ; new 'PMID' location 1215 1216 ; Move VIDEO BIOS from 0C0000h to EAX 1217 000006BE B900400000 mov ecx, 65536/4 1218 000006C3 89C7 mov edi, eax ; 30/11/2020 1219 000006C5 F3A5 rep movsd 1220 1221 ; 02/12/2020 1222 ; 30/11/2020 1223 ; set vbe3 segment selectors 1224 1225 ; 04/12/2023 - TRDOS 386 v2.0.7 ; (+!*!+) 1226 %if 0 1227 ; VBE3CS (VESA VBE3 video bios code segment) 1228 mov edi, _vbe3_CS+2 ; base address bits 0..15 1229 stosw ; edi = _vbe3_CS+4 1230 ror eax, 16 1231 mov [edi], al ; base address, bits 16..23 1232 1233 ; VBE3DS ('CodeSegSel' in PMInfoBlock) 1234 mov edi, _vbe3_DS+4 ; base addr bits 16..23 1235 mov [edi], al 1236 rol eax, 16 1237 mov [edi-2], ax ; base address, bits 0..15 1238 %endif 1239 ; VBE3BDS (BIOSDataSel in PMInfoBlock) 1240 000006C7 BF[BA650000] mov edi, _vbe3_BDS+2 ; base addr bits 0..15 1241 000006CC B800700900 mov eax, VBE3BIOSDATABLOCK ; 1536 bytes 1242 000006D1 66AB stosw ; edi = _vbe3_BDS+4 1243 000006D3 C1E810 shr eax, 16 1244 000006D6 8807 mov [edi], al ; base address, bits 16..23 1245 1246 ; VBE3SS (1024 bytes) 1247 000006D8 BF[E2650000] mov edi, _vbe3_SS+2 ; base addr bits 0..15 1248 000006DD B800600900 mov eax, VBE3STACKADDR ; size = 1024 bytes 1249 000006E2 66AB stosw ; edi = _vbe3_SS+4 1250 000006E4 C1E810 shr eax, 16 1251 000006E7 8807 mov [edi], al ; base address, bits 16..23 1252 1253 ; stack pointer (esp) will be set to 1020 1254 ; (before VBE3 PMI call) 1255 1256 ; VBE3ES (max: 2048 bytes) 1257 000006E9 BF[EA650000] mov edi, _vbe3_ES+2 ; base addr bits 0..15 1258 000006EE B800760900 mov eax, VBE3SAVERESTOREBLOCK 1259 000006F3 66AB stosw ; edi = _vbe3_ES+4 1260 000006F5 C1E810 shr eax, 16 1261 000006F8 8807 mov [edi], al ; base address, bits 16..23 1262 1263 ;Note: low word of _VBE3_ES base address will be 1264 ; set -again- by VBE3 PMI caller routine 1265 1266 ; 09/12/2020 1267 ;; set pmi32 (as VBE3 PMI is ready) 1268 ;inc byte [pmi32] ; = 1 1269 1270 ; KCODE16 (set PMI far return segment) 1271 000006FA BF[F2650000] mov edi, _16bit_CS+2 ; base addr bits 0..15 1272 000006FF B8[88070000] mov eax, pminit_return_addr16 1273 00000704 66AB stosw ; edi = _16bit_CS+4 1274 00000706 C1E810 shr eax, 16 1275 00000709 8807 mov [edi], al ; base address, bits 16..23 1276 1277 ; 30/11/2020 1278 ; clear mem from VBE3 BIOS data area emu block 1279 ; to end of vbe3 buffers 1280 1281 ; 18/10/2023 - TRDOS v2.0.7 1282 ; (VBE3BIOSDATABLOCK contains a copy of the 1st 1283 ; 1536 bytes of the memory, IVT, ROMBIOS DATA etc.) 1284 ; ((it must not be cleared here)) 1285 %if 0 1286 ; 01/12/2020 1287 mov edi, VBE3BIOSDATABLOCK ; 97000h 1288 ;mov cx, (VBE3INFOBLOCK-VBE3BIOSDATABLOCK)/4 1289 ; ; ecx = 3584/4 double words 1290 ; 21/12/2020 1291 mov cx, (VBE3MODEINFOBLOCK-VBE3BIOSDATABLOCK)/4 1292 ; ecx = 3072/4 double words 1293 ;xor eax, eax 1294 xor al, al 1295 rep stosd 1296 %endif 1297 ; 18/10/2023 - TRDOS v2.0.7 1298 ; (VBE3BIOSDATABLOCK contains a copy of the 1st 1299 ; 1536 bytes of the memory, IVT, ROMBIOS DATA etc.) 1300 ; ((it must not be cleared here)) 1301 0000070B BF00760900 mov edi, VBE3SAVERESTOREBLOCK ; 97600h 1302 00000710 66B98001 mov cx, (VBE3MODEINFOBLOCK-VBE3SAVERESTOREBLOCK)/4 1303 ; ecx = 1536/4 = 384 double words 1304 ;xor eax, eax 1305 00000714 30C0 xor al, al 1306 00000716 F3AB rep stosd 1307 1308 ; Filling PMInfoBlock selector fields 1309 00000718 8B3D[2C9D0100] mov edi, [pmid_addr] 1310 0000071E 66C747083800 mov word [edi+PMInfo.BIOSDataSel], VBE3BDS 1311 00000724 66C7470A4000 mov word [edi+PMInfo.A0000Sel], VBE3A000 1312 0000072A 66C7470C4800 mov word [edi+PMInfo.B0000Sel], VBE3B000 1313 00000730 66C7470E5000 mov word [edi+PMInfo.B8000Sel], VBE3B800 1314 00000736 66C747105800 mov word [edi+PMInfo.CodeSegSel], VBE3DS 1315 0000073C C6471201 mov byte [edi+PMInfo.InProtectMode], 1 1316 1317 ; Calculate and write checksum byte 1318 00000740 89FE mov esi, edi 1319 00000742 B113 mov cl, PMInfo.size - 1 1320 ;xor ah, ah 1321 pmid_chksum: 1322 00000744 AC lodsb 1323 00000745 00C4 add ah, al 1324 00000747 E2FB loop pmid_chksum 1325 00000749 F6DC neg ah ; 1 -> 255, 255 -> 1 1326 0000074B 8826 mov [esi], ah ; checksum 1327 1328 ; far call PM initialization 1329 ; (VBE3 video bios will return via 'retf') 1330 1331 0000074D 668B4706 mov ax, [edi+PMInfo.PMInitialize] 1332 ; 30/11/2020 1333 00000751 C1E010 shl eax, 16 ; save entry address in hw 1334 ; ax = 0 1335 1336 ; 02/12/2020 1337 00000754 68[AC070000] push pminit_ok ; normal, near return address 1338 1339 ; 30/11/2020 1340 _VBE3PMI_fcall: 1341 ; ax = function, hw of eax = entry address 1342 00000759 9C pushf ; save 32 bit flags 1343 0000075A 56 push esi ; * 1344 0000075B 55 push ebp ; ** 1345 1346 0000075C 89E5 mov ebp, esp ; save 32 bit stack pointer 1347 1348 ;mov esi, eax 1349 ; 28/12/2025 (PMI32 BugFix) 1350 0000075E 0FB7F0 movzx esi, ax 1351 1352 00000761 FA cli 1353 1354 ; Disable interrupts (clear interrupt flag) 1355 ; Reset Interrupt MASK Registers (Master&Slave) 1356 00000762 B0FF mov al, 0FFh ; mask off all interrupts 1357 00000764 E621 out 21h, al ; on master PIC (8259) 1358 00000766 EB00 jmp $+2 ; (delay) 1359 00000768 E6A1 out 0A1h, al ; on slave PIC (8259) 1360 1361 ; 02/12/2020 1362 0000076A 66B86000 mov ax, VBE3SS 1363 0000076E 8ED0 mov ss, ax 1364 1365 00000770 BCFC030000 mov esp, 1020 ; 30/11/2020 1366 1367 ; 01/12/2020 1368 ;lss esp, [stack16] 1369 1370 00000775 C1E810 shr eax, 16 ; now, entry address is in lw 1371 1372 ; 30/11/2020 - 16 bit pm selector test (OK) 1373 ; (32 bit stack push/pop & retf with 32 bit code segment) 1374 ; (16 bit stack push/pop with 16 bit code segment) 1375 1376 ; return 1377 ;push KCODE16 1378 ;push 0 ; 30/11/2020 (pminit_return_addr16) 1379 1380 ; 30/11/2020 (16 bit stack during retf from video bios) 1381 00000778 C7042400007000 mov dword [esp], KCODE16 << 16 1382 ; ip = 0, cs = KCODE16 1383 ; 01/12/2020 1384 ;mov dword [VBE3STACKADDR+1020], KCODE16*65536 1385 1386 ;mov [jumpfar16], eax 1387 1388 ; 02/12/2020 1389 ; 30/11/2020 (32 bit stack during retf from kernel) 1390 ; far jump/call via retf 1391 0000077F 6A30 push VBE3CS ; VBE3 video bios's code segment 1392 00000781 50 push eax ; PMInitialize or EntryPoint 1393 1394 ;mov ax, si ; restore function 1395 ; 24/07/2022 1396 00000782 89F0 mov eax, esi 1397 1398 ; 02/12/2020 1399 00000784 31F6 xor esi, esi ; (not necessary, it is not used) 1400 1401 00000786 CB retf ; far return (to 16 bit code segment) 1402 1403 ; 01/12/2020 1404 ;db 0EAh ; far jump to 16 bit code segment 1405 ;jumpfar16: 1406 ;dd 0 1407 ;dw VBE3CS 1408 1409 ;stack16: 1410 ;dd 1020 1411 ;dw VBE3SS 1412 1413 00000787 90 align 2 1414 1415 pminit_return_addr16: 1416 ; 02/12/2020 1417 ; 30/11/2020 1418 ;;db 66h ; Prefix for 32-bit 1419 ;db 0EAh ; Opcode for far jump 1420 ;dd pminit_return_addr32 ; 32 bit Offset 1421 ;dw KCODE ; 32 bit code segment 1422 ; 01/12/2020 1423 00000788 EA[8F070000]0800 jmp KCODE:pminit_return_addr32 1424 1425 pminit_return_addr32: 1426 ; restore 32 bit kernel selectors and 32 bit stack addr 1427 0000078F BE10000000 mov esi, KDATA 1428 00000794 8EDE mov ds, si 1429 00000796 8EC6 mov es, si 1430 00000798 8ED6 mov ss, si 1431 0000079A 89EC mov esp, ebp ; top of stack = iretd return addr 1432 1433 0000079C 5D pop ebp ; ** 1434 0000079D 5E pop esi ; * 1435 0000079E 9D popf ; restore 32 bit flags 1436 1437 ; enable interrupts 1438 1439 0000079F FA cli 1440 1441 ; 21/12/2020 1442 000007A0 50 push eax 1443 1444 000007A1 30C0 xor al, al ; Enable all hardware interrupts! 1445 000007A3 E621 out 21h, al ; (IBM PC-AT compatibility) 1446 000007A5 EB00 jmp $+2 ; (All conventional PC-AT hardware 1447 000007A7 E6A1 out 0A1h, al ; interrupts will be in use.) 1448 ; (Even if related hardware component 1449 ; does not exist!) 1450 000007A9 58 pop eax 1451 1452 000007AA FB sti 1453 1454 ; top of stack = return address 1455 ; ('pminit_ok' for PMinit) 1456 1457 000007AB C3 retn 1458 1459 pminit_ok: 1460 ; 03/12/2020 1461 ; (set [pmid_addr] to PMI entry point for next calls) 1462 000007AC 8305[2C9D0100]04 add dword [pmid_addr], PMInfo.EntryPoint ; + 4 1463 1464 ; 17/01/2021 1465 ; copy EDID data from temporary location to final address 1466 000007B3 803D[1D420000]4F cmp byte [edid], 4Fh 1467 000007BA 7510 jne short vbe3h_chcl 1468 ;mov ecx, 32 ; 128 bytes, 32 dwords 1469 ; 24/07/2022 1470 000007BC 31C9 xor ecx, ecx 1471 000007BE B120 mov cl, 32 1472 000007C0 BE007D0900 mov esi, VBE3EDIDINFOBLOCK ; 97D00h 1473 000007C5 BF[A49C0100] mov edi, edid_info 1474 000007CA F3A5 rep movsd 1475 ; 17/01/2021 1476 vbe3h_chcl: 1477 ; 16/01/2021 1478 ;; 06/12/2020 1479 ;; Save video mode 03h regs/dac/bios state 1480 ; 1481 ;mov ax, 4F04h ; VESA VBE Function 04h 1482 ; ; Save/Restore State 1483 ;sub dl, dl ; 0 = return buffer size 1484 ;mov cx, 0Fh ; ctrl/bios/dac/regs 1485 ; 1486 ;call int10h_32bit_pmi 1487 ;; bx = number of 64-byte blocks to hold the state buff 1488 ; 1489 ;;mov [vbe3stbufsize], bx 1490 ;; 16/01/2021 1491 ;or word [vbe3stbsflags], 32768 ; set bit 15 1492 ;mov ax, bx 1493 ;shl ax, 6 ; * 64 1494 ;mov [vbestatebufsize+30], ax 1495 ; 1496 ;; 06/12/2020 1497 ;; check 'vbe3stbufsize' (it must be <= 32) 1498 ; 1499 ;cmp bx, 32 1500 ;ja short display_mem_info ; light red forecolor 1501 ; 1502 ;; 16/01/2021 1503 ;or byte [vbe3stbsflags], 1 ; set bit 0 1504 1505 ; 30/11/2020 1506 ; Change VESA VBE3 BIOS text color in order to give 1507 ; "VBE3 PMI initialization has been successed" meaning 1508 1509 000007CC BE40810B00 mov esi, 0B8000h + 160*2 ; row 2 1510 000007D1 89F7 mov edi, esi 1511 vbe3h_chcl_next: 1512 000007D3 66AD lodsw 1513 000007D5 80FC0C cmp ah, 0Ch ; light red forecolor 1514 000007D8 7518 jne short display_mem_info 1515 000007DA B40E mov ah, 0Eh ; yellow forecolor 1516 000007DC 66AB stosw 1517 000007DE EBF3 jmp short vbe3h_chcl_next 1518 1519 di5: 1520 ; 18/10/2023 - TRDOS 386 v2.0.7 1521 ; ATI RV370 Video BIOS (VESA VBE2) 1522 ; has PMI. (as described in VESA VBE3 specification) 1523 ; 1524 000007E0 FE05[7C090000] inc byte [vbe3] ; [vbe3] = 2 -> 3 1525 ; will be decreased to 2 again if 'PMID' 1526 ; signature will not be found. 1527 000007E6 E95FFEFFFF jmp vbe3_pmid_chk ; check for ATI Video BIOS 1528 1529 di0: 1530 ; 30/11/2020 1531 ; Memory allocation error ! 1532 000007EB C605[7C090000]00 mov byte [vbe3], 0 ; disable VBE3 1533 1534 display_mem_info: 1535 ; 19/12/2020 1536 ; temporary 1537 ; 24/11/2023 1538 000007F2 803D[7C090000]02 cmp byte [vbe3], 2 1539 000007F9 7205 jb short dmi 1540 000007FB E8A1390000 call default_lfb_info 1541 dmi: 1542 ; 06/11/2014 1543 00000800 E827390000 call memory_info 1544 ; 14/08/2015 1545 ;call getch ; 28/02/2015 1546 1547 ; 07/12/2023 1548 ; check EDID info for LCD monitor -screen resolution- 1549 ; for modifying VGA mode 13h CRTC parameters 1550 ; (if it is needed or not) 1551 1552 00000805 E82D010000 call video_mode_13h_parms 1553 1554 drv_init: 1555 0000080A FB sti ; Enable Interrupts 1556 ; 06/02/2015 1557 0000080B 8B15[8E660000] mov edx, [hd0_type] ; hd0, hd1, hd2, hd3 1558 00000811 668B1D[8C660000] mov bx, [fd0_type] ; fd0, fd1 1559 ; 22/02/2015 1560 00000818 6621DB and bx, bx 1561 0000081B 756C jnz short di1 1562 ; 1563 0000081D 09D2 or edx, edx 1564 0000081F 757A jnz short di2 1565 ; 1566 setup_error: 1567 00000821 BE[FE380100] mov esi, setup_error_msg 1568 psem: 1569 00000826 AC lodsb 1570 00000827 08C0 or al, al 1571 ;jz short haltx ; 22/02/2015 1572 00000829 747C jz short di3 1573 0000082B 56 push esi 1574 ; 13/05/2016 1575 0000082C BB07000000 mov ebx, 7 ; Black background, 1576 ; light gray forecolor 1577 ; Video page 0 (BH=0) 1578 00000831 E8A91A0000 call _write_tty 1579 00000836 5E pop esi 1580 00000837 EBED jmp short psem 1581 1582 check_boch_plex86_vbe: 1583 ; 20/10/2023 1584 ; 18/10/2023 1585 ; 20/11/2020 1586 ; check Bochs/Plex86 VGABios VBE extension 1587 ; (check if TRDOS 386 v2 is running on emulators) 1588 ; BOCHS/QEMU/VIRTUALBOX 1589 ; 1590 ; ref: vbe_display_api.txt 1591 1592 ; bochs/plex86 VGAbios VBE source code 1593 ; by Jeroen Janssen (2002) 1594 ; and Volker Ruppert (2003-2020) 1595 1596 ; 20/10/2023 1597 ; (ATI RV370 video bios has PMI support but 1598 ; it is a VESA VBE2 bios. So, even if [vbe3] is set 1599 ; to 3 for PMI functionality, it is better to display 1600 ; VESA VBE number as it is declared by the video bios.) 1601 1602 00000839 C605[5E730100]32 mov byte [vbe_vnumber], "2" ; 20/10/2023 1603 1604 00000840 29C0 sub eax, eax ; 0 1605 00000842 66BACE01 mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 1606 00000846 66EF out dx, ax ; VBE_DISPI_INDEX_ID register 1607 ;mov ax, 0B0C0h ; VBE_DISPI_ID0 1608 ;mov dx, 1CFh ; VBE_DISPI_IOPORT_DATA 1609 00000848 6642 inc dx 1610 ;out dx, ax 1611 ;nop 1612 0000084A 66ED in ax, dx 1613 0000084C 80FCB0 cmp ah, 0B0h 1614 ;jne short not_boch_qemu_vbe 1615 ; 18/10/2023 1616 ;jne short display_mem_info 1617 0000084F 758F jne short di5 ; ATI VESA VBE2 bios or another 1618 1619 00000851 3CC5 cmp al, 0C5h ; it must be 0B0C4h or 0B0C5h .. 1620 ;ja short not_boch_qemu_vbe 1621 00000853 779D ja short display_mem_info 1622 00000855 3CC0 cmp al, 0C0h ; 0B0C0h to 0B0C5h .. ; Qemu 1623 ;cmp al, 0C4h ; 0BC04h or 0B0C5h is OK ; Bochs 1624 ;jb short not_boch_qemu_vbe 1625 00000857 7299 jb short display_mem_info 1626 1627 ; save VESA VBE2 bios (bochs/qemu) signature 1628 ; for enabling VBE2 functions in TRDOS 386 v2 kernel 1629 00000859 A2[7D090000] mov [vbe2bios], al ; 0C4h or 0C5h (for BOCHS) 1630 ; (0C0h-0C5h for QEMU) 1631 ; 20/10/2023 1632 ;mov byte [vbe_vnumber], "2" 1633 1634 ; 26/11/2020 1635 ; "BOCHS/QEMU/VIRTUALBOX VBE2 Video BIOS ..". 1636 0000085E BE[40730100] mov esi, vbe2_bochs_vbios ; BOCH/QEMU vbios msg 1637 00000863 B40E mov ah, 0Eh ; Yellow font 1638 00000865 E81B390000 call print_kmsg 1639 1640 ; this is not necessary ! (20/11/2020) 1641 0000086A 803D[7D090000]C4 cmp byte [vbe2bios], 0C4h 1642 ;jb display_mem_info ; (QEMU) 1643 ; 02/12/2023 1644 00000871 720E jb short not_boch_qemu_vbe 1645 1646 ; Display kernel version message if 0E9h hack port 1647 ; is enabled (bochs emulator feature) 1648 00000873 66BAE900 mov dx, 0E9h ; hack port for BOCHS 1649 00000877 BE[99730100] mov esi, kernel_version_msg 1650 kvmsg_next_char: 1651 0000087C AC lodsb 1652 0000087D 08C0 or al, al 1653 0000087F 7505 jnz short put_kvmsg_in_hack_port 1654 not_boch_qemu_vbe: 1655 00000881 E96CFFFFFF jmp display_mem_info 1656 put_kvmsg_in_hack_port: 1657 00000886 EE out dx, al 1658 00000887 EBF3 jmp short kvmsg_next_char 1659 1660 di1: 1661 ; supress 'jmp short T6' 1662 ; (activate fdc motor control code) 1663 00000889 66C705[DE090000]90- mov word [T5], 9090h ; nop 1663 00000891 90 1664 ; 1665 ;mov ax, int_0Eh ; IRQ 6 handler 1666 ;mov di, 0Eh*4 ; IRQ 6 vector 1667 ;stosw 1668 ;mov ax, cs 1669 ;stosw 1670 ;; 16/02/2015 1671 ;;mov dword [DISKETTE_INT], fdc_int ; IRQ 6 handler 1672 ; 1673 00000892 E823460000 CALL DSKETTE_SETUP ; Initialize Floppy Disks 1674 ; 1675 00000897 09D2 or edx, edx 1676 00000899 740C jz short di3 1677 di2: 1678 0000089B E850460000 call DISK_SETUP ; Initialize Fixed Disks 1679 ;jc setup_error 1680 ; 24/07/2022 1681 000008A0 7305 jnc short di3 1682 000008A2 E97AFFFFFF jmp setup_error 1683 di3: 1684 000008A7 E854380000 call setup_rtc_int ; 22/05/2015 (dsectrpm.s) 1685 ; 1686 000008AC E8E32E0100 call display_disks ; 07/03/2015 (Temporary) 1687 ;haltx: 1688 ; 14/08/2015 1689 ;call getch ; 22/02/2015 1690 ;sti ; Enable interrupts (for CPU) 1691 ; ; 29/01/2016 1692 ; sub ah, ah ; read time count 1693 ; call int1Ah 1694 ; mov edx, ecx ; 18.2 * seconds 1695 ;md_info_msg_wait1: 1696 ; ; 29/01/2016 1697 ; mov ah, 1 1698 ; call int16h 1699 ; jz short md_info_msg_wait2 1700 ; xor ah, ah ; 0 1701 ; call int16h 1702 ; jmp short md_info_msg_ok 1703 ;md_info_msg_wait2: 1704 ; sub ah, ah ; read time count 1705 ; call int1Ah 1706 ; cmp edx, ecx ; ; 18.2 * seconds 1707 ; jna short md_info_msg_wait3 1708 ; xchg edx, ecx 1709 ;md_info_msg_wait3: 1710 ; sub ecx, edx 1711 ; cmp ecx, 127 ; 7 seconds (18.2 * 7) 1712 ; jb short md_info_msg_wait1 1713 ;md_info_msg_ok: 1714 1715 ; 15/12/2020 1716 ; set initial values of LFB parameters 1717 1718 000008B1 803D[7C090000]02 cmp byte [vbe3], 2 1719 000008B8 7225 jb short di4 1720 1721 ;mov ax, [def_LFB_addr] 1722 ;shl eax, 16 1723 ;mov [LFB_ADDR], eax 1724 ;mov eax, 1024*768*3 1725 ;mov [LFB_SIZE], eax 1726 1727 000008BA BEFE7B0900 mov esi, VBE3MODEINFOBLOCK - 2 1728 000008BF 66C7061801 mov word [esi], 0118h ; default vbe mode 1729 ; 1024*768, 24bpp 1730 000008C4 E8E2300000 call set_lfbinfo_table 1731 1732 ;;; 1733 ; 28/11/2023 1734 ; 20/10/2023 - TRDOS 386 v2.0.7 1735 000008C9 8B35[349D0100] mov esi, [LFB_ADDR] ; LFB base address (in bytes) 1736 ;mov edx, [LFB_SIZE] ; 28/11/2023 1737 ;add edx, 4095 1738 ;;; 1739 ;mov edx, ((1024*768*4)+4095)>>12 ; 28/11/2023 1740 000008CF BAE9070000 mov edx, ((1920*1080*4)+4095)>>12 ; 28/11/2023 1741 ; edx = LFB size in pages 1742 1743 ; 29/11/2023 1744 ;mov ebx, esi 1745 ;;add ebx, 4095 ; LFB start addr is always in page boundary 1746 ;shr ebx, 12 ; convert byte address to page address 1747 000008D4 8B0D[B4760100] mov ecx, [memory_size] 1748 ;cmp ebx, ecx 1749 ;jnb short di4 ; LFB addr >= main memory size 1750 1751 ; (set the overlapped pages as allocated for kernel) 1752 ;;; 1753 ; 28/11/2023 1754 ; (and set all of LFB pages in the kernel's page tables) 1755 1756 000008DA E8AC590000 call allocate_lfb_pages_for_kernel 1757 di4: 1758 ; 08/09/2016 1759 000008DF 0F20C0 mov eax, cr0 1760 000008E2 A810 test al, 10h ; Bit 4, ET (Extension Type) 1761 000008E4 7408 jz short sysinit 1762 ; 27/02/2017 1763 000008E6 FE05[74830100] inc byte [fpready] 1764 ; 80387 (FPU) is ready 1765 000008EC DBE3 fninit ; Initialize Floating-Point Unit 1766 sysinit: 1767 ; 30/06/2015 1768 000008EE E8A7630000 call sys_init 1769 ; 1770 ;jmp cpu_reset ; 22/02/2015 1771 hang: 1772 ; 23/02/2015 1773 ;sti ; Enable interrupts 1774 000008F3 F4 hlt 1775 ; 1776 ;nop 1777 ;; 03/12/2014 1778 ;; 28/08/2014 1779 ;mov ah, 11h 1780 ;call getc 1781 ;jz _c8 1782 ; 1783 ; 23/02/2015 1784 ; 06/02/2015 1785 ; 07/09/2014 1786 000008F4 31DB xor ebx, ebx 1787 000008F6 8A1D[DE760100] mov bl, [ptty] ; active_page 1788 000008FC 89DE mov esi, ebx 1789 ;shl si, 1 1790 ; 24/07/2022 1791 000008FE D1E6 shl esi, 1 1792 00000900 81C6[E0760100] add esi, ttychr 1793 00000906 668B06 mov ax, [esi] 1794 00000909 6621C0 and ax, ax 1795 ;jz short _c8 1796 0000090C 74E5 jz short hang 1797 0000090E 66C7060000 mov word [esi], 0 1798 00000913 80FB03 cmp bl, 3 ; Video page 3 1799 ;jb short _c8 1800 00000916 72DB jb short hang 1801 ; 1802 ; 13/05/2016 1803 ; 07/09/2014 1804 nxtl: 1805 ;push bx 1806 ; 18/04/2021 1807 00000918 53 push ebx 1808 00000919 66BB0E00 mov bx, 0Eh ; Yellow character 1809 ; on black background 1810 ; bh = 0 (video page 0) 1811 ; Retro UNIX 386 v1 - Video Mode 0 1812 ; (PC/AT Video Mode 3 - 80x25 Alpha.) 1813 ;push ax 1814 ; 18/04/2021 1815 0000091D 50 push eax 1816 0000091E E8BC190000 call _write_tty 1817 ;pop ax 1818 ; 18/04/2021 1819 00000923 58 pop eax 1820 ;pop bx 1821 00000924 5B pop ebx 1822 00000925 3C0D cmp al, 0Dh ; carriage return (enter) 1823 ;jne short _c8 1824 00000927 75CA jne short hang 1825 00000929 B00A mov al, 0Ah ; next line 1826 0000092B EBEB jmp short nxtl 1827 1828 ;_c8: 1829 ; ; 25/08/2014 1830 ; cli ; Disable interrupts 1831 ; mov al, [scounter + 1] 1832 ; and al, al 1833 ; jnz hang 1834 ; call rtc_p 1835 ; jmp hang 1836 1837 ; 27/08/2014 1838 ; 20/08/2014 1839 printk: 1840 ;mov edi, [scr_row] 1841 pkl: 1842 0000092D AC lodsb 1843 0000092E 08C0 or al, al 1844 00000930 7404 jz short pkr 1845 00000932 66AB stosw 1846 00000934 EBF7 jmp short pkl 1847 pkr: 1848 00000936 C3 retn 1849 1850 ; ************************************* 1851 video_mode_13h_parms: 1852 ; 07/12/2023 - TRDOS 386 v2.0.7 1853 ; Check EDID information for LCD monitors 1854 ; and change mode 13h parameters if it is required 1855 ; (if resolution > 1280x1024, it is LCD/panel monitor 1856 ; and Video Mode 13h parameters will be modified for 60HZ 1857 ; because LCD monitors does/can not display 320x200 70HZ 1858 ; standard VGA mode) 1859 1860 00000937 803D[1D420000]4F cmp byte [edid], 4Fh 1861 0000093E 753B jne short CRT_monitor 1862 1863 00000940 BE[A49C0100] mov esi, edid_info 1864 00000945 83C626 add esi, 26h ; EDID Standard Timing Identification 1865 00000948 B908000000 mov ecx, 8 1866 chk_edid: 1867 0000094D 66AD lodsw 1868 0000094F 3C81 cmp al, 129 ; (1280/8)-31 1869 00000951 770E ja short LCD_monitor ; 16:9 1870 00000953 3C01 cmp al, 1 1871 00000955 7624 jna short CRT_monitor 1872 00000957 E2F4 loop chk_edid 1873 ;jmp short CRT_monitor 1874 00000959 C3 retn 1875 mode13h_crtc_60hz: 1876 0000095A 0B3EB9858FB8E2 db 0Bh, 3Eh, 0B9h, 85h, 8Fh, 0B8h, 0E2h 1877 LCD_monitor: 1878 ; modify default (CRTC register) parameters for 60HZ 1879 ; (320x200 letterbox type screen will appear on LCD screen) 1880 ; 1881 ; Note: When/While [PMI32] -protected mode video bios- 1882 ; feature is enabled -by user- for MODE 13h, internal 1883 ; (TRDOS 386) VGA -video mode setting- parameters 1884 ; will not be used (will be bypassed) 1885 ; by TRDOS 386 kernel for all standard VGA modes. 1886 ; ((NVIDIA/ATI Video Bios PMI will be used.)) 1887 ; 1888 ; ref: github, juj/60hz.cpp 1889 ; https://gist.github.com/juj/ 1890 ; 1891 00000961 B107 mov cl, 7 1892 00000963 BE[5A090000] mov esi, mode13h_crtc_60hz 1893 00000968 BF[CA690000] mov edi, vga_mode_13h+10+6 ; CRTC Registers (index: 6) 1894 0000096D A4 movsb ; Vertical Total Register 1895 0000096E A4 movsb ; Overflow Register 1896 0000096F BF[D4690000] mov edi, vga_mode_13h+10+16 ; CRTC Regs (index: 16) 1897 00000974 A4 movsb ; Vertical Retrace Start Register 1898 00000975 A4 movsb ; Vertical Retrace End Register 1899 00000976 A4 movsb ; Vertical Display Enable/End Register 1900 00000977 47 inc edi 1901 00000978 47 inc edi 1902 00000979 A4 movsb ; Vertical Blanking Start Register 1903 0000097A A4 movsb ; Vertical Blanking End Register 1904 CRT_monitor: 1905 0000097B C3 retn 1906 ; ************************************* 1907 1908 ; 14/11/2020 (TRDOS 386 v2.0.3) 1909 0000097C 00 vbe3: db 0 ; VESA VBE version (must be 03h) 1910 ; for using video bios calls in protected mode 1911 vbe2bios: 1912 0000097D B0 db 0B0h ; 1913 ;pmid_addr: 1914 ;dw 0 ; > 0 if 'PMID' sign is found 1915 ; ; ('pmid' offset addr in VGA bios seg, 0C000h) 1916 ;; 02/12/2020 1917 ;dw 0 ; 32 bit address in pmid_addr 1918 1919 ; 28/02/2017 1920 ; 22/01/2017 1921 ; 15/01/2017 1922 ; 14/01/2017 1923 ; 02/01/2017 1924 ; 25/12/2016 1925 ; 19/12/2016 1926 ; 10/12/2016 (callback) 1927 ; 06/06/2016 1928 ; 23/05/2016 1929 ; 22/05/2016 - TRDOS 386 (TRDOS v2.0) Timer Event Modifications 1930 ; 25/07/2015 1931 ; 14/05/2015 (multi tasking -time sharing- 'clock', x_timer) 1932 ; 17/02/2015 1933 ; 06/02/2015 (unix386.s) 1934 ; 11/12/2014 - 22/12/2014 (dsectrm2.s) 1935 ; 1936 ; IBM PC-XT Model 286 Source Code - BIOS2.ASM (06/10/85) 1937 ; 1938 ;-- HARDWARE INT 08 H - ( IRQ LEVEL 0 ) --------------------------------------- 1939 ; THIS ROUTINE HANDLES THE TIMER INTERRUPT FROM FROM CHANNEL 0 OF : 1940 ; THE 8254 TIMER. INPUT FREQUENCY IS 1.19318 MHZ AND THE DIVISOR : 1941 ; IS 65536, RESULTING IN APPROXIMATELY 18.2 INTERRUPTS EVERY SECOND. : 1942 ; : 1943 ; THE INTERRUPT HANDLER MAINTAINS A COUNT (40:6C) OF INTERRUPTS SINCE : 1944 ; POWER ON TIME, WHICH MAY BE USED TO ESTABLISH TIME OF DAY. : 1945 ; THE INTERRUPT HANDLER ALSO DECREMENTS THE MOTOR CONTROL COUNT (40:40) : 1946 ; OF THE DISKETTE, AND WHEN IT EXPIRES, WILL TURN OFF THE : 1947 ; DISKETTE MOTOR(s), AND RESET THE MOTOR RUNNING FLAGS. : 1948 ; THE INTERRUPT HANDLER WILL ALSO INVOKE A USER ROUTINE THROUGH : 1949 ; INTERRUPT 1CH AT EVERY TIME TICK. THE USER MUST CODE A : 1950 ; ROUTINE AND PLACE THE CORRECT ADDRESS IN THE VECTOR TABLE. : 1951 ;------------------------------------------------------------------------------- 1952 ; 1953 1954 timer_int: ; IRQ 0 1955 ;int_08h: ; Timer 1956 ; 14/10/2015 1957 ; Here, we are simulating system call entry (for task switch) 1958 ; (If multitasking is enabled, 1959 ; 'clock' procedure may jump to 'sysrelease') 1960 1961 0000097E 1E push ds 1962 0000097F 06 push es 1963 00000980 0FA0 push fs 1964 00000982 0FA8 push gs 1965 1966 00000984 60 pushad ; eax, ecx, edx, ebx, esp -before pushad-, ebp, esi, edi 1967 00000985 66B91000 mov cx, KDATA 1968 00000989 8ED9 mov ds, cx 1969 0000098B 8EC1 mov es, cx 1970 0000098D 8EE1 mov fs, cx 1971 0000098F 8EE9 mov gs, cx 1972 1973 00000991 0F20D9 mov ecx, cr3 1974 00000994 890D[7C8F0100] mov [cr3reg], ecx ; save current cr3 register value/content 1975 1976 ; 14/01/2017 1977 0000099A 3B0D[B0760100] cmp ecx, [k_page_dir] 1978 000009A0 7409 je short T3 1979 1980 000009A2 8B0D[B0760100] mov ecx, [k_page_dir] 1981 000009A8 0F22D9 mov cr3, ecx 1982 T3: 1983 ;sti ; INTERRUPTS BACK ON 1984 000009AB 66FF05[30770100] INC word [TIMER_LOW] ; INCREMENT TIME 1985 000009B2 7507 JNZ short T4 ; GO TO TEST_DAY 1986 000009B4 66FF05[32770100] INC word [TIMER_HIGH] ; INCREMENT HIGH WORD OF TIME 1987 T4: ; TEST_DAY 1988 000009BB 66833D[32770100]18 CMP word [TIMER_HIGH],018H ; TEST FOR COUNT EQUALING 24 HOURS 1989 000009C3 7519 JNZ short T5 ; GO TO DISKETTE_CTL 1990 000009C5 66813D[30770100]B0- CMP word [TIMER_LOW],0B0H 1990 000009CD 00 1991 000009CE 750E JNZ short T5 ; GO TO DISKETTE_CTL 1992 1993 ;----- TIMER HAS GONE 24 HOURS 1994 ;;SUB AX,AX 1995 ;MOV [TIMER_HIGH],AX 1996 ;MOV [TIMER_LOW],AX 1997 000009D0 29C0 sub eax, eax 1998 000009D2 A3[30770100] mov [TIMER_LH], eax 1999 ; 2000 000009D7 C605[34770100]01 MOV byte [TIMER_OFL],1 2001 2002 ;----- TEST FOR DISKETTE TIME OUT 2003 2004 T5: 2005 ; 23/12/2014 2006 000009DE EB1D jmp short T6 ; will be replaced with nop, nop 2007 ; (9090h) if a floppy disk 2008 ; is detected. 2009 ;mov al,[CS:MOTOR_COUNT] 2010 000009E0 A0[37770100] mov al, [MOTOR_COUNT] 2011 000009E5 FEC8 dec al 2012 ;mov [CS:MOTOR_COUNT], al ; DECREMENT DISKETTE MOTOR CONTROL 2013 000009E7 A2[37770100] mov [MOTOR_COUNT], al 2014 ;mov [ORG_MOTOR_COUNT], al 2015 000009EC 750F JNZ short T6 ; RETURN IF COUNT NOT OUT 2016 000009EE B0F0 mov al,0F0h 2017 ;AND [CS:MOTOR_STATUS],al ; TURN OFF MOTOR RUNNING BITS 2018 000009F0 2005[36770100] and [MOTOR_STATUS], al 2019 ;and [ORG_MOTOR_STATUS], al 2020 000009F6 B00C MOV AL,0CH ; bit 3 = enable IRQ & DMA, 2021 ; bit 2 = enable controller 2022 ; 1 = normal operation 2023 ; 0 = reset 2024 ; bit 0, 1 = drive select 2025 ; bit 4-7 = motor running bits 2026 000009F8 66BAF203 MOV DX,03F2H ; FDC CTL PORT 2027 000009FC EE OUT DX,AL ; TURN OFF THE MOTOR 2028 T6: 2029 ;inc word [CS:wait_count] ; 22/12/2014 (byte -> word) 2030 ; TIMER TICK INTERRUPT 2031 ;;inc word [wait_count] ;;27/02/2015 2032 ;INT 1CH ; TRANSFER CONTROL TO A USER ROUTINE 2033 ;cli 2034 000009FD E85E040000 call u_timer ; TRANSFER CONTROL TO A USER ROUTINE 2035 ; 23/05/2016 2036 00000A02 E83F110100 call clock ; Multi Tasking control procedure 2037 T7: 2038 ; 14/10/2015 2039 00000A07 B020 MOV AL,EOI ; GET END OF INTERRUPT MASK 2040 00000A09 FA CLI ; DISABLE INTERRUPTS TILL STACK CLEARED 2041 00000A0A E620 OUT INTA00,AL ; END OF INTERRUPT TO 8259 - 1 2042 ; 2043 ;;; 2044 ; 21/08/2024 2045 00000A0C 803D[45830100]FF cmp byte [p_change], 0FFh ; CTRL+BREAK signature 2046 00000A13 7424 je short T9 ; current program will be forced to sysrelease 2047 ;;; 2048 rtc_int_2: 2049 ; 26/12/2016 2050 ;mov ecx, [cr3reg] 2051 ; 13/01/2017 2052 00000A15 803D[E48E0100]00 cmp byte [u.t_lock], 0 ; T_LOCK 2053 00000A1C 7730 ja short timer_int_return ; Timer Lock : 'sysrele' is needed ! 2054 ; 28/02/2017 2055 ; We need to exit if the user's IRQ callback service is in progress! 2056 ; (To prevent a conflict!) 2057 00000A1E 803D[E88E0100]00 cmp byte [u.r_lock], 0 ; R_LOCK, IRQ callback service lock ! 2058 00000A25 7727 ja short timer_int_return ; Timer Lock : 'sysrele' is needed ! 2059 ; 15/01/2017 2060 00000A27 803D[44830100]02 cmp byte [priority], 2 2061 00000A2E 733A jnb short T8 ; current process has a timer event (15/01/2017) 2062 ; 22/05/2016 2063 00000A30 803D[45830100]00 cmp byte [p_change], 0 ; in 'set_run_sequence', in 'rtc_p' 2064 00000A37 7615 jna short timer_int_return ; 23/05/2016 2065 2066 ; 15/01/2017 2067 ; present process must be changed with high priority process 2068 T9: ; 21/08/2024 2069 ;xor al, al 2070 00000A39 31C0 xor eax, eax ; 26/12/2016 2071 00000A3B A2[45830100] mov [p_change], al ; 0 2072 ;mov byte [priority], 2 ; 15/01/2017 (there is a timer event) 2073 2074 00000A40 803D[608E0100]FF cmp byte [sysflg], 0FFh ; user or system space ? 2075 00000A47 7416 je short rtc_int_3 ; user space ([sysflg]= 0FFh) 2076 2077 ; system space, wait for 'sysret' 2078 ; to change running process 2079 ; with high priority (event) process 2080 2081 00000A49 A2[B48E0100] mov [u.quant], al ; 0 2082 2083 timer_int_return: ; 23/05/2016 - jump from 'rtc_int' ('rtc_int_2') 2084 00000A4E 8B0D[7C8F0100] mov ecx, [cr3reg] ; previous value/content of cr3 register 2085 00000A54 0F22D9 mov cr3, ecx ; restore cr3 register content 2086 ; 2087 00000A57 61 popad ; edi, esi, ebp, temp (icrement esp by 4), ebx, edx, ecx, eax 2088 ; 2089 00000A58 0FA9 pop gs 2090 00000A5A 0FA1 pop fs 2091 00000A5C 07 pop es 2092 00000A5D 1F pop ds 2093 ; 2094 00000A5E CF iretd ; return from interrupt 2095 2096 rtc_int_3: 2097 00000A5F FE05[608E0100] inc byte [sysflg] ; now, we are in system space 2098 ; 2099 00000A65 E945C00000 jmp sysrelease ; change running process immediatelly 2100 2101 T8: 2102 ; 13/01/2017 (eax -> ebx) 2103 ; callback checking... (19/12/2016) 2104 00000A6A 31DB xor ebx, ebx 2105 00000A6C 871D[E08E0100] xchg ebx, [u.tcb] ; callback address (0 = normal return) 2106 00000A72 09DB or ebx, ebx 2107 00000A74 74D8 jz short timer_int_return 2108 2109 ; Set user's callback routine as return address from this interrupt 2110 ; and set normal return address as return address from callback 2111 ; routine!!! (19/12/2016) 2112 2113 ; 14/01/2017 2114 ; 13/01/2017 - Timer Lock (T_LOCK) 2115 00000A76 FE05[E48E0100] inc byte [u.t_lock] 2116 00000A7C 8A0D[608E0100] mov cl, [sysflg] 2117 00000A82 880D[E58E0100] mov [u.t_mode], cl 2118 2119 00000A88 8B2D[4C760100] mov ebp, [tss.esp0] ; kernel stack address (for ring 0) 2120 00000A8E 83ED14 sub ebp, 20 ; eip, cs, eflags, esp, ss 2121 00000A91 892D[648E0100] mov [u.sp], ebp 2122 00000A97 8925[688E0100] mov [u.usp], esp 2123 2124 ;or word [ebp+8], 200h ; 22/01/2017, force enabling interrupts 2125 2126 00000A9D 8B44241C mov eax, [esp+28] ; pushed eax 2127 00000AA1 A3[6C8E0100] mov [u.r0], eax 2128 2129 00000AA6 E82CFF0000 call wswap ; save user's registers & status 2130 2131 ; software int is in ring 0 but timer int must return to ring 3 2132 ; so, ring 3 return address and stack registers 2133 ; (eip, cs, eflags, esp, ss) 2134 ; must be copied to timer int return 2135 ; eip will be replaced by callback service routine address 2136 2137 00000AAB C605[608E0100]FF mov byte [sysflg], 0FFh ; user mode 2138 2139 ; system mode (system call) 2140 ;mov ebp, [u.sp] ; EIP (u), CS (UCODE), EFLAGS (u), 2141 ; ESP (u), SS (UDATA) 2142 2143 00000AB2 8B4510 mov eax, [ebp+16] ; SS (UDATA 2144 00000AB5 89E6 mov esi, esp 2145 00000AB7 50 push eax 2146 00000AB8 50 push eax 2147 00000AB9 89E7 mov edi, esp 2148 00000ABB 893D[688E0100] mov [u.usp], edi 2149 00000AC1 B908000000 mov ecx, ((ESPACE/4) - 4) ; except DS, ES, FS, GS 2150 00000AC6 F3A5 rep movsd 2151 00000AC8 B104 mov cl, 4 2152 00000ACA F3AB rep stosd 2153 00000ACC 893D[648E0100] mov [u.sp], edi 2154 00000AD2 89EE mov esi, ebp 2155 00000AD4 B105 mov cl, 5 ; EIP (u), CS (UCODE), EFLAGS (u), ESP (u), SS (UDATA) 2156 00000AD6 F3A5 rep movsd 2157 2158 00000AD8 8B0D[C48E0100] mov ecx, [u.pgdir] 2159 00000ADE 890D[7C8F0100] mov [cr3reg], ecx 2160 2161 ; 13/01/207 (eax -> ebx) 2162 ; EBX = callback routine address (virtual, not physical address!) 2163 2164 ; 09/01/2017 2165 ; !!! CALLBACK ROUTINE MUST BE ENDED/RETURNED WITH 'sysrele' 2166 ; system call !!! 2167 ; 25/12/2016 2168 ; Callback Note: (19/12/2016) 2169 ; !!! CALLBACK ROUTINE MUST BE ENDED/RETURNED WITH 'RETN' !!! 2170 ; pushf ; save flags 2171 ; 2172 ; popf ; restore flags 2173 ; retn ; return to normal running address 2174 ; 2175 2176 ; 15/01/2017 2177 ; 14/01/2017 2178 ; 13/01/2017 (eax -> ebx) 2179 ; 10/01/2017 2180 set_callback_addr: 2181 ; 09/01/2017 (**) 2182 ; 02/01/2017 (*) 2183 ; 25/12/2016 (*) 2184 ; 19/12/2016 (TRDOS 386 feature only!) 2185 ; 2186 ; This routine sets return address 2187 ; to start of user's interrupt 2188 ; service (callback) address 2189 ;; and sets callback 'retn' address to normal 2190 ;; return address of user's running code! 2191 ; 2192 ; INPUT: 2193 ; EBX = callback routine/service address 2194 ; (virtual, not physical address!) 2195 ; [u.sp] = kernel stack, points to 2196 ; user's EIP,CS,EFLAGS,ESP,SS 2197 ; registers. 2198 ; OUTPUT: 2199 ; EIP (user) = callback (service) address 2200 ; CS (user) = UCODE 2201 ; EFLAGS (user) = flags before callback 2202 ; ESP (user) = ESP-4 (user, before callback) 2203 ; [ESP](user) = EIP (user) before callback 2204 ; 2205 ; Note: If CPU was in user mode while entering 2206 ; the timer interrupt service routine, 2207 ; 'IRET' will get return to callback routine 2208 ; immediately. If CPU was in system/kernel mode 2209 ; 'iret' will get return to system call and 2210 ; then, callback routine will be return address 2211 ; from system call. (User's callback/service code 2212 ; will be able to return to normal return address 2213 ; via an 'retn' at the end.) 2214 ; 2215 ; Note(**): User's callback service code must be ended 2216 ; with a 'sysrele' sytstem call ! (09/01/2017) 2217 ; 2218 ; For example: 2219 ; 2220 ; timer_callback: 2221 ; ... 2222 ; inc dword [time_counter] 2223 ; ... 2224 ; mov eax, 39 ; 'sysrele' 2225 ; int 40h ; TRDOS 386 system call (interrupt) 2226 ; 2227 ; 2228 ;; Note(*): User's callback service code must preserve cpu 2229 ;; flags if it has any instructions which changes 2230 ;; flags in the service code. (25/12/2016) 2231 ;; 2232 ;; For example: 2233 ;; 2234 ;; timer_callback: 2235 ;; pushf ; save flags 2236 ;; ; this instruction changes zero flag 2237 ;; inc dword [time_counter] 2238 ;; popf ; restore flags 2239 ;; retn ; return to normal user code 2240 ;; (which is interrupted by the 2241 ;; timer interput) 2242 ;; 2243 2244 ; 15/01/2017 2245 00000AE4 8B2D[648E0100] mov ebp, [u.sp]; kernel's stack, points to EIP (user) 2246 00000AEA 895D00 mov [ebp], ebx 2247 00000AED E95CFFFFFF jmp timer_int_return 2248 2249 ; 15/01/2017 2250 ; 13/01/2017 2251 ; 19/12/2016 2252 ; 06/06/2016 2253 ; 23/05/2016 2254 ; 22/05/2016 2255 ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 2256 ; 26/02/2015 2257 ; 07/09/2014 2258 ; 25/08/2014 2259 rtc_int: ; Real Time Clock Interrupt (IRQ 8) 2260 ; 22/05/2016 2261 00000AF2 1E push ds ; ** ; 23/05/2016 2262 00000AF3 50 push eax ; * 2263 00000AF4 66B81000 mov ax, KDATA 2264 00000AF8 8ED8 mov ds, ax 2265 ; 2266 00000AFA 8A25[2E770100] mov ah, [RTC_2Hz] ; 2 Hz interrupt to 1 Hz function 2267 00000B00 80F401 xor ah, 1 2268 00000B03 8825[2E770100] mov [RTC_2Hz], ah ; 1 = 0.5 second, 0 = 1 second 2269 00000B09 753B jnz short rtc_int_return ; half second 2270 ; 1 second 2271 rtc_int_0: 2272 ; 22/05/2016 2273 00000B0B 58 pop eax ; * 2274 ; 2275 ; 14/10/2015 ('timer_int') 2276 ; Here, we are simulating system call entry (for task switch) 2277 ; (If multitasking is enabled, 2278 ; 'clock' procedure may jump to 'sysrelease') 2279 ;push ds ; ** ; 23/05/2016 2280 00000B0C 06 push es 2281 00000B0D 0FA0 push fs 2282 00000B0F 0FA8 push gs 2283 00000B11 60 pushad ; eax, ecx, edx, ebx, esp -before pushad-, ebp, esi, edi 2284 00000B12 66B91000 mov cx, KDATA 2285 ;mov ds, cx ; 06/06/2016 2286 00000B16 8EC1 mov es, cx 2287 00000B18 8EE1 mov fs, cx 2288 00000B1A 8EE9 mov gs, cx 2289 ; 2290 00000B1C 0F20D9 mov ecx, cr3 2291 00000B1F 890D[7C8F0100] mov [cr3reg], ecx ; save current cr3 register value/content 2292 ; 2293 00000B25 803D[E48E0100]00 cmp byte [u.t_lock], 0 ; timer lock (callback) status ? 2294 00000B2C 7711 ja short rtc_int_1 ; yes 2295 2296 ; 15/01/2017 2297 00000B2E 3B0D[B0760100] cmp ecx, [k_page_dir] 2298 00000B34 7409 je short rtc_int_1 2299 2300 00000B36 8B0D[B0760100] mov ecx, [k_page_dir] 2301 00000B3C 0F22D9 mov cr3, ecx 2302 rtc_int_1: 2303 ; Timer event (kernel) functions must be performed with 2304 ; 1 second intervals - TRDOS 386 (TRDOS v2.0) feature ! - 2305 ; 2306 ; 25/08/2014 2307 00000B3F E818030000 call rtc_p ; 19/05/2016 - major modification 2308 2309 ; 23/05/2016 2310 00000B44 28E4 sub ah, ah ; 0 2311 ; 22/05/2016 - TRDOS 386 timer event modifications 2312 rtc_int_return: ; 19/05/2016 2313 ; 22/02/2015 - dsectpm.s 2314 ; [ source: http://wiki.osdev.org/RTC ] 2315 ; read status register C to complete procedure 2316 ;(it is needed to get a next IRQ 8) 2317 00000B46 B00C mov al, 0Ch ; 2318 00000B48 E670 out 70h, al ; select register C 2319 00000B4A 90 nop 2320 00000B4B E471 in al, 71h ; just throw away contents 2321 ; 22/02/2015 2322 00000B4D B020 MOV AL,EOI ; END OF INTERRUPT 2323 ;CLI ; DISABLE INTERRUPTS TILL STACK CLEARED 2324 00000B4F E6A0 OUT INTB00,AL ; FOR CONTROLLER #2 2325 2326 ; 23/05/2016 2327 00000B51 B020 MOV AL,EOI ; GET END OF INTERRUPT MASK 2328 00000B53 FA CLI ; DISABLE INTERRUPTS TILL STACK CLEARED 2329 00000B54 E620 OUT INTA00,AL ; END OF INTERRUPT TO 8259 - 1 2330 ; 2331 ; 23/05/2016 2332 00000B56 20E4 and ah, ah 2333 ;jz rtc_int_2 2334 ; 24/07/2022 2335 00000B58 7505 jnz short rtc_int_4 2336 00000B5A E9B6FEFFFF jmp rtc_int_2 2337 rtc_int_4: 2338 ; ah = 1 (half second) 2339 00000B5F 58 pop eax ; * 2340 00000B60 1F pop ds ; ** 2341 00000B61 CF iretd 2342 2343 ; //////////////// 2344 2345 ; 28/08/2014 2346 irq0: 2347 00000B62 6A00 push dword 0 2348 00000B64 EB48 jmp short which_irq 2349 irq1: 2350 00000B66 6A01 push dword 1 2351 00000B68 EB44 jmp short which_irq 2352 irq2: 2353 00000B6A 6A02 push dword 2 2354 00000B6C EB40 jmp short which_irq 2355 irq3: 2356 ; 20/11/2015 2357 ; 24/10/2015 2358 00000B6E 2EFF15[D01C0100] call dword [cs:com2_irq3] 2359 00000B75 6A03 push dword 3 2360 00000B77 EB35 jmp short which_irq 2361 irq4: 2362 ; 20/11/2015 2363 ; 24/10/2015 2364 00000B79 2EFF15[CC1C0100] call dword [cs:com1_irq4] 2365 00000B80 6A04 push dword 4 2366 00000B82 EB2A jmp short which_irq 2367 irq5: 2368 00000B84 6A05 push dword 5 2369 00000B86 EB26 jmp short which_irq 2370 irq6: 2371 00000B88 6A06 push dword 6 2372 00000B8A EB22 jmp short which_irq 2373 irq7: 2374 00000B8C 6A07 push dword 7 2375 00000B8E EB1E jmp short which_irq 2376 irq8: 2377 00000B90 6A08 push dword 8 2378 00000B92 EB1A jmp short which_irq 2379 irq9: 2380 00000B94 6A09 push dword 9 2381 00000B96 EB16 jmp short which_irq 2382 irq10: 2383 00000B98 6A0A push dword 10 2384 00000B9A EB12 jmp short which_irq 2385 irq11: 2386 00000B9C 6A0B push dword 11 2387 00000B9E EB0E jmp short which_irq 2388 irq12: 2389 00000BA0 6A0C push dword 12 2390 00000BA2 EB0A jmp short which_irq 2391 irq13: 2392 00000BA4 6A0D push dword 13 2393 00000BA6 EB06 jmp short which_irq 2394 irq14: 2395 00000BA8 6A0E push dword 14 2396 00000BAA EB02 jmp short which_irq 2397 irq15: 2398 00000BAC 6A0F push dword 15 2399 ;jmp short which_irq 2400 2401 ; 22/01/2017 2402 ; 19/10/2015 2403 ; 29/08/2014 2404 ; 21/08/2014 2405 which_irq: 2406 00000BAE 870424 xchg eax, [esp] ; 28/08/2014 2407 00000BB1 53 push ebx 2408 00000BB2 56 push esi 2409 00000BB3 57 push edi 2410 00000BB4 1E push ds 2411 00000BB5 06 push es 2412 ; 2413 00000BB6 88C3 mov bl, al 2414 ; 2415 00000BB8 B810000000 mov eax, KDATA 2416 00000BBD 8ED8 mov ds, ax 2417 00000BBF 8EC0 mov es, ax 2418 ; 19/10/2015 2419 00000BC1 FC cld 2420 ; 27/08/2014 2421 00000BC2 8105[F0350100]A000- add dword [scr_row], 0A0h 2421 00000BCA 0000 2422 ; 2423 00000BCC B417 mov ah, 17h ; blue (1) background, 2424 ; light gray (7) forecolor 2425 00000BCE 8B3D[F0350100] mov edi, [scr_row] 2426 00000BD4 B049 mov al, 'I' 2427 00000BD6 66AB stosw 2428 00000BD8 B052 mov al, 'R' 2429 00000BDA 66AB stosw 2430 00000BDC B051 mov al, 'Q' 2431 00000BDE 66AB stosw 2432 00000BE0 B020 mov al, ' ' 2433 00000BE2 66AB stosw 2434 00000BE4 88D8 mov al, bl 2435 00000BE6 3C0A cmp al, 10 2436 00000BE8 7208 jb short ii1 2437 00000BEA B031 mov al, '1' 2438 00000BEC 66AB stosw 2439 00000BEE 88D8 mov al, bl 2440 00000BF0 2C0A sub al, 10 2441 ii1: 2442 00000BF2 0430 add al, '0' 2443 00000BF4 66AB stosw 2444 00000BF6 B020 mov al, ' ' 2445 00000BF8 66AB stosw 2446 00000BFA B021 mov al, '!' 2447 00000BFC 66AB stosw 2448 00000BFE B020 mov al, ' ' 2449 00000C00 66AB stosw 2450 ; 23/02/2015 2451 00000C02 80FB07 cmp bl, 7 ; check for IRQ 8 to IRQ 15 2452 00000C05 7604 jna ii2 2453 ; 22/01/2017 2454 00000C07 B020 mov al, 20h ; END OF INTERRUPT COMMAND TO 2455 00000C09 E6A0 out 0A0h, al ; the 2nd 8259 2456 ii2: 2457 00000C0B B020 mov al, 20h ; END OF INTERRUPT COMMAND TO 2458 00000C0D E620 out 20h, al ; the 2nd 8259 2459 00000C0F E9CA010000 jmp iiret 2460 ; 2461 ; 22/08/2014 2462 ;mov al, 20h ; END OF INTERRUPT COMMAND TO 8259 2463 ;out 20h, al ; 8259 PORT 2464 ; 2465 ;pop es 2466 ;pop ds 2467 ;pop edi 2468 ;pop esi 2469 ;pop ebx 2470 ;pop eax 2471 ;iret 2472 2473 ; 02/04/2015 2474 ; 25/08/2014 2475 exc0: 2476 00000C14 6A00 push dword 0 2477 00000C16 E990000000 jmp cpu_except 2478 exc1: 2479 00000C1B 6A01 push dword 1 2480 00000C1D E989000000 jmp cpu_except 2481 exc2: 2482 00000C22 6A02 push dword 2 2483 00000C24 E982000000 jmp cpu_except 2484 exc3: 2485 00000C29 6A03 push dword 3 2486 00000C2B EB7E jmp cpu_except 2487 exc4: 2488 00000C2D 6A04 push dword 4 2489 00000C2F EB7A jmp cpu_except 2490 exc5: 2491 00000C31 6A05 push dword 5 2492 00000C33 EB76 jmp cpu_except 2493 exc6: 2494 00000C35 6A06 push dword 6 2495 00000C37 EB72 jmp cpu_except 2496 exc7: 2497 00000C39 6A07 push dword 7 2498 00000C3B EB6E jmp cpu_except 2499 exc8: 2500 ; [esp] = Error code 2501 00000C3D 6A08 push dword 8 2502 00000C3F EB5C jmp cpu_except_en 2503 exc9: 2504 00000C41 6A09 push dword 9 2505 00000C43 EB66 jmp cpu_except 2506 exc10: 2507 ; [esp] = Error code 2508 00000C45 6A0A push dword 10 2509 00000C47 EB54 jmp cpu_except_en 2510 exc11: 2511 ; [esp] = Error code 2512 00000C49 6A0B push dword 11 2513 00000C4B EB50 jmp cpu_except_en 2514 exc12: 2515 ; [esp] = Error code 2516 00000C4D 6A0C push dword 12 2517 00000C4F EB4C jmp cpu_except_en 2518 exc13: 2519 ; [esp] = Error code 2520 00000C51 6A0D push dword 13 2521 00000C53 EB48 jmp cpu_except_en 2522 exc14: 2523 ; [esp] = Error code 2524 00000C55 6A0E push dword 14 2525 00000C57 EB44 jmp short cpu_except_en 2526 exc15: 2527 00000C59 6A0F push dword 15 2528 00000C5B EB4E jmp cpu_except 2529 exc16: 2530 00000C5D 6A10 push dword 16 2531 00000C5F EB4A jmp cpu_except 2532 exc17: 2533 ; [esp] = Error code 2534 00000C61 6A11 push dword 17 2535 00000C63 EB38 jmp short cpu_except_en 2536 exc18: 2537 00000C65 6A12 push dword 18 2538 00000C67 EB42 jmp short cpu_except 2539 exc19: 2540 00000C69 6A13 push dword 19 2541 00000C6B EB3E jmp short cpu_except 2542 exc20: 2543 00000C6D 6A14 push dword 20 2544 00000C6F EB3A jmp short cpu_except 2545 exc21: 2546 00000C71 6A15 push dword 21 2547 00000C73 EB36 jmp short cpu_except 2548 exc22: 2549 00000C75 6A16 push dword 22 2550 00000C77 EB32 jmp short cpu_except 2551 exc23: 2552 00000C79 6A17 push dword 23 2553 00000C7B EB2E jmp short cpu_except 2554 exc24: 2555 00000C7D 6A18 push dword 24 2556 00000C7F EB2A jmp short cpu_except 2557 exc25: 2558 00000C81 6A19 push dword 25 2559 00000C83 EB26 jmp short cpu_except 2560 exc26: 2561 00000C85 6A1A push dword 26 2562 00000C87 EB22 jmp short cpu_except 2563 exc27: 2564 00000C89 6A1B push dword 27 2565 00000C8B EB1E jmp short cpu_except 2566 exc28: 2567 00000C8D 6A1C push dword 28 2568 00000C8F EB1A jmp short cpu_except 2569 exc29: 2570 00000C91 6A1D push dword 29 2571 00000C93 EB16 jmp short cpu_except 2572 exc30: 2573 00000C95 6A1E push dword 30 2574 00000C97 EB04 jmp short cpu_except_en 2575 exc31: 2576 00000C99 6A1F push dword 31 2577 00000C9B EB0E jmp short cpu_except 2578 2579 ; 19/10/2015 2580 ; 19/09/2015 2581 ; 01/09/2015 2582 ; 28/08/2015 2583 ; 28/08/2014 2584 cpu_except_en: 2585 00000C9D 87442404 xchg eax, [esp+4] ; Error code 2586 00000CA1 36A3[80900100] mov [ss:error_code], eax 2587 00000CA7 58 pop eax ; Exception number 2588 00000CA8 870424 xchg eax, [esp] 2589 ; eax = eax before exception 2590 ; [esp] -> exception number 2591 ; [esp+4] -> EIP to return 2592 ; 22/01/2017 2593 ; 19/10/2015 2594 ; 19/09/2015 2595 ; 01/09/2015 2596 ; 28/08/2015 2597 ; 29/08/2014 2598 ; 28/08/2014 2599 ; 25/08/2014 2600 ; 21/08/2014 2601 cpu_except: ; CPU Exceptions 2602 00000CAB FC cld 2603 00000CAC 870424 xchg eax, [esp] 2604 ; eax = Exception number 2605 ; [esp] = eax (before exception) 2606 00000CAF 53 push ebx 2607 00000CB0 56 push esi 2608 00000CB1 57 push edi 2609 00000CB2 1E push ds 2610 00000CB3 06 push es 2611 ; 28/08/2015 2612 00000CB4 66BB1000 mov bx, KDATA 2613 00000CB8 8EDB mov ds, bx 2614 00000CBA 8EC3 mov es, bx 2615 00000CBC 0F20DB mov ebx, cr3 2616 00000CBF 53 push ebx ; (*) page directory 2617 ; 19/10/2015 2618 00000CC0 FC cld 2619 ; 25/03/2015 2620 00000CC1 8B1D[B0760100] mov ebx, [k_page_dir] 2621 00000CC7 0F22DB mov cr3, ebx 2622 ; 28/08/2015 2623 00000CCA 83F80E cmp eax, 0Eh ; 14, PAGE FAULT 2624 00000CCD 7510 jne short cpu_except_nfp 2625 00000CCF E8FD4D0000 call page_fault_handler 2626 00000CD4 21C0 and eax, eax 2627 ;jz iiretp ; 01/09/2015 2628 ; 24/07/2022 2629 00000CD6 7505 jnz short cpu_except_pf 2630 00000CD8 E9FD000000 jmp iiretp 2631 cpu_except_pf: ; 24/07/2022 2632 00000CDD B00E mov al, 0Eh ; 14 2633 cpu_except_nfp: 2634 ; 23/08/2016 2635 00000CDF 803D[2E680000]03 cmp byte [CRT_MODE], 3 2636 00000CE6 7409 je short cpu_except_mode_3 2637 00000CE8 50 push eax 2638 00000CE9 B003 mov al, 3 2639 00000CEB E8950E0000 call _set_mode 2640 00000CF0 58 pop eax 2641 cpu_except_mode_3: 2642 ; 02/04/2015 2643 00000CF1 BB[F3080000] mov ebx, hang 2644 00000CF6 875C241C xchg ebx, [esp+28] 2645 ; EIP (points to instruction which faults) 2646 ; New EIP (hang) 2647 00000CFA 891D[84900100] mov [FaultOffset], ebx 2648 00000D00 C744242008000000 mov dword [esp+32], KCODE ; kernel's code segment 2649 00000D08 814C242400020000 or dword [esp+36], 200h ; enable interrupts (set IF) 2650 ; 2651 00000D10 88C4 mov ah, al 2652 00000D12 240F and al, 0Fh 2653 00000D14 3C09 cmp al, 9 2654 00000D16 7602 jna short h1ok 2655 00000D18 0407 add al, 'A'-':' 2656 h1ok: 2657 00000D1A C0EC04 shr ah, 4 2658 00000D1D 80FC09 cmp ah, 9 2659 00000D20 7603 jna short h2ok 2660 00000D22 80C407 add ah, 'A'-':' 2661 h2ok: 2662 00000D25 86E0 xchg ah, al 2663 00000D27 66053030 add ax, '00' 2664 00000D2B 66A3[48380100] mov [excnstr], ax 2665 ; 2666 ; 29/08/2014 2667 00000D31 A1[84900100] mov eax, [FaultOffset] 2668 00000D36 51 push ecx 2669 00000D37 52 push edx 2670 00000D38 89E3 mov ebx, esp 2671 ; 28/08/2015 2672 00000D3A B910000000 mov ecx, 16 ; divisor value to convert binary number 2673 ; to hexadecimal string 2674 ;mov ecx, 10 ; divisor to convert 2675 ; binary number to decimal string 2676 b2d1: 2677 00000D3F 31D2 xor edx, edx 2678 00000D41 F7F1 div ecx 2679 ;push dx 2680 ; 18/04/2021 2681 00000D43 52 push edx 2682 00000D44 39C8 cmp eax, ecx 2683 00000D46 73F7 jnb short b2d1 2684 00000D48 BF[53380100] mov edi, EIPstr ; EIP value 2685 ; points to instruction which faults 2686 ; 28/08/2015 2687 00000D4D 89C2 mov edx, eax 2688 b2d2: 2689 ;add al, '0' 2690 00000D4F 8A82[0D420000] mov al, [edx+hexchrs] 2691 00000D55 AA stosb ; write hexadecimal digit to its place 2692 00000D56 39E3 cmp ebx, esp 2693 00000D58 7605 jna short b2d3 2694 ;pop ax 2695 ; 18/04/2021 2696 00000D5A 58 pop eax 2697 00000D5B 88C2 mov dl, al 2698 00000D5D EBF0 jmp short b2d2 2699 b2d3: 2700 00000D5F B068 mov al, 'h' ; 28/08/2015 2701 00000D61 AA stosb 2702 00000D62 B020 mov al, 20h ; space 2703 00000D64 AA stosb 2704 00000D65 30C0 xor al, al ; to do it an ASCIIZ string 2705 00000D67 AA stosb 2706 ; 2707 00000D68 5A pop edx 2708 00000D69 59 pop ecx 2709 ; 2710 00000D6A B44F mov ah, 4Fh ; red (4) background, 2711 ; white (F) forecolor 2712 00000D6C BE[38380100] mov esi, exc_msg ; message offset 2713 ; 2714 ; 20/01/2017 (!cpu exception!) 2715 ; 2716 00000D71 8105[F0350100]A000- add dword [scr_row], 0A0h 2716 00000D79 0000 2717 00000D7B 8B3D[F0350100] mov edi, [scr_row] 2718 ; 2719 00000D81 C605[608E0100]00 mov byte [sysflg], 0 ; system mode 2720 00000D88 FB sti 2721 ; 2722 00000D89 E89FFBFFFF call printk 2723 ; 2724 00000D8E B410 mov ah, 10h 2725 00000D90 E87D010000 call int16h ; getc 2726 ; 2727 00000D95 B003 mov al, 3 2728 00000D97 E8E90D0000 call _set_mode 2729 ; 2730 ;mov eax, 1 2731 ; 30/11/2023 2732 00000D9C 31C0 xor eax, eax 2733 00000D9E 40 inc eax 2734 ; eax = 1 2735 00000D9F E928BE0000 jmp sysexit ; terminate process !!! 2736 2737 ; 22/01/2017 2738 ; 18/04/2016 2739 ; 28/08/2015 2740 ; 23/02/2015 2741 ; 20/08/2014 2742 ignore_int: 2743 00000DA4 50 push eax 2744 00000DA5 53 push ebx ; 23/02/2015 2745 00000DA6 56 push esi 2746 00000DA7 57 push edi 2747 00000DA8 1E push ds 2748 00000DA9 06 push es 2749 ; 18/04/2016 2750 00000DAA 66B81000 mov ax, KDATA 2751 00000DAE 8ED8 mov ds, ax 2752 00000DB0 8EC0 mov es, ax 2753 ; 28/08/2015 2754 00000DB2 0F20D8 mov eax, cr3 2755 00000DB5 50 push eax ; (*) page directory 2756 ; 2757 00000DB6 B467 mov ah, 67h ; brown (6) background, 2758 ; light gray (7) forecolor 2759 00000DB8 BE[00370100] mov esi, int_msg ; message offset 2760 piemsg: 2761 ; 27/08/2014 2762 00000DBD 8105[F0350100]A000- add dword [scr_row], 0A0h 2762 00000DC5 0000 2763 00000DC7 8B3D[F0350100] mov edi, [scr_row] 2764 ; 2765 00000DCD E85BFBFFFF call printk 2766 ; 2767 ; 23/02/2015 2768 00000DD2 B020 mov al, 20h ; END OF INTERRUPT COMMAND TO 2769 00000DD4 E6A0 out 0A0h, al ; the 2nd 8259 2770 ; 22/08/2014 2771 00000DD6 B020 mov al, 20h ; END OF INTERRUPT COMMAND TO 8259 2772 00000DD8 E620 out 20h, al ; 8259 PORT 2773 iiretp: 2774 ; 22/01/2017 2775 ; 01/09/2015 2776 ; 28/08/2015 2777 00000DDA 58 pop eax ; (*) page directory 2778 00000DDB 0F22D8 mov cr3, eax 2779 iiret: 2780 00000DDE 07 pop es 2781 00000DDF 1F pop ds 2782 00000DE0 5F pop edi 2783 00000DE1 5E pop esi 2784 00000DE2 5B pop ebx ; 29/08/2014 2785 00000DE3 58 pop eax 2786 00000DE4 CF iretd 2787 2788 ; 23/05/2016 2789 ; 22/08/2014 2790 ; IBM PC/AT BIOS source code ----- 10/06/85 (bios.asm) 2791 ; (INT 1Ah) 2792 ;; Linux (v0.12) source code (main.c) by Linus Torvalds (1991) 2793 time_of_day: 2794 00000DE5 E83F570000 call UPD_IPR ; WAIT TILL UPDATE NOT IN PROGRESS 2795 00000DEA 726F jc short time_of_day_retn ; 23/05/2016 2796 00000DEC B000 mov al, CMOS_SECONDS 2797 00000DEE E86C570000 call CMOS_READ 2798 00000DF3 A2[20770100] mov [time_seconds], al 2799 00000DF8 B002 mov al, CMOS_MINUTES 2800 00000DFA E860570000 call CMOS_READ 2801 00000DFF A2[21770100] mov [time_minutes], al 2802 00000E04 B004 mov al, CMOS_HOURS 2803 00000E06 E854570000 call CMOS_READ 2804 00000E0B A2[22770100] mov [time_hours], al 2805 00000E10 B006 mov al, CMOS_DAY_WEEK 2806 00000E12 E848570000 call CMOS_READ 2807 00000E17 A2[23770100] mov [date_wday], al 2808 00000E1C B007 mov al, CMOS_DAY_MONTH 2809 00000E1E E83C570000 call CMOS_READ 2810 00000E23 A2[24770100] mov [date_day], al 2811 00000E28 B008 mov al, CMOS_MONTH 2812 00000E2A E830570000 call CMOS_READ 2813 00000E2F A2[25770100] mov [date_month], al 2814 00000E34 B009 mov al, CMOS_YEAR 2815 00000E36 E824570000 call CMOS_READ 2816 00000E3B A2[26770100] mov [date_year], al 2817 00000E40 B032 mov al, CMOS_CENTURY 2818 00000E42 E818570000 call CMOS_READ 2819 00000E47 A2[27770100] mov [date_century], al 2820 ; 2821 00000E4C B000 mov al, CMOS_SECONDS 2822 00000E4E E80C570000 call CMOS_READ 2823 00000E53 3A05[20770100] cmp al, [time_seconds] 2824 00000E59 758A jne short time_of_day 2825 2826 time_of_day_retn: 2827 00000E5B C3 retn 2828 2829 ; 15/01/2017 2830 ; 10/06/2016 2831 ; 07/06/2016 2832 ; 06/06/2016 2833 ; 23/05/2016 2834 rtc_p: 2835 00000E5C B101 mov cl, 1 ; 15/01/2017 2836 00000E5E EB02 jmp short rtc_p0 2837 u_timer: 2838 ; Timer Events with 18.2 Hz Timer Ticks 2839 ; (and also timer events with RTC seconds) 2840 00000E60 28C9 sub cl, cl ; mov cl, 0 ; 15/01/2017 2841 rtc_p0: 2842 ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 2843 ; Major Modification: 2844 ; Check and Perform Timer Events (for RTC) 2845 ; 25/08/2014 - 07/09/2014 2846 ; Retro UNIX 386 v1: 2847 ; Print Real Time Clock content 2848 2849 ; 15/01/2017 2850 00000E62 880D[44830100] mov byte [priority], cl ; 0 or 1 (not 2) 2851 00000E68 8A2D[47830100] mov ch, [timer_events] 2852 00000E6E 20ED and ch, ch 2853 00000E70 7420 jz short rtc_p3 2854 2855 00000E72 BE[808F0100] mov esi, timer_set ; beginning address of 2856 ; timer events space 2857 rtc_p1: 2858 00000E77 8B06 mov eax, [esi] 2859 00000E79 20C0 and al, al ; 0 = free, >0 = process no. 2860 00000E7B 7416 jz short rtc_p4 2861 ; 2862 00000E7D C1C810 ror eax, 16 2863 ; ah = response value, al = interrupt type 2864 ; 15/01/2017 2865 ; cl = interrupt source 2866 ; 1 = RTC, 0 = PIT 2867 00000E80 38C8 cmp al, cl 2868 00000E82 750A jne short rtc_p2 ; not as requested or undefined ! 2869 00000E84 3C01 cmp al, 1 ; 1 ; RTC interrupt ? 2870 00000E86 7410 je short rtc_p5 ; yes, check for response 2871 ; 06/06/2016 - 18.2 Hz Timer Ticks 2872 00000E88 836E080A sub dword [esi+8], 10 ; 1 tick = 10 2873 00000E8C 7613 jna short rtc_p6 ; continue for responding 2874 rtc_p2: 2875 ; 15/01/2017 (cl -> ch) 2876 ; 07/06/2016 2877 00000E8E FECD dec ch ; remain count of timer events 2878 00000E90 7501 jnz short rtc_p4 2879 rtc_p3: 2880 00000E92 C3 retn 2881 rtc_p4: 2882 ;cmp esi, timer_set + 240 ; 15*16 (last event) 2883 ;jnb short rtc_p3 ; end of timer event space 2884 00000E93 83C610 add esi, 16 ; next timer event 2885 00000E96 EBDF jmp short rtc_p1 2886 rtc_p5: 2887 ; current timer count ; 06/06/2016 (182) 2888 00000E98 816E08B6000000 sub dword [esi+8], 182 ; 1 second (10*18.2) 2889 00000E9F 77ED ja short rtc_p2 ; check for the next 2890 rtc_p6: 2891 ; it is the time of response! 2892 00000EA1 8B5E04 mov ebx, [esi+4] ; set (count limit) value 2893 00000EA4 895E08 mov [esi+8], ebx ; reset count down value 2894 ; to count limit 2895 ; 19/12/2016 2896 ; 10/12/2016 - timer callback modification 2897 00000EA7 8B7E0C mov edi, [esi+12] ; response (or callback) address 2898 00000EAA 807E0100 cmp byte [esi+1], 0 ; >0 = callback 2899 00000EAE 762A jna short rtc_p8 2900 2901 ; timer callback ! 2902 00000EB0 0FB61E movzx ebx, byte [esi] ; process number (>0) 2903 00000EB3 89D8 mov eax, ebx 2904 00000EB5 C0E302 shl bl, 2 ; *4 2905 00000EB8 89BB[FC8D0100] mov [ebx+p.tcb-4], edi ; user's callback service addr 2906 00000EBE 3A05[BD8E0100] cmp al, [u.uno] 2907 00000EC4 7521 jne short rtc_p9 2908 00000EC6 893D[E08E0100] mov [u.tcb], edi 2909 rtc_p7: 2910 ; 15/01/2017 2911 00000ECC B002 mov al, 2 2912 00000ECE A2[44830100] mov [priority], al ; 2 2913 ; 10/01/2017 2914 ;mov byte [u.pri], 2 2915 00000ED3 A2[B68E0100] mov [u.pri], al ; 2 2916 00000ED8 EBB4 jmp short rtc_p2 2917 rtc_p8: 2918 ; response address is physical address of 2919 ; the program's response (signal return) byte 2920 ; 06/06/2016 2921 ;mov edi, [esi+12] ; response address 2922 00000EDA 8827 mov [edi], ah ; response value 2923 ; 2924 00000EDC C1C010 rol eax, 16 2925 ; 15/01/2017 2926 00000EDF 3A05[BD8E0100] cmp al, [u.uno] ; running process ? 2927 00000EE5 74E5 je short rtc_p7 2928 rtc_p9: 2929 ; al = process number ; 10/06/2016 2930 00000EE7 B202 mov dl, 2 ; priority, 2 = event (high) 2931 00000EE9 E80D0C0100 call set_run_sequence ; 19/05/2016 2932 00000EEE EB9E jmp short rtc_p2 ; 10/06/2016 2933 2934 ; Default IRQ 7 handler against spurious IRQs (from master PIC) 2935 ; 25/02/2015 (source: http://wiki.osdev.org/8259_PIC) 2936 default_irq7: 2937 ;push ax 2938 ; 18/04/2021 2939 00000EF0 50 push eax 2940 00000EF1 B00B mov al, 0Bh ; In-Service register 2941 00000EF3 E620 out 20h, al 2942 00000EF5 EB00 jmp short $+2 2943 00000EF7 EB00 jmp short $+2 2944 00000EF9 E420 in al, 20h 2945 00000EFB 2480 and al, 80h ; bit 7 (is it real IRQ 7 or fake?) 2946 00000EFD 7404 jz short irq7_iret ; Fake (spurious) IRQ, do not send EOI 2947 00000EFF B020 mov al, 20h ; EOI 2948 00000F01 E620 out 20h, al 2949 irq7_iret: 2950 ;pop ax 2951 ; 18/04/2021 2952 00000F03 58 pop eax 2953 00000F04 CF iretd 2954 2955 bcd_to_ascii: 2956 ; 25/08/2014 2957 ; INPUT -> 2958 ; al = Packed BCD number 2959 ; OUTPUT -> 2960 ; ax = ASCII word/number 2961 ; 2962 ; Erdogan Tan - 1998 (proc_hex) - TRDOS.ASM (2004-2011) 2963 ; 2964 00000F05 D410 db 0D4h, 10h ; Undocumented inst. AAM 2965 ; AH = AL / 10h 2966 ; AL = AL MOD 10h 2967 00000F07 660D3030 or ax, '00' ; Make it ASCII based 2968 2969 00000F0B 86E0 xchg ah, al 2970 2971 00000F0D C3 retn 2972 2973 ; 15/12/2020 2974 real_mem_16m_64k: 2975 00000F0E 0000 dw 0 ; Real size of system memory (if > 16MB) 2976 ; as number of 64K blocks - 256 2977 ; (This is for saving real system memory 2978 ; because if system memory is larger than 2979 ; 3 GB and if a VESA VBE video bios 2980 ; is detected, 'mem_16m_64K' may be 2981 ; decreased to reserve LFB space 2982 ; at the end of system memory.) 2983 ; Upper memory space from LFB base address 2984 ; to 4GB will not be included by M.A.T. 2985 def_LFB_addr: 2986 00000F10 0000 dw 0 ; HW of default LFB addr (for mode 118h) 2987 2988 2989 %include 'keyboard.s' ; 07/03/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - keyboard.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 07/08/2022 (Previous: 12/04/2021) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 17/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; keyboard.inc (17/10/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Ref: Retro UNIX 386 v1.2 - keyboard.s - 11/06/2022 20 <1> 21 <1> ; Retro UNIX 386 v1 Kernel - KEYBOARD.INC 22 <1> ; Last Modification: 17/10/2015 23 <1> ; (Keyboard Data is in 'KYBDATA.INC') 24 <1> ; 25 <1> ; ///////// KEYBOARD FUNCTIONS (PROCEDURES) /////////////// 26 <1> 27 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 28 <1> 29 <1> ; 03/12/2014 30 <1> ; 26/08/2014 31 <1> ; KEYBOARD I/O 32 <1> ; (INT_16h - Retro UNIX 8086 v1 - U9.ASM, 30/06/2014) 33 <1> 34 <1> ;NOTE: 'k0' to 'k7' are name of OPMASK registers. 35 <1> ; (The reason of using '_k' labels!!!) (27/08/2014) 36 <1> ;NOTE: 'NOT' keyword is '~' unary operator in NASM. 37 <1> ; ('NOT LC_HC' --> '~LC_HC') (bit reversing operator) 38 <1> 39 <1> int16h: ; 30/06/2015 40 <1> ;getc: 41 00000F12 9C <1> pushfd ; 28/08/2014 42 00000F13 0E <1> push cs 43 00000F14 E826000000 <1> call KEYBOARD_IO_1 ; getc_int 44 00000F19 C3 <1> retn 45 <1> 46 <1> ; 24/07/2022 - TRDOS 386 v2.0.5 47 <1> 48 <1> ;----- SHIFT STATUS 49 <1> _K3E: ; GET THE EXTENDED SHIFT STATUS FLAGS 50 00000F1A 8A25[FA670000] <1> mov ah, [KB_FLAG_1] ; GET SYSTEM SHIFT KEY STATUS 51 00000F20 80E404 <1> and ah, SYS_SHIFT ; MASK ALL BUT SYS KEY BIT 52 <1> ;mov cl, 5 ; SHIFT THEW SYSTEMKEY BIT OVER TO 53 <1> ;shl ah, cl ; BIT 7 POSITION 54 00000F23 C0E405 <1> shl ah, 5 55 00000F26 A0[FA670000] <1> mov al, [KB_FLAG_1] ; GET SYSTEM SHIFT STATES BACK 56 00000F2B 2473 <1> and al, 01110011b ; ELIMINATE SYS SHIFT, HOLD_STATE AND INS_SHIFT 57 00000F2D 08C4 <1> or ah, al ; MERGE REMAINING BITS INTO AH 58 00000F2F A0[FC670000] <1> mov al, [KB_FLAG_3] ; GET RIGHT CTL AND ALT 59 00000F34 240C <1> and al, 00001100b ; ELIMINATE LC_E0 AND LC_E1 60 00000F36 08C4 <1> or ah, al ; OR THE SHIFT FLAGS TOGETHER 61 <1> _K3: 62 00000F38 A0[F9670000] <1> mov al, [KB_FLAG] ; GET THE SHIFT STATUS FLAGS 63 <1> ; 24/07/2022 64 00000F3D EB38 <1> jmp short _KIO_EXIT ; RETURN TO CALLER 65 <1> 66 <1> getc_int: 67 <1> ; 28/02/2015 68 <1> ; 03/12/2014 (derivation from pc-xt-286 bios source code -1986-, 69 <1> ; instead of pc-at bios - 1985-) 70 <1> ; 28/08/2014 (_k1d) 71 <1> ; 30/06/2014 72 <1> ; 03/03/2014 73 <1> ; 28/02/2014 74 <1> ; Derived from "KEYBOARD_IO_1" procedure of IBM "pc-xt-286" 75 <1> ; rombios source code (21/04/1986) 76 <1> ; 'keybd.asm', INT 16H, KEYBOARD_IO 77 <1> ; 78 <1> ; KYBD --- 03/06/86 KEYBOARD BIOS 79 <1> ; 80 <1> ;--- INT 16 H ----------------------------------------------------------------- 81 <1> ; KEYBOARD I/O : 82 <1> ; THESE ROUTINES PROVIDE READ KEYBOARD SUPPORT : 83 <1> ; INPUT : 84 <1> ; (AH)= 00H READ THE NEXT ASCII CHARACTER ENTERED FROM THE KEYBOARD, : 85 <1> ; RETURN THE RESULT IN (AL), SCAN CODE IN (AH). : 86 <1> ; THIS IS THE COMPATIBLE READ INTERFACE, EQUIVALENT TO THE : 87 <1> ; STANDARD PC OR PCAT KEYBOARD : 88 <1> ;-----------------------------------------------------------------------------: 89 <1> ; (AH)= 01H SET THE ZERO FLAG TO INDICATE IF AN ASCII CHARACTER IS : 90 <1> ; AVAILABLE TO BE READ FROM THE KEYBOARD BUFFER. : 91 <1> ; (ZF)= 1 -- NO CODE AVAILABLE : 92 <1> ; (ZF)= 0 -- CODE IS AVAILABLE (AX)= CHARACTER : 93 <1> ; IF (ZF)= 0, THE NEXT CHARACTER IN THE BUFFER TO BE READ IS : 94 <1> ; IN (AX), AND THE ENTRY REMAINS IN THE BUFFER. : 95 <1> ; THIS WILL RETURN ONLY PC/PCAT KEYBOARD COMPATIBLE CODES : 96 <1> ;-----------------------------------------------------------------------------: 97 <1> ; (AH)= 02H RETURN THE CURRENT SHIFT STATUS IN AL REGISTER : 98 <1> ; THE BIT SETTINGS FOR THIS CODE ARE INDICATED IN THE : 99 <1> ; EQUATES FOR @KB_FLAG : 100 <1> ;-----------------------------------------------------------------------------: 101 <1> ; (AH)= 03H SET TYPAMATIC RATE AND DELAY : 102 <1> ; (AL) = 05H : 103 <1> ; (BL) = TYPAMATIC RATE (BITS 5 - 7 MUST BE RESET TO 0) : 104 <1> ; : 105 <1> ; REGISTER RATE REGISTER RATE : 106 <1> ; VALUE SELECTED VALUE SELECTED : 107 <1> ; -------------------------------------------- : 108 <1> ; 00H 30.0 10H 7.5 : 109 <1> ; 01H 26.7 11H 6.7 : 110 <1> ; 02H 24.0 12H 6.0 : 111 <1> ; 03H 21.8 13H 5.5 : 112 <1> ; 04H 20.0 14H 5.0 : 113 <1> ; 05H 18.5 15H 4.6 : 114 <1> ; 06H 17.1 16H 4.3 : 115 <1> ; 07H 16.0 17H 4.0 : 116 <1> ; 08H 15.0 18H 3.7 : 117 <1> ; 09H 13.3 19H 3.3 : 118 <1> ; 0AH 12.0 1AH 3.0 : 119 <1> ; 0BH 10.9 1BH 2.7 : 120 <1> ; 0CH 10.0 1CH 2.5 : 121 <1> ; 0DH 9.2 1DH 2.3 : 122 <1> ; 0EH 8.6 1EH 2.1 : 123 <1> ; 0FH 8.0 1FH 2.0 : 124 <1> ; : 125 <1> ; (BH) = TYPAMATIC DELAY (BITS 2 - 7 MUST BE RESET TO 0) : 126 <1> ; : 127 <1> ; REGISTER DELAY : 128 <1> ; VALUE VALUE : 129 <1> ; ------------------ : 130 <1> ; 00H 250 ms : 131 <1> ; 01H 500 ms : 132 <1> ; 02H 750 ms : 133 <1> ; 03H 1000 ms : 134 <1> ;-----------------------------------------------------------------------------: 135 <1> ; (AH)= 05H PLACE ASCII CHARACTER/SCAN CODE COMBINATION IN KEYBOARD : 136 <1> ; BUFFER AS IF STRUCK FROM KEYBOARD : 137 <1> ; ENTRY: (CL) = ASCII CHARACTER : 138 <1> ; (CH) = SCAN CODE : 139 <1> ; EXIT: (AH) = 00H = SUCCESSFUL OPERATION : 140 <1> ; (AL) = 01H = UNSUCCESSFUL - BUFFER FULL : 141 <1> ; FLAGS: CARRY IF ERROR : 142 <1> ;-----------------------------------------------------------------------------: 143 <1> ; (AH)= 10H EXTENDED READ INTERFACE FOR THE ENHANCED KEYBOARD, : 144 <1> ; OTHERWISE SAME AS FUNCTION AH=0 : 145 <1> ;-----------------------------------------------------------------------------: 146 <1> ; (AH)= 11H EXTENDED ASCII STATUS FOR THE ENHANCED KEYBOARD, : 147 <1> ; OTHERWISE SAME AS FUNCTION AH=1 : 148 <1> ;-----------------------------------------------------------------------------: 149 <1> ; (AH)= 12H RETURN THE EXTENDED SHIFT STATUS IN AX REGISTER : 150 <1> ; AL = BITS FROM KB_FLAG, AH = BITS FOR LEFT AND RIGHT : 151 <1> ; CTL AND ALT KEYS FROM KB_FLAG_1 AND KB_FLAG_3 : 152 <1> ; OUTPUT : 153 <1> ; AS NOTED ABOVE, ONLY (AX) AND FLAGS CHANGED : 154 <1> ; ALL REGISTERS RETAINED : 155 <1> ;------------------------------------------------------------------------------ 156 <1> 157 <1> ; 07/08/2022 158 <1> ; 24/07/2022 - TRDOS 386 v2.0.5 159 <1> ; 12/04/2021 - TRDOS 386 v2.0.3 (32 bit push/pop) 160 <1> ; 15/01/2017 161 <1> ; 14/01/2017 162 <1> ; 02/01/2017 163 <1> ; 29/05/2016 164 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 165 <1> int32h: ; Keyboard BIOS 166 <1> 167 <1> KEYBOARD_IO_1: 168 <1> ;sti ; INTERRUPTS BACK ON 169 <1> ; 29/05/2016 170 00000F3F 80642408BE <1> and byte [esp+8], 10111110b ; clear zero flag and cary flag 171 <1> ; 172 00000F44 1E <1> push ds ; SAVE CURRENT DS 173 00000F45 53 <1> push ebx ; SAVE BX TEMPORARILY 174 <1> ;push ecx ; SAVE CX TEMPORARILY 175 00000F46 66BB1000 <1> mov bx, KDATA 176 00000F4A 8EDB <1> mov ds, bx ; PUT SEGMENT VALUE OF DATA AREA INTO DS 177 <1> ; 14/01/2017 178 00000F4C 8B1C24 <1> mov ebx, [esp] 179 <1> ;; 15/01/2017 180 <1> ; 02/01/2017 181 <1> ;;mov byte [intflg], 32h ; keyboard interrupt 182 00000F4F FB <1> sti 183 <1> ; 184 00000F50 08E4 <1> or ah, ah ; CHECK FOR (AH)= 00H 185 00000F52 7433 <1> jz short _K1 ; ASCII_READ 186 00000F54 FECC <1> dec ah ; CHECK FOR (AH)= 01H 187 00000F56 744C <1> jz short _K2 ; ASCII_STATUS 188 00000F58 FECC <1> dec ah ; CHECK FOR (AH)= 02H 189 00000F5A 74DC <1> jz short _K3 ; SHIFT STATUS 190 00000F5C FECC <1> dec ah ; CHECK FOR (AH)= 03H 191 00000F5E 746F <1> jz short _K300 ; SET TYPAMATIC RATE/DELAY 192 00000F60 80EC02 <1> sub ah, 2 ; CHECK FOR (AH)= 05H 193 <1> ;jz short _K500 ; KEYBOARD WRITE 194 <1> ; 07/08/2022 195 00000F63 7505 <1> jnz short _KIO1 196 00000F65 E988000000 <1> jmp _K500 197 <1> _KIO1: 198 00000F6A 80EC0B <1> sub ah, 11 ; AH = 10H 199 00000F6D 740C <1> jz short _K1E ; EXTENDED ASCII READ 200 00000F6F FECC <1> dec ah ; CHECK FOR (AH)= 11H 201 00000F71 7422 <1> jz short _K2E ; EXTENDED_ASCII_STATUS 202 00000F73 FECC <1> dec ah ; CHECK FOR (AH)= 12H 203 00000F75 74A3 <1> jz short _K3E ; EXTENDED_SHIFT_STATUS 204 <1> _KIO_EXIT: 205 <1> ; 02/01/2017 206 00000F77 FA <1> cli 207 <1> ;;mov byte [intflg], 0 ;; 15/01/2017 208 <1> ; 209 <1> ;pop ecx ; RECOVER REGISTER 210 00000F78 5B <1> pop ebx ; RECOVER REGISTER 211 00000F79 1F <1> pop ds ; RECOVER SEGMENT 212 00000F7A CF <1> iretd ; INVALID COMMAND, EXIT 213 <1> 214 <1> ; 24/07/2022 215 <1> ; 216 <1> ; ;----- SHIFT STATUS 217 <1> ;_K3E: ; GET THE EXTENDED SHIFT STATUS FLAGS 218 <1> ; mov ah, [KB_FLAG_1] ; GET SYSTEM SHIFT KEY STATUS 219 <1> ; and ah, SYS_SHIFT ; MASK ALL BUT SYS KEY BIT 220 <1> ; ;mov cl, 5 ; SHIFT THEW SYSTEMKEY BIT OVER TO 221 <1> ; ;shl ah, cl ; BIT 7 POSITION 222 <1> ; shl ah, 5 223 <1> ; mov al, [KB_FLAG_1] ; GET SYSTEM SHIFT STATES BACK 224 <1> ; and al, 01110011b ; ELIMINATE SYS SHIFT, HOLD_STATE AND INS_SHIFT 225 <1> ; or ah, al ; MERGE REMAINING BITS INTO AH 226 <1> ; mov al, [KB_FLAG_3] ; GET RIGHT CTL AND ALT 227 <1> ; and al, 00001100b ; ELIMINATE LC_E0 AND LC_E1 228 <1> ; or ah, al ; OR THE SHIFT FLAGS TOGETHER 229 <1> ;_K3: 230 <1> ; mov al, [KB_FLAG] ; GET THE SHIFT STATUS FLAGS 231 <1> ; ; 24/07/2022 232 <1> ; jmp short _KIO_EXIT ; RETURN TO CALLER 233 <1> 234 <1> ;----- ASCII CHARACTER 235 <1> _K1E: 236 00000F7B E89F000000 <1> call _K1S ; GET A CHARACTER FROM THE BUFFER (EXTENDED) 237 00000F80 E812010000 <1> call _KIO_E_XLAT ; ROUTINE TO XLATE FOR EXTENDED CALLS 238 00000F85 EBF0 <1> jmp short _KIO_EXIT ; GIVE IT TO THE CALLER 239 <1> _K1: 240 00000F87 E893000000 <1> call _K1S ; GET A CHARACTER FROM THE BUFFER 241 00000F8C E811010000 <1> call _KIO_S_XLAT ; ROUTINE TO XLATE FOR STANDARD CALLS 242 00000F91 72F4 <1> jc short _K1 ; CARRY SET MEANS TROW CODE AWAY 243 <1> _K1A: 244 00000F93 EBE2 <1> jmp short _KIO_EXIT ; RETURN TO CALLER 245 <1> 246 <1> ;----- ASCII STATUS 247 <1> _K2E: 248 00000F95 E8D0000000 <1> call _K2S ; TEST FOR CHARACTER IN BUFFER (EXTENDED) 249 00000F9A 7420 <1> jz short _K2B ; RETURN IF BUFFER EMPTY 250 00000F9C 9C <1> pushf ; SAVE ZF FROM TEST 251 00000F9D E8F5000000 <1> call _KIO_E_XLAT ; ROUTINE TO XLATE FOR EXTENDED CALLS 252 00000FA2 EB17 <1> jmp short _K2A ; GIVE IT TO THE CALLER 253 <1> _K2: 254 00000FA4 E8C1000000 <1> call _K2S ; TEST FOR CHARACTER IN BUFFER 255 00000FA9 7411 <1> jz short _K2B ; RETURN IF BUFFER EMPTY 256 00000FAB 9C <1> pushf ; SAVE ZF FROM TEST 257 00000FAC E8F1000000 <1> call _KIO_S_XLAT ; ROUTINE TO XLATE FOR STANDARD CALLS 258 00000FB1 7308 <1> jnc short _K2A ; CARRY CLEAR MEANS PASS VALID CODE 259 00000FB3 9D <1> popf ; INVALID CODE FOR THIS TYPE OF CALL 260 00000FB4 E866000000 <1> call _K1S ; THROW THE CHARACTER AWAY 261 00000FB9 EBE9 <1> jmp short _K2 ; GO LOOK FOR NEXT CHAR, IF ANY 262 <1> _K2A: 263 00000FBB 9D <1> popf ; RESTORE ZF FROM TEST 264 <1> _K2B: 265 <1> ; 02/01/2017 266 00000FBC FA <1> cli 267 <1> ;; mov byte [intflg], 0 ;; 15/01/2017 268 <1> ; 269 <1> ;pop ecx ; RECOVER REGISTER 270 00000FBD 5B <1> pop ebx ; RECOVER REGISTER 271 00000FBE 1F <1> pop ds ; RECOVER SEGMENT 272 <1> ; (*) 29/05/2016 273 <1> ; (*) retf 4 ; THROW AWAY (e)FLAGS 274 00000FBF 7208 <1> jc short _k2d 275 00000FC1 7505 <1> jnz short _k2c 276 00000FC3 804C240840 <1> or byte [esp+8], 01000000b ; set zero flag bit of eflags register 277 <1> _k2c: 278 00000FC8 CF <1> iretd 279 <1> _k2d: 280 <1> ; 29/05/2016 -set carry flag on stack- 281 <1> ; [esp] = EIP 282 <1> ; [esp+4] = CS 283 <1> ; [esp+8] = E-FLAGS 284 00000FC9 804C240801 <1> or byte [esp+8], 1 ; set carry bit of eflags register 285 <1> ; [esp+12] = ESP (user) 286 <1> ; [esp+16] = SS (User) 287 00000FCE CF <1> iretd 288 <1> 289 <1> ; (*) 29/05/2016 - 'retf 4' intruction causes to stack fault 290 <1> ; (OUTER-PRIVILEGE-LEVEL) 291 <1> ; INTEL 80386 PROGRAMMER'S REFERENCE MANUAL 1986 292 <1> ; // RETF instruction: 293 <1> ; 294 <1> ; IF OperandMode=32 THEN 295 <1> ; Load CS:EIP from stack; 296 <1> ; Set CS RPL to CPL; 297 <1> ; Increment ESP by 8 plus the immediate offset if it exists; 298 <1> ; Load SS:ESP from stack; 299 <1> ; ELSE (* OperandMode=16 *) 300 <1> ; Load CS:IP from stack; 301 <1> ; Set CS RPL to CPL; 302 <1> ; Increment SP by 4 plus the immediate offset if it exists; 303 <1> ; Load SS:SP from stack; 304 <1> ; FI; 305 <1> ; 306 <1> ; // 307 <1> 308 <1> ; 24/07/2022 309 <1> ;----- SET TYPAMATIC RATE AND DELAY 310 <1> _K300: 311 00000FCF 3C05 <1> cmp al, 5 ; CORRECT FUNCTION CALL? 312 00000FD1 75A4 <1> jne short _KIO_EXIT ; NO, RETURN 313 00000FD3 F6C3E0 <1> test bl, 0E0h ; TEST FOR OUT-OF-RANGE RATE 314 00000FD6 759F <1> jnz short _KIO_EXIT ; RETURN IF SO 315 00000FD8 F6C7FC <1> test bh, 0FCh ; TEST FOR OUT-OF-RANGE DELAY 316 00000FDB 759A <1> jnz short _KIO_EXIT ; RETURN IF SO 317 00000FDD B0F3 <1> mov al, KB_TYPA_RD ; COMMAND FOR TYPAMATIC RATE/DELAY 318 00000FDF E875060000 <1> call SND_DATA ; SEND TO KEYBOARD 319 <1> ;mov cx, 5 ; SHIFT COUNT 320 <1> ;shl bh, cl ; SHIFT DELAY OVER 321 00000FE4 C0E705 <1> shl bh, 5 322 00000FE7 88D8 <1> mov al, bl ; PUT IN RATE 323 00000FE9 08F8 <1> or al, bh ; AND DELAY 324 00000FEB E869060000 <1> call SND_DATA ; SEND TO KEYBOARD 325 00000FF0 EB85 <1> jmp _KIO_EXIT ; RETURN TO CALLER 326 <1> 327 <1> ;----- WRITE TO KEYBOARD BUFFER 328 <1> _K500: 329 00000FF2 56 <1> push esi ; SAVE SI (esi) 330 00000FF3 FA <1> cli ; 331 00000FF4 8B1D[0A680000] <1> mov ebx, [BUFFER_TAIL] ; GET THE 'IN TO' POINTER TO THE BUFFER 332 00000FFA 89DE <1> mov esi, ebx ; SAVE A COPY IN CASE BUFFER NOT FULL 333 00000FFC E8D1000000 <1> call _K4 ; BUMP THE POINTER TO SEE IF BUFFER IS FULL 334 00001001 3B1D[06680000] <1> cmp ebx, [BUFFER_HEAD] ; WILL THE BUFFER OVERRUN IF WE STORE THIS? 335 00001007 740D <1> je short _K502 ; YES - INFORM CALLER OF ERROR 336 00001009 66890E <1> mov [esi], cx ; NO - PUT ASCII/SCAN CODE INTO BUFFER 337 0000100C 891D[0A680000] <1> mov [BUFFER_TAIL], ebx ; ADJUST 'IN TO' POINTER TO REFLECT CHANGE 338 00001012 28C0 <1> sub al, al ; TELL CALLER THAT OPERATION WAS SUCCESSFUL 339 00001014 EB02 <1> jmp short _K504 ; SUB INSTRUCTION ALSO RESETS CARRY FLAG 340 <1> _K502: 341 00001016 B001 <1> mov al, 01h ; BUFFER FULL INDICATION 342 <1> _K504: 343 00001018 FB <1> sti 344 00001019 5E <1> pop esi ; RECOVER SI (esi) 345 0000101A E958FFFFFF <1> jmp _KIO_EXIT ; RETURN TO CALLER WITH STATUS IN AL 346 <1> 347 <1> ;----- READ THE KEY TO FIGURE OUT WHAT TO DO ----- 348 <1> _K1S: 349 0000101F FA <1> cli ; 03/12/2014 350 00001020 8B1D[06680000] <1> mov ebx, [BUFFER_HEAD] ; GET POINTER TO HEAD OF BUFFER 351 00001026 3B1D[0A680000] <1> cmp ebx, [BUFFER_TAIL] ; TEST END OF BUFFER 352 <1> ;jne short _K1U ; IF ANYTHING IN BUFFER SKIP INTERRUPT 353 0000102C 750F <1> jne short _k1x ; 03/12/2014 354 <1> ; 355 <1> ; 03/12/2014 356 <1> ; 28/08/2014 357 <1> ; PERFORM OTHER FUNCTION ?? here ! 358 <1> ;; MOV AX, 9002h ; MOVE IN WAIT CODE & TYPE 359 <1> ;; INT 15H ; PERFORM OTHER FUNCTION 360 <1> _K1T: ; ASCII READ 361 0000102E FB <1> sti ; INTERRUPTS BACK ON DURING LOOP 362 0000102F 90 <1> nop ; ALLOW AN INTERRUPT TO OCCUR 363 <1> _K1U: 364 00001030 FA <1> cli ; INTERRUPTS BACK OFF 365 00001031 8B1D[06680000] <1> mov ebx, [BUFFER_HEAD] ; GET POINTER TO HEAD OF BUFFER 366 00001037 3B1D[0A680000] <1> cmp ebx, [BUFFER_TAIL] ; TEST END OF BUFFER 367 <1> _k1x: 368 0000103D 53 <1> push ebx ; SAVE ADDRESS 369 0000103E 9C <1> pushf ; SAVE FLAGS 370 0000103F E8C9060000 <1> call MAKE_LED ; GO GET MODE INDICATOR DATA BYTE 371 00001044 8A1D[FB670000] <1> mov bl, [KB_FLAG_2] ; GET PREVIOUS BITS 372 0000104A 30C3 <1> xor bl, al ; SEE IF ANY DIFFERENT 373 0000104C 80E307 <1> and bl, 07h ; KB_LEDS ; ISOLATE INDICATOR BITS 374 0000104F 7406 <1> jz short _K1V ; IF NO CHANGE BYPASS UPDATE 375 00001051 E863060000 <1> call SND_LED1 376 00001056 FA <1> cli ; DISABLE INTERRUPTS 377 <1> _K1V: 378 00001057 9D <1> popf ; RESTORE FLAGS 379 00001058 5B <1> pop ebx ; RESTORE ADDRESS 380 00001059 74D3 <1> je short _K1T ; LOOP UNTIL SOMETHING IN BUFFER 381 <1> ; 382 0000105B 668B03 <1> mov ax, [ebx] ; GET SCAN CODE AND ASCII CODE 383 0000105E E86F000000 <1> call _K4 ; MOVE POINTER TO NEXT POSITION 384 00001063 891D[06680000] <1> mov [BUFFER_HEAD], ebx ; STORE VALUE IN VARIABLE 385 00001069 C3 <1> retn ; RETURN 386 <1> 387 <1> ;----- READ THE KEY TO SEE IF ONE IS PRESENT ----- 388 <1> _K2S: 389 0000106A FA <1> cli ; INTERRUPTS OFF 390 0000106B 8B1D[06680000] <1> mov ebx, [BUFFER_HEAD] ; GET HEAD POINTER 391 00001071 3B1D[0A680000] <1> cmp ebx, [BUFFER_TAIL] ; IF EQUAL (Z=1) THEN NOTHING THERE 392 00001077 668B03 <1> mov ax, [ebx] 393 0000107A 9C <1> pushf ; SAVE FLAGS 394 <1> ;push ax ; SAVE CODE 395 <1> ; 12/04/2021 396 0000107B 50 <1> push eax 397 0000107C E88C060000 <1> call MAKE_LED ; GO GET MODE INDICATOR DATA BYTE 398 00001081 8A1D[FB670000] <1> mov bl, [KB_FLAG_2] ; GET PREVIOUS BITS 399 00001087 30C3 <1> xor bl, al ; SEE IF ANY DIFFERENT 400 00001089 80E307 <1> and bl, 07h ; KB_LEDS ; ISOLATE INDICATOR BITS 401 0000108C 7405 <1> jz short _K2T ; IF NO CHANGE BYPASS UPDATE 402 0000108E E80F060000 <1> call SND_LED ; GO TURN ON MODE INDICATORS 403 <1> _K2T: 404 <1> ;pop ax ; RESTORE CODE 405 <1> ; 12/04/2021 406 00001093 58 <1> pop eax 407 00001094 9D <1> popf ; RESTORE FLAGS 408 00001095 FB <1> sti ; INTERRUPTS BACK ON 409 00001096 C3 <1> retn ; RETURN 410 <1> 411 <1> ;----- ROUTINE TO TRANSLATE SCAN CODE PAIRS FOR EXTENDED CALLS ----- 412 <1> _KIO_E_XLAT: 413 00001097 3CF0 <1> cmp al, 0F0h ; IS IT ONE OF THE FILL-INs? 414 00001099 7506 <1> jne short _KIO_E_RET ; NO, PASS IT ON 415 0000109B 08E4 <1> or ah, ah ; AH = 0 IS SPECIAL CASE 416 0000109D 7402 <1> jz short _KIO_E_RET ; PASS THIS ON UNCHANGED 417 0000109F 30C0 <1> xor al, al ; OTHERWISE SET AL = 0 418 <1> _KIO_E_RET: 419 000010A1 C3 <1> retn ; GO BACK 420 <1> 421 <1> ;----- ROUTINE TO TRANSLATE SCAN CODE PAIRS FOR STANDARD CALLS ----- 422 <1> _KIO_S_XLAT: 423 000010A2 80FCE0 <1> cmp ah, 0E0h ; IS IT KEYPAD ENTER OR / ? 424 000010A5 750F <1> jne short _KIO_S2 ; NO, CONTINUE 425 000010A7 3C0D <1> cmp al, 0Dh ; KEYPAD ENTER CODE? 426 000010A9 7408 <1> je short _KIO_S1 ; YES, MASSAGE A BIT 427 000010AB 3C0A <1> cmp al, 0Ah ; CTRL KEYPAD ENTER CODE? 428 000010AD 7404 <1> je short _KIO_S1 ; YES, MASSAGE THE SAME 429 000010AF B435 <1> mov ah, 35h ; NO, MUST BE KEYPAD / 430 <1> _kio_ret: ; 03/12/2014 431 000010B1 F8 <1> clc 432 000010B2 C3 <1> retn 433 <1> ;jmp short _KIO_USE ; GIVE TO CALLER 434 <1> _KIO_S1: 435 000010B3 B41C <1> mov ah, 1Ch ; CONVERT TO COMPATIBLE OUTPUT 436 <1> ;jmp short _KIO_USE ; GIVE TO CALLER 437 000010B5 C3 <1> retn 438 <1> _KIO_S2: 439 000010B6 80FC84 <1> cmp ah, 84h ; IS IT ONE OF EXTENDED ONES? 440 000010B9 7715 <1> ja short _KIO_DIS ; YES, THROW AWAY AND GET ANOTHER CHAR 441 000010BB 3CF0 <1> cmp al, 0F0h ; IS IT ONE OF THE FILL-INs? 442 000010BD 7506 <1> jne short _KIO_S3 ; NO, TRY LAST TEST 443 000010BF 08E4 <1> or ah, ah ; AH = 0 IS SPECIAL CASE 444 000010C1 740C <1> jz short _KIO_USE ; PASS THIS ON UNCHANGED 445 000010C3 EB0B <1> jmp short _KIO_DIS ; THROW AWAY THE REST 446 <1> _KIO_S3: 447 000010C5 3CE0 <1> cmp al, 0E0h ; IS IT AN EXTENSION OF A PREVIOUS ONE? 448 <1> ;jne short _KIO_USE ; NO, MUST BE A STANDARD CODE 449 000010C7 75E8 <1> jne short _kio_ret 450 000010C9 08E4 <1> or ah, ah ; AH = 0 IS SPECIAL CASE 451 000010CB 7402 <1> jz short _KIO_USE ; JUMP IF AH = 0 452 000010CD 30C0 <1> xor al, al ; CONVERT TO COMPATIBLE OUTPUT 453 <1> ;jmp short _KIO_USE ; PASS IT ON TO CALLER 454 <1> _KIO_USE: 455 <1> ;clc ; CLEAR CARRY TO INDICATE GOOD CODE 456 000010CF C3 <1> retn ; RETURN 457 <1> _KIO_DIS: 458 000010D0 F9 <1> stc ; SET CARRY TO INDICATE DISCARD CODE 459 000010D1 C3 <1> retn ; RETURN 460 <1> 461 <1> ;----- INCREMENT BUFFER POINTER ROUTINE ----- 462 <1> _K4: 463 000010D2 43 <1> inc ebx 464 000010D3 43 <1> inc ebx ; MOVE TO NEXT WORD IN LIST 465 000010D4 3B1D[02680000] <1> cmp ebx, [BUFFER_END] ; AT END OF BUFFER? 466 <1> ;jne short _K5 ; NO, CONTINUE 467 000010DA 7206 <1> jb short _K5 468 000010DC 8B1D[FE670000] <1> mov ebx, [BUFFER_START] ; YES, RESET TO BUFFER BEGINNING 469 <1> _K5: 470 000010E2 C3 <1> retn 471 <1> 472 <1> ; 20/02/2015 473 <1> ; 05/12/2014 474 <1> ; 26/08/2014 475 <1> ; KEYBOARD (HARDWARE) INTERRUPT - IRQ LEVEL 1 476 <1> ; (INT_09h - Retro UNIX 8086 v1 - U9.ASM, 07/03/2014) 477 <1> ; 478 <1> ; Derived from "KB_INT_1" procedure of IBM "pc-at" 479 <1> ; rombios source code (06/10/1985) 480 <1> ; 'keybd.asm', HARDWARE INT 09h - (IRQ Level 1) 481 <1> 482 <1> ; EQUATES (IBM PC-XT-286 BIOS, 1986, 'POSQEQU.INC') 483 <1> 484 <1> ;--------- 8042 COMMANDS ------------------------------------------------------- 485 <1> ENA_KBD equ 0AEh ; ENABLE KEYBOARD COMMAND 486 <1> DIS_KBD equ 0ADh ; DISABLE KEYBOARD COMMAND 487 <1> SHUT_CMD equ 0FEh ; CAUSE A SHUTDOWN COMMAND 488 <1> ;--------- 8042 KEYBOARD INTERFACE AND DIAGNOSTIC CONTROL REGISTERS ------------ 489 <1> STATUS_PORT equ 064h ; 8042 STATUS PORT 490 <1> INPT_BUF_FULL equ 00000010b ; 1 = +INPUT BUFFER FULL 491 <1> PORT_A equ 060h ; 8042 KEYBOARD SCAN CODE/CONTROL PORT 492 <1> ;---------- 8042 KEYBOARD RESPONSE --------------------------------------------- 493 <1> KB_ACK equ 0FAh ; ACKNOWLEDGE PROM TRANSMISSION 494 <1> KB_RESEND equ 0FEh ; RESEND REQUEST 495 <1> KB_OVER_RUN equ 0FFh ; OVER RUN SCAN CODE 496 <1> ;---------- KEYBOARD/LED COMMANDS ---------------------------------------------- 497 <1> KB_ENABLE equ 0F4h ; KEYBOARD ENABLE 498 <1> LED_CMD equ 0EDh ; LED WRITE COMMAND 499 <1> KB_TYPA_RD equ 0F3h ; TYPAMATIC RATE/DELAY COMMAND 500 <1> ;---------- KEYBOARD SCAN CODES ------------------------------------------------ 501 <1> NUM_KEY equ 69 ; SCAN CODE FOR NUMBER LOCK KEY 502 <1> SCROLL_KEY equ 70 ; SCAN CODE FOR SCROLL LOCK KEY 503 <1> ALT_KEY equ 56 ; SCAN CODE FOR ALTERNATE SHIFT KEY 504 <1> CTL_KEY equ 29 ; SCAN CODE FOR CONTROL KEY 505 <1> CAPS_KEY equ 58 ; SCAN CODE FOR SHIFT LOCK KEY 506 <1> DEL_KEY equ 83 ; SCAN CODE FOR DELETE KEY 507 <1> INS_KEY equ 82 ; SCAN CODE FOR INSERT KEY 508 <1> LEFT_KEY equ 42 ; SCAN CODE FOR LEFT SHIFT 509 <1> RIGHT_KEY equ 54 ; SCAN CODE FOR RIGHT SHIFT 510 <1> SYS_KEY equ 84 ; SCAN CODE FOR SYSTEM KEY 511 <1> ;---------- ENHANCED KEYBOARD SCAN CODES --------------------------------------- 512 <1> ID_1 equ 0ABh ; 1ST ID CHARACTER FOR KBX 513 <1> ID_2 equ 041h ; 2ND ID CHARACTER FOR KBX 514 <1> ID_2A equ 054h ; ALTERNATE 2ND ID CHARACTER FOR KBX 515 <1> F11_M equ 87 ; F11 KEY MAKE 516 <1> F12_M equ 88 ; F12 KEY MAKE 517 <1> MC_E0 equ 224 ; GENERAL MARKER CODE 518 <1> MC_E1 equ 225 ; PAUSE KEY MARKER CODE 519 <1> ;---------- FLAG EQUATES WITHIN @KB_FLAG---------------------------------------- 520 <1> RIGHT_SHIFT equ 00000001b ; RIGHT SHIFT KEY DEPRESSED 521 <1> LEFT_SHIFT equ 00000010b ; LEFT SHIFT KEY DEPRESSED 522 <1> CTL_SHIFT equ 00000100b ; CONTROL SHIFT KEY DEPRESSED 523 <1> ALT_SHIFT equ 00001000b ; ALTERNATE SHIFT KEY DEPRESSED 524 <1> SCROLL_STATE equ 00010000b ; SCROLL LOCK STATE IS ACTIVE 525 <1> NUM_STATE equ 00100000b ; NUM LOCK STATE IS ACTIVE 526 <1> CAPS_STATE equ 01000000b ; CAPS LOCK STATE IS ACTIVE 527 <1> INS_STATE equ 10000000b ; INSERT STATE IS ACTIVE 528 <1> ;---------- FLAG EQUATES WITHIN @KB_FLAG_1 ------------------------------------- 529 <1> L_CTL_SHIFT equ 00000001b ; LEFT CTL KEY DOWN 530 <1> L_ALT_SHIFT equ 00000010b ; LEFT ALT KEY DOWN 531 <1> SYS_SHIFT equ 00000100b ; SYSTEM KEY DEPRESSED AND HELD 532 <1> HOLD_STATE equ 00001000b ; SUSPEND KEY HAS BEEN TOGGLED 533 <1> SCROLL_SHIFT equ 00010000b ; SCROLL LOCK KEY IS DEPRESSED 534 <1> NUM_SHIFT equ 00100000b ; NUM LOCK KEY IS DEPRESSED 535 <1> CAPS_SHIFT equ 01000000b ; CAPS LOCK KEY IS DEPRE55ED 536 <1> INS_SHIFT equ 10000000b ; INSERT KEY IS DEPRESSED 537 <1> ;---------- FLAGS EQUATES WITHIN @KB_FLAG_2 ----------------------------------- 538 <1> KB_LEDS equ 00000111b ; KEYBOARD LED STATE BITS 539 <1> ; equ 00000001b ; SCROLL LOCK INDICATOR 540 <1> ; equ 00000010b ; NUM LOCK INDICATOR 541 <1> ; equ 00000100b ; CAPS LOCK INDICATOR 542 <1> ; equ 00001000b ; RESERVED (MUST BE ZERO) 543 <1> KB_FA equ 00010000b ; ACKNOWLEDGMENT RECEIVED 544 <1> KB_FE equ 00100000b ; RESEND RECEIVED FLAG 545 <1> KB_PR_LED equ 01000000b ; MODE INDICATOR UPDATE 546 <1> KB_ERR equ 10000000b ; KEYBOARD TRANSMIT ERROR FLAG 547 <1> ;----------- FLAGS EQUATES WITHIN @KB_FLAG_3 ----------------------------------- 548 <1> LC_E1 equ 00000001b ; LAST CODE WAS THE E1 HIDDEN CODE 549 <1> LC_E0 equ 00000010b ; LAST CODE WAS THE E0 HIDDEN CODE 550 <1> R_CTL_SHIFT equ 00000100b ; RIGHT CTL KEY DOWN 551 <1> R_ALT_SHIFT equ 00001000b ; RIGHT ALT KEY DOWN 552 <1> GRAPH_ON equ 00001000b ; ALT GRAPHICS KEY DOWN (WT ONLY) 553 <1> KBX equ 00010000b ; ENHANCED KEYBOARD INSTALLED 554 <1> SET_NUM_LK equ 00100000b ; FORCE NUM LOCK IF READ ID AND KBX 555 <1> LC_AB equ 01000000b ; LAST CHARACTER WAS FIRST ID CHARACTER 556 <1> RD_ID equ 10000000b ; DOING A READ ID (MUST BE BIT0) 557 <1> ; 558 <1> ;----------- INTERRUPT EQUATES ------------------------------------------------- 559 <1> EOI equ 020h ; END OF INTERRUPT COMMAND TO 8259 560 <1> INTA00 equ 020h ; 8259 PORT 561 <1> 562 <1> 563 <1> kb_int: 564 <1> 565 <1> ; 24/07/2022 - TRDOS 386 v2.0.5 566 <1> ; 12/04/2021 - TRDOS 386 v2.0.3 (32 bit push/pop) 567 <1> ; 17/10/2015 ('ctrlbrk') 568 <1> ; 05/12/2014 569 <1> ; 04/12/2014 (derived from pc-xt-286 bios source code -1986-) 570 <1> ; 26/08/2014 571 <1> ; 572 <1> ; 03/06/86 KEYBOARD BIOS 573 <1> ; 574 <1> ;--- HARDWARE INT 09H -- (IRQ LEVEL 1) ------------------------------------------ 575 <1> ; ; 576 <1> ; KEYBOARD INTERRUPT ROUTINE ; 577 <1> ; ; 578 <1> ;-------------------------------------------------------------------------------- 579 <1> 580 <1> KB_INT_1: 581 000010E3 FB <1> sti ; ENABLE INTERRUPTS 582 <1> ;push ebp 583 000010E4 50 <1> push eax 584 000010E5 53 <1> push ebx 585 000010E6 51 <1> push ecx 586 000010E7 52 <1> push edx 587 000010E8 56 <1> push esi 588 000010E9 57 <1> push edi 589 000010EA 1E <1> push ds 590 000010EB 06 <1> push es 591 000010EC FC <1> cld ; FORWARD DIRECTION 592 000010ED 66B81000 <1> mov ax, KDATA 593 000010F1 8ED8 <1> mov ds, ax 594 000010F3 8EC0 <1> mov es, ax 595 <1> ; 596 <1> ;----- WAIT FOR KEYBOARD DISABLE COMMAND TO BE ACCEPTED 597 000010F5 B0AD <1> mov al, DIS_KBD ; DISABLE THE KEYBOARD COMMAND 598 000010F7 E84B050000 <1> call SHIP_IT ; EXECUTE DISABLE 599 000010FC FA <1> cli ; DISABLE INTERRUPTS 600 000010FD B900000100 <1> mov ecx, 10000h ; SET MAXIMUM TIMEOUT 601 <1> KB_INT_01: 602 00001102 E464 <1> in al, STATUS_PORT ; READ ADAPTER STATUS 603 00001104 A802 <1> test al, INPT_BUF_FULL ; CHECK INPUT BUFFER FULL STATUS BIT 604 00001106 E0FA <1> loopnz KB_INT_01 ; WAIT FOR COMMAND TO BE ACCEPTED 605 <1> ; 606 <1> ;----- READ CHARACTER FROM KEYBOARD INTERFACE 607 00001108 E460 <1> in al, PORT_A ; READ IN THE CHARACTER 608 <1> ; 609 <1> ;----- SYSTEM HOOK INT 15H - FUNCTION 4FH (ON HARDWARE INT LEVEL 9H) 610 <1> ;mov ah, 04Fh ; SYSTEM INTERCEPT - KEY CODE FUNCTION 611 <1> ;stc ; SET CY=1 (IN CASE OF IRET) 612 <1> ;int 15h ; CASETTE CALL (AL)=KEY SCAN CODE 613 <1> ; ; RETURNS CY=1 FOR INVALID FUNCTION 614 <1> ;jc KB_INT_02 ; CONTINUE IF CARRY FLAG SET ((AL)=CODE) 615 <1> ;jmp K26 ; EXIT IF SYSTEM HANDLES SCAN CODE 616 <1> ; ; EXÝT HANDLES HARDWARE EOI AND ENABLE 617 <1> ; 618 <1> ;----- CHECK FOR A RESEND COMMAND TO KEYBOARD 619 <1> KB_INT_02: ; (AL)= SCAN CODE 620 0000110A FB <1> sti ; ENABLE INTERRUPTS AGAIN 621 0000110B 3CFE <1> cmp al, KB_RESEND ; IS THE INPUT A RESEND 622 0000110D 740E <1> je short KB_INT_4 ; GO IF RESEND 623 <1> ; 624 <1> ;----- CHECK FOR RESPONSE TO A COMMAND TO KEYBOARD 625 0000110F 3CFA <1> cmp al, KB_ACK ; IS THE INPUT AN ACKNOWLEDGE 626 00001111 7514 <1> jne short KB_INT_2 ; GO IF NOT 627 <1> ; 628 <1> ;----- A COMMAND TO THE KEYBOARD WAS ISSUED 629 00001113 FA <1> cli ; DISABLE INTERRUPTS 630 00001114 800D[FB670000]10 <1> or byte [KB_FLAG_2], KB_FA ; INDICATE ACK RECEIVED 631 <1> ;jmp K26 ; RETURN IF NOT ACK RETURNED FOR DATA) 632 <1> ; 12/04/2021 633 0000111B EB76 <1> jmp short ID_EX ; K26 634 <1> ; 635 <1> ;----- RESEND THE LAST BYTE 636 <1> KB_INT_4: 637 0000111D FA <1> cli ; DISABLE INTERRUPTS 638 0000111E 800D[FB670000]20 <1> or byte [KB_FLAG_2], KB_FE ; INDICATE RESEND RECEIVED 639 <1> ;jmp K26 ; RETURN IF NOT ACK RETURNED FOR DATA) 640 <1> ; 12/04/2021 641 00001125 EB6C <1> jmp short ID_EX ; K26 642 <1> ; 643 <1> ;----- UPDATE MODE INDICATORS IF CHANGE IN STATE 644 <1> KB_INT_2: 645 <1> ;push ax ; SAVE DATA IN 646 <1> ; 12/04/2021 647 00001127 50 <1> push eax 648 00001128 E8E0050000 <1> call MAKE_LED ; GO GET MODE INDICATOR DATA BYTE 649 0000112D 8A1D[FB670000] <1> mov bl, [KB_FLAG_2] ; GET PREVIOUS BITS 650 00001133 30C3 <1> xor bl, al ; SEE IF ANY DIFFERENT 651 00001135 80E307 <1> and bl, KB_LEDS ; ISOLATE INDICATOR BITS 652 00001138 7405 <1> jz short UP0 ; IF NO CHANGE BYPASS UPDATE 653 0000113A E863050000 <1> call SND_LED ; GO TURN ON MODE INDICATORS 654 <1> UP0: 655 <1> ;pop ax ; RESTORE DATA IN 656 <1> ; 12/04/2021 657 0000113F 58 <1> pop eax 658 <1> ;------------------------------------------------------------------------ 659 <1> ; START OF KEY PROCESSING ; 660 <1> ;------------------------------------------------------------------------ 661 00001140 88C4 <1> mov ah, al ; SAVE SCAN CODE IN AH ALSO 662 <1> ; 663 <1> ;----- TEST FOR OVERRUN SCAN CODE FROM KEYBOARD 664 00001142 3CFF <1> cmp al, KB_OVER_RUN ; IS THIS AN OVERRUN CHAR 665 <1> ;je K62 ; BUFFER_FULL_BEEP 666 <1> ; 12/04/2021 667 00001144 7505 <1> jne short K16 668 00001146 E9E8040000 <1> jmp K62 669 <1> K16: 670 0000114B 8A3D[FC670000] <1> mov bh, [KB_FLAG_3] ; LOAD FLAGS FOR TESTING 671 <1> ; 672 <1> ;----- TEST TO SEE IF A READ_ID IS IN PROGRESS 673 00001151 F6C7C0 <1> test bh, RD_ID+LC_AB ; ARE WE DOING A READ ID? 674 00001154 7442 <1> jz short NOT_ID ; CONTINUE IF NOT 675 00001156 7914 <1> jns short TST_ID_2 ; IS THE RD_ID FLAG ON? 676 00001158 3CAB <1> cmp al, ID_1 ; IS THIS THE 1ST ID CHARACTER? 677 0000115A 7507 <1> jne short RST_RD_ID 678 0000115C 800D[FC670000]40 <1> or byte [KB_FLAG_3], LC_AB ; INDICATE 1ST ID WAS OK 679 <1> RST_RD_ID: 680 00001163 8025[FC670000]7F <1> and byte [KB_FLAG_3], ~RD_ID ; RESET THE READ ID FLAG 681 0000116A EB27 <1> jmp short ID_EX ; AND EXIT 682 <1> ; 12/04/2021 683 <1> ;jmp K26 684 <1> ; 685 <1> TST_ID_2: 686 0000116C 8025[FC670000]BF <1> and byte [KB_FLAG_3], ~LC_AB ; RESET FLAG 687 00001173 3C54 <1> cmp al, ID_2A ; IS THIS THE 2ND ID CHARACTER? 688 00001175 7415 <1> je short KX_BIT ; JUMP IF SO 689 00001177 3C41 <1> cmp al, ID_2 ; IS THIS THE 2ND ID CHARACTER? 690 00001179 7518 <1> jne short ID_EX ; LEAVE IF NOT 691 <1> ; 12/04/2021 692 <1> ;jne K26 693 <1> ; 694 <1> ;----- A READ ID SAID THAT IT WAS ENHANCED KEYBOARD 695 0000117B F6C720 <1> test bh, SET_NUM_LK ; SHOULD WE SET NUM LOCK? 696 0000117E 740C <1> jz short KX_BIT ; EXIT IF NOT 697 00001180 800D[F9670000]20 <1> or byte [KB_FLAG], NUM_STATE ; FORCE NUM LOCK ON 698 00001187 E816050000 <1> call SND_LED ; GO SET THE NUM LOCK INDICATOR 699 <1> KX_BIT: 700 0000118C 800D[FC670000]10 <1> or byte [KB_FLAG_3], KBX ; INDICATE ENHANCED KEYBOARD WAS FOUND 701 00001193 E9CB010000 <1> ID_EX: jmp K26 ; EXIT 702 <1> ; 703 <1> NOT_ID: 704 00001198 3CE0 <1> cmp al, MC_E0 ; IS THIS THE GENERAL MARKER CODE? 705 0000119A 7509 <1> jne short TEST_E1 706 0000119C 800D[FC670000]12 <1> or byte [KB_FLAG_3], LC_E0+KBX ; SET FLAG BIT, SET KBX, AND 707 000011A3 EB0B <1> jmp short EXIT ; THROW AWAY THIS CODE 708 <1> ; 12/04/2021 709 <1> ;jmp K26A 710 <1> TEST_E1: 711 000011A5 3CE1 <1> cmp al, MC_E1 ; IS THIS THE PAUSE KEY? 712 000011A7 750C <1> jne short NOT_HC 713 000011A9 800D[FC670000]11 <1> or byte [KB_FLAG_3], LC_E1+KBX ; SET FLAG BIT, SET KBX, AND 714 000011B0 E9B5010000 <1> EXIT: jmp K26A ; THROW AWAY THIS CODE 715 <1> ; 716 <1> NOT_HC: 717 000011B5 247F <1> and al, 07Fh ; TURN OFF THE BREAK BIT 718 000011B7 F6C702 <1> test bh, LC_E0 ; LAST CODE THE E0 MARKER CODE 719 000011BA 7410 <1> jz short NOT_LC_E0 ; JUMP IF NOT 720 <1> ; 721 000011BC BF[E6660000] <1> mov edi, _K6+6 ; IS THIS A SHIFT KEY? 722 000011C1 AE <1> scasb 723 <1> ;je K26 ; K16B ; YES, THROW AWAY & RESET FLAG 724 <1> ; 12/04/2021 725 000011C2 745B <1> je short K16B ; K26 726 000011C4 AE <1> scasb 727 000011C5 756D <1> jne short K16A ; NO, CONTINUE KEY PROCESSING 728 <1> ;jmp short K16B ; YES, THROW AWAY & RESET FLAG 729 000011C7 E997010000 <1> jmp K26 730 <1> ; 731 <1> NOT_LC_E0: 732 000011CC F6C701 <1> test bh, LC_E1 ; LAST CODE THE E1 MARKER CODE? 733 000011CF 7425 <1> jz short T_SYS_KEY ; JUMP IF NOT 734 000011D1 B904000000 <1> mov ecx, 4 ; LENGHT OF SEARCH 735 000011D6 BF[E4660000] <1> mov edi, _K6+4 ; IS THIS AN ALT, CTL, OR SHIFT? 736 000011DB F2AE <1> repne scasb ; CHECK IT 737 000011DD 74D1 <1> je short EXIT ; THROW AWAY IF SO 738 <1> ; 12/04/2021 739 <1> ;je K26A 740 <1> ; 741 000011DF 3C45 <1> cmp al, NUM_KEY ; IS IT THE PAUSE KEY? 742 000011E1 753C <1> jne short K16B ; NO, THROW AWAY & RESET FLAG 743 <1> ; 12/04/2021 744 <1> ;jne K26 745 000011E3 F6C480 <1> test ah, 80h ; YES, IS IT THE BREAK OF THE KEY? 746 000011E6 7537 <1> jnz short K16B ; YES, THROW THIS AWAY, TOO 747 <1> ; 24/07/2022 748 <1> ;jnz K26 749 <1> ; 20/02/2015 750 000011E8 F605[FA670000]08 <1> test byte [KB_FLAG_1],HOLD_STATE ; NO, ARE WE PAUSED ALREADY? 751 000011EF 752E <1> jnz short K16B ; YES, THROW AWAY 752 <1> ; 12/04/2021 753 <1> ;jnz K26 754 000011F1 E9B1020000 <1> jmp K39P ; NO, THIS IS THE REAL PAUSE STATE 755 <1> ; 756 <1> ;----- TEST FOR SYSTEM KEY 757 <1> T_SYS_KEY: 758 000011F6 3C54 <1> cmp al, SYS_KEY ; IS IT THE SYSTEM KEY? 759 000011F8 753A <1> jnz short K16A ; CONTINUE IF NOT 760 <1> ; 761 000011FA F6C480 <1> test ah, 80h ; CHECK IF THIS A BREAK CODE 762 000011FD 7525 <1> jnz short K16C ; DO NOT TOUCH SYSTEM INDICATOR IF TRUE 763 <1> ; 764 000011FF F605[FA670000]04 <1> test byte [KB_FLAG_1], SYS_SHIFT ; SEE IF IN SYSTEM KEY HELD DOWN 765 00001206 7517 <1> jnz short K16B ; IF YES, DO NOT PROCESS SYSTEM INDICATOR 766 <1> ; 12/04/2021 767 <1> ;jnz K26 768 <1> ; 769 00001208 800D[FA670000]04 <1> or byte [KB_FLAG_1], SYS_SHIFT ; INDICATE SYSTEM KEY DEPRESSED 770 0000120F B020 <1> mov al, EOI ; END OF INTERRUPT COMMAND 771 00001211 E620 <1> out 20h, al ;out INTA00, al ; SEND COMMAND TO INTERRUPT CONTROL PORT 772 <1> ; INTERRUPT-RETURN-NO-EOI 773 00001213 B0AE <1> mov al, ENA_KBD ; INSURE KEYBOARD IS ENABLED 774 00001215 E82D040000 <1> call SHIP_IT ; EXECUTE ENABLE 775 <1> ; !!! SYSREQ !!! function/system call (INTERRUPT) must be here !!! 776 <1> ;MOV AL, 8500H ; FUNCTION VALUE FOR MAKE OF SYSTEM KEY 777 <1> ;STI ; MAKE SURE INTERRUPTS ENABLED 778 <1> ;INT 15H ; USER INTERRUPT 779 0000121A E957010000 <1> jmp K27A ; END PROCESSING 780 <1> ; 781 0000121F E93F010000 <1> K16B: jmp K26 ; IGNORE SYSTEM KEY 782 <1> ; 783 <1> K16C: 784 00001224 8025[FA670000]FB <1> and byte [KB_FLAG_1], ~SYS_SHIFT ; TURN OFF SHIFT KEY HELD DOWN 785 0000122B B020 <1> mov al, EOI ; END OF INTERRUPT COMMAND 786 0000122D E620 <1> out 20h, al ;out INTA00, al ; SEND COMMAND TO INTERRUPT CONTROL PORT 787 <1> ; INTERRUPT-RETURN-NO-EOI 788 <1> ;MOV AL, ENA_KBD ; INSURE KEYBOARD IS ENABLED 789 <1> ;CALL SHIP_IT ; EXECUTE ENABLE 790 <1> ; 791 <1> ;MOV AX, 8501H ; FUNCTION VALUE FOR BREAK OF SYSTEM KEY 792 <1> ;STI ; MAKE SURE INTERRUPTS ENABLED 793 <1> ;INT 15H ; USER INTERRUPT 794 <1> ;JMP K27A ; INGONRE SYSTEM KEY 795 <1> ; 796 0000122F E93B010000 <1> jmp K27 ; IGNORE SYSTEM KEY 797 <1> ; 798 <1> ;----- TEST FOR SHIFT KEYS 799 <1> K16A: 800 00001234 8A1D[F9670000] <1> mov bl, [KB_FLAG] ; PUT STATE FLAGS IN BL 801 0000123A BF[E0660000] <1> mov edi, _K6 ; SHIFT KEY TABLE offset 802 0000123F B908000000 <1> mov ecx, _K6L ; LENGTH 803 00001244 F2AE <1> repne scasb ; LOOK THROUGH THE TABLE FOR A MATCH 804 00001246 88E0 <1> mov al, ah ; RECOVER SCAN CODE 805 <1> ;jne K25 ; IF NO MATCH, THEN SHIFT NOT FOUND 806 <1> ; 12/04/2021 807 00001248 7405 <1> je short K17 808 0000124A E9FC000000 <1> jmp K25 809 <1> ; 810 <1> ;------ SHIFT KEY FOUND 811 <1> K17: 812 0000124F 81EF[E1660000] <1> sub edi, _K6+1 ; ADJUST PTR TO SCAN CODE MATCH 813 00001255 8AA7[E8660000] <1> mov ah, [edi+_K7] ; GET MASK INTO AH 814 0000125B B102 <1> mov cl, 2 ; SETUP COUNT FOR FLAG SHIFTS 815 0000125D A880 <1> test al, 80h ; TEST FOR BREAK KEY 816 <1> ;jnz short K23 ; JUMP OF BREAK 817 <1> ; 12/04/2021 818 0000125F 7405 <1> jz short K17C 819 00001261 E981000000 <1> jmp K23 820 <1> ; 821 <1> ;----- SHIFT MAKE FOUND, DETERMINE SET OR TOGGLE 822 <1> K17C: 823 00001266 80FC10 <1> cmp ah, SCROLL_SHIFT 824 00001269 7324 <1> jae short K18 ; IF SCROLL SHIFT OR ABOVE, TOGGLE KEY 825 <1> ; 826 <1> ;----- PLAIN SHIFT KEY, SET SHIFT ON 827 0000126B 0825[F9670000] <1> or [KB_FLAG], ah ; TURN ON SHIFT BIT 828 00001271 A80C <1> test al, CTL_SHIFT+ALT_SHIFT ; IS IT ALT OR CTRL? 829 <1> ;;jnz short K17D ; YES, MORE FLAGS TO SET 830 <1> ;jz K26 ; NO, INTERRUPT RETURN 831 <1> ; 12/04/2021 832 00001273 7415 <1> jz short k17f 833 <1> K17D: 834 00001275 F6C702 <1> test bh, LC_E0 ; IS THIS ONE OF NEW KEYS? 835 00001278 7408 <1> jz short K17E ; NO, JUMP 836 0000127A 0825[FC670000] <1> or [KB_FLAG_3], ah ; SET BITS FOR RIGHT CTRL, ALT 837 <1> ;jmp K26 ; INTERRUPT RETURN 838 <1> ; 12/04/2021 839 00001280 EB08 <1> jmp short k17f 840 <1> K17E: 841 00001282 D2EC <1> shr ah, cl ; MOVE FLAG BITS TWO POSITIONS 842 00001284 0825[FA670000] <1> or [KB_FLAG_1], ah ; SET BITS FOR LEFT CTRL, ALT 843 <1> k17f: ; 12/04/2021 844 0000128A E9D4000000 <1> jmp K26 845 <1> ; 846 <1> ;----- TOGGLED SHIFT KEY, TEST FOR 1ST MAKE OR NOT 847 <1> K18: ; SHIFT-TOGGLE 848 0000128F F6C304 <1> test bl, CTL_SHIFT ; CHECK CTL SHIFT STATE 849 00001292 7402 <1> jz short K18A ; JUMP IF NOT CTL STATE 850 <1> ;jnz K25 ; JUMP IF CTL STATE 851 <1> ; 12/04/2021 852 00001294 EB1C <1> jmp short k20a ; K25 853 <1> K18A: 854 00001296 3C52 <1> cmp al, INS_KEY ; CHECK FOR INSERT KEY 855 00001298 7522 <1> jne short K22 ; JUMP IF NOT INSERT KEY 856 0000129A F6C308 <1> test bl, ALT_SHIFT ; CHECK FOR ALTERNATE SHIFT 857 0000129D 7402 <1> jz short K18B ; JUMP IF NOT ALTERNATE SHIFT 858 <1> ;jnz K25 ; JUMP IF ALTERNATE SHIFT 859 <1> ; 12/04/2021 860 0000129F EB11 <1> jmp short k20a ; K25 861 <1> K18B: 862 000012A1 F6C702 <1> test bh, LC_E0 ;20/02/2015 ; IS THIS NEW INSERT KEY? 863 000012A4 7516 <1> jnz short K22 ; YES, THIS ONE'S NEVER A '0' 864 <1> K19: 865 000012A6 F6C320 <1> test bl, NUM_STATE ; CHECK FOR BASE STATE 866 000012A9 750C <1> jnz short K21 ; JUMP IF NUM LOCK IS ON 867 000012AB F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; TEST FOR SHIFT STATE 868 000012AE 740C <1> jz short K22 ; JUMP IF BASE STATE 869 <1> K20: ; NUMERIC ZERO, NOT INSERT KEY 870 000012B0 88C4 <1> mov ah, al ; PUT SCAN CODE BACK IN AH 871 <1> k20a: ; 12/04/2021 872 000012B2 E994000000 <1> jmp K25 ; NUMERAL '0', STNDRD. PROCESSING 873 <1> K21: ; MIGHT BE NUMERIC 874 000012B7 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT 875 000012BA 74F4 <1> jz short K20 ; IS NUMERIC, STD. PROC. 876 <1> ; 877 <1> K22: ; SHIFT TOGGLE KEY HIT; PROCESS IT 878 000012BC 8425[FA670000] <1> test ah, [KB_FLAG_1] ; IS KEY ALREADY DEPRESSED 879 <1> ;jnz short K26 ; JUMP IF KEY ALREADY DEPRESSED 880 <1> ; 12/04/2021 881 000012C2 75C6 <1> jnz short k17f ; K26 882 <1> K22A: 883 000012C4 0825[FA670000] <1> or [KB_FLAG_1], ah ; INDICATE THAT THE KEY IS DEPRESSED 884 000012CA 3025[F9670000] <1> xor [KB_FLAG], ah ; TOGGLE THE SHIFT STATE 885 <1> ; 886 <1> ;----- TOGGLE LED IF CAPS, NUM OR SCROLL KEY DEPRESSED 887 000012D0 F6C470 <1> test ah, CAPS_SHIFT+NUM_SHIFT+SCROLL_SHIFT ; SHIFT TOGGLE? 888 000012D3 7407 <1> jz short K22B ; GO IF NOT 889 <1> ; 890 <1> ; 12/04/2021 (32 bit push/pop) 891 000012D5 50 <1> push eax ; push ax ; SAVE SCAN CODE AND SHIFT MASK 892 000012D6 E8C7030000 <1> call SND_LED ; GO TURN MODE INDICATORS ON 893 000012DB 58 <1> pop eax ; pop ax ; RESTORE SCAN CODE 894 <1> K22B: 895 000012DC 3C52 <1> cmp al, INS_KEY ; TEST FOR 1ST MAKE OF INSERT KEY 896 <1> ;jne short K26 ; JUMP IF NOT INSERT KEY 897 <1> ; 12/04/2021 898 000012DE 75AA <1> jne short k17f ; K26 899 000012E0 88C4 <1> mov ah, al ; SCAN CODE IN BOTH HALVES OF AX 900 000012E2 E999000000 <1> jmp K28 ; FLAGS UPDATED, PROC. FOR BUFFER 901 <1> ; 902 <1> ;----- BREAK SHIFT FOUND 903 <1> K23: ; BREAK-SHIFT-FOUND 904 000012E7 80FC10 <1> cmp ah, SCROLL_SHIFT ; IS THIS A TOGGLE KEY 905 000012EA F6D4 <1> not ah ; INVERT MASK 906 000012EC 7355 <1> jae short K24 ; YES, HANDLE BREAK TOGGLE 907 000012EE 2025[F9670000] <1> and [KB_FLAG], ah ; TURN OFF SHIFT BIT 908 000012F4 80FCFB <1> cmp ah, ~CTL_SHIFT ; IS THIS ALT OR CTL? 909 000012F7 7730 <1> ja short K23D ; NO, ALL DONE 910 <1> ; 911 000012F9 F6C702 <1> test bh, LC_E0 ; 2ND ALT OR CTL? 912 000012FC 7408 <1> jz short K23A ; NO, HANSLE NORMALLY 913 000012FE 2025[FC670000] <1> and [KB_FLAG_3], ah ; RESET BIT FOR RIGHT ALT OR CTL 914 00001304 EB08 <1> jmp short K23B ; CONTINUE 915 <1> K23A: 916 00001306 D2FC <1> sar ah, cl ; MOVE THE MASK BIT TWO POSITIONS 917 00001308 2025[FA670000] <1> and [KB_FLAG_1], ah ; RESET BIT FOR LEFT ALT AND CTL 918 <1> K23B: 919 0000130E 88C4 <1> mov ah, al ; SAVE SCAN CODE 920 00001310 A0[FC670000] <1> mov al, [KB_FLAG_3] ; GET RIGHT ALT & CTRL FLAGS 921 00001315 D2E8 <1> shr al, cl ; MOVE TO BITS 1 & 0 922 00001317 0A05[FA670000] <1> or al, [KB_FLAG_1] ; PUT IN LEFT ALÞT & CTL FLAGS 923 0000131D D2E0 <1> shl al, cl ; MOVE BACK TO BITS 3 & 2 924 0000131F 240C <1> and al, ALT_SHIFT+CTL_SHIFT ; FILTER OUT OTHER GARBAGE 925 00001321 0805[F9670000] <1> or [KB_FLAG], al ; PUT RESULT IN THE REAL FLAGS 926 00001327 88E0 <1> mov al, ah 927 <1> K23D: 928 00001329 3CB8 <1> cmp al, ALT_KEY+80h ; IS THIS ALTERNATE SHIFT RELEASE 929 0000132B 7536 <1> jne short K26 ; INTERRUPT RETURN 930 <1> ; 931 <1> ;----- ALTERNATE SHIFT KEY RELEASED, GET THE VALUE INTO BUFFER 932 0000132D A0[FD670000] <1> mov al, [ALT_INPUT] 933 00001332 B400 <1> mov ah, 0 ; SCAN CODE OF 0 934 00001334 8825[FD670000] <1> mov [ALT_INPUT], ah ; ZERO OUT THE FIELD 935 0000133A 3C00 <1> cmp al, 0 ; WAS THE INPUT = 0? 936 0000133C 7425 <1> je short K26 ; INTERRUPT_RETURN 937 <1> ; 29/01/2016 938 <1> ;jmp K61 ; IT WASN'T, SO PUT IN BUFFER 939 0000133E E9AB020000 <1> jmp _K60 940 <1> ; 941 <1> K24: ; BREAK-TOGGLE 942 00001343 2025[FA670000] <1> and [KB_FLAG_1], ah ; INDICATE NO LONGER DEPRESSED 943 00001349 EB18 <1> jmp short K26 ; INTERRUPT_RETURN 944 <1> ; 945 <1> ;----- TEST FOR HOLD STATE 946 <1> ; AL, AH = SCAN CODE 947 <1> K25: ; NO-SHIFT-FOUND 948 0000134B 3C80 <1> cmp al, 80h ; TEST FOR BREAK KEY 949 0000134D 7314 <1> jae short K26 ; NOTHING FOR BREAK CHARS FROM HERE ON 950 0000134F F605[FA670000]08 <1> test byte [KB_FLAG_1], HOLD_STATE ; ARE WE IN HOLD STATE 951 00001356 7428 <1> jz short K28 ; BRANCH AROUND TEST IF NOT 952 00001358 3C45 <1> cmp al, NUM_KEY 953 0000135A 7407 <1> je short K26 ; CAN'T END HOLD ON NUM_LOCK 954 0000135C 8025[FA670000]F7 <1> and byte [KB_FLAG_1], ~HOLD_STATE ; TURN OFF THE HOLD STATE BIT 955 <1> K26: 956 00001363 8025[FC670000]FC <1> and byte [KB_FLAG_3], ~(LC_E0+LC_E1) ; RESET LAST CHAR H.C. FLAG 957 <1> K26A: ; INTERRUPT-RETURN 958 0000136A FA <1> cli ; TURN OFF INTERRUPTS 959 0000136B B020 <1> mov al, EOI ; END OF INTERRUPT COMMAND 960 0000136D E620 <1> out 20h, al ;out INTA00, al ; SEND COMMAND TO INTERRUPT CONTROL PORT 961 <1> K27: ; INTERRUPT-RETURN-NO-EOI 962 0000136F B0AE <1> mov al, ENA_KBD ; INSURE KEYBOARD IS ENABLED 963 00001371 E8D1020000 <1> call SHIP_IT ; EXECUTE ENABLE 964 <1> K27A: 965 00001376 FA <1> cli ; DISABLE INTERRUPTS 966 <1> ;;mov byte [intflg], 0 ; 07/01/2017 ;; 15/01/2017 967 00001377 07 <1> pop es ; RESTORE REGISTERS 968 00001378 1F <1> pop ds 969 00001379 5F <1> pop edi 970 0000137A 5E <1> pop esi 971 0000137B 5A <1> pop edx 972 0000137C 59 <1> pop ecx 973 0000137D 5B <1> pop ebx 974 0000137E 58 <1> pop eax 975 <1> ;pop ebp 976 0000137F CF <1> iretd ; RETURN 977 <1> 978 <1> ;----- NOT IN HOLD STATE 979 <1> K28: ; NO-HOLD-STATE 980 00001380 3C58 <1> cmp al, 88 ; TEST FOR OUT-OF-RANGE SCAN CODES 981 00001382 77DF <1> ja short K26 ; IGNORE IF OUT-OF-RANGE 982 <1> ; 983 00001384 F6C308 <1> test bl, ALT_SHIFT ; ARE WE IN ALTERNATE SHIFT 984 00001387 740E <1> jz short K28A ; IF NOT ALTERNATE 985 <1> ; 12/04/2021 986 <1> ;jz K38 987 <1> ; 988 00001389 F6C710 <1> test bh, KBX ; IS THIS THE ENCHANCED KEYBOARD? 989 0000138C 740E <1> jz short K29 ; NO, ALT STATE IS REAL 990 <1> ;28/02/2015 991 0000138E F605[FA670000]04 <1> test byte [KB_FLAG_1], SYS_SHIFT ; YES, IS SYSREQ KEY DOWN? 992 00001395 7405 <1> jz short K29 ; NO, ALT STATE IS REAL 993 <1> ; 12/04/2021 994 <1> ;jnz K38 ; YES, THIS IS PHONY ALT STATE 995 <1> ; ; DUE TO PRESSING SYSREQ 996 00001397 E9C4000000 <1> K28A: jmp K38 997 <1> ; 998 <1> ;----- TEST FOR RESET KEY SEQUENCE (CTL ALT DEL) 999 <1> K29: ; TEST-RESET 1000 0000139C F6C304 <1> test bl, CTL_SHIFT ; ARE WE IN CONTROL SHIFT ALSO? 1001 0000139F 740B <1> jz short K31 ; NO_RESET 1002 000013A1 3C53 <1> cmp al, DEL_KEY ; CTL-ALT STATE, TEST FOR DELETE KEY 1003 000013A3 7507 <1> jne short K31 ; NO_RESET, IGNORE 1004 <1> ; 1005 <1> ;----- CTL-ALT-DEL HAS BEEN FOUND 1006 <1> ; 26/08/2014 1007 <1> cpu_reset: 1008 <1> ; IBM PC/AT ROM BIOS source code - 10/06/85 (TEST4.ASM - PROC_SHUTDOWN) 1009 <1> ; Send FEh (system reset command) to the keyboard controller. 1010 000013A5 B0FE <1> mov al, SHUT_CMD ; SHUTDOWN COMMAND 1011 000013A7 E664 <1> out STATUS_PORT, al ; SEND TO KEYBOARD CONTROL PORT 1012 <1> khere: 1013 000013A9 F4 <1> hlt ; WAIT FOR 80286 RESET 1014 000013AA EBFD <1> jmp short khere ; INSURE HALT 1015 <1> ; 1016 <1> ;----- IN ALTERNATE SHIFT, RESET NOT FOUND 1017 <1> K31: ; NO-RESET 1018 000013AC 3C39 <1> cmp al, 57 ; TEST FOR SPACE KEY 1019 000013AE 7507 <1> jne short K311 ; NOT THERE 1020 000013B0 B020 <1> mov al, ' ' ; SET SPACE CHAR 1021 <1> k31a: ; 12/04/2021 1022 000013B2 E929020000 <1> jmp K57 ; BUFFER_FILL 1023 <1> K311: 1024 000013B7 3C0F <1> cmp al, 15 ; TEST FOR TAB KEY 1025 000013B9 7506 <1> jne short K312 ; NOT THERE 1026 000013BB 66B800A5 <1> mov ax, 0A500h ; SET SPECIAL CODE FOR ALT-TAB 1027 <1> ;jmp K57 ; BUFFER_FILL 1028 <1> ; 12/04/2021 1029 000013BF EBF1 <1> jmp short k31a 1030 <1> K312: 1031 000013C1 3C4A <1> cmp al, 74 ; TEST FOR KEY PAD - 1032 <1> ;je short K37B ; GO PROCESS 1033 <1> ; 12/04/2021 1034 000013C3 7404 <1> je short k312a 1035 000013C5 3C4E <1> cmp al, 78 ; TEST FOR KEY PAD + 1036 <1> ;je short K37B ; GO PROCESS 1037 <1> ; 12/04/2021 1038 000013C7 7505 <1> jne short K32 1039 <1> k312a: 1040 000013C9 E988000000 <1> jmp K37B 1041 <1> ; 1042 <1> ;----- LOOK FOR KEY PAD ENTRY 1043 <1> K32: ; ALT-KEY-PAD 1044 000013CE BF[BC660000] <1> mov edi, K30 ; ALT-INPUT-TABLE offset 1045 000013D3 B90A000000 <1> mov ecx, 10 ; LOOK FOR ENTRY USING KEYPAD 1046 000013D8 F2AE <1> repne scasb ; LOOK FOR MATCH 1047 000013DA 7521 <1> jne short K33 ; NO_ALT_KEYPAD 1048 000013DC F6C702 <1> test bh, LC_E0 ; IS THIS ONE OF THE NEW KEYS? 1049 000013DF 7579 <1> jnz short K37C ; YES, JUMP, NOT NUMPAD KEY 1050 000013E1 81EF[BD660000] <1> sub edi, K30+1 ; DI NOW HAS ENTRY VALUE 1051 000013E7 A0[FD670000] <1> mov al, [ALT_INPUT] ; GET THE CURRENT BYTE 1052 000013EC B40A <1> mov ah, 10 ; MULTIPLY BY 10 1053 000013EE F6E4 <1> mul ah 1054 000013F0 6601F8 <1> add ax, di ; ADD IN THE LATEST ENTRY 1055 000013F3 A2[FD670000] <1> mov [ALT_INPUT], al ; STORE IT AWAY 1056 <1> K32A: 1057 000013F8 E966FFFFFF <1> jmp K26 ; THROW AWAY THAT KEYSTROKE 1058 <1> ; 1059 <1> ;----- LOOK FOR SUPERSHIFT ENTRY 1060 <1> K33: ; NO-ALT-KEYPAD 1061 000013FD C605[FD670000]00 <1> mov byte [ALT_INPUT], 0 ; ZERO ANY PREVIOUS ENTRY INTO INPUT 1062 00001404 B91A000000 <1> mov ecx, 26 ; (DI),(ES) ALREADY POINTING 1063 00001409 F2AE <1> repne scasb ; LOOK FOR MATCH IN ALPHABET 1064 0000140B 7445 <1> je short K37A ; MATCH FOUND, GO FILLL THE BUFFER 1065 <1> ; 1066 <1> ;----- LOOK FOR TOP ROW OF ALTERNATE SHIFT 1067 <1> K34: ; ALT-TOP-ROW 1068 0000140D 3C02 <1> cmp al, 2 ; KEY WITH '1' ON IT 1069 0000140F 7245 <1> jb short K37B ; MUST BE ESCAPE 1070 00001411 3C0D <1> cmp al, 13 ; IS IT IN THE REGION 1071 00001413 7705 <1> ja short K35 ; NO, ALT SOMETHING ELSE 1072 00001415 80C476 <1> add ah, 118 ; CONVERT PSEUDO SCAN CODE TO RANGE 1073 00001418 EB38 <1> jmp short K37A ; GO FILL THE BUFFER 1074 <1> ; 1075 <1> ;----- TRANSLATE ALTERNATE SHIFT PSEUDO SCAN CODES 1076 <1> K35: ; ALT-FUNCTION 1077 0000141A 3C57 <1> cmp al, F11_M ; IS IT F11? 1078 0000141C 7209 <1> jb short K35A ; 20/02/2015 ; NO, BRANCH 1079 0000141E 3C58 <1> cmp al, F12_M ; IS IT F12? 1080 00001420 7705 <1> ja short K35A ; 20/02/2015 ; NO, BRANCH 1081 00001422 80C434 <1> add ah, 52 ; CONVERT TO PSEUDO SCAN CODE 1082 00001425 EB2B <1> jmp short K37A ; GO FILL THE BUFFER 1083 <1> K35A: 1084 00001427 F6C702 <1> test bh, LC_E0 ; DO WE HAVE ONE OF THE NEW KEYS? 1085 0000142A 741B <1> jz short K37 ; NO, JUMP 1086 0000142C 3C1C <1> cmp al, 28 ; TEST FOR KEYPAD ENTER 1087 0000142E 7506 <1> jne short K35B ; NOT THERE 1088 00001430 66B800A6 <1> mov ax, 0A600h ; SPECIAL CODE 1089 <1> ;jmp K57 ; BUFFER FILL 1090 <1> ; 12/04/2021 1091 00001434 EB0C <1> jmp short k35c 1092 <1> K35B: 1093 00001436 3C53 <1> cmp al, 83 ; TEST FOR DELETE KEY 1094 00001438 7420 <1> je short K37C ; HANDLE WITH OTHER EDIT KEYS 1095 0000143A 3C35 <1> cmp al, 53 ; TEST FOR KEYPAD / 1096 0000143C 75BA <1> jne short K32A ; NOT THERE, NO OTHER E0 SPECIALS 1097 <1> ; 12/04/2021 1098 <1> ;jne K26 1099 0000143E 66B800A4 <1> mov ax, 0A400h ; SPECIAL CODE1 1100 <1> k35c: ; 12/04/2021 1101 00001442 E999010000 <1> jmp K57 ; BUFFER FILL 1102 <1> K37: 1103 00001447 3C3B <1> cmp al, 59 ; TEST FOR FUNCTION KEYS (F1) 1104 00001449 720B <1> jb short K37B ; NO FN, HANDLE W/OTHER EXTENDED 1105 0000144B 3C44 <1> cmp al, 68 ; IN KEYPAD REGION? 1106 0000144D 77A9 <1> ja short K32A ; IF SO, IGNORE 1107 <1> ; 12/04/2021 1108 <1> ;ja K26 1109 0000144F 80C42D <1> add ah, 45 ; CONVERT TO PSEUDO SCAN CODE 1110 <1> K37A: 1111 00001452 B000 <1> mov al, 0 ; ASCII CODE OF ZERO 1112 <1> ;jmp K57 ; PUT IT IN THE BUFFER 1113 <1> ; 12/04/2021 1114 00001454 EBEC <1> jmp short k35c 1115 <1> K37B: 1116 00001456 B0F0 <1> mov al, 0F0h ; USE SPECIAL ASCII CODE 1117 <1> ;jmp K57 ; PUT IT IN THE BUFFER 1118 <1> ; 12/04/2021 1119 00001458 EBE8 <1> jmp short k35c 1120 <1> K37C: 1121 0000145A 0450 <1> add al, 80 ; CONVERT SCAN CODE (EDIT KEYS) 1122 0000145C 88C4 <1> mov ah, al ; (SCAN CODE NOT IN AH FOR INSERT) 1123 0000145E EBF2 <1> jmp short K37A ; PUT IT IN THE BUFFER 1124 <1> ; 1125 <1> ;----- NOT IN ALTERNATE SHIFT 1126 <1> K38: ; NOT-ALT-SHIFT 1127 <1> ; BL STILL HAS SHIFT FLAGS 1128 00001460 F6C304 <1> test bl, CTL_SHIFT ; ARE WE IN CONTROL SHIFT? 1129 <1> ;;jnz short K38A ; YES, START PROCESSING 1130 <1> ;jz K44 ; NOT-CTL-SHIFT 1131 <1> ; 12/04/2021 1132 00001463 7505 <1> jnz short K38A ; YES, START PROCESSING 1133 00001465 E9AB000000 <1> jmp K44 ; NOT-CTL-SHIFT 1134 <1> ; 1135 <1> ;----- CONTROL SHIFT, TEST SPECIAL CHARACTERS 1136 <1> ;----- TEST FOR BREAK 1137 <1> K38A: 1138 0000146A 3C46 <1> cmp al, SCROLL_KEY ; TEST FOR BREAK 1139 0000146C 7530 <1> jne short K39 ; JUMP, NO-BREAK 1140 0000146E F6C710 <1> test bh, KBX ; IS THIS THE ENHANCED KEYBOARD? 1141 00001471 7405 <1> jz short K38B ; NO, BREAK IS VALID 1142 00001473 F6C702 <1> test bh, LC_E0 ; YES, WAS LAST CODE AN E0? 1143 00001476 7426 <1> jz short K39 ; NO-BREAK, TEST FOR PAUSE 1144 <1> K38B: 1145 00001478 8B1D[06680000] <1> mov ebx, [BUFFER_HEAD] ; RESET BUFFER TO EMPTY 1146 0000147E 891D[0A680000] <1> mov [BUFFER_TAIL], ebx 1147 00001484 C605[F8670000]80 <1> mov byte [BIOS_BREAK], 80h ; TURN ON BIOS_BREAK BIT 1148 <1> ; 1149 <1> ;----- ENABLE KEYBOARD 1150 0000148B B0AE <1> mov al, ENA_KBD ; ENABLE KEYBOARD 1151 0000148D E8B5010000 <1> call SHIP_IT ; EXECUTE ENABLE 1152 <1> ; 1153 <1> ; CTRL+BREAK code here !!! 1154 <1> ;INT 1BH ; BREAK INTERRUPT VECTOR 1155 <1> ; 17/10/2015 1156 00001492 E8A7590000 <1> call ctrlbrk ; control+break subroutine 1157 <1> ; 1158 <1> ;sub ax, ax ; PUT OUT DUMMY CHARACTER 1159 <1> ; 12/04/2021 1160 00001497 29C0 <1> sub eax, eax 1161 00001499 E942010000 <1> jmp K57 ; BUFFER_FILL 1162 <1> ; 1163 <1> ;----- TEST FOR PAUSE 1164 <1> K39: ; NO_BREAK 1165 0000149E F6C710 <1> test bh, KBX ; IS THIS THE ENHANCED KEYBOARD? 1166 000014A1 7537 <1> jnz short K41 ; YES, THEN THIS CAN'T BE PAUSE 1167 000014A3 3C45 <1> cmp al, NUM_KEY ; LOOK FOR PAUSE KEY 1168 000014A5 7533 <1> jne short K41 ; NO-PAUSE 1169 <1> K39P: 1170 000014A7 800D[FA670000]08 <1> or byte [KB_FLAG_1], HOLD_STATE ; TURN ON THE HOLD FLAG 1171 <1> ; 1172 <1> ;----- ENABLE KEYBOARD 1173 000014AE B0AE <1> mov al, ENA_KBD ; ENABLE KEYBOARD 1174 000014B0 E892010000 <1> call SHIP_IT ; EXECUTE ENABLE 1175 <1> K39A: 1176 000014B5 B020 <1> mov al, EOI ; END OF INTERRUPT TO CONTROL PORT 1177 000014B7 E620 <1> out 20h, al ;out INTA00, al ; ALLOW FURTHER KEYSTROKE INTERRUPTS 1178 <1> ; 1179 <1> ;----- DURING PAUSE INTERVAL, TURN COLOR CRT BACK ON 1180 000014B9 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; IS THIS BLACK AND WHITE CARD 1181 000014C0 740A <1> je short K40 ; YES, NOTHING TO DO 1182 000014C2 66BAD803 <1> mov dx, 03D8h ; PORT FOR COLOR CARD 1183 000014C6 A0[2F680000] <1> mov al, [CRT_MODE_SET] ; GET THE VALUE OF THE CURRENT MODE 1184 000014CB EE <1> out dx, al ; SET THE CRT MODE, SO THAT CRT IS ON 1185 <1> ; 1186 <1> K40: ; PAUSE-LOOP 1187 000014CC F605[FA670000]08 <1> test byte [KB_FLAG_1], HOLD_STATE ; CHECK HOLD STATE FLAG 1188 000014D3 75F7 <1> jnz short K40 ; LOOP UNTIL FLAG TURNED OFF 1189 <1> ; 1190 000014D5 E995FEFFFF <1> jmp K27 ; INTERRUPT_RETURN_NO_EOI 1191 <1> ; 1192 <1> ;----- TEST SPECIAL CASE KEY 55 1193 <1> K41: ; NO-PAUSE 1194 000014DA 3C37 <1> cmp al, 55 ; TEST FOR */PRTSC KEY 1195 000014DC 7513 <1> jne short K42 ; NOT-KEY-55 1196 000014DE F6C710 <1> test bh, KBX ; IS THIS THE ENHANCED KEYBOARD? 1197 000014E1 7405 <1> jz short K41A ; NO, CTL-PRTSC IS VALID 1198 000014E3 F6C702 <1> test bh, LC_E0 ; YES, WAS LAST CODE AN E0? 1199 000014E6 7421 <1> jz short K42B ; NO, TRANSLATE TO A FUNCTION 1200 <1> K41A: 1201 000014E8 66B80072 <1> mov ax, 114*256 ; START/STOP PRINTING SWITCH 1202 000014EC E9EF000000 <1> jmp K57 ; BUFFER_FILL 1203 <1> ; 1204 <1> ;----- SET UP TO TRANSLATE CONTROL SHIFT 1205 <1> K42: ; NOT-KEY-55 1206 000014F1 3C0F <1> cmp al, 15 ; IS IT THE TAB KEY? 1207 000014F3 7414 <1> je short K42B ; YES, XLATE TO FUNCTION CODE 1208 000014F5 3C35 <1> cmp al, 53 ; IS IT THE / KEY? 1209 000014F7 750E <1> jne short K42A ; NO, NO MORE SPECIAL CASES 1210 000014F9 F6C702 <1> test bh, LC_E0 ; YES, IS IT FROM THE KEY PAD? 1211 000014FC 7409 <1> jz short K42A ; NO, JUST TRANSLATE 1212 000014FE 66B80095 <1> mov ax, 9500h ; YES, SPECIAL CODE FOR THIS ONE 1213 00001502 E9D9000000 <1> jmp K57 ; BUFFER FILL 1214 <1> K42A: 1215 <1> ;;mov ebx, _K8 ; SET UP TO TRANSLATE CTL 1216 00001507 3C3B <1> cmp al, 59 ; IS IT IN CHARACTER TABLE? 1217 <1> ;jb short K45F ; YES, GO TRANSLATE CHAR 1218 <1> ;;jb K56 ; 20/02/2015 1219 <1> ;;jmp K64 ; 20/02/2015 1220 <1> K42B: 1221 00001509 BB[F0660000] <1> mov ebx, _K8 ; SET UP TO TRANSLATE CTL 1222 <1> ;jb K56 ;; 20/02/2015 1223 <1> ; 12/04/2021 1224 0000150E 7267 <1> jb short K45F 1225 00001510 E9B9000000 <1> jmp K64 1226 <1> ; 1227 <1> ;----- NOT IN CONTROL SHIFT 1228 <1> K44: ; NOT-CTL-SHIFT 1229 00001515 3C37 <1> cmp al, 55 ; PRINT SCREEN KEY? 1230 00001517 7528 <1> jne short K45 ; NOT PRINT SCREEN 1231 00001519 F6C710 <1> test bh, KBX ; IS THIS ENHANCED KEYBOARD? 1232 0000151C 7407 <1> jz short K44A ; NO, TEST FOR SHIFT STATE 1233 0000151E F6C702 <1> test bh, LC_E0 ; YES, LAST CODE A MARKER? 1234 00001521 7507 <1> jnz short K44B ; YES, IS PRINT SCREEN 1235 00001523 EB41 <1> jmp short K45C ; NO, TRANSLATE TO '*' CHARACTER 1236 <1> K44A: 1237 00001525 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; NOT 101 KBD, SHIFT KEY DOWN? 1238 00001528 743C <1> jz short K45C ; NO, TRANSLATE TO '*' CHARACTER 1239 <1> ; 1240 <1> ;----- ISSUE INTERRUPT TO INDICATE PRINT SCREEN FUNCTION 1241 <1> K44B: 1242 0000152A B0AE <1> mov al, ENA_KBD ; INSURE KEYBOARD IS ENABLED 1243 0000152C E816010000 <1> call SHIP_IT ; EXECUTE ENABLE 1244 00001531 B020 <1> mov al, EOI ; END OF CURRENT INTERRUPT 1245 00001533 E620 <1> out 20h, al ;out INTA00, al ; SO FURTHER THINGS CAN HAPPEN 1246 <1> ; Print Screen !!! ; ISSUE PRINT SCREEN INTERRUPT (INT 05h) 1247 <1> ;PUSH BP ; SAVE POINTER 1248 <1> ;INT 5H ; ISSUE PRINT SCREEN INTERRUPT 1249 <1> ;POP BP ; RESTORE POINTER 1250 00001535 8025[FC670000]FC <1> and byte [KB_FLAG_3], ~(LC_E0+LC_E1) ; ZERO OUT THESE FLAGS 1251 0000153C E92EFEFFFF <1> jmp K27 ; GO BACK WITHOUT EOI OCCURRING 1252 <1> ; 1253 <1> ;----- HANDLE IN-CORE KEYS 1254 <1> K45: ; NOT-PRINT-SCREEN 1255 00001541 3C3A <1> cmp al, 58 ; TEST FOR IN-CORE AREA 1256 00001543 7734 <1> ja short K46 ; JUMP IF NOT 1257 00001545 3C35 <1> cmp al, 53 ; IS THIS THE '/' KEY? 1258 00001547 7505 <1> jne short K45A ; NO, JUMP 1259 00001549 F6C702 <1> test bh, LC_E0 ; WAS THE LAST CODE THE MARKER? 1260 0000154C 7518 <1> jnz short K45C ; YES, TRANSLATE TO CHARACTER 1261 <1> K45A: 1262 0000154E B91A000000 <1> mov ecx, 26 ; LENGHT OF SEARCH 1263 00001553 BF[C6660000] <1> mov edi, K30+10 ; POINT TO TABLE OF A-Z CHARS 1264 00001558 F2AE <1> repne scasb ; IS THIS A LETTER KEY? 1265 <1> ; 20/02/2015 1266 0000155A 7505 <1> jne short K45B ; NO, SYMBOL KEY 1267 <1> ; 1268 0000155C F6C340 <1> test bl, CAPS_STATE ; ARE WE IN CAPS_LOCK? 1269 0000155F 750C <1> jnz short K45D ; TEST FOR SURE 1270 <1> K45B: 1271 00001561 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; ARE WE IN SHIFT STATE? 1272 00001564 750C <1> jnz short K45E ; YES, UPPERCASE 1273 <1> ; NO, LOWERCASE 1274 <1> K45C: 1275 00001566 BB[48670000] <1> mov ebx, K10 ; TRANSLATE TO LOWERCASE LETTERS 1276 0000156B EB51 <1> jmp short K56 1277 <1> K45D: ; ALMOST-CAPS-STATE 1278 0000156D F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; CL ON. IS SHIFT ON, TOO? 1279 00001570 75F4 <1> jnz short K45C ; SHIFTED TEMP OUT OF CAPS STATE 1280 <1> K45E: 1281 00001572 BB[A0670000] <1> mov ebx, K11 ; TRANSLATE TO UPPER CASE LETTERS 1282 00001577 EB45 <1> K45F: jmp short K56 1283 <1> ; 1284 <1> ;----- TEST FOR KEYS F1 - F10 1285 <1> K46: ; NOT IN-CORE AREA 1286 00001579 3C44 <1> cmp al, 68 ; TEST FOR F1 - F10 1287 <1> ;ja short K47 ; JUMP IF NOT 1288 <1> ;jmp short K53 ; YES, GO DO FN KEY PROCESS 1289 0000157B 7635 <1> jna short K53 1290 <1> ; 1291 <1> ;----- HANDLE THE NUMERIC PAD KEYS 1292 <1> K47: ; NOT F1 - F10 1293 0000157D 3C53 <1> cmp al, 83 ; TEST NUMPAD KEYS 1294 0000157F 772D <1> ja short K52 ; JUMP IF NOT 1295 <1> ; 1296 <1> ;----- KEYPAD KEYS, MUST TEST NUM LOCK FOR DETERMINATION 1297 <1> K48: 1298 00001581 3C4A <1> cmp al, 74 ; SPECIAL CASE FOR MINUS 1299 00001583 74ED <1> je short K45E ; GO TRANSLATE 1300 00001585 3C4E <1> cmp al, 78 ; SPECIAL CASE FOR PLUS 1301 00001587 74E9 <1> je short K45E ; GO TRANSLATE 1302 00001589 F6C702 <1> test bh, LC_E0 ; IS THIS ONE OFTHE NEW KEYS? 1303 0000158C 750A <1> jnz short K49 ; YES, TRANSLATE TO BASE STATE 1304 <1> ; 1305 0000158E F6C320 <1> test bl, NUM_STATE ; ARE WE IN NUM LOCK 1306 00001591 7514 <1> jnz short K50 ; TEST FOR SURE 1307 00001593 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; ARE WE IN SHIFT STATE? 1308 <1> ;jnz short K51 ; IF SHIFTED, REALLY NUM STATE 1309 00001596 75DA <1> jnz short K45E 1310 <1> ; 1311 <1> ;----- BASE CASE FOR KEYPAD 1312 <1> K49: 1313 00001598 3C4C <1> cmp al, 76 ; SPECIAL CASE FOR BASE STATE 5 1314 0000159A 7504 <1> jne short K49A ; CONTINUE IF NOT KEYPAD 5 1315 0000159C B0F0 <1> mov al, 0F0h ; SPECIAL ASCII CODE 1316 0000159E EB40 <1> jmp short K57 ; BUFFER FILL 1317 <1> K49A: 1318 000015A0 BB[48670000] <1> mov ebx, K10 ; BASE CASE TABLE 1319 000015A5 EB27 <1> jmp short K64 ; CONVERT TO PSEUDO SCAN 1320 <1> ; 1321 <1> ;----- MIGHT BE NUM LOCK, TEST SHIFT STATUS 1322 <1> K50: ; ALMOST-NUM-STATE 1323 000015A7 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT 1324 000015AA 75EC <1> jnz short K49 ; SHIFTED TEMP OUT OF NUM STATE 1325 000015AC EBC4 <1> K51: jmp short K45E ; REALLY NUM STATE 1326 <1> ; 1327 <1> ;----- TEST FOR THE NEW KEYS ON WT KEYBOARDS 1328 <1> K52: ; NOT A NUMPAD KEY 1329 000015AE 3C56 <1> cmp al, 86 ; IS IT THE NEW WT KEY? 1330 <1> ;jne short K53 ; JUMP IF NOT 1331 <1> ;jmp short K45B ; HANDLE WITH REST OF LETTER KEYS 1332 000015B0 74AF <1> je short K45B 1333 <1> ; 1334 <1> ;----- MUST BE F11 OR F12 1335 <1> K53: ; F1 - F10 COME HERE, TOO 1336 000015B2 F6C303 <1> test bl, LEFT_SHIFT+RIGHT_SHIFT ; TEST SHIFT STATE 1337 000015B5 74E1 <1> jz short K49 ; JUMP, LOWER CASE PSEUDO SC'S 1338 <1> ; 20/02/2015 1339 000015B7 BB[A0670000] <1> mov ebx, K11 ; UPPER CASE PSEUDO SCAN CODES 1340 000015BC EB10 <1> jmp short K64 ; TRANSLATE SCAN 1341 <1> ; 1342 <1> ;----- TRANSLATE THE CHARACTER 1343 <1> K56: ; TRANSLATE-CHAR 1344 000015BE FEC8 <1> dec al ; CONVERT ORIGIN 1345 000015C0 D7 <1> xlat ; CONVERT THE SCAN CODE TO ASCII 1346 000015C1 F605[FC670000]02 <1> test byte [KB_FLAG_3], LC_E0 ; IS THIS A NEW KEY? 1347 000015C8 7416 <1> jz short K57 ; NO, GO FILL BUFFER 1348 000015CA B4E0 <1> mov ah, MC_E0 ; YES, PUT SPECIAL MARKER IN AH 1349 000015CC EB12 <1> jmp short K57 ; PUT IT INTO THE BUFFER 1350 <1> ; 1351 <1> ;----- TRANSLATE SCAN FOR PSEUDO SCAN CODES 1352 <1> K64: ; TRANSLATE-SCAN-ORGD 1353 000015CE FEC8 <1> dec al ; CONVERT ORIGIN 1354 000015D0 D7 <1> xlat ; CTL TABLE SCAN 1355 000015D1 88C4 <1> mov ah, al ; PUT VALUE INTO AH 1356 000015D3 B000 <1> mov al, 0 ; ZERO ASCII CODE 1357 000015D5 F605[FC670000]02 <1> test byte [KB_FLAG_3], LC_E0 ; IS THIS A NEW KEY? 1358 000015DC 7402 <1> jz short K57 ; NO, GO FILL BUFFER 1359 000015DE B0E0 <1> mov al, MC_E0 ; YES, PUT SPECIAL MARKER IN AL 1360 <1> ; 1361 <1> ;----- PUT CHARACTER INTO BUFFER 1362 <1> K57: ; BUFFER_FILL 1363 000015E0 3CFF <1> cmp al, -1 ; IS THIS AN IGNORE CHAR 1364 000015E2 7405 <1> je short K59 ; YES, DO NOTHING WITH IT 1365 <1> ;je K26 ; YES, DO NOTHING WITH IT 1366 000015E4 80FCFF <1> cmp ah, -1 ; LOOK FOR -1 PSEUDO SCAN 1367 <1> ;;jne short K61 ; NEAR_INTERRUPT_RETURN 1368 <1> ;je K26 ; INTERRUPT_RETURN 1369 <1> ; 12/04/2021 1370 000015E7 7505 <1> jne short _K60 ; NEAR_INTERRUPT_RETURN 1371 <1> K59: ; NEAR_INTERRUPT_RETURN 1372 000015E9 E975FDFFFF <1> jmp K26 ; INTERRUPT_RETURN 1373 <1> 1374 <1> _K60: ; 29/01/2016 1375 000015EE 80FC68 <1> cmp ah, 68h ; ALT + F1 key 1376 000015F1 721D <1> jb short K61 1377 000015F3 80FC6F <1> cmp ah, 6Fh ; ALT + F8 key 1378 000015F6 7718 <1> ja short K61 1379 <1> ; 1380 000015F8 8A1D[DE760100] <1> mov bl, [ACTIVE_PAGE] 1381 000015FE 80C368 <1> add bl, 68h 1382 00001601 38E3 <1> cmp bl, ah 1383 00001603 740B <1> je short K61 1384 <1> ; 24/07/2022 1385 <1> ;push ax 1386 00001605 50 <1> push eax 1387 00001606 88E0 <1> mov al, ah 1388 00001608 2C68 <1> sub al, 68h 1389 0000160A E8A4090000 <1> call set_active_page 1390 0000160F 58 <1> pop eax 1391 <1> ;pop ax 1392 <1> K61: ; NOT-CAPS-STATE 1393 00001610 8B1D[0A680000] <1> mov ebx, [BUFFER_TAIL] ; GET THE END POINTER TO THE BUFFER 1394 00001616 89DE <1> mov esi, ebx ; SAVE THE VALUE 1395 00001618 E8B5FAFFFF <1> call _K4 ; ADVANCE THE TAIL 1396 0000161D 3B1D[06680000] <1> cmp ebx, [BUFFER_HEAD] ; HAS THE BUFFER WRAPPED AROUND 1397 00001623 740E <1> je short K62 ; BUFFER_FULL_BEEP 1398 00001625 668906 <1> mov [esi], ax ; STORE THE VALUE 1399 00001628 891D[0A680000] <1> mov [BUFFER_TAIL], ebx ; MOVE THE POINTER UP 1400 0000162E E930FDFFFF <1> jmp K26 1401 <1> ;;cli ; TURN OFF INTERRUPTS 1402 <1> ;;mov al, EOI ; END OF INTERRUPT COMMAND 1403 <1> ;;out INTA00, al ; SEND COMMAND TO INTERRUPT CONTROL PORT 1404 <1> ;mov al, ENA_KBD ; INSURE KEYBOARD IS ENABLED 1405 <1> ;call SHIP_IT ; EXECUTE ENABLE 1406 <1> ;mov ax, 9102h ; MOVE IN POST CODE & TYPE 1407 <1> ;int 15h ; PERFORM OTHER FUNCTION 1408 <1> ;;and byte [KB_FLAG_3],~(LC_E0+LC_E1) ; RESET LAST CHAR H.C. FLAG 1409 <1> ;jmp K27A ; INTERRUPT_RETURN 1410 <1> ;;jmp K27 1411 <1> ; 1412 <1> ;----- BUFFER IS FULL SOUND THE BEEPER 1413 <1> K62: 1414 00001633 B020 <1> mov al, EOI ; ENABLE INTERRUPT CONTROLLER CHIP 1415 00001635 E620 <1> out INTA00, al 1416 00001637 66B9A602 <1> mov cx, 678 ; DIVISOR FOR 1760 HZ 1417 0000163B B304 <1> mov bl, 4 ; SHORT BEEP COUNT (1/16 + 1/64 DELAY) 1418 0000163D E8960D0000 <1> call beep ; GO TO COMMON BEEP HANDLER 1419 00001642 E928FDFFFF <1> jmp K27 ; EXIT 1420 <1> 1421 <1> SHIP_IT: 1422 <1> ;--------------------------------------------------------------------------------- 1423 <1> ; SHIP_IT 1424 <1> ; THIS ROUTINES HANDLES TRANSMISSION OF COMMAND AND DATA BYTES 1425 <1> ; TO THE KEYBOARD CONTROLLER. 1426 <1> ;--------------------------------------------------------------------------------- 1427 <1> ; 1428 <1> 1429 <1> ;push ax ; SAVE DATA TO SEND 1430 <1> ; 12/04/2021 1431 00001647 50 <1> push eax 1432 <1> 1433 <1> ;----- WAIT FOR COMMAND TO ACCEPTED 1434 00001648 FA <1> cli ; DISABLE INTERRUPTS TILL DATA SENT 1435 <1> ; xor ecx, ecx ; CLEAR TIMEOUT COUNTER 1436 00001649 B900000100 <1> mov ecx, 10000h 1437 <1> S10: 1438 0000164E E464 <1> in al, STATUS_PORT ; READ KEYBOARD CONTROLLER STATUS 1439 00001650 A802 <1> test al, INPT_BUF_FULL ; CHECK FOR ITS INPUT BUFFER BUSY 1440 00001652 E0FA <1> loopnz S10 ; WAIT FOR COMMAND TO BE ACCEPTED 1441 <1> 1442 <1> ;pop ax ; GET DATA TO SEND 1443 <1> ; 12/04/2021 1444 00001654 58 <1> pop eax 1445 <1> 1446 00001655 E664 <1> out STATUS_PORT, al ; SEND TO KEYBOARD CONTROLLER 1447 00001657 FB <1> sti ; ENABLE INTERRUPTS AGAIN 1448 00001658 C3 <1> retn ; RETURN TO CALLER 1449 <1> 1450 <1> ; 12/04/2021 (32 bit push/pop) 1451 <1> SND_DATA: 1452 <1> ; --------------------------------------------------------------------------------- 1453 <1> ; SND_DATA 1454 <1> ; THIS ROUTINES HANDLES TRANSMISSION OF COMMAND AND DATA BYTES 1455 <1> ; TO THE KEYBOARD AND RECEIPT OF ACKNOWLEDGEMENTS. IT ALSO 1456 <1> ; HANDLES ANY RETRIES IF REQUIRED 1457 <1> ; --------------------------------------------------------------------------------- 1458 <1> ; 1459 00001659 50 <1> push eax ; push ax ; SAVE REGISTERS 1460 0000165A 53 <1> push ebx ; push bx 1461 0000165B 51 <1> push ecx 1462 0000165C 88C7 <1> mov bh, al ; SAVE TRANSMITTED BYTE FOR RETRIES 1463 0000165E B303 <1> mov bl, 3 ; LOAD RETRY COUNT 1464 <1> SD0: 1465 00001660 FA <1> cli ; DISABLE INTERRUPTS 1466 00001661 8025[FB670000]CF <1> and byte [KB_FLAG_2], ~(KB_FE+KB_FA) ; CLEAR ACK AND RESEND FLAGS 1467 <1> ; 1468 <1> ;----- WAIT FOR COMMAND TO BE ACCEPTED 1469 00001668 B900000100 <1> mov ecx, 10000h ; MAXIMUM WAIT COUNT 1470 <1> SD5: 1471 0000166D E464 <1> in al, STATUS_PORT ; READ KEYBOARD PROCESSOR STATUS PORT 1472 0000166F A802 <1> test al, INPT_BUF_FULL ; CHECK FOR ANY PENDING COMMAND 1473 00001671 E0FA <1> loopnz SD5 ; WAIT FOR COMMAND TO BE ACCEPTED 1474 <1> ; 1475 00001673 88F8 <1> mov al, bh ; REESTABLISH BYTE TO TRANSMIT 1476 00001675 E660 <1> out PORT_A, al ; SEND BYTE 1477 00001677 FB <1> sti ; ENABLE INTERRUPTS 1478 <1> ;mov cx, 01A00h ; LOAD COUNT FOR 10 ms+ 1479 00001678 B9FFFF0000 <1> mov ecx, 0FFFFh 1480 <1> SD1: 1481 0000167D F605[FB670000]30 <1> test byte [KB_FLAG_2], KB_FE+KB_FA ; SEE IF EITHER BIT SET 1482 00001684 750F <1> jnz short SD3 ; IF SET, SOMETHING RECEIVED GO PROCESS 1483 00001686 E2F5 <1> loop SD1 ; OTHERWISE WAIT 1484 <1> SD2: 1485 00001688 FECB <1> dec bl ; DECREMENT RETRY COUNT 1486 0000168A 75D4 <1> jnz short SD0 ; RETRY TRANSMISSION 1487 0000168C 800D[FB670000]80 <1> or byte [KB_FLAG_2], KB_ERR ; TURN ON TRANSMIT ERROR FLAG 1488 00001693 EB09 <1> jmp short SD4 ; RETRIES EXHAUSTED FORGET TRANSMISSION 1489 <1> SD3: 1490 00001695 F605[FB670000]10 <1> test byte [KB_FLAG_2], KB_FA ; SEE IF THIS IS AN ACKNOWLEDGE 1491 0000169C 74EA <1> jz short SD2 ; IF NOT, GO RESEND 1492 <1> SD4: 1493 0000169E 59 <1> pop ecx ; RESTORE REGISTERS 1494 0000169F 5B <1> pop ebx ; pop bx 1495 000016A0 58 <1> pop eax ; pop ax 1496 000016A1 C3 <1> retn ; RETURN, GOOD TRANSMISSION 1497 <1> 1498 <1> SND_LED: 1499 <1> ; --------------------------------------------------------------------------------- 1500 <1> ; SND_LED 1501 <1> ; THIS ROUTINES TURNS ON THE MODE INDICATORS. 1502 <1> ; 1503 <1> ;---------------------------------------------------------------------------------- 1504 <1> ; 1505 000016A2 FA <1> cli ; TURN OFF INTERRUPTS 1506 000016A3 F605[FB670000]40 <1> test byte [KB_FLAG_2], KB_PR_LED ; CHECK FOR MODE INDICATOR UPDATE 1507 000016AA 755F <1> jnz short SL1 ; DON'T UPDATE AGAIN IF UPDATE UNDERWAY 1508 <1> ; 1509 000016AC 800D[FB670000]40 <1> or byte [KB_FLAG_2], KB_PR_LED ; TURN ON UPDATE IN PROCESS 1510 000016B3 B020 <1> mov al, EOI ; END OF INTERRUPT COMMAND 1511 000016B5 E620 <1> out 20h, al ;out INTA00, al ; SEND COMMAND TO INTERRUPT CONTROL PORT 1512 000016B7 EB11 <1> jmp short SL0 ; GO SEND MODE INDICATOR COMMAND 1513 <1> SND_LED1: 1514 000016B9 FA <1> cli ; TURN OFF INTERRUPTS 1515 000016BA F605[FB670000]40 <1> test byte [KB_FLAG_2], KB_PR_LED ; CHECK FOR MODE INDICATOR UPDATE 1516 000016C1 7548 <1> jnz short SL1 ; DON'T UPDATE AGAIN IF UPDATE UNDERWAY 1517 <1> ; 1518 000016C3 800D[FB670000]40 <1> or byte [KB_FLAG_2], KB_PR_LED ; TURN ON UPDATE IN PROCESS 1519 <1> SL0: 1520 000016CA B0ED <1> mov al, LED_CMD ; LED CMD BYTE 1521 000016CC E888FFFFFF <1> call SND_DATA ; SEND DATA TO KEYBOARD 1522 000016D1 FA <1> cli 1523 000016D2 E836000000 <1> call MAKE_LED ; GO FORM INDICATOR DATA BYTE 1524 000016D7 8025[FB670000]F8 <1> and byte [KB_FLAG_2], 0F8h ; ~KB_LEDS ; CLEAR MODE INDICATOR BITS 1525 000016DE 0805[FB670000] <1> or [KB_FLAG_2], al ; SAVE PRESENT INDICATORS FOR NEXT TIME 1526 000016E4 F605[FB670000]80 <1> test byte [KB_FLAG_2], KB_ERR ; TRANSMIT ERROR DETECTED 1527 000016EB 750F <1> jnz short SL2 ; IF SO, BYPASS SECOND BYTE TRANSMISSION 1528 <1> ; 1529 000016ED E867FFFFFF <1> call SND_DATA ; SEND DATA TO KEYBOARD 1530 000016F2 FA <1> cli ; TURN OFF INTERRUPTS 1531 000016F3 F605[FB670000]80 <1> test byte [KB_FLAG_2], KB_ERR ; TRANSMIT ERROR DETECTED 1532 000016FA 7408 <1> jz short SL3 ; IF NOT, DON'T SEND AN ENABLE COMMAND 1533 <1> SL2: 1534 000016FC B0F4 <1> mov al, KB_ENABLE ; GET KEYBOARD CSA ENABLE COMMAND 1535 000016FE E856FFFFFF <1> call SND_DATA ; SEND DATA TO KEYBOARD 1536 00001703 FA <1> cli ; TURN OFF INTERRUPTS 1537 <1> SL3: 1538 00001704 8025[FB670000]3F <1> and byte [KB_FLAG_2], ~(KB_PR_LED+KB_ERR) ; TURN OFF MODE INDICATOR 1539 <1> SL1: ; UPDATE AND TRANSMIT ERROR FLAG 1540 0000170B FB <1> sti ; ENABLE INTERRUPTS 1541 0000170C C3 <1> retn ; RETURN TO CALLER 1542 <1> 1543 <1> MAKE_LED: 1544 <1> ;--------------------------------------------------------------------------------- 1545 <1> ; MAKE_LED 1546 <1> ; THIS ROUTINES FORMS THE DATA BYTE NECESSARY TO TURN ON/OFF 1547 <1> ; THE MODE INDICATORS. 1548 <1> ;--------------------------------------------------------------------------------- 1549 <1> ; 1550 <1> ;push cx ; SAVE CX 1551 0000170D A0[F9670000] <1> mov al, [KB_FLAG] ; GET CAPS & NUM LOCK INDICATORS 1552 00001712 2470 <1> and al, CAPS_STATE+NUM_STATE+SCROLL_STATE ; ISOLATE INDICATORS 1553 <1> ;mov cl, 4 ; SHIFT COUNT 1554 <1> ;rol al, cl ; SHIFT BITS OVER TO TURN ON INDICATORS 1555 00001714 C0C004 <1> rol al, 4 ; 20/02/2015 1556 00001717 2407 <1> and al, 07h ; MAKE SURE ONLY MODE BITS ON 1557 <1> ;pop cx 1558 00001719 C3 <1> retn ; RETURN TO CALLER 1559 <1> 1560 <1> ; % include 'kybdata.s' ; KEYBOARD DATA 1561 <1> 1562 <1> 1563 <1> ; /// End Of KEYBOARD FUNCTIONS /// 2990 2991 %include 'video.s' ; 07/03/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.10 - video.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 10/02/2026 (Previous: 29/11/2023 - Kernel v2.0.7) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 16/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; video.inc (13/08/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-AT' BIOS source code (1985) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - VIDEO.INC 20 <1> ; Last Modification: 13/08/2015 21 <1> ; (Video Data is in 'VIDATA.INC') 22 <1> ; 23 <1> ; ///////// VIDEO (CGA) FUNCTIONS /////////////// 24 <1> 25 <1> ; 16/01/2016 (32 bit modifications, TRDOS386 - TRDOS v2.0, video.s) 26 <1> ; INT 31H (TRDOS 386) = INT 10H (IBM PC/AT REAL MODE) 27 <1> 28 <1> ; IBM PC-AT BIOS Source Code 29 <1> ; TITLE VIDEO1 --- 06/10/85 VIDEO DISPLAY BIOS 30 <1> 31 <1> _int10h: 32 <1> ; 23/03/2016 33 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 34 0000171A 9C <1> pushfd 35 0000171B 0E <1> push cs 36 0000171C E851000000 <1> call VIDEO_IO_1 37 00001721 C3 <1> retn 38 <1> 39 <1> ;--- INT 10 H ------------------------------------------------------------------- 40 <1> ; VIDEO_IO : 41 <1> ; THESE ROUTINES PROVIDE THE CRT DISPLAY INTERFACE : 42 <1> ; THE FOLLOWING FUNCTIONS ARE PROVIDED: : 43 <1> ; : 44 <1> ; (AH)= 00H SET MODE (AL) CONTAINS MODE VALUE : 45 <1> ; (AL) = 00H 40X25 BW MODE (POWER ON DEFAULT) : 46 <1> ; (AL) = 01H 40X25 COLOR : 47 <1> ; (AL) = 02H 80X25 BW : 48 <1> ; (AL) = 03H 80X25 COLOR : 49 <1> ; GRAPHICS MODES : 50 <1> ; (AL) = 04H 320X200 COLOR : 51 <1> ; (AL) = 05H 320X200 BW MODE : 52 <1> ; (AL) = 06H 640X200 BW MODE : 53 <1> ; (AL) = 07H 80X25 MONOCHROME (USED INTERNAL TO VIDEO ONLY) : 54 <1> ; *** NOTES -BW MODES OPERATE SAME AS COLOR MODES, BUT COLOR : 55 <1> ; BURST IS NOT ENABLED : 56 <1> ; -CURSOR IS NOT DISPLAYED IN GRAPHICS MODE : 57 <1> ; (AH)= 01H SET CURSOR TYPE : 58 <1> ; (CH) = BITS 4-0 = START LINE FOR CURSOR : 59 <1> ; ** HARDWARE WILL ALWAYS CAUSE BLINK : 60 <1> ; ** SETTING BIT 5 OR 6 WILL CAUSE ERRATIC BLINKING : 61 <1> ; OR NO CURSOR AT ALL : 62 <1> ; (CL) = BITS 4-0 = END LINE FOR CURSOR : 63 <1> ; (AH)= 02H SET CURSOR POSITION : 64 <1> ; (DH,DL) = ROW,COLUMN (00H,00H) IS UPPER LEFT : 65 <1> ; (BH) = A PAGE NUMBER (MUST BE 00H FOR GRAPHICS MODES) : 66 <1> ; (AH)= 03H READ CURSOR POSITION : 67 <1> ; (BH) = PAGE NUMBER (MUST BE 00H FOR GRAPHICS MODES) : 68 <1> ; ON EXIT (DH,DL) = ROW,COLUMN OF CURRENT CURSOR : 69 <1> ; (CH,CL) = CURSOR MODE CURRENTLY SET : 70 <1> ; (AH)= 04H READ LIGHT PEN POSITION : 71 <1> ; ON EXIT: : 72 <1> ; (AH) = 00H -- LIGHT PEN SWITCH NOT DOWN/NOT TRIGGERED : 73 <1> ; (AH) = 01H -- VALID LIGHT PEN VALUE IN REGISTERS : 74 <1> ; (DH,DL) = ROW,COLUMN OF CHARACTER LP POSITION : 75 <1> ; (CH) = RASTER LINE (0-199) : 76 <1> ; (BX) = PIXEL COLUMN (0-319,639) : 77 <1> ; (AH)= 05H SELECT ACTIVE DISPLAY PAGE (VALID ONLY FOR ALPHA MODES) : 78 <1> ; (AL) = NEW PAGE VALUE (0-7 FOR MODES 0&1, 0-3 FOR MODES 2&3) : 79 <1> ; (AH)= 06H SCROLL ACTIVE PAGE UP : 80 <1> ; (AL) = NUMBER OF LINES. ( LINES BLANKED AT BOTTOM OF WINDOW ) : 81 <1> ; (AL) = 00H MEANS BLANK ENTIRE WINDOW : 82 <1> ; (CH,CL) = ROW,COLUMN OF UPPER LEFT CORNER OF SCROLL : 83 <1> ; (DH,DL) = ROW,COLUMN OF LOWER RIGHT CORNER OF SCROLL : 84 <1> ; (BH) = ATTRIBUTE TO BE USED ON BLANK LINE : 85 <1> ; (AH)= 07H SCROLL ACTIVE PAGE DOWN : 86 <1> ; (AL) = NUMBER OF LINES, INPUT LINES BLANKED AT TOP OF WINDOW : 87 <1> ; (AL) = 00H MEANS BLANK ENTIRE WINDOW : 88 <1> ; (CH,CL) = ROW,COLUMN OF UPPER LEFT CORNER OF SCROLL : 89 <1> ; (DH,DL) = ROW,COLUMN OF LOWER RIGHT CORNER OF SCROLL : 90 <1> ; (BH) = ATTRIBUTE TO BE USED ON BLANK LINE : 91 <1> ; : 92 <1> ; CHARACTER HANDLING ROUTINES : 93 <1> ; : 94 <1> ; (AH)= 08H READ ATTRIBUTE/CHARACTER AT CURRENT CURSOR POSITION : 95 <1> ; (BH) = DISPLAY PAGE (VALID FOR ALPHA MODES ONLY) : 96 <1> ; ON EXIT: : 97 <1> ; (AL) = CHAR READ : 98 <1> ; (AH) = ATTRIBUTE OF CHARACTER READ (ALPHA MODES ONLY) : 99 <1> ; (AH)= 09H WRITE ATTRIBUTE/CHARACTER AT CURRENT CURSOR POSITION : 100 <1> ; (BH) = DISPLAY PAGE (VALID FOR ALPHA MODES ONLY) : 101 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE : 102 <1> ; (AL) = CHAR TO WRITE : 103 <1> ; (BL) = ATTRIBUTE OF CHARACTER (ALPHA)/COLOR OF CHAR (GRAPHICS) : 104 <1> ; SEE NOTE ON WRITE DOT FOR BIT 7 OF BL = 1. : 105 <1> ; (AH) = 0AH WRITE CHARACTER ONLY AT CURRENT CURSOR POSITION : 106 <1> ; (BH) = DISPLAY PAGE (VALID FOR ALPHA MODES ONLY) : 107 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE : 108 <1> ; (AL) = CHAR TO WRITE : 109 <1> ; NOTE: USE FUNCTION (AH)= 09H IN GRAPHICS MODES : 110 <1> ; FOR READ/WRITE CHARACTER INTERFACE WHILE IN GRAPHICS MODE, THE : 111 <1> ; CHARACTERS ARE FORMED FROM A CHARACTER GENERATOR IMAGE : 112 <1> ; MAINTAINED IN THE SYSTEM ROM. ONLY THE 1ST 128 CHARS : 113 <1> ; ARE CONTAINED THERE. TO READ/WRITE THE SECOND 128 CHARS, : 114 <1> ; THE USER MUST INITIALIZE THE POINTER AT INTERRUPT 1FH : 115 <1> ; (LOCATION 0007CH) TO POINT TO THE 1K BYTE TABLE CONTAINING : 116 <1> ; THE CODE POINTS FOR THE SECOND 128 CHARS (128-255). : 117 <1> ; FOR WRITE CHARACTER INTERFACE IN GRAPHICS MODE, THE REPLICATION FACTOR : 118 <1> ; CONTAINED IN (CX) ON ENTRY WILL PRODUCE VALID RESULTS ONLY : 119 <1> ; FOR CHARACTERS CONTAINED ON THE SAME ROW. CONTINUATION TO : 120 <1> ; SUCCEEDING LINES WILL NOT PRODUCE CORRECTLY. : 121 <1> ; : 122 <1> ; GRAPHICS INTERFACE : 123 <1> ; (AH)= 0BH SET COLOR PALETTE : 124 <1> ; (BH) = PALETTE COLOR ID BEING SET (0-127) : 125 <1> ; (BL) = COLOR VALUE TO BE USED WITH THAT COLOR ID : 126 <1> ; NOTE: FOR THE CURRENT COLOR CARD, THIS ENTRY POINT HAS : 127 <1> ; MEANING ONLY FOR 320X200 GRAPHICS. : 128 <1> ; COLOR ID = 0 SELECTS THE BACKGROUND COLOR (0-15) : 129 <1> ; COLOR ID = 1 SELECTS THE PALETTE TO BE USED: : 130 <1> ; 0 = GREEN(1)/RED(2)/YELLOW(3) : 131 <1> ; 1 = CYAN(1)/MAGENTA(2)/WHITE(3) : 132 <1> ; IN 40X25 OR 80X25 ALPHA MODES, THE VALUE SET FOR : 133 <1> ; PALETTE COLOR 0 INDICATES THE BORDER COLOR : 134 <1> ; TO BE USED (VALUES 0-31, WHERE 16-31 SELECT : 135 <1> ; THE HIGH INTENSITY BACKGROUND SET. : 136 <1> ; (AH)= 0CH WRITE DOT : 137 <1> ; (DX) = ROW NUMBER : 138 <1> ; (CX) = COLUMN NUMBER : 139 <1> ; (AL) = COLOR VALUE : 140 <1> ; IF BIT 7 OF AL = 1, THEN THE COLOR VALUE IS EXCLUSIVE : 141 <1> ; ORed WITH THE CURRENT CONTENTS OF THE DOT : 142 <1> ; (AH)= ODH READ DOT : 143 <1> ; (DX) = ROW NUMBER : 144 <1> ; (CX) = COLUMN NUMBER : 145 <1> ; (AL) = RETURNS THE DOT READ : 146 <1> ; : 147 <1> ; ASCII TELETYPE ROUTINE FOR OUTPUT : 148 <1> ; : 149 <1> ; (AH)= 0EH WRITE TELETYPE TO ACTIVE PAGE : 150 <1> ; (AL) = CHAR TO WRITE : 151 <1> ; (BL) = FOREGROUND COLOR IN GRAPHICS MODE : 152 <1> ; NOTE -- SCREEN WIDTH IS CONTROLLED BY PREVIOUS MODE SET : 153 <1> ; (AH)= 0FH CURRENT VIDEO STATE : 154 <1> ; RETURNS THE CURRENT VIDEO STATE : 155 <1> ; (AL) = MODE CURRENTLY SET ( SEE (AH)=00H FOR EXPLANATION) : 156 <1> ; (AH) = NUMBER OR CHARACTER COLUMNS ON SCREEN : 157 <1> ; (BH) = CURRENT ACTIVE DISPLAY PAGE : 158 <1> ; (AH)= 10H RESERVED : 159 <1> ; (AH)= 11H RESERVED : 160 <1> ; (AH)= 12H RESERVED : 161 <1> ; (AH)= 13H WRITE STRING : 162 <1> ; ES:BP - POINTER T0 STRING TO BE WRITTEN : 163 <1> ; CX - LENGTH OF CHARACTER STRING TO WRITTEN : 164 <1> ; DX - CURSOR POSITION FOR STRING TO BE WRITTEN : 165 <1> ; BH - PAGE NUMBER : 166 <1> ; (AL)= 00H WRITE CHARACTER STRING : 167 <1> ; BL - ATTRIBUTE : 168 <1> ; STRING IS : 169 <1> ; CURSOR NOT MOVED : 170 <1> ; (AL)= 01H WRITE CHARACTER STRING AND MOVE CURSOR : 171 <1> ; BL - ATTRIBUTE : 172 <1> ; STRING IS : 173 <1> ; CURSOR MOVED : 174 <1> ; (AL)= 02H WRITE CHARACTER AND ATTRIBUTE STRING : 175 <1> ; (VALID FOR ALPHA MODES ONLY) : 176 <1> ; STRING IS : 177 <1> ; CURSOR IS NOT MOVED : 178 <1> ; (AL)= 03H WRITE CHARACTER AND ATTRIBUTE STRING AND MOVE CURSOR : 179 <1> ; (VALID FOR ALPHA MODES ONLY) : 180 <1> ; STRING IS : 181 <1> ; CURSOR IS MOVED : 182 <1> ; NOTE: CARRIAGE RETURN, LINE FEED, BACKSPACE, AND BELL ARE : 183 <1> ; TREATED AS COMMANDS RATHER THAN PRINTABLE CHARACTERS. : 184 <1> ; : 185 <1> ; BX,CX,DX,SI,DI,BP,SP,DS,ES,SS PRESERVED DURING CALLS EXCEPT FOR : 186 <1> ; BX,CX,DX RETURN VALUES ON FUNCTIONS 03H,04H,0DH AND 0FH. ON ALL CALLS : 187 <1> ; AX IS MODIFIED. : 188 <1> ;-------------------------------------------------------------------------------- 189 <1> 190 00001722 [361B0000] <1> M1: dd SET_MODE ; TABLE OF ROUTINES WITHIN VIDEO I/O 191 00001726 [F51E0000] <1> dd SET_CTYPE 192 0000172A [231F0000] <1> dd SET_CPOS 193 0000172E [471F0000] <1> dd READ_CURSOR 194 <1> ;dd VIDEO_RETURN ; READ_LPEN 195 00001732 [341B0000] <1> dd set_mode_ncm ; Set mode without clearing video memory 196 00001736 [951F0000] <1> dd ACT_DISP_PAGE 197 0000173A [1F200000] <1> dd SCROLL_UP 198 0000173E [36210000] <1> dd SCROLL_DOWN 199 00001742 [B5210000] <1> dd READ_AC_CURRENT 200 00001746 [12220000] <1> dd WRITE_AC_CURRENT 201 0000174A [38220000] <1> dd WRITE_C_CURRENT 202 0000174E [402B0000] <1> dd SET_COLOR 203 00001752 [A82B0000] <1> dd WRITE_DOT 204 00001756 [772B0000] <1> dd READ_DOT 205 0000175A [C2220000] <1> dd WRITE_TTY 206 0000175E [1C1B0000] <1> dd VIDEO_STATE 207 00001762 [75360000] <1> dd vga_pal_funcs ; 10/08/2016 (TRDOS 386) 208 00001766 [8D300000] <1> dd font_setup ; 10/07/2016 (TRDOS 386) 209 0000176A [6B1B0000] <1> dd VIDEO_RETURN ; RESERVED 210 0000176E [38240000] <1> dd WRITE_STRING ; 23/06/2016 (TRDOS 386) 211 <1> M1L EQU $ - M1 212 <1> 213 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 214 <1> ; BugFix note: 215 <1> ; cr3 is changed to Kernel's Page Directory address in int 31h. 216 <1> ; Because, 'transfer_to_user_buffer' uses 'get_physical_addr_x' 217 <1> ; uses 'get_pde' uses 'get_pde' .. and 'get_pde' causes 218 <1> ; page fault error because of "mov eax, [edx]" code in it while 219 <1> ; edx contains an address at the beyond of the 1st 4MB. 220 <1> ; (Before this Bugfix, 'VGA_func_std' part of int 31h was running 221 <1> ; with user's page directry in cr3. (That was no problem if 222 <1> ; all page tables would be in the 1st 4MB. But if the RAM is larger 223 <1> ; than 2.5GB, page tables extent at the beyond of the 1st 4MB.) 224 <1> ; As result of the BugFix today, size of 4GB-LFBaddress RAM will be 225 <1> ; available to use. 226 <1> ; 227 <1> ;; Note: [cr3prev] is used for int 31h video interrupt and [cr3reg] 228 <1> ;; is used for timer -or RTC- interrupt. 229 <1> ;; (This separation is needed because timer interrupt can occur 230 <1> ;; while video interrupt handler is in progress.) 231 <1> 232 <1> 233 <1> ; 22/12/2025 234 <1> ; 21/12/2025 - TRDOS 386 v2.0.10 235 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 236 <1> ; [VESA VBE3-PMI functions] 237 <1> ; (fixing page table problems for LFB/PMI for >2.5GB main memory) 238 <1> ; ((Addresses of kernel page tables and PMI videobios address 239 <1> ; must be < 4MB or cr3 register must contain kernel's page dir 240 <1> ; during video interrupt. Save-change-restore cr3 register 241 <1> ; content here is a bugfix method to prevent page faults 242 <1> ; for -real- computers with >2.5GB main memory.)) 243 <1> ; {INT 31h was not changing cr3 while it contains user's 244 <1> ; page directory addr and accessing beyond of the 1st 4MB was 245 <1> ; causing to page faults.. because, after the 1st 4MB, user's 246 <1> ; page tables contain non-linear/virtual memory pages.} 247 <1> ; 248 <1> ; 02/08/2022 - TRDOS 386 v2.0.5 249 <1> ; 06/12/2020 250 <1> ; 05/12/2020 251 <1> ; 03/12/2020 252 <1> ; 27/11/2020 - TRDOS 386 v2.0.3 253 <1> ; 14/01/2017 254 <1> ; 02/01/2017 255 <1> ; 04/07/2016 256 <1> ; 12/05/2016 257 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 258 <1> int31h: ; Video BIOS 259 <1> 260 <1> ; BH = Video page number 261 <1> ; BL = Color/Attribute 262 <1> ; AH = Function number 263 <1> ; AL = Character 264 <1> 265 <1> VIDEO_IO_1: 266 <1> ;sti ; INTERRUPTS BACK ON 267 00001772 FC <1> cld ; SET DIRECTION FORWARD 268 <1> 269 <1> ;cmp ah, M1L/4 ; TEST FOR WITHIN TABLE RANGE 270 <1> ;jnb short M4 ; BRANCH TO EXIT IF NOT A VALID COMMAND 271 <1> 272 <1> ; 26/11/2020 273 00001773 80FC14 <1> cmp ah, M1L/4 274 00001776 7205 <1> jb short VGA_func 275 <1> 276 00001778 80FC4F <1> cmp ah, 4Fh 277 0000177B 7546 <1> jne short M4 ; invalid ! 278 <1> 279 <1> VGA_func: ; 26/11/2020 280 0000177D 06 <1> push es ; * 281 0000177E 1E <1> push ds ; ** ; SAVE WORK AND PARAMETER REGISTERS 282 <1> 283 <1> ; 26/11/2020 284 0000177F 50 <1> push eax ; - 285 <1> 286 00001780 66B81000 <1> mov ax, KDATA ; POINT DS: TO DATA SEGMENT 287 00001784 8ED8 <1> mov ds, ax 288 00001786 8EC0 <1> mov es, ax 289 <1> 290 <1> ; 10/02/2026 - !!! BugFix !!! 291 00001788 0F20D8 <1> mov eax, cr3 292 0000178B A3[60770100] <1> mov [cr3prev], eax ; save current cr3 register value/content 293 00001790 A1[B0760100] <1> mov eax, [k_page_dir] 294 00001795 0F22D8 <1> mov cr3, eax 295 <1> 296 <1> ; 26/11/2020 297 00001798 58 <1> pop eax ; + 298 <1> ; 299 00001799 FB <1> sti 300 0000179A 80FC4F <1> cmp ah, 4Fh 301 <1> ;je short VBE_func 302 <1> ; 21/12/2025 303 0000179D 0F84BC000000 <1> je VBE_func 304 <1> 305 <1> ; 04/12/2020 306 000017A3 A3[3C830100] <1> mov [video_eax], eax 307 <1> 308 <1> ; 21/12/2020 309 000017A8 803D[2E680000]FF <1> cmp byte [CRT_MODE], 0FFh ; Current mode is a VESA VBE mode ? 310 000017AF 7213 <1> jb short VGA_func_std 311 <1> 312 000017B1 08E4 <1> or ah, ah ; set mode ? 313 000017B3 750F <1> jnz short VGA_func_std ; no 314 <1> 315 000017B5 803D[7C090000]03 <1> cmp byte [vbe3], 3 ; (real) VESA VBE 3 video bios ? 316 000017BC 7506 <1> jne short VGA_func_std ; no 317 <1> 318 000017BE E9CF010000 <1> jmp vesa_vbe3_pmi 319 <1> 320 <1> ; 21/12/2020 321 <1> M4: ; COMMAND NOT VALID 322 000017C3 CF <1> iretd ; DO NOTHING IF NOT IN VALID RANGE 323 <1> 324 <1> VGA_func_std: 325 <1> ; 06/12/2020 326 <1> ; 03/12/2020 327 000017C4 80FC0F <1> cmp ah, 0Fh 328 <1> ;ja short VGA_funcs_0 ; only CGA funcs will be handled by 329 <1> ; 21/12/2025 330 000017C7 777F <1> ja VGA_funcs_0 331 <1> 332 <1> ; 06/12/2020 ; vga bios firmware 333 <1> ; 03/12/2020 334 <1> ;test ah, 7Fh ; set mode ? 335 <1> ;;or ah, ah ; only 'set mode' will be handled by 336 <1> ;jnz short VGA_funcs_0 ; vga bios firmware 337 <1> ;jz short vbe_pmi32_0 338 <1> 339 <1> ; 28/11/2020 340 000017C9 803D[249D0100]00 <1> cmp byte [pmi32], 0 ; 32 bit protected mode interface for 341 000017D0 7676 <1> jna short VGA_funcs_0 ; video hardware's vga bios firmware 342 <1> ; ([pmi32] > 0 if it is activated) 343 <1> ; note: 344 <1> ; [vbe3] = 3 is required to activate 345 <1> ; 07/12/2020 346 000017D2 20E4 <1> and ah, ah ; is this set mode ? 347 000017D4 7413 <1> jz short vbe_pmi32_2 ; yes 348 <1> 349 000017D6 80FC04 <1> cmp ah, 04h ; set mode ('no clear memory' option) 350 000017D9 746D <1> je short VGA_funcs_0 351 <1> 352 <1> ; 07/12/2020 353 000017DB 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; current mode > 7 ? 354 000017E2 7664 <1> jna short VGA_funcs_0 ; no 355 <1> 356 <1> ; when mode 3 is active, 357 <1> ; video bios functions are not redirected 358 <1> ; to VESA VBE3 PMI except 'set mode' function 359 <1> 360 <1> vbe_pmi32_0: 361 <1> ; 06/12/2020 362 <1> ;or ah, ah 363 <1> ;jnz short vbe_pmi32_2 364 <1> ; ah = 0 ; 'set mode' 365 <1> ;cmp al, 3 ; 80x25 text mode, 16 colors, default mode for MainProg 366 <1> ;jne short vbe_pmi32_1 367 <1> ;cmp byte [CRT_MODE], 3 ; If current video mode <> 3 and requested 368 <1> ; ; video mode is 3, use internal 'set mode'; 369 <1> ; ; otherwise, use vesa vbe 3 bios's 'set mode'. 370 <1> ;jne short VGA_funcs_0 371 <1> vbe_pmi32_1: 372 000017E4 E9A9010000 <1> jmp vesa_vbe3_pmi 373 <1> 374 <1> ;vbe_pmi32_2: 375 <1> ;cmp ah, 04h ; set mode (no clear mem option) 376 <1> ;jne short vbe_pmi32_1 377 <1> 378 <1> vbe_pmi32_2: 379 <1> 380 <1> ; 22/12/2025 381 <1> ; 21/12/2025 - TRDOS 386 v2.0.10 382 <1> ; set character height (needed) for next system calls 383 <1> ;;;; 384 <1> vbe_pmi32_3: 385 000017E9 56 <1> push esi 386 000017EA 50 <1> push eax 387 000017EB 88C4 <1> mov ah, al 388 000017ED 80E47F <1> and ah, 7Fh 389 000017F0 BE[4A680000] <1> mov esi, vga_modes 390 <1> vbe_pmi32_3_1: 391 000017F5 AC <1> lodsb 392 000017F6 38C4 <1> cmp ah, al 393 000017F8 7408 <1> je short vbe_pmi32_3_2 394 000017FA 81FE[5A680000] <1> cmp esi, vga_modes+vga_mode_count 395 00001800 72F3 <1> jb short vbe_pmi32_3_1 396 <1> vbe_pmi32_3_2: 397 00001802 81EE[4A680000] <1> sub esi, vga_modes 398 00001808 C1E602 <1> shl esi, 2 ; dword 399 0000180B 81C6[5A680000] <1> add esi, vga_mode_tbl_ptr 400 00001811 8B36 <1> mov esi, [esi] 401 00001813 66AD <1> lodsw 402 00001815 A2[30680000] <1> mov [CRT_COLS], al 403 0000181A FEC4 <1> inc ah 404 0000181C 8825[36680000] <1> mov [VGA_ROWS], ah 405 00001822 8A06 <1> mov al, [esi] 406 <1> ;lodsb 407 00001824 A2[32680000] <1> mov [CHAR_HEIGHT], al 408 <1> vbe_pmi32_4: 409 00001829 58 <1> pop eax 410 0000182A 5E <1> pop esi 411 <1> ;;;; 412 <1> 413 <1> ; 07/12/2020 414 0000182B 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; current mode > 7 ? 415 00001832 77B0 <1> ja short vbe_pmi32_1 ; yes 416 <1> 417 00001834 3C07 <1> cmp al, 7 ; requested mode > 7 ? 418 00001836 7610 <1> jna short VGA_funcs_0 ; no (CGA) 419 <1> 420 00001838 3C13 <1> cmp al, 13h 421 0000183A 76A8 <1> jna short vbe_pmi32_1 422 <1> 423 0000183C A880 <1> test al, 80h 424 0000183E 7408 <1> jz short VGA_funcs_0 ; unknown or special 425 <1> 426 00001840 3C87 <1> cmp al, 87h ; requested mode > 7 ? 427 <1> ; (with no clear mem ops) 428 00001842 7604 <1> jna short VGA_funcs_0 ; no (CGA) 429 <1> 430 00001844 3C93 <1> cmp al, 93h 431 00001846 769C <1> jna short vbe_pmi32_1 432 <1> 433 <1> ; > 13h video modes are unknown or special 434 <1> ; they must be handled by kernel 435 <1> 436 <1> ; CGA video modes will be handled by kernel 437 <1> 438 <1> VGA_funcs_0: 439 00001848 52 <1> push edx ; *** 440 00001849 51 <1> push ecx ; **** 441 0000184A 53 <1> push ebx ; ***** 442 0000184B 56 <1> push esi ; ****** 443 0000184C 57 <1> push edi ; ******* 444 0000184D 55 <1> push ebp ; ******** 445 <1> 446 <1> ;mov [video_eax], eax ; 12/05/2016 447 0000184E BF00800B00 <1> mov edi, 0B8000h ; GET offset FOR COLOR CARD 448 <1> 449 <1> ; 23/03/2016 450 00001853 C0E402 <1> shl ah, 2 ; dword ; TIMES 2 FOR WORD TABLE LOOKUP 451 00001856 0FB6F4 <1> movzx esi, ah ; MOVE OFFSET INTO LOOK UP REGISTER (SI) 452 <1> ;mov ah, [CRT_MODE] ; MOVE CURRENT MODE INTO (AH) REGISTER 453 <1> 454 <1> ;;15/01/2017 455 <1> ; 14/01/2017 456 <1> ; 02/01/2017 457 <1> ;;mov byte [intflg], 31h ; video interrupt 458 <1> ;sti ; 26/11/2020 459 <1> ; 460 <1> 461 00001859 FFA6[22170000] <1> jmp dword [esi+M1] ; GO TO SELECTED FUNCTION 462 <1> 463 <1> VBE_func: 464 <1> ; 26/11/2020 465 <1> ;sti 466 0000185F 55 <1> push ebp ; *** ; 27/11/2020 467 00001860 56 <1> push esi ; **** 468 <1> 469 <1> ; Note: 470 <1> ; ebx, ecx, edx, edi, ebp registers 471 <1> ; must be saved by VBE functions and 472 <1> ; eax register must be set 473 <1> ; (according to VBE 3 standard) 474 <1> ; before return from this interrupt 475 <1> ; (every function must restore and set 476 <1> ; registers except esp, esi, es, ds) 477 <1> 478 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 479 <1> ; cr3 = [k_page_dir] ; kernel's cr3 480 <1> ; [cr3prev] = previous (user's) cr3 481 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 482 <1> ;mov esi, cr3 483 <1> ;push esi ; ***** 484 <1> ;;cmp esi, [k_page_dir] 485 <1> ;;je short VBE_func_x 486 <1> ;mov esi, [k_page_dir] 487 <1> ;mov cr3, esi 488 <1> ;VBE_func_x: 489 00001861 803D[7C090000]02 <1> cmp byte [vbe3], 2 490 00001868 7749 <1> ja short VESA_VBE3_PMI_CALL ; VBE3 video bios ('PMID') 491 <1> ;je short VBE_func_0 ; Bochs/Qemu/VirtualBox emulator 492 0000186A 7271 <1> jb short VBE_unknown ; invalid ([vbe3] = 0) 493 <1> 494 <1> ;jmp VESA_VBE3_PMI_CALL 495 <1> 496 <1> VBE_func_0: 497 <1> ; Bochs/Plex86 VGAbios VBE extension 498 <1> ; (TRDOS 386 v2.0.3 can use VBE graphics modes on emulators) 499 <1> ; BOCHS/QEMU/VIRTUALBOX 500 <1> 501 0000186C 8A25[7D090000] <1> mov ah, [vbe2bios] 502 00001872 80FCC0 <1> cmp ah, 0C0h 503 00001875 7266 <1> jb short VBE_unknown 504 00001877 80FCC5 <1> cmp ah, 0C5h 505 0000187A 7761 <1> ja short VBE_unknown 506 <1> 507 <1> ; TRDOS 386 is running on BOCHS or QEMU 508 0000187C B44F <1> mov ah, 4Fh 509 <1> VBE_func_1: 510 0000187E 0FB6F0 <1> movzx esi, al ; VESA VBE function number 511 <1> ;shl si, 2 ; dword 512 <1> ; 02/08/2022 513 00001881 C1E602 <1> shl esi, 2 514 00001884 6683FE14 <1> cmp si, N1L 515 00001888 7353 <1> jnb short VBE_unknown 516 <1> ;sti 517 <1> 518 0000188A FF96[9F180000] <1> call dword [esi+N1] ; call VBE function 519 <1> 520 <1> ;jmp short VBE_bios_return 521 <1> 522 <1> VBE_bios_return: 523 00001890 FA <1> cli 524 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 525 00001891 8B35[60770100] <1> mov esi, [cr3prev] ; restore pðrevious (user's) cr3 526 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 527 <1> ;pop esi ; ***** 528 <1> ;;cmp esi, [k_page_dir] 529 <1> ;;je short VBE_bios_return_x 530 00001897 0F22DE <1> mov cr3, esi 531 <1> ;VBE_bios_return_x: 532 0000189A 5E <1> pop esi ; **** 533 0000189B 5D <1> pop ebp ; *** ; 27/11/2020 534 0000189C 07 <1> pop es ; ** 535 0000189D 1F <1> pop ds ; * 536 0000189E CF <1> iretd 537 <1> 538 <1> ; 26/11/2020 539 <1> N1: 540 0000189F [00190000] <1> dd vbe_biosfn_return_ctrl_info 541 000018A3 [2D390000] <1> dd vbe_biosfn_return_mode_info 542 000018A7 [E7390000] <1> dd vbe_biosfn_set_mode 543 000018AB [B73A0000] <1> dd vbe_biosfn_return_current_mode 544 000018AF [D63A0000] <1> dd vbe_biosfn_save_restore_state 545 <1> ;dd vbe_biosfn_display_window_ctrl 546 <1> ;dd vbe_biosfn_set_get_log_scanline 547 <1> ;dd vbe_biosfn_set_get_disp_start 548 <1> ;dd vbe_biosfn_set_get_dac_pal_frm 549 <1> ;dd vbe_biosfn_set_get_palette_data 550 <1> 551 <1> N1L EQU $ - N1 552 <1> 553 <1> VESA_VBE3_PMI_CALL: ; VESA VBE video bios (firmware) functions 554 <1> ; by using VESA VBE3 Protected Mode Interface 555 <1> 556 <1> ; 02/08/2022 - TRDOS 386 v2.0.5 557 <1> ; 29/11/2020 558 <1> ; 26/11/2020 - TRDOS 386 v2.0.3 video.s 559 <1> 560 <1> ; We are here because.. 561 <1> ; 'PMID' has been verified by TRDOS 386 v2.0.3 kernel. 562 <1> ; (Otherwise bochs/plex86 compatible VBE functions and 563 <1> ; modes would be used on BOCHS/QEMU/VIRTUALBOX emulators 564 <1> ; or only standard/old VGA graphics modes would be used.) 565 <1> 566 <1> ; (TRDOS 386 v2.0.3 can use VESA VBE graphics modes if 567 <1> ; the video bios is full compatible with VBE3 standard) 568 <1> 569 <1> ; 29/11/2020 570 <1> 571 000018B3 0FB6F0 <1> movzx esi, al ; VESA VBE 3 function number 572 <1> ;shl si, 2 ; dword 573 <1> ; 02/08/2022 574 000018B6 C1E602 <1> shl esi, 2 575 000018B9 6683FE14 <1> cmp si, P1L 576 000018BD 731E <1> jnb short VBE_unknown 577 <1> ;sti 578 <1> 579 000018BF 57 <1> push edi ; ***** 580 <1> 581 000018C0 FF96[C9180000] <1> call dword [esi+P1] ; call VBE 3 function 582 <1> 583 000018C6 5F <1> pop edi ; ***** 584 <1> 585 000018C7 EBC7 <1> jmp short VBE_bios_return 586 <1> 587 <1> P1: 588 000018C9 [E3180000] <1> dd vbe3_pmfn_return_ctrl_info 589 000018CD [06190000] <1> dd vbe3_pmfn_return_mode_info 590 000018D1 [42190000] <1> dd vbe3_pmfn_set_mode 591 000018D5 [3D190000] <1> dd vbe3_pmfn_return_current_mode 592 000018D9 [401A0000] <1> dd vbe3_pmfn_save_restore_state 593 <1> ;dd vbe3_pmfn_display_window_ctrl 594 <1> ;dd vbe3_pmfn_set_get_log_scanline 595 <1> ;dd vbe3_pmfn_set_get_disp_start 596 <1> ;dd vbe3_pmfn_set_get_dac_pal_frm 597 <1> ;dd vbe3_pmfn_set_get_palette_data 598 <1> ;dd vbe3_pmfn_return_pmi ; invalid for TRDOS 386 v2 599 <1> ;dd vbe3_pmfn_set_get_pixel_clock 600 <1> 601 <1> P1L EQU $ - P1 602 <1> 603 <1> ; ; 29/11/2020 604 <1> ; mov edi, VBE3MODEINFOBLOCK >> 4 ; / 16 605 <1> ; 606 <1> ; cmp al, 04h 607 <1> ; jb short vbe3_pm_f ; function: 4F00h to 4F03h 608 <1> ; ja short vbe3_pmi_f5B ; function: 4F05h to 4F0Bh 609 <1> ; 610 <1> ; ; check buffer length (must be <= 2048 bytes) 611 <1> ; 612 <1> ; and dl, dl ; 0 613 <1> ; jz short vbe3_pm_f 614 <1> ; ; Return Save/Restore State buffer size 615 <1> ; 616 <1> ; push ebx ; buffer address 617 <1> ; push edx ; function: save (01h) or restore (02h) 618 <1> ; call 619 <1> ; 620 <1> ;vbe3_pm_f03: 621 <1> ; cmp al, 2 622 <1> ; ja short vbe3_pm_f ; function 4F03h 623 <1> ; jb short vbe3_pm_f1 624 <1> ; 625 <1> ; 626 <1> ;vbe3_pm_f1: 627 <1> ; 628 <1> ; 629 <1> ;vbe3_pmi_f5B: 630 <1> ; cmp al, 09h 631 <1> ; jna short vbe3_pm_f ; funcs 05h to 09h are usable 632 <1> ; 633 <1> ; cmp al, 0Bh ; Get/Set pixel clock, last function 634 <1> ; jne short VBE_unknown 635 <1> ; ; (do not use 'uncertain' functions 636 <1> ; ; because of system-user buff transfers) 637 <1> ;vbe3_pm_f: 638 <1> ; mov byte [vbe3_pm_fn], al ; set 639 <1> ; ; prepare 16 bit pm segments & registers for pmi call 640 <1> ; call VESA_VBE3_PM_FUNCTION 641 <1> ; 642 <1> ; 643 <1> 644 <1> ; 26/11/2020 645 <1> VBE_unknown: 646 000018DD 66B80001 <1> mov ax, 0100h ; ah = 1 : Function call failed 647 <1> ; al = 0 : Function is not supported 648 <1> 649 000018E1 EBAD <1> jmp short VBE_bios_return 650 <1> 651 <1> vbe3_pmfn_return_ctrl_info: 652 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 653 <1> ; 12/12/2020 654 <1> ; 655 <1> ; VBE function 4F00h - Return VBE Controller Information 656 <1> ; 657 <1> ; Input: 658 <1> ; EDI = Pointer to buffer in which to place 659 <1> ; VbeInfoBlock structure 660 <1> ; 661 <1> ; AX = 4F00h 662 <1> ; Output: 663 <1> ; AX = VBE return status 664 <1> ; AX = 004Fh -> succeeded 665 <1> ; AX <> 004Fh -> failed 666 <1> ; 667 <1> ; Modified registers: eax (+ edi for kernel's own call) 668 <1> 669 <1> ; NOTE: TRDOS 386 v2 (v2.0.3) kernel calls this function 670 <1> ; during startup while cpu is in real mode 671 <1> ; (by using int 10h, 4F02h) and saves VbeInfoBlock at 672 <1> ; VBE3INFOBLOCK address (97E00h for TRDOS 386 v2.0.3). 673 <1> ; 674 <1> ; So... 675 <1> ; This VBE function is adjusted to return/move same info 676 <1> ; from VBE3INFOBLOCK to user's buffer in EDI. 677 <1> 678 <1> ; int 31h (int 10h) entrance 679 <1> 680 000018E3 21FF <1> and edi, edi 681 000018E5 7423 <1> jz short vbe3_func_fail ; invalid buffer address ! 682 <1> 683 <1> ;_vbe3_pmfn_return_ctrl_info: 684 <1> ;or edi, edi 685 <1> ;jnz short _vbe_biosfn_return_ctrl_info 686 <1> ; 687 <1> ;; this option may not be necessary - 12/12/2020 688 <1> ; 689 <1> ;; edi = 0, kernel forces to get ctrl info again 690 <1> ;; by using VESA VBE3 video bios's pmi 691 <1> ; 692 <1> ;;push edi 693 <1> ;; far call to VESA VBE3 PMI 694 <1> ;;mov ax, 4F00h ; Return VBE Controller Info 695 <1> ;mov edi, VBE3INFOBLOCK-VBE3SAVERESTOREBLOCK 696 <1> ;; ES selector base address = VBE3SAVERESTOREBLOCK 697 <1> ;call int10h_32bit_pmi 698 <1> ;;pop edi 699 <1> ;mov edi, VBE3INFOBLOCK ; retn to the kernel sub 700 <1> ;cmp ax, 004Fh 701 <1> ;je short vbe_ctrl_info_retn 702 <1> ;stc 703 <1> ;retn 704 <1> 705 <1> _vbe_biosfn_return_ctrl_info: 706 000018E7 57 <1> push edi 707 000018E8 51 <1> push ecx 708 000018E9 BE007E0900 <1> mov esi, VBE3INFOBLOCK 709 <1> ;mov ecx, 512 710 <1> ; 02/08/2022 711 000018EE 29C9 <1> sub ecx, ecx 712 000018F0 B502 <1> mov ch, 2 713 <1> ; ecx = 512 714 000018F2 E824F20000 <1> call transfer_to_user_buffer 715 000018F7 59 <1> pop ecx 716 000018F8 5F <1> pop edi 717 000018F9 720F <1> jc short vbe3_func_fail 718 <1> 719 000018FB 31C0 <1> xor eax, eax 720 000018FD B04F <1> mov al, 4Fh ; successful 721 <1> ;vbe_ctrl_info_retn: 722 000018FF C3 <1> retn 723 <1> 724 <1> vbe_biosfn_return_ctrl_info: 725 <1> ; 12/12/2020 726 <1> ; 727 <1> ; VBE function 4F00h - Return VBE Controller Information 728 <1> ; 729 <1> ; Input: 730 <1> ; EDI = Pointer to buffer in which to place 731 <1> ; VbeInfoBlock structure 732 <1> ; 733 <1> ; AX = 4F00h 734 <1> ; Output: 735 <1> ; AX = VBE return status 736 <1> ; AX = 004Fh -> succeeded 737 <1> ; AX <> 004Fh -> failed 738 <1> ; 739 <1> ; Modified registers: eax 740 <1> 741 00001900 21FF <1> and edi, edi 742 00001902 7406 <1> jz short vbe3_func_fail ; invalid buffer addr ! 743 00001904 EBE1 <1> jmp short _vbe_biosfn_return_ctrl_info 744 <1> 745 <1> vbe3_pmfn_return_mode_info: 746 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 747 <1> ; 21/12/2020 748 <1> ; 12/12/2020 749 <1> ; 750 <1> ; VBE function 4F01h - Return VBE Mode Information 751 <1> ; 752 <1> ; Input: 753 <1> ; CX = Mode number (VESA VBE mode number) 754 <1> ; EDI = Pointer to ModeInfoBlock structure 755 <1> ; (256 bytes) -User's buffer address- 756 <1> ; EDI = 0 -> kernel call 757 <1> ; (do not transfer ModeInfoBlock 758 <1> ; to user's buffer address) 759 <1> ; AX = 4F01h 760 <1> ; Output: 761 <1> ; AX = VBE return status 762 <1> ; AX = 004Fh -> succeeded 763 <1> ; AX <> 004Fh -> failed 764 <1> ; 765 <1> ; Modified registers: eax, esi, edi 766 <1> 767 <1> ; int 31h (int 10h) entrance 768 <1> 769 00001906 09FF <1> or edi, edi 770 00001908 7506 <1> jnz short _vbe3_pmfn_return_mode_info 771 <1> 772 <1> vbe3_func_fail: 773 0000190A B84F010000 <1> mov eax, 014Fh ; ah = 1 : Function call failed 774 <1> ; al = 4Fh : Function is supported 775 0000190F C3 <1> retn 776 <1> 777 <1> ; jump from '_vbe_biosfn_return_mode_info' 778 <1> _vbe3_pmfn_return_mode_info: 779 00001910 57 <1> push edi 780 <1> 781 <1> ;; clear vbe3 'mode info block' buffer 782 <1> ;push ecx 783 <1> ;xor eax, eax 784 <1> ;mov ecx, 256/4 785 <1> ;mov edi, VBE3MODEINFOBLOCK 786 <1> ;rep stosd 787 <1> ;pop ecx 788 <1> 789 <1> ; far call to VESA VBE3 PMI 790 <1> ;mov ax, 4F01h ; Return VBE Mode Information 791 00001911 BF00060000 <1> mov edi, VBE3MODEINFOBLOCK-VBE3SAVERESTOREBLOCK 792 <1> ; ES selector base address = VBE3SAVERESTOREBLOCK 793 00001916 E807010000 <1> call int10h_32bit_pmi 794 <1> 795 0000191B 5F <1> pop edi 796 <1> 797 <1> ;cmp ax, 004Fh 798 <1> ;jne short vbe3_func_retn ; failed ! 799 <1> 800 0000191C 21FF <1> and edi, edi 801 <1> ;jz short vbe3_func_success 802 <1> ; 21/12/2020 803 0000191E 741C <1> jz short vbe3_func_retn 804 <1> 805 00001920 6683F84F <1> cmp ax, 004Fh 806 00001924 7516 <1> jne short vbe3_func_retn ; failed ! 807 <1> 808 00001926 51 <1> push ecx 809 00001927 BE007C0900 <1> mov esi, VBE3MODEINFOBLOCK 810 <1> ;mov ecx, 256 811 <1> ; 02/08/2022 812 0000192C 29C9 <1> sub ecx, ecx 813 0000192E FEC5 <1> inc ch 814 <1> ; ecx = 256 815 00001930 E8E6F10000 <1> call transfer_to_user_buffer 816 00001935 59 <1> pop ecx 817 00001936 72D2 <1> jc short vbe3_func_fail 818 <1> 819 00001938 31C0 <1> xor eax, eax 820 0000193A B04F <1> mov al, 4Fh ; successful 821 <1> vbe3_func_success: 822 <1> vbe3_func_retn: 823 0000193C C3 <1> retn 824 <1> 825 <1> vbe3_pmfn_return_current_mode: 826 <1> ; 12/12/2020 827 <1> ; 828 <1> ; VBE function 4F03h - Return Current VBE Mode 829 <1> ; 830 <1> ; Input: 831 <1> ; none (AX = 4F03h) 832 <1> ; Output: 833 <1> ; AX = VBE return status 834 <1> ; AX = 004Fh -> succeeded 835 <1> ; AX <> 004Fh -> failed 836 <1> ; BX = Current VBE mode 837 <1> ; bit 0-13 = Mode number 838 <1> ; bit 14 = 0 Windowed frame buffer model 839 <1> ; = 1 Linear frame buffer model 840 <1> ; bit 15 841 <1> ; = 0 Memory cleared at last mode set 842 <1> ; = 1 Memory not cleared at last mode set 843 <1> ; 844 <1> ; Modified registers: eax, ebx 845 <1> 846 <1> ; int 31h (int 10h) entrance 847 <1> 848 <1> ; far call to VESA VBE3 PMI 849 <1> 850 <1> ;mov eax, 4F03h ; Return Current VBE Mode 851 <1> vbe3_pmfn_far_call: 852 <1> ; ES selector base address = VBE3SAVERESTOREBLOCK 853 <1> ;call int10h_32bit_pmi 854 <1> ;retn 855 0000193D E9E0000000 <1> jmp int10h_32bit_pmi 856 <1> 857 <1> vbe3_pmfn_set_mode: 858 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 859 <1> ; 22/12/2020 860 <1> ; 21/12/2020 861 <1> ; 12/12/2020 862 <1> ; 863 <1> ; VBE function 4F02h - Set VBE Mode 864 <1> ; 865 <1> ; Input: 866 <1> ; BX = Desired Mode to set 867 <1> ; bit 0-13 = Mode number 868 <1> ; bit 14 = 0 Windowed frame buffer model 869 <1> ; = 1 Linear frame buffer model 870 <1> ; bit 15 871 <1> ; = 0 Memory cleared at last mode set 872 <1> ; = 1 Memory not cleared at last mode set 873 <1> ; Output: 874 <1> ; AX = VBE return status 875 <1> ; AX = 004Fh -> succeeded 876 <1> ; AX <> 004Fh -> failed 877 <1> ; 878 <1> ; Modified registers: eax, ebx, esi (21/12/2020) 879 <1> 880 <1> ; int 31h (int 10h) entrance 881 <1> 882 <1> ; 22/12/2020 (VESA VBE3 feature) 883 <1> ; BX bit 11 is flag for 884 <1> ; user specified CRTC values for refresh rate 885 <1> ; 'test bh, 8' 886 <1> ; if bit 11 is set, EDI points to 'CRTCInfoBlock' 887 <1> 888 <1> ; 22/12/2020 889 <1> ;; test bx for VBE video mode 890 <1> ;test bh, 1 891 <1> ;jnz short vbe3_sm_0 892 <1> 893 <1> ;; use internal VBE mode set procedure 894 <1> ;; for non-vbe (std VGA/CGA) modes 895 <1> ; 896 <1> ;; (it is useful -as 4F02h function- 897 <1> ;; to jump 'vbe_biosfn_set_mode' 898 <1> ;; instead of direct jump to '_set_mode') 899 <1> ;; ((eliminates additional push-pops and settings)) 900 <1> 901 <1> ;jmp vbe_biosfn_set_mode 902 <1> 903 <1> vbe3_sm_0: 904 <1> ;;push ds ; * 905 <1> ;;push es ; ** 906 <1> ;;push ebp ; *** 907 <1> ;;push esi ; **** 908 <1> 909 <1> ; Fit bx to VESA VBE2 type mode setting 910 <1> ; (bx bit 11 is used for custom CRTC values in VBE3) 911 <1> ; clear bit 9 to 11 (clear bh bit 1 to bit 3) 912 <1> 913 <1> ; 22/12/2020 914 00001942 57 <1> push edi ; ***** 915 00001943 F6C708 <1> test bh, 8 ; Use user specified CRTC values 916 00001946 7530 <1> jnz short vbe3_sm_3 ; for refresh rate 917 <1> vbe3_sm_4: 918 00001948 80E7C1 <1> and bh, 0C1h ; use bit 15, 14, 8 only (for bh) 919 <1> ;mov [vbe_mode_x], bh 920 <1> 921 0000194B 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; is current mode 03h ? 922 00001952 7509 <1> jne short vbe3_sm_1 ; no 923 <1> 924 <1> ; save mode 03h video pages and cursor positions 925 00001954 57 <1> push edi ; **!*** 926 00001955 51 <1> push ecx ; ****** 927 <1> ;push esi 928 <1> 929 00001956 E8CC040000 <1> call save_mode3_multiscreen 930 <1> 931 <1> ;pop esi 932 0000195B 59 <1> pop ecx ; ****** 933 0000195C 5F <1> pop edi ; **!*** 934 <1> vbe3_sm_1: 935 <1> ; ax = 4F02h 936 <1> ; bx = video mode number (vbe2 type) 937 0000195D E8C0000000 <1> call int10h_32bit_pmi 938 <1> ; call to far call to VBE3 PMI 939 <1> 940 00001962 6683F84F <1> cmp ax, 004Fh ; succeeded ? 941 00001966 750E <1> jne short vbe3_sm_2 942 <1> ; set current mode byte/sign to extended (SVGA) mode 943 00001968 C605[2E680000]FF <1> mov byte [CRT_MODE], 0FFh ; VESA VBE mode 944 <1> ; set current VBE mode word to bx input 945 0000196F 66891D[269D0100] <1> mov [video_mode], bx 946 <1> vbe3_sm_2: 947 <1> ; 22/12/2020 948 00001976 5F <1> pop edi ; ***** 949 00001977 C3 <1> retn 950 <1> 951 <1> vbe3_sm_3: 952 <1> ; 22/12/2020 953 <1> ; copy user's CRTCInfoBlock to the buffer 954 00001978 51 <1> push ecx 955 00001979 89FE <1> mov esi, edi 956 0000197B BF807D0900 <1> mov edi, VBE3CRTCINFOBLOCK 957 <1> ;mov ecx, 64 958 <1> ; 02/08/2022 959 00001980 29C9 <1> sub ecx, ecx 960 00001982 B140 <1> mov cl, 64 961 00001984 E8DCF10000 <1> call transfer_from_user_buffer 962 00001989 59 <1> pop ecx 963 <1> ; set offset (es base addr is VBE3SAVERESTOREBLOCK) 964 0000198A 81EF00760900 <1> sub edi, VBE3SAVERESTOREBLOCK 965 00001990 EBB6 <1> jmp short vbe3_sm_4 966 <1> 967 <1> vesa_vbe3_pmi: 968 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 969 <1> ; 12/12/2020 970 <1> ; 08/12/2020 971 <1> ; 07/12/2020 972 <1> ; 05/12/2020, 06/12/2020 973 <1> ; 03/12/2020, 04/12/2020 974 <1> ; 28/11/2020 (TRDOS 386 v2.0.3) 975 <1> ; VGA BIOS functions via 976 <1> ; VESA VBE3 Protected Mode Inface 977 <1> ; [vbe3] = 3 and [pmi32] > 0 978 <1> 979 <1> ; 04/12/2020 980 <1> ; Only 'set mode' will be redirected to vbe3 video bios 981 <1> ; (by setting mode 3 multiscreen parameters before and after) 982 <1> 983 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 984 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 985 <1> ;push eax 986 <1> ;mov eax, cr3 987 <1> ;xchg eax, [esp] ; **!** 988 <1> ;push eax 989 <1> ;;cmp esi, [k_page_dir] 990 <1> ;;je short vesa_vbe3_pmi_x 991 <1> ;mov eax, [k_page_dir] 992 <1> ;mov cr3, eax 993 <1> ;;vesa_vbe3_pmi_x: 994 <1> ;pop eax 995 <1> 996 <1> ; 06/12/2020 997 00001992 20E4 <1> and ah, ah ; 0 = set mode function 998 00001994 7405 <1> jz short vbe3_pmi_0 999 00001996 E980000000 <1> jmp vbe3_pmi_9 1000 <1> 1001 <1> vbe3_pmi_0: 1002 <1> ; 07/12/2020 1003 0000199B 88C4 <1> mov ah, al 1004 0000199D 80E480 <1> and ah, 80h ; 0 or 80h 1005 000019A0 30E0 <1> xor al, ah ; 8?h -> 0?h 1006 <1> 1007 <1> ;cmp al, 13h ; mode number above 13h is returned 1008 <1> ;jna short vbe3_pmi_1 1009 <1> ; ; back to default code due to uncertainty 1010 <1> ; ; (>13h is not std for all svga bioses) 1011 <1> ;jmp VGA_funcs_0 1012 <1> vbe3_pmi_1: 1013 <1> ; 07/12/2020 1014 <1> ; Possible cases for VBE3 (PMI, ah=0) set mode: 1015 <1> ; current mode > 07h and requested mode: any 1016 <1> ; current mode <= 07h and requested mode > 07h 1017 <1> 1018 <1> ; 06/12/2020 1019 000019A2 8825[4B830100] <1> mov byte [noclearmem], ah ; 0 or 80h 1020 <1> ; check current video mode if it is 03h 1021 000019A8 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; current mode 1022 000019AF 750B <1> jne short vbe3_pmi_3 1023 <1> ; 07/12/2020 1024 <1> ; check new video mode if it is 03h also 1025 <1> ;cmp al, 3 1026 <1> ;jne short vbe3_pmi_2 1027 <1> ;mov byte [p_crt_mode], 80h ; clear video memory 1028 <1> ;jmp short vbe3_pmi_5 1029 <1> vbe3_pmi_2: 1030 <1> ; case 1: 1031 <1> ; Current mode is 03h and new mode is not 03h 1032 <1> 1033 <1> ; save video pages and cursor positions 1034 000019B1 56 <1> push esi 1035 000019B2 57 <1> push edi 1036 000019B3 51 <1> push ecx 1037 <1> 1038 <1> ; 12/12/2020 1039 <1> ;mov esi, 0B8000h ; mode 3 video memory 1040 <1> ;mov edi, 98000h ; backup location 1041 <1> ;mov ecx, (0B8000h-0B0000h)/4 1042 <1> ;rep movsd 1043 <1> ; 1044 <1> ;mov byte [p_crt_mode], 3 ; previous mode, backup sign 1045 <1> ;xchg cl, [ACTIVE_PAGE] 1046 <1> ;mov [p_crt_page], cl ; save as previous active page 1047 <1> ; 1048 <1> ;; save cursor positions 1049 <1> ;mov esi, CURSOR_POSN 1050 <1> ;mov edi, cursor_pposn ; cursor positions backup 1051 <1> ;mov cl, 4 1052 <1> ;rep movsd 1053 <1> 1054 <1> ; 12/12/2020 1055 000019B4 E86E040000 <1> call save_mode3_multiscreen 1056 <1> 1057 000019B9 59 <1> pop ecx 1058 000019BA 5F <1> pop edi 1059 000019BB 5E <1> pop esi 1060 <1> vbe3_pmi_3: 1061 <1> ; 08/12/2020 1062 <1> ; 07/12/2020 1063 <1> ; case 3 or case 4 1064 000019BC A2[2E680000] <1> mov [CRT_MODE], al 1065 000019C1 3C03 <1> cmp al, 3 1066 000019C3 7407 <1> je short vbe3_pmi_4 1067 <1> ; case 4: 1068 <1> ; Current mode is not 03h and also new mode is not 03h 1069 000019C5 800D[49830100]80 <1> or byte [p_crt_mode], 80h ; 83h (case 1 -> case 4) 1070 <1> ;jmp short vbe3_pmi_5 1071 <1> vbe3_pmi_4: 1072 <1> ; case 3: 1073 <1> ; 1074 <1> ; Current mode is not 03h and new mode is 03h 1075 <1> 1076 <1> ;vbe3_pmi_5: 1077 <1> ;mov [CRT_MODE], al 1078 <1> 1079 000019CC E851000000 <1> call int10h_32bit_pmi 1080 <1> 1081 000019D1 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; new video mode 1082 <1> ;jne vbe3_pmi_8 ; video mode <> 03h 1083 000019D8 7532 <1> jne short vbe3_pmi_8 1084 <1> 1085 <1> ;push eax ; 04/12/2020 1086 000019DA 53 <1> push ebx 1087 000019DB 51 <1> push ecx 1088 000019DC 52 <1> push edx 1089 000019DD 57 <1> push edi ; 03/12/2020 1090 <1> 1091 <1> ; 12/12/2020 1092 000019DE 56 <1> push esi 1093 000019DF E875040000 <1> call restore_mode3_multiscreen 1094 000019E4 5E <1> pop esi 1095 <1> ; AL = active video page 1096 <1> 1097 <1> ; 12/12/2020 1098 <1> ;mov al, [p_crt_page] ; previous mode 3 active page 1099 <1> ; 1100 <1> ;;test byte [p_crt_mode], 7Fh ; 83h or 80h or 03h 1101 <1> ;;jz short vbe3_pmi_6 ; do not restore video pages 1102 <1> ; ; clear current video page 1103 <1> ;; case 3 1104 <1> ; 1105 <1> ;; ([p_crt_mode] = 03h) 1106 <1> ; 1107 <1> ;; New video mode is 3 while current video mode is not 3 1108 <1> ;; (multi screen) video pages will be restored from 098000h 1109 <1> ; 1110 <1> ;; restore video pages and cursor positions 1111 <1> ; 1112 <1> ;mov [ACTIVE_PAGE], al ; current mode 3 active page 1113 <1> ; 1114 <1> ;push esi 1115 <1> ; 1116 <1> ;; restore video pages 1117 <1> ;mov esi, 98000h 1118 <1> ;mov edi, 0B8000h 1119 <1> ;;mov ecx, 2000h 1120 <1> ;mov cx, 2000h ; 8K dwords (32K) 1121 <1> ;rep movsd 1122 <1> ; 1123 <1> ;mov [p_crt_mode], cl ; reset ('case 3' end condition) 1124 <1> ; 1125 <1> ;; restore cursor positions 1126 <1> ;mov esi, cursor_pposn 1127 <1> ;mov edi, CURSOR_POSN 1128 <1> ;;mov ecx, 4 ; restore all cursor positions (16 bytes) 1129 <1> ;mov cl, 4 1130 <1> ;rep movsd 1131 <1> ; 1132 <1> ;pop esi 1133 <1> ; 1134 <1> ;; 07/12/2020 1135 <1> ;; restore CRT_START according to ACTIVE_PAGE 1136 <1> ;mov [CRT_START], cx ; 0 1137 <1> ; 1138 <1> ;; check active page and set it again if it is not 0 1139 <1> ;or al, al 1140 <1> ;jz short vbe3_pmi_7 1141 <1> ; 1142 <1> ;mov cl, al 1143 <1> ;vbe3_pmi_5: 1144 <1> ;add word [CRT_START], 4096 1145 <1> ;dec cl 1146 <1> ;jnz short vbe3_pmi_5 1147 <1> 1148 000019E5 B405 <1> mov ah, 05h ; set current video page 1149 <1> ;al = video page 1150 000019E7 E836000000 <1> call int10h_32bit_pmi 1151 <1> 1152 <1> ; check current cursor position & set it again if not 0,0 1153 <1> ;movzx ebx, byte [ACTIVE_PAGE] 1154 000019EC 0FB6D8 <1> movzx ebx, al 1155 000019EF D0E3 <1> shl bl, 1 1156 000019F1 81C3[CE760100] <1> add ebx, CURSOR_POSN 1157 000019F7 668B13 <1> mov dx, [ebx] 1158 000019FA 6621D2 <1> and dx, dx 1159 000019FD 7409 <1> jz short vbe3_pmi_7 1160 <1> 1161 <1> ;dx = cursor position (dl = column, dh = row) 1162 <1> ;mov bh, [ACTIVE_PAGE] ; 06/12/2020 1163 000019FF 88C7 <1> mov bh, al 1164 00001A01 B402 <1> mov ah, 02h ; set cursor position 1165 00001A03 E81A000000 <1> call int10h_32bit_pmi 1166 <1> 1167 <1> ;jmp short vbe3_pmi_7 1168 <1> 1169 <1> ;vbe3_pmi_6: 1170 <1> ; ; 07/12/2020 1171 <1> ; ; case 1, previous mode is 03h, current mode is 03h 1172 <1> ; ; 03/12/2020 1173 <1> ; cmp byte [noclearmem], 0 1174 <1> ; jna short vbe3_pmi_7 ; do not clear memory 1175 <1> ; ; clear video page 1176 <1> ; mov ecx, 1024 ; 4096/4 1177 <1> ; mov eax, 07200720h 1178 <1> ; mov edi, 0B8000h ; [crt_base] 1179 <1> ; add di, [CRT_START] 1180 <1> ; rep stosd ; FILL THE REGEN BUFFER WITH BLANKS 1181 <1> 1182 <1> vbe3_pmi_7: 1183 00001A08 5F <1> pop edi 1184 00001A09 5A <1> pop edx 1185 00001A0A 59 <1> pop ecx 1186 00001A0B 5B <1> pop ebx 1187 <1> ;pop eax ; 04/12/2020 1188 <1> vbe3_pmi_8: 1189 <1> ; 04/12/2020 1190 <1> ;(TRDOS 386 v2.0.3, INT 31h, ah=0 return) 1191 00001A0C 31C0 <1> xor eax, eax ; eax = 0 -> succesful 1192 <1> vesa_vbe3_pmi_retn: 1193 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 1194 00001A0E 50 <1> push eax 1195 00001A0F A1[60770100] <1> mov eax, [cr3prev] ; restore previous (user's) cr3 1196 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 1197 <1> ;xchg eax, [esp] ; **!** 1198 <1> ;;cmp eax, [k_page_dir] 1199 <1> ;;je short vesa_vbe3_pmi_retn_x 1200 00001A14 0F22D8 <1> mov cr3, eax 1201 <1> ;;vesa_vbe3_pmi_retn_x: 1202 00001A17 58 <1> pop eax 1203 <1> ; 1204 00001A18 07 <1> pop es ; ** 1205 00001A19 1F <1> pop ds ; * 1206 00001A1A CF <1> iretd 1207 <1> 1208 <1> vbe3_pmi_9: 1209 <1> ; 06/12/2020 1210 <1> ;cmp ah, 10h ; Set/Get Palette Registers 1211 <1> ;jnb short vbe3_pmi_10 1212 <1> ; 05/12/2020 1213 00001A1B E802000000 <1> call int10h_32bit_pmi 1214 00001A20 EBEC <1> jmp short vesa_vbe3_pmi_retn 1215 <1> 1216 <1> ;vbe3_pmi_10: 1217 <1> ; 06/12/2020 1218 <1> ;jmp VGA_funcs_0 1219 <1> 1220 <1> int10h_32bit_pmi: 1221 <1> ; 03/12/2020 1222 <1> ; 28/11/2020 1223 <1> ; calling standard VGA Bios (INT 10h) functions 1224 <1> ; by using 32 bit protected mode interface of 1225 <1> ; VESA VBE3 Video Bios (with 'PMID' signature) 1226 <1> 1227 <1> ; 03/12/2020 1228 <1> ; eax, ebx, ecx, edx, edi will be used by vbios pmi 1229 <1> ; (esi and ebp will not be used) 1230 <1> 1231 <1> ; 03/12/2020 1232 00001A22 56 <1> push esi 1233 00001A23 C1E010 <1> shl eax, 16 ; move function number (ax) to hw 1234 00001A26 8B35[2C9D0100] <1> mov esi, [pmid_addr] ; linear address of 1235 <1> ; PMInfo.Entrypoint pointer 1236 <1> ;mov ax, [esi+PMInfo.EntryPoint] 1237 00001A2C 668B06 <1> mov ax, [esi] 1238 00001A2F C1C010 <1> rol eax, 16 ; move PM entry address to hw 1239 <1> ; and move function number to lw (ax) 1240 00001A32 5E <1> pop esi 1241 <1> 1242 <1> ; top of stack: ; (*) 1243 <1> ; return (the caller) address of "int10h_32bit_pmi" 1244 <1> 1245 00001A33 E921EDFFFF <1> jmp _VBE3PMI_fcall ; will return to the caller (*) 1246 <1> 1247 <1> _vbe3_pmfn_srs_8: 1248 <1> ; 17/01/2021 1249 00001A38 31DB <1> xor ebx, ebx ; points to VBE3SAVERESTOREBLOCK 1250 <1> _vbe3_pmfn_srs_9: ; 24/01/2021 1251 00001A3A 66B8044F <1> mov ax, 4F04h 1252 00001A3E EBE2 <1> jmp short int10h_32bit_pmi 1253 <1> 1254 <1> vbe3_pmfn_save_restore_state: 1255 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 1256 <1> ; 24/01/2021 1257 <1> ; 23/01/2021 1258 <1> ; 16/01/2021 - 17/01/2021 1259 <1> ; 14/01/2021 1260 <1> ; 1261 <1> ; VBE function 4F04h - Save/Restore Video State 1262 <1> ; 1263 <1> ; Input: 1264 <1> ; DL = sub function 1265 <1> ; CL = requested state 1266 <1> ; EBX = pointer to buffer (if DL<>00h) 1267 <1> ; AX = 4F04h 1268 <1> ; Output: 1269 <1> ; AX = 004Fh (successful) 1270 <1> ; AH > 0 -> error 1271 <1> ; BX = Number of 64-byte blocks 1272 <1> ; to hold the state buffer (if DL=00h) 1273 <1> 1274 <1> ; Modified registers: eax, ebx, esi, edi 1275 <1> 1276 00001A40 21DB <1> and ebx, ebx ; user's buffer address 1277 00001A42 750A <1> jnz short _vbe3_pmfn_save_restore_state 1278 <1> 1279 00001A44 08D2 <1> or dl, dl 1280 00001A46 740C <1> jz short _vbe3_pmfn_srs_0 1281 <1> 1282 <1> ; function failed 1283 <1> ;;mov eax, 0100h 1284 <1> ;sub eax, eax 1285 <1> ;inc ah ; eax = 0100h 1286 <1> ;retn 1287 <1> ; 16/01/2021 1288 <1> _vbe3_pmfn_srs_fail: 1289 00001A48 B84F010000 <1> mov eax, 014Fh ; ah = 1 : Function call failed 1290 <1> ; al = 4Fh : Function is supported 1291 <1> _vbe3_srs_retn: 1292 00001A4D C3 <1> retn 1293 <1> 1294 <1> _vbe3_pmfn_save_restore_state: 1295 00001A4E 20D2 <1> and dl, dl 1296 00001A50 7555 <1> jnz short _vbe3_pmfn_srs_2 1297 <1> _vbe3_pmfn_srs: 1298 00001A52 31DB <1> xor ebx, ebx 1299 <1> _vbe3_pmfn_srs_0: 1300 <1> ; 24/01/2021 1301 00001A54 83F90F <1> cmp ecx, 0Fh 1302 <1> ;ja short _vbe3_pmfn_srs_1 1303 00001A57 77EF <1> ja short _vbe3_pmfn_srs_fail 1304 <1> 1305 <1> ; !!! CLEAR CL BIT 2 !!! 1306 <1> ; (when bit 2 is set, function causes cpu exception) 1307 <1> ; BIOS data will not be saved and restored 1308 <1> ; (to prevent protected mode page fault error) 1309 00001A59 80E1FD <1> and cl, ~2 ; and cl, not 2 1310 <1> 1311 <1> ; 24/01/2021 1312 <1> ;mov bl, 1 1313 00001A5C FEC3 <1> inc bl ; = 1 1314 <1> ;shl bx, cl 1315 <1> ; 02/08/2022 1316 00001A5E D3E3 <1> shl ebx, cl 1317 00001A60 66231D[309D0100] <1> and bx, [vbe3stbsflags] 1318 00001A67 7415 <1> jz short _vbe3_pmfn_srs_1 1319 <1> ;mov bx, cx 1320 00001A69 89CB <1> mov ebx, ecx ; <= 15 1321 00001A6B D0E3 <1> shl bl, 1 ; 0, 2, 8 .. 30 1322 00001A6D 668B9B[873B0000] <1> mov bx, [vbestatebufsize+ebx] 1323 00001A74 89DF <1> mov edi, ebx 1324 <1> ; edi = state buffer size in bytes 1325 <1> ;shr bx, 6 ; / 64 1326 <1> ; 02/08/2022 1327 00001A76 C1EB06 <1> shr ebx, 6 1328 <1> ;mov ax, 4Fh 1329 00001A79 28E4 <1> sub ah, ah 1330 00001A7B B04F <1> mov al, 4Fh 1331 00001A7D C3 <1> retn 1332 <1> _vbe3_pmfn_srs_1: 1333 <1> ; ax = 4F04h 1334 <1> ;call int10h_32bit_pmi 1335 <1> ; 24/01/2021 1336 <1> ;call _vbe3_pmfn_srs_8 1337 <1> ; ebx = 0 1338 00001A7E E8B7FFFFFF <1> call _vbe3_pmfn_srs_9 1339 00001A83 6683F84F <1> cmp ax, 004Fh 1340 00001A87 75C4 <1> jne short _vbe3_srs_retn 1341 <1> ; 24/01/2021 1342 <1> ;cmp ecx, 0Fh 1343 <1> ;ja short _vbe3_srs_retn 1344 <1> ; 24/01/2021 1345 <1> ;mov ax, 1 1346 00001A89 B001 <1> mov al, 1 1347 <1> ;shl ax, cl 1348 <1> ; 02/08/2022 1349 00001A8B D3E0 <1> shl eax, cl 1350 00001A8D 660905[309D0100] <1> or [vbe3stbsflags], ax ; set flag for state option 1351 <1> ; 23/01/2021 1352 00001A94 89DF <1> mov edi, ebx 1353 00001A96 89C8 <1> mov eax, ecx 1354 00001A98 D0E0 <1> shl al, 1 1355 <1> ;shl di, 6 ; * 64 1356 <1> ; 02/08/2022 1357 00001A9A C1E706 <1> shl edi, 6 1358 00001A9D 6689B8[873B0000] <1> mov [vbestatebufsize+eax], di 1359 <1> ; save buf size for option 1360 <1> ;xchg edi, ebx 1361 <1> ; edi = state buffer size in bytes 1362 00001AA4 B04F <1> mov al, 4Fh 1363 00001AA6 C3 <1> retn 1364 <1> 1365 <1> _vbe3_pmfn_srs_2: 1366 <1> ; 24/01/2021 1367 <1> ; !!! CLEAR CL BIT 2 !!! 1368 <1> ; (when bit 2 is set, function causes cpu exception) 1369 <1> ; BIOS data will not be saved and restored 1370 <1> ; (to prevent protected mode page fault error) 1371 <1> 1372 00001AA7 F6C1FD <1> test cl, ~2 ; test cl, not 2 1373 00001AAA 749C <1> jz short _vbe3_pmfn_srs_fail 1374 <1> 1375 00001AAC 80FA02 <1> cmp dl, 2 1376 00001AAF 7748 <1> ja short _vbe3_pmfn_srs_5 1377 <1> 1378 <1> ;and cl, ~2 ; and cl, not 2 1379 <1> 1380 00001AB1 53 <1> push ebx ; * ; buffer address 1381 <1> ; save or restore state 1382 <1> ; (get required buffer size at first) 1383 00001AB2 52 <1> push edx ; ** 1384 00001AB3 28D2 <1> sub dl, dl ; 0 1385 00001AB5 E898FFFFFF <1> call _vbe3_pmfn_srs 1386 00001ABA 5A <1> pop edx ; ** 1387 <1> ; 24/01/2021 1388 00001ABB 5B <1> pop ebx ; * 1389 00001ABC 08E4 <1> or ah, ah 1390 00001ABE 7538 <1> jnz short _vbe3_pmfn_srs_4 ; error 1391 <1> 1392 <1> ; edi = buffer size in bytes 1393 00001AC0 81FF00080000 <1> cmp edi, 2048 1394 00001AC6 772B <1> ja short _vbe3_pmfn_srs_3 1395 <1> 1396 00001AC8 80FA01 <1> cmp dl, 1 1397 00001ACB 7531 <1> jne short _vbe3_pmfn_srs_6 ; restore state 1398 <1> 1399 <1> ; save video state 1400 <1> ;xor ebx, ebx ; points to VBE3SAVERESTOREBLOCK 1401 <1> ;mov ax, 4F04h 1402 <1> ;call int10h_32bit_pmi 1403 <1> 1404 <1> ; 24/01/2021 1405 00001ACD E842000000 <1> call _vbe3_pmfn_srs_7 1406 <1> 1407 00001AD2 6683F84F <1> cmp ax, 004Fh 1408 00001AD6 7520 <1> jne short _vbe3_pmfn_srs_4 1409 <1> 1410 00001AD8 09DB <1> or ebx, ebx ; kernel ('sysvideo') ? 1411 00001ADA 741C <1> jz short _vbe3_pmfn_srs_4 ; yes 1412 <1> 1413 <1> ; the caller is user 1414 00001ADC 51 <1> push ecx ; * 1415 00001ADD 89F9 <1> mov ecx, edi ; state buffer size 1416 00001ADF BE00760900 <1> mov esi, VBE3SAVERESTOREBLOCK ; source 1417 <1> ; (vbe3 pmi buff) 1418 00001AE4 89DF <1> mov edi, ebx ; destination (user buff) 1419 00001AE6 E830F00000 <1> call transfer_to_user_buffer 1420 00001AEB 59 <1> pop ecx ; * 1421 00001AEC 7205 <1> jc short _vbe3_pmfn_srs_3 1422 <1> 1423 00001AEE 29C0 <1> sub eax, eax 1424 00001AF0 B04F <1> mov al, 4Fh 1425 00001AF2 C3 <1> retn 1426 <1> 1427 <1> ; 24/01/2021 1428 <1> _vbe3_pmfn_srs_3: 1429 00001AF3 B84F010000 <1> mov eax, 014Fh 1430 <1> _vbe3_pmfn_srs_4: 1431 00001AF8 C3 <1> retn 1432 <1> _vbe3_pmfn_srs_5: 1433 00001AF9 31C0 <1> xor eax, eax 1434 00001AFB FEC4 <1> inc ah 1435 <1> ; eax = 0100h, function is not supported 1436 00001AFD C3 <1> retn 1437 <1> 1438 <1> _vbe3_pmfn_srs_6: 1439 <1> ; restore video state 1440 <1> ; 24/01/2021 1441 <1> ;pop ebx ; * 1442 <1> ; 23/01/2021 1443 00001AFE 09DB <1> or ebx, ebx ; 0 ? 1444 00001B00 7412 <1> jz short _vbe3_pmfn_srs_7 ; 'sysvideo' call 1445 <1> ; 24/01/2021 1446 <1> ;jz _vbe3_pmfn_srs_8 1447 00001B02 89DE <1> mov esi, ebx 1448 <1> ; esi = user's video state buffer 1449 00001B04 51 <1> push ecx ; * 1450 00001B05 89F9 <1> mov ecx, edi ; state buffer size 1451 00001B07 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK ; destination 1452 <1> ; (vbe3 pmi buff) 1453 <1> ;mov esi, ebx ; source (user buff) 1454 00001B0C E854F00000 <1> call transfer_from_user_buffer 1455 00001B11 59 <1> pop ecx ; * 1456 00001B12 72DF <1> jc short _vbe3_pmfn_srs_3 1457 <1> _vbe3_pmfn_srs_7: 1458 00001B14 53 <1> push ebx ; * 1459 <1> ; restore video state 1460 <1> ;xor ebx, ebx ; points to VBE3SAVERESTOREBLOCK 1461 <1> ;mov ax, 4F04h 1462 <1> ;call int10h_32bit_pmi 1463 <1> ; 17/01/2021 1464 00001B15 E81EFFFFFF <1> call _vbe3_pmfn_srs_8 1465 00001B1A 5B <1> pop ebx ; * 1466 00001B1B C3 <1> retn 1467 <1> 1468 <1> VIDEO_STATE: 1469 <1> ; 26/06/2016 1470 <1> ; 12/05/2016 1471 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 1472 <1> 1473 <1> ;--------------------------------------------------- 1474 <1> ; VIDEO STATE 1475 <1> ; RETURNS THE CURRENT VIDEO STATE IN AX 1476 <1> ; AH = NUMBER OF COLUMNS ON THE SCREEN 1477 <1> ; AL = CURRENT VIDEO MODE 1478 <1> ; BH = CURRENT ACTIVE PAGE 1479 <1> ;--------------------------------------------------- 1480 <1> 1481 00001B1C 8A25[30680000] <1> mov ah, [CRT_COLS] ; GET NUMBER OF COLUMNS 1482 00001B22 A0[2E680000] <1> mov al, [CRT_MODE] ; CURRENT MODE 1483 <1> ;movzx esi, al 1484 <1> ;mov ah, [esi+M6] 1485 <1> ; BH = active page 1486 00001B27 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] ; GET CURRENT ACTIVE PAGE 1487 00001B2D FA <1> cli ; 02/01/2017 1488 00001B2E 5D <1> pop ebp ; RECOVER REGISTERS 1489 00001B2F 5F <1> pop edi 1490 00001B30 5E <1> pop esi 1491 00001B31 59 <1> pop ecx ; DISCARD SAVED BX 1492 00001B32 EB41 <1> jmp short M15 ; RETURN TO CALLER 1493 <1> 1494 <1> set_mode_ncm: 1495 <1> ; 17/11/2020 (TRDOS 386 v2.0.3) 1496 <1> ; 04/07/2016 - TRDOS 386 (TRDOS v2.0) 1497 <1> ; set mode without clearing the video memory 1498 <1> ; (ony for graphics modes) 1499 <1> 1500 <1> ;cmp al, 7 ; IBM PC CGA modes 1501 <1> ;jna short SET_MODE ; normal function (clear) 1502 <1> ;; do not clear memory 1503 <1> ;;mov [noclearmem], al ; > 0 1504 <1> ;mov byte [noclearmem], 80h ; 17/11/2020 1505 <1> ;call _set_mode 1506 <1> ;mov byte [noclearmem], 0 1507 <1> ;jmp short VIDEO_RETURN 1508 <1> 1509 <1> ; 17/11/2020 (TRDOS v2.0.3) 1510 00001B34 0C80 <1> or al, 80h ; not clear memory option 1511 <1> 1512 <1> ; 05/12/2020 1513 <1> ; 27/11/2020 1514 <1> ; 17/11/2020 1515 <1> ; 08/08/2016, 10/08/2016 1516 <1> ; 29/07/2016, 30/07/2016 1517 <1> ; 25/07/2016, 26/07/2016, 27/07/2016 1518 <1> ; 02/07/2016, 18/07/2016, 23/07/2016 1519 <1> ; 24/06/2016, 26/06/2016 1520 <1> ; 29/05/2016 - TRDOS 386 (TRDOS v2.0) 1521 <1> SET_MODE: 1522 <1> ; For 32 bit TRDOS and Retro UNIX 386: 1523 <1> ; valid video mode: 03h only! 1524 <1> ; (VGA modes will be selected with another routine) 1525 <1> ; 1526 <1> ; set_txt_mode ; 80*25 (16 fore colors, 8 back colors) 1527 <1> 1528 <1> ; 27/11/2020 1529 <1> 1530 <1> ; Check if current mode is 1531 <1> ; Bochs/Plex86 VBE graphics mode 1532 00001B36 803D[2E680000]FF <1> cmp byte [CRT_MODE], 0FFh ; VESA VBE graphics mode 1533 00001B3D 7220 <1> jb short _set_mode_ ; signature 1534 <1> ; VBE mode number is in 1535 <1> ; [video_mode] bit 0to8 1536 00001B3F 88C3 <1> mov bl, al ; save video mode 1537 00001B41 E88D230000 <1> call dispi_get_enable 1538 00001B46 50 <1> push eax ; save current VBE dispi status 1539 <1> ; Disable Bochs/Plex86 VBE dispi 1540 <1> ;mov ax, 0 ; VBE_DISPI_DISABLED 1541 00001B47 31C0 <1> xor eax, eax ; 0 1542 00001B49 E85A230000 <1> call dispi_set_enable 1543 00001B4E 88D8 <1> mov al, bl ; restore video mode 1544 00001B50 E830000000 <1> call _set_mode 1545 00001B55 58 <1> pop eax ; restore current VBE dispi status 1546 00001B56 7313 <1> jnc short VIDEO_RETURN 1547 <1> ; ! unimplemented or invalid video mode number ! 1548 <1> ; VBE dispi must be enabled again 1549 <1> ; (return to run on current VBE graphics mode) 1550 <1> ;;mov al, [video_mode+1] ; bit 8 to 15 1551 <1> ;;and al, 0C0h ; isolate bit 14 and bit 15 1552 <1> ;;or al, 1 ; VBE_DISPI_ENABLED 1553 00001B58 E84B230000 <1> call dispi_set_enable 1554 00001B5D EB07 <1> jmp short _video_func_err 1555 <1> 1556 <1> _set_mode_: 1557 <1> ; VGA bios (non-VBE) 'setmode' procedure 1558 <1> 1559 <1> ; 26/11/2020 (TRDOS v2.0.3) 1560 <1> 1561 <1> ;------------------------------------------------------ 1562 <1> ; SET MODE : 1563 <1> ; THIS ROUTINE INITIALIZES THE ATTACHMENT TO : 1564 <1> ; THE SELECTED MODE, THE SCREEN IS BLANKED. : 1565 <1> ; INPUT : 1566 <1> ; (AL) - MODE SELECTED (RANGE 0-7) : 1567 <1> ; OUTPUT : 1568 <1> ; NONE : 1569 <1> ;------------------------------------------------------ 1570 <1> 1571 00001B5F E821000000 <1> call _set_mode ; 24/06/2016 (set_txt_mode) 1572 <1> ; 26/11/2020 1573 00001B64 7305 <1> jnc short VIDEO_RETURN 1574 <1> 1575 <1> ; 26/11/2020 1576 <1> _video_func_err: 1577 00001B66 31C0 <1> xor eax, eax ; function call failed 1578 00001B68 48 <1> dec eax ; 0FFFFFFFFh ; - 1 1579 00001B69 EB05 <1> jmp short _video_return 1580 <1> 1581 <1> ; 12/05/2016 1582 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 1583 <1> 1584 <1> ;----- NORMAL RETURN FROM ALL VIDEO RETURNS 1585 <1> 1586 <1> VIDEO_RETURN: 1587 00001B6B A1[3C830100] <1> mov eax, [video_eax] ; 12/05/2016 1588 <1> _video_return: 1589 00001B70 FA <1> cli ; 02/01/2017 1590 00001B71 5D <1> pop ebp ; ******** ; 26/11/2020 1591 00001B72 5F <1> pop edi ; ******* 1592 00001B73 5E <1> pop esi ; ****** 1593 00001B74 5B <1> pop ebx ; ***** 1594 <1> M15: ; VIDEO_RETURN_C 1595 <1> ;;15/01/2017 1596 <1> ; 02/01/2017 1597 <1> ;;mov byte [intflg], 0 1598 <1> ; 1599 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 1600 <1> ; restore previous (user's) cr3 1601 00001B75 8B0D[60770100] <1> mov ecx, [cr3prev] 1602 00001B7B 0F22D9 <1> mov cr3, ecx 1603 <1> ; 1604 00001B7E 59 <1> pop ecx ; **** ; 26/11/2020 1605 00001B7F 5A <1> pop edx ; *** 1606 00001B80 1F <1> pop ds ; ** 1607 00001B81 07 <1> pop es ; * ; RECOVER SEGMENTS 1608 00001B82 CF <1> iretd ; ALL DONE 1609 <1> 1610 <1> set_txt_mode: 1611 <1> 1612 <1> ; 29/07/2016 1613 <1> ; 27/06/2016 1614 00001B83 B003 <1> mov al, 3 ; 26/11/2020 (bit 7 = 0) 1615 <1> 1616 <1> ; 17/11/2020 (TRDOS v2.0.3) 1617 <1> ;mov byte [noclearmem], 0 1618 <1> 1619 <1> ; 04/08/2022 1620 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 1621 <1> ; 12/04/2021 1622 <1> ; 10/08/2016 1623 <1> ; 08/08/2016 1624 <1> ; 30/07/2016 1625 <1> ; 29/07/2016 1626 <1> ; 25/07/2016 - 26/07/2016 - 27/07/2016 1627 <1> ; 07/07/2016 - 18/07/2016 - 23/07/2016 1628 <1> ; 02/07/2016 - 03/07/2016 - 04/07/2016 1629 <1> ; 26/06/2016 1630 <1> ; 24/06/2016 (set_txt_mode -> _set_mode) 1631 <1> ; 17/06/2016 1632 <1> ; 29/05/2016 1633 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 1634 <1> 1635 <1> _set_mode: 1636 <1> ; 12/12/2020 1637 <1> ; 26/11/2020 1638 <1> ; call from 'biosfn_set_video_mode' 1639 <1> ; (bochs/plex86 video bios code) 1640 <1> ; call from 'SET_MODE' 1641 <1> ; (TRDOS 386 v2 default, IBM PC/AT rom bios code) 1642 <1> ; continue from 'set_txt_mode' 1643 <1> 1644 <1> ; INPUT: 1645 <1> ; al = VGA video mode 1646 <1> ; RETURN: 1647 <1> ; cf = 1 -> video mode not implemented 1648 <1> ; cf = 0 -> OK 1649 <1> ; 1650 <1> ; Modified registers: eax, bx, ecx, esi, edi, (ebp) 1651 <1> 1652 <1> ; 17/11/2020 (TRDOS v2.0.3) 1653 <1> ; no clear memory option 1654 <1> ; (from mode number byte bit 7) 1655 00001B85 88C4 <1> mov ah, al 1656 00001B87 80E480 <1> and ah, 80h 1657 <1> ;mov [noclearmem], al 1658 00001B8A 8825[4B830100] <1> mov [noclearmem], ah 1659 <1> ;and al, 7Fh ; clear bit 7 1660 <1> ;;xor [noclearmem], al ; clear bit 0 to 6 1661 <1> ; 26/11/2020 1662 00001B90 30E0 <1> xor al, ah ; and al, 7Fh 1663 <1> 1664 <1> ; 19/11/2020 1665 <1> 1666 <1> ; Video mode 03h action principle: 1667 <1> ; 1668 <1> ; for case 1: 1669 <1> ; Current mode is 03h and next/requested mode is not 03h 1670 <1> ; - save mode (set mode 03h flag) 1671 <1> ; - save 8 video pages (which are will be restored) 1672 <1> ; - save active page number (which will be reactivated) 1673 <1> ; - set active page to 0 always (no multi screen) 1674 <1> ; - save 8 cursor positions (which will be restored) 1675 <1> ; - use 'noclearmem' option 1676 <1> ; [p_crt_mode] = 0 -> 03h 1677 <1> ; 1678 <1> ; for case 2: 1679 <1> ; Current mode is 03h and next/requested mode is also 03h 1680 <1> ; - clear active video page if 'noclearmem' is not set 1681 <1> ; [p_crt_mode] = 0 -> 80h -> 0 1682 <1> ; 1683 <1> ; for case 3: 1684 <1> ; Current mode is not 03h and next/requested mode is 03h 1685 <1> ; - restore video pages (8 video pages were saved) 1686 <1> ; - restore active page number (which were saved) 1687 <1> ; - restore 8 cursor positions (which were saved) 1688 <1> ; - reset/clear mode 03h flag 1689 <1> ; [p_crt_mode] = 03h -> 0 1690 <1> ; 1691 <1> ; for case 4: 1692 <1> ; Current mode is not 03h and next/requested mode is not 03h 1693 <1> ; - use 'noclearmem' option 1694 <1> ; - set active page to 0 always 1695 <1> ; [p_crt_mode] = 03h -> 83h -> 03h 1696 <1> ; 1697 <1> ; initial (boot time) values: 1698 <1> ; [p_crt_mode] = 0 ("there isn't a page backup, yet") 1699 <1> ; [CRT_MODE] = 3 (kernel's starting mode) 1700 <1> 1701 <1> ; 26/11/2020 1702 00001B92 3C03 <1> cmp al, 03h ; mode 3, 80x25 text, 16 colors 1703 00001B94 7515 <1> jne short _sm_0 ; (default mode for TRDOS 386 mainprog) 1704 <1> 1705 <1> ; case 2 or case 3 1706 <1> 1707 <1> ; check current video mode if it is 03h 1708 00001B96 08E4 <1> or ah, ah ; 80h or 0 ('noclearmem' option) 1709 00001B98 7521 <1> jnz short _sm_1 ; do not clear display page 1710 <1> 1711 <1> ; 26/11/2020 1712 <1> ; Note: 1713 <1> ; [CRT_MODE] = 0FFh for VESA VBE video modes 1714 <1> ; [video_mode] = standard VGA and VESA VBE video modes 1715 <1> 1716 00001B9A 3805[2E680000] <1> cmp [CRT_MODE], al ; 03h 1717 00001BA0 7520 <1> jne short _sm_2 ; case 3 ([p_crt_mode] = 03h) 1718 <1> 1719 <1> ; case 2 1720 <1> 1721 <1> ; [p_crt_mode] = 0 1722 <1> 1723 <1> ; 19/11/2020 1724 <1> ; If '_set_mode' procedure is called for video mode 3 1725 <1> ; while video mode is 3, video page will be cleared 1726 <1> ; and cursor position of video page will be reset. 1727 <1> 1728 <1> ; clear display page 1729 00001BA2 C605[49830100]80 <1> mov byte [p_crt_mode], 80h ; clear page sign 1730 00001BA9 EB1C <1> jmp short _sm_3 ; bypass save video page routine 1731 <1> _sm_0: 1732 <1> ; case 1 or case 4 1733 <1> 1734 <1> ; 05/12/2020 1735 00001BAB 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; is current mode 03h? 1736 00001BB2 7507 <1> jne short _sm_1 ; case 4 ; [p_crt_mode] = 03h 1737 <1> 1738 <1> ; case 1 1739 <1> ; [p_crt_mode] = 0 1740 <1> 1741 <1> ; 19/11/2020 1742 <1> ; If '_set_mode' procedure is called for a video mode 1743 <1> ; except video mode 3 while current video mode 1744 <1> ; is 3, all video pages of mode 3 will be copied 1745 <1> ; to 98000h address as backup, before mode change. 1746 <1> 1747 <1> _sm_save_pm: 1748 <1> ; 12/12/2020 1749 <1> ;; 03/07/2016 1750 <1> ;; save video pages 1751 <1> ;mov esi, 0B8000h 1752 <1> ;mov edi, 98000h ; 30/07/2016 1753 <1> ;mov ecx, (0B8000h-0B0000h)/4 1754 <1> ;rep movsd 1755 <1> 1756 <1> ;mov byte [p_crt_mode], 3 ; previous mode, backup sign 1757 <1> ;; 26/11/2020 1758 <1> ;xchg cl, [ACTIVE_PAGE] 1759 <1> ;mov [p_crt_page], cl ; save as previous active page 1760 <1> ; 1761 <1> ;; save cursor positions 1762 <1> ;mov esi, CURSOR_POSN 1763 <1> ;mov edi, cursor_pposn ; cursor positions backup 1764 <1> ;mov cl, 4 1765 <1> ;rep movsd 1766 <1> 1767 <1> ; 12/12/2020 1768 00001BB4 E86E020000 <1> call save_mode3_multiscreen 1769 <1> 1770 <1> ; 29/07/2016 1771 <1> ;;mov [ACTIVE_PAGE], cl ; 0 1772 <1> ;xchg cl, [ACTIVE_PAGE] 1773 <1> ;mov [p_crt_page], cl ; previous page (for mode 3) 1774 <1> 1775 <1> ; [ACTIVE_PAGE] = 0 1776 <1> 1777 00001BB9 EB07 <1> jmp short _sm_2 ; case 1 - 19/11/2020 1778 <1> _sm_1: 1779 <1> ; 26/11/2020 1780 <1> ; 19/11/2020 1781 <1> 1782 <1> ; case 4 1783 00001BBB 800D[49830100]80 <1> or byte [p_crt_mode], 80h 1784 <1> ; here [p_crt_mode] must be 83h 1785 <1> ; (for case 4) 1786 <1> ; (because video mode 03h 1787 <1> ; was changed before as in case 1) 1788 <1> 1789 <1> _sm_2: ; case 4 (jump to _sm_2) - 19/11/2020 1790 <1> 1791 <1> ; 19/11/2020 1792 <1> ; case 3 1793 <1> ; If '_set_mode' procedure is called for video mode 3 1794 <1> ; while video mode is not 3 and if there is video 1795 <1> ; page backup for video mode 3, all (of 8) mode 3 1796 <1> ; video pages will be restored from 98000h. 1797 <1> 1798 00001BC2 A2[2E680000] <1> mov [CRT_MODE], al ; save mode in global variable 1799 <1> _sm_3: 1800 <1> ; 04/08/2022 (TRDOS 386 v2.0.5) 1801 <1> ; 30/07/2016 1802 <1> ; 26/07/2016 1803 <1> ; 25/07/2016 1804 <1> ; set_mode_vga: 1805 <1> ; 18/07/2016 1806 <1> ; 14/07/2016 1807 <1> ; 09/07/2016 1808 <1> ; 04/07/2016 1809 <1> ; 03/07/2016 (TRDOS 386 = TRDOS v2.0) 1810 <1> ; /// video mode 13h /// 1811 <1> ; derived from 'Plex86/Bochs VGABios' source code 1812 <1> ; vgabios-0.7a (2011) 1813 <1> ; by the LGPL VGABios developers Team (2001-2008) 1814 <1> ; 'vgabios.c', 'vgatables.h' 1815 <1> ; 1816 <1> ; Oracle VirtualBox 5.0.24 VGABios Source Code 1817 <1> ; ('vgabios.c', 'vgatables.h', 'vgafonts.h', 'vgarom.asm') 1818 <1> ; 1819 00001BC7 88C4 <1> mov ah, al 1820 00001BC9 B910000000 <1> mov ecx, vga_mode_count 1821 00001BCE BE[4A680000] <1> mov esi, vga_modes 1822 00001BD3 31DB <1> xor ebx, ebx 1823 <1> _sm_4: 1824 00001BD5 AC <1> lodsb 1825 00001BD6 38C4 <1> cmp ah, al 1826 00001BD8 7406 <1> je short _sm_5 1827 00001BDA FEC3 <1> inc bl 1828 00001BDC E2F7 <1> loop _sm_4 1829 <1> 1830 <1> ; UNIMPLEMENTED VIDEO MODE ! 1831 <1> ;xor eax, eax 1832 <1> ;mov [video_eax], eax ; 0 1833 <1> 1834 <1> ; 26/11/2020 1835 00001BDE F9 <1> stc ; unimplemented video mode ! (cf=1) 1836 <1> 1837 00001BDF C3 <1> retn 1838 <1> 1839 <1> ;----- EBX POINTS TO CORRECT ROW OF INITIALIZATION TABLE 1840 <1> 1841 <1> _sm_5: ; 25/07/2016 1842 <1> ;mov esi, ebx 1843 <1> ;add esi, vga_memmodel 1844 <1> ;mov al, [esi] 1845 <1> ; 19/11/2020 1846 00001BE0 8A83[9A680000] <1> mov al, [ebx+vga_memmodel] 1847 00001BE6 A2[62830100] <1> mov [VGA_MTYPE], al 1848 <1> 1849 00001BEB 89DF <1> mov edi, ebx 1850 00001BED 81C7[AA680000] <1> add edi, vga_dac_s 1851 00001BF3 C0E302 <1> shl bl, 2 ; byte -> dword 1852 00001BF6 81C3[5A680000] <1> add ebx, vga_mode_tbl_ptr 1853 <1> 1854 <1> ;mov dword [VGA_BASE], 0B8000h 1855 <1> ;cmp ah, 0Dh ; [CRT_MODE] 1856 <1> ;jb short M9 1857 <1> ;mov dword [VGA_BASE], 0A0000h 1858 <1> ;M9: 1859 00001BFC 8B33 <1> mov esi, [ebx] 1860 00001BFE 89F3 <1> mov ebx, esi 1861 00001C00 83C614 <1> add esi, vga_p_cm_pos ; ebx + 20 1862 00001C03 668B06 <1> mov ax, [esi] ; get the cursor mode from the table 1863 00001C06 66A3[47680000] <1> mov [CURSOR_MODE], ax ; save cursor mode (initial value) 1864 <1> ; al = 6, ah = 7 1865 <1> ; al = 0Dh, ah = 0Eh ; 25/07/2016 1866 00001C0C E893020000 <1> call cursor_shape_fix 1867 <1> ; al = 14, ah = 15 (If [CHAR_HEIGHT] = 16) 1868 00001C11 668906 <1> mov [esi], ax 1869 <1> 1870 00001C14 56 <1> push esi ; * 1871 <1> 1872 <1> ; 17/04/2021 1873 00001C15 B603 <1> mov dh, 03h 1874 <1> ; 1875 00001C17 8A25[35680000] <1> mov ah, [VGA_MODESET_CTL] 1876 00001C1D 80E408 <1> and ah, 8 ; default palette loading ? 1877 00001C20 7520 <1> jnz short _sm_6 1878 <1> ;mov dx, 3C6h ; VGAREG_PEL_MASK (DAC mask register) 1879 <1> ; 17/04/2021 1880 00001C22 B2C6 <1> mov dl, 0C6h 1881 00001C24 B0FF <1> mov al, 0FFh ; PEL mask 1882 00001C26 EE <1> out dx, al 1883 00001C27 8A27 <1> mov ah, [edi] ; DAC model (selection number) 1884 00001C29 E800100000 <1> call load_dac_palette 1885 <1> ; ecx = 0 1886 00001C2E F605[35680000]02 <1> test byte [VGA_MODESET_CTL], 2 ; gray scale summing 1887 00001C35 740B <1> jz short _sm_6 1888 00001C37 53 <1> push ebx 1889 00001C38 29DB <1> sub ebx, ebx ; sub bl, bl 1890 <1> ;mov cx, 256 1891 <1> ; 02/08/2022 1892 <1> ;sub ecx, ecx 1893 <1> ; ecx = 0 1894 00001C3A FEC5 <1> inc ch 1895 <1> ; ecx = 256 1896 00001C3C E83F100000 <1> call gray_scale_summing 1897 00001C41 5B <1> pop ebx 1898 <1> _sm_6: 1899 <1> ; Reset Attribute Ctl flip-flop 1900 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 1901 <1> ; 17/03/2021 1902 00001C42 B2DA <1> mov dl, 0DAh ; dx = 3DAh 1903 00001C44 EC <1> in al, dx 1904 <1> ; Set Attribute Ctl 1905 00001C45 89DE <1> mov esi, ebx ; addr of params tbl for selected mode 1906 00001C47 83C623 <1> add esi, 35 ; actl regs 1907 00001C4A 30E4 <1> xor ah, ah ; 0 1908 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 1909 <1> ; 17/04/2021 1910 00001C4C B2C0 <1> mov dl, 0C0h 1911 <1> _sm_7: 1912 00001C4E 88E0 <1> mov al, ah 1913 00001C50 EE <1> out dx, al ; index 1914 00001C51 AC <1> lodsb 1915 <1> ; DX = 3C0h = VGAREG_ACTL_WRITE_DATA 1916 00001C52 EE <1> out dx, al ; value 1917 00001C53 FEC4 <1> inc ah 1918 00001C55 80FC14 <1> cmp ah, 20 ; number of actl registers 1919 00001C58 72F4 <1> jb short _sm_7 1920 <1> ; 1921 00001C5A 88E0 <1> mov al, ah ; 20 1922 00001C5C EE <1> out dx, al ; index 1923 00001C5D 28C0 <1> sub al, al ; 0 1924 00001C5F EE <1> out dx, al ; value 1925 <1> ; 1926 <1> ; Set Sequencer Ctl 1927 00001C60 89DE <1> mov esi, ebx ; addr of params tbl for selected mode 1928 00001C62 83C605 <1> add esi, 5 ; sequ regs 1929 <1> ; 1930 <1> ;mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 1931 <1> ; 17/04/2021 1932 00001C65 B2C4 <1> mov dl, 0C4h 1933 00001C67 EE <1> out dx, al ; 0 1934 <1> ;inc dx ; 3C5h ; VGAREG_SEQU_DATA 1935 <1> ; 17/04/2021 1936 00001C68 FEC2 <1> inc dl ; dx = 3C5h 1937 00001C6A B003 <1> mov al, 3 1938 00001C6C EE <1> out dx, al 1939 00001C6D B401 <1> mov ah, 1 1940 <1> _sm_8: 1941 00001C6F 88E0 <1> mov al, ah 1942 <1> ;mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 1943 <1> ;dec dx 1944 <1> ; 17/04/2021 1945 00001C71 FECA <1> dec dl ; dx = 3C4h 1946 00001C73 EE <1> out dx, al ; index 1947 00001C74 AC <1> lodsb 1948 <1> ;inc dx ; 3C5h ; VGAREG_SEQU_DATA 1949 <1> ; 17/04/2021 1950 00001C75 FEC2 <1> inc dl 1951 00001C77 EE <1> out dx, al 1952 00001C78 80FC04 <1> cmp ah, 4 ; number of sequ regs 1953 00001C7B 7304 <1> jnb short _sm_9 1954 00001C7D FEC4 <1> inc ah 1955 00001C7F EBEE <1> jmp short _sm_8 1956 <1> _sm_9: 1957 <1> ; Set Grafx Ctl 1958 00001C81 89DE <1> mov esi, ebx ; addr of params tbl for selected mode 1959 00001C83 83C637 <1> add esi, 55 ; grdc regs 1960 00001C86 30E4 <1> xor ah, ah ; 0 1961 <1> _sm_10: 1962 00001C88 88E0 <1> mov al, ah 1963 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 1964 <1> ; 17/04/2021 1965 00001C8A B2CE <1> mov dl, 0CEh 1966 00001C8C EE <1> out dx, al 1967 00001C8D AC <1> lodsb 1968 <1> ;inc dx ; 3CFh ; VGAREG_GRDC_DATA 1969 <1> ; 17/04/2021 1970 00001C8E FEC2 <1> inc dl ; 3CFh 1971 00001C90 EE <1> out dx, al 1972 00001C91 FEC4 <1> inc ah 1973 00001C93 80FC09 <1> cmp ah, 9 ; number of grdc regs 1974 00001C96 72F0 <1> jb short _sm_10 1975 <1> ; 1976 <1> ; Disable CRTC write protection 1977 <1> ;mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 1978 <1> ; 17/04/2021 1979 00001C98 B2D4 <1> mov dl, 0D4h 1980 <1> ;mov al, 11h 1981 <1> ;out dx, al 1982 <1> ;inc dx 1983 <1> ;sub al, al 1984 <1> ;out dx, al 1985 00001C9A 66B81100 <1> mov ax, 11h 1986 00001C9E 66EF <1> out dx, ax 1987 00001CA0 89DE <1> mov esi, ebx ; addr of params tbl for selected mode 1988 00001CA2 83C60A <1> add esi, 10 ; crtc regs 1989 <1> ; ah = 0 1990 <1> _sm_11: 1991 00001CA5 88E0 <1> mov al, ah 1992 <1> ; dx = 3D4h = VGAREG_VGA_CRTC_ADDRESS 1993 00001CA7 EE <1> out dx, al ; index 1994 00001CA8 AC <1> lodsb 1995 <1> ;inc dx ; VGAREG_VGA_CRTC_ADDRESS + 1 1996 <1> ; 17/04/2021 1997 00001CA9 FEC2 <1> inc dl 1998 00001CAB EE <1> out dx, al ; value 1999 00001CAC 80FC18 <1> cmp ah, 24 ; number of crtc registers - 1 2000 00001CAF 7306 <1> jnb short _sm_12 2001 00001CB1 FEC4 <1> inc ah 2002 <1> ;dec dx ; 3D4h 2003 <1> ; 17/04/2021 2004 00001CB3 FECA <1> dec dl 2005 00001CB5 EBEE <1> jmp short _sm_11 2006 <1> _sm_12: 2007 <1> ; Set the misc register 2008 <1> ;mov dx, 3CCh ; VGAREG_READ_MISC_OUTPUT 2009 <1> ; 17/04/2021 2010 00001CB7 B2CC <1> mov dl, 0CCh 2011 00001CB9 8A4309 <1> mov al, [ebx+9] ; misc reg 2012 00001CBC EE <1> out dx, al 2013 <1> ; 2014 <1> ; Enable video 2015 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 2016 <1> ; 17/04/2021 2017 00001CBD B2C0 <1> mov dl, 0C0h 2018 00001CBF B020 <1> mov al, 20h 2019 00001CC1 EE <1> out dx, al ; set bit 5 to 1 2020 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 2021 <1> ; 17/04/2021 2022 00001CC2 B2DA <1> mov dl, 0DAh 2023 00001CC4 EC <1> in al, dx 2024 <1> ; 2025 <1> ; 17/11/2020 2026 <1> ;cmp byte [noclearmem], 0 2027 <1> ;ja short _sm_15 2028 <1> 2029 00001CC5 F605[4B830100]80 <1> test byte [noclearmem], 80h 2030 00001CCC 753B <1> jnz short _sm_15 2031 <1> 2032 <1> ; 29/07/2016 2033 00001CCE 31C0 <1> xor eax, eax 2034 <1> ;mov ecx, 4000h ; 16K words (32K) 2035 <1> ; 02/08/2022 2036 00001CD0 29C9 <1> sub ecx, ecx 2037 00001CD2 B540 <1> mov ch, 40h 2038 <1> ; ecx = 4000h 2039 00001CD4 803D[62830100]02 <1> cmp byte [VGA_MTYPE], 2 ; CTEXT, MTEXT, CGA 2040 00001CDB 7715 <1> ja short _sm_14 ; no ? (0A0000h) 2041 00001CDD BF00800B00 <1> mov edi, 0B8000h 2042 00001CE2 7409 <1> je short _sm_13 ; CGA graphics mode 2043 <1> ; 08/08/2016 2044 00001CE4 A3[5E830100] <1> mov [VGA_INT43H], eax ; 0 ; default font 2045 00001CE9 66B82007 <1> mov ax, 0720h ; CGA text mode 2046 <1> _sm_13: 2047 00001CED 66F3AB <1> rep stosw 2048 00001CF0 EB17 <1> jmp short _sm_15 2049 <1> 2050 <1> _sm_14: 2051 00001CF2 BF00000A00 <1> mov edi, 0A0000h 2052 <1> ; ecx = 16384 dwords (64K) 2053 <1> ;mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 2054 <1> ; 17/04/2021 2055 00001CF7 B2C4 <1> mov dl, 0C4h 2056 00001CF9 B002 <1> mov al, 2 2057 00001CFB EE <1> out dx, al 2058 <1> ;mov dx, 3C5h ; VGAREG_SEQU_DATA 2059 <1> ;inc dx 2060 <1> ; 17/04/2021 2061 00001CFC FEC2 <1> inc dl ; 3C5h 2062 00001CFE EC <1> in al, dx ; mmask 2063 <1> ;push ax 2064 <1> ; 12/04/2021 2065 00001CFF 50 <1> push eax 2066 00001D00 B00F <1> mov al, 0Fh ; all planes 2067 00001D02 EE <1> out dx, al 2068 00001D03 30C0 <1> xor al, al ; 0 2069 00001D05 F3AB <1> rep stosd ; ecx = 163684 (64K) 2070 <1> ;pop ax 2071 <1> ; 12/04/2021 2072 00001D07 58 <1> pop eax 2073 00001D08 EE <1> out dx, al ; mmask 2074 <1> _sm_15: 2075 <1> ; ebx = addr of params tbl for selected mode 2076 <1> ; 10/08/2016 2077 00001D09 668B03 <1> mov ax, [ebx] ; num of columns, 'twidth' 2078 00001D0C A2[30680000] <1> mov [CRT_COLS], al 2079 <1> ;; 26/07/2016 2080 <1> ;; CRTC_ADDRESS = 3D4h (always) 2081 <1> ;mov ah, [ebx+1] ; num of rows, 'theightm1' 2082 00001D11 FEC4 <1> inc ah ; 09/07/2016 2083 00001D13 8825[36680000] <1> mov [VGA_ROWS], ah 2084 <1> ; 10/08/2016 2085 00001D19 8A4302 <1> mov al, [ebx+2] 2086 00001D1C A2[32680000] <1> mov [CHAR_HEIGHT], al 2087 <1> ; 29/07/2016 2088 <1> ; length of regen buffer in bytes 2089 00001D21 668B4B03 <1> mov cx, [ebx+3] ; 'slength_l' 2090 00001D25 66890D[4C830100] <1> mov [CRT_LEN], cx 2091 <1> ; 2092 <1> ; 27/07/2016 2093 00001D2C 30E4 <1> xor ah, ah 2094 00001D2E A0[DE760100] <1> mov al, [ACTIVE_PAGE] ; may be > 0 for mode 3 2095 <1> ;mul word [CRT_LEN] ; 4096 for mode 3 2096 00001D33 66F7E1 <1> mul cx ; 29/07/2016 2097 00001D36 66A3[CC760100] <1> mov [CRT_START], ax 2098 <1> ; 2099 00001D3C B060 <1> mov al, 60h 2100 <1> ;cmp byte [noclearmem], 0 2101 <1> ;jna short _sm_16 2102 <1> ;add al, 80h 2103 00001D3E 0A05[4B830100] <1> or al, [noclearmem] ; 17/11/2020 2104 <1> _sm_16: 2105 00001D44 A2[33680000] <1> mov [VGA_VIDEO_CTL], al 2106 00001D49 C605[34680000]F9 <1> mov byte [VGA_SWITCHES], 0F9h 2107 00001D50 8025[35680000]7F <1> and byte [VGA_MODESET_CTL], 7Fh 2108 <1> 2109 00001D57 5E <1> pop esi ; * 2110 <1> 2111 <1> ; 26/07/2016 2112 <1> ; 07/07/2016 2113 00001D58 668B0D[47680000] <1> mov cx, [CURSOR_MODE] ; restore cursor mode (initial value) 2114 00001D5F 66870E <1> xchg cx, [esi] ; cl = start line, ch = end line 2115 <1> ; reset to initial value 2116 00001D62 86E9 <1> xchg ch, cl ; ch = start line, cl = end line 2117 00001D64 66890D[47680000] <1> mov [CURSOR_MODE], cx ; save (fixed) cursor mode 2118 <1> 2119 <1> ; 27/07/2016 2120 00001D6B 803D[62830100]02 <1> cmp byte [VGA_MTYPE], 2 ; CTEXT, MTEXT 2121 00001D72 7317 <1> jnb short _sm_17 2122 <1> 2123 <1> ; Set cursor shape 2124 <1> ;mov cx, 0607h 2125 <1> ;call _set_ctype 2126 <1> 2127 <1> ; 29/07/2016 2128 00001D74 B40A <1> mov ah, 10 ; 6845 register for cursor set 2129 00001D76 E827060000 <1> call m16 ; output cx register 2130 <1> 2131 <1> ; 25/07/2016 2132 00001D7B 803D[2E680000]03 <1> cmp byte [CRT_MODE], 03h 2133 00001D82 7507 <1> jne short _sm_17 2134 <1> ; 26/07/2016 2135 <1> 2136 00001D84 A0[DE760100] <1> mov al, [ACTIVE_PAGE] 2137 00001D89 EB0B <1> jmp short _sm_18 2138 <1> _sm_17: 2139 <1> ; Set cursor pos for page 0..7 2140 <1> ;sub ax, ax ; eax = 0 2141 00001D8B 29C0 <1> sub eax, eax ; 17/11/2020 2142 00001D8D BF[CE760100] <1> mov edi, CURSOR_POSN 2143 00001D92 AB <1> stosd 2144 00001D93 AB <1> stosd 2145 00001D94 AB <1> stosd 2146 00001D95 AB <1> stosd 2147 <1> ;; Set active page 0 2148 <1> ;mov [ACTIVE_PAGE], al ; 0 2149 <1> _sm_18: 2150 <1> ; 29/07/2016 2151 00001D96 803D[62830100]02 <1> cmp byte [VGA_MTYPE], 2 ; CTEXT, MTEXT 2152 <1> ;jnb _sm_23 2153 <1> ; 04/08/2022 2154 00001D9D 7205 <1> jb short _sm_24 2155 00001D9F E914020000 <1> jmp _set_active_page 2156 <1> _sm_24: 2157 <1> ;cmp byte [CHAR_HEIGHT], 16 2158 <1> ;je short _sm_19 2159 <1> 2160 <1> ;; copy and activate 8x16 font 2161 <1> 2162 <1> ; 26/07/2016 2163 00001DA4 B004 <1> mov al, 04h 2164 <1> ;sub bl, bl 2165 <1> ; AX = 1104H ; Load ROM 8x16 Character Set 2166 <1> ; (BL = font block to load (EGA: 0-3; VGA: 0-7)) 2167 00001DA6 E84C160000 <1> call load_text_8_16_pat 2168 <1> 2169 <1> ; video_func_1103h: 2170 <1> ; biosfn_set_text_block_specifier: 2171 <1> ; BL = font block selector code 2172 <1> ; NOTE: TRDOS 386 only uses and sets font block 0 2173 <1> ; (It is as BL = 0 for TRDOS 386) 2174 00001DAB 66BAC403 <1> mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 2175 <1> ;;mov ah, bl 2176 <1> ;sub ah, ah ; 0 2177 <1> ;mov al, 03h 2178 <1> ; 19/11/2020 2179 00001DAF 66B80300 <1> mov ax, 03h 2180 00001DB3 66EF <1> out dx, ax 2181 <1> _sm_19: 2182 <1> ; 29/07/2016 2183 <1> ; 26/07/2016 2184 <1> ; 24/06/2016 2185 <1> ;mov edi, 0B8000h 2186 <1> ;mov cx, 4000h ; 16K words (32K) 2187 <1> ; 2188 00001DB5 30C0 <1> xor al, al 2189 00001DB7 3805[49830100] <1> cmp [p_crt_mode], al ; 0 2190 00001DBD 7705 <1> ja short _sm_20 ; 03h, 80h or 83h 2191 <1> 2192 <1> ; case 1 - 19/11/2020 2193 <1> ; 2194 <1> ; If [pc_crt_mode] = 0, that means, previous mode is 03h 2195 <1> ; and current mode is not 03h (case 1) 2196 <1> 2197 <1> ; 30/07/2016 2198 <1> ; 24/06/2016 2199 <1> ; TRDOS 386 (TRDOS v2) 'set mode' modification 2200 <1> ; (for multiscreen feature): 2201 <1> ; If '_set_mode' procedure is called for video mode 3 2202 <1> ; while video mode is 3, video page will be cleared 2203 <1> ; and cursor position of video page will be reset. 2204 <1> ; If '_set_mode' procedure is called for a video mode 2205 <1> ; except video mode 3, while current video mode 2206 <1> ; is 3, all video pages of mode 3 will be copied 2207 <1> ; to 98000h address as backup, before mode change. 2208 <1> ; If '_set_mode' procedure is called for video mode 3 2209 <1> ; while video mode is not 3 and if there is video 2210 <1> ; page backup for video mode 3, all (of 8) mode 3 2211 <1> ; video pages will be restored from 98000h. 2212 <1> 2213 <1> ; 19/11/2020 2214 <1> ;mov [ACTIVE_PAGE], al ; 0 2215 <1> 2216 <1> ; Here, 2217 <1> ; video memory already cleared if [noclearmem] <> 80h 2218 <1> 2219 <1> ;mov ax, 0720h 2220 <1> ;mov cx, 4000h ; 16K words (32K) 2221 <1> ;mov edi, 0B8000h 2222 <1> ;rep stosw 2223 <1> ;sub al, al 2224 <1> 2225 <1> ;jmp short _sm_23 2226 <1> 2227 <1> ; Set hardware side for the new active video page 2228 <1> 2229 00001DBF E9F4010000 <1> jmp _set_active_page ; 19/11/2020 2230 <1> 2231 <1> _sm_20: 2232 <1> ; 19/11/2020 2233 <1> ; case 2 or case 3 or case 4 - 19/11/2020 2234 <1> 2235 <1> ; 19/11/2020 2236 00001DC4 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; new video mode 2237 00001DCB 754E <1> jne short _sm_22 ; al = 0 (& video mode <> 03h) 2238 <1> ; case 4 - 19/11/2020 2239 <1> ; ([p_crt_mode] = 83h) 2240 <1> 2241 <1> ; case 2 or case 3 - 19/11/2020 2242 <1> 2243 <1> ;movzx ebx, byte [ACTIVE_PAGE] 2244 <1> ; 19/11/2020 2245 00001DCD A0[4A830100] <1> mov al, [p_crt_page] ; previous mode 3 active page 2246 <1> ;movzx ebx, al 2247 <1> ;shl bl, 1 ; * 2 2248 <1> ;add ebx, CURSOR_POSN 2249 <1> 2250 <1> ; 29/07/2016 2251 00001DD2 F605[49830100]7F <1> test byte [p_crt_mode], 7Fh ; 83h or 80h or 03h 2252 00001DD9 740F <1> jz short _sm_21 ; do not restore video pages 2253 <1> ; case 2 - 19/11/2020 2254 <1> ; case 3 - 19/11/2020 2255 <1> 2256 <1> ; ([p_crt_mode] = 03h) 2257 <1> 2258 <1> ; New video mode is 3 while current video mode is not 3 2259 <1> ; (multi screen) video pages will be restored from 098000h 2260 <1> 2261 <1> ; 19/11/2020 2262 00001DDB A2[DE760100] <1> mov [ACTIVE_PAGE], al ; current mode 3 active page 2263 <1> 2264 <1> ; 12/12/2020 2265 <1> ;; restore video pages 2266 <1> ;mov esi, 98000h ; 30/07/2016 2267 <1> ;mov edi, 0B8000h 2268 <1> ;mov cx, 2000h ; 8K dwords (32K) 2269 <1> ;rep movsd 2270 <1> ; 2271 <1> ;; 19/11/2020 2272 <1> ;mov [p_crt_mode], cl ; reset ('case 3' end condition) 2273 <1> ; 2274 <1> ;; restore cursor positions 2275 <1> ;mov esi, cursor_pposn 2276 <1> ;mov edi, CURSOR_POSN 2277 <1> ;;mov ecx, 4 ; restore all cursor positions (16 bytes) 2278 <1> ;mov cl, 4 2279 <1> ;rep movsd 2280 <1> 2281 <1> ; 12/12/2020 2282 00001DE0 E89A000000 <1> call _restore_mode3_multiscreen 2283 <1> 2284 <1> ;jmp short _sm_23 ; do not clear current video pages 2285 <1> 2286 <1> ; 19/11/2020 2287 00001DE5 E9CE010000 <1> jmp _set_active_page 2288 <1> 2289 <1> _sm_21: 2290 <1> ; 19/11/2020 2291 <1> ; case 2 2292 <1> ; 2293 <1> ; ([p_crt_mode] = 80h) 2294 <1> ; 2295 <1> ; User has requested to set video mode 3 again while 2296 <1> ; current video mode is 3.. that means, set mode 03h 2297 <1> ; parameters again and clear video page. 2298 <1> ; ('noclearmem' option effects the result) 2299 <1> 2300 <1> ; 19/11/2020 2301 00001DEA F605[4B830100]80 <1> test byte [noclearmem], 80h 2302 00001DF1 7528 <1> jnz short _sm_22 ; 'do not clear video memory' 2303 <1> ; continue with current text 2304 <1> ; (user's option/choice) 2305 <1> ; clear video page 2306 <1> ;mov cx, [CRT_LEN] ; 4096 2307 <1> ;shr cx, 1 ; 2048 ; 16/11/2020 2308 00001DF3 66B82007 <1> mov ax, 0720h 2309 <1> ; 26/11/2020 2310 <1> ;mov ecx, 2048 ; 4096/2 2311 <1> ; 02/08/2022 2312 00001DF7 29C9 <1> sub ecx, ecx 2313 00001DF9 B508 <1> mov ch, 08h 2314 <1> ; ecx = 0800h 2315 00001DFB BF00800B00 <1> mov edi, 0B8000h ; [crt_base] 2316 00001E00 66033D[CC760100] <1> add di, [CRT_START] 2317 00001E07 66F3AB <1> rep stosw ; FILL THE REGEN BUFFER WITH BLANKS 2318 <1> ; 2319 <1> ; 19/11/2020 2320 00001E0A A0[DE760100] <1> mov al, [ACTIVE_PAGE] ; 0 to 7 (for video mode 3) 2321 00001E0F 0FB6D8 <1> movzx ebx, al 2322 00001E12 D0E3 <1> shl bl, 1 2323 00001E14 66898B[CE760100] <1> mov [ebx+CURSOR_POSN], cx ; reset cursor position 2324 <1> _sm_22: 2325 <1> ;mov [p_crt_mode], al ; 0 ; reset 2326 <1> ; 19/11/2020 2327 <1> ;and byte [p_crt_mode], 3 ; 83h -> 3, 80h -> 0 2328 00001E1B 8025[49830100]7F <1> and byte [p_crt_mode], 7Fh ; 83h -> 3, 80h -> 0 2329 <1> _sm_23: 2330 <1> ; al = video page number 2331 <1> ; [CRT_LEN] = length of regen buffer in bytes 2332 <1> ;call _set_active_page 2333 <1> ; 16/11/2020 2334 00001E22 E991010000 <1> jmp _set_active_page 2335 <1> 2336 <1> ;----- NORMAL RETURN FROM ALL VIDEO RETURNS 2337 <1> ;retn 2338 <1> 2339 <1> save_mode3_multiscreen: 2340 <1> ; 02/08/2022 (TRDOS v2.0.5) 2341 <1> ; 12/12/2020 (TRDOS v2.0.3) 2342 <1> ; save mode 03h video pages and cursor positions 2343 <1> ; 2344 <1> ; Modified registers: ecx (=0), esi, edi 2345 <1> 2346 <1> ; 12/12/2020 2347 <1> ; moved here from '_set_mode' 2348 <1> ; 03/07/2016 2349 <1> ; save video pages 2350 00001E27 BE00800B00 <1> mov esi, 0B8000h 2351 00001E2C BF00800900 <1> mov edi, 98000h ; 30/07/2016 2352 <1> ;mov ecx, (0B8000h-0B0000h)/4 2353 <1> ; 02/08/2022 2354 00001E31 29C9 <1> sub ecx, ecx 2355 00001E33 B520 <1> mov ch, 20h 2356 <1> ; ecx = 2000h 2357 00001E35 F3A5 <1> rep movsd 2358 <1> 2359 00001E37 C605[49830100]03 <1> mov byte [p_crt_mode], 3 ; previous mode, backup sign 2360 <1> ; 26/11/2020 2361 00001E3E 860D[DE760100] <1> xchg cl, [ACTIVE_PAGE] 2362 00001E44 880D[4A830100] <1> mov [p_crt_page], cl ; save as previous active page 2363 <1> 2364 <1> ; save cursor positions 2365 00001E4A BE[CE760100] <1> mov esi, CURSOR_POSN 2366 00001E4F BF[4E830100] <1> mov edi, cursor_pposn ; cursor positions backup 2367 00001E54 B104 <1> mov cl, 4 2368 00001E56 F3A5 <1> rep movsd 2369 00001E58 C3 <1> retn 2370 <1> 2371 <1> restore_mode3_multiscreen: 2372 <1> ; 02/08/2022 (TRDOS v2.0.5) 2373 <1> ; 12/12/2020 (TRDOS v2.0.3) 2374 <1> ; restore mode 03h video pages and cursor positions 2375 <1> ; 2376 <1> ; Input: 2377 <1> ; settings from the last 'save_mode3_multiscreen' 2378 <1> ; 2379 <1> ; Output: 2380 <1> ; AL = active video page = [ACTIVE_PAGE] 2381 <1> ; 2382 <1> ; Modified registers: al, ecx (=0), esi, edi 2383 <1> 2384 00001E59 A0[4A830100] <1> mov al, [p_crt_page] ; previous mode 3 active page 2385 00001E5E A2[DE760100] <1> mov [ACTIVE_PAGE], al ; current mode 3 active page 2386 <1> 2387 <1> ; 12/12/2020 2388 <1> ; moved here from 'vesa_vbe3_pmi' 2389 <1> 2390 <1> ; 07/12/2020 2391 <1> ; restore CRT_START according to ACTIVE_PAGE 2392 <1> ;mov [CRT_START], cx ; 0 2393 <1> ; 12/12/2020 2394 00001E63 66C705[CC760100]00- <1> mov word [CRT_START], 0 2394 00001E6B 00 <1> 2395 <1> 2396 <1> ; check active page and set it again if it is not 0 2397 00001E6C 08C0 <1> or al, al 2398 <1> ;;jz short vbe3_pmi_7 2399 <1> ;jz short _restore_mode3_multiscreen 2400 00001E6E 740F <1> jz short r_m3_ms_1 2401 00001E70 88C1 <1> mov cl, al 2402 <1> ;vbe3_pmi_5: 2403 <1> r_m3_ms_0: 2404 00001E72 668105[CC760100]00- <1> add word [CRT_START], 4096 2404 00001E7A 10 <1> 2405 00001E7B FEC9 <1> dec cl 2406 <1> ;jnz short vbe3_pmi_5 2407 00001E7D 75F3 <1> jnz short r_m3_ms_0 2408 <1> r_m3_ms_1: 2409 <1> ; 12/12/2020 2410 <1> ; moved here from '_set_mode' 2411 <1> _restore_mode3_multiscreen: 2412 <1> ; Modified registers: ecx, esi, edi 2413 <1> 2414 <1> ; restore video pages 2415 00001E7F BE00800900 <1> mov esi, 98000h ; 30/07/2016 2416 00001E84 BF00800B00 <1> mov edi, 0B8000h 2417 <1> ;mov cx, 2000h ; 8K dwords (32K) 2418 <1> ;mov ecx, 2000h 2419 <1> ; 02/08/2022 2420 00001E89 29C9 <1> sub ecx, ecx 2421 00001E8B B520 <1> mov ch, 20h 2422 <1> ; ecx = 2000h 2423 00001E8D F3A5 <1> rep movsd 2424 <1> 2425 <1> ; 19/11/2020 2426 00001E8F 880D[49830100] <1> mov [p_crt_mode], cl ; reset ('case 3' end condition) 2427 <1> 2428 <1> ; restore cursor positions 2429 00001E95 BE[4E830100] <1> mov esi, cursor_pposn 2430 00001E9A BF[CE760100] <1> mov edi, CURSOR_POSN 2431 <1> ;mov ecx, 4 ; restore all cursor positions (16 bytes) 2432 00001E9F B104 <1> mov cl, 4 2433 00001EA1 F3A5 <1> rep movsd 2434 00001EA3 C3 <1> retn 2435 <1> 2436 <1> cursor_shape_fix: 2437 <1> ; 12/04/2021 2438 <1> ; 07/07/2016 2439 <1> ; (Cursor start and cursor end line values -6,7- 2440 <1> ; will be fixed depending on character height) 2441 <1> ; 2442 <1> ; derived from 'Plex86/Bochs VGABios' source code 2443 <1> ; vgabios-0.7a (2011) 2444 <1> ; by the LGPL VGABios developers Team (2001-2008) 2445 <1> ; 'vgabios.c', ' biosfn_set_cursor_shape (CH,CL)' 2446 <1> ; 2447 <1> ; INPUT -> 2448 <1> ; AL = cursor start line (=6) 2449 <1> ; AH = cursor end line (=7) 2450 <1> ; OUTPUT -> 2451 <1> ; AL = cursor start line (=14) 2452 <1> ; AH = cursor end line (=15) 2453 <1> ; 2454 <1> ;; if((modeset_ctl&0x01)&&(cheight>8)&&(CL<8)&&(CH<0x20)) 2455 <1> 2456 <1> ;test byte [VGA_MODESET_CTL], 1 ; VGA active 2457 <1> ;jz short csf_3 2458 00001EA4 803D[32680000]08 <1> cmp byte [CHAR_HEIGHT], 8 2459 00001EAB 7647 <1> jna short csf_3 2460 00001EAD 80FC08 <1> cmp ah, 8 2461 00001EB0 7342 <1> jnb short csf_3 2462 00001EB2 3C20 <1> cmp al, 20h 2463 00001EB4 733E <1> jnb short csf_3 2464 <1> ; 2465 <1> ;push ax 2466 <1> ; 12/04/2021 2467 00001EB6 50 <1> push eax 2468 <1> ; { 2469 <1> ; if(CL!=(CH+1)) 2470 00001EB7 FEC0 <1> inc al 2471 00001EB9 38C4 <1> cmp ah, al ; ah != al + 1 2472 00001EBB 740F <1> je short csf_1 2473 <1> ; CH = ((CH+1) * cheight / 8) -1; 2474 00001EBD 8A25[32680000] <1> mov ah, [CHAR_HEIGHT] 2475 00001EC3 F6E4 <1> mul ah 2476 00001EC5 C0E803 <1> shr al, 3 ; / 8 2477 00001EC8 FEC8 <1> dec al ; - 1 2478 00001ECA EB0E <1> jmp short csf_2 2479 <1> csf_1: 2480 <1> ; } 2481 <1> ; else ; ah = al + 1 2482 <1> ; { 2483 00001ECC FEC4 <1> inc ah ; ah = ah + 1 2484 <1> ; CH = ((CL+1) * cheight / 8) - 2; 2485 00001ECE A0[32680000] <1> mov al, [CHAR_HEIGHT] 2486 00001ED3 F6E4 <1> mul ah 2487 00001ED5 C0E803 <1> shr al, 3 ; / 8 2488 00001ED8 2C02 <1> sub al, 2 ; - 2 2489 <1> ; al = 14 (if [CHAR_HEIGHT] = 16) 2490 <1> csf_2: 2491 00001EDA 880424 <1> mov [esp], al 2492 00001EDD 8A642401 <1> mov ah, [esp+1] 2493 <1> ; CL = ((CL+1) * cheight / 8) - 1; 2494 00001EE1 FEC4 <1> inc ah 2495 00001EE3 A0[32680000] <1> mov al, [CHAR_HEIGHT] 2496 00001EE8 F6E4 <1> mul ah 2497 00001EEA C0E803 <1> shr al, 3 ; / 8 2498 00001EED FEC8 <1> dec al ; - 1 2499 00001EEF 88442401 <1> mov [esp+1], al 2500 <1> ; ah = 15 (if [CHAR_HEIGHT] = 16) 2501 <1> ; 2502 <1> ;pop ax 2503 <1> ; 12/04/2021 2504 00001EF3 58 <1> pop eax 2505 <1> csf_3: 2506 00001EF4 C3 <1> retn 2507 <1> 2508 <1> SET_CTYPE: 2509 <1> ; 04/08/2022 (TRDOS 386 v2.0.5) 2510 <1> ; 12/09/2016 2511 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2512 00001EF5 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 2513 <1> ;ja VIDEO_RETURN ; 12/09/2016 2514 <1> ; 04/08/2022 2515 00001EFC 7738 <1> ja short set_cpos_inv_vp 2516 00001EFE E805000000 <1> call _set_ctype 2517 00001F03 E963FCFFFF <1> jmp VIDEO_RETURN 2518 <1> 2519 <1> _set_ctype: 2520 <1> ; 02/09/2014 (Retro UNIX 386 v1) 2521 <1> ; 2522 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2523 <1> 2524 <1> ; (CH) = BITS 4-0 = START LINE FOR CURSOR 2525 <1> ; ** HARDWARE WILL ALWAYS CAUSE BLINK 2526 <1> ; ** SETTING BIT 5 OR 6 WILL CAUSE ERRATIC BLINKING 2527 <1> ; OR NO CURSOR AT ALL 2528 <1> ; (CL) = BITS 4-0 = END LINE FOR CURSOR 2529 <1> 2530 <1> ;------------------------------------------------ 2531 <1> ; SET_CTYPE 2532 <1> ; THIS ROUTINE SETS THE CURSOR VALUE 2533 <1> ; INPUT 2534 <1> ; (CX) HAS CURSOR VALUE CH-START LINE, CL-STOP LINE 2535 <1> ; OUTPUT 2536 <1> ; NONE 2537 <1> ;------------------------------------------------ 2538 <1> 2539 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 2540 <1> ; 2541 <1> ; 07/07/2016 2542 <1> ; Fixing cursor start and stop line depending on 2543 <1> ; current character height (=16) 2544 <1> ; (Note: Default/initial values are 6 and 7. 2545 <1> ; If set values are 6 (start) & 7 (stop) and 2546 <1> ; [CHAR_HEIGHT] = 16 : 2547 <1> ; After fixing, start line will be 14, stop line 2548 <1> ; will be 15.) 2549 <1> 2550 <1> ;mov ax, cx 2551 <1> ; 02/08/2022 2552 00001F08 89C8 <1> mov eax, ecx 2553 <1> 2554 00001F0A 86C4 <1> xchg al, ah 2555 <1> ; AL = start line, AH = stop line 2556 00001F0C E893FFFFFF <1> call cursor_shape_fix 2557 <1> ; AL = start line (fixed), AH = stop line (fixed) 2558 <1> ;mov cx, ax 2559 <1> ; 02/08/2022 2560 00001F11 89C1 <1> mov ecx, eax 2561 00001F13 86E9 <1> xchg ch, cl 2562 <1> ; CH = start line (fixed), CL = stop line (fixed) 2563 <1> ; 2564 00001F15 B40A <1> mov ah, 10 ; 6845 register for cursor set 2565 00001F17 66890D[47680000] <1> mov [CURSOR_MODE], cx ; save in data area 2566 <1> ;call m16 ; output cx register 2567 <1> ;retn 2568 00001F1E E97F040000 <1> jmp m16 2569 <1> 2570 <1> SET_CPOS: 2571 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 2572 <1> ; 12/09/2016 2573 <1> ; 07/07/2016 2574 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2575 00001F23 80FF07 <1> cmp bh, 7 ; video page > 7 ; 07/07/2016 2576 <1> ;ja VIDEO_RETURN 2577 <1> ; 02/08/2022 2578 00001F26 770E <1> ja short set_cpos_inv_vp 2579 <1> ; 2580 00001F28 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 2581 00001F2F 770A <1> ja short vga_set_cpos ; 12/09/2016 2582 00001F31 E841040000 <1> call _set_cpos 2583 <1> set_cpos_inv_vp: ; 02/08/2022 2584 00001F36 E930FCFFFF <1> jmp VIDEO_RETURN 2585 <1> 2586 <1> vga_set_cpos: 2587 <1> ; 12/09/2016 2588 <1> ; 09/07/2016 2589 <1> ; set cursor position 2590 <1> ; NOTE: Hardware cursor position will not be set 2591 <1> ; in any VGA modes (>7) 2592 <1> ; But, cursor position will be saved into 2593 <1> ; [CURSOR_POSN]. 2594 <1> ; TRDOS 386 (TRDOS v2.0) uses only one page 2595 <1> ; (page 0) for all graphics modes. 2596 <1> 2597 00001F3B 668915[CE760100] <1> mov [CURSOR_POSN], dx ; save cursor pos for pg 0 2598 <1> ; 04/08/2016 2599 <1> ;mov bh, [ACTIVE_PAGE] ; = 0 2600 <1> ;call _set_cpos 2601 00001F42 E924FCFFFF <1> jmp VIDEO_RETURN 2602 <1> 2603 <1> READ_CURSOR: 2604 <1> ; 12/09/2016 2605 <1> ; 07/07/2016 2606 <1> ; 12/05/2016 2607 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2608 <1> ; 2609 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2610 <1> 2611 <1> ;------------------------------------------------------ 2612 <1> ; READ_CURSOR 2613 <1> ; THIS ROUTINE READS THE CURRENT CURSOR VALUE FROM THE 2614 <1> ; 845, FORMATS IT, AND SENDS IT BACK TO THE CALLER 2615 <1> ; INPUT 2616 <1> ; BH - PAGE OF CURSOR 2617 <1> ; OUTPUT 2618 <1> ; DX - ROW, COLUMN OF THE CURRENT CURSOR POSITION 2619 <1> ; CX - CURRENT CURSOR MODE 2620 <1> ;------------------------------------------------------ 2621 <1> 2622 <1> ; BH = Video page number (0 to 7) 2623 <1> 2624 <1> ; 07/07/2016 2625 00001F47 80FF07 <1> cmp bh, 7 ; video page > 7 (invalid) 2626 00001F4A 7606 <1> jna short read_cursor_1 2627 <1> ; invalid video page (input) 2628 00001F4C 31C9 <1> xor ecx, ecx ; 0 2629 00001F4E 31D2 <1> xor edx, edx ; 0 2630 00001F50 EB15 <1> jmp short read_cursor_2 2631 <1> read_cursor_1: 2632 <1> ; 12/09/2016 2633 00001F52 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; vga mode 2634 00001F59 772F <1> ja short vga_get_cpos 2635 <1> ; 2636 00001F5B E81D000000 <1> call get_cpos 2637 00001F60 0FB70D[47680000] <1> movzx ecx, word [CURSOR_MODE] 2638 <1> read_cursor_2: 2639 00001F67 5D <1> pop ebp 2640 00001F68 5F <1> pop edi 2641 00001F69 5E <1> pop esi 2642 00001F6A 5B <1> pop ebx 2643 00001F6B 58 <1> pop eax ; DISCARD SAVED CX AND DX 2644 00001F6C 58 <1> pop eax 2645 <1> ; 2646 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 2647 <1> ; restore previous (user's) cr3 2648 00001F6D A1[60770100] <1> mov eax, [cr3prev] 2649 00001F72 0F22D8 <1> mov cr3, eax 2650 <1> ; 2651 00001F75 A1[3C830100] <1> mov eax, [video_eax] ; 12/05/2016 2652 <1> ;;15/01/2017 2653 <1> ;;mov byte [intflg], 0 ; 07/01/2017 2654 00001F7A 1F <1> pop ds 2655 00001F7B 07 <1> pop es 2656 00001F7C CF <1> iretd 2657 <1> 2658 <1> get_cpos: 2659 <1> ; 12/05/2016 2660 <1> ; 16/01/2016 2661 <1> ; BH = Video page number (0 to 7) 2662 <1> ; 2663 00001F7D D0E7 <1> shl bh, 1 ; WORD OFFSET 2664 00001F7F 0FB6F7 <1> movzx esi, bh 2665 00001F82 0FB796[CE760100] <1> movzx edx, word [esi+CURSOR_POSN] 2666 00001F89 C3 <1> retn 2667 <1> 2668 <1> vga_get_cpos: 2669 <1> ; 12/09/2016 2670 <1> ; get cursor position (vga) 2671 00001F8A 0FB715[CE760100] <1> movzx edx, word [CURSOR_POSN] ; cursor pos for pg 0 2672 00001F91 31C9 <1> xor ecx, ecx ; Cursor Mode = 0 (invalid) 2673 00001F93 EBD2 <1> jmp short read_cursor_2 2674 <1> 2675 <1> ACT_DISP_PAGE: 2676 <1> ; 07/07/2016 2677 <1> ; 26/06/2016 2678 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2679 <1> ; 2680 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2681 <1> ; 2682 <1> ;----------------------------------------------------- 2683 <1> ; ACT_DISP_PAGE 2684 <1> ; THIS ROUTINE SETS THE ACTIVE DISPLAY PAGE, ALLOWING 2685 <1> ; THE FULL USE OF THE MEMORY SET ASIDE FOR THE VIDEO ATTACHMENT 2686 <1> ; INPUT 2687 <1> ; AL HAS THE NEW ACTIVE DISPLAY PAGE 2688 <1> ; OUTPUT 2689 <1> ; THE 6845 IS RESET TO DISPLAY THAT PAGE 2690 <1> ;----------------------------------------------------- 2691 <1> ; 07/07/2016 2692 00001F95 3C07 <1> cmp al, 7 ; > 7 = invalid video page number 2693 <1> ;ja VIDEO_RETURN 2694 00001F97 7715 <1> ja short adp_2 ; 18/11/2020 2695 <1> ;cmp byte [CRT_MODE], 3 2696 <1> ;je short adp_1 2697 <1> ; 18/11/2020 2698 00001F99 8A25[2E680000] <1> mov ah, [CRT_MODE] 2699 00001F9F 80FC03 <1> cmp ah, 3 2700 00001FA2 7605 <1> jna short adp_1 ; mode 01h, 00h (01h), 02h (03h), 03h 2701 00001FA4 80FC07 <1> cmp ah, 7 ; mode 07h (03h) 2702 00001FA7 7505 <1> jne short adp_2 2703 <1> ;and al, al 2704 <1> ;jnz VIDEO_RETURN 2705 <1> ;;sub al, al ; 0 ; force to page 0 2706 <1> adp_1: 2707 00001FA9 E805000000 <1> call set_active_page 2708 <1> adp_2: 2709 00001FAE E9B8FBFFFF <1> jmp VIDEO_RETURN 2710 <1> 2711 <1> set_active_page: ; tty_sw 2712 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 2713 <1> ; 09/12/2017 2714 <1> ; 26/07/2016 2715 <1> ; 26/06/2016 2716 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2717 <1> ; 30/06/2015 2718 <1> ; 04/03/2014 (act_disp_page --> tty_sw) 2719 <1> ; 10/12/2013 2720 <1> ; 04/12/2013 2721 <1> ; 2722 00001FB3 A2[DE760100] <1> mov [ACTIVE_PAGE], al ; save active page value ; [ptty] 2723 <1> _set_active_page: 2724 <1> ; 27/06/2015 2725 <1> ;movzx ebx, al 2726 <1> ; 02/08/2022 2727 00001FB8 0FB6C0 <1> movzx eax, al 2728 00001FBB 89C3 <1> mov ebx, eax 2729 <1> ; 2730 <1> ;cbw ; 07/09/2014 (ah=0) 2731 <1> ; 02/08/2022 2732 <1> ;sub ah, ah ; 09/12/2017 2733 00001FBD 66F725[4C830100] <1> mul word [CRT_LEN] ; get saved length of regen buffer 2734 <1> ; display page times regen length 2735 <1> ; 10/12/2013 2736 00001FC4 66A3[CC760100] <1> mov [CRT_START], ax ; save start address for later 2737 <1> ;mov cx, ax ; start address to cx 2738 <1> ; 02/08/2022 2739 00001FCA 89C1 <1> mov ecx, eax 2740 <1> _M16: 2741 <1> ;;sar cx, 1 2742 <1> ;shr cx, 1 ; divide by 2 for 6845 handling 2743 <1> ; 02/08/2022 2744 00001FCC D1E9 <1> shr ecx, 1 2745 00001FCE B40C <1> mov ah, 12 ; 6845 register for start address 2746 00001FD0 E8CD030000 <1> call m16 2747 <1> ;sal bx, 1 2748 <1> ; 01/09/2014 2749 00001FD5 D0E3 <1> shl bl, 1 ; *2 for word offset 2750 00001FD7 81C3[CE760100] <1> add ebx, CURSOR_POSN 2751 00001FDD 668B13 <1> mov dx, [ebx] ; get cursor for this page 2752 <1> ; 16/01/2016 2753 <1> ;call m18 2754 <1> ;retn 2755 00001FE0 E9A9030000 <1> jmp m18 2756 <1> 2757 <1> position: 2758 <1> ; 02/08/2022 - TRDOS 386 v2.0.5 2759 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 2760 <1> ; 24/06/2016 2761 <1> ; 12/05/2016 - TRDOS 386 (TRDOS v2.0) 2762 <1> ; 27/06/2015 2763 <1> ; 02/09/2014 2764 <1> ; 30/08/2014 (Retro UNIX 386 v1) 2765 <1> ; 04/12/2013 (Retro UNIX 8086 v1) 2766 <1> ; 2767 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2768 <1> ; 2769 <1> ;----------------------------------------- 2770 <1> ; POSITION 2771 <1> ; THIS SERVICE ROUTINE CALCULATES THE REGEN BUFFER ADDRESS 2772 <1> ; OF A CHARACTER IN THE ALPHA MODE 2773 <1> ; INPUT 2774 <1> ; AX = ROW, COLUMN POSITION 2775 <1> ; OUTPUT 2776 <1> ; AX = OFFSET OF CHAR POSITION IN REGEN BUFFER 2777 <1> ;----------------------------------------- 2778 <1> 2779 <1> ; DX = ROW, COLUMN POSITION 2780 <1> ;movzx eax, byte [CRT_COLS] ; 27/06/2015 2781 00001FE5 31C0 <1> xor eax, eax ; 02/09/2014 2782 00001FE7 B050 <1> mov al, 80 ; determine bytes to row 2783 00001FE9 F6E6 <1> mul dh ; row value 2784 <1> ;xor dh, dh ; 0 2785 <1> ;add ax, dx ; add column value to the result 2786 <1> ; 16/04/2021 2787 00001FEB 00D0 <1> add al, dl 2788 00001FED 80D400 <1> adc ah, 0 2789 <1> ; 02/08/2022 2790 00001FF0 D1E0 <1> shl eax, 1 2791 <1> ;shl ax, 1 ; * 2 for attribute bytes 2792 <1> ; EAX = AX = OFFSET OF CHAR POSITION IN REGEN BUFFER 2793 00001FF2 C3 <1> retn 2794 <1> 2795 <1> find_position: 2796 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 2797 <1> ; 24/06/2016 2798 <1> ; 12/05/2016 - TRDOS 386 (TRDOS v2.0) 2799 <1> ; 27/06/2015 2800 <1> ; 07/09/2014 2801 <1> ; 02/09/2014 2802 <1> ; 30/08/2014 (Retro UNIX 386 v1) 2803 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2804 <1> 2805 00001FF3 0FB6CF <1> movzx ecx, bh ; video page number 2806 <1> ; 17/04/2021 2807 <1> ;mov esi, ecx 2808 <1> ;shl si, 1 2809 <1> ;mov dx, [esi+CURSOR_POSN] 2810 <1> ;jz short p21 2811 <1> ;xor si, si 2812 <1> ; 17/04/2021 2813 00001FF6 31F6 <1> xor esi, esi 2814 00001FF8 D0E1 <1> shl cl, 1 2815 00001FFA 668B91[CE760100] <1> mov dx, [ecx+CURSOR_POSN] 2816 00002001 740B <1> jz short p21 2817 00002003 D0E9 <1> shr cl, 1 2818 <1> p20: 2819 00002005 660335[4C830100] <1> add si, [CRT_LEN] ; 24/06/2016 2820 <1> ;add si, 80*25*2 ; add length of buffer for one page 2821 0000200C E2F7 <1> loop p20 2822 <1> p21: 2823 0000200E 6621D2 <1> and dx, dx 2824 00002011 7407 <1> jz short p22 2825 00002013 E8CDFFFFFF <1> call position ; determine location in regen in page 2826 00002018 01C6 <1> add esi, eax ; add location to start of regen page 2827 <1> p22: 2828 <1> ;mov dx, [addr_6845] ; get base address of active display 2829 <1> ;mov dx, 03D4h ; I/O address of color card 2830 <1> ;add dx, 6 ; point at status port 2831 0000201A 66BADA03 <1> mov dx, 03DAh ; status port 2832 <1> ; cx = 0 2833 0000201E C3 <1> retn 2834 <1> 2835 <1> SCROLL_UP: 2836 <1> ; 04/08/2022 (TRDOS 386 v2.0.5) 2837 <1> ; 07/07/2016 2838 <1> ; 26/06/2016 2839 <1> ; 12/05/2016 2840 <1> ; 30/01/2016 2841 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2842 <1> ; 07/09/2014 2843 <1> ; 02/09/2014 2844 <1> ; 01/09/2014 (Retro UNIX 386 v1 - beginning) 2845 <1> ; 04/04/2014 2846 <1> ; 04/12/2013 2847 <1> ; 2848 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 2849 <1> ; 2850 <1> ;---------------------------------------------- 2851 <1> ; SCROLL UP 2852 <1> ; THIS ROUTINE MOVES A BLOCK OF CHARACTERS UP 2853 <1> ; ON THE SCREEN 2854 <1> ; INPUT 2855 <1> ; (AH) = CURRENT CRT MODE 2856 <1> ; (AL) = NUMBER OF ROWS TO SCROLL 2857 <1> ; (CX) = ROW/COLUMN OF UPPER LEFT CORNER 2858 <1> ; (DX) = ROW/COLUMN OF LOWER RIGHT CORNER 2859 <1> ; (BH) = ATTRIBUTE TO BE USED ON BLANKED LINE 2860 <1> ; (DS) = DATA SEGMENT 2861 <1> ; (ES) = REGEN BUFFER SEGMENT 2862 <1> ; OUTPUT 2863 <1> ; NONE -- THE REGEN BUFFER IS MODIFIED 2864 <1> ;-------------------------------------------- 2865 <1> 2866 <1> ; 07/07/2016 2867 0000201F 38F5 <1> cmp ch, dh 2868 <1> ;ja VIDEO_RETURN 2869 <1> ; 04/08/2022 2870 00002021 7709 <1> ja short _s_u_retn 2871 <1> 2872 00002023 38D1 <1> cmp cl, dl 2873 <1> ;ja VIDEO_RETURN 2874 <1> ; 04/08/2022 2875 00002025 7705 <1> ja short _s_u_retn 2876 <1> ; 2877 00002027 E805000000 <1> call _scroll_up 2878 <1> _s_u_retn: 2879 0000202C E93AFBFFFF <1> jmp VIDEO_RETURN 2880 <1> 2881 <1> _scroll_up: ; from 'write_tty' 2882 <1> ; 2883 <1> ; cl = left upper column 2884 <1> ; ch = left upper row 2885 <1> ; dl = right lower column 2886 <1> ; dh = right lower row 2887 <1> ; 2888 <1> ; al = line count 2889 <1> ; bl = attribute to be used on blanked line 2890 <1> ; bh = video page number (0 to 7) 2891 <1> 2892 00002031 E89B000000 <1> call test_line_count ; 16/01/2016 2893 <1> 2894 00002036 8A25[2E680000] <1> mov ah, [CRT_MODE] ; current video mode 2895 <1> ;;cmp byte [CRT_MODE], 4 2896 <1> ;cmp ah, 4 ; 07/07/2016 2897 <1> ;jnb GRAPHICS_UP ; 26/06/2016 2898 <1> ; 18/11/2020 2899 0000203C 80FC04 <1> cmp ah, 4 2900 0000203F 720A <1> jb short n0 2901 00002041 80FC07 <1> cmp ah, 7 ; TEST FOR BW CARD 2902 <1> ; (80x25 text, mono) 2903 00002044 7405 <1> je short n0 ; same with mode 3 for TRDOS 386 2904 00002046 E91B050000 <1> jmp GRAPHICS_UP 2905 <1> n0: 2906 <1> ; 07/07/2016 2907 0000204B 80FF07 <1> cmp bh, 7 ; video page number 2908 0000204E 7606 <1> jna short n1 2909 00002050 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] 2910 <1> n1: 2911 00002056 88DC <1> mov ah, bl ; attribute 2912 <1> ;push ax ; * 2913 <1> ; 12/04/2021 2914 00002058 50 <1> push eax ; * 2915 <1> ;mov esi, [CRT_BASE] 2916 00002059 BE00800B00 <1> mov esi, 0B8000h 2917 0000205E 3A3D[DE760100] <1> cmp bh, [ACTIVE_PAGE] 2918 00002064 750B <1> jne short n2 2919 <1> ; 2920 00002066 66A1[CC760100] <1> mov ax, [CRT_START] 2921 0000206C 6601C6 <1> add si, ax 2922 0000206F EB11 <1> jmp short n4 2923 <1> n2: 2924 00002071 20FF <1> and bh, bh 2925 00002073 740D <1> jz short n4 2926 00002075 88F8 <1> mov al, bh 2927 <1> n3: 2928 00002077 660335[4C830100] <1> add si, [CRT_LEN] 2929 0000207E FEC8 <1> dec al 2930 00002080 75F5 <1> jnz short n3 2931 <1> n4: 2932 00002082 E85B000000 <1> call scroll_position ; 16/01/2016 2933 00002087 7420 <1> jz short n6 2934 <1> 2935 00002089 01CE <1> add esi, ecx ; from address for scroll 2936 0000208B 88F5 <1> mov ch, dh ; #rows in block 2937 0000208D 28C5 <1> sub ch, al ; #rows to be moved 2938 <1> n5: 2939 0000208F E88A000000 <1> call n10 ; 16/01/2016 2940 <1> 2941 00002094 51 <1> push ecx 2942 00002095 0FB60D[30680000] <1> movzx ecx, byte [CRT_COLS] 2943 0000209C 00C9 <1> add cl, cl 2944 0000209E 01CE <1> add esi, ecx ; next line 2945 000020A0 01CF <1> add edi, ecx 2946 000020A2 59 <1> pop ecx 2947 <1> 2948 000020A3 FECD <1> dec ch ; count of lines to move 2949 000020A5 75E8 <1> jnz short n5 ; row loop 2950 <1> ; ch = 0 2951 000020A7 88C6 <1> mov dh, al ; #rows 2952 <1> n6: 2953 <1> ; attribute in ah 2954 000020A9 B020 <1> mov al, ' ' ; fill with blanks 2955 <1> n7: 2956 000020AB E87B000000 <1> call n11 ; 16/01/2016 2957 <1> 2958 000020B0 8A0D[30680000] <1> mov cl, [CRT_COLS] 2959 000020B6 00C9 <1> add cl, cl 2960 000020B8 01CF <1> add edi, ecx 2961 <1> 2962 000020BA FECE <1> dec dh 2963 000020BC 75ED <1> jnz short n7 2964 <1> n16: 2965 000020BE 3A3D[DE760100] <1> cmp bh, [ACTIVE_PAGE] 2966 000020C4 750A <1> jne short n8 2967 <1> 2968 <1> ;cmp byte [CRT_MODE], 7 ; is this the black and white card 2969 <1> ;je short n8 ; if so, skip the mode reset 2970 <1> 2971 000020C6 A0[2F680000] <1> mov al, [CRT_MODE_SET] ; get the value of mode set 2972 000020CB 66BAD803 <1> mov dx, 03D8h ; always set color card port 2973 000020CF EE <1> out dx, al 2974 <1> n8: 2975 000020D0 C3 <1> retn 2976 <1> 2977 <1> test_line_count: 2978 <1> ; 12/04/2021 2979 <1> ; 12/05/2016 2980 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 2981 <1> ; 07/09/2014 (scroll_up) 2982 000020D1 08C0 <1> or al, al 2983 000020D3 740C <1> jz short al_set2 2984 <1> ;push dx 2985 <1> ; 12/04/2021 2986 000020D5 52 <1> push edx 2987 000020D6 28EE <1> sub dh, ch ; subtract upper row from lower row number 2988 000020D8 FEC6 <1> inc dh ; adjust difference by 1 2989 000020DA 38C6 <1> cmp dh, al ; line count = amount of rows in window? 2990 000020DC 7502 <1> jne short al_set1 ; if not the we're all set 2991 000020DE 30C0 <1> xor al, al ; otherwise set al to zero 2992 <1> al_set1: 2993 <1> ;pop dx 2994 <1> ; 12/04/2021 2995 000020E0 5A <1> pop edx 2996 <1> al_set2: 2997 000020E1 C3 <1> retn 2998 <1> 2999 <1> scroll_position: 3000 <1> ; 12/04/2021 3001 <1> ; 26/06/2016 3002 <1> ; 30/01/2016 3003 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3004 <1> ; 07/09/2014 (scroll_up) 3005 <1> 3006 <1> ; (*) [esp+4] = ax (al = line count, ah = attribute) 3007 <1> 3008 <1> ;push dx 3009 <1> ; 12/04/2021 3010 000020E2 52 <1> push edx 3011 000020E3 6689CA <1> mov dx, cx ; now, upper left position in DX 3012 000020E6 E8FAFEFFFF <1> call position 3013 000020EB 01C6 <1> add esi, eax 3014 000020ED 89F7 <1> mov edi, esi 3015 <1> ;pop dx ; lower right position in DX 3016 <1> ; 12/04/2021 3017 000020EF 5A <1> pop edx 3018 000020F0 6629CA <1> sub dx, cx 3019 000020F3 FEC6 <1> inc dh ; dh = #rows 3020 000020F5 FEC2 <1> inc dl ; dl = #cols in block 3021 000020F7 59 <1> pop ecx ; return address 3022 <1> ;pop ax ; * ; al = line count, ah = attribute 3023 <1> ; 12/04/2021 3024 000020F8 58 <1> pop eax ; (*) 3025 000020F9 51 <1> push ecx ; return address 3026 000020FA 0FB7C8 <1> movzx ecx, ax 3027 000020FD 8A25[30680000] <1> mov ah, [CRT_COLS] 3028 00002103 F6E4 <1> mul ah ; determine offset to from address 3029 <1> ;add ax, ax ; *2 for attribute byte 3030 <1> ; 02/08/2022 3031 <1> ;shl eax, 1 3032 00002105 01C0 <1> add eax, eax 3033 <1> ; 3034 <1> ;push ax ; offset 3035 <1> ;push dx 3036 <1> ; 12/04/2021 3037 00002107 50 <1> push eax ; offset 3038 00002108 52 <1> push edx 3039 <1> ; 3040 <1> ; 04/04/2014 3041 00002109 66BADA03 <1> mov dx, 3DAh ; guaranteed to be color card here 3042 <1> n9: ; wait_display_enable 3043 0000210D EC <1> in al, dx ; get port 3044 0000210E A808 <1> test al, RVRT ; wait for vertical retrace 3045 00002110 74FB <1> jz short n9 ; wait_display_enable 3046 00002112 B025 <1> mov al, 25h 3047 00002114 B2D8 <1> mov dl, 0D8h ; address control port 3048 00002116 EE <1> out dx, al ; turn off video during vertical retrace 3049 <1> ;pop dx ; #rows, #cols 3050 <1> ;pop ax ; offset 3051 <1> ; 12/04/2021 3052 00002117 5A <1> pop edx ; #rows, #cols 3053 00002118 58 <1> pop eax ; offset 3054 00002119 6691 <1> xchg ax, cx ; 3055 <1> ; ecx = offset, al = line count, ah = attribute 3056 <1> ; 3057 0000211B 08C0 <1> or al, al 3058 0000211D C3 <1> retn 3059 <1> n10: 3060 <1> ; Move rows 3061 0000211E 88D1 <1> mov cl, dl ; get # of cols to move 3062 00002120 56 <1> push esi 3063 00002121 57 <1> push edi ; save start address 3064 <1> n10r: 3065 00002122 66A5 <1> movsw ; move that line on screen 3066 00002124 FEC9 <1> dec cl 3067 00002126 75FA <1> jnz short n10r 3068 00002128 5F <1> pop edi 3069 00002129 5E <1> pop esi ; recover addresses 3070 0000212A C3 <1> retn 3071 <1> n11: 3072 <1> ; Clear rows 3073 <1> ; dh = #rows 3074 0000212B 88D1 <1> mov cl, dl ; get # of cols to clear 3075 0000212D 57 <1> push edi ; save address 3076 <1> n11r: 3077 0000212E 66AB <1> stosw ; store fill character 3078 00002130 FEC9 <1> dec cl 3079 00002132 75FA <1> jnz short n11r 3080 00002134 5F <1> pop edi ; recover address 3081 00002135 C3 <1> retn 3082 <1> 3083 <1> SCROLL_DOWN: 3084 <1> ; 12/04/2021 3085 <1> ; 07/07/2016 3086 <1> ; 27/06/2016 3087 <1> ; 26/06/2016 3088 <1> ; 12/05/2016 3089 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3090 <1> ; 3091 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3092 <1> 3093 <1> ;------------------------------------------ 3094 <1> ; SCROLL DOWN 3095 <1> ; THIS ROUTINE MOVES THE CHARACTERS WITHIN A DEFINED 3096 <1> ; BLOCK DOWN ON THE SCREEN, FILLING THE TOP LINES 3097 <1> ; WITH A DEFINED CHARACTER 3098 <1> ; INPUT 3099 <1> ; (AH) = CURRENT CRT MODE 3100 <1> ; (AL) = NUMBER OF LINES TO SCROLL 3101 <1> ; (CX) = UPPER LEFT CORNER OF RECION 3102 <1> ; (DX) = LOWER RIGHT CORNER OF REGION 3103 <1> ; (BH) = FILL CHARACTER 3104 <1> ; (DS) = DATA SEGMENT 3105 <1> ; (ES) = REGEN SEGMENT 3106 <1> ; OUTPUT 3107 <1> ; NONE -- SCREEN IS SCROLLED 3108 <1> ;------------------------------------------ 3109 <1> 3110 <1> ; 07/07/2016 3111 00002136 38F5 <1> cmp ch, dh 3112 <1> ;ja VIDEO_RETURN 3113 00002138 7709 <1> ja short _s_d_retn ; 18/11/2020 3114 0000213A 38D1 <1> cmp cl, dl 3115 <1> ;ja VIDEO_RETURN 3116 0000213C 7705 <1> ja short _s_d_retn ; 18/11/2020 3117 <1> ; 3118 0000213E E805000000 <1> call _scroll_down 3119 <1> _s_d_retn: 3120 00002143 E923FAFFFF <1> jmp VIDEO_RETURN 3121 <1> 3122 <1> _scroll_down: ; 27/06/2016 3123 <1> 3124 <1> ; cl = left upper column 3125 <1> ; ch = left upper row 3126 <1> ; dl = right lower column 3127 <1> ; dh = right lower row 3128 <1> ; 3129 <1> ; al = line count 3130 <1> ; bl = attribute to be used on blanked line 3131 <1> ; bh = video page number (0 to 7) 3132 <1> 3133 <1> ; !!!! 3134 00002148 FD <1> std ; DIRECTION FOR SCROLL DOWN 3135 <1> ; !!!! 3136 00002149 E883FFFFFF <1> call test_line_count ; 16/01/2016 3137 <1> 3138 0000214E 8A25[2E680000] <1> mov ah, [CRT_MODE] ; current video mode 3139 <1> ;;cmp byte [CRT_MODE], 4 3140 <1> ;cmp ah, 4 ; 07/07/2016 3141 <1> ;jnb GRAPHICS_DOWN ; 26/06/2016 3142 <1> ; 18/11/2020 3143 00002154 80FC04 <1> cmp ah, 4 3144 00002157 720A <1> jb short _n0 3145 00002159 80FC07 <1> cmp ah, 7 ; TEST FOR BW CARD 3146 <1> ; (80x25 text, mono) 3147 0000215C 7405 <1> je short _n0 ; same with mode 3 for TRDOS 386 3148 0000215E E9D5060000 <1> jmp GRAPHICS_DOWN 3149 <1> _n0: 3150 <1> ; 07/07/2016 3151 00002163 80FF07 <1> cmp bh, 7 ; video page number 3152 00002166 7606 <1> jna short n12 3153 00002168 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] 3154 <1> ; 3155 <1> n12: ; CONTINUE_DOWN 3156 0000216E 88DC <1> mov ah, bl 3157 <1> ;push ax ; * ; save attribute in ah 3158 <1> ; 12/04/2021 3159 00002170 50 <1> push eax 3160 00002171 6689D0 <1> mov ax, dx ; LOWER RIGHT CORNER 3161 00002174 E869FFFFFF <1> call scroll_position ; GET REGEN LOCATION 3162 00002179 741F <1> jz short n14 3163 0000217B 29CE <1> sub esi, ecx ; SI IS FROM ADDRESS 3164 0000217D 88F5 <1> mov ch, dh ; #rows in block 3165 0000217F 28C5 <1> sub ch, al ; #rows to be moved 3166 <1> n13: 3167 00002181 E898FFFFFF <1> call n10 ; MOVE ONE ROW 3168 <1> 3169 00002186 51 <1> push ecx 3170 00002187 8A0D[30680000] <1> mov cl, [CRT_COLS] 3171 0000218D 00C9 <1> add cl, cl 3172 0000218F 29CE <1> sub esi, ecx ; next line 3173 00002191 29CF <1> sub edi, ecx 3174 00002193 59 <1> pop ecx 3175 <1> 3176 00002194 FECD <1> dec ch ; count of lines to move 3177 00002196 75E9 <1> jnz short n13 ; row loop 3178 <1> ; ch = 0 3179 00002198 88C6 <1> mov dh, al ; #rows 3180 <1> n14: 3181 <1> ; attribute in ah 3182 0000219A B020 <1> mov al, ' ' ; fill with blanks 3183 <1> n15: 3184 0000219C E88AFFFFFF <1> call n11 ; 16/01/2016 3185 <1> 3186 000021A1 8A0D[30680000] <1> mov cl, [CRT_COLS] 3187 000021A7 00C9 <1> add cl, cl 3188 000021A9 29CF <1> sub edi, ecx 3189 <1> 3190 000021AB FECE <1> dec dh 3191 000021AD 75ED <1> jnz short n15 3192 <1> ; 3193 <1> ; 18/11/2020 3194 000021AF FC <1> cld ; clear direction flag 3195 <1> ; 3196 000021B0 E909FFFFFF <1> jmp n16 ; 27/06/2016 3197 <1> 3198 <1> ; cmp bh, [ACTIVE_PAGE] 3199 <1> ; jne short n16 3200 <1> ; 3201 <1> ; ;cmp byte [CRT_MODE], 7 ; is this the black and white card 3202 <1> ; ;je short n16 ; if so, skip the mode reset 3203 <1> ; 3204 <1> ; mov al, [CRT_MODE_SET] ; get the value of mode set 3205 <1> ; mov dx, 03D8h ; always set color card port 3206 <1> ; out dx, al 3207 <1> ;n16: 3208 <1> ; ; !!!! 3209 <1> ; cld ; Clear direction flag ! 3210 <1> ; ; !!!! 3211 <1> ; retn 3212 <1> 3213 <1> READ_AC_CURRENT: 3214 <1> ; 08/07/2016 3215 <1> ; 26/06/2016 3216 <1> ; 12/05/2016 3217 <1> ; 18/01/2016 3218 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3219 <1> ; 3220 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3221 <1> ; 3222 <1> ; 08/07/2016 3223 000021B5 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; 6!? 3224 000021BC 7607 <1> jna short read_ac_c 3225 000021BE 31C0 <1> xor eax, eax 3226 000021C0 E9ABF9FFFF <1> jmp _video_return 3227 <1> read_ac_c: 3228 000021C5 E805000000 <1> call _read_ac_current 3229 <1> ; 12/05/2016 3230 <1> ;jmp VIDEO_RETURN 3231 000021CA E9A1F9FFFF <1> jmp _video_return 3232 <1> 3233 <1> ;------------------------------------------------------------------------ 3234 <1> ; READ_AC_CURRENT : 3235 <1> ; THIS ROUTINE READS THE ATTRIBUTE AND CHARACTER AT THE CURRENT : 3236 <1> ; CURSOR POSITION AND RETURNS THEM TO THE CALLER : 3237 <1> ; INPUT : 3238 <1> ; (AH) = CURRENT CRT MODE : 3239 <1> ; (BH) = DISPLAY PAGE ( ALPHA MODES ONLY ) : 3240 <1> ; (DS) = DATA SEGMENT : 3241 <1> ; (ES) = REGEN SEGMENT : 3242 <1> ; OUTPUT : 3243 <1> ; (AL) = CHARACTER READ : 3244 <1> ; (AH) = ATTRIBUTE READ : 3245 <1> ;------------------------------------------------------------------------ 3246 <1> 3247 <1> _read_ac_current: 3248 <1> ; 26/06/2016 3249 <1> ; 12/05/2016 3250 <1> ; 18/01/2016 3251 <1> 3252 000021CF 8A25[2E680000] <1> mov ah, [CRT_MODE] ; current video mode 3253 000021D5 80FC04 <1> cmp ah, 4 3254 000021D8 720A <1> jb short p10 3255 <1> ; 18/11/2020 3256 <1> ;cmp byte [CRT_MODE], 4 3257 <1> ;jnb GRAPHICS_READ ; 26/06/2016 3258 <1> 3259 000021DA 80FC07 <1> cmp ah, 7 ; TEST FOR BW CARD (80x25 monochrome text) 3260 000021DD 7405 <1> je short p10 ; same with mode 3 in TRDOS 386 3261 000021DF E9A0080000 <1> jmp GRAPHICS_READ 3262 <1> p10: 3263 000021E4 E80AFEFFFF <1> call find_position ; GET REGEN LOCATION AND PORT ADDRESS 3264 <1> ; 3265 <1> ; esi = regen location 3266 <1> ; dx = status port 3267 <1> ; 3268 <1> 3269 <1> ; 18/11/2020 3270 <1> ; convert display mode to a zero value 3271 <1> ; for 80 column color mode 3272 <1> ;mov ah, [CRT_MODE] 3273 <1> ;sub ah, 2 3274 <1> ;shr ah, 1 3275 <1> ;jnz short p13 3276 <1> 3277 <1> ; 05/12/2020 3278 <1> ; 18/11/2020 (TRDOS 386 v2.0.3) 3279 <1> ;xor bl, bl ; 0 3280 000021E9 803D[2E680000]03 <1> cmp byte [CRT_MODE], 03h ; 80x25 color text 3281 <1> ;je short p11 ; Note: Only mode 03h and mode 01h are 3282 <1> ;inc bl ; 1 ; in use by TRDOS 386 as text modes 3283 <1> ;jmp short p14 ; (07h, 00h and 02h are redirected) 3284 000021F0 7516 <1> jne short p13 3285 <1> 3286 <1> ; 05/12/2020 3287 000021F2 3A3D[DE760100] <1> cmp bh, [ACTIVE_PAGE] 3288 000021F8 750E <1> jne short p13 3289 <1> 3290 <1> ; WAIT FOR HORIZONTAL RETRACE OR VERTICAL RETRACE IF COLOR 80 3291 <1> p11: 3292 000021FA FB <1> sti ; enable interrupts first 3293 <1> ; 05/12/2020 3294 000021FB 90 <1> nop 3295 <1> ; 18/11/2020 3296 <1> ;or bl, bl 3297 <1> ;jnz short p13 ; mode 01h (and mode 00h) - 40x25 color text 3298 000021FC FA <1> cli ; block interrupts for single loop 3299 000021FD EC <1> in al, dx ; get status from the adapter 3300 000021FE A801 <1> test al, RHRZ ; is horizontal retrace low 3301 00002200 75F8 <1> jnz short p11 ; wait until it is 3302 <1> p12: ; wait for either retrace high 3303 00002202 EC <1> in al, dx ; get status again 3304 00002203 A809 <1> test al, RVRT+RHRZ ; is horizontal or vertical retrace high 3305 00002205 74FB <1> jz short p12 ; wait until either retrace active 3306 <1> ;p14: 3307 00002207 FB <1> sti 3308 <1> p13: 3309 00002208 81C600800B00 <1> add esi, 0B8000h 3310 0000220E 668B06 <1> mov ax, [esi] 3311 <1> 3312 00002211 C3 <1> retn ; 18/01/2016 3313 <1> 3314 <1> WRITE_AC_CURRENT: 3315 <1> ; 08/07/2016 3316 <1> ; 26/06/2016 3317 <1> ; 24/06/2016 3318 <1> ; 12/05/2016 3319 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3320 <1> ; 3321 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3322 <1> ; 3323 <1> ;---------------------------------------------------------------- 3324 <1> ; WRITE_AC_CURRENT : 3325 <1> ; THTS ROUTINE WRITES THE ATTRIBUTE AND CHARACTER : 3326 <1> ; AT THE CURRENT CURSOR POSITION : 3327 <1> ; INPUT : 3328 <1> ; (AH) = CURRENT CRT MODE : 3329 <1> ; (BH) = DISPLAY PAGE : 3330 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE : 3331 <1> ; (AL) = CHAR TO WRITE : 3332 <1> ; (BL) = ATTRIBUTE OF CHAR TO WRITE : 3333 <1> ; (DS) = DATA SEGMENT : 3334 <1> ; (ES) = REGEN SEGMENT : 3335 <1> ; OUTPUT : 3336 <1> ; DISPLAY REGEN BUFFER UPDATED : 3337 <1> ;---------------------------------------------------------------- 3338 <1> 3339 <1> ; 08/07/2016 3340 00002212 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; 6!? 3341 00002219 760A <1> jna short write_ac_c 3342 <1> 3343 0000221B E8B60A0000 <1> call vga_write_char_attr 3344 00002220 E946F9FFFF <1> jmp VIDEO_RETURN 3345 <1> 3346 <1> write_ac_c: 3347 00002225 E834000000 <1> call _write_c_current 3348 <1> 3349 0000222A 0FB6F7 <1> movzx esi, bh ; video page number (0 to 7) 3350 0000222D 889E[37680000] <1> mov [esi+chr_attrib], bl ; color/attribute 3351 <1> 3352 00002233 E933F9FFFF <1> jmp VIDEO_RETURN 3353 <1> 3354 <1> WRITE_C_CURRENT: 3355 <1> ; 08/07/2016 3356 <1> ; 26/06/2016 3357 <1> ; 12/05/2016 3358 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3359 <1> ; 3360 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3361 <1> ; 3362 <1> ;---------------------------------------------------------------- 3363 <1> ; WRITE_C_CURRENT : 3364 <1> ; THIS ROUTINE WRITES THE CHARACTER AT : 3365 <1> ; THE CURRENT CURSOR POSITION, ATTRIBUTE UNCHANGED : 3366 <1> ; INPUT : 3367 <1> ; (AH) = CURRENT CRT MODE : 3368 <1> ; (BH) = DISPLAY PAGE : 3369 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE : 3370 <1> ; (AL) = CHAR TO WRITE : 3371 <1> ; (DS) = DATA SEGMENT : 3372 <1> ; (ES) = REGEN SEGMENT : 3373 <1> ; OUTPUT : 3374 <1> ; DISPLAY REGEN BUFFER UPDATED : 3375 <1> ;---------------------------------------------------------------- 3376 <1> 3377 <1> ; 08/07/2016 3378 00002238 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; 6!? 3379 0000223F 760A <1> jna short write_c_c 3380 <1> 3381 00002241 E8900A0000 <1> call vga_write_char_only 3382 00002246 E920F9FFFF <1> jmp VIDEO_RETURN 3383 <1> 3384 <1> write_c_c: 3385 <1> ;and bh, 7 ; video page number (<= 7) 3386 0000224B 0FB6F7 <1> movzx esi, bh 3387 0000224E 8A9E[37680000] <1> mov bl, [esi+chr_attrib] 3388 <1> 3389 00002254 E805000000 <1> call _write_c_current 3390 00002259 E90DF9FFFF <1> jmp VIDEO_RETURN 3391 <1> 3392 <1> _write_c_current: ; from 'write_tty' 3393 <1> ; 12/04/2021 3394 <1> ; 18/11/2020 3395 <1> ; 26/06/2016 3396 <1> ; 24/06/2016 3397 <1> ; 12/05/2016 3398 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3399 <1> ; 30/08/2014 (Retro UNIX 386 v1) 3400 <1> ; 18/01/2014 3401 <1> ; 04/12/2013 3402 <1> ; 3403 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3404 <1> 3405 <1> ; 18/11/2020 3406 0000225E 8A25[2E680000] <1> mov ah, [CRT_MODE] ; current video mode 3407 00002264 80FC04 <1> cmp ah, 4 3408 00002267 720A <1> jb short p40 3409 <1> 3410 <1> ;cmp byte [CRT_MODE], 4 3411 <1> ;jnb GRAPHICS_WRITE ; 26/06/2016 3412 <1> 3413 00002269 80FC07 <1> cmp ah, 7 ; TEST FOR BW CARD 3414 0000226C 7405 <1> je short p40 3415 0000226E E963070000 <1> jmp GRAPHICS_WRITE 3416 <1> p40: 3417 <1> ; al = character 3418 <1> ; bl = color/attribute 3419 <1> ; bh = video page 3420 <1> ; cx = count of characters to write 3421 <1> ;push dx 3422 <1> ; 12/04/2021 3423 00002273 52 <1> push edx ; * 3424 00002274 88DC <1> mov ah, bl ; color/attribute (12/05/2016) 3425 <1> ;push ax ; save character & attribute/color 3426 <1> ;push cx 3427 <1> ; 12/04/2021 3428 00002276 50 <1> push eax ; ** ; save character & attribute/color 3429 00002277 51 <1> push ecx ; *** 3430 00002278 E876FDFFFF <1> call find_position ; get regen location and port address 3431 <1> ;pop cx 3432 <1> ; 12/04/2021 3433 0000227D 59 <1> pop ecx ; *** 3434 <1> ; esi = regen location 3435 <1> ; dx = status port 3436 <1> ; 3437 0000227E 81C600800B00 <1> add esi, 0B8000h ; 30/08/2014 (crt_base) 3438 <1> ; 3439 <1> ; 18/11/2020 3440 <1> ; convert display mode to a zero value 3441 <1> ; for 80 column color mode 3442 <1> ;mov ah, [CRT_MODE] 3443 <1> ;sub ah, 2 3444 <1> ;shr ah, 1 3445 <1> ;jnz short p44 ; 26/06/2016 3446 <1> 3447 <1> ; 05/12/2020 3448 <1> ; 18/11/2020 (TRDOS 386 v2.0.3) 3449 <1> ;xor bl, bl ; 0 3450 00002284 803D[2E680000]03 <1> cmp byte [CRT_MODE], 03h ; 80x25 color text 3451 <1> ;je short p41 ; Note: Only mode 03h and mode 01h are 3452 <1> ;inc bl ; 1 ; in use by TRDOS 386 as text modes 3453 <1> ;jmp short p43 ; (07h, 00h and 02h are redirected) 3454 <1> ; 05/12/2020 3455 0000228B 751A <1> jne short p44 3456 <1> p46: 3457 <1> ; 05/12/2020 3458 0000228D 3A3D[DE760100] <1> cmp bh, [ACTIVE_PAGE] 3459 00002293 7512 <1> jne short p44 3460 <1> 3461 <1> ; WAIT FOR HORIZONTAL RETRACE OR VERTICAL RETRACE IF COLOR 80 3462 <1> p41: 3463 <1> ; 05/12/2020 3464 00002295 FB <1> sti ; enable interrupts first 3465 00002296 90 <1> nop 3466 <1> ; 18/11/2020 3467 <1> ;or bl, bl 3468 <1> ;jnz short p44 ; mode 01h (and mode 00h) - 40x25 color text 3469 00002297 FA <1> cli ; block interrupts for single loop 3470 00002298 EC <1> in al, dx ; get status from the adapter 3471 00002299 A808 <1> test al, RVRT ; check for vertical retrace first 3472 0000229B 7509 <1> jnz short p43 ; Do fast write now if vertical retrace 3473 0000229D A801 <1> test al, RHRZ ; is horizontal retrace low 3474 0000229F 75F4 <1> jnz short p41 ; wait until it is 3475 <1> p42: ; wait for either retrace high 3476 000022A1 EC <1> in al, dx ; get status again 3477 000022A2 A809 <1> test al, RVRT+RHRZ ; is horizontal or vertical retrace high 3478 000022A4 74FB <1> jz short p42 ; wait until either retrace active 3479 <1> p43: 3480 000022A6 FB <1> sti 3481 <1> p44: 3482 000022A7 668B0424 <1> mov ax, [esp] ; restore the character (al) & attribute (ah) 3483 000022AB 668906 <1> mov [esi], ax 3484 <1> 3485 000022AE 6649 <1> dec cx 3486 000022B0 740D <1> jz short p45 3487 <1> 3488 000022B2 46 <1> inc esi 3489 000022B3 46 <1> inc esi 3490 <1> 3491 <1> ; 05/12/2020 3492 000022B4 803D[2E680000]03 <1> cmp byte [CRT_MODE], 03h 3493 000022BB 75EA <1> jne short p44 3494 <1> ;jmp short p41 3495 000022BD EBCE <1> jmp short p46 3496 <1> p45: 3497 <1> ;pop ax 3498 <1> ;pop dx 3499 <1> ; 12/04/2021 3500 000022BF 58 <1> pop eax ; ** 3501 000022C0 5A <1> pop edx ; * 3502 000022C1 C3 <1> retn 3503 <1> 3504 <1> ; 09/07/2016 3505 <1> ; 26/06/2016 3506 <1> ; 24/06/2016 3507 <1> ; 12/05/2016 3508 <1> ; 18/01/2016 3509 <1> ; 16/01/2016 - TRDOS 386 (TRDOS v2.0) 3510 <1> ; 30/06/2015 3511 <1> ; 27/06/2015 3512 <1> ; 11/03/2015 3513 <1> ; 02/09/2014 3514 <1> ; 30/08/2014 3515 <1> ; VIDEO FUNCTIONS 3516 <1> ; (write_tty - Retro UNIX 8086 v1 - U9.ASM, 01/02/2014) 3517 <1> 3518 <1> WRITE_TTY: 3519 <1> ; 09/12/2017 3520 <1> ; 09/07/2016 3521 <1> ; 01/07/2016 3522 <1> ; 26/06/2016 3523 <1> ; 24/06/2016 3524 <1> ; 13/05/2016 3525 <1> ; 12/05/2016 3526 <1> ; 30/01/2016 3527 <1> ; 18/01/2016 3528 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 3529 <1> ; 13/08/2015 3530 <1> ; 02/09/2014 3531 <1> ; 30/08/2014 (Retro UNIX 386 v1 - beginning) 3532 <1> ; 01/02/2014 (Retro UNIX 8086 v1 - last update) 3533 <1> ; 03/12/2013 (Retro UNIX 8086 v1 - beginning) 3534 <1> ; (Modified registers: EAX, EBX, ECX, EDX, ESI, EDI) 3535 <1> ; 3536 <1> ; INPUT -> AL = Character to be written 3537 <1> ; BL = Color (Forecolor, Backcolor) 3538 <1> ; BH = Video Page (0 to 7) 3539 <1> 3540 <1> ; 09/07/2016 3541 000022C2 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 3542 000022C9 760A <1> jna short write_tty_cga 3543 <1> 3544 000022CB E8EB0C0000 <1> call vga_write_teletype 3545 000022D0 E996F8FFFF <1> jmp VIDEO_RETURN 3546 <1> 3547 <1> write_tty_cga: 3548 <1> ; 13/05/2016 3549 <1> ;call _write_tty 3550 <1> ; 01/07/2016 3551 000022D5 E818000000 <1> call _write_tty_m3 3552 000022DA E98CF8FFFF <1> jmp VIDEO_RETURN 3553 <1> 3554 <1> RVRT equ 00001000b ; VIDEO VERTICAL RETRACE BIT 3555 <1> RHRZ equ 00000001b ; VIDEO HORIZONTAL RETRACE BIT 3556 <1> 3557 <1> ; Derived from "WRITE_TTY" procedure of IBM "pc-at" rombios source code 3558 <1> ; (06/10/1985), 'video.asm', INT 10H, VIDEO_IO 3559 <1> ; 3560 <1> ; 06/10/85 VIDEO DISPLAY BIOS 3561 <1> ; 3562 <1> ;--- WRITE_TTY ------------------------------------------------------------------ 3563 <1> ; : 3564 <1> ; THIS INTERFACE PROVIDES A TELETYPE LIKE INTERFACE TO THE : 3565 <1> ; VIDEO CARDS. THE INPUT CHARACTER IS WRITTEN TO THE CURRENT : 3566 <1> ; CURSOR POSITION, AND THE CURSOR IS MOVED TO THE NEXT POSITION. : 3567 <1> ; IF THE CURSOR LEAVES THE LAST COLUMN OF THE FIELD, THE COLUMN : 3568 <1> ; IS SET TO ZERO, AND THE ROW VALUE IS INCREMENTED. IF THE ROW : 3569 <1> ; ROW VALUE LEAVES THE FIELD, THE CURSOR IS PLACED ON THE LAST ROW, : 3570 <1> ; FIRST COLUMN, AND THE ENTIRE SCREEN IS SCROLLED UP ONE LINE. : 3571 <1> ; WHEN THE SCREEN IS SCROLLED UP, THE ATTRIBUTE FOR FILLING THE : 3572 <1> ; NEWLY BLANKED LINE IS READ FROM THE CURSOR POSITION ON THE PREVIOUS : 3573 <1> ; LINE BEFORE THE SCROLL, IN CHARACTER MODE. IN GRAPHICS MODE, : 3574 <1> ; THE 0 COLOR IS USED. : 3575 <1> ; ENTRY -- : 3576 <1> ; (AH) = CURRENT CRT MODE : 3577 <1> ; (AL) = CHARACTER TO BE WRITTEN : 3578 <1> ; NOTE THAT BACK SPACE, CARRIAGE RETURN, BELL AND LINE FEED ARE : 3579 <1> ; HANDLED AS COMMANDS RATHER THAN AS DISPLAY GRAPHICS CHARACTERS : 3580 <1> ; (BL) = FOREGROUND COLOR FOR CHAR WRITE IF CURRENTLY IN A GRAPHICS MODE : 3581 <1> ; EXIT -- : 3582 <1> ; ALL REGISTERS SAVED : 3583 <1> ;-------------------------------------------------------------------------------- 3584 <1> 3585 <1> ; 02/08/2022 (TRDOS 386 v2.0.5) 3586 <1> ; 18/11/2020 (TRDOS 386 v2.0.3) 3587 <1> ; 09/12/2017 3588 <1> ; 08/07/2016 3589 <1> ; 26/06/2016 3590 <1> ; 24/06/2016 3591 <1> _write_tty: 3592 <1> ; 13/05/2016 3593 <1> ; --- 18/11/2020 --- 3594 <1> ; NOTE: 3595 <1> ; Only kernel calls "_write_tty" procedure... 3596 <1> ; TRDOS 386 v2 kernel uses video mode 3 for displaying 3597 <1> ; (some error) messages and also mainprog command interpreter 3598 <1> ; (in kernel) uses "_write_tty". 3599 <1> ; So, here video mode must be set to 3 if it is not 3. 3600 <1> 3601 000022DF FA <1> cli ; disable interrupts 3602 <1> ; 3603 <1> ; 01/09/2014 3604 000022E0 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 3605 000022E7 7409 <1> je short _write_tty_m3 3606 <1> ; 3607 <1> set_mode_3: 3608 000022E9 53 <1> push ebx 3609 000022EA 50 <1> push eax 3610 <1> ;call _set_mode 3611 <1> ; 18/11/2020 3612 000022EB E893F8FFFF <1> call set_txt_mode ; set video mode to 03h 3613 000022F0 58 <1> pop eax 3614 000022F1 5B <1> pop ebx 3615 <1> ; 3616 <1> _write_tty_m3: ; 24/06/2016 (m3 -> _write_tty_m3) 3617 000022F2 0FB6F7 <1> movzx esi, bh ; 12/05/2016 3618 <1> ;shl si, 1 3619 <1> ; 02/08/2022 3620 000022F5 D1E6 <1> shl esi, 1 3621 000022F7 81C6[CE760100] <1> add esi, CURSOR_POSN 3622 000022FD 668B16 <1> mov dx, [esi] 3623 <1> ; 3624 <1> ; dx now has the current cursor position 3625 <1> ; 3626 00002300 3C0D <1> cmp al, 0Dh ; CR ; is it carriage return or control character 3627 <1> ;jbe short u8 3628 <1> ; 17/04/2021 3629 00002302 7241 <1> jb short u8 3630 00002304 746F <1> je short u9 3631 <1> ; 3632 <1> ; write the char to the screen 3633 <1> u0: 3634 <1> ; al = character 3635 <1> ; bl = attribute/color 3636 <1> ; bh = video page number (0 to 7) 3637 <1> ; 3638 <1> ;mov cx, 1 ; 24/06/2016 3639 <1> ; 02/08/2022 3640 00002306 29C9 <1> sub ecx, ecx 3641 00002308 FEC1 <1> inc cl ; ecx = 1 3642 <1> ; cx = count of characters to write 3643 <1> ; 3644 0000230A E84FFFFFFF <1> call _write_c_current ; 16/01/2015 3645 <1> ; 3646 <1> ; position the cursor for next char 3647 0000230F FEC2 <1> inc dl ; next column 3648 00002311 3A15[30680000] <1> cmp dl, [CRT_COLS] ; test for column overflow 3649 <1> ;jne _set_cpos 3650 <1> ; 02/08/2022 3651 00002317 7402 <1> je short u13 3652 00002319 EB5C <1> jmp _set_cpos 3653 <1> u13: 3654 0000231B B200 <1> mov dl, 0 ; column = 0 3655 <1> u10: ; (line feed found) 3656 0000231D 80FE18 <1> cmp dh, 25-1 ; check for last row 3657 00002320 721F <1> jb short u6 3658 <1> ; 3659 <1> ; scroll required 3660 <1> u1: 3661 <1> ; SET CURSOR POSITION (04/12/2013) 3662 00002322 E850000000 <1> call _set_cpos 3663 <1> ; 3664 <1> ; determine value to fill with during scroll 3665 <1> u2: 3666 <1> ; bh = video page number 3667 <1> ; 3668 00002327 E8A3FEFFFF <1> call _read_ac_current ; 18/01/2016 3669 <1> ; 3670 <1> ; al = character, ah = attribute 3671 <1> ; bh = video page number 3672 <1> ; 18/11/2020 3673 0000232C 88E3 <1> mov bl, ah ; color/attribute 3674 <1> u3: 3675 <1> ;;mov ax, 0601h ; scroll one line 3676 <1> ;;sub cx, cx ; upper left corner 3677 <1> ;;mov dh, 25-1 ; lower right row 3678 <1> ;;;mov dl, [CRT_COLS] 3679 <1> ;mov dl, 80 ; lower right column 3680 <1> ;;dec dl 3681 <1> ;;mov dl, 79 3682 <1> 3683 <1> ;;call scroll_up ; 04/12/2013 3684 <1> ;;; 11/03/2015 3685 <1> ; 02/09/2014 3686 <1> ;;;mov cx, [crt_ulc] ; Upper left corner (0000h) 3687 <1> ;;;mov dx, [crt_lrc] ; Lower right corner (184Fh) 3688 <1> ; 11/03/2015 3689 <1> ;sub cx, cx 3690 <1> ; 17/04/2021 3691 0000232E 29C9 <1> sub ecx, ecx 3692 <1> ;mov dx, 184Fh ; dl = 79 (column), dh = 24 (row) 3693 <1> ; 18/11/2020 3694 00002330 B618 <1> mov dh, 25-1 3695 00002332 8A15[30680000] <1> mov dl, [CRT_COLS] 3696 00002338 FECA <1> dec dl 3697 <1> ; 3698 0000233A B001 <1> mov al, 1 ; scroll 1 line up 3699 <1> ; ah = attribute 3700 <1> ;mov bl, al ; 12/05/2016 3701 0000233C E9F0FCFFFF <1> jmp _scroll_up ; 16/01/2016 3702 <1> ;u4: 3703 <1> ;;int 10h ; video-call return 3704 <1> ; scroll up the screen 3705 <1> ; tty return 3706 <1> ;u5: 3707 <1> ;retn ; return to the caller 3708 <1> 3709 <1> u6: ; set-cursor-inc 3710 00002341 FEC6 <1> inc dh ; next row 3711 <1> ; set cursor 3712 <1> ;u7: 3713 <1> ;;mov ah, 02h 3714 <1> ;;jmp short u4 ; establish the new cursor 3715 <1> ;call _set_cpos 3716 <1> ;jmp short u5 3717 00002343 EB32 <1> jmp _set_cpos 3718 <1> 3719 <1> ; check for control characters 3720 <1> u8: 3721 <1> ;je short u9 ; 17/04/2021 3722 00002345 3C0A <1> cmp al, 0Ah ; is it a line feed (0Ah) 3723 00002347 74D4 <1> je short u10 3724 00002349 3C07 <1> cmp al, 07h ; is it a bell 3725 0000234B 747C <1> je short u11 3726 0000234D 3C08 <1> cmp al, 08h ; is it a backspace 3727 <1> ;jne short u0 3728 0000234F 741C <1> je short bs ; 12/12/2013 3729 <1> ; 12/12/2013 (tab stop) 3730 00002351 3C09 <1> cmp al, 09h ; is it a tab stop 3731 00002353 75B1 <1> jne short u0 3732 00002355 88D0 <1> mov al, dl 3733 <1> ;cbw 3734 00002357 30E4 <1> xor ah, ah ; 09/12/2017 3735 00002359 B108 <1> mov cl, 8 3736 0000235B F6F1 <1> div cl 3737 0000235D 28E1 <1> sub cl, ah 3738 <1> ts: 3739 <1> ; 02/09/2014 3740 <1> ; 01/09/2014 3741 <1> ;mov al, 20h 3742 <1> tsloop: 3743 <1> ;push cx 3744 <1> ; 12/04/2021 3745 0000235F 51 <1> push ecx ; * 3746 <1> ; 18/11/2020 3747 <1> ;push ax 3748 <1> ;;mov bh, [ACTIVE_PAGE] 3749 <1> ; 05/12/2020 3750 <1> ;push bx 3751 00002360 B020 <1> mov al, 20h ; al = space (blank) 3752 <1> ; bl = color/attribute 3753 00002362 E88BFFFFFF <1> call _write_tty_m3 ; 24/06/2016 (m3 -> _write_tty_m3) 3754 <1> ; 05/12/2020 3755 <1> ; bx is preserved in '_write_tty_m3' 3756 <1> ; 18/11/2020 3757 <1> ;pop bx ; BL = color/attribute, Bh = video page 3758 <1> ;pop ax ; AL = character 3759 <1> ; 12/04/2021 3760 <1> ;pop cx 3761 00002367 59 <1> pop ecx ; * 3762 00002368 FEC9 <1> dec cl 3763 0000236A 75F3 <1> jnz short tsloop 3764 0000236C C3 <1> retn 3765 <1> bs: 3766 <1> ; back space found 3767 <1> 3768 0000236D 08D2 <1> or dl, dl ; is it already at start of line 3769 <1> ;je short u7 ; set_cursor 3770 0000236F 7406 <1> jz short _set_cpos 3771 <1> ;dec dx ; no -- just move it back 3772 <1> ; 17/04/2021 3773 00002371 FECA <1> dec dl ; move to 1 column back 3774 <1> ;jmp short u7 3775 00002373 EB02 <1> jmp short _set_cpos 3776 <1> 3777 <1> ; carriage return found 3778 <1> u9: 3779 00002375 B200 <1> mov dl, 0 ; move to first column 3780 <1> ;jmp short u7 3781 <1> ;jmp short _set_cpos ; 30/01/2016 3782 <1> 3783 <1> ; line feed found 3784 <1> ;u10: 3785 <1> ; cmp dh, 25-1 ; bottom of screen 3786 <1> ; jne short u6 ; no, just set the cursor 3787 <1> ; jmp u1 ; yes, scroll the screen 3788 <1> 3789 <1> _set_cpos: 3790 <1> ; 02/08/2022 - TRDOS 386 v2.0.5 3791 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 3792 <1> ; 12/05/2016 - TRDOS 386 (TRDOS v2.0) 3793 <1> ; 27/06/2015 3794 <1> ; 01/09/2014 3795 <1> ; 30/08/2014 (Retro UNIX 386 v1) 3796 <1> ; 3797 <1> ; 04/12/2013 - 12/12/2013 (Retro UNIX 8086 v1) 3798 <1> ; 3799 <1> ; VIDEO.ASM - 06/10/85 VIDEO DISPLAY BIOS 3800 <1> ; 3801 <1> ;---------------------------------------------- 3802 <1> ; SET_CPOS 3803 <1> ; THIS ROUTINE SETS THE CURRENT CURSOR POSITION TO THE 3804 <1> ; NEW X-Y VALUES PASSED 3805 <1> ; INPUT 3806 <1> ; DX - ROW,COLUMN OF NEW CURSOR 3807 <1> ; BH - DISPLAY PAGE OF CURSOR 3808 <1> ; OUTPUT 3809 <1> ; CURSOR ID SET AT 6845 IF DISPLAY PAGE IS CURRENT DISPLAY 3810 <1> ;---------------------------------------------- 3811 <1> ; 3812 00002377 BE[CE760100] <1> mov esi, CURSOR_POSN 3813 0000237C 0FB6C7 <1> movzx eax, bh ; BH = video page number 3814 <1> ; or al, al 3815 <1> ; jz short _set_cpos_0 3816 0000237F D0E0 <1> shl al, 1 ; word offset 3817 00002381 01C6 <1> add esi, eax 3818 <1> ;_set_cpos_0: 3819 00002383 668916 <1> mov [esi], dx ; save the pointer 3820 00002386 383D[DE760100] <1> cmp [ACTIVE_PAGE], bh 3821 0000238C 7532 <1> jne short m17 3822 <1> ;call m18 ; CURSOR SET 3823 <1> ;m17: ; SET_CPOS_RETURN 3824 <1> ; 01/09/2014 3825 <1> ; retn 3826 <1> ; DX = row/column 3827 <1> m18: 3828 0000238E E852FCFFFF <1> call position ; determine location in regen buffer 3829 00002393 668B0D[CC760100] <1> mov cx, [CRT_START] 3830 0000239A 6601C1 <1> add cx, ax ; add char position in regen buffer 3831 <1> ; to the start address (offset) for this page 3832 0000239D 66D1E9 <1> shr cx, 1 ; divide by 2 for char only count 3833 000023A0 B40E <1> mov ah, 14 ; register number for cursor 3834 <1> ;call m16 ; output value to the 6845 3835 <1> ;retn 3836 <1> 3837 <1> ;----- THIS ROUTINE OUTPUTS THE CX REGISTER 3838 <1> ; TO THE 6845 REGISTERS NAMED IN (AH) 3839 <1> m16: 3840 000023A2 FA <1> cli 3841 <1> ;mov dx, [addr_6845] ; address register 3842 000023A3 66BAD403 <1> mov dx, 03D4h ; I/O address of color card 3843 000023A7 88E0 <1> mov al, ah ; get value 3844 000023A9 EE <1> out dx, al ; register set 3845 <1> ;inc dx ; data register 3846 <1> ; 17/04/2021 3847 000023AA FEC2 <1> inc dl 3848 000023AC EB00 <1> jmp $+2 ; i/o delay 3849 000023AE 88E8 <1> mov al, ch ; data 3850 000023B0 EE <1> out dx, al 3851 <1> ;dec dx 3852 <1> ; 17/04/2021 3853 000023B1 FECA <1> dec dl 3854 000023B3 88E0 <1> mov al, ah 3855 000023B5 FEC0 <1> inc al ; point to other data register 3856 000023B7 EE <1> out dx, al ; set for second register 3857 <1> ;inc dx 3858 <1> ; 17/04/2021 3859 000023B8 FEC2 <1> inc dl 3860 000023BA EB00 <1> jmp $+2 ; i/o delay 3861 000023BC 88C8 <1> mov al, cl ; second data value 3862 000023BE EE <1> out dx, al 3863 000023BF FB <1> sti 3864 <1> m17: 3865 000023C0 C3 <1> retn 3866 <1> 3867 <1> _beep: 3868 <1> ; 12/02/2021 (TRDOS v2.0.3) 3869 000023C1 FA <1> cli 3870 000023C2 E811000000 <1> call beep 3871 000023C7 FB <1> sti 3872 000023C8 C3 <1> retn 3873 <1> 3874 <1> beeper: 3875 <1> ; 04/08/2016 3876 <1> ; 12/05/2016 - TRDOS 386 (TRDOS v2.0) 3877 <1> ; 30/08/2014 (Retro UNIX 386 v1) 3878 <1> ; 18/01/2014 3879 <1> ; 03/12/2013 3880 <1> ; bell found 3881 <1> u11: 3882 000023C9 FB <1> sti 3883 000023CA 3A3D[DE760100] <1> cmp bh, [ACTIVE_PAGE] 3884 000023D0 7552 <1> jne short u12 ; Do not sound the beep 3885 <1> ; if it is not written on the active page 3886 <1> beeper_gfx: ; 04/08/2016 3887 000023D2 66B93305 <1> mov cx, 1331 ; divisor for 896 hz tone 3888 000023D6 B31F <1> mov bl, 31 ; set count for 31/64 second for beep 3889 <1> ;call beep ; sound the pod bell 3890 <1> ;jmp short u5 ; tty_return 3891 <1> ;retn 3892 <1> 3893 <1> TIMER equ 040h ; 8254 TIMER - BASE ADDRESS 3894 <1> PORT_B equ 061h ; PORT B READ/WRITE DIAGNOSTIC REGISTER 3895 <1> GATE2 equ 00000001b ; TIMER 2 INPUT CATE CLOCK BIT 3896 <1> SPK2 equ 00000010b ; SPEAKER OUTPUT DATA ENABLE BIT 3897 <1> 3898 <1> beep: 3899 <1> ; 12/02/2021 3900 <1> ; 07/02/2015 3901 <1> ; 30/08/2014 (Retro UNIX 386 v1) 3902 <1> ; 18/01/2014 3903 <1> ; 03/12/2013 3904 <1> ; 3905 <1> ; TEST4.ASM - 06/10/85 POST AND BIOS UTILITY ROUTINES 3906 <1> ; 3907 <1> ; ROUTINE TO SOUND THE BEEPER USING TIMER 2 FOR TONE 3908 <1> ; 3909 <1> ; ENTRY: 3910 <1> ; (BL) = DURATION COUNTER ( 1 FOR 1/64 SECOND ) 3911 <1> ; (CX) = FREQUENCY DIVISOR (1193180/FREQUENCY) (1331 FOR 886 HZ) 3912 <1> ; EXIT: : 3913 <1> ; (AX),(BL),(CX) MODIFIED. 3914 <1> 3915 000023D8 9C <1> pushfd ; 18/01/2014 ; save interrupt status 3916 000023D9 FA <1> cli ; block interrupts during update 3917 000023DA B0B6 <1> mov al, 10110110b ; select timer 2, lsb, msb binary 3918 000023DC E643 <1> out TIMER+3, al ; write timer mode register 3919 000023DE EB00 <1> jmp $+2 ; I/O delay 3920 000023E0 88C8 <1> mov al, cl ; divisor for hz (low) 3921 000023E2 E642 <1> out TIMER+2,AL ; write timer 2 count - lsb 3922 000023E4 EB00 <1> jmp $+2 ; I/O delay 3923 000023E6 88E8 <1> mov al, ch ; divisor for hz (high) 3924 000023E8 E642 <1> out TIMER+2, al ; write timer 2 count - msb 3925 000023EA E461 <1> in al, PORT_B ; get current setting of port 3926 000023EC 88C4 <1> mov ah, al ; save that setting 3927 000023EE 0C03 <1> or al, GATE2+SPK2 ; gate timer 2 and turn speaker on 3928 000023F0 E661 <1> out PORT_B, al ; and restore interrupt status 3929 <1> ; 12/02/2021 3930 000023F2 9D <1> popfd ; 18/01/2014 3931 <1> ;sti 3932 <1> g7: ; 1/64 second per count (bl) 3933 000023F3 B90B040000 <1> mov ecx, 1035 ; delay count for 1/64 of a second 3934 000023F8 E828000000 <1> call waitf ; go to beep delay 1/64 count 3935 000023FD FECB <1> dec bl ; (bl) length count expired? 3936 000023FF 75F2 <1> jnz short g7 ; no - continue beeping speaker 3937 <1> ; 3938 00002401 9C <1> pushfd ; 12/02/2021 ; save interrupt status 3939 00002402 FA <1> cli ; 18/01/2014 ; block interrupts during update 3940 00002403 E461 <1> in al, PORT_B ; get current port value 3941 <1> ;or al, not (GATE2+SPK2) ; isolate current speaker bits in case 3942 00002405 0CFC <1> or al, ~(GATE2+SPK2) 3943 00002407 20C4 <1> and ah, al ; someone turned them off during beep 3944 00002409 88E0 <1> mov al, ah ; recover value of port 3945 <1> ;or al, not (GATE2+SPK2) ; force speaker data off 3946 0000240B 0CFC <1> or al, ~(GATE2+SPK2) ; isolate current speaker bits in case 3947 0000240D E661 <1> out PORT_B, al ; and stop speaker timer 3948 0000240F 9D <1> popfd ; 12/02/2021 ; restore interrupt flag state 3949 <1> ;sti 3950 <1> ;mov ecx, 1035 ; force 1/64 second delay (short) 3951 <1> ; 17/04/2021 3952 00002410 66B90B04 <1> mov cx, 1035 3953 00002414 E80C000000 <1> call waitf ; minimum delay between all beeps 3954 00002419 9C <1> pushfd ; save interrupt status 3955 0000241A FA <1> cli ; block interrupts during update 3956 0000241B E461 <1> in al, PORT_B ; get current port value in case 3957 0000241D 2403 <1> and al, GATE2+SPK2 ; someone turned them on 3958 0000241F 08E0 <1> or al, ah ; recover value of port_b 3959 00002421 E661 <1> out PORT_B, al ; restore speaker status 3960 00002423 9D <1> popfd ; restore interrupt flag state 3961 <1> u12: 3962 00002424 C3 <1> retn 3963 <1> 3964 <1> REFRESH_BIT equ 00010000b ; REFRESH TEST BIT 3965 <1> 3966 <1> WAITF: 3967 <1> waitf: 3968 <1> ; 30/08/2014 (Retro UNIX 386 v1) 3969 <1> ; 03/12/2013 3970 <1> ; 3971 <1> ; push ax ; save work register (ah) 3972 <1> ;waitf1: 3973 <1> ; use timer 1 output bits 3974 <1> ; in al, PORT_B ; read current counter output status 3975 <1> ; and al, REFRESH_BIT ; mask for refresh determine bit 3976 <1> ; cmp al, ah ; did it just change 3977 <1> ; je short waitf1 ; wait for a change in output line 3978 <1> ; ; 3979 <1> ; mov ah, al ; save new lflag state 3980 <1> ; loop waitf1 ; decrement half cycles till count end 3981 <1> ; ; 3982 <1> ; pop ax ; restore (ah) 3983 <1> ; retn ; return (cx)=0 3984 <1> 3985 <1> ; 06/02/2015 (unix386.s <-- dsectrm2.s) 3986 <1> ; 17/12/2014 (dsectrm2.s) 3987 <1> ; WAITF 3988 <1> ; /// IBM PC-XT Model 286 System BIOS Source Code - Test 4 - 06/10/85 /// 3989 <1> ; 3990 <1> ;---WAITF----------------------------------------------------------------------- 3991 <1> ; FIXED TIME WAIT ROUTINE (HARDWARE CONTROLLED - NOT PROCESSOR) 3992 <1> ; ENTRY: 3993 <1> ; (CX) = COUNT OF 15.085737 MICROSECOND INTERVALS TO WAIT 3994 <1> ; MEMORY REFRESH TIMER 1 OUTPUT USED AS REFERENCE 3995 <1> ; EXIT: 3996 <1> ; AFTER (CX) TIME COUNT (PLUS OR MINUS 16 MICROSECONDS) 3997 <1> ; (CX) = 0 3998 <1> ;------------------------------------------------------------------------------- 3999 <1> 4000 <1> ; Refresh period: 30 micro seconds (15-80 us) 4001 <1> ; (16/12/2014 - AWARDBIOS 1999 - ATORGS.ASM, WAIT_REFRESH) 4002 <1> 4003 <1> ;WAITF: ; DELAY FOR (CX)*15.085737 US 4004 <1> ;push AX ; SAVE WORK REGISTER (AH) 4005 <1> ; 11/04/2021 4006 00002425 50 <1> push eax 4007 <1> ; 16/12/2014 4008 <1> ;shr cx, 1 ; convert to count of 30 micro seconds 4009 00002426 D1E9 <1> shr ecx, 1 ; 21/02/2015 4010 <1> ;17/12/2014 4011 <1> ;WAITF1: 4012 <1> ; in al, PORT_B ;061h ; READ CURRENT COUNTER OUTPUT STATUS 4013 <1> ; and al, REFRESH_BIT ;00010000b ; MASK FOR REFRESH DETERMINE BIT 4014 <1> ; cmp al, ah ; DID IT JUST CHANGE 4015 <1> ; je short WAITF1 ; WAIT FOR A CHANGE IN OUTPUT LINE 4016 <1> ; mov ah, al ; SAVE NEW FLAG STATE 4017 <1> ; loop WAITF1 ; DECREMENT HALF CYCLES TILL COUNT END 4018 <1> ; 4019 <1> ; 17/12/2014 4020 <1> ; 4021 <1> ; Modification from 'WAIT_REFRESH' procedure of AWARD BIOS - 1999 4022 <1> ; 4023 <1> ;WAIT_REFRESH: Uses port 61, bit 4 to have CPU speed independent waiting. 4024 <1> ; INPUT: CX = number of refresh periods to wait 4025 <1> ; (refresh periods = 1 per 30 microseconds on most machines) 4026 <1> WR_STATE_0: 4027 00002428 E461 <1> in al, PORT_B ; IN AL,SYS1 4028 0000242A A810 <1> test al, 010h 4029 0000242C 74FA <1> JZ short WR_STATE_0 4030 <1> WR_STATE_1: 4031 0000242E E461 <1> in al, PORT_B ; IN AL,SYS1 4032 00002430 A810 <1> test al, 010h 4033 00002432 75FA <1> jnz short WR_STATE_1 4034 00002434 E2F2 <1> loop WR_STATE_0 4035 <1> ; 4036 <1> ;pop ax ; RESTORE (AH) 4037 <1> ; 11/04/2021 4038 00002436 58 <1> pop eax 4039 00002437 C3 <1> retn ; (CX) = 0 4040 <1> 4041 <1> ; 03/08/2022 4042 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 4043 <1> ; 09/07/2016 4044 <1> ; 01/07/2016 4045 <1> ; 24/06/2016 4046 <1> ; 23/06/2016 - TRDOS 386 (TRDOS v2.0) 4047 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 4048 <1> ;------------------------------------------------------------------------------- 4049 <1> ; WRITE_STRING : 4050 <1> ; THIS ROUTINE WRITES A STRING OF CHARACTERS TO THE CRT. : 4051 <1> ; INPUT : 4052 <1> ; (AL) = WRITE STRING COMMAND 0 - 3 : 4053 <1> ; (BH) = DISPLAY PAGE (ACTIVE PAGE) : 4054 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE, IF (CX) = 0 THEN RETURN : 4055 <1> ; (DX) = CURSOR POSITION FOR START OF STRING WRITE : 4056 <1> ; (BL) = ATTRIBUTE OF CHARACTER TO WRITE IF (AL) = 0 OR (AL) = 1 : 4057 <1> ; (EBP) = SOURCE STRING OFFSET : 4058 <1> ; OUTPUT : 4059 <1> ; NONE : 4060 <1> ;------------------------------------------------------------------------------- 4061 <1> 4062 <1> ; AL = 00h: Assign all characters the attribute in BL; do not update cursor 4063 <1> ; AL = 01h: Assign all characters the attribute in BL; update cursor 4064 <1> ; AL = 02h: Use attributes in string; do not update cursor 4065 <1> ; AL = 03h: Use attributes in string; update cursor 4066 <1> 4067 <1> WRITE_STRING: 4068 <1> ; 03/08/2022 4069 <1> ; 02/08/2022 4070 <1> ; 12/09/2016 4071 <1> ; 09/07/2016 4072 <1> ;cmp byte [CRT_MODE], 7 ; 6?! 4073 <1> ;ja VIDEO_RETURN ; not a valid function for VGA modes 4074 <1> ; 4075 00002438 A2[48830100] <1> mov [w_str_cmd], al ; save (AL) command 4076 0000243D 3C04 <1> cmp al, 4 ; TEST FOR INVALID WRITE STRING OPTION 4077 <1> ;jnb VIDEO_RETURN ; IF OPTION INVALID THEN RETURN 4078 <1> ; 02/08/2022 4079 0000243F 7361 <1> jnb short P55 4080 <1> 4081 <1> ;jcxz VIDEO_RETURN ; IF ZERO LENGTH STRING THEN RETURN 4082 <1> 4083 00002441 67E35E <1> jcxz P55 ; 01/07/2016 4084 <1> 4085 <1> ; 01/07/2016 4086 <1> ;and ecx, 0FFFFh 4087 <1> ; ecx = byte count 4088 <1> ;push ecx 4089 00002444 89EE <1> mov esi, ebp ; user buffer 4090 00002446 BF00000700 <1> mov edi, Cluster_Buffer ; system buffer 4091 0000244B E815E70000 <1> call transfer_from_user_buffer 4092 <1> ;pop ecx 4093 <1> ;jc VIDEO_RETURN 4094 <1> ; 02/08/2022 4095 00002450 7250 <1> jc short P55 4096 <1> ; ecx = transfer (byte) count = character count 4097 00002452 BD00000700 <1> mov ebp, Cluster_Buffer 4098 <1> ; 12/09/2016 4099 00002457 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; 6?! 4100 <1> ;ja vga_write_string 4101 <1> ; 02/08/2022 4102 0000245E 7605 <1> jna short P57 4103 00002460 E99C000000 <1> jmp vga_write_string 4104 <1> P57: 4105 00002465 0FB6F7 <1> movzx esi, bh ; GET CURRENT CURSOR PAGE 4106 <1> ;sal si, 1 ; CONVERT TO PAGE OFFSET (SI = PAGE) 4107 <1> ; 02/08/2022 4108 00002468 D1E6 <1> sal esi, 1 4109 <1> ; ***** 4110 0000246A 66FFB6[CE760100] <1> push word [esi+CURSOR_POSN] ; SAVE CURRENT CURSOR POSITION IN STACK 4111 <1> 4112 <1> ;mov ax, 0200h ; SET NEW CURSOR POSITION 4113 <1> ;int 10h 4114 <1> P50next: 4115 00002471 51 <1> push ecx ; **** 4116 00002472 53 <1> push ebx ; *** ; 18/11/2020 4117 00002473 56 <1> push esi ; ** 4118 00002474 52 <1> push edx ; * 4119 00002475 E8FDFEFFFF <1> call _set_cpos 4120 <1> P50: 4121 0000247A 8A4500 <1> mov al, [ebp] ; GET CHARACTER FROM INPUT STRING 4122 0000247D 45 <1> inc ebp ; BUMP POINTER TO CHARACTER 4123 <1> 4124 <1> ;----- TEST FOR SPECIAL CHARACTER'S 4125 <1> 4126 0000247E 3C08 <1> cmp al, 08h ; IS IT A BACKSPACE 4127 00002480 7410 <1> je short P51 ; BACK_SPACE 4128 00002482 3C0D <1> cmp al, 0Dh ; CR ; IS IT CARRIAGE RETURN 4129 00002484 740C <1> je short P51 ; CAR_RET 4130 00002486 3C0A <1> cmp al, 0Ah ; LF ; IS IT A LINE FEED 4131 00002488 7408 <1> je short P51 ; LINE_FEED 4132 <1> ; 18/11/2020 4133 0000248A 3C09 <1> cmp al, 09h ; is it a tab stop 4134 0000248C 7404 <1> je short P51 4135 <1> ; 4136 0000248E 3C07 <1> cmp al, 07h ; IS IT A BELL 4137 00002490 7515 <1> jne short P52 ; IF NOT THEN DO WRITE CHARACTER 4138 <1> P51: 4139 <1> ;mov ah, 0Eh ; TTY_CHARACTER_WRITE 4140 <1> ;int 10h ; WRITE TTY CHARACTER TO THE CRT 4141 <1> 4142 00002492 E85BFEFFFF <1> call _write_tty_m3 4143 <1> 4144 00002497 5A <1> pop edx ; * 4145 00002498 5E <1> pop esi ; ** 4146 <1> 4147 00002499 668B96[CE760100] <1> mov dx, [esi+CURSOR_POSN] ; GET CURRENT CURSOR POSITION 4148 000024A0 EB44 <1> jmp short P54 ; SET CURSOR POSITION AND CONTINUE 4149 <1> P55: 4150 000024A2 E9C4F6FFFF <1> jmp VIDEO_RETURN 4151 <1> P52: 4152 <1> ;mov cx, 1 ; SET CHARACTER WRITE AMOUNT TO ONE 4153 <1> ; 02/08/2022 4154 000024A7 29C9 <1> sub ecx, ecx 4155 000024A9 FEC1 <1> inc cl 4156 <1> ; ecx = 1 4157 000024AB 803D[48830100]02 <1> cmp byte [w_str_cmd], 2 ; IS THE ATTRIBUTE IN THE STRING 4158 000024B2 7204 <1> jb short P53 ; IF NOT THEN SKIP 4159 000024B4 8A5D00 <1> mov bl, [ebp] ; ELSE GET NEW ATTRIBUTE 4160 000024B7 45 <1> inc ebp ; BUMP STRING POINTER 4161 <1> P53: 4162 <1> ;mov ah, 09h ; GOT_CHARACTER 4163 <1> ;int 10h ; WRITE CHARACTER TO THE CRT 4164 <1> 4165 000024B8 E8A1FDFFFF <1> call _write_c_current 4166 <1> 4167 000024BD 5A <1> pop edx ; * 4168 <1> 4169 <1> ; 05/12/2020 4170 <1> ; bx is preserved in '_write_c_current' 4171 <1> ; 18/11/2020 4172 <1> ;mov ebx, [esp+4] ; *** 4173 <1> 4174 000024BE 0FB6F7 <1> movzx esi, bh ; video page number (0 to 7) 4175 000024C1 889E[37680000] <1> mov [esi+chr_attrib], bl ; color/attribute 4176 <1> 4177 000024C7 FEC2 <1> inc dl ; INCREMENT COLUMN COUNTER 4178 000024C9 3A15[30680000] <1> cmp dl, [CRT_COLS] ; IF COLS ARE WITHIN RANGE FOR THIS MODE 4179 <1> ;jb short P54 ; THEN GO TO COLUMNS SET 4180 000024CF 7214 <1> jb short P56 ; 05/12/2020 4181 000024D1 FEC6 <1> inc dh ; BUMP ROW COUNTER BY ONE 4182 000024D3 28D2 <1> sub dl, dl ; SET COLUMN COUNTER TO ZERO 4183 000024D5 80FE19 <1> cmp dh, 25 ; IF ROWS ARE LESS THAN 25 THEN 4184 <1> ;jb short P54 ; GO TO ROWS_COLUMNS_SET 4185 000024D8 720B <1> jb short P56 ; 05/12/2020 4186 <1> 4187 <1> ; 18/11/2020 4188 <1> ;mov ax, 0E0Ah ; ELSE SCROLL SCREEN 4189 <1> ;int 10h ; RESET ROW COUNTER TO 24 4190 <1> 4191 <1> ; 18/11/2020 4192 000024DA B00A <1> mov al, 0Ah ; line feed 4193 <1> 4194 000024DC E811FEFFFF <1> call _write_tty_m3 4195 <1> 4196 000024E1 66BA0018 <1> mov dx, 1800h ; Column = 0, Row = 24 4197 <1> P56: 4198 <1> ; 05/12/2020 4199 <1> ; 18/11/2020 4200 000024E5 5E <1> pop esi ; ** 4201 <1> P54: ; ROW_COLUMNS_SET 4202 <1> ;mov ax, 0200h ; SET NEW CURSOR POSITION COMMAND 4203 <1> ;int 10h ; ESTABLISH NEW CURSOR POSITION 4204 <1> 4205 <1> ; 18/11/2020 4206 000024E6 5B <1> pop ebx ; *** 4207 000024E7 59 <1> pop ecx ; **** 4208 <1> 4209 <1> ;loop P50 ; DO IT ONCE MORE UNTIL (CX) = ZERO 4210 000024E8 6649 <1> dec cx 4211 000024EA 7585 <1> jnz short P50next 4212 <1> 4213 000024EC 665A <1> pop dx ; ***** ; RESTORE OLD CURSOR COORDINATES 4214 <1> 4215 000024EE F605[48830100]01 <1> test byte [w_str_cmd], 1 ; IF CURSOR WAS NOT TO BE MOVED 4216 <1> ;jnz VIDEO_RETURN ; THEN EXIT WITHOUT RESETTING OLD VALUE 4217 <1> ; 03/08/2022 4218 000024F5 7505 <1> jnz short P58 4219 <1> 4220 <1> ;mov ax, 0200h ; ELSE RESTORE OLD CURSOR POSITION 4221 <1> ;int 10h 4222 <1> ; DONE - EXIT WRITE STRING 4223 000024F7 E87BFEFFFF <1> call _set_cpos 4224 <1> P58: 4225 000024FC E96AF6FFFF <1> jmp VIDEO_RETURN ; RETURN TO CALLER 4226 <1> 4227 <1> vga_write_string: 4228 <1> ; 04/08/2022 - TRDOS 386 Kernel v2.0.5 4229 <1> ; 12/09/2016 - TRDOS 386 (TRDOS v2.0) 4230 <1> ; 4231 <1> ; derived from 'Plex86/Bochs VGABios' source code 4232 <1> ; vgabios-0.7a (2011) 4233 <1> ; by the LGPL VGABios developers Team (2001-2008) 4234 <1> ; 'vgabios.c', ' biosfn_write_string' 4235 <1> 4236 <1> ; INPUT : 4237 <1> ; (AL) = WRITE STRING COMMAND 0 - 3 : 4238 <1> ; (BH) = DISPLAY PAGE (ACTIVE PAGE) : 4239 <1> ; (CX) = COUNT OF CHARACTERS TO WRITE, IF (CX) = 0 THEN RETURN : 4240 <1> ; (DX) = CURSOR POSITION FOR START OF STRING WRITE : 4241 <1> ; (BL) = ATTRIBUTE OF CHARACTER TO WRITE IF (AL) = 0 OR (AL) = 1 : 4242 <1> ; (EBP) = SOURCE STRING OFFSET : 4243 <1> ; OUTPUT : 4244 <1> ; NONE : 4245 <1> ;-------------------------------------------------------------------------; 4246 <1> 4247 <1> ; AL = 00h: Assign all characters the attribute in BL; do not update cursor 4248 <1> ; AL = 01h: Assign all characters the attribute in BL; update cursor 4249 <1> ; AL = 02h: Use attributes in string; do not update cursor 4250 <1> ; AL = 03h: Use attributes in string; update cursor 4251 <1> 4252 <1> ; biosfn_write_string(GET_AL(),GET_BH(),GET_BL(),CX,GET_DH(),GET_DL(),ES,BP); 4253 <1> ; static void biosfn_write_string (flag,page,attr,count,row,col,seg,offset) 4254 <1> 4255 <1> ; // Read curs info for the page 4256 <1> ; biosfn_get_cursor_pos(page,&dummy,&oldcurs); 4257 <1> ; bh = video page = 0 4258 <1> ;movzx esi, word [CURSOR_POSN] ; current cursor position for video page 0 4259 <1> 4260 <1> ; // if row=0xff special case : use current cursor position 4261 <1> ; if(row==0xff) 4262 <1> ; {col=oldcurs&0x00ff; 4263 <1> ; row=(oldcurs&0xff00)>>8; 4264 <1> ; } 4265 <1> 4266 <1> ;mov al, [w_str_cmd] 4267 <1> 4268 00002501 80FEFF <1> cmp dh, 0FFh 4269 00002504 7407 <1> je short vga_wstr_1 ; user current cursor position 4270 <1> vga_wstr_0: 4271 <1> ; set cursor position 4272 00002506 668915[CE760100] <1> mov [CURSOR_POSN], dx ; save cursor pos for pg 0 4273 <1> vga_wstr_1: 4274 0000250D 66FF35[CE760100] <1> push word [CURSOR_POSN] ; * 4275 <1> 4276 <1> ; ebp = string offset in system buffer (user buffer was copied to) 4277 <1> 4278 <1> ; while(count--!=0) 4279 <1> ; { 4280 <1> ; car=read_byte(seg,offset++); 4281 <1> ; if((flag&0x02)!=0) 4282 <1> ; attr=read_byte(seg,offset++); 4283 <1> ; biosfn_write_teletype(car,page,attr,WITH_ATTR); 4284 <1> ; } 4285 <1> 4286 <1> ;push eax ; ** 4287 <1> ;test al, 2 4288 00002514 F605[48830100]02 <1> test byte [w_str_cmd], 2 4289 0000251B 751D <1> jnz short vga_wstr_3 4290 0000251D 881D[DF760100] <1> mov [ccolor], bl 4291 <1> vga_wstr_2: 4292 00002523 51 <1> push ecx 4293 00002524 8A4500 <1> mov al, [ebp] 4294 00002527 E88F0A0000 <1> call vga_write_teletype 4295 0000252C 59 <1> pop ecx 4296 0000252D 6649 <1> dec cx 4297 0000252F 741E <1> jz short vga_wstr_4 4298 00002531 45 <1> inc ebp 4299 00002532 8A1D[DF760100] <1> mov bl, [ccolor] 4300 00002538 EBE9 <1> jmp short vga_wstr_2 4301 <1> vga_wstr_3: 4302 0000253A 51 <1> push ecx 4303 0000253B 8A4500 <1> mov al, [ebp] 4304 0000253E 45 <1> inc ebp 4305 0000253F 8A5D00 <1> mov bl, [ebp] 4306 00002542 E8740A0000 <1> call vga_write_teletype 4307 00002547 59 <1> pop ecx 4308 00002548 6649 <1> dec cx 4309 0000254A 7403 <1> jz short vga_wstr_4 4310 0000254C 45 <1> inc ebp 4311 0000254D EBEB <1> jmp short vga_wstr_3 4312 <1> vga_wstr_4: 4313 <1> ; // Set back curs pos 4314 <1> ; if((flag&0x01)==0) 4315 <1> ; biosfn_set_cursor_pos(page,oldcurs); 4316 <1> ; } 4317 <1> ;pop eax ; ** 4318 0000254F 665A <1> pop dx ; word [CURSOR_POSN] ; * 4319 <1> ;test al, 1 4320 00002551 F605[48830100]01 <1> test byte [w_str_cmd], 1 4321 <1> ;jnz VIDEO_RETURN 4322 <1> ; 04/08/2022 4323 00002558 7507 <1> jnz short vga_wstr_5 4324 0000255A 668915[CE760100] <1> mov [CURSOR_POSN], dx 4325 <1> vga_wstr_5: 4326 00002561 E905F6FFFF <1> jmp VIDEO_RETURN 4327 <1> 4328 <1> ; 03/08/2022 - TRDOS 386 Kernel v2.0.5 4329 <1> ; 07/07/2016 4330 <1> ; 27/06/2016 - TRDOS 386 (TRDOS v2.0) 4331 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 4332 <1> ;------------------------------------------------------ 4333 <1> ; SCROLL UP 4334 <1> ; THIS ROUTINE SCROLLS UP THE INFORMATION ON THE CRT 4335 <1> ; ENTRY --- 4336 <1> ; CH,CL = UPPER LEFT CORNER OF REGION TO SCROLL 4337 <1> ; DH,DL = LOWER RIGHT CORNER OF REGION TO SCROLL 4338 <1> ; BOTH OF THE ABOVE ARE IN CHARACTER POSITIONS 4339 <1> ; BH = FILL VALUE FOR BLANKED LINES 4340 <1> ; AL = # LINES TO SCROLL (AL=0 MEANS BLANK THE ENTIRE FIELD) 4341 <1> ; DS = DATA SEGMENT 4342 <1> ; ES = REGEN SEGMENT 4343 <1> ; EXIT -- 4344 <1> ; NOTHING, THE SCREEN IS SCROLLED 4345 <1> ;-------------------------------------------------------- 4346 <1> 4347 <1> ; cl = upper left column 4348 <1> ; ch = upper left row 4349 <1> ; dl = lower rigth column 4350 <1> ; dh = lower right row 4351 <1> ; 4352 <1> ; al = line count (AL=0 means blank entire fields) 4353 <1> ; bl = fill value for blanked lines 4354 <1> ; bh = unused 4355 <1> 4356 <1> GRAPHICS_UP: 4357 <1> ; 07/07/2016 4358 <1> ; AH = Current video mode, [CRT_MODE] 4359 00002566 80FC07 <1> cmp ah, 7 4360 00002569 7762 <1> ja short vga_graphics_up 4361 <1> ;je n0 4362 <1> 4363 0000256B 88C7 <1> mov bh, al ; save line count in BH 4364 <1> ;mov ax, cx ; GET UPPER LEFT POSITION INTO AX REG 4365 <1> ; 03/08/2022 4366 0000256D 89C8 <1> mov eax, ecx 4367 <1> 4368 <1> ;----- USE CHARACTER SUBROUTINE FOR POSITIONING 4369 <1> ;----- ADDRESS RETURNED IS MULTIPLIED BY 2 FROM CORRECT VALUE 4370 <1> 4371 0000256F E8BA050000 <1> call GRAPH_POSN 4372 <1> ;movzx edi, ax ; SAVE RESULT AS DESTINATION ADDRESS 4373 <1> ; 03/08/2022 4374 00002574 89C7 <1> mov edi, eax 4375 <1> 4376 <1> ;----- DETERMINE SIZE OF WINDOW 4377 <1> 4378 00002576 6629CA <1> sub dx, cx 4379 00002579 6681C20101 <1> add dx, 101h ; ADJUST VALUES 4380 0000257E C0E602 <1> sal dh, 2 ; MULTIPLY ROWS BY 4 AT 8 VERT DOTS/CHAR 4381 <1> ; AND EVEN/ODD ROWS 4382 <1> ;----- DETERMINE CRT MODE 4383 <1> 4384 00002581 803D[2E680000]06 <1> cmp byte [CRT_MODE], 6 ; TEST FOR MEDIUM RES 4385 00002588 7304 <1> jnc short _R7_ ; FIND_SOURCE 4386 <1> 4387 <1> ;----- MEDIUM RES UP 4388 0000258A D0E2 <1> sal dl, 1 ; # COLUMNS * 2, SINCE 2 BYTES/CHAR 4389 <1> ;sal di, 1 ; OFFSET *2 SINCE 2 BYTES/CHAR 4390 <1> ; 03/08/2022 4391 0000258C D1E7 <1> sal edi, 1 4392 <1> 4393 <1> ;----- DETERMINE THE SOURCE ADDRESS IN THE BUFFER 4394 <1> _R7_: ; FIND_SOURCE 4395 0000258E 81C700800B00 <1> add edi, 0B8000h 4396 00002594 C0E702 <1> sal bh, 2 ; multiply number of lines by 4 4397 00002597 7430 <1> jz short _R11 ; IF ZERO, THEN BLANK ENTIRE FIELD 4398 00002599 B050 <1> mov al, 80 ; 80 BYTES/ROW 4399 0000259B F6E7 <1> mul bh ; determine offset to source 4400 <1> ;movzx esi, ax ; offset to source 4401 <1> ; 03/08/2022 4402 0000259D 89C6 <1> mov esi, eax 4403 0000259F 01FE <1> add esi, edi ; SET UP SOURCE 4404 000025A1 88F4 <1> mov ah, dh ; NUMBER OF ROWS IN FIELD 4405 000025A3 28FC <1> sub ah, bh ; determine number to move 4406 <1> 4407 <1> ;----- LOOP THROUGH, MOVING ONE ROW AT A TIME, BOTH EVEN AND ODD FIELDS 4408 <1> _R8: ; ROW_LOOP 4409 000025A5 E8FD030000 <1> call _R17 ; MOVE ONE ROW 4410 000025AA 6681EEB01F <1> sub si, 2000h-80 ; MOVE TO NEXT ROW 4411 000025AF 6681EFB01F <1> sub di, 2000h-80 4412 000025B4 FECC <1> dec ah ; NUMBER OF ROWS TO MOVE 4413 000025B6 75ED <1> jnz short _R8 ; CONTINUE TILL ALL MOVED 4414 <1> 4415 <1> ;----- FILL IN THE VACATED LINE(S) 4416 <1> _R9: ; CLEAR ENTRY 4417 000025B8 88D8 <1> mov al, bl ; attribute to fill with 4418 <1> _R10_: 4419 000025BA E804040000 <1> call _R18 ; CLEAR THAT ROW 4420 000025BF 6681EFB01F <1> sub di, 2000h-80 ; POINT TO NEXT LINE 4421 000025C4 FECF <1> dec bh ; number of lines to fill 4422 000025C6 75F2 <1> jnz short _R10_ ; CLEAR LOOP 4423 000025C8 C3 <1> retn ; EVERYYHING DONE 4424 <1> 4425 <1> _R11: ; BLANK_FIELD 4426 000025C9 88F7 <1> mov bh, dh ; set blank count to everything in field 4427 000025CB EBEB <1> jmp short _R9 ; CLEAR THE FIELD 4428 <1> 4429 <1> vga_graphics_up: 4430 <1> ; 03/08/2022 - TRDOS 386 Kertnel v2.0.5 4431 <1> ; 12/04/2021 4432 <1> ; 08/08/2016 4433 <1> ; 07/08/2016 4434 <1> ; 04/08/2016 4435 <1> ; 01/08/2016 4436 <1> ; 31/07/2016 4437 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 4438 <1> ; 4439 <1> ; derived from 'Plex86/Bochs VGABios' source code 4440 <1> ; vgabios-0.7a (2011) 4441 <1> ; by the LGPL VGABios developers Team (2001-2008) 4442 <1> ; 'vgabios.c', 'biosfn_scroll' 4443 <1> ; 4444 <1> 4445 <1> ; cl = upper left column 4446 <1> ; ch = upper left row 4447 <1> ; dl = lower rigth column 4448 <1> ; dh = lower right row 4449 <1> ; 4450 <1> ; al = line count (AL=0 means blank entire fields) 4451 <1> ; bl = fill value for blanked lines 4452 <1> ; bh = unused 4453 <1> ; 4454 <1> ; ah = [CRT_MODE], current video mode 4455 <1> 4456 000025CD 88C7 <1> mov bh, al ; 31/07/2016 4457 000025CF BE[52680000] <1> mov esi, vga_g_modes 4458 000025D4 89F7 <1> mov edi, esi 4459 000025D6 83C708 <1> add edi, vga_g_mode_count 4460 <1> vga_g_up_0: 4461 000025D9 AC <1> lodsb 4462 000025DA 38E0 <1> cmp al, ah ; [CRT_MODE] 4463 000025DC 7405 <1> je short vga_g_up_1 4464 000025DE 39FE <1> cmp esi, edi 4465 000025E0 72F7 <1> jb short vga_g_up_0 4466 <1> ;xor bh, bh ; 31/07/2016) 4467 000025E2 C3 <1> retn ; nothing to do 4468 <1> vga_g_up_1: 4469 000025E3 88F8 <1> mov al, bh ; 31/07/2016 4470 000025E5 83C64F <1> add esi, vga_g_memmodel - (vga_g_modes + 1) 4471 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 4472 <1> 4473 <1> ; if(rlr>=nbrows)rlr=nbrows-1; 4474 <1> ; if(clr>=nbcols)clr=nbcols-1; 4475 <1> ; if(nblines>nbrows)nblines=0; 4476 <1> ; cols=clr-cul+1; 4477 <1> 4478 000025E8 3A35[36680000] <1> cmp dh, [VGA_ROWS] 4479 000025EE 7208 <1> jb short vga_g_up_2 4480 000025F0 8A35[36680000] <1> mov dh, [VGA_ROWS] 4481 000025F6 FECE <1> dec dh 4482 <1> vga_g_up_2: 4483 000025F8 3A15[30680000] <1> cmp dl, [CRT_COLS] ; = [VGA_COLS] 4484 000025FE 7208 <1> jb short vga_g_up_3 4485 00002600 8A15[30680000] <1> mov dl, [CRT_COLS] 4486 00002606 FECA <1> dec dl 4487 <1> vga_g_up_3: 4488 00002608 3A05[36680000] <1> cmp al, [VGA_ROWS] 4489 0000260E 7602 <1> jna short vga_g_up_4 4490 00002610 28C0 <1> sub al, al ; 0 4491 <1> vga_g_up_4: 4492 00002612 88D7 <1> mov bh, dl ; clr 4493 00002614 28CF <1> sub bh, cl ; cul 4494 00002616 FEC7 <1> inc bh ; cols = clr-cul+1 4495 <1> 4496 00002618 20C0 <1> and al, al ; nblines = 0 4497 0000261A 7559 <1> jnz short vga_g_up_6 4498 0000261C 20ED <1> and ch, ch ; rul = 0 4499 0000261E 7555 <1> jnz short vga_g_up_6 4500 00002620 20C9 <1> and cl, cl ; cul = 0 4501 00002622 7551 <1> jnz short vga_g_up_6 4502 <1> 4503 <1> ;push ax 4504 <1> ; 12/04/2021 4505 00002624 50 <1> push eax 4506 00002625 A0[36680000] <1> mov al, [VGA_ROWS] 4507 0000262A FEC8 <1> dec al 4508 0000262C 38C6 <1> cmp dh, al ; rlr = nbrows-1 4509 0000262E 7545 <1> jne short vga_g_up_5 4510 00002630 A0[30680000] <1> mov al, [CRT_COLS] ; = VGA_COLS 4511 00002635 FEC8 <1> dec al 4512 00002637 38C2 <1> cmp dl, al ; clr = nbcols-1 4513 <1> ;jne short vga_g_up_5 4514 <1> ;;pop ax 4515 <1> ; 12/04/2021 4516 00002639 58 <1> pop eax 4517 0000263A 7539 <1> jne short vga_g_up_5 4518 <1> 4519 0000263C 66B80502 <1> mov ax, 0205h 4520 00002640 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4521 00002644 66EF <1> out dx, ax 4522 00002646 A0[36680000] <1> mov al, [VGA_ROWS] 4523 0000264B 8A25[30680000] <1> mov ah, [CRT_COLS] ; = [VGA_COLS] 4524 00002651 F6E4 <1> mul ah 4525 00002653 0FB7D0 <1> movzx edx, ax 4526 <1> ; 08/08/2016 4527 00002656 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 4528 0000265D F7E2 <1> mul edx 4529 <1> ; eax = byte count 4530 0000265F 89C1 <1> mov ecx, eax 4531 <1> ;; 07/08/2016 4532 <1> ;shl dx, 3 ; * 8 ; * [CHAR_HEIGHT] 4533 <1> ;mov ecx, edx 4534 00002661 88D8 <1> mov al, bl ; fill value for blanked lines 4535 00002663 BF00000A00 <1> mov edi, 0A0000h 4536 00002668 F3AA <1> rep stosb 4537 <1> 4538 <1> ;mov ax, 5 4539 <1> ; 03/08/2022 4540 0000266A 30E4 <1> xor ah, ah 4541 0000266C B005 <1> mov al, 5 4542 <1> 4543 0000266E 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4544 00002672 66EF <1> out dx, ax ; 0005h 4545 <1> 4546 00002674 C3 <1> retn 4547 <1> 4548 <1> vga_g_up_5: 4549 <1> ;;pop ax 4550 <1> ; 12/04/2021 4551 <1> ;pop eax 4552 <1> 4553 <1> vga_g_up_6: 4554 <1> ; [ESI] = VGA memory model number for current video mode 4555 <1> ; 4556 <1> ; LINEAR8 equ 5 4557 <1> ; PLANAR4 equ 4 4558 <1> ; PLANAR1 equ 3 4559 <1> 4560 00002675 803E04 <1> cmp byte [esi], PLANAR4 4561 00002678 7424 <1> je short vga_g_up_planar 4562 0000267A 803E03 <1> cmp byte [esi], PLANAR1 4563 0000267D 741F <1> je short vga_g_up_planar 4564 <1> vga_g_up_linear8: 4565 <1> ; 07/07/2016 (TEMPORARY) 4566 <1> ; 4567 <1> ; cl = upper left column ; cul 4568 <1> ; ch = upper left row ; rul 4569 <1> ; dl = lower rigth column ; clr 4570 <1> ; dh = lower right row ; rlr 4571 <1> 4572 <1> vga_g_up_l0: 4573 <1> ;{for(i=rul;i<=rlr;i++) 4574 <1> ; if((i+nblines>rlr)||(nblines==0)) 4575 0000267F 08C0 <1> or al, al 4576 00002681 7414 <1> jz short vga_g_up_l2 4577 00002683 88C4 <1> mov ah, al 4578 00002685 00EC <1> add ah, ch ; i+nblines 4579 <1> ;jc short vga_g_up_l2 4580 00002687 38F4 <1> cmp ah, dh 4581 00002689 770C <1> ja short vga_g_up_l2 4582 <1> ; else 4583 <1> ; vgamem_copy_pl4(cul,i+nblines,i,cols,nbcols,cheight); 4584 0000268B E8F2000000 <1> call vgamem_copy_l8 4585 <1> vga_g_up_l1: 4586 00002690 FEC5 <1> inc ch 4587 00002692 38F5 <1> cmp ch, dh 4588 00002694 76E9 <1> jna short vga_g_up_l0 4589 00002696 C3 <1> retn 4590 <1> vga_g_up_l2: 4591 <1> ; vgamem_fill_pl4(cul,i,cols,nbcols,cheight,attr); 4592 00002697 E84C010000 <1> call vgamem_fill_l8 4593 0000269C EBF2 <1> jmp short vga_g_up_l1 4594 <1> 4595 <1> vga_g_up_planar: 4596 <1> ; cl = upper left column ; cul 4597 <1> ; ch = upper left row ; rul 4598 <1> ; dl = lower rigth column ; clr 4599 <1> ; dh = lower right row ; rlr 4600 <1> vga_g_up_pl0: 4601 <1> ;{for(i=rul;i<=rlr;i++) 4602 <1> ; if((i+nblines>rlr)||(nblines==0)) 4603 0000269E 20C0 <1> and al, al 4604 000026A0 7414 <1> jz short vga_g_up_pl2 4605 000026A2 88C4 <1> mov ah, al 4606 000026A4 00EC <1> add ah, ch ; i+nblines 4607 <1> ;jc short vga_g_up_pl2 4608 000026A6 38F4 <1> cmp ah, dh 4609 000026A8 770C <1> ja short vga_g_up_pl2 4610 <1> ; else 4611 <1> ; vgamem_copy_pl4(cul,i+nblines,i,cols,nbcols,cheight); 4612 000026AA E80E000000 <1> call vgamem_copy_pl4 4613 <1> vga_g_up_pl1: 4614 000026AF FEC5 <1> inc ch 4615 000026B1 38F5 <1> cmp ch, dh 4616 000026B3 76E9 <1> jna short vga_g_up_pl0 4617 000026B5 C3 <1> retn 4618 <1> vga_g_up_pl2: 4619 <1> ; vgamem_fill_pl4(cul,i,cols,nbcols,cheight,attr); 4620 000026B6 E870000000 <1> call vgamem_fill_pl4 4621 000026BB EBF2 <1> jmp short vga_g_up_pl1 4622 <1> 4623 <1> vgamem_copy_pl4: 4624 <1> ; 08/08/2016 4625 <1> ; 07/08/2016 4626 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 4627 <1> ; 4628 <1> ; derived from 'Plex86/Bochs VGABios' source code 4629 <1> ; vgabios-0.7a (2011) 4630 <1> ; by the LGPL VGABios developers Team (2001-2008) 4631 <1> ; 'vgabios.c', 'vgamem_copy_pl4' 4632 <1> ; 4633 <1> ; vgamem_copy_pl4(xstart,ysrc,ydest,cols,nbcols,cheight) 4634 <1> ; cl = xstart, ah = ysrc (i+nblines), ch = ydest (i), 4635 <1> ; bh = cols, [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight 4636 <1> 4637 <1> ; src=ysrc*cheight*nbcols+xstart; 4638 <1> ; dest=ydest*cheight*nbcols+xstart; 4639 <1> 4640 000026BD 52 <1> push edx 4641 000026BE 50 <1> push eax 4642 <1> 4643 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0105) 4644 000026BF 66B80501 <1> mov ax, 0105h 4645 000026C3 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4646 000026C7 66EF <1> out dx, ax 4647 <1> 4648 <1> ; 07/08/2016 4649 <1> ;mov ah, [esp+1] 4650 <1> ;movzx edx, ah ; ysrc 4651 000026C9 0FB6542401 <1> movzx edx, byte [esp+1] 4652 <1> ; 08/08/2016 4653 000026CE 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 4654 000026D5 8A25[30680000] <1> mov ah, [CRT_COLS] ; nbcols 4655 000026DB F6E4 <1> mul ah 4656 <1> ;; 07/08/2016 4657 <1> ;movzx eax, byte [CRT_COLS] 4658 <1> ;shl ax, 3 ; * 8 ; * [CHAR_HEIGHT] 4659 000026DD 50 <1> push eax ; cheight * nbcols 4660 000026DE F7E2 <1> mul edx ; * ysrc 4661 <1> ; eax = ysrc * cheight * nbcols 4662 <1> ; edx = 0 4663 000026E0 88CA <1> mov dl, cl ; edx = xstart 4664 000026E2 01D0 <1> add eax, edx 4665 000026E4 89C6 <1> mov esi, eax ; src 4666 000026E6 88EA <1> mov dl, ch ; ydest 4667 000026E8 58 <1> pop eax ; cheight * nbcols 4668 000026E9 F7E2 <1> mul edx 4669 <1> ; eax = ydest * cheight * nbcols 4670 000026EB 88CA <1> mov dl, cl ; edx = xstart 4671 000026ED 01D0 <1> add eax, edx 4672 000026EF 89C7 <1> mov edi, eax ; dest 4673 <1> ; esi = src 4674 <1> ; edi = dest 4675 <1> ; for(i=0;i ; { 4677 <1> ; memcpyb(0xa000,dest+i*nbcols,0xa000,src+i*nbcols,cols); 4678 <1> ; } 4679 000026F1 51 <1> push ecx 4680 000026F2 B900000A00 <1> mov ecx, 0A0000h 4681 000026F7 01CE <1> add esi, ecx 4682 000026F9 01CF <1> add edi, ecx 4683 <1> ; 08/08/2016 4684 000026FB 8A35[32680000] <1> mov dh, [CHAR_HEIGHT] 4685 <1> ;; 07/08/2016 4686 <1> ;mov dh, 8 ; 07/08/2016 4687 00002701 28D2 <1> sub dl, dl ; i 4688 <1> vgamem_copy_pl4_0: 4689 00002703 56 <1> push esi 4690 00002704 57 <1> push edi 4691 00002705 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] 4692 0000270C F6E2 <1> mul dl 4693 <1> ; eax = i * nbcols 4694 0000270E 01C7 <1> add edi, eax ; dest+i*nbcols 4695 00002710 01C6 <1> add esi, eax 4696 00002712 0FB6CF <1> movzx ecx, bh ; cols 4697 00002715 F3A4 <1> rep movsb 4698 00002717 5F <1> pop edi 4699 00002718 5E <1> pop esi 4700 00002719 FECE <1> dec dh 4701 0000271B 75E6 <1> jnz short vgamem_copy_pl4_0 4702 <1> vgamem_copy_pl4_1: 4703 0000271D 59 <1> pop ecx 4704 <1> 4705 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0005); 4706 0000271E 66B80500 <1> mov ax, 0005h 4707 00002722 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4708 00002726 66EF <1> out dx, ax 4709 <1> 4710 00002728 58 <1> pop eax 4711 00002729 5A <1> pop edx 4712 <1> 4713 0000272A C3 <1> retn 4714 <1> 4715 <1> vgamem_fill_pl4: 4716 <1> ; 08/08/2016 4717 <1> ; 07/08/2016 4718 <1> ; 04/08/2016 4719 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 4720 <1> ; 4721 <1> ; derived from 'Plex86/Bochs VGABios' source code 4722 <1> ; vgabios-0.7a (2011) 4723 <1> ; by the LGPL VGABios developers Team (2001-2008) 4724 <1> ; 'vgabios.c', 'vgamem_fill_pl4' 4725 <1> ; 4726 <1> ; vgamem_fill_pl4(xstart,ystart,cols,nbcols,cheight,attr) 4727 <1> ; cl = xstart, edi = ch = ystart, bh = cols, 4728 <1> ; [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight, attr = 0 4729 <1> 4730 <1> ; dest=ystart*cheight*nbcols+xstart; 4731 0000272B 52 <1> push edx 4732 0000272C 50 <1> push eax 4733 <1> 4734 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0205) 4735 0000272D 66B80502 <1> mov ax, 0205h 4736 00002731 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4737 00002735 66EF <1> out dx, ax 4738 <1> 4739 <1> ; 08/08/2016 4740 00002737 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 4741 0000273E F6E5 <1> mul ch 4742 <1> ;; 07/08/2016 4743 <1> ;movzx eax, ch 4744 <1> ;shl ax, 3 ; * 8 ; * [CHAR_HEIGHT] 4745 00002740 0FB615[30680000] <1> movzx edx, byte [CRT_COLS] ; = [VGA_COLS] 4746 00002747 F7E2 <1> mul edx 4747 <1> ; edx = 0 4748 00002749 88CA <1> mov dl, cl 4749 0000274B 01D0 <1> add eax, edx 4750 0000274D 89C7 <1> mov edi, eax 4751 <1> ; edi = dest 4752 <1> ; for(i=0;i ; { 4754 <1> ; memsetb(0xa000,dest+i*nbcols,attr,cols); 4755 <1> ; } 4756 0000274F 81C700000A00 <1> add edi, 0A0000h 4757 00002755 51 <1> push ecx 4758 <1> ; 08/08/2016 4759 00002756 8A35[32680000] <1> mov dh, [CHAR_HEIGHT] 4760 <1> ;; 07/08/2016 4761 <1> ;mov dh, 8 ; 07/08/2016 4762 0000275C 28D2 <1> sub dl, dl ; i 4763 <1> vgamem_fill_pl4_0: 4764 0000275E 57 <1> push edi 4765 0000275F 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] 4766 00002766 F6E2 <1> mul dl 4767 <1> ; eax = i * nbcols 4768 00002768 01C7 <1> add edi, eax ; dest+i*nbcols 4769 0000276A 88D8 <1> mov al, bl ; attr ; 04/08/2016 4770 0000276C 0FB6CF <1> movzx ecx, bh ; cols 4771 0000276F F3AA <1> rep stosb 4772 00002771 5F <1> pop edi 4773 00002772 75EA <1> jnz short vgamem_fill_pl4_0 4774 <1> vgamem_fill_pl4_1: 4775 00002774 59 <1> pop ecx 4776 <1> 4777 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0005); 4778 00002775 66B80500 <1> mov ax, 0005h 4779 00002779 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4780 0000277D 66EF <1> out dx, ax 4781 <1> 4782 0000277F 58 <1> pop eax 4783 00002780 5A <1> pop edx 4784 <1> 4785 00002781 C3 <1> retn 4786 <1> 4787 <1> vgamem_copy_l8: 4788 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 4789 <1> ; 08/08/2016 4790 <1> ; 07/08/2016 4791 <1> ; 06/08/2016 4792 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 4793 <1> ; 4794 <1> ; TEMPORARY 4795 <1> ; 4796 <1> ; derived from 'Plex86/Bochs VGABios' source code 4797 <1> ; vgabios-0.7a (2011) 4798 <1> ; by the LGPL VGABios developers Team (2001-2008) 4799 <1> ; 'vgabios.c', 'vgamem_copy_pl4' 4800 <1> ; 4801 <1> ; vgamem_copy_pl4(xstart,ysrc,ydest,cols,nbcols,cheight) 4802 <1> ; cl = xstart, ah = ysrc (i+nblines), ch = ydest (i), 4803 <1> ; bh = cols, [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight 4804 <1> 4805 <1> ; src=ysrc*cheight*nbcols+xstart; 4806 <1> ; dest=ydest*cheight*nbcols+xstart; 4807 <1> 4808 00002782 52 <1> push edx 4809 00002783 50 <1> push eax 4810 <1> 4811 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0105) 4812 <1> ;mov ax, 0105h 4813 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4814 <1> ;out dx, ax 4815 <1> 4816 <1> ;mov ah, [esp+1] 4817 <1> 4818 00002784 0FB6D4 <1> movzx edx, ah ; ysrc 4819 <1> ; 08/08/2016 4820 00002787 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 4821 0000278E 8A25[30680000] <1> mov ah, [CRT_COLS] ; nbcols 4822 00002794 F6E4 <1> mul ah 4823 <1> ;; 07/08/2016 4824 <1> ;movzx eax, byte [CRT_COLS] 4825 <1> ;shl ax, 3 ; * 8 ; * [CHAR_HEIGHT] 4826 00002796 50 <1> push eax ; cheight * nbcols 4827 00002797 F7E2 <1> mul edx ; * ysrc 4828 <1> ; eax = ysrc * cheight * nbcols 4829 <1> ; edx = 0 4830 00002799 88CA <1> mov dl, cl ; edx = xstart 4831 0000279B 01D0 <1> add eax, edx 4832 0000279D 89C6 <1> mov esi, eax ; src 4833 <1> ;shl si, 3 ; * 8 ; 06/08/2016 4834 <1> ; 02/08/2022 4835 0000279F C1E603 <1> shl esi, 3 4836 000027A2 88EA <1> mov dl, ch ; ydest 4837 000027A4 58 <1> pop eax ; cheight * nbcols 4838 000027A5 F7E2 <1> mul edx 4839 <1> ; eax = ydest * cheight * nbcols 4840 000027A7 88CA <1> mov dl, cl ; edx = xstart 4841 000027A9 01D0 <1> add eax, edx 4842 000027AB 89C7 <1> mov edi, eax ; dest 4843 <1> ;shl di, 3 ; * 8 ; 06/08/2016 4844 <1> ; 02/08/2022 4845 000027AD C1E703 <1> shl edi, 3 4846 <1> ; esi = src 4847 <1> ; edi = dest 4848 <1> ; for(i=0;i ; { 4850 <1> ; memcpyb(0xa000,dest+i*nbcols,0xa000,src+i*nbcols,cols); 4851 <1> ; } 4852 000027B0 51 <1> push ecx 4853 000027B1 B900000A00 <1> mov ecx, 0A0000h 4854 000027B6 01CE <1> add esi, ecx 4855 000027B8 01CF <1> add edi, ecx 4856 <1> ; 08/08/2016 4857 000027BA 8A35[32680000] <1> mov dh, [CHAR_HEIGHT] 4858 <1> ;; 07/08/2016 4859 <1> ;mov dh, 8 ; 07/08/2016 4860 000027C0 28D2 <1> sub dl, dl ; i 4861 <1> vgamem_copy_l8_0: 4862 000027C2 56 <1> push esi 4863 000027C3 57 <1> push edi 4864 000027C4 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] 4865 000027CB F6E2 <1> mul dl 4866 <1> ; eax = i * nbcols 4867 <1> ;shl ax, 3 ; * 8 ; 06/08/2016 4868 <1> ; 02/08/2022 4869 000027CD C1E003 <1> shl eax, 3 4870 000027D0 01C7 <1> add edi, eax ; dest+i*nbcols 4871 000027D2 01C6 <1> add esi, eax 4872 000027D4 0FB6CF <1> movzx ecx, bh ; cols 4873 <1> ;shl cx, 3 ; * 8 ; 06/08/2016 4874 <1> ; 02/08/2022 4875 000027D7 C1E103 <1> shl ecx, 3 4876 000027DA F3A4 <1> rep movsb 4877 000027DC 5F <1> pop edi 4878 000027DD 5E <1> pop esi 4879 000027DE FEC2 <1> inc dl ; 06/08/2016 4880 000027E0 FECE <1> dec dh 4881 000027E2 75DE <1> jnz short vgamem_copy_l8_0 4882 <1> vgamem_copy_l8_1: 4883 000027E4 59 <1> pop ecx 4884 <1> 4885 <1> ;; outw(VGAREG_GRDC_ADDRESS, 0x0005); 4886 <1> ;mov ax, 0005h 4887 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4888 <1> ;out dx, ax 4889 <1> 4890 000027E5 58 <1> pop eax 4891 000027E6 5A <1> pop edx 4892 <1> 4893 000027E7 C3 <1> retn 4894 <1> 4895 <1> vgamem_fill_l8: 4896 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 4897 <1> ; 08/08/2016 4898 <1> ; 07/08/2016 4899 <1> ; 06/08/2016 4900 <1> ; 04/08/2016 4901 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 4902 <1> ; 4903 <1> ; TEMPORARY 4904 <1> ; 4905 <1> ; derived from 'Plex86/Bochs VGABios' source code 4906 <1> ; vgabios-0.7a (2011) 4907 <1> ; by the LGPL VGABios developers Team (2001-2008) 4908 <1> ; 'vgabios.c', 'vgamem_fill_pl4' 4909 <1> ; 4910 <1> ; vgamem_fill_pl4(xstart,ystart,cols,nbcols,cheight,attr) 4911 <1> ; cl = xstart, edi = ch = ystart, bh = cols, 4912 <1> ; [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight, attr = 0 4913 <1> 4914 <1> ; dest=ystart*cheight*nbcols+xstart; 4915 000027E8 52 <1> push edx 4916 000027E9 50 <1> push eax 4917 <1> 4918 <1> ;; outw(VGAREG_GRDC_ADDRESS, 0x0205) 4919 <1> ;mov ax, 0205h 4920 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4921 <1> ;out dx, ax 4922 <1> 4923 <1> ; 08/08/2016 4924 000027EA 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 4925 000027F1 F6E5 <1> mul ch 4926 <1> ;; 07/08/2016 4927 <1> ;movzx eax, ch 4928 <1> ;shl ax, 3 ; * 8 ; * [CHAR_HEIGHT] 4929 000027F3 0FB615[30680000] <1> movzx edx, byte [CRT_COLS] ; = [VGA_COLS] 4930 000027FA F7E2 <1> mul edx 4931 <1> ; edx = 0 4932 000027FC 88CA <1> mov dl, cl 4933 000027FE 01D0 <1> add eax, edx 4934 00002800 89C7 <1> mov edi, eax 4935 <1> ;shl di, 3 ; * 8 ; 06/08/2016 4936 <1> ; 02/08/2022 4937 00002802 C1E703 <1> shl edi, 3 4938 <1> ; edi = dest 4939 <1> ; for(i=0;i ; { 4941 <1> ; memsetb(0xa000,dest+i*nbcols,attr,cols); 4942 <1> ; } 4943 00002805 81C700000A00 <1> add edi, 0A0000h 4944 0000280B 51 <1> push ecx 4945 <1> ; 08/08/2016 4946 0000280C 8A35[32680000] <1> mov dh, [CHAR_HEIGHT] 4947 <1> ;; 07/08/2016 4948 <1> ;mov dh, 8 ; 07/08/2016 4949 00002812 28D2 <1> sub dl, dl ; i 4950 <1> vgamem_fill_l8_0: 4951 00002814 57 <1> push edi 4952 00002815 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] 4953 0000281C F6E2 <1> mul dl 4954 <1> ; eax = i * nbcols 4955 <1> ;shl ax, 3 ; * 8 ; 06/08/2016 4956 <1> ; 02/08/2022 4957 0000281E C1E003 <1> shl eax, 3 4958 00002821 01C7 <1> add edi, eax ; dest+i*nbcols 4959 00002823 88D8 <1> mov al, bl ; attr ; 04/08/2016 4960 00002825 0FB6CF <1> movzx ecx, bh ; cols 4961 <1> ;shl cx, 3 ; * 8 ; 06/08/2016 4962 <1> ; 02/08/2022 4963 00002828 C1E103 <1> shl ecx, 3 4964 0000282B F3AA <1> rep stosb 4965 0000282D 5F <1> pop edi 4966 0000282E FEC2 <1> inc dl ; 06/08/2016 4967 00002830 FECE <1> dec dh 4968 00002832 75E0 <1> jnz short vgamem_fill_l8_0 4969 <1> vgamem_fill_l8_1: 4970 00002834 59 <1> pop ecx 4971 <1> 4972 <1> ;; outw(VGAREG_GRDC_ADDRESS, 0x0005); 4973 <1> ;mov ax, 0005h 4974 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 4975 <1> ;out dx, ax 4976 <1> 4977 00002835 58 <1> pop eax 4978 00002836 5A <1> pop edx 4979 <1> 4980 00002837 C3 <1> retn 4981 <1> 4982 <1> ; 03/08/2022 - TRDOS 386 Kernel V2.0.5 4983 <1> ; 07/07/2016 4984 <1> ; 27/06/2016 - TRDOS 386 (TRDOS v2.0) 4985 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 4986 <1> ;------------------------------------------------------ 4987 <1> ; SCROLL DOWN 4988 <1> ; THIS ROUTINE SCROLLS DOWN THE INFORMATION ON THE CRT 4989 <1> ; ENTRY -- 4990 <1> ; CH,CL = UPPER LEFT CORNER OF REGION TO SCROLL 4991 <1> ; DH,DL = LOWER RIGHT CORNER OF REGION TO SCROLL 4992 <1> ; BOTH OF THE ABOVE ARE IN CHARACTER POSITIONS 4993 <1> ; BH = FILL VALUE FOR BLANKED LINES 4994 <1> ; AL = # LINES TO SCROLL (AL=0 MEANS BLANK THE ENTIRE FIELD) 4995 <1> ; DS = DATA SEGMENT 4996 <1> ; ES = REGEN SEGMENT 4997 <1> ; EXIT -- 4998 <1> ; NOTHING, THE SCREEN IS SCROLLED 4999 <1> ;-------------------------------------------------------- 5000 <1> 5001 <1> ; cl = upper left column 5002 <1> ; ch = upper left row 5003 <1> ; dl = lower rigth column 5004 <1> ; dh = lower right row 5005 <1> ; 5006 <1> ; al = line count (AL=0 means blank entire fields) 5007 <1> ; bl = fill value for blanked lines 5008 <1> ; bh = unused 5009 <1> 5010 <1> GRAPHICS_DOWN: 5011 <1> ; 07/07/2016 5012 <1> ; ah = Current video mode, [CRT_MODE] 5013 <1> ; std ; SET DIRECTION 5014 00002838 80FC07 <1> cmp ah, 7 5015 0000283B 7769 <1> ja short vga_graphics_down ; 03/08/2022 5016 <1> ;je _n0 5017 <1> 5018 0000283D 88C7 <1> mov bh, al ; save line count in BH 5019 <1> ;mov ax, dx ; GET LOWER RIGHT POSITION INTO AX REG 5020 <1> ; 03/08/2022 5021 0000283F 89D0 <1> mov eax, edx 5022 <1> 5023 <1> ;----- USE CHARACTER SUBROUTINE FOR POSITIONING 5024 <1> ;----- ADDRESS RETURNED IS MULTIPLIED BY 2 FROM CORRECT VALUE 5025 <1> 5026 00002841 E8E8020000 <1> call GRAPH_POSN 5027 <1> ;movzx edi, ax ; SAVE RESULT AS DESTINATION ADDRESS 5028 <1> ; 03/08/2022 5029 00002846 89C7 <1> mov edi, eax 5030 <1> 5031 <1> ;----- DETERMINE SIZE OF WINDOW 5032 <1> 5033 00002848 6629CA <1> sub dx, cx 5034 0000284B 6681C20101 <1> add dx, 101h ; ADJUST VALUES 5035 00002850 C0E602 <1> sal dh, 2 ; MULTIPLY ROWS BY 4 AT 8 VERT DOTS/CHAR 5036 <1> ; AND EVEN/ODD ROWS 5037 <1> ;----- DETERMINE CRT MODE 5038 <1> 5039 00002853 803D[2E680000]06 <1> cmp byte [CRT_MODE], 6 ; TEST FOR MEDIUM RES 5040 0000285A 7305 <1> jnc short _R12 ; FIND_SOURCE_DOWN 5041 <1> 5042 <1> ;----- MEDIUM RES DOWN 5043 0000285C D0E2 <1> sal dl, 1 ; # COLUMNS * 2, SINCE 2 BYTES/CHAR 5044 <1> ;sal di, 1 ; OFFSET *2 SINCE 2 BYTES/CHAR 5045 <1> ; 03/08/2022 5046 0000285E D1E7 <1> sal edi, 1 5047 <1> ;inc di ; POINT TO LAST BYTE 5048 <1> ; 03/08/2022 5049 00002860 47 <1> inc edi 5050 <1> 5051 <1> ;----- DETERMINE THE SOURCE ADDRESS IN THE BUFFER 5052 <1> 5053 <1> _R12: ; FIND_SOURCE_DOWN 5054 00002861 81C700800B00 <1> add edi, 0B8000h 5055 00002867 6681C7F000 <1> add di, 240 ; POINT TO LAST ROW OF PIXELS 5056 0000286C C0E702 <1> sal bh, 2 ; multiply number of lines by 4 5057 0000286F 74(06) <1> jz short 6 ; IF ZERO, THEN BLANK ENTIRE FIELD 5058 00002871 B050 <1> mov al, 80 ; 80 BYTES/ROW 5059 00002873 F6E7 <1> mul bh ; determine offset to source 5060 00002875 89FE <1> mov esi, edi ; SET UP SOURCE 5061 <1> ;sub si, ax ; SUBTRACT THE OFFSET 5062 <1> ; 03/08/2022 5063 00002877 29C6 <1> sub esi, eax 5064 00002879 88F4 <1> mov ah, dh ; NUMBER OF ROWS IN FIELD 5065 0000287B 28FC <1> sub ah, bh ; determine number to move 5066 <1> 5067 <1> ;----- LOOP THROUGH, MOVING ONE ROW AT A TIME, BOTH EVEN AND ODD FIELDS 5068 <1> 5069 <1> _R13: ; ROW_LOOP_DOWN 5070 0000287D E825010000 <1> call _R17 ; MOVE ONE ROW 5071 00002882 6681EE5020 <1> sub si, 2000h+80 ; MOVE TO NEXT ROW 5072 00002887 6681EF5020 <1> sub di, 2000h+80 5073 0000288C FECC <1> dec ah ; NUMBER OF ROWS TO MOVE 5074 0000288E 75ED <1> jnz short _R13 ; CONTINUE TILL ALL MOVED 5075 <1> 5076 <1> ;----- FILL IN THE VACATED LINE(S) 5077 <1> _R14: ; CLEAR_ENTRY_DOWN 5078 00002890 88D8 <1> mov al, bl ; attribute to fill with 5079 <1> _R15_: ; CLEAR_LOOP_DOWN 5080 00002892 E82C010000 <1> call _R18 ; CLEAR A ROW 5081 00002897 6681EF5020 <1> sub di, 2000h+80 ; POINT TO NEXT LINE 5082 0000289C FECF <1> dec bh ; number of lines to fill 5083 0000289E 75F2 <1> jnz short _R15_ ; CLEAR_LOOP_DOWN 5084 <1> ; 18/11/2020 5085 000028A0 FC <1> cld ; RESET THE DIRECTION FLAG 5086 <1> 5087 000028A1 C3 <1> retn ; EVERYTHING DONE 5088 <1> 5089 <1> _R16: ; BLANK_FIELD_DOWN 5090 000028A2 88F7 <1> mov bh, dh ; set blank count to everything in field 5091 000028A4 EBEA <1> jmp short _R14 ; CLEAR THE FIELD 5092 <1> 5093 <1> vga_graphics_down: 5094 <1> ; 03/08/2022 - TRDOS 386 Kertnel v2.0.5 5095 <1> ; 12/04/2021 5096 <1> ; 08/08/2016 5097 <1> ; 07/08/2016 5098 <1> ; 31/07/2016 5099 <1> ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 5100 <1> ; 5101 <1> ; derived from 'Plex86/Bochs VGABios' source code 5102 <1> ; vgabios-0.7a (2011) 5103 <1> ; by the LGPL VGABios developers Team (2001-2008) 5104 <1> ; 'vgabios.c', 'biosfn_scroll' 5105 <1> ; 5106 <1> 5107 <1> ; cl = upper left column 5108 <1> ; ch = upper left row 5109 <1> ; dl = lower rigth column 5110 <1> ; dh = lower right row 5111 <1> ; 5112 <1> ; al = line count (AL=0 means blank entire fields) 5113 <1> ; bl = fill value for blanked lines 5114 <1> ; bh = unused 5115 <1> ; 5116 <1> ; ah = [CRT_MODE], current video mode 5117 <1> 5118 000028A6 FC <1> cld ; !!! Clear direction flag !!! 5119 <1> 5120 000028A7 88C7 <1> mov bh, al ; 31/07/2016 5121 <1> 5122 000028A9 BE[4A680000] <1> mov esi, vga_modes 5123 000028AE 89F7 <1> mov edi, esi 5124 000028B0 83C710 <1> add edi, vga_mode_count 5125 <1> vga_g_down_0: 5126 000028B3 AC <1> lodsb 5127 000028B4 38E0 <1> cmp al, ah ; [CRT_MODE] 5128 000028B6 7405 <1> je short vga_g_down_1 5129 000028B8 39FE <1> cmp esi, edi 5130 000028BA 72F7 <1> jb short vga_g_down_0 5131 <1> ; xor bh, bh ; 31/07/2016 5132 000028BC C3 <1> retn ; nothing to do 5133 <1> vga_g_down_1: 5134 000028BD 88F8 <1> mov al, bh ; 31/07/2016 5135 000028BF 83C64F <1> add esi, vga_memmodel - (vga_modes + 1) 5136 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 5137 <1> 5138 <1> ; if(rlr>=nbrows)rlr=nbrows-1; 5139 <1> ; if(clr>=nbcols)clr=nbcols-1; 5140 <1> ; if(nblines>nbrows)nblines=0; 5141 <1> ; cols=clr-cul+1; 5142 <1> 5143 000028C2 3A35[36680000] <1> cmp dh, [VGA_ROWS] 5144 000028C8 7208 <1> jb short vga_g_down_2 5145 000028CA 8A35[36680000] <1> mov dh, [VGA_ROWS] 5146 000028D0 FECE <1> dec dh 5147 <1> vga_g_down_2: 5148 000028D2 3A15[30680000] <1> cmp dl, [CRT_COLS] ; = [VGA_COLS] 5149 000028D8 7208 <1> jb short vga_g_down_3 5150 000028DA 8A15[30680000] <1> mov dl, [CRT_COLS] 5151 000028E0 FECA <1> dec dl 5152 <1> vga_g_down_3: 5153 000028E2 3A05[36680000] <1> cmp al, [VGA_ROWS] 5154 000028E8 7602 <1> jna short vga_g_down_4 5155 000028EA 28C0 <1> sub al, al ; 0 5156 <1> vga_g_down_4: 5157 000028EC 88F7 <1> mov bh, dh ; clr 5158 000028EE 28CF <1> sub bh, cl ; cul 5159 000028F0 FEC7 <1> inc bh ; cols = clr-cul+1 5160 <1> 5161 000028F2 20C0 <1> and al, al ; nblines = 0 5162 000028F4 7559 <1> jnz short vga_g_down_6 5163 000028F6 20ED <1> and ch, ch ; rul = 0 5164 000028F8 7555 <1> jnz short vga_g_down_6 5165 000028FA 20C9 <1> and cl, cl ; cul = 0 5166 000028FC 7551 <1> jnz short vga_g_down_6 5167 <1> 5168 000028FE 50 <1> push eax ; push ax ; 12/04/2021 5169 000028FF A0[36680000] <1> mov al, [VGA_ROWS] 5170 00002904 FEC8 <1> dec al 5171 00002906 38C6 <1> cmp dh, al ; rlr = nbrows-1 5172 00002908 7545 <1> jne short vga_g_down_5 5173 0000290A A0[30680000] <1> mov al, [CRT_COLS] ; = VGA_COLS 5174 0000290F FEC8 <1> dec al 5175 00002911 38C2 <1> cmp dl, al ; clr = nbcols-1 5176 <1> ;jne short vga_g_down_5 5177 <1> ; 12/04/2021 5178 00002913 58 <1> pop eax ; pop ax 5179 00002914 7539 <1> jne short vga_g_down_5 5180 <1> 5181 00002916 66B80502 <1> mov ax, 0205h 5182 0000291A 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 5183 0000291E 66EF <1> out dx, ax 5184 00002920 A0[36680000] <1> mov al, [VGA_ROWS] 5185 00002925 8A25[30680000] <1> mov ah, [CRT_COLS] ; = [VGA_COLS] 5186 0000292B F6E4 <1> mul ah 5187 0000292D 0FB7D0 <1> movzx edx, ax 5188 <1> ; 08/08/2016 5189 00002930 0FB605[32680000] <1> movzx eax, byte [CHAR_HEIGHT] 5190 00002937 F7E2 <1> mul edx 5191 <1> ; eax = byte count 5192 00002939 89C1 <1> mov ecx, eax 5193 <1> ;; 07/08/2016 5194 <1> ;shl dx, 3 ; * 8 ; * [CHAR_HEIGHT] 5195 <1> ;mov ecx, edx 5196 0000293B 88D8 <1> mov al, bl ; fill value for blanked lines 5197 0000293D BF00000A00 <1> mov edi, 0A0000h 5198 00002942 F3AA <1> rep stosb 5199 <1> 5200 <1> ; 03/08/2022 5201 00002944 30E4 <1> xor ah, ah ; 0 5202 <1> 5203 00002946 B005 <1> mov al, 5 5204 00002948 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 5205 0000294C 66EF <1> out dx, ax ; 0005h 5206 <1> 5207 0000294E C3 <1> retn 5208 <1> 5209 <1> vga_g_down_5: 5210 <1> ; 12/04/2021 5211 <1> ;pop eax ; pop ax 5212 <1> 5213 <1> vga_g_down_6: 5214 <1> ; [ESI] = VGA memory model number for current video mode 5215 <1> ; 5216 <1> ; LINEAR8 equ 5 5217 <1> ; PLANAR4 equ 4 5218 <1> ; PLANAR1 equ 3 5219 <1> 5220 0000294F 803E04 <1> cmp byte [esi], PLANAR4 5221 00002952 742C <1> je short vga_g_down_planar 5222 00002954 803E03 <1> cmp byte [esi], PLANAR1 5223 00002957 7427 <1> je short vga_g_down_planar 5224 <1> vga_g_down_linear8: 5225 <1> ; 07/07/2016 (TEMPORARY) 5226 <1> ; 5227 <1> ; cl = upper left column ; cul 5228 <1> ; ch = upper left row ; rul 5229 <1> ; dl = lower rigth column ; clr 5230 <1> ; dh = lower right row ; rlr 5231 <1> 5232 <1> vga_g_down_l0: 5233 <1> ;{for(i=rlr;i>=rul;i--) 5234 <1> ; if((i or al, al 5236 0000295B 741C <1> jz short vga_g_down_l2 5237 0000295D 88C4 <1> mov ah, al 5238 0000295F 00EC <1> add ah, ch 5239 <1> ;jc short vga_g_down_l2 5240 00002961 86EE <1> xchg ch, dh 5241 00002963 38E5 <1> cmp ch, ah 5242 00002965 7212 <1> jb short vga_g_down_l2 5243 00002967 88EC <1> mov ah, ch 5244 00002969 28C4 <1> sub ah, al ; ah = i - nblines 5245 <1> ; else 5246 <1> ; vgamem_copy_pl4(cul,i,i-nblines,cols,nbcols,cheight); 5247 0000296B E812FEFFFF <1> call vgamem_copy_l8 5248 <1> vga_g_down_l1: 5249 00002970 86F5 <1> xchg dh, ch 5250 00002972 FECE <1> dec dh 5251 00002974 38EE <1> cmp dh, ch 5252 00002976 73E1 <1> jnb short vga_g_down_l0 5253 00002978 C3 <1> retn 5254 <1> 5255 <1> vga_g_down_l2: 5256 <1> ; vgamem_fill_pl4(cul,i,cols,nbcols,cheight,attr); 5257 00002979 E86AFEFFFF <1> call vgamem_fill_l8 5258 0000297E EBF0 <1> jmp short vga_g_down_l1 5259 <1> 5260 <1> vga_g_down_planar: 5261 <1> ; cl = upper left column ; cul 5262 <1> ; ch = upper left row ; rul 5263 <1> ; dl = lower rigth column ; clr 5264 <1> ; dh = lower right row ; rlr 5265 <1> vga_g_down_pl0: 5266 <1> ;{for(i=rlr;i>=rul;i--) 5267 <1> ; if((i or al, al 5269 00002982 741C <1> jz short vga_g_down_pl2 5270 00002984 88C4 <1> mov ah, al 5271 00002986 00EC <1> add ah, ch 5272 <1> ;jc short vga_g_down_pl2 5273 00002988 86EE <1> xchg ch, dh 5274 0000298A 38E5 <1> cmp ch, ah 5275 0000298C 7212 <1> jb short vga_g_down_pl2 5276 0000298E 88EC <1> mov ah, ch 5277 00002990 28C4 <1> sub ah, al ; ah = i - nblines 5278 <1> ; else 5279 <1> ; vgamem_copy_pl4(cul,i,i-nblines,cols,nbcols,cheight); 5280 00002992 E826FDFFFF <1> call vgamem_copy_pl4 5281 <1> vga_g_down_pl1: 5282 00002997 86F5 <1> xchg dh, ch 5283 00002999 FECE <1> dec dh 5284 0000299B 38EE <1> cmp dh, ch 5285 0000299D 73E1 <1> jnb short vga_g_down_pl0 5286 0000299F C3 <1> retn 5287 <1> 5288 <1> vga_g_down_pl2: 5289 <1> ; vgamem_fill_pl4(cul,i,cols,nbcols,cheight,attr); 5290 000029A0 E886FDFFFF <1> call vgamem_fill_pl4 5291 000029A5 EBF0 <1> jmp short vga_g_down_pl1 5292 <1> 5293 <1> 5294 <1> 5295 <1> ; 27/06/2016 - TRDOS 386 (TRDOS v2.0) 5296 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5297 <1> 5298 <1> ;----- ROUTINE TO MOVE ONE ROW OF INFORMATION 5299 <1> 5300 <1> _R17: 5301 000029A7 0FB6CA <1> movzx ecx, dl ; NUMBER OF BYTES IN THE ROW 5302 000029AA 56 <1> push esi 5303 000029AB 57 <1> push edi ; SAVE POINTERS 5304 000029AC F3A4 <1> rep movsb ; MOVE THE EVEN FIELD 5305 000029AE 5F <1> pop edi 5306 000029AF 5E <1> pop esi 5307 000029B0 6681C60020 <1> add si, 2000h 5308 000029B5 6681C70020 <1> add di, 2000h ; POINT TO THE ODD FIELD 5309 000029BA 56 <1> push esi 5310 000029BB 57 <1> push edi ; SAVE THE POINTERS 5311 000029BC 88D1 <1> mov cl, dl ; COUNT BACK 5312 000029BE F3A4 <1> rep movsb ; MOVE THE ODD FIELD 5313 000029C0 5F <1> pop edi 5314 000029C1 5E <1> pop esi ; POINTERS BACK 5315 000029C2 C3 <1> retn ; RETURN TO CALLER 5316 <1> 5317 <1> ;----- CLEAR A SINGLE ROW 5318 <1> 5319 <1> _R18: 5320 000029C3 0FB6CA <1> movzx ecx, dl ; NUMBER OF BYTES IN FIELD 5321 000029C6 57 <1> push edi ; SAVE POINTER 5322 000029C7 F3AA <1> rep stosb ; STORE THE NEW VALUE 5323 000029C9 5F <1> pop edi ; POINTER BACK 5324 000029CA 6681C70020 <1> add di, 2000h ; POINT TO ODD FIELD 5325 000029CF 57 <1> push edi 5326 000029D0 88D1 <1> mov cl, dl 5327 000029D2 F3AA <1> rep stosb ; FILL THE ODD FIELD 5328 000029D4 5F <1> pop edi 5329 000029D5 C3 <1> retn ; RETURN TO CALLER 5330 <1> 5331 <1> ; 03/08/2022 - TRDOS 386 Kernel v2.0.5 5332 <1> ; 04/07/2016 5333 <1> ; 01/07/2016 5334 <1> ; 30/06/2016 - TRDOS 386 (TRDOS v2.0) 5335 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5336 <1> ;-------------------------------------------------- 5337 <1> ; GRAPHICS WRITE 5338 <1> ; THIS ROUTINE WRITES THE ASCII CHARACTER TO THE CURRENT 5339 <1> ; POSITION ON THE SCREEN. 5340 <1> ; ENTRY -- 5341 <1> ; AL = CHARACTER TO WRITE 5342 <1> ; BL = COLOR ATTRIBUTE TO BE USED FOR FOREGROUND COLOR 5343 <1> ; IF BIT 7 IS SET, THE CHAR IS XOR'D INTO THE REGEN BUFFER 5344 <1> ; (0 IS USED FOR THE BACKGROUND COLOR) 5345 <1> ; CX = NUMBER OF CHARS TO WRITE 5346 <1> ; DS = DATA SEGMENT 5347 <1> ; ES = REGEN SEGMENT 5348 <1> ; EXIT -- 5349 <1> ; NOTHING IS RETURNED 5350 <1> ; 5351 <1> ; GRAPHICS READ 5352 <1> ; THIS ROUTINE READS THE ASCII CHARACTER AT THE CURRENT CURSOR 5353 <1> ; POSITION ON THE SCREEN BY MATCHING THE DOTS ON THE SCREEN TO THE 5354 <1> ; CHARACTER GENERATOR CODE POINTS 5355 <1> ; ENTRY -- 5356 <1> ; NONE (0 IS ASSUMED AS THE BACKGROUND COLOR) 5357 <1> ; EXIT -- 5358 <1> ; AL = CHARACTER READ AT THAT POSITION (0 RETURNED IF NONE FOUND) 5359 <1> ; 5360 <1> ; FOR BOTH ROUTINES, THE IMAGES USED TO FORM CHARS ARE CONTAINED IN ROM 5361 <1> ; FOR THE 1ST 128 CHARS. TO ACCESS CHARS IN THE SECOND HALF, THE USER 5362 <1> ; MUST INITIALIZE THE VECTOR AT INTERRUPT 1FH (LOCATION 0007CH) TO 5363 <1> ; POINT TO THE USER SUPPLIED TABLE OF GRAPHIC IMAGES (8X8 BOXES). 5364 <1> ; FAILURE TO DO SO WILL CAUSE IN STRANGE RESULTS 5365 <1> ;----------------------------------------------------- 5366 <1> 5367 <1> GRAPHICS_WRITE: 5368 000029D6 25FF000000 <1> and eax, 0FFh ; ZERO TO HIGH OF CODE POINT 5369 000029DB 50 <1> push eax ; SAVE CODE POINT VALUE 5370 <1> 5371 <1> ;----- DETERMINE POSITION IN REGEN BUFFER TO PUT CODE POINTS 5372 <1> 5373 000029DC E846010000 <1> call S26 ; FIND LOCATION IN REGEN BUFFER 5374 000029E1 89C7 <1> mov edi, eax ; REGEN POINTER IN DI 5375 <1> 5376 <1> ;----- DETERMINE REGION TO GET CODE POINTS FROM 5377 <1> 5378 000029E3 58 <1> pop eax ; RECOVER CODE POINT 5379 <1> 5380 000029E4 BE[404D0100] <1> mov esi, CRT_CHAR_GEN ; OFFSET OF IMAGES 5381 <1> 5382 <1> ;----- DETERMINE GRAPHICS MODE IN OPERATION 5383 <1> ; DETERMINE_MODE 5384 <1> ;sal ax, 3 ; MULTIPLY CODE POINT VALUE BY 8 5385 <1> ; 03/08/2022 5386 000029E9 C1E003 <1> sal eax, 3 5387 000029EC 01C6 <1> add esi, eax ; SI HAS OFFSET OF DESIRED CODES 5388 <1> 5389 000029EE 803D[2E680000]06 <1> cmp byte [CRT_MODE], 6 5390 000029F5 7231 <1> jc short S6 ; TEST FOR MEDIUM RESOLUTION MODE 5391 <1> 5392 <1> ;----- HIGH RESOLUTION MODE 5393 <1> 5394 000029F7 81C700800B00 <1> add edi, 0B8000h 5395 <1> S1: ; HIGH_CHAR 5396 000029FD 57 <1> push edi ; SAVE REGEN POINTER 5397 000029FE 56 <1> push esi ; SAVE CODE POINTER 5398 000029FF B604 <1> mov dh, 4 ; NUMBER OF TIMES THROUGH LOOP 5399 <1> S2: 5400 00002A01 AC <1> lodsb ; GET BYTE FROM CODE POINTS 5401 00002A02 F6C380 <1> test bl, 80h ; SHOULD WE USE THE FUNCTION 5402 00002A05 7515 <1> jnz short S5 ; TO PUT CHAR IN 5403 00002A07 AA <1> stosb ; STORE IN REGEN BUFFER 5404 00002A08 AC <1> lodsb 5405 <1> S4: 5406 00002A09 8887FF1F0000 <1> mov [edi+2000h-1], al ; STORE IN SECOND HALF 5407 00002A0F 83C74F <1> add edi, 79 ; MOVE TO NEXT ROW IN REGEN 5408 00002A12 FECE <1> dec dh ; DONE WITH LOOP 5409 00002A14 75EB <1> jnz short S2 5410 00002A16 5E <1> pop esi 5411 00002A17 5F <1> pop edi ; RECOVER REGEN POINTER 5412 00002A18 47 <1> inc edi ; POINT TO NEXT CHAR POSITION 5413 00002A19 E2E2 <1> loop S1 ; MORE CHARS TO WRITE 5414 00002A1B C3 <1> retn 5415 <1> 5416 <1> S5: 5417 00002A1C 3207 <1> xor al, [edi] ; EXCLUSIVE OR WITH CURRENT 5418 00002A1E AA <1> stosb ; STORE THE CODE POINT 5419 00002A1F AC <1> lodsb ; AGAIN FOR ODD FIELD 5420 00002A20 3287FF1F0000 <1> xor al, [edi+2000h-1] 5421 00002A26 EBE1 <1> jmp short S4 ; BACK TO MAINSTREAM 5422 <1> 5423 <1> ;----- MEDIUM RESOLUTION WRITE 5424 <1> S6: ; MED_RES_WRITE 5425 00002A28 88DA <1> mov dl, bl ; SAVE HIGH COLOR BIT 5426 <1> ; 03/08/2022 5427 00002A2A D1E7 <1> sal edi, 1 5428 <1> ;sal di, 1 ; OFFSET*2 SINCE 2 BYTES/CHAR 5429 <1> ; EXPAND BL TO FULL WORD OF COLOR 5430 00002A2C 80E303 <1> and bl, 3 ; ISOLATE THE COLOR BITS ( LOW 2 BITS ) 5431 00002A2F B055 <1> mov al, 055h ; GET BIT CONVERSION MULTIPLIER 5432 00002A31 F6E3 <1> mul bl ; EXPAND 2 COLOR BITS TO 4 REPLICATIONS 5433 00002A33 88C3 <1> mov bl, al ; PLACE BACK IN WORK REGISTER 5434 00002A35 88C7 <1> mov bh, al ; EXPAND TO 8 REPLICATIONS OF COLOR BITS 5435 00002A37 81C700800B00 <1> add edi, 0B8000h 5436 <1> S7: ; MED_CHAR 5437 00002A3D 57 <1> push edi ; SAVE REGEN POINTER 5438 00002A3E 56 <1> push esi ; SAVE THE CODE POINTER 5439 00002A3F B604 <1> mov dh, 4 ; NUMBER OF LOOPS 5440 <1> S8: 5441 00002A41 AC <1> lodsb ; GET CODE POINT 5442 00002A42 E8B1000000 <1> call S21 ; DOUBLE UP ALL THE BITS 5443 00002A47 6621D8 <1> and ax, bx ; CONVERT TO FOREGROUND COLOR ( 0 BACK ) 5444 00002A4A 86E0 <1> xchg ah, al ; SWAP HIGH/LOW BYTES FOR WORD MOVE 5445 00002A4C F6C280 <1> test dl, 80h ; IS THIS XOR FUNCTION 5446 00002A4F 7403 <1> jz short S9 ; NO, STORE IT IN AS IS 5447 00002A51 663307 <1> xor ax, [edi] ; DO FUNCTION WITH LOW/HIGH 5448 <1> S9: 5449 00002A54 668907 <1> mov [edi], ax ; STORE FIRST BYTE HIGH, SECOND LOW 5450 00002A57 AC <1> lodsb ; GET CODE POINT 5451 00002A58 E89B000000 <1> call S21 5452 00002A5D 6621D8 <1> and ax, bx ; CONVERT TO COLOR 5453 00002A60 86E0 <1> xchg ah, al ; SWAP HIGH/LOW BYTES FOR WORD MOVE 5454 00002A62 F6C280 <1> test dl, 80h ; AGAIN, IS THIS XOR FUNCTION 5455 00002A65 7407 <1> jz short _S10 ; NO, JUST STORE THE VALUES 5456 00002A67 66338700200000 <1> xor ax, [edi+2000h] ; FUNCTION WITH FIRST HALF LOW 5457 <1> _S10: 5458 00002A6E 66898700200000 <1> mov [edi+2000h], ax ; STORE SECOND PORTION HIGH 5459 00002A75 6683C750 <1> add di, 80 ; POINT TO NEXT LOCATION 5460 00002A79 FECE <1> dec dh 5461 00002A7B 75C4 <1> jnz short S8 ; KEEP GOING 5462 00002A7D 5E <1> pop esi ; RECOVER CODE POINTER 5463 00002A7E 5F <1> pop edi ; RECOVER REGEN POINTER 5464 00002A7F 47 <1> inc edi ; POINT TO NEXT CHAR POSITION 5465 00002A80 47 <1> inc edi 5466 00002A81 E2BA <1> loop S7 ; MORE TO WRITE 5467 00002A83 C3 <1> retn 5468 <1> 5469 <1> ; 03/08/2022 - TRDOS 386 Kernel v2.0.5 5470 <1> ; 04/07/2016 5471 <1> ; 01/07/2016 5472 <1> ; 30/06/2016 - TRDOS 386 (TRDOS v2.0) 5473 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5474 <1> ;---------------------------------------- 5475 <1> ; GRAPHICS READ 5476 <1> ;---------------------------------------- 5477 <1> GRAPHICS_READ: 5478 00002A84 E89E000000 <1> call S26 ; CONVERTED TO OFFSET IN REGEN 5479 00002A89 89C6 <1> mov esi, eax ; SAVE IN SI 5480 00002A8B 81C600800B00 <1> add esi, 0B8000h ; 01/07/2016 5481 00002A91 83EC08 <1> sub esp, 8 ; ALLOCATE SPACE FOR THE READ CODE POINT 5482 00002A94 89E5 <1> mov ebp, esp ; POINTER TO SAVE AREA 5483 <1> 5484 <1> ;----- DETERMINE GRAPHICS MODES 5485 00002A96 B604 <1> mov dh, 4 ; number of passes ; 01/07/2016 5486 00002A98 803D[2E680000]06 <1> cmp byte [CRT_MODE], 6 5487 00002A9F 7219 <1> jc short S12 ; MEDIUM RESOLUTION 5488 <1> 5489 <1> ;----- HIGH RESOLUTION READ 5490 <1> ;----- GET VALUES FROM REGEN BUFFER AND CONVERT TO CODE POINT 5491 <1> ;mov dh,4 ; NUMBER OF PASSES 5492 <1> S11: 5493 00002AA1 8A06 <1> mov al, [esi] ; GET FIRST BYTE 5494 00002AA3 884500 <1> mov [ebp], al ; SAVE IN STORAGE AREA 5495 00002AA6 45 <1> inc ebp ; NEXT LOCATION 5496 00002AA7 8A8600200000 <1> mov al, [esi+2000h] ; GET LOWER REGION BYTE 5497 00002AAD 884500 <1> mov [ebp], al ; ADJUST AND STORE 5498 00002AB0 45 <1> inc ebp 5499 00002AB1 83C650 <1> add esi, 80 ; POINTER INTO REGEN 5500 00002AB4 FECE <1> dec dh ; LOOP CONTROL 5501 00002AB6 75E9 <1> jnz short S11 ; DO IT SOME MORE 5502 00002AB8 EB1C <1> jmp short S14 ; GO MATCH THE SAVED CODE POINTS 5503 <1> 5504 <1> ;----- MEDIUM RESOLUTION READ 5505 <1> S12: 5506 <1> ;sal si, 1 ; OFFSET*2 SINCE 2 BYTES/CHAR 5507 <1> ; 03/08/2022 5508 00002ABA D1E6 <1> sal esi, 1 5509 <1> ;mov dh, 4 ; NUMBER OF PASSES 5510 <1> S13: 5511 00002ABC E84B000000 <1> call S23 ; GET BYTES FROM REGEN INTO SINGLE SAVE 5512 00002AC1 81C6FE1F0000 <1> add esi, 2000h-2 ; GO TO LOWER REGION 5513 00002AC7 E840000000 <1> call S23 ; GET THIS PAIR INTO SAVE 5514 00002ACC 81EEB21F0000 <1> sub esi, 2000h-80+2 ; ADJUST POINTER BACK INTO UPPER 5515 00002AD2 FECE <1> dec dh 5516 00002AD4 75E6 <1> jnz short S13 ; KEEP GOING UNTIL ALL 8 DONE 5517 <1> 5518 <1> ;----- SAVE AREA HAS CHARACTER IN IT, MATCH IT 5519 <1> S14: ; FIND_CHAR 5520 00002AD6 BF[404D0100] <1> mov edi, CRT_CHAR_GEN ; ESTABLISH ADDRESSING 5521 00002ADB 83ED08 <1> sub ebp, 8 ; ADJUST POINTER TO START OF SAVE AREA 5522 00002ADE 89EE <1> mov esi, ebp 5523 <1> S15: 5524 <1> ;mov ax, 256 ; NUMBER TO TEST AGAINST 5525 <1> ; 03/08/2022 5526 00002AE0 29C0 <1> sub eax, eax 5527 00002AE2 FEC4 <1> inc ah 5528 <1> ; eax = 256 5529 <1> S16: 5530 00002AE4 56 <1> push esi ; SAVE SAVE AREA POINTER 5531 00002AE5 57 <1> push edi ; SAVE CODE POINTER 5532 <1> ;mov ecx, 4 ; NUMBER OF WORDS TO MATCH 5533 <1> ;repe cmpsw ; COMPARE THE 8 BYTES AS WORDS 5534 00002AE6 A7 <1> cmpsd ; compare first 4 bytes 5535 00002AE7 7501 <1> jne short S17 ; 5536 00002AE9 A7 <1> cmpsd ; compare last 4 bytes 5537 <1> S17: 5538 00002AEA 5F <1> pop edi ; RECOVER THE POINTERS 5539 00002AEB 5E <1> pop esi 5540 <1> ;jz short S18 ; IF ZERO FLAG SET, THEN MATCH OCCURRED 5541 00002AEC 7406 <1> je short S18 5542 <1> ; ; NO MATCH, MOVE ON TO NEXT 5543 00002AEE 83C708 <1> add edi, 8 ; NEXT CODE POINT 5544 <1> ;dec ax ; LOOP CONTROL 5545 <1> ; 03/08/2022 5546 00002AF1 48 <1> dec eax 5547 00002AF2 75F0 <1> jnz short S16 ; DO ALL OF THEM 5548 <1> 5549 <1> ;----- CHARACTER IS FOUND ( AL=0 IF NOT FOUND ) 5550 <1> S18: 5551 00002AF4 83C408 <1> add esp, 8 ; READJUST THE STACK, THROW AWAY SAVE 5552 00002AF7 C3 <1> retn ; ALL DONE 5553 <1> 5554 <1> ; 12/04/2021 5555 <1> ; 30/06/2016 - TRDOS 386 (TRDOS v2.0) 5556 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5557 <1> ;-------------------------------------------- 5558 <1> ; EXPAND BYTE 5559 <1> ; THIS ROUTINE TAKES THE BYTE IN AL AND DOUBLES ALL 5560 <1> ; OF THE BITS, TURNING THE 8 BITS INTO 16 BITS. 5561 <1> ; THE RESULT IS LEFT IN AX 5562 <1> ;-------------------------------------------- 5563 <1> S21: 5564 <1> ; 03/08/2022 5565 <1> ;push cx ; SAVE REGISTER 5566 <1> ; 12/04/2021 5567 00002AF8 51 <1> push ecx 5568 <1> ;;mov cx, 8 ; SHIFT COUNT REGISTER FOR ONE BYTE 5569 <1> ;mov cl, 8 5570 00002AF9 B408 <1> mov ah, 8 5571 <1> S22: 5572 00002AFB D0C8 <1> ror al, 1 ; SHIFT BITS, LOW BIT INTO CARRY FLAG 5573 <1> ;rcr bp, 1 ; MOVE CARRY FLAG (LOW BIT INTO RESULTS 5574 <1> ;sar bp, 1 ; SIGN EXTEND HIGH BIT (DOUBLE IT) 5575 <1> ; 03/08/2022 5576 00002AFD 66D1D9 <1> rcr cx, 1 5577 00002B00 66D1F9 <1> sar cx, 1 5578 <1> 5579 <1> ;;loop S22 ; REPEAT FOR ALL 8 BITS 5580 <1> ;dec cl 5581 <1> ;jnz short S22 5582 <1> ;xchg ax, bp ; MOVE RESULTS TO PARAMETER REGISTER 5583 <1> ; 03/08/5022 5584 00002B03 FECC <1> dec ah 5585 00002B05 75F4 <1> jnz short S22 5586 00002B07 6689C8 <1> mov ax, cx 5587 <1> ;pop cx ; RECOVER REGISTER 5588 <1> ; 12/04/2021 5589 00002B0A 59 <1> pop ecx 5590 00002B0B C3 <1> retn ; ALL DONE 5591 <1> 5592 <1> ; 01/07/2016 - TRDOS 386 (TRDOS v2.0) 5593 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5594 <1> ;-------------------------------------------------- 5595 <1> ; MED_READ_BYTE 5596 <1> ; THIS ROUTINE WILL TAKE 2 BYTES FROM THE REGEN BUFFER, 5597 <1> ; COMPARE AGAINST THE CURRENT FOREGROUND COLOR, AND PLACE 5598 <1> ; THE CORRESPONDING ON/OFF BIT PATTERN INTO THE CURRENT 5599 <1> ; POSITION IN THE SAVE AREA 5600 <1> ; ENTRY -- 5601 <1> ; SI,DS = POINTER TO REGEN AREA OF INTEREST 5602 <1> ; BX = EXPANDED FOREGROUND COLOR 5603 <1> ; BP = POINTER TO SAVE AREA 5604 <1> ; EXIT -- 5605 <1> ; SI AND BP ARE INCREMENTED 5606 <1> ;---------------------------------------------------- 5607 <1> S23: 5608 00002B0C 66AD <1> lodsw ; GET FIRST BYTE AND SECOND BYTES 5609 00002B0E 86C4 <1> xchg al, ah ; SWAP FOR COMPARE 5610 <1> ;mov cx, 0C000h ; 2 BIT MASK TO TEST THE ENTRIES 5611 <1> ; 02/08/2022 5612 00002B10 29C9 <1> sub ecx, ecx 5613 00002B12 B5C0 <1> mov ch, 0C0h 5614 <1> ; ecx = 0C000h 5615 <1> ;mov dl, 0 ; RESULT REGISTER 5616 <1> ; 03/08/2022 5617 00002B14 28D2 <1> sub dl, dl 5618 <1> S24: 5619 <1> ;test ax, cx ; IS THIS SECTION BACKCROUND? 5620 <1> ; 03/08/2022 5621 00002B16 85C8 <1> test eax, ecx 5622 00002B18 7401 <1> jz short S25 ; IF ZERO, IT IS BACKGROUND (CARRY=0) 5623 00002B1A F9 <1> stc ; WASN'T, SO SET CARRY 5624 <1> S25: 5625 00002B1B D0D2 <1> rcl dl, 1 ; MOVE THAT BIT INTO THE RESULT 5626 <1> ;shr cx, 2 ; MOVE THE MASK TO THE RIGHT BY 2 BITS 5627 <1> ; 02/08/2022 5628 00002B1D C1E902 <1> shr ecx, 2 5629 00002B20 73F4 <1> jnc short S24 ; DO IT AGAIN IF MASK DIDN'T FALL OUT 5630 00002B22 885500 <1> mov [ebp], dl ; STORE RESULT IN SAVE AREA 5631 00002B25 45 <1> inc ebp ; ADJUST POINTER 5632 00002B26 C3 <1> retn ; ALL DONE 5633 <1> 5634 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 5635 <1> ; 30/06/2016 - TRDOS 386 (TRDOS v2.0) 5636 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5637 <1> ;----------------------------------------- 5638 <1> ; V4_POSITION 5639 <1> ; THIS ROUTINE TAKES THE CURSOR POSITION CONTAINED IN 5640 <1> ; THE MEMORY LOCATION, AND CONVERTS IT INTO AN OFFSET 5641 <1> ; INTO THE REGEN BUFFER, ASSUMING ONE BYTE/CHAR. 5642 <1> ; FOR MEDIUM RESOLUTION GRAPHICS, THE NUMBER MUST 5643 <1> ; BE DOUBLED. 5644 <1> ; ENTRY -- NO REGISTERS,MEMORY LOCATION @CURSOR_POSN IS USED 5645 <1> ; EXIT-- 5646 <1> ; AX CONTAINS OFFSET INTO REGEN BUFFER 5647 <1> ;----------------------------------------- 5648 <1> S26: 5649 00002B27 0FB705[CE760100] <1> movzx eax, word [CURSOR_POSN] ; GET CURRENT CURSOR 5650 <1> GRAPH_POSN: 5651 00002B2E 53 <1> push ebx ; SAVE REGISTER 5652 00002B2F 0FB6D8 <1> movzx ebx, al ; SAVE A COPY OF CURRENT CURSOR 5653 00002B32 A0[30680000] <1> mov al, [CRT_COLS] ; GET BYTES PER COLUMN 5654 00002B37 F6E4 <1> mul ah ; MULTIPLY BY ROWS 5655 <1> ;shl ax, 2 ; MULTIPLY * 4 SINCE 4 ROWS/BYTE 5656 <1> ; 02/08/2022 5657 00002B39 C1E002 <1> shl eax, 2 5658 00002B3C 01D8 <1> add eax, ebx ; DETERMINE OFFSET 5659 00002B3E 5B <1> pop ebx ; RECOVER POINTER 5660 00002B3F C3 <1> retn ; ALL DONE 5661 <1> 5662 <1> ; 03/08/2022 - TRDOS 386 Kernel v2.0.5 5663 <1> ; 09/07/2016 5664 <1> ; 01/07/2016 - TRDOS 386 (TRDOS v2.0) 5665 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5666 <1> ;--------------------------------------------- 5667 <1> ; SET_COLOR 5668 <1> ; THIS ROUTINE WILL ESTABLISH THE BACKGROUND COLOR, THE OVERSCAN COLOR, 5669 <1> ; AND THE FOREGROUND COLOR SET FOR MEDIUM RESOLUTION GRAPHICS 5670 <1> ; INPUT 5671 <1> ; (BH) HAS COLOR ID 5672 <1> ; IF BH=0, THE BACKGROUND COLOR VALUE IS SET 5673 <1> ; FROM THE LOW BITS OF BL (0-31) 5674 <1> ; IF BH=1, THE PALETTE SELECTION IS MADE 5675 <1> ; BASED ON THE LOW BIT OF BL: 5676 <1> ; 0 = GREEN, RED, YELLOW FOR COLORS 1,2,3 5677 <1> ; 1 = BLUE, CYAN, MAGENTA FOR COLORS 1,2,3 5678 <1> ; (BL) HAS THE COLOR VALUE TO BE USED 5679 <1> ; OUTPUT 5680 <1> ; THE COLOR SELECTION IS UPDATED 5681 <1> ;---------------------------------------------- 5682 <1> SET_COLOR: 5683 00002B40 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 ; 09/07/2016 5684 <1> ;ja VIDEO_RETURN ; nothing to do for VGA modes 5685 <1> ; 03/08/2022 5686 00002B47 7605 <1> jna short M21 5687 00002B49 E91DF0FFFF <1> jmp VIDEO_RETURN 5688 <1> M21: 5689 <1> ;mov dx, [ADDR_6845] ; I/O PORT FOR PALETTE 5690 <1> ;mov dx, 3D4h 5691 <1> ;add dx, 5 ; OVERSCAN PORT 5692 00002B4E 66BAD903 <1> mov dx, 3D9h 5693 00002B52 A0[31680000] <1> mov al, [CRT_PALETTE] ; GET THE CURRENT PALETTE VALUE 5694 00002B57 08FF <1> or bh, bh ; IS THIS COLOR 0? 5695 00002B59 7512 <1> jnz short M20 ; OUTPUT COLOR 1 5696 <1> 5697 <1> ;----- HANDLE COLOR 0 BY SETTING THE BACKGROUND COLOR 5698 <1> 5699 00002B5B 24E0 <1> and al, 0E0h ; TURN OFF LOW 5 BITS OF CURRENT 5700 00002B5D 80E31F <1> and bl, 01Fh ; TURN OFF HIGH 3 BITS OF INPUT VALUE 5701 00002B60 08D8 <1> or al, bl ; PUT VALUE INTO REGISTER 5702 <1> M19: ; OUTPUT THE PALETTE 5703 00002B62 EE <1> out dx, al ; OUTPUT COLOR SELECTION TO 3D9 PORT 5704 00002B63 A2[31680000] <1> mov [CRT_PALETTE], al ; SAVE THE COLOR VALUE 5705 00002B68 E9FEEFFFFF <1> jmp VIDEO_RETURN 5706 <1> 5707 <1> ;----- HANDLE COLOR 1 BY SELECTING THE PALETTE TO BE USED 5708 <1> 5709 <1> M20: 5710 00002B6D 24DF <1> and al, 0DFH ; TURN OFF PALETTE SELECT BIT 5711 00002B6F D0EB <1> shr bl, 1 ; TEST THE LOW ORDER BIT OF BL 5712 00002B71 73EF <1> jnc short M19 ; ALREADY DONE 5713 00002B73 0C20 <1> or al, 20H ; TURN ON PALETTE SELECT BIT 5714 00002B75 EBEB <1> jmp short M19 ; GO DO IT 5715 <1> 5716 <1> ; 03/08/2022 - TRDOS 386 Kernel v2.0.5 5717 <1> ; 09/07/2016 5718 <1> ; 01/07/2016 - TRDOS 386 (TRDOS v2.0) 5719 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5720 <1> ;-------------------------------------------- 5721 <1> ; READ DOT -- WRITE DOT 5722 <1> ; THESE ROUTINES WILL WRITE A DOT, OR READ THE 5723 <1> ; DOT AT THE INDICATED LOCATION 5724 <1> ; ENTRY -- 5725 <1> ; DX = ROW (0-199) (THE ACTUAL VALUE DEPENDS ON THE MODE) 5726 <1> ; CX = COLUMN ( 0-639) ( THE VALUES ARE NOT RANGE CHECKED ) 5727 <1> ; AL = DOT VALUE TO WRITE (1,2 OR 4 BITS DEPENDING ON MODE, 5728 <1> ; REQUIRED FOR WRITE DOT ONLY, RIGHT JUSTIFIED) 5729 <1> ; BIT 7 OF AL = 1 INDICATES XOR THE VALUE INTO THE LOCATION 5730 <1> ; DS = DATA SEGMENT 5731 <1> ; ES = REGEN SEGMENT 5732 <1> ; 5733 <1> ; EXIT 5734 <1> ; AL = DOT VALUE READ, RIGHT JUSTIFIED, READ ONLY 5735 <1> ;---------------------------------------------- 5736 <1> 5737 <1> READ_DOT: 5738 <1> ; 09/07/2016 5739 00002B77 8A25[2E680000] <1> mov ah, [CRT_MODE] 5740 00002B7D 80FC07 <1> cmp ah, 7 ; 6!? 5741 00002B80 760A <1> jna short read_dot_cga 5742 <1> 5743 00002B82 E8B3030000 <1> call vga_read_pixel 5744 <1> ; al = pixel value 5745 <1> read_dot_retn: ; 03/08/2022 5746 00002B87 E9E4EFFFFF <1> jmp _video_return 5747 <1> 5748 <1> read_dot_cga: 5749 <1> ;je VIDEO_RETURN ; 7 5750 00002B8C 80FC04 <1> cmp ah, 4 ; graphics ? 5751 <1> ;jb VIDEO_RETURN ; no, text mode, nothing to do 5752 <1> ; 03/08/2022 5753 00002B8F 72F6 <1> jb short read_dot_retn 5754 <1> 5755 00002B91 E84F000000 <1> call R3 ; DETERMINE BYTE POSITION OF DOT 5756 00002B96 8A06 <1> mov al, [esi] ; GET THE BYTE 5757 00002B98 20E0 <1> and al, ah ; MASK OFF THE OTHER BITS IN THE BYTE 5758 00002B9A D2E0 <1> shl al, cl ; LEFT JUSTIFY THE VALUE 5759 00002B9C 88F1 <1> mov cl, dh ; GET NUMBER OF BITS IN RESULT 5760 00002B9E D2C0 <1> rol al, cl ; RIGHT JUSTIFY THE RESULT 5761 <1> ;jmp VIDEO_RETURN ; RETURN FROM VIDEO I/O 5762 00002BA0 0FB6C0 <1> movzx eax, al 5763 00002BA3 E9C8EFFFFF <1> jmp _video_return 5764 <1> 5765 <1> ; 03/08/2022 5766 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 5767 <1> ; 12/04/2021 5768 <1> ; 09/07/2016 5769 <1> ; 01/07/2016 - TRDOS 386 (TRDOS v2.0) 5770 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5771 <1> 5772 <1> WRITE_DOT: 5773 <1> ; 09/07/2016 5774 00002BA8 8A25[2E680000] <1> mov ah, [CRT_MODE] 5775 00002BAE 80FC07 <1> cmp ah, 7 ; 6!? 5776 00002BB1 760A <1> jna short write_dot_cga 5777 <1> 5778 00002BB3 E8F2020000 <1> call vga_write_pixel 5779 <1> write_dot_retn: ; 03/08/2022 5780 00002BB8 E9AEEFFFFF <1> jmp VIDEO_RETURN 5781 <1> 5782 <1> write_dot_cga: 5783 <1> ;je VIDEO_RETURN ; 7 5784 00002BBD 80FC04 <1> cmp ah, 4 ; graphics ? 5785 <1> ;jb VIDEO_RETURN ; no, text mode, nothing to do 5786 <1> ; 03/08/2022 5787 00002BC0 72F6 <1> jb short write_dot_retn 5788 <1> 5789 <1> ;;push ax ; SAVE DOT VALUE 5790 <1> ;push ax ; TWICE 5791 <1> ; 12/04/2021 5792 00002BC2 50 <1> push eax 5793 00002BC3 E81D000000 <1> call R3 ; DETERMINE BYTE POSITION OF THE DOT 5794 00002BC8 D2E8 <1> shr al, cl ; SHIFT TO SET UP THE BITS FOR OUTPUT 5795 00002BCA 20E0 <1> and al, ah ; STRIP OFF THE OTHER BITS 5796 00002BCC 8A0E <1> mov cl, [esi] ; GET THE CURRENT BYTE 5797 <1> ;pop bx ; RECOVER XOR FLAG 5798 <1> ; 12/04/2021 5799 00002BCE 5B <1> pop ebx 5800 00002BCF F6C380 <1> test bl, 80h ; IS IT ON 5801 00002BD2 750D <1> jnz short R2 ; YES, XOR THE DOT 5802 00002BD4 F6D4 <1> not ah ; SET MASK TO REMOVE THE INDICATED BITS 5803 00002BD6 20E1 <1> and cl, ah 5804 00002BD8 08C8 <1> or al, cl ; OR IN THE NEW VALUE OF THOSE BITS 5805 <1> R1: ; FINISH_DOT 5806 00002BDA 8806 <1> mov [esi], al ; RESTORE THE BYTE IN MEMORY 5807 <1> ;;pop AX 5808 00002BDC E98AEFFFFF <1> jmp VIDEO_RETURN ; RETURN FROM VIDEO I/O 5809 <1> R2: ; XOR_DOT 5810 00002BE1 30C8 <1> xor al, cl ; EXCLUSIVE OR THE DOTS 5811 00002BE3 EBF5 <1> jmp short R1 ; FINISH UP THE WRITING 5812 <1> 5813 <1> ; 02/08/2022 - TRDOS 386 Kernel v2.0.5 5814 <1> ; 01/07/2016 - TRDOS 386 (TRDOS v2.0) 5815 <1> ; VIDEO1.ASM - 24/03/1985 (IBM PC-AT BIOS source code) 5816 <1> 5817 <1> ;---------------------------------------------- 5818 <1> ; THIS SUBROUTINE DETERMINES THE REGEN BYTE LOCATION OF THE 5819 <1> ; INDICATED ROW COLUMN VALUE IN GRAPHICS MODE. 5820 <1> ; ENTRY -- 5821 <1> ; DX = ROW VALUE (0-199) 5822 <1> ; CX = COLUMN VALUE (0-639) 5823 <1> ; EXIT -- 5824 <1> ; SI = OFFSET INTO REGEN BUFFER FOR BYTE OF INTEREST 5825 <1> ; AH = MASK TO STRIP OFF THE BITS OF INTEREST 5826 <1> ; CL = BITS TO SHIFT TO RIGHT JUSTIFY THE MASK IN AH 5827 <1> ; DH = # BITS IN RESULT 5828 <1> ; BX = MODIFIED 5829 <1> ;----------------------------------------------- 5830 <1> R3: 5831 <1> 5832 <1> ;----- DETERMINE 1ST BYTE IN INDICATED ROW BY MULTIPLYING ROW VALUE BY 40 5833 <1> ;----- ( LOW BIT OF ROW DETERMINES EVEN/ODD, 80 BYTES/ROW ) 5834 <1> 5835 00002BE5 0FB7F0 <1> movzx esi, ax ; WILL SAVE AL AND AH DURING OPERATION 5836 00002BE8 B028 <1> mov al, 40 5837 00002BEA F6E2 <1> mul dl ; AX= ADDRESS OF START OF INDICATED ROW 5838 00002BEC A808 <1> test al, 08H ; TEST FOR EVEN/ODD ROW CALCULATED 5839 00002BEE 7404 <1> JZ short R4 ; JUMP IF EVEN ROW 5840 00002BF0 6605D81F <1> add ax, 2000h-40 ; OFFSET TO LOCATION OF ODD ROWS ADJUST 5841 <1> R4: ; EVEN_ROW 5842 <1> ;xchg si, ax ; MOVE POINTER TO (SI) AND RECOVER (AX) 5843 <1> ; 02/08/2022 5844 00002BF4 96 <1> xchg esi, eax 5845 00002BF5 81C600800B00 <1> add esi, 0B8000h 5846 <1> ;mov dx, cx ; COLUMN VALUE TO DX 5847 00002BFB 0FB7D1 <1> movzx edx, cx 5848 <1> 5849 <1> ;----- DETERMINE GRAPHICS MODE CURRENTLY IN EFFECT 5850 <1> 5851 <1> ; SET UP THE REGISTERS ACCORDING TO THE MODE 5852 <1> ; CH = MASK FOR LOW OF COLUMN ADDRESS ( 7/3 FOR HIGH/MED RES ) 5853 <1> ; CL = # OF ADDRESS BITS IN COLUMN VALUE ( 3/2 FOR H/M ) 5854 <1> ; BL = MASK TO SELECT BITS FROM POINTED BYTE ( 80H/C0H FOR H/M ) 5855 <1> ; BH = NUMBER OF VALID BITS IN POINTED BYTE ( 1/2 FOR H/M ) 5856 <1> 5857 00002BFE 66BBC002 <1> mov bx, 2C0h 5858 00002C02 66B90203 <1> mov cx, 302h ; SET PARMS FOR MED RES 5859 00002C06 803D[2E680000]06 <1> cmp byte [CRT_MODE], 6 5860 00002C0D 7208 <1> jc short R5 ; HANDLE IF MED RES 5861 00002C0F 66BB8001 <1> mov bx, 180h 5862 00002C13 66B90307 <1> mov cx, 703h ; SET PARMS FOR HIGH RES 5863 <1> 5864 <1> ;----- DETERMINE BIT OFFSET IN BYTE FROM COLUMN MASK 5865 <1> R5: 5866 00002C17 20D5 <1> and ch, dl ; ADDRESS OF PEL WITHIN BYTE TO CH 5867 <1> 5868 <1> ;----- DETERMINE BYTE OFFSET FOR THIS LOCATION IN COLUMN 5869 <1> 5870 <1> ;shr dx, cl ; SHIFT BY CORRECT AMOUNT 5871 <1> ;add si, dx ; INCREMENT THE POINTER 5872 <1> ; 02/08/2022 5873 00002C19 D3EA <1> shr edx, cl 5874 00002C1B 01D6 <1> add esi, edx 5875 00002C1D 88FE <1> mov dh, bh ; GET THE # OF BITS IN RESULT TO DH 5876 <1> 5877 <1> ;----- MULTIPLY BH (VALID BITS IN BYTE) BY CH (BIT OFFSET) 5878 <1> 5879 00002C1F 28C9 <1> sub cl, cl ; ZERO INTO STORAGE LOCATION 5880 <1> R6: 5881 00002C21 D0C8 <1> ror al, 1 ; LEFT JUSTIFY VALUE IN AL (FOR WRITE) 5882 00002C23 00E9 <1> add cl, ch ; ADD IN THE BIT OFFSET VALUE 5883 00002C25 FECF <1> dec bh ; LOOP CONTROL 5884 00002C27 75F8 <1> jnz short R6 ; ON EXIT, CL HAS COUNT TO RESTORE BITS 5885 00002C29 88DC <1> mov ah, bl ; GET MASK TO AH 5886 00002C2B D2EC <1> shr ah, cl ; MOVE THE MASK TO CORRECT LOCATION 5887 00002C2D C3 <1> retn ; RETURN WITH EVERYTHING SET UP 5888 <1> 5889 <1> load_dac_palette: 5890 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 5891 <1> ; 29/07/2016 5892 <1> ; 23/07/2016 5893 <1> ; 03/07/2016 (TRDOS 386 = TRDOS v2.0) 5894 <1> ; (set_mode_vga) 5895 <1> ; derived from 'Plex86/Bochs VGABios' source code 5896 <1> ; vgabios-0.7a (2011) 5897 <1> ; by the LGPL VGABios developers Team (2001-2008) 5898 <1> ; 'vgabios.c', 'load_dac_palette' 5899 <1> ; 5900 <1> ; Oracle VirtualBox 5.0.24 VGABios Source Code 5901 <1> ; ('vgabios.c', 'vgatables.h', 'vgafonts.h', 'vgarom.asm') 5902 <1> ; 5903 <1> ; INPUT -> AH = DAC selection number (3, 2 or 1) 5904 <1> ; OUTPUT -> ECX = 0, AX = 0 5905 <1> ; (Modifed registers: EAX, ECX, EDX, ESI) 5906 <1> ; 5907 00002C2E 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 5908 00002C32 28C0 <1> sub al, al ; 0 5909 00002C34 EE <1> out dx, al ; 0 ; color index, always 0 at the beginning 5910 <1> ;inc dx ; 3C9h ; VGAREG_DAC_DATA 5911 <1> ; 02/08/2022 5912 00002C35 FEC2 <1> inc dl ; dx = 3C9h 5913 <1> ;mov ecx, 256 ; always 256*3 values 5914 <1> ; 02/08/2022 5915 00002C37 31C9 <1> xor ecx, ecx 5916 00002C39 FEC5 <1> inc ch 5917 <1> ; ecx = 256 5918 <1> 5919 <1> ;push esi 5920 00002C3B 88E0 <1> mov al, ah 5921 00002C3D B43F <1> mov ah, 3Fh ; 3Fh except DAC selection number 3 5922 00002C3F 3C02 <1> cmp al, 2 5923 00002C41 7414 <1> je short l_dac_p_2 5924 00002C43 7719 <1> ja short l_dac_p_3 5925 00002C45 20C0 <1> and al, al 5926 00002C47 7507 <1> jnz short l_dac_p_1 5927 <1> l_dac_p_0: 5928 00002C49 BE[00480100] <1> mov esi, palette0 5929 00002C4E EB15 <1> jmp short l_dac_p_4 5930 <1> l_dac_p_1: 5931 00002C50 BE[C0480100] <1> mov esi, palette1 5932 00002C55 EB0E <1> jmp short l_dac_p_4 5933 <1> l_dac_p_2: 5934 00002C57 BE[80490100] <1> mov esi, palette2 5935 00002C5C EB07 <1> jmp short l_dac_p_4 5936 <1> l_dac_p_3: 5937 00002C5E B4FF <1> mov ah, 0FFh ; dac registers 5938 00002C60 BE[404A0100] <1> mov esi, palette3 5939 <1> l_dac_p_4: 5940 00002C65 AC <1> lodsb 5941 00002C66 EE <1> out dx, al ; Red 5942 00002C67 AC <1> lodsb 5943 00002C68 EE <1> out dx, al ; Green 5944 00002C69 AC <1> lodsb 5945 00002C6A EE <1> out dx, al ; Blue 5946 00002C6B 20E4 <1> and ah, ah 5947 00002C6D 7405 <1> jz short l_dac_p_5 5948 00002C6F FECC <1> dec ah 5949 00002C71 E2F2 <1> loop l_dac_p_4 5950 <1> ;pop esi 5951 00002C73 C3 <1> retn 5952 <1> l_dac_p_5: 5953 <1> ; 29/07/2016 5954 00002C74 FEC9 <1> dec cl 5955 00002C76 7407 <1> jz short l_dac_p_7 5956 <1> ; 5957 00002C78 28C0 <1> sub al, al ; 0 5958 <1> l_dac_p_6: 5959 00002C7A EE <1> out dx, al ; outb(VGAREG_DAC_DATA,0); 5960 00002C7B EE <1> out dx, al 5961 00002C7C EE <1> out dx, al 5962 00002C7D E2FB <1> loop l_dac_p_6 5963 <1> l_dac_p_7: 5964 <1> ;pop esi 5965 00002C7F C3 <1> retn 5966 <1> 5967 <1> gray_scale_summing: 5968 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 5969 <1> ; 12/04/2021 5970 <1> ; 03/07/2016 (TRDOS 386 = TRDOS v2.0) 5971 <1> ; (set_mode_vga) 5972 <1> ; derived from 'Plex86/Bochs VGABios' source code 5973 <1> ; vgabios-0.7a (2011) 5974 <1> ; by the LGPL VGABios developers Team (2001-2008) 5975 <1> ; 'vgabios.c', 'biosfn_perform_gray_scale_summing' 5976 <1> ; 5977 <1> ; Oracle VirtualBox 5.0.24 VGABios Source Code 5978 <1> ; ('vgabios.c', 'vgatables.h', 'vgafonts.h', 'vgarom.asm') 5979 <1> ; 5980 <1> 5981 <1> ; INPUT -> EBX = Start address (color index <= 255) 5982 <1> ; ECX = Count (<= 256) 5983 <1> ; OUTPUT -> (E)CX = 0 5984 <1> ; (Modifed registers: EAX, ECX, EDX, EBX) 5985 <1> 5986 00002C80 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 5987 00002C84 EC <1> in al, dx 5988 00002C85 30C0 <1> xor al, al ; 0 5989 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 5990 <1> ; 03/08/2022 5991 00002C87 B2C0 <1> mov dl, 0C0h 5992 00002C89 EE <1> out dx, al ; clear bit 5 5993 <1> ; (while loading palette registers) 5994 <1> ; set read address and switch to read mode 5995 <1> g_s_s_1: 5996 <1> ;mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 5997 <1> ; 03/08/2022 5998 00002C8A B2C7 <1> mov dl, 0C7h 5999 00002C8C 88D8 <1> mov al, bl 6000 00002C8E EE <1> out dx, al 6001 <1> ; get 6-bit wide RGB data values 6002 <1> ; intensity = (0.3*Red)+(0.59*Green)+(0.11*Blue) 6003 <1> ; i = ( ( 77*r + 151*g + 28*b ) + 0x80 ) >> 8; 6004 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 6005 <1> ; 03/08/2022 6006 00002C8F B2C9 <1> mov dl, 0C9h 6007 00002C91 EC <1> in al, dx ; red 6008 00002C92 B44D <1> mov ah, 77 ; 0.3* Red 6009 00002C94 F6E4 <1> mul ah 6010 <1> ;push ax 6011 <1> ; 12/04/2021 6012 00002C96 50 <1> push eax 6013 00002C97 EC <1> in al, dx ; green 6014 00002C98 B497 <1> mov ah, 151 ; 0.59 * Green 6015 00002C9A F6E4 <1> mul ah 6016 <1> ;push ax 6017 <1> ; 12/04/2021 6018 00002C9C 50 <1> push eax 6019 00002C9D EC <1> in al, dx ; blue 6020 00002C9E B41C <1> mov ah, 28 ; 0.11 * Blue 6021 00002CA0 F6E4 <1> mul ah 6022 <1> ;pop dx 6023 <1> ; 12/04/2021 6024 00002CA2 5A <1> pop edx 6025 00002CA3 6601D0 <1> add ax, dx 6026 <1> ;pop dx 6027 <1> ; 12/04/2021 6028 00002CA6 5A <1> pop edx 6029 00002CA7 6601D0 <1> add ax, dx 6030 00002CAA 66058000 <1> add ax, 80h 6031 00002CAE B03F <1> mov al, 3Fh 6032 00002CB0 38C4 <1> cmp ah, al ; if(i>0x3f)i=0x3f 6033 00002CB2 7602 <1> jna short g_s_s_2 6034 00002CB4 88C4 <1> mov ah, al 6035 <1> g_s_s_2: 6036 <1> ;mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 6037 <1> ; 03/08/2022 6038 00002CB6 B2C8 <1> mov dl, 0C8h 6039 00002CB8 88D8 <1> mov al, bl ; color index 6040 00002CBA EE <1> out dx, al 6041 00002CBB 88E0 <1> mov al, ah ; intensity 6042 <1> ;inc dx ; 3C9h ; VGAREG_DAC_DATA 6043 <1> ; 03/08/2022 6044 00002CBD FEC2 <1> inc dl 6045 00002CBF EE <1> out dx, al ; R (R=G=B) 6046 00002CC0 88E0 <1> mov al, ah ; intensity 6047 00002CC2 EE <1> out dx, al ; G (R=G=B) 6048 00002CC3 88E0 <1> mov al, ah ; intensity 6049 00002CC5 EE <1> out dx, al ; B (R=G=B) 6050 <1> ;dec cx 6051 <1> ; 03/08/2022 6052 00002CC6 49 <1> dec ecx 6053 00002CC7 7404 <1> jz short g_s_s_3 6054 00002CC9 FEC3 <1> inc bl ; next color index value 6055 00002CCB EBBD <1> jmp short g_s_s_1 6056 <1> g_s_s_3: 6057 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 6058 <1> ; 03/08/2022 6059 00002CCD B2DA <1> mov dl, 0DAh 6060 00002CCF EC <1> in al, dx 6061 00002CD0 B020 <1> mov al, 20h 6062 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 6063 <1> ; 03/08/2022 6064 00002CD2 B2C0 <1> mov dl, 0C0h 6065 00002CD4 EE <1> out dx, al ; 20h -> set bit 5 6066 <1> ; (after loading palette regs) 6067 00002CD5 C3 <1> retn 6068 <1> 6069 <1> vga_write_char_attr: 6070 <1> vga_write_char_only: 6071 <1> ; 08/07/2016 (TRDOS 386 = TRDOS v2.0) 6072 <1> ; 6073 <1> ; derived from 'Plex86/Bochs VGABios' source code 6074 <1> ; vgabios-0.7a (2011) 6075 <1> ; by the LGPL VGABios developers Team (2001-2008) 6076 <1> ; 'vgabios.c', 'biosfn_write_char_attr' 6077 <1> ; 'biosfn_write_char_only' 6078 <1> 6079 <1> ; INPUT -> 6080 <1> ; [CRT_MODE] = current video mode (>7) 6081 <1> ; CX = Count of characters to write 6082 <1> ; AL = Character to write 6083 <1> ; BL = Color of character 6084 <1> ; OUTPUT -> 6085 <1> ; Regen buffer updated 6086 <1> 6087 00002CD6 8A25[2E680000] <1> mov ah, [CRT_MODE] 6088 00002CDC 668B15[CE760100] <1> mov dx, [CURSOR_POSN] ; cursor pos for page 0 6089 <1> 6090 00002CE3 BE[4A680000] <1> mov esi, vga_modes 6091 00002CE8 89F7 <1> mov edi, esi 6092 00002CEA 83C710 <1> add edi, vga_mode_count 6093 <1> vga_wca_0: 6094 00002CED AC <1> lodsb 6095 00002CEE 38E0 <1> cmp al, ah ; [CRT_MODE] 6096 00002CF0 7405 <1> je short vga_wca_2 6097 00002CF2 39FE <1> cmp esi, edi 6098 00002CF4 72F7 <1> jb short vga_wca_0 6099 <1> vga_wca_1: 6100 00002CF6 C3 <1> retn ; nothing to do 6101 <1> vga_wca_2: 6102 00002CF7 83C64F <1> add esi, vga_memmodel - (vga_modes + 1) 6103 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 6104 <1> 6105 <1> ; biosfn_write_char_attr (car,page,attr,count) 6106 <1> ; AL = car, page = 0, BL = attr, CX = count 6107 00002CFA 803E04 <1> cmp byte [esi], PLANAR4 6108 00002CFD 741D <1> je short vga_wca_planar 6109 00002CFF 803E03 <1> cmp byte [esi], PLANAR1 6110 00002D02 7418 <1> je short vga_wca_planar 6111 <1> vga_wca_linear8: 6112 <1> ; while((count-->0) && (xcurs ; CX = count 6114 00002D04 6621C9 <1> and cx, cx 6115 00002D07 74ED <1> jz short vga_wca_1 6116 00002D09 3A15[30680000] <1> cmp dl, [CRT_COLS] 6117 00002D0F 73E5 <1> jnb short vga_wca_1 6118 <1> ; write_gfx_char_lin(car,attr,xcurs,ycurs,nbcols); 6119 <1> ; AL = car, BL = attr, DL = xcurs, DH = ycurs, 6120 <1> ; [CRT_COLS] = nbcols 6121 00002D11 E81E000000 <1> call write_gfx_char_lin 6122 00002D16 6649 <1> dec cx ; count 6123 00002D18 FEC2 <1> inc dl ; xcurs 6124 00002D1A EBE8 <1> jmp short vga_wca_linear8 6125 <1> vga_wca_planar: 6126 <1> ; while((count-->0) && (xcurs ; CX = count 6128 00002D1C 6621C9 <1> and cx, cx 6129 00002D1F 74D5 <1> jz short vga_wca_1 6130 00002D21 3A15[30680000] <1> cmp dl, [CRT_COLS] 6131 00002D27 73CD <1> jnb short vga_wca_1 6132 <1> ; write_gfx_char_pl4(car,attr,xcurs,ycurs,nbcols,cheight); 6133 <1> ; AL = car, BL = attr, DL = xcurs, DH = ycurs, 6134 <1> ; [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight 6135 00002D29 E8A7000000 <1> call write_gfx_char_pl4 6136 00002D2E 6649 <1> dec cx ; count 6137 00002D30 FEC2 <1> inc dl ; xcurs 6138 00002D32 EBE8 <1> jmp short vga_wca_planar 6139 <1> 6140 <1> write_gfx_char_lin: 6141 <1> ; 02/08/2022 (TRDOS 386 v2.0.5) 6142 <1> ; 08/01/2021 6143 <1> ; 05/01/2021 (TRDOS 386 v2.0.3) 6144 <1> ; 08/08/2016 6145 <1> ; 31/07/2016 6146 <1> ; 08/07/2016 (TRDOS 386 = TRDOS v2.0) 6147 <1> ; 6148 <1> ; derived from 'Plex86/Bochs VGABios' source code 6149 <1> ; vgabios-0.7a (2011) 6150 <1> ; by the LGPL VGABios developers Team (2001-2008) 6151 <1> ; 'vgabios.c', 'write_gfx_char_lin' 6152 <1> 6153 <1> ; write_gfx_char_lin(car,attr,xcurs,ycurs,nbcols) 6154 <1> ; INPUT -> 6155 <1> ; AL = car, BL = attr, DL = xcurs, DH = ycurs, 6156 <1> ; [CRT_COLS] = nbcols 6157 <1> ; OUTPUT -> 6158 <1> ; Regen buffer updated 6159 <1> 6160 00002D34 51 <1> push ecx 6161 00002D35 53 <1> push ebx 6162 00002D36 52 <1> push edx 6163 00002D37 50 <1> push eax 6164 <1> ; addr=xcurs*8+ycurs*nbcols*64; 6165 <1> ; 08/08/2016 6166 00002D38 0FB6F0 <1> movzx esi, al ; car 6167 <1> ; 08/01/2021 6168 <1> ;movzx eax, dh ; ycurs 6169 <1> ;mov ah, [CRT_COLS] ; nbcols 6170 <1> ;mul ah 6171 00002D3B A0[30680000] <1> mov al, [CRT_COLS] 6172 00002D40 F6E6 <1> mul dh 6173 <1> ;shl ax, 6 ; * 64 6174 <1> ;shl ax, 3 ; 8 * ycurs * [CRT_COLS] 6175 <1> ; 02/08/2022 6176 00002D42 C1E003 <1> shl eax, 3 6177 <1> ;sub dh, dh 6178 <1> ;shl dx, 3 ; xcurs * 8 6179 <1> ;movzx edi, dx 6180 00002D45 BF00000A00 <1> mov edi, 0A0000h 6181 00002D4A 30F6 <1> xor dh, dh 6182 00002D4C 6689D7 <1> mov di, dx 6183 <1> ;movzx edi, dl 6184 00002D4F 66C1E703 <1> shl di, 3 ; xcurs * 8 6185 <1> ;xor dh, dh 6186 00002D53 8A15[32680000] <1> mov dl, [CHAR_HEIGHT] 6187 00002D59 66F7E2 <1> mul dx 6188 <1> ; eax = ycurs*nbcols*8*[CHAR_HEIGHT] 6189 <1> ;add edi, eax ; addr 6190 <1> ;add edi, 0A0000h 6191 00002D5C 6601C7 <1> add di, ax 6192 <1> ;shl si, 3 ; car * 8 6193 00002D5F 30E4 <1> xor ah, ah 6194 00002D61 A0[32680000] <1> mov al, [CHAR_HEIGHT] 6195 00002D66 66F7E6 <1> mul si 6196 00002D69 6689C6 <1> mov si, ax 6197 <1> ;; esi = src = car * 8 6198 <1> ; esi = src = car * [CHAR_HEIGHT] 6199 <1> ; i = 0 6200 <1> ;add esi, vgafont8 ; fdata [src+i] 6201 <1> ; 08/08/2016 6202 00002D6C A1[5E830100] <1> mov eax, [VGA_INT43H] 6203 00002D71 09C0 <1> or eax, eax ; 0 ? 6204 00002D73 743E <1> jz short wfxl_7 ; yes, default font 6205 <1> ;cmp eax, vgafont16 6206 <1> ;je short wgfxl_0 6207 <1> ;cmp eax, vgafont14 6208 <1> ;je short wgfxl_0 6209 <1> ;cmp eax, vgafont8 6210 <1> ;je short wgfxl_0 6211 <1> ;; 05/01/2021 (TRDOS 386 v2.0.3) 6212 <1> ;; user font 6213 <1> ;mov eax, VGAFONTUSR ; 8x16 or 8x8 or 8x14 font 6214 <1> ; ; (256 characters) 6215 <1> wgfxl_0: 6216 00002D75 01C6 <1> add esi, eax 6217 <1> wgfxl_1: 6218 00002D77 28FF <1> sub bh, bh ; i = 0 6219 <1> wgfxl_2: 6220 <1> ; for(i=0;i<8;i++) 6221 00002D79 57 <1> push edi ; addr 6222 00002D7A 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] ; nbcols 6223 00002D81 F6E7 <1> mul bh ; nbcols*i 6224 <1> ;shl ax, 3 ; i*nbcols*8 6225 <1> ; 02/08/2022 6226 00002D83 C1E003 <1> shl eax, 3 6227 <1> ; dest=addr+i*nbcols*8; 6228 00002D86 01C7 <1> add edi, eax ; dest + j ; j = 0 6229 00002D88 B180 <1> mov cl, 80h ; mask = 0x80; 6230 <1> ; esi = fdata + src + i 6231 <1> ; for(j=0;j<8;j++) 6232 00002D8A 29D2 <1> sub edx, edx ; j = 0 6233 <1> wgfxl_3: 6234 00002D8C 8A06 <1> mov al, [esi] ; al = fdata[src+i] 6235 00002D8E 20C8 <1> and al, cl ; if (fdata[src+i] & mask) 6236 00002D90 7402 <1> jz short wgfxl_4 ; data = 0, zf = 1 6237 00002D92 88D8 <1> mov al, bl ; data = attr; 6238 <1> wgfxl_4: 6239 <1> ; write_byte(0xa000,dest+j,data); 6240 00002D94 AA <1> stosb ; dest + j (+ 0A0000h) 6241 <1> ;inc dl ; j++ 6242 <1> ;cmp dl, 8 6243 00002D95 80FA07 <1> cmp dl, 7 6244 00002D98 720E <1> jb short wgfxl_5 6245 00002D9A 5F <1> pop edi 6246 <1> ; 08/08/2016 6247 <1> ;cmp bh, 7 6248 <1> ;jnb short wgfxl_6 6249 00002D9B FEC7 <1> inc bh ; i++ 6250 00002D9D 3A3D[32680000] <1> cmp bh, [CHAR_HEIGHT] 6251 00002DA3 7309 <1> jnb short wgfxl_6 6252 00002DA5 46 <1> inc esi 6253 00002DA6 EBD1 <1> jmp short wgfxl_2 6254 <1> wgfxl_5: 6255 00002DA8 D0E9 <1> shr cl, 1 ; mask >>= 1; 6256 00002DAA FEC2 <1> inc dl ; j++ 6257 00002DAC EBDE <1> jmp short wgfxl_3 6258 <1> wgfxl_6: 6259 00002DAE 58 <1> pop eax 6260 00002DAF 5A <1> pop edx 6261 00002DB0 5B <1> pop ebx 6262 00002DB1 59 <1> pop ecx 6263 00002DB2 C3 <1> retn 6264 <1> wfxl_7: 6265 <1> ; 08/01/2021 6266 <1> ; 05/01/2021 6267 <1> ; Default font (8x8 or 8x14 or 8x16) 6268 00002DB3 A0[32680000] <1> mov al, [CHAR_HEIGHT] 6269 00002DB8 3C08 <1> cmp al, 8 6270 00002DBA 7507 <1> jne short wfxl_8 6271 00002DBC B8[404D0100] <1> mov eax, vgafont8 6272 00002DC1 EBB2 <1> jmp short wgfxl_0 6273 <1> wfxl_8: 6274 00002DC3 3C0E <1> cmp al, 14 6275 00002DC5 7507 <1> jne short wfxl_9 6276 00002DC7 B8[40550100] <1> mov eax, vgafont14 6277 00002DCC EBA7 <1> jmp short wgfxl_0 6278 <1> wfxl_9: 6279 00002DCE B8[40630100] <1> mov eax, vgafont16 6280 00002DD3 EBA0 <1> jmp short wgfxl_0 6281 <1> 6282 <1> write_gfx_char_pl4: 6283 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 6284 <1> ; 08/08/2016 6285 <1> ; 08/07/2016 (TRDOS 386 = TRDOS v2.0) 6286 <1> ; 6287 <1> ; derived from 'Plex86/Bochs VGABios' source code 6288 <1> ; vgabios-0.7a (2011) 6289 <1> ; by the LGPL VGABios developers Team (2001-2008) 6290 <1> ; 'vgabios.c', 'write_gfx_char_pl4' 6291 <1> 6292 <1> ; write_gfx_char_pl4(car,attr,xcurs,ycurs,nbcols,cheight) 6293 <1> ; INPUT -> 6294 <1> ; AL = car, BL = attr, DL = xcurs, DH = ycurs, 6295 <1> ; [CRT_COLS] = nbcols, [CHAR_HEIGHT] = cheight 6296 <1> ; OUTPUT -> 6297 <1> ; Regen buffer updated 6298 <1> 6299 00002DD5 51 <1> push ecx 6300 00002DD6 53 <1> push ebx 6301 00002DD7 52 <1> push edx 6302 00002DD8 50 <1> push eax 6303 <1> wgfxpl_f0: 6304 <1> ; switch(cheight) 6305 00002DD9 8A25[32680000] <1> mov ah, [CHAR_HEIGHT] 6306 00002DDF 80FC10 <1> cmp ah, 16 ; case 16: 6307 00002DE2 7507 <1> jne short wgfxpl_f1 6308 <1> ; fdata = &vgafont16; 6309 00002DE4 BE[40630100] <1> mov esi, vgafont16 6310 00002DE9 EB13 <1> jmp short wgfxpl_f3 6311 <1> wgfxpl_f1: 6312 00002DEB 80FC0E <1> cmp ah, 14 ; case 14: 6313 00002DEE 7507 <1> jne short wgfxpl_f2 6314 00002DF0 BE[40550100] <1> mov esi, vgafont14 6315 00002DF5 EB07 <1> jmp short wgfxpl_f3 6316 <1> wgfxpl_f2: 6317 <1> ; default: 6318 <1> ; fdata = &vgafont8; 6319 00002DF7 BE[404D0100] <1> mov esi, vgafont8 6320 00002DFC B408 <1> mov ah, 8 6321 <1> wgfxpl_f3: 6322 <1> ; al = car 6323 00002DFE F6E4 <1> mul ah ; ah = cheight 6324 00002E00 25FFFF0000 <1> and eax, 0FFFFh ; car * cheight 6325 <1> ; src = car * cheight; 6326 00002E05 01C6 <1> add esi, eax ; esi = fdata[src+i] 6327 <1> ; addr=xcurs*8+ycurs*nbcols*64; 6328 00002E07 88F0 <1> mov al, dh ; ycurs 6329 00002E09 8A25[30680000] <1> mov ah, [CRT_COLS] ; nbcols 6330 00002E0F F6E4 <1> mul ah 6331 <1> ; 08/08/2016 6332 <1> ;shl ax, 6 ; * 64 6333 <1> ;shl ax, 3 ; * 8 6334 <1> ; 02/08/2022 6335 00002E11 C1E003 <1> shl eax, 3 6336 <1> ;sub dh, dh ; 0 6337 <1> ;shl dx, 3 ; xcurs * 8 6338 <1> ;movzx edi, dx 6339 00002E14 0FB6FA <1> movzx edi, dl 6340 <1> ;shl di, 3 ; xcurs * 8 6341 <1> ; 02/08/2022 6342 00002E17 C1E703 <1> shl edi, 3 6343 00002E1A 30F6 <1> xor dh, dh 6344 00002E1C 8A15[32680000] <1> mov dl, [CHAR_HEIGHT] 6345 00002E22 66F7E2 <1> mul dx 6346 <1> ; eax = ycurs*nbcols*8*[CHAR_HEIGHT] 6347 00002E25 01C7 <1> add edi, eax ; addr 6348 00002E27 81C700000A00 <1> add edi, 0A0000h 6349 <1> ; 6350 <1> ; outw(VGAREG_SEQU_ADDRESS, 0x0f02); 6351 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0205); 6352 00002E2D 66BAC403 <1> mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 6353 00002E31 66B8020F <1> mov ax, 0F02h 6354 00002E35 66EF <1> out dx, ax 6355 00002E37 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6356 00002E3B 66B80502 <1> mov ax, 0205h 6357 00002E3F 66EF <1> out dx, ax 6358 <1> ; 6359 00002E41 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6360 00002E45 F6C380 <1> test bl, 80h ; if(attr&0x80) 6361 00002E48 7406 <1> jz short wgfxpl_f4 ; else 6362 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x1803); 6363 00002E4A 66B80318 <1> mov ax, 1803h 6364 00002E4E EB04 <1> jmp short wgfxpl_f5 6365 <1> wgfxpl_f4: 6366 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0003); 6367 00002E50 66B80300 <1> mov ax, 0003h 6368 <1> wgfxpl_f5: 6369 00002E54 66EF <1> out dx, ax 6370 <1> ; 6371 00002E56 28FF <1> sub bh, bh ; i = 0 6372 <1> wgfxpl_0: 6373 <1> ; for(i=0;i push edi ; addr 6375 00002E59 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] ; nbcols 6376 00002E60 F6E7 <1> mul bh ; nbcols*i 6377 <1> ; dest=addr+i*nbcols 6378 00002E62 01C7 <1> add edi, eax ; dest 6379 00002E64 B580 <1> mov ch, 80h ; mask = 0x80; 6380 <1> ; for(j=0;j<8;j++) 6381 00002E66 28C9 <1> sub cl, cl ; j = 0 6382 <1> wgfxpl_1: 6383 00002E68 D2ED <1> shr ch, cl ; mask=0x80>>j; 6384 <1> ; 6385 <1> ; outw(VGAREG_GRDC_ADDRESS, (mask << 8) | 0x08); 6386 <1> ; read_byte(0xa000,dest); 6387 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6388 00002E6A 88EC <1> mov ah, ch 6389 00002E6C B008 <1> mov al, 8 6390 00002E6E 66EF <1> out dx, ax 6391 00002E70 8A07 <1> mov al, [edi] ; ? (io delay?) 6392 <1> ; 6393 00002E72 28C0 <1> sub al, al ; attr = 0 6394 <1> ; if (fdata[src+i] & mask) 6395 00002E74 842E <1> test byte [esi], ch 6396 00002E76 7404 <1> jz short wgfxpl_2 ; zf = 1 6397 <1> ; write_byte(0xa000,dest,attr&0x0f); 6398 00002E78 88D8 <1> mov al, bl ; attr; 6399 00002E7A 240F <1> and al, 0Fh ; attr&0x0f 6400 <1> wgfxpl_2: 6401 <1> ; write_byte(0xa000,dest,0x00); 6402 00002E7C 8807 <1> mov [edi], al ; dest (+ 0A0000h) 6403 00002E7E FEC1 <1> inc cl ; j++ 6404 00002E80 80F908 <1> cmp cl, 8 6405 00002E83 72E3 <1> jb short wgfxpl_1 6406 00002E85 5F <1> pop edi 6407 <1> ; 08/08/2016 6408 <1> ;cmp bh, 7 6409 <1> ;jnb short wgfxpl_3 6410 00002E86 FEC7 <1> inc bh ; i++ 6411 00002E88 3A3D[32680000] <1> cmp bh, [CHAR_HEIGHT] 6412 00002E8E 7303 <1> jnb short wgfxpl_3 6413 00002E90 46 <1> inc esi 6414 00002E91 EBC5 <1> jmp short wgfxpl_0 6415 <1> wgfxpl_3: 6416 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6417 00002E93 66B808FF <1> mov ax, 0FF08h 6418 00002E97 66EF <1> out dx, ax 6419 00002E99 66B80500 <1> mov ax, 0005h 6420 00002E9D 66EF <1> out dx, ax 6421 00002E9F 66B80300 <1> mov ax, 0003h 6422 00002EA3 66EF <1> out dx, ax 6423 <1> ; 6424 00002EA5 58 <1> pop eax 6425 00002EA6 5A <1> pop edx 6426 00002EA7 5B <1> pop ebx 6427 00002EA8 59 <1> pop ecx 6428 00002EA9 C3 <1> retn 6429 <1> 6430 <1> vga_write_pixel: 6431 <1> ; 02/08/2022 (TRDOS 386 Kerbel v2.0.5) 6432 <1> ; 09/07/2016 (TRDOS 386 = TRDOS v2.0) 6433 <1> ; 6434 <1> ; derived from 'Plex86/Bochs VGABios' source code 6435 <1> ; vgabios-0.7a (2011) 6436 <1> ; by the LGPL VGABios developers Team (2001-2008) 6437 <1> ; 'vgabios.c', 'biosfn_write_pixel' 6438 <1> 6439 <1> ; INPUT -> 6440 <1> ; DX = row (0-239) 6441 <1> ; CX = column (0-799) 6442 <1> ; AL = pixel value 6443 <1> ; (AH = [CRT_MODE]) 6444 <1> ; OUTPUT -> 6445 <1> ; none 6446 <1> 6447 00002EAA 88C3 <1> mov bl, al ; pixel value 6448 <1> ;mov ah, [CRT_MODE] 6449 00002EAC BE[4A680000] <1> mov esi, vga_modes 6450 00002EB1 89F7 <1> mov edi, esi 6451 00002EB3 83C710 <1> add edi, vga_mode_count 6452 <1> vga_wp_0: 6453 00002EB6 AC <1> lodsb 6454 00002EB7 38E0 <1> cmp al, ah ; [CRT_MODE] 6455 00002EB9 7405 <1> je short vga_wp_1 6456 00002EBB 39FE <1> cmp esi, edi 6457 00002EBD 72F7 <1> jb short vga_wp_0 6458 00002EBF C3 <1> retn ; nothing to do 6459 <1> vga_wp_1: 6460 00002EC0 83C64F <1> add esi, vga_memmodel - (vga_modes + 1) 6461 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 6462 00002EC3 BF00000A00 <1> mov edi, 0A0000h 6463 <1> ; 6464 00002EC8 803E04 <1> cmp byte [esi], PLANAR4 6465 00002ECB 741C <1> je short vga_wp_planar 6466 00002ECD 803E03 <1> cmp byte [esi], PLANAR1 6467 00002ED0 7417 <1> je short vga_wp_planar 6468 <1> vga_wp_linear8: 6469 <1> ; addr=CX+DX*(read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); 6470 00002ED2 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] ; = [VGA_COLS] ; nbcols 6471 <1> ;shl ax, 3 ; * 8 6472 <1> ; 02/08/2022 6473 00002ED9 C1E003 <1> shl eax, 3 6474 00002EDC 66F7E2 <1> mul dx 6475 00002EDF 50 <1> push eax 6476 <1> ;mov edi, 0A0000h 6477 00002EE0 6601CF <1> add di, cx 6478 00002EE3 58 <1> pop eax 6479 00002EE4 01C7 <1> add edi, eax ; addr 6480 <1> ; write_byte(0xa000,addr,AL); 6481 00002EE6 881F <1> mov [edi], bl 6482 00002EE8 C3 <1> retn 6483 <1> vga_wp_planar: 6484 <1> ; addr = CX/8+DX*read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS); 6485 00002EE9 0FB7C1 <1> movzx eax, cx 6486 00002EEC 66C1E803 <1> shr ax, 3 ; CX/8 6487 00002EF0 50 <1> push eax 6488 00002EF1 28E4 <1> sub ah, ah ; 0 6489 00002EF3 A0[30680000] <1> mov al, [CRT_COLS] ; = [VGA_COLS] ; nbcols 6490 00002EF8 66F7E2 <1> mul dx 6491 <1> ;mov edi, 0A0000h 6492 00002EFB 6601C7 <1> add di, ax 6493 00002EFE 58 <1> pop eax 6494 00002EFF 01C7 <1> add edi, eax ; addr 6495 00002F01 80E107 <1> and cl, 7 6496 00002F04 B580 <1> mov ch, 80h ; mask 6497 00002F06 D2ED <1> shr ch, cl ; mask = 0x80 >> (CX & 0x07); 6498 <1> 6499 <1> ; outw(VGAREG_GRDC_ADDRESS, (mask << 8) | 0x08); 6500 00002F08 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6501 00002F0C 88EC <1> mov ah, ch 6502 00002F0E B008 <1> mov al, 8 6503 00002F10 66EF <1> out dx, ax 6504 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x0205); 6505 00002F12 66B80502 <1> mov ax, 0205h 6506 00002F16 66EF <1> out dx, ax 6507 <1> ; data = read_byte(0xa000,addr); 6508 00002F18 8A07 <1> mov al, [edi] ; (delay?) 6509 <1> ; if (AL & 0x80) 6510 <1> ; { 6511 <1> ; outw(VGAREG_GRDC_ADDRESS, 0x1803); 6512 <1> ; } 6513 00002F1A F6C380 <1> test bl, 80h 6514 00002F1D 7406 <1> jz short vga_wp_2 6515 00002F1F 66B80318 <1> mov ax, 1803h 6516 00002F23 66EF <1> out dx, ax 6517 <1> vga_wp_2: 6518 <1> ; write_byte(0xa000,addr,AL); 6519 00002F25 881F <1> mov [edi], bl 6520 <1> ; 6521 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6522 00002F27 66B808FF <1> mov ax, 0FF08h 6523 00002F2B 66EF <1> out dx, ax 6524 00002F2D 66B80500 <1> mov ax, 0005h 6525 00002F31 66EF <1> out dx, ax 6526 00002F33 66B80300 <1> mov ax, 0003h 6527 00002F37 66EF <1> out dx, ax 6528 <1> ; 6529 00002F39 C3 <1> retn 6530 <1> 6531 <1> vga_read_pixel: 6532 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 6533 <1> ; 09/07/2016 (TRDOS 386 = TRDOS v2.0) 6534 <1> ; 6535 <1> ; derived from 'Plex86/Bochs VGABios' source code 6536 <1> ; vgabios-0.7a (2011) 6537 <1> ; by the LGPL VGABios developers Team (2001-2008) 6538 <1> ; 'vgabios.c', 'biosfn_read_pixel' 6539 <1> 6540 <1> ; INPUT -> 6541 <1> ; DX = row (0-239) 6542 <1> ; CX = column (0-799) 6543 <1> ; (AH = [CRT_MODE]) 6544 <1> ; OUTPUT -> 6545 <1> ; AL = pixel value 6546 <1> 6547 <1> ;mov ah, [CRT_MODE] 6548 00002F3A BE[4A680000] <1> mov esi, vga_modes 6549 00002F3F 89F7 <1> mov edi, esi 6550 00002F41 83C710 <1> add edi, vga_mode_count 6551 <1> vga_rp_0: 6552 00002F44 AC <1> lodsb 6553 00002F45 38E0 <1> cmp al, ah ; [CRT_MODE] 6554 00002F47 7405 <1> je short vga_rp_1 6555 00002F49 39FE <1> cmp esi, edi 6556 00002F4B 72F7 <1> jb short vga_rp_0 6557 00002F4D C3 <1> retn ; nothing to do 6558 <1> vga_rp_1: 6559 00002F4E 83C64F <1> add esi, vga_memmodel - (vga_modes + 1) 6560 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 6561 00002F51 BF00000A00 <1> mov edi, 0A0000h 6562 <1> ; 6563 00002F56 803E04 <1> cmp byte [esi], PLANAR4 6564 00002F59 741C <1> je short vga_rp_planar 6565 00002F5B 803E03 <1> cmp byte [esi], PLANAR1 6566 00002F5E 7417 <1> je short vga_rp_planar 6567 <1> vga_rp_linear8: 6568 <1> ; addr=CX+DX*(read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS)*8); 6569 00002F60 0FB605[30680000] <1> movzx eax, byte [CRT_COLS] ; = [VGA_COLS] ; nbcols 6570 <1> ;shl ax, 3 ; * 8 6571 <1> ; 02/08/2022 6572 00002F67 C1E003 <1> shl eax, 3 6573 00002F6A 66F7E2 <1> mul dx 6574 00002F6D 50 <1> push eax 6575 <1> ;mov edi, 0A0000h 6576 00002F6E 6601CF <1> add di, cx 6577 00002F71 58 <1> pop eax 6578 00002F72 01C7 <1> add edi, eax ; addr 6579 <1> ; attr=read_byte(0xa000,addr); 6580 00002F74 8A07 <1> mov al, [edi] ; pixel value 6581 00002F76 C3 <1> retn 6582 <1> vga_rp_planar: 6583 <1> ; addr = CX/8+DX*read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS); 6584 00002F77 0FB7C1 <1> movzx eax, cx 6585 00002F7A 66C1E803 <1> shr ax, 3 ; CX/8 6586 00002F7E 50 <1> push eax 6587 00002F7F 28E4 <1> sub ah, ah ; 0 6588 00002F81 A0[30680000] <1> mov al, [CRT_COLS] ; = [VGA_COLS] ; nbcols 6589 00002F86 66F7E2 <1> mul dx 6590 <1> ;mov edi, 0A0000h 6591 00002F89 6601C7 <1> add di, ax 6592 00002F8C 58 <1> pop eax 6593 00002F8D 01C7 <1> add edi, eax ; addr 6594 00002F8F 80E107 <1> and cl, 7 6595 00002F92 B580 <1> mov ch, 80h ; mask 6596 00002F94 D2ED <1> shr ch, cl ; mask = 0x80 >> (CX & 0x07); 6597 <1> ; attr = 0x00; 6598 00002F96 30DB <1> xor bl, bl ; attr = bl = 0, 6599 00002F98 30C9 <1> xor cl, cl ; i = cl = 0 6600 <1> ; for(i=0;i<4;i++) 6601 <1> ; { 6602 <1> ; outw(VGAREG_GRDC_ADDRESS, (i << 8) | 0x04); 6603 <1> ; data = read_byte(0xa000,addr) & mask; 6604 <1> ; if (data > 0) attr |= (0x01 << i); 6605 <1> ; } 6606 <1> vga_rp_2: 6607 00002F9A 88CC <1> mov ah, cl ; i << 8 6608 00002F9C B004 <1> mov al, 4 ; | 0x04 6609 00002F9E 66BACE03 <1> mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 6610 00002FA2 66EF <1> out dx, ax 6611 <1> ; data = read_byte(0xa000,addr) & mask; 6612 00002FA4 8A07 <1> mov al, [edi] 6613 00002FA6 20E8 <1> and al, ch ; & mask 6614 <1> ; if (data > 0) attr |= (0x01 << i); 6615 00002FA8 08C0 <1> or al, al 6616 00002FAA 7408 <1> jz short vga_rp_3 ; al = 0 6617 00002FAC B701 <1> mov bh, 1 6618 00002FAE D2E7 <1> shl bh, cl ; (0x01 << i) 6619 00002FB0 08FB <1> or bl, bh ; attr |= (0x01 << i) 6620 00002FB2 88D8 <1> mov al, bl ; pixel value 6621 <1> vga_rp_3: 6622 00002FB4 C3 <1> retn 6623 <1> 6624 <1> vga_beeper: 6625 <1> ; 04/08/2016 (TRDOS 386 = TRDOS v2.0) 6626 00002FB5 FB <1> sti 6627 <1> ;mov bh, [ACTIVE_PAGE] 6628 00002FB6 E917F4FFFF <1> jmp beeper_gfx 6629 <1> 6630 <1> vga_write_teletype: 6631 <1> ; 03/08/2022 (TRDOS 386 Kernel v2.0.5) 6632 <1> ; 12/04/2021 (TRDOS 386 v2.0.3, 32 bit push/pop) 6633 <1> ; 09/12/2017 6634 <1> ; 06/08/2016 6635 <1> ; 04/08/2016 6636 <1> ; 01/08/2016 6637 <1> ; 31/07/2016 6638 <1> ; 09/07/2016 (TRDOS 386 = TRDOS v2.0) 6639 <1> ; 6640 <1> ; derived from 'Plex86/Bochs VGABios' source code 6641 <1> ; vgabios-0.7a (2011) 6642 <1> ; by the LGPL VGABios developers Team (2001-2008) 6643 <1> ; 'vgabios.c', 'biosfn_write_teletype' 6644 <1> ; 'biosfn_write_char_only' 6645 <1> 6646 <1> ; INPUT -> 6647 <1> ; [CRT_MODE] = current video mode (>7) 6648 <1> ; AL = Character to write 6649 <1> ; BL = Color of character 6650 <1> ; OUTPUT -> 6651 <1> ; Regen buffer updated 6652 <1> 6653 <1> ; biosfn_write_teletype (car, page, attr, flag) 6654 <1> ; car = character (AL) 6655 <1> ; page = 0 6656 <1> ; attr = color (BL) 6657 <1> ; 'flag' not used 6658 <1> 6659 00002FBB 8A25[2E680000] <1> mov ah, [CRT_MODE] 6660 00002FC1 88C7 <1> mov bh, al ; character 6661 00002FC3 668B15[CE760100] <1> mov dx, [CURSOR_POSN] ; cursor pos for page 0 6662 <1> 6663 00002FCA BE[52680000] <1> mov esi, vga_g_modes 6664 00002FCF 89F7 <1> mov edi, esi 6665 00002FD1 83C708 <1> add edi, vga_g_mode_count 6666 <1> vga_wtty_0: 6667 00002FD4 AC <1> lodsb 6668 00002FD5 38E0 <1> cmp al, ah ; [CRT_MODE] 6669 00002FD7 7405 <1> je short vga_wtty_2 6670 00002FD9 39FE <1> cmp esi, edi 6671 00002FDB 72F7 <1> jb short vga_wtty_0 6672 <1> vga_wtty_1: 6673 00002FDD C3 <1> retn ; nothing to do 6674 <1> vga_wtty_2: 6675 00002FDE 80FF07 <1> cmp bh, 07h ; bell (beep) 6676 00002FE1 74D2 <1> je short vga_beeper ; u11 6677 00002FE3 80FF08 <1> cmp bh, 08h ; backspace 6678 00002FE6 7508 <1> jne short vga_wtty_3 6679 <1> ; if(xcurs>0)xcurs--; 6680 00002FE8 08D2 <1> or dl, dl ; xcurs (column) 6681 00002FEA 74F1 <1> jz short vga_wtty_1 6682 00002FEC FECA <1> dec dl ; xcurs--; 6683 00002FEE EB55 <1> jmp short vga_wtty_12 6684 <1> vga_wtty_3: 6685 00002FF0 80FF0D <1> cmp bh, 0Dh ; carriage return (\r) 6686 00002FF3 7504 <1> jne short vga_wtty_4 6687 <1> ; xcurs=0; 6688 00002FF5 28D2 <1> sub dl, dl ; 0 6689 00002FF7 EB4C <1> jmp short vga_wtty_12 6690 <1> vga_wtty_4: 6691 00002FF9 80FF0A <1> cmp bh, 0Ah ; new line (\n) 6692 00002FFC 7504 <1> jne short vga_wtty_5 6693 <1> ; ycurs++; 6694 00002FFE FEC6 <1> inc dh ; next row 6695 00003000 EB5E <1> jmp short vga_wtty_11 6696 <1> vga_wtty_5: 6697 00003002 80FF09 <1> cmp bh, 09h ; tab stop 6698 00003005 7523 <1> jne short vga_wtty_8 6699 00003007 88D0 <1> mov al, dl 6700 <1> ;cbw 6701 00003009 30E4 <1> xor ah, ah ; 09/12/2017 6702 0000300B B108 <1> mov cl, 8 6703 0000300D F6F1 <1> div cl 6704 0000300F 28E1 <1> sub cl, ah 6705 <1> ; 6706 00003011 B720 <1> mov bh, 20h ; space 6707 <1> vga_wtty_6: ; tab stop loop 6708 <1> ;push cx 6709 <1> ;push bx 6710 <1> ; 12/04/2021 6711 00003013 51 <1> push ecx 6712 00003014 53 <1> push ebx 6713 00003015 E810000000 <1> call vga_wtty_8 6714 <1> ;pop bx ; bh = character, bl = color 6715 <1> ;pop cx 6716 <1> ; 12/04/2021 6717 0000301A 5B <1> pop ebx ; bh = character, bl = color 6718 0000301B 59 <1> pop ecx 6719 0000301C FEC9 <1> dec cl 6720 0000301E 7409 <1> jz short vga_wtty_7 6721 00003020 668B15[CE760100] <1> mov dx, [CURSOR_POSN] ; new cursor position (pg 0) 6722 00003027 EBEA <1> jmp short vga_wtty_6 6723 <1> vga_wtty_7: 6724 00003029 C3 <1> retn 6725 <1> ; 6726 <1> vga_wtty_8: 6727 0000302A 83C64F <1> add esi, vga_g_memmodel - (vga_g_modes + 1) 6728 <1> ; [ESI] = VGA memory model number (LINEAR8, PLANAR4, PLANAR1) 6729 0000302D BF00000A00 <1> mov edi, 0A0000h 6730 <1> ; 6731 00003032 88F8 <1> mov al, bh ; character 6732 <1> ; 6733 00003034 803E04 <1> cmp byte [esi], PLANAR4 6734 00003037 7414 <1> je short vga_wtty_planar 6735 00003039 803E03 <1> cmp byte [esi], PLANAR1 6736 0000303C 740F <1> je short vga_wtty_planar 6737 <1> vga_wtty_linear8: 6738 <1> ; write_gfx_char_lin(car,attr,xcurs,ycurs,nbcols); 6739 <1> ; AL = car, BL = attr (color), DL = xcurs, DH = ycurs, 6740 <1> ; [CRT_COLS] = nbcols 6741 0000303E E8F1FCFFFF <1> call write_gfx_char_lin 6742 00003043 EB0D <1> jmp short vga_wtty_9 6743 <1> 6744 <1> vga_wtty_12: 6745 <1> ; 09/07/2016 6746 <1> ; set cursor position 6747 <1> ; NOTE: Hardware cursor position will not be set 6748 <1> ; in any VGA modes (>7) 6749 <1> ; But, cursor position will be saved into 6750 <1> ; [CURSOR_POSN]. 6751 <1> ; TRDOS 386 (TRDOS v2.0) uses only one page 6752 <1> ; (page 0) for all graphics modes. 6753 <1> 6754 00003045 668915[CE760100] <1> mov [CURSOR_POSN], dx ; save cursor pos for pg 0 6755 <1> ; 04/08/2016 6756 <1> ;mov bh, [ACTIVE_PAGE] ; = 0 6757 <1> ;call _set_cpos 6758 0000304C C3 <1> retn 6759 <1> 6760 <1> vga_wtty_planar: 6761 <1> ; write_gfx_char_pl4(car,attr,xcurs,ycurs,nbcols,cheight); 6762 <1> ; AL = car, BL = attr (color), DL = xcurs, DH = ycurs, 6763 <1> ; [CRT_COLS]= nbcols, [CHAR_HEIGHT] = cheight 6764 0000304D E883FDFFFF <1> call write_gfx_char_pl4 6765 <1> vga_wtty_9: 6766 00003052 FEC2 <1> inc dl ; xcurs++; 6767 <1> vga_wtty_10: 6768 <1> ; Do we need to wrap ? 6769 <1> ; if(xcurs==nbcols) 6770 00003054 3A15[30680000] <1> cmp dl, [CRT_COLS] ; [VGA_COLS] 6771 0000305A 7204 <1> jb short vga_wtty_11 ; no 6772 0000305C 28D2 <1> sub dl, dl ; xcurs=0; 6773 0000305E FEC6 <1> inc dh ; ycurs++; 6774 <1> vga_wtty_11: 6775 <1> ; Do we need to scroll ? 6776 <1> ; if(ycurs==nbrows) 6777 00003060 3A35[36680000] <1> cmp dh, [VGA_ROWS] 6778 00003066 72DD <1> jb short vga_wtty_12 ; no 6779 <1> ; 6780 <1> ; biosfn_scroll (nblines,attr,rul,cul,rlr,clr,page,dir) 6781 <1> ; al = nblines = 1, bl = attr (color) = 0 6782 <1> ; ch = rul, cl = cul, dh = rlr, dl = clr, page = 0 6783 <1> ; dir = SCROLL_UP 6784 <1> 6785 00003068 B001 <1> mov al, 1 6786 0000306A 28DB <1> sub bl, bl ; 0 ; blank/black line (attr=0) will be used 6787 <1> ;sub cx, cx ; 0,0 6788 <1> ; 03/08/2022 6789 0000306C 29C9 <1> sub ecx, ecx 6790 <1> 6791 <1> ; 06/08/2016 6792 0000306E 8A35[36680000] <1> mov dh, [VGA_ROWS] 6793 00003074 FECE <1> dec dh ; nbrows -1 6794 <1> 6795 <1> ;push dx ; 04/08/2016 6796 <1> ; 12/04/2021 6797 00003076 52 <1> push edx 6798 00003077 8A15[30680000] <1> mov dl, [CRT_COLS] 6799 0000307D FECA <1> dec dl ; nbcols -1 6800 <1> 6801 0000307F 8A25[2E680000] <1> mov ah, [CRT_MODE] 6802 <1> 6803 <1> ; biosfn_scroll(0x01,0x00,0,0,nbrows-1,nbcols-1,page,SCROLL_UP); 6804 00003085 E843F5FFFF <1> call vga_graphics_up 6805 <1> ; 04/08/2016 6806 <1> ;pop dx 6807 <1> ; 12/04/2021 6808 0000308A 5A <1> pop edx 6809 <1> 6810 <1> ;dec dh ; ycurs-=1 6811 0000308B EBB8 <1> jmp short vga_wtty_12 6812 <1> 6813 <1> font_setup: 6814 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 6815 <1> ; 09/01/2021 (TRDOS 386 v2.0.3) 6816 <1> ; 09/07/2016 6817 <1> ; character generator (font loading) functions 6818 <1> ; 6819 <1> ; derived from 'Plex86/Bochs VGABios' source code 6820 <1> ; vgabios-0.7a (2011) 6821 <1> ; by the LGPL VGABios developers Team (2001-2008) 6822 <1> ; 'vgabios.c', 'int10_func' 6823 <1> 6824 <1> ; AX = 1100H ; Load User-Defined Font (EGA/VGA) 6825 <1> ; 6826 <1> ; BH = height of each character (bytes per character definition) 6827 <1> ; (BL = font block to load (EGA: 0-3; VGA: 0-7)) 6828 <1> ; CX = number of characters to redefine (<=256) 6829 <1> ; DX = ASCII code of the first character defined at ES:BP 6830 <1> ; EBP = address of font-definition information 6831 <1> ; (in user's memory space) 6832 <1> 6833 <1> ; case 0x11: 6834 <1> ; switch(GET_AL()) 6835 <1> ; { 6836 <1> ; case 0x00: 6837 <1> ; case 0x10: 6838 <1> ; biosfn_load_text_user_pat(GET_AL(),ES,BP,CX,DX,GET_BL(),GET_BH()); 6839 <1> ; break; 6840 <1> 6841 <1> ; AX = 1110H ; Load and Activate User-Defined Font (EGA/VGA) 6842 0000308D 08C0 <1> or al, al ; 0 6843 0000308F 7404 <1> jz short font_setup_0 6844 00003091 3C10 <1> cmp al, 10h 6845 00003093 7511 <1> jne short font_setup_1 6846 <1> font_setup_0: 6847 00003095 E8CE000000 <1> call transfer_user_fonts 6848 0000309A 721C <1> jc short font_setup_error 6849 0000309C E8AD010000 <1> call load_text_user_pat 6850 000030A1 E9C5EAFFFF <1> jmp VIDEO_RETURN 6851 <1> font_setup_1: 6852 <1> ; AX = 1101H ; Load ROM 8x14 Character Set (EGA/VGA) 6853 <1> ; case 0x01: 6854 <1> ; case 0x11: 6855 <1> ; biosfn_load_text_8_14_pat(GET_AL(),GET_BL()); 6856 <1> ; break; 6857 000030A6 3C01 <1> cmp al, 1 6858 000030A8 7404 <1> je short font_setup_2 6859 000030AA 3C11 <1> cmp al, 11h 6860 000030AC 7511 <1> jne short font_setup_3 6861 <1> font_setup_2: 6862 <1> ; AX = 1111H ; Load and Activate ROM 8x14 Character Set (EGA/VGA) 6863 <1> ; (BL = font block to load (EGA: 0-3; VGA: 0-7)) 6864 000030AE E8C9020000 <1> call load_text_8_14_pat 6865 000030B3 E9B3EAFFFF <1> jmp VIDEO_RETURN 6866 <1> font_setup_error: 6867 000030B8 29C0 <1> sub eax, eax ; 0 -> fonts could not be loaded 6868 000030BA E9B1EAFFFF <1> jmp _video_return 6869 <1> font_setup_3: 6870 <1> ; AX = 1102H ; Load ROM 8x8 Character Set (EGA/VGA) 6871 <1> ; case 0x02: 6872 <1> ; case 0x12: 6873 <1> ; biosfn_load_text_8_8_pat(GET_AL(),GET_BL()); 6874 <1> ; break; 6875 000030BF 3C02 <1> cmp al, 2 6876 000030C1 7404 <1> je short font_setup_4 6877 000030C3 3C12 <1> cmp al, 12h 6878 000030C5 750A <1> jne short font_setup_5 6879 <1> font_setup_4: 6880 <1> ; AX = 1112H ; Load and Activate ROM 8x8 Character Set (EGA/VGA) 6881 <1> ; (BL = font block to load (EGA: 0-3; VGA: 0-7)) 6882 000030C7 E8E1020000 <1> call load_text_8_8_pat 6883 000030CC E99AEAFFFF <1> jmp VIDEO_RETURN 6884 <1> font_setup_5: 6885 <1> ; AX = 1104H ; Load ROM 8x16 Character Set (EGA/VGA) 6886 <1> ; case 0x04: 6887 <1> ; case 0x14: 6888 <1> ; biosfn_load_text_8_16_pat(GET_AL(),GET_BL()); 6889 <1> ; break; 6890 000030D1 3C04 <1> cmp al, 4 6891 000030D3 7404 <1> je short font_setup_6 6892 000030D5 3C14 <1> cmp al, 14h 6893 000030D7 750A <1> jne short font_setup_7 6894 <1> font_setup_6: 6895 <1> ; AX = 1114H ; Load and Activate ROM 8x16 Character Set (EGA/VGA) 6896 <1> ; (BL = font block to load (EGA: 0-3; VGA: 0-7)) 6897 000030D9 E819030000 <1> call load_text_8_16_pat 6898 000030DE E988EAFFFF <1> jmp VIDEO_RETURN 6899 <1> font_setup_7: 6900 <1> ; Note: AX=1120h (Setup INT 1Fh, EXT_PTR) is not needed 6901 <1> ; for TRDOS 386 (TRDOS v2.0) video functionality; 6902 <1> ; because, originally EXT_PTR (font address) was used for 6903 <1> ; chars 80h to 0FFh (after the first 128 ASCII char fonts), for 6904 <1> ; CGA graphics mode; currenty, 'vgafont8' address has 256 chars! 6905 <1> ; 6906 <1> ; case 0x20: 6907 <1> ; biosfn_load_gfx_8_8_chars(ES,BP); 6908 <1> ; break; 6909 <1> ; case 0x21: 6910 <1> ; biosfn_load_gfx_user_chars(ES,BP,CX,GET_BL(),GET_DL()); 6911 <1> ; break; 6912 <1> ; AX = 1121H ; Setup User-Defined Font for Graphics Mode (VGA) 6913 <1> ; BL screen rows code: 00H = user-specified (in DL) 6914 <1> ; 01H = 14 rows 6915 <1> ; 02H = 25 rows 6916 <1> ; 03H = 43 rows 6917 <1> ; CX bytes per character definition 6918 <1> ; DL (when BL=0) custom number of character rows on screen 6919 <1> ; EBP address of font-definition information (user's mem space) 6920 <1> 6921 000030E3 3C21 <1> cmp al, 21h 6922 000030E5 7531 <1> jne short font_setup_9 6923 <1> 6924 <1> ; TRDOS 386 modification ! 6925 <1> ; dh = 0 -> 256 characters 6926 <1> ; dh = 80h -> second 128 characters 6927 <1> ; dh = 0FFh -> first 128 characters 6928 <1> 6929 <1> ; 09/01/2021 (TRDOS 386 v2.0.3) 6930 <1> ;push ebx 6931 000030E7 51 <1> push ecx 6932 000030E8 52 <1> push edx 6933 000030E9 30D2 <1> xor dl, dl 6934 000030EB 88CF <1> mov bh, cl ; character height 6935 <1> ;mov cx, 100h ; 256 6936 <1> ; 03/08/2022 6937 000030ED 31C9 <1> xor ecx, ecx 6938 000030EF FEC5 <1> inc ch 6939 <1> ; ecx = 100h 6940 000030F1 08F6 <1> or dh, dh ; 0 6941 000030F3 7410 <1> jz short font_setup_8 6942 000030F5 FECD <1> dec ch ; cx = 0 6943 000030F7 80FEFF <1> cmp dh, 0FFh 6944 000030FA 7409 <1> je short font_setup_8 ; 1st 128 chars 6945 <1> ; 2nd 128 chars 6946 000030FC 80FE80 <1> cmp dh, 80h 6947 000030FF 75B7 <1> jne short font_setup_error ; invalid ! 6948 00003101 88F1 <1> mov cl, dh 6949 00003103 86D6 <1> xchg dl, dh 6950 <1> ; number of chars, cx = 80h 6951 <1> ; start char, dl = 80h 6952 <1> font_setup_8: 6953 00003105 E85E000000 <1> call transfer_user_fonts 6954 0000310A 5A <1> pop edx 6955 0000310B 59 <1> pop ecx 6956 <1> ;pop ebx 6957 0000310C 72AA <1> jc short font_setup_error 6958 <1> ; ebp = user's font data address in system's memory space 6959 0000310E E82F030000 <1> call load_gfx_user_chars 6960 00003113 E953EAFFFF <1> jmp VIDEO_RETURN 6961 <1> font_setup_9: 6962 <1> ; case 0x22: 6963 <1> ; biosfn_load_gfx_8_14_chars(GET_BL()); 6964 <1> ; break; 6965 00003118 3C22 <1> cmp al, 22h 6966 0000311A 750A <1> jne short font_setup_10 6967 0000311C E85D030000 <1> call load_gfx_8_14_chars 6968 00003121 E945EAFFFF <1> jmp VIDEO_RETURN 6969 <1> font_setup_10: 6970 <1> ; case 0x23: 6971 <1> ; biosfn_load_gfx_8_8_dd_chars(GET_BL()); 6972 <1> ; break; 6973 00003126 3C23 <1> cmp al, 23h 6974 00003128 750A <1> jne short font_setup_11 6975 0000312A E890030000 <1> call load_gfx_8_8_chars 6976 0000312F E937EAFFFF <1> jmp VIDEO_RETURN 6977 <1> font_setup_11: 6978 <1> ; case 0x24: 6979 <1> ; biosfn_load_gfx_8_16_chars(GET_BL()); 6980 <1> ; break; 6981 00003134 3C24 <1> cmp al, 24h 6982 00003136 750A <1> jne short font_setup_12 6983 00003138 E8C3030000 <1> call load_gfx_8_16_chars 6984 0000313D E929EAFFFF <1> jmp VIDEO_RETURN 6985 <1> font_setup_12: 6986 <1> ; case 0x30: 6987 <1> ; biosfn_get_font_info(GET_BH(),&ES,&BP,&CX,&DX); 6988 <1> ; break; 6989 00003142 3C30 <1> cmp al, 30h 6990 00003144 750A <1> jne short font_setup_13 6991 00003146 E8F6030000 <1> call get_font_info 6992 <1> ; eax = return value (info: 4 bytes for 4 parms) 6993 <1> ; eax = 0 -> invalid function (input) 6994 0000314B E920EAFFFF <1> jmp _video_return 6995 <1> font_setup_13: 6996 00003150 3C03 <1> cmp al, 03h ; AX = 1103h 6997 00003152 750D <1> jne short font_setup_14 6998 <1> ; biosfn_set_text_block_specifier: 6999 <1> ; BL = font block selector code 7000 <1> ; NOTE: TRDOS 386 only uses and sets font block 0 7001 <1> ; (It is as BL = 0 for TRDOS 386) 7002 00003154 66BAC403 <1> mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 7003 <1> ;mov ah, bl 7004 00003158 28E4 <1> sub ah, ah ; 0 7005 <1> ;mov al, 03h 7006 0000315A 66EF <1> out dx, ax 7007 0000315C E90AEAFFFF <1> jmp VIDEO_RETURN 7008 <1> 7009 <1> font_setup_14: 7010 00003161 29C0 <1> sub eax, eax ; 0 = invalid function 7011 00003163 E908EAFFFF <1> jmp _video_return 7012 <1> 7013 <1> transfer_user_fonts: 7014 <1> ; 02/08/2022 (TRDOS 386 Kernel v2.0.5) 7015 <1> ; 19/01/2021 7016 <1> ; 09/01/2021 7017 <1> ; 05/01/2021 (TRDOS 386 v2.0.3) 7018 <1> 7019 <1> ; BH = height of each character (bytes per character) 7020 <1> ; CX = number of characters to redefine (<=256) 7021 <1> ; DX = ASCII code of the first character defined at EBP 7022 <1> ; EBP = address of font-definition information 7023 <1> ; (in user's memory space) 7024 <1> 7025 <1> ; Modified registers: eax, edx, ecx, esi, edi, ebp 7026 <1> ; 7027 <1> ; output: 7028 <1> ; ebp = user font data address in system memory 7029 <1> 7030 00003168 81E2FFFF0000 <1> and edx, 0FFFFh 7031 0000316E 81E1FFFF0000 <1> and ecx, 0FFFFh 7032 00003174 7537 <1> jnz short transfer_user_fonts_5 7033 <1> 7034 00003176 09D2 <1> or edx, edx 7035 00003178 7531 <1> jnz short transfer_user_fonts_4 7036 0000317A 09ED <1> or ebp, ebp 7037 0000317C 752D <1> jnz short transfer_user_fonts_4 7038 <1> 7039 <1> ; cx = 0, dx = 0, ebp = 0 7040 <1> ; copy system font to user font 7041 <1> 7042 0000317E B140 <1> mov cl, 64 ; 64 dwords 7043 <1> 7044 00003180 80FF10 <1> cmp bh, 16 7045 00003183 7417 <1> je short transfer_user_fonts_2 7046 00003185 80FF08 <1> cmp bh, 8 7047 00003188 7406 <1> je short transfer_user_fonts_1 7048 <1> 7049 0000318A BD[40550100] <1> mov ebp, vgafont14 7050 0000318F C3 <1> retn 7051 <1> 7052 <1> transfer_user_fonts_1: 7053 00003190 BF00500900 <1> mov edi, VGAFONT8USER 7054 00003195 BE[404D0100] <1> mov esi, vgafont8 7055 0000319A EB0A <1> jmp short transfer_user_fonts_3 7056 <1> 7057 <1> transfer_user_fonts_2: 7058 0000319C BF00400900 <1> mov edi, VGAFONT16USER 7059 000031A1 BE[40630100] <1> mov esi, vgafont16 7060 <1> transfer_user_fonts_3: 7061 000031A6 89FD <1> mov ebp, edi 7062 000031A8 F3A5 <1> rep movsd 7063 000031AA C3 <1> retn 7064 <1> 7065 <1> transfer_user_fonts_4: 7066 000031AB F9 <1> stc 7067 000031AC C3 <1> retn 7068 <1> 7069 <1> transfer_user_fonts_5: 7070 000031AD 09ED <1> or ebp, ebp 7071 000031AF 74FA <1> jz short transfer_user_fonts_4 ; invalid address ! 7072 <1> 7073 000031B1 6681F90001 <1> cmp cx, 256 7074 000031B6 77F3 <1> ja short transfer_user_fonts_4 7075 000031B8 29D1 <1> sub ecx, edx 7076 000031BA 76EF <1> jna short transfer_user_fonts_4 7077 <1> 7078 000031BC 80FF0E <1> cmp bh, 14 ; 8x14 font 7079 <1> ; (there is not an alternative buffer) 7080 000031BF 7524 <1> jne short transfer_user_fonts_6 7081 <1> 7082 <1> ; use system's 8x14 font space if permission flag is 1 7083 000031C1 F605[869D0100]80 <1> test byte [ufont], 80h 7084 000031C8 74E1 <1> jz short transfer_user_fonts_4 ; not allowed 7085 <1> 7086 <1> ; permission is given (for vgafont14 location etc.) 7087 <1> ; (for permanent font modification) 7088 <1> ; 7089 <1> ; 19/01/2021 7090 <1> ; Note: Permission flag can be set by 'root' while 7091 <1> ; system is not in multi tasking/user mode 7092 <1> ; while [multi_tasking] = 0 and [u.uid] = 0 7093 <1> 7094 <1> ;push edx 7095 <1> ; 02/08/2022 7096 000031CA 87D1 <1> xchg edx, ecx 7097 <1> ;xor ah, ah 7098 <1> ; 02/08/2022 7099 000031CC 31C0 <1> xor eax, eax 7100 000031CE 88F8 <1> mov al, bh ; mov al, 14 7101 <1> ;mul cx 7102 <1> ; 02/08/2022 7103 000031D0 F7E2 <1> mul edx ; char count * 14 7104 <1> ; 02/08/2022 7105 000031D2 89CA <1> mov edx, ecx ; ascii code 7106 000031D4 89C1 <1> mov ecx, eax 7107 <1> ; ecx = byte count 7108 <1> ;pop edx 7109 <1> ; 02/08/2022 7110 <1> ;xor eax, eax 7111 000031D6 30E4 <1> xor ah, ah 7112 000031D8 88F8 <1> mov al, bh ; mov ax, 14 ; bytes per character 7113 <1> ;mul dx 7114 <1> ;mov dx, ax ; char offset 7115 <1> ; 02/08/2022 7116 000031DA F7E2 <1> mul edx 7117 000031DC 89C2 <1> mov edx, eax ; char offset 7118 000031DE BF[40550100] <1> mov edi, vgafont14 7119 000031E3 EB48 <1> jmp short transfer_user_fonts_8 7120 <1> transfer_user_fonts_6: 7121 000031E5 80FF08 <1> cmp bh, 8 ; 8x8 font 7122 000031E8 7520 <1> jne short transfer_user_fonts_7 ; 8x16 font 7123 <1> ;shl dx, 3 ; * 8 7124 <1> ;shl cx, 3 ; * 8 7125 <1> ; 02/08/2022 7126 000031EA C1E203 <1> shl edx, 3 ; byte offset 7127 000031ED C1E103 <1> shl ecx, 3 ; byte count 7128 <1> ; 09/01/2021 7129 000031F0 BF00500900 <1> mov edi, VGAFONT8USER 7130 000031F5 F605[869D0100]08 <1> test byte [ufont], 8 ; already loaded ? 7131 000031FC 752F <1> jnz short transfer_user_fonts_8 ; yes 7132 000031FE BE[404D0100] <1> mov esi, vgafont8 7133 00003203 E839000000 <1> call transfer_user_fonts_10 7134 00003208 EB23 <1> jmp short transfer_user_fonts_8 7135 <1> transfer_user_fonts_7: 7136 0000320A 80FF10 <1> cmp bh, 16 ; 8x16 font 7137 0000320D 759C <1> jne short transfer_user_fonts_4 ; invalid ! 7138 <1> ;shl dx, 4 ; * 16 7139 <1> ;shl cx, 4 ; * 16 7140 <1> ; 02/08/2022 7141 0000320F C1E204 <1> shl edx, 4 ; byte offset 7142 00003212 C1E104 <1> shl ecx, 4 ; byte count 7143 00003215 BF00400900 <1> mov edi, VGAFONT16USER 7144 0000321A F605[869D0100]10 <1> test byte [ufont], 16 ; already loaded ? 7145 00003221 750A <1> jnz short transfer_user_fonts_8 ; yes 7146 00003223 BE[40630100] <1> mov esi, vgafont16 7147 00003228 E814000000 <1> call transfer_user_fonts_10 7148 <1> transfer_user_fonts_8: 7149 0000322D 01D7 <1> add edi, edx ; char offset 7150 <1> ; 09/07/2016 7151 <1> ;and ecx, 0FFFFh 7152 <1> ; ECX = byte count 7153 <1> ;push ecx 7154 0000322F 89EE <1> mov esi, ebp ; user's font buffer 7155 <1> ; 09/01/2021 7156 00003231 89FD <1> mov ebp, edi ; system addr for user's font 7157 <1> ; 05/01/2021 7158 <1> ;mov edi, Cluster_Buffer ; system buffer 7159 00003233 E82DD90000 <1> call transfer_from_user_buffer 7160 <1> ;pop ecx 7161 <1> ; ecx = transfer (byte) count = character count 7162 00003238 7206 <1> jc short transfer_user_fonts_9 7163 <1> ; 05/01/2021 7164 <1> ;mov ebp, Cluster_Buffer 7165 <1> 7166 0000323A 083D[869D0100] <1> or byte [ufont], bh 7167 <1> ; 8x8 or 8x16 user font ready 7168 <1> transfer_user_fonts_9: 7169 00003240 C3 <1> retn 7170 <1> 7171 <1> transfer_user_fonts_10: 7172 <1> ; 02/08/2022 7173 <1> ; 09/01/2021 7174 00003241 56 <1> push esi 7175 00003242 57 <1> push edi 7176 00003243 51 <1> push ecx 7177 <1> ;mov cx, 64 7178 <1> ; 02/08/2022 7179 00003244 31C9 <1> xor ecx, ecx 7180 00003246 B140 <1> mov cl, 64 7181 00003248 F3A5 <1> rep movsd 7182 0000324A 59 <1> pop ecx 7183 0000324B 5F <1> pop edi 7184 0000324C 5E <1> pop esi 7185 0000324D C3 <1> retn 7186 <1> 7187 <1> load_text_user_pat: 7188 <1> ; 02/08/2022 (TRDOS 3386 v2.0.5) 7189 <1> ; 26/07/2016 7190 <1> ; 09/07/2016 7191 <1> ; load user defined (EGA/VGA) text fonts 7192 <1> ; 7193 <1> ; derived from 'Plex86/Bochs VGABios' source code 7194 <1> ; vgabios-0.7a (2011) 7195 <1> ; by the LGPL VGABios developers Team (2001-2008) 7196 <1> ; 'vgabios.c', 'biosfn_load_text_user_pat' 7197 <1> 7198 <1> ; biosfn_load_text_user_pat (AL,ES,BP,CX,DX,BL,BH) 7199 <1> 7200 <1> ; get_font_access(); 7201 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7202 <1> ; for(i=0;i ; { 7204 <1> ; src = BP + i * BH; 7205 <1> ; dest = blockaddr + (DX + i) * 32; 7206 <1> ; memcpyb(0xA000, dest, ES, src, BH); 7207 <1> ; } 7208 <1> ; release_font_access(); 7209 <1> ; if(AL>=0x10) 7210 <1> ; { 7211 <1> ; set_scan_lines(BH); 7212 <1> ; } 7213 <1> 7214 0000324E 50 <1> push eax 7215 0000324F E839000000 <1> call get_font_access 7216 00003254 28DB <1> sub bl, bl ; i = 0 7217 <1> ; 02/08/2022 7218 <1> ; ecx <= 256 7219 00003256 30ED <1> xor ch, ch 7220 <1> ltup_1: 7221 00003258 88D8 <1> mov al, bl 7222 0000325A F6E7 <1> mul bh 7223 <1> ;movzx esi, ax 7224 <1> ; 02/08/2022 7225 0000325C 89C6 <1> mov esi, eax 7226 0000325E 01EE <1> add esi, ebp 7227 00003260 88D8 <1> mov al, bl 7228 00003262 28E4 <1> sub ah, ah 7229 <1> ;add ax, dx ; (DX + i) 7230 <1> ;shl ax, 5 ; * 32 7231 <1> ; 02/08/2022 7232 00003264 01D0 <1> add eax, edx 7233 00003266 C1E005 <1> shl eax, 5 7234 <1> ;movzx edi, ax 7235 <1> ; 02/08/2022 7236 00003269 89C7 <1> mov edi, eax 7237 0000326B 81C700000A00 <1> add edi, 0A0000h 7238 00003271 51 <1> push ecx 7239 <1> ;movzx ecx, bh 7240 <1> ; 02/08/2022 7241 00003272 88F9 <1> mov cl, bh 7242 00003274 F3A4 <1> rep movsb 7243 00003276 59 <1> pop ecx 7244 00003277 FEC3 <1> inc bl 7245 00003279 38CB <1> cmp bl, cl 7246 0000327B 75DB <1> jne short ltup_1 7247 <1> ; 7248 0000327D E83E000000 <1> call release_font_access 7249 <1> ; 7250 00003282 58 <1> pop eax 7251 <1> ; if(AL>=0x10) 7252 00003283 3C10 <1> cmp al, 10h 7253 00003285 7205 <1> jb short ltup_2 7254 <1> ; set_scan_lines(BH); 7255 00003287 E86F000000 <1> call set_scan_lines 7256 <1> ltup_2: 7257 0000328C C3 <1> retn 7258 <1> 7259 <1> get_font_access: 7260 <1> ; 02/08/2022 7261 <1> ; 09/07/2016 7262 <1> ; 7263 <1> ; derived from 'Plex86/Bochs VGABios' source code 7264 <1> ; vgabios-0.7a (2011) 7265 <1> ; by the LGPL VGABios developers Team (2001-2008) 7266 <1> ; 'vgabios.c', 'get_font_access' 7267 <1> 7268 <1> ; get_font_access() 7269 0000328D 52 <1> push edx 7270 0000328E 66BAC403 <1> mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 7271 <1> ; 02/08/2022 7272 00003292 31C0 <1> xor eax, eax 7273 <1> ;mov ax, 0100h 7274 00003294 B401 <1> mov ah, 1 7275 <1> ; ax = 0100h 7276 00003296 66EF <1> out dx, ax 7277 00003298 66B80204 <1> mov ax, 0402h 7278 0000329C 66EF <1> out dx, ax 7279 0000329E 66B80407 <1> mov ax, 0704h 7280 000032A2 66EF <1> out dx, ax 7281 000032A4 66B80003 <1> mov ax, 0300h 7282 000032A8 66EF <1> out dx, ax 7283 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 7284 <1> ; 02/08/2022 7285 000032AA B2CE <1> mov dl, 0CEh 7286 000032AC 66B80402 <1> mov ax, 0204h 7287 000032B0 66EF <1> out dx, ax 7288 000032B2 66B80500 <1> mov ax, 0005h 7289 000032B6 66EF <1> out dx, ax 7290 000032B8 66B80604 <1> mov ax, 0406h 7291 000032BC 66EF <1> out dx, ax 7292 000032BE 5A <1> pop edx 7293 000032BF C3 <1> retn 7294 <1> 7295 <1> release_font_access: 7296 <1> ; 02/08/2022 7297 <1> ; 29/07/2016 7298 <1> ; 09/07/2016 7299 <1> ; 7300 <1> ; derived from 'Plex86/Bochs VGABios' source code 7301 <1> ; vgabios-0.7a (2011) 7302 <1> ; by the LGPL VGABios developers Team (2001-2008) 7303 <1> ; 'vgabios.c', 'release_font_access' 7304 <1> 7305 000032C0 66BAC403 <1> mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 7306 <1> ;mov ax, 0100h 7307 <1> ; 02/08/2022 7308 000032C4 29C0 <1> sub eax, eax 7309 000032C6 B401 <1> mov ah, 1 7310 <1> ; ax = 0100h 7311 000032C8 66EF <1> out dx, ax 7312 000032CA 66B80203 <1> mov ax, 0302h 7313 000032CE 66EF <1> out dx, ax 7314 000032D0 66B80403 <1> mov ax, 0304h 7315 000032D4 66EF <1> out dx, ax 7316 000032D6 66B80003 <1> mov ax, 0300h 7317 000032DA 66EF <1> out dx, ax 7318 <1> ;mov dx, 3CCh ; VGAREG_READ_MISC_OUTPUT 7319 <1> ; 02/08/2022 7320 000032DC B2CC <1> mov dl, 0CCh 7321 000032DE EC <1> in al, dx 7322 000032DF 2401 <1> and al, 01h 7323 000032E1 C0E002 <1> shl al, 2 7324 000032E4 0C0A <1> or al, 0Ah 7325 000032E6 88C4 <1> mov ah, al 7326 000032E8 B006 <1> mov al, 06h 7327 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 7328 <1> ; 02/08/2022 7329 000032EA B2CE <1> mov dl, 0CEh 7330 000032EC 66EF <1> out dx, ax 7331 000032EE 66B80400 <1> mov ax, 0004h 7332 000032F2 66EF <1> out dx, ax 7333 000032F4 66B80510 <1> mov ax, 1005h 7334 000032F8 66EF <1> out dx, ax 7335 000032FA C3 <1> retn 7336 <1> 7337 <1> set_scan_lines: 7338 <1> ; 02/08/2022 7339 <1> ; 09/07/2016 7340 <1> ; 7341 <1> ; derived from 'Plex86/Bochs VGABios' source code 7342 <1> ; vgabios-0.7a (2011) 7343 <1> ; by the LGPL VGABios developers Team (2001-2008) 7344 <1> ; 'vgabios.c', 'set_scan_lines' 7345 <1> 7346 <1> ; set_scan_lines(lines) 7347 <1> ; BH = lines 7348 <1> 7349 <1> ; outb(crtc_addr, 0x09); 7350 000032FB 66BAD403 <1> mov dx, 3D4h ; CRTC_ADDRESS = 3D4h (always) 7351 000032FF B009 <1> mov al, 09h 7352 00003301 EE <1> out dx, al 7353 <1> ; crtc_r9 = inb(crtc_addr+1); 7354 <1> ;inc dx ; 3D5h 7355 <1> ; 02/08/2022 7356 00003302 FEC2 <1> inc dl 7357 00003304 EC <1> in al, dx 7358 <1> ; crtc_r9 = (crtc_r9 & 0xe0) | (lines - 1); 7359 00003305 24E0 <1> and al, 0E0h 7360 00003307 FECF <1> dec bh ; lines - 1 7361 00003309 08F8 <1> or al, bh 7362 <1> ; outb(crtc_addr+1, crtc_r9); 7363 0000330B EE <1> out dx, al 7364 <1> ;inc bh 7365 <1> ; if(lines==8) 7366 <1> ;cmp bh, 8 7367 0000330C 80FF07 <1> cmp bh, 7 7368 0000330F 7506 <1> jne short ssl_1 7369 <1> ; biosfn_set_cursor_shape(0x06,0x07); 7370 00003311 66B90706 <1> mov cx, 0607h 7371 00003315 EB06 <1> jmp short ssl_2 7372 <1> ssl_1: 7373 <1> ; biosfn_set_cursor_shape(lines-4,lines-3); 7374 00003317 88F9 <1> mov cl, bh ; lines - 1 7375 00003319 88CD <1> mov ch, cl ; lines - 1 (16 -> 15) 7376 0000331B FECD <1> dec ch ; lines - 2 (16 -> 14) 7377 <1> ssl_2: 7378 <1> ; CH = start line, CL = stop line 7379 0000331D B40A <1> mov ah, 10 ; 6845 register for cursor set 7380 0000331F 66890D[47680000] <1> mov [CURSOR_MODE], cx ; save in data area 7381 00003326 E877F0FFFF <1> call m16 ; output cx register 7382 <1> ; write_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT, lines); 7383 0000332B FEC7 <1> inc bh ; lines 7384 0000332D 883D[32680000] <1> mov [CHAR_HEIGHT], bh 7385 <1> ; outb(crtc_addr, 0x12); 7386 00003333 66BAD403 <1> mov dx, 3D4h ; CRTC_ADDRESS 7387 00003337 B012 <1> mov al, 12h 7388 00003339 EE <1> out dx, al 7389 <1> ; vde = inb(crtc_addr+1); 7390 <1> ;inc dx 7391 <1> ; 02/08/2022 7392 0000333A FEC2 <1> inc dl 7393 0000333C EC <1> in al, dx 7394 0000333D 88C4 <1> mov ah, al 7395 <1> ; outb(crtc_addr, 0x07); 7396 <1> ;dec dx 7397 <1> ; 02/08/2022 7398 0000333F FECA <1> dec dl 7399 00003341 B007 <1> mov al, 07h 7400 00003343 EE <1> out dx, al 7401 <1> ; ovl = inb(crtc_addr+1); 7402 <1> ;inc dx 7403 <1> ; 02/08/2022 7404 00003344 FEC2 <1> inc dl 7405 00003346 EC <1> in al, dx 7406 <1> ; vde += (((ovl & 0x02) << 7) + ((ovl & 0x40) << 3) + 1); 7407 00003347 88E2 <1> mov dl, ah ; vde 7408 00003349 88C6 <1> mov dh, al ; ovl 7409 <1> ;and ax, 02h 7410 <1> ;shl ax, 7 7411 <1> ; 02/08/2022 7412 0000334B 31C0 <1> xor eax, eax 7413 0000334D 88F0 <1> mov al, dh 7414 0000334F 2402 <1> and al, 2 7415 00003351 C1E007 <1> shl eax, 7 7416 <1> ;mov cx, ax ; (ovl & 0x02) << 7) 7417 <1> ; 02/08/2022 7418 00003354 89C1 <1> mov ecx, eax 7419 00003356 28E4 <1> sub ah, ah 7420 00003358 88F0 <1> mov al, dh ; ovl 7421 <1> ;and ax, 40h 7422 <1> ;shl ax, 3 ; (ovl & 0x40) << 3) 7423 <1> ;inc ax ; + 1 7424 <1> ;add ax, cx 7425 <1> ; 02/08/2022 7426 0000335A 2440 <1> and al, 40h 7427 0000335C C1E003 <1> shl eax, 3 7428 0000335F 40 <1> inc eax 7429 00003360 01C8 <1> add eax, ecx 7430 00003362 30F6 <1> xor dh, dh 7431 <1> ;add ax, dx ; + vde 7432 <1> ; 02/08/2022 7433 00003364 01D0 <1> add eax, edx 7434 <1> ; rows = vde / lines; 7435 00003366 F6F7 <1> div bh 7436 <1> ;dec al ; rows -1 7437 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, rows-1); 7438 00003368 A2[36680000] <1> mov [VGA_ROWS], al ; rows (not 'rows-1' !) 7439 <1> ; write_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE, rows * cols * 2); 7440 <1> ;mov ah, [CRT_COLS] 7441 <1> ;mul ah 7442 <1> ; 17/11/2020 7443 0000336D F625[30680000] <1> mul byte [CRT_COLS] 7444 <1> ;shl ax, 1 7445 <1> ; 02/08/2022 7446 00003373 D1E0 <1> shl eax, 1 7447 00003375 66A3[4C830100] <1> mov [CRT_LEN], ax 7448 0000337B C3 <1> retn 7449 <1> 7450 <1> load_text_8_14_pat: 7451 <1> ; 02/08/2022 (TRDOS 3386 v2.0.5) 7452 <1> ; 26/07/2016 7453 <1> ; 25/07/2016 7454 <1> ; 23/07/2016 7455 <1> ; 09/07/2016 7456 <1> ; load user defined (EGA/VGA) text fonts 7457 <1> ; 7458 <1> ; derived from 'Plex86/Bochs VGABios' source code 7459 <1> ; vgabios-0.7a (2011) 7460 <1> ; by the LGPL VGABios developers Team (2001-2008) 7461 <1> ; 'vgabios.c', 'biosfn_load_text_8_14_pat' 7462 <1> 7463 <1> ; biosfn_load_text_8_14_pat (AL,BL) 7464 <1> 7465 <1> ; get_font_access(); 7466 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7467 <1> ; for(i=0;i<0x100;i++) 7468 <1> ; { 7469 <1> ; src = i * 14; 7470 <1> ; dest = blockaddr + i * 32; 7471 <1> ; memcpyb(0xA000, dest, 0xC000, vgafont14+src, 14); 7472 <1> ; } 7473 <1> ; release_font_access(); 7474 <1> ; if(AL>=0x10) 7475 <1> ; { 7476 <1> ; set_scan_lines(14); 7477 <1> ; } 7478 <1> 7479 0000337C 50 <1> push eax 7480 0000337D E80BFFFFFF <1> call get_font_access 7481 <1> 7482 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7483 <1> ;mov dl, bl 7484 <1> ;and dl, 3 7485 <1> ;shl dx, 14 7486 <1> ;xchg dx, bx 7487 <1> ;and dl, 4 7488 <1> ;shl dx, 11 7489 <1> ;add dx, bx 7490 <1> 7491 <1> ;xor dx, dx ; blockaddr = 0 7492 <1> ; Always block 0 for TRDOS 386 ! (blockaddr=0) 7493 <1> 7494 00003382 28DB <1> sub bl, bl ; i = 0 7495 00003384 B70E <1> mov bh, 14 7496 00003386 BE[40550100] <1> mov esi, vgafont14 7497 0000338B BF00000A00 <1> mov edi, 0A0000h 7498 <1> ; 02/08/2022 7499 00003390 29C9 <1> sub ecx, ecx 7500 <1> lt8_14_1: 7501 <1> ;mov al, bl 7502 <1> ;mul bh 7503 <1> ;movzx esi, ax 7504 <1> ;add esi, vgafont14 7505 <1> ;mov al, bl 7506 <1> ;sub ah, ah 7507 <1> ;shl ax, 5 ; * 32 7508 <1> ;;add ax, dx ; blockaddr + i * 32; 7509 <1> ;movzx edi, ax ; dest 7510 <1> ;add edi, 0A0000h 7511 <1> ;02/08/2022 7512 <1> ;movzx ecx, bh 7513 00003392 88F9 <1> mov cl, bh 7514 00003394 F3A4 <1> rep movsb 7515 00003396 83C712 <1> add edi, 18 ; 32 - 14 7516 00003399 FEC3 <1> inc bl 7517 0000339B 75F5 <1> jnz short lt8_14_1 7518 <1> ; 7519 0000339D E81EFFFFFF <1> call release_font_access 7520 <1> ; 7521 000033A2 58 <1> pop eax 7522 <1> ; if(AL>=0x10) 7523 000033A3 3C10 <1> cmp al, 10h 7524 000033A5 7205 <1> jb short lt8_14_4 7525 <1> ; BH = 14 7526 <1> ; set_scan_lines(14); 7527 000033A7 E84FFFFFFF <1> call set_scan_lines 7528 <1> lt8_14_4: 7529 000033AC C3 <1> retn 7530 <1> 7531 <1> load_text_8_8_pat: 7532 <1> ; 02/08/2022 (TRDOS 3386 v2.0.5) 7533 <1> ; 05/01/2021 (TRDOS 386 v2.0.3) 7534 <1> ; 26/07/2016 7535 <1> ; 25/07/2016 7536 <1> ; 23/07/2016 7537 <1> ; 09/07/2016 7538 <1> ; load user defined (EGA/VGA) text fonts 7539 <1> ; 7540 <1> ; derived from 'Plex86/Bochs VGABios' source code 7541 <1> ; vgabios-0.7a (2011) 7542 <1> ; by the LGPL VGABios developers Team (2001-2008) 7543 <1> ; 'vgabios.c', 'biosfn_load_text_8_8_pat' 7544 <1> 7545 <1> ; biosfn_load_text_8_8_pat (AL,BL) 7546 <1> 7547 <1> ; get_font_access(); 7548 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7549 <1> ; for(i=0;i<0x100;i++) 7550 <1> ; { 7551 <1> ; src = i * 8; 7552 <1> ; dest = blockaddr + i * 32; 7553 <1> ; memcpyb(0xA000, dest, 0xC000, vgafont8+src, 8); 7554 <1> ; } 7555 <1> ; release_font_access(); 7556 <1> ; if(AL>=0x10) 7557 <1> ; { 7558 <1> ; set_scan_lines(8); 7559 <1> ; } 7560 <1> 7561 000033AD 50 <1> push eax 7562 000033AE E8DAFEFFFF <1> call get_font_access 7563 <1> 7564 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7565 <1> ;mov dl, bl 7566 <1> ;and dl, 3 7567 <1> ;shl dx, 14 7568 <1> ;xchg dx, bx 7569 <1> ;and dl, 4 7570 <1> ;shl dx, 11 7571 <1> ;add dx, bx 7572 <1> 7573 <1> ;xor dx, dx ; blockaddr = 0 7574 <1> ; Always block 0 for TRDOS 386 ! (blockaddr=0) 7575 <1> 7576 000033B3 28DB <1> sub bl, bl ; i = 0 7577 000033B5 B708 <1> mov bh, 8 7578 <1> ;mov esi, vgafont8 7579 000033B7 BF00000A00 <1> mov edi, 0A0000h 7580 <1> 7581 <1> ; 02/08/2022 7582 000033BC 29C9 <1> sub ecx, ecx 7583 <1> 7584 <1> ; 05/01/2021 7585 000033BE F605[869D0100]80 <1> test byte [ufont], 80h 7586 000033C5 7410 <1> jz short lt8_8_0 7587 <1> ; user font permission (after set mode) 7588 000033C7 F605[869D0100]08 <1> test byte [ufont], 8 7589 000033CE 7407 <1> jz short lt8_8_0 7590 000033D0 BE00500900 <1> mov esi, VGAFONT8USER 7591 000033D5 EB05 <1> jmp short lt8_8_1 7592 <1> lt8_8_0: 7593 000033D7 BE[404D0100] <1> mov esi, vgafont8 7594 <1> lt8_8_1: 7595 <1> ;mov al, bl 7596 <1> ;mul bh 7597 <1> ;movzx esi, ax 7598 <1> ;add esi, vgafont8 7599 <1> ;mov al, bl 7600 <1> ;sub ah, ah 7601 <1> ;shl ax, 5 ; * 32 7602 <1> ;;add ax, dx ; blockaddr + i * 32; 7603 <1> ;movzx edi, ax ; dest 7604 <1> ;add edi, 0A0000h 7605 <1> ; 02/08/2022 7606 <1> ;movzx ecx, bh 7607 000033DC 88F9 <1> mov cl, bh 7608 000033DE F3A4 <1> rep movsb 7609 000033E0 83C718 <1> add edi, 24 ; 32 - 8 7610 000033E3 FEC3 <1> inc bl 7611 000033E5 75F5 <1> jnz short lt8_8_1 7612 <1> ; 7613 000033E7 E8D4FEFFFF <1> call release_font_access 7614 <1> ; 7615 000033EC 58 <1> pop eax 7616 <1> ; if(AL>=0x10) 7617 000033ED 3C10 <1> cmp al, 10h 7618 000033EF 7205 <1> jb short lt8_8_2 7619 <1> ; BH = 8 7620 <1> ; set_scan_lines(8); 7621 000033F1 E805FFFFFF <1> call set_scan_lines 7622 <1> lt8_8_2: 7623 000033F6 C3 <1> retn 7624 <1> 7625 <1> load_text_8_16_pat: 7626 <1> ; 02/08/2022 (TRDOS 3386 v2.0.5) 7627 <1> ; 05/01/2021 (TRDOS 386 v2.0.3) 7628 <1> ; 26/07/2016 7629 <1> ; 25/07/2016 7630 <1> ; 23/07/2016 7631 <1> ; 09/07/2016 7632 <1> ; load user defined (EGA/VGA) text fonts 7633 <1> ; 7634 <1> ; derived from 'Plex86/Bochs VGABios' source code 7635 <1> ; vgabios-0.7a (2011) 7636 <1> ; by the LGPL VGABios developers Team (2001-2008) 7637 <1> ; 'vgabios.c', 'biosfn_load_text_8_16_pat' 7638 <1> 7639 <1> ; biosfn_load_text_8_16_pat (AL,BL) 7640 <1> 7641 <1> ; get_font_access(); 7642 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7643 <1> ; for(i=0;i<0x100;i++) 7644 <1> ; { 7645 <1> ; src = i * 16; 7646 <1> ; dest = blockaddr + i * 32; 7647 <1> ; memcpyb(0xA000, dest, 0xC000, vgafont16+src, 16); 7648 <1> ; } 7649 <1> ; release_font_access(); 7650 <1> ; if(AL>=0x10) 7651 <1> ; { 7652 <1> ; set_scan_lines(16); 7653 <1> ; } 7654 <1> 7655 000033F7 50 <1> push eax 7656 000033F8 E890FEFFFF <1> call get_font_access 7657 <1> 7658 <1> ; blockaddr = ((BL & 0x03) << 14) + ((BL & 0x04) << 11); 7659 <1> ;mov dl, bl 7660 <1> ;and dl, 3 7661 <1> ;shl dx, 14 7662 <1> ;xchg dx, bx 7663 <1> ;and dl, 4 7664 <1> ;shl dx, 11 7665 <1> ;add dx, bx 7666 <1> 7667 <1> ;xor dx, dx ; blockaddr = 0 7668 <1> ; Always block 0 for TRDOS 386 ! (blockaddr=0) 7669 <1> 7670 000033FD 28DB <1> sub bl, bl ; i = 0 7671 000033FF B710 <1> mov bh, 16 7672 <1> ;mov esi, vgafont16 7673 00003401 BF00000A00 <1> mov edi, 0A0000h 7674 <1> ;movzx eax, bh 7675 <1> ; 02/08/2022 7676 00003406 29C0 <1> sub eax, eax 7677 00003408 88F8 <1> mov al, bh 7678 <1> 7679 <1> ; 05/01/2021 7680 0000340A F605[869D0100]80 <1> test byte [ufont], 80h 7681 00003411 7410 <1> jz short lt8_16_0 7682 <1> ; user font permission (after set mode) 7683 00003413 F605[869D0100]10 <1> test byte [ufont], 16 7684 0000341A 7407 <1> jz short lt8_16_0 7685 0000341C BE00400900 <1> mov esi, VGAFONT16USER 7686 00003421 EB05 <1> jmp short lt8_16_1 7687 <1> lt8_16_0: 7688 00003423 BE[40630100] <1> mov esi, vgafont16 7689 <1> lt8_16_1: 7690 <1> ;mov al, bl 7691 <1> ;mul bh 7692 <1> ;movzx esi, ax 7693 <1> ;add esi, vgafont16 7694 <1> ;mov al, bl ; i 7695 <1> ;sub ah, ah 7696 <1> ;shl ax, 5 ; * 32 7697 <1> ;;add ax, dx ; blockaddr + i * 32; 7698 <1> ;movzx edi, ax ; dest 7699 <1> ;add edi, 0A0000h 7700 <1> ;movzx ecx, bh 7701 00003428 89C1 <1> mov ecx, eax ; 16 7702 0000342A F3A4 <1> rep movsb 7703 0000342C 01C7 <1> add edi, eax ; add edi, 16 7704 0000342E FEC3 <1> inc bl 7705 00003430 75F6 <1> jnz short lt8_16_1 7706 <1> ; 7707 00003432 E889FEFFFF <1> call release_font_access 7708 <1> ; 7709 00003437 58 <1> pop eax 7710 <1> ; if(AL>=0x10) 7711 00003438 3C10 <1> cmp al, 10h 7712 0000343A 7205 <1> jb short lt8_16_2 7713 <1> ; BH = 16 7714 <1> ; set_scan_lines(16); 7715 0000343C E8BAFEFFFF <1> call set_scan_lines 7716 <1> lt8_16_2: 7717 00003441 C3 <1> retn 7718 <1> 7719 <1> load_gfx_user_chars: 7720 <1> ; 08/01/2021 7721 <1> ; 05/01/2021 (TRDOS 386 v2.0.3) 7722 <1> ; 08/08/2016 7723 <1> ; 10/07/2016 7724 <1> ; Setup User-Defined Font for Graphics Mode (VGA) 7725 <1> ; 7726 <1> ; derived from 'Plex86/Bochs VGABios' source code 7727 <1> ; vgabios-0.7a (2011) 7728 <1> ; by the LGPL VGABios developers Team (2001-2008) 7729 <1> ; 'vgabios.c', 'biosfn_load_gfx_user_chars' 7730 <1> 7731 <1> ; biosfn_load_gfx_user_chars (ES,BP,CX,BL,DL) 7732 <1> ; /* set 0x43 INT pointer */ 7733 <1> ; write_word(0x0, 0x43*4, BP); 7734 <1> ; write_word(0x0, 0x43*4+2, ES); 7735 <1> 7736 <1> ; 08/01/2021 7737 <1> 7738 <1> ; BL screen rows code: 00H = user-specified (in DL) 7739 <1> ; 01H = 14 rows 7740 <1> ; 02H = 25 rows 7741 <1> ; 03H = 43 rows 7742 <1> ; CX bytes per character definition 7743 <1> ; DL (when BL=0) custom number of character rows on screen 7744 <1> ; EBP address of font-definition information (user's mem space) 7745 <1> 7746 <1> ; 05/01/2021 7747 <1> ;xor eax, eax 7748 <1> ;dec eax ; 0FFFFFFFFh (user defined fonts) 7749 <1> ;mov [VGA_INT43H], eax 7750 <1> 7751 <1> ; 08/01/2021 7752 <1> ; ebp = video font data (buffer) address 7753 00003442 892D[5E830100] <1> mov [VGA_INT43H], ebp 7754 <1> 7755 <1> ; switch (BL) { 7756 <1> ; case 0: 7757 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, DL-1); 7758 <1> ; break; 7759 00003448 20DB <1> and bl, bl 7760 0000344A 7508 <1> jnz short l_gfx_uc_1 7761 0000344C 8815[36680000] <1> mov [VGA_ROWS], dl ; not DL-1 ! 7762 00003452 EB23 <1> jmp short l_gfx_uc_4 7763 <1> l_gfx_uc_1: 7764 <1> ; case 1: 7765 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 13); 7766 <1> ; break; 7767 00003454 FECB <1> dec bl 7768 00003456 7509 <1> jnz short l_gfx_uc_2 7769 <1> ; bl = 1 7770 00003458 C605[36680000]0E <1> mov byte [VGA_ROWS], 14 ; not 13 ! 7771 0000345F EB16 <1> jmp short l_gfx_uc_4 7772 <1> l_gfx_uc_2: 7773 00003461 FECB <1> dec bl 7774 00003463 740B <1> jz short l_gfx_uc_3 ; bl = 2 7775 00003465 FECB <1> dec bl 7776 00003467 750E <1> jnz short l_gfx_uc_4 ; bl > 3 7777 <1> ; bl = 3 7778 <1> ; case 3: 7779 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 42); 7780 <1> ; break; 7781 00003469 C605[36680000]2B <1> mov byte [VGA_ROWS], 43 ; not 42 ! 7782 <1> l_gfx_uc_3: 7783 <1> ; case 2: 7784 <1> ; default: 7785 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 24); 7786 <1> ; break; 7787 <1> ; bl = 2 or bl > 3 7788 00003470 C605[36680000]19 <1> mov byte [VGA_ROWS], 25 ; not 24 ! 7789 <1> ; } 7790 <1> l_gfx_uc_4: 7791 <1> ; write_byte(BIOSMEM_SEG, BIOSMEM_CHAR_HEIGHT, CX); 7792 00003477 880D[32680000] <1> mov [CHAR_HEIGHT], cl 7793 <1> ; } 7794 0000347D C3 <1> retn 7795 <1> 7796 <1> load_gfx_8_14_chars: 7797 <1> ; 08/08/2016 7798 <1> ; 10/07/2016 7799 <1> ; Setup ROM 8x14 Font for Graphics Mode (VGA) 7800 <1> ; 7801 <1> ; derived from 'Plex86/Bochs VGABios' source code 7802 <1> ; vgabios-0.7a (2011) 7803 <1> ; by the LGPL VGABios developers Team (2001-2008) 7804 <1> ; 'vgabios.c', 'biosfn_load_gfx_8_14_chars' 7805 <1> 7806 <1> ; biosfn_load_gfx_8_14_chars (BL) 7807 <1> ; /* set 0x43 INT pointer */ 7808 <1> ; write_word(0x0, 0x43*4, &vgafont14); 7809 <1> ; write_word(0x0, 0x43*4+2, 0xC000); 7810 0000347E C705[5E830100]- <1> mov dword [VGA_INT43H], vgafont14 7810 00003484 [40550100] <1> 7811 <1> 7812 <1> ; BL screen rows code: 00H = user-specified (in DL) 7813 <1> ; 01H = 14 rows 7814 <1> ; 02H = 25 rows 7815 <1> ; 03H = 43 rows 7816 <1> ; DL (when BL=0) custom number of char rows on screen 7817 <1> 7818 <1> ; switch (BL) { 7819 <1> ; case 0: 7820 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, DL-1); 7821 <1> ; break; 7822 00003488 20DB <1> and bl, bl 7823 0000348A 7508 <1> jnz short l_gfx_8_14c_1 7824 0000348C 8815[36680000] <1> mov [VGA_ROWS], dl ; not DL-1 ! 7825 00003492 EB23 <1> jmp short l_gfx_8_14c_4 7826 <1> l_gfx_8_14c_1: 7827 <1> ; case 1: 7828 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 13); 7829 <1> ; break; 7830 00003494 FECB <1> dec bl 7831 00003496 7509 <1> jnz short l_gfx_8_14c_2 7832 <1> ; bl = 1 7833 00003498 C605[36680000]0E <1> mov byte [VGA_ROWS], 14 ; not 13 ! 7834 0000349F EB16 <1> jmp short l_gfx_8_14c_4 7835 <1> l_gfx_8_14c_2: 7836 000034A1 FECB <1> dec bl 7837 000034A3 740B <1> jz short l_gfx_8_14c_3 ; bl = 2 7838 000034A5 FECB <1> dec bl 7839 000034A7 750E <1> jnz short l_gfx_8_14c_4 ; bl > 3 7840 <1> ; bl = 3 7841 <1> ; case 3: 7842 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 42); 7843 <1> ; break; 7844 000034A9 C605[36680000]2B <1> mov byte [VGA_ROWS], 43 ; not 42 ! 7845 <1> l_gfx_8_14c_3: 7846 <1> ; case 2: 7847 <1> ; default: 7848 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 24); 7849 <1> ; break; 7850 <1> ; bl = 2 or bl > 3 7851 000034B0 C605[36680000]19 <1> mov byte [VGA_ROWS], 25 ; not 24 ! 7852 <1> ; } 7853 <1> l_gfx_8_14c_4: 7854 <1> ; write_byte(BIOSMEM_SEG, BIOSMEM_CHAR_HEIGHT, 14); 7855 000034B7 C605[32680000]0E <1> mov byte [CHAR_HEIGHT], 14 7856 <1> ; } 7857 000034BE C3 <1> retn 7858 <1> 7859 <1> load_gfx_8_8_chars: 7860 <1> ; 08/08/2016 7861 <1> ; 10/07/2016 7862 <1> ; Setup ROM 8x14 Font for Graphics Mode (VGA) 7863 <1> ; 7864 <1> ; derived from 'Plex86/Bochs VGABios' source code 7865 <1> ; vgabios-0.7a (2011) 7866 <1> ; by the LGPL VGABios developers Team (2001-2008) 7867 <1> ; 'vgabios.c', 'biosfn_load_gfx_8_8_dd_chars' 7868 <1> 7869 <1> ; biosfn_load_gfx_8_8_dd_chars (BL) 7870 <1> ; /* set 0x43 INT pointer */ 7871 <1> ; write_word(0x0, 0x43*4, &vgafont8); 7872 <1> ; write_word(0x0, 0x43*4+2, 0xC000); 7873 000034BF C705[5E830100]- <1> mov dword [VGA_INT43H], vgafont8 7873 000034C5 [404D0100] <1> 7874 <1> 7875 <1> ; BL screen rows code: 00H = user-specified (in DL) 7876 <1> ; 01H = 14 rows 7877 <1> ; 02H = 25 rows 7878 <1> ; 03H = 43 rows 7879 <1> ; DL (when BL=0) custom number of char rows on screen 7880 <1> 7881 <1> ; switch (BL) { 7882 <1> ; case 0: 7883 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, DL-1); 7884 <1> ; break; 7885 000034C9 20DB <1> and bl, bl 7886 000034CB 7508 <1> jnz short l_gfx_8_8c_1 7887 000034CD 8815[36680000] <1> mov [VGA_ROWS], dl ; not DL-1 ! 7888 000034D3 EB23 <1> jmp short l_gfx_8_8c_4 7889 <1> l_gfx_8_8c_1: 7890 <1> ; case 1: 7891 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 13); 7892 <1> ; break; 7893 000034D5 FECB <1> dec bl 7894 000034D7 7509 <1> jnz short l_gfx_8_8c_2 7895 <1> ; bl = 1 7896 000034D9 C605[36680000]0E <1> mov byte [VGA_ROWS], 14 ; not 13 ! 7897 000034E0 EB16 <1> jmp short l_gfx_8_8c_4 7898 <1> l_gfx_8_8c_2: 7899 000034E2 FECB <1> dec bl 7900 000034E4 740B <1> jz short l_gfx_8_8c_3 ; bl = 2 7901 000034E6 FECB <1> dec bl 7902 000034E8 750E <1> jnz short l_gfx_8_8c_4 ; bl > 3 7903 <1> ; bl = 3 7904 <1> ; case 3: 7905 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 42); 7906 <1> ; break; 7907 000034EA C605[36680000]2B <1> mov byte [VGA_ROWS], 43 ; not 42 ! 7908 <1> l_gfx_8_8c_3: 7909 <1> ; case 2: 7910 <1> ; default: 7911 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 24); 7912 <1> ; break; 7913 <1> ; bl = 2 or bl > 3 7914 000034F1 C605[36680000]19 <1> mov byte [VGA_ROWS], 25 ; not 24 ! 7915 <1> ; } 7916 <1> l_gfx_8_8c_4: 7917 <1> ; write_byte(BIOSMEM_SEG, BIOSMEM_CHAR_HEIGHT, 8); 7918 000034F8 C605[32680000]08 <1> mov byte [CHAR_HEIGHT], 8 7919 <1> ; } 7920 000034FF C3 <1> retn 7921 <1> 7922 <1> load_gfx_8_16_chars: 7923 <1> ; 08/08/2016 7924 <1> ; 10/07/2016 7925 <1> ; Setup ROM 8x14 Font for Graphics Mode (VGA) 7926 <1> ; 7927 <1> ; derived from 'Plex86/Bochs VGABios' source code 7928 <1> ; vgabios-0.7a (2011) 7929 <1> ; by the LGPL VGABios developers Team (2001-2008) 7930 <1> ; 'vgabios.c', 'biosfn_load_gfx_8_16_chars' 7931 <1> 7932 <1> ; biosfn_load_gfx_8_16_chars (BL) 7933 <1> ; /* set 0x43 INT pointer */ 7934 <1> ; write_word(0x0, 0x43*4, &vgafont16); 7935 <1> ; write_word(0x0, 0x43*4+2, 0xC000); 7936 00003500 C705[5E830100]- <1> mov dword [VGA_INT43H], vgafont16 7936 00003506 [40630100] <1> 7937 <1> 7938 <1> ; BL screen rows code: 00H = user-specified (in DL) 7939 <1> ; 01H = 14 rows 7940 <1> ; 02H = 25 rows 7941 <1> ; 03H = 43 rows 7942 <1> ; DL (when BL=0) custom number of char rows on screen 7943 <1> 7944 <1> ; switch (BL) { 7945 <1> ; case 0: 7946 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, DL-1); 7947 <1> ; break; 7948 0000350A 20DB <1> and bl, bl 7949 0000350C 7508 <1> jnz short l_gfx_8_16c_1 7950 0000350E 8815[36680000] <1> mov [VGA_ROWS], dl ; not DL-1 ! 7951 00003514 EB23 <1> jmp short l_gfx_8_16c_4 7952 <1> l_gfx_8_16c_1: 7953 <1> ; case 1: 7954 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 13); 7955 <1> ; break; 7956 00003516 FECB <1> dec bl 7957 00003518 7509 <1> jnz short l_gfx_8_16c_2 7958 <1> ; bl = 1 7959 0000351A C605[36680000]0E <1> mov byte [VGA_ROWS], 14 ; not 13 ! 7960 00003521 EB16 <1> jmp short l_gfx_8_16c_4 7961 <1> l_gfx_8_16c_2: 7962 00003523 FECB <1> dec bl 7963 00003525 740B <1> jz short l_gfx_8_16c_3 ; bl = 2 7964 00003527 FECB <1> dec bl 7965 00003529 750E <1> jnz short l_gfx_8_16c_4 ; bl > 3 7966 <1> ; bl = 3 7967 <1> ; case 3: 7968 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 42); 7969 <1> ; break; 7970 0000352B C605[36680000]2B <1> mov byte [VGA_ROWS], 43 ; not 42 ! 7971 <1> l_gfx_8_16c_3: 7972 <1> ; case 2: 7973 <1> ; default: 7974 <1> ; write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, 24); 7975 <1> ; break; 7976 <1> ; bl = 2 or bl > 3 7977 00003532 C605[36680000]19 <1> mov byte [VGA_ROWS], 25 ; not 24 ! 7978 <1> ; } 7979 <1> l_gfx_8_16c_4: 7980 <1> ; write_byte(BIOSMEM_SEG, BIOSMEM_CHAR_HEIGHT, 16); 7981 00003539 C605[32680000]10 <1> mov byte [CHAR_HEIGHT], 16 7982 <1> ; } 7983 00003540 C3 <1> retn 7984 <1> 7985 <1> get_font_info: 7986 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 7987 <1> ; 08/01/2021 (TRDOS 386 v2.0.3) 7988 <1> ; 19/09/2016 7989 <1> ; 08/08/2016 7990 <1> ; 10/07/2016 7991 <1> ; Get Current Character Generator Info (VGA) 7992 <1> ; 7993 <1> ; derived from 'Plex86/Bochs VGABios' source code 7994 <1> ; vgabios-0.7a (2011) 7995 <1> ; by the LGPL VGABios developers Team (2001-2008) 7996 <1> ; 'vgabios.c', 'biosfn_get_font_info' 7997 <1> 7998 <1> ; Modified for TRDOS 386 ! 7999 <1> ; 8000 <1> ; INPUT -> 8001 <1> ; AX = 1130h 8002 <1> ; BL = 0 -> Get info for current VGA font 8003 <1> ; (BH = unused) 8004 <1> ; 19/09/2016 8005 <1> ; BL > 0 -> Get requested character font data 8006 <1> ; BL = 1 -> vgafont8 8007 <1> ; BL = 2 -> vgafont14 8008 <1> ; BL = 3 -> vgafont16 8009 <1> ; ;08/01/2021 8010 <1> ; BL = 4 -> user defined 8x8 font 8011 <1> ; BL = 5 -> user defined 8x14 font 8012 <1> ; BL = 6 -> user defined 8x16 font 8013 <1> ; BL > 6 -> Invalid function (for now!) 8014 <1> ; BH = ASCII code of the first character 8015 <1> ; ECX = Number of characters from the 1st char 8016 <1> ; ECX >= 256 -> All (256-BH) characters 8017 <1> ; ECX = 0 -> All characters (BH = unused) 8018 <1> ; EDX = User's Buffer Address 8019 <1> ; OUTPUT -> 8020 <1> ; AL = height (scanlines), bytes per character 8021 <1> ; AH = screen rows 8022 <1> ; Byte 16-23 of EAX = number of columns 8023 <1> ; Byte 24-31 of EAX = 8024 <1> ; 0 -> default font (not configured yet) 8025 <1> ; 0FFh -> user defined font 8026 <1> ; 14 = vgafont14 8027 <1> ; 8 = vgafont8 8028 <1> ; 16 = vgafont16 8029 <1> ; If BL input > 0 -> 8030 <1> ; EAX = Actual transfer count 8031 <1> ; 8032 00003541 20DB <1> and bl, bl 8033 00003543 740F <1> jz short gfi_1 8034 <1> ; invalid function (input) 8035 <1> ; 08/01/2021 8036 00003545 80FB04 <1> cmp bl, 4 8037 00003548 7263 <1> jb short gfi_5 8038 0000354A 7441 <1> je short gfi_3 8039 0000354C 80FB06 <1> cmp bl, 6 8040 0000354F 744C <1> je short gfi_4 8041 <1> ; bh = 5 or bh > 6 8042 <1> gfi_0: 8043 00003551 31C0 <1> xor eax, eax ; 0 8044 00003553 C3 <1> retn 8045 <1> gfi_1: 8046 00003554 A0[32680000] <1> mov al, [CHAR_HEIGHT] 8047 00003559 8A25[36680000] <1> mov ah, [VGA_ROWS] 8048 0000355F C1E010 <1> shl eax, 16 8049 00003562 A0[30680000] <1> mov al, [CRT_COLS] 8050 00003567 8B0D[5E830100] <1> mov ecx, [VGA_INT43H] 8051 0000356D 21C9 <1> and ecx, ecx 8052 0000356F 7418 <1> jz short gfi_2 ; 0 = default font 8053 <1> ; 08/01/2021 8054 00003571 FECC <1> dec ah ; 0FFh 8055 00003573 81F900400900 <1> cmp ecx, VGAFONT16USER 8056 00003579 740E <1> je short gfi_2 8057 0000357B 81F900500900 <1> cmp ecx, VGAFONT8USER 8058 00003581 7406 <1> je short gfi_2 8059 00003583 8A25[32680000] <1> mov ah, [CHAR_HEIGHT] ; font size = height 8060 <1> gfi_2: 8061 00003589 C1C010 <1> rol eax, 16 8062 0000358C C3 <1> retn 8063 <1> gfi_3: 8064 <1> ; 08/01/2021 8065 0000358D F605[869D0100]08 <1> test byte [ufont], 08h ; 8x8 user font 8066 00003594 74BB <1> jz short gfi_0 ; not loaded ! 8067 00003596 BE00500900 <1> mov esi, VGAFONT8USER ; * 8068 <1> ;mov bl, 8 8069 <1> ;jmp short gfi_8 8070 0000359B EB4A <1> jmp short gfi_10 8071 <1> gfi_4: 8072 <1> ; 08/01/2021 8073 0000359D F605[869D0100]10 <1> test byte [ufont], 10h ; 8x16 user font 8074 000035A4 74AB <1> jz short gfi_0 ; not loaded ! 8075 000035A6 BE00400900 <1> mov esi, VGAFONT16USER ; * 8076 000035AB EB15 <1> jmp short gfi_7 8077 <1> gfi_5: 8078 000035AD 80FB02 <1> cmp bl, 2 8079 000035B0 7230 <1> jb short gfi_9 8080 000035B2 7709 <1> ja short gfi_6 8081 <1> ; BL = 2 -> vgafont14 8082 000035B4 BE[40550100] <1> mov esi, vgafont14 ; * 8083 000035B9 B30E <1> mov bl, 14 8084 000035BB EB07 <1> jmp short gfi_8 8085 <1> gfi_6: 8086 <1> ; BL = 3 -> vgafont16 8087 000035BD BE[40630100] <1> mov esi, vgafont16 ; * 8088 <1> gfi_7: 8089 000035C2 B310 <1> mov bl, 16 8090 <1> gfi_8: 8091 000035C4 89D7 <1> mov edi, edx ; ** 8092 000035C6 09C9 <1> or ecx, ecx 8093 000035C8 7421 <1> jz short gfi_11 ; all chars from the 00h 8094 <1> ;mov al, bh ; character index 8095 <1> ; 03/08/2022 8096 000035CA 0FB6C7 <1> movzx eax, bh 8097 000035CD F6E3 <1> mul bl ; char index * char height/size 8098 <1> ;movzx edx, ax 8099 <1> ; 03/08/2022 8100 <1> ;add esi, edx ; * 8101 000035CF 01C6 <1> add esi, eax 8102 000035D1 31D2 <1> xor edx, edx 8103 000035D3 FECA <1> dec dl 8104 <1> ; edx = 0FFh = 255 8105 <1> ;mov dx, 255 8106 000035D5 28FA <1> sub dl, bh 8107 <1> ;inc dx 8108 <1> ; 03/08/2022 8109 000035D7 42 <1> inc edx 8110 000035D8 39D1 <1> cmp ecx, edx 8111 000035DA 770F <1> ja short gfi_11 8112 000035DC 7411 <1> je short gfi_12 8113 000035DE 89D1 <1> mov ecx, edx 8114 000035E0 EB0D <1> jmp short gfi_12 8115 <1> gfi_9: 8116 <1> ;BL = 1 -> vgafont8 8117 000035E2 BE[404D0100] <1> mov esi, vgafont8 ; * 8118 <1> gfi_10: 8119 000035E7 B308 <1> mov bl, 8 8120 000035E9 EBD9 <1> jmp short gfi_8 8121 <1> gfi_11: 8122 <1> ;mov ecx, 256 8123 <1> ; 03/08/2022 8124 000035EB 29C9 <1> sub ecx, ecx 8125 000035ED FEC5 <1> inc ch 8126 <1> ; ecx = 100h 8127 <1> gfi_12: 8128 <1> ; 08/01/2021 8129 000035EF 89C8 <1> mov eax, ecx ; character count 8130 000035F1 30FF <1> xor bh, bh 8131 000035F3 66F7E3 <1> mul bx ; char count * char height/size 8132 000035F6 89C1 <1> mov ecx, eax 8133 <1> 8134 <1> ; ESI = source address in system space 8135 <1> ; EDI = user's buffer address 8136 <1> ; ECX = transfer (byte) count 8137 000035F8 E81ED50000 <1> call transfer_to_user_buffer 8138 000035FD 89C8 <1> mov eax, ecx ; actual transfer count 8139 000035FF C3 <1> retn 8140 <1> 8141 <1> set_all_palette_reg: 8142 <1> ; 03/08/2022 8143 <1> ; 10/08/2016 8144 <1> ; Set All Palette Registers and Overscan 8145 <1> ; EDX = Address of 17 bytes; 8146 <1> ; an rgbRGB value for each of 16 palette 8147 <1> ; registers plus one for the border. 8148 <1> 8149 00003600 89D6 <1> mov esi, edx ; user buffer 8150 <1> ;mov ecx, 17 8151 <1> ; 03/08/2022 8152 00003602 29C9 <1> sub ecx, ecx 8153 00003604 B111 <1> mov cl, 17 8154 00003606 89E7 <1> mov edi, esp 8155 00003608 83EC14 <1> sub esp, 20 8156 0000360B E855D50000 <1> call transfer_from_user_buffer 8157 <1> ;jc VIDEO_RETURN 8158 <1> 8159 00003610 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8160 00003614 EC <1> in al, dx 8161 <1> ;mov cl, 0 8162 <1> ; 03/08/2022 8163 00003615 28C9 <1> sub cl, cl 8164 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8165 <1> ; 03/08/2022 8166 00003617 B2C0 <1> mov dl, 0C0h 8167 <1> set_palette_loop: 8168 00003619 88C8 <1> mov al, cl 8169 0000361B EE <1> out dx, al 8170 0000361C 8A07 <1> mov al, [edi] 8171 0000361E EE <1> out dx, al 8172 0000361F 47 <1> inc edi 8173 00003620 FEC1 <1> inc cl 8174 00003622 80F910 <1> cmp cl, 10h 8175 00003625 75F2 <1> jne short set_palette_loop 8176 00003627 B011 <1> mov al, 11h 8177 00003629 EE <1> out dx, al 8178 0000362A 8A07 <1> mov al, [edi] 8179 0000362C EE <1> out dx, al 8180 0000362D B020 <1> mov al, 20h 8181 0000362F EE <1> out dx, al 8182 <1> ; ifdef VBOX 8183 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8184 <1> ; 03/08/2022 8185 00003630 B2DA <1> mov dl, 0DAh 8186 00003632 EC <1> in al, dx 8187 <1> ; endif ; VBOX 8188 00003633 83C414 <1> add esp, 20 8189 00003636 E930E5FFFF <1> jmp VIDEO_RETURN 8190 <1> 8191 <1> ; 07/08/2022 8192 <1> toggle_intensity: 8193 <1> ; 03/08/2022 8194 <1> ; 10/08/2016 8195 <1> ; Select Foreground Blink or Bold Background 8196 <1> ; BL = 00h = enable bold backgrounds 8197 <1> ; (16 background colors) 8198 <1> ; 01h = enable blinking foreground 8199 <1> ; (8 background colors) 8200 <1> 8201 0000363B 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8202 0000363F EC <1> in al, dx 8203 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8204 <1> ; 03/08/2022 8205 00003640 B2C0 <1> mov dl, 0C0h 8206 00003642 B010 <1> mov al, 10h 8207 00003644 EE <1> out dx, al 8208 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8209 <1> ; 03/08/2022 8210 00003645 FEC2 <1> inc dl ; dx = 3C1h 8211 00003647 EC <1> in al, dx 8212 00003648 24F7 <1> and al, 0F7h 8213 0000364A 80E301 <1> and bl, 01h 8214 0000364D C0E303 <1> shl bl, 3 8215 00003650 08D8 <1> or al, bl 8216 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8217 <1> ; 03/08/2022 8218 00003652 FECA <1> dec dl ; dx = 3C0h 8219 00003654 EE <1> out dx, al 8220 00003655 B020 <1> mov al, 20h 8221 00003657 EE <1> out dx, al 8222 <1> ; ifdef VBOX 8223 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8224 <1> ; 03/08/2022 8225 00003658 B2DA <1> mov dl, 0DAh 8226 0000365A EC <1> in al, dx 8227 <1> ; endif ; VBOX 8228 0000365B E90BE5FFFF <1> jmp VIDEO_RETURN 8229 <1> 8230 <1> ; 07/08/2022 8231 <1> vga_palf_unknown: 8232 00003660 29C0 <1> sub eax, eax ; 0 = invalid function 8233 00003662 E909E5FFFF <1> jmp _video_return 8234 <1> 8235 <1> ; 07/08/2022 8236 <1> vga_palf_101B: 8237 00003667 3C1B <1> cmp al, 1Bh 8238 <1> ;jne short vga_palf_unknown 8239 00003669 77F5 <1> ja short vga_palf_unknown 8240 <1> 8241 0000366B E810F6FFFF <1> call gray_scale_summing 8242 00003670 E9F6E4FFFF <1> jmp VIDEO_RETURN 8243 <1> 8244 <1> vga_pal_funcs: 8245 <1> ; 07/08/2022 8246 <1> ; 10/08/2016 8247 <1> ; VGA Palette functions 8248 <1> ; 8249 <1> ; derived from 'Plex86/Bochs VGABios' source code 8250 <1> ; vgabios-0.7a (2011) 8251 <1> ; by the LGPL VGABios developers Team (2001-2008) 8252 <1> ; 'vgabios.c', 'vgarom.asm' 8253 <1> 8254 00003675 3C00 <1> cmp al, 0 8255 00003677 7467 <1> je short set_single_palette_reg 8256 <1> vga_palf_1002: 8257 00003679 3C02 <1> cmp al, 2 8258 0000367B 7483 <1> je short set_all_palette_reg 8259 <1> ; 07/08/2022 8260 0000367D 7702 <1> ja short vga_palf_1003 8261 0000367F EB5D <1> jmp short set_overscan_border_color 8262 <1> ; 07/08/2022 8263 <1> ;vga_palf_1001: 8264 <1> ; cmp al, 1 8265 <1> ; je short set_overscan_border_color 8266 <1> vga_palf_1003: 8267 00003681 3C03 <1> cmp al, 3 8268 00003683 74B6 <1> je short toggle_intensity 8269 <1> vga_palf_1007: 8270 00003685 3C07 <1> cmp al, 7 8271 00003687 747F <1> je short get_single_palette_reg 8272 00003689 72D5 <1> jb short vga_palf_unknown 8273 <1> vga_palf_1008: 8274 0000368B 3C08 <1> cmp al, 8 8275 0000368D 7477 <1> je short read_overscan_border_color 8276 <1> vga_palf_1009: 8277 0000368F 3C09 <1> cmp al, 9 8278 <1> ;je short get_all_palette_reg 8279 <1> ; 07/08/2022 8280 00003691 7505 <1> jne short vga_palf_1010 8281 00003693 E966010000 <1> jmp get_all_palette_reg 8282 <1> vga_palf_1010: 8283 00003698 3C10 <1> cmp al, 10h 8284 <1> ;je short set_single_dac_reg 8285 <1> ; 07/08/2022 8286 0000369A 7707 <1> ja short vga_palf_1012 8287 0000369C 72C2 <1> jb short vga_palf_unknown 8288 0000369E E908010000 <1> jmp set_single_dac_reg 8289 <1> vga_palf_1012: 8290 000036A3 3C12 <1> cmp al, 12h 8291 <1> ;je short set_all_dac_reg 8292 <1> ; 07/08/2022 8293 000036A5 7707 <1> ja short vga_palf_1013 8294 000036A7 72B7 <1> jb short vga_palf_unknown 8295 000036A9 E916010000 <1> jmp set_all_dac_reg 8296 <1> vga_palf_1013: 8297 000036AE 3C13 <1> cmp al, 13h 8298 <1> ;je short select_video_dac_color_page 8299 <1> ; 07/08/2022 8300 000036B0 7505 <1> jne short vga_palf_1015 8301 000036B2 E992010000 <1> jmp select_video_dac_color_page 8302 <1> vga_palf_1015: 8303 000036B7 3C15 <1> cmp al, 15h 8304 <1> ;je short read_single_dac_reg 8305 <1> ; 07/08/2022 8306 000036B9 7707 <1> ja short vga_palf_1017 8307 000036BB 72A3 <1> jb short vga_palf_unknown 8308 000036BD E98D000000 <1> jmp read_single_dac_reg 8309 <1> vga_palf_1017: 8310 000036C2 3C17 <1> cmp al, 17h 8311 <1> ;je short read_all_dac_reg 8312 <1> ; 07/08/2022 8313 000036C4 7707 <1> ja short vga_palf_1018 8314 000036C6 7298 <1> jb short vga_palf_unknown 8315 000036C8 E9A0000000 <1> jmp read_all_dac_reg 8316 <1> vga_palf_1018: 8317 000036CD 3C18 <1> cmp al, 18h 8318 000036CF 7464 <1> je short set_pel_mask 8319 <1> vga_palf_1019: 8320 000036D1 3C19 <1> cmp al, 19h 8321 000036D3 746C <1> je short read_pel_mask 8322 <1> vga_palf_101A: 8323 000036D5 3C1A <1> cmp al, 1Ah 8324 <1> ;je short read_video_dac_state 8325 <1> ; 07/08/2022 8326 000036D7 758E <1> jne short vga_palf_101B 8327 000036D9 E9AD010000 <1> jmp read_video_dac_state 8328 <1> 8329 <1> ; 07/08/2022 8330 <1> set_overscan_border_color: 8331 <1> ; 10/08/2016 8332 <1> ; Set Overscan/Border Color Register 8333 <1> ; BH = 6-bit RGB color to display 8334 <1> ; for that attribute 8335 <1> 8336 000036DE B311 <1> mov bl, 11h 8337 <1> ; 07/08/2022 8338 <1> ;jmp short set_single_palette_reg 8339 <1> 8340 <1> set_single_palette_reg: 8341 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 8342 <1> ; 12/04/2021 (TRDOS 386 v2.0.3, 32 bit push/pop) 8343 <1> ; 10/08/2016 8344 <1> ; Set One Palette Register 8345 <1> ; BL = register number to set 8346 <1> ; (a 4-bit attribute nibble: 00h-0Fh) 8347 <1> ; BH = 6-bit RGB color to display 8348 <1> ; for that attribute 8349 <1> 8350 000036E0 80FB14 <1> cmp bl, 14h 8351 <1> ;;ja short no_actl_reg1 8352 <1> ;ja VIDEO_RETURN 8353 <1> ; 03/08/2022 8354 000036E3 7605 <1> jna short sspr_1 8355 000036E5 E981E4FFFF <1> jmp VIDEO_RETURN 8356 <1> sspr_1: 8357 <1> ;push ax 8358 <1> ;push dx 8359 <1> ; 12/04/2021 8360 000036EA 50 <1> push eax 8361 000036EB 52 <1> push edx 8362 000036EC 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8363 000036F0 EC <1> in al, dx 8364 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8365 <1> ; 03/08/2022 8366 000036F1 B2C0 <1> mov dl, 0C0h 8367 000036F3 88D8 <1> mov al, bl 8368 000036F5 EE <1> out dx, al 8369 000036F6 88F8 <1> mov al, bh 8370 000036F8 EE <1> out dx, al 8371 000036F9 B020 <1> mov al, 20h 8372 000036FB EE <1> out dx, al 8373 <1> ; ifdef VBOX 8374 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8375 <1> ; 03/08/2022 8376 000036FC B2DA <1> mov dl, 0DAh 8377 000036FE EC <1> in al, dx 8378 <1> ; endif ; VBOX 8379 <1> ;pop dx 8380 <1> ;pop ax 8381 <1> ; 12/04/2021 8382 000036FF 5A <1> pop edx 8383 00003700 58 <1> pop eax 8384 <1> ;no_actl_reg1: 8385 00003701 E965E4FFFF <1> jmp VIDEO_RETURN 8386 <1> 8387 <1> ; 07/08/2022 8388 <1> read_overscan_border_color: 8389 <1> ; 10/08/2016 8390 <1> ; Read Overscan Register 8391 <1> ; OUTPUT: 8392 <1> ; BH = current rgbRGB value 8393 <1> ; of the overscan/border register 8394 <1> 8395 00003706 B311 <1> mov bl, 11h 8396 <1> ; 07/08/2022 8397 <1> ;jmp short get_single_palette_reg 8398 <1> 8399 <1> get_single_palette_reg: 8400 <1> ; 03/08/2022 8401 <1> ; 10/08/2016 8402 <1> ; Read One Palette Register 8403 <1> ; INPUT: 8404 <1> ; BL = Palette register to read (00h-0Fh) 8405 <1> ; OUTPUT: 8406 <1> ; BH = Current rgbRGB value of specified register 8407 <1> ; for that attribute 8408 <1> 8409 00003708 80FB14 <1> cmp bl, 14h 8410 <1> ;;ja short no_actl_reg2 8411 <1> ;ja VIDEO_RETURN 8412 <1> ; 03/08/2022 8413 0000370B 7605 <1> jna short gspr_1 8414 0000370D E959E4FFFF <1> jmp VIDEO_RETURN 8415 <1> gspr_1: 8416 00003712 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8417 <1> ; 03/08/2022 8418 00003716 B2DA <1> mov dl, 0DAh 8419 00003718 EC <1> in al, dx 8420 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8421 <1> ; 03/08/2022 8422 00003719 B2C0 <1> mov dl, 0C0h 8423 0000371B 88D8 <1> mov al, bl 8424 0000371D EE <1> out dx, al 8425 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8426 <1> ; 03/08/2022 8427 0000371E FEC2 <1> inc dl ; dx = 3C1h 8428 00003720 EC <1> in al, dx 8429 00003721 8844240D <1> mov [esp+13], al ; bh 8430 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8431 <1> ; 03/08/2022 8432 00003725 B2DA <1> mov dl, 0DAh 8433 00003727 EC <1> in al, dx 8434 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8435 <1> ; 03/08/2022 8436 00003728 B2C0 <1> mov dl, 0C0h 8437 0000372A B020 <1> mov al, 20h 8438 0000372C EE <1> out dx, al 8439 <1> ; ifdef VBOX 8440 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8441 <1> ; 03/08/2022 8442 0000372D B2DA <1> mov dl, 0DAh 8443 0000372F EC <1> in al, dx 8444 <1> ; endif ; VBOX 8445 00003730 E936E4FFFF <1> jmp VIDEO_RETURN 8446 <1> 8447 <1> set_pel_mask: 8448 <1> ; 10/08/2016 8449 <1> ; BL = mask value 8450 00003735 66BAC603 <1> mov dx, 3C6h ; VGAREG_PEL_MASK 8451 00003739 88D8 <1> mov al, bl 8452 0000373B EE <1> out dx, al 8453 0000373C E92AE4FFFF <1> jmp VIDEO_RETURN 8454 <1> 8455 <1> read_pel_mask: 8456 <1> ; 10/08/2016 8457 <1> ; Output: BL = mask value 8458 00003741 66BAC603 <1> mov dx, 3C6h ; VGAREG_PEL_MASK 8459 00003745 EC <1> in al, dx 8460 00003746 8844240C <1> mov [esp+12], al ; bl 8461 0000374A E91CE4FFFF <1> jmp VIDEO_RETURN 8462 <1> 8463 <1> read_single_dac_reg: 8464 <1> ; 02/08/2022 8465 <1> ; 10/08/2016 8466 <1> ; Read One DAC Color Register 8467 <1> ; INPUT: 8468 <1> ; BX = color register to read (0-255) 8469 <1> ; OUTPUT: 8470 <1> ; CH = green value (00h-3Fh) 8471 <1> ; CL = blue value (00h-3Fh) 8472 <1> ; DH = red value (00h-3Fh) 8473 <1> 8474 0000374F 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 8475 00003753 88D8 <1> mov al, bl 8476 00003755 EE <1> out dx, al 8477 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 8478 <1> ; 02/08/2022 8479 00003756 B2C9 <1> mov dl, 0C9h 8480 00003758 EC <1> in al, dx 8481 00003759 88442415 <1> mov [esp+21], al ; dh 8482 0000375D EC <1> in al, dx 8483 0000375E 88C5 <1> mov ch, al 8484 00003760 EC <1> in al, dx 8485 00003761 88C1 <1> mov cl, al 8486 00003763 66894C2410 <1> mov [esp+16], cx ; cx 8487 00003768 E9FEE3FFFF <1> jmp VIDEO_RETURN 8488 <1> 8489 <1> read_all_dac_reg: 8490 <1> ; 02/08/2022 8491 <1> ; 12/08/2016 8492 <1> ; 11/08/2016 8493 <1> ; 10/08/2016 8494 <1> ; Read a Block of DAC Color Registers 8495 <1> ; BX = first DAC register to read (0-00FFh) 8496 <1> ; ECX = number of registers to read (0-00FFh) 8497 <1> ; EDX = addr of a buffer to hold R,G,B values 8498 <1> ; (CX*3 bytes long) 8499 <1> 8500 0000376D 89D7 <1> mov edi, edx ; user buffer 8501 0000376F 89CA <1> mov edx, ecx 8502 <1> ;shl dx, 1 ; *2 8503 <1> ; 02/08/2022 8504 00003771 D1E2 <1> shl edx, 1 8505 00003773 01CA <1> add edx, ecx ; edx = 3*ecx 8506 00003775 89E5 <1> mov ebp, esp 8507 00003777 89EE <1> mov esi, ebp 8508 00003779 29D6 <1> sub esi, edx 8509 0000377B 6683E6FC <1> and si, 0FFFCh ; (dword alignment) 8510 0000377F 89F4 <1> mov esp, esi 8511 00003781 52 <1> push edx ; 3*ecx 8512 00003782 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 8513 00003786 88D8 <1> mov al, bl 8514 00003788 EE <1> out dx, al 8515 00003789 66BAC903 <1> mov dx, 3C9h ; VGAREG_DAC_DATA 8516 0000378D 89F3 <1> mov ebx, esi 8517 <1> read_dac_loop: 8518 0000378F EC <1> in al, dx 8519 00003790 8803 <1> mov [ebx], al 8520 00003792 43 <1> inc ebx 8521 00003793 EC <1> in al, dx 8522 00003794 8803 <1> mov [ebx], al 8523 00003796 43 <1> inc ebx 8524 00003797 EC <1> in al, dx 8525 00003798 8803 <1> mov [ebx], al 8526 0000379A 43 <1> inc ebx 8527 <1> ;dec cx 8528 <1> ; 02/08/2022 8529 0000379B 49 <1> dec ecx 8530 0000379C 75F1 <1> jnz short read_dac_loop 8531 0000379E 59 <1> pop ecx ; 3*ecx 8532 <1> ; ECX = transfer (byte) count 8533 <1> ; ESI = source address in system space 8534 <1> ; EDI = user's buffer address 8535 0000379F E877D30000 <1> call transfer_to_user_buffer 8536 000037A4 89EC <1> mov esp, ebp 8537 000037A6 E9C0E3FFFF <1> jmp VIDEO_RETURN 8538 <1> 8539 <1> set_single_dac_reg: 8540 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 8541 <1> ; 12/04/2021 (TRDOS 386 v2.0.3, 32 bit push/pop) 8542 <1> ; 10/08/2016 8543 <1> ; Set One DAC Color Register 8544 <1> ; BX = color register to set (0-255) 8545 <1> ; CH = green value (00h-3Fh) 8546 <1> ; CL = blue value (00h-3Fh) 8547 <1> ; DH = red value (00h-3Fh) 8548 <1> 8549 <1> ;push dx 8550 <1> ; 12/04/2021 8551 000037AB 52 <1> push edx 8552 000037AC 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 8553 000037B0 88D8 <1> mov al, bl 8554 000037B2 EE <1> out dx, al 8555 <1> ;;mov dx, 3C9h ; VGAREG_DAC_DATA 8556 <1> ;inc dx 8557 <1> ; 03/08/2022 8558 000037B3 FEC2 <1> inc dl 8559 <1> ;pop ax 8560 <1> ; 12/04/2021 8561 000037B5 58 <1> pop eax 8562 000037B6 88E0 <1> mov al, ah 8563 000037B8 EE <1> out dx, al 8564 000037B9 88E8 <1> mov al, ch 8565 000037BB EE <1> out dx, al 8566 000037BC 88C8 <1> mov al, cl 8567 000037BE EE <1> out dx, al 8568 000037BF E9A7E3FFFF <1> jmp VIDEO_RETURN 8569 <1> 8570 <1> set_all_dac_reg: 8571 <1> ; 02/08/2022 8572 <1> ; 12/08/2016 8573 <1> ; 11/08/2016 8574 <1> ; 10/08/2016 8575 <1> ; Set a Block of DAC Color Register 8576 <1> ; BX = first DAC register to set (0-00FFh) 8577 <1> ; ECX = number of registers to set (0-00FFh) 8578 <1> ; EDX = addr of a table of R,G,B values 8579 <1> ; (it will be CX*3 bytes long) 8580 <1> 8581 000037C4 89D6 <1> mov esi, edx ; user buffer 8582 000037C6 89CA <1> mov edx, ecx 8583 <1> ;shl cx, 1 ; *2 8584 <1> ; 02/08/2022 8585 000037C8 D1E1 <1> shl ecx, 1 8586 000037CA 01D1 <1> add ecx, edx ; ecx = 3*ecx 8587 000037CC 89E5 <1> mov ebp, esp 8588 000037CE 89EF <1> mov edi, ebp 8589 000037D0 29CF <1> sub edi, ecx 8590 000037D2 6683E7FC <1> and di, 0FFFCh ; (dword alignment) 8591 000037D6 89FC <1> mov esp, edi 8592 000037D8 E888D30000 <1> call transfer_from_user_buffer 8593 <1> ;jc VIDEO_RETURN 8594 <1> 8595 000037DD 89D1 <1> mov ecx, edx 8596 000037DF 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 8597 000037E3 88D8 <1> mov al, bl 8598 000037E5 EE <1> out dx, al 8599 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 8600 <1> ; 02/08/2022 8601 000037E6 FEC2 <1> inc dl 8602 <1> set_dac_loop: 8603 000037E8 8A07 <1> mov al, [edi] 8604 000037EA EE <1> out dx, al 8605 000037EB 47 <1> inc edi 8606 000037EC 8A07 <1> mov al, [edi] 8607 000037EE EE <1> out dx, al 8608 000037EF 47 <1> inc edi 8609 000037F0 8A07 <1> mov al, [edi] 8610 000037F2 EE <1> out dx, al 8611 000037F3 47 <1> inc edi 8612 <1> ;dec cx 8613 <1> ; 02/08/2022 8614 000037F4 49 <1> dec ecx 8615 000037F5 75F1 <1> jnz short set_dac_loop 8616 000037F7 89EC <1> mov esp, ebp 8617 000037F9 E96DE3FFFF <1> jmp VIDEO_RETURN 8618 <1> 8619 <1> get_all_palette_reg: 8620 <1> ; 03/08/2022 8621 <1> ; 10/08/2016 8622 <1> ; Read All Palette Registers 8623 <1> ; EDX = Address of 17-byte buffer 8624 <1> ; to receive data 8625 <1> 8626 000037FE 89D7 <1> mov edi, edx 8627 00003800 89E3 <1> mov ebx, esp 8628 00003802 89DE <1> mov esi, ebx 8629 00003804 83EC14 <1> sub esp, 20 8630 <1> 8631 00003807 B100 <1> mov cl, 0 8632 <1> get_palette_loop: 8633 00003809 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8634 0000380D EC <1> in al, dx 8635 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8636 <1> ; 03/08/2022 8637 0000380E B2C0 <1> mov dl, 0C0h 8638 00003810 88C8 <1> mov al, cl 8639 00003812 EE <1> out dx, al 8640 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8641 <1> ; 03/08/2022 8642 <1> ;mov dl, 0C1h 8643 00003813 FEC2 <1> inc dl 8644 00003815 EC <1> in al, dx 8645 00003816 8803 <1> mov [ebx], al 8646 00003818 43 <1> inc ebx 8647 00003819 FEC1 <1> inc cl 8648 0000381B 80F910 <1> cmp cl, 10h 8649 0000381E 75E9 <1> jne short get_palette_loop 8650 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8651 <1> ; 03/08/2022 8652 00003820 B2DA <1> mov dl, 0DAh 8653 00003822 EC <1> in al, dx 8654 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8655 <1> ; 03/08/2022 8656 00003823 B2C0 <1> mov dl, 0C0h 8657 00003825 B011 <1> mov al, 11h 8658 00003827 EE <1> out dx, al 8659 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8660 <1> ; 03/08/2022 8661 00003828 FEC2 <1> inc dl ; dx = 3C1h 8662 0000382A EC <1> in al, dx 8663 0000382B 8803 <1> mov [ebx], al 8664 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8665 <1> ; 03/08/2022 8666 0000382D B2DA <1> mov dl, 0DAh 8667 0000382F EC <1> in al, dx 8668 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8669 <1> ; 03/08/2022 8670 00003830 B2C0 <1> mov dl, 0C0h 8671 00003832 B020 <1> mov al, 20h 8672 00003834 EE <1> out dx, al 8673 <1> ; ifdef VBOX 8674 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8675 <1> ; 03/08/2022 8676 00003835 B2DA <1> mov dl, 0DAh 8677 00003837 EC <1> in al, dx 8678 <1> ; endif ; VBOX 8679 <1> 8680 <1> ;mov ecx, 17 ; transfer (byte) count 8681 <1> ; 03/08/2022 8682 00003838 29C9 <1> sub ecx, ecx 8683 0000383A B111 <1> mov cl, 17 8684 <1> 8685 <1> ; ESI = source address in system space 8686 <1> ; EDI = user's buffer address 8687 0000383C E8DAD20000 <1> call transfer_to_user_buffer 8688 <1> 8689 00003841 83C414 <1> add esp, 20 8690 00003844 E922E3FFFF <1> jmp VIDEO_RETURN 8691 <1> 8692 <1> select_video_dac_color_page: 8693 <1> ; 02/08/2022 (TRDOS 386 v2.0.5, code optimization) 8694 <1> ; 12/04/2021 (TRDOS 386 v2.0.3, 32 bit push/pop) 8695 <1> ; 10/08/2016 8696 <1> ; DAC Color Paging Functions 8697 <1> ; BL = 00H = select color paging mode 8698 <1> ; BH = paging mode 8699 <1> ; 00h = 4 blocks of 64 registers 8700 <1> ; 01h = 16 blocks of 16 registers 8701 <1> ; BL = 01H = activate color page 8702 <1> ; BH = DAC color page number 8703 <1> ; 00h-03h (4-page/64-reg mode) 8704 <1> ; 00h-0Fh (16-page/16-reg mode) 8705 <1> 8706 00003849 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8707 0000384D EC <1> in al, dx 8708 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8709 <1> ; 02/08/2022 8710 0000384E B240 <1> mov dl, 40h 8711 00003850 B010 <1> mov al, 10h 8712 00003852 EE <1> out dx, al 8713 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8714 <1> ; 02/08/2022 8715 00003853 FEC2 <1> inc dl ; mov dl, 0C1h 8716 00003855 EC <1> in al, dx 8717 00003856 80E301 <1> and bl, 01h 8718 00003859 750C <1> jnz short set_dac_page 8719 0000385B 247F <1> and al, 07Fh 8720 0000385D C0E707 <1> shl bh, 7 8721 00003860 08F8 <1> or al, bh 8722 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8723 <1> ; 02/08/2022 8724 00003862 FECA <1> dec dl ; mov dl, 0C0h 8725 00003864 EE <1> out dx, al 8726 00003865 EB19 <1> jmp short set_actl_normal 8727 <1> set_dac_page: 8728 <1> ;push ax 8729 <1> ; 12/04/2021 8730 00003867 50 <1> push eax 8731 00003868 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8732 0000386C EC <1> in al, dx 8733 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8734 <1> ; 02/08/2022 8735 0000386D B2C0 <1> mov dl, 0C0h 8736 0000386F B014 <1> mov al, 14h 8737 00003871 EE <1> out dx, al 8738 <1> ;pop ax 8739 <1> ; 12/04/2021 8740 00003872 58 <1> pop eax 8741 00003873 2480 <1> and al, 80h 8742 00003875 7503 <1> jnz short set_dac_16_page 8743 00003877 C0E702 <1> shl bh, 2 8744 <1> set_dac_16_page: 8745 0000387A 80E70F <1> and bh, 0Fh 8746 0000387D 88F8 <1> mov al, bh 8747 0000387F EE <1> out dx, al 8748 <1> set_actl_normal: 8749 00003880 B020 <1> mov al, 20h 8750 00003882 EE <1> out dx, al 8751 <1> ; ifdef VBOX 8752 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 8753 <1> ; 02/08/2022 8754 00003883 B2DA <1> mov dl, 0DAh 8755 00003885 EC <1> in al, dx 8756 <1> ; endif ; VBOX 8757 00003886 E9E0E2FFFF <1> jmp VIDEO_RETURN 8758 <1> 8759 <1> read_video_dac_state: 8760 <1> ; 10/08/2016 8761 <1> ; Query DAC Color Paging State 8762 <1> ; Output: 8763 <1> ; BH = current active DAC color page 8764 <1> ; BL = current active DAC paging mode 8765 <1> 8766 0000388B 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8767 0000388F EC <1> in al, dx 8768 00003890 66BAC003 <1> mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8769 00003894 B010 <1> mov al, 10h 8770 00003896 EE <1> out dx, al 8771 00003897 66BAC103 <1> mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8772 0000389B EC <1> in al, dx 8773 0000389C 88C3 <1> mov bl, al 8774 0000389E C0EB07 <1> shr bl, 7 8775 000038A1 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8776 000038A5 EC <1> in al, dx 8777 000038A6 66BAC003 <1> mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8778 000038AA B014 <1> mov al, 14h 8779 000038AC EE <1> out dx, al 8780 000038AD 66BAC103 <1> mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 8781 000038B1 EC <1> in al, dx 8782 000038B2 88C7 <1> mov bh, al 8783 000038B4 80E70F <1> and bh, 0Fh 8784 000038B7 F6C301 <1> test bl, 01 8785 000038BA 7503 <1> jnz short get_dac_16_page 8786 000038BC C0EF02 <1> shr bh, 2 8787 <1> get_dac_16_page: 8788 000038BF 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8789 000038C3 EC <1> in al, dx 8790 000038C4 66BAC003 <1> mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 8791 000038C8 B020 <1> mov al, 20h 8792 000038CA EE <1> out dx, al 8793 <1> ; ifdef VBOX 8794 000038CB 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 8795 000038CF EC <1> in al, dx 8796 <1> ; endif ; VBOX 8797 000038D0 66895C240C <1> mov [esp+12], bx ; bx 8798 000038D5 E991E2FFFF <1> jmp VIDEO_RETURN 8799 <1> 8800 <1> ; 23/11/2020 - TRDOS 386 v2.0.3 8801 <1> ; VBE 2 BOCHS/QEMU emulator extensions 8802 <1> ; for TRDOS 386 v2 kernel (video bios) 8803 <1> 8804 <1> ; BOCH/QEMU VBE2 VGA BIOS code 8805 <1> ; by Jeroen Janssen (2002) 8806 <1> ; by Volker Rupper (2003-2020) 8807 <1> ; vbe.c (02/01/2020) 8808 <1> 8809 <1> ; vbe.h (02/01/2020) 8810 <1> 8811 <1> VBE_DISPI_BANK_ADDRESS equ 0A0000h 8812 <1> VBE_DISPI_BANK_SIZE_KB equ 64 8813 <1> 8814 <1> VBE_DISPI_MAX_XRES equ 2560 8815 <1> VBE_DISPI_MAX_YRES equ 1600 8816 <1> 8817 <1> VBE_DISPI_IOPORT_INDEX equ 01CEh 8818 <1> VBE_DISPI_IOPORT_DATA equ 01CFh 8819 <1> 8820 <1> VBE_DISPI_INDEX_ID equ 00h 8821 <1> VBE_DISPI_INDEX_XRES equ 01h 8822 <1> VBE_DISPI_INDEX_YRES equ 02h 8823 <1> VBE_DISPI_INDEX_BPP equ 03h 8824 <1> VBE_DISPI_INDEX_ENABLE equ 04h 8825 <1> VBE_DISPI_INDEX_BANK equ 05h 8826 <1> VBE_DISPI_INDEX_VIRT_WIDTH equ 06h 8827 <1> VBE_DISPI_INDEX_VIRT_HEIGHT equ 07h 8828 <1> VBE_DISPI_INDEX_X_OFFSET equ 08h 8829 <1> VBE_DISPI_INDEX_Y_OFFSET equ 09h 8830 <1> VBE_DISPI_INDEX_VIDEO_MEMORY_64K equ 0Ah 8831 <1> VBE_DISPI_INDEX_DDC equ 0Bh 8832 <1> 8833 <1> VBE_DISPI_ID0 equ 0B0C0h 8834 <1> VBE_DISPI_ID1 equ 0B0C1h 8835 <1> VBE_DISPI_ID2 equ 0B0C2h 8836 <1> VBE_DISPI_ID3 equ 0B0C3h 8837 <1> VBE_DISPI_ID4 equ 0B0C4h 8838 <1> VBE_DISPI_ID5 equ 0B0C5h 8839 <1> 8840 <1> VBE_DISPI_DISABLED equ 00h 8841 <1> VBE_DISPI_ENABLED equ 01h 8842 <1> VBE_DISPI_GETCAPS equ 02h 8843 <1> VBE_DISPI_8BIT_DAC equ 20h 8844 <1> VBE_DISPI_LFB_ENABLED equ 40h 8845 <1> VBE_DISPI_NOCLEARMEM equ 80h 8846 <1> 8847 <1> VBE_DISPI_LFB_PHYSICAL_ADDRESS equ 0E0000000h 8848 <1> 8849 <1> ; *** 8850 <1> 8851 <1> ;// VBE Return Status Info 8852 <1> ;// AL 8853 <1> VBE_RETURN_STATUS_SUPPORTED equ 4Fh 8854 <1> VBE_RETURN_STATUS_UNSUPPORTED equ 00h 8855 <1> ;// AH 8856 <1> VBE_RETURN_STATUS_SUCCESSFULL equ 00h 8857 <1> VBE_RETURN_STATUS_FAILED equ 01h 8858 <1> VBE_RETURN_STATUS_NOT_SUPPORTED equ 02h 8859 <1> VBE_RETURN_STATUS_INVALID equ 03h 8860 <1> 8861 <1> ;// VBE Mode Numbers 8862 <1> 8863 <1> VBE_MODE_VESA_DEFINED equ 0100h 8864 <1> VBE_MODE_REFRESH_RATE_USE_CRTC equ 0800h 8865 <1> VBE_MODE_LINEAR_FRAME_BUFFER equ 4000h 8866 <1> VBE_MODE_PRESERVE_DISPLAY_MEMORY equ 8000h 8867 <1> 8868 <1> ;// Mode Attributes 8869 <1> 8870 <1> VBE_MODE_ATTRIBUTE_SUPPORTED equ 0001h 8871 <1> VBE_MODE_ATTRIBUTE_EXTENDED_INFO_AVAILABLE equ 0002h 8872 <1> VBE_MODE_ATTRIBUTE_COLOR_MODE equ 0008h 8873 <1> VBE_MODE_ATTRIBUTE_GRAPHICS_MODE equ 0010h 8874 <1> VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE equ 0080h 8875 <1> VBE_MODE_ATTRIBUTE_DOUBLE_SCAN_MODE equ 0100h 8876 <1> VBE_MODE_ATTRIBUTE_INTERLACE_MODE equ 0200h 8877 <1> 8878 <1> ;// Window attributes 8879 <1> 8880 <1> VBE_WINDOW_ATTRIBUTE_RELOCATABLE equ 01h 8881 <1> VBE_WINDOW_ATTRIBUTE_READABLE equ 02h 8882 <1> VBE_WINDOW_ATTRIBUTE_WRITEABLE equ 04h 8883 <1> 8884 <1> ;/* Video memory */ 8885 <1> VGAMEM_GRAPH equ 0A000h 8886 <1> VGAMEM_CTEXT equ 0B800h 8887 <1> ;VGAMEM_MTEXT equ 0B000h 8888 <1> 8889 <1> ;// Memory model 8890 <1> 8891 <1> ;VBE_MEMORYMODEL_TEXT_MODE equ 00h 8892 <1> ;VBE_MEMORYMODEL_CGA_GRAPHICS equ 01h 8893 <1> ;VBE_MEMORYMODEL_PLANAR equ 03h 8894 <1> VBE_MEMORYMODEL_PACKED_PIXEL equ 04h 8895 <1> ;VBE_MEMORYMODEL_NON_CHAIN_4_256 equ 05h 8896 <1> VBE_MEMORYMODEL_DIRECT_COLOR equ 06h 8897 <1> ;VBE_MEMORYMODEL_YUV equ 07h 8898 <1> 8899 <1> ;// DirectColorModeInfo 8900 <1> 8901 <1> ;VBE_DIRECTCOLOR_COLOR_RAMP_PROGRAMMABLE equ 01h 8902 <1> VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE equ 02h 8903 <1> 8904 <1> VBE_DISPI_TOTAL_VIDEO_MEMORY_MB equ 16 8905 <1> 8906 <1> ; 24/11/2020 8907 <1> ; vbe.c 8908 <1> 8909 <1> %if 1 8910 <1> 8911 <1> _vbe_biosfn_return_mode_info: 8912 <1> ; 15/12/2020 8913 <1> ; 12/12/2020 8914 <1> ; Return VBE Mode Information 8915 <1> ; (call from 'sysvideo') 8916 <1> ; 8917 <1> ; Input: 8918 <1> ; cx = video (bios) mode 8919 <1> ; Output: 8920 <1> ; cf = 0 -> (successful) 8921 <1> ; MODE_INFO_LIST addr contains MODEINFO 8922 <1> ; cf = 1 -> error 8923 <1> ; 8924 <1> ; Modified registers: eax, edx, edi 8925 <1> ; 8926 <1> 8927 <1> ; pushes for subroutine stack pops compatibility 8928 <1> 8929 <1> ;push ds ; * 8930 <1> ;push es ; ** 8931 <1> 8932 000038DA 55 <1> push ebp ; *** 8933 000038DB 56 <1> push esi ; **** 8934 <1> 8935 000038DC 31FF <1> xor edi, edi ; mov edi, 0 8936 <1> 8937 000038DE 803D[7C090000]03 <1> cmp byte [vbe3], 3 8938 000038E5 7221 <1> jb short _vbe_rmi_1 8939 <1> 8940 <1> ;sub edi, edi ; 0 = kernel call (sign) 8941 <1> ; ; no transfer to user's buffer 8942 <1> 8943 <1> ; cx = Video mode (for 4F01h, with LFB flag) 8944 <1> 8945 000038E7 66B8014F <1> mov ax, 4F01h 8946 <1> 8947 000038EB E820E0FFFF <1> call _vbe3_pmfn_return_mode_info 8948 <1> 8949 000038F0 6683F84F <1> cmp ax, 004Fh 8950 000038F4 7533 <1> jne short _vbe_rmi_2 ; fail 8951 <1> 8952 <1> ; 15/12/2020 8953 <1> ; cx = vbe video mode 8954 000038F6 80E501 <1> and ch, 01h ; clear LFB flag 8955 000038F9 BEFE7B0900 <1> mov esi, VBE3MODEINFOBLOCK - 2 8956 000038FE 66890E <1> mov [esi], cx ; MODEINFO.mode 8957 00003901 E8A5000000 <1> call set_lfbinfo_table 8958 00003906 EB22 <1> jmp short _vbe_rmi_3 ; cf = 0 8959 <1> _vbe_rmi_1: 8960 00003908 803D[7C090000]02 <1> cmp byte [vbe3], 2 8961 0000390F 7219 <1> jb short _vbe_rmi_3 ; cf = 1 8962 00003911 A0[7D090000] <1> mov al, [vbe2bios] ; 0C0h-0C5h for emu (*) 8963 00003916 3CC0 <1> cmp al, 0C0h ; BOCHS/QEMU/VIRTUALBOX (*) ? 8964 00003918 7210 <1> jb short _vbe_rmi_3 ; cf = 1 8965 0000391A 3CC5 <1> cmp al, 0C5h ; (*) 8966 0000391C 770B <1> ja short _vbe_rmi_2 ; unknown vbios !? 8967 <1> 8968 <1> ;xor edi, edi ; 0 = kernel call (sign) 8969 <1> ; ; no transfer to user's buffer 8970 <1> 8971 <1> ;mov ax, 4F01h 8972 <1> 8973 <1> ; cx = Video mode (for 4F01h, with LFB flag) 8974 <1> 8975 0000391E E80A000000 <1> call vbe_biosfn_return_mode_info 8976 00003923 6683F84F <1> cmp ax, 004Fh ; successful ? 8977 00003927 7401 <1> je short _vbe_rmi_3 ; cf = 0 8978 <1> _vbe_rmi_2: 8979 00003929 F9 <1> stc 8980 <1> ; cf = 1 8981 <1> _vbe_rmi_3: 8982 0000392A 5E <1> pop esi ; **** 8983 0000392B 5D <1> pop ebp ; *** 8984 <1> 8985 <1> ;pop es ; ** 8986 <1> ;pop ss ; * 8987 <1> 8988 0000392C C3 <1> retn 8989 <1> 8990 <1> 8991 <1> ; * (TRDOS 386, INT 31h, VESA Video Bios functions) 8992 <1> ; * --------------------------------------------------------- 8993 <1> ; * Function 01h - Return VBE Mode Information 8994 <1> ; * --------------------------------------------------------- 8995 <1> ; * Input: 8996 <1> ; * AX = 4F01h 8997 <1> ; * CX = Mode number 8998 <1> ; * (ES:DI) EDI = Pointer to ModeInfoBlock structure 8999 <1> ; * Output: 9000 <1> ; * AX = VBE Return Status 9001 <1> ; * 9002 <1> ; *---------------------------------------------------------- 9003 <1> ; * 9004 <1> 9005 <1> vbe_biosfn_return_mode_info: 9006 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 9007 <1> ; 15/12/2020 9008 <1> ; 14/12/2020 9009 <1> ; 12/12/2020 9010 <1> ; 11/12/2020 (TRDOS 386 v2.0.3) 9011 <1> ; 9012 <1> ; Input: 9013 <1> ; cx = video (bios) mode 9014 <1> ; edi = ModeInfoBlock buffer address 9015 <1> ; (in user's memory space) 9016 <1> ; (ax = 4F01h) 9017 <1> ; Output: 9018 <1> ; ax = 004Fh (successful) 9019 <1> ; ah > 0 -> error 9020 <1> ; 9021 <1> ; Modified registers: esi 9022 <1> 9023 <1> ;;push ds ; * 9024 <1> ;;push es ; ** 9025 <1> ;;push ebp ; *** 9026 <1> ;;push esi ; **** 9027 <1> 9028 0000392D F6C501 <1> test ch, 1 9029 00003930 7505 <1> jnz short vbe_rmi_1 9030 <1> 9031 <1> ; mode number < 100h 9032 <1> ; CGA/VGA mode is not proper this VBE function 9033 <1> 9034 00003932 29C0 <1> sub eax, eax 9035 <1> vbe_rmi_0: 9036 <1> ;mov ax, 0100h ; Function is not supported 9037 00003934 B401 <1> mov ah, 1 9038 00003936 C3 <1> retn 9039 <1> vbe_rmi_1: 9040 00003937 52 <1> push edx ; ***** 9041 00003938 51 <1> push ecx ; ****** 9042 00003939 53 <1> push ebx ; ******* 9043 0000393A 57 <1> push edi ; ******** 9044 <1> 9045 <1> ; 14/12/2020 9046 0000393B 89CB <1> mov ebx, ecx 9047 <1> 9048 <1> ;xor eax, eax 9049 0000393D 80E7C1 <1> and bh, 0C1h ; use bit 15, 14, 8 only (for bh) 9050 00003940 883D[259D0100] <1> mov [vbe_mode_x], bh 9051 <1> ;and bx, 1FFh 9052 00003946 80E701 <1> and bh, 1 9053 <1> ;mov bh, 1 9054 <1> 9055 <1> ; Alternative 2 (instead of 'Mode_info_find_mode') 9056 00003949 E86A060000 <1> call set_mode_info_list ; (alternative 2) 9057 <1> 9058 <1> ; eax = 0 9059 <1> 9060 <1> ;mov bx, [esi] ; mode 9061 <1> 9062 <1> ; Alternative 1 (instead of 'set_mode_info_list') 9063 <1> ;call mode_info_find_mode ; (alternative 1) 9064 <1> 9065 0000394E 09F6 <1> or esi, esi 9066 <1> ; 14/12/2020 9067 00003950 744C <1> jz short vbe_rmi_4 ; VBE mode number is wrong 9068 <1> ; or it is not supported 9069 <1> 9070 <1> ; 15/12/2020 9071 <1> ;mov bx, [esi] ; mode 9072 <1> 9073 <1> ; 12/12/2020 9074 <1> ;call set_lfbinfo_table 9075 <1> 9076 00003952 F605[259D0100]40 <1> test byte [vbe_mode_x], 40h ; LFB model ? 9077 00003959 7404 <1> jz short vbe_rmi_2 9078 <1> 9079 0000395B C6461C01 <1> mov byte [esi+MODEINFO.NumberOfBanks], 1 9080 <1> vbe_rmi_2: 9081 <1> ; (vbe.c, 02/01/2020, vruppert) 9082 <1> ; 11/12/2020 (Erdogan Tan, video.s) 9083 <1> ; Bochs Graphics Adapter 9084 <1> ; vendor_id: 1111h, device id: 1234h 9085 <1> 9086 0000395F E835070000 <1> call pci_get_lfb_addr 9087 <1> ;or eax, eax 9088 00003964 7404 <1> jz short vbe_rmi_3 9089 <1> ; zf = 0, ax > 0 (high word of LFB address) 9090 <1> ; set/change LFB address in MODEINFO structure 9091 00003966 6689462C <1> mov [esi+MODEINFO.PhysBasePtr+2], ax 9092 <1> ; 12/12/2020 9093 <1> ;mov [edi+LFBINFO.LFB_addr+2], ax 9094 <1> vbe_rmi_3: 9095 <1> ;test byte [esi+MODEINFO.WinAAttributes], 1 9096 <1> ; ; VBE_WINDOW_ATTRIBUTE_RELOCATABLE = 1 9097 <1> ;jz short vbe_rmi_4 9098 <1> ;; 11/12/2020 9099 <1> ;; In fact, this is far call address in (Bochs/BGA) Video Bios 9100 <1> ;; Direct user access to kernel subroutines is not possible 9101 <1> ;; in TRDOS 386. Also, TRDOS 386 kernel will support only LFB. 9102 <1> ;; Bank select may be a seperate sysvideo function in future 9103 <1> ;; (if it will be required). 9104 <1> ;mov dword [esi+MODEINFO.WinFuncPtr], dispi_set_bank_farcall 9105 <1> ;vbe_rmi_4: 9106 <1> ; 12/12/2020 9107 0000396A E83C000000 <1> call set_lfbinfo_table 9108 <1> 9109 <1> ; 11/12/2020 9110 <1> ; copy 68 bytes of MODE_INFO_LIST to user 9111 <1> 9112 0000396F 8B3C24 <1> mov edi, [esp] ; user's buffer address 9113 <1> ; 12/12/2020 9114 00003972 09FF <1> or edi, edi ; 0 = kernel call 9115 <1> ; (call from '_vbe_biosfn_return_mode_info') 9116 00003974 7431 <1> jz short vbe_rmi_6 9117 <1> 9118 <1> ; 15/12/2020 9119 <1> ; prepare 256 bytes MODEINFO buffer at VBE3MODEINFOBLOCK 9120 <1> ; and then, copy buffer conttent to user's buffer 9121 00003976 57 <1> push edi 9122 00003977 BE[449D0100] <1> mov esi, MODE_INFO_LIST + 2 ; MODEINFO.ModeAttributes 9123 0000397C BF007C0900 <1> mov edi, VBE3MODEINFOBLOCK 9124 <1> ;mov ecx, 66/4 ; 66 bytes 9125 <1> ; 03/08/2022 9126 00003981 29C9 <1> sub ecx, ecx 9127 00003983 B110 <1> mov cl, 66/4 9128 00003985 F3A5 <1> rep movsd 9129 00003987 31C0 <1> xor eax, eax 9130 00003989 B12F <1> mov cl, (256-68)/4 ; 188 bytes 9131 0000398B F3AB <1> rep stosd 9132 0000398D 66AB <1> stosw ; 2 bytes 9133 0000398F 5F <1> pop edi 9134 00003990 BE007C0900 <1> mov esi, VBE3MODEINFOBLOCK 9135 <1> ;mov cx, 256 9136 00003995 FEC5 <1> inc ch ; cx = 256 9137 00003997 E87FD10000 <1> call transfer_to_user_buffer 9138 0000399C 7309 <1> jnc short vbe_rmi_5 9139 <1> vbe_rmi_4: 9140 <1> ;mov eax, 014Fh ; fail/error 9141 0000399E 31C0 <1> xor eax, eax 9142 000039A0 B401 <1> mov ah, 01h 9143 <1> ;jmp short vbe_rmi_6 9144 000039A2 E981000000 <1> jmp vbe_sm_ret1 ; 11/12/2020 9145 <1> vbe_rmi_5: 9146 <1> ; 256 bytes of MODEINFO have been transferred to user 9147 <1> ;mov eax, 4Fh ; succesfull 9148 <1> vbe_rmi_6: ; 12/12/2020 9149 000039A7 31C0 <1> xor eax, eax 9150 <1> ;vbe_rmi_6: 9151 000039A9 EB7D <1> jmp vbe_sm_ret1 ; 11/12/2020 9152 <1> 9153 <1> ;pop edi ; ******** 9154 <1> ;pop ebx ; ******* 9155 <1> ;pop ecx ; ****** 9156 <1> ;pop edx ; ***** 9157 <1> 9158 <1> ;;pop esi ; **** 9159 <1> ;;pop ebp ; *** 9160 <1> ;;pop es ; ** 9161 <1> ;;pop ds ; * 9162 <1> 9163 <1> ;retn 9164 <1> 9165 <1> set_lfbinfo_table: 9166 <1> ; 19/12/2020 9167 <1> ; 11/12/2020 9168 <1> ; Set/Fill LFBINFO structure/table 9169 <1> ; 9170 <1> ; Input: 9171 <1> ; esi = Mode info list address 9172 <1> ; Output: 9173 <1> ; LFB_Info address is filled with LFBINFO 9174 <1> ; edi = LFB_Info address 9175 <1> ; 9176 <1> ; Modified registers: eax, edx (=0), edi 9177 <1> 9178 000039AB BF[329D0100] <1> mov edi, LFB_Info 9179 000039B0 8B462A <1> mov eax, [esi+MODEINFO.PhysBasePtr] 9180 000039B3 894702 <1> mov [edi+LFBINFO.LFB_addr], eax ; LFB address 9181 <1> ;mov ax, [esi+MODEINFO.mode] 9182 000039B6 668B06 <1> mov ax, [esi] 9183 000039B9 668907 <1> mov [edi+LFBINFO.mode],ax 9184 000039BC 8A461B <1> mov al, [esi+MODEINFO.BitsPerPixel] 9185 000039BF 88470E <1> mov [edi+LFBINFO.bpp], al 9186 000039C2 29C0 <1> sub eax, eax 9187 000039C4 668B4614 <1> mov ax, [esi+MODEINFO.XResolution] 9188 000039C8 6689470A <1> mov [edi+LFBINFO.X_res], ax 9189 000039CC 89C2 <1> mov edx, eax ; 19/12/2020 9190 000039CE 668B4616 <1> mov ax, [esi+MODEINFO.YResolution] 9191 000039D2 6689470C <1> mov [edi+LFBINFO.Y_res], ax 9192 <1> ; eax = Y_res ; screen height 9193 <1> ; 19/12/2020 9194 000039D6 F7E2 <1> mul edx ; X_res*Y_res 9195 <1> ; edx = 0 9196 000039D8 8A570E <1> mov dl, [edi+LFBINFO.bpp] 9197 <1> ; Note: 9198 <1> ; Bits per pixel may be 8,16,24,32 for TRDOS 386 v2. 9199 <1> ; (4 bits for pixel is not used for VESA modes here) 9200 000039DB C0EA03 <1> shr dl, 3 ; convert bits to byte 9201 000039DE F7E2 <1> mul edx 9202 <1> ; eax = screen/page/buffer size in bytes 9203 000039E0 894706 <1> mov [edi+LFBINFO.LFB_size], eax 9204 <1> ; edx = 0 9205 <1> ; clear reserved byte in LFBINFO structure/table 9206 000039E3 88570F <1> mov [edi+LFBINFO.reserved], dl ; not necessary 9207 000039E6 C3 <1> retn 9208 <1> 9209 <1> ; * (TRDOS 386, INT 31h, VESA Video Bios functions) 9210 <1> ; * --------------------------------------------------------- 9211 <1> ; * Function 02h - Set VBE Mode 9212 <1> ; * --------------------------------------------------------- 9213 <1> ; * Input: 9214 <1> ; * AX = 4F02h 9215 <1> ; * BX = Desired Mode to set 9216 <1> ; * Output: 9217 <1> ; * AX = VBE Return Status 9218 <1> ; * 9219 <1> ; *---------------------------------------------------------- 9220 <1> ; * 9221 <1> 9222 <1> vbe_biosfn_set_mode: 9223 <1> ; 07/03/2021 9224 <1> ; 12/12/2020 9225 <1> ; 11/12/2020 (LFBINFO table for VESA VBE modes) 9226 <1> ; 27/11/2020 9227 <1> ; 25/11/2020 9228 <1> ; 23/11/2020 (TRDOS 386 v2.0.3) 9229 <1> ; (ref: vbe.c, 02/01/2020, vruppert) 9230 <1> ; 9231 <1> ; Input: 9232 <1> ; bx = video (bios) mode 9233 <1> ; ax = 4F02h 9234 <1> ; Output: 9235 <1> ; ax = 004Fh (successful) 9236 <1> ; ah > 0 -> error 9237 <1> ; 9238 <1> ; Modified registers: esi 9239 <1> 9240 <1> ; 27/11/2020 9241 <1> 9242 <1> ;;push ds ; * 9243 <1> ;;push es ; ** 9244 <1> ;;push ebp ; *** 9245 <1> ;;push esi ; **** 9246 <1> 9247 <1> ; 11/12/2020 9248 000039E7 52 <1> push edx ; ***** 9249 000039E8 51 <1> push ecx ; ****** 9250 000039E9 53 <1> push ebx ; ******* 9251 000039EA 57 <1> push edi ; ******** 9252 <1> 9253 <1> ;xor eax, eax 9254 000039EB 80E7C1 <1> and bh, 0C1h ; use bit 15, 14, 8 only (for bh) 9255 000039EE 883D[259D0100] <1> mov [vbe_mode_x], bh 9256 000039F4 80E701 <1> and bh, 1 9257 000039F7 753C <1> jnz short vbe_sm_3 ; VESA VBE mode 9258 <1> 9259 <1> ;;test bx, 4000h ; VBE_MODE_LINEAR_FRAME_BUFFER 9260 <1> ;test bh, 40h 9261 <1> ;jz short vbe_sm_0 9262 <1> ;; lfb_flag 9263 <1> ;mov al, 40h ; VBE_DISPI_LFB_ENABLED 9264 <1> vbe_sm_0: 9265 <1> ; 27/11/2020 9266 000039F9 B080 <1> mov al, 80h 9267 <1> ;test bh, 80h ; VBE_MODE_PRESERVE_DISPLAY_MEMORY 9268 <1> ;jnz short vbe_sm_1 ; no_clear 9269 <1> ;; clear 9270 <1> ;sub al, al ; 0 9271 000039FB 8405[259D0100] <1> test [vbe_mode_x], al ; 80h 9272 00003A01 7402 <1> jz short vbe_sm_1 ; clear display memory 9273 <1> ; no_clear 9274 00003A03 08C3 <1> or bl, al ; VBE_MODE_PRESERVE_DISPLAY_MEMORY 9275 <1> vbe_sm_1: 9276 <1> ; check non vesa mode 9277 <1> ;;cmp bx, 100h ; VBE_MODE_VESA_DEFINED 9278 <1> ;;jna short vbe_sm_2 9279 <1> ;and bh, 1 9280 <1> ;jnz short vbe_sm_3 9281 <1> 9282 <1> ; BX <= 1FFh 9283 <1> 9284 <1> ; 27/11/2020 9285 <1> ;or bl, al ; al = 80h if no_clear option is set 9286 <1> ; ; al = 0 if no_clear option is not set 9287 <1> 9288 <1> ; 25/11/2020 9289 <1> ; VBE DISPI will be disabled in 'biosfn_set_video_mode' 9290 <1> 9291 <1> ;xor al, al ; 0 ; VBE_DISPI_DISABLED 9292 <1> ;call dispi_set_enable 9293 <1> 9294 <1> ; call the vgabios in order to set the video mode 9295 <1> ; this allows for going back to textmode with a VBE call 9296 <1> ; (some applications expect that to work) 9297 <1> 9298 <1> ;and bx, 0FFh 9299 <1> 9300 <1> ; 27/11/2020 9301 <1> biosfn_set_video_mode: 9302 <1> ; _call: call subroutine 9303 <1> ; 26/11/2020 (TRDOS 386 v2.0.3) 9304 <1> ; (ref: vgabios.c, 02/01/2020, vruppert) 9305 <1> ; Input: 9306 <1> ; bl = VGA video (bios) mode 9307 <1> ; Output: 9308 <1> ; cf = 1 -> error 9309 <1> ; cf = 0 -> ok 9310 <1> ; 9311 <1> ; Modified registers: esi 9312 <1> 9313 <1> ; 'dispi_set_enable(VBE_DISPI_DISABLED);' 9314 <1> 9315 <1> ;mov ax, 0 ; VBE_DISPI_DISABLED 9316 00003A05 31C0 <1> xor eax, eax ; 0 9317 00003A07 E89C040000 <1> call dispi_set_enable 9318 <1> 9319 00003A0C 88D8 <1> mov al, bl 9320 <1> ;jmp _set_mode ; (in 'biosfn_set_video_mode' sub) 9321 00003A0E E872E1FFFF <1> call _set_mode ; will return with cf=1 only if 9322 <1> ; desired mode is not implemented 9323 <1> ; _retn: return from subroutine 9324 00003A13 721A <1> jc short vbe_sm_2 ; 25/11/2020 9325 <1> 9326 <1> ; 26/11/2020 9327 00003A15 31C0 <1> xor eax, eax 9328 00003A17 A0[2E680000] <1> mov al, [CRT_MODE] 9329 <1> ; 27/11/2020 9330 00003A1C 8A25[4B830100] <1> mov ah, [noclearmem] ; 80h or 0 9331 <1> ;and ah 80h 9332 00003A22 66A3[269D0100] <1> mov [video_mode], ax ; bit 15 = no_clear flag 9333 <1> ; bit 14 = 0 (not LFB model) 9334 <1> vbe_sm_ret1: 9335 <1> ; 11/12/2020 9336 <1> ; (vbe_rmi_4 and vbe_rmi_6 jump here) 9337 <1> ; 27/11/2020 9338 00003A28 B04F <1> mov al, 4Fh ; Function call successful 9339 <1> ; eax = 004Fh 9340 <1> vbe_sm_ret2: 9341 <1> ; 11/12/2020 9342 00003A2A 5F <1> pop edi ; ******** 9343 00003A2B 5B <1> pop ebx ; ******* 9344 00003A2C 59 <1> pop ecx ; ****** 9345 00003A2D 5A <1> pop edx ; ***** 9346 <1> 9347 <1> ;;pop esi ; **** 9348 <1> ;;pop ebp ; *** 9349 <1> ;;pop es ; ** 9350 <1> ;;pop ds ; * 9351 <1> 9352 00003A2E C3 <1> retn 9353 <1> 9354 <1> vbe_sm_2: 9355 <1> ;mov ax, 0100h ; Function is not supported 9356 <1> ; 27/11/2020 9357 00003A2F 31C0 <1> xor eax, eax 9358 00003A31 B401 <1> mov ah, 01h 9359 <1> ; eax = 0100h 9360 <1> ;retn 9361 00003A33 EBF5 <1> jmp short vbe_sm_ret2 9362 <1> 9363 <1> vbe_sm_3: 9364 <1> ; 12/12/2020 9365 <1> ; check current mode, if it is 03h 9366 <1> ; save page contents and cursor positions 9367 00003A35 803D[2E680000]03 <1> cmp byte [CRT_MODE], 03h 9368 <1> ;jne short vbe_sm_0 9369 00003A3C 7505 <1> jne short vbe_sm_4 ; 07/03/2021 9370 00003A3E E8E4E3FFFF <1> call save_mode3_multiscreen 9371 <1> ; set current mode to extended (SVGA) mode 9372 <1> ;mov byte [CRT_MODE], 0FFh ; VESA VBE mode 9373 <1> vbe_sm_4: 9374 <1> ; 27/11/2020 9375 <1> ; bx = mode (bit 0 to 8) 9376 <1> 9377 <1> ; 25/11/2020 9378 <1> 9379 <1> ; Alternative 2 (instead of 'Mode_info_find_mode') 9380 <1> ;push edi 9381 00003A43 E870050000 <1> call set_mode_info_list ; (alternative 2) 9382 <1> ;pop edi 9383 <1> 9384 <1> ;mov bx, [esi] ; mode 9385 <1> 9386 <1> ; Alternative 1 (instead of 'set_mode_info_list') 9387 <1> ;call mode_info_find_mode ; (alternative 1) 9388 <1> 9389 00003A48 09F6 <1> or esi, esi 9390 00003A4A 74E3 <1> jz short vbe_sm_2 ; VBE mode number is wrong 9391 <1> ; or it is not supported 9392 <1> 9393 <1> ; 11/12/2020 9394 00003A4C 668B1E <1> mov bx, [esi] ; mode 9395 <1> 9396 <1> ; 27/11/2020 9397 00003A4F 0A3D[259D0100] <1> or bh, [vbe_mode_x] 9398 <1> 9399 <1> ; save VESA VBE mode 9400 00003A55 66891D[269D0100] <1> mov [video_mode], bx 9401 <1> ; 27/11/2020 9402 <1> ; bit 0 to 8 = VESA VBE mode 9403 <1> ; bit 9 to 13 = 0 (bit 0 to 13 = mode) 9404 <1> ; bit 14 = Linear/Flat Frame Buffer flag 9405 <1> ; bit 15 = 'memory not cleared 9406 <1> ; at last mode set' flag 9407 <1> 9408 <1> ; first disable current mode 9409 <1> ; (when switching between vesa modes) 9410 <1> ; 'dispi_set_enable(VBE_DISPI_DISABLED);' 9411 <1> 9412 <1> ;mov ax, VBE_DISPI_DISABLED ; 0 9413 00003A5C 29C0 <1> sub eax, eax ; 0 9414 <1> 9415 00003A5E E845040000 <1> call dispi_set_enable 9416 <1> 9417 <1> ; 11/12/2020 9418 00003A63 8A461B <1> mov al, [esi+MODEINFO.BitsPerPixel] 9419 <1> ; ah = 0 9420 <1> 9421 <1> ;cmp byte [esi+MODEINFO.BitsPerPixel], 8 9422 00003A66 3C08 <1> cmp al, 8 9423 00003A68 750B <1> jne short vbe_sm_5 9424 <1> 9425 <1> ; 11/12/2020 9426 <1> ;push edi 9427 00003A6A 50 <1> push eax 9428 <1> ; 'load_dac_palette(3);' 9429 00003A6B 56 <1> push esi 9430 00003A6C B403 <1> mov ah, 3 ; palette3, 256 colors 9431 00003A6E E8BBF1FFFF <1> call load_dac_palette 9432 00003A73 5E <1> pop esi 9433 <1> ; 11/12/2020 9434 00003A74 58 <1> pop eax 9435 <1> ;pop edi 9436 <1> vbe_sm_5: 9437 <1> ;'dispi_set_bpp(cur_info->info.BitsPerPixel);' 9438 <1> ; 11/12/2020 (al = bits per pixel, ah = 0) 9439 <1> ;xor ah, ah 9440 <1> ;mov al, [esi+MODEINFO.BitsPerPixel] 9441 00003A75 E841040000 <1> call dispi_set_bpp 9442 <1> ;'dispi_set_xres(cur_info->info.XResolution);' 9443 00003A7A 668B4614 <1> mov ax, [esi+MODEINFO.XResolution] 9444 00003A7E E83E040000 <1> call dispi_set_xres 9445 <1> ;'dispi_set_yres(cur_info->info.YResolution);' 9446 00003A83 668B4616 <1> mov ax, [esi+MODEINFO.YResolution] 9447 00003A87 E83B040000 <1> call dispi_set_yres 9448 <1> 9449 <1> ;'dispi_set_bank(0);' 9450 <1> ;xor ax, ax 9451 00003A8C 31C0 <1> xor eax, eax ; 0 9452 00003A8E E83A040000 <1> call dispi_set_bank 9453 <1> ;'dispi_set_enable(VBE_DISPI_ENABLED|no_clear|lfb_flag);' 9454 <1> ;mov ax, di 9455 <1> ; ah = 0 ; 27/11/2020 9456 00003A93 A0[259D0100] <1> mov al, [vbe_mode_x] ; restore VBE mode bit 14 & 15 9457 00003A98 0C01 <1> or al, 1 ; VBE_DISPI_ENABLED 9458 00003A9A E809040000 <1> call dispi_set_enable 9459 <1> 9460 <1> ; 'vga_compat_setup();' 9461 00003A9F E83E040000 <1> call vga_compat_setup 9462 <1> 9463 <1> ; 11/12/2020 9464 00003AA4 E802FFFFFF <1> call set_lfbinfo_table 9465 <1> 9466 <1> ; 26/11/2020 9467 00003AA9 31C0 <1> xor eax, eax 9468 00003AAB FEC8 <1> dec al 9469 00003AAD A2[2E680000] <1> mov [CRT_MODE], al ; 0FFh = VESA VBE mode sign 9470 <1> 9471 <1> ; 27/11/2020 9472 00003AB2 E971FFFFFF <1> jmp vbe_sm_ret1 ; Function call successful 9473 <1> 9474 <1> ; 27/11/2020 9475 <1> ;mov al, 4Fh 9476 <1> ; ; eax = 004Fh = Function call successful 9477 <1> ;jmp short vbe_sm_ret2 9478 <1> 9479 <1> ; * (TRDOS 386, INT 31h, VESA Video Bios functions) 9480 <1> ; * --------------------------------------------------------- 9481 <1> ; * Function 03h - Return Current VBE Mode 9482 <1> ; * --------------------------------------------------------- 9483 <1> ; * Input: 9484 <1> ; * AX = 4F03h 9485 <1> ; * Output: 9486 <1> ; * AX = VBE Return Status 9487 <1> ; * BX = Current VBE Mode 9488 <1> ; * 9489 <1> ; *---------------------------------------------------------- 9490 <1> ; * 9491 <1> 9492 <1> vbe_biosfn_return_current_mode: 9493 <1> ; 11/12/2020 9494 <1> ; 27/11/2020 (TRDOS 386 v2.0.3) 9495 <1> ; (ref: vbe.c, 02/01/2020, vruppert) 9496 <1> ; 9497 <1> ; Input: 9498 <1> ; none 9499 <1> ; Output: 9500 <1> ; ax = 004Fh (successful) 9501 <1> ; ah > 0 -> error 9502 <1> ; bx = current video (bios) mode (if ah = 0) 9503 <1> ; 9504 <1> ; Modified registers: eax, ebx 9505 <1> 9506 <1> ; 27/11/2020 9507 <1> 9508 <1> ;;push ds ; * 9509 <1> ;;push es ; ** 9510 <1> ;;push ebp ; *** 9511 <1> ;;push esi ; **** 9512 <1> 9513 <1> ;push edx ; ***** 9514 <1> 9515 <1> ; (vbe.c) 9516 <1> ;call dispi_get_enable 9517 <1> ; ; ax = vbe display interface status 9518 <1> ;and al, 1 ; VBE_DISPI_ENABLED 9519 <1> ;jnz short vbe_gm_1 ; VBE graphics mode 9520 <1> 9521 00003AB7 A0[2E680000] <1> mov al, [CRT_MODE] ; current cga/vga mode 9522 00003ABC 3CFF <1> cmp al, 0FFh ; VBE extension signature 9523 00003ABE 720E <1> jb short vbe_gm_1 ; get CGA/VGA mode 9524 <1> 9525 <1> ; get VBE mode 9526 <1> vbe_gm_0: 9527 00003AC0 66A1[269D0100] <1> mov ax, [video_mode] 9528 <1> ; BX bits: 9529 <1> ; bit 0 to 8 = VESA VBE video mode 9530 <1> ; bit 9 to 13 = 0 9531 <1> ; bit 14 = last mode set LFB option 9532 <1> ; 1 - linear/flat frame buffer 9533 <1> ; 0 - windowed frame buffer 9534 <1> ; bit 15 = last mode set no_clear option 9535 <1> ; 0 - video memory cleared 9536 <1> ; 1 - video memory not cleared 9537 <1> 9538 <1> vbe_gm_return: 9539 <1> ;pop edx ; ****** 9540 00003AC6 0FB7D8 <1> movzx ebx, ax 9541 <1> ;vbe_srs_retn: 9542 00003AC9 31C0 <1> xor eax, eax ; 0 9543 00003ACB B04F <1> mov al, 4Fh ; ax = 004Fh (successful) 9544 00003ACD C3 <1> retn 9545 <1> 9546 <1> vbe_gm_1: 9547 <1> ; legacy (old, standard) CGA/VGA bios video mode 9548 00003ACE 8A25[4B830100] <1> mov ah, [noclearmem] ; 80h or 0 9549 <1> ; BX bits: 9550 <1> ; bit 0 to 7 = video mode 9551 <1> ; bit 8 to 13 = 0 9552 <1> ; bit 14 = 0 (not LFB mode) CGA/VGA 9553 <1> ; bit 15 = 1 if [noclearmem] = 80h 9554 <1> ; 0 if [noclearmem] = 0 9555 00003AD4 EBF0 <1> jmp short vbe_gm_return 9556 <1> 9557 <1> ; * (TRDOS 386, INT 31h, VESA Video Bios functions) 9558 <1> ; * --------------------------------------------------------- 9559 <1> ; * Function 04h - Save/Restore State 9560 <1> ; * --------------------------------------------------------- 9561 <1> ; * Input: 9562 <1> ; * AX = 4F04h 9563 <1> ; * DL = 00h Return Save/Restore State buff size 9564 <1> ; * 01h Save State 9565 <1> ; * 02h Restore State 9566 <1> ; * CX = Requested states 9567 <1> ; * bit 0 - controller hardware state 9568 <1> ; * bit 1 - BIOS data state 9569 <1> ; * bit 2 - DAC state 9570 <1> ; * bit 3 - register state 9571 <1> ; * (ES:BX) EBX = Pointer to buffer (if DL <> 00h) 9572 <1> ; * Output: 9573 <1> ; * AX = VBE Return Status 9574 <1> ; * BX = Number of 64-byte blocks 9575 <1> ; * to hold the state buffer (if DL=00h) 9576 <1> ; * 9577 <1> ; *---------------------------------------------------------- 9578 <1> ; * 9579 <1> 9580 <1> vbe_biosfn_save_restore_state: 9581 <1> ; 23/01/2021 9582 <1> ; 16/01/2021 9583 <1> ; 14/01/2021 9584 <1> ; 13/01/2021 9585 <1> ; 12/01/2021 9586 <1> ; 11/01/2021 (TRDOS 386 v2.0.3) 9587 <1> ; (ref: vbe.c, 02/01/2020, vruppert) 9588 <1> ; 9589 <1> ; Input: 9590 <1> ; dl = sub function 9591 <1> ; cl = requested state 9592 <1> ; ebx = pointer to buffer (if dl<>00h) 9593 <1> ; Output: 9594 <1> ; ax = 004Fh (successful) 9595 <1> ; ah > 0 -> error 9596 <1> ; bx = Number of 64-byte blocks 9597 <1> ; to hold the state buffer (if DL=00h) 9598 <1> 9599 <1> ; Modified registers: eax, ebx, edi 9600 <1> 9601 <1> ; 14/01/2021 9602 00003AD6 09DB <1> or ebx, ebx ; user's buffer address 9603 00003AD8 750A <1> jnz short _vbe_biosfn_save_restore_state 9604 <1> 9605 00003ADA 20D2 <1> and dl, dl 9606 00003ADC 7406 <1> jz short _vbe_biosfn_save_restore_state 9607 <1> 9608 <1> ; function failed 9609 <1> ;mov eax, 0100h 9610 <1> ;xor eax, eax 9611 <1> ;inc ah ; eax = 0100h 9612 <1> ; 16/01/2021 9613 00003ADE B84F010000 <1> mov eax, 014Fh 9614 00003AE3 C3 <1> retn 9615 <1> 9616 <1> _vbe_biosfn_save_restore_state: 9617 <1> ; 23/01/2021 9618 <1> ; 14/01/2021 9619 <1> ; ebx = 0 if the caller is kernel ('sysvideo') 9620 <1> 9621 <1> ; 13/01/2021 9622 00003AE4 57 <1> push edi 9623 00003AE5 52 <1> push edx 9624 00003AE6 51 <1> push ecx 9625 <1> 9626 <1> ; 23/01/2021 9627 <1> ; 12/01/2021 9628 00003AE7 80FA02 <1> cmp dl, 2 9629 00003AEA 7757 <1> ja short vbe_srs_7 ; 23/01/2021 9630 <1> ; invalid sub function 9631 00003AEC 83F90F <1> cmp ecx, 0Fh 9632 00003AEF 7752 <1> ja short vbe_srs_7 ; invalid ! 9633 <1> 9634 00003AF1 20D2 <1> and dl, dl 9635 00003AF3 7515 <1> jnz short vbe_srs_4 9636 <1> 9637 <1> ; DL = 0 9638 <1> ; Return Save/Restore State buffer size 9639 <1> 9640 <1> ;mov ebx, ecx 9641 <1> ;shl bl, 1 9642 <1> ;mov bx, [ebx+vbestatebufsize] 9643 00003AF5 E881000000 <1> call vbe_srs_gbs 9644 <1> 9645 <1> ; ; 11/01/2021 9646 <1> ; test cl, 8 9647 <1> ; jz short vbe_srs_3 9648 <1> ; ; vbe_biosfn_read_video_state_size(); 9649 <1> ; ; return 9 * 2; 9650 <1> ; mov bl, 18 ; register state size 9651 <1> ;vbe_srs_0: 9652 <1> ; test cl, 1 9653 <1> ; jz short vbe_srs_1 9654 <1> ; ; size += 0x46; 9655 <1> ; add bl, 70 ; controller state size 9656 <1> ;vbe_srs_1: 9657 <1> ; test cl, 2 9658 <1> ; jz short vbe_srs_2 9659 <1> ; ; size += (5 + 8 + 5) * 2 + 6; 9660 <1> ; ;add bl, 42 ; BIOS data state size ; Bochs/Plex86 9661 <1> ; ; 12/01/2021 9662 <1> ; add bl, 40 ; TRDOS 386 v2 VBIOS data state size 9663 <1> ;vbe_srs_2: 9664 <1> ; test cl, 4 9665 <1> ; jz short vbe_srs_3 9666 <1> ; ; size += 3 + 256 * 3 + 1; 9667 <1> ; add bx, 772 ; DAC state size 9668 <1> 9669 <1> vbe_srs_3: 9670 00003AFA 6683C33F <1> add bx, 63 9671 00003AFE 66C1EB06 <1> shr bx, 6 ; / 64 9672 <1> 9673 <1> vbe_srs_retn: 9674 00003B02 31C0 <1> xor eax, eax ; 0 9675 <1> vbe_srs_0: ; 16/01/2021 9676 00003B04 B04F <1> mov al, 4Fh ; ax = 004Fh (successful) 9677 <1> ;vbe_srs_0: 9678 <1> ; 13/01/2021 9679 00003B06 59 <1> pop ecx 9680 00003B07 5A <1> pop edx 9681 00003B08 5F <1> pop edi 9682 <1> 9683 00003B09 C3 <1> retn 9684 <1> 9685 <1> ; 23/01/2021 9686 <1> ;vbe_srs_10: 9687 <1> ;; 14/01/2021 9688 <1> ; return to 'sysvideo' 9689 <1> ;mov ebx, ecx ; transfer count 9690 <1> ; ; (byte count for saving current video state) 9691 <1> ;jmp short vbe_srs_retn 9692 <1> 9693 <1> vbe_srs_4: 9694 <1> ; 23/01/2021 9695 00003B0A 80E10F <1> and cl, 0Fh ; 8, 4, 2, 1 9696 00003B0D 7434 <1> jz short vbe_srs_7 ; cx = 0 -> invalid ! 9697 <1> 9698 00003B0F BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 9699 <1> 9700 00003B14 80FA01 <1> cmp dl, 1 9701 00003B17 7730 <1> ja short vbe_srs_8 9702 <1> 9703 <1> ; save video state 9704 <1> 9705 00003B19 F6C107 <1> test cl, 07h ; 4, 2, 1 9706 00003B1C 740A <1> jz short vbe_srs_5 ; vbe dispi regs state 9707 <1> 9708 00003B1E E884000000 <1> call biosfn_save_video_state 9709 <1> ; edi = current position 9710 <1> ; in VBE3SAVERESTOREBLOCK 9711 <1> ; (VGA save_state offset) 9712 <1> ; modified regs: edi, eax, edx, ch 9713 00003B23 F6C108 <1> test cl, 8 9714 00003B26 7405 <1> jz short vbe_srs_6 9715 <1> vbe_srs_5: 9716 00003B28 E8AB010000 <1> call vbe_biosfn_save_video_state 9717 <1> ; edi = end position 9718 <1> ; in VBE3SAVERESTOREBLOCK 9719 <1> ; (VGA save_state offset) 9720 <1> ; modified regs: edi, eax, edx, ch 9721 <1> vbe_srs_6: 9722 <1> ; 23/01/2021 9723 00003B2D 21DB <1> and ebx, ebx 9724 00003B2F 74D1 <1> jz short vbe_srs_retn ; the caller is kernel 9725 <1> 9726 00003B31 BE00760900 <1> mov esi, VBE3SAVERESTOREBLOCK 9727 00003B36 29F7 <1> sub edi, esi 9728 00003B38 89F9 <1> mov ecx, edi ; transfer count in bytes 9729 <1> 9730 <1> ;; 14/01/2021 9731 <1> ;and ebx, ebx 9732 <1> ;jz short vbe_srs_10 ; the caller is kernel 9733 <1> 9734 00003B3A 89DF <1> mov edi, ebx ; user's buffer address 9735 00003B3C E8DACF0000 <1> call transfer_to_user_buffer 9736 00003B41 73BF <1> jnc short vbe_srs_retn 9737 <1> vbe_srs_7: 9738 <1> ; // function failed 9739 <1> ;mov eax, 0100h 9740 00003B43 31C0 <1> xor eax, eax 9741 00003B45 FEC4 <1> inc ah ; eax = 0100h 9742 <1> ; 16/01/2021 9743 <1> ; ax = 0014Fh 9744 <1> ;retn 9745 <1> ; 13/01/2021 9746 00003B47 EBBB <1> jmp short vbe_srs_0 9747 <1> vbe_srs_8: 9748 <1> ;cmp dl, 2 9749 <1> ;jne short vbe_srs_7 9750 <1> ; ; invalid sub function 9751 <1> 9752 <1> ; 14/01/2021 9753 00003B49 09DB <1> or ebx, ebx ; user's buffer address 9754 <1> ;jnz short vbe_srs_11 9755 <1> 9756 <1> ; the caller is kernel ('sysvideo') 9757 <1> ;jmp short vbe_srs_12 9758 <1> ; 23/01/2021 9759 00003B4B 7414 <1> jz short vbe_srs_12 ; 'sysvideo' call 9760 <1> vbe_srs_11: 9761 00003B4D 89DE <1> mov esi, ebx ; user's buffer address 9762 <1> ; 23/01/2021 9763 <1> ;push ebx 9764 <1> 9765 00003B4F E827000000 <1> call vbe_srs_gbs 9766 <1> 9767 <1> ; restore video state 9768 <1> 9769 <1> ;mov edi, VBE3SAVERESTOREBLOCK 9770 00003B54 51 <1> push ecx 9771 00003B55 89D9 <1> mov ecx, ebx ; transfer count in bytes 9772 00003B57 E809D00000 <1> call transfer_from_user_buffer 9773 00003B5C 59 <1> pop ecx 9774 <1> ; 23/01/2021 9775 <1> ;pop ebx 9776 00003B5D 89F3 <1> mov ebx, esi 9777 00003B5F 72E2 <1> jc short vbe_srs_7 9778 <1> 9779 <1> vbe_srs_12: 9780 <1> ;mov esi, VBE3SAVERESTOREBLOCK 9781 00003B61 89FE <1> mov esi, edi 9782 <1> 9783 00003B63 F6C107 <1> test cl, 07h ; 4, 2, 1 9784 00003B66 740C <1> jz short vbe_srs_9 ; vbe dispi regs state 9785 <1> 9786 00003B68 E8A2010000 <1> call biosfn_restore_video_state 9787 00003B6D 72D4 <1> jc short vbe_srs_7 ; invalid buffer content ! 9788 <1> ; esi = current position 9789 <1> ; in VBE3SAVERESTOREBLOCK 9790 <1> ; (VGA save_state offset) 9791 <1> ; modified regs: esi, eax, edx, ch 9792 00003B6F F6C108 <1> test cl, 8 9793 <1> ;jz short vbe_srs_10 9794 <1> ; 23/01/2020 9795 00003B72 EB8E <1> jmp short vbe_srs_retn 9796 <1> vbe_srs_9: 9797 00003B74 E8F1020000 <1> call vbe_biosfn_restore_video_state 9798 <1> 9799 <1> ; modified regs: esi, eax, edx, ch 9800 <1> 9801 00003B79 EB87 <1> jmp short vbe_srs_retn 9802 <1> 9803 <1> ;vbe_srs_10: 9804 <1> ; ; successful 9805 <1> ; xor eax, eax ; 0 9806 <1> ; mov al, 4Fh ; ax = 004Fh (successful) 9807 <1> ; retn 9808 <1> 9809 <1> vbe_srs_gbs: 9810 <1> ; return buffer size according to flags 9811 00003B7B 89CB <1> mov ebx, ecx ; options/flags 9812 00003B7D D0E3 <1> shl bl, 1 9813 00003B7F 668B9B[873B0000] <1> mov bx, [ebx+vbestatebufsize] 9814 00003B86 C3 <1> retn 9815 <1> 9816 <1> vbestatebufsize: 9817 <1> ; ---------------------------------------- 9818 <1> ; CL = 0 1 2 3 4 5 6 7 9819 <1> ; ---------------------------------------- 9820 00003B87 0000460028006E0004- <1> dw 0, 70, 40, 110, 772, 842, 812, 882 9820 00003B90 034A032C037203 <1> 9821 <1> ; ---------------------------------------- 9822 <1> ; CL = 8 9 10 11 12 13 14 15 9823 <1> ; ---------------------------------------- 9824 00003B97 120058003A00800016- <1> dw 18, 88, 58, 128, 790, 860, 830, 900 9824 00003BA0 035C033E038403 <1> 9825 <1> 9826 <1> ; 11/01/2021 9827 <1> VGAREG_ACTL_ADDRESS equ 3C0h 9828 <1> VGAREG_ACTL_WRITE_DATA equ 3C0h 9829 <1> VGAREG_ACTL_READ_DATA equ 3C1h 9830 <1> 9831 <1> VGAREG_INPUT_STATUS equ 3C2h 9832 <1> VGAREG_WRITE_MISC_OUTPUT equ 3C2h 9833 <1> VGAREG_VIDEO_ENABLE equ 3C3h 9834 <1> VGAREG_SEQU_ADDRESS equ 3C4h 9835 <1> VGAREG_SEQU_DATA equ 3C5h 9836 <1> 9837 <1> VGAREG_PEL_MASK equ 3C6h 9838 <1> VGAREG_DAC_STATE equ 3C7h 9839 <1> VGAREG_DAC_READ_ADDRESS equ 3C7h 9840 <1> VGAREG_DAC_WRITE_ADDRESS equ 3C8h 9841 <1> VGAREG_DAC_DATA equ 3C9h 9842 <1> 9843 <1> VGAREG_READ_FEATURE_CTL equ 3CAh 9844 <1> VGAREG_READ_MISC_OUTPUT equ 3CCh 9845 <1> 9846 <1> VGAREG_GRDC_ADDRESS equ 3CEh 9847 <1> VGAREG_GRDC_DATA equ 3CFh 9848 <1> 9849 <1> ;VGAREG_MDA_CRTC_ADDRESS equ 3B4h 9850 <1> ;VGAREG_MDA_CRTC_DATA equ 3B5h 9851 <1> VGAREG_VGA_CRTC_ADDRESS equ 3D4h 9852 <1> VGAREG_VGA_CRTC_DATA equ 3D5h 9853 <1> 9854 <1> ;VGAREG_MDA_WRITE_FEATURE_CTL equ 3BAh 9855 <1> VGAREG_VGA_WRITE_FEATURE_CTL equ 3DAh 9856 <1> VGAREG_ACTL_RESET equ 3DAh 9857 <1> 9858 <1> ;VGAREG_MDA_MODECTL equ 3B8h 9859 <1> VGAREG_CGA_MODECTL equ 3D8h 9860 <1> VGAREG_CGA_PALETTE equ 3D9h 9861 <1> 9862 <1> biosfn_save_video_state: 9863 <1> ; 03/08/2022 (TRDOS 386 v2.0.5) 9864 <1> ; 22/01/2021 9865 <1> ; 12/01/2021 9866 <1> ; 11/01/2021 (TRDOS 386 v2.0.3) 9867 <1> ; (vgabios.c) 9868 <1> 9869 <1> ; modified registers: eax, edx, edi, ch 9870 <1> 9871 <1> ;mov edi, VBE3SAVERESTOREBLOCK 9872 <1> 9873 <1> ; input: edi = state buffer address 9874 <1> 9875 00003BA7 F6C101 <1> test cl, 1 9876 00003BAA 0F8485000000 <1> jz bfn_svs_4 9877 <1> 9878 00003BB0 66BAC403 <1> mov dx, VGAREG_SEQU_ADDRESS ; 3C7h 9879 00003BB4 EC <1> in al, dx 9880 00003BB5 AA <1> stosb 9881 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 9882 00003BB6 B2D4 <1> mov dl, 0D4h 9883 00003BB8 EC <1> in al, dx 9884 00003BB9 AA <1> stosb 9885 <1> ;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 9886 00003BBA B2CE <1> mov dl, 0CEh 9887 00003BBC EC <1> in al, dx 9888 00003BBD AA <1> stosb 9889 <1> ;mov dx, VGAREG_ACTL_RESET ; 3DAh 9890 00003BBE B2DA <1> mov dl, 0DAh 9891 00003BC0 EC <1> in al, dx 9892 <1> ;mov dx, VGAREG_ACTL_ADDRESS ; 3C0h 9893 00003BC1 B2C0 <1> mov dl, 0C0h 9894 00003BC3 EC <1> in al, dx 9895 00003BC4 AA <1> stosb 9896 00003BC5 88C4 <1> mov ah, al ; ar_index 9897 <1> ;mov dx, VGAREG_READ_FEATURE_CTL ; 3CAh 9898 00003BC7 B2CA <1> mov dl, 0CAh 9899 00003BC9 EC <1> in al, dx 9900 00003BCA AA <1> stosb 9901 <1> ; (5 bytes are writen above) 9902 <1> 9903 <1> ; for(i=1;i<=4;i++){ 9904 00003BCB B001 <1> mov al, 1 9905 <1> ;;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 9906 <1> ;mov dl, 0C4h 9907 00003BCD B504 <1> mov ch, 4 9908 <1> bfn_svs_0: 9909 <1> ; outb(VGAREG_SEQU_ADDRESS, i); 9910 <1> ;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 9911 00003BCF B2C4 <1> mov dl, 0C4h 9912 00003BD1 EE <1> out dx, al 9913 <1> ;mov dx, VGAREG_SEQU_DATA ; 3C5h 9914 00003BD2 FEC2 <1> inc dl ; dx = 3C5h 9915 <1> ; inb(VGAREG_SEQU_DATA) 9916 00003BD4 50 <1> push eax 9917 00003BD5 EC <1> in al, dx 9918 00003BD6 AA <1> stosb ; (4 bytes in loop) 9919 00003BD7 58 <1> pop eax 9920 <1> ;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 9921 <1> ;dec dl 9922 00003BD8 FEC0 <1> inc al ; i++ 9923 00003BDA FECD <1> dec ch 9924 00003BDC 75F1 <1> jnz short bfn_svs_0 9925 <1> 9926 <1> ; outb(VGAREG_SEQU_ADDRESS, 0); 9927 00003BDE 28C0 <1> sub al, al ; 0 9928 00003BE0 EE <1> out dx, al 9929 <1> ; inb(VGAREG_SEQU_DATA) 9930 <1> ;mov dx, VGAREG_SEQU_DATA ; 3C5h 9931 00003BE1 FEC2 <1> inc dl ; dx = 3C5h 9932 00003BE3 EC <1> in al, dx 9933 00003BE4 AA <1> stosb ; (+1 byte) 9934 <1> 9935 <1> ; for(i=0;i<=0x18;i++) { 9936 00003BE5 28C0 <1> sub al, al ; 0 9937 <1> ;;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 9938 <1> ;mov dl, 0D4h 9939 00003BE7 B519 <1> mov ch, 25 9940 <1> bfn_svs_1: 9941 <1> ; outb(crtc_addr,i); 9942 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 9943 00003BE9 B2D4 <1> mov dl, 0D4h 9944 00003BEB EE <1> out dx, al 9945 <1> ;mov dx, VGAREG_VGA_CRTC_DATA ; 3D5h 9946 00003BEC FEC2 <1> inc dl ; dx = 3D5h 9947 <1> ; inb(crtc_addr+1) 9948 00003BEE 50 <1> push eax 9949 00003BEF EC <1> in al, dx 9950 00003BF0 AA <1> stosb ; (25 bytes in loop) 9951 00003BF1 58 <1> pop eax 9952 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 9953 <1> ;dec dl 9954 00003BF2 FEC0 <1> inc al ; i++ 9955 00003BF4 FECD <1> dec ch 9956 00003BF6 75F1 <1> jnz short bfn_svs_1 9957 <1> 9958 00003BF8 80E420 <1> and ah, 20h ; (ar_index & 0x20) 9959 <1> ; for(i=0;i<=0x13;i++) { 9960 00003BFB 28C0 <1> sub al, al ; 0 9961 00003BFD B514 <1> mov ch, 20 9962 <1> bfn_svs_2: 9963 <1> ; inb(VGAREG_ACTL_RESET); 9964 <1> ;mov dx, VGAREG_ACTL_RESET ; 3DAh 9965 00003BFF B2DA <1> mov dl, 0DAh 9966 00003C01 50 <1> push eax 9967 00003C02 EC <1> in al, dx 9968 00003C03 8A0424 <1> mov al, [esp] 9969 <1> ; outb(VGAREG_ACTL_ADDRESS, i | (ar_index & 0x20)); 9970 00003C06 08E0 <1> or al, ah 9971 <1> ;mov dx, VGAREG_ACTL_ADDRESS ; 3C0h 9972 00003C08 B2C0 <1> mov dl, 0C0h 9973 00003C0A EE <1> out dx, al 9974 <1> ;mov dx, VGAREG_ACTL_READ_DATA ; 3C1h 9975 <1> ;mov dl, 0C1h 9976 00003C0B FEC2 <1> inc dl 9977 00003C0D EC <1> in al, dx 9978 00003C0E AA <1> stosb ; (20 bytes in loop) 9979 00003C0F 58 <1> pop eax 9980 00003C10 FEC0 <1> inc al ; i++ 9981 00003C12 FECD <1> dec ch 9982 00003C14 75E9 <1> jnz short bfn_svs_2 9983 <1> 9984 <1> ; inb(VGAREG_ACTL_RESET); 9985 <1> ;mov dx, VGAREG_ACTL_RESET ; 3DAh 9986 00003C16 B2DA <1> mov dl, 0DAh 9987 00003C18 EC <1> in al, dx 9988 <1> 9989 <1> ; for(i=0;i<=8;i++) { 9990 00003C19 28C0 <1> sub al, al ; 0 9991 <1> ;;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 9992 <1> ;mov dl, 0CEh 9993 00003C1B B509 <1> mov ch, 9 9994 <1> bfn_svs_3: 9995 <1> ; outb(VGAREG_GRDC_ADDRESS,i) 9996 <1> ;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 9997 00003C1D B2CE <1> mov dl, 0CEh 9998 00003C1F EE <1> out dx, al 9999 <1> ; inb(VGAREG_ACTL_READ_DATA) 10000 00003C20 50 <1> push eax 10001 <1> ;mov dx, VGAREG_GRDC_DATA ; 3CFh 10002 <1> ;mov dl, 0CFh 10003 00003C21 FEC2 <1> inc dl 10004 00003C23 EC <1> in al, dx 10005 00003C24 AA <1> stosb ; (9 bytes in loop) 10006 00003C25 58 <1> pop eax 10007 <1> ;dec dl 10008 00003C26 FEC0 <1> inc al ; i++ 10009 00003C28 FECD <1> dec ch 10010 00003C2A 75F1 <1> jnz short bfn_svs_3 10011 <1> 10012 <1> ; write_word(ES, BX, crtc_addr); BX+= 2; 10013 <1> ; (offset 64) 10014 00003C2C 66B8D403 <1> mov ax, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 10015 00003C30 66AB <1> stosw ; (2 bytes (1 word)) 10016 <1> 10017 <1> ; /* XXX: read plane latches */ 10018 00003C32 31C0 <1> xor eax, eax ; 0 10019 00003C34 AB <1> stosd ; (4 bytes) 10020 <1> 10021 <1> ; (total 70 bytes are written above as controller hardware state) 10022 <1> 10023 <1> bfn_svs_4: 10024 <1> ; 12/01/2021 (TRDOS 386 v2.0.3) 10025 00003C35 F6C102 <1> test cl, 2 10026 00003C38 7476 <1> jz short bfn_svs_6 10027 <1> 10028 <1> ; VIDEO BIOS DATA 10029 <1> ; !!! this data is valid for TRDOS 386 v2 kernel only !!! 10030 <1> ; (this is not same with BOCHS/PLEX86 video bios, BIOS data) 10031 <1> 10032 <1> ; if (CX & 2) { 10033 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE)); BX++; 10034 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS)); BX += 2; 10035 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)); BX += 2; 10036 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS)); BX += 2; 10037 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS)); BX++; 10038 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT)); BX += 2; 10039 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL)); BX++; 10040 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES)); BX++; 10041 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL)); BX++; 10042 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE)); BX += 2; 10043 <1> ;for(i=0;i<8;i++) { 10044 <1> ; write_word(ES, BX, read_word(BIOSMEM_SEG, BIOSMEM_CURSOR_POS+2*i)); 10045 <1> ; BX += 2; 10046 <1> ;} 10047 <1> ;write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CURRENT_START)); BX += 2; 10048 <1> ;write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE)); BX++; 10049 <1> ;/* current font */ 10050 <1> ;write_word(ES, BX, read_word(0, 0x1f * 4)); BX += 2; 10051 <1> ;write_word(ES, BX, read_word(0, 0x1f * 4 + 2)); BX += 2; 10052 <1> ;write_word(ES, BX, read_word(0, 0x43 * 4)); BX += 2; 10053 <1> ;write_word(ES, BX, read_word(0, 0x43 * 4 + 2)); BX += 2; 10054 <1> 10055 <1> ; !!! save TRDOS 386 v2 kernel spesific video bios data !!! 10056 <1> ; (which is/are used by 'SET_MODE' function and/or it's sub functions) 10057 <1> 10058 00003C3A 66B8D403 <1> mov ax, 3D4h ; CRTC_ADDR, always 3D4h (color VGA) for TRDOS 386 v2 10059 00003C3E 66AB <1> stosw 10060 00003C40 A0[2E680000] <1> mov al, [CRT_MODE] ; Current video mode (0FFh for VESA VBE modes) 10061 00003C45 AA <1> stosb 10062 00003C46 A0[2F680000] <1> mov al, [CRT_MODE_SET] ; 29h for mode 03h ; TRDOS 386 feature only ! 10063 00003C4B AA <1> stosb 10064 00003C4C 66A1[269D0100] <1> mov ax, [video_mode] ; Current VESA VBE (SVGA, extended VGA) mode 10065 00003C52 66AB <1> stosw ; (valid if [CRT_MODE] = 0FFh) 10066 00003C54 66A1[4C830100] <1> mov ax, [CRT_LEN] ; page size (in bytes) 10067 00003C5A 66AB <1> stosw 10068 00003C5C 66A1[CC760100] <1> mov ax, [CRT_START] ; video page start offset 10069 00003C62 66AB <1> stosw 10070 00003C64 A0[30680000] <1> mov al, [CRT_COLS] ; nbcols, characters per row 10071 00003C69 AA <1> stosb 10072 00003C6A A0[36680000] <1> mov al, [VGA_ROWS] ; nbrows, (character) rows per page (not rows-1) 10073 00003C6F AA <1> stosb 10074 00003C70 A0[32680000] <1> mov al, [CHAR_HEIGHT] ; character font height (8 or 16 or 14) 10075 00003C75 AA <1> stosb 10076 00003C76 A0[33680000] <1> mov al, [VGA_VIDEO_CTL] ; ROM BIOS DATA AREA Offset 87h 10077 00003C7B AA <1> stosb 10078 00003C7C A0[34680000] <1> mov al, [VGA_SWITCHES] ; feature bit switches 10079 00003C81 AA <1> stosb 10080 00003C82 A0[35680000] <1> mov al, [VGA_MODESET_CTL] ; basic mode set options 10081 00003C87 AA <1> stosb 10082 <1> ; followings are only used by TRDOS 386 v2 (IBM PC/AT ROMBIOS) code 10083 <1> ; (bochs/plex86 does not use and return those) 10084 00003C88 A0[31680000] <1> mov al, [CRT_PALETTE] ; current color palette ; TRDOS 386 feature only ! 10085 00003C8D AA <1> stosb 10086 00003C8E A0[DE760100] <1> mov al, [ACTIVE_PAGE] ; current video page 10087 00003C93 AA <1> stosb 10088 00003C94 66A1[47680000] <1> mov ax, [CURSOR_MODE] ; cursor type 10089 00003C9A 66AB <1> stosw 10090 <1> ;mov eax, [CURSOR_POSN] ; cursor position for video page 0 and 1 10091 <1> ;stosd 10092 <1> ;mov eax, [CURSOR_POSN+4] ; cursor position for video page 2 and 3 10093 <1> ;stosd 10094 <1> ;mov eax, [CURSOR_POSN+8] ; cursor position for video page 4 and 5 10095 <1> ;stosd 10096 <1> ;mov eax, [CURSOR_POSN+12] ; cursor position for video page 6 and 7 10097 <1> ;stosd 10098 00003C9C 56 <1> push esi 10099 00003C9D B504 <1> mov ch, 4 10100 00003C9F BE[CE760100] <1> mov esi, CURSOR_POSN 10101 <1> bfn_svs_5: 10102 00003CA4 A5 <1> movsd 10103 00003CA5 FECD <1> dec ch 10104 00003CA7 75FB <1> jnz short bfn_svs_5 10105 00003CA9 5E <1> pop esi 10106 <1> ; (font addr) protected mode address in kernel's/system memory space 10107 <1> ; (not accessable/meaningful address value by user) 10108 00003CAA A1[5E830100] <1> mov eax, [VGA_INT43H] ; VGA current (default) font address 10109 00003CAF AB <1> stosd 10110 <1> 10111 <1> ; (total 40 bytes are written above as BIOS data state) 10112 <1> 10113 <1> bfn_svs_6: 10114 <1> ; 12/01/2021 10115 00003CB0 F6C104 <1> test cl, 4 10116 00003CB3 7422 <1> jz short bfn_svs_8 10117 <1> 10118 <1> ;/* XXX: check this */ 10119 <1> ; /* read/write mode dac */ 10120 <1> ;write_byte(ES, BX, inb(VGAREG_DAC_STATE)); BX++; 10121 <1> ; ; /* pix address */ 10122 <1> ;write_byte(ES, BX, inb(VGAREG_DAC_WRITE_ADDRESS)); BX++; 10123 <1> ;write_byte(ES, BX, inb(VGAREG_PEL_MASK)); BX++; 10124 <1> ;// Set the whole dac always, from 0 10125 <1> ;outb(VGAREG_DAC_WRITE_ADDRESS,0x00); 10126 <1> ;for(i=0;i<256*3;i++) { 10127 <1> ; write_byte(ES, BX, inb(VGAREG_DAC_DATA)); BX++; 10128 <1> ;} 10129 <1> ;write_byte(ES, BX, 0); BX++; /* color select register */ 10130 <1> 10131 <1> ; /* read/write mode dac */ 10132 00003CB5 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_STATE 10133 00003CB9 EC <1> in al, dx 10134 00003CBA AA <1> stosb 10135 <1> ; /* pix address */ 10136 <1> ;mov dx, VGAREG_DAC_WRITE_ADDRESS ; 3C8h 10137 <1> ;mov dl, 0C8h 10138 00003CBB FEC2 <1> inc dl 10139 00003CBD EC <1> in al, dx 10140 00003CBE AA <1> stosb 10141 <1> ;mov dx, VGAREG_PEL_MASK ; 3C6h 10142 00003CBF B2C6 <1> mov dl, 0C6h 10143 00003CC1 EC <1> in al, dx 10144 00003CC2 AA <1> stosb 10145 <1> ;// Set the whole dac always, from 0 10146 00003CC3 30C0 <1> xor al, al ; 0 10147 <1> ;mov dx, VGAREG_DAC_WRITE_ADDRESS ; 3C8h 10148 00003CC5 B2C8 <1> mov dl, 0C8h 10149 00003CC7 EE <1> out dx, al 10150 <1> 10151 00003CC8 51 <1> push ecx ; 22/01/2021 10152 <1> ;for(i=0;i<256*3;i++) { 10153 <1> ;mov ecx, 256*3 ; 768 bytes 10154 <1> ; 03/08/2022 10155 00003CC9 29C9 <1> sub ecx, ecx 10156 00003CCB B503 <1> mov ch, 3 10157 <1> ; ecx = 300h = 768 10158 <1> ;mov dx, VGAREG_DAC_DATA ; 3C9h 10159 <1> ;mov dl, 0C9h 10160 00003CCD FEC2 <1> inc dl ; dx = 3C9h 10161 <1> bfn_svs_7: 10162 00003CCF EC <1> in al, dx 10163 00003CD0 AA <1> stosb 10164 00003CD1 E2FC <1> loop bfn_svs_7 10165 00003CD3 59 <1> pop ecx ; 22/01/2021 10166 <1> 10167 <1> ; /* color select register */ 10168 00003CD4 28C0 <1> sub al, al ; 0 10169 00003CD6 AA <1> stosb 10170 <1> 10171 <1> ; (total 772 bytes are written above as DAC state) 10172 <1> bfn_svs_8: 10173 00003CD7 C3 <1> retn 10174 <1> 10175 <1> vbe_biosfn_save_video_state: 10176 <1> ; 23/01/2021 10177 <1> ; 13/01/2021 10178 <1> ; 12/01/2021 (TRDOS 386 v2.0.3) 10179 <1> ; (vbe.c) 10180 <1> 10181 <1> ; modified registers: eax, edx, edi, ch 10182 <1> 10183 <1> ; input: edi = state buffer address 10184 <1> ; output: 10185 <1> ; VBE DISPI register contents will be saved 10186 <1> ; (18 bytes, 9 words) 10187 <1> 10188 <1> ; outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); 10189 <1> ; enable = inw(VBE_DISPI_IOPORT_DATA); 10190 <1> ; write_word(ES, BX, enable); 10191 <1> ; BX += 2; 10192 <1> ; if (!(enable & VBE_DISPI_ENABLED)) 10193 <1> ; return; 10194 <1> ; for(i = VBE_DISPI_INDEX_XRES; 10195 <1> ; i <= VBE_DISPI_INDEX_Y_OFFSET; i++) { 10196 <1> ; if (i != VBE_DISPI_INDEX_ENABLE) { 10197 <1> ; outw(VBE_DISPI_IOPORT_INDEX, i); 10198 <1> ; write_word(ES, BX, inw(VBE_DISPI_IOPORT_DATA)); 10199 <1> ; BX += 2; 10200 <1> ; } 10201 <1> ; } 10202 <1> 10203 00003CD8 66BACE01 <1> mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10204 <1> ;mov eax, 04h ; VBE_DISPI_INDEX_ENABLE 10205 <1> ;03/08/2022 10206 00003CDC 66EF <1> out dx, ax 10207 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10208 00003CDE FEC2 <1> inc dl 10209 00003CE0 66ED <1> in ax, dx ; enable (status) 10210 00003CE2 66AB <1> stosw 10211 00003CE4 6683E001 <1> and ax, 1 ; VBE_DISPI_ENABLED 10212 00003CE8 7505 <1> jnz short vbe_bfn_svs_0 10213 <1> ; 23/01/2021 10214 <1> ; ax = 0 10215 <1> ; VBE_DISPI_DISABLED 10216 <1> ; 13/01/2021 10217 <1> ; clear remain 8 bytes 10218 <1> ;xor eax, eax 10219 00003CEA AB <1> stosd ; 2 10220 00003CEB AB <1> stosd ; 2 10221 00003CEC AB <1> stosd ; 2 10222 00003CED AB <1> stosd ; 2 10223 00003CEE C3 <1> retn 10224 <1> vbe_bfn_svs_0: 10225 <1> ; VBE_DISPI_ENABLED 10226 <1> 10227 <1> ;sub eax, eax 10228 00003CEF 28C0 <1> sub al, al ; eax = 0 10229 <1> 10230 <1> ; from VBE_DISPI_INDEX_XRES 10231 <1> ; to VBE_DISPI_INDEX_BPP 10232 <1> 10233 00003CF1 B503 <1> mov ch, 3 10234 <1> ; al = 0 ; VBE_DISPI_INDEX_XRES - 1 10235 <1> 10236 00003CF3 E804000000 <1> call vbe_bfn_svs_1 10237 <1> 10238 <1> ; from VBE_DISPI_INDEX_BANK 10239 <1> ; to VBE_DISPI_INDEX_Y_OFFSET 10240 <1> 10241 00003CF8 FEC0 <1> inc al 10242 <1> ; al = 4 ; VBE_DISPI_INDEX_BANK - 1 10243 <1> 10244 00003CFA B505 <1> mov ch, 5 10245 <1> vbe_bfn_svs_1: 10246 00003CFC FEC0 <1> inc al ; from VBE_DISPI_INDEX_XRES 10247 <1> ; to VBE_DISPI_INDEX_BPP 10248 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10249 00003CFE FECA <1> dec dl ; 1CEh 10250 00003D00 66EF <1> out dx, ax 10251 00003D02 50 <1> push eax 10252 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10253 00003D03 FEC2 <1> inc dl ; 1CFh 10254 00003D05 66ED <1> in ax, dx 10255 00003D07 66AB <1> stosw 10256 00003D09 58 <1> pop eax 10257 00003D0A FECD <1> dec ch 10258 00003D0C 75EE <1> jnz short vbe_bfn_svs_1 10259 00003D0E C3 <1> retn 10260 <1> 10261 <1> biosfn_restore_video_state: 10262 <1> ; 22/01/2021 10263 <1> ; 13/01/2021 10264 <1> ; 12/01/2021 (TRDOS 386 v2.0.3) 10265 <1> ; (vgabios.c) 10266 <1> 10267 <1> ; modified registers: eax, edx, esi, edi, ch 10268 <1> 10269 <1> ;mov esi, VBE3SAVERESTOREBLOCK 10270 <1> 10271 <1> ; input: esi = state buffer address 10272 <1> 10273 00003D0F F6C101 <1> test cl, 1 10274 00003D12 0F84A9000000 <1> jz bfn_rvs_6 10275 <1> 10276 00003D18 66817E40D403 <1> cmp word [esi+64], 3D4h ; must be 3D4h 10277 00003D1E 7402 <1> je short bfn_rvs_0 10278 <1> ; it is seen as valid buffer 10279 00003D20 F9 <1> stc 10280 00003D21 C3 <1> retn 10281 <1> 10282 <1> bfn_rvs_0: 10283 00003D22 89F7 <1> mov edi, esi ; addr1 10284 00003D24 83C605 <1> add esi, 5 ; skip 1st 5 bytes for now 10285 <1> 10286 <1> ; // Reset Attribute Ctl flip-flop 10287 <1> ; inb(VGAREG_ACTL_RESET); 10288 00003D27 66BADA03 <1> mov dx, 3DAh ; VGAREG_ACTL_RESET 10289 00003D2B EC <1> in al, dx 10290 <1> 10291 <1> ; for(i=1;i<=4;i++){ 10292 00003D2C B001 <1> mov al, 1 10293 <1> ;;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 10294 <1> ;mov dl, 0C4h 10295 00003D2E B504 <1> mov ch, 4 10296 <1> bfn_rvs_1: 10297 <1> ; outb(VGAREG_SEQU_ADDRESS, i); 10298 <1> ;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 10299 00003D30 B2C4 <1> mov dl, 0C4h 10300 00003D32 EE <1> out dx, al 10301 <1> ;mov dx, VGAREG_SEQU_DATA ; 3C5h 10302 00003D33 FEC2 <1> inc dl ; dx = 3C5h 10303 <1> ; outb(VGAREG_SEQU_DATA) 10304 00003D35 50 <1> push eax 10305 00003D36 AC <1> lodsb ; (4 bytes in loop) 10306 00003D37 EE <1> out dx, al 10307 00003D38 58 <1> pop eax 10308 <1> ;mov dx, VGAREG_SEQU_ADDRESS ; 3C4h 10309 <1> ;dec dl 10310 00003D39 FEC0 <1> inc al ; i++ 10311 00003D3B FECD <1> dec ch 10312 00003D3D 75F1 <1> jnz short bfn_rvs_1 10313 <1> 10314 <1> ; outb(VGAREG_SEQU_ADDRESS, 0); 10315 00003D3F 28C0 <1> sub al, al ; 0 10316 00003D41 EE <1> out dx, al 10317 <1> ; outb(VGAREG_SEQU_DATA) 10318 <1> ;mov dx, VGAREG_SEQU_DATA ; 3C5h 10319 00003D42 FEC2 <1> inc dl ; dx = 3C5h 10320 00003D44 AC <1> lodsb ; (+1 byte) 10321 00003D45 EE <1> out dx, al 10322 <1> 10323 <1> ; // Disable CRTC write protection 10324 <1> ; outw(crtc_addr,0x0011); 10325 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10326 00003D46 B2D4 <1> mov dl, 0D4h 10327 00003D48 66B81100 <1> mov ax, 11h 10328 00003D4C 66EF <1> out dx, ax 10329 <1> 10330 <1> ; // Set CRTC regs 10331 <1> 10332 <1> ; for(i=0;i<=0x18;i++) { 10333 <1> ; if (i != 0x11) { 10334 00003D4E 28C0 <1> sub al, al ; 0 10335 <1> ;;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10336 <1> ;mov dl, 0D4h 10337 00003D50 B519 <1> mov ch, 25 10338 <1> bfn_rvs_2: 10339 <1> ; outb(crtc_addr,i); 10340 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10341 00003D52 B2D4 <1> mov dl, 0D4h 10342 00003D54 EE <1> out dx, al 10343 <1> ;mov dx, VGAREG_VGA_CRTC_DATA ; 3D5h 10344 00003D55 FEC2 <1> inc dl ; dx = 3D5h 10345 <1> ; inb(crtc_addr+1) 10346 00003D57 50 <1> push eax 10347 00003D58 AC <1> lodsb ; (25 bytes in loop) 10348 00003D59 EE <1> out dx, al 10349 00003D5A 58 <1> pop eax 10350 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10351 <1> ;dec dl 10352 00003D5B FEC0 <1> inc al ; i++ 10353 00003D5D 3C11 <1> cmp al, 17 ; 11h 10354 00003D5F 7505 <1> jne short bfn_rvs_3 10355 00003D61 AC <1> lodsb 10356 00003D62 88C4 <1> mov ah, al ; * 10357 00003D64 B012 <1> mov al, 18 10358 <1> bfn_rvs_3: 10359 00003D66 FECD <1> dec ch 10360 00003D68 75E8 <1> jnz short bfn_rvs_2 10361 <1> 10362 <1> ; // select crtc base address 10363 <1> ; v = inb(VGAREG_READ_MISC_OUTPUT) & ~0x01; 10364 <1> ;if (crtc_addr = 0x3d4) 10365 <1> ; v |= 0x01; 10366 <1> ; outb(VGAREG_WRITE_MISC_OUTPUT, v); 10367 <1> 10368 <1> ;;mov dx, VGAREG_READ_MISC_OUTPUT ; 3CCh 10369 <1> ;mov dl, 0CCh 10370 <1> ;in al, dl 10371 <1> ;and al, 1 10372 <1> ;;mov dx, VGAREG_WRITE_MISC_OUTPUT ; 3C2h 10373 <1> ;mov dl, 0C2h 10374 <1> ;or al, 1 10375 <1> ;out dx, al 10376 <1> 10377 <1> ; // enable write protection if needed 10378 <1> ;outb(crtc_addr, 0x11); 10379 <1> ;outb(crtc_addr+1, read_byte(ES, BX - 0x18 + 0x11)); 10380 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10381 00003D6A B2D4 <1> mov dl, 0D4h 10382 00003D6C B011 <1> mov al, 11h 10383 00003D6E EE <1> out dx, al 10384 00003D6F 88E0 <1> mov al, ah ; * 10385 00003D71 FEC2 <1> inc dl ; dx = 3D5h 10386 00003D73 EE <1> out dx, al 10387 <1> 10388 <1> ; // Set Attribute Ctl 10389 00003D74 8A6703 <1> mov ah, [edi+3] ; addr1+3, ah = ar_index 10390 00003D77 80E420 <1> and ah, 20h ; (ar_index & 0x20) 10391 <1> 10392 <1> ; inb(VGAREG_ACTL_RESET); 10393 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 10394 00003D7A B2DA <1> mov dl, 0DAh 10395 00003D7C EC <1> in al, dx 10396 <1> 10397 <1> ; for(i=0;i<=0x13;i++) { 10398 00003D7D 28C0 <1> sub al, al ; 0 10399 00003D7F B514 <1> mov ch, 20 10400 <1> bfn_rvs_4: 10401 <1> ; outb(VGAREG_ACTL_ADDRESS, i | (ar_index & 0x20)); 10402 00003D81 50 <1> push eax 10403 00003D82 08E0 <1> or al, ah 10404 <1> ;mov dx, VGAREG_ACTL_ADDRESS ; 3C0h 10405 00003D84 B2C0 <1> mov dl, 0C0h 10406 00003D86 EE <1> out dx, al 10407 <1> ;mov dx, VGAREG_ACTL_WRITE_DATA ; 3C0h 10408 <1> ;mov dl, 0C0h 10409 00003D87 AC <1> lodsb ; (20 bytes in loop) 10410 00003D88 EE <1> out dx, al 10411 00003D89 58 <1> pop eax 10412 00003D8A FEC0 <1> inc al ; i++ 10413 00003D8C FECD <1> dec ch 10414 00003D8E 75F1 <1> jnz short bfn_rvs_4 10415 <1> 10416 <1> ; outb(VGAREG_ACTL_ADDRESS, ar_index); 10417 <1> ;mov dx, VGAREG_ACTL_ADDRESS ; 3C0h 10418 <1> ;mov dl, 0C0h 10419 00003D90 88E0 <1> mov al, ah ; ar_index 10420 00003D92 EE <1> out dx, al 10421 <1> 10422 <1> ; inb(VGAREG_ACTL_RESET); 10423 <1> ;mov dx, VGAREG_ACTL_RESET ; 3DAh 10424 00003D93 B2DA <1> mov dl, 0DAh 10425 00003D95 EC <1> in al, dx 10426 <1> 10427 <1> ; for(i=0;i<=8;i++) { 10428 00003D96 28C0 <1> sub al, al ; 0 10429 <1> ;;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 10430 <1> ;mov dl, 0CEh 10431 00003D98 B509 <1> mov ch, 9 10432 <1> bfn_rvs_5: 10433 <1> ; outb(VGAREG_GRDC_ADDRESS,i) 10434 <1> ;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 10435 00003D9A B2CE <1> mov dl, 0CEh 10436 00003D9C EE <1> out dx, al 10437 <1> ; outb(VGAREG_ACTL_READ_DATA) 10438 00003D9D 50 <1> push eax 10439 <1> ;mov dx, VGAREG_GRDC_DATA ; 3CFh 10440 <1> ;mov dl, 0CFh 10441 00003D9E FEC2 <1> inc dl 10442 00003DA0 AC <1> lodsb ; (9 bytes in loop) 10443 00003DA1 EE <1> out dx, al 10444 00003DA2 58 <1> pop eax 10445 <1> ;dec dl 10446 00003DA3 FEC0 <1> inc al ; i++ 10447 00003DA5 FECD <1> dec ch 10448 00003DA7 75F1 <1> jnz short bfn_rvs_5 10449 <1> 10450 <1> ; BX += 2; /* crtc_addr */ ; 3D4h 10451 <1> ; BX += 4; /* plane latches */ ; 0 10452 00003DA9 83C606 <1> add esi, 6 10453 00003DAC 56 <1> push esi ; * 10454 <1> 10455 <1> ;outb(VGAREG_SEQU_ADDRESS, read_byte(ES, addr1)); addr1++; 10456 <1> ;outb(crtc_addr, read_byte(ES, addr1)); addr1++; 10457 <1> ;outb(VGAREG_GRDC_ADDRESS, read_byte(ES, addr1)); addr1++; 10458 <1> ;addr1++; 10459 <1> ;outb(crtc_addr - 0x4 + 0xa, read_byte(ES, addr1)); addr1++; 10460 <1> 10461 00003DAD 89FE <1> mov esi, edi ; start of state buffer 10462 <1> 10463 <1> ;mov dx, VGAREG_SEQU_ADDRESS ; 3C7h 10464 00003DAF B2C7 <1> mov dl, 0C7h 10465 00003DB1 AC <1> lodsb 10466 00003DB2 EE <1> out dx, al 10467 <1> ;mov dx, VGAREG_VGA_CRTC_ADDRESS ; 3D4h 10468 00003DB3 B2D4 <1> mov dl, 0D4h 10469 00003DB5 AC <1> lodsb 10470 00003DB6 EE <1> out dx, al 10471 <1> ;mov dx, VGAREG_GRDC_ADDRESS ; 3CEh 10472 00003DB7 B2CE <1> mov dl, 0CEh 10473 00003DB9 AC <1> lodsb 10474 00003DBA EE <1> out dx, al 10475 00003DBB AC <1> lodsb ; addr1++ 10476 <1> ;mov dx, VGAREG_VGA_WRITE_FEATURE_CTL ; 3DAh 10477 00003DBC B2DA <1> mov dl, 0DAh 10478 00003DBE AC <1> lodsb 10479 00003DBF EE <1> out dx, al 10480 <1> 10481 00003DC0 5E <1> pop esi ; * 10482 <1> 10483 <1> ; (total 70 bytes are read above as controller hardware state) 10484 <1> 10485 <1> bfn_rvs_6: 10486 <1> ; 13/01/2021 10487 00003DC1 F6C102 <1> test cl, 2 10488 00003DC4 747D <1> jz short bfn_rvs_9 10489 <1> 10490 <1> ; VIDEO BIOS DATA 10491 <1> ; !!! this data is valid for TRDOS 386 v2 kernel only !!! 10492 <1> ; (this is not same with BOCHS/PLEX86 video bios, BIOS data) 10493 <1> 10494 <1> ; if (CX & 2) { 10495 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE, read_byte(ES, BX)); BX++; 10496 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_NB_COLS, read_word(ES, BX)); BX += 2; 10497 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE, read_word(ES, BX)); BX += 2; 10498 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS, read_word(ES, BX)); BX += 2; 10499 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, read_byte(ES, BX)); BX++; 10500 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT, read_word(ES, BX)); BX += 2; 10501 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL, read_byte(ES, BX)); BX++; 10502 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES, read_byte(ES, BX)); BX++; 10503 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL, read_byte(ES, BX)); BX++; 10504 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE, read_word(ES, BX)); BX += 2; 10505 <1> ;for(i=0;i<8;i++) { 10506 <1> ; write_word(BIOSMEM_SEG, BIOSMEM_CURSOR_POS+2*i, read_word(ES, BX)); 10507 <1> ; BX += 2; 10508 <1> ;} 10509 <1> ;write_word(BIOSMEM_SEG,BIOSMEM_CURRENT_START, read_word(ES, BX)); BX += 2; 10510 <1> ;write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE, read_byte(ES, BX)); BX++; 10511 <1> ;/* current font */ 10512 <1> ;write_word(0, 0x1f * 4, read_word(ES, BX)); BX += 2; 10513 <1> ;write_word(0, 0x1f * 4 + 2, read_word(ES, BX)); BX += 2; 10514 <1> ;write_word(0, 0x43 * 4, read_word(ES, BX)); BX += 2; 10515 <1> ;write_word(0, 0x43 * 4 + 2, read_word(ES, BX)); BX += 2; 10516 <1> 10517 <1> ; !!! save TRDOS 386 v2 kernel spesific video bios data !!! 10518 <1> ; (which is/are used by 'SET_MODE' function and/or it's sub functions) 10519 <1> 10520 00003DC6 66AD <1> lodsw ; CRTC_ADDR, always 3D4h (color VGA) for TRDOS 386 v2 10521 <1> ; skip 3D4h check if it is already checked 10522 00003DC8 F6C101 <1> test cl, 1 10523 00003DCB 7508 <1> jnz short bfn_rvs_7 10524 00003DCD 663DD403 <1> cmp ax, 3D4h 10525 00003DD1 7402 <1> je short bfn_rvs_7 10526 00003DD3 F9 <1> stc 10527 00003DD4 C3 <1> retn 10528 <1> bfn_rvs_7: 10529 00003DD5 AC <1> lodsb 10530 00003DD6 A2[2E680000] <1> mov [CRT_MODE], al ; Current video mode (0FFh for VESA VBE modes) 10531 00003DDB AC <1> lodsb 10532 00003DDC A2[2F680000] <1> mov [CRT_MODE_SET], al ; 29h for mode 03h ; TRDOS 386 feature only ! 10533 00003DE1 66AD <1> lodsw 10534 00003DE3 66A3[269D0100] <1> mov [video_mode], ax ; Current VESA VBE (SVGA, extended VGA) mode 10535 00003DE9 66AD <1> lodsw ; (valid if [CRT_MODE] = 0FFh) 10536 00003DEB 66A3[4C830100] <1> mov [CRT_LEN], ax ; page size (in bytes) 10537 00003DF1 66AD <1> lodsw 10538 00003DF3 66A3[CC760100] <1> mov [CRT_START], ax ; video page start offset 10539 00003DF9 AC <1> lodsb 10540 00003DFA A2[30680000] <1> mov [CRT_COLS], al ; nbcols, characters per row 10541 00003DFF AC <1> lodsb 10542 00003E00 A2[36680000] <1> mov [VGA_ROWS], al ; nbrows, (character) rows per page (not rows-1) 10543 00003E05 AC <1> lodsb 10544 00003E06 A2[32680000] <1> mov [CHAR_HEIGHT], al ; character font height (8 or 16 or 14) 10545 00003E0B AC <1> lodsb 10546 00003E0C A2[33680000] <1> mov [VGA_VIDEO_CTL], al ; ROM BIOS DATA AREA Offset 87h 10547 00003E11 AC <1> lodsb 10548 00003E12 A2[34680000] <1> mov [VGA_SWITCHES], al ; feature bit switches 10549 00003E17 AC <1> lodsb 10550 00003E18 A2[35680000] <1> mov [VGA_MODESET_CTL], al ; basic mode set options 10551 <1> ; followings are only used by TRDOS 386 v2 (IBM PC/AT ROMBIOS) code 10552 <1> ; (bochs/plex86 does not use and return those) 10553 00003E1D AC <1> lodsb 10554 00003E1E A2[31680000] <1> mov [CRT_PALETTE], al ; current color palette ; TRDOS 386 feature only ! 10555 00003E23 AC <1> lodsb 10556 00003E24 A2[DE760100] <1> mov [ACTIVE_PAGE], al ; current video page 10557 00003E29 66AD <1> lodsw 10558 00003E2B 66A3[47680000] <1> mov [CURSOR_MODE], ax ; cursor type 10559 <1> ;lodsd 10560 <1> ;mov [CURSOR_POSN], eax ; cursor position for video page 0 and 1 10561 <1> ;lodsd 10562 <1> ;mov [CURSOR_POSN+4], eax ; cursor position for video page 2 and 3 10563 <1> ;lodsd 10564 <1> ;mov [CURSOR_POSN+8], eax ; cursor position for video page 4 and 5 10565 <1> ;lodsd 10566 <1> ;mov [CURSOR_POSN+12], eax ; cursor position for video page 6 and 7 10567 00003E31 B504 <1> mov ch, 4 10568 00003E33 BF[CE760100] <1> mov edi, CURSOR_POSN 10569 <1> bfn_rvs_8: 10570 00003E38 A5 <1> movsd 10571 00003E39 FECD <1> dec ch 10572 00003E3B 75FB <1> jnz short bfn_rvs_8 10573 <1> ; (font addr) protected mode address in kernel's/system memory space 10574 <1> ; (not accessable/meaningful address value by user) 10575 00003E3D AD <1> lodsd 10576 00003E3E A3[5E830100] <1> mov [VGA_INT43H], eax ; VGA current (default) font address 10577 <1> 10578 <1> ; (total 40 bytes are read&written above as BIOS data state) 10579 <1> bfn_rvs_9: 10580 <1> ; 13/01/2021 10581 00003E43 F6C104 <1> test cl, 4 10582 00003E46 7421 <1> jz short bfn_rvs_11 10583 <1> 10584 <1> ;BX++; 10585 <1> ;v = read_byte(ES, BX); BX++; 10586 <1> ;outb(VGAREG_PEL_MASK, read_byte(ES, BX)); BX++; 10587 <1> ;// Set the whole dac always, from 0 10588 <1> ;outb(VGAREG_DAC_WRITE_ADDRESS,0x00); 10589 <1> ;for(i=0;i<256*3;i++) { 10590 <1> ; outb(VGAREG_DAC_DATA, read_byte(ES, BX)); BX++; 10591 <1> ;} 10592 <1> ;BX++; 10593 <1> ;outb(VGAREG_DAC_WRITE_ADDRESS, v); 10594 <1> 10595 <1> ; /* read/write mode dac */ 10596 00003E48 AC <1> lodsb ; skip ; VGAREG_DAC_STATE 10597 00003E49 AC <1> lodsb 10598 00003E4A 88C4 <1> mov ah, al ; * ; v 10599 00003E4C AC <1> lodsb 10600 00003E4D 66BAC603 <1> mov dx, VGAREG_PEL_MASK ; 3C6h 10601 00003E51 EE <1> out dx, al 10602 <1> ;// Set the whole dac always, from 0 10603 00003E52 30C0 <1> xor al, al ; 0 10604 <1> ;mov dx, VGAREG_DAC_WRITE_ADDRESS ; 3C8h 10605 00003E54 B2C8 <1> mov dl, 0C8h 10606 00003E56 EE <1> out dx, al 10607 <1> 10608 00003E57 51 <1> push ecx ; 22/01/2021 10609 <1> ;for(i=0;i<256*3;i++) { 10610 <1> ;mov ecx, 256*3 ; 768 bytes 10611 <1> ; 03/08/2022 10612 00003E58 29C9 <1> sub ecx, ecx 10613 00003E5A B503 <1> mov ch, 3 10614 <1> ; ecx = 300h = 768 10615 <1> ;mov dx, VGAREG_DAC_DATA ; 3C9h 10616 <1> ;mov dl, 0C9h 10617 00003E5C FEC2 <1> inc dl ; dx = 3C9h 10618 <1> bfn_rvs_10: 10619 00003E5E AC <1> lodsb 10620 00003E5F EE <1> out dx, al 10621 00003E60 E2FC <1> loop bfn_rvs_10 10622 00003E62 59 <1> pop ecx ; 22/01/2021 10623 <1> 10624 <1> ; /* color select register */ 10625 00003E63 AC <1> lodsb ; skip 10626 <1> 10627 00003E64 88E0 <1> mov al, ah ; * ; v 10628 <1> 10629 <1> ;mov dx, VGAREG_DAC_WRITE_ADDRESS ; 3C8h 10630 <1> ;mov dl, 0C8h 10631 00003E66 FECA <1> dec dl ; dx = 3C8h 10632 00003E68 EE <1> out dx, al ; * ; v 10633 <1> 10634 <1> ; (total 772 bytes are read above as DAC state) 10635 <1> bfn_rvs_11: 10636 00003E69 C3 <1> retn 10637 <1> 10638 <1> vbe_biosfn_restore_video_state: 10639 <1> ; 23/01/2021 10640 <1> ; 13/01/2021 (TRDOS 386 v2.0.3) 10641 <1> ; (vbe.c) 10642 <1> 10643 <1> ; modified registers: eax, edx, esi, ch 10644 <1> 10645 <1> ; input: esi = state buffer address 10646 <1> ; output: 10647 <1> ; VBE DISPI register contents will be restored 10648 <1> ; (18 bytes, 9 words) 10649 <1> 10650 <1> ; enable = read_word(ES, BX); 10651 <1> ; BX += 2; 10652 <1> ; 10653 <1> ; if (!(enable & VBE_DISPI_ENABLED)) { 10654 <1> ; outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); 10655 <1> ; outw(VBE_DISPI_IOPORT_DATA, enable); 10656 <1> ; } else { 10657 <1> ; outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES); 10658 <1> ; outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX)); 10659 <1> ; BX += 2; 10660 <1> ; outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES); 10661 <1> ; outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX)); 10662 <1> ; BX += 2; 10663 <1> ; outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP); 10664 <1> ; outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX)); 10665 <1> ; BX += 2; 10666 <1> ; outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); 10667 <1> ; outw(VBE_DISPI_IOPORT_DATA, enable); 10668 <1> ; 10669 <1> ; for(i = VBE_DISPI_INDEX_BANK; i <= VBE_DISPI_INDEX_Y_OFFSET; i++) 10670 <1> ; { 10671 <1> ; outw(VBE_DISPI_IOPORT_INDEX, i); 10672 <1> ; outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX)); 10673 <1> ; BX += 2; 10674 <1> ; } 10675 <1> ; } 10676 <1> 10677 00003E6A 66AD <1> lodsw ; enable (status, enabled=1, disabled=0) 10678 00003E6C 66BACE01 <1> mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10679 <1> ; 23/01/2021 10680 00003E70 6683E001 <1> and ax, 1 ; VBE_DISPI_ENABLED 10681 00003E74 750B <1> jnz short vbe_bfn_rvs_1 10682 <1> ; ax = 0 10683 <1> ; VBE_DISPI_DISABLED 10684 <1> vbe_bfn_rvs_0: 10685 <1> ; enable (disable) dispi 10686 <1> ; dx = 01CEh ; VBE_DISPI_IOPORT_INDEX 10687 <1> ; ah = 0 10688 00003E76 50 <1> push eax 10689 00003E77 B004 <1> mov al, 04h ; VBE_DISPI_INDEX_ENABLE 10690 00003E79 66EF <1> out dx, ax 10691 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10692 00003E7B FEC2 <1> inc dl 10693 00003E7D 58 <1> pop eax 10694 00003E7E 66EF <1> out dx, ax ; enable (or disable) 10695 00003E80 C3 <1> retn 10696 <1> vbe_bfn_rvs_1: 10697 <1> ; VBE_DISPI_ENABLED 10698 <1> 10699 <1> ; from VBE_DISPI_INDEX_XRES 10700 <1> ; to VBE_DISPI_INDEX_BPP 10701 <1> 10702 00003E81 B503 <1> mov ch, 3 10703 00003E83 28C0 <1> sub al, al ; 0 ; VBE_DISPI_INDEX_XRES - 1 10704 <1> ; ax = 0 10705 <1> 10706 00003E85 E80B000000 <1> call vbe_bfn_rvs_2 10707 <1> 10708 <1> ;outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); 10709 <1> ;outw(VBE_DISPI_IOPORT_DATA, enable); 10710 <1> 10711 <1> ; 23/01/2021 10712 00003E8A B001 <1> mov al, 1 ; VBE_DISPI_ENABLED 10713 <1> ; ax = 1 10714 00003E8C E8E5FFFFFF <1> call vbe_bfn_rvs_0 10715 <1> 10716 <1> ; from VBE_DISPI_INDEX_BANK 10717 <1> ; to VBE_DISPI_INDEX_Y_OFFSET 10718 <1> 10719 00003E91 B505 <1> mov ch, 5 10720 <1> ; 23/01/2021 10721 00003E93 B004 <1> mov al, 4 ; VBE_DISPI_INDEX_BANK - 1 10722 <1> ; ax = 4 10723 <1> vbe_bfn_rvs_2: 10724 00003E95 FEC0 <1> inc al ; from VBE_DISPI_INDEX_XRES 10725 <1> ; to VBE_DISPI_INDEX_BPP 10726 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10727 <1> ;mov dl, 0CEh 10728 00003E97 66EF <1> out dx, ax 10729 00003E99 50 <1> push eax 10730 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10731 00003E9A FEC2 <1> inc dl ; 1CFh 10732 00003E9C 66AD <1> lodsw 10733 00003E9E 66EF <1> out dx, ax 10734 00003EA0 58 <1> pop eax 10735 00003EA1 FECA <1> dec dl ; 1CEh 10736 00003EA3 FECD <1> dec ch 10737 00003EA5 75EE <1> jnz short vbe_bfn_rvs_2 10738 00003EA7 C3 <1> retn 10739 <1> 10740 <1> ; --------------------------------------------------------- 10741 <1> 10742 <1> dispi_set_enable: 10743 <1> ; 03/08/2022 10744 <1> ; 23/11/2020 10745 <1> ; Input: 10746 <1> ; ax = VBE_DISPI_ENABLED = 1 10747 <1> ; or VBE_DISPI_DISABLED = 0 10748 <1> ; 10749 <1> ; Modified registers: none 10750 <1> 10751 <1> ;push edx 10752 <1> ;push eax 10753 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10754 <1> ;mov ax, 04h ; VBE_DISPI_INDEX_ENABLE 10755 <1> ;out dx, ax 10756 <1> ;pop eax 10757 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10758 <1> ;;mov dl, 0CFh 10759 <1> ;inc dl 10760 <1> ;out dx, ax 10761 <1> ;pop edx 10762 <1> ;retn 10763 <1> 10764 <1> ; 25/11/2020 10765 <1> ; Modified registers: edx 10766 <1> ;;push edx 10767 <1> ;mov dx, 04h ; VBE_DISPI_INDEX_ENABLE 10768 <1> ; 03/08/2022 10769 00003EA8 28F6 <1> sub dh, dh 10770 00003EAA B204 <1> mov dl, 04h ; VBE_DISPI_INDEX_ENABLE 10771 <1> 10772 <1> ;;call dispi_set_parms 10773 <1> ;;pop edx 10774 <1> ;;retn 10775 <1> ;jmp short dispi_set_parms 10776 <1> 10777 <1> dispi_set_parms: 10778 <1> ; 03/08/2022 10779 <1> ; 25/11/2020 10780 <1> ; Input: 10781 <1> ; ax = data 10782 <1> ; dx = vbe dispi register index 10783 <1> ; 10784 <1> ; Modified registers: edx 10785 <1> 10786 00003EAC 50 <1> push eax 10787 <1> ;mov ax, dx 10788 <1> ; 03/08/2022 10789 00003EAD 89D0 <1> mov eax, edx 10790 00003EAF 66BACE01 <1> mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10791 00003EB3 66EF <1> out dx, ax 10792 00003EB5 58 <1> pop eax 10793 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10794 <1> ;mov dl, 0CFh 10795 00003EB6 FEC2 <1> inc dl 10796 00003EB8 66EF <1> out dx, ax 10797 00003EBA C3 <1> retn 10798 <1> 10799 <1> dispi_set_bpp: 10800 <1> ; 03/08/2022 10801 <1> ; 25/11/2020 10802 <1> ; Input: 10803 <1> ; ax = Bits per pixel value 10804 <1> ; (8,16,24,32) 10805 <1> ; 10806 <1> ; Modified registers: none 10807 <1> 10808 <1> ;push edx 10809 <1> ;push eax 10810 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10811 <1> ;mov ax, 03h ; VBE_DISPI_INDEX_BPP 10812 <1> ;out dx, ax 10813 <1> ;pop eax 10814 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10815 <1> ;;mov dl, 0CFh 10816 <1> ;inc dl 10817 <1> ;out dx, ax 10818 <1> ;pop edx 10819 <1> ;retn 10820 <1> 10821 <1> ; 25/11/2020 10822 <1> ; Modified registers: edx 10823 <1> ;;push edx 10824 <1> ;mov dx, 03h ; VBE_DISPI_INDEX_BPP 10825 <1> ; 03/08/2022 10826 00003EBB 28F6 <1> sub dh, dh 10827 00003EBD B203 <1> mov dl, 03h ; VBE_DISPI_INDEX_BPP 10828 <1> 10829 <1> ;;call dispi_set_parms 10830 <1> ;;pop edx 10831 <1> ;;retn 10832 00003EBF EBEB <1> jmp short dispi_set_parms 10833 <1> 10834 <1> dispi_set_xres: 10835 <1> ; 03/08/2022 10836 <1> ; 25/11/2020 10837 <1> ; Input: 10838 <1> ; ax = X resolution (screen witdh) 10839 <1> ; (320,640,800,1024,1280,1920) 10840 <1> ; 10841 <1> ; Modified registers: none 10842 <1> 10843 <1> ;push edx 10844 <1> ;push eax 10845 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10846 <1> ;mov ax, 01h ; VBE_DISPI_INDEX_XRES 10847 <1> ;out dx, ax 10848 <1> ;pop eax 10849 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10850 <1> ;;mov dl, 0CFh 10851 <1> ;inc dl 10852 <1> ;out dx, ax 10853 <1> ;pop edx 10854 <1> ;retn 10855 <1> 10856 <1> ; 25/11/2020 10857 <1> ; Modified registers: edx 10858 <1> ;;push edx 10859 <1> ;mov dx, 01h ; VBE_DISPI_INDEX_XRES 10860 <1> ; 03/08/2022 10861 00003EC1 28F6 <1> sub dh, dh 10862 00003EC3 B201 <1> mov dl, 01h ; VBE_DISPI_INDEX_XRES 10863 <1> ;;call dispi_set_parms 10864 <1> ;;pop edx 10865 <1> ;;retn 10866 00003EC5 EBE5 <1> jmp short dispi_set_parms 10867 <1> 10868 <1> dispi_set_yres: 10869 <1> ; 03/08/2022 10870 <1> ; 25/11/2020 10871 <1> ; Input: 10872 <1> ; ax = Y resolution (screen height) 10873 <1> ; (200,400,600,720,768,1080) 10874 <1> ; 10875 <1> ; Modified registers: none 10876 <1> 10877 <1> ;push edx 10878 <1> ;push eax 10879 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10880 <1> ;mov ax, 02h ; VBE_DISPI_INDEX_YRES 10881 <1> ;out dx, ax 10882 <1> ;pop eax 10883 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10884 <1> ;;mov dl, 0CFh 10885 <1> ;inc dl 10886 <1> ;out dx, ax 10887 <1> ;pop edx 10888 <1> ;retn 10889 <1> 10890 <1> ; 25/11/2020 10891 <1> ; Modified registers: edx 10892 <1> ;;push edx 10893 <1> ;mov dx, 02h ; VBE_DISPI_INDEX_YRES 10894 <1> ; 03/08/2022 10895 00003EC7 28F6 <1> sub dh, dh 10896 00003EC9 B202 <1> mov dl, 02h ; VBE_DISPI_INDEX_YRES 10897 <1> ;;call dispi_set_parms 10898 <1> ;;pop edx 10899 <1> ;;retn 10900 00003ECB EBDF <1> jmp short dispi_set_parms 10901 <1> 10902 <1> dispi_set_bank: 10903 <1> ; 03/08/2022 10904 <1> ; 25/11/2020 10905 <1> ; Input: 10906 <1> ; ax = video memory bank number 10907 <1> ; 10908 <1> ; Modified registers: none 10909 <1> 10910 <1> ;push edx 10911 <1> ;push eax 10912 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10913 <1> ;mov ax, 05h ; VBE_DISPI_INDEX_BANK 10914 <1> ;out dx, ax 10915 <1> ;pop eax 10916 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10917 <1> ;;mov dl, 0CFh 10918 <1> ;inc dl 10919 <1> ;out dx, ax 10920 <1> ;pop edx 10921 <1> ;retn 10922 <1> 10923 <1> ; 25/11/2020 10924 <1> ; Modified registers: edx 10925 <1> ;;push edx 10926 <1> ;mov dx, 05h ; VBE_DISPI_INDEX_BANK 10927 <1> ; 03/08/2022 10928 00003ECD 28F6 <1> sub dh, dh 10929 00003ECF B205 <1> mov dl, 05h ; VBE_DISPI_INDEX_BANK 10930 <1> ;;call dispi_set_parms 10931 <1> ;;pop edx 10932 <1> ;;retn 10933 00003ED1 EBD9 <1> jmp short dispi_set_parms 10934 <1> 10935 <1> dispi_get_enable: 10936 <1> ; 03/08/2022 10937 <1> ; 27/11/2020 10938 <1> ; Input: 10939 <1> ; none 10940 <1> ; Output: 10941 <1> ; ax = vbe dispi status 10942 <1> ; 10943 <1> ; Modified registers: eax 10944 <1> 10945 <1> ;push edx 10946 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10947 <1> ;mov ax, 04h ; VBE_DISPI_INDEX_ENABLE 10948 <1> ;out dx, ax 10949 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10950 <1> ;;mov dl, 0CFh 10951 <1> ;inc dl 10952 <1> ;in ax, dx 10953 <1> ;pop edx 10954 <1> ;retn 10955 <1> 10956 <1> ; 27/11/2020 10957 <1> ; Modified registers: eax, edx 10958 <1> ;;push edx 10959 <1> ;mov ax, 04h ; VBE_DISPI_INDEX_ENABLE 10960 <1> ; 03/08/2022 10961 00003ED3 28E4 <1> sub ah, ah 10962 00003ED5 B004 <1> mov al, 04h ; VBE_DISPI_INDEX_ENABLE 10963 <1> 10964 <1> ;;call dispi_get_parms 10965 <1> ;;pop edx 10966 <1> ;;retn 10967 <1> ;jmp short dispi_get_parms 10968 <1> 10969 <1> dispi_get_parms: 10970 <1> ; 25/11/2020 10971 <1> ; Input: 10972 <1> ; ax = vbe dispi register index 10973 <1> ; output: 10974 <1> ; ax = data 10975 <1> ; 10976 <1> ; Modified registers: eax, edx 10977 <1> 10978 00003ED7 66BACE01 <1> mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 10979 00003EDB 66EF <1> out dx, ax 10980 <1> ;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 10981 <1> ;mov dl, 0CFh 10982 00003EDD FEC2 <1> inc dl 10983 00003EDF 66ED <1> in ax, dx 10984 00003EE1 C3 <1> retn 10985 <1> 10986 <1> vga_compat_setup: 10987 <1> ; 03/08/2022 10988 <1> ; 26/11/2020 10989 <1> ; 25/11/2020 10990 <1> ; VGA compatibility setup 10991 <1> ; (vbe.c, 02/01/2020, vruppert) 10992 <1> ; 10993 <1> ; Input: 10994 <1> ; none 10995 <1> ; 10996 <1> ; Modified registers: eax, edx 10997 <1> 10998 <1> ; 26/11/2020 10999 <1> ;push eax 11000 <1> ;push edx 11001 <1> 11002 <1> ; set CRT X resolution 11003 00003EE2 66BACE01 <1> mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 11004 <1> ;mov ax, 01h ; VBE_DISPI_INDEX_XRES 11005 <1> ; 03/08/2022 11006 00003EE6 31C0 <1> xor eax, eax 11007 00003EE8 FEC0 <1> inc al 11008 <1> ; eax = 1 11009 00003EEA 66EF <1> out dx, ax 11010 <1> ;mov dx, 1CFh ; VBE_DISPI_IOPORT_DATA 11011 00003EEC FEC2 <1> inc dl 11012 00003EEE 66ED <1> in ax, dx 11013 00003EF0 50 <1> push eax 11014 00003EF1 66BAD403 <1> mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 11015 00003EF5 66B81100 <1> mov ax, 0011h ; Vertical retrace end register 11016 00003EF9 66EF <1> out dx, ax 11017 <1> ;pop eax 11018 <1> ;push eax 11019 00003EFB 8B0424 <1> mov eax, [esp] 11020 <1> ;shr ax, 3 ; / 8 for pixel to character 11021 <1> ;dec ax ; - 1 (EGA or VGA?) 11022 <1> ; 03/08/2022 11023 00003EFE C1E803 <1> shr eax, 3 11024 00003F01 48 <1> dec eax 11025 00003F02 88C4 <1> mov ah, al 11026 00003F04 B001 <1> mov al, 01h ; Horizontal display end register 11027 00003F06 66EF <1> out dx, ax 11028 00003F08 58 <1> pop eax 11029 <1> 11030 00003F09 E89C000000 <1> call vga_set_virt_width 11031 <1> 11032 <1> ; set CRT Y resolution 11033 <1> ; 03/08/2022 11034 00003F0E 66BACE01 <1> mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 11035 00003F12 66B80200 <1> mov ax, 02h ; VBE_DISPI_INDEX_YRES 11036 00003F16 66EF <1> out dx, ax 11037 <1> ;mov dx, 1CFh ; VBE_DISPI_IOPORT_DATA 11038 <1> ; 03/08/2022 11039 00003F18 FEC2 <1> inc dl 11040 00003F1A 66ED <1> in ax, dx 11041 00003F1C 50 <1> push eax 11042 00003F1D 66BAD403 <1> mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 11043 00003F21 88C4 <1> mov ah, al 11044 00003F23 B012 <1> mov al, 12h ; Vertical display end register 11045 00003F25 66EF <1> out dx, ax 11046 00003F27 58 <1> pop eax 11047 00003F28 B007 <1> mov al, 07h ; Overflow register 11048 00003F2A EE <1> out dx, al 11049 <1> ;inc dx 11050 <1> ; 03/08/2022 11051 00003F2B FEC2 <1> inc dl 11052 00003F2D EC <1> in al, dx ; read overflow register 11053 00003F2E 24BD <1> and al, 0BDh ; clear VDE 9th and 10th bits 11054 00003F30 F6C401 <1> test ah, 01h 11055 00003F33 7402 <1> jz short bit8_clear 11056 00003F35 0C02 <1> or al, 02h ; VDE 9th bit (bit 8) in bit 1 11057 <1> bit8_clear: 11058 00003F37 F6C402 <1> test ah, 02h 11059 00003F3A 7402 <1> jz short bit9_clear 11060 00003F3C 0C40 <1> or al, 40h ; VDE 10th bit (bit 9) in bit 6 11061 <1> bit9_clear: 11062 00003F3E EE <1> out dx, al 11063 <1> 11064 <1> ; other settings 11065 <1> ;mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 11066 <1> ; 03/08/2022 11067 00003F3F B2D4 <1> mov dl, 0D4h 11068 00003F41 66B80900 <1> mov ax, 0009h ; Maximum scan line register 11069 00003F45 66EF <1> out dx, ax ; Reset 11070 00003F47 B017 <1> mov al, 17h ; Mode control register 11071 00003F49 EE <1> out dx, al 11072 <1> ;mov dx, 3D5h ; VGAREG_VGA_CRTC_DATA 11073 00003F4A FEC2 <1> inc dl 11074 00003F4C EC <1> in al, dx ; Read mode control register 11075 00003F4D 0C03 <1> or al, 03h ; Set SRS and CMS bits 11076 00003F4F EE <1> out dx, al 11077 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 11078 <1> ; 03/08/2022 11079 00003F50 B2DA <1> mov dl, 0DAh 11080 00003F52 EC <1> in al, dx ; clear flip-flop 11081 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 11082 <1> ; 03/08/2022 11083 00003F53 B2C0 <1> mov dl, 0C0h 11084 00003F55 B010 <1> mov al, 10h ; Mode control register 11085 00003F57 EE <1> out dx, al 11086 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 11087 00003F58 FEC2 <1> inc dl 11088 00003F5A EC <1> in al, dx 11089 00003F5B 0C01 <1> or al, 01h ; select graphics mode 11090 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 11091 00003F5D FECA <1> dec dl 11092 00003F5F EE <1> out dx, al ; Write to mode control register 11093 00003F60 B020 <1> mov al, 20h ; Palette RAM <-> display memory 11094 00003F62 EE <1> out dx, al ; Write to attribute addr register 11095 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 11096 <1> ; 03/08/2022 11097 00003F63 B2CE <1> mov dl, 0CEh 11098 00003F65 66B80605 <1> mov ax, 0506h ; Misc. register, graph, mm 1 11099 00003F69 66EF <1> out dx, ax 11100 <1> ;mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 11101 <1> ; 03/08/2022 11102 00003F6B B2C4 <1> mov dl, 0C4h 11103 00003F6D 66B8020F <1> mov ax, 0F02h ; Map mask register, all planes 11104 00003F71 66EF <1> out dx, ax 11105 <1> 11106 <1> ; settings for >= 8bpp 11107 <1> 11108 <1> ;mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 11109 <1> ;mov ax, 03h ; VBE_DISPI_INDEX_BPP 11110 <1> ;out dx, ax 11111 <1> ;;mov dx, 1CFh ; VBE_DISPI_IOPORT_DATA 11112 <1> ;inc dl 11113 <1> ;in ax, dx 11114 <1> ;cmp al, 08h ; < 8 bits per pixel 11115 <1> ;jb short vga_compat_end 11116 <1> 11117 <1> ;mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 11118 <1> ; 03/08/2022 11119 00003F73 B2D4 <1> mov dl, 0D4h 11120 00003F75 B014 <1> mov al, 14h ; Underline location register 11121 00003F77 EE <1> out dx, al 11122 <1> ;mov dx, 3D5h ; VGAREG_VGA_CRTC_DATA 11123 00003F78 FEC2 <1> inc dl 11124 00003F7A EC <1> in al, dx 11125 00003F7B 0C40 <1> or al, 40h ; enable double word mode 11126 00003F7D EE <1> out dx, al 11127 <1> ;mov dx, 3DAh ; VGAREG_ACTL_RESET 11128 <1> ; 03/08/2022 11129 00003F7E B2DA <1> mov dl, 0DAh 11130 00003F80 EC <1> in al, dx ; clear flip-flop 11131 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 11132 <1> ; 03/08/2022 11133 00003F81 B2C0 <1> mov dl, 0C0h 11134 00003F83 B010 <1> mov al, 10h ; Mode control register 11135 00003F85 EE <1> out dx, al 11136 <1> ;mov dx, 3C1h ; VGAREG_ACTL_READ_DATA 11137 00003F86 FEC2 <1> inc dl 11138 00003F88 EC <1> in al, dx 11139 00003F89 0C40 <1> or al, 40h ; Pixel clock select is 1 11140 <1> ;mov dx, 3C0h ; VGAREG_ACTL_ADDRESS 11141 00003F8B FECA <1> dec dl 11142 00003F8D EE <1> out dx, al ; update mode control reggister 11143 00003F8E B020 <1> mov al, 20h ; select display memory as PAS 11144 00003F90 EE <1> out dx, al 11145 <1> ;mov dx, 3C4h ; VGAREG_SEQU_ADDRESS 11146 <1> ; 03/08/2022 11147 00003F91 B2C4 <1> mov dl, 0C4h 11148 00003F93 B004 <1> mov al, 04h ; Memory mode register 11149 00003F95 EE <1> out dx, al 11150 <1> ;mov dx, 3C5h ; VGAREG_SEQU_DATA 11151 00003F96 FEC2 <1> inc dl 11152 00003F98 EC <1> in al, dx 11153 00003F99 0C08 <1> or al, 08h ; enable chain four 11154 00003F9B EE <1> out dx, al 11155 <1> ;mov dx, 3CEh ; VGAREG_GRDC_ADDRESS 11156 <1> ; 03/08/2022 11157 00003F9C B2CE <1> mov dl, 0CEh 11158 00003F9E B005 <1> mov al, 05h ; Mode register 11159 00003FA0 EE <1> out dx, al 11160 <1> ;mov dx, 3CFh ; VGAREG_GRDC_DATA 11161 00003FA1 FEC2 <1> inc dl 11162 00003FA3 EC <1> in al, dx 11163 00003FA4 249F <1> and al, 9Fh ; clear shift register 11164 00003FA6 0C40 <1> or al, 40h ; set shift register to 2 11165 00003FA8 EE <1> out dx, al 11166 <1> 11167 <1> vga_compat_end: 11168 <1> ;pop edx 11169 <1> ;pop eax 11170 00003FA9 C3 <1> retn 11171 <1> 11172 <1> vga_set_virt_width: 11173 <1> ; 03/08/2022 11174 <1> ; 27/11/2020 11175 <1> ; 25/11/2020 11176 <1> ; (vbe.c, 02/01/2020, vruppert) 11177 <1> ; 11178 <1> ; Input: 11179 <1> ; AX = resolution (screen width) 11180 <1> ; 11181 <1> ; Modified registers: eax, edx 11182 <1> 11183 <1> ;;push ebx 11184 <1> ;push edx 11185 <1> ;push eax 11186 <1> ;mov ebx, eax 11187 <1> ;call dispi_get_bpp ; bits per pixel 11188 <1> ;cmp al, 4 11189 <1> ;ja short set_width_svga ; 8, 16, 24, 32 11190 <1> ;shr bx, 1 11191 <1> ;set_width_svga: 11192 <1> ;shr bx, 3 11193 <1> ;mov eax, [esp] 11194 <1> ;shr ax, 3 ; / 8, bytes per row 11195 <1> ; 03/08/2022 11196 00003FAA C1E803 <1> shr eax, 3 11197 00003FAD 66BAD403 <1> mov dx, 3D4h ; VGAREG_VGA_CRTC_ADDRESS 11198 <1> ;mov ah, bl ; 11199 00003FB1 88C4 <1> mov ah, al ; width in bytes 11200 00003FB3 B013 <1> mov al, 13h ; offset register 11201 00003FB5 66EF <1> out dx, ax ; index (3D4h) and data (3D5h) 11202 <1> ;pop eax 11203 <1> ;pop edx 11204 <1> ;;pop ebx 11205 00003FB7 C3 <1> retn 11206 <1> 11207 <1> ; 24/11/2020 11208 <1> 11209 <1> struc bmi ; BOCHS/PLEX86 MODE INFO structure/table 11210 00000000 ???? <1> .mode: resw 1 11211 00000002 ???? <1> .width: resw 1 11212 00000004 ???? <1> .height: resw 1 11213 00000006 ???? <1> .depth: resw 1 11214 <1> .size: 11215 <1> endstruc 11216 <1> 11217 <1> ; 24/11/2020 11218 <1> struc MODEINFO 11219 00000000 ???? <1> .mode: resw 1 ; 1XXh 11220 00000002 ???? <1> .ModeAttributes: resw 1 11221 00000004 ?? <1> .WinAAttributes: resb 1 11222 00000005 ?? <1> .WinBAttributes: resb 1 ; = 0 11223 00000006 ???? <1> .WinGranularity: resw 1 11224 00000008 ???? <1> .WinSize: resw 1 11225 0000000A ???? <1> .WinASegment: resw 1 11226 0000000C ???? <1> .WinBSegment: resw 1 ; = 0 11227 0000000E ???????? <1> .WinFuncPtr: resd 1 ; = 0 11228 00000012 ???? <1> .BytesPerScanLine: resw 1 11229 00000014 ???? <1> .XResolution: resw 1 11230 00000016 ???? <1> .YResolution: resw 1 11231 00000018 ?? <1> .XCharSize: resb 1 11232 00000019 ?? <1> .YCharSize: resb 1 11233 0000001A ?? <1> .NumberOfPlanes: resb 1 11234 0000001B ?? <1> .BitsPerPixel: resb 1 11235 0000001C ?? <1> .NumberOfBanks: resb 1 11236 0000001D ?? <1> .MemoryModel: resb 1 11237 0000001E ?? <1> .BankSize: resb 1 ; = 0 11238 0000001F ?? <1> .NumberOfImagePages: resb 1 11239 00000020 ?? <1> .Reserved_page: resb 1 ; = 0 11240 00000021 ?? <1> .RedMaskSize: resb 1 11241 00000022 ?? <1> .RedFieldPosition: resb 1 11242 00000023 ?? <1> .GreenMaskSize: resb 1 11243 00000024 ?? <1> .GreenFieldPosition: resb 1 11244 00000025 ?? <1> .BlueMaskSize: resb 1 11245 00000026 ?? <1> .BlueFieldPosition: resb 1 11246 00000027 ?? <1> .RsvdMaskSize: resb 1 11247 00000028 ?? <1> .RsvdFieldPosition: resb 1 11248 00000029 ?? <1> .DirectColorModeInfo: resb 1 11249 0000002A ???????? <1> .PhysBasePtr: resd 1 11250 0000002E ???????? <1> .OffScreenMemOffset: resd 1 ; = 0 11251 00000032 ???? <1> .OffScreenMemSize: resw 1 ; = 0 11252 00000034 ???? <1> .LinBytesPerScanLine: resw 1 11253 00000036 ?? <1> .BnkNumberOfPages: resb 1 11254 00000037 ?? <1> .LinNumberOfPages: resb 1 11255 00000038 ?? <1> .LinRedMaskSize: resb 1 11256 00000039 ?? <1> .LinRedFieldPosition1: resb 1 11257 0000003A ?? <1> .LinGreenMaskSize1: resb 1 11258 0000003B ?? <1> .LinGreenFieldPosition:resb 1 11259 0000003C ?? <1> .LinBlueMaskSize: resb 1 11260 0000003D ?? <1> .LinBlueFieldPosition: resb 1 11261 0000003E ?? <1> .LinRsvdMaskSize: resb 1 11262 0000003F ?? <1> .LinRsvdFieldPosition: resb 1 11263 00000040 ???????? <1> .MaxPixelClock: resd 1 ; = 0 11264 <1> .size: 11265 <1> endstruc 11266 <1> 11267 <1> ; 10/12/2020 11268 <1> struc LFBINFO 11269 00000000 ???? <1> .mode: resw 1 ; 1XXh 11270 00000002 ???????? <1> .LFB_addr: resd 1 11271 00000006 ???????? <1> .LFB_size: resd 1 11272 0000000A ???? <1> .X_res: resw 1 11273 0000000C ???? <1> .Y_res: resw 1 11274 0000000E ?? <1> .bpp: resb 1 11275 0000000F ?? <1> .reserved: resb 1 11276 <1> .size: ; 16 bytes 11277 <1> endstruc 11278 <1> 11279 <1> set_mode_info_list: 11280 <1> ; 14/12/2020 11281 <1> ; 11/12/2020 11282 <1> ; 24/11/2020 11283 <1> ; (vbetables-gen.c) 11284 <1> ; Input: 11285 <1> ; BX = VBE mode (including bochs special modes) 11286 <1> ; Output: 11287 <1> ; ;;EAX = MODE_INFO_LIST address 11288 <1> ; EAX = 0 ; 11/12/2020 11289 <1> ; ESI = MODE_INFO_LIST address ; 11/12/2020 11290 <1> ; (if mode is not found, ESI = 0) 11291 <1> ; 11292 <1> ; Modified registers: eax, ebx, ecx, edx, esi, edi 11293 <1> 11294 00003FB8 BE[BA6B0000] <1> mov esi, b_vbe_modes ; bochs mode info base table 11295 00003FBD BF[429D0100] <1> mov edi, MODE_INFO_LIST ; mode info list (4F01h) 11296 <1> sml_0: 11297 00003FC2 66AD <1> lodsw 11298 00003FC4 6639D8 <1> cmp ax, bx ; is mode number same ? 11299 00003FC7 7410 <1> je short sml_1 ; yes 11300 00003FC9 AD <1> lodsd 11301 00003FCA 66AD <1> lodsw 11302 00003FCC 81FE[7A6C0000] <1> cmp esi, end_of_b_vbe_modes 11303 00003FD2 72EE <1> jb short sml_0 11304 <1> ; not found 11305 00003FD4 31C0 <1> xor eax, eax ; 0 11306 <1> ; 11/12/2020 11307 00003FD6 31F6 <1> xor esi, esi 11308 00003FD8 C3 <1> retn 11309 <1> sml_1: 11310 00003FD9 66AB <1> stosw ; mode 11311 00003FDB AD <1> lodsd ; width, height 11312 <1> ; 14/12/2020 11313 00003FDC 89C1 <1> mov ecx, eax 11314 00003FDE 50 <1> push eax ; *** 11315 00003FDF 29C0 <1> sub eax, eax ; clear high word of eax 11316 00003FE1 66AD <1> lodsw ; depth 11317 00003FE3 50 <1> push eax ; ** 11318 <1> 11319 <1> ;add al, 7 ; only for 15 bit colors (not used here) 11320 00003FE4 C0E803 <1> shr al, 3 ; / 8 11321 <1> ; 14/12/2020 11322 00003FE7 66F7E1 <1> mul cx ; pitch = width * ((depth+7)/8) 11323 <1> ; ax = pitch 11324 00003FEA 50 <1> push eax ; * ; high word of eax = 0 11325 00003FEB C1E910 <1> shr ecx, 16 11326 <1> ;mul cx 11327 <1> ;mov cx, ax 11328 00003FEE 31D2 <1> xor edx, edx ; clear high word of edx 11329 00003FF0 F7E1 <1> mul ecx ; height * pitch 11330 00003FF2 89C1 <1> mov ecx, eax 11331 00003FF4 B800000001 <1> mov eax, VBE_DISPI_TOTAL_VIDEO_MEMORY_MB * 1024 * 1024 11332 00003FF9 F7F1 <1> div ecx 11333 <1> ; eax = pages = vram_size / (height*pitch) 11334 <1> 11335 <1> ;mov cx, ax 11336 00003FFB 89C1 <1> mov ecx, eax ; pages 11337 <1> 11338 00003FFD 66B89B00 <1> mov ax, MODE_ATTRIBUTES 11339 00004001 66AB <1> stosw ; ModeAttributes 11340 00004003 B007 <1> mov al, WINA_ATTRIBUTES 11341 00004005 AA <1> stosb ; WinAAttributes 11342 00004006 30C0 <1> xor al, al ; WinBAttributes = 0 11343 00004008 AA <1> stosb 11344 00004009 66B84000 <1> mov ax, VBE_DISPI_BANK_SIZE_KB 11345 0000400D 66AB <1> stosw ; WinGranularity 11346 0000400F 66AB <1> stosw ; WinSize 11347 00004011 66B800A0 <1> mov ax, VGAMEM_GRAPH 11348 00004015 66AB <1> stosw ; WinASegment 11349 00004017 29C0 <1> sub eax, eax 11350 00004019 66AB <1> stosw ; WinBSegment = 0 11351 0000401B AB <1> stosd ; WinFuncPtr = 0 11352 <1> 11353 0000401C 58 <1> pop eax ; * ; pitch 11354 0000401D 89C3 <1> mov ebx, eax ; high word of ebx = 0 ; 14/12/2020 11355 0000401F 66AB <1> stosw ; BytesPerScanLine 11356 <1> 11357 00004021 5A <1> pop edx ; ** ; depth (bits per pixel) 11358 00004022 58 <1> pop eax ; *** width, height 11359 <1> 11360 <1> ; // Mandatory information for VBE 1.2 and above 11361 <1> 11362 00004023 66AB <1> stosw ; XResolution (width) 11363 00004025 C1E810 <1> shr eax, 16 11364 00004028 50 <1> push eax ; **** height 11365 00004029 66AB <1> stosw ; YResolution (height) 11366 0000402B B008 <1> mov al, 8 11367 0000402D AA <1> stosb ; XCharSize ; char width 11368 0000402E B010 <1> mov al, 16 11369 00004030 AA <1> stosb ; YCharSize ; char height 11370 00004031 B001 <1> mov al, 1 11371 00004033 AA <1> stosb ; NumberOfPlanes 11372 <1> ;movzx eax, dl 11373 00004034 88D0 <1> mov al, dl ; eax <= 32 11374 00004036 AA <1> stosb ; BitsPerPixel 11375 <1> ; Number of banks = (height * pitch + 65535) / 65536 11376 00004037 58 <1> pop eax ; **** ; height 11377 <1> ; 14/12/2020 11378 00004038 52 <1> push edx ; ***** ; depth ; edx <= 32 11379 00004039 F7E3 <1> mul ebx ; pitch (ebx) * height (eax) 11380 <1> ;mov edx, [esp] ; ***** 11381 <1> ;mov dl, [esp] ; ***** 11382 0000403B 05FFFF0000 <1> add eax, 65535 11383 00004040 C1E810 <1> shr eax, 16 ; / 65536 ; <= 127 ; 14/12/2020 11384 00004043 AA <1> stosb ; NumberOfBanks 11385 <1> ; 14/12/2020 11386 <1> ;cmp dl, 8 ; 8 bits per pixel 11387 00004044 803C2408 <1> cmp byte [esp], 8 11388 00004048 7704 <1> ja short sml_2 11389 0000404A B004 <1> mov al, VBE_MEMORYMODEL_PACKED_PIXEL 11390 0000404C EB02 <1> jmp short sml_3 11391 <1> sml_2: 11392 <1> ; 16, 24, 32 bits per pixel 11393 0000404E B006 <1> mov al, VBE_MEMORYMODEL_DIRECT_COLOR 11394 <1> sml_3: 11395 00004050 AA <1> stosb 11396 00004051 30C0 <1> xor al, al ; 0 11397 00004053 AA <1> stosb ; BankSize = 0 11398 00004054 49 <1> dec ecx ; pages - 1 11399 <1> ; NumberOfImagePages = 262 for 320x200x8 mode 11400 <1> ;;mov ax, 255 11401 <1> ; 14/12/2020 11402 <1> ;mov al, 255 11403 00004055 FEC8 <1> dec al ; 255 11404 00004057 39C1 <1> cmp ecx, eax ; ecx <= 261, eax = 255 11405 <1> ;cmp cx, ax 11406 00004059 7302 <1> jnb short sml_4 11407 0000405B 88C8 <1> mov al, cl 11408 <1> sml_4: 11409 0000405D AA <1> stosb ; NumberOfImagePages (1 byte) 11410 0000405E 28C0 <1> sub al, al 11411 00004060 AA <1> stosb ; Reserved_page = 0 11412 00004061 58 <1> pop eax ; ***** ; depth 11413 00004062 88C1 <1> mov cl, al 11414 <1> ; eax < = 32 11415 00004064 2C08 <1> sub al, 8 ; 8->0, 16->8, 24->16, 32->24 11416 00004066 BE[7A6C0000] <1> mov esi, direct_color_fields 11417 0000406B 01C6 <1> add esi, eax 11418 0000406D 56 <1> push esi ; ****** 11419 0000406E AD <1> lodsd ; RedMaskSize (AL), RedFieldPosition (AH) 11420 <1> ; GreenMaskSize (16), GreenFieldPosition (24) 11421 0000406F AB <1> stosd 11422 00004070 AD <1> lodsd ; BlueMaskSize (AL), BlueFieldPosition (AH) 11423 <1> ; RsvdMaskSize (16), RsvdFieldPosition (24) 11424 00004071 AB <1> stosd 11425 00004072 5E <1> pop esi ; ****** 11426 <1> 11427 00004073 30C0 <1> xor al, al ; 0 11428 00004075 80F920 <1> cmp cl, 32 11429 00004078 7202 <1> jb short sml_5 11430 0000407A B002 <1> mov al, VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 11431 <1> sml_5: 11432 0000407C AA <1> stosb ; DirectColorModeInfo 11433 <1> 11434 <1> ; // Mandatory information for VBE 2.0 and above 11435 <1> 11436 0000407D B8000000E0 <1> mov eax, VBE_DISPI_LFB_PHYSICAL_ADDRESS 11437 00004082 AB <1> stosd ; PhysBasePtr 11438 00004083 29C0 <1> sub eax, eax 11439 00004085 AB <1> stosd ; OffScreenMemOffset = 0 11440 00004086 66AB <1> stosw ; OffScreenMemSize = 0 11441 <1> 11442 <1> ;// Mandatory information for VBE 3.0 and above 11443 <1> 11444 <1> ; ebx = pitch 11445 00004088 6689D8 <1> mov ax, bx 11446 <1> ;stosw 11447 <1> 11448 <1> ;xor al, al 11449 <1> ;stosb ; BnkNumberOfPages = 0 11450 <1> ;stosb ; LinNumberOfPages = 0 11451 <1> 11452 0000408B AB <1> stosd ; pitch (word), 0 (byte), 0 (byte) 11453 <1> 11454 0000408C AD <1> lodsd ; LinRedMaskSize (AL), LinRedFieldPosition (AH) 11455 <1> ; LinGreenMaskSize (16), LinGreenFieldPosition (24) 11456 0000408D AB <1> stosd 11457 0000408E AD <1> lodsd ; LinBlueMaskSize (AL), LinBlueFieldPosition (AH) 11458 <1> ; LinRsvdMaskSize (16), LinRsvdFieldPosition (24) 11459 0000408F AB <1> stosd 11460 <1> 11461 00004090 29C0 <1> sub eax, eax 11462 00004092 AB <1> stosd ; MaxPixelClock = 0 11463 <1> 11464 <1> ;mov eax, MODE_INFO_LIST 11465 <1> ; 11/12/2020 11466 00004093 BE[429D0100] <1> mov esi, MODE_INFO_LIST 11467 <1> 11468 00004098 C3 <1> retn 11469 <1> 11470 <1> ; end of set_mode_info_list ; edi = set_mode_info_list + 68 11471 <1> 11472 <1> pci_get_lfb_addr: 11473 <1> ; 11/12/2020 11474 <1> ; Get linear frame buffer base from PCI 11475 <1> ; (vgabios.c, 02/01/2020, vruppert) 11476 <1> ; 11477 <1> ; Input: 11478 <1> ; ax = PCI device vendor id 11479 <1> ; Output: 11480 <1> ; ax = LFB address (high 16 bit) (zf=0) 11481 <1> ; eax = 0 -> not found (error) (zf=1) 11482 <1> ; 11483 <1> ; Modified registers: eax 11484 <1> 11485 00004099 53 <1> push ebx 11486 0000409A 51 <1> push ecx 11487 0000409B 52 <1> push edx 11488 <1> ; 11489 0000409C 89C3 <1> mov ebx, eax 11490 0000409E 31C9 <1> xor ecx, ecx 11491 000040A0 28D2 <1> sub dl, dl ; mov dl, 0 11492 000040A2 E842000000 <1> call pci_read_reg 11493 000040A7 6683F8FF <1> cmp ax, 0FFFFh 11494 000040AB 7417 <1> je short pci_get_lfb_addr_fail 11495 <1> pci_get_lfb_addr_next_dev: 11496 000040AD 28D2 <1> sub dl, dl ; mov dl, 0 11497 000040AF E835000000 <1> call pci_read_reg 11498 000040B4 6639D8 <1> cmp ax, bx ; check vendor 11499 000040B7 740F <1> je short pci_get_lfb_addr_found 11500 000040B9 6683C108 <1> add cx, 08h 11501 000040BD 6681F90002 <1> cmp cx, 200h ; search bus 0 and 1 11502 000040C2 72E9 <1> jb short pci_get_lfb_addr_next_dev 11503 <1> pci_get_lfb_addr_fail: 11504 000040C4 31C0 <1> xor eax, eax ; no LFB 11505 <1> ; zf = 1 11506 000040C6 EB1D <1> jmp short pci_get_lfb_addr_return 11507 <1> pci_get_lfb_addr_found: 11508 000040C8 B210 <1> mov dl, 10h ; I/O space 0 11509 000040CA E81A000000 <1> call pci_read_reg 11510 000040CF 66A9F1FF <1> test ax, 0FFF1h 11511 000040D3 740D <1> jz short pci_get_lfb_addr_success 11512 000040D5 B214 <1> mov dl, 14h ; I/O space 1 11513 000040D7 E80D000000 <1> call pci_read_reg 11514 000040DC 66A9F1FF <1> test ax, 0FFF1h 11515 000040E0 75E2 <1> jnz short pci_get_lfb_addr_fail 11516 <1> pci_get_lfb_addr_success: 11517 000040E2 C1E810 <1> shr eax, 16 ; LFB address (hw) 11518 <1> ; zf = 0 11519 <1> pci_get_lfb_addr_return: 11520 000040E5 5A <1> pop edx 11521 000040E6 59 <1> pop ecx 11522 000040E7 5B <1> pop ebx 11523 000040E8 C3 <1> retn 11524 <1> 11525 <1> pci_read_reg: 11526 <1> ; 11/12/2020 11527 <1> ; Read PCI register 11528 <1> ; (vgabios.c, 02/01/2020, vruppert) 11529 <1> ; 11530 <1> ; Input: 11531 <1> ; cx = device/function 11532 <1> ; dl = register 11533 <1> ; Output: 11534 <1> ; eax = value 11535 <1> ; 11536 <1> ; Modified registers: eax, edx 11537 <1> 11538 000040E9 B800008000 <1> mov eax, 00800000h 11539 000040EE 6689C8 <1> mov ax, cx 11540 000040F1 C1E008 <1> shl eax, 8 11541 000040F4 88D0 <1> mov al, dl 11542 000040F6 66BAF80C <1> mov dx, 0CF8h 11543 000040FA EF <1> out dx, eax 11544 000040FB 80C204 <1> add dl, 4 ; mov dx, 0CFCh 11545 000040FE ED <1> in eax, dx 11546 000040FF C3 <1> retn 11547 <1> 11548 <1> %endif 11549 <1> 11550 <1> ; ----------- 11551 <1> 11552 <1> %if 0 11553 <1> 11554 <1> mode_info_find_mode: 11555 <1> ; 25/11/2020 11556 <1> ; Input: 11557 <1> ; bx = VESA VBE2 video mode (+ bochs extensions) 11558 <1> ; Output: 11559 <1> ; esi = mode info address (for BX input) 11560 <1> ; esi = 0 -> not found 11561 <1> ; 11562 <1> ; Modified registers: eax, esi 11563 <1> 11564 <1> xor eax, eax 11565 <1> mov esi, MODE_INFO_LIST 11566 <1> mifm_1: 11567 <1> mov ax, [esi] 11568 <1> cmp ax, bx 11569 <1> je short mifm_2 11570 <1> add esi, MODEINFO.size ; add esi, 68 11571 <1> cmp esi, VBE_VESA_MODE_END_OF_LIST 11572 <1> jb short mifm_1 11573 <1> ; not found 11574 <1> sub esi, esi ; 0 11575 <1> mifm_2 11576 <1> retn 11577 <1> 11578 <1> dispi_get_bpp: 11579 <1> ; 28/11/2020 11580 <1> ; Input: 11581 <1> ; none 11582 <1> ; Output: 11583 <1> ; al = Bits per pixel 11584 <1> ; (8,16,24,32) 11585 <1> ; ah = Bytes per pixel 11586 <1> ; (1,2,3,4) 11587 <1> ; 11588 <1> ; Modified registers: none 11589 <1> 11590 <1> ;push edx 11591 <1> ;mov dx, 01CEh ; VBE_DISPI_IOPORT_INDEX 11592 <1> ;mov ax, 03h ; VBE_DISPI_INDEX_BPP 11593 <1> ;out dx, ax 11594 <1> ;;mov dx, 01CFh ; VBE_DISPI_IOPORT_DATA 11595 <1> ;;mov dl, 0CFh 11596 <1> ;inc dl 11597 <1> ;in ax, dx 11598 <1> ;mov ah, al 11599 <1> ;shr ah, 3 ; / 8 11600 <1> ;;test al, 7 ; 15 bit graphics mode 11601 <1> ;;jz short get_bpp_noinc 11602 <1> ;;inc ah 11603 <1> ;;get_bpp_noinc: 11604 <1> ;pop edx 11605 <1> ;retn 11606 <1> 11607 <1> ; 28/11/2020 11608 <1> ; Modified registers: edx 11609 <1> ;push edx 11610 <1> mov dx, 03h ; VBE_DISPI_INDEX_BPP 11611 <1> call dispi_get_parms 11612 <1> ;pop edx 11613 <1> ;retn 11614 <1> mov ah, al 11615 <1> shr ah, 3 ; / 8 11616 <1> ;test al, 7 ; 15 bit graphips mode 11617 <1> ;jz short get_bpp_noinc 11618 <1> ;inc ah 11619 <1> ;get_bpp_noinc: 11620 <1> ;pop edx 11621 <1> retn 11622 <1> 11623 <1> restore_vesa_video_state: 11624 <1> ; 02/08/2022 (TRDOS 386 v2.0.5) 11625 <1> ; 14/01/2021 11626 <1> ; 06/12/2020 11627 <1> ; Input: 11628 <1> ; [vbe3stbufsize] <= 32 ; <= 32*64 bytes 11629 <1> ; Output: 11630 <1> ; AX = 004Fh (successed) 11631 <1> ; 11632 <1> ; eax = 0 -> buffer size problem 11633 <1> ; eax > 0 and ax <> 004Fh -> failed 11634 <1> ; 11635 <1> ; Modified regs: eax, ebx, ecx, edx, esi, edi 11636 <1> 11637 <1> ;movzx ecx, word [vbe3stbufsize] 11638 <1> ;cmp cx, 32 ; 32 * 64 bytes 11639 <1> ;ja short r_v_b_s_fail 11640 <1> 11641 <1> movzx ecx, byte [vbe3stbufsize]; <=32 11642 <1> ;shl cx, 4 ; dword count for movsd 11643 <1> ; 02/08/2022 11644 <1> shl ecx, 4 ; <= 32*16 dwords (32*64 bytes) 11645 <1> mov edi, VBE3SAVERESTOREBLOCK ; destination 11646 <1> ; (vbe3 pmi buff) 11647 <1> mov esi, VBE3VIDEOSTATE ; source (kernel buff) 11648 <1> rep movsd 11649 <1> 11650 <1> mov ax, 4F04h 11651 <1> mov dl, 02h ; restore 11652 <1> ;mov cx, 0Fh 11653 <1> mov cl, 0Fh 11654 <1> xor ebx, ebx ; points to VBE3SAVERESTOREBLOCK 11655 <1> jmp short int10h_32bit_pmi 11656 <1> 11657 <1> ;s_v_b_s_fail: 11658 <1> ;r_v_b_s_fail: 11659 <1> ; xor eax, eax 11660 <1> ; retn 11661 <1> 11662 <1> save_vesa_video_state: 11663 <1> ; 02/08/2022 (TRDOS 386 v2.0.5) 11664 <1> ; 14/01/2021 11665 <1> ; 06/12/2020 11666 <1> ; Input: 11667 <1> ; [vbe3stbufsize] <= 32 ; <= 32*64 bytes 11668 <1> ; Output: 11669 <1> ; AX = 004Fh (successed) 11670 <1> ; 11671 <1> ; eax = 0 -> buffer size problem 11672 <1> ; eax > 0 and ax <> 004Fh -> failed 11673 <1> ; 11674 <1> ; Modified regs: eax, ebx, ecx, edx, esi, edi 11675 <1> 11676 <1> ;cmp word [vbe33stbufsize], 32 11677 <1> ; ; 32 * 64 bytes 11678 <1> ;ja short s_v_b_s_fail 11679 <1> 11680 <1> mov ax, 4F04h 11681 <1> mov dl, 01h ; save 11682 <1> ;mov cx, 0Fh 11683 <1> mov cl, 0Fh 11684 <1> xor ebx, ebx ; points to VBE3SAVERESTOREBLOCK 11685 <1> 11686 <1> call int10h_32bit_pmi 11687 <1> 11688 <1> movzx ecx, byte [vbe3stbufsize]; <=32 11689 <1> ;shl cx, 4 ; dword count for movsd 11690 <1> ; 02/08/2022 11691 <1> shl ecx, 4 ; <= 32*16 dwords (32*64 bytes) 11692 <1> mov esi, VBE3SAVERESTOREBLOCK ; destination 11693 <1> ; (vbe3 pmi buff) 11694 <1> mov edi, VBE3VIDEOSTATE ; source (kernel buff) 11695 <1> rep movsd 11696 <1> retn 11697 <1> 11698 <1> dispi_set_bank_farcall: 11699 <1> ; 03/08/2022 11700 <1> ; 12/04/2021 (32 bit push/pop) 11701 <1> ; 11/12/2020 11702 <1> ; (This may be 'sysvideo' function, later) 11703 <1> ; 11704 <1> ; Input: 11705 <1> ; bx = 0000h, set bank number 11706 <1> ; = 0100h, get bank number 11707 <1> ; dx = bank number (if bx = 0) 11708 <1> ; Output: 11709 <1> ; dx = bank number 11710 <1> 11711 <1> cmp bx, 0100h 11712 <1> je short dispi_set_bank_farcall_get 11713 <1> or bx, bx 11714 <1> ;jnz dispi_set_bank_farcall_error 11715 <1> ; 03/08/2022 11716 <1> jz short dsbfcall_1 11717 <1> jmp dispi_set_bank_farcall_error 11718 <1> dsbfcall_1: 11719 <1> mov ax, dx 11720 <1> ;push dx 11721 <1> ;push ax 11722 <1> ; 12/04/2021 11723 <1> push edx 11724 <1> push eax 11725 <1> mov ax, VBE_DISPI_INDEX_BANK 11726 <1> mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 11727 <1> out dx, ax 11728 <1> ;pop ax 11729 <1> ; 12/04/2021 11730 <1> pop eax 11731 <1> ;;mov dx, VBE_DISPI_IOPORT_DATA 11732 <1> ;mov dl, 0CFh 11733 <1> inc dl ; 1CFh = VBE_DISPI_IOPORT_DATA 11734 <1> out dx, ax 11735 <1> in ax, dx 11736 <1> ;pop dx 11737 <1> ; 12/04/2021 11738 <1> pop edx 11739 <1> cmp dx, ax 11740 <1> jne short dispi_set_bank_farcall_error 11741 <1> mov ax, 004Fh 11742 <1> retn ; retf for real mode far call 11743 <1> dispi_set_bank_farcall_get: 11744 <1> mov ax, VBE_DISPI_INDEX_BANK 11745 <1> ; 03/08/2022 11746 <1> mov dx, 1CEh ; VBE_DISPI_IOPORT_INDEX 11747 <1> out dx, ax 11748 <1> ;;mov dx, VBE_DISPI_IOPORT_DATA 11749 <1> ;mov dl, 0CFh 11750 <1> ; 03/08/2022 11751 <1> inc dl ; 1CFh = VBE_DISPI_IOPORT_DATA 11752 <1> in ax, dx 11753 <1> mov dx, ax 11754 <1> retn ; retf for real mode far call 11755 <1> dispi_set_bank_farcall_error: 11756 <1> mov ax, 014Fh 11757 <1> retn ; retf for real mode far call 11758 <1> 11759 <1> %endif 11760 <1> 11761 <1> ; % include 'vidata.s' ; VIDEO DATA 11762 <1> 11763 <1> ; /// End Of VIDEO FUNCTIONS /// 2992 2993 setup_rtc_int: 2994 ; source: http://wiki.osdev.org/RTC 2995 00004100 FA cli ; disable interrupts 2996 ; default int frequency is 1024 Hz (Lower 4 bits of register A is 0110b or 6) 2997 ; in order to change this ... 2998 ; frequency = 32768 >> (rate-1) --> 32768 >> 5 = 1024 2999 ; (rate must be above 2 and not over 15) 3000 ; new rate = 15 --> 32768 >> (15-1) = 2 Hz 3001 00004101 B08A mov al, 8Ah 3002 00004103 E670 out 70h, al ; set index to register A, disable NMI 3003 00004105 90 nop 3004 00004106 E471 in al, 71h ; get initial value of register A 3005 00004108 88C4 mov ah, al 3006 0000410A 80E4F0 and ah, 0F0h 3007 0000410D B08A mov al, 8Ah 3008 0000410F E670 out 70h, al ; reset index to register A 3009 00004111 88E0 mov al, ah 3010 00004113 0C0F or al, 0Fh ; new rate (0Fh -> 15) 3011 00004115 E671 out 71h, al ; write only our rate to A. Note, rate is the bottom 4 bits. 3012 ; enable RTC interrupt 3013 00004117 B08B mov al, 8Bh ; 3014 00004119 E670 out 70h, al ; select register B and disable NMI 3015 0000411B 90 nop 3016 0000411C E471 in al, 71h ; read the current value of register B 3017 0000411E 88C4 mov ah, al ; 3018 00004120 B08B mov al, 8Bh ; 3019 00004122 E670 out 70h, al ; set the index again (a read will reset the index to register B) 3020 00004124 88E0 mov al, ah ; 3021 00004126 0C40 or al, 40h ; 3022 00004128 E671 out 71h, al ; write the previous value ORed with 0x40. This turns on bit 6 of register B 3023 0000412A FB sti 3024 0000412B C3 retn 3025 3026 ; Write memory information 3027 ; 29/01/2016 3028 ; 06/11/2014 3029 ; 14/08/2015 3030 memory_info: 3031 0000412C A1[B4760100] mov eax, [memory_size] ; in pages 3032 00004131 50 push eax 3033 00004132 C1E00C shl eax, 12 ; in bytes 3034 00004135 BB0A000000 mov ebx, 10 3035 0000413A 89D9 mov ecx, ebx ; 10 3036 0000413C BE[71380100] mov esi, mem_total_b_str 3037 00004141 E8D8000000 call bintdstr 3038 00004146 58 pop eax 3039 00004147 B107 mov cl, 7 3040 00004149 BE[95380100] mov esi, mem_total_p_str 3041 0000414E E8CB000000 call bintdstr 3042 ; 14/08/2015 3043 00004153 E8E3000000 call calc_free_mem 3044 ; edx = calculated free pages 3045 ; ecx = 0 3046 00004158 A1[B8760100] mov eax, [free_pages] 3047 0000415D 39D0 cmp eax, edx ; calculated free mem value 3048 ; and initial free mem value are same or not? 3049 0000415F 751D jne short pmim ; print mem info with '?' if not 3050 00004161 52 push edx ; free memory in pages 3051 ;mov eax, edx 3052 00004162 C1E00C shl eax, 12 ; convert page count 3053 ; to byte count 3054 00004165 B10A mov cl, 10 3055 00004167 BE[B5380100] mov esi, free_mem_b_str 3056 0000416C E8AD000000 call bintdstr 3057 00004171 58 pop eax 3058 00004172 B107 mov cl, 7 3059 00004174 BE[D9380100] mov esi, free_mem_p_str 3060 00004179 E8A0000000 call bintdstr 3061 pmim: 3062 0000417E BE[5F380100] mov esi, msg_memory_info 3063 ; 3064 00004183 B407 mov ah, 07h ; Black background, 3065 ; light gray forecolor 3066 print_kmsg: ; 29/01/2016 3067 00004185 8825[DF760100] mov [ccolor], ah 3068 pkmsg_loop: 3069 0000418B AC lodsb 3070 0000418C 08C0 or al, al 3071 0000418E 7410 jz short pkmsg_ok 3072 00004190 56 push esi 3073 ; 13/05/2016 3074 00004191 0FB61D[DF760100] movzx ebx, byte [ccolor] 3075 ; Video page 0 (bh=0) 3076 00004198 E842E1FFFF call _write_tty 3077 0000419D 5E pop esi 3078 0000419E EBEB jmp short pkmsg_loop 3079 pkmsg_ok: 3080 000041A0 C3 retn 3081 3082 ; 19/12/2020 3083 ; temporary 3084 ; Write default liner frame buffer address 3085 ; 3086 default_lfb_info: 3087 000041A1 66A1[100F0000] mov ax, [def_LFB_addr] ; high word 3088 ; 24/11/2023 - temporary 3089 000041A7 6609C0 or ax, ax 3090 000041AA 74F4 jz short pkmsg_ok 3091 000041AC E829000000 call wordtohex 3092 000041B1 A3[31390100] mov dword [lfb_addr_str], eax 3093 000041B6 BE[1A390100] mov esi, msg_lfb_addr 3094 000041BB B40F mov ah, 0Fh ; Black background, 3095 ; white forecolor 3096 000041BD EBC6 jmp short print_kmsg 3097 3098 ; Convert binary number to hexadecimal string 3099 ; 10/05/2015 3100 ; dsectpm.s (28/02/2015) 3101 ; Retro UNIX 386 v1 - Kernel v0.2.0.6 3102 ; 01/12/2014 3103 ; 25/11/2014 3104 ; 3105 bytetohex: 3106 ; INPUT -> 3107 ; AL = byte (binary number) 3108 ; OUTPUT -> 3109 ; AX = hexadecimal string 3110 ; 3111 000041BF 53 push ebx 3112 000041C0 31DB xor ebx, ebx 3113 000041C2 88C3 mov bl, al 3114 000041C4 C0EB04 shr bl, 4 3115 000041C7 8A9B[0D420000] mov bl, [ebx+hexchrs] 3116 000041CD 86D8 xchg bl, al 3117 000041CF 80E30F and bl, 0Fh 3118 000041D2 8AA3[0D420000] mov ah, [ebx+hexchrs] 3119 000041D8 5B pop ebx 3120 000041D9 C3 retn 3121 3122 wordtohex: 3123 ; INPUT -> 3124 ; AX = word (binary number) 3125 ; OUTPUT -> 3126 ; EAX = hexadecimal string 3127 ; 3128 000041DA 53 push ebx 3129 000041DB 31DB xor ebx, ebx 3130 000041DD 86E0 xchg ah, al 3131 000041DF 6650 push ax ; * save ax 3132 000041E1 88E3 mov bl, ah 3133 000041E3 C0EB04 shr bl, 4 3134 000041E6 8A83[0D420000] mov al, [ebx+hexchrs] 3135 000041EC 88E3 mov bl, ah 3136 000041EE 80E30F and bl, 0Fh 3137 000041F1 8AA3[0D420000] mov ah, [ebx+hexchrs] 3138 000041F7 C1E010 shl eax, 16 ; ax -> hw of eax 3139 000041FA 6658 pop ax ; * restore ax 3140 000041FC 5B pop ebx 3141 000041FD EBC0 jmp short bytetohex 3142 ;mov bl, al 3143 ;shr bl, 4 3144 ;mov bl, [ebx+hexchrs] 3145 ;xchg bl, al 3146 ;and bl, 0Fh 3147 ;mov ah, [ebx+hexchrs] 3148 ;pop ebx 3149 ;retn 3150 3151 dwordtohex: 3152 ; INPUT -> 3153 ; EAX = dword (binary number) 3154 ; OUTPUT -> 3155 ; EDX:EAX = hexadecimal string 3156 ; 3157 000041FF 50 push eax 3158 00004200 C1E810 shr eax, 16 3159 00004203 E8D2FFFFFF call wordtohex 3160 00004208 89C2 mov edx, eax 3161 0000420A 58 pop eax 3162 ;call wordtohex 3163 ;retn 3164 ; 18/04/2021 3165 0000420B EBCD jmp short wordtohex 3166 3167 ; 10/05/2015 3168 hex_digits: 3169 hexchrs: 3170 0000420D 303132333435363738- db '0123456789ABCDEF' 3170 00004216 39414243444546 3171 ; 19/01/2021 - VESA EDID ready flag (4Fh) 3172 0000421D 00 edid: db 0 3173 3174 ; Convert binary number to decimal/numeric string 3175 ; 06/11/2014 3176 ; Temporary Code 3177 ; 3178 3179 bintdstr: 3180 ; EAX = binary number 3181 ; ESI = decimal/numeric string address 3182 ; EBX = divisor (10) 3183 ; ECX = string length (<=10) 3184 0000421E 01CE add esi, ecx 3185 btdstr0: 3186 00004220 4E dec esi 3187 00004221 31D2 xor edx, edx 3188 00004223 F7F3 div ebx 3189 00004225 80C230 add dl, 30h 3190 00004228 8816 mov [esi], dl 3191 0000422A FEC9 dec cl 3192 0000422C 740C jz short btdstr2 ; 08/09/2016 3193 0000422E 09C0 or eax, eax 3194 00004230 75EE jnz short btdstr0 3195 btdstr1: 3196 00004232 4E dec esi 3197 00004233 C60620 mov byte [esi], 20h ; blank space 3198 00004236 FEC9 dec cl 3199 00004238 75F8 jnz short btdstr1 3200 btdstr2: 3201 0000423A C3 retn 3202 3203 ; Calculate free memory pages on M.A.T. 3204 ; 06/11/2014 3205 ; Temporary Code 3206 ; 3207 3208 calc_free_mem: 3209 0000423B 31D2 xor edx, edx 3210 ;xor ecx, ecx 3211 0000423D 668B0D[C8760100] mov cx, [mat_size] ; in pages 3212 00004244 C1E10A shl ecx, 10 ; 1024 dwords per page 3213 00004247 BE00001000 mov esi, MEM_ALLOC_TBL 3214 cfm0: 3215 0000424C AD lodsd 3216 0000424D 51 push ecx 3217 0000424E B920000000 mov ecx, 32 3218 cfm1: 3219 00004253 D1E8 shr eax, 1 3220 00004255 7301 jnc short cfm2 3221 00004257 42 inc edx 3222 cfm2: 3223 00004258 E2F9 loop cfm1 3224 0000425A 59 pop ecx 3225 0000425B E2EF loop cfm0 3226 0000425D C3 retn 3227 3228 %include 'diskio.s' ; 07/03/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.8 - diskio.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 23/06/2024 (Previous: 02/12/2023 - Kernel v2.0.7) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; diskio.inc (22/08/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> ; Ref: Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 'diskio' modification: 12/07/2022 19 <1> 20 <1> ; Retro UNIX 386 v1 Kernel - DISKIO.INC 21 <1> ; Last Modification: 22/08/2015 22 <1> ; (Initialized Disk Parameters Data is in 'DISKDATA.INC') 23 <1> ; (Uninitialized Disk Parameters Data is in 'DISKBSS.INC') 24 <1> 25 <1> ; DISK I/O SYSTEM - Erdogan Tan (Retro UNIX 386 v1 project) 26 <1> 27 <1> ; ///////// DISK I/O SYSTEM /////////////// 28 <1> 29 <1> ; 11/04/2021 30 <1> ;; 06/02/2015 31 <1> ;diskette_io: 32 <1> ;clc ; 20/07/2020 33 <1> ;pushfd 34 <1> ;push cs 35 <1> ;;call DISKETTE_IO_1 36 <1> ;;retn 37 <1> 38 <1> ;;;;;; DISKETTE I/O ;;;;;;;;;;;;;;;;;;;; 06/02/2015 ;;; 39 <1> ;////////////////////////////////////////////////////// 40 <1> 41 <1> ; DISKETTE I/O - Erdogan Tan (Retro UNIX 386 v1 project) 42 <1> ; 20/02/2015 43 <1> ; 06/02/2015 (unix386.s) 44 <1> ; 16/12/2014 - 02/01/2015 (dsectrm2.s) 45 <1> ; 46 <1> ; Code (DELAY) modifications - AWARD BIOS 1999 (ADISK.EQU, COMMON.MAC) 47 <1> ; 48 <1> ; ADISK.EQU 49 <1> 50 <1> ;----- Wait control constants 51 <1> 52 <1> ;amount of time to wait while RESET is active. 53 <1> 54 <1> WAITCPU_RESET_ON EQU 21 ;Reset on must last at least 14us 55 <1> ;at 250 KBS xfer rate. 56 <1> ;see INTEL MCS, 1985, pg. 5-456 57 <1> 58 <1> WAITCPU_FOR_STATUS EQU 100 ;allow 30 microseconds for 59 <1> ;status register to become valid 60 <1> ;before re-reading. 61 <1> 62 <1> ;After sending a byte to NEC, status register may remain 63 <1> ;incorrectly set for 24 us. 64 <1> 65 <1> WAITCPU_RQM_LOW EQU 24 ;number of loops to check for 66 <1> ;RQM low. 67 <1> 68 <1> ; COMMON.MAC 69 <1> ; 70 <1> ; Timing macros 71 <1> ; 72 <1> 73 <1> %macro SIODELAY 0 ; SHORT IODELAY 74 <1> jmp short $+2 75 <1> %endmacro 76 <1> 77 <1> %macro IODELAY 0 ; NORMAL IODELAY 78 <1> jmp short $+2 79 <1> jmp short $+2 80 <1> %endmacro 81 <1> 82 <1> %macro NEWIODELAY 0 83 <1> out 0EBh, al 84 <1> %endmacro 85 <1> 86 <1> ; (According to) AWARD BIOS 1999 - ATORGS.ASM (dw -> equ, db -> equ) 87 <1> ;;; WAIT_FOR_MEM 88 <1> ;WAIT_FDU_INT_LO equ 017798 ; 2.5 secs in 30 micro units. 89 <1> ;WAIT_FDU_INT_HI equ 1 90 <1> WAIT_FDU_INT_LH equ 83334 ; 27/02/2015 (2.5 seconds waiting) 91 <1> ;;; WAIT_FOR_PORT 92 <1> ;WAIT_FDU_SEND_LO equ 16667 ; .5 secons in 30 us units. 93 <1> ;WAIT_FDU_SEND_HI equ 0 94 <1> WAIT_FDU_SEND_LH equ 16667 ; 27/02/2015 95 <1> ;Time to wait while waiting for each byte of NEC results = .5 96 <1> ;seconds. .5 seconds = 500,000 micros. 500,000/30 = 16,667. 97 <1> ;WAIT_FDU_RESULTS_LO equ 16667 ; .5 seconds in 30 micro units. 98 <1> ;WAIT_FDU_RESULTS_HI equ 0 99 <1> WAIT_FDU_RESULTS_LH equ 16667 ; 27/02/2015 100 <1> ;;; WAIT_REFRESH 101 <1> ;amount of time to wait for head settle, per unit in parameter 102 <1> ;table = 1 ms. 103 <1> WAIT_FDU_HEAD_SETTLE equ 33 ; 1 ms in 30 micro units. 104 <1> 105 <1> 106 <1> ; //////////////// DISKETTE I/O //////////////// 107 <1> 108 <1> ; 11/12/2014 (copy from IBM PC-XT Model 286 BIOS - POSTEQU.INC) 109 <1> 110 <1> ;---------------------------------------- 111 <1> ; EQUATES USED BY POST AND BIOS : 112 <1> ;---------------------------------------- 113 <1> 114 <1> ;--------- 8042 KEYBOARD INTERFACE AND DIAGNOSTIC CONTROL REGISTERS ------------ 115 <1> ;PORT_A EQU 060H ; 8042 KEYBOARD SCAN CODE/CONTROL PORT 116 <1> ;PORT_B EQU 061H ; PORT B READ/WRITE DIAGNOSTIC REGISTER 117 <1> ;REFRESH_BIT EQU 00010000B ; REFRESH TEST BIT 118 <1> 119 <1> ;---------------------------------------- 120 <1> ; CMOS EQUATES FOR THIS SYSTEM : 121 <1> ;------------------------------------------------------------------------------- 122 <1> ;CMOS_PORT EQU 070H ; I/O ADDRESS OF CMOS ADDRESS PORT 123 <1> ;CMOS_DATA EQU 071H ; I/O ADDRESS OF CMOS DATA PORT 124 <1> ;NMI EQU 10000000B ; DISABLE NMI INTERRUPTS MASK - 125 <1> ; HIGH BIT OF CMOS LOCATION ADDRESS 126 <1> 127 <1> ;---------- CMOS TABLE LOCATION ADDRESS'S ## ----------------------------------- 128 <1> CMOS_DISKETTE EQU 010H ; DISKETTE DRIVE TYPE BYTE ; 129 <1> ; EQU 011H ; - RESERVED ;C 130 <1> CMOS_DISK EQU 012H ; FIXED DISK TYPE BYTE ;H 131 <1> ; EQU 013H ; - RESERVED ;E 132 <1> CMOS_EQUIP EQU 014H ; EQUIPMENT WORD LOW BYTE ;C 133 <1> 134 <1> ;---------- DISKETTE EQUATES --------------------------------------------------- 135 <1> INT_FLAG EQU 10000000B ; INTERRUPT OCCURRENCE FLAG 136 <1> DSK_CHG EQU 10000000B ; DISKETTE CHANGE FLAG MASK BIT 137 <1> DETERMINED EQU 00010000B ; SET STATE DETERMINED IN STATE BITS 138 <1> HOME EQU 00010000B ; TRACK 0 MASK 139 <1> SENSE_DRV_ST EQU 00000100B ; SENSE DRIVE STATUS COMMAND 140 <1> TRK_SLAP EQU 030H ; CRASH STOP (48 TPI DRIVES) 141 <1> QUIET_SEEK EQU 00AH ; SEEK TO TRACK 10 142 <1> ;MAX_DRV EQU 2 ; MAX NUMBER OF DRIVES 143 <1> HD12_SETTLE EQU 15 ; 1.2 M HEAD SETTLE TIME 144 <1> HD320_SETTLE EQU 20 ; 320 K HEAD SETTLE TIME 145 <1> MOTOR_WAIT EQU 37 ; 2 SECONDS OF COUNTS FOR MOTOR TURN OFF 146 <1> 147 <1> ;---------- DISKETTE ERRORS ---------------------------------------------------- 148 <1> ;TIME_OUT EQU 080H ; ATTACHMENT FAILED TO RESPOND 149 <1> ;BAD_SEEK EQU 040H ; SEEK OPERATION FAILED 150 <1> BAD_NEC EQU 020H ; DISKETTE CONTROLLER HAS FAILED 151 <1> BAD_CRC EQU 010H ; BAD CRC ON DISKETTE READ 152 <1> MED_NOT_FND EQU 00CH ; MEDIA TYPE NOT FOUND 153 <1> DMA_BOUNDARY EQU 009H ; ATTEMPT TO DMA ACROSS 64K BOUNDARY 154 <1> BAD_DMA EQU 008H ; DMA OVERRUN ON OPERATION 155 <1> MEDIA_CHANGE EQU 006H ; MEDIA REMOVED ON DUAL ATTACH CARD 156 <1> RECORD_NOT_FND EQU 004H ; REQUESTED SECTOR NOT FOUND 157 <1> WRITE_PROTECT EQU 003H ; WRITE ATTEMPTED ON WRITE PROTECT DISK 158 <1> BAD_ADDR_MARK EQU 002H ; ADDRESS MARK NOT FOUND 159 <1> BAD_CMD EQU 001H ; BAD COMMAND PASSED TO DISKETTE I/O 160 <1> 161 <1> ;---------- DISK CHANGE LINE EQUATES ------------------------------------------- 162 <1> NOCHGLN EQU 001H ; NO DISK CHANGE LINE AVAILABLE 163 <1> CHGLN EQU 002H ; DISK CHANGE LINE AVAILABLE 164 <1> 165 <1> ;---------- MEDIA/DRIVE STATE INDICATORS --------------------------------------- 166 <1> TRK_CAPA EQU 00000001B ; 80 TRACK CAPABILITY 167 <1> FMT_CAPA EQU 00000010B ; MULTIPLE FORMAT CAPABILITY (1.2M) 168 <1> DRV_DET EQU 00000100B ; DRIVE DETERMINED 169 <1> MED_DET EQU 00010000B ; MEDIA DETERMINED BIT 170 <1> DBL_STEP EQU 00100000B ; DOUBLE STEP BIT 171 <1> RATE_MSK EQU 11000000B ; MASK FOR CLEARING ALL BUT RATE 172 <1> RATE_500 EQU 00000000B ; 500 KBS DATA RATE 173 <1> RATE_300 EQU 01000000B ; 300 KBS DATA RATE 174 <1> RATE_250 EQU 10000000B ; 250 KBS DATA RATE 175 <1> STRT_MSK EQU 00001100B ; OPERATION START RATE MASK 176 <1> SEND_MSK EQU 11000000B ; MASK FOR SEND RATE BITS 177 <1> 178 <1> ;---------- MEDIA/DRIVE STATE INDICATORS COMPATIBILITY ------------------------- 179 <1> M3D3U EQU 00000000B ; 360 MEDIA/DRIVE NOT ESTABLISHED 180 <1> M3D1U EQU 00000001B ; 360 MEDIA,1.2DRIVE NOT ESTABLISHED 181 <1> M1D1U EQU 00000010B ; 1.2 MEDIA/DRIVE NOT ESTABLISHED 182 <1> MED_UNK EQU 00000111B ; NONE OF THE ABOVE 183 <1> 184 <1> ;---------- INTERRUPT EQUATES -------------------------------------------------- 185 <1> ;EOI EQU 020H ; END OF INTERRUPT COMMAND TO 8259 186 <1> ;INTA00 EQU 020H ; 8259 PORT 187 <1> INTA01 EQU 021H ; 8259 PORT 188 <1> INTB00 EQU 0A0H ; 2ND 8259 189 <1> INTB01 EQU 0A1H ; 190 <1> 191 <1> ;------------------------------------------------------------------------------- 192 <1> DMA08 EQU 008H ; DMA STATUS REGISTER PORT ADDRESS 193 <1> DMA EQU 000H ; DMA CH.0 ADDRESS REGISTER PORT ADDRESS 194 <1> DMA18 EQU 0D0H ; 2ND DMA STATUS PORT ADDRESS 195 <1> DMA1 EQU 0C0H ; 2ND DMA CH.0 ADDRESS REGISTER ADDRESS 196 <1> ;------------------------------------------------------------------------------- 197 <1> ;TIMER EQU 040H ; 8254 TIMER - BASE ADDRESS 198 <1> 199 <1> ;------------------------------------------------------------------------------- 200 <1> DMA_PAGE EQU 081H ; START OF DMA PAGE REGISTERS 201 <1> 202 <1> ; 06/02/2015 (unix386.s, protected mode modifications) 203 <1> ; (unix386.s <-- dsectrm2.s) 204 <1> ; 11/12/2014 (copy from IBM PC-XT Model 286 BIOS - DSEG.INC) 205 <1> 206 <1> ; 27/05/2016 - TRDOS 386 (TRDOS v2.0) 207 <1> ; 10/12/2014 208 <1> ; 209 <1> ;int40h: 210 <1> ; pushf 211 <1> ; push cs 212 <1> ; ;cli 213 <1> ; call DISKETTE_IO_1 214 <1> ; retn 215 <1> 216 <1> ; DSKETTE ----- 04/21/86 DISKETTE BIOS 217 <1> ; (IBM PC XT Model 286 System BIOS Source Code, 04-21-86) 218 <1> ; 219 <1> 220 <1> ;-- INT13H --------------------------------------------------------------------- 221 <1> ; DISKETTE I/O 222 <1> ; THIS INTERFACE PROVIDES ACCESS TO THE 5 1/4 INCH 360 KB, 223 <1> ; 1.2 MB, 720 KB AND 1.44 MB DISKETTE DRIVES. 224 <1> ; INPUT 225 <1> ; (AH) = 00H RESET DISKETTE SYSTEM 226 <1> ; HARD RESET TO NEC, PREPARE COMMAND, RECALIBRATE REQUIRED 227 <1> ; ON ALL DRIVES 228 <1> ;------------------------------------------------------------------------------- 229 <1> ; (AH)= 01H READ THE STATUS OF THE SYSTEM INTO (AH) 230 <1> ; @DISKETTE_STATUS FROM LAST OPERATION IS USED 231 <1> ;------------------------------------------------------------------------------- 232 <1> ; REGISTERS FOR READ/WRITE/VERIFY/FORMAT 233 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHECKED) 234 <1> ; (DH) - HEAD NUMBER (0-1 ALLOWED, NOT VALUE CHECKED) 235 <1> ; (CH) - TRACK NUMBER (NOT VALUE CHECKED) 236 <1> ; MEDIA DRIVE TRACK NUMBER 237 <1> ; 320/360 320/360 0-39 238 <1> ; 320/360 1.2M 0-39 239 <1> ; 1.2M 1.2M 0-79 240 <1> ; 720K 720K 0-79 241 <1> ; 1.44M 1.44M 0-79 242 <1> ; (CL) - SECTOR NUMBER (NOT VALUE CHECKED, NOT USED FOR FORMAT) 243 <1> ; MEDIA DRIVE SECTOR NUMBER 244 <1> ; 320/360 320/360 1-8/9 245 <1> ; 320/360 1.2M 1-8/9 246 <1> ; 1.2M 1.2M 1-15 247 <1> ; 720K 720K 1-9 248 <1> ; 1.44M 1.44M 1-18 249 <1> ; (AL) NUMBER OF SECTORS (NOT VALUE CHECKED) 250 <1> ; MEDIA DRIVE MAX NUMBER OF SECTORS 251 <1> ; 320/360 320/360 8/9 252 <1> ; 320/360 1.2M 8/9 253 <1> ; 1.2M 1.2M 15 254 <1> ; 720K 720K 9 255 <1> ; 1.44M 1.44M 18 256 <1> ; 257 <1> ; (ES:BX) - ADDRESS OF BUFFER (NOT REQUIRED FOR VERIFY) 258 <1> ; 259 <1> ;------------------------------------------------------------------------------- 260 <1> ; (AH)= 02H READ THE DESIRED SECTORS INTO MEMORY 261 <1> ;------------------------------------------------------------------------------- 262 <1> ; (AH)= 03H WRITE THE DESIRED SECTORS FROM MEMORY 263 <1> ;------------------------------------------------------------------------------- 264 <1> ; (AH)= 04H VERIFY THE DESIRED SECTORS 265 <1> ;------------------------------------------------------------------------------- 266 <1> ; (AH)= 05H FORMAT THE DESIRED TRACK 267 <1> ; (ES,BX) MUST POINT TO THE COLLECTION OF DESIRED ADDRESS FIELDS 268 <1> ; FOR THE TRACK. EACH FIELD IS COMPOSED OF 4 BYTES, (C,H,R,N), 269 <1> ; WHERE C = TRACK NUMBER, H=HEAD NUMBER, R = SECTOR NUMBER, 270 <1> ; N= NUMBER OF BYTES PER SECTOR (00=128,01=256,02=512,03=1024), 271 <1> ; THERE MUST BE ONE ENTRY FOR EVERY SECTOR ON THE TRACK. 272 <1> ; THIS INFORMATION IS USED TO FIND THE REQUESTED SECTOR DURING 273 <1> ; READ/WRITE ACCESS. 274 <1> ; PRIOR TO FORMATTING A DISKETTE, IF THERE EXISTS MORE THAN 275 <1> ; ONE SUPPORTED MEDIA FORMAT TYPE WITHIN THE DRIVE IN QUESTION, 276 <1> ; THEN "SET DASD TYPE" (INT 13H, AH = 17H) OR 'SET MEDIA TYPE' 277 <1> ; (INT 13H, AH = 18H) MUST BE CALLED TO SET THE DISKETTE TYPE 278 <1> ; THAT IS TO BE FORMATTED. IF "SET DASD TYPE" OR "SET MEDIA TYPE" 279 <1> ; IS NOT CALLED, THE FORMAT ROUTINE WILL ASSUME THE 280 <1> ; MEDIA FORMAT TO BE THE MAXIMUM CAPACITY OF THE DRIVE. 281 <1> ; 282 <1> ; THESE PARAMETERS OF DISK BASE MUST BE CHANGED IN ORDER TO 283 <1> ; FORMAT THE FOLLOWING MEDIAS: 284 <1> ; --------------------------------------------- 285 <1> ; : MEDIA : DRIVE : PARM 1 : PARM 2 : 286 <1> ; --------------------------------------------- 287 <1> ; : 320K : 320K/360K/1.2M : 50H : 8 : 288 <1> ; : 360K : 320K/360K/1.2M : 50H : 9 : 289 <1> ; : 1.2M : 1.2M : 54H : 15 : 290 <1> ; : 720K : 720K/1.44M : 50H : 9 : 291 <1> ; : 1.44M : 1.44M : 6CH : 18 : 292 <1> ; --------------------------------------------- 293 <1> ; NOTES: - PARM 1 = GAP LENGTH FOR FORMAT 294 <1> ; - PARM 2 = EOT (LAST SECTOR ON TRACK) 295 <1> ; - DISK BASE IS POINTED BY DISK POINTER LOCATED 296 <1> ; AT ABSOLUTE ADDRESS 0:78. 297 <1> ; - WHEN FORMAT OPERATIONS ARE COMPLETE, THE PARAMETERS 298 <1> ; SHOULD BE RESTORED TO THEIR RESPECTIVE INITIAL VALUES. 299 <1> ;------------------------------------------------------------------------------- 300 <1> ; (AH) = 08H READ DRIVE PARAMETERS 301 <1> ; REGISTERS 302 <1> ; INPUT 303 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHECKED) 304 <1> ; ** 27/05/2016 - TRDOS 386 (TRDOS v2.0) ** 305 <1> ; ** EBX = Buffer address for floppy disk parameters table ** 306 <1> ; OUTPUT 307 <1> ; (ES:DI) POINTS TO DRIVE PARAMETER TABLE 308 <1> ; *** TRDOS 386 note: floppy disk parameter table (16 bytes) 309 <1> ; will be returned to user in EBX, buffer address *** 27/05/2016 *** 310 <1> ; 311 <1> ; (CH) - LOW ORDER 8 OF 10 BITS MAXIMUM NUMBER OF TRACKS 312 <1> ; (CL) - BITS 7 & 6 - HIGH ORDER TWO BITS OF MAXIMUM TRACKS 313 <1> ; BITS 5 THRU 0 - MAXIMUM SECTORS PER TRACK 314 <1> ; (DH) - MAXIMUM HEAD NUMBER 315 <1> ; (DL) - NUMBER OF DISKETTE DRIVES INSTALLED 316 <1> ; (BH) - 0 317 <1> ; (BL) - BITS 7 THRU 4 - 0 318 <1> ; BITS 3 THRU 0 - VALID DRIVE TYPE VALUE IN CMOS 319 <1> ; (AX) - 0 320 <1> ; UNDER THE FOLLOWING CIRCUMSTANCES: 321 <1> ; (1) THE DRIVE NUMBER IS INVALID, 322 <1> ; (2) THE DRIVE TYPE IS UNKNOWN AND CMOS IS NOT PRESENT, 323 <1> ; (3) THE DRIVE TYPE IS UNKNOWN AND CMOS IS BAD, 324 <1> ; (4) OR THE DRIVE TYPE IS UNKNOWN AND THE CMOS DRIVE TYPE IS INVALID 325 <1> ; THEN ES,AX,BX,CX,DH,DI=0 ; DL=NUMBER OF DRIVES. 326 <1> ; IF NO DRIVES ARE PRESENT THEN: ES,AX,BX,CX,DX,DI=0. 327 <1> ; @DISKETTE_STATUS = 0 AND CY IS RESET. 328 <1> ;------------------------------------------------------------------------------- 329 <1> ; (AH)= 15H READ DASD TYPE 330 <1> ; OUTPUT REGISTERS 331 <1> ; (AH) - ON RETURN IF CARRY FLAG NOT SET, OTHERWISE ERROR 332 <1> ; 00 - DRIVE NOT PRESENT 333 <1> ; 01 - DISKETTE, NO CHANGE LINE AVAILABLE 334 <1> ; 02 - DISKETTE, CHANGE LINE AVAILABLE 335 <1> ; 03 - RESERVED (FIXED DISK) 336 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHECKED) 337 <1> ;------------------------------------------------------------------------------- 338 <1> ; (AH)= 16H DISK CHANGE LINE STATUS 339 <1> ; OUTPUT REGISTERS 340 <1> ; (AH) - 00 - DISK CHANGE LINE NOT ACTIVE 341 <1> ; 06 - DISK CHANGE LINE ACTIVE & CARRY BIT ON 342 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHECKED) 343 <1> ;------------------------------------------------------------------------------- 344 <1> ; (AH)= 17H SET DASD TYPE FOR FORMAT 345 <1> ; INPUT REGISTERS 346 <1> ; (AL) - 00 - NOT USED 347 <1> ; 01 - DISKETTE 320/360K IN 360K DRIVE 348 <1> ; 02 - DISKETTE 360K IN 1.2M DRIVE 349 <1> ; 03 - DISKETTE 1.2M IN 1.2M DRIVE 350 <1> ; 04 - DISKETTE 720K IN 720K DRIVE 351 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHECKED: 352 <1> ; (DO NOT USE WHEN DISKETTE ATTACH CARD USED) 353 <1> ;------------------------------------------------------------------------------- 354 <1> ; (AH)= 18H SET MEDIA TYPE FOR FORMAT 355 <1> ; INPUT REGISTERS 356 <1> ; (CH) - LOW ORDER 8 OF 10 BITS MAXIMUM TRACKS 357 <1> ; (CL) - BITS 7 & 6 - HIGH ORDER TWO BITS OF MAXIMUM TRACKS 358 <1> ; BITS 5 THRU 0 - MAXIMUM SECTORS PER TRACK 359 <1> ; (DL) - DRIVE NUMBER (0-1 ALLOWED, VALUE CHACKED) 360 <1> ; OUTPUT REGISTERS: 361 <1> ; (ES:DI) - POINTER TO DRIVE PARAMETERS TABLE FOR THIS MEDIA TYPE, 362 <1> ; UNCHANGED IF (AH) IS NON-ZERO 363 <1> ; (AH) - 00H, CY = 0, TRACK AND SECTORS/TRACK COMBINATION IS SUPPORTED 364 <1> ; - 01H, CY = 1, FUNCTION IS NOT AVAILABLE 365 <1> ; - 0CH, CY = 1, TRACK AND SECTORS/TRACK COMBINATION IS NOT SUPPORTED 366 <1> ; - 80H, CY = 1, TIME OUT (DISKETTE NOT PRESENT) 367 <1> ;------------------------------------------------------------------------------- 368 <1> ; DISK CHANGE STATUS IS ONLY CHECKED WHEN A MEDIA SPECIFIED IS OTHER 369 <1> ; THAN 360 KB DRIVE. IF THE DISK CHANGE LINE IS FOUND TO BE 370 <1> ; ACTIVE THE FOLLOWING ACTIONS TAKE PLACE: 371 <1> ; ATTEMPT TO RESET DISK CHANGE LINE TO INACTIVE STATE. 372 <1> ; IF ATTEMPT SUCCEEDS SET DASD TYPE FOR FORMAT AND RETURN DISK 373 <1> ; CHANGE ERROR CODE 374 <1> ; IF ATTEMPT FAILS RETURN TIMEOUT ERROR CODE AND SET DASD TYPE 375 <1> ; TO A PREDETERMINED STATE INDICATING MEDIA TYPE UNKNOWN. 376 <1> ; IF THE DISK CHANGE LINE IN INACTIVE PERFORM SET DASD TYPE FOR FORMAT. 377 <1> ; 378 <1> ; DATA VARIABLE -- @DISK_POINTER 379 <1> ; DOUBLE WORD POINTER TO THE CURRENT SET OF DISKETTE PARAMETERS 380 <1> ;------------------------------------------------------------------------------- 381 <1> ; OUTPUT FOR ALL FUNCTIONS 382 <1> ; AH = STATUS OF OPERATION 383 <1> ; STATUS BITS ARE DEFINED IN THE EQUATES FOR @DISKETTE_STATUS 384 <1> ; VARIABLE IN THE DATA SEGMENT OF THIS MODULE 385 <1> ; CY = 0 SUCCESSFUL OPERATION (AH=0 ON RETURN, EXCEPT FOR READ DASD 386 <1> ; TYPE AH=(15)). 387 <1> ; CY = 1 FAILED OPERATION (AH HAS ERROR REASON) 388 <1> ; FOR READ/WRITE/VERIFY 389 <1> ; DS,BX,DX,CX PRESERVED 390 <1> ; NOTE: IF AN ERROR IS REPORTED BY THE DISKETTE CODE, THE APPROPRIATE 391 <1> ; ACTION IS TO RESET THE DISKETTE, THEN RETRY THE OPERATION. 392 <1> ; ON READ ACCESSES, NO MOTOR START DELAY IS TAKEN, SO THAT 393 <1> ; THREE RETRIES ARE REQUIRED ON READS TO ENSURE THAT THE 394 <1> ; PROBLEM IS NOT DUE TO MOTOR START-UP. 395 <1> ;------------------------------------------------------------------------------- 396 <1> ; 397 <1> ; DISKETTE STATE MACHINE - ABSOLUTE ADDRESS 40:90 (DRIVE A) & 91 (DRIVE B) 398 <1> ; 399 <1> ; ----------------------------------------------------------------- 400 <1> ; | | | | | | | | | 401 <1> ; | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 402 <1> ; | | | | | | | | | 403 <1> ; ----------------------------------------------------------------- 404 <1> ; | | | | | | | | 405 <1> ; | | | | | ----------------- 406 <1> ; | | | | | | 407 <1> ; | | | | RESERVED | 408 <1> ; | | | | PRESENT STATE 409 <1> ; | | | | 000: 360K IN 360K DRIVE UNESTABLISHED 410 <1> ; | | | | 001: 360K IN 1.2M DRIVE UNESTABLISHED 411 <1> ; | | | | 010: 1.2M IN 1.2M DRIVE UNESTABLISHED 412 <1> ; | | | | 011: 360K IN 360K DRIVE ESTABLISHED 413 <1> ; | | | | 100: 360K IN 1.2M DRIVE ESTABLISHED 414 <1> ; | | | | 101: 1.2M IN 1.2M DRIVE ESTABLISHED 415 <1> ; | | | | 110: RESERVED 416 <1> ; | | | | 111: NONE OF THE ABOVE 417 <1> ; | | | | 418 <1> ; | | | ------> MEDIA/DRIVE ESTABLISHED 419 <1> ; | | | 420 <1> ; | | --------------> DOUBLE STEPPING REQUIRED (360K IN 1.2M 421 <1> ; | | DRIVE) 422 <1> ; | | 423 <1> ; ------------------------------> DATA TRANSFER RATE FOR THIS DRIVE: 424 <1> ; 425 <1> ; 00: 500 KBS 426 <1> ; 01: 300 KBS 427 <1> ; 10: 250 KBS 428 <1> ; 11: RESERVED 429 <1> ; 430 <1> ; 431 <1> ;------------------------------------------------------------------------------- 432 <1> ; STATE OPERATION STARTED - ABSOLUTE ADDRESS 40:92 (DRIVE A) & 93 (DRIVE B) 433 <1> ;------------------------------------------------------------------------------- 434 <1> ; PRESENT CYLINDER NUMBER - ABSOLUTE ADDRESS 40:94 (DRIVE A) & 95 (DRIVE B) 435 <1> ;------------------------------------------------------------------------------- 436 <1> 437 <1> struc MD 438 00000000 ?? <1> .SPEC1 resb 1 ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 439 00000001 ?? <1> .SPEC2 resb 1 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 440 00000002 ?? <1> .OFF_TIM resb 1 ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 441 00000003 ?? <1> .BYT_SEC resb 1 ; 512 BYTES/SECTOR 442 00000004 ?? <1> .SEC_TRK resb 1 ; EOT (LAST SECTOR ON TRACK) 443 00000005 ?? <1> .GAP resb 1 ; GAP LENGTH 444 00000006 ?? <1> .DTL resb 1 ; DTL 445 00000007 ?? <1> .GAP3 resb 1 ; GAP LENGTH FOR FORMAT 446 00000008 ?? <1> .FIL_BYT resb 1 ; FILL BYTE FOR FORMAT 447 00000009 ?? <1> .HD_TIM resb 1 ; HEAD SETTLE TIME (MILLISECONDS) 448 0000000A ?? <1> .STR_TIM resb 1 ; MOTOR START TIME (1/8 SECONDS) 449 0000000B ?? <1> .MAX_TRK resb 1 ; MAX. TRACK NUMBER 450 0000000C ?? <1> .RATE resb 1 ; DATA TRANSFER RATE 451 <1> endstruc 452 <1> 453 <1> BIT7OFF EQU 7FH 454 <1> BIT7ON EQU 80H 455 <1> 456 <1> ; 30/08/2020 - TRDOS 386 v2 457 <1> 458 <1> ;;int13h: ; 16/02/2015 459 <1> ;; 16/02/2015 - 21/02/2015 460 <1> ; 17/07/2022 - TRDOS 386 v2.0.5 461 <1> ;int40h: 462 <1> ;; 11/04/2021 463 <1> ;diskette_io: 464 <1> ; clc ; 20/07/2020 465 <1> ; pushfd 466 <1> ; push cs 467 <1> ; call DISKETTE_IO_1 468 <1> ; retn 469 <1> 470 <1> ; 09/08/2022 471 <1> ; 06/08/2022 472 <1> ; 17/07/2022 - TRDOS 386 v2.0.5 473 <1> ; (jump from DISK_IO) 474 <1> DISKETTE_IO_1: 475 <1> ;sti ; 17/07/2022 ; INTERRUPTS BACK ON 476 <1> 477 <1> ;push ebp ; USER REGISTER 478 <1> ;push edi ; USER REGISTER 479 <1> ;push edx ; HEAD #, DRIVE # OR USER REGISTER 480 <1> ;push ebx ; BUFFER OFFSET PARAMETER OR REGISTER 481 <1> ;push ecx ; TRACK #-SECTOR # OR USER REGISTER 482 <1> ;mov ebp, esp ; BP => PARAMETER LIST DEP. ON AH 483 <1> ; [BP] = SECTOR # 484 <1> ; [BP+1] = TRACK # 485 <1> ; [BP+2] = BUFFER OFFSET 486 <1> ; FOR RETURN OF DRIVE PARAMETERS: 487 <1> ; CL/[BP] = BITS 7&6 HI BITS OF MAX CYL 488 <1> ; BITS 0-5 MAX SECTORS/TRACK 489 <1> ; CH/[BP+1] = LOW 8 BITS OF MAX CYL. 490 <1> ; BL/[BP+2] = BITS 7-4 = 0 491 <1> ; BITS 3-0 = VALID CMOS TYPE 492 <1> ; BH/[BP+3] = 0 493 <1> ; DL/[BP+4] = # DRIVES INSTALLED 494 <1> ; DH/[BP+5] = MAX HEAD # 495 <1> ; DI/[BP+6] = OFFSET TO DISK BASE 496 <1> ;push es ; 06/02/2015 497 <1> ;push ds ; BUFFER SEGMENT PARM OR USER REGISTER 498 <1> ;push esi ; USER REGISTERS 499 <1> ;;call DDS ; SEGMENT OF BIOS DATA AREA TO DS 500 <1> ;;mov cx, cs 501 <1> ;;mov ds, cx 502 <1> ;mov cx, KDATA 503 <1> ;mov ds, cx 504 <1> ;mov es, cx 505 <1> 506 <1> ; 17/07/2022 507 <1> ; Registers are also on stack 508 <1> ; (with same contents) 509 <1> ; in following order: 510 <1> ; 511 <1> ; ebx = esp+20 512 <1> ; ecx = esp+16 513 <1> ; edx = esp+12 514 <1> ; esi = esp+8 515 <1> ; edi = esp+4 516 <1> ; 517 <1> ; [esp] = caller's return address (from 'DISK_IO') 518 <1> ; 519 <1> ; cs = KCODE == KDATA 520 <1> ; ds = es = ss = KDATA 521 <1> 522 <1> ; 17/07/2022 523 0000425E 55 <1> push ebp 524 0000425F 89DD <1> mov ebp, ebx 525 <1> 526 <1> ;cmp ah, (FNC_TAE-FNC_TAB)/2 ; CHECK FOR > LARGEST FUNCTION 527 00004261 80FC19 <1> cmp ah, (FNC_TAE-FNC_TAB)/4 ; 18/02/2015 528 <1> ;jb short OK_FUNC ; FUNCTION OK 529 <1> ;mov ah, 14h ; REPLACE WITH KNOWN INVALID FUNCTION 530 <1> ; 09/08/2022 531 00004264 730F <1> jnb short INV_FUNC 532 <1> OK_FUNC: 533 00004266 80FC01 <1> cmp ah, 1 ; RESET OR STATUS ? 534 00004269 760C <1> jbe short OK_DRV ; IF RESET OR STATUS DRIVE ALWAYS OK 535 0000426B 80FC08 <1> cmp ah, 8 ; READ DRIVE PARMS ? 536 0000426E 7407 <1> je short OK_DRV ; IF SO DRIVE CHECKED LATER 537 00004270 80FA01 <1> cmp dl, 1 ; DRIVES 0 AND 1 OK 538 00004273 7602 <1> jbe short OK_DRV ; IF 0 OR 1 THEN JUMP 539 <1> INV_FUNC: 540 00004275 B414 <1> mov ah, 14h ; REPLACE WITH KNOWN INVALID FUNCTION 541 <1> OK_DRV: 542 <1> ; 17/07/2022 543 <1> ;xor ecx, ecx 544 <1> ;;mov esi, ecx ; 08/02/2015 545 <1> ;mov edi, ecx ; 08/02/2015 546 <1> ;mov cl, ah ; CL = FUNCTION 547 <1> ;;xor ch, ch ; CX = FUNCTION 548 <1> ;;shl cl, 1 ; FUNCTION TIMES 2 549 <1> ;shl cl, 2 ; 20/02/2015 ; FUNCTION TIMES 4 (for 32 bit offset) 550 <1> ;mov ebx, FNC_TAB ; LOAD START OF FUNCTION TABLE 551 <1> ;add ebx, ecx ; ADD OFFSET INTO TABLE => ROUTINE 552 <1> 553 <1> ; 17/07/2022 554 00004277 29DB <1> sub ebx, ebx 555 00004279 88E3 <1> mov bl, ah ; BL = FUNCTION 556 0000427B C0E302 <1> shl bl, 2 ; * 4 557 0000427E 81C3[9D420000] <1> add ebx, FNC_TAB ; [EBX] = FUNCTION ADDRESS 558 <1> 559 00004284 88F4 <1> mov ah, dh ; AX = HEAD #,# OF SECTORS OR DASD TYPE 560 <1> ;xor dh, dh ; DX = DRIVE # 561 <1> ;mov si, ax ; SI = HEAD #,# OF SECTORS OR DASD TYPE 562 <1> ;mov di, dx ; DI = DRIVE # 563 <1> 564 00004286 0FB7F0 <1> movzx esi, ax ; ESI = HEAD #,# OF SECTORS OR DASD TYPE 565 00004289 0FB6FA <1> movzx edi, dl ; EDI = DRIVE # 566 <1> 567 <1> ; CH = cylinder number (low 8 bit) 568 <1> ; CL = sector number (and high 2 bits of cylinder number) 569 <1> 570 <1> ; 06/08/2022 571 <1> ; 11/12/2014 572 <1> ;mov [cfd], dl ; current floppy drive (for 'GET_PARM') 573 <1> ; 06/08/2022 574 <1> ; EDI = (current) DRIVE # 575 <1> ; 576 0000428C 8A25[38770100] <1> mov ah, [DSKETTE_STATUS] ; LOAD STATUS TO AH FOR STATUS FUNCTION 577 00004292 C605[38770100]00 <1> mov byte [DSKETTE_STATUS], 0 ; INITIALIZE FOR ALL OTHERS 578 <1> 579 <1> ; THROUGHOUT THE DISKETTE BIOS, THE FOLLOWING INFORMATION IS CONTAINED IN 580 <1> ; THE FOLLOWING MEMORY LOCATIONS AND REGISTERS. NOT ALL DISKETTE BIOS 581 <1> ; FUNCTIONS REQUIRE ALL OF THESE PARAMETERS. 582 <1> ; 583 <1> ; DI : DRIVE # 584 <1> ; SI-HI : HEAD # 585 <1> ; SI-LOW : # OF SECTORS OR DASD TYPE FOR FORMAT 586 <1> ; ES : BUFFER SEGMENT 587 <1> ; [BP] : SECTOR # 588 <1> ; [BP+1] : TRACK # 589 <1> ; [BP+2] : BUFFER OFFSET 590 <1> ; 591 <1> ; ACROSS CALLS TO SUBROUTINES THE CARRY FLAG (CY=1), WHERE INDICATED IN 592 <1> ; SUBROUTINE PROLOGUES, REPRESENTS AN EXCEPTION RETURN (NORMALLY AN ERROR 593 <1> ; CONDITION). IN MOST CASES, WHEN CY = 1, @DSKETTE_STATUS CONTAINS THE 594 <1> ; SPECIFIC ERROR CODE. 595 <1> 596 <1> ; 17/07/2022 597 <1> ; EBX = pointer to function address 598 <1> ; EBP = buffer address 599 <1> ; EDI = drive number (0 or 1) 600 <1> ; ESI = head number (byte 1) and sector count or disk type (byte 0) 601 <1> ; CH = cylinder number (low 8 bit) 602 <1> ; CL = sector number (and high 2 bits of cylinder number) 603 <1> 604 <1> ; (AH) = @DSKETTE_STATUS 605 00004299 FF13 <1> call dword [ebx] ; CALL THE REQUESTED FUNCTION 606 <1> 607 <1> ;pop esi ; RESTORE ALL REGISTERS 608 <1> ;pop ds 609 <1> ;pop es ; 06/02/2015 610 <1> ;pop ecx 611 <1> ;pop ebx 612 <1> ;pop edx 613 <1> ;pop edi 614 <1> ;mov ebp, esp 615 <1> ;push eax 616 <1> ;pushfd 617 <1> ;pop eax 618 <1> ;;mov [bp+6], ax 619 <1> ;mov [ebp+12], eax ; 18/02/2015, flags 620 <1> ;pop eax 621 <1> ;pop ebp 622 <1> ;iretd 623 <1> 624 <1> ; 17/07/2022 625 0000429B 5D <1> pop ebp 626 <1> 627 <1> ; 17/07/2022 628 <1> ; Stack order: 629 <1> ; ebx = esp+20 630 <1> ; ecx = esp+16 631 <1> ; edx = esp+12 632 <1> ; esi = esp+8 633 <1> ; edi = esp+4 634 <1> ; 635 <1> ; [esp] = caller's return address (from 'DISK_IO') 636 <1> 637 <1> ; CF = disk i/o status (1 = error) 638 <1> ; AH = error code (if > 0 and cf = 1) 639 <1> 640 <1> ; 17/07/2022 641 0000429C C3 <1> retn ; return to the caller of 'DISK_IO' 642 <1> 643 <1> ;------------------------------------------------------------------------------- 644 <1> ; DW --> dd (06/02/2015) 645 0000429D [01430000] <1> FNC_TAB dd DSK_RESET ; AH = 00H; RESET 646 000042A1 [6C430000] <1> dd DSK_STATUS ; AH = 01H; STATUS 647 000042A5 [7C430000] <1> dd DSK_READ ; AH = 02H; READ 648 000042A9 [89430000] <1> dd DSK_WRITE ; AH = 03H; WRITE 649 000042AD [9D440000] <1> dd DSK_VERF ; AH = 04H; VERIFY 650 000042B1 [AD440000] <1> dd DSK_FORMAT ; AH = 05H; FORMAT 651 000042B5 [2B450000] <1> dd FNC_ERR ; AH = 06H; INVALID 652 000042B9 [2B450000] <1> dd FNC_ERR ; AH = 07H; INVALID 653 000042BD [37450000] <1> dd DSK_PARMS ; AH = 08H; READ DRIVE PARAMETERS 654 000042C1 [2B450000] <1> dd FNC_ERR ; AH = 09H; INVALID 655 000042C5 [2B450000] <1> dd FNC_ERR ; AH = 0AH; INVALID 656 000042C9 [2B450000] <1> dd FNC_ERR ; AH = 0BH; INVALID 657 000042CD [2B450000] <1> dd FNC_ERR ; AH = 0CH; INVALID 658 000042D1 [2B450000] <1> dd FNC_ERR ; AH = 0DH; INVALID 659 000042D5 [2B450000] <1> dd FNC_ERR ; AH = 0EH; INVALID 660 000042D9 [2B450000] <1> dd FNC_ERR ; AH = 0FH; INVALID 661 000042DD [2B450000] <1> dd FNC_ERR ; AH = 10H; INVALID 662 000042E1 [2B450000] <1> dd FNC_ERR ; AH = 11H; INVALID 663 000042E5 [2B450000] <1> dd FNC_ERR ; AH = 12H; INVALID 664 000042E9 [2B450000] <1> dd FNC_ERR ; AH = 13H; INVALID 665 000042ED [2B450000] <1> dd FNC_ERR ; AH = 14H; INVALID 666 000042F1 [F4450000] <1> dd DSK_TYPE ; AH = 15H; READ DASD TYPE 667 000042F5 [14460000] <1> dd DSK_CHANGE ; AH = 16H; CHANGE STATUS 668 000042F9 [43460000] <1> dd FORMAT_SET ; AH = 17H; SET DASD TYPE 669 000042FD [B8460000] <1> dd SET_MEDIA ; AH = 18H; SET MEDIA TYPE 670 <1> FNC_TAE EQU $ ; END 671 <1> 672 <1> ; 17/07/2022 - TRDOS 386 v2.0.5 673 <1> ;------------------------------------------------------------------------------- 674 <1> ; DISK_RESET (AH = 00H) 675 <1> ; RESET THE DISKETTE SYSTEM. 676 <1> ; 677 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 678 <1> ;------------------------------------------------------------------------------- 679 <1> DSK_RESET: 680 <1> ; 17/07/2022 681 00004301 66BAF203 <1> mov dx, 03F2h ; ADAPTER CONTROL PORT 682 00004305 FA <1> cli ; NO INTERRUPTS 683 00004306 A0[36770100] <1> mov al, [MOTOR_STATUS] ; GET DIGITAL OUTPUT REGISTER REFLECTION 684 0000430B 243F <1> and al, 00111111b ; KEEP SELECTED AND MOTOR ON BITS 685 0000430D C0C004 <1> rol al, 4 ; MOTOR VALUE TO HIGH NIBBLE 686 <1> ; DRIVE SELECT TO LOW NIBBLE 687 00004310 0C08 <1> or al, 00001000b ; TURN ON INTERRUPT ENABLE 688 00004312 EE <1> out dx, al ; RESET THE ADAPTER 689 00004313 C605[35770100]00 <1> mov byte [SEEK_STATUS], 0 ; SET RECALIBRATE REQUIRED ON ALL DRIVES 690 <1> ;jmp $+2 ; WAIT FOR I/O 691 <1> ;jmp $+2 ; WAIT FOR I/O (TO INSURE MINIMUM 692 <1> ; PULSE WIDTH) 693 <1> ; 19/12/2014 694 <1> NEWIODELAY 83 0000431A E6EB <2> out 0EBh, al 695 <1> 696 <1> ; 17/12/2014 697 <1> ; AWARD BIOS 1999 - RESETDRIVES (ADISK.ASM) 698 0000431C B915000000 <1> mov ecx, WAITCPU_RESET_ON ; cx = 21 -- Min. 14 micro seconds !? 699 <1> wdw1: 700 <1> NEWIODELAY ; 27/02/2015 83 00004321 E6EB <2> out 0EBh, al 701 00004323 E2FC <1> loop wdw1 702 <1> ; 703 00004325 0C04 <1> or al, 00000100b ; TURN OFF RESET BIT 704 00004327 EE <1> out dx, al ; RESET THE ADAPTER 705 <1> ; 16/12/2014 706 <1> IODELAY 78 00004328 EB00 <2> jmp short $+2 79 0000432A EB00 <2> jmp short $+2 707 <1> ; 708 <1> ;sti ; ENABLE THE INTERRUPTS 709 0000432C E8DD0A0000 <1> call WAIT_INT ; WAIT FOR THE INTERRUPT 710 00004331 7230 <1> jc short DR_ERR ; IF ERROR, RETURN IT 711 <1> ;mov cx, 11000000b ; CL = EXPECTED @NEC_STATUS 712 <1> ; 17/07/2022 713 <1> ;xor ch, ch 714 00004333 B1C0 <1> mov cl, 11000000b 715 <1> NXT_DRV: 716 <1> ;push cx ; SAVE FOR CALL 717 <1> ; 11/04/2021 718 00004335 51 <1> push ecx 719 00004336 B8[62430000] <1> mov eax, DR_POP_ERR ; LOAD NEC_OUTPUT ERROR ADDRESS 720 0000433B 50 <1> push eax ; " 721 0000433C B408 <1> mov ah, 08h ; SENSE INTERRUPT STATUS COMMAND 722 0000433E E8C3090000 <1> call NEC_OUTPUT 723 00004343 58 <1> pop eax ; THROW AWAY ERROR RETURN 724 00004344 E8F40A0000 <1> call RESULTS ; READ IN THE RESULTS 725 <1> ;pop cx ; RESTORE AFTER CALL 726 <1> ; 11/04/2021 727 00004349 59 <1> pop ecx 728 0000434A 7217 <1> jc short DR_ERR ; ERROR RETURN 729 0000434C 3A0D[39770100] <1> cmp cl, [NEC_STATUS] ; TEST FOR DRIVE READY TRANSITION 730 00004352 750F <1> jnz short DR_ERR ; EVERYTHING OK 731 00004354 FEC1 <1> inc cl ; NEXT EXPECTED @NEC_STATUS 732 00004356 80F9C3 <1> cmp cl, 11000011b ; ALL POSSIBLE DRIVES CLEARED 733 00004359 76DA <1> jbe short NXT_DRV ; FALL THRU IF 11000100B OR > 734 <1> ; 735 0000435B E800040000 <1> call SEND_SPEC ; SEND SPECIFY COMMAND TO NEC 736 <1> RESBAC: 737 <1> ; 06/08/2022 738 00004360 EB10 <1> jmp short SETUP_END_X 739 <1> ;call SETUP_END ; VARIOUS CLEANUPS 740 <1> ;;mov bx, si ; GET SAVED AL TO BL 741 <1> ;; 17/07/2022 742 <1> ;mov ebx, esi 743 <1> ;mov al, bl ; PUT BACK FOR RETURN 744 <1> ;retn 745 <1> 746 <1> DR_POP_ERR: 747 <1> ;pop cx ; CLEAR STACK 748 <1> ; 11/04/2021 749 00004362 59 <1> pop ecx 750 <1> DR_ERR: 751 00004363 800D[38770100]20 <1> or byte [DSKETTE_STATUS], BAD_NEC ; SET ERROR CODE 752 <1> ;jmp short RESBAC ; RETURN FROM RESET 753 <1> ; 06/08/2022 754 0000436A EB06 <1> jmp short SETUP_END_X 755 <1> 756 <1> ;------------------------------------------------------------------------------- 757 <1> ; DISK_STATUS (AH = 01H) 758 <1> ; DISKETTE STATUS. 759 <1> ; 760 <1> ; ON ENTRY: AH : STATUS OF PREVIOUS OPERATION 761 <1> ; 762 <1> ; ON EXIT: AH, @DSKETTE_STATUS, CY REFLECT STATUS OF PREVIOUS OPERATION. 763 <1> ;------------------------------------------------------------------------------- 764 <1> DSK_STATUS: 765 0000436C 8825[38770100] <1> mov [DSKETTE_STATUS], ah ; PUT BACK FOR SETUP END 766 <1> SETUP_END_X: ; 06/08/2022 767 00004372 E809010000 <1> call SETUP_END ; VARIOUS CLEANUPS 768 <1> ;mov bx, si ; GET SAVED AL TO BL 769 <1> ;mov al, bl ; PUT BACK FOR RETURN 770 <1> ; 06/08/2022 771 00004377 89F3 <1> mov ebx, esi 772 00004379 88D8 <1> mov al, bl 773 0000437B C3 <1> retn 774 <1> 775 <1> ;------------------------------------------------------------------------------- 776 <1> ; DISK_READ (AH = 02H) 777 <1> ; DISKETTE READ. 778 <1> ; 779 <1> ; ON ENTRY: DI : DRIVE # 780 <1> ; SI-HI : HEAD # 781 <1> ; SI-LOW : # OF SECTORS 782 <1> ; ES : BUFFER SEGMENT 783 <1> ; [BP] : SECTOR # 784 <1> ; [BP+1] : TRACK # 785 <1> ; [BP+2] : BUFFER OFFSET 786 <1> ; 787 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 788 <1> ;------------------------------------------------------------------------------- 789 <1> 790 <1> ; 06/02/2015, ES:BX -> EBX (unix386.s) 791 <1> 792 <1> DSK_READ: 793 0000437C 8025[36770100]7F <1> and byte [MOTOR_STATUS], 01111111b ; INDICATE A READ OPERATION 794 00004383 66B846E6 <1> mov ax, 0E646h ; AX = NEC COMMAND, DMA COMMAND 795 <1> ;call RD_WR_VF ; COMMON READ/WRITE/VERIFY 796 <1> ;retn 797 <1> ; 06/08/2022 798 00004387 EB0B <1> jmp short RD_WR_VF 799 <1> 800 <1> ;------------------------------------------------------------------------------- 801 <1> ; DISK_WRITE (AH = 03H) 802 <1> ; DISKETTE WRITE. 803 <1> ; 804 <1> ; ON ENTRY: DI : DRIVE # 805 <1> ; SI-HI : HEAD # 806 <1> ; SI-LOW : # OF SECTORS 807 <1> ; ES : BUFFER SEGMENT 808 <1> ; [BP] : SECTOR # 809 <1> ; [BP+1] : TRACK # 810 <1> ; [BP+2] : BUFFER OFFSET 811 <1> ; 812 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 813 <1> ;------------------------------------------------------------------------------- 814 <1> 815 <1> ; 06/02/2015, ES:BX -> EBX (unix386.s) 816 <1> 817 <1> DSK_WRITE: 818 00004389 66B84AC5 <1> mov ax, 0C54Ah ; AX = NEC COMMAND, DMA COMMAND 819 0000438D 800D[36770100]80 <1> or byte [MOTOR_STATUS], 10000000b ; INDICATE WRITE OPERATION 820 <1> ;call RD_WR_VF ; COMMON READ/WRITE/VERIFY 821 <1> ;retn 822 <1> ; 06/08/2022 823 <1> ;jmp short RD_WR_VF 824 <1> 825 <1> ; 09/08/2022 826 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 827 <1> ;------------------------------------------------------------------------------- 828 <1> ; RD_WR_VF 829 <1> ; COMMON READ, WRITE AND VERIFY: 830 <1> ; MAIN LOOP FOR STATE RETRIES. 831 <1> ; 832 <1> ; ON ENTRY: AH = READ/WRITE/VERIFY NEC PARAMETER 833 <1> ; AL = READ/WRITE/VERIFY DMA PARAMETER 834 <1> ; 835 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 836 <1> ;------------------------------------------------------------------------------- 837 <1> RD_WR_VF: 838 <1> ; 02/12/2023 839 <1> ; 11/08/2022 840 <1> ; 09/08/2022 841 <1> ; 07/08/2022 842 <1> ; 06/08/2022 843 <1> ; 11/04/2021 (32 bit push/pop, AX -> EAX) 844 <1> 845 00004394 50 <1> push eax ; SAVE DMA, NEC PARAMETERS 846 <1> 847 <1> ; 02/12/2023 848 <1> ; (diskette change check for 'dir', 28 seconds) 849 00004395 A0[31770100] <1> mov al, [TIMER_LOW+1] 850 0000439A D0E8 <1> shr al, 1 851 0000439C A2[9A7E0100] <1> mov [P_TIMER], al 852 <1> 853 000043A1 E803040000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 854 000043A6 E86A040000 <1> call SETUP_STATE ; INITIALIZE START AND END RATE 855 000043AB 58 <1> pop eax ; RESTORE READ/WRITE/VERIFY 856 <1> DO_AGAIN: 857 000043AC 50 <1> push eax ; SAVE READ/WRITE/VERIFY PARAMETER 858 000043AD E8F8040000 <1> call MED_CHANGE ; MEDIA CHANGE AND RESET IF CHANGED 859 000043B2 58 <1> pop eax ; RESTORE READ/WRITE/VERIFY 860 <1> ;jc short RWV_END ; MEDIA CHANGE ERROR OR TIME-OUT 861 <1> ; 07/08/2022 862 000043B3 7305 <1> jnc short RWV 863 000043B5 E9BC000000 <1> jmp RWV_END 864 <1> RWV: 865 000043BA 50 <1> push eax ; SAVE READ/WRITE/VERIFY PARAMETER 866 000043BB 8AB7[43770100] <1> mov dh, [DSK_STATE+edi] ; GET RATE STATE OF THIS DRIVE 867 000043C1 80E6C0 <1> and dh, RATE_MSK ; KEEP ONLY RATE 868 000043C4 E83E080000 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN AL (AL) 869 <1> ;;20/02/2015 870 <1> ;;jc short RWV_ASSUME ; ERROR IN CMOS 871 000043C9 7447 <1> jz short RWV_ASSUME ; 20/02/2015 872 000043CB 3C01 <1> cmp al, 1 ; 40 TRACK DRIVE? 873 000043CD 750D <1> jne short RWV_1 ; NO, BYPASS CMOS VALIDITY CHECK 874 000043CF F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; CHECK FOR 40 TRACK DRIVE 875 000043D6 7411 <1> jz short RWV_2 ; YES, CMOS IS CORRECT 876 <1> ;mov al, 2 ; CHANGE TO 1.2M 877 <1> ; 06/08/2022 878 000043D8 FEC0 <1> inc al ; al = 2 879 000043DA EB0D <1> jmp short RWV_2 880 <1> RWV_1: 881 <1> ; 09/08/2022 882 <1> ;jb short RWV_2 ; NO DRIVE SPECIFIED, CONTINUE 883 000043DC F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; IS IT REALLY 40 TRACK? 884 000043E3 7504 <1> jnz short RWV_2 ; NO, 80 TRACK 885 000043E5 B001 <1> mov al, 1 ; IT IS 40 TRACK, FIX CMOS VALUE 886 000043E7 EB00 <1> jmp short rwv_3 887 <1> RWV_2: 888 <1> ; 09/08/2022 889 <1> ;or al, al ; TEST FOR NO DRIVE 890 <1> ;jz short RWV_ASSUME ; ASSUME TYPE, USE MAX TRACK 891 <1> rwv_3: 892 000043E9 E855030000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL. 893 000043EE 7222 <1> jc short RWV_ASSUME ; TYPE NOT IN TABLE (BAD CMOS) 894 <1> 895 <1> ;----- SEARCH FOR MEDIA/DRIVE PARAMETER TABLE 896 <1> 897 000043F0 57 <1> push edi ; SAVE DRIVE # 898 <1> ; 09/08/2022 899 <1> ;xor ebx, ebx ; EBX = INDEX TO DR_TYPE TABLE 900 000043F1 BB[08660000] <1> mov ebx, DR_TYPE 901 <1> ;mov ecx, DR_CNT ; ECX = LOOP COUNT 902 000043F6 B106 <1> mov cl, DR_CNT 903 <1> RWV_DR_SEARCH: 904 <1> ;mov ah, [DR_TYPE+ebx] ; GET DRIVE TYPE 905 000043F8 8A23 <1> mov ah, [ebx] 906 000043FA 80E47F <1> and ah, BIT7OFF ; MASK OUT MSB 907 000043FD 38E0 <1> cmp al, ah ; DRIVE TYPE MATCH? 908 <1> ; 09/08/2022 909 <1> ;cmp dl, ah 910 000043FF 7509 <1> jne short RWV_NXT_MD ; NO, CHECK NEXT DRIVE TYPE 911 <1> RWV_DR_FND: 912 <1> ;mov edi, [DR_TYPE+ebx+1] ; EDI = MEDIA/DRIVE PARAMETER TABLE 913 00004401 43 <1> inc ebx 914 00004402 8B3B <1> mov edi, [ebx] 915 00004404 4B <1> dec ebx 916 <1> RWV_MD_SEARH: 917 00004405 3A770C <1> cmp dh, [edi+MD.RATE] ; MATCH? 918 00004408 741D <1> je short RWV_MD_FND ; YES, GO GET 1ST SPECIFY BYTE 919 <1> RWV_NXT_MD: 920 0000440A 83C305 <1> add ebx, 5 ; CHECK NEXT DRIVE TYPE 921 <1> ;loop RWV_DR_SEARCH 922 0000440D FEC9 <1> dec cl 923 0000440F 75E7 <1> jnz short RWV_DR_SEARCH 924 00004411 5F <1> pop edi ; RESTORE DRIVE # 925 <1> 926 <1> ;----- ASSUME PRIMARY DRIVE IS INSTALLED AS SHIPPED 927 <1> 928 <1> RWV_ASSUME: 929 00004412 BB[26660000] <1> mov ebx, MD_TBL1 ; POINT TO 40 TRACK 250 KBS 930 00004417 F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; TEST FOR 80 TRACK 931 0000441E 740A <1> jz short RWV_MD_FND1 ; MUST BE 40 TRACK 932 00004420 BB[40660000] <1> mov ebx, MD_TBL3 ; POINT TO 80 TRACK 500 KBS 933 00004425 EB03 <1> jmp short RWV_MD_FND1 ; GO SPECIFY PARAMTERS 934 <1> 935 <1> ;----- CS:BX POINTS TO MEDIA/DRIVE PARAMETER TABLE 936 <1> 937 <1> RWV_MD_FND: 938 00004427 89FB <1> mov ebx, edi ; BX = MEDIA/DRIVE PARAMETER TABLE 939 00004429 5F <1> pop edi ; RESTORE DRIVE # 940 <1> 941 <1> ;----- SEND THE SPECIFY COMMAND TO THE CONTROLLER 942 <1> 943 <1> RWV_MD_FND1: 944 0000442A E85A030000 <1> call SEND_SPEC_MD 945 0000442F E8E3040000 <1> call CHK_LASTRATE ; ZF=1 ATTEMP RATE IS SAME AS LAST RATE 946 00004434 7405 <1> jz short RWV_DBL ; YES,SKIP SEND RATE COMMAND 947 00004436 E8BC040000 <1> call SEND_RATE ; SEND DATA RATE TO NEC 948 <1> RWV_DBL: 949 0000443B 53 <1> push ebx ; SAVE MEDIA/DRIVE PARAM TBL ADDRESS 950 0000443C E825070000 <1> call SETUP_DBL ; CHECK FOR DOUBLE STEP 951 00004441 5B <1> pop ebx ; RESTORE ADDRESS 952 00004442 7225 <1> jc short CHK_RET ; ERROR FROM READ ID, POSSIBLE RETRY 953 <1> ;pop eax ; RESTORE NEC COMMAND 954 <1> ;push eax ; SAVE NEC COMMAND 955 <1> ; 09/08/2022 956 00004444 8B0424 <1> mov eax, [esp] 957 <1> ;push ebx ; SAVE MEDIA/DRIVE PARAM TBL ADDRESS 958 00004447 E8E0040000 <1> call DMA_SETUP ; SET UP THE DMA 959 <1> ;pop ebx 960 0000444C 58 <1> pop eax ; RESTORE NEC COMMAND 961 0000444D 7231 <1> jc short RWV_BAC ; CHECK FOR DMA BOUNDARY ERROR 962 0000444F 50 <1> push eax ; SAVE NEC COMMAND 963 00004450 53 <1> push ebx ; SAVE MEDIA/DRIVE PARAM TBL ADDRESS 964 <1> ; 11/08/2022 965 00004451 8B5C2420 <1> mov ebx, [esp+32] ; ECX 966 00004455 E866050000 <1> call NEC_INIT ; INITIALIZE NEC 967 0000445A 5B <1> pop ebx ; RESTORE ADDRESS 968 0000445B 720C <1> jc short CHK_RET ; ERROR - EXIT 969 0000445D E88C050000 <1> call RWV_COM ; OP CODE COMMON TO READ/WRITE 970 00004462 7205 <1> jc short CHK_RET ; ERROR - EXIT 971 00004464 E8D2050000 <1> call NEC_TERM ; TERMINATE, GET STATUS, ETC. 972 <1> CHK_RET: 973 00004469 E871060000 <1> call RETRY ; CHECK FOR, SETUP RETRY 974 0000446E 58 <1> pop eax ; RESTORE READ/WRITE PARAMETER 975 0000446F 7305 <1> jnc short RWV_END ; CY = 0 NO RETRY 976 00004471 E936FFFFFF <1> jmp DO_AGAIN ; CY = 1 MEANS RETRY 977 <1> RWV_END: 978 00004476 E81C060000 <1> call DSTATE ; ESTABLISH STATE IF SUCCESSFUL 979 0000447B E8AE060000 <1> call NUM_TRANS ; AL = NUMBER TRANSFERRED 980 <1> RWV_BAC: ; BAD DMA ERROR ENTRY 981 <1> ; 06/08/2022 982 <1> ;push eax ; SAVE NUMBER TRANSFERRED 983 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 984 <1> ;pop eax ; RESTORE NUMBER TRANSFERRED 985 <1> ;call SETUP_END ; VARIOUS CLEANUPS 986 <1> ;retn 987 <1> 988 <1> ;------------------------------------------------------------------------------- 989 <1> ; SETUP_END 990 <1> ; RESTORES @MOTOR_COUNT TO PARAMETER PROVIDED IN TABLE 991 <1> ; AND LOADS @DSKETTE_STATUS TO AH, AND SETS CY. 992 <1> ; 993 <1> ; ON EXIT: 994 <1> ; AH, @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 995 <1> ;------------------------------------------------------------------------------- 996 <1> SETUP_END: 997 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 998 <1> ;mov dl, 2 ; GET THE MOTOR WAIT PARAMETER 999 <1> ;push ax ; SAVE NUMBER TRANSFERRED 1000 <1> ; 11/04/2021 1001 00004480 50 <1> push eax 1002 <1> ; 06/08/2022 1003 00004481 B002 <1> mov al, 2 ; GET THE MOTOR WAIT PARAMETER 1004 00004483 E888070000 <1> call GET_PARM 1005 00004488 8825[37770100] <1> mov [MOTOR_COUNT], ah ; STORE UPON RETURN 1006 <1> ;pop ax ; RESTORE NUMBER TRANSFERRED 1007 <1> ; 11/04/2021 1008 0000448E 58 <1> pop eax 1009 0000448F 8A25[38770100] <1> mov ah, [DSKETTE_STATUS] ; GET STATUS OF OPERATION 1010 00004495 08E4 <1> or ah, ah ; CHECK FOR ERROR 1011 00004497 7403 <1> jz short NUN_ERR ; NO ERROR 1012 00004499 30C0 <1> xor al, al ; CLEAR NUMBER RETURNED 1013 <1> ; 06/08/2022 1014 0000449B F9 <1> stc 1015 <1> NUN_ERR: 1016 <1> ;cmp ah, 1 ; SET THE CARRY FLAG TO INDICATE 1017 <1> ;cmc ; SUCCESS OR FAILURE 1018 0000449C C3 <1> retn 1019 <1> 1020 <1> ;------------------------------------------------------------------------------- 1021 <1> ; DISK_VERF (AH = 04H) 1022 <1> ; DISKETTE VERIFY. 1023 <1> ; 1024 <1> ; ON ENTRY: DI : DRIVE # 1025 <1> ; SI-HI : HEAD # 1026 <1> ; SI-LOW : # OF SECTORS 1027 <1> ; ES : BUFFER SEGMENT 1028 <1> ; [BP] : SECTOR # 1029 <1> ; [BP+1] : TRACK # 1030 <1> ; [BP+2] : BUFFER OFFSET 1031 <1> ; 1032 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 1033 <1> ;------------------------------------------------------------------------------- 1034 <1> DSK_VERF: 1035 0000449D 8025[36770100]7F <1> and byte [MOTOR_STATUS], 01111111b ; INDICATE A READ OPERATION 1036 000044A4 66B842E6 <1> mov ax, 0E642h ; AX = NEC COMMAND, DMA COMMAND 1037 <1> ;call RD_WR_VF ; COMMON READ/WRITE/VERIFY 1038 <1> ;retn 1039 <1> ; 06/08/2022 1040 000044A8 E9E7FEFFFF <1> jmp RD_WR_VF 1041 <1> 1042 <1> ;------------------------------------------------------------------------------- 1043 <1> ; DISK_FORMAT (AH = 05H) 1044 <1> ; DISKETTE FORMAT. 1045 <1> ; 1046 <1> ; ON ENTRY: DI : DRIVE # 1047 <1> ; SI-HI : HEAD # 1048 <1> ; SI-LOW : # OF SECTORS 1049 <1> ; ES : BUFFER SEGMENT 1050 <1> ; [BP] : SECTOR # 1051 <1> ; [BP+1] : TRACK # 1052 <1> ; [BP+2] : BUFFER OFFSET 1053 <1> ; @DISK_POINTER POINTS TO THE PARAMETER TABLE OF THIS DRIVE 1054 <1> ; 1055 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 1056 <1> ;------------------------------------------------------------------------------- 1057 <1> DSK_FORMAT: 1058 <1> ; 11/08/2022 1059 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1060 000044AD E8F7020000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 1061 000044B2 E89F030000 <1> call FMT_INIT ; ESTABLISH STATE IF UNESTABLISHED 1062 000044B7 800D[36770100]80 <1> or byte [MOTOR_STATUS], 10000000b ; INDICATE WRITE OPERATION 1063 000044BE E8E7030000 <1> call MED_CHANGE ; CHECK MEDIA CHANGE AND RESET IF SO 1064 000044C3 7261 <1> jc short FM_DON ; MEDIA CHANGED, SKIP 1065 000044C5 E896020000 <1> call SEND_SPEC ; SEND SPECIFY COMMAND TO NEC 1066 000044CA E848040000 <1> call CHK_LASTRATE ; ZF=1 ATTEMPT RATE IS SAME AS LAST RATE 1067 000044CF 7405 <1> jz short FM_WR ; YES, SKIP SPECIFY COMMAND 1068 000044D1 E821040000 <1> call SEND_RATE ; SEND DATA RATE TO CONTROLLER 1069 <1> FM_WR: 1070 000044D6 E8C8040000 <1> call FMTDMA_SET ; SET UP THE DMA FOR FORMAT 1071 000044DB 7249 <1> jc short FM_DON ; RETURN WITH ERROR 1072 000044DD B44D <1> mov ah, 04Dh ; ESTABLISH THE FORMAT COMMAND 1073 <1> ; 11/08/2022 1074 000044DF 8B5C2418 <1> mov ebx, [esp+24] ; ECX 1075 000044E3 E8D8040000 <1> call NEC_INIT ; INITIALIZE THE NEC 1076 000044E8 723C <1> jc short FM_DON ; ERROR - EXIT 1077 000044EA B8[26450000] <1> mov eax, FM_DON ; LOAD ERROR ADDRESS 1078 000044EF 50 <1> push eax ; PUSH NEC_OUT ERROR RETURN 1079 <1> ;mov dl, 3 ; BYTES/SECTOR VALUE TO NEC 1080 <1> ; 06/08/2022 1081 000044F0 B003 <1> mov al, 3 1082 000044F2 E819070000 <1> call GET_PARM 1083 000044F7 E80A080000 <1> call NEC_OUTPUT 1084 <1> ;mov dl, 4 ; SECTORS/TRACK VALUE TO NEC 1085 <1> ; 06/08/2022 1086 000044FC B004 <1> mov al, 4 1087 000044FE E80D070000 <1> call GET_PARM 1088 00004503 E8FE070000 <1> call NEC_OUTPUT 1089 <1> ;mov dl, 7 ; GAP LENGTH VALUE TO NEC 1090 <1> ; 06/08/2022 1091 00004508 B007 <1> mov al, 7 1092 0000450A E801070000 <1> call GET_PARM 1093 0000450F E8F2070000 <1> call NEC_OUTPUT 1094 <1> ;mov dl, 8 ; FILLER BYTE TO NEC 1095 <1> ; 06/08/2022 1096 00004514 B008 <1> mov al, 8 1097 00004516 E8F5060000 <1> call GET_PARM 1098 0000451B E8E6070000 <1> call NEC_OUTPUT 1099 00004520 58 <1> pop eax ; THROW AWAY ERROR 1100 00004521 E815050000 <1> call NEC_TERM ; TERMINATE, RECEIVE STATUS, ETC, 1101 <1> FM_DON: 1102 <1> ; 06/08/2022 1103 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1104 <1> ; 06/08/2022 1105 00004526 E947FEFFFF <1> jmp SETUP_END_X 1106 <1> ;call SETUP_END ; VARIOUS CLEANUPS 1107 <1> ;; 06/08/2022 1108 <1> ;mov ebx, esi ; GET SAVED AL TO BL 1109 <1> ;mov al, bl ; PUT BACK FOR RETURN 1110 <1> ;retn 1111 <1> 1112 <1> ;------------------------------------------------------------------------------- 1113 <1> ; FNC_ERR 1114 <1> ; INVALID FUNCTION REQUESTED OR INVALID DRIVE: 1115 <1> ; SET BAD COMMAND IN STATUS. 1116 <1> ; 1117 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 1118 <1> ;------------------------------------------------------------------------------- 1119 <1> FNC_ERR: ; INVALID FUNCTION REQUEST 1120 <1> ;mov ax, si 1121 <1> ; 06/08/2022 1122 0000452B 89F0 <1> mov eax, esi ; RESTORE AL 1123 0000452D B401 <1> mov ah, BAD_CMD ; SET BAD COMMAND ERROR 1124 0000452F 8825[38770100] <1> mov [DSKETTE_STATUS], ah ; STORE IN DATA AREA 1125 00004535 F9 <1> stc ; SET CARRY INDICATING ERROR 1126 00004536 C3 <1> retn 1127 <1> 1128 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1129 <1> ; 30/08/2020 1130 <1> ; 29/08/2020 1131 <1> ; 01/06/2016 1132 <1> ; 28/05/2016 1133 <1> ; 27/05/2016 - TRDOS 386 (TRDOS v.2.0) 1134 <1> ;------------------------------------------------------------------------------- 1135 <1> ; DISK_PARMS (AH = 08H) 1136 <1> ; READ DRIVE PARAMETERS. 1137 <1> ; 1138 <1> ; ON ENTRY: DI : DRIVE # 1139 <1> ; ; 27/05/2016 1140 <1> ; EBX = Buffer Address for floppy disk parameters table (16 bytes) 1141 <1> ; 1142 <1> ; ON EXIT: CL/[BP] = BITS 7 & 6 HI 2 BITS OF MAX CYLINDER 1143 <1> ; BITS 0-5 MAX SECTORS/TRACK 1144 <1> ; CH/[BP+1] = LOW 8 BITS OF MAX CYLINDER 1145 <1> ; BL/[BP+2] = BITS 7-4 = 0 1146 <1> ; BITS 3-0 = VALID CMOS DRIVE TYPE 1147 <1> ; BH/[BP+3] = 0 1148 <1> ; DL/[BP+4] = # DRIVES INSTALLED (VALUE CHECKED) 1149 <1> ; DH/[BP+5] = MAX HEAD # 1150 <1> ; ** 27/05/2016 - TRDOS 386 (TRDOS v2.0) ** 1151 <1> ; ** EBX = Buffer address for floppy disk parameters table ** 1152 <1> ; ;DI/[BP+6] = OFFSET TO DISK_BASE 1153 <1> ; ;ES = SEGMENT OF DISK_BASE 1154 <1> ; 1155 <1> ; AX = 0 1156 <1> ; 1157 <1> ; NOTE : THE ABOVE INFORMATION IS STORED IN THE USERS STACK AT 1158 <1> ; THE LOCATIONS WHERE THE MAIN ROUTINE WILL POP THEM 1159 <1> ; INTO THE APPROPRIATE REGISTERS BEFORE RETURNING TO THE 1160 <1> ; CALLER. 1161 <1> ;------------------------------------------------------------------------------- 1162 <1> DSK_PARMS: 1163 <1> ; 09/08/2022 1164 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1165 <1> ; 1166 <1> ; Registers on stack: 1167 <1> ; ebx = esp+28 1168 <1> ; ecx = esp+24 1169 <1> ; edx = esp+20 1170 <1> ; esi = esp+16 1171 <1> ; edi = esp+12 1172 <1> ; return address from DSKETTE_IO_1 = esp+8 1173 <1> ; ebp = esp+4 1174 <1> ; return address from DSK_PARMS = esp 1175 <1> ; 1176 <1> ; INPUT: 1177 <1> ; ebp = buffer address 1178 <1> ; edi = drive number (0 or 1) 1179 <1> 1180 <1> ; OUTPUT: 1181 <1> ; ebx = [esp+28] ((BL = cmos type, BH = 0)) 1182 <1> ; ecx = [esp+24] ((CL = sectors per track, CH = tracks - 1)) 1183 <1> ; edx = [esp+20] ((DL = floppy drive count, DH = heads - 1)) 1184 <1> ; user's buffer = FDPT table 1185 <1> 1186 00004537 E86D020000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH, 1187 <1> 1188 <1> ;;mov word [bp+2], 0 ; DRIVE TYPE = 0 1189 <1> ;;mov ax, [EQUIP_FLAG] ; LOAD EQUIPMENT FLAG FOR # DISKETTES 1190 <1> ;;and al, 11000001b ; KEEP DISKETTE DRIVE BITS 1191 <1> ;;mov dl, 2 ; DISKETTE DRIVES = 2 1192 <1> ;;cmp al, 01000001b ; 2 DRIVES INSTALLED ? 1193 <1> ;;jz short STO_DL ; IF YES JUMP 1194 <1> ;;dec dl ; DISKETTE DRIVES = 1 1195 <1> ;;cmp al, 00000001b ; 1 DRIVE INSTALLED ? 1196 <1> ;;jnz short NON_DRV ; IF NO JUMP 1197 <1> 1198 0000453C 29D2 <1> sub edx, edx 1199 0000453E 66A1[8C660000] <1> mov ax, [fd0_type] 1200 00004544 6621C0 <1> and ax, ax 1201 00004547 747C <1> jz short NON_DRV 1202 00004549 FEC2 <1> inc dl 1203 0000454B 20E4 <1> and ah, ah 1204 0000454D 7402 <1> jz short STO_DL 1205 0000454F FEC2 <1> inc dl 1206 <1> STO_DL: 1207 <1> ; 30/08/2020 1208 <1> ;cmp dx, di 1209 <1> ; 06/08/2022 1210 00004551 39FA <1> cmp edx, edi 1211 00004553 7670 <1> jna short NON_DRV 1212 <1> ; 1213 <1> ;;mov [bp+4], dl ; STORE NUMBER OF DRIVES 1214 <1> ;mov [ebp+8], edx ; 20/02/2015 1215 <1> 1216 <1> ; 06/08/2022 1217 00004555 FEC6 <1> inc dh ; number of heads - 1 1218 <1> ; dh = 1 1219 <1> ; dl = number of floppy/diskette drives (DL) 1220 00004557 89542414 <1> mov [esp+20], edx 1221 <1> 1222 <1> ; 11/04/2021 1223 <1> ;cmp di, 1 ; CHECK FOR VALID DRIVE 1224 <1> ;;ja short NON_DRV1 ; DRIVE INVALID 1225 <1> ;ja NON_DRV1 ; 29/08/2020 1226 <1> ; 1227 <1> ;;mov byte [bp+5], 1 ; MAXIMUM HEAD NUMBER = 1 1228 <1> ; 06/08/2022 1229 <1> ;mov byte [ebp+9], 1 ; 20/02/2015 1230 <1> 1231 0000455B E8A7060000 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN AL 1232 <1> ;;20/02/2015 1233 <1> ;;jc short CHK_EST ; IF CMOS BAD CHECKSUM ESTABLISHED 1234 <1> ;;or al, al ; TEST FOR NO DRIVE TYPE 1235 00004560 740F <1> jz short CHK_EST ; JUMP IF SO 1236 00004562 E8DC010000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL 1237 00004567 7208 <1> jc short CHK_EST ; TYPE NOT IN TABLE (POSSIBLE BAD CMOS) 1238 <1> ;mov [bp+2], al ; STORE VALID CMOS DRIVE TYPE 1239 <1> ;mov [ebp+4], al ; 06/02/2015 1240 00004569 8A4B04 <1> mov cl, [ebx+MD.SEC_TRK] ; GET SECTOR/TRACK 1241 0000456C 8A6B0B <1> mov ch, [ebx+MD.MAX_TRK] ; GET MAX. TRACK NUMBER 1242 0000456F EB36 <1> jmp short STO_CX ; CMOS GOOD, USE CMOS 1243 <1> CHK_EST: 1244 00004571 8AA7[43770100] <1> mov ah, [DSK_STATE+edi] ; LOAD STATE FOR THIS DRIVE 1245 00004577 F6C410 <1> test ah, MED_DET ; CHECK FOR ESTABLISHED STATE 1246 0000457A 744D <1> jz short NON_DRV1 ; CMOS BAD/INVALID OR UNESTABLISHED 1247 <1> USE_EST: 1248 0000457C 80E4C0 <1> and ah, RATE_MSK ; ISOLATE STATE 1249 0000457F 80FC80 <1> cmp ah, RATE_250 ; RATE 250 ? 1250 00004582 755C <1> jne short USE_EST2 ; NO, GO CHECK OTHER RATE 1251 <1> 1252 <1> ;----- DATA RATE IS 250 KBS, TRY 360 KB TABLE FIRST 1253 <1> 1254 00004584 B001 <1> mov al, 1 ; DRIVE TYPE 1 (360KB) 1255 00004586 E8B8010000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL 1256 0000458B 8A4B04 <1> mov cl, [ebx+MD.SEC_TRK] ; GET SECTOR/TRACK 1257 0000458E 8A6B0B <1> mov ch, [ebx+MD.MAX_TRK] ; GET MAX. TRACK NUMBER 1258 00004591 F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; 80 TRACK ? 1259 00004598 740D <1> jz short STO_CX ; MUST BE 360KB DRIVE 1260 <1> 1261 <1> ;----- IT IS 1.44 MB DRIVE 1262 <1> 1263 <1> PARM144: 1264 0000459A B004 <1> mov al, 4 ; DRIVE TYPE 4 (1.44MB) 1265 0000459C E8A2010000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL 1266 000045A1 8A4B04 <1> mov cl, [ebx+MD.SEC_TRK] ; GET SECTOR/TRACK 1267 000045A4 8A6B0B <1> mov ch, [ebx+MD.MAX_TRK] ; GET MAX. TRACK NUMBER 1268 <1> STO_CX: 1269 <1> ;mov [ebp], ecx ; SAVE POINTER IN STACK FOR RETURN 1270 <1> ; 06/08/2022 1271 000045A7 894C2418 <1> mov [esp+24], ecx ; spt (cl), tracks - 1 (ch) 1272 <1> ES_DI: 1273 <1> ;mov [bp+6], bx ; ADDRESS OF MEDIA/DRIVE PARM TABLE 1274 <1> ;mov [ebp+12], ebx ; 06/02/2015 1275 <1> ;mov ax, cs ; SEGMENT MEDIA/DRIVE PARAMETER TABLE 1276 <1> ;mov es, ax ; ES IS SEGMENT OF TABLE 1277 <1> ; 1278 <1> ; 28/05/2016 1279 <1> ; 27/05/2016 1280 <1> ; return floppy disk parameters table to user 1281 <1> ; in user's buffer, which is pointed by EBX 1282 <1> 1283 <1> ; 09/08/2022 1284 <1> ;movzx eax, al 1285 000045AB 29C9 <1> sub ecx, ecx 1286 000045AD 88C1 <1> mov cl, al 1287 <1> ;;mov [ebp+4], eax ; ebx ; drive type (for floppy drives) 1288 <1> ; 06/08/2022 1289 <1> ;mov [esp+28], eax ; drive type 1290 <1> ; 09/08/2022 1291 000045AF 894C241C <1> mov [esp+28], ecx ; drive type 1292 <1> 1293 <1> ; 06/08/2022 1294 <1> ;push edi 1295 <1> 1296 <1> ;mov edi, [ebp+4] ; ebx (input), user's buffer address 1297 <1> ; 06/08/2022 1298 <1> ;mov edi, ebp ; [esp+28] ; user's buffer address 1299 <1> ; 1300 <1> ;; 29/08/2020 1301 <1> ;or edi, edi 1302 <1> ;jz short no_copy_fdpt 1303 <1> ; 06/08/2022 1304 000045B3 09ED <1> or ebp, ebp ; [esp+28] = ebx ; user's buffer address if > 0 1305 000045B5 740B <1> jz short DP_OUT 1306 <1> ; 06/08/2022 1307 <1> ;push edi 1308 000045B7 89EF <1> mov edi, ebp 1309 <1> ; 1310 <1> ; 06/08/2022 1311 <1> ; 01/06/2016 (Int 33h, disk type return for floppy disks, in BL) 1312 <1> ;mov [user_buffer], eax ; 01/06/2016 (overwrite ebx return value) 1313 <1> 1314 <1> ;(Int 33h, Function 08h will replace user's buffer addr with disk type!) 1315 <1> ; 1316 000045B9 89DE <1> mov esi, ebx ; floppy disk parameter table (16 bytes) 1317 <1> ;mov ecx, 16 ; 16 bytes 1318 <1> ; 09/08/2022 1319 <1> ; ecx < 256 1320 <1> ; 06/08/2022 1321 <1> ;sub ecx, ecx 1322 000045BB B110 <1> mov cl, 16 1323 000045BD E859C50000 <1> call transfer_to_user_buffer ; trdosk6.s (16/05/2016) 1324 <1> no_copy_fdpt: 1325 <1> ; 06/08/2022 1326 <1> ;pop edi 1327 <1> DP_OUT: 1328 <1> ; 06/08/2022 1329 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1330 <1> ;xor ax, ax ; CLEAR 1331 <1> ; 06/08/2022 1332 000045C2 31C0 <1> xor eax, eax 1333 <1> ;clc 1334 000045C4 C3 <1> retn 1335 <1> 1336 <1> ;----- NO DRIVE PRESENT HANDLER 1337 <1> 1338 <1> NON_DRV: 1339 <1> ;;mov byte [bp+4], 0 ; CLEAR NUMBER OF DRIVES 1340 <1> ;mov [ebp+8], edx ; 0 ; 20/02/2015 1341 <1> ; 06/08/2022 1342 000045C5 89542414 <1> mov [esp+20], edx ; 0 ; number of floppy drives and heads are 0 1343 <1> NON_DRV1: 1344 000045C9 6681FF8000 <1> cmp di, 80h ; CHECK FOR FIXED MEDIA TYPE REQUEST 1345 000045CE 7206 <1> jb short NON_DRV2 ; CONTINUE IF NOT REQUEST FALL THROUGH 1346 <1> 1347 <1> ;----- FIXED DISK REQUEST FALL THROUGH ERROR 1348 <1> 1349 <1> ; 06/08/2022 1350 <1> ;call XLAT_OLD ; ELSE TRANSLATE TO COMPATIBLE MODE 1351 <1> ;mov ax, si ; RESTORE AL 1352 <1> ; 06/08/2022 1353 000045D0 89F0 <1> mov eax, esi 1354 000045D2 B401 <1> mov ah, BAD_CMD ; SET BAD COMMAND ERROR 1355 000045D4 F9 <1> stc 1356 000045D5 C3 <1> retn 1357 <1> 1358 <1> NON_DRV2: 1359 <1> ;xor ax, ax ; CLEAR PARMS IF NO DRIVES OR CMOS BAD 1360 000045D6 31C0 <1> xor eax, eax 1361 <1> ;mov [ebp], ax ; TRACKS, SECTORS/TRACK = 0 1362 <1> ; 06/08/2022 1363 000045D8 89442418 <1> mov [esp+24], eax ; spt and max. track number is 0 1364 <1> 1365 <1> ;;mov [bp+5], ah ; HEAD = 0 1366 <1> ; 06/08/2022 1367 <1> ;mov [ebp+9], ah ; 06/02/2015 1368 <1> ; 06/08/2022 1369 <1> ;mov [esp+21], ah ; 0 1370 <1> 1371 <1> ;;mov [bp+6], ax ; OFFSET TO DISK_BASE = 0 1372 <1> ; 06/08/2022 1373 <1> ;mov [ebp+12], eax 1374 <1> 1375 <1> ;;mov es, ax ; ES IS SEGMENT OF TABLE 1376 <1> ;jmp short DP_OUT 1377 <1> 1378 <1> ; 06/08/2022 1379 <1> ; 30/08/2020 1380 <1> ;call XLAT_OLD 1381 <1> ;;mov ah, NOT_RDY ; drive not ready 1382 000045DC B407 <1> mov ah, INIT_FAIL ; DRIVE PARAMETER ACTIVITY FAILED 1383 000045DE F9 <1> stc ; cf -> 1, ah = 'drive not ready' error code 1384 000045DF C3 <1> retn 1385 <1> 1386 <1> ;----- DATA RATE IS EITHER 300 KBS OR 500 KBS, TRY 1.2 MB TABLE FIRST 1387 <1> 1388 <1> USE_EST2: 1389 000045E0 B002 <1> mov al, 2 ; DRIVE TYPE 2 (1.2MB) 1390 000045E2 E85C010000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL 1391 000045E7 8A4B04 <1> mov cl, [ebx+MD.SEC_TRK] ; GET SECTOR/TRACK 1392 000045EA 8A6B0B <1> mov ch, [ebx+MD.MAX_TRK] ; GET MAX. TRACK NUMBER 1393 000045ED 80FC40 <1> cmp ah, RATE_300 ; RATE 300 ? 1394 000045F0 74B5 <1> jz short STO_CX ; MUST BE 1.2MB DRIVE 1395 000045F2 EBA6 <1> jmp short PARM144 ; ELSE, IT IS 1.44MB DRIVE 1396 <1> 1397 <1> ; 30/08/2020 1398 <1> 1399 <1> ;------------------------------------------------------------------------------- 1400 <1> ; DISK_TYPE (AH = 15H) 1401 <1> ; THIS ROUTINE RETURNS THE TYPE OF MEDIA INSTALLED. 1402 <1> ; 1403 <1> ; ON ENTRY: DI = DRIVE # 1404 <1> ; 1405 <1> ; ON EXIT: AH = DRIVE TYPE, CY=0 1406 <1> ;------------------------------------------------------------------------------- 1407 <1> DSK_TYPE: 1408 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1409 000045F4 E8B0010000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 1410 000045F9 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; GET PRESENT STATE INFORMATION 1411 000045FF 08C0 <1> or al, al ; CHECK FOR NO DRIVE 1412 00004601 740D <1> jz short NO_DRV 1413 00004603 B401 <1> mov ah, NOCHGLN ; NO CHANGE LINE FOR 40 TRACK DRIVE 1414 00004605 A801 <1> test al, TRK_CAPA ; IS THIS DRIVE AN 80 TRACK DRIVE? 1415 00004607 7402 <1> jz short DT_BACK ; IF NO JUMP 1416 00004609 B402 <1> mov ah, CHGLN ; CHANGE LINE FOR 80 TRACK DRIVE 1417 <1> DT_BACK: 1418 <1> ; 06/08/2022 1419 <1> ;;push ax ; SAVE RETURN VALUE 1420 <1> ; 11/04/2021 1421 <1> ;push eax 1422 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1423 <1> ;; 11/04/2021 1424 <1> ;pop eax 1425 <1> ;; pop ax 1426 <1> ;clc ; NO ERROR 1427 <1> ;mov bx, si ; GET SAVED AL TO BL 1428 <1> ; 06/08/2022 1429 0000460B 89F3 <1> mov ebx, esi 1430 0000460D 88D8 <1> mov al, bl ; PUT BACK FOR RETURN 1431 0000460F C3 <1> retn 1432 <1> NO_DRV: 1433 <1> ;xor ah, ah ; NO DRIVE PRESENT OR UNKNOWN 1434 <1> ;jmp short DT_BACK 1435 <1> 1436 <1> ; 06/08/2022 1437 <1> ; 30/08/2020 1438 <1> ;call XLAT_OLD 1439 00004610 29C0 <1> sub eax, eax 1440 00004612 F9 <1> stc ; cf = 1 -> drive not ready, ah = 0 (disk type = 0) 1441 00004613 C3 <1> retn 1442 <1> 1443 <1> ;------------------------------------------------------------------------------- 1444 <1> ; DISK_CHANGE (AH = 16H) 1445 <1> ; THIS ROUTINE RETURNS THE STATE OF THE DISK CHANGE LINE. 1446 <1> ; 1447 <1> ; ON ENTRY: DI = DRIVE # 1448 <1> ; 1449 <1> ; ON EXIT: AH = @DSKETTE_STATUS 1450 <1> ; 00 - DISK CHANGE LINE INACTIVE, CY = 0 1451 <1> ; 06 - DISK CHANGE LINE ACTIVE, CY = 1 1452 <1> ;------------------------------------------------------------------------------- 1453 <1> DSK_CHANGE: 1454 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1455 00004614 E890010000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 1456 00004619 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; GET MEDIA STATE INFORMATION 1457 0000461F 08C0 <1> or al, al ; DRIVE PRESENT ? 1458 00004621 7417 <1> jz short DC_NON ; JUMP IF NO DRIVE 1459 00004623 A801 <1> test al, TRK_CAPA ; 80 TRACK DRIVE ? 1460 00004625 7407 <1> jz short SETIT ; IF SO , CHECK CHANGE LINE 1461 <1> DC0: 1462 00004627 E86B080000 <1> call READ_DSKCHNG ; GO CHECK STATE OF DISK CHANGE LINE 1463 0000462C 7407 <1> jz short FINIS ; CHANGE LINE NOT ACTIVE 1464 <1> SETIT: 1465 0000462E C605[38770100]06 <1> mov byte [DSKETTE_STATUS], MEDIA_CHANGE ; INDICATE MEDIA REMOVED 1466 <1> 1467 <1> FINIS: ; 06/08/2022 1468 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1469 <1> ; 06/08/2022 1470 00004635 E938FDFFFF <1> jmp SETUP_END_X 1471 <1> ;call SETUP_END ; VARIOUS CLEANUPS 1472 <1> ;; 06/08/2022 1473 <1> ;mov ebx, esi ; GET SAVED AL TO BL 1474 <1> ;mov al, bl ; PUT BACK FOR RETURN 1475 <1> ;retn 1476 <1> DC_NON: 1477 0000463A 800D[38770100]80 <1> or byte [DSKETTE_STATUS], TIME_OUT ; SET TIMEOUT, NO DRIVE 1478 00004641 EBF2 <1> jmp short FINIS 1479 <1> 1480 <1> ;------------------------------------------------------------------------------- 1481 <1> ; FORMAT_SET (AH = 17H) 1482 <1> ; THIS ROUTINE IS USED TO ESTABLISH THE TYPE OF MEDIA TO BE USED 1483 <1> ; FOR THE FOLLOWING FORMAT OPERATION. 1484 <1> ; 1485 <1> ; ON ENTRY: SI LOW = DASD TYPE FOR FORMAT 1486 <1> ; DI = DRIVE # 1487 <1> ; 1488 <1> ; ON EXIT: @DSKETTE_STATUS REFLECTS STATUS 1489 <1> ; AH = @DSKETTE_STATUS 1490 <1> ; CY = 1 IF ERROR 1491 <1> ;------------------------------------------------------------------------------- 1492 <1> FORMAT_SET: 1493 00004643 E861010000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 1494 <1> ;push si ; SAVE DASD TYPE 1495 <1> ; 11/04/2021 1496 00004648 56 <1> push esi 1497 <1> ;mov ax, si ; AH = ? , AL = DASD TYPE 1498 <1> ;xor ah, ah ; AH = 0 , AL = DASD TYPE 1499 <1> ;mov si, ax ; SI = DASD TYPE 1500 <1> ; 11/04/2021 1501 00004649 89F0 <1> mov eax, esi 1502 0000464B 0FB6F0 <1> movzx esi, al 1503 0000464E 80A7[43770100]0F <1> and byte [DSK_STATE+edi], ~(MED_DET+DBL_STEP+RATE_MSK) ; CLEAR STATE 1504 <1> ;dec si ; CHECK FOR 320/360K MEDIA & DRIVE 1505 <1> ; 11/04/2021 1506 00004655 4E <1> dec esi 1507 00004656 7509 <1> jnz short NOT_320 ; BYPASS IF NOT 1508 00004658 808F[43770100]90 <1> or byte [DSK_STATE+edi], MED_DET+RATE_250 ; SET TO 320/360 1509 0000465F EB45 <1> jmp short S0 1510 <1> 1511 <1> NOT_320: 1512 00004661 E844020000 <1> call MED_CHANGE ; CHECK FOR TIME_OUT 1513 00004666 803D[38770100]80 <1> cmp byte [DSKETTE_STATUS], TIME_OUT 1514 0000466D 7437 <1> jz short S0 ; IF TIME OUT TELL CALLER 1515 <1> S3: 1516 <1> ;dec si ; CHECK FOR 320/360K IN 1.2M DRIVE 1517 <1> ; 11/04/2021 1518 0000466F 4E <1> dec esi 1519 00004670 7509 <1> jnz short NOT_320_12 ; BYPASS IF NOT 1520 00004672 808F[43770100]70 <1> OR byte [DSK_STATE+edi], MED_DET+DBL_STEP+RATE_300 ; SET STATE 1521 00004679 EB2B <1> jmp short S0 1522 <1> 1523 <1> NOT_320_12: 1524 <1> ;dec si ; CHECK FOR 1.2M MEDIA IN 1.2M DRIVE 1525 <1> ; 11/04/2021 1526 0000467B 4E <1> dec esi 1527 0000467C 7509 <1> jnz short NOT_12 ; BYPASS IF NOT 1528 0000467E 808F[43770100]10 <1> or byte [DSK_STATE+edi], MED_DET+RATE_500 ; SET STATE VARIABLE 1529 00004685 EB1F <1> jmp short S0 ; RETURN TO CALLER 1530 <1> 1531 <1> NOT_12: 1532 <1> ;dec si ; CHECK FOR SET DASD TYPE 04 1533 <1> ; 11/04/2021 1534 00004687 4E <1> dec esi 1535 00004688 7525 <1> jnz short FS_ERR ; BAD COMMAND EXIT IF NOT VALID TYPE 1536 <1> 1537 0000468A F687[43770100]04 <1> test byte [DSK_STATE+edi], DRV_DET ; DRIVE DETERMINED ? 1538 00004691 740B <1> jz short ASSUME ; IF STILL NOT DETERMINED ASSUME 1539 00004693 B050 <1> mov al, MED_DET+RATE_300 1540 00004695 F687[43770100]02 <1> test byte [DSK_STATE+edi], FMT_CAPA ; MULTIPLE FORMAT CAPABILITY ? 1541 0000469C 7502 <1> jnz short OR_IT_IN ; IF 1.2 M THEN DATA RATE 300 1542 <1> 1543 <1> ASSUME: 1544 0000469E B090 <1> mov al, MED_DET+RATE_250 ; SET UP 1545 <1> 1546 <1> OR_IT_IN: 1547 000046A0 0887[43770100] <1> or [DSK_STATE+edi], al ; OR IN THE CORRECT STATE 1548 <1> S0: 1549 <1> ; 06/08/2022 1550 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1551 000046A6 E8D5FDFFFF <1> call SETUP_END ; VARIOUS CLEANUPS 1552 <1> ;pop BX ; GET SAVED AL TO BL 1553 <1> ; 11/04/2021 1554 000046AB 5B <1> pop ebx 1555 000046AC 88D8 <1> mov al, bl ; PUT BACK FOR RETURN 1556 000046AE C3 <1> retn 1557 <1> 1558 <1> FS_ERR: 1559 000046AF C605[38770100]01 <1> mov byte [DSKETTE_STATUS], BAD_CMD ; UNKNOWN STATE,BAD COMMAND 1560 000046B6 EBEE <1> jmp short S0 1561 <1> 1562 <1> ;------------------------------------------------------------------------------- 1563 <1> ; SET_MEDIA (AH = 18H) 1564 <1> ; THIS ROUTINE SETS THE TYPE OF MEDIA AND DATA RATE 1565 <1> ; TO BE USED FOR THE FOLLOWING FORMAT OPERATION. 1566 <1> ; 1567 <1> ; ON ENTRY: 1568 <1> ; [BP] = SECTOR PER TRACK 1569 <1> ; [BP+1] = TRACK # 1570 <1> ; DI = DRIVE # 1571 <1> ; 1572 <1> ; ON EXIT: 1573 <1> ; @DSKETTE_STATUS REFLECTS STATUS 1574 <1> ; IF NO ERROR: 1575 <1> ; AH = 0 1576 <1> ; CY = 0 1577 <1> ; ES = SEGMENT OF MEDIA/DRIVE PARAMETER TABLE 1578 <1> ; DI/[BP+6] = OFFSET OF MEDIA/DRIVE PARAMETER TABLE 1579 <1> ; IF ERROR: 1580 <1> ; AH = @DSKETTE_STATUS 1581 <1> ; CY = 1 1582 <1> ;------------------------------------------------------------------------------- 1583 <1> SET_MEDIA: 1584 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1585 000046B8 E8EC000000 <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH. 1586 000046BD F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; CHECK FOR CHANGE LINE AVAILABLE 1587 000046C4 7415 <1> jz short SM_CMOS ; JUMP IF 40 TRACK DRIVE 1588 000046C6 E8DF010000 <1> call MED_CHANGE ; RESET CHANGE LINE 1589 000046CB 803D[38770100]80 <1> cmp byte [DSKETTE_STATUS], TIME_OUT ; IF TIME OUT TELL CALLER 1590 000046D2 746A <1> je short SM_RTN 1591 000046D4 C605[38770100]00 <1> mov byte [DSKETTE_STATUS], 0 ; CLEAR STATUS 1592 <1> SM_CMOS: 1593 000046DB E827050000 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN (AL) 1594 <1> ;;20/02/2015 1595 <1> ;;jc short MD_NOT_FND ; ERROR IN CMOS 1596 <1> ;;or al, al ; TEST FOR NO DRIVE 1597 000046E0 745C <1> jz short SM_RTN ; RETURN IF SO 1598 000046E2 E85C000000 <1> call DR_TYPE_CHECK ; RTN CS:BX = MEDIA/DRIVE PARAM TBL 1599 000046E7 7233 <1> jc short MD_NOT_FND ; TYPE NOT IN TABLE (BAD CMOS) 1600 000046E9 57 <1> push edi ; SAVE REG. 1601 000046EA 31DB <1> xor ebx, ebx ; BX = INDEX TO DR. TYPE TABLE 1602 000046EC B906000000 <1> mov ecx, DR_CNT ; CX = LOOP COUNT 1603 <1> DR_SEARCH: 1604 000046F1 8AA3[08660000] <1> mov ah, [DR_TYPE+ebx] ; GET DRIVE TYPE 1605 000046F7 80E47F <1> and ah, BIT7OFF ; MASK OUT MSB 1606 000046FA 38E0 <1> cmp al, ah ; DRIVE TYPE MATCH ? 1607 000046FC 7518 <1> jne short NXT_MD ; NO, CHECK NEXT DRIVE TYPE 1608 <1> DR_FND: 1609 000046FE 8BBB[09660000] <1> mov edi, [DR_TYPE+ebx+1] ; DI = MEDIA/DRIVE PARAM TABLE 1610 <1> MD_SEARCH: 1611 00004704 8A6704 <1> mov ah, [edi+MD.SEC_TRK] ; GET SECTOR/TRACK 1612 <1> ;cmp [ebp], ah ; MATCH? 1613 <1> ; 06/08/2022 1614 00004707 38642418 <1> cmp [esp+24], ah ; CL ; spt 1615 0000470B 7509 <1> jne short NXT_MD ; NO, CHECK NEXT MEDIA 1616 0000470D 8A670B <1> mov ah, [edi+MD.MAX_TRK] ; GET MAX. TRACK # 1617 <1> ;cmp [ebp+1], ah ; MATCH? 1618 <1> ; 06/08/2022 1619 00004710 38642419 <1> cmp [esp+25], ah ; CH ; heads - 1 1620 00004714 740F <1> je short MD_FND ; YES, GO GET RATE 1621 <1> NXT_MD: 1622 <1> ;add bx, 3 ; CHECK NEXT DRIVE TYPE 1623 00004716 83C305 <1> add ebx, 5 ; 18/02/2015 1624 00004719 E2D6 <1> loop DR_SEARCH 1625 0000471B 5F <1> pop edi ; RESTORE REG. 1626 <1> MD_NOT_FND: 1627 0000471C C605[38770100]0C <1> mov byte [DSKETTE_STATUS], MED_NOT_FND ; ERROR, MEDIA TYPE NOT FOUND 1628 00004723 EB19 <1> jmp short SM_RTN ; RETURN 1629 <1> MD_FND: 1630 00004725 8A470C <1> mov al, [edi+MD.RATE] ; GET RATE 1631 00004728 3C40 <1> cmp al, RATE_300 ; DOUBLE STEP REQUIRED FOR RATE 300 1632 0000472A 7502 <1> jne short MD_SET 1633 0000472C 0C20 <1> or al, DBL_STEP 1634 <1> MD_SET: 1635 <1> ;;mov [bp+6], di ; SAVE TABLE POINTER IN STACK 1636 <1> ; 06/08/2022 1637 <1> ;mov [ebp+12], edi ; 18/02/2015 1638 <1> 1639 0000472E 0C10 <1> or al, MED_DET ; SET MEDIA ESTABLISHED 1640 00004730 5F <1> pop edi 1641 00004731 80A7[43770100]0F <1> and byte [DSK_STATE+edi], ~(MED_DET+DBL_STEP+RATE_MSK) ; CLEAR STATE 1642 00004738 0887[43770100] <1> or [DSK_STATE+edi], al 1643 <1> ;mov ax, cs ; SEGMENT OF MEDIA/DRIVE PARAMETER TABLE 1644 <1> ;mov es, ax ; ES IS SEGMENT OF TABLE 1645 <1> SM_RTN: 1646 <1> ; 06/08/2022 1647 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 1648 <1> ;call SETUP_END ; VARIOUS CLEANUPS 1649 <1> ;retn 1650 <1> ; 06/08/2022 1651 0000473E E93DFDFFFF <1> jmp SETUP_END 1652 <1> 1653 <1> ;---------------------------------------------------------------- 1654 <1> ; DR_TYPE_CHECK : 1655 <1> ; CHECK IF THE GIVEN DRIVE TYPE IN REGISTER (AL) : 1656 <1> ; IS SUPPORTED IN BIOS DRIVE TYPE TABLE : 1657 <1> ; ON ENTRY: : 1658 <1> ; AL = DRIVE TYPE : 1659 <1> ; ON EXIT: : 1660 <1> ; CY = 0 DRIVE TYPE SUPPORTED : 1661 <1> ; EBX = OFFSET TO MEDIA/DRIVE PARAMETER TABLE : 1662 <1> ; CY = 1 DRIVE TYPE NOT SUPPORTED : 1663 <1> ; REGISTERS ALTERED: EBX, AH ; 11/07/2022 : 1664 <1> ;---------------------------------------------------------------- 1665 <1> DR_TYPE_CHECK: 1666 <1> ; 09/08/2022 - TRDOS 386 Kernel v2.0.5 1667 <1> ; 12/07/2022 1668 <1> ; 11/07/2022 1669 <1> ; 08/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 1670 <1> ; 24/12/2021 1671 <1> ;push eax ; 11/07/2022 1672 <1> ;push ecx ; 08/07/2022 1673 <1> ;xor ebx,ebx ; EBX = INDEX TO DR_TYPE TABLE 1674 00004743 BB[08660000] <1> mov ebx, DR_TYPE 1675 <1> ;;mov ecx, DR_CNT ; ECX = LOOP COUNT 1676 <1> ;mov cl, DR_CNT 1677 00004748 B406 <1> mov ah, DR_CNT ; 11/07/2022 1678 <1> TYPE_CHK: 1679 <1> ;;mov ah, [DR_TYPE+ebx] ; GET DRIVE TYPE 1680 <1> ;mov ah, [ebx] 1681 <1> ;cmp al, ah ; DRIVE TYPE MATCH? 1682 0000474A 3A03 <1> cmp al, [ebx] ; 11/07/2022 1683 0000474C 740E <1> je short DR_TYPE_VALID ; YES, RETURN WITH CARRY RESET 1684 <1> ; 16/02/2015 (32 bit address modification) 1685 0000474E 83C305 <1> add ebx, 5 ; CHECK NEXT DRIVE TYPE 1686 <1> ;loop TYPE_CHK 1687 <1> ;dec cl 1688 00004751 FECC <1> dec ah ; 11/07/2022 1689 00004753 75F5 <1> jnz short TYPE_CHK 1690 <1> ; 1691 00004755 BB[67660000] <1> mov ebx, MD_TBL6 ; 1.44MB fd parameter table 1692 <1> ; Default for GET_PARM (11/12/2014) 1693 <1> ; 1694 0000475A F9 <1> stc ; DRIVE TYPE NOT FOUND IN TABLE 1695 <1> ;jmp short TYPE_RTN 1696 <1> ; 12/07/2022 1697 0000475B C3 <1> retn 1698 <1> DR_TYPE_VALID: 1699 <1> ;mov ebx, [DR_TYPE+ebx+1] ; EBX = MEDIA TABLE 1700 0000475C 43 <1> inc ebx 1701 0000475D 8B1B <1> mov ebx, [ebx] 1702 <1> TYPE_RTN: 1703 <1> ;pop ecx ; 08/07/2022 1704 <1> ; 24/12/2021 1705 <1> ;pop eax ; 11/07/2022 1706 0000475F C3 <1> retn 1707 <1> 1708 <1> ;---------------------------------------------------------------- 1709 <1> ; SEND_SPEC : 1710 <1> ; SEND THE SPECIFY COMMAND TO CONTROLLER USING DATA FROM : 1711 <1> ; THE DRIVE PARAMETER TABLE POINTED BY @DISK_POINTER : 1712 <1> ; ON ENTRY: @DISK_POINTER = DRIVE PARAMETER TABLE : 1713 <1> ; ON EXIT: NONE : 1714 <1> ; REGISTERS ALTERED: CX, DX : 1715 <1> ;---------------------------------------------------------------- 1716 <1> SEND_SPEC: 1717 <1> ; 06/08/2022 1718 00004760 50 <1> push eax ; SAVE AX 1719 00004761 B8[87470000] <1> mov eax, SPECBAC ; LOAD ERROR ADDRESS 1720 00004766 50 <1> push eax ; PUSH NEC_OUT ERROR RETURN 1721 00004767 B403 <1> mov ah, 03h ; SPECIFY COMMAND 1722 00004769 E898050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1723 <1> ;sub dl, dl ; FIRST SPECIFY BYTE 1724 <1> ; 06/08/2022 1725 0000476E 28C0 <1> sub al, al ; 0 1726 00004770 E89B040000 <1> call GET_PARM ; GET PARAMETER TO AH 1727 00004775 E88C050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1728 <1> ;mov dl, 1 ; SECOND SPECIFY BYTE 1729 <1> ; 06/08/2022 1730 0000477A B001 <1> mov al, 1 1731 0000477C E88F040000 <1> call GET_PARM ; GET PARAMETER TO AH 1732 00004781 E880050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1733 00004786 58 <1> pop eax ; POP ERROR RETURN 1734 <1> SPECBAC: 1735 00004787 58 <1> pop eax ; RESTORE ORIGINAL AX VALUE 1736 00004788 C3 <1> retn 1737 <1> 1738 <1> ;---------------------------------------------------------------- 1739 <1> ; SEND_SPEC_MD : 1740 <1> ; SEND THE SPECIFY COMMAND TO CONTROLLER USING DATA FROM : 1741 <1> ; THE MEDIA/DRIVE PARAMETER TABLE POINTED BY (CS:BX) : 1742 <1> ; ON ENTRY: CS:BX = MEDIA/DRIVE PARAMETER TABLE : 1743 <1> ; ON EXIT: NONE : 1744 <1> ; REGISTERS ALTERED: AX : 1745 <1> ;---------------------------------------------------------------- 1746 <1> SEND_SPEC_MD: 1747 00004789 50 <1> push eax ; SAVE RATE DATA 1748 0000478A B8[A7470000] <1> mov eax, SPEC_ESBAC ; LOAD ERROR ADDRESS 1749 0000478F 50 <1> push eax ; PUSH NEC_OUT ERROR RETURN 1750 00004790 B403 <1> mov ah, 03h ; SPECIFY COMMAND 1751 00004792 E86F050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1752 00004797 8A23 <1> mov ah, [ebx+MD.SPEC1] ; GET 1ST SPECIFY BYTE 1753 00004799 E868050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1754 0000479E 8A6301 <1> mov ah, [ebx+MD.SPEC2] ; GET SECOND SPECIFY BYTE 1755 000047A1 E860050000 <1> call NEC_OUTPUT ; OUTPUT THE COMMAND 1756 000047A6 58 <1> pop eax ; POP ERROR RETURN 1757 <1> SPEC_ESBAC: 1758 000047A7 58 <1> pop eax ; RESTORE ORIGINAL AX VALUE 1759 000047A8 C3 <1> retn 1760 <1> 1761 <1> ;------------------------------------------------------------------------------- 1762 <1> ; XLAT_NEW 1763 <1> ; TRANSLATES DISKETTE STATE LOCATIONS FROM COMPATIBLE 1764 <1> ; MODE TO NEW ARCHITECTURE. 1765 <1> ; 1766 <1> ; ON ENTRY: DI = DRIVE # 1767 <1> ;------------------------------------------------------------------------------- 1768 <1> XLAT_NEW: 1769 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1770 <1> ; 11/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 1771 000047A9 83FF01 <1> cmp edi, 1 ; VALID DRIVE 1772 000047AC 7709 <1> ja short XN_OUT ; IF INVALID BACK 1773 000047AE 80BF[43770100]00 <1> cmp byte [DSK_STATE+edi], 0 ; NO DRIVE ? 1774 000047B5 7401 <1> jz short DO_DET ; IF NO DRIVE ATTEMPT DETERMINE 1775 <1> 1776 <1> ;;mov cx, di ; CX = DRIVE NUMBER 1777 <1> ;mov ecx, edi 1778 <1> ;or cl, cl 1779 <1> ;jz short XN_0 1780 <1> ;shl cl, 2 ; CL = SHIFT COUNT, A=0, B=4 1781 <1> ;mov al, [HF_CNTRL] ; DRIVE INFORMATION 1782 <1> ;ror al, cl ; TO LOW NIBBLE 1783 <1> ;XN_0: 1784 <1> ;and al, DRV_DET+FMT_CAPA+TRK_CAPA ; KEEP DRIVE BITS 1785 <1> ;and byte [DSK_STATE+edi], ~(DRV_DET+FMT_CAPA+TRK_CAPA) 1786 <1> ;or [DSK_STATE+edi], al ; UPDATE DRIVE STATE 1787 <1> XN_OUT: 1788 000047B7 C3 <1> retn 1789 <1> 1790 <1> DO_DET: 1791 <1> ;call DRIVE_DET ; TRY TO DETERMINE 1792 <1> ;retn 1793 <1> ;jmp DRIVE_DET 1794 <1> 1795 <1> ;------------------------------------------------------------------------------- 1796 <1> ; DRIVE_DET 1797 <1> ; DETERMINES WHETHER DRIVE IS 80 OR 40 TRACKS AND 1798 <1> ; UPDATES STATE INFORMATION ACCORDINGLY. 1799 <1> ; ON ENTRY: DI = DRIVE # 1800 <1> ;------------------------------------------------------------------------------- 1801 <1> DRIVE_DET: 1802 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1803 <1> ; 08/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 1804 000047B8 E88E040000 <1> call MOTOR_ON ; TURN ON MOTOR IF NOT ALREADY ON 1805 000047BD E8FA050000 <1> call RECAL ; RECALIBRATE DRIVE 1806 000047C2 724E <1> jc short DD_BAC ; ASSUME NO DRIVE PRESENT 1807 000047C4 B530 <1> mov ch, TRK_SLAP ; SEEK TO TRACK 48 1808 000047C6 E872050000 <1> call SEEK 1809 000047CB 7245 <1> jc short DD_BAC ; ERROR NO DRIVE 1810 000047CD B50B <1> mov ch, QUIET_SEEK+1 ; SEEK TO TRACK 10 1811 <1> SK_GIN: 1812 000047CF FECD <1> dec ch ; DECREMENT TO NEXT TRACK 1813 <1> ;push cx ; SAVE TRACK 1814 <1> ; 11/04/2021 1815 000047D1 51 <1> push ecx 1816 000047D2 E866050000 <1> call SEEK 1817 000047D7 723A <1> jc short POP_BAC ; POP AND RETURN 1818 000047D9 B8[13480000] <1> mov eax, POP_BAC ; LOAD NEC OUTPUT ERROR ADDRESS 1819 000047DE 50 <1> push eax 1820 000047DF B404 <1> mov ah, SENSE_DRV_ST ; SENSE DRIVE STATUS COMMAND BYTE 1821 000047E1 E820050000 <1> call NEC_OUTPUT ; OUTPUT TO NEC 1822 <1> ;mov ax, di ; AL = DRIVE 1823 <1> ; 06/08/2022 1824 000047E6 89F8 <1> mov eax, edi 1825 000047E8 88C4 <1> mov ah, al ; AH = DRIVE 1826 000047EA E817050000 <1> call NEC_OUTPUT ; OUTPUT TO NEC 1827 000047EF E849060000 <1> call RESULTS ; GO GET STATUS 1828 000047F4 58 <1> pop eax ; THROW AWAY ERROR ADDRESS 1829 <1> ;pop cx ; RESTORE TRACK 1830 <1> ; 11/04/2021 1831 000047F5 59 <1> pop ecx 1832 000047F6 F605[39770100]10 <1> test byte [NEC_STATUS], HOME ; TRACK 0 ? 1833 000047FD 74D0 <1> jz short SK_GIN ; GO TILL TRACK 0 1834 000047FF 08ED <1> or ch, ch ; IS HOME AT TRACK 0 1835 00004801 7408 <1> jz short IS_80 ; MUST BE 80 TRACK DRIVE 1836 <1> 1837 <1> ; DRIVE IS A 360; SET DRIVE TO DETERMINED; 1838 <1> ; SET MEDIA TO DETERMINED AT RATE 250. 1839 <1> 1840 00004803 808F[43770100]94 <1> or byte [DSK_STATE+edi], DRV_DET+MED_DET+RATE_250 1841 0000480A C3 <1> retn ; ALL INFORMATION SET 1842 <1> IS_80: 1843 0000480B 808F[43770100]01 <1> or byte [DSK_STATE+edi], TRK_CAPA ; SETUP 80 TRACK CAPABILITY 1844 <1> DD_BAC: 1845 00004812 C3 <1> retn 1846 <1> POP_BAC: 1847 <1> ;pop cx ; THROW AWAY 1848 <1> ; 11/04/2021 1849 00004813 59 <1> pop ecx 1850 00004814 C3 <1> retn 1851 <1> 1852 <1> 1853 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1854 <1> 1855 <1> %if 0 1856 <1> 1857 <1> ;------------------------------------------------------------------------------- 1858 <1> ; XLAT_OLD 1859 <1> ; TRANSLATES DISKETTE STATE LOCATIONS FROM NEW 1860 <1> ; ARCHITECTURE TO COMPATIBLE MODE. 1861 <1> ; 1862 <1> ; ON ENTRY: DI = DRIVE 1863 <1> ;------------------------------------------------------------------------------- 1864 <1> XLAT_OLD: 1865 <1> cmp edi, 1 ; VALID DRIVE ? 1866 <1> ja short XO_OUT ; IF INVALID BACK 1867 <1> cmp byte [DSK_STATE+edi], 0 ; NO DRIVE ? 1868 <1> jz short XO_OUT ; IF NO DRIVE TRANSLATE DONE 1869 <1> 1870 <1> ;----- TEST FOR SAVED DRIVE INFORMATION ALREADY SET 1871 <1> 1872 <1> ;mov cx, di ; CX = DRIVE NUMBER 1873 <1> ; 06/08/2022 1874 <1> mov ecx, edi 1875 <1> shl cl, 2 ; CL = SHIFT COUNT, A=0, B=4 1876 <1> mov ah, FMT_CAPA ; LOAD MULTIPLE DATA RATE BIT MASK 1877 <1> ror ah, cl ; ROTATE BY MASK 1878 <1> test [HF_CNTRL], ah ; MULTIPLE-DATA RATE DETERMINED ? 1879 <1> jnz short SAVE_SET ; IF SO, NO NEED TO RE-SAVE 1880 <1> 1881 <1> ;----- ERASE DRIVE BITS IN @HF_CNTRL FOR THIS DRIVE 1882 <1> 1883 <1> mov ah, DRV_DET+FMT_CAPA+TRK_CAPA ; MASK TO KEEP 1884 <1> ror ah, cl ; FIX MASK TO KEEP 1885 <1> not ah ; TRANSLATE MASK 1886 <1> and [HF_CNTRL], ah ; KEEP BITS FROM OTHER DRIVE INTACT 1887 <1> 1888 <1> ;----- ACCESS CURRENT DRIVE BITS AND STORE IN @HF_CNTRL 1889 <1> 1890 <1> mov al, [DSK_STATE+edi] ; ACCESS STATE 1891 <1> and al, DRV_DET+FMT_CAPA+TRK_CAPA ; KEEP DRIVE BITS 1892 <1> ror al, cl ; FIX FOR THIS DRIVE 1893 <1> or [HF_CNTRL], al ; UPDATE SAVED DRIVE STATE 1894 <1> 1895 <1> ;----- TRANSLATE TO COMPATIBILITY MODE 1896 <1> 1897 <1> SAVE_SET: 1898 <1> mov ah, [DSK_STATE+edi] ; ACCESS STATE 1899 <1> mov bh, ah ; TO BH FOR LATER 1900 <1> and ah, RATE_MSK ; KEEP ONLY RATE 1901 <1> cmp ah, RATE_500 ; RATE 500 ? 1902 <1> jz short CHK_144 ; YES 1.2/1.2 OR 1.44/1.44 1903 <1> mov al, M3D1U ; AL = 360 IN 1.2 UNESTABLISHED 1904 <1> cmp ah, RATE_300 ; RATE 300 ? 1905 <1> jnz short CHK_250 ; NO, 360/360, 720/720 OR 720/1.44 1906 <1> test bh, DBL_STEP ; CHECK FOR DOUBLE STEP 1907 <1> jnz short TST_DET ; MUST BE 360 IN 1.2 1908 <1> UNKNO: 1909 <1> mov al, MED_UNK ; NONE OF THE ABOVE 1910 <1> jmp short AL_SET ; PROCESS COMPLETE 1911 <1> CHK_144: 1912 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN (AL) 1913 <1> ;;20/02/2015 1914 <1> ;;jc short UNKNO ; ERROR, SET 'NONE OF ABOVE' 1915 <1> jz short UNKNO ;; 20/02/2015 1916 <1> cmp al, 2 ; 1.2MB DRIVE ? 1917 <1> jne short UNKNO ; NO, GO SET 'NONE OF ABOVE' 1918 <1> mov al, M1D1U ; AL = 1.2 IN 1.2 UNESTABLISHED 1919 <1> jmp short TST_DET 1920 <1> CHK_250: 1921 <1> mov al, M3D3U ; AL = 360 IN 360 UNESTABLISHED 1922 <1> cmp ah, RATE_250 ; RATE 250 ? 1923 <1> jnz short UNKNO ; IF SO FALL IHRU 1924 <1> test bh, TRK_CAPA ; 80 TRACK CAPABILITY ? 1925 <1> jnz short UNKNO ; IF SO JUMP, FALL THRU TEST DET 1926 <1> TST_DET: 1927 <1> test bh, MED_DET ; DETERMINED ? 1928 <1> jz short AL_SET ; IF NOT THEN SET 1929 <1> add al, 3 ; MAKE DETERMINED/ESTABLISHED 1930 <1> AL_SET: 1931 <1> and byte [DSK_STATE+edi], ~(DRV_DET+FMT_CAPA+TRK_CAPA) ; CLEAR DRIVE 1932 <1> or [DSK_STATE+edi], al ; REPLACE WITH COMPATIBLE MODE 1933 <1> XO_OUT: 1934 <1> retn 1935 <1> 1936 <1> %endif 1937 <1> 1938 <1> ;------------------------------------------------------------------------------- 1939 <1> ; SETUP_STATE: INITIALIZES START AND END RATES. 1940 <1> ;------------------------------------------------------------------------------- 1941 <1> SETUP_STATE: 1942 00004815 F687[43770100]10 <1> test byte [DSK_STATE+edi], MED_DET ; MEDIA DETERMINED ? 1943 0000481C 7537 <1> jnz short J1C ; NO STATES IF DETERMINED 1944 0000481E 66B84000 <1> mov ax, (RATE_500*256)+RATE_300 ; AH = START RATE, AL = END RATE 1945 00004822 F687[43770100]04 <1> test byte [DSK_STATE+edi], DRV_DET ; DRIVE ? 1946 00004829 740D <1> jz short AX_SET ; DO NOT KNOW DRIVE 1947 0000482B F687[43770100]02 <1> test byte [DSK_STATE+edi], FMT_CAPA ; MULTI-RATE? 1948 00004832 7504 <1> jnz short AX_SET ; JUMP IF YES 1949 00004834 66B88080 <1> mov ax, RATE_250*257 ; START A END RATE 250 FOR 360 DRIVE 1950 <1> AX_SET: 1951 00004838 80A7[43770100]1F <1> and byte [DSK_STATE+edi], ~(RATE_MSK+DBL_STEP) ; TURN OFF THE RATE 1952 0000483F 08A7[43770100] <1> or [DSK_STATE+edi], ah ; RATE FIRST TO TRY 1953 00004845 8025[40770100]F3 <1> and byte [LASTRATE], ~STRT_MSK ; ERASE LAST TO TRY RATE BITS 1954 0000484C C0C804 <1> ror al, 4 ; TO OPERATION LAST RATE LOCATION 1955 0000484F 0805[40770100] <1> or [LASTRATE], al ; LAST RATE 1956 <1> J1C: 1957 00004855 C3 <1> retn 1958 <1> 1959 <1> ;------------------------------------------------------------------------------- 1960 <1> ; FMT_INIT: ESTABLISH STATE IF UNESTABLISHED AT FORMAT TIME. 1961 <1> ;------------------------------------------------------------------------------- 1962 <1> FMT_INIT: 1963 00004856 F687[43770100]10 <1> test byte [DSK_STATE+edi], MED_DET ; IS MEDIA ESTABLISHED 1964 0000485D 7546 <1> jnz short F1_OUT ; IF SO RETURN 1965 0000485F E8A3030000 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN AL 1966 <1> ;; 20/02/2015 1967 <1> ;;jc short CL_DRV ; ERROR IN CMOS ASSUME NO DRIVE 1968 00004864 7440 <1> jz short CL_DRV ;; 20/02/2015 1969 00004866 FEC8 <1> dec al ; MAKE ZERO ORIGIN 1970 <1> ;;JS short CL_DRV ; NO DRIVE IF AL 0 1971 00004868 8AA7[43770100] <1> mov ah, [DSK_STATE+edi] ; AH = CURRENT STATE 1972 0000486E 80E40F <1> and ah, ~(MED_DET+DBL_STEP+RATE_MSK) ; CLEAR 1973 00004871 08C0 <1> or al, al ; CHECK FOR 360 1974 00004873 7505 <1> jnz short N_360 ; IF 360 WILL BE 0 1975 00004875 80CC90 <1> or ah, MED_DET+RATE_250 ; ESTABLISH MEDIA 1976 00004878 EB25 <1> jmp short SKP_STATE ; SKIP OTHER STATE PROCESSING 1977 <1> N_360: 1978 0000487A FEC8 <1> dec al ; 1.2 M DRIVE 1979 0000487C 7505 <1> jnz short N_12 ; JUMP IF NOT 1980 <1> F1_RATE: 1981 0000487E 80CC10 <1> or ah, MED_DET+RATE_500 ; SET FORMAT RATE 1982 00004881 EB1C <1> jmp short SKP_STATE ; SKIP OTHER STATE PROCESSING 1983 <1> N_12: 1984 00004883 FEC8 <1> dec al ; CHECK FOR TYPE 3 1985 00004885 750F <1> jnz short N_720 ; JUMP IF NOT 1986 00004887 F6C404 <1> test ah, DRV_DET ; IS DRIVE DETERMINED 1987 0000488A 7410 <1> jz short ISNT_12 ; TREAT AS NON 1.2 DRIVE 1988 0000488C F6C402 <1> test ah, FMT_CAPA ; IS 1.2M 1989 0000488F 740B <1> jz short ISNT_12 ; JUMP IF NOT 1990 00004891 80CC50 <1> or ah, MED_DET+RATE_300 ; RATE 300 1991 00004894 EB09 <1> jmp short SKP_STATE ; CONTINUE 1992 <1> N_720: 1993 00004896 FEC8 <1> dec al ; CHECK FOR TYPE 4 1994 00004898 750C <1> jnz short CL_DRV ; NO DRIVE, CMOS BAD 1995 0000489A EBE2 <1> jmp SHORT F1_RATE 1996 <1> ISNT_12: 1997 0000489C 80CC90 <1> or ah, MED_DET+RATE_250 ; MUST BE RATE 250 1998 <1> SKP_STATE: 1999 0000489F 88A7[43770100] <1> mov [DSK_STATE+edi], ah ; STORE AWAY 2000 <1> F1_OUT: 2001 000048A5 C3 <1> retn 2002 <1> CL_DRV: 2003 000048A6 30E4 <1> xor ah, ah ; CLEAR STATE 2004 000048A8 EBF5 <1> jmp short SKP_STATE ; SAVE IT 2005 <1> 2006 <1> ;------------------------------------------------------------------------------- 2007 <1> ; MED_CHANGE 2008 <1> ; CHECKS FOR MEDIA CHANGE, RESETS MEDIA CHANGE, 2009 <1> ; CHECKS MEDIA CHANGE AGAIN. 2010 <1> ; 2011 <1> ; ON EXIT: CY = 1 MEANS MEDIA CHANGE OR TIMEOUT 2012 <1> ; @DSKETTE_STATUS = ERROR CODE 2013 <1> ;------------------------------------------------------------------------------- 2014 <1> MED_CHANGE: 2015 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2016 000048AA E8E8050000 <1> call READ_DSKCHNG ; READ DISK CHANCE LINE STATE 2017 000048AF 7445 <1> jz short MC_OUT ; BYPASS HANDLING DISK CHANGE LINE 2018 000048B1 80A7[43770100]EF <1> and byte [DSK_STATE+edi], ~MED_DET ; CLEAR STATE FOR THIS DRIVE 2019 <1> 2020 <1> ; THIS SEQUENCE ENSURES WHENEVER A DISKETTE IS CHANGED THAT 2021 <1> ; ON THE NEXT OPERATION THE REQUIRED MOTOR START UP TIME WILL 2022 <1> ; BE WAITED. (DRIVE MOTOR MAY GO OFF UPON DOOR OPENING). 2023 <1> 2024 <1> ;mov cx, di ; CL = DRIVE 0 2025 <1> ; 06/08/2022 2026 000048B8 89F9 <1> mov ecx, edi 2027 000048BA B001 <1> mov al, 1 ; MOTOR ON BIT MASK 2028 000048BC D2E0 <1> shl al, cl ; TO APPROPRIATE POSITION 2029 000048BE F6D0 <1> not al ; KEEP ALL BUT MOTOR ON 2030 000048C0 FA <1> cli ; NO INTERRUPTS 2031 000048C1 2005[36770100] <1> and [MOTOR_STATUS], al ; TURN MOTOR OFF INDICATOR 2032 000048C7 FB <1> sti ; INTERRUPTS ENABLED 2033 000048C8 E87E030000 <1> call MOTOR_ON ; TURN MOTOR ON 2034 <1> 2035 <1> ;----- THIS SEQUENCE OF SEEKS IS USED TO RESET DISKETTE CHANGE SIGNAL 2036 <1> 2037 000048CD E82FFAFFFF <1> call DSK_RESET ; RESET NEC 2038 000048D2 B501 <1> mov ch, 1 ; MOVE TO CYLINDER 1 2039 000048D4 E864040000 <1> call SEEK ; ISSUE SEEK 2040 000048D9 30ED <1> xor ch, ch ; MOVE TO CYLINDER 0 2041 000048DB E85D040000 <1> call SEEK ; ISSUE SEEK 2042 000048E0 C605[38770100]06 <1> mov byte [DSKETTE_STATUS], MEDIA_CHANGE ; STORE IN STATUS 2043 <1> OK1: 2044 000048E7 E8AB050000 <1> call READ_DSKCHNG ; CHECK MEDIA CHANGED AGAIN 2045 000048EC 7407 <1> jz short OK2 ; IF ACTIVE, NO DISKETTE, TIMEOUT 2046 <1> OK4: 2047 000048EE C605[38770100]80 <1> mov byte [DSKETTE_STATUS], TIME_OUT ; TIMEOUT IF DRIVE EMPTY 2048 <1> OK2: 2049 000048F5 F9 <1> stc ; MEDIA CHANGED, SET CY 2050 <1> MC_OUT: ; 06/08/2022 (cf = 0) 2051 000048F6 C3 <1> retn 2052 <1> ;MC_OUT: 2053 <1> ;clc ; NO MEDIA CHANGED, CLEAR CY 2054 <1> ;retn 2055 <1> 2056 <1> ;------------------------------------------------------------------------------- 2057 <1> ; SEND_RATE 2058 <1> ; SENDS DATA RATE COMMAND TO NEC 2059 <1> ; ON ENTRY: DI = DRIVE # 2060 <1> ; ON EXIT: NONE 2061 <1> ; REGISTERS ALTERED: DX 2062 <1> ;------------------------------------------------------------------------------- 2063 <1> SEND_RATE: 2064 <1> ;push ax ; SAVE REG. 2065 <1> ; 11/04/2021 2066 000048F7 50 <1> push eax 2067 000048F8 8025[40770100]3F <1> and byte [LASTRATE], ~SEND_MSK ; ELSE CLEAR LAST RATE ATTEMPTED 2068 000048FF 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; GET RATE STATE OF THIS DRIVE 2069 00004905 24C0 <1> and al, SEND_MSK ; KEEP ONLY RATE BITS 2070 00004907 0805[40770100] <1> or [LASTRATE], al ; SAVE NEW RATE FOR NEXT CHECK 2071 0000490D C0C002 <1> rol al, 2 ; MOVE TO BIT OUTPUT POSITIONS 2072 00004910 66BAF703 <1> mov dx, 03F7h ; OUTPUT NEW DATA RATE 2073 00004914 EE <1> out dx, al 2074 <1> ;pop ax ; RESTORE REG. 2075 <1> ; 11/04/2021 2076 00004915 58 <1> pop eax 2077 00004916 C3 <1> retn 2078 <1> 2079 <1> ;------------------------------------------------------------------------------- 2080 <1> ; CHK_LASTRATE 2081 <1> ; CHECK PREVIOUS DATE RATE SNT TO THE CONTROLLER. 2082 <1> ; ON ENTRY: 2083 <1> ; DI = DRIVE # 2084 <1> ; ON EXIT: 2085 <1> ; ZF = 1 DATA RATE IS THE SAME AS THE LAST RATE SENT TO NEC 2086 <1> ; ZF = 0 DATA RATE IS DIFFERENT FROM LAST RATE 2087 <1> ; REGISTERS ALTERED: DX 2088 <1> ;------------------------------------------------------------------------------- 2089 <1> CHK_LASTRATE: 2090 <1> ; 13/07/2022 - TRDOS 386 v2.0.5 2091 <1> ;push ax ; SAVE REG. 2092 <1> ; 11/04/2021 2093 00004917 50 <1> push eax 2094 <1> ; 13/07/2022 (BugFix) 2095 00004918 8A25[40770100] <1> mov ah, [LASTRATE] ; GET LAST DATA RATE SELECTED 2096 0000491E 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; GET RATE STATE OF THIS DRIVE 2097 00004924 6625C0C0 <1> and ax, SEND_MSK*257 ; KEEP ONLY RATE BITS OF BOTH 2098 00004928 38E0 <1> cmp al, ah ; COMPARE TO PREVIOUSLY TRIED 2099 <1> ; ZF = 1 RATE IS THE SAME 2100 <1> ;pop ax ; RESTORE REG. 2101 <1> ; 11/04/2021 2102 0000492A 58 <1> pop eax 2103 0000492B C3 <1> retn 2104 <1> 2105 <1> ;------------------------------------------------------------------------------- 2106 <1> ; DMA_SETUP 2107 <1> ; THIS ROUTINE SETS UP THE DMA FOR READ/WRITE/VERIFY OPERATIONS. 2108 <1> ; 2109 <1> ; ON ENTRY: AL = DMA COMMAND 2110 <1> ; 2111 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2112 <1> ;------------------------------------------------------------------------------- 2113 <1> 2114 <1> ; SI = Head #, # of Sectors or DASD Type 2115 <1> 2116 <1> ; 22/08/2015 2117 <1> ; 08/02/2015 - Protected Mode Modification 2118 <1> ; 06/02/2015 - 07/02/2015 2119 <1> ; NOTE: Buffer address must be in 1st 16MB of Physical Memory (24 bit limit). 2120 <1> ; (DMA Addres = Physical Address) 2121 <1> ; (Retro UNIX 386 v1 Kernel/System Mode Virtual Address = Physical Address) 2122 <1> ; 2123 <1> ; 09/08/2022 2124 <1> ; 06/08/2022 2125 <1> ; 04/02/2016 (clc) 2126 <1> ; 20/02/2015 modification (source: AWARD BIOS 1999, DMA_SETUP) 2127 <1> ; 16/12/2014 (IODELAY) 2128 <1> 2129 <1> DMA_SETUP: 2130 <1> ; 09/08/2022 2131 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 2132 <1> ;; 20/02/2015 2133 <1> ;;mov edx, [ebp+4] ; Buffer address 2134 <1> ; 06/08/2022 2135 <1> ;mov edx, ebp ; buffer address 2136 <1> ;test edx, 0FF000000h ; 16 MB limit (22/08/2015, bugfix) 2137 0000492C F7C5000000FF <1> test ebp, 0FF000000h 2138 00004932 7566 <1> jnz short dma_bnd_err_stc 2139 <1> ; 09/08/2022 2140 00004934 89EA <1> mov edx, ebp 2141 <1> ; 2142 <1> ;;push ax ; DMA command 2143 <1> ; 11/04/2021 2144 00004936 50 <1> push eax 2145 <1> ; 06/08/2022 2146 <1> ;push edx ; * 2147 <1> ;mov dl, 3 ; GET BYTES/SECTOR PARAMETER 2148 <1> ; 06/08/2022 2149 00004937 B003 <1> mov al, 3 ; GET BYTES/SECTOR PARAMETER 2150 00004939 E8D2020000 <1> call GET_PARM ; 2151 0000493E 88E1 <1> mov cl, ah ; SHIFT COUNT (0=128, 1=256, 2=512 ETC) 2152 <1> ;mov ax, si ; Sector count 2153 <1> ; 06/08/2022 2154 00004940 89F0 <1> mov eax, esi 2155 00004942 88C4 <1> mov ah, al ; AH = # OF SECTORS 2156 00004944 28C0 <1> sub al, al ; AL = 0, AX = # SECTORS * 256 2157 <1> ;shr ax, 1 ; AX = # SECTORS * 128 2158 <1> ; 06/08/2022 2159 00004946 D1E8 <1> shr eax, 1 2160 <1> ;shl ax, cl ; SHIFT BY PARAMETER VALUE 2161 <1> ;dec ax ; -1 FOR DMA VALUE 2162 <1> ;mov cx, ax 2163 00004948 D3E0 <1> shl eax, cl 2164 0000494A 48 <1> dec eax 2165 0000494B 89C1 <1> mov ecx, eax 2166 <1> ; 06/08/2022 2167 <1> ;pop edx ; * 2168 <1> ;;pop ax 2169 <1> ; 11/04/2021 2170 0000494D 58 <1> pop eax 2171 0000494E 3C42 <1> cmp al, 42h 2172 00004950 7507 <1> jne short NOT_VERF 2173 <1> ; 09/08/2022 2174 00004952 BA0000FF00 <1> mov edx, 0FF0000h 2175 <1> ; 06/08/2022 2176 <1> ;mov ebp, 0FF0000h 2177 00004957 EB08 <1> jmp short J33 2178 <1> NOT_VERF: 2179 00004959 6601CA <1> add dx, cx ; check for overflow 2180 0000495C 723D <1> jc short dma_bnd_err 2181 <1> ; 2182 0000495E 6629CA <1> sub dx, cx ; Restore start address 2183 <1> J33: 2184 00004961 FA <1> cli ; DISABLE INTERRUPTS DURING DMA SET-UP 2185 00004962 E60C <1> out DMA+12, al ; SET THE FIRST/LA5T F/F 2186 <1> IODELAY ; WAIT FOR I/O 78 00004964 EB00 <2> jmp short $+2 79 00004966 EB00 <2> jmp short $+2 2187 00004968 E60B <1> out DMA+11, al ; OUTPUT THE MODE BYTE 2188 <1> ;mov eax, edx ; Buffer address 2189 <1> ; 06/08/2022 2190 <1> ;mov eax, ebp 2191 <1> ; 09/08/2022 2192 0000496A 89D0 <1> mov eax, edx 2193 0000496C E604 <1> out DMA+4, al ; OUTPUT LOW ADDRESS 2194 <1> IODELAY ; WAIT FOR I/O 78 0000496E EB00 <2> jmp short $+2 79 00004970 EB00 <2> jmp short $+2 2195 00004972 88E0 <1> mov al, ah 2196 00004974 E604 <1> out DMA+4, al ; OUTPUT HIGH ADDRESS 2197 00004976 C1E810 <1> shr eax, 16 2198 <1> IODELAY ; I/O WAIT STATE 78 00004979 EB00 <2> jmp short $+2 79 0000497B EB00 <2> jmp short $+2 2199 0000497D E681 <1> out 081h, al ; OUTPUT HIGHEST BITS TO PAGE REGISTER 2200 <1> IODELAY 78 0000497F EB00 <2> jmp short $+2 79 00004981 EB00 <2> jmp short $+2 2201 <1> ;mov ax, cx ; Byte count - 1 2202 <1> ; 06/08/2022 2203 00004983 89C8 <1> mov eax, ecx 2204 00004985 E605 <1> out DMA+5, al ; LOW BYTE OF COUNT 2205 <1> IODELAY ; WAIT FOR I/O 78 00004987 EB00 <2> jmp short $+2 79 00004989 EB00 <2> jmp short $+2 2206 0000498B 88E0 <1> mov al, ah 2207 0000498D E605 <1> out DMA+5, al ; HIGH BYTE OF COUNT 2208 <1> IODELAY 78 0000498F EB00 <2> jmp short $+2 79 00004991 EB00 <2> jmp short $+2 2209 00004993 FB <1> sti ; RE-ENABLE INTERRUPTS 2210 00004994 B002 <1> mov al, 2 ; MODE FOR 8237 2211 00004996 E60A <1> out DMA+10, al ; INITIALIZE THE DISKETTE CHANNEL 2212 <1> 2213 00004998 F8 <1> clc ; 04/02/2016 2214 00004999 C3 <1> retn 2215 <1> 2216 <1> dma_bnd_err_stc: 2217 0000499A F9 <1> stc 2218 <1> dma_bnd_err: 2219 0000499B C605[38770100]09 <1> mov byte [DSKETTE_STATUS], DMA_BOUNDARY ; SET ERROR 2220 000049A2 C3 <1> retn ; CY SET BY ABOVE IF ERROR 2221 <1> 2222 <1> ;; 16/12/2014 2223 <1> ;; CLI ; DISABLE INTERRUPTS DURING DMA SET-UP 2224 <1> ;; OUT DMA+12,AL ; SET THE FIRST/LA5T F/F 2225 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2226 <1> ;; IODELAY 2227 <1> ;; OUT DMA+11,AL ; OUTPUT THE MODE BYTE 2228 <1> ;; ;SIODELAY 2229 <1> ;; ;cmp AL,42H ; DMA VERIFY COMMAND 2230 <1> ;; ;JNE short NOT_VERF ; NO 2231 <1> ;; ;xor AX,AX ; START ADDRESS 2232 <1> ;; ;jmp SHORT J33 2233 <1> ;;;NOT_VERF: 2234 <1> ;; ;mov AX,ES ; GET THE ES VALUE 2235 <1> ;; ;ROL AX,4 ; ROTATE LEFT 2236 <1> ;; ;mov CH,AL ; GET HIGHEST NIBBLE OF ES TO CH 2237 <1> ;; ;and AL,11110000B ; ZERO THE LOW NIBBLE FROM SEGMENT 2238 <1> ;; ;add AX,[BP+2] ; TEST FOR CARRY FROM ADDITION 2239 <1> ;; mov eax,[ebp+4] ; 06/02/2015 2240 <1> ;; ;jnc short J33 2241 <1> ;; ;inc CH ; CARRY MEANS HIGH 4 BITS MUST BE INC 2242 <1> ;;;J33: 2243 <1> ;; push eax ; SAVE START ADDRESS 2244 <1> ;; OUT DMA+4,AL ; OUTPUT LOW ADDRESS 2245 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2246 <1> ;; IODELAY 2247 <1> ;; mov AL,AH 2248 <1> ;; OUT DMA+4,AL ; OUTPUT HIGH ADDRESS 2249 <1> ;; shr eax, 16 ; 07/02/2015 2250 <1> ;; ;mov AL,CH ; GET HIGH 4 BITS 2251 <1> ;; ;jmp $+2 ; I/O WAIT STATE 2252 <1> ;; IODELAY 2253 <1> ;; ;and AL,00001111B 2254 <1> ;; OUT 081H,AL ; OUTPUT HIGH 4 BITS TO PAGE REGISTER 2255 <1> ;; ;SIODELAY 2256 <1> ;; 2257 <1> ;;;----- DETERMINE COUNT 2258 <1> ;; sub eax, eax ; 08/02/2015 2259 <1> ;; mov AX,SI ; AL = # OF SECTORS 2260 <1> ;; xchg AL,AH ; AH = # OF SECTORS 2261 <1> ;; sub AL,AL ; AL = 0, AX = # SECTORS * 256 2262 <1> ;; SHR AX,1 ; AX = # SECTORS * 128 2263 <1> ;; push AX ; SAVE # OF SECTORS * 128 2264 <1> ;; mov DL,3 ; GET BYTES/SECTOR PARAMETER 2265 <1> ;; call GET_PARM ; " 2266 <1> ;; mov CL,AH ; SHIFT COUNT (0=128, 1=256, 2=512 ETC) 2267 <1> ;; pop AX ; AX = # SECTORS * 128 2268 <1> ;; SHL AX,CL ; SHIFT BY PARAMETER VALUE 2269 <1> ;; dec AX ; -1 FOR DMA VALUE 2270 <1> ;; push eax ; 08/02/2015 ; SAVE COUNT VALUE 2271 <1> ;; OUT DMA+5,AL ; LOW BYTE OF COUNT 2272 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2273 <1> ;; IODELAY 2274 <1> ;; mov AL,AH 2275 <1> ;; OUT DMA+5,AL ; HIGH BYTE OF COUNT 2276 <1> ;; ;IODELAY 2277 <1> ;; STI ; RE-ENABLE INTERRUPTS 2278 <1> ;; pop ecx ; 08/02/2015 ; RECOVER COUNT VALUE 2279 <1> ;; pop eax ; 08/02/2015 ; RECOVER ADDRESS VALUE 2280 <1> ;; ;add AX, CX ; ADD, TEST FOR 64K OVERFLOW 2281 <1> ;; add ecx,eax ; 08/02/2015 2282 <1> ;; mov AL, 2 ; MODE FOR 8237 2283 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2284 <1> ;; SIODELAY 2285 <1> ;; OUT DMA+10,AL ; INITIALIZE THE DISKETTE CHANNEL 2286 <1> ;; ;jnc short NO_BAD ; CHECK FOR ERROR 2287 <1> ;; jc short dma_bnd_err ; 08/02/2015 2288 <1> ;; and ecx,0FFF00000h ; 16 MB limit 2289 <1> ;; jz short NO_BAD 2290 <1> ;;dma_bnd_err: 2291 <1> ;; mov byte [DSKETTE_STATUS],DMA_BOUNDARY ; SET ERROR 2292 <1> ;;NO_BAD: 2293 <1> ;; retn ; CY SET BY ABOVE IF ERROR 2294 <1> 2295 <1> ;------------------------------------------------------------------------------- 2296 <1> ; FMTDMA_SET 2297 <1> ; THIS ROUTINE SETS UP THE DMA CONTROLLER FOR A FORMAT OPERATION. 2298 <1> ; 2299 <1> ; ON ENTRY: NOTHING REQUIRED 2300 <1> ; 2301 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2302 <1> ;------------------------------------------------------------------------------- 2303 <1> 2304 <1> FMTDMA_SET: 2305 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2306 <1> ;; 20/02/2015 modification 2307 <1> ;;mov edx, [ebp+4] ; Buffer address 2308 <1> ; 06/08/2022 2309 <1> ;mov edx, ebp ; buffer address 2310 <1> ; 06/08/2022 2311 <1> ;test edx, 0FF000000h ; 16 MB limit 2312 000049A3 F7C5000000FF <1> test ebp, 0FF000000h 2313 000049A9 75EF <1> jnz short dma_bnd_err_stc 2314 <1> ; 2315 <1> ;;push dx ; * 2316 <1> ;; 11/04/2021 2317 <1> ; 06/08/2022 2318 <1> ;push edx 2319 <1> ;mov dl, 4 ; SECTORS/TRACK VALUE IN PARM TABLE 2320 <1> ; 06/08/2022 2321 000049AB B004 <1> mov al, 4 ; SECTORS/TRACK VALUE IN PARM TABLE 2322 000049AD E85E020000 <1> call GET_PARM ; " 2323 000049B2 88E0 <1> mov al, ah ; AL = SECTORS/TRACK VALUE 2324 000049B4 28E4 <1> sub ah, ah ; AX = SECTORS/TRACK VALUE 2325 <1> ;shl ax, 2 ; AX = SEC/TRK * 4 (OFFSET C,H,R,N) 2326 <1> ; 06/08/2022 2327 000049B6 C1E002 <1> shl eax, 2 2328 <1> ;dec ax ; -1 FOR DMA VALUE 2329 000049B9 48 <1> dec eax 2330 <1> ;mov cx, ax 2331 000049BA 89C1 <1> mov ecx, eax 2332 <1> ;;pop dx ; * 2333 <1> ;; 11/04/2021 2334 <1> ; 06/08/2022 2335 <1> ;pop edx 2336 <1> ; 06/08/2022 2337 000049BC B04A <1> mov al, 04Ah 2338 <1> ; 2339 000049BE EB99 <1> jmp short NOT_VERF ; 06/08/2022 2340 <1> 2341 <1> ;; 06/08/2022 2342 <1> ; add dx, cx ; check for overflow 2343 <1> ; jc short dma_bnd_err 2344 <1> ; ; 2345 <1> ; sub dx, cx ; Restore start address 2346 <1> ; ; 2347 <1> ; ;mov al, 04Ah ; WILL WRITE TO THE DISKETTE 2348 <1> ; cli ; DISABLE INTERRUPTS DURING DMA SET-UP 2349 <1> ; out DMA+12, al ; SET THE FIRST/LA5T F/F 2350 <1> ; IODELAY ; WAIT FOR I/O 2351 <1> ; out DMA+11, al ; OUTPUT THE MODE BYTE 2352 <1> ; mov eax, edx ; Buffer address 2353 <1> ; out DMA+4, al ; OUTPUT LOW ADDRESS 2354 <1> ; IODELAY ; WAIT FOR I/O 2355 <1> ; mov al, ah 2356 <1> ; out DMA+4, al ; OUTPUT HIGH ADDRESS 2357 <1> ; shr eax, 16 2358 <1> ; IODELAY ; I/O WAIT STATE 2359 <1> ; out 081h, al ; OUTPUT HIGHEST BITS TO PAGE REGISTER 2360 <1> ; IODELAY 2361 <1> ; ;mov ax, cx ; Byte count - 1 2362 <1> ; ; 06/08/2022 2363 <1> ; mov eax, ecx 2364 <1> ; out DMA+5, al ; LOW BYTE OF COUNT 2365 <1> ; IODELAY ; WAIT FOR I/O 2366 <1> ; mov al, ah 2367 <1> ; out DMA+5, al ; HIGH BYTE OF COUNT 2368 <1> ; IODELAY 2369 <1> ; sti ; RE-ENABLE INTERRUPTS 2370 <1> ; mov al, 2 ; MODE FOR 8237 2371 <1> ; out DMA+10, al ; INITIALIZE THE DISKETTE CHANNEL 2372 <1> ; 2373 <1> ; ; 06/08/2022 2374 <1> ; clc 2375 <1> ; retn 2376 <1> 2377 <1> ;; 08/02/2015 - Protected Mode Modification 2378 <1> ;; mov AL,04AH ; WILL WRITE TO THE DISKETTE 2379 <1> ;; CLI ; DISABLE INTERRUPTS DURING DMA SET-UP 2380 <1> ;; OUT DMA+12,AL ; SET THE FIRST/LA5T F/F 2381 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2382 <1> ;; IODELAY 2383 <1> ;; OUT DMA+11,AL ; OUTPUT THE MODE BYTE 2384 <1> ;; ;mov AX,ES ; GET THE ES VALUE 2385 <1> ;; ;ROL AX,4 ; ROTATE LEFT 2386 <1> ;; ;mov CH,AL ; GET HIGHEST NIBBLE OF ES TO CH 2387 <1> ;; ;and AL,11110000B ; ZERO THE LOW NIBBLE FROM SEGMENT 2388 <1> ;; ;add AX,[BP+2] ; TEST FOR CARRY FROM ADDITION 2389 <1> ;; ;jnc short J33A 2390 <1> ;; ;inc CH ; CARRY MEANS HIGH 4 BITS MUST BE INC 2391 <1> ;; mov eax,[ebp+4] ; 08/02/2015 2392 <1> ;;;J33A: 2393 <1> ;; push eax ; 08/02/2015 ; SAVE START ADDRESS 2394 <1> ;; OUT DMA+4,AL ; OUTPUT LOW ADDRESS 2395 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2396 <1> ;; IODELAY 2397 <1> ;; mov AL,AH 2398 <1> ;; OUT DMA+4,AL ; OUTPUT HIGH ADDRESS 2399 <1> ;; shr eax,16 ; 08/02/2015 2400 <1> ;; ;mov AL,CH ; GET HIGH 4 BITS 2401 <1> ;; ;jmp $+2 ; I/O WAIT STATE 2402 <1> ;; IODELAY 2403 <1> ;; ;and AL,00001111B 2404 <1> ;; OUT 081H,AL ; OUTPUT HIGH 4 BITS TO PAGE REGISTER 2405 <1> ;; 2406 <1> ;;;----- DETERMINE COUNT 2407 <1> ;; sub eax,eax ; 08/02/2015 2408 <1> ;; mov DL,4 ; SECTORS/TRACK VALUE IN PARM TABLE 2409 <1> ;; call GET_PARM ; " 2410 <1> ;; xchg AL,AH ; AL = SECTORS/TRACK VALUE 2411 <1> ;; sub AH,AH ; AX = SECTORS/TRACK VALUE 2412 <1> ;; SHL AX,2 ; AX = SEC/TRK * 4 (OFFSET C,H,R,N) 2413 <1> ;; dec AX ; -1 FOR DMA VALUE 2414 <1> ;; push eax ; 08/02/2015 ; SAVE # OF BYTES TO BE TRANSFERED 2415 <1> ;; OUT DMA+5,AL ; LOW BYTE OF COUNT 2416 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2417 <1> ;; IODELAY 2418 <1> ;; mov AL,AH 2419 <1> ;; OUT DMA+5,AL ; HIGH BYTE OF COUNT 2420 <1> ;; STI ; RE-ENABLE INTERRUPTS 2421 <1> ;; pop ecx ; 08/02/2015 ; RECOVER COUNT VALUE 2422 <1> ;; pop eax ; 08/02/2015 ; RECOVER ADDRESS VALUE 2423 <1> ;; ;add AX,CX ; ADD, TEST FOR 64K OVERFLOW 2424 <1> ;; add ecx,eax ; 08/02/2015 2425 <1> ;; mov AL,2 ; MODE FOR 8237 2426 <1> ;; ;jmp $+2 ; WAIT FOR I/O 2427 <1> ;; SIODELAY 2428 <1> ;; OUT DMA+10,AL ; INITIALIZE THE DISKETTE CHANNEL 2429 <1> ;; ;jnc short FMTDMA_OK ; CHECK FOR ERROR 2430 <1> ;; jc short fmtdma_bnd_err ; 08/02/2015 2431 <1> ;; and ecx,0FFF00000h ; 16 MB limit 2432 <1> ;; jz short FMTDMA_OK 2433 <1> ;; stc ; 20/02/2015 2434 <1> ;;fmtdma_bnd_err: 2435 <1> ;; mov byte [DSKETTE_STATUS],DMA_BOUNDARY ; SET ERROR 2436 <1> ;;FMTDMA_OK: 2437 <1> ;; retn ; CY SET BY ABOVE IF ERROR 2438 <1> 2439 <1> ;------------------------------------------------------------------------------- 2440 <1> ; NEC_INIT 2441 <1> ; THIS ROUTINE SEEKS TO THE REQUESTED TRACK AND INITIALIZES 2442 <1> ; THE NEC FOR THE READ/WRITE/VERIFY/FORMAT OPERATION. 2443 <1> ; 2444 <1> ; ON ENTRY: AH = NEC COMMAND TO BE PERFORMED 2445 <1> ; 2446 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2447 <1> ;------------------------------------------------------------------------------- 2448 <1> NEC_INIT: 2449 <1> ; 11/08/2022 2450 <1> ; EBX = user's ECX register content (on stack) 2451 <1> ; 10/08/2022 2452 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2453 <1> ;push ax ; SAVE NEC COMMAND 2454 <1> ; 11/04/2021 2455 000049C0 50 <1> push eax 2456 000049C1 E885020000 <1> call MOTOR_ON ; TURN MOTOR ON FOR SPECIFIC DRIVE 2457 <1> 2458 <1> ;----- DO THE SEEK OPERATION 2459 <1> 2460 <1> ;mov ch, [ebp+1] ; CH = TRACK # 2461 <1> ; 10/08/2022 2462 000049C6 88FD <1> mov ch, bh ; CH = TRACK # 2463 000049C8 E870030000 <1> call SEEK ; MOVE TO CORRECT TRACK 2464 <1> ;pop ax ; RECOVER COMMAND 2465 <1> ; 11/04/2021 2466 000049CD 58 <1> pop eax 2467 000049CE 721D <1> jc short ER_1 ; ERROR ON SEEK 2468 000049D0 BB[ED490000] <1> mov ebx, ER_1 ; LOAD ERROR ADDRESS 2469 000049D5 53 <1> push ebx ; PUSH NEC_OUT ERROR RETURN 2470 <1> 2471 <1> ;----- SEND OUT THE PARAMETERS TO THE CONTROLLER 2472 <1> 2473 000049D6 E82B030000 <1> call NEC_OUTPUT ; OUTPUT THE OPERATION COMMAND 2474 <1> ;mov ax, si ; AH = HEAD # 2475 <1> ; 06/08/2022 2476 000049DB 89F0 <1> mov eax, esi 2477 000049DD 89FB <1> mov ebx, edi ; BL = DRIVE # 2478 000049DF C0E402 <1> sal ah, 2 ; MOVE IT TO BIT 2 2479 000049E2 80E404 <1> and ah, 00000100b ; ISOLATE THAT BIT 2480 000049E5 08DC <1> or ah, bl ; OR IN THE DRIVE NUMBER 2481 000049E7 E81A030000 <1> call NEC_OUTPUT ; FALL THRU CY SET IF ERROR 2482 000049EC 5B <1> pop ebx ; THROW AWAY ERROR RETURN 2483 <1> ER_1: 2484 000049ED C3 <1> retn 2485 <1> 2486 <1> ;------------------------------------------------------------------------------- 2487 <1> ; RWV_COM 2488 <1> ; THIS ROUTINE SENDS PARAMETERS TO THE NEC SPECIFIC TO THE 2489 <1> ; READ/WRITE/VERIFY OPERATIONS. 2490 <1> ; 2491 <1> ; ON ENTRY: CS:BX = ADDRESS OF MEDIA/DRIVE PARAMETER TABLE 2492 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2493 <1> ;------------------------------------------------------------------------------- 2494 <1> RWV_COM: 2495 <1> ; 11/08/2022 2496 <1> ; 10/08/2022 2497 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2498 000049EE B8[3A4A0000] <1> mov eax, ER_2 ; LOAD ERROR ADDRESS 2499 000049F3 50 <1> push eax ; PUSH NEC_OUT ERROR RETURN 2500 <1> ;mov ah, [ebp+1] ; OUTPUT TRACK # 2501 <1> ; 11/08/2022 2502 000049F4 8A642425 <1> mov ah, [esp+37] ; CH = OUTPUT TRACK # 2503 000049F8 E809030000 <1> call NEC_OUTPUT 2504 <1> ;mov ax, si ; OUTPUT HEAD # 2505 <1> ; 06/08/2022 2506 000049FD 89F0 <1> mov eax, esi 2507 000049FF E802030000 <1> call NEC_OUTPUT 2508 <1> ;mov ah, [ebp] ; OUTPUT SECTOR # 2509 <1> ; 11/08/2022 2510 00004A04 8A642424 <1> mov ah, [esp+36] ; CL = OUTPUT SECTOR # 2511 00004A08 E8F9020000 <1> call NEC_OUTPUT 2512 <1> ;mov dl, 3 ; BYTES/SECTOR PARAMETER FROM BLOCK 2513 <1> ; 06/08/2022 2514 00004A0D B003 <1> mov al, 3 2515 00004A0F E8FC010000 <1> call GET_PARM ; ... TO THE NEC 2516 00004A14 E8ED020000 <1> call NEC_OUTPUT ; OUTPUT TO CONTROLLER 2517 <1> ;mov dl, 4 ; EOT PARAMETER FROM BLOCK 2518 <1> ; 06/08/2022 2519 00004A19 B004 <1> mov al, 4 2520 00004A1B E8F0010000 <1> call GET_PARM ; ... TO THE NEC 2521 00004A20 E8E1020000 <1> call NEC_OUTPUT ; OUTPUT TO CONTROLLER 2522 00004A25 8A6305 <1> mov ah, [ebx+MD.GAP] ; GET GAP LENGTH 2523 <1> _R15: 2524 00004A28 E8D9020000 <1> call NEC_OUTPUT 2525 <1> ;mov dl, 6 ; DTL PARAMETER PROM BLOCK 2526 <1> ; 06/08/2022 2527 00004A2D B006 <1> mov al, 6 2528 00004A2F E8DC010000 <1> call GET_PARM ; ... TO THE NEC 2529 00004A34 E8CD020000 <1> call NEC_OUTPUT ; OUTPUT TO CONTROLLER 2530 00004A39 58 <1> pop eax ; THROW AWAY ERROR EXIT 2531 <1> ER_2: 2532 00004A3A C3 <1> retn 2533 <1> 2534 <1> ;------------------------------------------------------------------------------- 2535 <1> ; NEC_TERM 2536 <1> ; THIS ROUTINE WAITS FOR THE OPERATION THEN ACCEPTS THE STATUS 2537 <1> ; FROM THE NEC FOR THE READ/WRITE/VERIFY/FORWAT OPERATION. 2538 <1> ; 2539 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2540 <1> ;------------------------------------------------------------------------------- 2541 <1> NEC_TERM: 2542 <1> 2543 <1> ;----- LET THE OPERATION HAPPEN 2544 <1> 2545 00004A3B 56 <1> push esi ; SAVE HEAD #, # OF SECTORS 2546 00004A3C E8CD030000 <1> call WAIT_INT ; WAIT FOR THE INTERRUPT 2547 00004A41 9C <1> pushf 2548 00004A42 E8F6030000 <1> call RESULTS ; GET THE NEC STATUS 2549 00004A47 724B <1> jc short SET_END_POP 2550 00004A49 9D <1> popf 2551 00004A4A 723E <1> jc short SET_END ; LOOK FOR ERROR 2552 <1> 2553 <1> ;----- CHECK THE RESULTS RETURNED BY THE CONTROLLER 2554 <1> 2555 00004A4C FC <1> cld ; SET THE CORRECT DIRECTION 2556 00004A4D BE[39770100] <1> mov esi, NEC_STATUS ; POINT TO STATUS FIELD 2557 00004A52 AC <1> lodsb ; GET ST0 2558 00004A53 24C0 <1> and AL, 11000000B ; TEST FOR NORMAL TERMINATION 2559 00004A55 7433 <1> jz short SET_END 2560 00004A57 3C40 <1> cmp AL,01000000B ; TEST FOR ABNORMAL TERMINATION 2561 00004A59 7527 <1> jnz short J18 ; NOT ABNORMAL, BAD NEC 2562 <1> 2563 <1> ;----- ABNORMAL TERMINATION, FIND OUT WHY 2564 <1> 2565 00004A5B AC <1> lodsb ; GET ST1 2566 00004A5C D0E0 <1> sal al, 1 ; TEST FOR EDT FOUND 2567 00004A5E B404 <1> mov ah, RECORD_NOT_FND 2568 00004A60 7222 <1> jc short J19 2569 00004A62 C0E002 <1> sal al, 2 2570 00004A65 B410 <1> mov ah, BAD_CRC 2571 00004A67 721B <1> jc short J19 2572 00004A69 D0E0 <1> sal al, 1 ; TEST FOR DMA OVERRUN 2573 00004A6B B408 <1> mov ah, BAD_DMA 2574 00004A6D 7215 <1> jc short J19 2575 00004A6F C0E002 <1> sal al, 2 ; TEST FOR RECORD NOT FOUND 2576 00004A72 B404 <1> mov ah, RECORD_NOT_FND 2577 00004A74 720E <1> jc short J19 2578 00004A76 D0E0 <1> sal al, 1 2579 00004A78 B403 <1> mov ah, WRITE_PROTECT ; TEST FOR WRITE_PROTECT 2580 00004A7A 7208 <1> jc short J19 2581 00004A7C D0E0 <1> sal al, 1 ; TEST MISSING ADDRESS MARK 2582 00004A7E B402 <1> mov ah, BAD_ADDR_MARK 2583 00004A80 7202 <1> jc short J19 2584 <1> 2585 <1> ;----- NEC MUST HAVE FAILED 2586 <1> J18: 2587 00004A82 B420 <1> mov ah, BAD_NEC 2588 <1> J19: 2589 00004A84 0825[38770100] <1> or [DSKETTE_STATUS], ah 2590 <1> SET_END: 2591 00004A8A 803D[38770100]01 <1> cmp byte [DSKETTE_STATUS], 1 ; SET ERROR CONDITION 2592 00004A91 F5 <1> cmc 2593 00004A92 5E <1> pop esi 2594 00004A93 C3 <1> retn ; RESTORE HEAD #, # OF SECTORS 2595 <1> 2596 <1> SET_END_POP: 2597 00004A94 9D <1> popf 2598 00004A95 EBF3 <1> jmp short SET_END 2599 <1> 2600 <1> ;------------------------------------------------------------------------------- 2601 <1> ; DSTATE: ESTABLISH STATE UPON SUCCESSFUL OPERATION. 2602 <1> ;------------------------------------------------------------------------------- 2603 <1> DSTATE: 2604 00004A97 803D[38770100]00 <1> cmp byte [DSKETTE_STATUS], 0 ; CHECK FOR ERROR 2605 00004A9E 753E <1> jnz short SETBAC ; IF ERROR JUMP 2606 00004AA0 808F[43770100]10 <1> or byte [DSK_STATE+edi], MED_DET 2607 <1> ; NO ERROR, MARK MEDIA AS DETERMINED 2608 00004AA7 F687[43770100]04 <1> test byte [DSK_STATE+edi], DRV_DET ; DRIVE DETERMINED ? 2609 00004AAE 752E <1> jnz short SETBAC ; IF DETERMINED NO TRY TO DETERMINE 2610 00004AB0 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; LOAD STATE 2611 00004AB6 24C0 <1> and al, RATE_MSK ; KEEP ONLY RATE 2612 00004AB8 3C80 <1> cmp al, RATE_250 ; RATE 250 ? 2613 00004ABA 751B <1> jne short M_12 ; NO, MUST BE 1.2M OR 1.44M DRIVE 2614 <1> 2615 <1> ;----- CHECK IF IT IS 1.44M 2616 <1> 2617 00004ABC E846010000 <1> call CMOS_TYPE ; RETURN DRIVE TYPE IN (AL) 2618 <1> ;;20/02/2015 2619 <1> ;;jc short M_12 ; CMOS BAD 2620 00004AC1 7414 <1> jz short M_12 ;; 20/02/2015 2621 00004AC3 3C04 <1> cmp al, 4 ; 1.44MB DRIVE ? 2622 00004AC5 7410 <1> je short M_12 ; YES 2623 <1> M_720: 2624 00004AC7 80A7[43770100]FD <1> and byte [DSK_STATE+edi], ~FMT_CAPA ; TURN OFF FORMAT CAPABILITY 2625 00004ACE 808F[43770100]04 <1> or byte [DSK_STATE+edi], DRV_DET ; MARK DRIVE DETERMINED 2626 00004AD5 EB07 <1> jmp short SETBAC ; BACK 2627 <1> M_12: 2628 00004AD7 808F[43770100]06 <1> or byte [DSK_STATE+edi], DRV_DET+FMT_CAPA 2629 <1> ; TURN ON DETERMINED & FMT CAPA 2630 <1> SETBAC: 2631 00004ADE C3 <1> retn 2632 <1> 2633 <1> ;------------------------------------------------------------------------------- 2634 <1> ; RETRY 2635 <1> ; DETERMINES WHETHER A RETRY IS NECESSARY. 2636 <1> ; IF RETRY IS REQUIRED THEN STATE INFORMATION IS UPDATED FOR RETRY. 2637 <1> ; 2638 <1> ; ON EXIT: CY = 1 FOR RETRY, CY = 0 FOR NO RETRY 2639 <1> ;------------------------------------------------------------------------------- 2640 <1> RETRY: 2641 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2642 00004ADF 803D[38770100]00 <1> cmp byte [DSKETTE_STATUS], 0 ; GET STATUS OF OPERATION 2643 00004AE6 7445 <1> jz short NO_RETRY ; SUCCESSFUL OPERATION 2644 00004AE8 803D[38770100]80 <1> cmp byte [DSKETTE_STATUS], TIME_OUT ; IF TIME OUT NO RETRY 2645 00004AEF 743C <1> jz short NO_RETRY 2646 00004AF1 8AA7[43770100] <1> mov ah, [DSK_STATE+edi] ; GET MEDIA STATE OF DRIVE 2647 00004AF7 F6C410 <1> test ah, MED_DET ; ESTABLISHED/DETERMINED ? 2648 00004AFA 7531 <1> jnz short NO_RETRY ; IF ESTABLISHED STATE THEN TRUE ERROR 2649 00004AFC 80E4C0 <1> and ah, RATE_MSK ; ISOLATE RATE 2650 00004AFF 8A2D[40770100] <1> mov ch, [LASTRATE] ; GET START OPERATION STATE 2651 00004B05 C0C504 <1> rol ch, 4 ; TO CORRESPONDING BITS 2652 00004B08 80E5C0 <1> and ch, RATE_MSK ; ISOLATE RATE BITS 2653 00004B0B 38E5 <1> cmp ch, ah ; ALL RATES TRIED 2654 00004B0D 741E <1> je short NO_RETRY ; IF YES, THEN TRUE ERROR 2655 <1> 2656 <1> ; SETUP STATE INDICATOR FOR RETRY ATTEMPT TO NEXT RATE 2657 <1> ; 00000000B (500) -> 10000000B (250) 2658 <1> ; 10000000B (250) -> 01000000B (300) 2659 <1> ; 01000000B (300) -> 00000000B (500) 2660 <1> 2661 00004B0F 80FC01 <1> cmp ah, RATE_500+1 ; SET CY FOR RATE 500 2662 00004B12 D0DC <1> rcr ah, 1 ; TO NEXT STATE 2663 00004B14 80E4C0 <1> and ah, RATE_MSK ; KEEP ONLY RATE BITS 2664 00004B17 80A7[43770100]1F <1> and byte [DSK_STATE+edi], ~(RATE_MSK+DBL_STEP) 2665 <1> ; RATE, DBL STEP OFF 2666 00004B1E 08A7[43770100] <1> or [DSK_STATE+edi], ah ; TURN ON NEW RATE 2667 00004B24 C605[38770100]00 <1> mov byte [DSKETTE_STATUS], 0 ; RESET STATUS FOR RETRY 2668 00004B2B F9 <1> stc ; SET CARRY FOR RETRY 2669 00004B2C C3 <1> retn ; RETRY RETURN 2670 <1> 2671 <1> NO_RETRY: 2672 <1> ; 06/08/2022 2673 <1> ;clc ; CLEAR CARRY NO RETRY 2674 00004B2D C3 <1> retn ; NO RETRY RETURN 2675 <1> 2676 <1> ;------------------------------------------------------------------------------- 2677 <1> ; NUM_TRANS 2678 <1> ; THIS ROUTINE CALCULATES THE NUMBER OF SECTORS THAT WERE 2679 <1> ; ACTUALLY TRANSFERRED TO/FROM THE DISKETTE. 2680 <1> ; 2681 <1> ; ON ENTRY: [BP+1] = TRACK 2682 <1> ; SI-HI = HEAD 2683 <1> ; [BP] = START SECTOR 2684 <1> ; 2685 <1> ; ON EXIT: AL = NUMBER ACTUALLY TRANSFERRED 2686 <1> ;------------------------------------------------------------------------------- 2687 <1> NUM_TRANS: 2688 <1> ; 10/08/2022 2689 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2690 00004B2E 30C0 <1> xor al, al ; CLEAR FOR ERROR 2691 <1> ;cmp byte [DSKETTE_STATUS], 0 2692 00004B30 3805[38770100] <1> cmp [DSKETTE_STATUS], al ; 0 ; CHECK FOR ERROR 2693 00004B36 752D <1> jnz short NT_OUT ; IF ERROR 0 TRANSFERRED 2694 <1> ;mov dl, 4 ; SECTORS/TRACK OFFSET TO DL 2695 <1> ; 06/08/2022 2696 00004B38 B004 <1> mov al, 4 2697 00004B3A E8D1000000 <1> call GET_PARM ; AH = SECTORS/TRACK 2698 00004B3F 8A1D[3E770100] <1> mov bl, [NEC_STATUS+5] ; GET ENDING SECTOR 2699 <1> ;mov cx, si ; CH = HEAD # STARTED 2700 <1> ; 06/08/2022 2701 00004B45 89F1 <1> mov ecx, esi 2702 00004B47 3A2D[3D770100] <1> cmp ch, [NEC_STATUS+4] ; GET HEAD ENDED UP ON 2703 00004B4D 750E <1> jnz short DIF_HD ; IF ON SAME HEAD, THEN NO ADJUST 2704 00004B4F 8A2D[3C770100] <1> mov ch, [NEC_STATUS+3] ; GET TRACK ENDED UP ON 2705 <1> ;cmp ch, [ebp+1] ; IS IT ASKED FOR TRACK 2706 <1> ; 10/08/2022 2707 00004B55 3A6C241D <1> cmp ch, [esp+29] ; CH = TRACK # 2708 00004B59 7404 <1> jz short SAME_TRK ; IF SAME TRACK NO INCREASE 2709 00004B5B 00E3 <1> add bl, ah ; ADD SECTORS/TRACK 2710 <1> DIF_HD: 2711 00004B5D 00E3 <1> add bl, ah ; ADD SECTORS/TRACK 2712 <1> SAME_TRK: 2713 <1> ;sub bl, [ebp] ; SUBTRACT START FROM END 2714 <1> ; 10/08/2022 2715 00004B5F 2A5C241C <1> sub bl, [esp+28] ; CL = SECTOR # 2716 00004B63 88D8 <1> mov al, bl ; TO AL 2717 <1> NT_OUT: 2718 00004B65 C3 <1> retn 2719 <1> 2720 <1> ;------------------------------------------------------------------------------- 2721 <1> ; SETUP_DBL 2722 <1> ; CHECK DOUBLE STEP. 2723 <1> ; 2724 <1> ; ON ENTRY : DI = DRIVE 2725 <1> ; 2726 <1> ; ON EXIT : CY = 1 MEANS ERROR 2727 <1> ;------------------------------------------------------------------------------- 2728 <1> SETUP_DBL: 2729 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2730 00004B66 8AA7[43770100] <1> mov ah, [DSK_STATE+edi] ; ACCESS STATE 2731 00004B6C F6C410 <1> test ah, MED_DET ; ESTABLISHED STATE ? 2732 00004B6F 7578 <1> jnz short NO_DBL ; IF ESTABLISHED THEN DOUBLE DONE 2733 <1> 2734 <1> ;----- CHECK FOR TRACK 0 TO SPEED UP ACKNOWLEDGE OF UNFORMATTED DISKETTE 2735 <1> 2736 00004B71 C605[35770100]00 <1> mov byte [SEEK_STATUS], 0 ; SET RECALIBRATE REQUIRED ON ALL DRIVES 2737 00004B78 E8CE000000 <1> call MOTOR_ON ; ENSURE MOTOR STAY ON 2738 00004B7D B500 <1> mov ch, 0 ; LOAD TRACK 0 2739 00004B7F E8B9010000 <1> call SEEK ; SEEK TO TRACK 0 2740 00004B84 E861000000 <1> call READ_ID ; READ ID FUNCTION 2741 00004B89 7243 <1> jc short SD_ERR ; IF ERROR NO TRACK 0 2742 <1> 2743 <1> ;----- INITIALIZE START AND MAX TRACKS (TIMES 2 FOR BOTH HEADS) 2744 <1> 2745 00004B8B 66B95004 <1> mov cx, 0450h ; START, MAX TRACKS 2746 00004B8F F687[43770100]01 <1> test byte [DSK_STATE+edi], TRK_CAPA ; TEST FOR 80 TRACK CAPABILITY 2747 00004B96 7402 <1> jz short CNT_OK ; IF NOT COUNT IS SETUP 2748 00004B98 B1A0 <1> mov cl, 0A0h ; MAXIMUM TRACK 1.2 MB 2749 <1> 2750 <1> ; ATTEMPT READ ID OF ALL TRACKS, ALL HEADS UNTIL SUCCESS; UPON SUCCESS, 2751 <1> ; MUST SEE IF ASKED FOR TRACK IN SINGLE STEP MODE = TRACK ID READ; IF NOT 2752 <1> ; THEN SET DOUBLE STEP ON. 2753 <1> 2754 <1> CNT_OK: 2755 <1> ; 11/04/2021 (32 bit push/pop) 2756 00004B9A C605[37770100]FF <1> mov byte [MOTOR_COUNT], 0FFh ; ENSURE MOTOR STAYS ON FOR OPERATION 2757 00004BA1 51 <1> push ecx ; SAVE TRACK, COUNT 2758 00004BA2 C605[38770100]00 <1> mov byte [DSKETTE_STATUS], 0 ; CLEAR STATUS, EXPECT ERRORS 2759 <1> ;xor ax, ax ; CLEAR AX 2760 <1> ; 06/08/2022 2761 00004BA9 31C0 <1> xor eax, eax 2762 00004BAB D0ED <1> shr ch, 1 ; HALVE TRACK, CY = HEAD 2763 00004BAD C0D003 <1> rcl al, 3 ; AX = HEAD IN CORRECT BIT 2764 00004BB0 50 <1> push eax ; SAVE HEAD 2765 00004BB1 E887010000 <1> call SEEK ; SEEK TO TRACK 2766 00004BB6 58 <1> pop eax ; RESTORE HEAD 2767 <1> ;or di, ax ; DI = HEAD OR'ED DRIVE 2768 <1> ; 06/08/2022 2769 00004BB7 09C7 <1> or edi, eax 2770 00004BB9 E82C000000 <1> call READ_ID ; READ ID HEAD 0 2771 00004BBE 9C <1> pushf ; SAVE RETURN FROM READ_ID 2772 00004BBF 6681E7FB00 <1> and di, 11111011b ; TURN OFF HEAD 1 BIT 2773 00004BC4 9D <1> popf ; RESTORE ERROR RETURN 2774 00004BC5 59 <1> pop ecx ; RESTORE COUNT 2775 00004BC6 7308 <1> jnc short DO_CHK ; IF OK, ASKED = RETURNED TRACK ? 2776 00004BC8 FEC5 <1> inc ch ; INC FOR NEXT TRACK 2777 00004BCA 38CD <1> cmp ch, cl ; REACHED MAXIMUM YET 2778 00004BCC 75CC <1> jnz short CNT_OK ; CONTINUE TILL ALL TRIED 2779 <1> 2780 <1> ;----- FALL THRU, READ ID FAILED FOR ALL TRACKS 2781 <1> 2782 <1> SD_ERR: 2783 00004BCE F9 <1> stc ; SET CARRY FOR ERROR 2784 00004BCF C3 <1> retn ; SETUP_DBL ERROR EXIT 2785 <1> 2786 <1> DO_CHK: 2787 00004BD0 8A0D[3C770100] <1> mov cl, [NEC_STATUS+3] ; LOAD RETURNED TRACK 2788 00004BD6 888F[45770100] <1> mov [DSK_TRK+edi], cl ; STORE TRACK NUMBER 2789 00004BDC D0ED <1> shr ch, 1 ; HALVE TRACK 2790 00004BDE 38CD <1> cmp ch, cl ; IS IT THE SAME AS ASKED FOR TRACK 2791 00004BE0 7407 <1> jz short NO_DBL ; IF SAME THEN NO DOUBLE STEP 2792 00004BE2 808F[43770100]20 <1> or byte [DSK_STATE+edi], DBL_STEP ; TURN ON DOUBLE STEP REQUIRED 2793 <1> NO_DBL: 2794 <1> ; 06/08/2022 2795 <1> ;clc ; CLEAR ERROR FLAG 2796 00004BE9 C3 <1> retn 2797 <1> 2798 <1> ;------------------------------------------------------------------------------- 2799 <1> ; READ_ID 2800 <1> ; READ ID FUNCTION. 2801 <1> ; 2802 <1> ; ON ENTRY: DI : BIT 2 = HEAD; BITS 1,0 = DRIVE 2803 <1> ; 2804 <1> ; ON EXIT: DI : BIT 2 IS RESET, BITS 1,0 = DRIVE 2805 <1> ; @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION 2806 <1> ;------------------------------------------------------------------------------- 2807 <1> READ_ID: 2808 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2809 00004BEA B8[064C0000] <1> mov eax, ER_3 ; MOVE NEC OUTPUT ERROR ADDRESS 2810 00004BEF 50 <1> push eax 2811 00004BF0 B44A <1> mov ah, 4Ah ; READ ID COMMAND 2812 00004BF2 E80F010000 <1> call NEC_OUTPUT ; TO CONTROLLER 2813 <1> ;mov ax, di ; DRIVE # TO AH, HEAD 0 2814 <1> ; 06/08/2022 2815 00004BF7 89F8 <1> mov eax, edi 2816 00004BF9 88C4 <1> mov ah, al 2817 00004BFB E806010000 <1> call NEC_OUTPUT ; TO CONTROLLER 2818 00004C00 E836FEFFFF <1> call NEC_TERM ; WAIT FOR OPERATION, GET STATUS 2819 00004C05 58 <1> pop eax ; THROW AWAY ERROR ADDRESS 2820 <1> ER_3: 2821 00004C06 C3 <1> retn 2822 <1> 2823 <1> ;------------------------------------------------------------------------------- 2824 <1> ; CMOS_TYPE 2825 <1> ; RETURNS DISKETTE TYPE FROM CMOS 2826 <1> ; 2827 <1> ; ON ENTRY: DI = DRIVE # 2828 <1> ; 2829 <1> ; ON EXIT: AL = TYPE; CY REFLECTS STATUS 2830 <1> ;------------------------------------------------------------------------------- 2831 <1> 2832 <1> CMOS_TYPE: ; 11/12/2014 2833 00004C07 8A87[8C660000] <1> mov al, [edi+fd0_type] 2834 00004C0D 20C0 <1> and al, al ; 18/12/2014 2835 00004C0F C3 <1> retn 2836 <1> 2837 <1> ;CMOS_TYPE: 2838 <1> ; mov al, CMOS_DIAG ; CMOS DIAGNOSTIC STATUS BYTE ADDRESS 2839 <1> ; call CMOS_READ ; GET CMOS STATUS 2840 <1> ; test al, BAD_BAT+BAD_CKSUM ; BATTERY GOOD AND CHECKSUM VALID 2841 <1> ; stc ; SET CY = 1 INDICATING ERROR FOR RETURN 2842 <1> ; jnz short BAD_CM ; ERROR IF EITHER BIT ON 2843 <1> ; mov al, CMOS_DISKETTE ; ADDRESS OF DISKETTE BYTE IN CMOS 2844 <1> ; call CMOS_READ ; GET DISKETTE BYTE 2845 <1> ; or di, di ; SEE WHICH DRIVE IN QUESTION 2846 <1> ; jnz short TB ; IF DRIVE 1, DATA IN LOW NIBBLE 2847 <1> ; ror al, 4 ; EXCHANGE NIBBLES IF SECOND DRIVE 2848 <1> ;TB: 2849 <1> ; and al, 0Fh ; KEEP ONLY DRIVE DATA, RESET CY, 0 2850 <1> ;BAD_CM: 2851 <1> ; retn ; CY, STATUS OF READ 2852 <1> 2853 <1> ;------------------------------------------------------------------------------- 2854 <1> ; GET_PARM 2855 <1> ; THIS ROUTINE FETCHES THE INDEXED POINTER FROM THE DISK_BASE 2856 <1> ; BLOCK POINTED TO BY THE DATA VARIABLE @DISK_POINTER. A BYTE FROM 2857 <1> ; THAT TABLE IS THEN MOVED INTO AH, THE INDEX OF THAT BYTE BEING 2858 <1> ; THE PARAMETER IN DL. 2859 <1> ; 2860 <1> ; ON ENTRY: DL = INDEX OF BYTE TO BE FETCHED 2861 <1> ; 2862 <1> ; ON EXIT: AH = THAT BYTE FROM BLOCK 2863 <1> ; AL, DH DESTROYED 2864 <1> ;------------------------------------------------------------------------------- 2865 <1> GET_PARM: 2866 <1> ; 09/08/2022 2867 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2868 <1> ; AL = INDEX 2869 <1> ; EDI = (current) DRIVE # 2870 <1> ;;push ds 2871 <1> ;push esi 2872 <1> ;;sub ax, ax ; DS = 0, BIOS DATA AREA 2873 <1> ;;mov ds, ax 2874 <1> ;;mov ax, cs 2875 <1> ;;mov ds, ax 2876 <1> ; 08/02/2015 (protected mode modifications, bx -> ebx) 2877 <1> ;xchg edx, ebx ; BL = INDEX 2878 <1> ; 06/08/2022 2879 00004C10 53 <1> push ebx ; SAVE EBX 2880 <1> ;movzx ebx, dl ; EBX = INDEX 2881 00004C11 0FB6D8 <1> movzx ebx, al ; 06/08/2022 2882 <1> ;;sub bh, bh ; BX = INDEX 2883 <1> ;and ebx, 0FFh 2884 <1> ;;lds si, [DISK_POINTER] ; POINT TO BLOCK 2885 <1> ; 2886 <1> ; 17/12/2014 2887 <1> ;mov ax, [cfd] ; current (AL) and previous fd (AH) 2888 <1> ; 06/08/2022 2889 00004C14 89F8 <1> mov eax, edi ; EDI = DRIVE # 2890 <1> ;cmp al, ah 2891 00004C16 3A05[7D660000] <1> cmp al, [pfd] 2892 00004C1C 7423 <1> je short gpndc 2893 00004C1E A2[7D660000] <1> mov [pfd], al ; current drive -> previous drive 2894 00004C23 53 <1> push ebx ; 08/02/2015 2895 <1> ;mov bl, al 2896 <1> ;; 11/12/2014 2897 <1> ;mov al, [ebx+fd0_type] ; Drive type (0,1,2,3,4) 2898 <1> ; 09/08/2022 2899 00004C24 8A87[8C660000] <1> mov al, [edi+fd0_type] ; Drive type (0,1,2,3,4) 2900 <1> ; 18/12/2014 2901 00004C2A 20C0 <1> and al, al 2902 00004C2C 7507 <1> jnz short gpdtc 2903 00004C2E BB[67660000] <1> mov ebx, MD_TBL6 ; 1.44 MB param. tbl. (default) 2904 00004C33 EB05 <1> jmp short gpdpu 2905 <1> gpdtc: 2906 00004C35 E809FBFFFF <1> call DR_TYPE_CHECK 2907 <1> ; cf = 1 -> ebx points to 1.44MB fd parameter table (default) 2908 <1> gpdpu: 2909 00004C3A 891D[04660000] <1> mov [DISK_POINTER], ebx 2910 00004C40 5B <1> pop ebx 2911 <1> gpndc: 2912 <1> ;mov esi, [DISK_POINTER] ; 08/02/2015, si -> esi 2913 <1> ; 06/08/2022 2914 00004C41 031D[04660000] <1> add ebx, [DISK_POINTER] 2915 <1> ;mov ah, [esi+ebx] ; GET THE WORD 2916 00004C47 8A23 <1> mov ah, [ebx] 2917 <1> ;xchg edx, ebx ; RESTORE BX 2918 <1> ; 06/08/2022 2919 00004C49 5B <1> pop ebx ; RESTORE EBX 2920 <1> ;pop esi 2921 <1> ;;pop ds 2922 00004C4A C3 <1> retn 2923 <1> 2924 <1> ;------------------------------------------------------------------------------- 2925 <1> ; MOTOR_ON 2926 <1> ; TURN MOTOR ON AND WAIT FOR MOTOR START UP TIME. THE @MOTOR_COUNT 2927 <1> ; IS REPLACED WITH A SUFFICIENTLY HIGH NUMBER (0FFH) TO ENSURE 2928 <1> ; THAT THE MOTOR DOES NOT GO OFF DURING THE OPERATION. IF THE 2929 <1> ; MOTOR NEEDED TO BE TURNED ON, THE MULTI-TASKING HOOK FUNCTION 2930 <1> ; (AX=90FDH, INT 15) IS CALLED TELLING THE OPERATING SYSTEM 2931 <1> ; THAT THE BIOS IS ABOUT TO WAIT FOR MOTOR START UP. IF THIS 2932 <1> ; FUNCTION RETURNS WITH CY = 1, IT MEANS THAT THE MINIMUM WAIT 2933 <1> ; HAS BEEN COMPLETED. AT THIS POINT A CHECK IS MADE TO ENSURE 2934 <1> ; THAT THE MOTOR WASN'T TURNED OFF BY THE TIMER. IF THE HOOK DID 2935 <1> ; NOT WAIT, THE WAIT FUNCTION (AH=086H) IS CALLED TO WAIT THE 2936 <1> ; PRESCRIBED AMOUNT OF TIME. IF THE CARRY FLAG IS SET ON RETURN, 2937 <1> ; IT MEANS THAT THE FUNCTION IS IN USE AND DID NOT PERFORM THE 2938 <1> ; WAIT. A TIMER 1 WAIT LOOP WILL THEN DO THE WAIT. 2939 <1> ; 2940 <1> ; ON ENTRY: DI = DRIVE # 2941 <1> ; ON EXIT: AX,CX,DX DESTROYED 2942 <1> ;------------------------------------------------------------------------------- 2943 <1> MOTOR_ON: 2944 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 2945 00004C4B 53 <1> push ebx ; SAVE REG. 2946 00004C4C E825000000 <1> call TURN_ON ; TURN ON MOTOR 2947 00004C51 7221 <1> jc short MOT_IS_ON ; IF CY=1 NO WAIT 2948 <1> ; 06/08/2022 2949 <1> ;call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 2950 00004C53 E851FBFFFF <1> call XLAT_NEW ; TRANSLATE STATE TO PRESENT ARCH, 2951 <1> ;call TURN_ON ; CHECK AGAIN IF MOTOR ON 2952 <1> ;jc short MOT_IS_ON ; IF NO WAIT MEANS IT IS ON 2953 <1> M_WAIT: 2954 <1> ;mov dl, 10 ; GET THE MOTOR WAIT PARAMETER 2955 <1> ; 06/08/2022 2956 00004C58 B00A <1> mov al, 10 2957 00004C5A E8B1FFFFFF <1> call GET_PARM 2958 <1> ;mov al, ah ; AL = MOTOR WAIT PARAMETER 2959 <1> ;xor ah, ah ; AX = MOTOR WAIT PARAMETER 2960 <1> ;cmp al, 8 ; SEE IF AT LEAST A SECOND IS SPECIFIED 2961 00004C5F 80FC08 <1> cmp ah, 8 2962 <1> ;jae short GP2 ; IF YES, CONTINUE 2963 00004C62 7702 <1> ja short J13 2964 <1> ;mov al, 8 ; ONE SECOND WAIT FOR MOTOR START UP 2965 00004C64 B408 <1> mov ah, 8 2966 <1> 2967 <1> ;----- AS CONTAINS NUMBER OF 1/8 SECONDS (125000 MICROSECONDS) TO WAIT 2968 <1> GP2: 2969 <1> ;----- FOLLOWING LOOPS REQUIRED WHEN RTC WAIT FUNCTION IS ALREADY IN USE 2970 <1> J13: ; WAIT FOR 1/8 SECOND PER (AL) 2971 <1> ;mov ecx, 8286 ; COUNT FOR 1/8 SECOND AT 15.085737 US 2972 <1> ; 11/04/2021 2973 00004C66 B947100000 <1> mov ecx, 4167 ; count of 30 micro seconds * (1/8) 2974 00004C6B E8B5D7FFFF <1> call WAITF ; GO TO FIXED WAIT ROUTINE 2975 <1> ;dec al ; DECREMENT TIME VALUE 2976 00004C70 FECC <1> dec ah 2977 00004C72 75F2 <1> jnz short J13 ; ARE WE DONE YET 2978 <1> MOT_IS_ON: 2979 00004C74 5B <1> pop ebx ; RESTORE REG. 2980 00004C75 C3 <1> retn 2981 <1> 2982 <1> ;------------------------------------------------------------------------------- 2983 <1> ; TURN_ON 2984 <1> ; TURN MOTOR ON AND RETURN WAIT STATE. 2985 <1> ; 2986 <1> ; ON ENTRY: DI = DRIVE # 2987 <1> ; 2988 <1> ; ON EXIT: CY = 0 MEANS WAIT REQUIRED 2989 <1> ; CY = 1 MEANS NO WAIT REQUIRED 2990 <1> ; AX,BX,CX,DX DESTROYED 2991 <1> ;------------------------------------------------------------------------------- 2992 <1> TURN_ON: 2993 00004C76 89FB <1> mov ebx, edi ; BX = DRIVE # 2994 00004C78 88D9 <1> mov cl, bl ; CL = DRIVE # 2995 00004C7A C0C304 <1> rol bl, 4 ; BL = DRIVE SELECT 2996 00004C7D FA <1> cli ; NO INTERRUPTS WHILE DETERMINING STATUS 2997 00004C7E C605[37770100]FF <1> mov byte [MOTOR_COUNT], 0FFh ; ENSURE MOTOR STAYS ON FOR OPERATION 2998 00004C85 A0[36770100] <1> mov al, [MOTOR_STATUS] ; GET DIGITAL OUTPUT REGISTER REFLECTION 2999 00004C8A 2430 <1> and al, 00110000b ; KEEP ONLY DRIVE SELECT BITS 3000 00004C8C B401 <1> mov ah, 1 ; MASK FOR DETERMINING MOTOR BIT 3001 00004C8E D2E4 <1> shl ah, cl ; AH = MOTOR ON, A=00000001, B=00000010 3002 <1> 3003 <1> ; AL = DRIVE SELECT FROM @MOTOR_STATUS 3004 <1> ; BL = DRIVE SELECT DESIRED 3005 <1> ; AH = MOTOR ON MASK DESIRED 3006 <1> 3007 00004C90 38D8 <1> cmp al, bl ; REQUESTED DRIVE ALREADY SELECTED ? 3008 00004C92 7508 <1> jnz short TURN_IT_ON ; IF NOT SELECTED JUMP 3009 00004C94 8425[36770100] <1> test ah, [MOTOR_STATUS] ; TEST MOTOR ON BIT 3010 00004C9A 7535 <1> jnz short NO_MOT_WAIT ; JUMP IF MOTOR ON AND SELECTED 3011 <1> 3012 <1> TURN_IT_ON: 3013 00004C9C 08DC <1> or ah, bl ; AH = DRIVE SELECT AND MOTOR ON 3014 00004C9E 8A3D[36770100] <1> mov bh, [MOTOR_STATUS] ; SAVE COPY OF @MOTOR_STATUS BEFORE 3015 00004CA4 80E70F <1> and bh, 00001111b ; KEEP ONLY MOTOR BITS 3016 00004CA7 8025[36770100]CF <1> and byte [MOTOR_STATUS], 11001111b ; CLEAR OUT DRIVE SELECT 3017 00004CAE 0825[36770100] <1> or [MOTOR_STATUS], ah ; OR IN DRIVE SELECTED AND MOTOR ON 3018 00004CB4 A0[36770100] <1> mov al, [MOTOR_STATUS] ; GET DIGITAL OUTPUT REGISTER REFLECTION 3019 00004CB9 88C3 <1> mov bl, al ; BL=@MOTOR_STATUS AFTER, BH=BEFORE 3020 00004CBB 80E30F <1> and bl, 00001111b ; KEEP ONLY MOTOR BITS 3021 00004CBE FB <1> sti ; ENABLE INTERRUPTS AGAIN 3022 00004CBF 243F <1> and al, 00111111b ; STRIP AWAY UNWANTED BITS 3023 00004CC1 C0C004 <1> rol al, 4 ; PUT BITS IN DESIRED POSITIONS 3024 00004CC4 0C0C <1> or al, 00001100b ; NO RESET, ENABLE DMA/INTERRUPT 3025 00004CC6 66BAF203 <1> mov dx, 03F2h ; SELECT DRIVE AND TURN ON MOTOR 3026 00004CCA EE <1> out dx, al 3027 00004CCB 38FB <1> cmp bl, bh ; NEW MOTOR TURNED ON ? 3028 <1> ;jz short NO_MOT_WAIT ; NO WAIT REQUIRED IF JUST SELECT 3029 00004CCD 7403 <1> je short no_mot_w1 ; 27/02/2015 3030 00004CCF F8 <1> clc ; (re)SET CARRY MEANING WAIT 3031 00004CD0 C3 <1> retn 3032 <1> 3033 <1> NO_MOT_WAIT: 3034 00004CD1 FB <1> sti 3035 <1> no_mot_w1: ; 27/02/2015 3036 00004CD2 F9 <1> stc ; SET NO WAIT REQUIRED 3037 <1> ;sti ; INTERRUPTS BACK ON 3038 00004CD3 C3 <1> retn 3039 <1> 3040 <1> ;------------------------------------------------------------------------------- 3041 <1> ; HD_WAIT 3042 <1> ; WAIT FOR HEAD SETTLE TIME. 3043 <1> ; 3044 <1> ; ON ENTRY: DI = DRIVE # 3045 <1> ; 3046 <1> ; ON EXIT: AX,BX,CX,DX DESTROYED 3047 <1> ;------------------------------------------------------------------------------- 3048 <1> HD_WAIT: 3049 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3050 <1> ;mov dl,9 ; GET HEAD SETTLE PARAMETER 3051 <1> ; 06/08/2022 3052 00004CD4 B009 <1> mov al, 9 3053 00004CD6 E835FFFFFF <1> call GET_PARM 3054 00004CDB 08E4 <1> or ah, ah ; 17/12/2014 3055 00004CDD 7519 <1> jnz short DO_WAT 3056 00004CDF F605[36770100]80 <1> test byte [MOTOR_STATUS], 10000000b ; SEE IF A WRITE OPERATION 3057 <1> ;jz short ISNT_WRITE ; IF NOT, DO NOT ENFORCE ANY VALUES 3058 <1> ;or ah, ah ; CHECK FOR ANY WAIT? 3059 <1> ;jnz short DO_WAT ; IF THERE DO NOT ENFORCE 3060 00004CE6 741D <1> jz short HW_DONE 3061 00004CE8 B40F <1> mov ah, HD12_SETTLE ; LOAD 1.2M HEAD SETTLE MINIMUM 3062 00004CEA 8A87[43770100] <1> mov al, [DSK_STATE+edi] ; LOAD STATE 3063 00004CF0 24C0 <1> and al, RATE_MSK ; KEEP ONLY RATE 3064 00004CF2 3C80 <1> cmp al, RATE_250 ; 1.2 M DRIVE ? 3065 00004CF4 7502 <1> jnz short DO_WAT ; DEFAULT HEAD SETTLE LOADED 3066 <1> ;GP3: 3067 00004CF6 B414 <1> mov ah, HD320_SETTLE ; USE 320/360 HEAD SETTLE 3068 <1> ; jmp short DO_WAT 3069 <1> 3070 <1> ;ISNT_WRITE: 3071 <1> ; or ah, ah ; CHECK FOR NO WAIT 3072 <1> ; jz short HW_DONE ; IF NOT WRITE AND 0 ITS OK 3073 <1> 3074 <1> ;----- AH CONTAINS NUMBER OF MILLISECONDS TO WAIT 3075 <1> DO_WAT: 3076 <1> ; mov al, ah ; AL = # MILLISECONDS 3077 <1> ; ;xor ah, ah ; AX = # MILLISECONDS 3078 <1> J29: ; 1 MILLISECOND LOOP 3079 <1> ;;mov cx, WAIT_FDU_HEAD_SETTLE ; 33 ; 1 ms in 30 micro units. 3080 <1> ;mov ecx, 66 ; COUNT AT 15.085737 US PER COUNT 3081 <1> ; 11/04/2021 3082 <1> ;mov ecx, WAIT_FDU_HEAD_SETTLE ; 33 3083 <1> ; 06/08/2022 3084 00004CF8 29C9 <1> sub ecx, ecx 3085 00004CFA B121 <1> mov cl, WAIT_FDU_HEAD_SETTLE ; 33 3086 00004CFC E824D7FFFF <1> call WAITF ; DELAY FOR 1 MILLISECOND 3087 <1> ;dec al ; DECREMENT THE COUNT 3088 00004D01 FECC <1> dec ah 3089 00004D03 75F3 <1> jnz short J29 ; DO AL MILLISECOND # OF TIMES 3090 <1> HW_DONE: 3091 00004D05 C3 <1> retn 3092 <1> 3093 <1> ;------------------------------------------------------------------------------- 3094 <1> ; NEC_OUTPUT 3095 <1> ; THIS ROUTINE SENDS A BYTE TO THE NEC CONTROLLER AFTER TESTING 3096 <1> ; FOR CORRECT DIRECTION AND CONTROLLER READY THIS ROUTINE WILL 3097 <1> ; TIME OUT IF THE BYTE IS NOT ACCEPTED WITHIN A REASONABLE AMOUNT 3098 <1> ; OF TIME, SETTING THE DISKETTE STATUS ON COMPLETION. 3099 <1> ; 3100 <1> ; ON ENTRY: AH = BYTE TO BE OUTPUT 3101 <1> ; 3102 <1> ; ON EXIT: CY = 0 SUCCESS 3103 <1> ; CY = 1 FAILURE -- DISKETTE STATUS UPDATED 3104 <1> ; IF A FAILURE HAS OCCURRED, THE RETURN IS MADE ONE LEVEL 3105 <1> ; HIGHER THAN THE CALLER OF NEC OUTPUT. THIS REMOVES THE 3106 <1> ; REQUIREMENT OF TESTING AFTER EVERY CALL OF NEC_OUTPUT. 3107 <1> ; AX,CX,DX DESTROYED 3108 <1> ;------------------------------------------------------------------------------- 3109 <1> 3110 <1> ; 09/12/2014 [Erdogan Tan] 3111 <1> ; (from 'PS2 Hardware Interface Tech. Ref. May 88', Page 09-05.) 3112 <1> ; Diskette Drive Controller Status Register (3F4h) 3113 <1> ; This read only register facilitates the transfer of data between 3114 <1> ; the system microprocessor and the controller. 3115 <1> ; Bit 7 - When set to 1, the Data register is ready to transfer data 3116 <1> ; with the system micrprocessor. 3117 <1> ; Bit 6 - The direction of data transfer. If this bit is set to 0, 3118 <1> ; the transfer is to the controller. 3119 <1> ; Bit 5 - When this bit is set to 1, the controller is in the non-DMA mode. 3120 <1> ; Bit 4 - When this bit is set to 1, a Read or Write command is being executed. 3121 <1> ; Bit 3 - Reserved. 3122 <1> ; Bit 2 - Reserved. 3123 <1> ; Bit 1 - When this bit is set to 1, dskette drive 1 is in the seek mode. 3124 <1> ; Bit 0 - When this bit is set to 1, dskette drive 1 is in the seek mode. 3125 <1> 3126 <1> ; Data Register (3F5h) 3127 <1> ; This read/write register passes data, commands and parameters, and provides 3128 <1> ; diskette status information. 3129 <1> 3130 <1> NEC_OUTPUT: 3131 <1> ; 09/08/2022 3132 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 3133 <1> ; 3134 <1> ;push bx ; SAVE REG. 3135 00004D06 66BAF403 <1> mov dx, 03F4h ; STATUS PORT 3136 <1> ;mov bl,2 ; HIGH ORDER COUNTER 3137 <1> ;xor cx, cx ; COUNT FOR TIME OUT 3138 <1> ; 16/12/2014 3139 <1> ; waiting for (max.) 0.5 seconds 3140 <1> ;;mov byte [wait_count], 0 ;; 27/02/2015 3141 <1> ; 3142 <1> ; 17/12/2014 3143 <1> ; Modified from AWARD BIOS 1999 - ADISK.ASM - SEND_COMMAND 3144 <1> ; 3145 <1> ;WAIT_FOR_PORT: Waits for a bit at a port pointed to by DX to 3146 <1> ; go on. 3147 <1> ;INPUT: 3148 <1> ; AH=Mask for isolation bits. 3149 <1> ; AL=pattern to look for. 3150 <1> ; DX=Port to test for 3151 <1> ; BH:CX=Number of memory refresh periods to delay. 3152 <1> ; (normally 30 microseconds per period.) 3153 <1> ; 3154 <1> ;WFP_SHORT: 3155 <1> ; Wait for port if refresh cycle is short (15-80 Us range). 3156 <1> ; 3157 <1> 3158 <1> ; mov bl, WAIT_FDU_SEND_HI+1 ; 0+1 3159 <1> ; mov cx, WAIT_FDU_SEND_LO ; 16667 3160 00004D0A B91B410000 <1> mov ecx, WAIT_FDU_SEND_LH ; 16667 (27/02/2015) 3161 <1> ; 3162 <1> ;WFPS_OUTER_LP: 3163 <1> ; ; 3164 <1> ;WFPS_CHECK_PORT: 3165 <1> J23: 3166 00004D0F EC <1> in al, dx ; GET STATUS 3167 00004D10 24C0 <1> and al, 11000000b ; KEEP STATUS AND DIRECTION 3168 00004D12 3C80 <1> cmp al, 10000000b ; STATUS 1 AND DIRECTION 0 ? 3169 00004D14 7418 <1> jz short J27 ; STATUS AND DIRECTION OK 3170 <1> WFPS_HI: 3171 00004D16 E461 <1> in al, PORT_B ; 061h ; SYS1 ; wait for hi to lo 3172 00004D18 A810 <1> test al, 010h ; transition on memory 3173 00004D1A 75FA <1> jnz short WFPS_HI ; refresh. 3174 <1> WFPS_LO: 3175 00004D1C E461 <1> in al, PORT_B ; SYS1 3176 00004D1E A810 <1> test al, 010h 3177 00004D20 74FA <1> jz short WFPS_LO 3178 <1> ;loop short WFPS_CHECK_PORT 3179 00004D22 E2EB <1> loop J23 ; 27/02/2015 3180 <1> ; ; 3181 <1> ; dec bl 3182 <1> ; jnz short WFPS_OUTER_LP 3183 <1> ; jmp short WFPS_TIMEOUT ; fail 3184 <1> ;J23: 3185 <1> ; in al, dx ; GET STATUS 3186 <1> ; and al, 11000000b ; KEEP STATUS AND DIRECTION 3187 <1> ; cmp al, 10000000b ; STATUS 1 AND DIRECTION 0 ? 3188 <1> ; jz short J27 ; STATUS AND DIRECTION OK 3189 <1> ;loop J23 ; CONTINUE TILL CX EXHAUSTED 3190 <1> ;dec bl ; DECREMENT COUNTER 3191 <1> ;jnz short J23 ; REPEAT TILL DELAY FINISHED, CX = 0 3192 <1> 3193 <1> ;;27/02/2015 3194 <1> ;16/12/2014 3195 <1> ;;cmp byte [wait_count], 10 ; (10/18.2 seconds) 3196 <1> ;;jb short J23 3197 <1> 3198 <1> ;WFPS_TIMEOUT: 3199 <1> 3200 <1> ;----- FALL THRU TO ERROR RETURN 3201 <1> 3202 00004D24 800D[38770100]80 <1> or byte [DSKETTE_STATUS], TIME_OUT 3203 <1> ;pop bx ; RESTORE REG. 3204 00004D2B 58 <1> pop eax ; 08/02/2015 ; DISCARD THE RETURN ADDRESS 3205 00004D2C F9 <1> stc ; INDICATE ERROR TO CALLER 3206 00004D2D C3 <1> retn 3207 <1> 3208 <1> ;----- DIRECTION AND STATUS OK; OUTPUT BYTE 3209 <1> 3210 <1> J27: 3211 00004D2E 88E0 <1> mov al, ah ; GET BYTE TO OUTPUT 3212 <1> ;inc dx ; DATA PORT = STATUS PORT + 1 3213 <1> ; 06/08/2022 3214 00004D30 FEC2 <1> inc dl 3215 00004D32 EE <1> out dx, al ; OUTPUT THE BYTE 3216 <1> ;;NEWIODELAY ;; 27/02/2015 3217 <1> ; 27/02/2015 3218 <1> ;pushf ; SAVE FLAGS 3219 <1> ; 09/08/2022 3220 <1> ; cf = 0, zf = 1 3221 <1> ;mov ecx, 3 ; 30 TO 45 MICROSECONDS WAIT FOR 3222 <1> ; 11/04/2021 3223 <1> ;mov ecx, 2 3224 <1> ; 06/08/2022 3225 00004D33 29C9 <1> sub ecx, ecx 3226 00004D35 B102 <1> mov cl, 2 3227 00004D37 E8E9D6FFFF <1> call WAITF ; NEC FLAGS UPDATE CYCLE 3228 <1> ; 09/08/2022 3229 <1> ; cf = 0, zf = 1 3230 <1> ;popf ; RESTORE FLAGS FOR EXIT 3231 <1> ;pop bx ; RESTORE REG 3232 00004D3C C3 <1> retn ; CY = 0 FROM TEST INSTRUCTION 3233 <1> 3234 <1> ;------------------------------------------------------------------------------- 3235 <1> ; SEEK 3236 <1> ; THIS ROUTINE WILL MOVE THE HEAD ON THE NAMED DRIVE TO THE NAMED 3237 <1> ; TRACK. IF THE DRIVE HAS NOT BEEN ACCESSED SINCE THE DRIVE 3238 <1> ; RESET COMMAND WAS ISSUED, THE DRIVE WILL BE RECALIBRATED. 3239 <1> ; 3240 <1> ; ON ENTRY: DI = DRIVE # 3241 <1> ; CH = TRACK # 3242 <1> ; 3243 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION. 3244 <1> ; AX,BX,CX DX DESTROYED 3245 <1> ;------------------------------------------------------------------------------- 3246 <1> SEEK: 3247 00004D3D 89FB <1> mov ebx, edi ; BX = DRIVE # 3248 00004D3F B001 <1> mov al, 1 ; ESTABLISH MASK FOR RECALIBRATE TEST 3249 <1> ; 06/08/2022 3250 <1> ;xchg cl, bl ; SET DRIVE VALUE INTO CL 3251 <1> ;rol al, cl ; SHIFT MASK BY THE DRIVE VALUE 3252 <1> ;xchg cl, bl ; RECOVER TRACK VALUE 3253 <1> ; 06/08/2022 3254 00004D41 84C3 <1> test bl, al ; test bl, 1 3255 00004D43 7402 <1> jz short seek_0 3256 00004D45 FEC0 <1> inc al ; shl al, 1 3257 <1> seek_0: 3258 00004D47 8405[35770100] <1> test al, [SEEK_STATUS] ; TEST FOR RECALIBRATE REQUIRED 3259 00004D4D 7526 <1> jnz short J28A ; JUMP IF RECALIBRATE NOT REQUIRED 3260 <1> 3261 00004D4F 0805[35770100] <1> or [SEEK_STATUS], al ; TURN ON THE NO RECALIBRATE BIT IN FLAG 3262 00004D55 E862000000 <1> call RECAL ; RECALIBRATE DRIVE 3263 00004D5A 730E <1> jnc short AFT_RECAL ; RECALIBRATE DONE 3264 <1> 3265 <1> ;----- ISSUE RECALIBRATE FOR 80 TRACK DISKETTES 3266 <1> 3267 00004D5C C605[38770100]00 <1> mov byte [DSKETTE_STATUS], 0 ; CLEAR OUT INVALID STATUS 3268 00004D63 E854000000 <1> call RECAL ; RECALIBRATE DRIVE 3269 00004D68 7251 <1> jc short RB ; IF RECALIBRATE FAILS TWICE THEN ERROR 3270 <1> 3271 <1> AFT_RECAL: 3272 00004D6A C687[45770100]00 <1> mov byte [DSK_TRK+edi], 0 ; SAVE NEW CYLINDER AS PRESENT POSITION 3273 00004D71 08ED <1> or ch, ch ; CHECK FOR SEEK TO TRACK 0 3274 00004D73 743F <1> jz short DO_WAIT ; HEAD SETTLE, CY = 0 IF JUMP 3275 <1> 3276 <1> ;----- DRIVE IS IN SYNCHRONIZATION WITH CONTROLLER, SEEK TO TRACK 3277 <1> 3278 00004D75 F687[43770100]20 <1> J28A: test byte [DSK_STATE+edi], DBL_STEP ; CHECK FOR DOUBLE STEP REQUIRED 3279 00004D7C 7402 <1> jz short _R7 ; SINGLE STEP REQUIRED BYPASS DOUBLE 3280 00004D7E D0E5 <1> shl ch, 1 ; DOUBLE NUMBER OF STEP TO TAKE 3281 <1> 3282 00004D80 3AAF[45770100] <1> _R7: cmp ch, [DSK_TRK+edi] ; SEE IF ALREADY AT THE DESIRED TRACK 3283 00004D86 7433 <1> je short RB ; IF YES, DO NOT NEED TO SEEK 3284 <1> 3285 00004D88 BA[BB4D0000] <1> mov edx, NEC_ERR ; LOAD RETURN ADDRESS 3286 00004D8D 52 <1> push edx ; (*) ; ON STACK FOR NEC OUTPUT ERROR 3287 00004D8E 88AF[45770100] <1> mov [DSK_TRK+edi], ch ; SAVE NEW CYLINDER AS PRESENT POSITION 3288 00004D94 B40F <1> mov ah, 0Fh ; SEEK COMMAND TO NEC 3289 00004D96 E86BFFFFFF <1> call NEC_OUTPUT 3290 00004D9B 89FB <1> mov ebx, edi ; BX = DRIVE # 3291 00004D9D 88DC <1> mov ah, bl ; OUTPUT DRIVE NUMBER 3292 00004D9F E862FFFFFF <1> call NEC_OUTPUT 3293 00004DA4 8AA7[45770100] <1> mov ah, [DSK_TRK+edi] ; GET CYLINDER NUMBER 3294 00004DAA E857FFFFFF <1> call NEC_OUTPUT 3295 00004DAF E827000000 <1> call CHK_STAT_2 ; ENDING INTERRUPT AND SENSE STATUS 3296 <1> 3297 <1> ;----- WAIT FOR HEAD SETTLE 3298 <1> 3299 <1> DO_WAIT: 3300 00004DB4 9C <1> pushf ; SAVE STATUS 3301 00004DB5 E81AFFFFFF <1> call HD_WAIT ; WAIT FOR HEAD SETTLE TIME 3302 00004DBA 9D <1> popf ; RESTORE STATUS 3303 <1> RB: 3304 <1> NEC_ERR: 3305 <1> ; 08/02/2015 (code trick here from original IBM PC/AT DISKETTE.ASM) 3306 <1> ; (*) nec_err -> retn (push edx -> pop edx) -> nec_err -> retn 3307 00004DBB C3 <1> retn ; RETURN TO CALLER 3308 <1> 3309 <1> ;------------------------------------------------------------------------------- 3310 <1> ; RECAL 3311 <1> ; RECALIBRATE DRIVE 3312 <1> ; 3313 <1> ; ON ENTRY: DI = DRIVE # 3314 <1> ; 3315 <1> ; ON EXIT: CY REFLECTS STATUS OF OPERATION. 3316 <1> ;------------------------------------------------------------------------------- 3317 <1> RECAL: 3318 <1> ;push cx 3319 <1> ; 11/04/2021 3320 00004DBC 51 <1> push ecx 3321 00004DBD B8[D94D0000] <1> mov eax, RC_BACK ; LOAD NEC_OUTPUT ERROR 3322 00004DC2 50 <1> push eax 3323 00004DC3 B407 <1> mov ah, 07h ; RECALIBRATE COMMAND 3324 00004DC5 E83CFFFFFF <1> call NEC_OUTPUT 3325 00004DCA 89FB <1> mov ebx, edi ; BX = DRIVE # 3326 00004DCC 88DC <1> mov ah, bl 3327 00004DCE E833FFFFFF <1> call NEC_OUTPUT ; OUTPUT THE DRIVE NUMBER 3328 00004DD3 E803000000 <1> call CHK_STAT_2 ; GET THE INTERRUPT AND SENSE INT STATUS 3329 00004DD8 58 <1> pop eax ; THROW AWAY ERROR 3330 <1> RC_BACK: 3331 <1> ;pop cx 3332 <1> ; 11/04/2021 3333 00004DD9 59 <1> pop ecx 3334 00004DDA C3 <1> retn 3335 <1> 3336 <1> ;------------------------------------------------------------------------------- 3337 <1> ; CHK_STAT_2 3338 <1> ; THIS ROUTINE HANDLES THE INTERRUPT RECEIVED AFTER RECALIBRATE, 3339 <1> ; OR SEEK TO THE ADAPTER. THE INTERRUPT IS WAITED FOR, THE 3340 <1> ; INTERRUPT STATUS SENSED, AND THE RESULT RETURNED TO THE CALLER. 3341 <1> ; 3342 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION. 3343 <1> ;------------------------------------------------------------------------------- 3344 <1> CHK_STAT_2: 3345 00004DDB B8[034E0000] <1> mov eax, CS_BACK ; LOAD NEC_OUTPUT ERROR ADDRESS 3346 00004DE0 50 <1> push eax 3347 00004DE1 E828000000 <1> call WAIT_INT ; WAIT FOR THE INTERRUPT 3348 00004DE6 721A <1> jc short J34 ; IF ERROR, RETURN IT 3349 00004DE8 B408 <1> mov ah, 08h ; SENSE INTERRUPT STATUS COMMAND 3350 00004DEA E817FFFFFF <1> call NEC_OUTPUT 3351 00004DEF E849000000 <1> call RESULTS ; READ IN THE RESULTS 3352 00004DF4 720C <1> jc short J34 3353 00004DF6 A0[39770100] <1> mov al, [NEC_STATUS] ; GET THE FIRST STATUS BYTE 3354 00004DFB 2460 <1> and al, 01100000B ; ISOLATE THE BITS 3355 00004DFD 3C60 <1> cmp al, 01100000B ; TEST FOR CORRECT VALUE 3356 00004DFF 7403 <1> jz short J35 ; IF ERROR, GO MARK IT 3357 00004E01 F8 <1> clc ; GOOD RETURN 3358 <1> J34: 3359 00004E02 58 <1> pop eax ; THROW AWAY ERROR RETURN 3360 <1> CS_BACK: 3361 00004E03 C3 <1> retn 3362 <1> J35: 3363 00004E04 800D[38770100]40 <1> or byte [DSKETTE_STATUS], BAD_SEEK 3364 00004E0B F9 <1> stc ; ERROR RETURN CODE 3365 00004E0C EBF4 <1> jmp short J34 3366 <1> 3367 <1> ;------------------------------------------------------------------------------- 3368 <1> ; WAIT_INT 3369 <1> ; THIS ROUTINE WAITS FOR AN INTERRUPT TO OCCUR A TIME OUT ROUTINE 3370 <1> ; TAKES PLACE DURING THE WAIT, SO THAT AN ERROR MAY BE RETURNED 3371 <1> ; IF THE DRIVE IS NOT READY. 3372 <1> ; 3373 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION. 3374 <1> ;------------------------------------------------------------------------------- 3375 <1> 3376 <1> ; 17/12/2014 3377 <1> ; 2.5 seconds waiting ! 3378 <1> ;(AWARD BIOS - 1999, WAIT_FDU_INT_LOW, WAIT_FDU_INT_HI) 3379 <1> ; amount of time to wait for completion interrupt from NEC. 3380 <1> 3381 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3382 <1> WAIT_INT: 3383 00004E0E FB <1> sti ; TURN ON INTERRUPTS, JUST IN CASE 3384 <1> ; 06/08/2022 3385 <1> ;clc ; CLEAR TIMEOUT INDICATOR 3386 <1> ; 3387 <1> ;mov bl, 10 ; CLEAR THE COUNTERS 3388 <1> ;xor cx, cx ; FOR 2 SECOND WAIT 3389 <1> 3390 <1> ; Modification from AWARD BIOS - 1999 (ATORGS.ASM, WAIT 3391 <1> ; 3392 <1> ;WAIT_FOR_MEM: 3393 <1> ; Waits for a bit at a specified memory location pointed 3394 <1> ; to by ES:[DI] to become set. 3395 <1> ;INPUT: 3396 <1> ; AH= Mask to test with. 3397 <1> ; ES:[DI] = memory location to watch. 3398 <1> ; BH:CX= Number of memory refresh periods to delay. 3399 <1> ; (normally 30 microseconds per period.) 3400 <1> 3401 <1> ; waiting for (max.) 2.5 secs in 30 micro units. 3402 <1> ; mov cx, WAIT_FDU_INT_LO ; 017798 3403 <1> ;; mov bl, WAIT_FDU_INT_HI 3404 <1> ; mov bl, WAIT_FDU_INT_HI + 1 3405 <1> ; 27/02/2015 3406 00004E0F B986450100 <1> mov ecx, WAIT_FDU_INT_LH ; 83334 (2.5 seconds) 3407 <1> WFMS_CHECK_MEM: 3408 00004E14 F605[35770100]80 <1> test byte [SEEK_STATUS], INT_FLAG 3409 <1> ; TEST FOR INTERRUPT OCCURRING 3410 00004E1B 7516 <1> jnz short J37 3411 <1> WFMS_HI: 3412 00004E1D E461 <1> in al, PORT_B ; 061h ; SYS1, wait for lo to hi 3413 00004E1F A810 <1> test al, 010h ; transition on memory 3414 00004E21 75FA <1> jnz short WFMS_HI ; refresh. 3415 <1> WFMS_LO: 3416 00004E23 E461 <1> in al, PORT_B ; SYS1 3417 00004E25 A810 <1> test al, 010h 3418 00004E27 74FA <1> jz short WFMS_LO 3419 00004E29 E2E9 <1> loop WFMS_CHECK_MEM 3420 <1> 3421 <1> ;WFMS_OUTER_LP: 3422 <1> ;; or bl, bl ; check outer counter 3423 <1> ;; jz short J36A ; WFMS_TIMEOUT 3424 <1> ; dec bl 3425 <1> ; jz short J36A 3426 <1> ; jmp short WFMS_CHECK_MEM 3427 <1> 3428 <1> ; 17/12/2014 3429 <1> ; 16/12/2014 3430 <1> ; mov byte [wait_count], 0 ; Reset (INT 08H) counter 3431 <1> ;J36: 3432 <1> ; test byte [SEEK_STATUS], INT_FLAG 3433 <1> ; ; TEST FOR INTERRUPT OCCURRING 3434 <1> ; jnz short J37 3435 <1> 3436 <1> ; 16/12/2014 3437 <1> ;loop J36 ; COUNT DOWN WHILE WAITING 3438 <1> ;dec bl ; SECOND LEVEL COUNTER 3439 <1> ;jnz short J36 3440 <1> ; cmp byte [wait_count], 46 ; (46/18.2 seconds) 3441 <1> ; jb short J36 3442 <1> 3443 <1> ;WFMS_TIMEOUT: 3444 <1> ;J36A: 3445 00004E2B 800D[38770100]80 <1> or byte [DSKETTE_STATUS], TIME_OUT ; NOTHING HAPPENED 3446 00004E32 F9 <1> stc ; ERROR RETURN 3447 <1> J37: 3448 00004E33 9C <1> pushf ; SAVE CURRENT CARRY 3449 00004E34 8025[35770100]7F <1> and byte [SEEK_STATUS], ~INT_FLAG ; TURN OFF INTERRUPT FLAG 3450 00004E3B 9D <1> popf ; RECOVER CARRY 3451 00004E3C C3 <1> retn ; GOOD RETURN CODE 3452 <1> 3453 <1> ;------------------------------------------------------------------------------- 3454 <1> ; RESULTS 3455 <1> ; THIS ROUTINE WILL READ ANYTHING THAT THE NEC CONTROLLER RETURNS 3456 <1> ; FOLLOWING AN INTERRUPT. 3457 <1> ; 3458 <1> ; ON EXIT: @DSKETTE_STATUS, CY REFLECT STATUS OF OPERATION. 3459 <1> ; AX,BX,CX,DX DESTROYED 3460 <1> ;------------------------------------------------------------------------------- 3461 <1> RESULTS: 3462 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3463 00004E3D 57 <1> push edi 3464 00004E3E BF[39770100] <1> mov edi, NEC_STATUS ; POINTER TO DATA AREA 3465 00004E43 B307 <1> mov bl, 7 ; MAX STATUS BYTES 3466 00004E45 66BAF403 <1> mov dx, 03F4h ; STATUS PORT 3467 <1> 3468 <1> ;----- WAIT FOR REQUEST FOR MASTER 3469 <1> 3470 <1> _R10: 3471 <1> ; 16/12/2014 3472 <1> ; wait for (max) 0.5 seconds 3473 <1> ;mov bh, 2 ; HIGH ORDER COUNTER 3474 <1> ;xor cx, cx ; COUNTER 3475 <1> 3476 <1> ;Time to wait while waiting for each byte of NEC results = .5 3477 <1> ;seconds. .5 seconds = 500,000 micros. 500,000/30 = 16,667. 3478 <1> ; 27/02/2015 3479 00004E49 B91B410000 <1> mov ecx, WAIT_FDU_RESULTS_LH ; 16667 3480 <1> ;mov cx, WAIT_FDU_RESULTS_LO ; 16667 3481 <1> ;mov bh, WAIT_FDU_RESULTS_HI+1 ; 0+1 3482 <1> 3483 <1> WFPSR_OUTER_LP: 3484 <1> ; 3485 <1> WFPSR_CHECK_PORT: 3486 <1> J39: ; WAIT FOR MASTER 3487 00004E4E EC <1> in al, dx ; GET STATUS 3488 00004E4F 24C0 <1> and al, 11000000b ; KEEP ONLY STATUS AND DIRECTION 3489 00004E51 3CC0 <1> cmp al, 11000000b ; STATUS 1 AND DIRECTION 1 ? 3490 00004E53 7418 <1> jz short J42 ; STATUS AND DIRECTION OK 3491 <1> WFPSR_HI: 3492 00004E55 E461 <1> in al, PORT_B ; 061h ; SYS1 ; wait for hi to lo 3493 00004E57 A810 <1> test al, 010h ; transition on memory 3494 00004E59 75FA <1> jnz short WFPSR_HI ; refresh. 3495 <1> WFPSR_LO: 3496 00004E5B E461 <1> in al, PORT_B ; SYS1 3497 00004E5D A810 <1> test al, 010h 3498 00004E5F 74FA <1> jz SHORT WFPSR_LO 3499 00004E61 E2EB <1> loop WFPSR_CHECK_PORT 3500 <1> 3501 <1> ;; 27/02/2015 3502 <1> ;;dec bh 3503 <1> ;;jnz short WFPSR_OUTER_LP 3504 <1> ;jmp short WFPSR_TIMEOUT ; fail 3505 <1> 3506 <1> ;;mov byte [wait_count], 0 3507 <1> ;J39: ; WAIT FOR MASTER 3508 <1> ; in al, dx ; GET STATUS 3509 <1> ; and al, 11000000b ; KEEP ONLY STATUS AND DIRECTION 3510 <1> ; cmp al, 11000000b ; STATUS 1 AND DIRECTION 1 ? 3511 <1> ; jz short J42 ; STATUS AND DIRECTION OK 3512 <1> ;loop J39 ; LOOP TILL TIMEOUT 3513 <1> ;dec bh ; DECREMENT HIGH ORDER COUNTER 3514 <1> ;jnz short J39 ; REPEAT TILL DELAY DONE 3515 <1> ; 3516 <1> ;;cmp byte [wait_count], 10 ; (10/18.2 seconds) 3517 <1> ;;jb short J39 3518 <1> 3519 <1> ;WFPSR_TIMEOUT: 3520 00004E63 800D[38770100]80 <1> or byte [DSKETTE_STATUS], TIME_OUT 3521 00004E6A F9 <1> stc ; SET ERROR RETURN 3522 00004E6B EB28 <1> jmp short POPRES ; POP REGISTERS AND RETURN 3523 <1> 3524 <1> ;----- READ IN THE STATUS 3525 <1> 3526 <1> J42: 3527 00004E6D EB00 <1> jmp $+2 ; I/O DELAY 3528 <1> ;inc dx ; POINT AT DATA PORT 3529 <1> ; 06/08/2022 3530 00004E6F FEC2 <1> inc dl 3531 00004E71 EC <1> in al, dx ; GET THE DATA 3532 <1> ; 16/12/2014 3533 <1> NEWIODELAY 83 00004E72 E6EB <2> out 0EBh, al 3534 00004E74 8807 <1> mov [edi], al ; STORE THE BYTE 3535 00004E76 47 <1> inc edi ; INCREMENT THE POINTER 3536 <1> 3537 <1> ; 16/12/2014 3538 <1> ; push cx 3539 <1> ; mov cx, 30 3540 <1> ;wdw2: 3541 <1> ; NEWIODELAY 3542 <1> ; loop wdw2 3543 <1> ; pop cx 3544 <1> 3545 <1> ;;mov ecx, 3 ; MINIMUM 24 MICROSECONDS FOR NEC 3546 <1> ; 11/04/2021 3547 <1> ;mov ecx, 2 3548 <1> ; 06/08/2022 3549 00004E77 29C9 <1> sub ecx, ecx 3550 00004E79 B102 <1> mov cl, 2 3551 00004E7B E8A5D5FFFF <1> call WAITF ; WAIT 30 TO 45 MICROSECONDS 3552 <1> ;dec dx ; POINT AT STATUS PORT 3553 <1> ; 06/08/2022 3554 00004E80 FECA <1> dec dl 3555 00004E82 EC <1> in al, dx ; GET STATUS 3556 <1> ; 16/12/2014 3557 <1> NEWIODELAY 83 00004E83 E6EB <2> out 0EBh, al 3558 <1> ; 3559 00004E85 A810 <1> test al, 00010000b ; TEST FOR NEC STILL BUSY 3560 00004E87 740C <1> jz short POPRES ; RESULTS DONE ? 3561 <1> 3562 00004E89 FECB <1> dec bl ; DECREMENT THE STATUS COUNTER 3563 00004E8B 75BC <1> jnz short _R10 ; GO BACK FOR MORE 3564 00004E8D 800D[38770100]20 <1> or byte [DSKETTE_STATUS], BAD_NEC ; TOO MANY STATUS BYTES 3565 00004E94 F9 <1> stc ; SET ERROR FLAG 3566 <1> 3567 <1> ;----- RESULT OPERATION IS DONE 3568 <1> POPRES: 3569 00004E95 5F <1> pop edi 3570 00004E96 C3 <1> retn ; RETURN WITH CARRY SET 3571 <1> 3572 <1> ;------------------------------------------------------------------------------- 3573 <1> ; READ_DSKCHNG 3574 <1> ; READS THE STATE OF THE DISK CHANGE LINE. 3575 <1> ; 3576 <1> ; ON ENTRY: DI = DRIVE # 3577 <1> ; 3578 <1> ; ON EXIT: DI = DRIVE # 3579 <1> ; ZF = 0 : DISK CHANGE LINE INACTIVE 3580 <1> ; ZF = 1 : DISK CHANGE LINE ACTIVE 3581 <1> ; AX,CX,DX DESTROYED 3582 <1> ;------------------------------------------------------------------------------- 3583 <1> READ_DSKCHNG: 3584 00004E97 E8AFFDFFFF <1> call MOTOR_ON ; TURN ON THE MOTOR IF OFF 3585 00004E9C 66BAF703 <1> mov dx, 03F7h ; ADDRESS DIGITAL INPUT REGISTER 3586 00004EA0 EC <1> in al, dx ; INPUT DIGITAL INPUT REGISTER 3587 00004EA1 A880 <1> test al, DSK_CHG ; CHECK FOR DISK CHANGE LINE ACTIVE 3588 00004EA3 C3 <1> retn ; RETURN TO CALLER WITH ZERO FLAG SET 3589 <1> 3590 <1> fdc_int: 3591 <1> ; 30/07/2015 3592 <1> ; 16/02/2015 3593 <1> ;int_0Eh: ; 11/12/2014 3594 <1> 3595 <1> ;--- HARDWARE INT 0EH -- ( IRQ LEVEL 6 ) --------------------------------------- 3596 <1> ; DISK_INT 3597 <1> ; THIS ROUTINE HANDLES THE DISKETTE INTERRUPT. 3598 <1> ; 3599 <1> ; ON EXIT: THE INTERRUPT FLAG IS SET IN @SEEK_STATUS. 3600 <1> ;------------------------------------------------------------------------------- 3601 <1> DISK_INT_1: 3602 <1> ;push AX ; SAVE WORK REGISTER 3603 <1> ; 11/04/2021 3604 00004EA4 50 <1> push eax 3605 00004EA5 1E <1> push ds 3606 00004EA6 66B81000 <1> mov ax, KDATA 3607 00004EAA 8ED8 <1> mov ds, ax 3608 00004EAC 800D[35770100]80 <1> or byte [SEEK_STATUS], INT_FLAG ; TURN ON INTERRUPT OCCURRED 3609 00004EB3 B020 <1> mov al, EOI ; END OF INTERRUPT MARKER 3610 00004EB5 E620 <1> out INTA00, al ; INTERRUPT CONTROL PORT 3611 00004EB7 1F <1> pop ds 3612 <1> ;pop ax ; RECOVER REGISTER 3613 <1> ; 11/04/2021 3614 00004EB8 58 <1> pop eax 3615 00004EB9 CF <1> iretd ; RETURN FROM INTERRUPT 3616 <1> 3617 <1> ;------------------------------------------------------------------------------- 3618 <1> ; DSKETTE_SETUP 3619 <1> ; THIS ROUTINE DOES A PRELIMINARY CHECK TO SEE WHAT TYPE OF 3620 <1> ; DISKETTE DRIVES ARE ATTACH TO THE SYSTEM. 3621 <1> ;------------------------------------------------------------------------------- 3622 <1> 3623 <1> ; 09/08/2022 - TRDOS 386 Kernel v2.0.5 3624 <1> ; 29/05/2016 - TRDOS 386 (TRDOS v2.0) 3625 <1> 3626 <1> DSKETTE_SETUP: 3627 <1> ;push ax ; SAVE REGISTERS 3628 <1> ;push bx 3629 <1> ;push cx 3630 00004EBA 52 <1> push edx 3631 <1> ;push di 3632 <1> ;;push ds 3633 <1> ; 14/12/2014 3634 <1> ;mov word [DISK_POINTER], MD_TBL6 3635 <1> ;mov [DISK_POINTER+2], cs 3636 <1> ; 3637 <1> ;or byte [RTC_WAIT_FLAG], 1 ; NO RTC WAIT, FORCE USE OF LOOP 3638 00004EBB 31FF <1> xor edi, edi ; INITIALIZE DRIVE POINTER 3639 <1> ; 09/08/2022 3640 <1> ;mov esi, eax 3641 00004EBD 31C0 <1> xor eax, eax ; eax = 0 3642 00004EBF 66A3[43770100] <1> mov [DSK_STATE], ax ; INITIALIZE STATES 3643 00004EC5 8025[40770100]33 <1> and byte [LASTRATE], ~(STRT_MSK+SEND_MSK) ; CLEAR START & SEND 3644 00004ECC 800D[40770100]C0 <1> or byte [LASTRATE], SEND_MSK ; INITIALIZE SENT TO IMPOSSIBLE 3645 00004ED3 A2[35770100] <1> mov [SEEK_STATUS], al ; INDICATE RECALIBRATE NEEDED 3646 00004ED8 A2[37770100] <1> mov [MOTOR_COUNT], al ; INITIALIZE MOTOR COUNT 3647 00004EDD A2[36770100] <1> mov [MOTOR_STATUS], al ; INITIALIZE DRIVES TO OFF STATE 3648 00004EE2 A2[38770100] <1> mov [DSKETTE_STATUS], al ; NO ERRORS 3649 <1> ; 3650 <1> ; 28/02/2015 3651 <1> ;mov word [cfd], 100h 3652 00004EE7 E815F4FFFF <1> call DSK_RESET 3653 00004EEC 5A <1> pop edx 3654 00004EED F8 <1> clc ; 29/05/2016 3655 00004EEE C3 <1> retn 3656 <1> 3657 <1> ;SUP0: 3658 <1> ; call DRIVE_DET ; DETERMINE DRIVE 3659 <1> ; call XLAT_OLD ; TRANSLATE STATE TO COMPATIBLE MODE 3660 <1> ; ; 02/01/2015 3661 <1> ; ;inc di ; POINT TO NEXT DRIVE 3662 <1> ; ;cmp di, MAX_DRV ; SEE IF DONE 3663 <1> ; ;jnz short SUP0 ; REPEAT FOR EACH ORIVE 3664 <1> ; cmp byte [fd1_type], 0 3665 <1> ; jna short sup1 3666 <1> ; or di, di 3667 <1> ; jnz short sup1 3668 <1> ; inc di 3669 <1> ; jmp short SUP0 3670 <1> ;sup1: 3671 <1> ; mov byte [SEEK_STATUS], 0 ; FORCE RECALIBRATE 3672 <1> ; ;and byte [RTC_WAIT_FLAG], 0FEh ; ALLOW FOR RTC WAIT 3673 <1> ; call SETUP_END ; VARIOUS CLEANUPS 3674 <1> ; ;;pop ds ; RESTORE CALLERS REGISTERS 3675 <1> ; ;pop di 3676 <1> ; pop edx 3677 <1> ; ;pop cx 3678 <1> ; ;pop bx 3679 <1> ; ;pop ax 3680 <1> ; retn 3681 <1> 3682 <1> ;////////////////////////////////////////////////////// 3683 <1> ;; END OF DISKETTE I/O ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3684 <1> 3685 <1> ; 17/04/2021 (TRDOS 386 v2.0.4) 3686 <1> 3687 <1> ; 11/04/2021 3688 <1> ;int13h: ; 21/02/2015 3689 <1> ;pushfd 3690 <1> ;push cs 3691 <1> ;;call DISK_IO 3692 <1> ;;retn 3693 <1> 3694 <1> ;;;;;; DISK I/O ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21/02/2015 ;;; 3695 <1> ;///////////////////////////////////////////////////////////////////// 3696 <1> 3697 <1> ; DISK I/O - Erdogan Tan (Retro UNIX 386 v1 project) 3698 <1> ; 18/02/2016 3699 <1> ; 17/02/2016 3700 <1> ; 23/02/2015 3701 <1> ; 21/02/2015 (unix386.s) 3702 <1> ; 22/12/2014 - 14/02/2015 (dsectrm2.s) 3703 <1> ; 3704 <1> ; Original Source Code: 3705 <1> ; DISK ----- 09/25/85 FIXED DISK BIOS 3706 <1> ; (IBM PC XT Model 286 System BIOS Source Code, 04-21-86) 3707 <1> ; 3708 <1> ; Modifications: by reference of AWARD BIOS 1999 (D1A0622) 3709 <1> ; Source Code - ATORGS.ASM, AHDSK.ASM 3710 <1> ; 3711 <1> 3712 <1> ;The wait for controller to be not busy is 10 seconds. 3713 <1> ;10,000,000 / 30 = 333,333. 333,333 decimal = 051615h 3714 <1> ;;WAIT_HDU_CTLR_BUSY_LO equ 1615h 3715 <1> ;;WAIT_HDU_CTLR_BUSY_HI equ 05h 3716 <1> WAIT_HDU_CTRL_BUSY_LH equ 51615h ; 21/02/2015 3717 <1> 3718 <1> ;The wait for controller to issue completion interrupt is 10 seconds. 3719 <1> ;10,000,000 / 30 = 333,333. 333,333 decimal = 051615h 3720 <1> ;;WAIT_HDU_INT_LO equ 1615h 3721 <1> ;;WAIT_HDU_INT_HI equ 05h 3722 <1> WAIT_HDU_INT_LH equ 51615h ; 21/02/2015 3723 <1> 3724 <1> ;The wait for Data request on read and write longs is 3725 <1> ;2000 us. (?) 3726 <1> ;;WAIT_HDU_DRQ_LO equ 1000 ; 03E8h 3727 <1> ;;WAIT_HDU_DRQ_HI equ 0 3728 <1> WAIT_HDU_DRQ_LH equ 1000 ; 21/02/2015 3729 <1> 3730 <1> ; Port 61h (PORT_B) 3731 <1> SYS1 equ 61h ; PORT_B (diskette.inc) 3732 <1> 3733 <1> ; 23/12/2014 3734 <1> %define CMD_BLOCK ebp-8 ; 21/02/2015 3735 <1> 3736 <1> ;--- INT 13H ------------------------------------------------------------------- 3737 <1> ; : 3738 <1> ; FIXED DISK I/O INTERFACE : 3739 <1> ; : 3740 <1> ; THIS INTERFACE PROVIDES ACCESS TO 5 1/4" FIXED DISKS THROUGH : 3741 <1> ; THE IBM FIXED DISK CONTROLLER. : 3742 <1> ; : 3743 <1> ; THE BIOS ROUTINES ARE MEANT TO BE ACCESSED THROUGH : 3744 <1> ; SOFTWARE INTERRUPTS ONLY. ANY ADDRESSES PRESENT IN : 3745 <1> ; THESE LISTINGS ARE INCLUDED ONLY FOR COMPLETENESS, : 3746 <1> ; NOT FOR REFERENCE. APPLICATIONS WHICH REFERENCE ANY : 3747 <1> ; ABSOLUTE ADDRESSES WITHIN THE CODE SEGMENTS OF BIOS : 3748 <1> ; VIOLATE THE STRUCTURE AND DESIGN OF BIOS. : 3749 <1> ; : 3750 <1> ;------------------------------------------------------------------------------: 3751 <1> ; : 3752 <1> ; INPUT (AH)= HEX COMMAND VALUE : 3753 <1> ; : 3754 <1> ; (AH)= 00H RESET DISK (DL = 80H,81H) / DISKETTE : 3755 <1> ; (AH)= 01H READ THE STATUS OF THE LAST DISK OPERATION INTO (AL) : 3756 <1> ; NOTE: DL < 80H - DISKETTE : 3757 <1> ; DL > 80H - DISK : 3758 <1> ; (AH)= 02H READ THE DESIRED SECTORS INTO MEMORY : 3759 <1> ; (AH)= 03H WRITE THE DESIRED SECTORS FROM MEMORY : 3760 <1> ; (AH)= 04H VERIFY THE DESIRED SECTORS : 3761 <1> ; (AH)= 05H FORMAT THE DESIRED TRACK : 3762 <1> ; (AH)= 06H UNUSED : 3763 <1> ; (AH)= 07H UNUSED : 3764 <1> ; (AH)= 08H RETURN THE CURRENT DRIVE PARAMETERS : 3765 <1> ; (AH)= 09H INITIALIZE DRIVE PAIR CHARACTERISTICS : 3766 <1> ; INTERRUPT 41 POINTS TO DATA BLOCK FOR DRIVE 0 : 3767 <1> ; INTERRUPT 46 POINTS TO DATA BLOCK FOR DRIVE 1 : 3768 <1> ; (AH)= 0AH READ LONG : 3769 <1> ; (AH)= 0BH WRITE LONG (READ & WRITE LONG ENCOMPASS 512 + 4 BYTES ECC) : 3770 <1> ; (AH)= 0CH SEEK : 3771 <1> ; (AH)= 0DH ALTERNATE DISK RESET (SEE DL) : 3772 <1> ; (AH)= 0EH UNUSED : 3773 <1> ; (AH)= 0FH UNUSED : 3774 <1> ; (AH)= 10H TEST DRIVE READY : 3775 <1> ; (AH)= 11H RECALIBRATE : 3776 <1> ; (AH)= 12H UNUSED : 3777 <1> ; (AH)= 13H UNUSED : 3778 <1> ; (AH)= 14H CONTROLLER INTERNAL DIAGNOSTIC : 3779 <1> ; (AH)= 15H READ DASD TYPE : 3780 <1> ; : 3781 <1> ;------------------------------------------------------------------------------- 3782 <1> ; : 3783 <1> ; REGISTERS USED FOR FIXED DISK OPERATIONS : 3784 <1> ; : 3785 <1> ; (DL) - DRIVE NUMBER (80H-81H FOR DISK. VALUE CHECKED) : 3786 <1> ; (DH) - HEAD NUMBER (0-15 ALLOWED, NOT VALUE CHECKED) : 3787 <1> ; (CH) - CYLINDER NUMBER (0-1023, NOT VALUE CHECKED)(SEE CL): 3788 <1> ; (CL) - SECTOR NUMBER (1-17, NOT VALUE CHECKED) : 3789 <1> ; : 3790 <1> ; NOTE: HIGH 2 BITS OF CYLINDER NUMBER ARE PLACED : 3791 <1> ; IN THE HIGH 2 BITS OF THE CL REGISTER : 3792 <1> ; (10 BITS TOTAL) : 3793 <1> ; : 3794 <1> ; (AL) - NUMBER OF SECTORS (MAXIMUM POSSIBLE RANGE 1-80H, : 3795 <1> ; FOR READ/WRITE LONG 1-79H) : 3796 <1> ; : 3797 <1> ; (ES:BX) - ADDRESS OF BUFFER FOR READS AND WRITES, : 3798 <1> ; (NOT REQUIRED FOR VERIFY) : 3799 <1> ; : 3800 <1> ; FORMAT (AH=5) ES:BX POINTS TO A 512 BYTE BUFFER. THE FIRST : 3801 <1> ; 2*(SECTORS/TRACK) BYTES CONTAIN F,N FOR EACH SECTOR.: 3802 <1> ; F = 00H FOR A GOOD SECTOR : 3803 <1> ; 80H FOR A BAD SECTOR : 3804 <1> ; N = SECTOR NUMBER : 3805 <1> ; FOR AN INTERLEAVE OF 2 AND 17 SECTORS/TRACK : 3806 <1> ; THE TABLE SHOULD BE: : 3807 <1> ; : 3808 <1> ; DB 00H,01H,00H,0AH,00H,02H,00H,0BH,00H,03H,00H,0CH : 3809 <1> ; DB 00H,04H,00H,0DH,00H,05H,00H,0EH,00H,06H,00H,0FH : 3810 <1> ; DB 00H,07H,00H,10H,00H,08H,00H,11H,00H,09H : 3811 <1> ; : 3812 <1> ;------------------------------------------------------------------------------- 3813 <1> 3814 <1> ;------------------------------------------------------------------------------- 3815 <1> ; OUTPUT : 3816 <1> ; AH = STATUS OF CURRENT OPERATION : 3817 <1> ; STATUS BITS ARE DEFINED IN THE EQUATES BELOW : 3818 <1> ; CY = 0 SUCCESSFUL OPERATION (AH=0 ON RETURN) : 3819 <1> ; CY = 1 FAILED OPERATION (AH HAS ERROR REASON) : 3820 <1> ; : 3821 <1> ; NOTE: ERROR 11H INDICATES THAT THE DATA READ HAD A RECOVERABLE : 3822 <1> ; ERROR WHICH WAS CORRECTED BY THE ECC ALGORITHM. THE DATA : 3823 <1> ; IS PROBABLY GOOD, HOWEVER THE BIOS ROUTINE INDICATES AN : 3824 <1> ; ERROR TO ALLOW THE CONTROLLING PROGRAM A CHANCE TO DECIDE : 3825 <1> ; FOR ITSELF. THE ERROR MAY NOT RECUR IF THE DATA IS : 3826 <1> ; REWRITTEN. : 3827 <1> ; : 3828 <1> ; IF DRIVE PARAMETERS WERE REQUESTED (DL >= 80H), : 3829 <1> ; INPUT: : 3830 <1> ; (DL) = DRIVE NUMBER : 3831 <1> ; ; 27/05/2016 - TRDOS 386 (TRDOS v2.0) : 3832 <1> ; EBX = Buffer address for fixed disk parameters table (32 bytes) : 3833 <1> ; OUTPUT: : 3834 <1> ; (DL) = NUMBER OF CONSECUTIVE ACKNOWLEDGING DRIVES ATTACHED (1-2) : 3835 <1> ; (CONTROLLER CARD ZERO TALLY ONLY) : 3836 <1> ; (DH) = MAXIMUM USEABLE VALUE FOR HEAD NUMBER : 3837 <1> ; (CH) = MAXIMUM USEABLE VALUE FOR CYLINDER NUMBER : 3838 <1> ; (CL) = MAXIMUM USEABLE VALUE FOR SECTOR NUMBER : 3839 <1> ; AND CYLINDER NUMBER HIGH BITS : 3840 <1> ; : 3841 <1> ; IF READ DASD TYPE WAS REQUESTED, : 3842 <1> ; : 3843 <1> ; AH = 0 - NOT PRESENT : 3844 <1> ; 1 - DISKETTE - NO CHANGE LINE AVAILABLE : 3845 <1> ; 2 - DISKETTE - CHANGE LINE AVAILABLE : 3846 <1> ; 3 - FIXED DISK : 3847 <1> ; : 3848 <1> ; CX,DX = NUMBER OF 512 BYTE BLOCKS WHEN AH = 3 : 3849 <1> ; : 3850 <1> ; REGISTERS WILL BE PRESERVED EXCEPT WHEN THEY ARE USED TO RETURN : 3851 <1> ; INFORMATION. : 3852 <1> ; : 3853 <1> ; NOTE: IF AN ERROR IS REPORTED BY THE DISK CODE, THE APPROPRIATE : 3854 <1> ; ACTION IS TO RESET THE DISK, THEN RETRY THE OPERATION. : 3855 <1> ; : 3856 <1> ;------------------------------------------------------------------------------- 3857 <1> 3858 <1> SENSE_FAIL EQU 0FFH ; NOT IMPLEMENTED 3859 <1> NO_ERR EQU 0E0H ; STATUS ERROR/ERROR REGISTER=0 3860 <1> WRITE_FAULT EQU 0CCH ; WRITE FAULT ON SELECTED DRIVE 3861 <1> UNDEF_ERR EQU 0BBH ; UNDEFINED ERROR OCCURRED 3862 <1> NOT_RDY EQU 0AAH ; DRIVE NOT READY 3863 <1> TIME_OUT EQU 80H ; ATTACHMENT FAILED TO RESPOND 3864 <1> BAD_SEEK EQU 40H ; SEEK OPERATION FAILED 3865 <1> BAD_CNTLR EQU 20H ; CONTROLLER HAS FAILED 3866 <1> DATA_CORRECTED EQU 11H ; ECC CORRECTED DATA ERROR 3867 <1> BAD_ECC EQU 10H ; BAD ECC ON DISK READ 3868 <1> BAD_TRACK EQU 0BH ; NOT IMPLEMENTED 3869 <1> BAD_SECTOR EQU 0AH ; BAD SECTOR FLAG DETECTED 3870 <1> ;DMA_BOUNDARY EQU 09H ; DATA EXTENDS TOO FAR 3871 <1> INIT_FAIL EQU 07H ; DRIVE PARAMETER ACTIVITY FAILED 3872 <1> BAD_RESET EQU 05H ; RESET FAILED 3873 <1> ;RECORD_NOT_FND EQU 04H ; REQUESTED SECTOR NOT FOUND 3874 <1> ;BAD_ADDR_MARK EQU 02H ; ADDRESS MARK NOT FOUND 3875 <1> ;BAD_CMD EQU 01H ; BAD COMMAND PASSED TO DISK I/O 3876 <1> 3877 <1> ;-------------------------------------------------------- 3878 <1> ; : 3879 <1> ; FIXED DISK PARAMETER TABLE : 3880 <1> ; - THE TABLE IS COMPOSED OF A BLOCK DEFINED AS: : 3881 <1> ; : 3882 <1> ; +0 (1 WORD) - MAXIMUM NUMBER OF CYLINDERS : 3883 <1> ; +2 (1 BYTE) - MAXIMUM NUMBER OF HEADS : 3884 <1> ; +3 (1 WORD) - NOT USED/SEE PC-XT : 3885 <1> ; +5 (1 WORD) - STARTING WRITE PRECOMPENSATION CYL : 3886 <1> ; +7 (1 BYTE) - MAXIMUM ECC DATA BURST LENGTH : 3887 <1> ; +8 (1 BYTE) - CONTROL BYTE : 3888 <1> ; BIT 7 DISABLE RETRIES -OR- : 3889 <1> ; BIT 6 DISABLE RETRIES : 3890 <1> ; BIT 3 MORE THAN 8 HEADS : 3891 <1> ; +9 (3 BYTES)- NOT USED/SEE PC-XT : 3892 <1> ; +12 (1 WORD) - LANDING ZONE : 3893 <1> ; +14 (1 BYTE) - NUMBER OF SECTORS/TRACK : 3894 <1> ; +15 (1 BYTE) - RESERVED FOR FUTURE USE : 3895 <1> ; : 3896 <1> ; - TO DYNAMICALLY DEFINE A SET OF PARAMETERS : 3897 <1> ; BUILD A TABLE FOR UP TO 15 TYPES AND PLACE : 3898 <1> ; THE CORRESPONDING VECTOR INTO INTERRUPT 41 : 3899 <1> ; FOR DRIVE 0 AND INTERRUPT 46 FOR DRIVE 1. : 3900 <1> ; : 3901 <1> ;-------------------------------------------------------- 3902 <1> 3903 <1> ;-------------------------------------------------------- 3904 <1> ; : 3905 <1> ; HARDWARE SPECIFIC VALUES : 3906 <1> ; : 3907 <1> ; - CONTROLLER I/O PORT : 3908 <1> ; : 3909 <1> ; > WHEN READ FROM: : 3910 <1> ; HF_PORT+0 - READ DATA (FROM CONTROLLER TO CPU) : 3911 <1> ; HF_PORT+1 - GET ERROR REGISTER : 3912 <1> ; HF_PORT+2 - GET SECTOR COUNT : 3913 <1> ; HF_PORT+3 - GET SECTOR NUMBER : 3914 <1> ; HF_PORT+4 - GET CYLINDER LOW : 3915 <1> ; HF_PORT+5 - GET CYLINDER HIGH (2 BITS) : 3916 <1> ; HF_PORT+6 - GET SIZE/DRIVE/HEAD : 3917 <1> ; HF_PORT+7 - GET STATUS REGISTER : 3918 <1> ; : 3919 <1> ; > WHEN WRITTEN TO: : 3920 <1> ; HF_PORT+0 - WRITE DATA (FROM CPU TO CONTROLLER) : 3921 <1> ; HF_PORT+1 - SET PRECOMPENSATION CYLINDER : 3922 <1> ; HF_PORT+2 - SET SECTOR COUNT : 3923 <1> ; HF_PORT+3 - SET SECTOR NUMBER : 3924 <1> ; HF_PORT+4 - SET CYLINDER LOW : 3925 <1> ; HF_PORT+5 - SET CYLINDER HIGH (2 BITS) : 3926 <1> ; HF_PORT+6 - SET SIZE/DRIVE/HEAD : 3927 <1> ; HF_PORT+7 - SET COMMAND REGISTER : 3928 <1> ; : 3929 <1> ;-------------------------------------------------------- 3930 <1> 3931 <1> ;HF_PORT EQU 01F0H ; DISK PORT 3932 <1> ;HF1_PORT equ 0170h 3933 <1> ;HF_REG_PORT EQU 03F6H 3934 <1> ;HF1_REG_PORT equ 0376h 3935 <1> 3936 <1> HDC1_BASEPORT equ 1F0h 3937 <1> HDC2_BASEPORT equ 170h 3938 <1> 3939 00004EEF 90 <1> align 2 3940 <1> 3941 <1> ;----- STATUS REGISTER 3942 <1> 3943 <1> ST_ERROR EQU 00000001B ; 3944 <1> ST_INDEX EQU 00000010B ; 3945 <1> ST_CORRCTD EQU 00000100B ; ECC CORRECTION SUCCESSFUL 3946 <1> ST_DRQ EQU 00001000B ; 3947 <1> ST_SEEK_COMPL EQU 00010000B ; SEEK COMPLETE 3948 <1> ST_WRT_FLT EQU 00100000B ; WRITE FAULT 3949 <1> ST_READY EQU 01000000B ; 3950 <1> ST_BUSY EQU 10000000B ; 3951 <1> 3952 <1> ;----- ERROR REGISTER 3953 <1> 3954 <1> ERR_DAM EQU 00000001B ; DATA ADDRESS MARK NOT FOUND 3955 <1> ERR_TRK_0 EQU 00000010B ; TRACK 0 NOT FOUND ON RECAL 3956 <1> ERR_ABORT EQU 00000100B ; ABORTED COMMAND 3957 <1> ; EQU 00001000B ; NOT USED 3958 <1> ERR_ID EQU 00010000B ; ID NOT FOUND 3959 <1> ; EQU 00100000B ; NOT USED 3960 <1> ERR_DATA_ECC EQU 01000000B 3961 <1> ERR_BAD_BLOCK EQU 10000000B 3962 <1> 3963 <1> 3964 <1> RECAL_CMD EQU 00010000B ; DRIVE RECAL (10H) 3965 <1> READ_CMD EQU 00100000B ; READ (20H) 3966 <1> WRITE_CMD EQU 00110000B ; WRITE (30H) 3967 <1> VERIFY_CMD EQU 01000000B ; VERIFY (40H) 3968 <1> FMTTRK_CMD EQU 01010000B ; FORMAT TRACK (50H) 3969 <1> INIT_CMD EQU 01100000B ; INITIALIZE (60H) 3970 <1> SEEK_CMD EQU 01110000B ; SEEK (70H) 3971 <1> DIAG_CMD EQU 10010000B ; DIAGNOSTIC (90H) 3972 <1> SET_PARM_CMD EQU 10010001B ; DRIVE PARMS (91H) 3973 <1> NO_RETRIES EQU 00000001B ; CHD MODIFIER (01H) 3974 <1> ECC_MODE EQU 00000010B ; CMD MODIFIER (02H) 3975 <1> BUFFER_MODE EQU 00001000B ; CMD MODIFIER (08H) 3976 <1> 3977 <1> ;MAX_FILE EQU 2 3978 <1> ;S_MAX_FILE EQU 2 3979 <1> MAX_FILE equ 4 ; 22/12/2014 3980 <1> S_MAX_FILE equ 4 ; 22/12/2014 3981 <1> 3982 <1> DELAY_1 EQU 25H ; DELAY FOR OPERATION COMPLETE 3983 <1> DELAY_2 EQU 0600H ; DELAY FOR READY 3984 <1> DELAY_3 EQU 0100H ; DELAY FOR DATA REQUEST 3985 <1> 3986 <1> HF_FAIL EQU 08H ; CMOS FLAG IN BYTE 0EH 3987 <1> 3988 <1> ;----- COMMAND BLOCK REFERENCE 3989 <1> 3990 <1> ;CMD_BLOCK EQU BP-8 ; @CMD_BLOCK REFERENCES BLOCK HEAD IN SS 3991 <1> ; (BP) POINTS TO COMMAND BLOCK TAIL 3992 <1> ; AS DEFINED BY THE "ENTER" PARMS 3993 <1> ; 19/12/2014 3994 <1> ORG_VECTOR equ 4*13h ; INT 13h vector 3995 <1> DISK_VECTOR equ 4*40h ; INT 40h vector (for floppy disks) 3996 <1> ;HDISK_INT equ 4*76h ; Primary HDC - Hardware interrupt (IRQ14) 3997 <1> ;HDISK_INT1 equ 4*76h ; Primary HDC - Hardware interrupt (IRQ14) 3998 <1> ;HDISK_INT2 equ 4*77h ; Secondary HDC - Hardware interrupt (IRQ15) 3999 <1> ;HF_TBL_VEC equ 4*41h ; Pointer to 1st fixed disk parameter table 4000 <1> ;HF1_TBL_VEC equ 4*46h ; Pointer to 2nd fixed disk parameter table 4001 <1> 4002 <1> align 2 4003 <1> 4004 <1> ;---------------------------------------------------------------- 4005 <1> ; FIXED DISK I/O SETUP : 4006 <1> ; : 4007 <1> ; - ESTABLISH TRANSFER VECTORS FOR THE FIXED DISK : 4008 <1> ; - PERFORM POWER ON DIAGNOSTICS : 4009 <1> ; SHOULD AN ERROR OCCUR A "1701" MESSAGE IS DISPLAYED : 4010 <1> ; : 4011 <1> ;---------------------------------------------------------------- 4012 <1> 4013 <1> ; 09/08/2022 4014 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 4015 <1> ; 29/05/2016 - TRDOS 386 (TRDOS v2.0) 4016 <1> 4017 <1> DISK_SETUP: 4018 <1> ;CLI 4019 <1> ;;mov ax, ABS0 ; GET ABSOLUTE SEGMENT 4020 <1> ;xor ax, ax 4021 <1> ;mov ds, ax ; SET SEGMENT REGISTER 4022 <1> ;mov ax, [ORG_VECTOR] ; GET DISKETTE VECTOR 4023 <1> ;mov [DISK_VECTOR], ax ; INTO INT 40H 4024 <1> ;mov ax, [ORG_VECTOR+2] 4025 <1> ;mov [DISK_VECTOR+2], ax 4026 <1> ;mov word [ORG_VECTOR], DISK_IO ; FIXED DISK HANDLER 4027 <1> ;mov [ORG_VECTOR+2], cs 4028 <1> ; 1st controller (primary master, slave) - IRQ 14 4029 <1> ;;mov word [HDISK_INT], HD_INT ; FIXED DISK INTERRUPT 4030 <1> ;mov word [HDISK_INT1], HD_INT ; 4031 <1> ;;mov [HDISK_INT+2], cs 4032 <1> ;mov [HDISK_INT1+2], cs 4033 <1> ; 2nd controller (secondary master, slave) - IRQ 15 4034 <1> ;mov word [HDISK_INT2], HD1_INT ; 4035 <1> ;mov [HDISK_INT2+2], cs 4036 <1> ; 4037 <1> ;;mov word [HF_TBL_VEC], HD0_DPT ; PARM TABLE DRIVE 80 4038 <1> ;;mov word [HF_TBL_VEC+2], DPT_SEGM 4039 <1> ;;mov word [HF1_TBL_VEC], HD1_DPT ; PARM TABLE DRIVE 81 4040 <1> ;;mov word [HF1_TBL_VEC+2], DPT_SEGM 4041 <1> ;push cs 4042 <1> ;pop ds 4043 <1> ;mov word [HDPM_TBL_VEC], HD0_DPT ; PARM TABLE DRIVE 80h 4044 <1> ;mov word [HDPM_TBL_VEC+2], DPT_SEGM 4045 00004EF0 C705[4C770100]0000- <1> mov dword [HDPM_TBL_VEC], (DPT_SEGM*16)+HD0_DPT 4045 00004EF8 0900 <1> 4046 <1> ;mov word [HDPS_TBL_VEC], HD1_DPT ; PARM TABLE DRIVE 81h 4047 <1> ;mov word [HDPS_TBL_VEC+2], DPT_SEGM 4048 00004EFA C705[50770100]2000- <1> mov dword [HDPS_TBL_VEC], (DPT_SEGM*16)+HD1_DPT 4048 00004F02 0900 <1> 4049 <1> ;mov word [HDSM_TBL_VEC], HD2_DPT ; PARM TABLE DRIVE 82h 4050 <1> ;mov word [HDSM_TBL_VEC+2], DPT_SEGM 4051 00004F04 C705[54770100]4000- <1> mov dword [HDSM_TBL_VEC], (DPT_SEGM*16)+HD2_DPT 4051 00004F0C 0900 <1> 4052 <1> ;mov word [HDSS_TBL_VEC], HD3_DPT ; PARM TABLE DRIVE 83h 4053 <1> ;mov word [HDSS_TBL_VEC+2], DPT_SEGM 4054 00004F0E C705[58770100]6000- <1> mov dword [HDSS_TBL_VEC], (DPT_SEGM*16)+HD3_DPT 4054 00004F16 0900 <1> 4055 <1> ; 4056 <1> ;;in al, INTB01 ; TURN ON SECOND INTERRUPT CHIP 4057 <1> ;;;and al, 0BFh 4058 <1> ;;and al, 3Fh ; enable IRQ 14 and IRQ 15 4059 <1> ;;;jmp $+2 4060 <1> ;;IODELAY 4061 <1> ;;out INTB01, al 4062 <1> ;;IODELAY 4063 <1> ;;in al, INTA01 ; LET INTERRUPTS PASS THRU TO 4064 <1> ;;and al, 0FBh ; SECOND CHIP 4065 <1> ;;;jmp $+2 4066 <1> ;;IODELAY 4067 <1> ;;out INTA01, al 4068 <1> ; 4069 <1> ;sti 4070 <1> ;;push ds ; MOVE ABS0 POINTER TO 4071 <1> ;;pop es ; EXTRA SEGMENT POINTER 4072 <1> ;;;call DDS ; ESTABLISH DATA SEGMENT 4073 <1> ;;mov byte [DISK_STATUS1], 0 ; RESET THE STATUS INDICATOR 4074 <1> ;;mov byte [HF_NUM], 0 ; ZERO NUMBER OF FIXED DISKS 4075 <1> ;;mov byte [CONTROL_BYTE], 0 4076 <1> ;;mov byte [PORT_OFF], 0 ; ZERO CARD OFFSET 4077 <1> ; 20/12/2014 - private code by Erdogan Tan 4078 <1> ; (out of original PC-AT, PC-XT BIOS code) 4079 <1> ;mov si, hd0_type 4080 00004F18 BE[8E660000] <1> mov esi, hd0_type 4081 <1> ;;mov cx, 4 4082 <1> ;mov ecx, 4 4083 <1> ; 06/08/2022 4084 00004F1D 29C9 <1> sub ecx, ecx 4085 00004F1F B104 <1> mov cl, 4 4086 <1> hde_l: 4087 00004F21 AC <1> lodsb 4088 00004F22 3C80 <1> cmp al, 80h ; 8?h = existing 4089 00004F24 7206 <1> jb short _L4 4090 00004F26 FE05[48770100] <1> inc byte [HF_NUM] ; + 1 hard (fixed) disk drives 4091 <1> _L4: ; 26/02/2015 4092 00004F2C E2F3 <1> loop hde_l 4093 <1> ;_L4: ; 0 <= [HF_NUM] =< 4 4094 <1> ;L4: 4095 <1> ;; 31/12/2014 - cancel controller diagnostics here 4096 <1> ;;;mov cx, 3 ; 26/12/2014 (Award BIOS 1999) 4097 <1> ;;mov cl, 3 4098 <1> ;; 4099 <1> ;;mov DL, 80H ; CHECK THE CONTROLLER 4100 <1> ;;hdc_dl: 4101 <1> ;;mov AH, 14H ; USE CONTROLLER DIAGNOSTIC COMMAND 4102 <1> ;;INT 13H ; CALL BIOS WITH DIAGNOSTIC COMMAND 4103 <1> ;;;jc short CTL_ERRX ; DISPLAY ERROR MESSAGE IF BAD RETURN 4104 <1> ;;;jc short POD_DONE ;22/12/2014 4105 <1> ;;jnc short hdc_reset0 4106 <1> ;;loop hdc_dl 4107 <1> ;;; 27/12/2014 4108 <1> ;;stc 4109 <1> ;;retn 4110 <1> ; 4111 <1> ;;hdc_reset0: 4112 <1> ; 18/01/2015 4113 00004F2E 8A0D[48770100] <1> mov cl, [HF_NUM] 4114 00004F34 20C9 <1> and cl, cl 4115 00004F36 740D <1> jz short POD_DONE 4116 <1> ; 4117 00004F38 B27F <1> mov dl, 7Fh 4118 <1> hdc_reset1: 4119 00004F3A FEC2 <1> inc dl 4120 <1> ;; 31/12/2015 4121 <1> ;;push dx 4122 <1> ;;push cx 4123 <1> ;;push ds 4124 <1> ;;sub ax, ax 4125 <1> ;;mov ds, ax 4126 <1> ;;mov ax, [TIMER_LOW] ; GET START TIMER COUNTS 4127 <1> ;;pop ds 4128 <1> ;;mov bx, ax 4129 <1> ;;add ax, 6*182 ; 60 SECONDS* 18.2 4130 <1> ;;mov cx, ax 4131 <1> ;;mov word [wait_count], 0 ; 22/12/2014 (reset wait counter) 4132 <1> ;; 4133 <1> ;; 31/12/2014 - cancel HD_RESET_1 4134 <1> ;;call HD_RESET_1 ; SET UP DRIVE 0, (1,2,3) 4135 <1> ;;pop cx 4136 <1> ;;pop dx 4137 <1> ;; 4138 <1> ; 18/01/2015 4139 00004F3C B40D <1> mov ah, 0Dh ; ALTERNATE RESET 4140 <1> ;int 13h 4141 00004F3E E8CC000000 <1> call int13h 4142 00004F43 E2F5 <1> loop hdc_reset1 4143 <1> ;clc ; 29/05/2016 4144 <1> POD_DONE: 4145 00004F45 C3 <1> retn 4146 <1> 4147 <1> ;;----- POD_ERROR 4148 <1> 4149 <1> ;;CTL_ERRX: 4150 <1> ; ;mov SI,OFFSET F1782 ; CONTROLLER ERROR 4151 <1> ; ;call SET_FAIL ; DO NOT IPL FROM DISK 4152 <1> ; ;call E_MSG ; DISPLAY ERROR AND SET (BP) ERROR FLAG 4153 <1> ; ;jmp short POD_DONE 4154 <1> 4155 <1> ;;HD_RESET_1: 4156 <1> ;; ;push BX ; SAVE TIMER LIMITS 4157 <1> ;; ;push CX 4158 <1> ;;RES_1: mov AH,09H ; SET DRIVE PARAMETERS 4159 <1> ;; INT 13H 4160 <1> ;; jc short RES_2 4161 <1> ;; mov AH,11h ; RECALIBRATE DRIVE 4162 <1> ;; INT 13H 4163 <1> ;; jnc short RES_CK ; DRIVE OK 4164 <1> ;;RES_2: ;call POD_TCHK ; CHECK TIME OUT 4165 <1> ;; cmp word [wait_count], 6*182 ; waiting time (in timer ticks) 4166 <1> ;; ; (30 seconds) 4167 <1> ;; ;cmc 4168 <1> ;; ;jnc short RES_1 4169 <1> ;; jb short RES_1 4170 <1> ;;;RES_FL: ;mov SI,OFFSET F1781 ; INDICATE DISK 1 FAILURE; 4171 <1> ;; ;test DL,1 4172 <1> ;; ;jnz short RES_E1 4173 <1> ;; ;mov SI,OFFSET F1780 ; INDICATE DISK 0 FAILURE 4174 <1> ;; ;call SET_FAIL ; DO NOT TRY TO IPL DISK 0 4175 <1> ;; ;jmp SHORT RES_E1 4176 <1> ;;RES_ER: ; 22/12/2014 4177 <1> ;;RES_OK: 4178 <1> ;; ;pop CX ; RESTORE TIMER LIMITS 4179 <1> ;; ;pop BX 4180 <1> ;; retn 4181 <1> ;; 4182 <1> ;;RES_RS: mov AH,00H ; RESET THE DRIVE 4183 <1> ;; INT 13H 4184 <1> ;;RES_CK: mov AH,08H ; GET MAX CYLINDER,HEAD,SECTOR 4185 <1> ;; mov BL,DL ; SAVE DRIVE CODE 4186 <1> ;; INT 13H 4187 <1> ;; jc short RES_ER 4188 <1> ;; mov [NEC_STATUS],CX ; SAVE MAX CYLINDER, SECTOR 4189 <1> ;; mov DL,BL ; RESTORE DRIVE CODE 4190 <1> ;;RES_3: mov AX,0401H ; VERIFY THE LAST SECTOR 4191 <1> ;; INT 13H 4192 <1> ;; jnc short RES_OK ; VERIFY OK 4193 <1> ;; cmp AH,BAD_SECTOR ; OK ALSO IF JUST ID READ 4194 <1> ;; JE short RES_OK 4195 <1> ;; cmp AH,DATA_CORRECTED 4196 <1> ;; JE short RES_OK 4197 <1> ;; cmp AH,BAD_ECC 4198 <1> ;; JE short RES_OK 4199 <1> ;; ;call POD_TCHK ; CHECK FOR TIME OUT 4200 <1> ;; cmp word [wait_count], 6*182 ; waiting time (in timer ticks) 4201 <1> ;; ; (60 seconds) 4202 <1> ;; cmc 4203 <1> ;; jc short RES_ER ; FAILED 4204 <1> ;; mov CX,[NEC_STATUS] ; GET SECTOR ADDRESS, AND CYLINDER 4205 <1> ;; mov AL,CL ; SEPARATE OUT SECTOR NUMBER 4206 <1> ;; and AL,3FH 4207 <1> ;; dec AL ; TRY PREVIOUS ONE 4208 <1> ;; jz short RES_RS ; WE'VE TRIED ALL SECTORS ON TRACK 4209 <1> ;; and CL,0C0H ; KEEP CYLINDER BITS 4210 <1> ;; OR CL,AL ; MERGE SECTOR WITH CYLINDER BITS 4211 <1> ;; mov [NEC_STATUS],CX ; SAVE CYLINDER, NEW SECTOR NUMBER 4212 <1> ;; jmp short RES_3 ; TRY AGAIN 4213 <1> ;;;RES_ER: mov SI,OFFSET F1791 ; INDICATE DISK 1 ERROR 4214 <1> ;; ;test DL,1 4215 <1> ;; ;jnz short RES_E1 4216 <1> ;; ;mov SI,OFFSET F1790 ; INDICATE DISK 0 ERROR 4217 <1> ;;;RES_E1: 4218 <1> ;; ;call E_MSG ; DISPLAY ERROR AND SET (BP) ERROR FLAG 4219 <1> ;;;RES_OK: 4220 <1> ;; ;pop CX ; RESTORE TIMER LIMITS 4221 <1> ;; ;pop BX 4222 <1> ;; ;retn 4223 <1> ; 4224 <1> ;;SET_FAIL: 4225 <1> ; ;mov AX,X*(CMOS_DIAG+NMI) ; GET CMOS ERROR BYTE 4226 <1> ; ;call CMOS_READ 4227 <1> ; ;OR AL,HF_FAIL ; SET DO NOT IPL FROM DISK FLAG 4228 <1> ; ;xchg AH,AL ; SAVE IT 4229 <1> ; ;call CMOS_WRITE ; PUT IT OUT 4230 <1> ; ;retn 4231 <1> ; 4232 <1> ;;POD_TCHK: ; CHECK FOR 30 SECOND TIME OUT 4233 <1> ; ;pop AX ; SAVE RETURN 4234 <1> ; ;pop CX ; GET TIME OUT LIMITS 4235 <1> ; ;pop BX 4236 <1> ; ;push BX ; AND SAVE THEM AGAIN 4237 <1> ; ;push CX 4238 <1> ; ;push AX 4239 <1> ; ;push ds 4240 <1> ; ;xor ax, ax 4241 <1> ; ;mov ds, ax ; RESTORE RETURN 4242 <1> ; ;mov AX, [TIMER_LOW] ; AX = CURRENT TIME 4243 <1> ; ; ; BX = START TIME 4244 <1> ; ; ; CX = END TIME 4245 <1> ; ;pop ds 4246 <1> ; ;cmp BX,CX 4247 <1> ; ;JB short TCHK1 ; START < END 4248 <1> ; ;cmp BX,AX 4249 <1> ; ;JB short TCHKG ; END < START < CURRENT 4250 <1> ; ;jmp SHORT TCHK2 ; END, CURRENT < START 4251 <1> ;;TCHK1: cmp AX,BX 4252 <1> ;; JB short TCHKNG ; CURRENT < START < END 4253 <1> ;;TCHK2: cmp AX,CX 4254 <1> ;; JB short TCHKG ; START < CURRENT < END 4255 <1> ;; ; OR CURRENT < END < START 4256 <1> ;;TCHKNG: STC ; CARRY SET INDICATES TIME OUT 4257 <1> ;; retn 4258 <1> ;;TCHKG: CLC ; INDICATE STILL TIME 4259 <1> ;; retn 4260 <1> ;; 4261 <1> ;;int_13h: 4262 <1> 4263 <1> ;---------------------------------------- 4264 <1> ; FIXED DISK BIOS ENTRY POINT : 4265 <1> ;---------------------------------------- 4266 <1> 4267 <1> ; 17/07/2022 4268 <1> ; 16/07/2022 4269 <1> ; 13/07/2022 - TRDOS 386 v2.0.5 4270 <1> ; 15/01/2017 4271 <1> ; 14/01/2017 4272 <1> ; 07/01/2017 4273 <1> ; 02/01/2017 4274 <1> ; 01/06/2016 4275 <1> ; 16/05/2016, 27/05/2016, 28/05/2016, 29/05/2016 4276 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 4277 <1> int33h: ; DISK I/O 4278 <1> ; 29/05/2016 4279 00004F46 80642408FE <1> and byte [esp+8], 11111110b ; clear carry bit of eflags register 4280 <1> 4281 <1> ; 13/07/2022 4282 00004F4B 06 <1> push es 4283 <1> ; 16/05/2016 4284 00004F4C 1E <1> push ds 4285 00004F4D 53 <1> push ebx ; user's buffer address (virtual) 4286 <1> ; 13/07/2022 4287 00004F4E 51 <1> push ecx 4288 00004F4F 52 <1> push edx 4289 00004F50 56 <1> push esi 4290 00004F51 57 <1> push edi 4291 <1> 4292 <1> ;mov bx, KDATA ; System (Kernel's) data segment 4293 <1> ;mov ds, bx 4294 <1> ; 13/07/2022 4295 00004F52 66BF1000 <1> mov di, KDATA 4296 00004F56 8EDF <1> mov ds, di 4297 00004F58 8EC7 <1> mov es, di 4298 <1> 4299 <1> ;;15/01/2017 4300 <1> ; 14/01/2017 4301 <1> ; 02/01/2017 4302 <1> ;;mov byte [intflg], 33h ; disk io interrupt 4303 <1> ;pop ebx 4304 <1> 4305 <1> ; 13/07/2022 4306 <1> ;pop dword [user_buffer] ; 01/06/2016 4307 00004F5A 891D[40830100] <1> mov [user_buffer], ebx 4308 <1> 4309 00004F60 C605[7A7C0100]00 <1> mov byte [scount], 0 ; sector count for transfer 4310 00004F67 80FC03 <1> cmp ah, 03h ; chs write 4311 00004F6A 773C <1> ja short int33h_2 4312 00004F6C 7407 <1> je short int33h_0 4313 00004F6E 80FC02 <1> cmp ah, 02h ; chs read 4314 00004F71 7267 <1> jb short int33h_5 4315 00004F73 EB5A <1> jmp short int33h_4 4316 <1> int33h_0: 4317 <1> ;; 17/07/2022 - 64K r/w buffer limit check ? 4318 <1> ;cmp al, 80h ; 128 4319 <1> ;ja short int33h_8 ; error 4320 <1> ;; 17/07/2022 - zero r/w count check ? 4321 <1> ;or al, al 4322 <1> ;jz short int33h_8 ; error 4323 <1> 4324 <1> ; 17/07/2022 (buffer limit and zero count check) 4325 00004F75 FEC8 <1> dec al 4326 00004F77 781A <1> js short int33h_8 ; error 4327 00004F79 FEC0 <1> inc al 4328 <1> 4329 <1> ; transfer user's buffer content to sector buffer 4330 00004F7B 51 <1> push ecx 4331 00004F7C 0FB6C8 <1> movzx ecx, al 4332 <1> int33h_1: 4333 <1> ; 13/07/2022 4334 <1> ;push esi 4335 <1> ;mov esi, [user_buffer] 4336 00004F7F 89DE <1> mov esi, ebx 4337 <1> ; esi = user's buffer address (virtual, ebx) 4338 <1> ;push edi 4339 <1> ;push es 4340 00004F81 50 <1> push eax 4341 <1> ;mov ax, KDATA 4342 <1> ;mov es, ax 4343 00004F82 BF00000700 <1> mov edi, Cluster_Buffer 4344 00004F87 C1E109 <1> shl ecx, 9 ; * 512 4345 00004F8A E8D6BB0000 <1> call transfer_from_user_buffer 4346 <1> ; (ecx and eax will be modified) 4347 00004F8F 58 <1> pop eax 4348 <1> ; 13/07/2022 4349 <1> ;pop es 4350 <1> ;pop edi 4351 <1> ;pop esi 4352 00004F90 59 <1> pop ecx 4353 00004F91 7347 <1> jnc short int33h_5 4354 <1> 4355 <1> ;mov ebx, [user_buffer] ; 01/06/2016 4356 <1> ;pop ds 4357 <1> 4358 <1> int33h_8: 4359 <1> ; 13/07/2022 4360 00004F93 B8FF000000 <1> mov eax, 0FFh ; Unknown error !? 4361 <1> int33h_9: 4362 00004F98 5F <1> pop edi 4363 00004F99 5E <1> pop esi 4364 00004F9A 5A <1> pop edx 4365 00004F9B 59 <1> pop ecx 4366 00004F9C 5B <1> pop ebx 4367 00004F9D 1F <1> pop ds 4368 00004F9E 07 <1> pop es 4369 <1> 4370 <1> ; 13/07/2022 4371 00004F9F 7305 <1> jnc short int33h_7 4372 <1> 4373 <1> ;;15/01/2017 4374 <1> ; 02/01/2017 4375 <1> ;cli 4376 <1> ;;mov byte [ss:intflg], 0 ; 07/01/2017 4377 <1> ; 4378 <1> ; (*) 29/05/2016 4379 <1> ; (*) retf 4 ; skip eflags on stack 4380 <1> 4381 <1> ; 29/05/2016 -set carry flag on stack- 4382 <1> ; [esp] = EIP 4383 <1> ; [esp+4] = CS 4384 <1> ; [esp+8] = E-FLAGS 4385 00004FA1 804C240801 <1> or byte [esp+8], 1 ; set carry bit of eflags register 4386 <1> ; [esp+12] = ESP (user) 4387 <1> ; [esp+16] = SS (User) 4388 <1> ; 4389 <1> ; 13/07/2022 4390 <1> int33h_7: 4391 00004FA6 FA <1> cli 4392 <1> ;;15/01/2017 4393 <1> ;;mov byte [ss:intflg], 0 ; 07/01/2017 4394 <1> ; cf = 0 ; use eflags which is in stack 4395 00004FA7 CF <1> iretd 4396 <1> 4397 <1> ; (*) 29/05/2016 - 'retf 4' intruction causes to stack fault 4398 <1> ; (OUTER-PRIVILEGE-LEVEL) 4399 <1> ; INTEL 80386 PROGRAMMER'S REFERENCE MANUAL 1986 4400 <1> ; // RETF instruction: 4401 <1> ; 4402 <1> ; IF OperandMode=32 THEN 4403 <1> ; Load CS:EIP from stack; 4404 <1> ; Set CS RPL to CPL; 4405 <1> ; Increment ESP by 8 plus the immediate offset if it exists; 4406 <1> ; Load SS:ESP from stack; 4407 <1> ; ELSE (* OperandMode=16 *) 4408 <1> ; Load CS:IP from stack; 4409 <1> ; Set CS RPL to CPL; 4410 <1> ; Increment ESP by 4 plus the immediate offset if it exists; 4411 <1> ; Load SS:ESP from stack; 4412 <1> ; FI; 4413 <1> ; 4414 <1> ; // 4415 <1> 4416 <1> int33h_2: 4417 00004FA8 80FC05 <1> cmp ah, 05h ; format track 4418 00004FAB 7709 <1> ja short int33h_3 4419 00004FAD 722B <1> jb short int33h_5 4420 00004FAF 51 <1> push ecx 4421 <1> ;mov ecx, 1 4422 <1> ; 17/07/2022 4423 00004FB0 31C9 <1> xor ecx, ecx 4424 00004FB2 FEC1 <1> inc cl 4425 <1> ; ecx = 1 4426 00004FB4 EBC9 <1> jmp short int33h_1 4427 <1> int33h_3: 4428 00004FB6 80FC1C <1> cmp ah, 1Ch ; LBA write 4429 00004FB9 771F <1> ja short int33h_5 4430 00004FBB 74B8 <1> je short int33h_0 4431 00004FBD 80FC1B <1> cmp ah, 1Bh ; LBA read 4432 00004FC0 740D <1> je short int33h_4 4433 00004FC2 80FC08 <1> cmp ah, 08h ; get disk parameters 4434 00004FC5 7513 <1> jne short int33h_5 4435 <1> ; 01/06/2016 4436 00004FC7 8B1D[40830100] <1> mov ebx, [user_buffer] ; user's buffer address 4437 00004FCD EB10 <1> jmp short int33h_6 4438 <1> int33h_4: 4439 <1> ;; 17/07/2022 - 64K r/w buffer limit check ? 4440 <1> ;cmp al, 80h ; 128 4441 <1> ;ja short int33h_8 ; error 4442 <1> ;; 17/07/2022 - zero r/w count check ? 4443 <1> ;or al, al 4444 <1> ;jz short int33h_8 ; error 4445 <1> 4446 <1> ; 17/07/2022 (buffer limit and zero count check) 4447 00004FCF FEC8 <1> dec al 4448 00004FD1 78C0 <1> js short int33h_8 ; error 4449 00004FD3 FEC0 <1> inc al 4450 <1> 4451 00004FD5 A2[7A7C0100] <1> mov byte [scount], al ; <= 128 sectors 4452 <1> int33h_5: 4453 00004FDA BB00000700 <1> mov ebx, Cluster_Buffer ; max. 65536 bytes 4454 <1> ; buf. addr: 70000h 4455 <1> ;mov byte [ClusterBuffer_Valid], 0 4456 <1> int33h_6: 4457 <1> ; 13/07/2022 4458 <1> ;pop ds 4459 <1> ;pushfd 4460 <1> ;push cs 4461 <1> 4462 00004FDF E83B000000 <1> call DISK_IO 4463 <1> 4464 <1> ;;mov ebx, [cs:user_buffer] ; 01/06/2016 4465 <1> ;mov ebx, [user_buffer] ; 13/07/2022 4466 00004FE4 72B2 <1> jc short int33h_9 4467 <1> ; 4468 <1> ;cmp byte [cs:scount], 0 4469 <1> ;jna short int33h_7 4470 00004FE6 803D[7A7C0100]00 <1> cmp byte [scount], 0 ; 13/07/2022 4471 00004FED 76A9 <1> jna short int33h_9 4472 <1> 4473 <1> ; 13/07/2022 4474 <1> 4475 <1> ; transfer sector buffer content to user's buffer 4476 <1> ;push es 4477 <1> ;push ds 4478 <1> ;push eax 4479 <1> ;mov ax, KDATA 4480 <1> ;mov ds, ax 4481 <1> ;mov es, ax 4482 <1> ;push ecx 4483 <1> ;push esi 4484 <1> ;push edi 4485 <1> 4486 <1> ; 13/07/2022 4487 00004FEF 50 <1> push eax 4488 00004FF0 0FB60D[7A7C0100] <1> movzx ecx, byte [scount] 4489 00004FF7 C1E109 <1> shl ecx, 9 ; * 512 bytes 4490 <1> ;mov edi, ebx ; user's buffer address 4491 00004FFA 8B3D[40830100] <1> mov edi, [user_buffer] ; 13/07/2022 4492 00005000 BE00000700 <1> mov esi, Cluster_Buffer 4493 00005005 E811BB0000 <1> call transfer_to_user_buffer 4494 <1> ; (ecx and eax will be modified) 4495 0000500A 58 <1> pop eax 4496 <1> 4497 <1> ; 13/07/2022 4498 0000500B 7286 <1> jc short int33h_8 ; eax = 0FFh 4499 0000500D EB89 <1> jmp short int33h_9 ; cf = 0 4500 <1> 4501 <1> ;pop edi 4502 <1> ;pop esi 4503 <1> ;pop ecx 4504 <1> ;pop eax 4505 <1> ;pop ds 4506 <1> ;pop es 4507 <1> ;jc short int33h_8 4508 <1> ;int33h_7: 4509 <1> ;cli 4510 <1> ;;;15/01/2017 4511 <1> ;;;mov byte [ss:intflg], 0 ; 07/01/2017 4512 <1> ;; cf = 0 ; use eflags which is in stack 4513 <1> ;iretd 4514 <1> ;int33h_8: 4515 <1> ;mov eax, 0FFh ; Unknown error !? 4516 <1> ; 13/07/2022 4517 <1> ;xor eax, eax 4518 <1> ;dec al ; eax = 0FFh 4519 <1> ;jmp short int33h_9 4520 <1> 4521 <1> ;int33h_9: 4522 <1> ;; cf = 1 4523 <1> ; 4524 <1> ;; (*) 29/05/2016 4525 <1> ;; (*) retf 4 ; skip eflags on stack 4526 <1> ;; Note: This 'retf 4' was wrong, -it was causing 4527 <1> ;; to stack errors in ring 3- 4528 <1> ;; POP sequence of 'retf 4' is as 4529 <1> ;; "eip, cs, eflags, esp, ss, +4 bytes" 4530 <1> ;; it is not as "eip, cs, +4 bytes, esp, ss" ! 4531 <1> ; 4532 <1> ;; 29/05/2016 -set carry flag on stack- 4533 <1> ;or byte [esp+8], 1 ; set carry bit of eflags register 4534 <1> ;;iretd 4535 <1> ;jmp short int33h_7 ; 07/01/2017 4536 <1> 4537 <1> ;; 11/04/2021 4538 <1> ;int13h: ; 21/02/2015 4539 <1> ; clc ; 11/04/2021 4540 <1> ; pushfd 4541 <1> ; push cs 4542 <1> ; call DISK_IO 4543 <1> ; retn 4544 <1> 4545 <1> int13h: 4546 <1> ; 13/07/2022 - TRDOS 386 v2.0.5 4547 <1> ; Note: DISK_IO sets registers on stack 4548 <1> ; as return parameters. So, 4549 <1> ; stack order (at the entry of 'DISK_IO') 4550 <1> ; must be same with 'int33h:' as above. 4551 <1> 4552 <1> ;push es ; not necessary 4553 <1> ;push ds ; not necessary 4554 <1> ; 4555 <1> ; following pushes are necessary 4556 <1> ; for setting registers -return values- in DISK_IO 4557 0000500F 53 <1> push ebx 4558 00005010 51 <1> push ecx 4559 00005011 52 <1> push edx 4560 00005012 56 <1> push esi 4561 00005013 57 <1> push edi 4562 <1> ;push ebp 4563 <1> ;mov ebp, esp 4564 <1> ; edi = ebp+4 4565 <1> ; esi = ebp+8 4566 <1> ; edx = ebp+12 4567 <1> ; ecx = ebp+16 4568 <1> ; ebx = ebp+20 4569 <1> ; 4570 00005014 E806000000 <1> call DISK_IO 4571 <1> ; 4572 00005019 5F <1> pop edi 4573 0000501A 5E <1> pop esi 4574 0000501B 5A <1> pop edx 4575 0000501C 59 <1> pop ecx 4576 0000501D 5B <1> pop ebx 4577 <1> ; 4578 <1> ;pop ds 4579 <1> ;pop es 4580 <1> ; 4581 0000501E C3 <1> retn 4582 <1> 4583 <1> ; 10/08/2022 4584 <1> ; 07/08/2022 4585 <1> ; 17/07/2022 4586 <1> ; 13/07/2022 - TRDOS 386 v2.0.5 4587 <1> ; 18/04/2021 - TRDOS 386 v2.0.4 4588 <1> ; 11/04/2021 - TRDOS 386 v2.0.3 4589 <1> ; 30/08/2020 4590 <1> ; 09/12/2017 4591 <1> ; 29/05/2016 4592 <1> ; 27/05/2016 - TRDOS 386 (TRDOS v2.0) 4593 <1> 4594 <1> DISK_IO: 4595 <1> ; 10/08/2022 4596 <1> ; 17/07/2022 4597 <1> ; 13/07/2022 4598 <1> ; Registers are also on stack 4599 <1> ; (with same contents) 4600 <1> ; in following order: 4601 <1> ; 4602 <1> ; ebx = esp+20 4603 <1> ; ecx = esp+16 4604 <1> ; edx = esp+12 4605 <1> ; esi = esp+8 4606 <1> ; edi = esp+4 4607 <1> 4608 <1> ; cs = KCODE (== KDATA base address) 4609 <1> ; ss = KDATA 4610 <1> ; ds = KDATA 4611 <1> ; es = KDATA 4612 <1> 4613 <1> ; 17/07/2022 4614 0000501F FB <1> sti ; ENABLE INTERRUPTS 4615 <1> 4616 00005020 80FA80 <1> cmp dl, 80h ; TEST FOR FIXED DISK DRIVE 4617 <1> ;jae short A1 ; YES, HANDLE HERE 4618 <1> ;;;int 40h ; DISKETTE HANDLER 4619 <1> ;;call int40h 4620 <1> ;jb DISKETTE_IO_1 4621 <1> ;RET_2: 4622 <1> ;;retf 2 ; BACK TO CALLER 4623 <1> ;retf 4 4624 <1> ; 11/04/2021 4625 00005023 7305 <1> jnb short A1 4626 00005025 E934F2FFFF <1> jmp DISKETTE_IO_1 4627 <1> A1: 4628 <1> ;sti ; 17/07/2022 ; ENABLE INTERRUPTS 4629 <1> 4630 <1> ;; 04/01/2015 4631 <1> ;;or ah, ah 4632 <1> ;;jnz short A2 4633 <1> ;;int 40h ; RESET NEC WHEN AH=0 4634 <1> ;;sub ah, ah 4635 <1> 4636 0000502A 80FA83 <1> cmp dl, (80h + S_MAX_FILE - 1) 4637 <1> ;ja short RET_2 4638 0000502D 760A <1> jna short _A0 4639 <1> 4640 <1> ; 13/07/2022 4641 <1> ; (here, DS is KDATA segment already) 4642 <1> ; 4643 <1> ; 29/05/2016 4644 <1> ;push ds 4645 <1> ; 11/04/2021 4646 <1> ;push eax 4647 <1> ;mov ax, KDATA 4648 <1> ;mov ds, ax 4649 <1> ; 11/04/2021 4650 <1> ;pop eax 4651 <1> 4652 0000502F B4AA <1> mov ah, 0AAh ; Hard disk drive not ready ! 4653 <1> ; (Programmer's guide to AMIBIOS, 1992) 4654 00005031 8825[47770100] <1> mov byte [DISK_STATUS1], ah 4655 <1> ; 13/07/2022 4656 <1> ;pop ds 4657 <1> ;jmp short RET_2 4658 00005037 F9 <1> stc 4659 00005038 C3 <1> retn 4660 <1> _A0: 4661 <1> ; 18/01/2015 4662 00005039 08E4 <1> or ah, ah 4663 0000503B 742C <1> jz short A4 4664 0000503D 80FC0D <1> cmp ah, 0Dh ; Alternate reset 4665 00005040 7504 <1> jne short A2 4666 00005042 28E4 <1> sub ah, ah ; Reset 4667 00005044 EB23 <1> jmp short A4 4668 <1> A2: 4669 <1> ; 13/07/2022 4670 00005046 80FC08 <1> cmp ah, 08h ; GET PARAMETERS IS A SPECIAL CASE 4671 00005049 7505 <1> jne short A3 4672 0000504B E911040000 <1> jmp GET_PARM_N 4673 <1> A3: 4674 <1> ; 13/07/2022 4675 00005050 80FC15 <1> cmp ah, 15h ; READ DASD TYPE IS ALSO 4676 00005053 7514 <1> jne short A4 4677 00005055 E9AC030000 <1> jmp READ_DASD_TYPE ; Return Drive Type 4678 <1> ; (Programmer's guide to AMIBIOS, 1992) 4679 <1> ; 13/07/2022 4680 <1> int33h_bad_cmd: 4681 <1> ; 16/05/2016 4682 <1> ; 30/01/2015 4683 <1> ; 29/05/2016 4684 <1> ;push ds 4685 <1> ;push eax 4686 <1> ;mov ax, KDATA 4687 <1> ;mov ds, ax 4688 <1> ;pop eax 4689 <1> 4690 0000505A B401 <1> mov ah, BAD_CMD 4691 0000505C 8825[47770100] <1> mov [DISK_STATUS1], ah ; BAD_CMD ; COMMAND ERROR 4692 <1> ;jmp short RET_2 4693 <1> ; 13/07/2022 4694 <1> ;RET_2: 4695 <1> ; (*) 29/05/2016 4696 <1> ; (*) retf 4 4697 <1> ;or byte [esp+8], 1 ; set carry bit of eflags register 4698 <1> ;iretd 4699 <1> 4700 <1> ; 13/07/2022 4701 00005062 F9 <1> stc 4702 <1> ; cf = 1, ah = BAD_CMD 4703 00005063 C3 <1> retn 4704 <1> _A4: 4705 <1> ; 13/07/2022 4706 <1> ; 02/02/2015 4707 00005064 80FC1D <1> cmp ah, 1Dh ; (Temporary for Retro UNIX 386 v1) 4708 <1> ; 12/01/2015 4709 <1> ;cmc 4710 <1> ;jnc short A4 4711 <1> ; 13/07/2022 4712 00005067 73F1 <1> jnb short int33h_bad_cmd 4713 <1> A4: ; SAVE REGISTERS DURING OPERATION 4714 00005069 C8080000 <1> enter 8, 0 ; SAVE (BP) AND MAKE ROOM FOR @CMD_BLOCK 4715 <1> 4716 <1> ; 13/07/2022 4717 <1> ; ENTER 8, 0 4718 <1> ;;push ebp 4719 <1> ;;mov ebp, esp 4720 <1> ;;sub esp, 8 4721 <1> ; 4722 <1> ;push ebx ; IN THE STACK, THE COMMAND BLOCK IS: 4723 <1> ;push ecx ; @CMD_BLOCK == BYTE PTR [BP]-8 4724 <1> ;push edx 4725 <1> ;push esi 4726 <1> ;push edi 4727 <1> 4728 <1> ; 13/07/2022 4729 <1> ; edi = ebp+8 4730 <1> ; esi = ebp+12 4731 <1> ; edx = ebp+16 4732 <1> ; ecx = ebp+20 4733 <1> ; ebx = ebp+24 4734 <1> 4735 <1> ;;04/01/2015 4736 <1> ;;or ah, ah ; CHECK FOR RESET 4737 <1> ;;jnz short A5 4738 <1> ;;mov dl, 80h ; FORCE DRIVE 80 FOR RESET 4739 <1> ;;A5: 4740 <1> ; 13/07/2022 4741 0000506D E880000000 <1> call DISK_IO_CONT ; PERFORM THE OPERATION 4742 <1> ;;call DDS ; ESTABLISH SEGMENT 4743 00005072 8A25[47770100] <1> mov ah, [DISK_STATUS1] ; GET STATUS FROM OPERATION 4744 <1> ;(*) cmp ah, 1 ; SET THE CARRY FLAG TO INDICATE 4745 <1> ; SUCCESS OR FAILURE 4746 <1> ;pop edi ; RESTORE REGISTERS 4747 <1> ;pop esi 4748 <1> ;pop edx 4749 <1> ;pop ecx 4750 <1> ;pop ebx 4751 <1> 4752 00005078 C9 <1> leave ; ADJUST (SP) AND RESTORE (BP) 4753 <1> 4754 <1> ;retf 2 ; THROW AWAY SAVED FLAGS 4755 <1> ; (*) 29/05/2016 4756 <1> ; (*) retf 4 4757 <1> 4758 <1> ; 13/07/2022 4759 00005079 80FC01 <1> cmp ah, 1 4760 <1> ;jc short _A5 4761 <1> ;or byte [esp+8], 1 ; set carry bit of eflags register 4762 <1> ;_A5: 4763 <1> ;iretd 4764 <1> ; 10/08/2022 4765 0000507C F5 <1> cmc 4766 <1> ; 13/07/2022 4767 0000507D C3 <1> retn 4768 <1> 4769 <1> ; 21/02/2015 4770 <1> ; dw --> dd 4771 <1> ; 13/07/2022 4772 <1> D1: ; FUNCTION TRANSFER TABLE 4773 0000507E [95520000] <1> dd DISK_RESET ; 00h 4774 00005082 [F5520000] <1> dd RETURN_STATUS ; 01h 4775 00005086 [08530000] <1> dd DISK_READ ; 02h 4776 0000508A [64530000] <1> dd DISK_WRITE ; 03h 4777 0000508E [EE530000] <1> dd DISK_VERF ; 04h 4778 00005092 [D8530000] <1> dd FMT_TRK ; 05h 4779 00005096 [2B520000] <1> dd BAD_COMMAND ; 06h FORMAT BAD SECTORS 4780 0000509A [2B520000] <1> dd BAD_COMMAND ; 07h FORMAT DRIVE 4781 0000509E [2B520000] <1> dd BAD_COMMAND ; 08h RETURN PARAMETERS 4782 000050A2 [E1540000] <1> dd INIT_DRV ; 09h 4783 000050A6 [02530000] <1> dd RD_LONG ; 0Ah 4784 000050AA [5E530000] <1> dd WR_LONG ; 0Bh 4785 000050AE [52550000] <1> dd DISK_SEEK ; 0Ch 4786 000050B2 [95520000] <1> dd DISK_RESET ; 0Dh 4787 000050B6 [2B520000] <1> dd BAD_COMMAND ; 0Eh READ BUFFER 4788 000050BA [2B520000] <1> dd BAD_COMMAND ; 0Fh WRITE BUFFER 4789 000050BE [7A550000] <1> dd TST_RDY ; 10h 4790 000050C2 [AE550000] <1> dd HDISK_RECAL ; 11h 4791 000050C6 [2B520000] <1> dd BAD_COMMAND ; 12h MEMORY DIAGNOSTIC 4792 000050CA [2B520000] <1> dd BAD_COMMAND ; 13h DRIVE DIAGNOSTIC 4793 000050CE [E4550000] <1> dd CTLR_DIAGNOSTIC ; 14h CONTROLLER DIAGNOSTIC 4794 <1> ;; 02/02/2015 (Temporary - Retro UNIX 386 v1 - DISK I/O test) 4795 000050D2 [2B520000] <1> dd BAD_COMMAND ; 15h 4796 000050D6 [2B520000] <1> dd BAD_COMMAND ; 16h 4797 000050DA [2B520000] <1> dd BAD_COMMAND ; 17h 4798 000050DE [2B520000] <1> dd BAD_COMMAND ; 18h 4799 000050E2 [2B520000] <1> dd BAD_COMMAND ; 19h 4800 000050E6 [2B520000] <1> dd BAD_COMMAND ; 1Ah 4801 000050EA [08530000] <1> dd DISK_READ ; 1Bh ; LBA read 4802 000050EE [64530000] <1> dd DISK_WRITE ; 1Ch ; LBA write 4803 <1> D1L EQU $ - D1 4804 <1> 4805 <1> ; 02/12/2023 4806 <1> ; 01/12/2023 - TRDOS 386 v2.0.7 4807 <1> ; 07/08/2022 4808 <1> ; 17/07/2022 - TRDOS 386 v2.0.5 4809 <1> DISK_IO_CONT: 4810 <1> ;;call DDS ; ESTABLISH SEGMENT 4811 <1> ; 11/04/2021 4812 000050F2 80FC01 <1> cmp ah, 01h ; RETURN STATUS 4813 000050F5 7505 <1> jne short SU0 4814 000050F7 E9F9010000 <1> jmp RETURN_STATUS 4815 <1> SU0: 4816 000050FC C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 ; RESET THE STATUS INDICATOR 4817 <1> ; 13/07/2022 4818 00005103 89DE <1> mov esi, ebx ; 21/02/2015 ; SAVE DATA ADDRESS 4819 00005105 8A1D[48770100] <1> mov bl, [HF_NUM] ; GET NUMBER OF DRIVES 4820 0000510B 80E27F <1> and dl, 7Fh ; GET DRIVE AS 0 OR 1 4821 <1> ; (get drive number as 0 to 3) 4822 <1> ; 14/02/2015 4823 0000510E 38D3 <1> cmp bl, dl 4824 <1> ;jbe short BAD_COMMAND ; INVALID DRIVE 4825 <1> ; 07/08/2022 4826 00005110 7705 <1> ja short SU0X 4827 00005112 E914010000 <1> jmp BAD_COMMAND 4828 <1> SU0X: 4829 <1> ;;03/01/2015 4830 00005117 29DB <1> sub ebx, ebx 4831 00005119 88D3 <1> mov bl, dl 4832 0000511B 883D[5C770100] <1> mov [LBAMode], bh ; 0 4833 <1> 4834 <1> ;test byte [ebx+hd0_type], 1 ; LBA ready ? 4835 <1> ;jz short su1 ; no 4836 <1> ;inc byte [LBAMode] 4837 <1> ;su1: 4838 <1> ; 11/04/2021 (32 bit push/pop) 4839 <1> ; 21/02/2015 (32 bit modification) 4840 <1> ; 04/01/2015 4841 00005121 50 <1> push eax ; *** 4842 <1> ;push es ; ** 4843 00005122 52 <1> push edx ; * 4844 00005123 50 <1> push eax ; **** 4845 00005124 E8AA060000 <1> call GET_VEC ; GET DISK PARAMETERS 4846 <1> ; 02/02/2015 4847 <1> ;mov ax, [ES:BX+16] ; I/O port base address (1F0h, 170h) 4848 00005129 668B4310 <1> mov ax, [ebx+16] 4849 0000512D 66A3[7E660000] <1> mov [HF_PORT], ax 4850 <1> ;mov dx, [ES:BX+18] ; control port address (3F6h, 376h) 4851 00005133 668B5312 <1> mov dx, [ebx+18] 4852 00005137 668915[80660000] <1> mov [HF_REG_PORT], dx 4853 <1> ;mov al, [ES:BX+20] ; head register upper nibble (A0h,B0h,E0h,F0h) 4854 0000513E 8A4314 <1> mov al, [ebx+20] 4855 <1> ; 23/02/2015 4856 00005141 A840 <1> test al, 40h ; LBA bit (bit 6) 4857 00005143 7406 <1> jz short su1 4858 00005145 FE05[5C770100] <1> inc byte [LBAMode] ; 1 4859 <1> su1: 4860 0000514B C0E804 <1> shr al, 4 4861 0000514E 2401 <1> and al, 1 4862 00005150 A2[82660000] <1> mov [hf_m_s], al 4863 <1> ; 4864 <1> ; 03/01/2015 4865 <1> ;mov al, [ES:BX+8] ; GET CONTROL BYTE MODIFIER 4866 00005155 8A4308 <1> mov al, [ebx+8] 4867 <1> ;mov dx, [HF_REG_PORT] ; Device Control register 4868 00005158 EE <1> out dx, al ; SET EXTRA HEAD OPTION 4869 <1> ; -here- 4870 <1> ; Control Byte: (= 08h) 4871 <1> ; bit 0 - 0 4872 <1> ; bit 1 - nIEN (1 = disable irq) 4873 <1> ; bit 2 - SRST (software RESET) 4874 <1> ; bit 3 - use extra heads (8 to 15) 4875 <1> ; -always set to 1- 4876 <1> ; (bits 3 to 7 are reserved 4877 <1> ; for ATA devices) 4878 00005159 8A25[49770100] <1> mov ah, [CONTROL_BYTE] ; SET EXTRA HEAD OPTION IN 4879 0000515F 80E4C0 <1> and ah, 0C0h ; CONTROL BYTE 4880 00005162 08C4 <1> or ah, al 4881 00005164 8825[49770100] <1> mov [CONTROL_BYTE], ah 4882 <1> 4883 <1> ; 11/04/2021 (32 bit push/pop) 4884 <1> ; 04/01/2015 4885 0000516A 58 <1> pop eax ; **** 4886 0000516B 5A <1> pop edx ; * ; 14/02/2015 4887 0000516C 20E4 <1> and ah, ah ; Reset function ? 4888 0000516E 7506 <1> jnz short su2 4889 <1> ;pop es ; ** 4890 00005170 58 <1> pop eax ; *** 4891 00005171 E91F010000 <1> jmp DISK_RESET 4892 <1> su2: 4893 00005176 803D[5C770100]00 <1> cmp byte [LBAMode], 0 4894 0000517D 765E <1> jna short su3 4895 <1> ; 4896 <1> ; 02/02/2015 (LBA read/write function calls) 4897 0000517F 80FC1B <1> cmp ah, 1Bh 4898 00005182 720A <1> jb short lbarw1 4899 00005184 80FC1C <1> cmp ah, 1Ch 4900 00005187 7759 <1> ja short invldfnc 4901 <1> ;;pop edx ; * ; 14/02/2015 4902 <1> ;mov ax, cx ; Lower word of LBA address (bits 0-15) 4903 <1> 4904 <1> ; 01/12/2023 (48 bit LBA rw) 4905 00005189 E9AD000000 <1> jmp lba_read_write 4906 <1> 4907 <1> lbarw1: 4908 <1> ; convert CHS to LBA 4909 <1> ; 4910 <1> ; LBA calculation - AWARD BIOS - 1999 - AHDSK.ASM 4911 <1> ; LBA = "# of Heads" * Sectors/Track * Cylinder + Head * Sectors/Track 4912 <1> ; + Sector - 1 4913 <1> ; 11/04/2021 (32 bit push/pop) 4914 0000518E 52 <1> push edx ; * ;; 14/02/2015 4915 <1> ;xor dh, dh 4916 0000518F 31D2 <1> xor edx, edx 4917 <1> ;mov dl, [ES:BX+14] ; sectors per track (logical) 4918 00005191 8A530E <1> mov dl, [ebx+14] 4919 <1> ;xor ah, ah 4920 00005194 31C0 <1> xor eax, eax 4921 <1> ;mov al, [ES:BX+2] ; heads (logical) 4922 00005196 8A4302 <1> mov al, [ebx+2] 4923 00005199 FEC8 <1> dec al 4924 0000519B 6640 <1> inc ax ; 0 = 256 4925 0000519D 66F7E2 <1> mul dx 4926 <1> ; AX = # of Heads * Sectors/Track 4927 000051A0 6689CA <1> mov dx, cx 4928 <1> ;and cx, 3Fh ; sector (1 to 63) 4929 000051A3 83E13F <1> and ecx, 3Fh 4930 000051A6 86D6 <1> xchg dl, dh 4931 000051A8 C0EE06 <1> shr dh, 6 4932 <1> ; DX = cylinder (0 to 1023) 4933 <1> ;mul dx 4934 <1> ; DX:AX = # of Heads" * Sectors/Track * Cylinder 4935 000051AB F7E2 <1> mul edx 4936 000051AD FEC9 <1> dec cl ; sector - 1 4937 <1> ;add ax, cx 4938 <1> ;adc dx, 0 4939 <1> ; DX:AX = # of Heads" * Sectors/Track * Cylinder + Sector - 1 4940 000051AF 01C8 <1> add eax, ecx 4941 <1> ; 11/04/2021 (32 bit push/pop) 4942 000051B1 59 <1> pop ecx ; * ; ch = head, cl = drive number (zero based) 4943 <1> ;push dx 4944 <1> ;push ax 4945 000051B2 50 <1> push eax 4946 <1> ; 13/07/2022 4947 000051B3 29C0 <1> sub eax, eax 4948 <1> ;mov al, [ES:BX+14] ; sectors per track (logical) 4949 000051B5 8A430E <1> mov al, [ebx+14] 4950 000051B8 F6E5 <1> mul ch 4951 <1> ; AX = Head * Sectors/Track 4952 <1> ; 13/07/2022 4953 <1> ;movzx eax, ax ; 09/12/2017 4954 <1> ;pop dx 4955 000051BA 5A <1> pop edx 4956 <1> ;add ax, dx 4957 <1> ;pop dx 4958 <1> ;adc dx, 0 ; add carry bit 4959 000051BB 01D0 <1> add eax, edx 4960 <1> lbarw2: 4961 000051BD 29D2 <1> sub edx, edx ; 21/02/2015 4962 000051BF 88CA <1> mov dl, cl ; 21/02/2015 4963 000051C1 C645F800 <1> mov byte [CMD_BLOCK], 0 ; Features Register 4964 <1> ; NOTE: Features register (1F1h, 171h) 4965 <1> ; is not used for ATA device R/W functions. 4966 <1> ; It is old/obsolete 'write precompensation' 4967 <1> ; register and error register 4968 <1> ; for old ATA/IDE devices. 4969 <1> ; 18/01/2014 4970 <1> ;mov ch, [hf_m_s] ; Drive 0 (master) or 1 (slave) 4971 000051C5 8A0D[82660000] <1> mov cl, [hf_m_s] 4972 <1> ;shl ch, 4 ; bit 4 (drive bit) 4973 <1> ;or ch, 0E0h ; bit 5 = 1 4974 <1> ; bit 6 = 1 = LBA mode 4975 <1> ; bit 7 = 1 4976 000051CB 80C90E <1> or cl, 0Eh ; 1110b 4977 <1> ;and dh, 0Fh ; LBA byte 4 (bits 24 to 27) 4978 000051CE 25FFFFFF0F <1> and eax, 0FFFFFFFh 4979 000051D3 C1E11C <1> shl ecx, 28 ; 21/02/2015 4980 <1> ;or dh, ch 4981 000051D6 09C8 <1> or eax, ecx 4982 <1> ;;mov [CMD_BLOCK+2], al ; LBA byte 1 (bits 0 to 7) 4983 <1> ; (Sector Number Register) 4984 <1> ;;mov [CMD_BLOCK+3], ah ; LBA byte 2 (bits 8 to 15) 4985 <1> ; (Cylinder Low Register) 4986 <1> ;mov [CMD_BLOCK+2], ax ; LBA byte 1, 2 4987 <1> ;mov [CMD_BLOCK+4], dl ; LBA byte 3 (bits 16 to 23) 4988 <1> ; (Cylinder High Register) 4989 <1> ;;mov [CMD_BLOCK+5], dh ; LBA byte 4 (bits 24 to 27) 4990 <1> ; (Drive/Head Register) 4991 <1> 4992 <1> ;mov [CMD_BLOCK+4], dx ; LBA byte 4, LBA & DEV select bits 4993 000051D8 8945FA <1> mov [CMD_BLOCK+2], eax ; 21/02/2015 4994 <1> ; 14/02/2015 4995 <1> ;mov dl, cl ; Drive number (INIT_DRV) 4996 000051DB EB36 <1> jmp short su4 4997 <1> su3: 4998 <1> ; 07/08/2022 4999 <1> ; 13/07/2022 5000 <1> ; 02/02/2015 5001 <1> ; (1Bh & 1Ch functions are not valid for CHS mode) 5002 000051DD 80FC14 <1> cmp ah, 14h 5003 000051E0 7603 <1> jna short chsfnc 5004 <1> invldfnc: 5005 <1> ; 14/02/2015 5006 <1> ;pop es ; ** 5007 <1> ; 11/04/2021 5008 000051E2 58 <1> pop eax ; *** 5009 000051E3 EB46 <1> jmp short BAD_COMMAND 5010 <1> chsfnc: 5011 <1> ;mov ax, [ES:BX+5] ; GET WRITE PRE-COMPENSATION CYLINDER 5012 000051E5 668B4305 <1> mov ax, [ebx+5] 5013 <1> ;shr ax, 2 5014 <1> ; 07/08/2022 5015 000051E9 C1E802 <1> shr eax, 2 5016 000051EC 8845F8 <1> mov [CMD_BLOCK], al 5017 <1> 5018 <1> ;;mov al, [ES:BX+8] ; GET CONTROL BYTE MODIFIER 5019 <1> ;;push edx ; * 5020 <1> ;;mov dx, [HF_REG_PORT] 5021 <1> ;;out dx, al ; SET EXTRA HEAD OPTION 5022 <1> ;;pop edx ; * 5023 <1> ;;pop es ; ** 5024 <1> ;;mov ah, [CONTROL_BYTE] ; SET EXTRA HEAD OPTION IN 5025 <1> ;;and ah, 0C0h ; CONTROL BYTE 5026 <1> ;;or ah, al 5027 <1> ;;mov [CONTROL_BYTE], ah 5028 <1> 5029 000051EF 88C8 <1> mov al, cl ; GET SECTOR NUMBER 5030 000051F1 243F <1> and al, 3Fh 5031 000051F3 8845FA <1> mov [CMD_BLOCK+2], al 5032 000051F6 886DFB <1> mov [CMD_BLOCK+3], ch ; GET CYLINDER NUMBER 5033 000051F9 88C8 <1> mov al, cl 5034 000051FB C0E806 <1> shr al, 6 5035 000051FE 8845FC <1> mov [CMD_BLOCK+4], al ; CYLINDER HIGH ORDER 2 BITS 5036 <1> 5037 <1> ;;05/01/2015 5038 <1> ;;mov al, dl ; DRIVE NUMBER 5039 00005201 A0[82660000] <1> mov al, [hf_m_s] 5040 00005206 C0E004 <1> shl al, 4 5041 00005209 80E60F <1> and dh, 0Fh ; HEAD NUMBER 5042 0000520C 08F0 <1> or al, dh 5043 <1> ;or al, 80h or 20h 5044 0000520E 0CA0 <1> or al, 80h+20h ; ECC AND 512 BYTE SECTORS 5045 00005210 8845FD <1> mov [CMD_BLOCK+5], al ; ECC/SIZE/DRIVE/HEAD 5046 <1> su4: 5047 <1> ;pop es ; ** 5048 <1> ;; 14/02/2015 5049 <1> ;;pop ax 5050 <1> ;;mov [CMD_BLOCK+1], al ; SECTOR COUNT 5051 <1> ;;push ax 5052 <1> ;;mov al, ah ; GET INTO LOW BYTE 5053 <1> ;;xor ah, ah ; ZERO HIGH BYTE 5054 <1> ;;sal ax, 1 ; *2 FOR TABLE LOOKUP 5055 <1> ; 11/04/2021 5056 00005213 58 <1> pop eax ; *** 5057 00005214 8845F9 <1> mov [CMD_BLOCK+1], al 5058 00005217 29DB <1> sub ebx, ebx 5059 <1> ;xor bh, bh 5060 00005219 88E3 <1> mov bl, ah 5061 <1> ;sal bx, 1 5062 <1> ; 17/07/2022 5063 0000521B C1E302 <1> sal ebx, 2 ; 32 bit offset (21/02/2015) 5064 <1> ;mov si, ax ; PUT INTO SI FOR BRANCH 5065 <1> ; 13/07/2022 5066 <1> ;cmp bx, D1L ; TEST WITHIN RANGE 5067 <1> ;jnb short BAD_COMMAND_POP 5068 0000521E 83FB74 <1> cmp ebx, D1L ; TEST WITHIN RANGE 5069 00005221 7308 <1> jnb short BAD_COMMAND 5070 <1> ;xchg bx, si 5071 00005223 87DE <1> xchg ebx, esi 5072 <1> ;;;pop ax ; RESTORE AX 5073 <1> ;;;pop bx ; AND DATA ADDRESS 5074 <1> 5075 <1> ;;push cx 5076 <1> ;;push ax ; ADJUST ES:BX 5077 <1> ;mov cx, bx ; GET 3 HIGH ORDER NIBBLES OF BX 5078 <1> ;shr cx, 4 5079 <1> ;mov ax, es 5080 <1> ;add ax, cx 5081 <1> ;mov es, ax 5082 <1> ;and bx, 000Fh ; ES:BX CHANGED TO ES:000X 5083 <1> ;;pop ax 5084 <1> ;;pop cx 5085 <1> ;;jmp word [CS:SI+D1] 5086 <1> ;jmp word [SI+D1] 5087 <1> 5088 00005225 FFA6[7E500000] <1> jmp dword [esi+D1] 5089 <1> 5090 <1> ; 07/08/2022 5091 <1> ; 13/07/2022 5092 <1> BAD_COMMAND: 5093 0000522B C605[47770100]01 <1> mov byte [DISK_STATUS1], BAD_CMD ; COMMAND ERROR 5094 00005232 B000 <1> mov al, 0 5095 00005234 C3 <1> retn 5096 <1> 5097 <1> ; ----------------------------------------------------- 5098 <1> ; 48 bit LBA read/write 5099 <1> ; ----------------------------------------------------- 5100 <1> 5101 <1> su10: ; 01/12/2023 ; 28 bit LBA r/w 5102 00005235 89C8 <1> mov eax, ecx ; LBA address (21/02/2015) 5103 <1> ; 13/07/2022 5104 00005237 88D1 <1> mov cl, dl ; 14/02/2015 5105 00005239 EB82 <1> jmp short lbarw2 5106 <1> 5107 <1> lba_read_write: 5108 <1> ; 02/12/2023 5109 <1> ; 01/12/2023 - TRDOS 386 v2.0.7 (48 bit LBA rw) 5110 0000523B 81F9FFFFFF0F <1> cmp ecx, 0FFFFFFFh 5111 00005241 731B <1> jnb short su6 5112 <1> ;movzx eax, byte [esp] ; *** 5113 00005243 31C0 <1> xor eax, eax 5114 00005245 8A0424 <1> mov al, [esp] ; *** ; sector count 5115 00005248 01C8 <1> add eax, ecx 5116 0000524A 730B <1> jnc short su5 5117 0000524C C605[47770100]17 <1> mov byte [DISK_STATUS1], ERR_INV_PARAMETER 5118 <1> ;jmp short su7 5119 <1> ; 20/06/2024 5120 00005253 58 <1> pop eax ; *** 5121 00005254 B000 <1> mov al, 0 5122 00005256 C3 <1> retn 5123 <1> su5: 5124 00005257 3DFFFFFF0F <1> cmp eax, 0FFFFFFFh ; 28 bit limit 5125 0000525C 76D7 <1> jna short su10 5126 <1> su6: 5127 <1> 5128 <1> ; 20/06/2024 (TRDOS 386 v2.0.8) 5129 <1> %if 0 5130 <1> ; 48 bit LBA r/w 5131 <1> mov al, [hf_m_s] ; (+!+) ; 02/12/2023 5132 <1> shl al, 4 5133 <1> ; 02/12/2023 5134 <1> ;add al, 0E0h 5135 <1> add al, 40h 5136 <1> ;;add al, 0Eh 5137 <1> ;add al, 04h 5138 <1> ;shl al, 4 5139 <1> mov dx, [HF_PORT] 5140 <1> add dl, 6 ; hd base port + 6 5141 <1> out dx, al 5142 <1> ; 02/12/2023 5143 <1> mov [CMD_BLOCK+6], al 5144 <1> inc edx ; hd base port + 7 5145 <1> in al, dx 5146 <1> NEWIODELAY 5147 <1> ;test al, 128 ; READY ? 5148 <1> and al, 128 5149 <1> jz short su8 5150 <1> in al, dx 5151 <1> ;test al, 128 5152 <1> and al, 128 5153 <1> jz short su8 5154 <1> mov byte [DISK_STATUS1], TIME_OUT 5155 <1> su7: 5156 <1> pop eax ; *** 5157 <1> mov al, 0 5158 <1> retn 5159 <1> su8: 5160 <1> ;mov dx, [HF_PORT] 5161 <1> ;inc edx 5162 <1> ;inc edx ; hd base port + 2 5163 <1> sub dl, 5 ; hd base port + 2 5164 <1> ;xor al, al 5165 <1> out dx, al ; sector count hb (bits 8 to 15) = 0 5166 <1> inc edx ; hd base port + 3 5167 <1> mov eax, ecx ; LBA disk sector address 5168 <1> rol eax, 8 5169 <1> out dx, al ; LBA byte 4 (bits 24 to 31) 5170 <1> inc edx ; hd base port + 4 5171 <1> xor al, al 5172 <1> out dx, al ; LBA byte 5 (bits 32 to 39) = 0 5173 <1> inc edx ; hd base port + 5 5174 <1> ;sub al, al 5175 <1> out dx, al ; LBA byte 6 (bits 40 to 47) = 0 5176 <1> 5177 <1> mov al, [esp] ; *** 5178 <1> ; 02/12/2023 5179 <1> mov [CMD_BLOCK+1], al 5180 <1> 5181 <1> sub dl, 3 ; hd base port + 2 5182 <1> out dx, al ; sector count lb (bits 0 to 7) 5183 <1> inc edx ; hd base port + 3 5184 <1> mov eax, ecx ; LBA disk sector address 5185 <1> out dx, al ; LBA byte 1 (bits 0 to 7) 5186 <1> inc edx ; hd base port + 4 5187 <1> shr eax, 8 5188 <1> out dx, al ; LBA byte 2 (bits 8 to 15) 5189 <1> inc edx ; hd base port + 5 5190 <1> shr eax, 8 5191 <1> out dx, al ; LBA byte 3 (bits 16 to 23) 5192 <1> 5193 <1> inc edx ; hd base port + 6 5194 <1> 5195 <1> ; 02/12/2023 (not necessary) (+!+) 5196 <1> ;mov al, [hf_m_s] 5197 <1> ;shl al, 4 5198 <1> ;add al, 40h 5199 <1> ;out dx, al 5200 <1> 5201 <1> pop eax ; *** 5202 <1> 5203 <1> inc edx ; dx = hd base port + 7 5204 <1> ; command/status port 5205 <1> ;xchg esi, ebx 5206 <1> ;mov edi, ebx 5207 <1> mov edi, esi ; sector buffer 5208 <1> cmp ah, 1Ch 5209 <1> jne short su9 5210 <1> mov al, 34h ; WRITE SECTOR(S) EXT 5211 <1> out dx, al 5212 <1> jmp CMD_WX 5213 <1> su9: 5214 <1> mov al, 24h ; READ SECTOR(S) EXT 5215 <1> out dx, al 5216 <1> jmp CMD_RX 5217 <1> %else 5218 <1> ; 20/06/2024 5219 0000525E 58 <1> pop eax ; *** 5220 0000525F C645F800 <1> mov byte [CMD_BLOCK], 0 5221 00005263 8845F9 <1> mov [CMD_BLOCK+1], al ; sector count to r/w 5222 00005266 894DFA <1> mov [CMD_BLOCK+2], ecx ; LBA disk sector address 5223 <1> 5224 <1> ;;; 5225 <1> ; 23/06/2024 5226 00005269 C605[5C770100]FF <1> mov byte [LBAMode], 0FFh 5227 <1> ; 5228 00005270 A0[82660000] <1> mov al, [hf_m_s] 5229 00005275 C0E004 <1> shl al, 4 5230 <1> ;add al, 40h 5231 00005278 0C40 <1> or al, 40h 5232 <1> ; al = 40h (for master), 50h (for slave) 5233 0000527A A2[82660000] <1> mov [hf_m_s], al 5234 <1> ;;; 5235 <1> 5236 0000527F 80FC1C <1> cmp ah, 1Ch 5237 00005282 7509 <1> jne short su7 5238 <1> ; AH = 1Ch ; TRDOS 386 v2 - INT 33h - LBA WRITE 5239 <1> ; esi = sector buffer 5240 <1> ; 48 bit LBA write 5241 00005284 C645FE34 <1> mov byte [CMD_BLOCK+6], 34h ; WRITE SECTOR(S) EXT 5242 00005288 E9DD000000 <1> jmp CMD_WX 5243 <1> su7: 5244 <1> ; AH = 1Bh ; TRDOS 386 v2 - INT 33h - LBA READ 5245 0000528D 89F7 <1> mov edi, esi ; sector buffer 5246 <1> ; 48 bit LBA read 5247 0000528F C645FE24 <1> mov byte [CMD_BLOCK+6], 24h ; READ SECTOR(S) EXT 5248 00005293 EB79 <1> jmp CMD_RX 5249 <1> 5250 <1> %endif 5251 <1> 5252 <1> ; ----------------------------------------------------- 5253 <1> 5254 <1> ; 09/08/2022 5255 <1> ; 07/08/2022 5256 <1> ; 17/07/2022 5257 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5258 <1> ; 10/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 5259 <1> 5260 <1> ;---------------------------------------- 5261 <1> ; RESET THE DISK SYSTEM (AH=00H) : 5262 <1> ;---------------------------------------- 5263 <1> 5264 <1> ; 18-1-2015 : one controller reset (not other one) 5265 <1> 5266 <1> DISK_RESET: 5267 00005295 FA <1> cli 5268 00005296 E4A1 <1> in al, INTB01 ; GET THE MASK REGISTER 5269 <1> ;jmp $+2 5270 <1> IODELAY 78 00005298 EB00 <2> jmp short $+2 79 0000529A EB00 <2> jmp short $+2 5271 <1> ;and al, 0BFh ; ENABLE FIXED DISK INTERRUPT 5272 0000529C 243F <1> and al, 3Fh ; 22/12/2014 (IRQ 14 & IRQ 15) 5273 0000529E E6A1 <1> out INTB01, al 5274 000052A0 FB <1> sti ; START INTERRUPTS 5275 <1> ; 14/02/2015 5276 <1> ;mov di, dx 5277 <1> ; 24/12/2021 5278 000052A1 89D7 <1> mov edi, edx 5279 <1> ; 04/01/2015 5280 <1> ;xor di,di 5281 <1> drst0: 5282 000052A3 B004 <1> mov al, 04h ; bit 2 - SRST 5283 <1> ;mov dx, HF_REG_PORT 5284 000052A5 668B15[80660000] <1> mov dx, [HF_REG_PORT] 5285 000052AC EE <1> out dx, al ; RESET 5286 <1> ; mov cx, 10 ; DELAY COUNT 5287 <1> ;DRD: dec cx 5288 <1> ; jnz short DRD ; WAIT 4.8 MICRO-SEC 5289 <1> ;mov cx, 2 ; wait for 30 micro seconds 5290 <1> ;mov ecx, 2 ; 21/02/2015 5291 <1> ; 10/07/2022 5292 000052AD 29C9 <1> sub ecx, ecx 5293 000052AF B102 <1> mov cl, 2 5294 000052B1 E86FD1FFFF <1> call WAITF ; (Award Bios 1999 - WAIT_REFRESH, 5295 <1> ; 40 micro seconds) 5296 000052B6 A0[49770100] <1> mov al, [CONTROL_BYTE] 5297 000052BB 240F <1> and al, 0Fh ; SET HEAD OPTION 5298 000052BD EE <1> out dx, al ; TURN RESET OFF 5299 000052BE E85B040000 <1> call NOT_BUSY 5300 000052C3 7514 <1> jnz short DRERR ; TIME OUT ON RESET 5301 000052C5 668B15[7E660000] <1> mov dx, [HF_PORT] 5302 000052CC FEC2 <1> inc dl ; HF_PORT+1 5303 <1> ; 02/01/2015 - Award BIOS 1999 - AHDSK.ASM 5304 <1> ;mov cl, 10 5305 <1> ;mov ecx, 10 ; 21/02/2015 5306 <1> ; 17/07/2022 5307 <1> ;xor ecx, ecx 5308 000052CE B10A <1> mov cl, 10 5309 <1> drst1: 5310 000052D0 EC <1> in al, dx ; GET RESET STATUS 5311 000052D1 3C01 <1> cmp al, 1 5312 <1> ; 04/01/2015 5313 000052D3 740C <1> jz short drst2 5314 <1> ;jnz short DRERR ; BAD RESET STATUS 5315 <1> ; Drive/Head Register - bit 4 5316 <1> ;loop drst1 5317 <1> ; 17/07/2022 5318 000052D5 FEC9 <1> dec cl 5319 000052D7 75F7 <1> jnz short drst1 5320 <1> DRERR: 5321 000052D9 C605[47770100]05 <1> mov byte [DISK_STATUS1], BAD_RESET ; CARD FAILED 5322 000052E0 C3 <1> retn 5323 <1> drst2: 5324 <1> ; 14/02/2015 5325 <1> ;mov dx, di 5326 <1> ; 07/08/2022 5327 000052E1 89FA <1> mov edx, edi 5328 <1> ;drst3: 5329 <1> ; ; 05/01/2015 5330 <1> ; shl di, 1 5331 <1> ; ; 04/01/2015 5332 <1> ; mov ax, [di+hd_cports] 5333 <1> ; cmp ax, [HF_REG_PORT] 5334 <1> ; je short drst4 5335 <1> ; mov [HF_REG_PORT], ax 5336 <1> ; ; 03/01/2015 5337 <1> ; mov ax, [di+hd_ports] 5338 <1> ; mov [HF_PORT], ax 5339 <1> ; ; 05/01/2014 5340 <1> ; shr di, 1 5341 <1> ; ; 04/01/2015 5342 <1> ; jmp short drst0 ; reset other controller 5343 <1> ;drst4: 5344 <1> ; ; 05/01/2015 5345 <1> ; shr di, 1 5346 <1> ; mov al, [di+hd_dregs] 5347 <1> ; and al, 10h ; bit 4 only 5348 <1> ; shr al, 4 ; bit 4 -> bit 0 5349 <1> ; mov [hf_m_s], al ; (0 = master, 1 = slave) 5350 <1> ; 5351 <1> ; 09/08/2022 5352 <1> ; (('INIT_DRV' prodedure sets [CMD_BLOCKS+5] value)) 5353 <1> ; 5354 <1> ; mov al, [hf_m_s] ; 18/01/2015 5355 <1> ; test al, 1 5356 <1> ; ;jnz short drst6 5357 <1> ; jnz short drst4 5358 <1> ; and byte [CMD_BLOCK+5], 0EFh ; SET TO DRIVE 0 5359 <1> ;drst5: 5360 <1> drst3: 5361 000052E3 E8F9010000 <1> call INIT_DRV ; SET MAX HEADS 5362 <1> ;mov dx, di 5363 000052E8 E8C1020000 <1> call HDISK_RECAL ; RECAL TO RESET SEEK SPEED 5364 <1> ; 04/01/2014 5365 <1> ; inc di 5366 <1> ; mov dx, di 5367 <1> ; cmp dl, [HF_NUM] 5368 <1> ; jb short drst3 5369 <1> ;DRE: 5370 000052ED C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 ; IGNORE ANY SET UP ERRORS 5371 000052F4 C3 <1> retn 5372 <1> ;drst6: 5373 <1> drst4: ; Drive/Head Register - bit 4 5374 <1> ; or byte [CMD_BLOCK+5], 010h ; SET TO DRIVE 1 5375 <1> ; ;jmp short drst5 5376 <1> ; jmp short drst3 5377 <1> 5378 <1> ;---------------------------------------- 5379 <1> ; DISK STATUS ROUTINE (AH = 01H) : 5380 <1> ;---------------------------------------- 5381 <1> 5382 <1> RETURN_STATUS: 5383 000052F5 A0[47770100] <1> mov al, [DISK_STATUS1] ; OBTAIN PREVIOUS STATUS 5384 000052FA C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 ; RESET STATUS 5385 00005301 C3 <1> retn 5386 <1> 5387 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5388 <1> 5389 <1> ;---------------------------------------- 5390 <1> ; READ LONG (AH = 0AH) : 5391 <1> ;---------------------------------------- 5392 <1> 5393 <1> RD_LONG: 5394 <1> ;mov @CMD_BLOCK+6, READ_CMD OR ECC_MODE 5395 00005302 C645FE22 <1> mov byte [CMD_BLOCK+6], READ_CMD + ECC_MODE 5396 00005306 EB04 <1> jmp short COMMANDI 5397 <1> 5398 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5399 <1> 5400 <1> ;---------------------------------------- 5401 <1> ; DISK READ ROUTINE (AH = 02H) : 5402 <1> ;---------------------------------------- 5403 <1> 5404 <1> DISK_READ: 5405 00005308 C645FE20 <1> mov byte [CMD_BLOCK+6], READ_CMD 5406 <1> ;jmp COMMANDI 5407 <1> 5408 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5409 <1> 5410 <1> ;---------------------------------------- 5411 <1> ; COMMANDI : 5412 <1> ; REPEATEDLY INPUTS DATA TILL : 5413 <1> ; NSECTOR RETURNS ZERO : 5414 <1> ;---------------------------------------- 5415 <1> COMMANDI: 5416 <1> ; 16/07/2022 5417 <1> ; (check 64K boundary is not needed) 5418 <1> ;call CHECK_DMA ; CHECK 64K BOUNDARY ERROR 5419 <1> ;jc short CMD_ABORT 5420 <1> 5421 <1> ;mov di, bx 5422 0000530C 89DF <1> mov edi, ebx ; 21/02/2015 5423 <1> CMD_RX: 5424 <1> ; 20/06/2024 (48 bit LBA r/w modification) 5425 0000530E E821030000 <1> call COMMAND ; OUTPUT COMMAND 5426 00005313 7548 <1> jnz short CMD_ABORT 5427 <1> ;CMD_RX: ; 01/12/2023 (48 bit LBA read) 5428 <1> CMD_I1: 5429 00005315 E8D4030000 <1> call _WAIT ; WAIT FOR DATA REQUEST INTERRUPT 5430 0000531A 7541 <1> jnz short TM_OUT ; TIME OUT 5431 <1> cmd_i1x: 5432 <1> ; 18/02/2016 5433 <1> ;;mov cx, 256 ; SECTOR SIZE IN WORDS 5434 <1> ;mov ecx, 256 ; 21/02/2015 5435 <1> ; 16/07/2022 5436 0000531C 29C9 <1> sub ecx, ecx 5437 0000531E FEC5 <1> inc ch ; ecx = 256 5438 <1> ;mov dh, HF_PORT 5439 00005320 668B15[7E660000] <1> mov dx, [HF_PORT] 5440 00005327 FA <1> cli 5441 00005328 FC <1> cld 5442 00005329 66F36D <1> rep insw ; GET THE SECTOR 5443 0000532C FB <1> sti 5444 <1> 5445 0000532D F645FE02 <1> test byte [CMD_BLOCK+6], ECC_MODE ; CHECK FOR NORMAL INPUT 5446 00005331 7418 <1> jz short CMD_I3 5447 00005333 E80D040000 <1> call WAIT_DRQ ; WAIT FOR DATA REQUEST 5448 00005338 7223 <1> jc short TM_OUT 5449 <1> ;mov dx, HF_PORT 5450 0000533A 668B15[7E660000] <1> mov dx, [HF_PORT] 5451 <1> ;;mov cx, 4 ; GET ECC BYTES 5452 <1> ;mov ecx, 4 ; mov cx, 4 5453 <1> ; 16/07/2022 5454 00005341 31C9 <1> xor ecx, ecx 5455 00005343 B104 <1> mov cl, 4 5456 <1> CMD_I2: 5457 00005345 EC <1> in al, dx 5458 00005346 8807 <1> mov [edi], al ; 21/02/2015 ; GO SLOW FOR BOARD 5459 00005348 47 <1> inc edi 5460 00005349 E2FA <1> loop CMD_I2 5461 <1> CMD_I3: 5462 <1> ; wait for 400 ns 5463 0000534B 80C207 <1> add dl, 7 5464 0000534E EC <1> in al, dx 5465 0000534F EC <1> in al, dx 5466 00005350 EC <1> in al, dx 5467 <1> ; 5468 00005351 E8E4010000 <1> call CHECK_STATUS 5469 00005356 7505 <1> jnz short CMD_ABORT ; ERROR RETURNED 5470 00005358 FE4DF9 <1> dec byte [CMD_BLOCK+1] ; CHECK FOR MORE 5471 <1> ;jnz short CMD_I1 5472 0000535B 75BF <1> jnz short cmd_i1x ; 18/02/2016 5473 <1> CMD_ABORT: 5474 <1> TM_OUT: 5475 0000535D C3 <1> retn 5476 <1> 5477 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5478 <1> 5479 <1> ;---------------------------------------- 5480 <1> ; WRITE LONG (AH = 0BH) : 5481 <1> ;---------------------------------------- 5482 <1> 5483 <1> WR_LONG: 5484 <1> ;mov @CMD_BLOCK+6, WRITE_CMD OR ECC_MODE 5485 0000535E C645FE32 <1> mov byte [CMD_BLOCK+6], WRITE_CMD + ECC_MODE 5486 00005362 EB04 <1> jmp short COMMANDO 5487 <1> 5488 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5489 <1> 5490 <1> ;---------------------------------------- 5491 <1> ; DISK WRITE ROUTINE (AH = 03H) : 5492 <1> ;---------------------------------------- 5493 <1> 5494 <1> DISK_WRITE: 5495 00005364 C645FE30 <1> mov byte [CMD_BLOCK+6], WRITE_CMD 5496 <1> ;jmp COMMANDO 5497 <1> 5498 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5499 <1> 5500 <1> ;---------------------------------------- 5501 <1> ; COMMANDO : 5502 <1> ; REPEATEDLY OUTPUTS DATA TILL : 5503 <1> ; NSECTOR RETURNS ZERO : 5504 <1> ;---------------------------------------- 5505 <1> COMMANDO: 5506 <1> ; 16/07/2022 5507 <1> ; (check 64K boundary is not needed) 5508 <1> ;call CHECK_DMA ; CHECK 64K BOUNDARY ERROR 5509 <1> ;jc short CMD_ABORT 5510 <1> CMD_OF: 5511 00005368 89DE <1> mov esi, ebx ; 21/02/2015 5512 <1> CMD_WX: 5513 <1> ; 20/06/2024 (48 bit LBA r/w modification) 5514 0000536A E8C5020000 <1> call COMMAND ; OUTPUT COMMAND 5515 0000536F 75EC <1> jnz short CMD_ABORT 5516 <1> ;CMD_WX: ; 01/12/2023 (48 bit LBA write) 5517 00005371 E8CF030000 <1> call WAIT_DRQ ; WAIT FOR DATA REQUEST 5518 00005376 72E5 <1> jc short TM_OUT ; TOO LONG 5519 <1> CMD_O1: 5520 <1> ; 16/07/2022 5521 00005378 668B15[7E660000] <1> mov dx, [HF_PORT] 5522 <1> 5523 <1> ;mov ecx, 256 ; 21/02/2015 5524 0000537F 31C9 <1> xor ecx, ecx 5525 00005381 FEC5 <1> inc ch 5526 <1> ; ecx = 256 5527 00005383 FA <1> cli 5528 00005384 FC <1> cld 5529 <1> ;rep outsw 5530 <1> ; 01/12/2023 - TRDOS 386 v2.0.7 5531 <1> CMD_01_L: 5532 00005385 666F <1> outsw 5533 00005387 EB00 <1> jmp $+2 5534 00005389 E2FA <1> loop CMD_01_L 5535 <1> 5536 0000538B FB <1> sti 5537 <1> 5538 0000538C F645FE02 <1> test byte [CMD_BLOCK+6], ECC_MODE ; CHECK FOR NORMAL OUTPUT 5539 00005390 7418 <1> jz short CMD_O3 5540 00005392 E8AE030000 <1> call WAIT_DRQ ; WAIT FOR DATA REQUEST 5541 00005397 72C4 <1> jc short TM_OUT 5542 <1> ;mov dx, HF_PORT 5543 00005399 668B15[7E660000] <1> mov dx, [HF_PORT] 5544 <1> ; OUTPUT THE ECC BYTES 5545 <1> ;mov ecx, 4 ; mov cx, 4 5546 <1> ; 16/07/2022 5547 000053A0 29C9 <1> sub ecx, ecx 5548 000053A2 B104 <1> mov cl, 4 5549 <1> CMD_O2: 5550 000053A4 8A06 <1> mov al, [esi] 5551 000053A6 EE <1> out dx, al 5552 000053A7 46 <1> inc esi 5553 000053A8 E2FA <1> loop CMD_O2 5554 <1> CMD_O3: 5555 000053AA E83F030000 <1> call _WAIT ; WAIT FOR SECTOR COMPLETE INTERRUPT 5556 000053AF 75AC <1> jnz short TM_OUT ; ERROR RETURNED 5557 000053B1 E884010000 <1> call CHECK_STATUS 5558 000053B6 75A5 <1> jnz short CMD_ABORT 5559 000053B8 F605[41770100]08 <1> test byte [HF_STATUS], ST_DRQ ; CHECK FOR MORE 5560 000053BF 75B7 <1> jnz short CMD_O1 5561 <1> ;mov dx, HF_PORT+2 ; CHECK RESIDUAL SECTOR COUNT 5562 000053C1 668B15[7E660000] <1> mov dx, [HF_PORT] 5563 000053C8 80C202 <1> add dl, 2 5564 <1> ;inc dl 5565 <1> ;inc dl 5566 000053CB EC <1> in al, dx ; 5567 000053CC A8FF <1> test al, 0FFh ; 5568 000053CE 7407 <1> jz short CMD_O4 ; COUNT = 0 OK 5569 000053D0 C605[47770100]BB <1> mov byte [DISK_STATUS1], UNDEF_ERR 5570 <1> ; OPERATION ABORTED - PARTIAL TRANSFER 5571 <1> CMD_O4: 5572 000053D7 C3 <1> retn 5573 <1> 5574 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5575 <1> 5576 <1> ;---------------------------------------- 5577 <1> ; FORMATTING (AH = 05H) : 5578 <1> ;---------------------------------------- 5579 <1> 5580 <1> FMT_TRK: ; FORMAT TRACK (AH = 005H) 5581 000053D8 C645FE50 <1> mov byte [CMD_BLOCK+6], FMTTRK_CMD 5582 <1> ;push es 5583 <1> ;push bx 5584 000053DC 53 <1> push ebx 5585 000053DD E8F1030000 <1> call GET_VEC ; GET DISK PARAMETERS ADDRESS 5586 <1> ;mov al, [ES:BX+14] ; GET SECTORS/TRACK 5587 000053E2 8A430E <1> mov al, [ebx+14] 5588 000053E5 8845F9 <1> mov [CMD_BLOCK+1], al ; SET SECTOR COUNT IN COMMAND 5589 000053E8 5B <1> pop ebx 5590 <1> ;pop bx 5591 <1> ;pop es 5592 <1> ;jmp short CMD_OF ; GO EXECUTE THE COMMAND 5593 <1> ; 01/12/2023 5594 000053E9 E97AFFFFFF <1> jmp CMD_OF 5595 <1> 5596 <1> ;---------------------------------------- 5597 <1> ; DISK VERIFY (AH = 04H) : 5598 <1> ;---------------------------------------- 5599 <1> 5600 <1> DISK_VERF: 5601 000053EE C645FE40 <1> mov byte [CMD_BLOCK+6], VERIFY_CMD 5602 000053F2 E83D020000 <1> call COMMAND 5603 000053F7 750C <1> jnz short VERF_EXIT ; CONTROLLER STILL BUSY 5604 000053F9 E8F0020000 <1> call _WAIT ; (Original: CALL WAIT) 5605 000053FE 7505 <1> jnz short VERF_EXIT ; TIME OUT 5606 00005400 E835010000 <1> call CHECK_STATUS 5607 <1> VERF_EXIT: 5608 00005405 C3 <1> retn 5609 <1> 5610 <1> ;---------------------------------------- 5611 <1> ; READ DASD TYPE (AH = 15H) : 5612 <1> ;---------------------------------------- 5613 <1> 5614 <1> RETURN_DRIVE_TYPE: 5615 <1> ; 10/08/2022 5616 <1> ; 13/07/2022 5617 <1> ; (Ref: Programmer's Guide to the AMIBIOS -Page 214-, 1992) 5618 <1> ; 5619 <1> ; INPUT: 5620 <1> ; DL = Disk number (>= 80h) 5621 <1> ; TRDOS 386 v2.0.5 Feature: 5622 <1> ; If AL = 0FFh, return disk size in ECX 5623 <1> ; otherwise in CX:DX 5624 <1> ; OUTPUT: 5625 <1> ; AH = 00h - No drive present 5626 <1> ; = 03h - Hard disk drive 5627 <1> ; CF = 0 - No error 5628 <1> ; = 1 - Error 5629 <1> ; TRDOS 386 v2.0.5 Feature: 5630 <1> ; AL = 00h - LBA not ready ! 5631 <1> ; = 01h - LBA ready 5632 <1> ; (28 bit or 48 bit LBA r/w depending 5633 <1> ; on disk size in CX:DX) 5634 <1> ; CX:DX = Number of 512 byte sectors 5635 <1> ; 5636 <1> ; (Note: High words of ECX and EDX will be zero at return) 5637 <1> ; ((If AL input is 0FFh, disk size will be in ECX only)) 5638 <1> 5639 <1> READ_DASD_TYPE: 5640 <1> READ_D_T: ; GET DRIVE PARAMETERS 5641 <1> ;push ds ; SAVE REGISTERS 5642 <1> 5643 <1> ;;push es 5644 <1> ; 18/04/2021 5645 <1> ;push ebx 5646 <1> ;;call DDS ; ESTABLISH ADDRESSING 5647 <1> ;;push cs 5648 <1> ;;pop ds 5649 <1> 5650 <1> ; 18/04/2021 5651 <1> ;mov bx, KDATA 5652 <1> ;mov ds, bx 5653 <1> ;;mov es, bx 5654 <1> ;mov byte [DISK_STATUS1], 0 5655 <1> ;mov bl, [HF_NUM] ; GET NUMBER OF DRIVES 5656 <1> ;and dl, 7Fh ; GET DRIVE NUMBER 5657 <1> ;cmp bl, dl 5658 <1> ;jbe short RDT_NOT_PRESENT ; RETURN DRIVE NOT PRESENT 5659 <1> 5660 <1> ;mov ax, KDATA 5661 <1> ;mov ds, ax 5662 <1> 5663 00005406 C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 5664 0000540D 8A0D[48770100] <1> mov cl, [HF_NUM] 5665 00005413 80E27F <1> and dl, 7Fh 5666 00005416 38D1 <1> cmp cl, dl 5667 00005418 7631 <1> jbe short RDT_NOT_PRESENT 5668 <1> 5669 <1> ; 18/04/2021 - TRDOS 386 v2.0.4 5670 <1> 5671 <1> ;call GET_VEC ; GET DISK PARAMETER ADDRESS 5672 <1> ; 5673 <1> ;;mov al, [ES:BX+2] ; HEADS 5674 <1> ;mov al, [ebx+2] ; heads (logical) 5675 <1> ;;;mov cl, [ES:BX+14] 5676 <1> ;;mov cl, [ebx+14] 5677 <1> ;; 17/04/2021 5678 <1> ;mov ah, [ebx+14] ; sectors per track (logical) 5679 <1> ;;imul cl ; * NUMBER OF SECTORS 5680 <1> ;;mov cx, [ES:BX] ; MAX NUMBER OF CYLINDERS 5681 <1> ;mov cx, [ebx] ; cylinders (logical) 5682 <1> ;; 02/01/2015 5683 <1> ;; ** leave the last cylinder as reserved for diagnostics ** 5684 <1> ;; (Also in Award BIOS - 1999, AHDSK.ASM, FUN15 -> sub ax, 1) 5685 <1> ;dec cx ; LEAVE ONE FOR DIAGNOSTICS 5686 <1> ;;imul cx ; NUMBER OF SECTORS 5687 <1> ;; 17/04/2021 5688 <1> ;mul ah 5689 <1> ;; ax = spt*heads 5690 <1> ;mul cx 5691 <1> ;; dx:ax = number of sectors 5692 <1> ; 5693 <1> ;mov cx, dx ; HIGH ORDER HALF 5694 <1> ;mov dx, ax ; LOW ORDER HALF 5695 <1> 5696 <1> ; 18/04/2021 5697 0000541A B102 <1> mov cl, 2 5698 0000541C 00CA <1> add dl, cl ; hd0 = 2 5699 <1> 5700 <1> ; 13/07/2022 5701 0000541E 0FB6D2 <1> movzx edx, dl 5702 00005421 8A9A[AE660000] <1> mov bl, [edx+drv.status] 5703 00005427 80E301 <1> and bl, 1 ; LBA ready bit (bit 0) 5704 <1> 5705 0000542A D2E2 <1> shl dl, cl ; * 4 5706 <1> 5707 <1> ;mov eax, [edx+drv.size] 5708 <1> ;mov dx, ax 5709 <1> ;shr eax, 16 5710 <1> ;mov cx, ax 5711 <1> 5712 0000542C 8B8A[92660000] <1> mov ecx, [edx+drv.size] 5713 <1> 5714 <1> ; 13/07/2022 5715 <1> ;cmp al, 0FFh ; return disk size in ecx ? 5716 <1> ;je short RDT1 ; yes 5717 00005432 FEC0 <1> inc al ; 0FFh -> 0 5718 00005434 740A <1> jz short RDT1 5719 <1> 5720 00005436 6689CA <1> mov dx, cx 5721 00005439 C1E910 <1> shr ecx, 16 5722 <1> 5723 <1> ; 13/07/2022 5724 <1> ; ebx = esp+20 5725 <1> ; ecx = esp+16 5726 <1> ; edx = esp+12 5727 <1> ; esi = esp+8 5728 <1> ; edi = esp+4 5729 <1> 5730 <1> ; return disk size in user's registers 5731 0000543C 8954240C <1> mov [esp+12], edx 5732 <1> ; cx:dx = disk size 5733 <1> RDT1: 5734 <1> ;mov [esp+16], ecx 5735 <1> 5736 <1> ;;sub al, al 5737 00005440 29C0 <1> sub eax, eax 5738 00005442 B403 <1> mov ah, 03h ; INDICATE FIXED DISK 5739 00005444 88D8 <1> mov al, bl 5740 <1> ; al = 1 -> LBA r/w ready/applicable 5741 <1> ; = 0 -> LBA r/w not ready/applicable 5742 <1> ; cf = 0 5743 <1> RDT2: 5744 00005446 894C2410 <1> mov [esp+16], ecx 5745 <1> ;RDT2: 5746 <1> ; 13/07/2022 5747 <1> ; 18/04/2021 5748 <1> ;pop ebx ; RESTORE REGISTERS 5749 <1> ;;pop es 5750 <1> ;pop ds 5751 <1> ; (*) clc ; CLEAR CARRY 5752 <1> ;retf 2 5753 <1> ; (*) 29/05/2016 5754 <1> ; (*) retf 4 5755 <1> ;and byte [esp+8], 0FEh ; clear carry bit of eflags register 5756 <1> ;iretd 5757 <1> 5758 <1> ; 13/07/2022 5759 <1> ; [DISK_STATUS1] = 0 5760 <1> ; ah = 3 5761 <1> ; al = 0 or 1 (LBA ready) 5762 <1> ; cf = 0 5763 <1> 5764 0000544A C3 <1> retn 5765 <1> 5766 <1> RDT_NOT_PRESENT: 5767 <1> ;;sub ax, ax ; DRIVE NOT PRESENT RETURN 5768 <1> ;; 18/04/2021 5769 <1> ;sub eax, eax 5770 <1> ;;mov cx, ax ; ZERO BLOCK COUNT 5771 <1> ;;mov dx, ax 5772 <1> ;mov ecx, eax 5773 <1> ;mov edx, eax 5774 <1> ;jmp short RDT2 5775 <1> ; 13/07/2022 5776 0000544B 29C9 <1> sub ecx, ecx 5777 0000544D 88C1 <1> mov cl, al ; if AL = 0FFh, disk size will be in ECX 5778 <1> ; if not, disk size will be in CX:DX 5779 0000544F 29C0 <1> sub eax, eax 5780 00005451 FEC1 <1> inc cl ; 0FFh -> 0 5781 00005453 80F901 <1> cmp cl, 1 5782 00005456 72EE <1> jb short RDT2 ; ecx = 0 5783 <1> ; 10/08/2022 5784 00005458 28C9 <1> sub cl, cl 5785 <1> ; ecx = 0 5786 0000545A 8944240C <1> mov [esp+12], eax ; edx = 0 5787 0000545E F9 <1> stc 5788 0000545F EBE5 <1> jmp short RDT2 ; cf = 1, eax = 0 5789 <1> 5790 <1> ; 10/08/2022 5791 <1> ; 07/08/2022 5792 <1> ; 13/07/2022 - TRDOS 386 v2.0.5 5793 <1> ; 28/05/2016 5794 <1> ; 27/05/2016 - TRDOS 386 (TRDOS v2.0) 5795 <1> 5796 <1> ;---------------------------------------- 5797 <1> ; GET PARAMETERS (AH = 08H) : 5798 <1> ;---------------------------------------- 5799 <1> 5800 <1> GET_PARM_N: 5801 <1> ; ebx = user's buffer address for parameters table 5802 <1> ; 10/08/2022 5803 <1> ; 13/07/2022 5804 <1> ; (if ebx = 0, HDPT will not be returned to user) 5805 <1> ; 5806 <1> ;GET_PARM: ; GET DRIVE PARAMETERS 5807 <1> ;push ds ; SAVE REGISTERS 5808 <1> ;push es 5809 <1> 5810 <1> ;push ebx 5811 00005461 89DF <1> mov edi, ebx ; 13/07/2022 5812 <1> 5813 <1> ; 13/07/2022 5814 <1> ; ((IBM PC XT-286 ROM BIOS source code remainders)) 5815 <1> ;;mov ax, ABS0 ; ESTABLISH ADDRESSING 5816 <1> ;;mov ds, ax 5817 <1> 5818 <1> ;;test dl, 1 ; CHECK FOR DRIVE 1 5819 <1> ;;jz short G0 5820 <1> ;;les bx, @HF1_TBL_VEC 5821 <1> ;;jmp short G1 5822 <1> ;;G0: 5823 <1> ;les bx, @HF_TBL_VEC 5824 <1> ;;G1: 5825 <1> ;;call DDS ; ESTABLISH SEGMENT 5826 <1> 5827 <1> ; 13/07/2022 5828 <1> ; 22/12/2014 5829 <1> ;;push cs 5830 <1> ;;pop ds 5831 <1> ;mov bx, KDATA 5832 <1> ;mov ds, bx 5833 <1> ;mov es, bx ; 27/05/2016 5834 <1> ; 5835 <1> ; 18/04/2021 5836 00005463 29C9 <1> sub ecx, ecx 5837 <1> ; 5838 00005465 80EA80 <1> sub dl, 80h 5839 00005468 80FA04 <1> cmp dl, MAX_FILE ; TEST WITHIN RANGE 5840 0000546B 7344 <1> jae short G2 ; 13/07/2022 5841 <1> ; 5842 <1> ; 21/02/2015 5843 0000546D 31DB <1> xor ebx, ebx 5844 <1> ; 18/04/2021 5845 <1> ;sub ecx, ecx 5846 <1> ; 22/12/2014 5847 0000546F 88D3 <1> mov bl, dl 5848 <1> ;xor bh, bh 5849 00005471 C0E302 <1> shl bl, 2 ; convert index to offset 5850 <1> ;add bx, HF_TBL_VEC 5851 00005474 81C3[4C770100] <1> add ebx, HF_TBL_VEC 5852 <1> ;mov ax, [bx+2] 5853 <1> ;mov es, ax ; dpt segment 5854 <1> ;mov bx, [bx] ; dpt offset 5855 0000547A 8B1B <1> mov ebx, [ebx] ; 32 bit offset 5856 <1> ; 18/04/2021 5857 0000547C 29D2 <1> sub edx, edx 5858 0000547E 8815[47770100] <1> mov [DISK_STATUS1], dl ; 0 5859 <1> 5860 <1> ;mov byte [DISK_STATUS1], 0 5861 <1> ;mov ax, [ES:BX] ; MAX NUMBER OF CYLINDERS 5862 00005484 668B03 <1> mov ax, [ebx] 5863 <1> ;;sub ax, 2 ; ADJUST FOR 0-N 5864 00005487 6648 <1> dec ax ; max. cylinder number 5865 00005489 88C5 <1> mov ch, al 5866 0000548B 66250003 <1> and ax, 0300h ; HIGH TWO BITS OF CYLINDER 5867 <1> ;shr ax, 1 5868 <1> ;shr ax, 1 5869 <1> ; 13/07/2022 5870 <1> ;shr ax, 2 5871 <1> ; 07/08/2022 5872 0000548F C1E802 <1> shr eax, 2 5873 <1> ;or al, [ES:BX+14] ; SECTORS 5874 00005492 0A430E <1> or al, [ebx+14] 5875 00005495 88C1 <1> mov cl, al 5876 <1> ;mov dh, [ES:BX+2] ; HEADS 5877 00005497 8A7302 <1> mov dh, [ebx+2] 5878 0000549A FECE <1> dec dh ; 0-N RANGE 5879 0000549C 8A15[48770100] <1> mov dl, [HF_NUM] ; DRIVE COUNT 5880 <1> ;;sub ax, ax 5881 <1> ; 18/04/2021 5882 <1> ;sub eax, eax 5883 <1> 5884 <1> ; 27/12/2014 5885 <1> ;mov di, bx ; HDPT offset 5886 <1> 5887 <1> ; 13/07/2022 5888 <1> ; ebx = esp+20 5889 <1> ; ecx = esp+16 5890 <1> ; edx = esp+12 5891 <1> ; esi = esp+8 5892 <1> ; edi = esp+4 5893 <1> 5894 <1> ; 13/07/2022 5895 <1> ; set return register contents/values 5896 000054A2 894C2410 <1> mov [esp+16], ecx 5897 000054A6 8954240C <1> mov [esp+12], edx 5898 <1> 5899 <1> ; is hard disk parameters table requested ? 5900 000054AA 09FF <1> or edi, edi ; (edi = [ebp+24] = ebx) 5901 000054AC 751B <1> jnz short G3 ; yes 5902 <1> 5903 000054AE 29C0 <1> sub eax, eax 5904 <1> 5905 <1> ; [DISK_STATUS1] = 0 5906 <1> ; eax = 0 5907 <1> ; cf = 0 5908 <1> 5909 000054B0 C3 <1> retn 5910 <1> 5911 <1> G2: 5912 <1> ;mov ah, INIT_FAIL 5913 <1> ;mov byte [DISK_STATUS1], ah ; (INIT_FAIL) 5914 <1> ; ; OPERATION FAILED 5915 <1> ;sub al, al 5916 <1> ;sub dx, dx 5917 <1> ;sub cx, cx 5918 <1> ; 18/04/2021 5919 000054B1 29C0 <1> sub eax, eax 5920 000054B3 B407 <1> mov ah, INIT_FAIL 5921 000054B5 8825[47770100] <1> mov [DISK_STATUS1], ah ; OPERATION FAILED 5922 <1> 5923 <1> ; 13/07/2022 5924 <1> ;sub edx, edx 5925 <1> ;sub ecx, ecx 5926 <1> ; ecx = 0 5927 000054BB 894C240C <1> mov [esp+12], ecx ; 0 ; edx (heads-1, drive count) 5928 000054BF 894C2410 <1> mov [esp+16], ecx ; 0 ; ecx (cylinders-1, sectors) 5929 000054C3 894C2414 <1> mov [esp+20], ecx ; 0 ; ebx (HDPT address) 5930 <1> 5931 000054C7 F9 <1> stc 5932 000054C8 C3 <1> retn 5933 <1> 5934 <1> ; 13/07/2022 5935 <1> ; 29/05/2016 (*) 5936 <1> ;;stc ; SET ERROR FLAG 5937 <1> ;;jmp short G5 5938 <1> ;jmp short _G6 5939 <1> 5940 <1> G3: 5941 <1> ; 27/05/2016 5942 <1> ; return fixed disk parameters table to user 5943 <1> ; in user's buffer, which is pointed by EBX 5944 <1> 5945 <1> ;xchg edi, [esp] ; ebx (input)-> edi, edi -> [esp] 5946 <1> ; 13/07/2022 5947 <1> ;pop edi 5948 <1> ; edi = user's buffer address 5949 <1> ;push esi 5950 000054C9 89DE <1> mov esi, ebx ; hard disk parameter table (32 bytes) 5951 <1> ;mov ebx, edi ; ebx = user's buffer address 5952 000054CB 51 <1> push ecx 5953 <1> ;push eax 5954 <1> ;mov ecx, 32 ; 32 bytes 5955 000054CC 30ED <1> xor ch, ch 5956 000054CE B120 <1> mov cl, 32 5957 <1> ; ecx = 32 5958 000054D0 E846B60000 <1> call transfer_to_user_buffer ; trdosk6.s (16/05/2016) 5959 <1> ;pop eax 5960 000054D5 59 <1> pop ecx 5961 <1> ; 10/08/2022 5962 <1> ;pop esi 5963 <1> ;pop edi 5964 000054D6 7306 <1> jnc short G4 5965 <1> ; 29/05/2016 (*) 5966 000054D8 B8FF000000 <1> mov eax, 0FFh ; unknown error ! 5967 <1> ; [DISK_STATUS1] = 0 5968 <1> ; ah = 0, al = 0FFh 5969 <1> ; cf = 1 5970 <1> 5971 000054DD C3 <1> retn 5972 <1> ;_G6: 5973 <1> ;or byte [esp+16], 1 ; set carry bit of eflags register 5974 <1> ;G5: 5975 <1> ; 27/05/2016 5976 <1> ;pop ebx ; RESTORE REGISTERS 5977 <1> ;pop es 5978 <1> ;pop ds 5979 <1> ;;retf 2 5980 <1> ; (*) 29/05/2016 5981 <1> ; (*) retf 4 5982 <1> ; (*) or byte [esp+8], 1 ; set carry bit of eflags register 5983 <1> ;iretd 5984 <1> 5985 <1> G4: 5986 <1> ; 13/07/2022 5987 000054DE 31C0 <1> xor eax, eax 5988 <1> 5989 <1> ; [user_buffer] = [ebp+24] = HDPT 5990 <1> ; [DISK_STATUS1] = 0 5991 <1> ; eax = 0 5992 <1> ; cf = 0 5993 <1> 5994 000054E0 C3 <1> retn 5995 <1> 5996 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 5997 <1> 5998 <1> ;---------------------------------------- 5999 <1> ; INITIALIZE DRIVE (AH = 09H) : 6000 <1> ;---------------------------------------- 6001 <1> ; 03/01/2015 6002 <1> ; According to ATA-ATAPI specification v2.0 to v5.0 6003 <1> ; logical sector per logical track 6004 <1> ; and logical heads - 1 would be set but 6005 <1> ; it is seen as it will be good 6006 <1> ; if physical parameters will be set here 6007 <1> ; because, number of heads <= 16. 6008 <1> ; (logical heads usually more than 16) 6009 <1> ; NOTE: ATA logical parameters (software C, H, S) 6010 <1> ; == INT 13h physical parameters 6011 <1> 6012 <1> ;INIT_DRV: 6013 <1> ; mov byte [CMD_BLOCK+6], SET_PARM_CMD 6014 <1> ; call GET_VEC ; ES:BX -> PARAMETER BLOCK 6015 <1> ; mov al, [es:bx+2] ; GET NUMBER OF HEADS 6016 <1> ; dec al ; CONVERT TO 0-INDEX 6017 <1> ; mov ah, [CMD_BLOCK+5] ; GET SDH REGISTER 6018 <1> ; and ah, 0F0h ; CHANGE HEAD NUMBER 6019 <1> ; or ah, al ; TO MAX HEAD 6020 <1> ; mov [CMD_BLOCK+5], ah 6021 <1> ; mov al, [es:bx+14] ; MAX SECTOR NUMBER 6022 <1> ; mov [CMD_BLOCK+1], al 6023 <1> ; sub ax, ax 6024 <1> ; mov [CMD_BLOCK+3], al ; ZERO FLAGS 6025 <1> ; call COMMAND ; TELL CONTROLLER 6026 <1> ; jnz short INIT_EXIT ; CONTROLLER BUSY ERROR 6027 <1> ; call NOT_BUSY ; WAIT FOR IT TO BE DONE 6028 <1> ; jnz short INIT_EXIT ; TIME OUT 6029 <1> ; call CHECK_STATUS 6030 <1> ;INIT_EXIT: 6031 <1> ; retn 6032 <1> 6033 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6034 <1> 6035 <1> ; 04/01/2015 6036 <1> ; 02/01/2015 - Derived from from AWARD BIOS 1999 6037 <1> ; AHDSK.ASM - INIT_DRIVE 6038 <1> INIT_DRV: 6039 <1> ;xor ah,ah 6040 000054E1 31C0 <1> xor eax, eax ; 21/02/2015 6041 000054E3 B00B <1> mov al, 11 ; Physical heads from translated HDPT 6042 000054E5 3825[5C770100] <1> cmp [LBAMode], ah ; 0 6043 000054EB 7702 <1> ja short idrv0 6044 000054ED B002 <1> mov al, 2 ; Physical heads from standard HDPT 6045 <1> idrv0: 6046 <1> ; DL = drive number (0 based) 6047 000054EF E8DF020000 <1> call GET_VEC 6048 <1> ;push bx 6049 000054F4 53 <1> push ebx ; 21/02/2015 6050 <1> ;add bx, ax 6051 000054F5 01C3 <1> add ebx, eax 6052 <1> ;; 05/01/2015 6053 000054F7 8A25[82660000] <1> mov ah, [hf_m_s] ; drive number (0= master, 1= slave) 6054 <1> ;;and ah, 1 6055 000054FD C0E404 <1> shl ah, 4 6056 00005500 80CCA0 <1> or ah, 0A0h ; Drive/Head register - 10100000b (A0h) 6057 <1> ;mov al, [es:bx] 6058 00005503 8A03 <1> mov al, [ebx] ; 21/02/2015 6059 00005505 FEC8 <1> dec al ; last head number 6060 <1> ;and al, 0Fh 6061 00005507 08E0 <1> or al, ah ; lower 4 bits for head number 6062 <1> ; 6063 00005509 C645FE91 <1> mov byte [CMD_BLOCK+6], SET_PARM_CMD 6064 0000550D 8845FD <1> mov [CMD_BLOCK+5], al 6065 <1> ;pop bx 6066 00005510 5B <1> pop ebx 6067 00005511 29C0 <1> sub eax, eax ; 21/02/2015 6068 00005513 B004 <1> mov al, 4 ; Physical sec per track from translated HDPT 6069 00005515 803D[5C770100]00 <1> cmp byte [LBAMode], 0 6070 0000551C 7702 <1> ja short idrv1 6071 0000551E B00E <1> mov al, 14 ; Physical sec per track from standard HDPT 6072 <1> idrv1: 6073 <1> ;xor ah, ah 6074 <1> ;add bx, ax 6075 00005520 01C3 <1> add ebx, eax ; 21/02/2015 6076 <1> ;mov al, [es:bx] 6077 <1> ; sector number 6078 00005522 8A03 <1> mov al, [ebx] 6079 00005524 8845F9 <1> mov [CMD_BLOCK+1], al 6080 00005527 28C0 <1> sub al, al 6081 00005529 8845FB <1> mov [CMD_BLOCK+3], al ; ZERO FLAGS 6082 0000552C E803010000 <1> call COMMAND ; TELL CONTROLLER 6083 00005531 751E <1> jnz short INIT_EXIT ; CONTROLLER BUSY ERROR 6084 00005533 E8E6010000 <1> call NOT_BUSY ; WAIT FOR IT TO BE DONE 6085 00005538 7517 <1> jnz short INIT_EXIT ; TIME OUT 6086 <1> ; 16/07/2022 6087 <1> ;call CHECK_STATUS 6088 <1> ;jmp short CHECK_STATUS 6089 <1> ;INIT_EXIT: 6090 <1> ;retn 6091 <1> 6092 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6093 <1> ; 10/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 6094 <1> 6095 <1> ;---------------------------------------- 6096 <1> ; CHECK FIXED DISK STATUS : 6097 <1> ;---------------------------------------- 6098 <1> CHECK_STATUS: 6099 0000553A E831020000 <1> call CHECK_ST ; CHECK THE STATUS BYTE 6100 <1> ;jnz short CHECK_S1 ; AN ERROR WAS FOUND 6101 <1> ; 10/07/2022 6102 0000553F 7510 <1> jnz short CHECK_S2 6103 00005541 A801 <1> test al, ST_ERROR ; WERE THERE ANY OTHER ERRORS 6104 00005543 7405 <1> jz short CHECK_S1 ; NO ERROR REPORTED 6105 00005545 E866020000 <1> call CHECK_ER ; ERROR REPORTED 6106 <1> CHECK_S1: 6107 0000554A 803D[47770100]00 <1> cmp byte [DISK_STATUS1], 0 ; SET STATUS FOR CALLER 6108 <1> CHECK_S2: 6109 <1> INIT_EXIT: ; 10/07/2022 6110 00005551 C3 <1> retn 6111 <1> 6112 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6113 <1> 6114 <1> ;---------------------------------------- 6115 <1> ; SEEK (AH = 0CH) : 6116 <1> ;---------------------------------------- 6117 <1> 6118 <1> DISK_SEEK: 6119 00005552 C645FE70 <1> mov byte [CMD_BLOCK+6], SEEK_CMD 6120 00005556 E8D9000000 <1> call COMMAND 6121 0000555B 751C <1> jnz short DS_EXIT ; CONTROLLER BUSY ERROR 6122 0000555D E88C010000 <1> call _WAIT 6123 00005562 7515 <1> jnz short DS_EXIT ; TIME OUT ON SEEK 6124 00005564 E8D1FFFFFF <1> call CHECK_STATUS 6125 00005569 803D[47770100]40 <1> cmp byte [DISK_STATUS1], BAD_SEEK 6126 00005570 7507 <1> jne short DS_EXIT 6127 00005572 C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 6128 <1> DS_EXIT: 6129 00005579 C3 <1> retn 6130 <1> 6131 <1> ;---------------------------------------- 6132 <1> ; TEST DISK READY (AH = 10H) : 6133 <1> ;---------------------------------------- 6134 <1> 6135 <1> TST_RDY: ; WAIT FOR CONTROLLER 6136 0000557A E89F010000 <1> call NOT_BUSY 6137 0000557F 752C <1> jnz short TR_EX 6138 <1> ;;; 6139 <1> ; 23/06/2024 6140 00005581 803D[5C770100]FF <1> cmp byte [LBAMode], 0FFh 6141 00005588 7507 <1> jne short tst_28bit_rdy 6142 0000558A A0[82660000] <1> mov al, [hf_m_s] 6143 0000558F EB03 <1> jmp short tst_48bit_rdy 6144 <1> tst_28bit_rdy: 6145 <1> ;;; 6146 00005591 8A45FD <1> mov al, [CMD_BLOCK+5] ; SELECT DRIVE 6147 <1> tst_48bit_rdy: 6148 00005594 668B15[7E660000] <1> mov dx, [HF_PORT] 6149 0000559B 80C206 <1> add dl, 6 6150 0000559E EE <1> out dx, al 6151 0000559F E8CC010000 <1> call CHECK_ST ; CHECK STATUS ONLY 6152 000055A4 7507 <1> jnz short TR_EX 6153 000055A6 C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 ; WIPE OUT DATA CORRECTED ERROR 6154 <1> TR_EX: 6155 000055AD C3 <1> retn 6156 <1> 6157 <1> ;---------------------------------------- 6158 <1> ; RECALIBRATE (AH = 11H) : 6159 <1> ;---------------------------------------- 6160 <1> 6161 <1> HDISK_RECAL: 6162 000055AE C645FE10 <1> mov byte [CMD_BLOCK+6], RECAL_CMD ; 10h, 16 6163 000055B2 E87D000000 <1> call COMMAND ; START THE OPERATION 6164 000055B7 7523 <1> jnz short RECAL_EXIT ; ERROR 6165 000055B9 E830010000 <1> call _WAIT ; WAIT FOR COMPLETION 6166 000055BE 7407 <1> jz short RECAL_X ; TIME OUT ONE OK ? 6167 000055C0 E829010000 <1> call _WAIT ; WAIT FOR COMPLETION LONGER 6168 000055C5 7515 <1> jnz short RECAL_EXIT ; TIME OUT TWO TIMES IS ERROR 6169 <1> RECAL_X: 6170 000055C7 E86EFFFFFF <1> call CHECK_STATUS 6171 000055CC 803D[47770100]40 <1> cmp byte [DISK_STATUS1], BAD_SEEK ; SEEK NOT COMPLETE 6172 000055D3 7507 <1> jne short RECAL_EXIT ; IS OK 6173 000055D5 C605[47770100]00 <1> mov byte [DISK_STATUS1], 0 6174 <1> RECAL_EXIT: 6175 000055DC 803D[47770100]00 <1> cmp byte [DISK_STATUS1], 0 6176 000055E3 C3 <1> retn 6177 <1> 6178 <1> ;---------------------------------------- 6179 <1> ; CONTROLLER DIAGNOSTIC (AH = 14H) : 6180 <1> ;---------------------------------------- 6181 <1> 6182 <1> CTLR_DIAGNOSTIC: 6183 <1> ; 07/08/2022 - TRDOS 386 v2.0.5 6184 000055E4 FA <1> cli ; DISABLE INTERRUPTS WHILE CHANGING MASK 6185 000055E5 E4A1 <1> in al, INTB01 ; TURN ON SECOND INTERRUPT CHIP 6186 <1> ;and al, 0BFH 6187 000055E7 243F <1> and al, 3Fh ; enable IRQ 14 & IRQ 15 6188 <1> ;jmp $+2 6189 <1> IODELAY 78 000055E9 EB00 <2> jmp short $+2 79 000055EB EB00 <2> jmp short $+2 6190 000055ED E6A1 <1> out INTB01, al 6191 <1> IODELAY 78 000055EF EB00 <2> jmp short $+2 79 000055F1 EB00 <2> jmp short $+2 6192 000055F3 E421 <1> in al, INTA01 ; LET INTERRUPTS PASS THRU TO 6193 000055F5 24FB <1> and al, 0FBh ; SECOND CHIP 6194 <1> ;jmp $+2 6195 <1> IODELAY 78 000055F7 EB00 <2> jmp short $+2 79 000055F9 EB00 <2> jmp short $+2 6196 000055FB E621 <1> out INTA01, al 6197 000055FD FB <1> sti 6198 000055FE E81B010000 <1> call NOT_BUSY ; WAIT FOR CARD 6199 00005603 7526 <1> jnz short CD_ERR ; BAD CARD 6200 <1> ;mov dx, PORT+7 6201 00005605 668B15[7E660000] <1> mov dx, [HF_PORT] 6202 0000560C 80C207 <1> add dl, 7 6203 0000560F B090 <1> mov al, DIAG_CMD ; START DIAGNOSE 6204 00005611 EE <1> out dx, al 6205 00005612 E807010000 <1> call NOT_BUSY ; WAIT FOR IT TO COMPLETE 6206 00005617 B480 <1> mov ah, TIME_OUT 6207 00005619 7512 <1> jnz short CD_EXIT ; TIME OUT ON DIAGNOSTIC 6208 <1> ;mov dx, HF_PORT+1 ; GET ERROR REGISTER 6209 0000561B 668B15[7E660000] <1> mov dx, [HF_PORT] 6210 00005622 FEC2 <1> inc dl 6211 00005624 EC <1> in al, dx 6212 <1> ; 07/08/2022 6213 <1> ;mov [HF_ERROR], al ; SAVE IT 6214 00005625 B400 <1> mov ah, 0 6215 00005627 3C01 <1> cmp al, 1 ; CHECK FOR ALL OK 6216 00005629 7402 <1> je short CD_EXIT 6217 <1> CD_ERR: 6218 0000562B B420 <1> mov ah, BAD_CNTLR 6219 <1> CD_EXIT: 6220 0000562D 8825[47770100] <1> mov [DISK_STATUS1], ah 6221 00005633 C3 <1> retn 6222 <1> 6223 <1> ; 20/06/2024 - TRDOS 386 v2.0.8 6224 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6225 <1> ; 10/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 6226 <1> 6227 <1> ;-------------------------------------------------------- 6228 <1> ; COMMAND : 6229 <1> ; THIS ROUTINE OUTPUTS THE COMMAND BLOCK : 6230 <1> ; OUTPUT : 6231 <1> ; BL = STATUS : 6232 <1> ; BH = ERROR REGISTER : 6233 <1> ;-------------------------------------------------------- 6234 <1> 6235 <1> COMMAND: 6236 <1> ;push ebx ; 10/07/2022 ; WAIT FOR SEEK COMPLETE AND READY 6237 <1> ;;mov ecx, DELAY_2 ; SET INITIAL DELAY BEFORE TEST 6238 <1> COMMAND1: 6239 <1> ;;push ecx ; SAVE LOOP COUNT 6240 00005634 E841FFFFFF <1> call TST_RDY ; CHECK DRIVE READY 6241 <1> ;;pop ecx 6242 <1> ;pop ebx ; 10/07/2022 6243 00005639 7418 <1> jz short COMMAND2 ; DRIVE IS READY 6244 0000563B 803D[47770100]80 <1> cmp byte [DISK_STATUS1], TIME_OUT ; TST_RDY TIMED OUT--GIVE UP 6245 <1> ;jz short CMD_TIMEOUT 6246 <1> ;;loop COMMAND1 ; KEEP TRYING FOR A WHILE 6247 <1> ;jmp short COMMAND4 ; ITS NOT GOING TO GET READY 6248 00005642 7507 <1> jne short COMMAND4 6249 <1> CMD_TIMEOUT: 6250 00005644 C605[47770100]20 <1> mov byte [DISK_STATUS1], BAD_CNTLR 6251 <1> COMMAND4: 6252 <1> ;;pop ebx ; 10/07/2022 6253 0000564B 803D[47770100]00 <1> cmp byte [DISK_STATUS1], 0 ; SET CONDITION CODE FOR CALLER 6254 00005652 C3 <1> retn 6255 <1> COMMAND2: 6256 <1> ;;pop ebx ; 10/07/2022 6257 <1> ;push edi ; 10/07/2022 6258 00005653 C605[42770100]00 <1> mov byte [HF_INT_FLAG], 0 ; RESET INTERRUPT FLAG 6259 0000565A FA <1> cli ; INHIBIT INTERRUPTS WHILE CHANGING MASK 6260 0000565B E4A1 <1> in al, INTB01 ; TURN ON SECOND INTERRUPT CHIP 6261 <1> ;and al, 0BFh 6262 0000565D 243F <1> and al, 3Fh ; Enable IRQ 14 & 15 6263 <1> ;jmp $+2 6264 <1> IODELAY 78 0000565F EB00 <2> jmp short $+2 79 00005661 EB00 <2> jmp short $+2 6265 00005663 E6A1 <1> out INTB01, al 6266 00005665 E421 <1> in al, INTA01 ; LET INTERRUPTS PASS THRU TO 6267 00005667 24FB <1> and al, 0FBh ; SECOND CHIP 6268 <1> ;jmp $+2 6269 <1> IODELAY 78 00005669 EB00 <2> jmp short $+2 79 0000566B EB00 <2> jmp short $+2 6270 0000566D E621 <1> out INTA01, al 6271 0000566F FB <1> sti 6272 <1> ;xor edi, edi ; INDEX THE COMMAND TABLE 6273 <1> ; 10/07/2022 6274 00005670 31C9 <1> xor ecx, ecx 6275 <1> 6276 <1> ;mov dx, HF_PORT+1 ; DISK ADDRESS 6277 00005672 668B15[7E660000] <1> mov dx, [HF_PORT] 6278 00005679 FEC2 <1> inc dl 6279 <1> 6280 <1> ; 20/06/2024 6281 <1> ;mov al, [CMD_BLOCK+6] 6282 <1> ;cmp al, 24h ; READ SECTOR(S) EXT 6283 <1> ;je short COMMAND5 6284 <1> ;cmp al, 34h ; WRITE SECTOR(S) EXT 6285 <1> ;je short COMMAND5 6286 <1> ; 23/06/2024 6287 0000567B 803D[5C770100]FF <1> cmp byte [LBAMode], 0FFh 6288 00005682 7428 <1> je short COMMAND5 ; 48 bit LBA read/write 6289 <1> 6290 <1> ; 20/06/2024 6291 <1> ; dx = hd base port + 1 ; 1F1h or 171h 6292 <1> 6293 00005684 F605[49770100]C0 <1> test byte [CONTROL_BYTE], 0C0h ; CHECK FOR RETRY SUPPRESSION 6294 0000568B 740E <1> jz short COMMAND3 6295 <1> ; 20/06/2024 6296 <1> ;mov al, [CMD_BLOCK+6] ; YES-GET OPERATION CODE 6297 0000568D 24F0 <1> and al, 0F0h ; GET RID OF MODIFIERS 6298 0000568F 3C20 <1> cmp al, 20h ; 20H-40H IS READ, WRITE, VERIFY 6299 00005691 7208 <1> jb short COMMAND3 6300 00005693 3C40 <1> cmp al, 40h 6301 00005695 7704 <1> ja short COMMAND3 6302 00005697 804DFE01 <1> or byte [CMD_BLOCK+6], NO_RETRIES 6303 <1> ; VALID OPERATION FOR RETRY SUPPRESS 6304 <1> COMMAND3: 6305 <1> ;mov al, [CMD_BLOCK+edi] ; GET THE COMMAND STRING BYTE 6306 <1> ; 10/07/2022 6307 0000569B 8A440DF8 <1> mov al, [CMD_BLOCK+ecx] 6308 0000569F EE <1> out dx, al ; GIVE IT TO CONTROLLER 6309 <1> IODELAY 78 000056A0 EB00 <2> jmp short $+2 79 000056A2 EB00 <2> jmp short $+2 6310 <1> ;inc edi ; NEXT BYTE IN COMMAND BLOCK 6311 <1> ; 10/07/2022 6312 000056A4 41 <1> inc ecx 6313 <1> ;inc dx ; NEXT DISK ADAPTER REGISTER 6314 000056A5 42 <1> inc edx ; 10/07/2022 6315 <1> ;cmp di, 7 ; 01/01/2015 ; ALL DONE? 6316 <1> ;jne short COMMAND3 ; NO--GO DO NEXT ONE 6317 000056A6 80F907 <1> cmp cl, 7 ; 10/07/2022 6318 000056A9 72F0 <1> jb short COMMAND3 6319 <1> ;pop edi ; 10/07/2022 6320 000056AB C3 <1> retn ; ZERO FLAG IS SET 6321 <1> 6322 <1> ; 20/06/2024 6323 <1> COMMAND5: 6324 <1> ; 48 bit LBA r/w 6325 000056AC 8A45F8 <1> mov al, [CMD_BLOCK] ; 0 6326 000056AF EE <1> out dx, al ; hd base port + 1 6327 <1> ; 6328 000056B0 80C205 <1> add dl, 5 ; hd base port + 6 ; 1F6h or 176h 6329 000056B3 A0[82660000] <1> mov al, [hf_m_s] 6330 <1> ; 23/06/2024 6331 <1> ;shl al, 4 6332 <1> ;;add al, 40h 6333 <1> ;or al, 40h 6334 <1> ;; al = 40h (for master), 50h (for slave) 6335 <1> ; 6336 000056B8 EE <1> out dx, al 6337 000056B9 80EA04 <1> sub dl, 4 ; hd base port + 2 ; 1F2h or 172h 6338 000056BC 30C0 <1> xor al, al ; 0 6339 000056BE EE <1> out dx, al ; sector count hb (bits 8 to 15) = 0 6340 000056BF 42 <1> inc edx ; hd base port + 3 6341 000056C0 8B45FA <1> mov eax, [CMD_BLOCK+2] 6342 000056C3 C1C008 <1> rol eax, 8 6343 000056C6 EE <1> out dx, al ; LBA byte 4 (bits 24 to 31) 6344 000056C7 42 <1> inc edx ; hd base port + 4 6345 000056C8 30C0 <1> xor al, al 6346 000056CA EE <1> out dx, al ; LBA byte 5 (bits 32 to 39) = 0 6347 000056CB 42 <1> inc edx ; hd base port + 5 6348 000056CC 28C0 <1> sub al, al 6349 000056CE EE <1> out dx, al ; LBA byte 6 (bits 40 to 47) = 0 6350 000056CF 8A45F9 <1> mov al, [CMD_BLOCK+1] ; sector count 6351 000056D2 80EA03 <1> sub dl, 3 ; hd base port + 2 6352 000056D5 EE <1> out dx, al ; sector count lb (bits 0 to 7) 6353 000056D6 C1E808 <1> shr eax, 8 6354 000056D9 42 <1> inc edx ; hd base port + 3 ; 1F3h or 173h 6355 000056DA EE <1> out dx, al ; LBA byte 1 (bits 0 to 7) 6356 000056DB C1E808 <1> shr eax, 8 6357 000056DE 42 <1> inc edx ; hd base port + 4 6358 000056DF EE <1> out dx, al ; LBA byte 2 (bits 8 to 15) 6359 000056E0 C1E808 <1> shr eax, 8 6360 000056E3 42 <1> inc edx ; hd base port + 5 6361 000056E4 EE <1> out dx, al ; LBA byte 3 (bits 16 to 23 6362 000056E5 42 <1> inc edx ; hd base port + 6 6363 000056E6 8A45FE <1> mov al, [CMD_BLOCK+6] ; 48 bit read or write command 6364 <1> ; al = 24h or 34h 6365 000056E9 42 <1> inc edx ; hd base port + 7 ; 1F7h or 177h 6366 000056EA EE <1> out dx, al 6367 000056EB 31C0 <1> xor eax, eax ; 0 6368 <1> ; zf = 1 6369 000056ED C3 <1> retn 6370 <1> 6371 <1> ;CMD_TIMEOUT: 6372 <1> ; mov byte [DISK_STATUS1], BAD_CNTLR 6373 <1> ;COMMAND4: 6374 <1> ; pop ebx 6375 <1> ; cmp byte [DISK_STATUS1], 0 ; SET CONDITION CODE FOR CALLER 6376 <1> ; retn 6377 <1> 6378 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6379 <1> ; 10/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 6380 <1> 6381 <1> ;---------------------------------------- 6382 <1> ; WAIT FOR INTERRUPT : 6383 <1> ;---------------------------------------- 6384 <1> ;WAIT: 6385 <1> _WAIT: 6386 000056EE FB <1> sti ; MAKE SURE INTERRUPTS ARE ON 6387 <1> ;sub cx, cx ; SET INITIAL DELAY BEFORE TEST 6388 <1> ;clc 6389 <1> ;mov ax, 9000h ; DEVICE WAIT INTERRUPT 6390 <1> ;int 15h 6391 <1> ;jc short WT2 ; DEVICE TIMED OUT 6392 <1> ;mov bl, DELAY_1 ; SET DELAY COUNT 6393 <1> 6394 <1> ;mov bl, WAIT_HDU_INT_HI 6395 <1> ;; 21/02/2015 6396 <1> ;;mov bl, WAIT_HDU_INT_HI + 1 6397 <1> ;;mov cx, WAIT_HDU_INT_LO 6398 000056EF B915160500 <1> mov ecx, WAIT_HDU_INT_LH 6399 <1> ; (AWARD BIOS -> WAIT_FOR_MEM) 6400 <1> ;----- WAIT LOOP 6401 <1> 6402 <1> WT1: 6403 <1> ;test byte [HF_INT_FLAG], 80h ; TEST FOR INTERRUPT 6404 000056F4 F605[42770100]C0 <1> test byte [HF_INT_FLAG], 0C0h 6405 <1> ;loopz WT1 6406 000056FB 7512 <1> jnz short WT3 ; INTERRUPT--LETS GO 6407 <1> ;dec bl 6408 <1> ;jnz short WT1 ; KEEP TRYING FOR A WHILE 6409 <1> 6410 <1> WT1_hi: 6411 000056FD E461 <1> in al, SYS1 ; 61h (PORT_B) ; wait for lo to hi 6412 000056FF A810 <1> test al, 10h ; transition on memory 6413 00005701 75FA <1> jnz short WT1_hi ; refresh. 6414 <1> WT1_lo: 6415 00005703 E461 <1> in al, SYS1 ; 061h (PORT_B) 6416 00005705 A810 <1> test al, 10h 6417 00005707 74FA <1> jz short WT1_lo 6418 00005709 E2E9 <1> loop WT1 6419 <1> ;;or bl, bl 6420 <1> ;;jz short WT2 6421 <1> ;;dec bl 6422 <1> ;;jmp short WT1 6423 <1> ;dec bl 6424 <1> ;jnz short WT1 6425 <1> WT2: 6426 <1> ; 10/07/2022 6427 <1> ;mov byte [DISK_STATUS1], TIME_OUT ; REPORT TIME OUT ERROR 6428 0000570B B080 <1> mov al, TIME_OUT 6429 0000570D EB07 <1> jmp short WT4 6430 <1> WT3: 6431 <1> ;mov byte [DISK_STATUS1], 0 6432 <1> ;mov byte [HF_INT_FLAG], 0 6433 0000570F 28C0 <1> sub al, al ; 0 6434 00005711 A2[42770100] <1> mov byte [HF_INT_FLAG], al 6435 <1> WT4: 6436 <1> NB2: 6437 00005716 A2[47770100] <1> mov byte [DISK_STATUS1], al 6438 <1> 6439 <1> ;cmp byte [DISK_STATUS1], 0 ; SET CONDITION CODE FOR CALLER 6440 0000571B 20C0 <1> and al, al 6441 <1> ; zf = 0 -> time out, zf = 1 -> ok 6442 0000571D C3 <1> retn 6443 <1> 6444 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6445 <1> ; 10/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 6446 <1> 6447 <1> ;---------------------------------------- 6448 <1> ; WAIT FOR CONTROLLER NOT BUSY : 6449 <1> ;---------------------------------------- 6450 <1> NOT_BUSY: 6451 0000571E FB <1> sti ; MAKE SURE INTERRUPTS ARE ON 6452 <1> ;push ebx 6453 <1> ;sub cx, cx ; SET INITIAL DELAY BEFORE TEST 6454 0000571F 668B15[7E660000] <1> mov dx, [HF_PORT] 6455 00005726 80C207 <1> add dl, 7 ; Status port (HF_PORT+7) 6456 <1> ;mov bl, DELAY_1 6457 <1> ; wait for 10 seconds 6458 <1> ;mov cx, WAIT_HDU_INT_LO ; 1615h 6459 <1> ;;mov bl, WAIT_HDU_INT_HI ; 05h 6460 <1> ;mov bl, WAIT_HDU_INT_HI + 1 6461 00005729 B915160500 <1> mov ecx, WAIT_HDU_INT_LH ; 21/02/2015 6462 <1> ; 6463 <1> ;;mov byte [wait_count], 0 ; Reset wait counter 6464 <1> NB1: 6465 0000572E EC <1> in al, dx ; CHECK STATUS 6466 <1> ;test al, ST_BUSY 6467 0000572F 2480 <1> and al, ST_BUSY 6468 <1> ;loopnz NB1 6469 00005731 74E3 <1> jz short NB2 ; al = 0 ; NOT BUSY--LETS GO 6470 <1> ;dec bl 6471 <1> ;jnz short NB1 ; KEEP TRYING FOR A WHILE 6472 <1> 6473 <1> NB1_hi: 6474 00005733 E461 <1> in al, SYS1 ; wait for hi to lo 6475 00005735 A810 <1> test al, 010h ; transition on memory 6476 00005737 75FA <1> jnz short NB1_hi ; refresh. 6477 <1> NB1_lo: 6478 00005739 E461 <1> in al, SYS1 6479 0000573B A810 <1> test al, 010h 6480 0000573D 74FA <1> jz short NB1_lo 6481 0000573F E2ED <1> loop NB1 6482 <1> ;dec bl 6483 <1> ;jnz short NB1 6484 <1> ; 6485 <1> ;;cmp byte [wait_count], 182 ; 10 seconds (182 timer ticks) 6486 <1> ;;jb short NB1 6487 <1> ; 6488 <1> ;mov byte [DISK_STATUS1], TIME_OUT ; REPORT TIME OUT ERROR 6489 <1> ;jmp short NB3 6490 00005741 B080 <1> mov al, TIME_OUT 6491 <1> ;NB2: 6492 00005743 EBD1 <1> jmp short NB2 ; 10/07/2022 6493 <1> 6494 <1> ; ;mov byte [DISK_STATUS1], 0 6495 <1> ;;NB3: 6496 <1> ; ;pop ebx 6497 <1> ; mov [DISK_STATUS1], al ;;; will be set after return 6498 <1> ; ;cmp byte [DISK_STATUS1], 0 ; SET CONDITION CODE FOR CALLER 6499 <1> ; or al, al ; (zf = 0 --> timeout) 6500 <1> ; retn 6501 <1> 6502 <1> ;---------------------------------------- 6503 <1> ; WAIT FOR DATA REQUEST : 6504 <1> ;---------------------------------------- 6505 <1> WAIT_DRQ: 6506 <1> ;mov cx, DELAY_3 6507 <1> ;mov dx, HF_PORT+7 6508 00005745 668B15[7E660000] <1> mov dx, [HF_PORT] 6509 0000574C 80C207 <1> add dl, 7 6510 <1> ;;mov bl, WAIT_HDU_DRQ_HI ; 0 6511 <1> ;mov cx, WAIT_HDU_DRQ_LO ; 1000 (30 milli seconds) 6512 <1> ; (but it is written as 2000 6513 <1> ; micro seconds in ATORGS.ASM file 6514 <1> ; of Award Bios - 1999, D1A0622) 6515 0000574F B9E8030000 <1> mov ecx, WAIT_HDU_DRQ_LH ; 21/02/2015 6516 <1> WQ_1: 6517 00005754 EC <1> in al, dx ; GET STATUS 6518 00005755 A808 <1> test al, ST_DRQ ; WAIT FOR DRQ 6519 00005757 7516 <1> jnz short WQ_OK 6520 <1> ;loop WQ_1 ; KEEP TRYING FOR A SHORT WHILE 6521 <1> WQ_hi: 6522 00005759 E461 <1> in al, SYS1 ; wait for hi to lo 6523 0000575B A810 <1> test al, 010h ; transition on memory 6524 0000575D 75FA <1> jnz short WQ_hi ; refresh. 6525 <1> WQ_lo: 6526 0000575F E461 <1> in al, SYS1 6527 00005761 A810 <1> test al, 010h 6528 00005763 74FA <1> jz short WQ_lo 6529 00005765 E2ED <1> loop WQ_1 6530 <1> 6531 00005767 C605[47770100]80 <1> mov byte [DISK_STATUS1], TIME_OUT ; ERROR 6532 0000576E F9 <1> stc 6533 <1> WQ_OK: 6534 0000576F C3 <1> retn 6535 <1> ;WQ_OK: 6536 <1> ;clc 6537 <1> ;ret 6538 <1> 6539 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6540 <1> 6541 <1> ;---------------------------------------- 6542 <1> ; CHECK FIXED DISK STATUS BYTE : 6543 <1> ;---------------------------------------- 6544 <1> CHECK_ST: 6545 <1> ;mov dx, HF_PORT+7 ; GET THE STATUS 6546 00005770 668B15[7E660000] <1> mov dx, [HF_PORT] 6547 00005777 80C207 <1> add dl, 7 6548 <1> 6549 <1> ; 17/02/2016 6550 <1> ;(http://wiki.osdev.org/ATA_PIO_Mode) 6551 <1> ;"delay 400ns to allow drive to set new values of BSY and DRQ" 6552 0000577A EC <1> in al, dx 6553 <1> ;in al, dx ; 100ns 6554 <1> ;in al, dx ; 100ns 6555 <1> ;in al, dx ; 100ns 6556 <1> NEWIODELAY ; 18/02/2016 (AWARD BIOS - 1999, 'CKST' in AHSDK.ASM) 83 0000577B E6EB <2> out 0EBh, al 6557 <1> ; 6558 <1> 6559 <1> ; 16/07/2022 6560 0000577D A2[41770100] <1> mov [HF_STATUS], al 6561 <1> ;mov ah, 0 6562 00005782 28E4 <1> sub ah, ah ; 0 6563 00005784 A880 <1> test al, ST_BUSY ; IF STILL BUSY 6564 00005786 751A <1> jnz short CKST_EXIT ; REPORT OK 6565 00005788 B4CC <1> mov ah, WRITE_FAULT 6566 0000578A A820 <1> test al, ST_WRT_FLT ; CHECK FOR WRITE FAULT 6567 0000578C 7514 <1> jnz short CKST_EXIT 6568 0000578E B4AA <1> mov ah, NOT_RDY 6569 00005790 A840 <1> test al, ST_READY ; CHECK FOR NOT READY 6570 00005792 740E <1> jz short CKST_EXIT 6571 00005794 B440 <1> mov ah, BAD_SEEK 6572 00005796 A810 <1> test al, ST_SEEK_COMPL ; CHECK FOR SEEK NOT COMPLETE 6573 00005798 7408 <1> jz short CKST_EXIT 6574 0000579A B411 <1> mov ah, DATA_CORRECTED 6575 0000579C A804 <1> test al, ST_CORRCTD ; CHECK FOR CORRECTED ECC 6576 0000579E 7502 <1> jnz short CKST_EXIT 6577 <1> ;mov ah, 0 6578 000057A0 30E4 <1> xor ah, ah ; 0 6579 <1> CKST_EXIT: 6580 000057A2 8825[47770100] <1> mov [DISK_STATUS1], ah ; SET ERROR FLAG 6581 000057A8 80FC11 <1> cmp ah, DATA_CORRECTED ; KEEP GOING WITH DATA CORRECTED 6582 000057AB 7402 <1> je short CKST_EX1 6583 <1> ;cmp ah, 0 6584 000057AD 20E4 <1> and ah, ah 6585 <1> CKST_EX1: 6586 000057AF C3 <1> retn 6587 <1> 6588 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6589 <1> 6590 <1> ;---------------------------------------- 6591 <1> ; CHECK FIXED DISK ERROR REGISTER : 6592 <1> ;---------------------------------------- 6593 <1> CHECK_ER: 6594 <1> ;mov dx, HF_PORT+1 ; GET THE ERROR REGISTER 6595 000057B0 668B15[7E660000] <1> mov dx, [HF_PORT] ; 6596 000057B7 FEC2 <1> inc dl 6597 000057B9 EC <1> in al, dx 6598 <1> ; 16/07/2022 6599 <1> ;mov [HF_ERROR], al 6600 <1> ;push ebx ; 21/02/2015 6601 000057BA 29C9 <1> sub ecx, ecx 6602 <1> ;mov ecx, 8 ; TEST ALL 8 BITS 6603 000057BC B108 <1> mov cl, 8 6604 <1> CK1: 6605 000057BE D0E0 <1> shl al, 1 ; MOVE NEXT ERROR BIT TO CARRY 6606 000057C0 7202 <1> jc short CK2 ; FOUND THE ERROR 6607 000057C2 E2FA <1> loop CK1 ; KEEP TRYING 6608 <1> CK2: 6609 <1> ;mov ebx, ERR_TBL ; COMPUTE ADDRESS OF 6610 <1> ;add ebx, ecx ; ERROR CODE 6611 000057C4 81C1[74660000] <1> add ecx, ERR_TBL ; 16/07/2022 6612 <1> 6613 <1> ;;;mov ah, byte [cs:bx] ; GET ERROR CODE 6614 <1> ;;mov ah, [bx] 6615 <1> ;mov ah, [ebx] ; 21/02/2015 6616 000057CA 8A21 <1> mov ah, [ecx] 6617 <1> CKEX: 6618 000057CC 8825[47770100] <1> mov [DISK_STATUS1], ah ; SAVE ERROR CODE 6619 <1> ; 16/07/2022 6620 <1> ;pop ebx 6621 <1> ;;cmp ah, 0 6622 <1> ;and ah, ah 6623 000057D2 C3 <1> retn 6624 <1> 6625 <1> ;-------------------------------------------------------- 6626 <1> ; CHECK_DMA : 6627 <1> ; -CHECK ES:BX AND # SECTORS TO MAKE SURE THAT IT WILL : 6628 <1> ; FIT WITHOUT SEGMENT OVERFLOW. : 6629 <1> ; -ES:BX HAS BEEN REVISED TO THE FORMAT SSSS:000X : 6630 <1> ; -OK IF # SECTORS < 80H (7FH IF LONG READ OR WRITE) : 6631 <1> ; -OK IF # SECTORS = 80H (7FH) AND BX <= 00H (04H) : 6632 <1> ; -ERROR OTHERWISE : 6633 <1> ;-------------------------------------------------------- 6634 <1> 6635 <1> ; 16/07/2022 - TRDOS 386 v2.0.5 6636 <1> ; (not needed for hard disks and 32 bit OS) 6637 <1> 6638 <1> ;CHECK_DMA: 6639 <1> ; ; 11/04/2021 (32 bit push/pop) 6640 <1> ; push eax ; SAVE REGISTERS 6641 <1> ; mov ax, 8000h ; AH = MAX # SECTORS 6642 <1> ; ; AL = MAX OFFSET 6643 <1> ; test byte [CMD_BLOCK+6], ECC_MODE 6644 <1> ; jz short CKD1 6645 <1> ; mov ah, 7F04h ; ECC IS 4 MORE BYTES 6646 <1> ;CKD1: 6647 <1> ; cmp ah, [CMD_BLOCK+1] ; NUMBER OF SECTORS 6648 <1> ; ja short CKDOK ; IT WILL FIT 6649 <1> ; jb short CKDERR ; TOO MANY 6650 <1> ; cmp al, bl ; CHECK OFFSET ON MAX SECTORS 6651 <1> ; ;jb short CKDERR ; ERROR 6652 <1> ; jnb short CKDOK ; 16/07/2022 6653 <1> ;;CKDOK: 6654 <1> ; ;clc ; CLEAR CARRY 6655 <1> ; ;pop eax 6656 <1> ; ;retn ; NORMAL RETURN 6657 <1> ;CKDERR: 6658 <1> ; ;stc ; INDICATE ERROR 6659 <1> ; mov byte [DISK_STATUS1], DMA_BOUNDARY 6660 <1> ;CKDOK: 6661 <1> ; pop eax 6662 <1> ; retn 6663 <1> 6664 <1> ;---------------------------------------- 6665 <1> ; SET UP EBX-> DISK PARMS : 6666 <1> ;---------------------------------------- 6667 <1> 6668 <1> ; INPUT -> DL = 0 based drive number 6669 <1> ; OUTPUT -> EBX = disk parameter table address 6670 <1> 6671 <1> GET_VEC: 6672 <1> ;sub ax, ax ; GET DISK PARAMETER ADDRESS 6673 <1> ;mov es, ax 6674 <1> ;test dl, 1 6675 <1> ;jz short GV_0 6676 <1> ; les bx, [HF1_TBL_VEC] ; ES:BX -> DRIVE PARAMETERS 6677 <1> ; jmp short GV_EXIT 6678 <1> ;GV_0: 6679 <1> ; les bx,[HF_TBL_VEC] ; ES:BX -> DRIVE PARAMETERS 6680 <1> ; 6681 000057D3 31DB <1> xor ebx, ebx 6682 000057D5 88D3 <1> mov bl, dl 6683 <1> ;02/01/2015 6684 <1> ;xor bh, bh 6685 <1> ;shl bl, 1 ; port address offset 6686 <1> ;mov ax, [bx+hd_ports] ; Base port address (1F0h, 170h) 6687 <1> ;shl bl, 1 ; dpt pointer offset 6688 000057D7 C0E302 <1> shl bl, 2 6689 <1> ;add bx, HF_TBL_VEC ; Disk parameter table pointer 6690 000057DA 81C3[4C770100] <1> add ebx, HF_TBL_VEC ; 21/02/2015 6691 <1> ;push word [bx+2] ; dpt segment 6692 <1> ;pop es 6693 <1> ;mov bx, [bx] ; dpt offset 6694 000057E0 8B1B <1> mov ebx, [ebx] 6695 <1> ;GV_EXIT: 6696 000057E2 C3 <1> retn 6697 <1> 6698 <1> hdc1_int: ; 21/02/2015 6699 <1> ;--- HARDWARE INT 76H -- ( IRQ LEVEL 14 ) ----------------------- 6700 <1> ; : 6701 <1> ; FIXED DISK INTERRUPT ROUTINE : 6702 <1> ; : 6703 <1> ;---------------------------------------------------------------- 6704 <1> 6705 <1> ; 22/12/2014 6706 <1> ; IBM PC-XT Model 286 System BIOS Source Code - DISK.ASM (HD_INT) 6707 <1> ; '11/15/85' 6708 <1> ; AWARD BIOS 1999 (D1A0622) 6709 <1> ; Source Code - ATORGS.ASM (INT_HDISK, INT_HDISK1) 6710 <1> 6711 <1> ;int_76h: 6712 <1> HD_INT: 6713 <1> ; 11/04/2021 (32 bit push/pop) 6714 000057E3 50 <1> push eax 6715 000057E4 1E <1> push ds 6716 <1> ;call DDS 6717 <1> ; 21/02/2015 (32 bit, 386 pm modification) 6718 000057E5 66B81000 <1> mov ax, KDATA 6719 000057E9 8ED8 <1> mov ds, ax 6720 <1> ; 6721 <1> ;;mov @HF_INT_FLAG,0FFH ; ALL DONE 6722 <1> ;mov byte [CS:HF_INT_FLAG], 0FFh 6723 000057EB C605[42770100]FF <1> mov byte [HF_INT_FLAG], 0FFh 6724 <1> ; 6725 000057F2 52 <1> push edx 6726 000057F3 66BAF701 <1> mov dx, HDC1_BASEPORT+7 ; Status Register (1F7h) 6727 <1> ; Clear Controller 6728 <1> Clear_IRQ1415: ; (Award BIOS - 1999) 6729 000057F7 EC <1> in al, dx ; 6730 000057F8 5A <1> pop edx 6731 <1> NEWIODELAY 83 000057F9 E6EB <2> out 0EBh, al 6732 <1> ; 6733 000057FB B020 <1> mov al, EOI ; NON-SPECIFIC END OF INTERRUPT 6734 000057FD E6A0 <1> out INTB00, al ; FOR CONTROLLER #2 6735 <1> ;jmp $+2 ; WAIT 6736 <1> NEWIODELAY 83 000057FF E6EB <2> out 0EBh, al 6737 00005801 E620 <1> out INTA00, al ; FOR CONTROLLER #1 6738 00005803 1F <1> pop ds 6739 <1> ;sti ; RE-ENABLE INTERRUPTS 6740 <1> ;mov ax, 9100h ; DEVICE POST 6741 <1> ;int 15h ; INTERRUPT 6742 <1> irq15_iret: ; 25/02/2015 6743 00005804 58 <1> pop eax 6744 00005805 CF <1> iretd ; RETURN FROM INTERRUPT 6745 <1> 6746 <1> hdc2_int: ; 21/02/2015 6747 <1> ;--- HARDWARE INT 77H -- ( IRQ LEVEL 15 ) ----------------------- 6748 <1> ; : 6749 <1> ; FIXED DISK INTERRUPT ROUTINE : 6750 <1> ; : 6751 <1> ;---------------------------------------------------------------- 6752 <1> 6753 <1> ;int_77h: 6754 <1> HD1_INT: 6755 <1> ; 11/04/2021 (32 bit push/pop) 6756 00005806 50 <1> push eax 6757 <1> ; Check if that is a spurious IRQ (from slave PIC) 6758 <1> ; 25/02/2015 (source: http://wiki.osdev.org/8259_PIC) 6759 00005807 B00B <1> mov al, 0Bh ; In-Service Register 6760 00005809 E6A0 <1> out 0A0h, al 6761 0000580B EB00 <1> jmp short $+2 6762 0000580D EB00 <1> jmp short $+2 6763 0000580F E4A0 <1> in al, 0A0h 6764 00005811 2480 <1> and al, 80h ; bit 7 (is it real IRQ 15 or fake?) 6765 00005813 74EF <1> jz short irq15_iret ; Fake (spurious) IRQ, do not send EOI) 6766 <1> ; 6767 00005815 1E <1> push ds 6768 <1> ;call DDS 6769 <1> ; 21/02/2015 (32 bit, 386 pm modification) 6770 00005816 66B81000 <1> mov ax, KDATA 6771 0000581A 8ED8 <1> mov ds, ax 6772 <1> ; 6773 <1> ;;mov @HF_INT_FLAG,0FFH ; ALL DONE 6774 <1> ;or byte [CS:HF_INT_FLAG],0C0h 6775 0000581C 800D[42770100]C0 <1> or byte [HF_INT_FLAG], 0C0h 6776 <1> ; 6777 00005823 52 <1> push edx 6778 00005824 66BA7701 <1> mov dx, HDC2_BASEPORT+7 ; Status Register (177h) 6779 <1> ; Clear Controller (Award BIOS 1999) 6780 00005828 EBCD <1> jmp short Clear_IRQ1415 6781 <1> 6782 <1> ;%include 'diskdata.inc' ; 11/03/2015 6783 <1> ;%include 'diskbss.inc' ; 11/03/2015 6784 <1> 6785 <1> ;//////////////////////////////////////////////////////////////////// 6786 <1> ;; END OF DISK I/O SYTEM /// 3229 %include 'memory.s' ; 09/03/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.8 - memory.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 09/02/2026 (Previous: 04/06/2024 - Kernel v2.0.8) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; memory.inc (18/10/2015) 15 <1> ; **************************************************************************** 16 <1> 17 <1> ; MEMORY.ASM - Retro UNIX 386 v1 MEMORY MANAGEMENT FUNCTIONS (PROCEDURES) 18 <1> ; Retro UNIX 386 v1 Kernel (unix386.s, v0.2.0.14) - MEMORY.INC 19 <1> ; Last Modification: 18/10/2015 20 <1> 21 <1> ; ///////// MEMORY MANAGEMENT FUNCTIONS (PROCEDURES) /////////////// 22 <1> 23 <1> ;;04/11/2014 (unix386.s) 24 <1> ;PDE_A_PRESENT equ 1 ; Present flag for PDE 25 <1> ;PDE_A_WRITE equ 2 ; Writable (write permission) flag 26 <1> ;PDE_A_USER equ 4 ; User (non-system/kernel) page flag 27 <1> ;; 28 <1> ;PTE_A_PRESENT equ 1 ; Present flag for PTE (bit 0) 29 <1> ;PTE_A_WRITE equ 2 ; Writable (write permission) flag (bit 1) 30 <1> ;PTE_A_USER equ 4 ; User (non-system/kernel) page flag (bit 2) 31 <1> ;PTE_A_ACCESS equ 32 ; Accessed flag (bit 5) ; 09/03/2015 32 <1> 33 <1> ; 27/04/2015 34 <1> ; 09/03/2015 35 <1> PAGE_SIZE equ 4096 ; page size in bytes 36 <1> PAGE_SHIFT equ 12 ; page table shift count 37 <1> PAGE_D_SHIFT equ 22 ; 12 + 10 ; page directory shift count 38 <1> PAGE_OFF equ 0FFFh ; 12 bit byte offset in page frame 39 <1> PTE_MASK equ 03FFh ; page table entry mask 40 <1> PTE_DUPLICATED equ 200h ; duplicated page sign (AVL bit 0) 41 <1> PDE_A_CLEAR equ 0F000h ; to clear PDE attribute bits 42 <1> PTE_A_CLEAR equ 0F000h ; to clear PTE attribute bits 43 <1> LOGIC_SECT_SIZE equ 512 ; logical sector size 44 <1> ERR_MAJOR_PF equ 0E0h ; major error: page fault 45 <1> ERR_MINOR_IM equ 4 ;15/10/2016 (1->4); insufficient (out of) memory 46 <1> ERR_MINOR_RO equ 5 ;09/02/2026 ; access error (write attempt on read only page) 47 <1> ERR_MINOR_PV equ 6 ;15/10/2016 (1->4); protection violation 48 <1> SWP_DISK_READ_ERR equ 40 49 <1> SWP_DISK_NOT_PRESENT_ERR equ 41 50 <1> SWP_SECTOR_NOT_PRESENT_ERR equ 42 51 <1> SWP_NO_FREE_SPACE_ERR equ 43 52 <1> SWP_DISK_WRITE_ERR equ 44 53 <1> SWP_NO_PAGE_TO_SWAP_ERR equ 45 54 <1> PTE_A_ACCESS_BIT equ 5 ; Bit 5 (accessed flag) 55 <1> SECTOR_SHIFT equ 3 ; sector shift (to convert page block number) 56 <1> ; 12/07/2016 57 <1> PTE_SHARED equ 400h ; AVL bit 1, direct memory access bit 58 <1> ; (Indicates that the page is not allocated 59 <1> ; for the process, it is a shared or system 60 <1> ; page, it must not be deallocated!) 61 <1> ; 14/12/2020 62 <1> ; (Linear Frame Buffer - video memory mark : AVL bit 1, outside M.A.T.) 63 <1> PDE_EXTERNAL equ 400h ; Page directory entry for external memory blocks 64 <1> PTE_EXTERNAL equ 400h ; Allocated kernel pages for Linear Frame Buffer 65 <1> ; (Out of memory allocation table) 66 <1> 67 <1> ; 68 <1> ;; Retro Unix 386 v1 - paging method/principles 69 <1> ;; 70 <1> ;; 10/10/2014 71 <1> ;; RETRO UNIX 386 v1 - PAGING METHOD/PRINCIPLES 72 <1> ;; 73 <1> ;; KERNEL PAGE MAP: 1 to 1 physical memory page map 74 <1> ;; (virtual address = physical address) 75 <1> ;; KERNEL PAGE TABLES: 76 <1> ;; Kernel page directory and all page tables are 77 <1> ;; on memory as initialized, as equal to physical memory 78 <1> ;; layout. Kernel pages can/must not be swapped out/in. 79 <1> ;; 80 <1> ;; what for: User pages may be swapped out, when accessing 81 <1> ;; a page in kernel/system mode, if it would be swapped out, 82 <1> ;; kernel would have to swap it in! But it is also may be 83 <1> ;; in use by a user process. (In system/kernel mode 84 <1> ;; kernel can access all memory pages even if they are 85 <1> ;; reserved/allocated for user processes. Swap out/in would 86 <1> ;; cause conflicts.) 87 <1> ;; 88 <1> ;; As result of these conditions, 89 <1> ;; all kernel pages must be initialized as equal to 90 <1> ;; physical layout for preventing page faults. 91 <1> ;; Also, calling "allocate page" procedure after 92 <1> ;; a page fault can cause another page fault (double fault) 93 <1> ;; if all kernel page tables would not be initialized. 94 <1> ;; 95 <1> ;; [first_page] = Beginning of users space, as offset to 96 <1> ;; memory allocation table. (double word aligned) 97 <1> ;; 98 <1> ;; [next_page] = first/next free space to be searched 99 <1> ;; as offset to memory allocation table. (dw aligned) 100 <1> ;; 101 <1> ;; [last_page] = End of memory (users space), as offset 102 <1> ;; to memory allocation table. (double word aligned) 103 <1> ;; 104 <1> ;; USER PAGE TABLES: 105 <1> ;; Demand paging (& 'copy on write' allocation method) ... 106 <1> ;; 'ready only' marked copies of the 107 <1> ;; parent process's page table entries (for 108 <1> ;; same physical memory). 109 <1> ;; (A page will be copied to a new page after 110 <1> ;; if it causes R/W page fault.) 111 <1> ;; 112 <1> ;; Every user process has own (different) 113 <1> ;; page directory and page tables. 114 <1> ;; 115 <1> ;; Code starts at virtual address 0, always. 116 <1> ;; (Initial value of EIP is 0 in user mode.) 117 <1> ;; (Programs can be written/developed as simple 118 <1> ;; flat memory programs.) 119 <1> ;; 120 <1> ;; MEMORY ALLOCATION STRATEGY: 121 <1> ;; Memory page will be allocated by kernel only 122 <1> ;; (in kernel/system mode only). 123 <1> ;; * After a 124 <1> ;; - 'not present' page fault 125 <1> ;; - 'writing attempt on read only page' page fault 126 <1> ;; * For loading (opening, reading) a file or disk/drive 127 <1> ;; * As responce to 'allocate additional memory blocks' 128 <1> ;; request by running process. 129 <1> ;; * While creating a process, allocating a new buffer, 130 <1> ;; new page tables etc. 131 <1> ;; 132 <1> ;; At first, 133 <1> ;; - 'allocate page' procedure will be called; 134 <1> ;, if it will return with a valid (>0) physical address 135 <1> ;; (that means the relevant M.A.T. bit has been RESET) 136 <1> ;; relevant memory page/block will be cleared (zeroed). 137 <1> ;; - 'allocate page' will be called for allocating page 138 <1> ;; directory, page table and running space (data/code). 139 <1> ;; - every successful 'allocate page' call will decrease 140 <1> ;; 'free_pages' count (pointer). 141 <1> ;; - 'out of (insufficient) memory error' will be returned 142 <1> ;; if 'free_pages' points to a ZERO. 143 <1> ;; - swapping out and swapping in (if it is not a new page) 144 <1> ;; procedures will be called as responce to 'out of memory' 145 <1> ;; error except errors caused by attribute conflicts. 146 <1> ;; (swapper functions) 147 <1> ;; 148 <1> ;; At second, 149 <1> ;; - page directory entry will be updated then page table 150 <1> ;; entry will be updated. 151 <1> ;; 152 <1> ;; MEMORY ALLOCATION TABLE FORMAT: 153 <1> ;; - M.A.T. has a size according to available memory as 154 <1> ;; follows: 155 <1> ;; - 1 (allocation) bit per 1 page (4096 bytes) 156 <1> ;; - a bit with value of 0 means allocated page 157 <1> ;; - a bit with value of 1 means a free page 158 <1> ;, - 'free_pages' pointer holds count of free pages 159 <1> ;; depending on M.A.T. 160 <1> ;; (NOTE: Free page count will not be checked 161 <1> ;; again -on M.A.T.- after initialization. 162 <1> ;; Kernel will trust on initial count.) 163 <1> ;, - 'free_pages' count will be decreased by allocation 164 <1> ;; and it will be increased by deallocation procedures. 165 <1> ;; 166 <1> ;; - Available memory will be calculated during 167 <1> ;; the kernel's initialization stage (in real mode). 168 <1> ;; Memory allocation table and kernel page tables 169 <1> ;; will be formatted/sized as result of available 170 <1> ;; memory calculation before paging is enabled. 171 <1> ;; 172 <1> ;; For 4GB Available/Present Memory: (max. possible memory size) 173 <1> ;; - Memory Allocation Table size will be 128 KB. 174 <1> ;; - Memory allocation for kernel page directory size 175 <1> ;; is always 4 KB. (in addition to total allocation size 176 <1> ;; for page tables) 177 <1> ;; - Memory allocation for kernel page tables (1024 tables) 178 <1> ;; is 4 MB (1024*4*1024 bytes). 179 <1> ;; - User (available) space will be started 180 <1> ;; at 6th MB of the memory (after 1MB+4MB). 181 <1> ;; - The first 640 KB is for kernel's itself plus 182 <1> ;; memory allocation table and kernel's page directory 183 <1> ;; (D0000h-EFFFFh may be used as kernel space...) 184 <1> ;; - B0000h to B7FFFh address space (32 KB) will be used 185 <1> ;; for buffers. 186 <1> ;; - ROMBIOS, VIDEO BUFFER and VIDEO ROM space are reserved. 187 <1> ;, (A0000h-AFFFFh, C0000h-CFFFFh, F0000h-FFFFFh) 188 <1> ;; - Kernel page tables start at 100000h (2nd MB) 189 <1> ;; 190 <1> ;; For 1GB Available Memory: 191 <1> ;; - Memory Allocation Table size will be 32 KB. 192 <1> ;; - Memory allocation for kernel page directory size 193 <1> ;; is always 4 KB. (in addition to total allocation size 194 <1> ;; for page tables) 195 <1> ;; - Memory allocation for kernel page tables (256 tables) 196 <1> ;; is 1 MB (256*4*1024 bytes). 197 <1> ;; - User (available) space will be started 198 <1> ;; at 3th MB of the memory (after 1MB+1MB). 199 <1> ;; - The first 640 KB is for kernel's itself plus 200 <1> ;; memory allocation table and kernel's page directory 201 <1> ;; (D0000h-EFFFFh may be used as kernel space...) 202 <1> ;; - B0000h to B7FFFh address space (32 KB) will be used 203 <1> ;; for buffers. 204 <1> ;; - ROMBIOS, VIDEO BUFFER and VIDEO ROM space are reserved. 205 <1> ;, (A0000h-AFFFFh, C0000h-CFFFFh, F0000h-FFFFFh) 206 <1> ;; - Kernel page tables start at 100000h (2nd MB). 207 <1> ;; 208 <1> ;; 209 <1> 210 <1> 211 <1> ;;************************************************************************************ 212 <1> ;; 213 <1> ;; RETRO UNIX 386 v1 - Paging (Method for Copy On Write paging principle) 214 <1> ;; DEMAND PAGING - PARENT&CHILD PAGE TABLE DUPLICATION PRINCIPLES (23/04/2015) 215 <1> 216 <1> ;; Main factor: "sys fork" system call 217 <1> ;; 218 <1> ;; FORK 219 <1> ;; |----> parent - duplicated PTEs, read only pages 220 <1> ;; writable pages ---->| 221 <1> ;; |----> child - duplicated PTEs, read only pages 222 <1> ;; 223 <1> ;; AVL bit (0) of Page Table Entry is used as duplication sign 224 <1> ;; 225 <1> ;; AVL Bit 0 [PTE Bit 9] = 'Duplicated PTE belongs to child' sign/flag (if it is set) 226 <1> ;; Note: Dirty bit (PTE bit 6) may be used instead of AVL bit 0 (PTE bit 9) 227 <1> ;; -while R/W bit is 0-. 228 <1> ;; 229 <1> ;; Duplicate page tables with writable pages (the 1st sys fork in the process): 230 <1> ;; # Parent's Page Table Entries are updated to point same pages as read only, 231 <1> ;; as duplicated PTE bit -AVL bit 0, PTE bit 9- are reset/clear. 232 <1> ;; # Then Parent's Page Table is copied to Child's Page Table. 233 <1> ;; # Child's Page Table Entries are updated as duplicated child bit 234 <1> ;; -AVL bit 0, PTE bit 9- is set. 235 <1> ;; 236 <1> ;; Duplicate page tables with read only pages (several sys fork system calls): 237 <1> ;; # Parent's read only pages are copied to new child pages. 238 <1> ;; Parent's PTE attributes are not changed. 239 <1> ;; (Because, there is another parent-child fork before this fork! We must not 240 <1> ;; destroy/mix previous fork result). 241 <1> ;; # Child's Page Table Entries (which are corresponding to Parent's 242 <1> ;; read only pages) are set as writable (while duplicated PTE bit is clear). 243 <1> ;; # Parent's PTEs with writable page attribute are updated to point same pages 244 <1> ;; as read only, (while) duplicated PTE bit is reset (clear). 245 <1> ;; # Parent's Page Table Entries (with writable page attribute) are duplicated 246 <1> ;; as Child's Page Table Entries without copying actual page. 247 <1> ;; # Child 's Page Table Entries (which are corresponding to Parent's writable 248 <1> ;; pages) are updated as duplicated PTE bit (AVL bit 0, PTE bit 9- is set. 249 <1> ;; 250 <1> ;; !? WHAT FOR (duplication after duplication): 251 <1> ;; In UNIX method for sys fork (a typical 'fork' application in /etc/init) 252 <1> ;; program/executable code continues from specified location as child process, 253 <1> ;; returns back previous code location as parent process, every child after 254 <1> ;; every sys fork uses last image of code and data just prior the fork. 255 <1> ;; Even if the parent code changes data, the child will not see the changed data 256 <1> ;; after the fork. In Retro UNIX 8086 v1, parent's process segment (32KB) 257 <1> ;; was copied to child's process segment (all of code and data) according to 258 <1> ;; original UNIX v1 which copies all of parent process code and data -core- 259 <1> ;; to child space -core- but swaps that core image -of child- on to disk. 260 <1> ;; If I (Erdogan Tan) would use a method of to copy parent's core 261 <1> ;; (complete running image of parent process) to the child process; 262 <1> ;; for big sizes, i would force Retro UNIX 386 v1 to spend many memory pages 263 <1> ;; and times only for a sys fork. (It would excessive reservation for sys fork, 264 <1> ;; because sys fork usually is prior to sys exec; sys exec always establishes 265 <1> ;; a new/fresh core -running space-, by clearing all code/data content). 266 <1> ;; 'Read Only' page flag ensures page fault handler is needed only for a few write 267 <1> ;; attempts between sys fork and sys exec, not more... (I say so by thinking 268 <1> ;; of "/etc/init" content, specially.) sys exec will clear page tables and 269 <1> ;; new/fresh pages will be used to load and run new executable/program. 270 <1> ;; That is what for i have preferred "copy on write", "duplication" method 271 <1> ;; for sharing same read only pages between parent and child processes. 272 <1> ;; That is a pitty i have to use new private flag (AVL bit 0, "duplicated PTE 273 <1> ;; belongs to child" sign) for cooperation on duplicated pages between a parent 274 <1> ;; and it's child processes; otherwise parent process would destroy data belongs 275 <1> ;; to its child or vice versa; or some pages would remain unclaimed 276 <1> ;; -deallocation problem-. 277 <1> ;; Note: to prevent conflicts, read only pages must not be swapped out... 278 <1> ;; 279 <1> ;; WHEN PARENT TRIES TO WRITE IT'S READ ONLY (DUPLICATED) PAGE: 280 <1> ;; # Page fault handler will do those: 281 <1> ;; - 'Duplicated PTE' flag (PTE bit 9) is checked (on the failed PTE). 282 <1> ;; - If it is reset/clear, there is a child uses same page. 283 <1> ;; - Parent's read only page -previous page- is copied to a new writable page. 284 <1> ;; - Parent's PTE is updated as writable page, as unique page (AVL=0) 285 <1> ;; - (Page fault handler whill check this PTE later, if child process causes to 286 <1> ;; page fault due to write attempt on read only page. Of course, the previous 287 <1> ;; read only page will be converted to writable and unique page which belongs 288 <1> ;; to child process.) 289 <1> ;; WHEN CHILD TRIES TO WRITE IT'S READ ONLY (DUPLICATED) PAGE: 290 <1> ;; # Page fault handler will do those: 291 <1> ;; - 'Duplicated PTE' flag (PTE bit 9) is checked (on the failed PTE). 292 <1> ;; - If it is set, there is a parent uses -or was using- same page. 293 <1> ;; - Same PTE address within parent's page table is checked if it has same page 294 <1> ;; address or not. 295 <1> ;; - If parent's PTE has same address, child will continue with a new writable page. 296 <1> ;; Parent's PTE will point to same (previous) page as writable, unique (AVL=0). 297 <1> ;; - If parent's PTE has different address, child will continue with it's 298 <1> ;; own/same page but read only flag (0) will be changed to writable flag (1) and 299 <1> ;; 'duplicated PTE (belongs to child)' flag/sign will be cleared/reset. 300 <1> ;; 301 <1> ;; NOTE: When a child process is terminated, read only flags of parent's page tables 302 <1> ;; will be set as writable (and unique) in case of child process was using 303 <1> ;; same pages with duplicated child PTE sign... Depending on sys fork and 304 <1> ;; duplication method details, it is not possible multiple child processes 305 <1> ;; were using same page with duplicated PTEs. 306 <1> ;; 307 <1> ;;************************************************************************************ 308 <1> 309 <1> ;; 08/10/2014 310 <1> ;; 11/09/2014 - Retro UNIX 386 v1 PAGING (further) draft 311 <1> ;; by Erdogan Tan (Based on KolibriOS 'memory.inc') 312 <1> 313 <1> ;; 'allocate_page' code is derived and modified from KolibriOS 314 <1> ;; 'alloc_page' procedure in 'memory.inc' 315 <1> ;; (25/08/2014, Revision: 5057) file 316 <1> ;; by KolibriOS Team (2004-2012) 317 <1> 318 <1> allocate_page: 319 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 320 <1> ; (temporary modifications) 321 <1> ; 01/07/2015 322 <1> ; 05/05/2015 323 <1> ; 30/04/2015 324 <1> ; 16/10/2014 325 <1> ; 08/10/2014 326 <1> ; 09/09/2014 (Retro UNIX 386 v1 - beginning) 327 <1> ; 328 <1> ; INPUT -> none 329 <1> ; 330 <1> ; OUTPUT -> 331 <1> ; EAX = PHYSICAL (real/flat) ADDRESS OF THE ALLOCATED PAGE 332 <1> ; (corresponding MEMORY ALLOCATION TABLE bit is RESET) 333 <1> ; 334 <1> ; CF = 1 and EAX = 0 335 <1> ; if there is not a free page to be allocated 336 <1> ; 337 <1> ; Modified Registers -> none (except EAX) 338 <1> ; 339 0000582A A1[B8760100] <1> mov eax, [free_pages] 340 0000582F 21C0 <1> and eax, eax 341 00005831 7438 <1> jz short out_of_memory 342 <1> ; 343 00005833 53 <1> push ebx 344 00005834 51 <1> push ecx 345 <1> ; 346 00005835 BB00001000 <1> mov ebx, MEM_ALLOC_TBL ; Memory Allocation Table offset 347 0000583A 89D9 <1> mov ecx, ebx 348 <1> ; NOTE: 32 (first_page) is initial 349 <1> ; value of [next_page]. 350 <1> ; It points to the first available 351 <1> ; page block for users (ring 3) ... 352 <1> ; (MAT offset 32 = 1024/32) 353 <1> ; (at the of the first 4 MB) 354 0000583C 031D[BC760100] <1> add ebx, [next_page] ; Free page searching starts from here 355 <1> ; next_free_page >> 5 356 00005842 030D[C0760100] <1> add ecx, [last_page] ; Free page searching ends here 357 <1> ; (total_pages - 1) >> 5 358 <1> al_p_scan: 359 00005848 39CB <1> cmp ebx, ecx 360 0000584A 770A <1> ja short al_p_notfound 361 <1> ; 362 <1> ; 01/07/2015 363 <1> ; AMD64 Architecture Programmer’s Manual 364 <1> ; Volume 3: 365 <1> ; General-Purpose and System Instructions 366 <1> ; 367 <1> ; BSF - Bit Scan Forward 368 <1> ; 369 <1> ; Searches the value in a register or a memory location 370 <1> ; (second operand) for the least-significant set bit. 371 <1> ; If a set bit is found, the instruction clears the zero flag (ZF) 372 <1> ; and stores the index of the least-significant set bit in a destination 373 <1> ; register (first operand). If the second operand contains 0, 374 <1> ; the instruction sets ZF to 1 and does not change the contents of the 375 <1> ; destination register. The bit index is an unsigned offset from bit 0 376 <1> ; of the searched value 377 <1> ; 378 0000584C 0FBC03 <1> bsf eax, [ebx] ; Scans source operand for first bit set (1). 379 <1> ; Clear ZF if a bit is found set (1) and 380 <1> ; loads the destination with an index to 381 <1> ; first set bit. (0 -> 31) 382 <1> ; Sets ZF to 1 if no bits are found set. 383 0000584F 751C <1> jnz short al_p_found ; ZF = 0 -> a free page has been found 384 <1> ; 385 <1> ; NOTE: a Memory Allocation Table bit 386 <1> ; with value of 1 means 387 <1> ; the corresponding page is free 388 <1> ; (Retro UNIX 386 v1 feature only!) 389 00005851 83C304 <1> add ebx, 4 390 <1> ; We return back for searching next page block 391 <1> ; NOTE: [free_pages] is not ZERO; so, 392 <1> ; we always will find at least 1 free page here. 393 00005854 EBF2 <1> jmp short al_p_scan 394 <1> ; 395 <1> al_p_notfound: 396 00005856 81E900001000 <1> sub ecx, MEM_ALLOC_TBL 397 0000585C 890D[BC760100] <1> mov [next_page], ecx ; next/first free page = last page 398 <1> ; (deallocate_page procedure will change it) 399 00005862 31C0 <1> xor eax, eax 400 00005864 A3[B8760100] <1> mov [free_pages], eax ; 0 401 00005869 59 <1> pop ecx 402 0000586A 5B <1> pop ebx 403 <1> ; 404 <1> ; 17/04/2021 405 <1> ; ('swap_out' procedure call is disabled as temporary) 406 <1> 407 <1> out_of_memory: 408 <1> ; call swap_out 409 <1> ; jnc short al_p_ok ; [free_pages] = 0, re-allocation by swap_out 410 <1> ; ; 411 <1> ; sub eax, eax ; 0 412 0000586B F9 <1> stc 413 0000586C C3 <1> retn 414 <1> 415 <1> al_p_found: 416 0000586D 89D9 <1> mov ecx, ebx 417 0000586F 81E900001000 <1> sub ecx, MEM_ALLOC_TBL 418 00005875 890D[BC760100] <1> mov [next_page], ecx ; Set first free page searching start 419 <1> ; address/offset (to the next) 420 0000587B FF0D[B8760100] <1> dec dword [free_pages] ; 1 page has been allocated (X = X-1) 421 <1> ; 422 00005881 0FB303 <1> btr [ebx], eax ; The destination bit indexed by the source value 423 <1> ; is copied into the Carry Flag and then cleared 424 <1> ; in the destination. 425 <1> ; 426 <1> ; Reset the bit which is corresponding to the 427 <1> ; (just) allocated page. 428 <1> ; 01/07/2015 (4*8 = 32, 1 allocation byte = 8 pages) 429 00005884 C1E103 <1> shl ecx, 3 ; (page block offset * 32) + page index 430 00005887 01C8 <1> add eax, ecx ; = page number 431 00005889 C1E00C <1> shl eax, 12 ; physical address of the page (flat/real value) 432 <1> ; EAX = physical address of memory page 433 <1> ; 434 <1> ; NOTE: The relevant page directory and page table entry will be updated 435 <1> ; according to this EAX value... 436 0000588C 59 <1> pop ecx 437 0000588D 5B <1> pop ebx 438 <1> al_p_ok: 439 0000588E C3 <1> retn 440 <1> 441 <1> make_page_dir: 442 <1> ; 18/04/2015 443 <1> ; 12/04/2015 444 <1> ; 23/10/2014 445 <1> ; 16/10/2014 446 <1> ; 09/10/2014 ; (Retro UNIX 386 v1 - beginning) 447 <1> ; 448 <1> ; INPUT -> 449 <1> ; none 450 <1> ; OUTPUT -> 451 <1> ; (EAX = 0) 452 <1> ; cf = 1 -> insufficient (out of) memory error 453 <1> ; cf = 0 -> 454 <1> ; u.pgdir = page directory (physical) address of the current 455 <1> ; process/user. 456 <1> ; 457 <1> ; Modified Registers -> EAX 458 <1> ; 459 0000588F E896FFFFFF <1> call allocate_page 460 00005894 7216 <1> jc short mkpd_error 461 <1> ; 462 00005896 A3[C48E0100] <1> mov [u.pgdir], eax ; Page dir address for current user/process 463 <1> ; (Physical address) 464 <1> clear_page: 465 <1> ; 18/04/2015 466 <1> ; 09/10/2014 ; (Retro UNIX 386 v1 - beginning) 467 <1> ; 468 <1> ; INPUT -> 469 <1> ; EAX = physical address of the page 470 <1> ; OUTPUT -> 471 <1> ; all bytes of the page will be cleared 472 <1> ; 473 <1> ; Modified Registers -> none 474 <1> ; 475 0000589B 57 <1> push edi 476 0000589C 51 <1> push ecx 477 0000589D 50 <1> push eax 478 0000589E B900040000 <1> mov ecx, PAGE_SIZE / 4 479 000058A3 89C7 <1> mov edi, eax 480 000058A5 31C0 <1> xor eax, eax 481 000058A7 F3AB <1> rep stosd 482 000058A9 58 <1> pop eax 483 000058AA 59 <1> pop ecx 484 000058AB 5F <1> pop edi 485 <1> mkpd_error: 486 <1> mkpt_error: 487 000058AC C3 <1> retn 488 <1> 489 <1> make_page_table: 490 <1> ; 23/06/2015 491 <1> ; 18/04/2015 492 <1> ; 12/04/2015 493 <1> ; 16/10/2014 494 <1> ; 09/10/2014 ; (Retro UNIX 386 v1 - beginning) 495 <1> ; 496 <1> ; INPUT -> 497 <1> ; EBX = virtual (linear) address 498 <1> ; ECX = page table attributes (lower 12 bits) 499 <1> ; (higher 20 bits must be ZERO) 500 <1> ; (bit 0 must be 1) 501 <1> ; u.pgdir = page directory (physical) address 502 <1> ; OUTPUT -> 503 <1> ; EDX = Page directory entry address 504 <1> ; EAX = Page table address 505 <1> ; cf = 1 -> insufficient (out of) memory error 506 <1> ; cf = 0 -> page table address in the PDE (EDX) 507 <1> ; 508 <1> ; Modified Registers -> EAX, EDX 509 <1> ; 510 000058AD E878FFFFFF <1> call allocate_page 511 000058B2 72F8 <1> jc short mkpt_error 512 000058B4 E811000000 <1> call set_pde 513 000058B9 EBE0 <1> jmp short clear_page 514 <1> 515 <1> make_page: 516 <1> ; 24/07/2015 517 <1> ; 23/06/2015 ; (Retro UNIX 386 v1 - beginning) 518 <1> ; 519 <1> ; INPUT -> 520 <1> ; EBX = virtual (linear) address 521 <1> ; ECX = page attributes (lower 12 bits) 522 <1> ; (higher 20 bits must be ZERO) 523 <1> ; (bit 0 must be 1) 524 <1> ; u.pgdir = page directory (physical) address 525 <1> ; OUTPUT -> 526 <1> ; EBX = Virtual address 527 <1> ; (EDX = PTE value) 528 <1> ; EAX = Physical address 529 <1> ; cf = 1 -> insufficient (out of) memory error 530 <1> ; 531 <1> ; Modified Registers -> EAX, EDX 532 <1> ; 533 000058BB E86AFFFFFF <1> call allocate_page 534 000058C0 7207 <1> jc short mkp_err 535 000058C2 E821000000 <1> call set_pte 536 000058C7 73D2 <1> jnc short clear_page ; 18/04/2015 537 <1> mkp_err: 538 000058C9 C3 <1> retn 539 <1> 540 <1> 541 <1> set_pde: ; Set page directory entry (PDE) 542 <1> ; 20/07/2015 543 <1> ; 18/04/2015 544 <1> ; 12/04/2015 545 <1> ; 23/10/2014 546 <1> ; 10/10/2014 ; (Retro UNIX 386 v1 - beginning) 547 <1> ; 548 <1> ; INPUT -> 549 <1> ; EAX = physical address 550 <1> ; (use present value if EAX = 0) 551 <1> ; EBX = virtual (linear) address 552 <1> ; ECX = page table attributes (lower 12 bits) 553 <1> ; (higher 20 bits must be ZERO) 554 <1> ; (bit 0 must be 1) 555 <1> ; u.pgdir = page directory (physical) address 556 <1> ; OUTPUT -> 557 <1> ; EDX = PDE address 558 <1> ; EAX = page table address (physical) 559 <1> ; ;(CF=1 -> Invalid page address) 560 <1> ; 561 <1> ; Modified Registers -> EDX 562 <1> ; 563 000058CA 89DA <1> mov edx, ebx 564 000058CC C1EA16 <1> shr edx, PAGE_D_SHIFT ; 22 565 000058CF C1E202 <1> shl edx, 2 ; offset to page directory (1024*4) 566 000058D2 0315[C48E0100] <1> add edx, [u.pgdir] 567 <1> ; 568 000058D8 21C0 <1> and eax, eax 569 000058DA 7506 <1> jnz short spde_1 570 <1> ; 571 000058DC 8B02 <1> mov eax, [edx] ; old PDE value 572 <1> ;test al, 1 573 <1> ;jz short spde_2 574 000058DE 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 bits 575 <1> spde_1: 576 <1> ;and cx, 0FFFh 577 000058E2 8902 <1> mov [edx], eax 578 000058E4 66090A <1> or [edx], cx 579 000058E7 C3 <1> retn 580 <1> ;spde_2: ; error 581 <1> ; stc 582 <1> ; retn 583 <1> 584 <1> set_pte: ; Set page table entry (PTE) 585 <1> ; 24/07/2015 586 <1> ; 20/07/2015 587 <1> ; 23/06/2015 588 <1> ; 18/04/2015 589 <1> ; 12/04/2015 590 <1> ; 10/10/2014 ; (Retro UNIX 386 v1 - beginning) 591 <1> ; 592 <1> ; INPUT -> 593 <1> ; EAX = physical page address 594 <1> ; (use present value if EAX = 0) 595 <1> ; EBX = virtual (linear) address 596 <1> ; ECX = page attributes (lower 12 bits) 597 <1> ; (higher 20 bits must be ZERO) 598 <1> ; (bit 0 must be 1) 599 <1> ; u.pgdir = page directory (physical) address 600 <1> ; OUTPUT -> 601 <1> ; EAX = physical page address 602 <1> ; (EDX = PTE value) 603 <1> ; EBX = virtual address 604 <1> ; 605 <1> ; CF = 1 -> error 606 <1> ; 607 <1> ; Modified Registers -> EAX, EDX 608 <1> ; 609 000058E8 50 <1> push eax 610 000058E9 A1[C48E0100] <1> mov eax, [u.pgdir] ; 20/07/2015 611 000058EE E837000000 <1> call get_pde 612 <1> ; EDX = PDE address 613 <1> ; EAX = PDE value 614 000058F3 5A <1> pop edx ; physical page address 615 000058F4 722A <1> jc short spte_err ; PDE not present 616 <1> ; 617 000058F6 53 <1> push ebx ; 24/07/2015 618 000058F7 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 bits 619 <1> ; EDX = PT address (physical) 620 000058FB C1EB0C <1> shr ebx, PAGE_SHIFT ; 12 621 000058FE 81E3FF030000 <1> and ebx, PTE_MASK ; 03FFh 622 <1> ; clear higher 10 bits (PD bits) 623 00005904 C1E302 <1> shl ebx, 2 ; offset to page table (1024*4) 624 00005907 01C3 <1> add ebx, eax 625 <1> ; 626 00005909 8B03 <1> mov eax, [ebx] ; Old PTE value 627 0000590B A801 <1> test al, 1 628 0000590D 740C <1> jz short spte_0 629 0000590F 09D2 <1> or edx, edx 630 00005911 750F <1> jnz short spte_1 631 00005913 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear lower 12 bits 632 00005917 89C2 <1> mov edx, eax 633 00005919 EB09 <1> jmp short spte_2 634 <1> spte_0: 635 <1> ; If this PTE contains a swap (disk) address, 636 <1> ; it can be updated by using 'swap_in' procedure 637 <1> ; only! 638 0000591B 21C0 <1> and eax, eax 639 0000591D 7403 <1> jz short spte_1 640 <1> ; 24/07/2015 641 <1> ; swapped page ! (on disk) 642 0000591F 5B <1> pop ebx 643 <1> spte_err: 644 00005920 F9 <1> stc 645 00005921 C3 <1> retn 646 <1> spte_1: 647 00005922 89D0 <1> mov eax, edx 648 <1> spte_2: 649 00005924 09CA <1> or edx, ecx 650 <1> ; 23/06/2015 651 00005926 8913 <1> mov [ebx], edx ; PTE value in EDX 652 <1> ; 24/07/2015 653 00005928 5B <1> pop ebx 654 00005929 C3 <1> retn 655 <1> 656 <1> get_pde: ; Get present value of the relevant PDE 657 <1> ; 20/07/2015 658 <1> ; 18/04/2015 659 <1> ; 12/04/2015 660 <1> ; 10/10/2014 ; (Retro UNIX 386 v1 - beginning) 661 <1> ; 662 <1> ; INPUT -> 663 <1> ; EBX = virtual (linear) address 664 <1> ; EAX = page directory (physical) address 665 <1> ; OUTPUT -> 666 <1> ; EDX = Page directory entry address 667 <1> ; EAX = Page directory entry value 668 <1> ; CF = 1 -> PDE not present or invalid ? 669 <1> ; Modified Registers -> EDX, EAX 670 <1> ; 671 0000592A 89DA <1> mov edx, ebx 672 0000592C C1EA16 <1> shr edx, PAGE_D_SHIFT ; 22 (12+10) 673 0000592F C1E202 <1> shl edx, 2 ; offset to page directory (1024*4) 674 00005932 01C2 <1> add edx, eax ; page directory address (physical) 675 00005934 8B02 <1> mov eax, [edx] 676 00005936 A801 <1> test al, PDE_A_PRESENT ; page table is present or not ! 677 00005938 751F <1> jnz short gpte_retn 678 0000593A F9 <1> stc 679 <1> gpde_retn: 680 0000593B C3 <1> retn 681 <1> 682 <1> get_pte: 683 <1> ; Get present value of the relevant PTE 684 <1> ; 29/07/2015 685 <1> ; 20/07/2015 686 <1> ; 18/04/2015 687 <1> ; 12/04/2015 688 <1> ; 10/10/2014 ; (Retro UNIX 386 v1 - beginning) 689 <1> ; 690 <1> ; INPUT -> 691 <1> ; EBX = virtual (linear) address 692 <1> ; EAX = page directory (physical) address 693 <1> ; OUTPUT -> 694 <1> ; EDX = Page table entry address (if CF=0) 695 <1> ; Page directory entry address (if CF=1) 696 <1> ; (Bit 0 value is 0 if PT is not present) 697 <1> ; EAX = Page table entry value (page address) 698 <1> ; CF = 1 -> PDE not present or invalid ? 699 <1> ; Modified Registers -> EAX, EDX 700 <1> ; 701 0000593C E8E9FFFFFF <1> call get_pde 702 00005941 72F8 <1> jc short gpde_retn ; page table is not present 703 <1> ;jnc short gpte_1 704 <1> ;retn 705 <1> ;gpte_1: 706 00005943 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 bits 707 00005947 89DA <1> mov edx, ebx 708 00005949 C1EA0C <1> shr edx, PAGE_SHIFT ; 12 709 0000594C 81E2FF030000 <1> and edx, PTE_MASK ; 03FFh 710 <1> ; clear higher 10 bits (PD bits) 711 00005952 C1E202 <1> shl edx, 2 ; offset from start of page table (1024*4) 712 00005955 01C2 <1> add edx, eax 713 00005957 8B02 <1> mov eax, [edx] 714 <1> gpte_retn: 715 00005959 C3 <1> retn 716 <1> 717 <1> deallocate_page_dir: 718 <1> ; 15/09/2015 719 <1> ; 05/08/2015 720 <1> ; 30/04/2015 721 <1> ; 28/04/2015 722 <1> ; 17/10/2014 723 <1> ; 12/10/2014 (Retro UNIX 386 v1 - beginning) 724 <1> ; 725 <1> ; INPUT -> 726 <1> ; EAX = PHYSICAL ADDRESS OF THE PAGE DIRECTORY (CHILD) 727 <1> ; EBX = PHYSICAL ADDRESS OF THE PARENT'S PAGE DIRECTORY 728 <1> ; OUTPUT -> 729 <1> ; All of page tables in the page directory 730 <1> ; and page dir's itself will be deallocated 731 <1> ; except 'read only' duplicated pages (will be converted 732 <1> ; to writable pages). 733 <1> ; 734 <1> ; Modified Registers -> EAX 735 <1> ; 736 <1> ; 737 0000595A 56 <1> push esi 738 0000595B 51 <1> push ecx 739 0000595C 50 <1> push eax 740 0000595D 89C6 <1> mov esi, eax 741 0000595F 31C9 <1> xor ecx, ecx 742 <1> ; The 1st PDE points to Kernel Page Table 0 (the 1st 4MB), 743 <1> ; it must not be deallocated 744 00005961 890E <1> mov [esi], ecx ; 0 ; clear PDE 0 745 <1> dapd_0: 746 00005963 AD <1> lodsd 747 00005964 A801 <1> test al, PDE_A_PRESENT ; bit 0, present flag (must be 1) 748 00005966 7409 <1> jz short dapd_1 749 00005968 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 750 0000596C E812000000 <1> call deallocate_page_table 751 <1> dapd_1: 752 00005971 41 <1> inc ecx ; page directory entry index 753 00005972 81F900040000 <1> cmp ecx, PAGE_SIZE / 4 ; 1024 754 00005978 72E9 <1> jb short dapd_0 755 <1> dapd_2: 756 0000597A 58 <1> pop eax 757 0000597B E869000000 <1> call deallocate_page ; deallocate the page dir's itself 758 00005980 59 <1> pop ecx 759 00005981 5E <1> pop esi 760 00005982 C3 <1> retn 761 <1> 762 <1> deallocate_page_table: 763 <1> ; 29/08/2023 - TRDOS 386 v2.0.6 764 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 765 <1> ; (temporary modifications) 766 <1> ; 12/07/2016 767 <1> ; 19/09/2015 768 <1> ; 15/09/2015 769 <1> ; 05/08/2015 770 <1> ; 30/04/2015 771 <1> ; 28/04/2015 772 <1> ; 24/10/2014 773 <1> ; 23/10/2014 774 <1> ; 12/10/2014 (Retro UNIX 386 v1 - beginning) 775 <1> ; 776 <1> ; INPUT -> 777 <1> ; EAX = PHYSICAL (real/flat) ADDRESS OF THE PAGE TABLE 778 <1> ; EBX = PHYSICAL ADDRESS OF THE PARENT'S PAGE DIRECTORY 779 <1> ; (ECX = page directory entry index) 780 <1> ; OUTPUT -> 781 <1> ; All of pages in the page table and page table's itself 782 <1> ; will be deallocated except 'read only' duplicated pages 783 <1> ; (will be converted to writable pages). 784 <1> ; 785 <1> ; Modified Registers -> EAX 786 <1> ; 787 00005983 56 <1> push esi 788 00005984 57 <1> push edi 789 00005985 52 <1> push edx 790 00005986 50 <1> push eax ; * 791 00005987 89C6 <1> mov esi, eax 792 00005989 31FF <1> xor edi, edi ; 0 793 <1> dapt_0: 794 0000598B AD <1> lodsd 795 0000598C A801 <1> test al, PTE_A_PRESENT ; bit 0, present flag (must be 1) 796 0000598E 744C <1> jz short dapt_1 797 <1> ; 798 00005990 A802 <1> test al, PTE_A_WRITE ; bit 1, writable (r/w) flag 799 <1> ; (must be 1) 800 00005992 753D <1> jnz short dapt_3 801 <1> ; Read only -duplicated- page (belongs to a parent or a child) 802 00005994 66A90002 <1> test ax, PTE_DUPLICATED ; Was this page duplicated 803 <1> ; as child's page ? 804 00005998 7442 <1> jz short dapt_4 ; Clear PTE but don't deallocate the page! 805 <1> ; check the parent's PTE value is read only & same page or not.. 806 <1> ; ECX = page directory entry index (0-1023) 807 0000599A 53 <1> push ebx 808 0000599B 51 <1> push ecx 809 <1> ;shl cx, 2 ; *4 810 <1> ; 29/08/2023 811 0000599C C1E102 <1> shl ecx, 2 812 0000599F 01CB <1> add ebx, ecx ; PDE offset (for the parent) 813 000059A1 8B0B <1> mov ecx, [ebx] 814 000059A3 F6C101 <1> test cl, PDE_A_PRESENT ; present (valid) or not ? 815 000059A6 7427 <1> jz short dapt_2 ; parent process does not use this page 816 000059A8 6681E100F0 <1> and cx, PDE_A_CLEAR ; 0F000h ; Clear attribute bits 817 <1> ; EDI = page table entry index (0-1023) 818 000059AD 89FA <1> mov edx, edi 819 <1> ;shl dx, 2 ; *4 820 <1> ; 29/08/2023 821 000059AF C1E202 <1> shl edx, 2 822 000059B2 01CA <1> add edx, ecx ; PTE offset (for the parent) 823 000059B4 8B1A <1> mov ebx, [edx] 824 000059B6 F6C301 <1> test bl, PTE_A_PRESENT ; present or not ? 825 000059B9 7414 <1> jz short dapt_2 ; parent process does not use this page 826 000059BB 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 827 000059BF 6681E300F0 <1> and bx, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 828 000059C4 39D8 <1> cmp eax, ebx ; parent's and child's pages are same ? 829 000059C6 7507 <1> jne short dapt_2 ; not same page 830 <1> ; deallocate the child's page 831 000059C8 800A02 <1> or byte [edx], PTE_A_WRITE ; convert to writable page (parent) 832 000059CB 59 <1> pop ecx 833 000059CC 5B <1> pop ebx 834 000059CD EB0D <1> jmp short dapt_4 835 <1> 836 <1> ; 17/04/2021 837 <1> ; ('dapt_1' is disabled as temporary) 838 <1> ; 839 <1> ;dapt_1: 840 <1> ; or eax, eax ; swapped page ? 841 <1> ; jz short dapt_5 ; no 842 <1> ; ; yes 843 <1> ; shr eax, 1 844 <1> ; call unlink_swap_block ; Deallocate swapped page block 845 <1> ; ; on the swap disk (or in file) 846 <1> ; jmp short dapt_5 847 <1> dapt_2: 848 000059CF 59 <1> pop ecx 849 000059D0 5B <1> pop ebx 850 <1> dapt_3: 851 <1> ; 12/07/2016 852 000059D1 66A90004 <1> test ax, PTE_SHARED ; shared or direct memory access indicator 853 000059D5 7505 <1> jnz short dapt_4 ; AVL bit 1 = 1, do not deallocate this page! 854 <1> ; 855 <1> ;and ax, PTE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 856 000059D7 E80D000000 <1> call deallocate_page ; set the mem allocation bit of this page 857 <1> dapt_4: 858 <1> ; 20/10/2023 859 <1> ; PTE clearing here was/is not necessary 860 <1> ; because this page table is being deallocated 861 <1> ; and it's PTEs will be ineffective. 862 <1> 863 <1> ;mov dword [esi-4], 0 ; clear/reset PTE (child, dupl. as parent) 864 <1> 865 <1> dapt_1: ; 17/04/2021 (temporary) 866 <1> dapt_5: 867 000059DC 47 <1> inc edi ; page table entry index 868 000059DD 81FF00040000 <1> cmp edi, PAGE_SIZE / 4 ; 1024 869 000059E3 72A6 <1> jb short dapt_0 870 <1> ; 871 000059E5 58 <1> pop eax ; * 872 000059E6 5A <1> pop edx 873 000059E7 5F <1> pop edi 874 000059E8 5E <1> pop esi 875 <1> ; 876 <1> ;call deallocate_page ; deallocate the page table's itself 877 <1> ;retn 878 <1> 879 <1> deallocate_page: 880 <1> ; 15/09/2015 881 <1> ; 28/04/2015 882 <1> ; 10/03/2015 883 <1> ; 17/10/2014 884 <1> ; 12/10/2014 (Retro UNIX 386 v1 - beginning) 885 <1> ; 886 <1> ; INPUT -> 887 <1> ; EAX = PHYSICAL (real/flat) ADDRESS OF THE ALLOCATED PAGE 888 <1> ; OUTPUT -> 889 <1> ; [free_pages] is increased 890 <1> ; (corresponding MEMORY ALLOCATION TABLE bit is SET) 891 <1> ; CF = 1 if the page is already deallocated 892 <1> ; (or not allocated) before. 893 <1> ; 894 <1> ; Modified Registers -> EAX 895 <1> ; 896 000059E9 53 <1> push ebx 897 000059EA 52 <1> push edx 898 <1> ; 899 000059EB C1E80C <1> shr eax, PAGE_SHIFT ; shift physical address to 900 <1> ; 12 bits right 901 <1> ; to get page number 902 000059EE 89C2 <1> mov edx, eax 903 <1> ; 15/09/2015 904 000059F0 C1EA03 <1> shr edx, 3 ; to get offset to M.A.T. 905 <1> ; (1 allocation bit = 1 page) 906 <1> ; (1 allocation bytes = 8 pages) 907 000059F3 80E2FC <1> and dl, 0FCh ; clear lower 2 bits 908 <1> ; (to get 32 bit position) 909 <1> ; 910 000059F6 BB00001000 <1> mov ebx, MEM_ALLOC_TBL ; Memory Allocation Table address 911 000059FB 01D3 <1> add ebx, edx 912 000059FD 83E01F <1> and eax, 1Fh ; lower 5 bits only 913 <1> ; (allocation bit position) 914 00005A00 3B15[BC760100] <1> cmp edx, [next_page] ; is the new free page address lower 915 <1> ; than the address in 'next_page' ? 916 <1> ; (next/first free page value) 917 00005A06 7306 <1> jnb short dap_1 ; no 918 00005A08 8915[BC760100] <1> mov [next_page], edx ; yes 919 <1> dap_1: 920 00005A0E 0FAB03 <1> bts [ebx], eax ; unlink/release/deallocate page 921 <1> ; set relevant bit to 1. 922 <1> ; set CF to the previous bit value 923 <1> ;cmc ; complement carry flag 924 <1> ;jc short dap_2 ; do not increase free_pages count 925 <1> ; if the page is already deallocated 926 <1> ; before. 927 00005A11 FF05[B8760100] <1> inc dword [free_pages] 928 <1> dap_2: 929 00005A17 5A <1> pop edx 930 00005A18 5B <1> pop ebx 931 00005A19 C3 <1> retn 932 <1> 933 <1> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 934 <1> ;; ;; 935 <1> ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; 936 <1> ;; Distributed under terms of the GNU General Public License ;; 937 <1> ;; ;; 938 <1> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 939 <1> 940 <1> ;;$Revision: 5057 $ 941 <1> 942 <1> 943 <1> ;;align 4 944 <1> ;;proc alloc_page 945 <1> 946 <1> ;; pushfd 947 <1> ;; cli 948 <1> ;; push ebx 949 <1> ;;;//- 950 <1> ;; cmp [pg_data.pages_free], 1 951 <1> ;; jle .out_of_memory 952 <1> ;;;//- 953 <1> ;; 954 <1> ;; mov ebx, [page_start] 955 <1> ;; mov ecx, [page_end] 956 <1> ;;.l1: 957 <1> ;; bsf eax, [ebx]; 958 <1> ;; jnz .found 959 <1> ;; add ebx, 4 960 <1> ;; cmp ebx, ecx 961 <1> ;; jb .l1 962 <1> ;; pop ebx 963 <1> ;; popfd 964 <1> ;; xor eax, eax 965 <1> ;; ret 966 <1> ;;.found: 967 <1> ;;;//- 968 <1> ;; dec [pg_data.pages_free] 969 <1> ;; jz .out_of_memory 970 <1> ;;;//- 971 <1> ;; btr [ebx], eax 972 <1> ;; mov [page_start], ebx 973 <1> ;; sub ebx, sys_pgmap 974 <1> ;; lea eax, [eax+ebx*8] 975 <1> ;; shl eax, 12 976 <1> ;;;//- dec [pg_data.pages_free] 977 <1> ;; pop ebx 978 <1> ;; popfd 979 <1> ;; ret 980 <1> ;;;//- 981 <1> ;;.out_of_memory: 982 <1> ;; mov [pg_data.pages_free], 1 983 <1> ;; xor eax, eax 984 <1> ;; pop ebx 985 <1> ;; popfd 986 <1> ;; ret 987 <1> ;;;//- 988 <1> ;;endp 989 <1> 990 <1> duplicate_page_dir: 991 <1> ; 21/09/2015 992 <1> ; 31/08/2015 993 <1> ; 20/07/2015 994 <1> ; 28/04/2015 995 <1> ; 27/04/2015 996 <1> ; 18/04/2015 997 <1> ; 12/04/2015 998 <1> ; 18/10/2014 999 <1> ; 16/10/2014 (Retro UNIX 386 v1 - beginning) 1000 <1> ; 1001 <1> ; INPUT -> 1002 <1> ; [u.pgdir] = PHYSICAL (real/flat) ADDRESS of the parent's 1003 <1> ; page directory. 1004 <1> ; OUTPUT -> 1005 <1> ; EAX = PHYSICAL (real/flat) ADDRESS of the child's 1006 <1> ; page directory. 1007 <1> ; (New page directory with new page table entries.) 1008 <1> ; (New page tables with read only copies of the parent's 1009 <1> ; pages.) 1010 <1> ; EAX = 0 -> Error (CF = 1) 1011 <1> ; 1012 <1> ; Modified Registers -> none (except EAX) 1013 <1> ; 1014 00005A1A E80BFEFFFF <1> call allocate_page 1015 00005A1F 723E <1> jc short dpd_err 1016 <1> ; 1017 00005A21 55 <1> push ebp ; 20/07/2015 1018 00005A22 56 <1> push esi 1019 00005A23 57 <1> push edi 1020 00005A24 53 <1> push ebx 1021 00005A25 51 <1> push ecx 1022 00005A26 8B35[C48E0100] <1> mov esi, [u.pgdir] 1023 00005A2C 89C7 <1> mov edi, eax 1024 00005A2E 50 <1> push eax ; save child's page directory address 1025 <1> ; 31/08/2015 1026 <1> ; copy PDE 0 from the parent's page dir to the child's page dir 1027 <1> ; (use same system space for all user page tables) 1028 00005A2F A5 <1> movsd 1029 00005A30 BD00004000 <1> mov ebp, 1024*4096 ; pass the 1st 4MB (system space) 1030 00005A35 B9FF030000 <1> mov ecx, (PAGE_SIZE / 4) - 1 ; 1023 1031 <1> dpd_0: 1032 00005A3A AD <1> lodsd 1033 <1> ;or eax, eax 1034 <1> ;jnz short dpd_1 1035 00005A3B A801 <1> test al, PDE_A_PRESENT ; bit 0 = 1 1036 00005A3D 7508 <1> jnz short dpd_1 1037 <1> ; 20/07/2015 (virtual address at the end of the page table) 1038 00005A3F 81C500004000 <1> add ebp, 1024*4096 ; page size * PTE count 1039 00005A45 EB0F <1> jmp short dpd_2 1040 <1> dpd_1: 1041 00005A47 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear attribute bits 1042 00005A4B 89C3 <1> mov ebx, eax 1043 <1> ; EBX = Parent's page table address 1044 00005A4D E81F000000 <1> call duplicate_page_table 1045 00005A52 720C <1> jc short dpd_p_err 1046 <1> ; EAX = Child's page table address 1047 00005A54 0C07 <1> or al, PDE_A_PRESENT + PDE_A_WRITE + PDE_A_USER 1048 <1> ; set bit 0, bit 1 and bit 2 to 1 1049 <1> ; (present, writable, user) 1050 <1> dpd_2: 1051 00005A56 AB <1> stosd 1052 00005A57 E2E1 <1> loop dpd_0 1053 <1> ; 1054 00005A59 58 <1> pop eax ; restore child's page directory address 1055 <1> dpd_3: 1056 00005A5A 59 <1> pop ecx 1057 00005A5B 5B <1> pop ebx 1058 00005A5C 5F <1> pop edi 1059 00005A5D 5E <1> pop esi 1060 00005A5E 5D <1> pop ebp ; 20/07/2015 1061 <1> dpd_err: 1062 00005A5F C3 <1> retn 1063 <1> dpd_p_err: 1064 <1> ; release the allocated pages missing (recover free space) 1065 00005A60 58 <1> pop eax ; the new page directory address (physical) 1066 00005A61 8B1D[C48E0100] <1> mov ebx, [u.pgdir] ; parent's page directory address 1067 00005A67 E8EEFEFFFF <1> call deallocate_page_dir 1068 00005A6C 29C0 <1> sub eax, eax ; 0 1069 00005A6E F9 <1> stc 1070 00005A6F EBE9 <1> jmp short dpd_3 1071 <1> 1072 <1> duplicate_page_table: 1073 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 1074 <1> ; (temporary modifications) 1075 <1> ; 20/02/2017 1076 <1> ; 21/09/2015 1077 <1> ; 20/07/2015 1078 <1> ; 05/05/2015 1079 <1> ; 28/04/2015 1080 <1> ; 27/04/2015 1081 <1> ; 18/04/2015 1082 <1> ; 18/10/2014 1083 <1> ; 16/10/2014 (Retro UNIX 386 v1 - beginning) 1084 <1> ; 1085 <1> ; INPUT -> 1086 <1> ; EBX = PHYSICAL (real/flat) ADDRESS of the parent's page table. 1087 <1> ; 20/02/2017 1088 <1> ; EBP = Linear address of the page (from 'duplicate_page_dir') 1089 <1> ; (Linear address = CORE + user's virtual address) 1090 <1> ; OUTPUT -> 1091 <1> ; EAX = PHYSICAL (real/flat) ADDRESS of the child's page table. 1092 <1> ; (with 'read only' attribute of page table entries) 1093 <1> ; 20/02/2017 1094 <1> ; EBP = Next linear page address (for 'duplicate_page_dir') 1095 <1> ; 1096 <1> ; CF = 1 -> error 1097 <1> ; 1098 <1> ; Modified Registers -> EBP (except EAX) 1099 <1> ; 1100 00005A71 E8B4FDFFFF <1> call allocate_page 1101 00005A76 7258 <1> jc short dpt_err 1102 <1> ; 1103 00005A78 50 <1> push eax ; * 1104 00005A79 56 <1> push esi 1105 00005A7A 57 <1> push edi 1106 00005A7B 52 <1> push edx 1107 00005A7C 51 <1> push ecx 1108 <1> ; 1109 00005A7D 89DE <1> mov esi, ebx 1110 00005A7F 89C7 <1> mov edi, eax 1111 00005A81 89C2 <1> mov edx, eax 1112 00005A83 81C200100000 <1> add edx, PAGE_SIZE 1113 <1> dpt_0: 1114 00005A89 AD <1> lodsd 1115 00005A8A 21C0 <1> and eax, eax 1116 00005A8C 7432 <1> jz short dpt_3 1117 00005A8E A801 <1> test al, PTE_A_PRESENT ; bit 0 = 1 1118 <1> ; 17/04/2021 (temporary) 1119 <1> ;jnz short dpt_1 1120 00005A90 7439 <1> jz short dpt_p_err 1121 <1> 1122 <1> ; 17/04/2021 1123 <1> ; ('reload_page' procedure call is disabled as temporary) 1124 <1> ; 1125 <1> ; ; 20/07/2015 1126 <1> ; ; ebp = virtual (linear) address of the memory page 1127 <1> ; call reload_page ; 28/04/2015 1128 <1> ; jc short dpt_p_err 1129 <1> dpt_1: 1130 <1> ; 21/09/2015 1131 00005A92 89C1 <1> mov ecx, eax 1132 00005A94 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear attribute bits 1133 00005A98 F6C102 <1> test cl, PTE_A_WRITE ; writable page ? 1134 00005A9B 751A <1> jnz short dpt_2 1135 <1> ; Read only (parent) page 1136 <1> ; - there is a third process which uses this page - 1137 <1> ; Allocate a new page for the child process 1138 00005A9D E888FDFFFF <1> call allocate_page 1139 00005AA2 7227 <1> jc short dpt_p_err 1140 00005AA4 57 <1> push edi 1141 00005AA5 56 <1> push esi 1142 00005AA6 89CE <1> mov esi, ecx 1143 00005AA8 89C7 <1> mov edi, eax 1144 00005AAA B900040000 <1> mov ecx, PAGE_SIZE/4 1145 00005AAF F3A5 <1> rep movsd ; copy page (4096 bytes) 1146 00005AB1 5E <1> pop esi 1147 00005AB2 5F <1> pop edi 1148 <1> ; 1149 <1> 1150 <1> ; 17/04/2021 1151 <1> ; ('add_to_swap_queue' procedure call is disabled as temporary) 1152 <1> ; 1153 <1> ; push ebx 1154 <1> ; push eax 1155 <1> ; ; 20/07/2015 1156 <1> ; mov ebx, ebp 1157 <1> ; ; ebx = virtual (linear) address of the memory page 1158 <1> ; call add_to_swap_queue 1159 <1> ; pop eax 1160 <1> ; pop ebx 1161 <1> 1162 <1> ; 21/09/2015 1163 00005AB3 0C07 <1> or al, PTE_A_USER+PTE_A_WRITE+PTE_A_PRESENT 1164 <1> ; user + writable + present page 1165 00005AB5 EB09 <1> jmp short dpt_3 1166 <1> dpt_2: 1167 <1> ;or ax, PTE_A_USER+PTE_A_PRESENT 1168 00005AB7 0C05 <1> or al, PTE_A_USER+PTE_A_PRESENT 1169 <1> ; (read only page!) 1170 00005AB9 8946FC <1> mov [esi-4], eax ; update parent's PTE 1171 00005ABC 660D0002 <1> or ax, PTE_DUPLICATED ; (read only page & duplicated PTE!) 1172 <1> dpt_3: 1173 00005AC0 AB <1> stosd ; EDI points to child's PTE 1174 <1> ; 1175 00005AC1 81C500100000 <1> add ebp, 4096 ; 20/07/2015 (next page) 1176 <1> ; 1177 00005AC7 39D7 <1> cmp edi, edx 1178 00005AC9 72BE <1> jb short dpt_0 1179 <1> dpt_p_err: 1180 00005ACB 59 <1> pop ecx 1181 00005ACC 5A <1> pop edx 1182 00005ACD 5F <1> pop edi 1183 00005ACE 5E <1> pop esi 1184 00005ACF 58 <1> pop eax ; * 1185 <1> dpt_err: 1186 00005AD0 C3 <1> retn 1187 <1> 1188 <1> page_fault_handler: ; CPU EXCEPTION 0Eh (14) : Page Fault ! 1189 <1> ; 09/02/2026 - TRDOS 386 v2.0.10 1190 <1> ; 29/11/2023 - TRDOS 386 v2.0.7 1191 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 1192 <1> ; (temporary modifications) 1193 <1> ; 21/09/2015 1194 <1> ; 19/09/2015 1195 <1> ; 17/09/2015 1196 <1> ; 28/08/2015 1197 <1> ; 20/07/2015 1198 <1> ; 28/06/2015 1199 <1> ; 03/05/2015 1200 <1> ; 30/04/2015 1201 <1> ; 18/04/2015 1202 <1> ; 12/04/2015 1203 <1> ; 30/10/2014 1204 <1> ; 11/09/2014 1205 <1> ; 10/09/2014 (Retro UNIX 386 v1 - beginning) 1206 <1> ; 1207 <1> ; Note: This is not an interrupt/exception handler. 1208 <1> ; This is a 'page fault remedy' subroutine 1209 <1> ; which will be called by standard/uniform 1210 <1> ; exception handler. 1211 <1> ; 1212 <1> ; INPUT -> 1213 <1> ; [error_code] = 32 bit ERROR CODE (lower 5 bits are valid) 1214 <1> ; 1215 <1> ; cr2 = the virtual (linear) address 1216 <1> ; which has caused to page fault (19/09/2015) 1217 <1> ; 1218 <1> ; OUTPUT -> 1219 <1> ; (corresponding PAGE TABLE ENTRY is mapped/set) 1220 <1> ; EAX = 0 -> no error 1221 <1> ; EAX > 0 -> error code in EAX (also CF = 1) 1222 <1> ; 1223 <1> ; Modified Registers -> none (except EAX) 1224 <1> ; 1225 <1> ; 1226 <1> ; ERROR CODE: 1227 <1> ; 31 ..... 4 3 2 1 0 1228 <1> ; +---+-- --+---+---+---+---+---+---+ 1229 <1> ; | Reserved | I | R | U | W | P | 1230 <1> ; +---+-- --+---+---+---+---+---+---+ 1231 <1> ; 1232 <1> ; P : PRESENT - When set, the page fault was caused by 1233 <1> ; a page-protection violation. When not set, 1234 <1> ; it was caused by a non-present page. 1235 <1> ; W : WRITE - When set, the page fault was caused by 1236 <1> ; a page write. When not set, it was caused 1237 <1> ; by a page read. 1238 <1> ; U : USER - When set, the page fault was caused 1239 <1> ; while CPL = 3. 1240 <1> ; This does not necessarily mean that 1241 <1> ; the page fault was a privilege violation. 1242 <1> ; R : RESERVD - When set, the page fault was caused by 1243 <1> ; WRITE reading a 1 in a reserved field. 1244 <1> ; I : INSTRUC - When set, the page fault was caused by 1245 <1> ; FETCH an instruction fetch 1246 <1> ; 1247 <1> ;; x86 (32 bit) VIRTUAL ADDRESS TRANSLATION 1248 <1> ; 31 22 12 11 0 1249 <1> ; +-------------------+-------------------+-----------------------+ 1250 <1> ; | PAGE DIR. ENTRY # | PAGE TAB. ENTRY # | OFFSET | 1251 <1> ; +-------------------+-------------------+-----------------------+ 1252 <1> ; 1253 <1> 1254 <1> ;; CR3 REGISTER (Control Register 3) 1255 <1> ; 31 12 5 4 3 2 0 1256 <1> ; +---------------------------------------+-------------+---+-----+ 1257 <1> ; | | |P|P| | 1258 <1> ; | PAGE DIRECTORY TABLE BASE ADDRESS | reserved |C|W|rsvrd| 1259 <1> ; | | |D|T| | 1260 <1> ; +---------------------------------------+-------------+---+-----+ 1261 <1> ; 1262 <1> ; PWT - WRITE THROUGH 1263 <1> ; PCD - CACHE DISABLE 1264 <1> ; 1265 <1> ; 1266 <1> ;; x86 PAGE DIRECTORY ENTRY (4 KByte Page) 1267 <1> ; 31 12 11 9 8 7 6 5 4 3 2 1 0 1268 <1> ; +---------------------------------------+-----+---+-+-+---+-+-+-+ 1269 <1> ; | | | | | | |P|P|U|R| | 1270 <1> ; | PAGE TABLE BASE ADDRESS 31..12 | AVL |G|0|D|A|C|W|/|/|P| 1271 <1> ; | | | | | | |D|T|S|W| | 1272 <1> ; +---------------------------------------+-----+---+-+-+---+-+-+-+ 1273 <1> ; 1274 <1> ; P - PRESENT 1275 <1> ; R/W - READ/WRITE 1276 <1> ; U/S - USER/SUPERVISOR 1277 <1> ; PWT - WRITE THROUGH 1278 <1> ; PCD - CACHE DISABLE 1279 <1> ; A - ACCESSED 1280 <1> ; D - DIRTY (IGNORED) 1281 <1> ; PAT - PAGE ATTRIBUTE TABLE INDEX (CACHE BEHAVIOR) 1282 <1> ; G - GLOBAL (IGNORED) 1283 <1> ; AVL - AVAILABLE FOR SYSTEMS PROGRAMMER USE 1284 <1> ; 1285 <1> ; 1286 <1> ;; x86 PAGE TABLE ENTRY (4 KByte Page) 1287 <1> ; 31 12 11 9 8 7 6 5 4 3 2 1 0 1288 <1> ; +---------------------------------------+-----+---+-+-+---+-+-+-+ 1289 <1> ; | | | |P| | |P|P|U|R| | 1290 <1> ; | PAGE FRAME BASE ADDRESS 31..12 | AVL |G|A|D|A|C|W|/|/|P| 1291 <1> ; | | | |T| | |D|T|S|W| | 1292 <1> ; +---------------------------------------+-----+---+-+-+---+-+-+-+ 1293 <1> ; 1294 <1> ; P - PRESENT 1295 <1> ; R/W - READ/WRITE 1296 <1> ; U/S - USER/SUPERVISOR 1297 <1> ; PWT - WRITE THROUGH 1298 <1> ; PCD - CACHE DISABLE 1299 <1> ; A - ACCESSED 1300 <1> ; D - DIRTY 1301 <1> ; PAT - PAGE ATTRIBUTE TABLE INDEX (CACHE BEHAVIOR) 1302 <1> ; G - GLOBAL 1303 <1> ; AVL - AVAILABLE FOR SYSTEMS PROGRAMMER USE 1304 <1> ; 1305 <1> ; 1306 <1> ;; 80386 PAGE TABLE ENTRY (4 KByte Page) 1307 <1> ; 31 12 11 9 8 7 6 5 4 3 2 1 0 1308 <1> ; +---------------------------------------+-----+-+-+-+-+---+-+-+-+ 1309 <1> ; | | | | | | | | |U|R| | 1310 <1> ; | PAGE FRAME BASE ADDRESS 31..12 | AVL |0|0|D|A|0|0|/|/|P| 1311 <1> ; | | | | | | | | |S|W| | 1312 <1> ; +---------------------------------------+-----+-+-+-+-+---+-+-+-+ 1313 <1> ; 1314 <1> ; P - PRESENT 1315 <1> ; R/W - READ/WRITE 1316 <1> ; U/S - USER/SUPERVISOR 1317 <1> ; D - DIRTY 1318 <1> ; AVL - AVAILABLE FOR SYSTEMS PROGRAMMER USE 1319 <1> ; 1320 <1> ; NOTE: 0 INDICATES INTEL RESERVED. DO NOT DEFINE. 1321 <1> ; 1322 <1> ; 1323 <1> ;; Invalid Page Table Entry 1324 <1> ; 31 1 0 1325 <1> ; +-------------------------------------------------------------+-+ 1326 <1> ; | | | 1327 <1> ; | AVAILABLE |0| 1328 <1> ; | | | 1329 <1> ; +-------------------------------------------------------------+-+ 1330 <1> ; 1331 <1> 1332 00005AD1 53 <1> push ebx 1333 00005AD2 52 <1> push edx 1334 00005AD3 51 <1> push ecx 1335 <1> ; 1336 <1> ; 21/09/2015 (debugging) 1337 00005AD4 FF05[DC8E0100] <1> inc dword [u.pfcount] ; page fault count for running process 1338 00005ADA FF05[88900100] <1> inc dword [PF_Count] ; total page fault count 1339 <1> ; 28/06/2015 1340 <1> ;mov edx, [error_code] ; Lower 5 bits are valid 1341 00005AE0 8A15[80900100] <1> mov dl, [error_code] 1342 <1> ; 1343 00005AE6 F6C201 <1> test dl, 1 ; page fault was caused by a non-present page 1344 <1> ; sign 1345 00005AE9 742D <1> jz short pfh_alloc_np 1346 <1> ; 1347 <1> ; If it is not a 'write on read only page' type page fault 1348 <1> ; major page fault error with minor reason must be returned without 1349 <1> ; fixing the problem. 'sys_exit with error' will be needed 1350 <1> ; after return here! 1351 <1> ; Page fault will be remedied, by copying page contents 1352 <1> ; to newly allocated page with write permission; 1353 <1> ; sys_fork -> sys_exec -> copy on write, demand paging method is 1354 <1> ; used for working with minimum possible memory usage. 1355 <1> ; sys_fork will duplicate page directory and tables of parent 1356 <1> ; process with 'read only' flag. If the child process attempts to 1357 <1> ; write on these read only pages, page fault will be directed here 1358 <1> ; for allocating a new page with same data/content. 1359 <1> ; 1360 <1> ; IMPORTANT : Retro UNIX 386 v1 (and SINGLIX and TR-DOS) 1361 <1> ; will not force to separate CODE and DATA space 1362 <1> ; in a process/program... 1363 <1> ; CODE segment/section may contain DATA! 1364 <1> ; It is flat, smoth and simplest programming method already as in 1365 <1> ; Retro UNIX 8086 v1 and MS-DOS programs. 1366 <1> ; 1367 00005AEB F6C202 <1> test dl, 2 ; page fault was caused by a page write 1368 <1> ; sign 1369 00005AEE 7418 <1> jz short pfh_p_err 1370 <1> ; 31/08/2015 1371 00005AF0 F6C204 <1> test dl, 4 ; page fault was caused while CPL = 3 (user mode) 1372 <1> ; sign. (U+W+P = 4+2+1 = 7) 1373 00005AF3 741B <1> jz short pfh_pv_err 1374 <1> ; 1375 <1> ; make a new page and copy the parent's page content 1376 <1> ; as the child's new page content 1377 <1> ; 1378 00005AF5 0F20D3 <1> mov ebx, cr2 ; CR2 contains the linear address 1379 <1> ; which has caused to page fault 1380 00005AF8 E884000000 <1> call copy_page 1381 00005AFD 7202 <1> jc short pfh_im_err ; insufficient memory 1382 <1> ; 1383 00005AFF EB7A <1> jmp pfh_cpp_ok 1384 <1> 1385 <1> ; 29/11/2023 1386 <1> pfh_im_err: 1387 00005B01 B8E4000000 <1> mov eax, ERR_MAJOR_PF + ERR_MINOR_IM ; Error code in AX 1388 <1> ; Major (Primary) Error: Page Fault 1389 <1> ; Minor (Secondary) Error: Insufficient Memory ! 1390 00005B06 EB75 <1> jmp short pfh_err_retn 1391 <1> 1392 <1> ; 29/11/2023 1393 <1> pfh_p_err: ; 09/03/2015 1394 <1> ; 09/02/2026 - temporary 1395 00005B08 B8E5000000 <1> mov eax, ERR_MAJOR_PF + ERR_MINOR_RO ; Error code in AX 1396 00005B0D F9 <1> stc 1397 00005B0E EB6D <1> jmp short pfh_err_retn 1398 <1> 1399 <1> pfh_pv_err: 1400 <1> ; Page fault was caused by a protection-violation 1401 00005B10 B8E6000000 <1> mov eax, ERR_MAJOR_PF + ERR_MINOR_PV ; Error code in AX 1402 <1> ; Major (Primary) Error: Page Fault 1403 <1> ; Minor (Secondary) Error: Protection violation ! 1404 00005B15 F9 <1> stc 1405 00005B16 EB65 <1> jmp short pfh_err_retn 1406 <1> 1407 <1> pfh_alloc_np: 1408 00005B18 E80DFDFFFF <1> call allocate_page ; (allocate a new page) 1409 00005B1D 72E2 <1> jc short pfh_im_err ; 'insufficient memory' error 1410 <1> pfh_chk_cpl: 1411 <1> ; EAX = Physical (base) address of the allocated (new) page 1412 <1> ; (Lower 12 bits are ZERO, because 1413 <1> ; the address is on a page boundary) 1414 00005B1F 80E204 <1> and dl, 4 ; CPL = 3 ? 1415 00005B22 7505 <1> jnz short pfh_um 1416 <1> ; Page fault handler for kernel/system mode (CPL=0) 1417 00005B24 0F20DB <1> mov ebx, cr3 ; CR3 (Control Register 3) contains physical address 1418 <1> ; of the current/active page directory 1419 <1> ; (Always kernel/system mode page directory, here!) 1420 <1> ; Note: Lower 12 bits are 0. (page boundary) 1421 00005B27 EB06 <1> jmp short pfh_get_pde 1422 <1> ; 1423 <1> pfh_um: ; Page fault handler for user/appl. mode (CPL=3) 1424 00005B29 8B1D[C48E0100] <1> mov ebx, [u.pgdir] ; Page directory of current/active process 1425 <1> ; Physical address of the USER's page directory 1426 <1> ; Note: Lower 12 bits are 0. (page boundary) 1427 <1> pfh_get_pde: 1428 00005B2F 80CA03 <1> or dl, 3 ; USER + WRITE + PRESENT or SYSTEM + WRITE + PRESENT 1429 00005B32 0F20D1 <1> mov ecx, cr2 ; CR2 contains the virtual address 1430 <1> ; which has been caused to page fault 1431 <1> ; 1432 00005B35 C1E914 <1> shr ecx, 20 ; shift 20 bits right 1433 00005B38 80E1FC <1> and cl, 0FCh ; mask lower 2 bits to get PDE offset 1434 <1> ; 1435 00005B3B 01CB <1> add ebx, ecx ; now, EBX points to the relevant page dir entry 1436 00005B3D 8B0B <1> mov ecx, [ebx] ; physical (base) address of the page table 1437 00005B3F F6C101 <1> test cl, 1 ; check bit 0 is set (1) or not (0). 1438 00005B42 740B <1> jz short pfh_set_pde ; Page directory entry is not valid, 1439 <1> ; set/validate page directory entry 1440 00005B44 6681E100F0 <1> and cx, PDE_A_CLEAR ; 0F000h ; Clear attribute bits 1441 00005B49 89CB <1> mov ebx, ecx ; Physical address of the page table 1442 00005B4B 89C1 <1> mov ecx, eax ; new page address (physical) 1443 00005B4D EB16 <1> jmp short pfh_get_pte 1444 <1> pfh_set_pde: 1445 <1> ;; NOTE: Page directories and page tables never be swapped out! 1446 <1> ;; (So, we know this PDE is empty or invalid) 1447 <1> ; 1448 00005B4F 08D0 <1> or al, dl ; lower 3 bits are used as U/S, R/W, P flags 1449 00005B51 8903 <1> mov [ebx], eax ; Let's put the new page directory entry here ! 1450 00005B53 30C0 <1> xor al, al ; clear lower (3..8) bits 1451 00005B55 89C3 <1> mov ebx, eax 1452 00005B57 E8CEFCFFFF <1> call allocate_page ; (allocate a new page) 1453 00005B5C 72A3 <1> jc short pfh_im_err ; 'insufficient memory' error 1454 <1> pfh_spde_1: 1455 <1> ; EAX = Physical (base) address of the allocated (new) page 1456 00005B5E 89C1 <1> mov ecx, eax 1457 00005B60 E836FDFFFF <1> call clear_page ; Clear page content 1458 <1> pfh_get_pte: 1459 00005B65 0F20D0 <1> mov eax, cr2 ; virtual address 1460 <1> ; which has been caused to page fault 1461 00005B68 89C7 <1> mov edi, eax ; 20/07/2015 1462 00005B6A C1E80C <1> shr eax, 12 ; shift 12 bit right to get 1463 <1> ; higher 20 bits of the page fault address 1464 00005B6D 25FF030000 <1> and eax, 3FFh ; mask PDE# bits, the result is PTE# (0 to 1023) 1465 00005B72 C1E002 <1> shl eax, 2 ; shift 2 bits left to get PTE offset 1466 00005B75 01C3 <1> add ebx, eax ; now, EBX points to the relevant page table entry 1467 <1> ; 17/04/2021 temporary 1468 <1> ; mov eax, [ebx] ; get previous value of pte 1469 <1> ; ; bit 0 of EAX is always 0 (otherwise we would not be here) 1470 <1> 1471 <1> ; 17/04/2021 1472 <1> ; ('swap_in' procedure call has been disabled as temporary) 1473 <1> ; 1474 <1> ; and eax, eax 1475 <1> ; jz short pfh_gpte_1 1476 <1> ; ; 20/07/2015 1477 <1> ; xchg ebx, ecx ; new page address (physical) 1478 <1> ; push ebp ; 20/07/2015 1479 <1> ; mov ebp, cr2 1480 <1> ; ; ECX = physical address of the page table entry 1481 <1> ; ; EBX = Memory page address (physical!) 1482 <1> ; ; EAX = Swap disk (offset) address 1483 <1> ; ; EBP = virtual address (page fault address) 1484 <1> ; call swap_in 1485 <1> ; pop ebp 1486 <1> ; jc short pfh_err_retn 1487 <1> ; xchg ecx, ebx 1488 <1> ; ; EBX = physical address of the page table entry 1489 <1> ; ; ECX = new page 1490 <1> pfh_gpte_1: 1491 00005B77 08D1 <1> or cl, dl ; lower 3 bits are used as U/S, R/W, P flags 1492 00005B79 890B <1> mov [ebx], ecx ; Let's put the new page table entry here ! 1493 <1> pfh_cpp_ok: 1494 <1> ; 17/04/2021 1495 <1> ; ('add_to_swap_queue' procedure call has been disabled as temporary) 1496 <1> ; 1497 <1> ; ; 20/07/2015 1498 <1> ; mov ebx, cr2 1499 <1> ; call add_to_swap_queue 1500 <1> ; 1501 <1> ; The new PTE (which contains the new page) will be added to 1502 <1> ; the swap queue, here. 1503 <1> ; (Later, if memory will become insufficient, 1504 <1> ; one page will be swapped out which is at the head of 1505 <1> ; the swap queue by using FIFO and access check methods.) 1506 <1> ; 1507 00005B7B 31C0 <1> xor eax, eax ; 0 1508 <1> ; 1509 <1> pfh_err_retn: 1510 00005B7D 59 <1> pop ecx 1511 00005B7E 5A <1> pop edx 1512 00005B7F 5B <1> pop ebx 1513 00005B80 C3 <1> retn 1514 <1> 1515 <1> copy_page: 1516 <1> ; 29/08/2023 (TRDOS 386 v2.0.6) 1517 <1> ; 22/09/2015 1518 <1> ; 21/09/2015 1519 <1> ; 19/09/2015 1520 <1> ; 07/09/2015 1521 <1> ; 31/08/2015 1522 <1> ; 20/07/2015 1523 <1> ; 05/05/2015 1524 <1> ; 03/05/2015 1525 <1> ; 18/04/2015 1526 <1> ; 12/04/2015 1527 <1> ; 30/10/2014 1528 <1> ; 18/10/2014 (Retro UNIX 386 v1 - beginning) 1529 <1> ; 1530 <1> ; INPUT -> 1531 <1> ; EBX = Virtual (linear) address of source page 1532 <1> ; (Page fault address) 1533 <1> ; OUTPUT -> 1534 <1> ; EAX = PHYSICAL (real/flat) ADDRESS OF THE ALLOCATED PAGE 1535 <1> ; (corresponding PAGE TABLE ENTRY is mapped/set) 1536 <1> ; EAX = 0 (CF = 1) 1537 <1> ; if there is not a free page to be allocated 1538 <1> ; (page content of the source page will be copied 1539 <1> ; onto the target/new page) 1540 <1> ; 1541 <1> ; Modified Registers -> ecx, ebx (except EAX) 1542 <1> ; 1543 00005B81 56 <1> push esi 1544 00005B82 57 <1> push edi 1545 <1> ;push ebx 1546 <1> ;push ecx 1547 00005B83 31F6 <1> xor esi, esi 1548 00005B85 C1EB0C <1> shr ebx, 12 ; shift 12 bits right to get PDE & PTE numbers 1549 00005B88 89D9 <1> mov ecx, ebx ; save page fault address (as 12 bit shifted) 1550 00005B8A C1EB08 <1> shr ebx, 8 ; shift 8 bits right and then 1551 00005B8D 80E3FC <1> and bl, 0FCh ; mask lower 2 bits to get PDE offset 1552 00005B90 89DF <1> mov edi, ebx ; save it for the parent of current process 1553 00005B92 031D[C48E0100] <1> add ebx, [u.pgdir] ; EBX points to the relevant page dir entry 1554 00005B98 8B03 <1> mov eax, [ebx] ; physical (base) address of the page table 1555 00005B9A 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear attribute bits 1556 00005B9E 89CB <1> mov ebx, ecx ; (restore higher 20 bits of page fault address) 1557 00005BA0 81E3FF030000 <1> and ebx, 3FFh ; mask PDE# bits, the result is PTE# (0 to 1023) 1558 <1> ;shl bx, 2 ; shift 2 bits left to get PTE offset 1559 <1> ; 29/08/2023 1560 00005BA6 C1E302 <1> shl ebx, 2 1561 00005BA9 01C3 <1> add ebx, eax ; EBX points to the relevant page table entry 1562 <1> ; 07/09/2015 1563 00005BAB 66F7030002 <1> test word [ebx], PTE_DUPLICATED ; (Does current process share this 1564 <1> ; read only page as a child process?) 1565 00005BB0 7509 <1> jnz short cpp_0 ; yes 1566 00005BB2 8B0B <1> mov ecx, [ebx] ; PTE value 1567 00005BB4 6681E100F0 <1> and cx, PTE_A_CLEAR ; 0F000h ; clear page attributes 1568 00005BB9 EB31 <1> jmp short cpp_1 1569 <1> cpp_0: 1570 00005BBB 89FE <1> mov esi, edi 1571 00005BBD 0335[C88E0100] <1> add esi, [u.ppgdir] ; the parent's page directory entry 1572 00005BC3 8B06 <1> mov eax, [esi] ; physical (base) address of the page table 1573 00005BC5 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear attribute bits 1574 00005BC9 89CE <1> mov esi, ecx ; (restore higher 20 bits of page fault address) 1575 00005BCB 81E6FF030000 <1> and esi, 3FFh ; mask PDE# bits, the result is PTE# (0 to 1023) 1576 <1> ;shl si, 2 ; shift 2 bits left to get PTE offset 1577 <1> ; 29/08/2023 1578 00005BD1 C1E602 <1> shl esi, 2 1579 00005BD4 01C6 <1> add esi, eax ; EDX points to the relevant page table entry 1580 00005BD6 8B0E <1> mov ecx, [esi] ; PTE value of the parent process 1581 <1> ; 21/09/2015 1582 00005BD8 8B03 <1> mov eax, [ebx] ; PTE value of the child process 1583 00005BDA 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear page attributes 1584 <1> ; 1585 00005BDE F6C101 <1> test cl, PTE_A_PRESENT ; is it a present/valid page ? 1586 00005BE1 7424 <1> jz short cpp_3 ; the parent's page is not same page 1587 <1> ; 1588 00005BE3 6681E100F0 <1> and cx, PTE_A_CLEAR ; 0F000h ; clear page attributes 1589 00005BE8 39C8 <1> cmp eax, ecx ; Same page? 1590 00005BEA 751B <1> jne short cpp_3 ; Parent page and child page are not same 1591 <1> ; Convert child's page to writable page 1592 <1> cpp_1: 1593 00005BEC E839FCFFFF <1> call allocate_page 1594 00005BF1 721A <1> jc short cpp_4 ; 'insufficient memory' error 1595 00005BF3 21F6 <1> and esi, esi ; check ESI is valid or not 1596 00005BF5 7405 <1> jz short cpp_2 1597 <1> ; Convert read only page to writable page 1598 <1> ;(for the parent of the current process) 1599 <1> ;and word [esi], PTE_A_CLEAR ; 0F000h 1600 <1> ; 22/09/2015 1601 00005BF7 890E <1> mov [esi], ecx 1602 00005BF9 800E07 <1> or byte [esi], PTE_A_PRESENT + PTE_A_WRITE + PTE_A_USER 1603 <1> ; 1+2+4 = 7 1604 <1> cpp_2: 1605 00005BFC 89C7 <1> mov edi, eax ; new page address of the child process 1606 <1> ; 07/09/2015 1607 00005BFE 89CE <1> mov esi, ecx ; the page address of the parent process 1608 00005C00 B900040000 <1> mov ecx, PAGE_SIZE / 4 1609 00005C05 F3A5 <1> rep movsd ; 31/08/2015 1610 <1> cpp_3: 1611 00005C07 0C07 <1> or al, PTE_A_PRESENT + PTE_A_WRITE + PTE_A_USER ; 1+2+4 = 7 1612 00005C09 8903 <1> mov [ebx], eax ; Update PTE 1613 00005C0B 28C0 <1> sub al, al ; clear attributes 1614 <1> cpp_4: 1615 <1> ;pop ecx 1616 <1> ;pop ebx 1617 00005C0D 5F <1> pop edi 1618 00005C0E 5E <1> pop esi 1619 00005C0F C3 <1> retn 1620 <1> 1621 <1> ;; 28/04/2015 1622 <1> ;; 24/10/2014 1623 <1> ;; 21/10/2014 (Retro UNIX 386 v1 - beginning) 1624 <1> ;; SWAP_PAGE_QUEUE (4096 bytes) 1625 <1> ;; 1626 <1> ;; 0000 0001 0002 0003 .... 1020 1021 1022 1023 1627 <1> ;; +------+------+------+------+- -+------+------+------+------+ 1628 <1> ;; | pg1 | pg2 | pg3 | pg4 | .... |pg1021|pg1022|pg1023|pg1024| 1629 <1> ;; +------+------+------+------+- -+------+------+------+------+ 1630 <1> ;; 1631 <1> ;; [swpq_last] = 0 to 4096 (step 4) -> the last position on the queue 1632 <1> ;; 1633 <1> ;; Method: 1634 <1> ;; Swap page queue is a list of allocated pages with physical 1635 <1> ;; addresses (system mode virtual adresses = physical addresses). 1636 <1> ;; It is used for 'swap_in' and 'swap_out' procedures. 1637 <1> ;; When a new page is being allocated, swap queue is updated 1638 <1> ;; by 'swap_queue_shift' procedure, header of the queue (offset 0) 1639 <1> ;; is checked for 'accessed' flag. If the 1st page on the queue 1640 <1> ;; is 'accessed' or 'read only', it is dropped from the list; 1641 <1> ;; other pages from the 2nd to the last (in [swpq_last]) shifted 1642 <1> ;; to head then the 2nd page becomes the 1st and '[swpq_last]' 1643 <1> ;; offset value becomes it's previous offset value - 4. 1644 <1> ;; If the 1st page of the swap page queue is not 'accessed' 1645 <1> ;; the queue/list is not shifted. 1646 <1> ;; After the queue/list shift, newly allocated page is added 1647 <1> ;; to the tail of the queue at the [swpq_count*4] position. 1648 <1> ;; But, if [swpq_count] > 1023, the newly allocated page 1649 <1> ;; will not be added to the tail of swap page queue. 1650 <1> ;; 1651 <1> ;; During 'swap_out' procedure, swap page queue is checked for 1652 <1> ;; the first non-accessed, writable page in the list, 1653 <1> ;; from the head to the tail. The list is shifted to left 1654 <1> ;; (to the head) till a non-accessed page will be found in the list. 1655 <1> ;; Then, this page is swapped out (to disk) and then it is dropped 1656 <1> ;; from the list by a final swap queue shift. [swpq_count] value 1657 <1> ;; is changed. If all pages on the queue' are 'accessed', 1658 <1> ;; 'insufficient memory' error will be returned ('swap_out' 1659 <1> ;; procedure will be failed)... 1660 <1> ;; 1661 <1> ;; Note: If the 1st page of the queue is an 'accessed' page, 1662 <1> ;; 'accessed' flag of the page will be reset (0) and that page 1663 <1> ;; (PTE) will be added to the tail of the queue after 1664 <1> ;; the check, if [swpq_count] < 1023. If [swpq_count] = 1024 1665 <1> ;; the queue will be rotated and the PTE in the head will be 1666 <1> ;; added to the tail after resetting 'accessed' bit. 1667 <1> ;; 1668 <1> ;; 1669 <1> ;; 1670 <1> ;; SWAP DISK/FILE (with 4096 bytes swapped page blocks) 1671 <1> ;; 1672 <1> ;; 00000000 00000004 00000008 0000000C ... size-8 size-4 1673 <1> ;; +---------+---------+---------+---------+-- --+---------+---------+ 1674 <1> ;; |descriptr| page(1) | page(2) | page(3) | ... |page(n-1)| page(n) | 1675 <1> ;; +---------+---------+---------+---------+-- --+---------+---------+ 1676 <1> ;; 1677 <1> ;; [swpd_next] = the first free block address in swapped page records 1678 <1> ;; for next free block search by 'swap_out' procedure. 1679 <1> ;; [swpd_size] = swap disk/file size in sectors (512 bytes) 1680 <1> ;; NOTE: max. possible swap disk size is 1024 GB 1681 <1> ;; (entire swap space must be accessed by using 1682 <1> ;; 31 bit offset address) 1683 <1> ;; [swpd_free] = free block (4096 bytes) count in swap disk/file space 1684 <1> ;; [swpd_start] = absolute/start address of the swap disk/file 1685 <1> ;; 0 for file, or beginning sector of the swap partition 1686 <1> ;; [swp_drv] = logical drive description table addr. of swap disk/file 1687 <1> ;; 1688 <1> ;; 1689 <1> ;; Method: 1690 <1> ;; When the memory (ram) becomes insufficient, page allocation 1691 <1> ;; procedure swaps out a page from memory to the swap disk 1692 <1> ;; (partition) or swap file to get a new free page at the memory. 1693 <1> ;; Swapping out is performed by using swap page queue. 1694 <1> ;; 1695 <1> ;; Allocation block size of swap disk/file is equal to page size 1696 <1> ;; (4096 bytes). Swapping address (in sectors) is recorded 1697 <1> ;; into relevant page file entry as 31 bit physical (logical) 1698 <1> ;; offset address as 1 bit shifted to left for present flag (0). 1699 <1> ;; Swapped page address is between 1 and swap disk/file size - 4. 1700 <1> ;; Absolute physical (logical) address of the swapped page is 1701 <1> ;; calculated by adding offset value to the swap partition's 1702 <1> ;; start address. If the swap device (disk) is a virtual disk 1703 <1> ;; or it is a file, start address of the swap disk/volume is 0, 1704 <1> ;; and offset value is equal to absolute (physical or logical) 1705 <1> ;; address/position. (It has not to be ZERO if the swap partition 1706 <1> ;; is in a partitioned virtual hard disk.) 1707 <1> ;; 1708 <1> ;; Note: Swap addresses are always specified/declared in sectors, 1709 <1> ;; not in bytes or in blocks/zones/clusters (4096 bytes) as unit. 1710 <1> ;; 1711 <1> ;; Swap disk/file allocation is mapped via 'Swap Allocation Table' 1712 <1> ;; at memory as similar to 'Memory Allocation Table'. 1713 <1> ;; 1714 <1> ;; Every bit of Swap Allocation Table repsesents one swap block 1715 <1> ;; (equal to page size) respectively. Bit 0 of the S.A.T. byte 0 1716 <1> ;; is reserved for swap disk/file block 0 as descriptor block 1717 <1> ;; (also for compatibility with PTE). If bit value is ZERO, 1718 <1> ;; it means relevant (respective) block is in use, and, 1719 <1> ;; of course, if bit value is 1, it means relevant (respective) 1720 <1> ;; swap disk/file block is free. 1721 <1> ;; For example: bit 1 of the byte 128 repsesents block 1025 1722 <1> ;; (128*8+1) or sector (offset) 8200 on the swap disk or 1723 <1> ;; byte (offset/position) 4198400 in the swap file. 1724 <1> ;; 4GB swap space is represented via 128KB Swap Allocation Table. 1725 <1> ;; Initial layout of Swap Allocation Table is as follows: 1726 <1> ;; ------------------------------------------------------------ 1727 <1> ;; 0111111111111111111111111 .... 11111111111111111111111111111 1728 <1> ;; ------------------------------------------------------------ 1729 <1> ;; (0 is reserved block, 1s represent free blocks respectively.) 1730 <1> ;; (Note: Allocation cell/unit of the table is bit, not byte) 1731 <1> ;; 1732 <1> ;; .............................................................. 1733 <1> ;; 1734 <1> ;; 'swap_out' procedure checks 'free_swap_blocks' count at first, 1735 <1> ;; then it searches Swap Allocation Table if free count is not 1736 <1> ;; zero. From begining the [swpd_next] dword value, the first bit 1737 <1> ;; position with value of 1 on the table is converted to swap 1738 <1> ;; disk/file offset address, in sectors (not 4096 bytes block). 1739 <1> ;; 'ldrv_write' procedure is called with ldrv (logical drive 1740 <1> ;; number of physical swap disk or virtual swap disk) 1741 <1> ;; number, sector offset (not absolute sector -LBA- number), 1742 <1> ;; and sector count (8, 512*8 = 4096) and buffer adress 1743 <1> ;; (memory page). That will be a direct disk write procedure. 1744 <1> ;; (for preventing late memory allocation, significant waiting). 1745 <1> ;; If disk write procedure returns with error or free count of 1746 <1> ;; swap blocks is ZERO, 'swap_out' procedure will return with 1747 <1> ;; 'insufficient memory error' (cf=1). 1748 <1> ;; 1749 <1> ;; (Note: Even if free swap disk/file blocks was not zero, 1750 <1> ;; any disk write error will not be fixed by 'swap_out' procedure, 1751 <1> ;; in other words, 'swap_out' will not check the table for other 1752 <1> ;; free blocks after a disk write error. It will return to 1753 <1> ;; the caller with error (CF=1) which means swapping is failed. 1754 <1> ;; 1755 <1> ;; After writing the page on to swap disk/file address/sector, 1756 <1> ;; 'swap_out' procesure returns with that swap (offset) sector 1757 <1> ;; address (cf=0). 1758 <1> ;; 1759 <1> ;; .............................................................. 1760 <1> ;; 1761 <1> ;; 'swap_in' procedure loads addressed (relevant) swap disk or 1762 <1> ;; file sectors at specified memory page. Then page allocation 1763 <1> ;; procedure updates relevant page table entry with 'present' 1764 <1> ;; attribute. If swap disk or file reading fails there is nothing 1765 <1> ;; to do, except to terminate the process which is the owner of 1766 <1> ;; the swapped page. 1767 <1> ;; 1768 <1> ;; 'swap_in' procedure sets the relevant/respective bit value 1769 <1> ;; in the Swap Allocation Table (as free block). 'swap_in' also 1770 <1> ;; updates [swpd_first] pointer if it is required. 1771 <1> ;; 1772 <1> ;; .............................................................. 1773 <1> ;; 1774 <1> ;; Note: If [swap_enabled] value is ZERO, that means there is not 1775 <1> ;; a swap disk or swap file in use... 'swap_in' and 'swap_out' 1776 <1> ;; procedures ans 'swap page que' procedures will not be active... 1777 <1> ;; 'Insufficient memory' error will be returned by 'swap_out' 1778 <1> ;; and 'general protection fault' will be returned by 'swap_in' 1779 <1> ;; procedure, if it is called mistakenly (a wrong value in a PTE). 1780 <1> ;; 1781 <1> 1782 <1> ; 17/04/2021 1783 <1> ; ('swap_in' procedure call is disabled as temporary) 1784 <1> 1785 <1> swap_in: 1786 <1> ; 31/08/2015 1787 <1> ; 20/07/2015 1788 <1> ; 28/04/2015 1789 <1> ; 18/04/2015 1790 <1> ; 24/10/2014 (Retro UNIX 386 v1 - beginning) 1791 <1> ; 1792 <1> ; INPUT -> 1793 <1> ; EBX = PHYSICAL (real/flat) ADDRESS OF THE MEMORY PAGE 1794 <1> ; EBP = VIRTUAL (LINEAR) ADDRESS (page fault address) 1795 <1> ; EAX = Offset Address for the swapped page on the 1796 <1> ; swap disk or in the swap file. 1797 <1> ; 1798 <1> ; OUTPUT -> 1799 <1> ; EAX = 0 if loading at memory has been successful 1800 <1> ; 1801 <1> ; CF = 1 -> swap disk reading error (disk/file not present 1802 <1> ; or sector not present or drive not ready 1803 <1> ; EAX = Error code 1804 <1> ; [u.error] = EAX 1805 <1> ; = The last error code for the process 1806 <1> ; (will be reset after returning to user) 1807 <1> ; 1808 <1> ; Modified Registers -> EAX 1809 <1> ; 1810 <1> 1811 <1> ; cmp dword [swp_drv], 0 1812 <1> ; jna short swpin_dnp_err 1813 <1> ; 1814 <1> ; cmp eax, [swpd_size] 1815 <1> ; jnb short swpin_snp_err 1816 <1> ; 1817 <1> ; push esi 1818 <1> ; push ebx 1819 <1> ; push ecx 1820 <1> ; mov esi, [swp_drv] 1821 <1> ; mov ecx, PAGE_SIZE / LOGIC_SECT_SIZE ; 8 ! 1822 <1> ; ; Note: Even if corresponding physical disk's sector 1823 <1> ; ; size different than 512 bytes, logical disk sector 1824 <1> ; ; size is 512 bytes and disk reading procedure 1825 <1> ; ; will be performed for reading 4096 bytes 1826 <1> ; ; (2*2048, 8*512). 1827 <1> ; ; ESI = Logical disk description table address 1828 <1> ; ; EBX = Memory page (buffer) address (physical!) 1829 <1> ; ; EAX = Sector adress (offset address, logical sector number) 1830 <1> ; ; ECX = Sector count ; 8 sectors 1831 <1> ; push eax 1832 <1> ; call logical_disk_read 1833 <1> ; pop eax 1834 <1> ; jnc short swpin_read_ok 1835 <1> ; ; 1836 <1> ; mov eax, SWP_DISK_READ_ERR ; drive not ready or read error 1837 <1> ; mov [u.error], eax 1838 <1> ; jmp short swpin_retn 1839 <1> ; ; 1840 <1> ;swpin_read_ok: 1841 <1> ; ; EAX = Offset address (logical sector number) 1842 <1> ; call unlink_swap_block ; Deallocate swap block 1843 <1> ; ; 1844 <1> ; ; EBX = Memory page (buffer) address (physical!) 1845 <1> ; ; 20/07/2015 1846 <1> ; mov ebx, ebp ; virtual address (page fault address) 1847 <1> ; and bx, ~PAGE_OFF ; ~0FFFh ; reset bits, 0 to 11 1848 <1> ; mov bl, [u.uno] ; current process number 1849 <1> ; ; EBX = Virtual (Linear) address & process number combination 1850 <1> ; call swap_queue_shift 1851 <1> ; ; eax = 0 ; 10/06/2016 (if ebx input > 0, eax output = 0) 1852 <1> ; ;sub eax, eax ; 0 ; Error Code = 0 (no error) 1853 <1> ; ; zf = 1 1854 <1> ;swpin_retn: 1855 <1> ; pop ecx 1856 <1> ; pop ebx 1857 <1> ; pop esi 1858 <1> ; retn 1859 <1> ; 1860 <1> ;swpin_dnp_err: 1861 <1> ; mov eax, SWP_DISK_NOT_PRESENT_ERR 1862 <1> ;swpin_err_retn: 1863 <1> ; mov [u.error], eax 1864 <1> ; stc 1865 <1> ; retn 1866 <1> ; 1867 <1> ;swpin_snp_err: 1868 <1> ; mov eax, SWP_SECTOR_NOT_PRESENT_ERR 1869 <1> ; jmp short swpin_err_retn 1870 <1> 1871 <1> ; 17/04/2021 1872 <1> ; ('swap_out' procedure call is disabled as temporary) 1873 <1> 1874 <1> swap_out: 1875 <1> ; 10/06/2016 1876 <1> ; 07/06/2016 1877 <1> ; 23/05/2016 1878 <1> ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 1879 <1> ; 24/10/2014 - 31/08/2015 (Retro UNIX 386 v1) 1880 <1> ; 1881 <1> ; INPUT -> 1882 <1> ; none 1883 <1> ; 1884 <1> ; OUTPUT -> 1885 <1> ; EAX = Physical page address (which is swapped out 1886 <1> ; for allocating a new page) 1887 <1> ; CF = 1 -> swap disk writing error (disk/file not present 1888 <1> ; or sector not present or drive not ready 1889 <1> ; EAX = Error code 1890 <1> ; [u.error] = EAX 1891 <1> ; = The last error code for the process 1892 <1> ; (will be reset after returning to user) 1893 <1> ; 1894 <1> ; Modified Registers -> none (except EAX) 1895 <1> ; 1896 <1> 1897 <1> ; cmp word [swpq_count], 1 1898 <1> ; jc swpout_im_err ; 'insufficient memory' 1899 <1> ; 1900 <1> ; ;cmp dword [swp_drv], 1 1901 <1> ; ;jc short swpout_dnp_err ; 'swap disk/file not present' 1902 <1> ; 1903 <1> ; cmp dword [swpd_free], 1 1904 <1> ; jc swpout_nfspc_err ; 'no free space on swap disk' 1905 <1> ; 1906 <1> ; push ebx ; * 1907 <1> ;swpout_1: 1908 <1> ; ; 10/06/2016 1909 <1> ; xor ebx, ebx ; shift the queue and return a PTE value 1910 <1> ; call swap_queue_shift 1911 <1> ; and eax, eax ; 0 = empty queue (improper entries) 1912 <1> ; jz swpout_npts_err ; There is not any proper PTE 1913 <1> ; ; pointer in the swap queue 1914 <1> ; ; EAX = PTE value of the page 1915 <1> ; ; EBX = PTE address of the page 1916 <1> ; and ax, PTE_A_CLEAR ; 0F000h ; clear attribute bits 1917 <1> ; ; 1918 <1> ; ; 07/06/2016 1919 <1> ; ; 19/05/2016 1920 <1> ; ; check this page is in timer events or not 1921 <1> ; 1922 <1> ;swpout_timer_page_0: 1923 <1> ; push edx ; ** 1924 <1> ; 1925 <1> ; ; 07/06/2016 1926 <1> ; cmp byte [timer_events], 0 1927 <1> ; jna short swpout_2 1928 <1> ; ; 1929 <1> ; mov dl, [timer_events] 1930 <1> ; 1931 <1> ; push ecx ; *** 1932 <1> ; push ebx ; **** 1933 <1> ; mov ebx, timer_set ; beginning address of timer event 1934 <1> ; ; structures 1935 <1> ;swpout_timer_page_1: 1936 <1> ; mov cl, [ebx] 1937 <1> ; or cl, cl ; 0 = free, >0 = process number 1938 <1> ; jz short swpout_timer_page_3 1939 <1> ; mov ecx, [ebx+12] ; response (signal return) address 1940 <1> ; and cx, PTE_A_CLEAR ; clear offset part (right 12 bits) 1941 <1> ; ; of the response byte address, to 1942 <1> ; ; get beginning of the page address) 1943 <1> ; cmp eax, ecx 1944 <1> ; jne short swpout_timer_page_2 ; not same page 1945 <1> ; 1946 <1> ; ; !same page! 1947 <1> ; ; 1948 <1> ; ; NOTE: // 19/05/2016 // - TRDOS 386 feature only ! - 1949 <1> ; ; This page will be used by the kernel to put timer event 1950 <1> ; ; response (signal return) byte at the requested address; 1951 <1> ; ; in order to prevent a possible wrong write (while 1952 <1> ; ; this page is swapped out) on physical memory, 1953 <1> ; ; we must protect this page against to be swapped out! 1954 <1> ; ; 1955 <1> ; pop ebx ; **** 1956 <1> ; pop ecx ; *** 1957 <1> ; pop edx ; ** 1958 <1> ; jmp short swpout_1 ; do not swap out this page ! 1959 <1> ; 1960 <1> ;swpout_timer_page_2: 1961 <1> ; ; 07/06/2016 1962 <1> ; dec dl 1963 <1> ; jz short swpout_timer_page_4 1964 <1> ;swpout_timer_page_3: 1965 <1> ; ;cmp ebx, timer_set + 240 ; last timer event (15*16) 1966 <1> ; ;jnb short swpout_timer_page_4 1967 <1> ; add ebx, 16 1968 <1> ; jmp short swpout_timer_page_1 1969 <1> ; 1970 <1> ;swpout_timer_page_4: 1971 <1> ; pop ebx ; **** 1972 <1> ; pop ecx ; *** 1973 <1> ;swpout_2: 1974 <1> ; mov edx, ebx ; Page table entry address 1975 <1> ; mov ebx, eax ; Buffer (Page) Address 1976 <1> ; ; 1977 <1> ; call link_swap_block 1978 <1> ; jnc short swpout_3 ; It may not be needed here 1979 <1> ; ; because [swpd_free] value 1980 <1> ; ; was checked at the beginging. 1981 <1> ; pop edx ; ** 1982 <1> ; pop ebx ; * 1983 <1> ; jmp short swpout_nfspc_err 1984 <1> ;swpout_3: 1985 <1> ; test eax, 80000000h ; test bit 31 (this may not be needed!) 1986 <1> ; jnz short swpout_nfspc_err ; 10/06/2016 (bit 31 = 1 !) 1987 <1> ; ; 1988 <1> ; push esi ; ** 1989 <1> ; push ecx ; *** 1990 <1> ; push eax ; sector address ; (31 bit !, bit 31 = 0) 1991 <1> ; mov esi, [swp_drv] 1992 <1> ; mov ecx, PAGE_SIZE / LOGIC_SECT_SIZE ; 8 ! 1993 <1> ; ; Note: Even if corresponding physical disk's sector 1994 <1> ; ; size different than 512 bytes, logical disk sector 1995 <1> ; ; size is 512 bytes and disk writing procedure 1996 <1> ; ; will be performed for writing 4096 bytes 1997 <1> ; ; (2*2048, 8*512). 1998 <1> ; ; ESI = Logical disk description table address 1999 <1> ; ; EBX = Buffer (Page) address 2000 <1> ; ; EAX = Sector adress (offset address, logical sector number) 2001 <1> ; ; ECX = Sector count ; 8 sectors 2002 <1> ; ; edx = PTE address 2003 <1> ; call logical_disk_write 2004 <1> ; ; edx = PTE address 2005 <1> ; pop ecx ; sector address 2006 <1> ; jnc short swpout_write_ok 2007 <1> ; ; 2008 <1> ; ;; call unlink_swap_block ; this block must be left as 'in use' 2009 <1> ;swpout_dw_err: 2010 <1> ; mov eax, SWP_DISK_WRITE_ERR ; drive not ready or write error 2011 <1> ; mov [u.error], eax 2012 <1> ; jmp short swpout_retn 2013 <1> ; ; 2014 <1> ;swpout_write_ok: 2015 <1> ; ; EBX = Buffer (page) address 2016 <1> ; ; EDX = Page Table Entry address 2017 <1> ; ; ECX = Swap disk sector (file block) address (31 bit) 2018 <1> ; shl ecx, 1 ; 31 bit sector address from bit 1 to bit 31 2019 <1> ; mov [edx], ecx 2020 <1> ; ; bit 0 = 0 (swapped page) 2021 <1> ; mov eax, ebx 2022 <1> ;swpout_retn: 2023 <1> ; pop ecx ; *** 2024 <1> ; pop esi ; ** 2025 <1> ; pop ebx ; * 2026 <1> ; retn 2027 <1> ; 2028 <1> ;;swpout_dnp_err: 2029 <1> ;; mov eax, SWP_DISK_NOT_PRESENT_ERR ; disk not present 2030 <1> ;; jmp short swpout_err_retn 2031 <1> ;swpout_nfspc_err: 2032 <1> ; mov eax, SWP_NO_FREE_SPACE_ERR ; no free space 2033 <1> ;swpout_err_retn: 2034 <1> ; mov [u.error], eax 2035 <1> ; ;stc 2036 <1> ; retn 2037 <1> ;swpout_npts_err: 2038 <1> ; mov eax, SWP_NO_PAGE_TO_SWAP_ERR 2039 <1> ; pop ebx 2040 <1> ; jmp short swpout_err_retn 2041 <1> ;swpout_im_err: 2042 <1> ; mov eax, ERR_MINOR_IM ; insufficient (out of) memory 2043 <1> ; jmp short swpout_err_retn 2044 <1> 2045 <1> ; 17/04/2021 2046 <1> ; ('swap_queue_shift' procedure call is disabled as temporary) 2047 <1> 2048 <1> swap_queue_shift: 2049 <1> ; 26/03/2017 2050 <1> ; 10/06/2016 2051 <1> ; 09/06/2016 - TRDOS 386 (TRDOS v2.0) 2052 <1> ; 23/10/2014 - 20/07/2015 (Retro UNIX 386 v1) 2053 <1> ; 2054 <1> ; INPUT -> 2055 <1> ; EBX = Virtual (linear) address (bit 12 to 31) 2056 <1> ; and process number combination (bit 0 to 11) 2057 <1> ; EBX = 0 -> shift/drop from the head (offset 0) 2058 <1> ; 2059 <1> ; OUTPUT -> 2060 <1> ; If EBX input > 0 2061 <1> ; the queue will be shifted 4 bytes (dword), 2062 <1> ; from the tail to the head, up to entry offset 2063 <1> ; which points to EBX input value or nothing 2064 <1> ; to do if EBX value is not found on the queue. 2065 <1> ; (The entry -with EBX value- will be removed 2066 <1> ; from the queue if it is found.) 2067 <1> ; 2068 <1> ; EAX = 0 2069 <1> ; 2070 <1> ; If EBX input = 0 2071 <1> ; the queue will be shifted 4 bytes (dword), 2072 <1> ; from the tail to the head, if the PTE address 2073 <1> ; which is pointed in head of the queue is marked 2074 <1> ; as "accessed" or it is marked as "non present". 2075 <1> ; (If "accessed" flag of the PTE -which is pointed 2076 <1> ; in the head- is set -to 1-, it will be reset 2077 <1> ; -to 0- and then, the queue will be rotated 2078 <1> ; -without dropping pointer of the PTE from 2079 <1> ; the queue- for 4 bytes on head to tail direction. 2080 <1> ; Pointer in the head will be moved into the tail, 2081 <1> ; other PTEs will be shifted on head direction.) 2082 <1> ; 2083 <1> ; Swap queue will be shifted up to the first 2084 <1> ; 'present' or 'non accessed' page will be found 2085 <1> ; (as pointed) on the queue head (then it will be 2086 <1> ; removed/dropped from the queue). 2087 <1> ; 2088 <1> ; EAX (> 0) = PTE value of the page which is 2089 <1> ; (it's pointer -virtual address-) dropped 2090 <1> ; (removed) from swap queue. 2091 <1> ; EBX = PTE address of the page (if EAX > 0) 2092 <1> ; which is (it's pointer -virtual address-) 2093 <1> ; dropped (removed) from swap queue. 2094 <1> ; 2095 <1> ; EAX = 0 -> empty swap queue ! 2096 <1> ; 2097 <1> ; Modified Registers -> EAX, EBX 2098 <1> ; 2099 <1> ; movzx eax, word [swpq_count] ; Max. 1024 2100 <1> ; and ax, ax 2101 <1> ; jz short swpqs_retn 2102 <1> ; push edi 2103 <1> ; push esi 2104 <1> ; push ecx 2105 <1> ; mov esi, swap_queue 2106 <1> ; mov ecx, eax 2107 <1> ; or ebx, ebx 2108 <1> ; jz short swpqs_7 2109 <1> ;swpqs_1: 2110 <1> ; lodsd 2111 <1> ; cmp eax, ebx 2112 <1> ; je short swpqs_2 2113 <1> ; loop swpqs_1 2114 <1> ; ; 10/06/2016 2115 <1> ; sub eax, eax 2116 <1> ; jmp short swpqs_6 2117 <1> ;swpqs_2: 2118 <1> ; mov edi, esi 2119 <1> ; sub edi, 4 2120 <1> ;swpqs_3: 2121 <1> ; dec word [swpq_count] 2122 <1> ; jz short swpqs_5 2123 <1> ;swpqs_4: 2124 <1> ; dec ecx 2125 <1> ; rep movsd ; shift up (to the head) 2126 <1> ;swpqs_5: 2127 <1> ; xor eax, eax 2128 <1> ; mov [edi], eax 2129 <1> ;swpqs_6: 2130 <1> ; pop ecx 2131 <1> ; pop esi 2132 <1> ; pop edi 2133 <1> ;swpqs_retn: 2134 <1> ; retn 2135 <1> ;swpqs_7: 2136 <1> ; mov edi, esi ; head 2137 <1> ; lodsd 2138 <1> ; ; 20/07/2015 2139 <1> ; mov ebx, eax 2140 <1> ; and ebx, ~PAGE_OFF ; ~0FFFh 2141 <1> ; ; ebx = virtual address (at page boundary) 2142 <1> ; and eax, PAGE_OFF ; 0FFFh 2143 <1> ; ; ax = process number (1 to 4095) 2144 <1> ; cmp al, [u.uno] 2145 <1> ; ; Max. 16 (nproc) processes for Retro UNIX 386 v1 2146 <1> ; jne short swpqs_8 2147 <1> ; mov eax, [u.pgdir] 2148 <1> ; jmp short swpqs_9 2149 <1> ;swpqs_8: 2150 <1> ; ; 09/06/2016 2151 <1> ; cmp byte [eax+p.stat-1], 0 2152 <1> ; jna short swpqs_3 ; free (or terminated) process 2153 <1> ; cmp byte [eax+p.stat-1], 2 ; waiting 2154 <1> ; ja short swpqs_3 ; zombie (3) or undefined ? 2155 <1> ; 2156 <1> ; ;shl ax, 2 2157 <1> ; shl al, 2 2158 <1> ; mov eax, [eax+p.upage-4] 2159 <1> ; or eax, eax 2160 <1> ; jz short swpqs_3 ; invalid upage 2161 <1> ; add eax, u.pgdir - user 2162 <1> ; ; u.pgdir value for the process 2163 <1> ; ; is in [eax] 2164 <1> ; mov eax, [eax] 2165 <1> ; and eax, eax 2166 <1> ; jz short swpqs_3 ; invalid page directory 2167 <1> ;swpqs_9: 2168 <1> ; push edx 2169 <1> ; ; eax = page directory 2170 <1> ; ; ebx = virtual address 2171 <1> ; call get_pte 2172 <1> ; mov ebx, edx ; PTE address 2173 <1> ; pop edx 2174 <1> ; ; 10/06/2016 2175 <1> ; jc short swpqs_13 ; empty PDE 2176 <1> ; ; EAX = PTE value 2177 <1> ; test al, PTE_A_PRESENT ; bit 0 = 1 2178 <1> ; jz short swpqs_13 ; Drop non-present page 2179 <1> ; ; from the queue (head) 2180 <1> ; test al, PTE_A_WRITE ; bit 1 = 0 (read only) 2181 <1> ; jz short swpqs_13 ; Drop read only page 2182 <1> ; ; from the queue (head) 2183 <1> ; ;test al, PTE_A_ACCESS ; bit 5 = 1 (Accessed) 2184 <1> ; ;jnz short swpqs_11 ; present 2185 <1> ; ; accessed page 2186 <1> ; btr eax, PTE_A_ACCESS_BIT ; reset 'accessed' bit 2187 <1> ; jc short swpqs_11 ; accessed page 2188 <1> ; 2189 <1> ; dec ecx 2190 <1> ; mov [swpq_count], cx 2191 <1> ; jz short swpqs_10 2192 <1> ; ; esi = head + 4 2193 <1> ; ; edi = head 2194 <1> ; rep movsd ; n = 1 to k-1, [n - 1] = [n] 2195 <1> ;swpqs_10: 2196 <1> ; mov [edi], ecx ; 0 2197 <1> ; jmp short swpqs_6 ; 26/03/2017 2198 <1> ; 2199 <1> ;swpqs_11: 2200 <1> ; mov [ebx], eax ; save changed attribute 2201 <1> ; ; Rotation (head -> tail) 2202 <1> ; dec ecx ; entry count -> last entry number 2203 <1> ; jz short swpqs_10 2204 <1> ; ; esi = head + 4 2205 <1> ; ; edi = head 2206 <1> ; mov eax, [edi] ; 20/07/2015 2207 <1> ; rep movsd ; n = 1 to k-1, [n - 1] = [n] 2208 <1> ; mov [edi], eax ; head -> tail ; [k] = [1] 2209 <1> ; 2210 <1> ; mov cx, [swpq_count] 2211 <1> ; 2212 <1> ;swpqs_12: 2213 <1> ; mov esi, swap_queue ; head 2214 <1> ; jmp swpqs_7 2215 <1> ; 2216 <1> ;swpqs_13: 2217 <1> ; dec ecx 2218 <1> ; mov [swpq_count], cx 2219 <1> ; jz swpqs_5 2220 <1> ; jmp short swpqs_12 2221 <1> 2222 <1> ; 17/04/2021 2223 <1> ; ('add_to_swp_queue' procedure call is disabled as temporary) 2224 <1> 2225 <1> add_to_swap_queue: 2226 <1> ; 20/02/2017 2227 <1> ; 20/07/2015 2228 <1> ; 24/10/2014 (Retro UNIX 386 v1 - beginning) 2229 <1> ; 2230 <1> ; Adds new page to swap queue 2231 <1> ; (page directories and page tables must not be added 2232 <1> ; to swap queue) 2233 <1> ; 2234 <1> ; INPUT -> 2235 <1> ; EBX = Linear (Virtual) addr for current process 2236 <1> ; [u.uno] 2237 <1> ; 20/02/2017 2238 <1> ; (Linear address = CORE + user's virtual address) 2239 <1> ; 2240 <1> ; OUTPUT -> 2241 <1> ; EAX = [swpq_count] 2242 <1> ; (after the PTE has been added) 2243 <1> ; EAX = 0 -> Swap queue is full, (1024 entries) 2244 <1> ; the PTE could not be added. 2245 <1> ; 2246 <1> ; Modified Registers -> EAX 2247 <1> ; 2248 <1> ; push ebx 2249 <1> ; and bx, ~PAGE_OFF ; ~0FFFh ; reset bits, 0 to 11 2250 <1> ; mov bl, [u.uno] ; current process number 2251 <1> ; call swap_queue_shift ; drop from the queue if 2252 <1> ; ; it is already on the queue 2253 <1> ; ; then add it to the tail of the queue 2254 <1> ; movzx eax, word [swpq_count] 2255 <1> ; cmp ax, 1024 2256 <1> ; jb short atsq_1 2257 <1> ; sub ax, ax 2258 <1> ; pop ebx 2259 <1> ; retn 2260 <1> ;atsq_1: 2261 <1> ; push esi 2262 <1> ; mov esi, swap_queue 2263 <1> ; and ax, ax 2264 <1> ; jz short atsq_2 2265 <1> ; shl ax, 2 ; convert to offset 2266 <1> ; add esi, eax 2267 <1> ; shr ax, 2 2268 <1> ;atsq_2: 2269 <1> ; inc ax 2270 <1> ; mov [esi], ebx ; Virtual address + [u.uno] combination 2271 <1> ; mov [swpq_count], ax 2272 <1> ; pop esi 2273 <1> ; pop ebx 2274 <1> ; retn 2275 <1> 2276 <1> ; 17/04/2021 2277 <1> ; ('unlink_swap_block' procedure call is disabled as temporary) 2278 <1> 2279 <1> unlink_swap_block: 2280 <1> ; 15/09/2015 2281 <1> ; 30/04/2015 2282 <1> ; 18/04/2015 2283 <1> ; 24/10/2014 (Retro UNIX 386 v1 - beginning) 2284 <1> ; 2285 <1> ; INPUT -> 2286 <1> ; EAX = swap disk/file offset address 2287 <1> ; (bit 1 to bit 31) 2288 <1> ; OUTPUT -> 2289 <1> ; [swpd_free] is increased 2290 <1> ; (corresponding SWAP DISK ALLOC. TABLE bit is SET) 2291 <1> ; 2292 <1> ; Modified Registers -> EAX 2293 <1> ; 2294 <1> ; push ebx 2295 <1> ; push edx 2296 <1> ; ; 2297 <1> ; shr eax, SECTOR_SHIFT+1 ;3+1 ; shift sector address to 2298 <1> ; ; 3 bits right 2299 <1> ; ; to get swap block/page number 2300 <1> ; mov edx, eax 2301 <1> ; ; 15/09/2015 2302 <1> ; shr edx, 3 ; to get offset to S.A.T. 2303 <1> ; ; (1 allocation bit = 1 page) 2304 <1> ; ; (1 allocation bytes = 8 pages) 2305 <1> ; and dl, 0FCh ; clear lower 2 bits 2306 <1> ; ; (to get 32 bit position) 2307 <1> ; ; 2308 <1> ; mov ebx, swap_alloc_table ; Swap Allocation Table address 2309 <1> ; add ebx, edx 2310 <1> ; and eax, 1Fh ; lower 5 bits only 2311 <1> ; ; (allocation bit position) 2312 <1> ; cmp eax, [swpd_next] ; is the new free block addr. lower 2313 <1> ; ; than the address in 'swpd_next' ? 2314 <1> ; ; (next/first free block value) 2315 <1> ; jnb short uswpbl_1 ; no 2316 <1> ; mov [swpd_next], eax ; yes 2317 <1> ;uswpbl_1: 2318 <1> ; bts [ebx], eax ; unlink/release/deallocate block 2319 <1> ; ; set relevant bit to 1. 2320 <1> ; ; set CF to the previous bit value 2321 <1> ; cmc ; complement carry flag 2322 <1> ; jc short uswpbl_2 ; do not increase swfd_free count 2323 <1> ; ; if the block is already deallocated 2324 <1> ; ; before. 2325 <1> ; inc dword [swpd_free] 2326 <1> ;uswpbl_2: 2327 <1> ; pop edx 2328 <1> ; pop ebx 2329 <1> ; retn 2330 <1> 2331 <1> ; 17/04/2021 2332 <1> ; ('ink_swap_block' procedure call is disabled as temporary) 2333 <1> 2334 <1> link_swap_block: 2335 <1> ; 01/07/2015 2336 <1> ; 18/04/2015 2337 <1> ; 24/10/2014 (Retro UNIX 386 v1 - beginning) 2338 <1> ; 2339 <1> ; INPUT -> none 2340 <1> ; 2341 <1> ; OUTPUT -> 2342 <1> ; EAX = OFFSET ADDRESS OF THE ALLOCATED BLOCK (4096 bytes) 2343 <1> ; in sectors (corresponding 2344 <1> ; SWAP DISK ALLOCATION TABLE bit is RESET) 2345 <1> ; 2346 <1> ; CF = 1 and EAX = 0 2347 <1> ; if there is not a free block to be allocated 2348 <1> ; 2349 <1> ; Modified Registers -> none (except EAX) 2350 <1> ; 2351 <1> 2352 <1> ; ;mov eax, [swpd_free] 2353 <1> ; ;and eax, eax 2354 <1> ; ;jz short out_of_swpspc 2355 <1> ; ; 2356 <1> ; push ebx 2357 <1> ; push ecx 2358 <1> ; ; 2359 <1> ; mov ebx, swap_alloc_table ; Swap Allocation Table offset 2360 <1> ; mov ecx, ebx 2361 <1> ; add ebx, [swpd_next] ; Free block searching starts from here 2362 <1> ; ; next_free_swap_block >> 5 2363 <1> ; add ecx, [swpd_last] ; Free block searching ends here 2364 <1> ; ; (total_swap_blocks - 1) >> 5 2365 <1> ;lswbl_scan: 2366 <1> ; cmp ebx, ecx 2367 <1> ; ja short lswbl_notfound 2368 <1> ; ; 2369 <1> ; bsf eax, [ebx] ; Scans source operand for first bit set (1). 2370 <1> ; ; Clears ZF if a bit is found set (1) and 2371 <1> ; ; loads the destination with an index to 2372 <1> ; ; first set bit. (0 -> 31) 2373 <1> ; ; Sets ZF to 1 if no bits are found set. 2374 <1> ; ; 01/07/2015 2375 <1> ; jnz short lswbl_found ; ZF = 0 -> a free block has been found 2376 <1> ; ; 2377 <1> ; ; NOTE: a Swap Disk Allocation Table bit 2378 <1> ; ; with value of 1 means 2379 <1> ; ; the corresponding page is free 2380 <1> ; ; (Retro UNIX 386 v1 feaure only!) 2381 <1> ; add ebx, 4 2382 <1> ; ; We return back for searching next page block 2383 <1> ; ; NOTE: [swpd_free] is not ZERO; so, 2384 <1> ; ; we always will find at least 1 free block here. 2385 <1> ; jmp short lswbl_scan 2386 <1> ; ; 2387 <1> ;lswbl_notfound: 2388 <1> ; sub ecx, swap_alloc_table 2389 <1> ; mov [swpd_next], ecx ; next/first free page = last page 2390 <1> ; ; (unlink_swap_block procedure will change it) 2391 <1> ; xor eax, eax 2392 <1> ; mov [swpd_free], eax 2393 <1> ; stc 2394 <1> ;lswbl_ok: 2395 <1> ; pop ecx 2396 <1> ; pop ebx 2397 <1> ; retn 2398 <1> ; ; 2399 <1> ;;out_of_swpspc: 2400 <1> ;; stc 2401 <1> ;; retn 2402 <1> ; 2403 <1> ;lswbl_found: 2404 <1> ; mov ecx, ebx 2405 <1> ; sub ecx, swap_alloc_table 2406 <1> ; mov [swpd_next], ecx ; Set first free block searching start 2407 <1> ; ; address/offset (to the next) 2408 <1> ; dec dword [swpd_free] ; 1 block has been allocated (X = X-1) 2409 <1> ; ; 2410 <1> ; btr [ebx], eax ; The destination bit indexed by the source value 2411 <1> ; ; is copied into the Carry Flag and then cleared 2412 <1> ; ; in the destination. 2413 <1> ; ; 2414 <1> ; ; Reset the bit which is corresponding to the 2415 <1> ; ; (just) allocated block. 2416 <1> ; shl ecx, 5 ; (block offset * 32) + block index 2417 <1> ; add eax, ecx ; = block number 2418 <1> ; shl eax, SECTOR_SHIFT ; 3, sector (offset) address of the block 2419 <1> ; ; 1 block = 8 sectors 2420 <1> ; ; 2421 <1> ; ; EAX = offset address of swap disk/file sector (beginning of the block) 2422 <1> ; ; 2423 <1> ; ; NOTE: The relevant page table entry will be updated 2424 <1> ; ; according to this EAX value... 2425 <1> ; ; 2426 <1> ; jmp short lswbl_ok 2427 <1> 2428 <1> ; 17/04/2021 2429 <1> ; ('logical_disk_read' procedure call is disabled as temporary) 2430 <1> 2431 <1> logical_disk_read: 2432 <1> ; 20/07/2015 2433 <1> ; 09/03/2015 (temporary code here) 2434 <1> ; 2435 <1> ; INPUT -> 2436 <1> ; ESI = Logical disk description table address 2437 <1> ; EBX = Memory page (buffer) address (physical!) 2438 <1> ; EAX = Sector adress (offset address, logical sector number) 2439 <1> ; ECX = Sector count 2440 <1> ; 2441 <1> ; 2442 <1> ; retn 2443 <1> 2444 <1> ; 17/04/2021 2445 <1> ; ('logical_disk_write' procedure call is disabled as temporary) 2446 <1> 2447 <1> logical_disk_write: 2448 <1> ; 20/07/2015 2449 <1> ; 09/03/2015 (temporary code here) 2450 <1> ; 2451 <1> ; INPUT -> 2452 <1> ; ESI = Logical disk description table address 2453 <1> ; EBX = Memory page (buffer) address (physical!) 2454 <1> ; EAX = Sector adress (offset address, logical sector number) 2455 <1> ; ECX = Sector count 2456 <1> ; 2457 <1> ; retn 2458 <1> 2459 <1> get_physical_addr: 2460 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 2461 <1> ; (temporary modifications) 2462 <1> ; 2463 <1> ; 26/03/2017 2464 <1> ; 20/02/2017 2465 <1> ; 27/05/2016 - TRDOS 386 (TRDOS v2.0) 2466 <1> ; 18/10/2015 2467 <1> ; 29/07/2015 2468 <1> ; 20/07/2015 2469 <1> ; 04/06/2015 2470 <1> ; 20/05/2015 2471 <1> ; 28/04/2015 2472 <1> ; 18/04/2015 2473 <1> ; Get physical address 2474 <1> ; (allocates a new page for user if it is not present) 2475 <1> ; 2476 <1> ; (This subroutine is needed for mapping user's virtual 2477 <1> ; (buffer) address to physical address (of the buffer).) 2478 <1> ; ('sys write', 'sys read' system calls...) 2479 <1> ; 2480 <1> ; INPUT -> 2481 <1> ; EBX = virtual address 2482 <1> ; u.pgdir = page directory (physical) address 2483 <1> ; 2484 <1> ; OUTPUT -> 2485 <1> ; EAX = physical address 2486 <1> ; EBX = linear address 2487 <1> ; EDX = physical address of the page frame 2488 <1> ; (with attribute bits) 2489 <1> ; ECX = byte count within the page frame 2490 <1> ; 2491 <1> ; Modified Registers -> EAX, EBX, ECX, EDX 2492 <1> ; 2493 00005C10 81C300004000 <1> add ebx, CORE ; 18/10/2015 2494 <1> get_physical_addr_x: ; 27/05/2016 2495 00005C16 A1[C48E0100] <1> mov eax, [u.pgdir] 2496 00005C1B E81CFDFFFF <1> call get_pte 2497 <1> ; EDX = Page table entry address (if CF=0) 2498 <1> ; Page directory entry address (if CF=1) 2499 <1> ; (Bit 0 value is 0 if PT is not present) 2500 <1> ; EAX = Page table entry value (page address) 2501 <1> ; CF = 1 -> PDE not present or invalid ? 2502 00005C20 731C <1> jnc short gpa_1 2503 <1> ; 2504 00005C22 E803FCFFFF <1> call allocate_page 2505 00005C27 723F <1> jc short gpa_im_err ; 'insufficient memory' error 2506 <1> gpa_0: 2507 00005C29 E86DFCFFFF <1> call clear_page 2508 <1> ; EAX = Physical (base) address of the allocated (new) page 2509 00005C2E 0C07 <1> or al, PDE_A_PRESENT + PDE_A_WRITE + PDE_A_USER ; 4+2+1 = 7 2510 <1> ; lower 3 bits are used as U/S, R/W, P flags 2511 <1> ; (user, writable, present page) 2512 00005C30 8902 <1> mov [edx], eax ; Let's put the new page directory entry here ! 2513 00005C32 A1[C48E0100] <1> mov eax, [u.pgdir] 2514 00005C37 E800FDFFFF <1> call get_pte 2515 00005C3C 722A <1> jc short gpa_im_err ; 'insufficient memory' error 2516 <1> gpa_1: 2517 <1> ; EAX = PTE value, EDX = PTE address 2518 00005C3E A801 <1> test al, PTE_A_PRESENT 2519 00005C40 7516 <1> jnz short gpa_3 ; 26/03/2017 2520 00005C42 09C0 <1> or eax, eax 2521 00005C44 7446 <1> jz short gpa_7 ; Allocate a new page 2522 <1> 2523 <1> ; 17/04/2021 (TRDOS 386 v2.0.4) 2524 <1> ; ('reload_page' procedure call is disabled as temporary) 2525 00005C46 EB20 <1> jmp short gpa_im_err ; temporary ! 2526 <1> 2527 <1> ; 20/07/2015 2528 <1> ; push ebp 2529 <1> ; mov ebp, ebx ; virtual (linear) address 2530 <1> ; ; reload swapped page 2531 <1> ; call reload_page ; 28/04/2015 2532 <1> ; pop ebp 2533 <1> ; jc short gpa_retn 2534 <1> gpa_2: 2535 <1> ; 26/03/2017 2536 <1> ; 20/02/2017 2537 <1> ; If a page will contain a Signal Response Byte 2538 <1> ; it must not be swapped out, because 2539 <1> ; timer service or irq callback service 2540 <1> ; will write a signal return/response byte 2541 <1> ; directly by using physical address of Signal 2542 <1> ; Response Byte.(Even if process is not running, 2543 <1> ; or it is running with swapped out pages.) 2544 <1> ; 2545 <1> ; 'no_page_swap' will be set by 'systimer' or 2546 <1> ; 'syscalbac' sistem functions/calls. (*) 2547 <1> ; 2548 00005C48 803D[52880100]00 <1> cmp byte [no_page_swap], 0 2549 00005C4F 761D <1> jna short gpa_4 ; this page can be swapped out 2550 <1> ; this page must not be swapped out 2551 <1> ; but 'no_page_swap' must be reset here 2552 <1> ; immediately for other callers (*) 2553 <1> ; (otherwise, swap queue would not be long enough) 2554 00005C51 E844000000 <1> call gpa_8 ; 26/03/2017 2555 00005C56 EB16 <1> jmp short gpa_5 2556 <1> gpa_3: 2557 <1> ; 26/03/2017 2558 00005C58 803D[52880100]00 <1> cmp byte [no_page_swap], 0 2559 00005C5F 7611 <1> jna short gpa_6 ; this page can be swapped out 2560 00005C61 E834000000 <1> call gpa_8 2561 00005C66 EB0A <1> jmp short gpa_6 2562 <1> 2563 <1> gpa_im_err: 2564 00005C68 B804000000 <1> mov eax, ERR_MINOR_IM ; Insufficient memory (minor) error! 2565 <1> ; Major error = 0 (No protection fault) 2566 00005C6D C3 <1> retn 2567 <1> gpa_4: 2568 <1> ; 17/04/2021 (TRDOS 386 v2.0.4) 2569 <1> ; ('add_to_swap_queue' procedure call is disabled as temporary) 2570 <1> 2571 <1> ; 20/07/2015 2572 <1> ; 20/05/2015 2573 <1> ; add this page to swap queue 2574 <1> ; push eax 2575 <1> ; ; EBX = Linear (CORE+virtual) address ; 20/02/2017 2576 <1> ; call add_to_swap_queue 2577 <1> ; pop eax 2578 <1> gpa_5: 2579 <1> ; PTE address in EDX 2580 <1> ; virtual address in EBX 2581 <1> ; EAX = memory page address 2582 00005C6E 0C07 <1> or al, PTE_A_PRESENT + PTE_A_USER + PTE_A_WRITE 2583 <1> ; present flag, bit 0 = 1 2584 <1> ; user flag, bit 2 = 1 2585 <1> ; writable flag, bit 1 = 1 2586 00005C70 8902 <1> mov [edx], eax ; Update PTE value 2587 <1> gpa_6: 2588 <1> ; 18/10/2015 2589 00005C72 89D9 <1> mov ecx, ebx 2590 00005C74 81E1FF0F0000 <1> and ecx, PAGE_OFF 2591 00005C7A 89C2 <1> mov edx, eax 2592 00005C7C 662500F0 <1> and ax, PTE_A_CLEAR 2593 00005C80 01C8 <1> add eax, ecx 2594 00005C82 F7D9 <1> neg ecx ; 1 -> -1 (0FFFFFFFFh), 4095 (0FFFh) -> -4095 2595 00005C84 81C100100000 <1> add ecx, PAGE_SIZE 2596 00005C8A F8 <1> clc 2597 <1> gpa_retn: 2598 00005C8B C3 <1> retn 2599 <1> gpa_7: 2600 00005C8C E899FBFFFF <1> call allocate_page 2601 00005C91 72D5 <1> jc short gpa_im_err ; 'insufficient memory' error 2602 00005C93 E803FCFFFF <1> call clear_page 2603 00005C98 EBAE <1> jmp short gpa_2 2604 <1> 2605 <1> gpa_8: ; 26/03/2017 2606 00005C9A C605[52880100]00 <1> mov byte [no_page_swap], 0 2607 <1> 2608 00005CA1 C3 <1> retn ; 17/04/2021 (temporary) 2609 <1> 2610 <1> ; 17/04/2021 (TRDOS 386 v2.0.4) 2611 <1> ; ('swap_queue_shift' procedure call is disabled as temporary) 2612 <1> ; 2613 <1> ; push ebx 2614 <1> ; push eax ; 26/03/2017 2615 <1> ; and bx, ~PAGE_OFF ; ~0FFFh ; reset bits, 0 to 11 2616 <1> ; mov bl, [u.uno] ; current process number 2617 <1> ; call swap_queue_shift ; drop from the queue if 2618 <1> ; ; it is already on the queue 2619 <1> ; pop eax ; 26/03/2017 2620 <1> ; pop ebx 2621 <1> ; 2622 <1> ; retn 2623 <1> 2624 <1> ; 17/04/2021 2625 <1> ; ('reload_page' procedure call is disabled as temporary) 2626 <1> 2627 <1> reload_page: 2628 <1> ; 20/07/2015 2629 <1> ; 28/04/2015 (Retro UNIX 386 v1 - beginning) 2630 <1> ; 2631 <1> ; Reload (Restore) swapped page at memory 2632 <1> ; 2633 <1> ; INPUT -> 2634 <1> ; EBP = Virtual (linear) memory address 2635 <1> ; EAX = PTE value (swap disk sector address) 2636 <1> ; (Swap disk sector address = bit 1 to bit 31 of EAX) 2637 <1> ; OUTPUT -> 2638 <1> ; EAX = PHYSICAL (real/flat) ADDRESS OF RELOADED PAGE 2639 <1> ; 2640 <1> ; CF = 1 and EAX = error code 2641 <1> ; 2642 <1> ; Modified Registers -> none (except EAX) 2643 <1> ; 2644 <1> ; shr eax, 1 ; Convert PTE value to swap disk address 2645 <1> ; push ebx ; 2646 <1> ; mov ebx, eax ; Swap disk (offset) address 2647 <1> ; call allocate_page 2648 <1> ; jc short rlp_im_err 2649 <1> ; xchg eax, ebx 2650 <1> ; ; EBX = Physical memory (page) address 2651 <1> ; ; EAX = Swap disk (offset) address 2652 <1> ; ; EBP = Virtual (linear) memory address 2653 <1> ; call swap_in 2654 <1> ; jc short rlp_swp_err ; (swap disk/file read error) 2655 <1> ; mov eax, ebx 2656 <1> ;rlp_retn: 2657 <1> ; pop ebx 2658 <1> ; retn 2659 <1> ; 2660 <1> ;rlp_im_err: 2661 <1> ; mov eax, ERR_MINOR_IM ; Insufficient memory (minor) error! 2662 <1> ; ; Major error = 0 (No protection fault) 2663 <1> ; jmp short rlp_retn 2664 <1> ; 2665 <1> ;rlp_swp_err: 2666 <1> ; mov eax, SWP_DISK_READ_ERR ; Swap disk read error ! 2667 <1> ; jmp short rlp_retn 2668 <1> 2669 <1> copy_page_dir: 2670 <1> ; 17/04/2021 (temporary modifications) 2671 <1> ; 19/09/2015 2672 <1> ; temporary - 07/09/2015 2673 <1> ; 07/09/2015 (Retro UNIX 386 v1 - beginning) 2674 <1> ; 2675 <1> ; INPUT -> 2676 <1> ; [u.pgdir] = PHYSICAL (real/flat) ADDRESS of the parent's 2677 <1> ; page directory. 2678 <1> ; OUTPUT -> 2679 <1> ; EAX = PHYSICAL (real/flat) ADDRESS of the child's 2680 <1> ; page directory. 2681 <1> ; (New page directory with new page table entries.) 2682 <1> ; (New page tables with read only copies of the parent's 2683 <1> ; pages.) 2684 <1> ; EAX = 0 -> Error (CF = 1) 2685 <1> ; 2686 <1> ; Modified Registers -> none (except EAX) 2687 <1> ; 2688 00005CA2 E883FBFFFF <1> call allocate_page 2689 00005CA7 723E <1> jc short cpd_err 2690 <1> ; 2691 00005CA9 55 <1> push ebp ; 20/07/2015 2692 00005CAA 56 <1> push esi 2693 00005CAB 57 <1> push edi 2694 00005CAC 53 <1> push ebx 2695 00005CAD 51 <1> push ecx 2696 00005CAE 8B35[C48E0100] <1> mov esi, [u.pgdir] 2697 00005CB4 89C7 <1> mov edi, eax 2698 00005CB6 50 <1> push eax ; save child's page directory address 2699 <1> ; copy PDE 0 from the parent's page dir to the child's page dir 2700 <1> ; (use same system space for all user page tables) 2701 00005CB7 A5 <1> movsd 2702 00005CB8 BD00004000 <1> mov ebp, 1024*4096 ; pass the 1st 4MB (system space) 2703 00005CBD B9FF030000 <1> mov ecx, (PAGE_SIZE / 4) - 1 ; 1023 2704 <1> cpd_0: 2705 00005CC2 AD <1> lodsd 2706 <1> ;or eax, eax 2707 <1> ;jnz short cpd_1 2708 00005CC3 A801 <1> test al, PDE_A_PRESENT ; bit 0 = 1 2709 00005CC5 7508 <1> jnz short cpd_1 2710 <1> ; (virtual address at the end of the page table) 2711 00005CC7 81C500004000 <1> add ebp, 1024*4096 ; page size * PTE count 2712 00005CCD EB0F <1> jmp short cpd_2 2713 <1> cpd_1: 2714 00005CCF 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear attribute bits 2715 00005CD3 89C3 <1> mov ebx, eax 2716 <1> ; EBX = Parent's page table address 2717 00005CD5 E81F000000 <1> call copy_page_table 2718 00005CDA 720C <1> jc short cpd_p_err 2719 <1> ; EAX = Child's page table address 2720 00005CDC 0C07 <1> or al, PDE_A_PRESENT + PDE_A_WRITE + PDE_A_USER 2721 <1> ; set bit 0, bit 1 and bit 2 to 1 2722 <1> ; (present, writable, user) 2723 <1> cpd_2: 2724 00005CDE AB <1> stosd 2725 00005CDF E2E1 <1> loop cpd_0 2726 <1> ; 2727 00005CE1 58 <1> pop eax ; restore child's page directory address 2728 <1> cpd_3: 2729 00005CE2 59 <1> pop ecx 2730 00005CE3 5B <1> pop ebx 2731 00005CE4 5F <1> pop edi 2732 00005CE5 5E <1> pop esi 2733 00005CE6 5D <1> pop ebp 2734 <1> cpd_err: 2735 00005CE7 C3 <1> retn 2736 <1> cpd_p_err: 2737 <1> ; release the allocated pages missing (recover free space) 2738 00005CE8 58 <1> pop eax ; the new page directory address (physical) 2739 00005CE9 8B1D[C48E0100] <1> mov ebx, [u.pgdir] ; parent's page directory address 2740 00005CEF E866FCFFFF <1> call deallocate_page_dir 2741 00005CF4 29C0 <1> sub eax, eax ; 0 2742 00005CF6 F9 <1> stc 2743 00005CF7 EBE9 <1> jmp short cpd_3 2744 <1> 2745 <1> copy_page_table: 2746 <1> ; 17/04/2021 (temporary modifications) 2747 <1> ; 19/09/2015 2748 <1> ; temporary - 07/09/2015 2749 <1> ; 07/09/2015 (Retro UNIX 386 v1 - beginning) 2750 <1> ; 2751 <1> ; INPUT -> 2752 <1> ; EBX = PHYSICAL (real/flat) ADDRESS of the parent's page table. 2753 <1> ; EBP = page table entry index (from 'copy_page_dir') 2754 <1> ; OUTPUT -> 2755 <1> ; EAX = PHYSICAL (real/flat) ADDRESS of the child's page table. 2756 <1> ; EBP = (recent) page table index (for 'add_to_swap_queue') 2757 <1> ; CF = 1 -> error 2758 <1> ; 2759 <1> ; Modified Registers -> EBP (except EAX) 2760 <1> ; 2761 00005CF9 E82CFBFFFF <1> call allocate_page 2762 00005CFE 7244 <1> jc short cpt_err 2763 <1> ; 2764 00005D00 50 <1> push eax ; * 2765 <1> ;push ebx 2766 00005D01 56 <1> push esi 2767 00005D02 57 <1> push edi 2768 00005D03 52 <1> push edx 2769 00005D04 51 <1> push ecx 2770 <1> ; 2771 00005D05 89DE <1> mov esi, ebx 2772 00005D07 89C7 <1> mov edi, eax 2773 00005D09 89C2 <1> mov edx, eax 2774 00005D0B 81C200100000 <1> add edx, PAGE_SIZE 2775 <1> cpt_0: 2776 00005D11 AD <1> lodsd 2777 00005D12 A801 <1> test al, PTE_A_PRESENT ; bit 0 = 1 2778 <1> ;jnz short cpt_1 (*) 2779 <1> ; 17/04/2021 (temporary (*) 2780 <1> ;and eax, eax (*) 2781 00005D14 741E <1> jz short cpt_2 ; 17/04/2021 2782 <1> 2783 <1> ; 17/04/2021 2784 <1> ; ('reload_page' procedure call is disabled as temporary) 2785 <1> ; 2786 <1> ; ; ebp = virtual (linear) address of the memory page 2787 <1> ; call reload_page ; 28/04/2015 2788 <1> ; jc short cpt_p_err 2789 <1> cpt_1: 2790 00005D16 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; clear attribute bits 2791 00005D1A 89C1 <1> mov ecx, eax 2792 <1> ; Allocate a new page for the child process 2793 00005D1C E809FBFFFF <1> call allocate_page 2794 00005D21 721C <1> jc short cpt_p_err 2795 00005D23 57 <1> push edi 2796 00005D24 56 <1> push esi 2797 00005D25 89CE <1> mov esi, ecx 2798 00005D27 89C7 <1> mov edi, eax 2799 00005D29 B900040000 <1> mov ecx, PAGE_SIZE/4 2800 00005D2E F3A5 <1> rep movsd ; copy page (4096 bytes) 2801 00005D30 5E <1> pop esi 2802 00005D31 5F <1> pop edi 2803 <1> ; 2804 <1> 2805 <1> ; 17/04/2021 2806 <1> ; ('add_to_swap_queue' procedure call is disabled as temporary) 2807 <1> ; 2808 <1> ; push ebx 2809 <1> ; push eax 2810 <1> ; mov ebx, ebp 2811 <1> ; ; ebx = virtual address of the memory page 2812 <1> ; call add_to_swap_queue 2813 <1> ; pop eax 2814 <1> ; pop ebx 2815 <1> ; 2816 <1> ;or ax, PTE_A_USER+PTE_A_PRESENT 2817 00005D32 0C07 <1> or al, PTE_A_USER+PTE_A_WRITE+PTE_A_PRESENT 2818 <1> cpt_2: 2819 00005D34 AB <1> stosd ; EDI points to child's PTE 2820 <1> ; 2821 00005D35 81C500100000 <1> add ebp, 4096 ; 20/07/2015 (next page) 2822 <1> ; 2823 00005D3B 39D7 <1> cmp edi, edx 2824 00005D3D 72D2 <1> jb short cpt_0 2825 <1> cpt_p_err: 2826 00005D3F 59 <1> pop ecx 2827 00005D40 5A <1> pop edx 2828 00005D41 5F <1> pop edi 2829 00005D42 5E <1> pop esi 2830 <1> ;pop ebx 2831 00005D43 58 <1> pop eax ; * 2832 <1> cpt_err: 2833 00005D44 C3 <1> retn 2834 <1> 2835 <1> allocate_memory_block: 2836 <1> ; 01/05/2017 2837 <1> ; 28/04/2017 2838 <1> ; 25/04/2017 2839 <1> ; 01/04/2016, 02/04/2016, 03/04/2016 2840 <1> ; 13/03/2016, 14/03/2016 2841 <1> ; 12/03/2016 (TRDOS 386 = TRDOS v2.0) 2842 <1> ; Allocating contiguous memory pages (in the kernel's memory space) 2843 <1> ; 2844 <1> ; INPUT -> 2845 <1> ; EAX = Beginning address (physical) 2846 <1> ; EAX = 0 -> Allocate memory block from the first proper aperture 2847 <1> ; ECX = Number of bytes to be allocated 2848 <1> ; 2849 <1> ; OUTPUT -> 2850 <1> ; 1) cf = 0 -> successful 2851 <1> ; EAX = Beginning (physical) address of the allocated memory block 2852 <1> ; ECX = Number of allocated bytes (rounded up to page borders) 2853 <1> ; 2) cf = 1 -> unsuccessful 2854 <1> ; 2.1) If EAX > 0 -> 2855 <1> ; (Number of requested pages is more than # of free pages 2856 <1> ; but contiguous free pages -the aperture- is not enough!) 2857 <1> ; EAX = Beginning address of available aperture 2858 <1> ; (one of all aperture with max. aperture size/length) 2859 <1> ; ECX = Size of available aperture (memory block) in bytes 2860 <1> ; 2.2) If EAX = 0 -> Out of memory error 2861 <1> ; (number of free pages is less than requested number) 2862 <1> ; ECX = Total number of free bytes (free pages * 4096) 2863 <1> ; (It is not number of contiguous free bytes) 2864 <1> ; 2865 <1> ; (Modified Registers -> EAX, ECX) 2866 <1> ; 2867 <1> ; PURPOSE: Loading a file at memory for copying or running etc. 2868 <1> ; If this procedure returns with cf is set, ECX contains maximum 2869 <1> ; available space and EAX contains the beginning address of it. 2870 <1> ; If EAX has zero, ECX contains total number of free bytes. 2871 <1> ; If requested block has been successfully allocated (by rounding up to 2872 <1> ; the last page border), it must be deallocated later by using 2873 <1> ; 'deallocate_memory_block' procedure. 2874 <1> 2875 00005D45 52 <1> push edx ; * 2876 00005D46 BAFF0F0000 <1> mov edx, PAGE_SIZE - 1 ; 4095 2877 00005D4B 01D0 <1> add eax, edx 2878 00005D4D 01D1 <1> add ecx, edx 2879 00005D4F C1E90C <1> shr ecx, PAGE_SHIFT ; 12 2880 <1> 2881 <1> ; ECX = number of contiguous pages to be allocated 2882 00005D52 8B15[B8760100] <1> mov edx, [free_pages] 2883 <1> ; 01/05/2017 2884 <1> ;or ecx, ecx 2885 <1> ;jz short amb3 2886 <1> ; If ECX=0, set cf to 1 and return with max. available mem block size 2887 <1> 2888 00005D58 39D1 <1> cmp ecx, edx 2889 00005D5A 7760 <1> ja short amb_3 2890 <1> 2891 00005D5C C1E80C <1> shr eax, PAGE_SHIFT ; 12 2892 <1> 2893 00005D5F 89C2 <1> mov edx, eax ; page number 2894 00005D61 C1EA03 <1> shr edx, 3 ; to get offset to M.A.T. 2895 <1> ; (1 allocation bit = 1 page) 2896 <1> ; (1 allocation bytes = 8 pages) 2897 00005D64 80E2FC <1> and dl, 0FCh ; clear lower 2 bits 2898 <1> ; (to get 32 bit position) 2899 00005D67 53 <1> push ebx ; ** 2900 <1> amb_0: 2901 00005D68 890D[70820100] <1> mov [mem_ipg_count], ecx ; initial (reset) value of page count 2902 00005D6E 890D[74820100] <1> mov [mem_pg_count], ecx 2903 00005D74 31C9 <1> xor ecx, ecx ; 0 2904 00005D76 890D[78820100] <1> mov [mem_aperture], ecx ; 0 2905 00005D7C 890D[7C820100] <1> mov [mem_max_aperture], ecx ; 0 2906 <1> 2907 00005D82 BB00001000 <1> mov ebx, MEM_ALLOC_TBL ; Memory Allocation Table address. 2908 00005D87 3B15[BC760100] <1> cmp edx, [next_page] ; Is the beginning page address lower 2909 <1> ; than the address in 'next_page' ? 2910 <1> ; (the first/next free page of user space) 2911 00005D8D 7208 <1> jb short amb_1 2912 00005D8F 3B15[C0760100] <1> cmp edx, [last_page] ; is the beginning page address higher 2913 <1> ; than the address in 'last_page' ? 2914 <1> ; (end of the memory) 2915 00005D95 7606 <1> jna short amb_2 ; no 2916 <1> amb_1: 2917 00005D97 8B15[BC760100] <1> mov edx, [next_page] ; M.A.T. offset (1 M.A.T. byte = 8 pages) 2918 <1> amb_2: 2919 00005D9D 01D3 <1> add ebx, edx 2920 <1> 2921 <1> ; 28/04/2017 2922 <1> ;xor ecx, ecx 2923 00005D9F 0FBC0B <1> bsf ecx, [ebx] ; 0 to 31 2924 00005DA2 89D0 <1> mov eax, edx 2925 00005DA4 C1E003 <1> shl eax, 3 ; *8 2926 00005DA7 01C8 <1> add eax, ecx ; beginning page number 2927 <1> 2928 00005DA9 A3[80820100] <1> mov [mem_pg_pos], eax ; beginning page no (for curr. mem. aperture) 2929 00005DAE A3[84820100] <1> mov [mem_max_pg_pos], eax ; beginning page no for max. mem. aperture 2930 <1> 2931 00005DB3 83E01F <1> and eax, 1Fh ; lower 5 bits only (0 to 31) 2932 <1> ; (allocation bit position) 2933 00005DB6 750E <1> jnz short amb_4 ; 0 2934 00005DB8 B120 <1> mov cl, 32 2935 00005DBA EB4B <1> jmp short amb_10 2936 <1> 2937 <1> amb_3: ; out_of_memory 2938 00005DBC 31C0 <1> xor eax, eax ; 0 2939 00005DBE 89D1 <1> mov ecx, edx ; free pages 2940 00005DC0 C1E10C <1> shl ecx, PAGE_SHIFT 2941 00005DC3 5A <1> pop edx ; * 2942 00005DC4 F9 <1> stc 2943 00005DC5 C3 <1> retn 2944 <1> amb_4: 2945 00005DC6 8B13 <1> mov edx, [ebx] 2946 00005DC8 88C1 <1> mov cl, al ; 1 to 31 2947 00005DCA D3EA <1> shr edx, cl 2948 00005DCC 89D0 <1> mov eax, edx 2949 <1> amb_5: 2950 00005DCE D1E8 <1> shr eax, 1 ; (***) 2951 00005DD0 7317 <1> jnc short amb_7 2952 00005DD2 FF05[78820100] <1> inc dword [mem_aperture] 2953 00005DD8 FF0D[74820100] <1> dec dword [mem_pg_count] 2954 00005DDE 747F <1> jz short amb_15 2955 <1> amb_6: 2956 <1> ; 28/04/2017 2957 00005DE0 FEC1 <1> inc cl 2958 00005DE2 80F920 <1> cmp cl, 32 2959 00005DE5 730D <1> jnb short amb_9 2960 00005DE7 EBE5 <1> jmp short amb_5 2961 <1> amb_7: 2962 00005DE9 50 <1> push eax ; (***) allocation bits (in shifted status) 2963 00005DEA E828010000 <1> call amb_26 ; set maximum memory aperture (free memory block size) 2964 00005DEF 58 <1> pop eax ; (***) 2965 00005DF0 EBEE <1> jmp short amb_6 2966 <1> amb_8: 2967 <1> ; 28/04/2017 2968 00005DF2 B120 <1> mov cl, 32 2969 <1> amb_9: 2970 00005DF4 89DA <1> mov edx, ebx 2971 00005DF6 81EA00001000 <1> sub edx, MEM_ALLOC_TBL 2972 00005DFC 3B15[C0760100] <1> cmp edx, [last_page] 2973 00005E02 7336 <1> jnb short amb_14 ; contiguous pages not enough 2974 00005E04 83C304 <1> add ebx, 4 2975 <1> amb_10: 2976 00005E07 8B03 <1> mov eax, [ebx] 2977 00005E09 21C0 <1> and eax, eax 2978 00005E0B 7408 <1> jz short amb_11 ; there is not a free page bit in this alloc dword 2979 00005E0D 40 <1> inc eax ; 0FFFFFFFFh -> 0 2980 00005E0E 740C <1> jz short amb_12 ; all of bits are set (32 free pages) 2981 00005E10 48 <1> dec eax 2982 00005E11 28C9 <1> sub cl, cl ; 0 2983 00005E13 EBB9 <1> jmp short amb_5 2984 <1> amb_11: 2985 00005E15 E8FD000000 <1> call amb_26 ; set maximum memory aperture (free memory block size) 2986 00005E1A EBD8 <1> jmp short amb_9 2987 <1> amb_12: 2988 00005E1C 390D[74820100] <1> cmp [mem_pg_count], ecx ; 32 2989 00005E22 7306 <1> jnb short amb_13 2990 00005E24 8B0D[74820100] <1> mov ecx, [mem_pg_count] 2991 <1> amb_13: 2992 00005E2A 010D[78820100] <1> add [mem_aperture], ecx 2993 00005E30 290D[74820100] <1> sub [mem_pg_count], ecx 2994 00005E36 7627 <1> jna short amb_15 2995 00005E38 EBBA <1> jmp short amb_9 ; 01/05/2017 2996 <1> amb_14: 2997 00005E3A E8D8000000 <1> call amb_26 ; 28/04/2017 2998 00005E3F A1[84820100] <1> mov eax, [mem_max_pg_pos] ; begin address of max. mem aperture 2999 00005E44 8B0D[7C820100] <1> mov ecx, [mem_max_aperture] ; max. (largest) memory aperture 3000 00005E4A F9 <1> stc 3001 00005E4B E9BC000000 <1> jmp amb_25 3002 <1> 3003 <1> allocate_lfb_memory_block: 3004 <1> ; 28/11/2023 3005 <1> ; 20/10/2023 - TRDOS 386 v2.0.7 3006 <1> ; (short way to set the LFB page bits on the M.A.T.) 3007 <1> ; called from 'allocate_lfb_pages_for_kernel' 3008 00005E50 A3[80820100] <1> mov [mem_pg_pos], eax ; LFB start/base address as page number 3009 00005E55 890D[78820100] <1> mov [mem_aperture], ecx ; number of LFB pages 3010 <1> ; (!which overlapping main memory!) 3011 00005E5B 52 <1> push edx ; * 3012 00005E5C 53 <1> push ebx ; ** 3013 00005E5D EB0B <1> jmp short amb_16 3014 <1> 3015 <1> amb_15: ; OK ! 3016 00005E5F A1[80820100] <1> mov eax, [mem_pg_pos] ; Beginning address as page number 3017 00005E64 8B0D[78820100] <1> mov ecx, [mem_aperture] ; Free contiguous page count (>=1) 3018 <1> amb_16: 3019 <1> ; allocate contiguous memory pages (via memory allocation table bits) 3020 00005E6A 89C2 <1> mov edx, eax 3021 <1> ; 25/04/2017 3022 00005E6C C1EA03 <1> shr edx, 3 ; 8 pages in one allocation byte 3023 00005E6F 80E2FC <1> and dl, 0FCh ; clear lower 2 bits 3024 <1> ; (for dword/32bit positioning) 3025 <1> 3026 00005E72 BB00001000 <1> mov ebx, MEM_ALLOC_TBL 3027 00005E77 01D3 <1> add ebx, edx 3028 00005E79 83E01F <1> and eax, 1Fh ; 31 3029 <1> ; 03/04/2016 3030 00005E7C BA20000000 <1> mov edx, 32 3031 00005E81 28C2 <1> sub dl, al 3032 00005E83 39CA <1> cmp edx, ecx ; ecx >= 1 3033 00005E85 7602 <1> jna short amb_17 3034 00005E87 89CA <1> mov edx, ecx 3035 <1> amb_17: 3036 00005E89 29D1 <1> sub ecx, edx 3037 00005E8B 51 <1> push ecx ; *** 3038 00005E8C 89D1 <1> mov ecx, edx 3039 <1> amb_18: 3040 00005E8E 0FB303 <1> btr [ebx], eax ; The destination bit indexed by the source value 3041 <1> ; is copied into the Carry Flag and then cleared 3042 <1> ; in the destination. 3043 <1> ; 20/10/2023 3044 <1> ; (for LFB page allocation.. 3045 <1> ; -here, to prevent using LFB pages for another allocation later- 3046 <1> ; /// the destination bit must be 0 -already- .. 3047 <1> ; so, following 'jnc' is not necessary but i am not removing it 3048 <1> ; for understanding why free page count is decreased here.) 3049 <1> ; 3050 <1> ;jnc short amb_28 ; requested page is already allocated 3051 <1> 3052 00005E91 FF0D[B8760100] <1> dec dword [free_pages] ; 1 page has been allocated (X = X-1) 3053 <1> ;amb_28: ; 20/10/2023 3054 00005E97 49 <1> dec ecx 3055 00005E98 7404 <1> jz short amb_19 3056 00005E9A FEC0 <1> inc al 3057 00005E9C EBF0 <1> jmp short amb_18 3058 <1> amb_19: 3059 00005E9E 59 <1> pop ecx ; *** 3060 <1> ;and ecx, ecx ; 0 ? 3061 <1> ;jz short amb_22 3062 <1> ; 28/11/2023 3063 00005E9F E31E <1> jecxz amb_22 3064 <1> ; 01/04/2016 3065 00005EA1 B020 <1> mov al, 32 3066 <1> amb_20: 3067 00005EA3 83C304 <1> add ebx, 4 3068 00005EA6 39C1 <1> cmp ecx, eax ; 32 3069 00005EA8 7305 <1> jnb short amb_21 3070 <1> ; ECX < 32 3071 00005EAA 28C0 <1> sub al, al ; 0 3072 00005EAC 50 <1> push eax ; 0 *** 3073 00005EAD EBDF <1> jmp short amb_18 3074 <1> amb_21: 3075 00005EAF 2905[B8760100] <1> sub [free_pages], eax ; [free_pages] = [free_pages] - 32 3076 00005EB5 C70300000000 <1> mov dword [ebx], 0 ; reset 32 bits 3077 00005EBB 29C1 <1> sub ecx, eax ; 32 3078 00005EBD 75E4 <1> jnz short amb_20 3079 <1> amb_22: 3080 00005EBF A1[80820100] <1> mov eax, [mem_pg_pos] ; Beginning address as page number 3081 00005EC4 8B0D[78820100] <1> mov ecx, [mem_aperture] ; Free contiguous page count 3082 <1> ; [next_page] update 3083 00005ECA 89C2 <1> mov edx, eax 3084 <1> ; 03/04/2016 3085 00005ECC C1EA03 <1> shr edx, 3 ; to get offset to M.A.T. 3086 <1> ; (1 allocation bit = 1 page) 3087 <1> ; (1 allocation bytes = 8 pages) 3088 00005ECF 80E2FC <1> and dl, 0FCh ; clear lower 2 bits 3089 <1> ; (to get 32 bit position) 3090 00005ED2 3B15[BC760100] <1> cmp edx, [next_page] ; first free page pointer offset 3091 00005ED8 7732 <1> ja short amb_25 3092 00005EDA BB00001000 <1> mov ebx, MEM_ALLOC_TBL 3093 00005EDF 833C1300 <1> cmp dword [ebx+edx], 0 3094 00005EE3 7721 <1> ja short amb_24 3095 00005EE5 89C2 <1> mov edx, eax 3096 00005EE7 01CA <1> add edx, ecx 3097 00005EE9 C1EA03 <1> shr edx, 3 3098 00005EEC 80E2FC <1> and dl, 0FCh 3099 <1> amb_23: 3100 00005EEF 833C1300 <1> cmp dword [ebx+edx], 0 3101 00005EF3 7711 <1> ja short amb_24 3102 00005EF5 83C204 <1> add edx, 4 3103 00005EF8 3B15[C0760100] <1> cmp edx, [last_page] ; last page pointer offset 3104 00005EFE 76EF <1> jna short amb_23 3105 00005F00 8B15[C4760100] <1> mov edx, [first_page] ; (for) beginning of user's space 3106 <1> amb_24: 3107 00005F06 8915[BC760100] <1> mov [next_page], edx 3108 <1> amb_25: 3109 00005F0C 9C <1> pushf 3110 00005F0D C1E00C <1> shl eax, PAGE_SHIFT ; convert to phy. address in bytes 3111 00005F10 C1E10C <1> shl ecx, PAGE_SHIFT ; convert to byte counts 3112 00005F13 9D <1> popf 3113 00005F14 5B <1> pop ebx ; ** 3114 00005F15 5A <1> pop edx ; * 3115 00005F16 C3 <1> retn 3116 <1> 3117 <1> amb_26: ; set maximum free memory aperture (free memory block size) 3118 00005F17 89DA <1> mov edx, ebx ; current address 3119 00005F19 81EA00001000 <1> sub edx, MEM_ALLOC_TBL ; MAT beginning address 3120 <1> ; 02/04/2016 3121 00005F1F C1E203 <1> shl edx, 3 ; MAT byte offset * 8 = page number base 3122 00005F22 01CA <1> add edx, ecx ; current page number (ecx = 0 to 32) 3123 <1> ; 3124 00005F24 A1[78820100] <1> mov eax, [mem_aperture] 3125 00005F29 21C0 <1> and eax, eax 3126 00005F2B 7421 <1> jz short amb_27 3127 00005F2D C705[78820100]0000- <1> mov dword [mem_aperture], 0 3127 00005F35 0000 <1> 3128 00005F37 3B05[7C820100] <1> cmp eax, [mem_max_aperture] 3129 00005F3D 760F <1> jna short amb_27 3130 00005F3F A3[7C820100] <1> mov [mem_max_aperture], eax 3131 <1> ; 25/04/2017 3132 00005F44 A1[80820100] <1> mov eax, [mem_pg_pos] 3133 <1> ; EAX = Beginning page number of the max. aperture 3134 00005F49 A3[84820100] <1> mov [mem_max_pg_pos], eax 3135 <1> amb_27: 3136 00005F4E 8915[80820100] <1> mov [mem_pg_pos], edx ; current page 3137 <1> 3138 00005F54 A1[70820100] <1> mov eax, [mem_ipg_count] ; initial (reset) value of page count 3139 00005F59 A3[74820100] <1> mov [mem_pg_count], eax 3140 <1> 3141 00005F5E C3 <1> retn 3142 <1> 3143 <1> ; 04/06/2024 3144 <1> %if 0 3145 <1> deallocate_memory_block_x: 3146 <1> ; 26/11/2023 - TRDOS 386 v2.0.7 3147 <1> ; deallocate pages after rounding up 3148 <1> ; ((audio buffer size etc. may not be rounded up to page boundary)) 3149 <1> add ecx, PAGE_SIZE - 1 ; 4095 3150 <1> %endif 3151 <1> 3152 <1> deallocate_memory_block: 3153 <1> ; 03/04/2016 3154 <1> ; 14/03/2016 (TRDOS 386 = TRDOS v2.0) 3155 <1> ; Deallocating contiguous memory pages (in the kernel's memory space) 3156 <1> ; 3157 <1> ; INPUT -> 3158 <1> ; EAX = Beginning address (physical) 3159 <1> ; ECX = Number of bytes to be deallocated 3160 <1> ; 3161 <1> ; OUTPUT -> 3162 <1> ; Memory Allocation Table bits will be updated 3163 <1> ; [free_pages] will be changed (increased) 3164 <1> ; 3165 <1> ; (Modified Registers -> EAX, ECX) 3166 <1> ; 3167 <1> ; PURPOSE: Unloading/Freeing a file -or an allocated memory block- 3168 <1> ; at memory after copying, running, saving, reading, writing etc. 3169 <1> ; 3170 <1> 3171 00005F5F 52 <1> push edx ; * 3172 00005F60 53 <1> push ebx ; ** 3173 <1> 3174 00005F61 C1E80C <1> shr eax, PAGE_SHIFT ; 12 3175 00005F64 C1E90C <1> shr ecx, PAGE_SHIFT ; 12 3176 <1> 3177 <1> ; EAX = Beginning page number 3178 <1> ; ECX = Number of contiguous pages to be deallocated 3179 <1> damb_0: 3180 <1> ; deallocate contiguous memory pages (via memory allocation table bits) 3181 00005F67 89C2 <1> mov edx, eax 3182 00005F69 C1EA03 <1> shr edx, 3 ; to get offset to M.A.T. 3183 <1> ; (1 allocation bit = 1 page) 3184 <1> ; (1 allocation bytes = 8 pages) 3185 00005F6C 80E2FC <1> and dl, 0FCh ; clear lower 2 bits 3186 <1> ; (to get 32 bit position) 3187 00005F6F 3B15[BC760100] <1> cmp edx, [next_page] ; next free page 3188 00005F75 7306 <1> jnb short damb_1 3189 00005F77 8915[BC760100] <1> mov [next_page], edx 3190 <1> damb_1: 3191 00005F7D BB00001000 <1> mov ebx, MEM_ALLOC_TBL 3192 00005F82 01D3 <1> add ebx, edx 3193 00005F84 83E01F <1> and eax, 1Fh ; 31 3194 <1> 3195 <1> ; 03/04/2016 3196 00005F87 BA20000000 <1> mov edx, 32 3197 00005F8C 28C2 <1> sub dl, al 3198 00005F8E 39CA <1> cmp edx, ecx 3199 00005F90 7602 <1> jna short damb_2 3200 00005F92 89CA <1> mov edx, ecx 3201 <1> damb_2: 3202 00005F94 29D1 <1> sub ecx, edx 3203 00005F96 51 <1> push ecx ; *** 3204 00005F97 89D1 <1> mov ecx, edx 3205 <1> damb_3: 3206 00005F99 0FAB03 <1> bts [ebx], eax ; unlink/release/deallocate page 3207 <1> ; set relevant bit to 1. 3208 <1> ; set CF to the previous bit value 3209 00005F9C FF05[B8760100] <1> inc dword [free_pages] ; 1 page has been deallocated (X = X+1) 3210 00005FA2 49 <1> dec ecx 3211 00005FA3 7404 <1> jz short damb_4 3212 00005FA5 FEC0 <1> inc al 3213 00005FA7 EBF0 <1> jmp short damb_3 3214 <1> damb_4: 3215 00005FA9 59 <1> pop ecx ; *** 3216 00005FAA 21C9 <1> and ecx, ecx ; 0 ? 3217 00005FAC 741E <1> jz short damb_7 3218 <1> ; 03/04/2016 3219 00005FAE B020 <1> mov al, 32 3220 <1> damb_5: 3221 00005FB0 83C304 <1> add ebx, 4 3222 00005FB3 39C1 <1> cmp ecx, eax ; 32 3223 00005FB5 7305 <1> jnb short damb_6 3224 <1> ; ECX < 32 3225 00005FB7 28C0 <1> sub al, al ; 0 3226 00005FB9 50 <1> push eax ; 0 *** 3227 00005FBA EBDD <1> jmp short damb_3 3228 <1> damb_6: 3229 00005FBC 0105[B8760100] <1> add [free_pages], eax ; [free_pages] = [free_pages] + 32 3230 00005FC2 C703FFFFFFFF <1> mov dword [ebx], 0FFFFFFFFh ; set 32 bits 3231 00005FC8 29C1 <1> sub ecx, eax ; 32 3232 00005FCA 75E4 <1> jnz short damb_5 3233 <1> damb_7: 3234 00005FCC 5B <1> pop ebx ; ** 3235 00005FCD 5A <1> pop edx ; * 3236 00005FCE C3 <1> retn 3237 <1> 3238 <1> direct_memory_access: 3239 <1> ; 20/10/2023 3240 <1> ; 17/04/2021 (temporary modifications) 3241 <1> ; 22/07/2017 3242 <1> ; 12/05/2017 3243 <1> ; 16/07/2016 3244 <1> ; 12/07/2016 (TRDOS 386 = TRDOS v2.0) 3245 <1> ; This processure will be called to map 3246 <1> ; user's (ring 3) page tables to access phsical 3247 <1> ; (flat/linear) memory addresses, directly (without 3248 <1> ; kernel's data transfer functions). 3249 <1> ; 3250 <1> ; Purpose: Video memory access and shared memory access. 3251 <1> ; 3252 <1> ; INPUT -> 3253 <1> ; EAX = Beginning address (physical). 3254 <1> ; EBX = User's buffer address ; 12/05/2017 3255 <1> ; ECX = Number of contiguous pages to be mapped. 3256 <1> ; OUTPUT -> 3257 <1> ; User's page directory and pages tables 3258 <1> ; will be updated. 3259 <1> ; 3260 <1> ; If an old page table entry has valid page address, 3261 <1> ; that page will be deallocated just before PTE will 3262 <1> ; be changed for direct (1 to 1) memory page access. 3263 <1> ; 3264 <1> ; If old PTE value points to a swapped page, 3265 <1> ; that page (block) will be unlinked on swap disk. 3266 <1> ; 3267 <1> ; Newly allocated pages (except page tables) will not 3268 <1> ; be applied to Memory Allocation Table. 3269 <1> ; AVL bit 1 (PTE bit 10) of page table entry will be 3270 <1> ; used to indicate shared (direct) memory page; then, 3271 <1> ; this page will not be deallocated later during 3272 <1> ; process termination. (Memory Allocation Table and 3273 <1> ; free memory count will not be affected. 3274 <1> ; (Except deallocating page table's itself.) 3275 <1> ; 3276 <1> ; CF = 1 -> error (EAX = error code) 3277 <1> ; CF = 0 -> success (EAX = beginning address) 3278 <1> ; 3279 <1> ;; (Modified Registers -> none) 3280 <1> ; Modified registers: ebp, edx, ecx, ebx, esi, edi 3281 <1> ; 3282 <1> 3283 <1> ;push ebp 3284 <1> ;push ebx 3285 <1> ;push ecx 3286 <1> ;push edx 3287 00005FCF 662500F0 <1> and ax, PTE_A_CLEAR ; clear page offset 3288 00005FD3 50 <1> push eax 3289 <1> ;and ecx, ecx ; page count 3290 <1> ;jz dmem_acc_7 ; 'insufficient memory' error 3291 00005FD4 89C5 <1> mov ebp, eax 3292 00005FD6 81C300004000 <1> add ebx, CORE ; 12/05/2017 3293 <1> dmem_acc_0: 3294 00005FDC 891D[288D0100] <1> mov [base_addr], ebx ; 12/05/2017 3295 00005FE2 A1[C48E0100] <1> mov eax, [u.pgdir] ; page dir address (physical) 3296 00005FE7 E850F9FFFF <1> call get_pte 3297 <1> ; EDX = Page table entry address (if CF=0) 3298 <1> ; Page directory entry address (if CF=1) 3299 <1> ; (Bit 0 value is 0 if PT is not present) 3300 <1> ; EAX = Page table entry value (page address) 3301 <1> ; CF = 1 -> PDE not present or invalid ? 3302 00005FEC 7321 <1> jnc short dmem_acc_1 3303 <1> ; 20/10/2023 3304 <1> ; Allocate a page as a new page table 3305 00005FEE E837F8FFFF <1> call allocate_page 3306 <1> ;jc dmem_acc_7 ; 'insufficient memory' error 3307 <1> ; 17/04/2021 3308 00005FF3 7215 <1> jc short _dmem_acc_7 3309 <1> ; 3310 00005FF5 E8A1F8FFFF <1> call clear_page 3311 <1> ; EAX = Physical (base) address of the allocated (new) page 3312 00005FFA 0C07 <1> or al, PDE_A_PRESENT + PDE_A_WRITE + PDE_A_USER ; 4+2+1 = 7 3313 <1> ; lower 3 bits are used as U/S, R/W, P flags 3314 <1> ; (user, writable, present page) 3315 00005FFC 8902 <1> mov [edx], eax ; Let's put the new page directory entry here ! 3316 00005FFE A1[C48E0100] <1> mov eax, [u.pgdir] 3317 00006003 E834F9FFFF <1> call get_pte 3318 <1> ;jc dmem_acc_7 ; 'insufficient memory' error 3319 <1> ; 17/04/2021 3320 00006008 7305 <1> jnc short dmem_acc_1 3321 <1> _dmem_acc_7: 3322 0000600A E985000000 <1> jmp dmem_acc_7 3323 <1> dmem_acc_1: 3324 <1> ; EAX = PTE value, EDX = PTE address 3325 0000600F A801 <1> test al, PTE_A_PRESENT 3326 <1> ;jnz short dmem_acc_2 ; 17/04/2021 (*) 3327 <1> ; 17/04/2021 (temporary) 3328 00006011 745F <1> jz short short dmem_acc_6 ; ! temporary ! (*) 3329 <1> ; 20/10/2023 3330 <1> ; If the page table entry is zero or invalid -not present- 3331 <1> ; it will be directy allocated for the physical memory section 3332 <1> ; without using the M.A.T. (Specially for LFB access -generally- 3333 <1> ; is at the beyod of the physical main memory end.) 3334 <1> ; (M.A.T bits are not used for direct memory access. To cancel 3335 <1> ; direct memory access also is out of the M.A.T scope because 3336 <1> ; direct accessed physical pages are marked as SHARED on their 3337 <1> ; PTE. Shared pages are not dealloaced.) 3338 <1> 3339 <1> ; 17/04/2021 3340 <1> ; (following code is disabled as temporary) 3341 <1> ; 3342 <1> ; or eax, eax 3343 <1> ; jz short dmem_acc_6 ; Change PTE 3344 <1> ; shr eax, 1 ; swap disk block (8 sectors) address 3345 <1> ; ; unlink swap disk block 3346 <1> ; call unlink_swap_block 3347 <1> ; jmp short dmem_acc_6 3348 <1> 3349 <1> dmem_acc_2: 3350 00006013 A802 <1> test al, PTE_A_WRITE ; bit 1, writable (r/w) flag 3351 <1> ; (must be 1) 3352 00006015 7550 <1> jnz short dmem_acc_4 3353 <1> ; Read only -duplicated- page (belongs to a parent or a child) 3354 00006017 66A90002 <1> test ax, PTE_DUPLICATED ; Was this page duplicated 3355 <1> ; as child's page ? 3356 0000601B 7455 <1> jz short dmem_acc_5 ; Change PTE but don't deallocate the page! 3357 <1> 3358 <1> ;push edi 3359 <1> ;push esi 3360 <1> 3361 0000601D 51 <1> push ecx 3362 <1> ;push ebx 3363 0000601E 8B1D[C88E0100] <1> mov ebx, [u.ppgdir] ; parent's page dir address (physical) 3364 <1> 3365 <1> ; check the parent's PTE value is read only & same page or not.. 3366 00006024 89EF <1> mov edi, ebp 3367 00006026 C1EF16 <1> shr edi, PAGE_D_SHIFT ; 22 3368 <1> ; EDI = page directory entry index (0-1023) 3369 00006029 89EE <1> mov esi, ebp 3370 0000602B C1EE0C <1> shr esi, PAGE_SHIFT ; 12 3371 0000602E 81E6FF030000 <1> and esi, PTE_MASK 3372 <1> ; ESI = page table entry index (0-1023) 3373 <1> 3374 00006034 66C1E702 <1> shl di, 2 ; * 4 3375 00006038 01FB <1> add ebx, edi ; PDE offset (for the parent) 3376 0000603A 8B0F <1> mov ecx, [edi] 3377 0000603C F6C101 <1> test cl, PDE_A_PRESENT ; present (valid) or not ? 3378 0000603F 7425 <1> jz short dmem_acc_3 ; parent process does not use this page 3379 00006041 6681E100F0 <1> and cx, PDE_A_CLEAR ; 0F000h ; Clear attribute bits 3380 00006046 66C1E602 <1> shl si, 2 ; *4 3381 0000604A 01CE <1> add esi, ecx ; PTE offset (for the parent) 3382 0000604C 8B1E <1> mov ebx, [esi] 3383 0000604E F6C301 <1> test bl, PTE_A_PRESENT ; present or not ? 3384 00006051 7413 <1> jz short dmem_acc_3 ; parent process does not use this page 3385 00006053 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3386 00006057 6681E300F0 <1> and bx, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3387 0000605C 39D8 <1> cmp eax, ebx ; parent's and child's pages are same ? 3388 0000605E 7506 <1> jne short dmem_acc_3 ; not same page 3389 <1> ; deallocate the child's page 3390 00006060 800E02 <1> or byte [esi], PTE_A_WRITE ; convert to writable page (parent) 3391 <1> ;pop ebx 3392 00006063 59 <1> pop ecx 3393 00006064 EB0C <1> jmp short dmem_acc_5 3394 <1> dmem_acc_3: 3395 <1> ;pop ebx 3396 00006066 59 <1> pop ecx 3397 <1> dmem_acc_4: 3398 00006067 66A90004 <1> test ax, PTE_SHARED ; shared or direct memory access indicator 3399 0000606B 7505 <1> jnz short dmem_acc_5 ; AVL bit 1 = 1, do not deallocate this page! 3400 <1> ; 3401 <1> ;and ax, PTE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 3402 0000606D E877F9FFFF <1> call deallocate_page 3403 <1> dmem_acc_5: 3404 <1> ;pop esi 3405 <1> ;pop edi 3406 <1> dmem_acc_6: 3407 00006072 89E8 <1> mov eax, ebp ; physical page (offset=0) address 3408 <1> ; EAX = memory page address 3409 <1> ; EDX = PTE entry address (physical) 3410 00006074 660D0704 <1> or ax, PTE_A_PRESENT+PTE_A_USER+PTE_A_WRITE+PTE_SHARED 3411 <1> ; present flag, bit 0 = 1 3412 <1> ; user flag, bit 2 = 1 3413 <1> ; writable flag, bit 1 = 1 3414 <1> ; direct memory access flag, bit 10 = 1 3415 <1> ; (This page must not be deallocated!) 3416 00006078 8902 <1> mov [edx], eax ; Update PTE value 3417 0000607A 49 <1> dec ecx ; remain count of contiguous pages 3418 0000607B 741E <1> jz short dmem_acc_8 3419 0000607D 81C500100000 <1> add ebp, PAGE_SIZE ; next physical page address 3420 <1> ; 22/07/2017 3421 <1> ;mov eax, ebp 3422 <1> ; 12/05/2017 3423 00006083 8B1D[288D0100] <1> mov ebx, [base_addr] ; linear address (virtual+CORE) 3424 00006089 81C300100000 <1> add ebx, PAGE_SIZE ; next linear address 3425 0000608F E948FFFFFF <1> jmp dmem_acc_0 3426 <1> dmem_acc_7: ; ERROR ! 3427 00006094 C7042404000000 <1> mov dword [esp], ERR_MINOR_IM 3428 <1> ; Insufficient memory (minor) error! 3429 <1> ; Major error = 0 (No protection fault) 3430 <1> ; cf = 1 3431 <1> dmem_acc_8: 3432 0000609B 58 <1> pop eax 3433 <1> ;pop edx 3434 <1> ;pop ecx 3435 <1> ;pop ebx 3436 <1> ;pop ebp 3437 0000609C C3 <1> retn 3438 <1> 3439 <1> deallocate_user_pages: 3440 <1> ; 20/05/2017 3441 <1> ; 15/05/2017 3442 <1> ; 20/02/2017 3443 <1> ; 19/02/2017 (TRDOS 386 = TRDOS v2.0) 3444 <1> ; 3445 <1> ; Deallocate virtually contiguous user pages (memory block) 3446 <1> ; (caller: 'sysdalloc' system call) 3447 <1> ; 3448 <1> ; INPUT -> 3449 <1> ; EBX = VIRTUAL ADDRESS (beginning address) 3450 <1> ; ECX = byte count 3451 <1> ; [u.pgdir] = user's page directory 3452 <1> ; [u.ppdir] = parent's page directory 3453 <1> ; 3454 <1> ; OUTPUT -> 3455 <1> ; If CF = 0 3456 <1> ; EAX = Deallocated memory bytes 3457 <1> ; (Even if shared or read only pages will not be 3458 <1> ; deallocated on M.A.T., this byte count will be 3459 <1> ; returned as virtually deallocated bytes; in fact 3460 <1> ; virtually deallocated user pages * 4096.) 3461 <1> ; EBX = Virtual address (as rounded up) 3462 <1> ; If CF = 1 3463 <1> ; EAX = 0 (there is not any deallocated pages) 3464 <1> ; 3465 <1> ; Note: Empty page tables will not be deallocated!!! 3466 <1> ; (they will be deallocated at process termination stage) 3467 <1> ; 3468 <1> ; Modified Registers -> EAX, EDX, ESI, EDI, EBX, ECX, EBP 3469 <1> ; 3470 0000609D 89DE <1> mov esi, ebx 3471 0000609F 89F7 <1> mov edi, esi 3472 000060A1 01CF <1> add edi, ecx 3473 000060A3 81C6FF0F0000 <1> add esi, PAGE_SIZE - 1 ; 4095 (round up) 3474 000060A9 C1EE0C <1> shr esi, PAGE_SHIFT 3475 000060AC C1EF0C <1> shr edi, PAGE_SHIFT 3476 000060AF 89F8 <1> mov eax, edi ; end page 3477 000060B1 29F0 <1> sub eax, esi ; end page - start page 3478 000060B3 0F86C8000000 <1> jna da_u_pd_err ; < 1 3479 000060B9 89F3 <1> mov ebx, esi 3480 000060BB C1E30C <1> shl ebx, PAGE_SHIFT ; virtual address (as rounded up) 3481 000060BE 53 <1> push ebx ; * 3482 000060BF 89C1 <1> mov ecx, eax ; page count 3483 000060C1 C1E00C <1> shl eax, PAGE_SHIFT ; byte count as adjusted 3484 000060C4 50 <1> push eax ; ** 3485 000060C5 8B1D[C48E0100] <1> mov ebx, [u.pgdir] ; physical addr of user's page dir 3486 000060CB 81C600040000 <1> add esi, CORE/PAGE_SIZE 3487 000060D1 89F7 <1> mov edi, esi 3488 000060D3 81E7FF030000 <1> and edi, PTE_MASK ; PTE entry in the page table 3489 000060D9 57 <1> push edi ; *** ; PTE index (of page directory) 3490 000060DA C1EE0A <1> shr esi, PAGE_D_SHIFT - PAGE_SHIFT ; 22-12=10 3491 000060DD 89F2 <1> mov edx, esi 3492 <1> ; EDX = PDE index 3493 000060DF C1E602 <1> shl esi, 2 ; convert PDE index to dword offset 3494 000060E2 01DE <1> add esi, ebx ; add page directory address 3495 <1> da_u_pd_1: 3496 000060E4 AD <1> lodsd 3497 <1> ; 3498 000060E5 89F5 <1> mov ebp, esi ; 20/02/2017 3499 <1> ; EBP = next PDE address 3500 <1> ; 3501 000060E7 A801 <1> test al, PDE_A_PRESENT ; bit 0, present flag (must be 1) 3502 000060E9 0F8487000000 <1> jz da_u_pd_3 ; 20/05/2017 3503 000060EF 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 3504 <1> ; EAX = PHYSICAL (flat) ADDRESS OF THE PAGE TABLE 3505 000060F3 8B3C24 <1> mov edi, [esp] ; *** 3506 <1> ; EDI = PTE index (of complete page directory) 3507 <1> ;and edi, PTE_MASK ; PTE entry in the page table 3508 000060F6 C1E702 <1> shl edi, 2 ; convert PTE index to dword offset 3509 000060F9 89FE <1> mov esi, edi ; PTE offset in page table (0-4092) 3510 000060FB 01C6 <1> add esi, eax ; now, esi points to requested PTE 3511 <1> da_u_pt_0: 3512 000060FD AD <1> lodsd 3513 000060FE A801 <1> test al, PTE_A_PRESENT ; bit 0, present flag (must be 1) 3514 00006100 7452 <1> jz short da_u_pt_1 3515 <1> ; 3516 00006102 A802 <1> test al, PTE_A_WRITE ; bit 1, writable (r/w) flag 3517 <1> ; (must be 1) 3518 00006104 753C <1> jnz short da_u_pt_3 3519 <1> ; Read only -duplicated- page (belongs to a parent or a child) 3520 00006106 66A90002 <1> test ax, PTE_DUPLICATED ; Was this page duplicated 3521 <1> ; as child's page ? 3522 0000610A 7441 <1> jz short da_u_pt_4 ; Clear PTE but don't deallocate the page! 3523 <1> ; 3524 <1> ; check the parent's PTE value is read only & same page or not.. 3525 <1> ; EDX = page directory entry index (0-1023) 3526 0000610C 52 <1> push edx ; **** 3527 <1> ; EDI = page table entry offset (0-4092) 3528 0000610D 8B1D[C88E0100] <1> mov ebx, [u.ppgdir] ; page directory of the parent process 3529 00006113 66C1E202 <1> shl dx, 2 ; *4 3530 00006117 01D3 <1> add ebx, edx ; PDE address (for the parent) 3531 00006119 8B13 <1> mov edx, [ebx] ; page table address 3532 0000611B F6C201 <1> test dl, PDE_A_PRESENT ; present (valid) or not ? 3533 0000611E 7421 <1> jz short da_u_pt_2 ; parent process does not use this page 3534 00006120 6681E200F0 <1> and dx, PDE_A_CLEAR ; 0F000h ; Clear attribute bits 3535 <1> ; EDI = page table entry offset (0-4092) 3536 00006125 01D7 <1> add edi, edx ; PTE address (for the parent) 3537 00006127 8B1F <1> mov ebx, [edi] 3538 00006129 F6C301 <1> test bl, PTE_A_PRESENT ; present or not ? 3539 0000612C 7413 <1> jz short da_u_pt_2 ; parent process does not use this page 3540 0000612E 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3541 00006132 6681E300F0 <1> and bx, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3542 00006137 39D8 <1> cmp eax, ebx ; parent's and child's pages are same ? 3543 00006139 7506 <1> jne short da_u_pt_2 ; not same page 3544 <1> ; deallocate the child's page 3545 0000613B 800F02 <1> or byte [edi], PTE_A_WRITE ; convert to writable page (parent) 3546 0000613E 5A <1> pop edx ; **** 3547 0000613F EB0C <1> jmp short da_u_pt_4 3548 <1> 3549 <1> ; 17/04/2021 3550 <1> ; ('da_u_pt_1' is disabled as temporary) 3551 <1> 3552 <1> ;da_u_pt_1: 3553 <1> ; or eax, eax ; swapped page ? 3554 <1> ; jz short da_u_pt_5 ; no 3555 <1> ; ; yes 3556 <1> ; shr eax, 1 3557 <1> ; call unlink_swap_block ; Deallocate swapped page block 3558 <1> ; ; on the swap disk (or in file) 3559 <1> ; jmp short da_u_pt_5 3560 <1> da_u_pt_2: 3561 00006141 5A <1> pop edx ; **** 3562 <1> da_u_pt_3: 3563 00006142 66A90004 <1> test ax, PTE_SHARED ; shared or direct memory access indicator 3564 00006146 7505 <1> jnz short da_u_pt_4 ; AVL bit 1 = 1, do not deallocate this page! 3565 <1> ; 3566 <1> ;and ax, PTE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 3567 00006148 E89CF8FFFF <1> call deallocate_page ; set the mem allocation bit of this page 3568 <1> da_u_pt_4: 3569 0000614D C746FC00000000 <1> mov dword [esi-4], 0 ; clear/reset PTE (child, dupl. as parent) 3570 <1> ; 17/04/2021 (temporary) 3571 <1> da_u_pt_1: 3572 <1> da_u_pt_5: 3573 <1> ; 20/05/2017 3574 00006154 58 <1> pop eax ; *** PTE index (of page directory) 3575 00006155 49 <1> dec ecx ; remain page count 3576 00006156 7426 <1> jz short da_u_pd_4 3577 00006158 40 <1> inc eax ; next PTE 3578 00006159 6625FF03 <1> and ax, PTE_MASK ; PTE entry index in the page table 3579 0000615D 50 <1> push eax ; *** (save again) 3580 <1> ;mov edi, eax 3581 <1> ;and di, PTE_MASK 3582 <1> ;cmp edi, PAGE_SIZE / 4 ; 1024 3583 <1> ;jnb short da_u_pd_2 3584 0000615E 89C7 <1> mov edi, eax 3585 00006160 C1E702 <1> shl edi, 2 ; convert index to dword offset 3586 <1> ;test ax, PTE_MASK ; 3FFh 3587 00006163 09C0 <1> or eax, eax 3588 00006165 7596 <1> jnz short da_u_pt_0 ; 1-1023 3589 <1> da_u_pd_2: 3590 00006167 42 <1> inc edx 3591 <1> ; 20/05/2017 3592 00006168 6681E2FF03 <1> and dx, PTE_MASK ; 3FFh 3593 0000616D 740F <1> jz short da_u_pd_4 ; 0 (1024) 3594 <1> ;cmp edx, 1024 3595 <1> ;jnb short da_u_pd_4 3596 0000616F 89EE <1> mov esi, ebp ; 20/02/2017 3597 00006171 E96EFFFFFF <1> jmp da_u_pd_1 3598 <1> da_u_pd_3: 3599 <1> ; 15/05/2017 (empty page directory entry) 3600 00006176 81E900040000 <1> sub ecx, 1024 3601 0000617C 77E9 <1> ja short da_u_pd_2 ; 20/05/2017 3602 <1> da_u_pd_4: 3603 0000617E 58 <1> pop eax ; ** 3604 0000617F 5B <1> pop ebx ; * 3605 00006180 C3 <1> retn 3606 <1> 3607 <1> da_u_pd_err: 3608 00006181 31C0 <1> xor eax, eax 3609 00006183 F9 <1> stc 3610 00006184 C3 <1> retn 3611 <1> 3612 <1> allocate_user_pages: 3613 <1> ; 20/05/2017 3614 <1> ; 01/05/2017, 02/05/2017, 15/05/2017 3615 <1> ; 04/03/2017 3616 <1> ; 20/02/2017 (TRDOS 386 = TRDOS v2.0) 3617 <1> ; 3618 <1> ; Allocate physically contiguous user pages (memory block) 3619 <1> ; (caller: 'sysalloc' system call) 3620 <1> ; 3621 <1> ; Note: This procedure does not alloc a page's itself 3622 <1> ; (page bits) on Memory Allocation Table. 3623 <1> ; (allocate_memory_block is needed before this proc) 3624 <1> ; 3625 <1> ; INPUT -> 3626 <1> ; EAX = PHYSICAL ADDRESS (beginning address) 3627 <1> ; EBX = VIRTUAL ADDRESS (beginning address) 3628 <1> ; ECX = byte count (>=4096) 3629 <1> ; [u.pgdir] = user's page directory 3630 <1> ; 3631 <1> ; Note: All addresses are (must be) already adjusted 3632 <1> ; to page borders, otherwise, lower 12bits of addresses 3633 <1> ; and byte count would be truncated. 3634 <1> ; 3635 <1> ; OUTPUT -> 3636 <1> ; none 3637 <1> ; 3638 <1> ; CF = 1 -> insufficient memory error 3639 <1> ; 3640 <1> ; Note: All pages will be allocated in physical page order 3641 <1> ; from the beginning page address. 3642 <1> ; * A new page table will be added to the page dir 3643 <1> ; when the requested PDE is invalid. 3644 <1> ; * Those pages will not be added to swap queue 3645 <1> ; because main purpose of this allocation is to 3646 <1> ; set a direct memory access (DMA controller) buffer. 3647 <1> ; (Swapping out a page in a DMA buffer would be wrong!) 3648 <1> ; * Previous content of page tables (PTEs) would be 3649 <1> ; (should be) deallocated before entering this 3650 <1> ; procedure. So, new page table entries (PTEs) 3651 <1> ; directly will be written without checking 3652 <1> ; their previous content. 3653 <1> ; * Only solution to increase free memory by removing 3654 <1> ; that non-swappable memory block is to terminate 3655 <1> ; the process or to wait until the process will 3656 <1> ; deallocate that memory block as itself. ('sysdalloc') 3657 <1> ; (No problem, if the process does not grab all of 3658 <1> ; -very big amount of- free memory by using 3659 <1> ; 'sysalloc' system call!?) 3660 <1> ; (Even if the process has grabbed all of free memory, 3661 <1> ; no problem if the process is not running in 3662 <1> ; multitasking mode. No problem in multitasking 3663 <1> ; mode if there is not another process which is running 3664 <1> ; or waiting or sleeping for an event as it's pages 3665 <1> ; are swapped-out. But a new process can not start to 3666 <1> ; run if all of free memory has beeen allocated 3667 <1> ; by running processes. Deallocation -'sysdalloc'- 3668 <1> ; or terminate a running process is needed 3669 <1> ; in order to run a new process.) 3670 <1> ; 3671 <1> ; Modified Registers -> EAX, EDX, ESI, EDI, EBX, ECX, EBP 3672 <1> ; 3673 <1> 3674 <1> ; 01/05/2017 3675 00006185 662500F0 <1> and ax, ~PAGE_OFF 3676 00006189 6681E300F0 <1> and bx, ~PAGE_OFF 3677 <1> ; 02/05/2017 3678 0000618E BD00F0FFFF <1> mov ebp, 0FFFFF000h ; 4 Giga Bytes - 4096 Bytes (for Stack) 3679 00006193 C1E90C <1> shr ecx, PAGE_SHIFT ; page count 3680 00006196 83F901 <1> cmp ecx, 1 3681 00006199 7251 <1> jb short a_u_im_retn 3682 0000619B 89C2 <1> mov edx, eax 3683 0000619D 01CA <1> add edx, ecx 3684 0000619F 724B <1> jc short a_u_im_retn 3685 000061A1 39D5 <1> cmp ebp, edx 3686 000061A3 7247 <1> jb short a_u_im_retn 3687 000061A5 89DA <1> mov edx, ebx 3688 000061A7 81C200004000 <1> add edx, CORE 3689 000061AD 723D <1> jc short a_u_im_retn 3690 000061AF 01CA <1> add edx, ecx 3691 000061B1 7239 <1> jc short a_u_im_retn 3692 000061B3 39D5 <1> cmp ebp, edx 3693 000061B5 7235 <1> jb short a_u_im_retn 3694 <1> ; 3695 000061B7 89C5 <1> mov ebp, eax ; physical address 3696 000061B9 89DE <1> mov esi, ebx 3697 000061BB 81C600004000 <1> add esi, CORE ; start of user's memory (4M) 3698 000061C1 C1EE0C <1> shr esi, PAGE_SHIFT ; higher 20 bits of the linear address 3699 <1> ;shr ecx, PAGE_SHIFT ; page count 3700 000061C4 8B1D[C48E0100] <1> mov ebx, [u.pgdir] ; physical addr of user's page dir 3701 000061CA 89F7 <1> mov edi, esi 3702 000061CC 81E7FF030000 <1> and edi, PTE_MASK ; PTE entry index in the page table 3703 000061D2 57 <1> push edi ; * ; PTE index (in page directory) 3704 000061D3 C1EE0A <1> shr esi, PAGE_D_SHIFT - PAGE_SHIFT ; 22-12=10 3705 000061D6 89F2 <1> mov edx, esi 3706 <1> ; EDX = PDE index 3707 000061D8 C1E602 <1> shl esi, 2 ; convert PDE index to dword offset 3708 000061DB 01DE <1> add esi, ebx ; add page directory address 3709 <1> a_u_pd_0: 3710 000061DD AD <1> lodsd 3711 <1> ; 3712 000061DE 89F3 <1> mov ebx, esi ; next PDE address 3713 <1> ; 3714 000061E0 A801 <1> test al, PDE_A_PRESENT ; bit 0, present flag (must be 1) 3715 000061E2 7513 <1> jnz short a_u_pd_2 3716 <1> ; 3717 <1> ; empty PDE (it does not point to valid page table address) 3718 000061E4 E841F6FFFF <1> call allocate_page ; (allocate a new page table) 3719 000061E9 7302 <1> jnc short a_u_pd_1 ; OK... now, we have a new page table. 3720 <1> ; cf = 1 3721 <1> ; There is not a free memory page to allocate a new page table !!! 3722 000061EB 5E <1> pop esi ; * 3723 <1> a_u_im_retn: 3724 000061EC C3 <1> retn ; return to 'sysalloc' with 'insufficient memory' error 3725 <1> ; 3726 <1> a_u_pd_1: ; clear the new page table content 3727 <1> ; EAX = Physical (base) address of the new page table 3728 000061ED E8A9F6FFFF <1> call clear_page ; Clear page content 3729 <1> ; 3730 000061F2 0C07 <1> or al, PDE_A_PRESENT + PDE_A_WRITE + PDE_A_USER 3731 <1> ; set bit 0, bit 1 and bit 2 to 1 3732 <1> ; (present, writable, user) 3733 000061F4 8946FC <1> mov [esi-4], eax 3734 <1> a_u_pd_2: 3735 000061F7 662500F0 <1> and ax, PDE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 3736 <1> ; EAX = PHYSICAL (flat) ADDRESS OF THE PAGE TABLE 3737 000061FB 8B3C24 <1> mov edi, [esp] ; * 3738 <1> ; EDI = PTE index (of page directory) 3739 <1> ;and edi, PTE_MASK ; PTE entry index in the page table 3740 <1> ; EBX = next PDE address 3741 000061FE 89FE <1> mov esi, edi ; PTE index in page table (0-1023) 3742 00006200 C1E702 <1> shl edi, 2 ; convert PTE index to dword offset 3743 00006203 01C7 <1> add edi, eax ; now, edi points to requested PTE 3744 <1> a_u_pt_0: 3745 <1> ; 02/05/2017 3746 00006205 8B07 <1> mov eax, [edi] 3747 <1> ; 3748 00006207 A801 <1> test al, PTE_A_PRESENT ; bit 0, present flag (must be 1) 3749 00006209 7445 <1> jz short a_u_pt_1 3750 <1> ; 3751 0000620B A802 <1> test al, PTE_A_WRITE ; bit 1, writable (r/w) flag 3752 <1> ; (must be 1) 3753 0000620D 7550 <1> jnz short a_u_pt_3 3754 <1> ; Read only -duplicated- page (belongs to a parent or a child) 3755 0000620F 66A90002 <1> test ax, PTE_DUPLICATED ; Was this page duplicated 3756 <1> ; as child's page ? 3757 00006213 7455 <1> jz short a_u_pt_4 ; Clear PTE but don't deallocate the page! 3758 <1> ; 3759 <1> ; check the parent's PTE value is read only & same page or not.. 3760 <1> ; EDX = page directory entry index (0-1023) 3761 00006215 52 <1> push edx ; ** 3762 00006216 53 <1> push ebx ; *** 3763 <1> ; ESI = page table entry index (0-1023) 3764 <1> ;push esi ; **** ; 20/05/2017 3765 00006217 8B1D[C88E0100] <1> mov ebx, [u.ppgdir] ; page directory of the parent process 3766 0000621D 66C1E202 <1> shl dx, 2 ; *4 3767 00006221 01D3 <1> add ebx, edx ; PTE address,0 (for the parent) 3768 00006223 8B13 <1> mov edx, [ebx] ; page table address 3769 00006225 F6C201 <1> test dl, PDE_A_PRESENT ; present (valid) or not ? 3770 00006228 7433 <1> jz short a_u_pt_2 ; parent process does not use this page 3771 0000622A 6681E200F0 <1> and dx, PDE_A_CLEAR ; 0F000h ; Clear attribute bits 3772 0000622F 66C1E602 <1> shl si, 2 ; *4 3773 <1> ; ESI = page table entry offset (0-4092) 3774 00006233 01D6 <1> add esi, edx ; PTE address (for the parent) 3775 00006235 8B1E <1> mov ebx, [esi] 3776 00006237 F6C301 <1> test bl, PTE_A_PRESENT ; present or not ? 3777 0000623A 7421 <1> jz short a_u_pt_2 ; parent process does not use this page 3778 0000623C 662500F0 <1> and ax, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3779 00006240 6681E300F0 <1> and bx, PTE_A_CLEAR ; 0F000h ; Clear attribute bits 3780 00006245 39D8 <1> cmp eax, ebx ; parent's and child's pages are same ? 3781 00006247 7514 <1> jne short a_u_pt_2 ; not same page 3782 <1> ; deallocate the child's page 3783 00006249 800E02 <1> or byte [esi], PTE_A_WRITE ; convert to writable page (parent) 3784 <1> ;pop esi ; **** ; 20/05/2017 3785 0000624C 5B <1> pop ebx ; *** 3786 0000624D 5A <1> pop edx ; ** 3787 0000624E EB1A <1> jmp short a_u_pt_4 3788 <1> a_u_pt_1: 3789 00006250 09C0 <1> or eax, eax ; swapped page ? 3790 00006252 7416 <1> jz short a_u_pt_4 ; no 3791 <1> ; yes 3792 00006254 D1E8 <1> shr eax, 1 3793 00006256 E8B5F9FFFF <1> call unlink_swap_block ; Deallocate swapped page block 3794 <1> ; on the swap disk (or in file) 3795 0000625B EB0D <1> jmp short a_u_pt_4 3796 <1> a_u_pt_2: 3797 <1> ;pop esi ; **** ; 20/05/2017 3798 0000625D 5B <1> pop ebx ; *** 3799 0000625E 5A <1> pop edx ; ** 3800 <1> a_u_pt_3: 3801 0000625F 66A90004 <1> test ax, PTE_SHARED ; shared or direct memory access indicator 3802 00006263 7505 <1> jnz short a_u_pt_4 ; AVL bit 1 = 1, do not deallocate this page! 3803 <1> ; 3804 <1> ;and ax, PTE_A_CLEAR ; 0F000h ; clear lower 12 (attribute) bits 3805 00006265 E87FF7FFFF <1> call deallocate_page ; set the mem allocation bit of this page 3806 <1> ; 3807 <1> a_u_pt_4: 3808 0000626A 89E8 <1> mov eax, ebp ; physical address 3809 0000626C 0C07 <1> or al, PTE_A_PRESENT + PTE_A_WRITE + PTE_A_USER ; 04/03/2017 3810 0000626E AB <1> stosd 3811 0000626F 5E <1> pop esi ; * ; 20/05/2017 3812 00006270 49 <1> dec ecx ; remain page count 3813 00006271 7417 <1> jz short a_u_pd_5 3814 00006273 81C500100000 <1> add ebp, PAGE_SIZE 3815 00006279 46 <1> inc esi ; next PTE (index) 3816 <1> ; 20/05/2017 3817 <1> ;cmp esi, PAGE_SIZE/4 ; 1024 3818 <1> ;jb short a_u_pt_0 3819 0000627A 6681E6FF03 <1> and si, PTE_MASK ; 3FFh (0 to 1023) 3820 0000627F 56 <1> push esi ; * 3821 00006280 7583 <1> jnz short a_u_pt_0 ; > 0 (<1024) 3822 <1> a_u_pd_3: 3823 00006282 42 <1> inc edx 3824 <1> ; cmp edx, 1024 3825 <1> ; jnb short a_u_pd_4 ; 02/05/2017 (error!, ecx > 0) 3826 00006283 89DE <1> mov esi, ebx ; the next PDE address 3827 00006285 E953FFFFFF <1> jmp a_u_pd_0 3828 <1> a_u_pd_4: 3829 <1> ; 02/05/2017 3830 <1> ; stc 3831 <1> a_u_pd_5: 3832 <1> ; 20/05/2017 3833 <1> ;pop edi ; * 3834 0000628A C3 <1> retn 3835 <1> 3836 <1> ; 28/11/2023 3837 <1> ;a_lfb_k__err: 3838 <1> ;retn 3839 <1> 3840 <1> allocate_lfb_pages_for_kernel: 3841 <1> ; 02/12/2023 3842 <1> ; 29/11/2023 3843 <1> ; 28/11/2023 3844 <1> ; 20/10/2023 - TRDOS 386 v2.0.7 3845 <1> ; (only the overlapped main memory pages will be allocated) 3846 <1> ; 28/11/2023 3847 <1> ; (but all LFB pages will be added to the kernel's page tables) 3848 <1> ; (NOTE: LFB size -which will be used- is the size of the max. 3849 <1> ; recognized screen resolution. For example: 1024*768*4 bytes) 3850 <1> ; 15/12/2020 3851 <1> ; 14/12/2020 - TRDOS 386 v2.0.3 3852 <1> ; Set kernel page tables for linear frame buffer 3853 <1> ; 3854 <1> ; Input: 3855 <1> ; ;[LFB_ADDR] = linear frame buffer base address 3856 <1> ; ;[LFB_SIZE] = linear frame buffer size in bytes 3857 <1> ; ; 29/11/2023 3858 <1> ; ;ebx = Linear frame buffer base address as page num 3859 <1> ; ; 20/10/2023 3860 <1> ; esi = linear frame buffer base address 3861 <1> ; ecx = memory size in pages = [memory_size] 3862 <1> ; ; 28/11/2023 3863 <1> ; edx = linear frame buffer size in pages 3864 <1> ; Output: 3865 <1> ; none 3866 <1> ; cf = 1 -> error 3867 <1> ; 3868 <1> ; Modified registers: eax, ebx, ecx, edx, esi, edi, ebp 3869 <1> 3870 <1> 3871 <1> ; 02/12/2023 ; (!**!) 3872 <1> ; ('memory size' -for M.A.T.- is always <= LFB stat/base address) 3873 <1> %if 0 3874 <1> 3875 <1> ; 29/11/2023 3876 <1> ; allocate LFB blocks which < memory size at first 3877 <1> 3878 <1> ;mov eax, edx 3879 <1> ;shl eax, 12 3880 <1> ;add eax, esi 3881 <1> ;jc short a_lfb_k__err ; > 4GB limit 3882 <1> ; 3883 <1> ;;mov eax, 1048576 ; page count of (full) 4GB memory 3884 <1> ;;sub eax, edx 3885 <1> ;;cmp eax, esi 3886 <1> ;jb short a_lfb_k__err ; > 4GB limit 3887 <1> 3888 <1> mov ebx, esi ; LFB base/start address 3889 <1> shr ebx, 12 ; convert byte address to page address 3890 <1> ; ebx = LFB start/base page number 3891 <1> 3892 <1> sub ecx, ebx 3893 <1> jna short a_lfb_k_2 ; skip M.A.T. bit allocation 3894 <1> cmp ecx, edx 3895 <1> jna short a_lfb_k_0 3896 <1> mov ecx, edx 3897 <1> a_lfb_k_0: 3898 <1> sub edx, ecx 3899 <1> jna short a_lfb_k_1 3900 <1> 3901 <1> ; edx = remain count of LFB pages which are out of the M.A.T. 3902 <1> ; ebx = LFB start/base page number 3903 <1> ; ecx = page allocation count in the M.A.T. 3904 <1> 3905 <1> ;mov eax, 4096 3906 <1> ;mul ecx 3907 <1> mov eax, ecx 3908 <1> shl eax, 12 ; * 4096 3909 <1> 3910 <1> add esi, eax 3911 <1> ; esi = LFB address just after the main memory if there is 3912 <1> a_lfb_k_1: 3913 <1> mov eax, ebx ; LFB start/base page number 3914 <1> call allocate_lfb_memory_block 3915 <1> 3916 <1> ; here if there is, remain (the 2nd) part of the LFB 3917 <1> ; will be allocated by using new kernel page table(s) 3918 <1> ; (but M.A.T. bits will not be cleared because 3919 <1> ; the 2nd LFB part is out of the M.A.T.) 3920 <1> 3921 <1> and edx, edx 3922 <1> jz short a_lfb_k_6 ; all LFB pages have been allocated 3923 <1> 3924 <1> %endif 3925 <1> 3926 <1> a_lfb_k_2: 3927 <1> ; 29/11/2023 3928 0000628B C1EE0C <1> shr esi, 12 ; convert LFB address to page number 3929 <1> ; edx = count of pages to be added (in kernel page tables) 3930 <1> ; 28/11/2023 3931 0000628E 89D5 <1> mov ebp, edx 3932 00006290 81C2FF030000 <1> add edx, 1023 ; round up 3933 00006296 C1EA0A <1> shr edx, 10 ; / 1024 3934 <1> ; edx = count of kernel page tables to be added 3935 <1> ; (edx = 1 or edx = 2) 3936 <1> ; ((1024*768*4 = 3145728 bytes, 768 PTEs, 1 page table)) 3937 <1> ; ((1920*1080*4 = 8294400 bytes, 2025 PTEs, 2 page tables)) 3938 00006299 E88CF5FFFF <1> call allocate_page 3939 <1> ;jc short a_lfb_k__err 3940 <1> ; (mem alloc error is not expected at this startup stage) 3941 <1> ; eax = physical address of the new page table 3942 0000629E 89F7 <1> mov edi, esi ; LFB start/base page number 3943 000062A0 C1EF0A <1> shr edi, 10 3944 <1> ; edi = PDE entry number of the Linear Frame Buffer addr 3945 <1> ; (edi = 832 for 0D0000000h, edi = 896 for 0E0000000h) 3946 000062A3 C1E702 <1> shl edi, 2 3947 <1> ; edi = PDE offset 3948 000062A6 033D[B0760100] <1> add edi, [k_page_dir] ; Kernel's Page Dir Address 3949 000062AC 50 <1> push eax ; + 3950 000062AD 660D0304 <1> or ax, PDE_A_PRESENT + PDE_A_WRITE + PDE_EXTERNAL 3951 <1> ; supervisor + read&write + present 3952 <1> ; + external memory block (LFB) 3953 000062B1 AB <1> stosd 3954 <1> 3955 000062B2 4A <1> dec edx 3956 000062B3 740C <1> jz short a_lfb_k_3 ; only 1 new page table 3957 <1> 3958 <1> ; the 2nd page table 3959 000062B5 E870F5FFFF <1> call allocate_page 3960 <1> ;jc short a_lfb_k__err 3961 <1> ; (mem alloc error is not expected at this startup stage) 3962 <1> ; eax = physical address of the new page table 3963 000062BA 89C3 <1> mov ebx, eax 3964 000062BC 660D0304 <1> or ax, PDE_A_PRESENT + PDE_A_WRITE + PDE_EXTERNAL 3965 <1> ; supervisor + read&write + present 3966 <1> ; + external memory block (LFB) 3967 000062C0 AB <1> stosd 3968 <1> 3969 <1> a_lfb_k_3: 3970 <1> ; set new PTEs 3971 <1> ; 3972 <1> ; ebp = count of pages (PTEs) to be allocated 3973 000062C1 5F <1> pop edi ; + ; 1st page table address 3974 <1> ; 29/11/2023 3975 000062C2 B900040000 <1> mov ecx, 1024 ; number of PTEs in a page table 3976 000062C7 89F0 <1> mov eax, esi ; LFB base/start page number 3977 <1> ; (may be the 2nd part of the LFB) 3978 000062C9 C1E00C <1> shl eax, 12 3979 000062CC 660D0304 <1> or ax, PTE_A_PRESENT + PTE_A_WRITE + PTE_EXTERNAL 3980 <1> ; supervisor + read&write + present 3981 <1> ; + external memory block (LFB) 3982 <1> a_lfb_k_4: 3983 000062D0 AB <1> stosd ; save as PTE 3984 000062D1 4D <1> dec ebp 3985 000062D2 740D <1> jz short a_lfb_k_5 3986 000062D4 0500100000 <1> add eax, 4096 ; the next page address 3987 000062D9 E2F5 <1> loop a_lfb_k_4 3988 <1> 3989 <1> ;and ebx, ebx 3990 <1> ;jz short a_lfb_k_6 3991 000062DB 89DF <1> mov edi, ebx ; the 2nd page table address 3992 <1> ;xor ebx, ebx 3993 <1> ;mov ecx, 1024 3994 000062DD B504 <1> mov ch, 4 ; cx = 4*256 = 1024 3995 000062DF EBEF <1> jmp short a_lfb_k_4 ; only 1 more loop (no the 3rd pt) 3996 <1> ; (ebp <= 1024 here) 3997 <1> a_lfb_k_5: 3998 000062E1 49 <1> dec ecx 3999 000062E2 7404 <1> jz short a_lfb_k_6 4000 000062E4 31C0 <1> xor eax, eax ; clear page table entry (empty) 4001 000062E6 F3AB <1> rep stosd 4002 <1> a_lfb_k_6: 4003 <1> ; 29/11/2023 4004 000062E8 C3 <1> retn 4005 <1> 4006 <1> ; 28/11/2023 4007 <1> %if 0 4008 <1> 4009 <1> allocate_lfb_pages_for_kernel: 4010 <1> ; 20/10/2023 - TRDOS 386 v2.0.7 4011 <1> ; (only the overlapped main memory pages will be allocated) 4012 <1> ; ((if LFB base/start address is greater than -or equal to- 4013 <1> ; main memory size, this procedure is not called/used)) 4014 <1> ; 15/12/2020 4015 <1> ; 14/12/2020 - TRDOS 386 v2.0.3 4016 <1> ; Set kernel page tables for linear frame buffer 4017 <1> ; 4018 <1> ; Input: 4019 <1> ; ;[LFB_ADDR] = linear frame buffer base address 4020 <1> ; ;[LFB_SIZE] = linear frame buffer size in bytes 4021 <1> ; ; 20/10/2023 4022 <1> ; eax = Linear frame buffer base address as page num 4023 <1> ; (eax < memory size) 4024 <1> ; esi = linear frame buffer base address 4025 <1> ; ecx = memory size in pages = [memory_size] 4026 <1> ; Output: 4027 <1> ; none 4028 <1> ; cf = 1 -> error 4029 <1> ; 4030 <1> ; Modified registers: eax, ecx, edx, edi 4031 <1> 4032 <1> ; 20/10/2023 4033 <1> ;mov edi, [LFB_ADDR] 4034 <1> ;mov edx, [LFB_SIZE] 4035 <1> 4036 <1> ;;; 4037 <1> ; 20/10/2023 4038 <1> mov edi, eax ; LFB base/start page number 4039 <1> ;mov ecx, [memory_size] 4040 <1> sub ecx, eax 4041 <1> 4042 <1> ; ecx = number of pages to be set as (already) allocated 4043 <1> ;;; 4044 <1> 4045 <1> ; 20/10/2023 4046 <1> shr edi, 10 ; convert page number to PDE entry number 4047 <1> ; (1024 pages per page table -the shift 4048 <1> ; result is a page table index number 4049 <1> ; or page directory entry number <= 1023) 4050 <1> ;shr edi, 22 ; convert address to page number 4051 <1> ; and then convert it to PDE entry offset 4052 <1> ; (1 PDE is for 4MB, 22 bit shift) 4053 <1> 4054 <1> shl di, 2 ; * 4 to obtain the PDE offset 4055 <1> 4056 <1> ; 20/10/2023 4057 <1> ;;add edx, 4095 4058 <1> ;shr edx, 12 ; convert LFB size to LFB page count 4059 <1> 4060 <1> ;mov ecx, edx ; * ; LFB page count 4061 <1> ; 20/10/2023 4062 <1> mov edx, ecx ; * 4063 <1> ; 20/10/2023 4064 <1> ; edx = page count (to be set as allocated) 4065 <1> ; from the LFB start page 4066 <1> ; (it may be <= linear frame buffer size) 4067 <1> 4068 <1> add ecx, 1023 ; page count + 1023 4069 <1> shr ecx, 10 ; convert to page directory entry count 4070 <1> ; (page table count) 4071 <1> push ecx ; ** 4072 <1> shl ecx, 12 ; convert to byte count 4073 <1> 4074 <1> ; 20/10/2023 4075 <1> ; (absolute allocation is needed instead of the first fit) 4076 <1> ;xor eax, eax ; first available pages 4077 <1> 4078 <1> ; 20/10/2023 4079 <1> ;mov esi, [LFB_ADDR] 4080 <1> mov eax, esi ; linear frame buffer's base/start address 4081 <1> 4082 <1> ; allocate contiguous memory block for these kernel pages 4083 <1> 4084 <1> ;call allocate_memory_block 4085 <1> ; 20/10/2023 4086 <1> ; (short way to set LFB page bits on the 'M.A.T.) 4087 <1> call allocate_lfb_memory_block ; in 'allocate_memory_block' 4088 <1> 4089 <1> ; eax = start address of (contiguous) memory block 4090 <1> pop ecx ; ** ; PDE count 4091 <1> jnc short a_lfb_k_1 4092 <1> ; error (cf=1) 4093 <1> retn 4094 <1> a_lfb_k_1: 4095 <1> ; Allocate (new) page tables in kernel's page directory 4096 <1> push ecx ; PDE (page table) count 4097 <1> push eax ; start address of contiguous memory pages 4098 <1> ; (at page boundary) 4099 <1> ; edi = 1st page directory entry offset 4100 <1> add edi, [k_page_dir] ; Kernel's Page Dir Address 4101 <1> a_lfb_k_2: 4102 <1> or ax, PDE_A_PRESENT + PDE_A_WRITE + PDE_EXTERNAL 4103 <1> ; supervisor + read&write + present 4104 <1> ; + external memory block (LFB) 4105 <1> stosd 4106 <1> add eax, 4096 4107 <1> loop a_lfb_k_2 4108 <1> 4109 <1> pop edi ; start addr of contiguous memory pages 4110 <1> pop ecx ; page table (PDE) count 4111 <1> 4112 <1> ; Allocate pages in (new) kernel page tables 4113 <1> 4114 <1> ; (Note: page tables are contiguous in pyhsical memory) 4115 <1> shl ecx, 10 ; * 1024, convert to (total) PTE count 4116 <1> 4117 <1> mov eax, [LFB_ADDR] 4118 <1> ; edx = LFB page count 4119 <1> ;and ax, ~4095 ; lw of LFB address is 0 4120 <1> a_lfb_k_3: 4121 <1> or ax, PTE_A_PRESENT + PTE_A_WRITE + PTE_EXTERNAL 4122 <1> ; supervisor + read&write + present 4123 <1> ; + external memory block (LFB) 4124 <1> stosd 4125 <1> dec edx 4126 <1> jz short a_lfb_k_4 ; LFB size has been completed (!?) 4127 <1> add eax, 4096 4128 <1> loop a_lfb_k_3 4129 <1> 4130 <1> retn 4131 <1> 4132 <1> a_lfb_k_4: 4133 <1> ; clear PTEs for empty/free pages 4134 <1> ; (if there are after LFB !?) 4135 <1> xor eax, eax ; clear page table entry (empty) 4136 <1> rep stosd 4137 <1> retn 4138 <1> 4139 <1> %endif 4140 <1> 4141 <1> ;deallocate_lfb_pages_for_kernel: 4142 <1> ; 15/12/2020 4143 <1> ; 14/12/2020 - TRDOS 386 v2.0.3 4144 <1> ; Reset/Release kernel page tables 4145 <1> ; which are used for linear frame buffer 4146 <1> ; (this procedure will be called by kernel only) 4147 <1> ; 4148 <1> ; Input: 4149 <1> ; [LFB_ADDR] = linear frame buffer base address 4150 <1> ; [FFB_SIZE] = linear frame buffer size in bytes 4151 <1> ; Output: 4152 <1> ; none 4153 <1> ; 4154 <1> ; Modified registers: eax, ecx, edi 4155 <1> 4156 <1> ;mov edi, [LFB_ADDR] 4157 <1> ;mov ecx, [LFB_SIZE] 4158 <1> ; 4159 <1> ;shr edi, 22 ; convert address to page number 4160 <1> ; ; and then convert it to PDE entry offset 4161 <1> ; ; (1 PDE is for 4MB, 22 bit shift) 4162 <1> ; 4163 <1> ;shl di, 2 ; * 4 for offset 4164 <1> ; 4165 <1> ;;add ecx, 4095 4166 <1> ;shr ecx, 12 ; convert LFB size to page count 4167 <1> ; 4168 <1> ;add ecx, 1023 ; page count + 1023 4169 <1> ;shr ecx, 10 ; convert to page directory entry count 4170 <1> ; ; (page table count) 4171 <1> ;push ecx ; * 4172 <1> ;shl ecx, 12 ; convert to byte count 4173 <1> ; 4174 <1> ;xor eax, eax ; first available pages 4175 <1> ; 4176 <1> ;; deallocate contiguous memory block for kernel pages 4177 <1> ; 4178 <1> ;call deallocate_memory_block 4179 <1> ; 4180 <1> ;pop ecx ; * ; PDE count 4181 <1> ; 4182 <1> ;; Release/Free PDEs (page tables) in kernel's page dir 4183 <1> ;; edi = 1st page directory entry offset 4184 <1> ;add edi, [k_page_dir] ; Kernel's Page Dir Address 4185 <1> ;sub eax, eax ; clear (also invalidate) 4186 <1> ;rep stosd 4187 <1> ; 4188 <1> ;retn 4189 <1> 4190 <1> ; /// End Of MEMORY MANAGEMENT FUNCTIONS /// 4191 <1> 4192 <1> ;; Data: 4193 <1> 4194 <1> ; 09/03/2015 4195 <1> ;swpq_count: dw 0 ; count of pages on the swap que 4196 <1> ;swp_drv: dd 0 ; logical drive description table address of the swap drive/disk 4197 <1> ;swpd_size: dd 0 ; size of swap drive/disk (volume) in sectors (512 bytes). 4198 <1> ;swpd_free: dd 0 ; free page blocks (4096 bytes) on swap disk/drive (logical) 4199 <1> ;swpd_next: dd 0 ; next free page block 4200 <1> ;swpd_last: dd 0 ; last swap page block 3230 %include 'timer.s' ; 17/01/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - timer.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 08/08/2022 (Previous: 18/04/2021) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 17/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; 15 <1> ; Derived from 'IBM PC-AT' BIOS source code (1985) 16 <1> ; **************************************************************************** 17 <1> 18 <1> ; TRDOS 386 (TRDOS v2.0) Kernel - TIMER & REAL TIME CLOCK (BIOS) FUNCTIONS 19 <1> 20 <1> ; IBM PC-AT BIOS Source Code ('BIOS2.ASM') 21 <1> ; TITLE BIOS2 ---- 06/10/85 BIOS INTERRUPT ROUTINES 22 <1> 23 <1> ;------------------------------------------------------------------------------- 24 <1> ; 25 <1> ; ///////// TIMER (& REAL TIME CLOCK) FUNCTIONS /////////////// 26 <1> 27 <1> int1Ah: 28 <1> ; 29/01/2016 29 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 30 000062E9 9C <1> pushfd 31 000062EA 0E <1> push cs 32 000062EB E801000000 <1> call TIME_OF_DAY_1 33 000062F0 C3 <1> retn 34 <1> 35 <1> ;------------------------------------------------------------------------------- 36 <1> 37 <1> ;--- INT 1A H -- (TIME OF DAY) -------------------------------------------------- 38 <1> ; THIS BIOS ROUTINE ALLOWS THE CLOCKS TO BE SET OR READ : 39 <1> ; : 40 <1> ; PARAMETERS: : 41 <1> ; (AH) = 00H READ THE CURRENT SETTING AND RETURN WITH, : 42 <1> ; (CX) = HIGH PORTION OF COUNT : 43 <1> ; (DX) = LOW PORTION OF COUNT : 44 <1> ; (AL) = 0 TIMER HAS NOT PASSED 24 HOURS SINCE LAST READ : 45 <1> ; 1 IF ON ANOTHER DAY. (RESET TO ZERO AFTER READ) : 46 <1> ; : 47 <1> ; (AH) = 01H SET THE CURRENT CLOCK USING, : 48 <1> ; (CX) = HIGH PORTION OF COUNT : 49 <1> ; (DX) = LOW PORTION OF COUNT. : 50 <1> ; : 51 <1> ; NOTE: COUNTS OCCUR AT THE RATE OF 1193180/65536 COUNTS/SECOND : 52 <1> ; (OR ABOUT 18.2 PER SECOND -- SEE EQUATES) : 53 <1> ; : 54 <1> ; (AH) = 02H READ THE REAL TIME CLOCK AND RETURN WITH, : 55 <1> ; (CH) = HOURS IN BCD (00-23) : 56 <1> ; (CL) = MINUTES IN BCD (00-59) : 57 <1> ; (DH) = SECONDS IN BCD (00-59) : 58 <1> ; (DL) = DAYLIGHT SAVINGS ENABLE (00-01) : 59 <1> ; : 60 <1> ; (AH) = 03H SET THE REAL TIME CLOCK USING, : 61 <1> ; (CH) = HOURS IN BCD (00-23) : 62 <1> ; (CL) = MINUTES IN BCD (00-59) : 63 <1> ; (DH) = SECONDS IN BCD (00-59) : 64 <1> ; (DL) = 01 IF DAYLIGHT SAVINGS ENABLE OPTION, ELSE 00. : 65 <1> ; : 66 <1> ; NOTE: (DL) = 00 IF DAYLIGHT SAVINGS TIME ENABLE IS NOT ENABLED. : 67 <1> ; (DL) = 01 ENABLES TWO SPECIAL UPDATES THE LAST SUNDAY IN : 68 <1> ; APRIL (1:59:59 --> 3:00:00 AM) AND THE LAST SUNDAY IN : 69 <1> ; OCTOBER (1:59:59 --> 1:00:00 AM) THE FIRST TIME. : 70 <1> ; : 71 <1> ; (AH) = 04H READ THE DATE FROM THE REAL TIME CLOCK AND RETURN WITH, : 72 <1> ; (CH) = CENTURY IN BCD (19 OR 20) : 73 <1> ; (CL) = YEAR IN BCD (00-99) : 74 <1> ; (DH) = MONTH IN BCD (01-12) : 75 <1> ; (DL) = DAY IN BCD (01-31). : 76 <1> ; : 77 <1> ; (AH) = 05H SET THE DATE INTO THE REAL TIME CLOCK USING, : 78 <1> ; (CH) = CENTURY IN BCD (19 OR 20) : 79 <1> ; (CL) = YEAR IN BCD (00-99) : 80 <1> ; (DH) = MONTH IN BCD (01-12) : 81 <1> ; (DL) = DAY IN BCD (01-31). : 82 <1> ; : 83 <1> ; (AH) = 06H SET THE ALARM TO INTERRUPT AT SPECIFIED TIME, : 84 <1> ; (CH) = HOURS IN BCD (00-23 (OR FFH)) : 85 <1> ; (CL) = MINUTES IN BCD (00-59 (OR FFH)) : 86 <1> ; (DH) = SECONDS IN BCD (00-59 (OR FFH)) : 87 <1> ; : 88 <1> ; (AH) = 07H RESET THE ALARM INTERRUPT FUNCTION. : 89 <1> ; : 90 <1> ; NOTES: FOR ALL RETURNS CY= 0 FOR SUCCESSFUL OPERATION. : 91 <1> ; FOR (AH)= 2, 4, 6 - CARRY FLAG SET IF REAL TIME CLOCK NOT OPERATING. : 92 <1> ; FOR (AH)= 6 - CARRY FLAG SET IF ALARM ALREADY ENABLED. : 93 <1> ; FOR THE ALARM FUNCTION (AH = 6) THE USER MUST SUPPLY A ROUTINE AND : 94 <1> ; INTERCEPT THE CORRECT ADDRESS IN THE VECTOR TABLE FOR INTERRUPT 4AH. : 95 <1> ; USE 0FFH FOR ANY "DO NOT CARE" POSITION FOR INTERVAL INTERRUPTS. : 96 <1> ; INTERRUPTS ARE DISABLED DURING DATA MODIFICATION. : 97 <1> ; AH & AL ARE RETURNED MODIFIED AND NOT DEFINED EXCEPT WHERE INDICATED. : 98 <1> ;-------------------------------------------------------------------------------- 99 <1> 100 <1> ; 29/07/2022 101 <1> ; 15/01/2017 102 <1> ; 14/01/2017 103 <1> ; 07/01/2017 104 <1> ; 02/01/2017 105 <1> ; 29/05/2016 106 <1> ; 29/01/2016 107 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 108 <1> 109 <1> ; 29/05/2016 110 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 111 <1> int35h: ; Date/Time functions 112 <1> 113 <1> TIME_OF_DAY_1: 114 <1> ; 07/08/5022 115 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 116 <1> ;sti ; INTERRUPTS BACK ON 117 <1> ; 29/05/2016 118 000062F1 80642408FE <1> and byte [esp+8], 11111110b ; clear carry bit of eflags register 119 <1> ; 120 000062F6 80FC08 <1> cmp ah, (RTC_TBE-RTC_TB)/4 ; CHECK IF COMMAND IN VALID RANGE (0-7) 121 000062F9 F5 <1> cmc ; COMPLEMENT CARRY FOR ERROR EXIT 122 <1> ; (*) jc short TIME_9 ; EXIT WITH CARRY = 1 IF NOT VALID 123 000062FA 721A <1> jc short _TIME_9 ; 29/05/2016 124 <1> 125 000062FC 1E <1> push ds 126 000062FD 56 <1> push esi 127 000062FE 66BE1000 <1> mov si, KDATA ; kernel data segment 128 00006302 8EDE <1> mov ds, si 129 <1> 130 <1> ;;15/01/2017 131 <1> ; 14/01/2017 132 <1> ; 02/01/2017 133 <1> ;;mov byte [intflg], 35h ; date & time interrupt 134 <1> ;sti 135 <1> ; 136 00006304 C0E402 <1> shl ah, 2 ; convert function to dword offset 137 00006307 0FB6F4 <1> movzx esi, ah ; PLACE INTO ADDRESSING REGISTER 138 <1> ;cli ; NO INTERRUPTS DURING TIME FUNCTIONS 139 0000630A FF96[1C630000] <1> call [esi+RTC_TB] ; VECTOR TO FUNCTION REQUESTED WITH CY=0 140 <1> ; RETURN WITH CARRY FLAG SET FOR RESULT 141 <1> ;sti ; INTERRUPTS BACK ON 142 00006310 B400 <1> mov ah, 0 ; CLEAR (AH) TO ZERO 143 00006312 5E <1> pop esi ; RECOVER USERS REGISTER 144 00006313 1F <1> pop ds ; RECOVER USERS SEGMENT SELECTOR 145 <1> 146 <1> ;;15/01/2017 147 <1> ; 02/01/2017 148 <1> ;;mov byte [ss:intflg], 0 ; 07/01/2017 149 <1> 150 <1> ;TIME_9: 151 <1> ; RETURN WITH CY= 0 IF NO ERROR 152 <1> ; (*) 29/05/2016 153 <1> ; (*) retf 4 ; skip eflags on stack 154 00006314 7305 <1> jnc short _TIME_10 155 <1> _TIME_9: 156 <1> ; 29/05/2016 -set carry flag on stack- 157 <1> ; [esp] = EIP 158 <1> ; [esp+4] = CS 159 <1> ; [esp+8] = E-FLAGS 160 00006316 804C240801 <1> or byte [esp+8], 1 ; set carry bit of eflags register 161 <1> ; [esp+12] = ESP (user) 162 <1> ; [esp+16] = SS (User) 163 <1> _TIME_10: 164 0000631B CF <1> iretd 165 <1> 166 <1> ; (*) 29/05/2016 - 'ref 4' intruction causes to stack fault 167 <1> ; (OUTER-PRIVILEGE-LEVEL) 168 <1> ; INTEL 80386 PROGRAMMER'S REFERENCE MANUAL 1986 169 <1> ; // RETF instruction: 170 <1> ; 171 <1> ; IF OperandMode=32 THEN 172 <1> ; Load CS:EIP from stack; 173 <1> ; Set CS RPL to CPL; 174 <1> ; Increment eSP by 8 plus the immediate offset if it exists; 175 <1> ; Load SS:eSP from stack; 176 <1> ; ELSE (* OperandMode=16 *) 177 <1> ; Load CS:IP from stack; 178 <1> ; Set CS RPL to CPL; 179 <1> ; Increment eSP by 4 plus the immediate offset if it exists; 180 <1> ; Load SS:eSP from stack; 181 <1> ; FI; 182 <1> ; 183 <1> ; // 184 <1> ; ROUTINE VECTOR TABLE (AH)= 185 <1> RTC_TB: 186 0000631C [3C630000] <1> dd RTC_00 ; 0 = READ CURRENT CLOCK COUNT 187 00006320 [4F630000] <1> dd RTC_10 ; 1 = SET CLOCK COUNT 188 00006324 [5D630000] <1> dd RTC_20 ; 2 = READ THE REAL TIME CLOCK TIME 189 00006328 [8B630000] <1> dd RTC_30 ; 3 = SET REAL TIME CLOCK TIME 190 0000632C [C8630000] <1> dd RTC_40 ; 4 = READ THE REAL TIME CLOCK DATE 191 00006330 [EE630000] <1> dd RTC_50 ; 5 = SET REAL TIME CLOCK DATE 192 00006334 [4D640000] <1> dd RTC_60 ; 6 = SET THE REAL TIME CLOCK ALARM 193 00006338 [9F640000] <1> dd RTC_70 ; 7 = RESET ALARM 194 <1> 195 <1> RTC_TBE equ $ 196 <1> 197 <1> RTC_00: ; READ TIME COUNT 198 0000633C A0[34770100] <1> mov al, [TIMER_OFL] ; GET THE OVERFLOW FLAG 199 00006341 C605[34770100]00 <1> mov byte [TIMER_OFL], 0 ; AND THEN RESET THE OVERFLOW FLAG 200 00006348 8B0D[30770100] <1> mov ecx, [TIMER_LH] ; GET COUNT OF TIME 201 0000634E C3 <1> retn 202 <1> 203 <1> RTC_10: ; SET TIME COUNT 204 0000634F 890D[30770100] <1> mov [TIMER_LH], ecx ; SET TIME COUNT 205 00006355 C605[34770100]00 <1> mov byte [TIMER_OFL], 0 ; RESET OVERFLOW FLAG 206 0000635C C3 <1> retn ; RETURN WITH NO CARRY 207 <1> 208 <1> RTC_20: ; GET RTC TIME 209 0000635D E8C7010000 <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 210 00006362 7226 <1> jc short RTC_29 ; EXIT IF ERROR (CY= 1) 211 <1> 212 00006364 B000 <1> mov al, CMOS_SECONDS ; SET ADDRESS OF SECONDS 213 00006366 E8F4010000 <1> call CMOS_READ ; GET SECONDS 214 0000636B 88C6 <1> mov dh, al ; SAVE 215 0000636D B00B <1> mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 216 0000636F E8EB010000 <1> call CMOS_READ ; READ CURRENT VALUE OF DSE BIT 217 00006374 2401 <1> and al, 00000001b ; MASK FOR VALID DSE BIT 218 00006376 88C2 <1> mov dl, al ; SET [DL] TO ZERO FOR NO DSE BIT 219 00006378 B002 <1> mov al, CMOS_MINUTES ; SET ADDRESS OF MINUTES 220 0000637A E8E0010000 <1> call CMOS_READ ; GET MINUTES 221 0000637F 88C1 <1> mov cl, al ; SAVE 222 00006381 B004 <1> mov al, CMOS_HOURS ; SET ADDRESS OF HOURS 223 <1> RTC_41: ; 29/07/2022 224 00006383 E8D7010000 <1> call CMOS_READ ; GET HOURS 225 00006388 88C5 <1> mov ch, al ; SAVE 226 <1> ; 29/07/2022 227 <1> ;clc ; SET CY= 0 228 <1> RTC_29: 229 0000638A C3 <1> retn ; RETURN WITH RESULT IN CARRY FLAG 230 <1> 231 <1> RTC_30: ; SET RTC TIME 232 0000638B E899010000 <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 233 00006390 7305 <1> jnc short RTC_35 ; GO AROUND IF CLOCK OPERATING 234 00006392 E8AD010000 <1> call RTC_STA ; ELSE TRY INITIALIZING CLOCK 235 <1> RTC_35: 236 00006397 88F4 <1> mov ah, dh ; GET TIME BYTE - SECONDS 237 00006399 B000 <1> mov al, CMOS_SECONDS ; ADDRESS SECONDS 238 0000639B E894000000 <1> call CMOS_WRITE ; UPDATE SECONDS 239 000063A0 88CC <1> mov ah, cl ; GET TIME BYTE - MINUTES 240 000063A2 B002 <1> mov al, CMOS_MINUTES ; ADDRESS MINUTES 241 000063A4 E88B000000 <1> call CMOS_WRITE ; UPDATE MINUTES 242 000063A9 88EC <1> mov ah, ch ; GET TIME BYTE - HOURS 243 000063AB B004 <1> mov al, CMOS_HOURS ; ADDRESS HOURS 244 000063AD E882000000 <1> call CMOS_WRITE ; UPDATE ADDRESS 245 <1> ;mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 246 <1> ;mov ah, al 247 000063B2 66B80B0B <1> mov ax, CMOS_REG_B * 257 248 000063B6 E8A4010000 <1> call CMOS_READ ; READ CURRENT TIME 249 000063BB 2462 <1> and al, 01100010b ; MASK FOR VALID BIT POSITIONS 250 000063BD 0C02 <1> or al, 00000010b ; TURN ON 24 HOUR MODE 251 000063BF 80E201 <1> and dl, 00000001b ; USE ONLY THE DSE BIT 252 000063C2 08D0 <1> or al, dl ; GET DAY LIGHT SAVINGS TIME BIT (OSE) 253 000063C4 86E0 <1> xchg ah, al ; PLACE IN WORK REGISTER AND GET ADDRESS 254 <1> ;call CMOS_WRITE ; SET NEW ALARM SITS 255 <1> ;clc ; SET CY= 0 256 <1> ;retn ; RETURN WITH CY= 0 257 <1> ; 29/07/2022 258 000063C6 EB6C <1> jmp short CMOS_WRITE 259 <1> 260 <1> RTC_40: ; GET RTC DATE 261 000063C8 E85C010000 <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 262 <1> ;jc short RTC_49 ; EXIT IF ERROR (CY= 1) 263 <1> ; 07/08/2022 264 000063CD 72BB <1> jc short RTC_29 265 <1> 266 000063CF B007 <1> mov al, CMOS_DAY_MONTH ; ADDRESS DAY OF MONTH 267 000063D1 E889010000 <1> call CMOS_READ ; READ DAY OF MONTH 268 000063D6 88C2 <1> mov dl, al ; SAVE 269 000063D8 B008 <1> mov al, CMOS_MONTH ; ADDRESS MONTH 270 000063DA E880010000 <1> call CMOS_READ ; READ MONTH 271 000063DF 88C6 <1> mov dh, al ; SAVE 272 000063E1 B009 <1> mov al, CMOS_YEAR ; ADDRESS YEAR 273 000063E3 E877010000 <1> call CMOS_READ ; READ YEAR 274 000063E8 88C1 <1> mov cl, al ; SAVE 275 000063EA B032 <1> mov al, CMOS_CENTURY ; ADDRESS CENTURY LOCATION 276 <1> ; 29/07/2022 277 <1> ; call CMOS_READ ; GET CENTURY BYTE 278 <1> ; mov ch, al ; SAVE 279 <1> ; ; 29/07/2022 280 <1> ; ;clc ; SET CY=0 281 <1> ;RTC_49: 282 <1> ; retn ; RETURN WITH RESULTS IN CARRY FLAG 283 <1> 284 <1> ; 29/07/2022 285 000063EC EB95 <1> jmp short RTC_41 286 <1> 287 <1> 288 <1> RTC_50: ; SET RTC DATE 289 000063EE E836010000 <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 290 000063F3 7305 <1> jnc short RTC_55 ; GO AROUND IF NO ERROR 291 000063F5 E84A010000 <1> call RTC_STA ; ELSE INITIALIZE CLOCK 292 <1> RTC_55: 293 000063FA 66B80600 <1> mov ax, CMOS_DAY_WEEK ; ADDRESS OF DAY OF WEEK BYTE 294 000063FE E831000000 <1> call CMOS_WRITE ; LOAD ZEROS TO DAY OF WEEK 295 00006403 88D4 <1> mov ah, dl ; GET DAY OF MONTH BYTE 296 00006405 B007 <1> mov al, CMOS_DAY_MONTH ; ADDRESS DAY OF MONTH BYTE 297 00006407 E828000000 <1> call CMOS_WRITE ; WRITE OF DAY OF MONTH REGISTER 298 0000640C 88F4 <1> mov ah, dh ; GET MONTH 299 0000640E B008 <1> mov al, CMOS_MONTH ; ADDRESS MONTH BYTE 300 00006410 E81F000000 <1> call CMOS_WRITE ; WRITE MONTH REGISTER 301 00006415 88CC <1> mov ah, cl ; GET YEAR BYTE 302 00006417 B009 <1> mov al, CMOS_YEAR ; ADDRESS YEAR REGISTER 303 00006419 E816000000 <1> call CMOS_WRITE ; WRITE YEAR REGISTER 304 0000641E 88EC <1> mov ah, ch ; GET CENTURY BYTE 305 00006420 B032 <1> mov al, CMOS_CENTURY ; ADDRESS CENTURY BYTE 306 00006422 E80D000000 <1> call CMOS_WRITE ; WRITE CENTURY LOCATION 307 <1> ;mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 308 <1> ;mov ah, al 309 00006427 66B80B0B <1> mov ax, CMOS_REG_B * 257 310 0000642B E82F010000 <1> call CMOS_READ ; READ CURRENT SETTINGS 311 00006430 247F <1> and al, 07Fh ; CLEAR 'SET BIT' 312 00006432 86E0 <1> xchg ah, al ; MOVE TO WORK REGISTER 313 <1> ;call CMOS_WRITE ; AND START CLOCK UPDATING 314 <1> ;clc ; SET CY= 0 315 <1> ;retn ; RETURN CY=0 316 <1> ; 29/07/2022 317 <1> ;jmp short CMOS_WRITE 318 <1> 319 <1> ;------------------------------------------------------------------------------- 320 <1> 321 <1> ; 08/08/2022 322 <1> ; 29/07/2022 (TRDOS 386 v2.0.5) 323 <1> ; 18/04/2021 (TRDOS 386 v2.0.4) 324 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 325 <1> 326 <1> ;--- CMOS_WRITE ---------------------------------------------------------------- 327 <1> ; WRITE BYTE TO CMOS SYSTEM CLOCK CONFIGURATION TABLE : 328 <1> ; : 329 <1> ; INPUT: (AL)= CMOS TABLE ADDRESS TO BE WRITTEN TO : 330 <1> ; BIT 7 = 0 FOR NMI ENABLED AND 1 FOR NMI DISABLED ON EXIT : 331 <1> ; BITS 6-0 = ADDRESS OF TABLE LOCATION TO WRITE : 332 <1> ; (AH)= NEW VALUE TO BE PLACED IN THE ADDRESSED TABLE LOCATION : 333 <1> ; : 334 <1> ; OUTPUT: VALUE IN (AH) PLACED IN LOCATION (AL) WITH NMI LEFT DISABLED : 335 <1> ; IF BIT 7 OF (AL) IS ON, DURING THE CMOS UPDATE BOTH NMI AND : 336 <1> ; NORMAL INTERRUPTS ARE DISABLED TO PROTECT CMOS DATA INTEGRITY. : 337 <1> ; THE CMOS ADDRESS REGISTER IS POINTED TO A DEFAULT VALUE AND : 338 <1> ; THE INTERRUPT FLAG RESTORED TO THE ENTRY STATE ON RETURN. : 339 <1> ; ONLY THE CMOS LOCATION AND THE NMI STATE IS CHANGED. : 340 <1> ;------------------------------------------------------------------------------- 341 <1> 342 <1> ; 08/08/2022 343 <1> CMOS_WRITE: ; WRITE (AH) TO LOCATION (AL) 344 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 345 <1> ;pushf ; SAVE INTERRUPT ENABLE STATUS AND FLAGS 346 <1> ;;push ax ; SAVE WORK REGISTER VALUES 347 <1> ; 18/04/2021 348 <1> ;push eax 349 00006434 D0C0 <1> rol al, 1 ; MOVE NMI BIT TO LOW POSITION 350 00006436 F9 <1> stc ; FORCE NMI BIT ON IN CARRY FLAG 351 00006437 D0D8 <1> rcr al, 1 ; HIGH BIT ON TO DISABLE NMI - OLD IN CY 352 00006439 FA <1> cli ; DISABLE INTERRUPTS 353 0000643A E670 <1> out CMOS_PORT, al ; ADDRESS LOCATION AND DISABLE NMI 354 0000643C 88E0 <1> mov al, ah ; GET THE DATA BYTE TO WRITE 355 0000643E E671 <1> out CMOS_DATA, al ; PLACE IN REQUESTED CMOS LOCATION 356 00006440 B01E <1> mov al, CMOS_SHUT_DOWN*2 ; GET ADDRESS OF DEFAULT LOCATION 357 <1> ;mov al, CMOS_REG_D*2 ; GET ADDRESS OF DEFAULT LOCATION 358 00006442 D0D8 <1> rcr al, 1 ; PUT ORIGINAL NMI MASK BIT INTO ADDRESS 359 00006444 E670 <1> out CMOS_PORT, al ; SET DEFAULT TO READ ONLY REGISTER 360 <1> ;nop ; I/O DELAY 361 <1> ; 29/07/2022 362 00006446 E6EB <1> out 0EBh, al ; NEWIODELAY ; AWARD BIOS 1999, ATIME.ASM 363 00006448 E471 <1> in al, CMOS_DATA ; OPEN STANDBY LATCH 364 <1> ;;pop ax ; RESTORE WORK REGISTERS 365 <1> ; 18/04/2021 366 <1> ;pop eax 367 <1> ;popf 368 <1> ; 29/07/2022 369 <1> ;clc 370 <1> ; 08/08/2022 371 0000644A 30C0 <1> xor al, al 372 0000644C C3 <1> retn 373 <1> 374 <1> ;------------------------------------------------------------------------------- 375 <1> 376 <1> RTC_60: ; SET RTC ALARM 377 0000644D B00B <1> mov al, CMOS_REG_B ; ADDRESS ALARM 378 0000644F E80B010000 <1> call CMOS_READ ; READ ALARM REGISTER 379 00006454 A820 <1> test al, 20h ; CHECK FOR ALARM ALREADY ENABLED 380 00006456 F9 <1> stc ; SET CARRY IN CASE OF ERROR 381 00006457 7541 <1> jnz short RTC_69 ; ERROR EXIT IF ALARM SET 382 00006459 E8CB000000 <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 383 0000645E 7305 <1> jnc short RTC_65 ; SKIP INITIALIZATION IF NO ERROR 384 00006460 E8DF000000 <1> call RTC_STA ; ELSE INITIALIZE CLOCK 385 <1> RTC_65: 386 00006465 88F4 <1> mov ah, dh ; GET SECONDS BYTE 387 00006467 B001 <1> mov al, CMOS_SEC_ALARM ; ADDRESS THE SECONDS ALARM REGISTER 388 00006469 E8C6FFFFFF <1> call CMOS_WRITE ; INSERT SECONDS 389 0000646E 88CC <1> mov ah, cl ; GET MINUTES PARAMETER 390 00006470 B003 <1> mov al, CMOS_MIN_ALARM ; ADDRESS MINUTES ALARM REGISTER 391 00006472 E8BDFFFFFF <1> call CMOS_WRITE ; INSERT MINUTES 392 00006477 88EC <1> mov ah, ch ; GET HOURS PARAMETER 393 00006479 B005 <1> mov al, CMOS_HR_ALARM ; ADDRESS HOUR ALARM REGISTER 394 0000647B E8B4FFFFFF <1> call CMOS_WRITE ; INSERT HOURS 395 00006480 E4A1 <1> in al, INTB01 ; READ SECOND INTERRUPT MASK REGISTER 396 00006482 24FE <1> and al, 0FEh ; ENABLE ALARM TIMER BIT (CY= 0) 397 00006484 E6A1 <1> out INTB01, al ; WRITE UPDATED MASK 398 <1> ;mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 399 <1> ;mov ah, al 400 00006486 66B80B0B <1> mov ax, CMOS_REG_B * 257 401 0000648A E8D0000000 <1> call CMOS_READ ; READ CURRENT ALARM REGISTER 402 0000648F 247F <1> and al, 07Fh ; ENSURE SET BIT TURNED OFF 403 00006491 0C20 <1> or al, 20h ; TURN ON ALARM ENABLE 404 00006493 86E0 <1> xchg ah, al ; MOVE MASK TO OUTPUT REGISTER 405 00006495 E89AFFFFFF <1> call CMOS_WRITE ; WRITE NEW ALARM MASK 406 <1> ; 29/07/2022 407 <1> ;clc ; SET CY= 0 408 <1> RTC_69: 409 0000649A 66B80000 <1> mov ax, 0 ; CLEAR AX REGISTER 410 0000649E C3 <1> retn ; RETURN WITH RESULTS IN CARRY FLAC 411 <1> 412 <1> RTC_70: ; RESET ALARM 413 <1> ;mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 414 <1> ;mov ah, al 415 0000649F 66B80B0B <1> mov ax, CMOS_REG_B * 257 ; ADDRESS ALARM REGISTER (TO BOTH AH,AL) 416 000064A3 E8B7000000 <1> call CMOS_READ ; READ ALARM REGISTER 417 000064A8 2457 <1> and al, 57h ; TURN OFF ALARM ENABLE 418 000064AA 86E0 <1> xchg ah, al ; SAVE DATA AND RECOVER ADDRESS 419 <1> ;call CMOS_WRITE ; RESTORE NEW VALUE 420 <1> ;clc ; SET CY= 0 421 <1> ;retn ; RETURN WITH NO CARRY 422 <1> ; 29/07/2022 423 000064AC EB86 <1> jmp short CMOS_WRITE 424 <1> 425 <1> ;------------------------------------------------------------------------------- 426 <1> 427 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 428 <1> 429 <1> ;--- HARDWARE INT 70 H -- ( IRQ LEVEL 8) ---------------------------------------- 430 <1> ; ALARM INTERRUPT HANDLER (RTC) : 431 <1> ; THIS ROUTINE HANDLES THE PERIODIC AND ALARM INTERRUPTS FROM THE CMOS : 432 <1> ; TIMER. INPUT FREQUENCY IS 1.024 KHZ OR APPROXIMATELY 1024 INTERRUPTS : 433 <1> ; EVERY SECOND FOR THE PERIODIC INTERRUPT. FOR THE ALARM FUNCTION, : 434 <1> ; THE INTERRUPT WILL OCCUR AT THE DESIGNATED TIME. : 435 <1> ; : 436 <1> ; INTERRUPTS ARE ENABLED WHEN THE EVENT OR ALARM FUNCTION IS ACTIVATED. : 437 <1> ; FOR THE EVENT INTERRUPT, THE HANDLER WILL DECREMENT THE WAIT COUNTER : 438 <1> ; AND WHEN IT EXPIRES WILL SET THE DESIGNATED LOCATION TO 80H. FOR : 439 <1> ; THE ALARM INTERRUPT. THE USER MUST PROVIDE A ROUTINE TO INTERCEPT : 440 <1> ; THE CORRECT ADDRESS FROM THE VECTOR TABLE INVOKED BY INTERRUPT 4AH : 441 <1> ; PRIOR TO SETTING THE REAL TIME CLOCK ALARM (INT 1AH, AH= 06H). : 442 <1> ;-------------------------------------------------------------------------------- 443 <1> 444 <1> RTC_A_INT: ; 07/01/2017 445 <1> ;RTC_INT: ; ALARM INTERRUPT 446 000064AE 1E <1> push ds ; LEAVE INTERRUPTS DISABLED 447 000064AF 50 <1> push eax ; SAVE REGISTERS 448 000064B0 57 <1> push edi 449 <1> RTC_I_1: ; CHECK FOR SECOND INTERRUPT 450 000064B1 66B88C8B <1> mov ax, 256*(CMOS_REG_B+NMI)+CMOS_REG_C+NMI ; ALARM AND STATUS 451 000064B5 E670 <1> out CMOS_PORT, al ; WRITE ALARM FLAG MASK ADDRESS 452 000064B7 90 <1> nop ; I/O DELAY 453 000064B8 EB00 <1> jmp short $+2 454 000064BA E471 <1> in al, CMOS_DATA ; READ AND RESET INTERRUPT REQUEST FLAGS 455 000064BC A860 <1> test al, 01100000b ; CHECK FOR EITHER INTERRUPT PENDING 456 000064BE 745B <1> jz short RTC_I_9 ; EXIT IF NOT A VALID RTC INTERRUPT 457 <1> 458 000064C0 86E0 <1> xchg ah, al ; SAVE FLAGS AND GET ENABLE ADDRESS 459 000064C2 E670 <1> out CMOS_PORT, al ; WRITE ALARM ENABLE MASK ADDRESS 460 000064C4 90 <1> nop ; I/O DELAY 461 000064C5 EB00 <1> jmp short $+2 462 000064C7 E471 <1> in al, CMOS_DATA ; READ CURRENT ALARM ENABLE MASK 463 000064C9 20E0 <1> and al, ah ; ALLOW ONLY SOURCES THAT ARE ENABLED 464 000064CB A840 <1> test al, 01000000b ; CHECK FOR PERIODIC INTERRUPT 465 000064CD 7439 <1> jz short RTC_I_5 ; SKIP IF NOT A PERIODIC INTERRUPT 466 <1> 467 <1> ;----- DECREMENT WAIT COUNT BY INTERRUPT INTERVAL 468 <1> 469 000064CF 66BF1000 <1> mov di, KDATA ; kernel data segment 470 000064D3 8EDF <1> mov ds, di 471 <1> 472 000064D5 812D[28770100]D003- <1> sub dword [RTC_LH], 976 ; DECREMENT COUNT BY 1/1024 472 000064DD 0000 <1> 473 000064DF 7327 <1> jnc short RTC_I_5 ; SKIP TILL 32 BIT WORD LESS THAN ZERO 474 <1> 475 <1> ;----- TURN OFF PERIODIC INTERRUPT ENABLE 476 <1> 477 <1> ;push ax ; SAVE INTERRUPT FLAG MASK 478 <1> ; 18/04/2021 479 000064E1 50 <1> push eax 480 000064E2 66B88B8B <1> mov ax, 257*(CMOS_REG_B+NMI) ; INTERRUPT ENABLE REGISTER 481 000064E6 E670 <1> out CMOS_PORT, al ; WRITE ADDRESS TO CMOS CLOCK 482 000064E8 90 <1> nop ; I/O DELAY 483 000064E9 EB00 <1> jmp short $+2 484 000064EB E471 <1> in al, CMOS_DATA ; READ CURRENT ENABLES 485 000064ED 24BF <1> and al, 0BFh ; TURN OFF PIE 486 000064EF 86C4 <1> xchg al, ah ; GET CMOS ADDRESS AND SAVE VALUE 487 000064F1 E670 <1> out CMOS_PORT, al ; ADDRESS REGISTER B 488 000064F3 86C4 <1> xchg al, ah ; GET NEW INTERRUPT ENABLE MASK 489 000064F5 E671 <1> out CMOS_DATA, al ; SET MASK IN INTERRUPT ENABLE REGISTER 490 000064F7 C605[2C770100]00 <1> mov byte [RTC_WAIT_FLAG], 0 ; SET FUNCTION ACTIVE FLAG OFF 491 000064FE 8B3D[2D770100] <1> mov edi, [USER_FLAG] ; SET UP (DS:DI) TO POINT TO USER FLAG 492 00006504 C60780 <1> mov byte [edi], 80h ; TURN ON USERS FLAG 493 <1> ;pop ax ; GET INTERRUPT SOURCE BACK 494 <1> ; 18/04/2021 495 00006507 58 <1> pop eax 496 <1> RTC_I_5: 497 00006508 A820 <1> test al, 00100000b ; TEST FOR ALARM INTERRUPT 498 0000650A 740D <1> jz short RTC_I_7 ; SKIP USER INTERRUPT CALL IF NOT ALARM 499 <1> 500 0000650C B00D <1> mov al, CMOS_REG_D ; POINT TO DEFAULT READ ONLY REGISTER 501 0000650E E670 <1> out CMOS_PORT, al ; ENABLE NMI AND CMOS ADDRESS TO DEFAULT 502 00006510 FB <1> sti ; INTERRUPTS BACK ON NOW 503 00006511 52 <1> push edx 504 00006512 E8E7B60000 <1> call INT4Ah ; TRANSFER TO USER ROUTINE 505 00006517 5A <1> pop edx 506 00006518 FA <1> cli ; BLOCK INTERRUPT FOR RETRY 507 <1> RTC_I_7: ; RESTART ROUTINE TO HANDLE DELAYED 508 00006519 EB96 <1> jmp short RTC_I_1 ; ENTRY AND SECOND EVENT BEFORE DONE 509 <1> 510 <1> RTC_I_9: ; EXIT - NO PENDING INTERRUPTS 511 0000651B B00D <1> mov al, CMOS_REG_D ; POINT TO DEFAULT READ ONLY REGISTER 512 0000651D E670 <1> out CMOS_PORT, al ; ENABLE NMI AND CMOS ADDRESS TO DEFAULT 513 0000651F B020 <1> mov al, EOI ; END OF INTERRUPT MASK TO 8259 - 2 514 00006521 E6A0 <1> out INTB00, al ; TO 8259 - 2 515 00006523 E620 <1> out INTA00, al ; TO 8259 - 1 516 00006525 5F <1> pop edi ; RESTORE REGISTERS 517 00006526 58 <1> pop eax 518 00006527 1F <1> pop ds 519 00006528 CF <1> iretd ; END OF INTERRUPT 520 <1> 521 <1> ;------------------------------------------------------------------------------- 522 <1> 523 <1> ; 29/05/2016 - TRDOS 386 (TRDOS v2.0) 524 <1> ; 22/08/2014 (Retro UNIX 386 v1) 525 <1> ; IBM PC/AT BIOS source code ----- 10/06/85 (bios2.asm) 526 <1> UPD_IPR: ; WAIT TILL UPDATE NOT IN PROGRESS 527 00006529 51 <1> push ecx 528 <1> 529 <1> ; 29/05/2016 530 0000652A B968110000 <1> mov ecx, ((1984+244)*4)/2 ; AWARD BIOS 1999, ATIME.ASM 531 <1> ; 'WAITCPU_CK_UD_STAT' 532 <1> ; (244Us + 1984Us) 533 <1> ; (assume each read takes 534 <1> ; 2 microseconds). 535 <1> ;mov ecx, 65535 536 <1> ;mov cx, 800 ; SET TIMEOUT LOOP COUNT (= 800) 537 <1> UPD_10: 538 0000652F B00A <1> mov al, CMOS_REG_A ; ADDRESS STATUS REGISTER A 539 00006531 FA <1> cli ; NO TIMER INTERRUPTS DURING UPDATES 540 00006532 E828000000 <1> call CMOS_READ ; READ UPDATE IN PROCESS FLAG 541 00006537 A880 <1> test al, 80h ; IF UIP BIT IS ON ( CANNOT READ TIME ) 542 00006539 7406 <1> jz short UPD_90 ; EXIT WITH CY= 0 IF CAN READ CLOCK NOW 543 0000653B FB <1> sti ; ALLOW INTERRUPTS WHILE WAITING 544 0000653C E2F1 <1> loop UPD_10 ; LOOP TILL READY OR TIMEOUT 545 0000653E 31C0 <1> xor eax, eax ; xor ax, ax ; CLEAR RESULTS IF ERROR 546 00006540 F9 <1> stc ; SET CARRY FOR ERROR 547 <1> UPD_90: 548 00006541 59 <1> pop ecx ; RESTORE CALLERS REGISTER 549 00006542 FA <1> cli ; INTERRUPTS OFF DURING SET 550 00006543 C3 <1> retn ; RETURN WITH CY FLAG SET 551 <1> 552 <1> ; 18/04/2021 553 <1> RTC_STA: ; INITIALIZE REAL TIME CLOCK 554 <1> ;mov al, CMOS_REG_A ; ADDRESS REGISTER A AND LOAD DATA MASK 555 <1> ;mov ah, 26h 556 00006544 66B80A26 <1> mov ax, (26h*100h)+CMOS_REG_A 557 00006548 E8E7FEFFFF <1> call CMOS_WRITE ; INITIALIZE STATUS REGISTER A 558 <1> ;mov al, CMOS_REG_B ; SET "SET BIT" FOR CLOCK INITIALIZATION 559 <1> ;mov ah, 82h 560 0000654D 66B80B82 <1> mov ax, (82h*100h)+CMOS_REG_B 561 00006551 E8DEFEFFFF <1> call CMOS_WRITE ; AND 24 HOUR MODE TO REGISTER B 562 00006556 B00C <1> mov al, CMOS_REG_C ; ADDRESS REGISTER C 563 00006558 E802000000 <1> call CMOS_READ ; READ REGISTER C TO INITIALIZE 564 0000655D B00D <1> mov al, CMOS_REG_D ; ADDRESS REGISTER D 565 <1> ; 18/04/2021 566 <1> ;call CMOS_READ ; READ REGISTER D TO INITIALIZE 567 <1> ;retn 568 <1> ;jmp short CMOS_READ ; 18/04/2021 569 <1> 570 <1> ;------------------------------------------------------------------------------- 571 <1> 572 <1> ; 29/07/2022 - TRDOS 386 v2.0.5 573 <1> ; 18/04/2021 - TRDOS 386 v2.0.4 574 <1> ; 29/05/2016 - TRDOS 386 (TRDOS v2.0) 575 <1> ; 22/08/2014 (Retro UNIX 386 v1) 576 <1> ; IBM PC/AT BIOS source code ----- 10/06/85 (test4.asm) 577 <1> 578 <1> ;--- CMOS_READ ----------------------------------------------------------------- 579 <1> ; READ BYTE FROM CMOS_SYSTEM CLOCK CONFIGURATION TABLE : 580 <1> ; : 581 <1> ; INPUT: (AL)= CMOS_TABLE ADDRESS TO BE READ : 582 <1> ; BIT 7 = 0 FOR NMI ENABLED AND 1 FOR NMI DISABLED ON EXIT : 583 <1> ; BITS 6-0 = ADDRESS OF TABLE LOCATION TO READ : 584 <1> ; : 585 <1> ; OUTPUT: (AL) VALUE AT LOCATION (AL) MOVED INTO (AL). IF BIT 7 OF (AL) WAS : 586 <1> ; ON THEN NMI LEFT DISABLED, DURING THE CMOS READ BOTH NMI AND : 587 <1> ; NORMAL INTERRUPTS ARE DISABLED TO PROTECT CMOS DATA INTEGRITY. : 588 <1> ; THE CMOS ADDRESS REGISTER IS POINTED TO A DEFAULT VALUE AND : 589 <1> ; THE INTERRUPT FLAG RESTORED TO THE ENTRY STATE ON RETURN. : 590 <1> ; ONLY THE (AL) REGISTER AND THE NMI STATE IS CHANGED. : 591 <1> ;------------------------------------------------------------------------------- 592 <1> 593 <1> CMOS_READ: 594 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 595 <1> ;pushf ; SAVE INTERRUPT ENABLE STATUS AND FLAGS 596 0000655F D0C0 <1> rol al, 1 ; MOVE NMI BIT TO LOW POSITION 597 00006561 F9 <1> stc ; FORCE NMI BIT ON IN CARRY FLAG 598 00006562 D0D8 <1> rcr al, 1 ; HIGH BIT ON TO DISABLE NMI - OLD IN CY 599 00006564 FA <1> cli ; DISABLE INTERRUPTS 600 00006565 E670 <1> out CMOS_PORT, al ; ADDRESS LOCATION AND DISABLE NMI 601 <1> ; 29/05/2016 602 <1> ;nop ; I/O DELAY 603 00006567 E6EB <1> out 0EBh, al ; NEWIODELAY ; AWARD BIOS 1999, ATIME.ASM 604 <1> ; 605 00006569 E471 <1> in al, CMOS_DATA ; READ THE REQUESTED CMOS LOCATION 606 <1> ;push ax ; SAVE (AH) REGISTER VALUE AND CMOS BYTE 607 <1> ; 18/04/2021 608 0000656B 50 <1> push eax 609 <1> ; 15/03/2015 ; IBM PC/XT Model 286 BIOS source code 610 <1> ; ----- 10/06/85 (test4.asm) 611 0000656C B01E <1> mov al, CMOS_SHUT_DOWN*2 ; GET ADDRESS OF DEFAULT LOCATION 612 <1> ;mov al, CMOS_REG_D*2 ; GET ADDRESS OF DEFAULT LOCATION 613 0000656E D0D8 <1> rcr al, 1 ; PUT ORIGINAL NMI MASK BIT INTO ADDRESS 614 00006570 E670 <1> out CMOS_PORT, al ; SET DEFAULT TO READ ONLY REGISTER 615 <1> ;pop ax ; RESTORE (AH) AND (AL), CMOS BYTE 616 <1> ; 18/04/2021 617 00006572 58 <1> pop eax 618 <1> ; 29/07/2022 619 <1> ;popf 620 00006573 F8 <1> clc ; 29/07/2022 621 00006574 C3 <1> retn ; RETURN WITH FLAGS RESTORED 622 <1> 623 <1> ;------------------------------------------------------------------------------- 624 <1> 625 <1> ; /// End Of TIMER FUNCTIONS /// 3231 3232 00006575 90 Align 16 3233 3234 gdt: ; Global Descriptor Table 3235 ; 02/12/2020 3236 ; (30/07/2015, conforming cs) 3237 ; (26/03/2015) 3238 ; (24/03/2015, tss) 3239 ; (19/03/2015) 3240 ; (29/12/2013) 3241 ; 3242 00006580 0000000000000000 dw 0, 0, 0, 0 ; NULL descriptor 3243 gdt_kcode: 3244 ; 18/08/2014 3245 ; 8h kernel code segment, base = 00000000h 3246 ;dw 0FFFFh, 0, 9E00h, 00CFh ; KCODE ; 30/12/2016 3247 00006588 FFFF0000009ACF00 dw 0FFFFh, 0, 9A00h, 00CFh ; KCODE 3248 gdt_kdata: 3249 ; 10h kernel data segment, base = 00000000h 3250 00006590 FFFF00000092CF00 dw 0FFFFh, 0, 9200h, 00CFh ; KDATA 3251 gdt_ucode: 3252 ; 1Bh user code segment, base address = 400000h ; CORE 3253 ;dw 0FBFFh, 0, 0FE40h, 00CFh ; UCODE ; 30/12/2016 3254 00006598 FFFB000040FACF00 dw 0FBFFh, 0, 0FA40h, 00CFh ; UCODE 3255 gdt_udata: 3256 ; 23h user data segment, base address = 400000h ; CORE 3257 000065A0 FFFB000040F2CF00 dw 0FBFFh, 0, 0F240h, 00CFh ; UDATA 3258 gdt_tss: 3259 ; Task State Segment 3260 000065A8 6700 dw 0067h ; Limit = 103 ; (104-1, tss size = 104 byte, 3261 ; no IO permission in ring 3) 3262 gdt_tss0: 3263 000065AA 0000 dw 0 ; TSS base address, bits 0-15 3264 gdt_tss1: 3265 000065AC 00 db 0 ; TSS base address, bits 16-23 3266 ; 49h 3267 000065AD E9 db 11101001b ; 0E9h => P=1/DPL=11/0/1/0/B/1 --> B = Task is busy (1) 3268 000065AE 00 db 0 ; G/0/0/AVL/LIMIT=0000 ; (Limit bits 16-19 = 0000) (G=0, 1 byte) 3269 gdt_tss2: 3270 000065AF 00 db 0 ; TSS base address, bits 24-31 3271 3272 ; 04/12/2023 - TRDOS v2.0.7 3273 ; 30/11/2020 3274 ; 29/11/2020 - TRDOS v2.0.3 3275 ; VESA VBE3 VIDE BIOS 32 BIT PMI SEGMENTS (16 bit segments) 3276 ; 30h ; VBE3CS 3277 _vbe3_CS: ; vesa vbe3 bios uses this as code seg (same addr with _vbe3_DS) 3278 ; limit = 65536, base addr = 0, P/DPL/1/Type/C/R/A = 9Ah, 16 bit 3279 ;dw 0FFFFh, 0, 9A00h, 0 ; Note: base addr will be initialized 3280 ; 04/12/2023 - TRDOS 386 v2.0.7 ; (+!*!+) 3281 000065B0 FFFF0000069A0000 dw 0FFFFh, 0, 9A06h, 0 ; VBE3BIOSCODE_ADDR = 60000h 3282 ; 38h ; VBE3BDS 3283 _vbe3_BDS: ; vesa vbe3 bios uses this as equivalent of rombios data segment 3284 ; limit = 1536, base addr = 0, P/DPL/1/Type/E/W/A = 92h, 16 bit 3285 000065B8 FF05000000920000 dw 05FFh, 0, 9200h, 0 ; Note: base addr will be initialized 3286 ; 40h ; VBE3A000 3287 _A0000Sel: ; VGA default video memory address 3288 ; limit = 65536, base addr = 0A0000h, 16 bit 3289 000065C0 FFFF00000A920000 dw 0FFFFh, 0, 920Ah, 0 3290 ; 48h ; VBE3B000 3291 _B0000Sel: ; MDA (monochrome) video memory address 3292 ; limit = 65536, base addr = 0B0000h, 16 bit 3293 000065C8 FFFF00000B920000 dw 0FFFFh, 0, 920Bh, 0 3294 ; 50h ; VBE3B800 3295 _B8000Sel: ; CGA video memory address 3296 ; limit = 32768, base addr = 0B8000h, 16 bit 3297 000065D0 FF7F00800B920000 dw 07FFFh, 8000h, 920Bh, 0 3298 ; 58h ; VBE3DS 3299 _vbe3_DS: ; vesa vbe3 bios uses this as data seg (CodeSegSel in PMInfoBlock) 3300 ; limit = 65536, base addr = 0, P/DPL/1/Type/E/W/A = 92h, 16 bit 3301 ;dw 0FFFFh, 0, 9200h, 0 ; Note: base addr will be initialized 3302 ; 04/12/2023 - TRDOS 386 v2.0.7 ; (+!*!+) 3303 000065D8 FFFF000006920000 dw 0FFFFh, 0, 9206h, 0 ; VBE3BIOSCODE_ADDR = 60000h 3304 ; 60h ; VBE3SS 3305 _vbe3_SS: ; kernel's stack segment but 16 bit version (same stack addr) 3306 ; limit = 1024, base addr = 0, P/DPL/1/Type/E/W/A = 92h, 16 bit 3307 000065E0 FF03000000920000 dw 03FFh, 0, 9200h, 0 ; Note: base addr will be initialized 3308 ; 68h ; VBE3ES 3309 _vbe3_ES: ; extra 16 bit segment points to buffers in kernel's mem space 3310 ; limit = 2048, base addr = 0, P/DPL/1/Type/E/W/A = 92h, 16 bit 3311 000065E8 FF07000000920000 dw 07FFh, 0, 9200h,0 ; Note: base addr will be initialized 3312 ; 70h ; KODE16 3313 _16bit_CS: ; 16 bit code segment points to kernel's far return addr 3314 ; limit = 16M, base addr = 0, P/DPL/1/Type/E/W/A = 92h, 16 bit 3315 000065F0 FFFF0000009AFF00 dw 0FFFFh, 0, 9A00h, 00FFh ; Note: base addr will be initialized 3316 3317 gdt_end: 3318 ;; 9Eh = 1001 1110b (GDT byte 5) P=1/DPL=00/1/TYPE=1110, 3319 ;; Type= 1 (code)/C=1/R=1/A=0 3320 ; P= Present, DPL=0=ring 0, 1= user (0= system) 3321 ; 1= Code C= Conforming, R= Readable, A= Accessed 3322 3323 ;; 9Ah = 1001 1010b (GDT byte 5) P=1/DPL=00/1/TYPE=1010, 3324 ;; Type= 1 (code)/C=0/R=1/A=0 3325 ; P= Present, DPL=0=ring 0, 1= user (0= system) 3326 ; 1= Code C= non-Conforming, R= Readable, A= Accessed 3327 3328 ;; 92h = 1001 0010b (GDT byte 5) P=1/DPL=00/1/TYPE=1010, 3329 ;; Type= 0 (data)/E=0/W=1/A=0 3330 ; P= Present, DPL=0=ring 0, 1= user (0= system) 3331 ; 0= Data E= Expansion direction (1= down, 0= up) 3332 ; W= Writeable, A= Accessed 3333 3334 ;; FEh = 1111 1110b (GDT byte 5) P=1/DPL=11/1/TYPE=1110, 3335 ;; Type= 1 (code)/C=1/R=1/A=0 3336 ; P= Present, DPL=3=ring 3, 1= user (0= system) 3337 ; 1= Code C= Conforming, R= Readable, A= Accessed 3338 3339 ;; FAh = 1111 1010b (GDT byte 5) P=1/DPL=11/1/TYPE=1010, 3340 ;; Type= 1 (code)/C=0/R=1/A=0 3341 ; P= Present, DPL=3=ring 3, 1= user (0= system) 3342 ; 1= Code C= non-Conforming, R= Readable, A= Accessed 3343 3344 ;; F2h = 1111 0010b (GDT byte 5) P=1/DPL=11/1/TYPE=0010, 3345 ;; Type= 0 (data)/E=0/W=1/A=0 3346 ; P= Present, DPL=3=ring 3, 1= user (0= system) 3347 ; 0= Data E= Expansion direction (1= down, 0= up) 3348 3349 ;; CFh = 1100 1111b (GDT byte 6) G=1/B=1/0/AVL=0, Limit=1111b (3) 3350 3351 ;; Limit = FFFFFh (=> FFFFFh+1= 100000h) // bits 0-15, 48-51 // 3352 ; = 100000h * 1000h (G=1) = 4GB 3353 ;; Limit = FFBFFh (=> FFBFFh+1= FFC00h) // bits 0-15, 48-51 // 3354 ; = FFC00h * 1000h (G=1) = 4GB - 4MB 3355 ; G= Granularity (1= 4KB), B= Big (32 bit), 3356 ; AVL= Available to programmers 3357 3358 gdtd: 3359 000065F8 7700 dw gdt_end - gdt - 1 ; Limit (size) 3360 000065FA [80650000] dd gdt ; Address of the GDT 3361 3362 ; 20/08/2014 3363 idtd: 3364 000065FE 7F02 dw idt_end - idt - 1 ; Limit (size) 3365 00006600 [C8730100] dd idt ; Address of the IDT 3366 3367 ; 20/02/2017 3368 ;;; 11/03/2015 3369 %include 'diskdata.s' ; DISK (BIOS) DATA (initialized) 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - diskdata.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 06/08/2022 (Previous: 24/01/2016) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; diskdata.inc (11/03/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - DISKDATA.INC 20 <1> ; Last Modification: 11/03/2015 21 <1> ; (Initialized Disk Parameters Data section for 'DISKIO.INC') 22 <1> ; 23 <1> 24 <1> ;---------------------------------------- 25 <1> ; 80286 INTERRUPT LOCATIONS : 26 <1> ; REFERENCED BY POST & BIOS : 27 <1> ;---------------------------------------- 28 <1> 29 00006604 [67660000] <1> DISK_POINTER: dd MD_TBL6 ; Pointer to Diskette Parameter Table 30 <1> 31 <1> ; IBM PC-XT Model 286 source code ORGS.ASM (06/10/85) - 14/12/2014 32 <1> ;---------------------------------------------------------------- 33 <1> ; DISK_BASE : 34 <1> ; THIS IS THE SET OF PARAMETERS REQUIRED FOR : 35 <1> ; DISKETTE OPERATION. THEY ARE POINTED AT BY THE : 36 <1> ; DATA VARIABLE @DISK_POINTER. TO MODIFY THE PARAMETERS, : 37 <1> ; BUILD ANOTHER PARAMETER BLOCK AND POINT AT IT : 38 <1> ;---------------------------------------------------------------- 39 <1> 40 <1> ;DISK_BASE: 41 <1> ; DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 42 <1> ; DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 43 <1> ; DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 44 <1> ; DB 2 ; 512 BYTES/SECTOR 45 <1> ; ;DB 15 ; EOT (LAST SECTOR ON TRACK) 46 <1> ; db 18 ; (EOT for 1.44MB diskette) 47 <1> ; DB 01BH ; GAP LENGTH 48 <1> ; DB 0FFH ; DTL 49 <1> ; ;DB 054H ; GAP LENGTH FOR FORMAT 50 <1> ; db 06ch ; (for 1.44MB dsikette) 51 <1> ; DB 0F6H ; FILL BYTE FOR FORMAT 52 <1> ; DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 53 <1> ; DB 8 ; MOTOR START TIME (1/8 SECONDS) 54 <1> 55 <1> ;---------------------------------------- 56 <1> ; ROM BIOS DATA AREAS : 57 <1> ;---------------------------------------- 58 <1> 59 <1> ;DATA SEGMENT AT 40H ; ADDRESS= 0040:0000 60 <1> 61 <1> ;@EQUIP_FLAG DW ? ; INSTALLED HARDWARE FLAGS 62 <1> 63 <1> ;---------------------------------------- 64 <1> ; DISKETTE DATA AREAS : 65 <1> ;---------------------------------------- 66 <1> 67 <1> ;@SEEK_STATUS DB ? ; DRIVE RECALIBRATION STATUS 68 <1> ; ; BIT 3-0 = DRIVE 3-0 RECALIBRATION 69 <1> ; ; BEFORE NEXT SEEK IF BIT IS = 0 70 <1> ;@MOTOR_STATUS DB ? ; MOTOR STATUS 71 <1> ; ; BIT 3-0 = DRIVE 3-0 CURRENTLY RUNNING 72 <1> ; ; BIT 7 = CURRENT OPERATION IS A WRITE 73 <1> ;@MOTOR_COUNT DB ? ; TIME OUT COUNTER FOR MOTOR(S) TURN OFF 74 <1> ;@DSKETTE_STATUS DB ? ; RETURN CODE STATUS BYTE 75 <1> ; ; CMD_BLOCK IN STACK FOR DISK OPERATION 76 <1> ;@NEC_STATUS DB 7 DUP(?) ; STATUS BYTES FROM DISKETTE OPERATION 77 <1> 78 <1> ;---------------------------------------- 79 <1> ; POST AND BIOS WORK DATA AREA : 80 <1> ;---------------------------------------- 81 <1> 82 <1> ;@INTR_FLAG DB ? ; FLAG INDICATING AN INTERRUPT HAPPENED 83 <1> 84 <1> ;---------------------------------------- 85 <1> ; TIMER DATA AREA : 86 <1> ;---------------------------------------- 87 <1> 88 <1> ; 17/12/2014 (IRQ 0 - INT 08H) 89 <1> ;TIMER_LOW equ 46Ch ; Timer ticks (counter) @ 40h:006Ch 90 <1> ;TIMER_HIGH equ 46Eh ; (18.2 timer ticks per second) 91 <1> ;TIMER_OFL equ 470h ; Timer - 24 hours flag @ 40h:0070h 92 <1> 93 <1> ;---------------------------------------- 94 <1> ; ADDITIONAL MEDIA DATA : 95 <1> ;---------------------------------------- 96 <1> 97 <1> ;@LASTRATE DB ? ; LAST DISKETTE DATA RATE SELECTED 98 <1> ;@DSK_STATE DB ? ; DRIVE 0 MEDIA STATE 99 <1> ; DB ? ; DRIVE 1 MEDIA STATE 100 <1> ; DB ? ; DRIVE 0 OPERATION START STATE 101 <1> ; DB ? ; DRIVE 1 OPERATION START STATE 102 <1> ;@DSK_TRK DB ? ; DRIVE 0 PRESENT CYLINDER 103 <1> ; DB ? ; DRIVE 1 PRESENT CYLINDER 104 <1> 105 <1> ;DATA ENDS ; END OF BIOS DATA SEGMENT 106 <1> 107 <1> ;-------------------------------------------------------- 108 <1> ; DRIVE TYPE TABLE : 109 <1> ;-------------------------------------------------------- 110 <1> ; 16/02/2015 (unix386.s, 32 bit modifications) 111 <1> DR_TYPE: 112 00006608 01 <1> DB 01 ; DRIVE TYPE, MEDIA TABLE 113 <1> ;DW MD_TBL1 114 00006609 [26660000] <1> dd MD_TBL1 115 0000660D 82 <1> DB 02+BIT7ON 116 <1> ;DW MD_TBL2 117 0000660E [33660000] <1> dd MD_TBL2 118 00006612 02 <1> DR_DEFAULT: DB 02 119 <1> ;DW MD_TBL3 120 00006613 [40660000] <1> dd MD_TBL3 121 00006617 03 <1> DB 03 122 <1> ;DW MD_TBL4 123 00006618 [4D660000] <1> dd MD_TBL4 124 0000661C 84 <1> DB 04+BIT7ON 125 <1> ;DW MD_TBL5 126 0000661D [5A660000] <1> dd MD_TBL5 127 00006621 04 <1> DB 04 128 <1> ;DW MD_TBL6 129 00006622 [67660000] <1> dd MD_TBL6 130 <1> DR_TYPE_E equ $ ; END OF TABLE 131 <1> ;DR_CNT EQU (DR_TYPE_E-DR_TYPE)/3 132 <1> DR_CNT equ (DR_TYPE_E-DR_TYPE)/5 133 <1> ;-------------------------------------------------------- 134 <1> ; MEDIA/DRIVE PARAMETER TABLES : 135 <1> ;-------------------------------------------------------- 136 <1> ;-------------------------------------------------------- 137 <1> ; 360 KB MEDIA IN 360 KB DRIVE : 138 <1> ;-------------------------------------------------------- 139 <1> MD_TBL1: 140 00006626 DF <1> DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 141 00006627 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 142 00006628 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 143 00006629 02 <1> DB 2 ; 512 BYTES/SECTOR 144 0000662A 09 <1> DB 09 ; EOT (LAST SECTOR ON TRACK) 145 0000662B 2A <1> DB 02AH ; GAP LENGTH 146 0000662C FF <1> DB 0FFH ; DTL 147 0000662D 50 <1> DB 050H ; GAP LENGTH FOR FORMAT 148 0000662E F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 149 0000662F 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 150 00006630 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 151 00006631 27 <1> DB 39 ; MAX. TRACK NUMBER 152 00006632 80 <1> DB RATE_250 ; DATA TRANSFER RATE 153 <1> ;-------------------------------------------------------- 154 <1> ; 360 KB MEDIA IN 1.2 MB DRIVE : 155 <1> ;-------------------------------------------------------- 156 <1> MD_TBL2: 157 00006633 DF <1> DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 158 00006634 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 159 00006635 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 160 00006636 02 <1> DB 2 ; 512 BYTES/SECTOR 161 00006637 09 <1> DB 09 ; EOT (LAST SECTOR ON TRACK) 162 00006638 2A <1> DB 02AH ; GAP LENGTH 163 00006639 FF <1> DB 0FFH ; DTL 164 0000663A 50 <1> DB 050H ; GAP LENGTH FOR FORMAT 165 0000663B F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 166 0000663C 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 167 0000663D 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 168 0000663E 27 <1> DB 39 ; MAX. TRACK NUMBER 169 0000663F 40 <1> DB RATE_300 ; DATA TRANSFER RATE 170 <1> ;-------------------------------------------------------- 171 <1> ; 1.2 MB MEDIA IN 1.2 MB DRIVE : 172 <1> ;-------------------------------------------------------- 173 <1> MD_TBL3: 174 00006640 DF <1> DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 175 00006641 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 176 00006642 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 177 00006643 02 <1> DB 2 ; 512 BYTES/SECTOR 178 00006644 0F <1> DB 15 ; EOT (LAST SECTOR ON TRACK) 179 00006645 1B <1> DB 01BH ; GAP LENGTH 180 00006646 FF <1> DB 0FFH ; DTL 181 00006647 54 <1> DB 054H ; GAP LENGTH FOR FORMAT 182 00006648 F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 183 00006649 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 184 0000664A 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 185 0000664B 4F <1> DB 79 ; MAX. TRACK NUMBER 186 0000664C 00 <1> DB RATE_500 ; DATA TRANSFER RATE 187 <1> ;-------------------------------------------------------- 188 <1> ; 720 KB MEDIA IN 720 KB DRIVE : 189 <1> ;-------------------------------------------------------- 190 <1> MD_TBL4: 191 0000664D DF <1> DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 192 0000664E 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 193 0000664F 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 194 00006650 02 <1> DB 2 ; 512 BYTES/SECTOR 195 00006651 09 <1> DB 09 ; EOT (LAST SECTOR ON TRACK) 196 00006652 2A <1> DB 02AH ; GAP LENGTH 197 00006653 FF <1> DB 0FFH ; DTL 198 00006654 50 <1> DB 050H ; GAP LENGTH FOR FORMAT 199 00006655 F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 200 00006656 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 201 00006657 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 202 00006658 4F <1> DB 79 ; MAX. TRACK NUMBER 203 00006659 80 <1> DB RATE_250 ; DATA TRANSFER RATE 204 <1> ;-------------------------------------------------------- 205 <1> ; 720 KB MEDIA IN 1.44 MB DRIVE : 206 <1> ;-------------------------------------------------------- 207 <1> MD_TBL5: 208 0000665A DF <1> DB 11011111B ; SRT=D, HD UNLOAD=0F - 1ST SPECIFY BYTE 209 0000665B 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 210 0000665C 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 211 0000665D 02 <1> DB 2 ; 512 BYTES/SECTOR 212 0000665E 09 <1> DB 09 ; EOT (LAST SECTOR ON TRACK) 213 0000665F 2A <1> DB 02AH ; GAP LENGTH 214 00006660 FF <1> DB 0FFH ; DTL 215 00006661 50 <1> DB 050H ; GAP LENGTH FOR FORMAT 216 00006662 F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 217 00006663 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 218 00006664 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 219 00006665 4F <1> DB 79 ; MAX. TRACK NUMBER 220 00006666 80 <1> DB RATE_250 ; DATA TRANSFER RATE 221 <1> ;-------------------------------------------------------- 222 <1> ; 1.44 MB MEDIA IN 1.44 MB DRIVE : 223 <1> ;-------------------------------------------------------- 224 <1> MD_TBL6: 225 00006667 AF <1> DB 10101111B ; SRT=A, HD UNLOAD=0F - 1ST SPECIFY BYTE 226 00006668 02 <1> DB 2 ; HD LOAD=1, MODE=DMA - 2ND SPECIFY BYTE 227 00006669 25 <1> DB MOTOR_WAIT ; WAIT TIME AFTER OPERATION TILL MOTOR OFF 228 0000666A 02 <1> DB 2 ; 512 BYTES/SECTOR 229 0000666B 12 <1> DB 18 ; EOT (LAST SECTOR ON TRACK) 230 0000666C 1B <1> DB 01BH ; GAP LENGTH 231 0000666D FF <1> DB 0FFH ; DTL 232 0000666E 6C <1> DB 06CH ; GAP LENGTH FOR FORMAT 233 0000666F F6 <1> DB 0F6H ; FILL BYTE FOR FORMAT 234 00006670 0F <1> DB 15 ; HEAD SETTLE TIME (MILLISECONDS) 235 00006671 08 <1> DB 8 ; MOTOR START TIME (1/8 SECONDS) 236 00006672 4F <1> DB 79 ; MAX. TRACK NUMBER 237 00006673 00 <1> DB RATE_500 ; DATA TRANSFER RATE 238 <1> 239 <1> 240 <1> ; << diskette.inc >> 241 <1> ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 242 <1> ; 243 <1> ;---------------------------------------- 244 <1> ; ROM BIOS DATA AREAS : 245 <1> ;---------------------------------------- 246 <1> 247 <1> ;DATA SEGMENT AT 40H ; ADDRESS= 0040:0000 248 <1> 249 <1> ;---------------------------------------- 250 <1> ; FIXED DISK DATA AREAS : 251 <1> ;---------------------------------------- 252 <1> 253 <1> ;DISK_STATUS1: DB 0 ; FIXED DISK STATUS 254 <1> ;HF_NUM: DB 0 ; COUNT OF FIXED DISK DRIVES 255 <1> ;CONTROL_BYTE: DB 0 ; HEAD CONTROL BYTE 256 <1> ;@PORT_OFF DB ? ; RESERVED (PORT OFFSET) 257 <1> 258 <1> ;---------------------------------------- 259 <1> ; ADDITIONAL MEDIA DATA : 260 <1> ;---------------------------------------- 261 <1> 262 <1> ;@LASTRATE DB ? ; LAST DISKETTE DATA RATE SELECTED 263 <1> ;HF_STATUS DB 0 ; STATUS REGISTER 264 <1> ;HF_ERROR DB 0 ; ERROR REGISTER 265 <1> ;HF_INT_FLAG DB 0 ; FIXED DISK INTERRUPT FLAG 266 <1> ;HF_CNTRL DB 0 ; COMBO FIXED DISK/DISKETTE CARD BIT 0=1 267 <1> ;@DSK_STATE DB ? ; DRIVE 0 MEDIA STATE 268 <1> ; DB ? ; DRIVE 1 MEDIA STATE 269 <1> ; DB ? ; DRIVE 0 OPERATION START STATE 270 <1> ; DB ? ; DRIVE 1 OPERATION START STATE 271 <1> ;@DSK_TRK DB ? ; DRIVE 0 PRESENT CYLINDER 272 <1> ; DB ? ; DRIVE 1 PRESENT CYLINDER 273 <1> 274 <1> ;DATA ENDS ; END OF BIOS DATA SEGMENT 275 <1> ; 276 <1> ; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 277 <1> 278 <1> ERR_TBL: 279 00006674 E0 <1> db NO_ERR 280 00006675 024001BB <1> db BAD_ADDR_MARK,BAD_SEEK,BAD_CMD,UNDEF_ERR 281 00006679 04BB100A <1> db RECORD_NOT_FND,UNDEF_ERR,BAD_ECC,BAD_SECTOR 282 <1> 283 <1> ; 06/08/2022 284 <1> ; 17/12/2014 (mov ax, [cfd]) 285 <1> ; 11/12/2014 286 <1> ;cfd: db 0 ; current floppy drive (for GET_PARM) 287 <1> ; 17/12/2014 ; instead of 'DISK_POINTER' 288 <1> ;pfd: db 1 ; previous floppy drive (for GET_PARM) 289 <1> ; (initial value of 'pfd 290 <1> ; must be different then 'cfd' value 291 <1> ; to force updating/initializing 292 <1> ; current drive parameters) 293 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 294 <1> ; 11/07/2022 - Retro UNIX 386 v1.1 (Kernel v0.2.1.5) 295 0000667D FF <1> pfd: db 0FFh 296 <1> 297 <1> align 2 298 <1> 299 0000667E F001 <1> HF_PORT: dw 1F0h ; Default = 1F0h 300 <1> ; (170h) 301 00006680 F603 <1> HF_REG_PORT: dw 3F6h ; HF_PORT + 206h 302 <1> 303 <1> ; 05/01/2015 304 00006682 00 <1> hf_m_s: db 0 ; (0 = Master, 1 = Slave) 305 <1> 306 <1> ; ***************************************************************************** 3370 3371 00006683 90 Align 2 3372 3373 ; 04/11/2014 (Retro UNIX 386 v1) 3374 00006684 0000 mem_1m_1k: dw 0 ; Number of contiguous KB between 3375 ; 1 and 16 MB, max. 3C00h = 15 MB. 3376 00006686 0000 mem_16m_64k: dw 0 ; Number of contiguous 64 KB blocks 3377 ; between 16 MB and 4 GB. 3378 3379 ; 12/11/2014 (Retro UNIX 386 v1) 3380 00006688 00 boot_drv: db 0 ; boot drive number (physical) 3381 ; 24/11/2014 3382 00006689 00 drv: db 0 3383 0000668A 00 last_drv: db 0 ; last hdd 3384 0000668B 00 hdc: db 0 ; number of hard disk drives 3385 ; (present/detected) 3386 3387 ; 24/11/2014 (Retro UNIX 386 v1) 3388 ; Physical drive type & flags 3389 0000668C 00 fd0_type: db 0 ; floppy drive type 3390 0000668D 00 fd1_type: db 0 ; 4 = 1.44 Mb, 80 track, 3.5" (18 spt) 3391 ; 6 = 2.88 Mb, 80 track, 3.5" (36 spt) 3392 ; 3 = 720 Kb, 80 track, 3.5" (9 spt) 3393 ; 2 = 1.2 Mb, 80 track, 5.25" (15 spt) 3394 ; 1 = 360 Kb, 40 track, 5.25" (9 spt) 3395 0000668E 00 hd0_type: db 0 ; EDD status for hd0 (bit 7 = present flag) 3396 0000668F 00 hd1_type: db 0 ; EDD status for hd1 (bit 7 = present flag) 3397 00006690 00 hd2_type: db 0 ; EDD status for hd2 (bit 7 = present flag) 3398 00006691 00 hd3_type: db 0 ; EDD status for hd3 (bit 7 = present flag) 3399 ; bit 0 - Fixed disk access subset supported 3400 ; bit 1 - Drive locking and ejecting 3401 ; bit 2 - Enhanced disk drive support 3402 ; bit 3 = Reserved (64 bit EDD support) 3403 ; (If bit 0 is '1' Retro UNIX 386 v1 3404 ; will interpret it as 'LBA ready'!) 3405 3406 ; 08/08/2022 3407 ; (drv.cylinders, drv.spt, drv.spt will not be used now on) 3408 ; ('diskio.inc') 3409 ; ((spt and heads and cylinder counts will be taken from DPT)) 3410 3411 ;; 11/03/2015 - 10/07/2015 3412 ;drv.cylinders: dw 0,0,0,0,0,0,0 3413 ;drv.heads: dw 0,0,0,0,0,0,0 3414 ;drv.spt: dw 0,0,0,0,0,0,0 3415 ; 12/07/2022 - 11/03/2015 3416 00006692 000000000000000000- drv.size: dd 0,0,0,0,0,0,0 3416 0000669B 000000000000000000- 3416 000066A4 000000000000000000- 3416 000066AD 00 3417 000066AE 00000000000000 drv.status: db 0,0,0,0,0,0,0 3418 000066B5 00000000000000 drv.error: db 0,0,0,0,0,0,0 3419 ; 3420 3421 Align 2 3422 3423 ;;; 11/03/2015 3424 %include 'kybdata.s' ; KEYBOARD (BIOS) DATA 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - kybdata.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 24/07/2022 (Previous: 17/01/2016) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 17/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; kybdata.inc (11/03/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - KYBDATA.INC 20 <1> ; Last Modification: 11/03/2015 21 <1> ; (Data Section for 'KEYBOARD.INC') 22 <1> ; 23 <1> ; ///////// KEYBOARD DATA /////////////// 24 <1> 25 <1> ; 24/07/2022 - TRDOS 386 Kernel v2.0.5 26 <1> ; 05/12/2014 27 <1> ; 04/12/2014 (derived from pc-xt-286 bios source code -1986-) 28 <1> ; 03/06/86 KEYBOARD BIOS 29 <1> 30 <1> ;--------------------------------------------------------------------------------- 31 <1> ; KEY IDENTIFICATION SCAN TABLES 32 <1> ;--------------------------------------------------------------------------------- 33 <1> 34 <1> ;----- TABLES FOR ALT CASE ------------ 35 <1> ;----- ALT-INPUT-TABLE 36 000066BC 524F50514B <1> K30: db 82,79,80,81,75 37 000066C1 4C4D474849 <1> db 76,77,71,72,73 ; 10 NUMBER ON KEYPAD 38 <1> ;----- SUPER-SHIFT-TABLE 39 000066C6 101112131415 <1> db 16,17,18,19,20,21 ; A-Z TYPEWRITER CHARS 40 000066CC 161718191E1F <1> db 22,23,24,25,30,31 41 000066D2 202122232425 <1> db 32,33,34,35,36,37 42 000066D8 262C2D2E2F30 <1> db 38,44,45,46,47,48 43 000066DE 3132 <1> db 49,50 44 <1> 45 <1> ;----- TABLE OF SHIFT KEYS AND MASK VALUES 46 <1> ;----- KEY_TABLE 47 000066E0 52 <1> _K6: db INS_KEY ; INSERT KEY 48 000066E1 3A4546381D <1> db CAPS_KEY,NUM_KEY,SCROLL_KEY,ALT_KEY,CTL_KEY 49 000066E6 2A36 <1> db LEFT_KEY,RIGHT_KEY 50 <1> _K6L equ $-_K6 51 <1> 52 <1> ;----- MASK_TABLE 53 000066E8 80 <1> _K7: db INS_SHIFT ; INSERT MODE SHIFT 54 000066E9 4020100804 <1> db CAPS_SHIFT,NUM_SHIFT,SCROLL_SHIFT,ALT_SHIFT,CTL_SHIFT 55 000066EE 0201 <1> db LEFT_SHIFT,RIGHT_SHIFT 56 <1> 57 <1> ;----- TABLES FOR CTRL CASE ;---- CHARACTERS ------ 58 000066F0 1BFF00FFFFFF <1> _K8: db 27,-1,0,-1,-1,-1 ; Esc, 1, 2, 3, 4, 5 59 000066F6 1EFFFFFFFF1F <1> db 30,-1,-1,-1,-1,31 ; 6, 7, 8, 9, 0, - 60 <1> ;db -1,127,-1,17,23,5 ; =, Bksp, Tab, Q, W, E 61 000066FC FF7F94111705 <1> db -1,127,148,17,23,5 ; 24/07/2022 62 00006702 12141915090F <1> db 18,20,25,21,9,15 ; R, T, Y, U, I, O 63 00006708 101B1D0AFF01 <1> db 16,27,29,10,-1,1 ; P, [, ], Enter, Ctrl, A 64 0000670E 13040607080A <1> db 19,4,6,7,8,10 ; S, D, F, G, H, J 65 00006714 0B0CFFFFFFFF <1> db 11,12,-1,-1,-1,-1 ; K, L, :, ', `, LShift 66 0000671A 1C1A18031602 <1> db 28,26,24,3,22,2 ; Bkslash, Z, X, C, V, B 67 00006720 0E0DFFFFFFFF <1> db 14,13,-1,-1,-1,-1 ; N, M, ,, ., /, RShift 68 00006726 96FF20FF <1> db 150,-1,' ',-1 ; *, ALT, Spc, CL 69 <1> ; ;----- FUNCTIONS ------ 70 0000672A 5E5F60616263 <1> db 94,95,96,97,98,99 ; F1 - F6 71 00006730 64656667FFFF <1> db 100,101,102,103,-1,-1 ; F7 - F10, NL, SL 72 00006736 778D848E738F <1> db 119,141,132,142,115,143 ; Home, Up, PgUp, -, Left, Pad5 73 0000673C 749075917692 <1> db 116,144,117,145,118,146 ; Right, +, End, Down, PgDn, Ins 74 00006742 93FFFFFF898A <1> db 147,-1,-1,-1,137,138 ; Del, SysReq, Undef, WT, F11, F12 75 <1> 76 <1> ;----- TABLES FOR LOWER CASE ---------- 77 00006748 1B3132333435363738- <1> K10: db 27,'1234567890-=',8,9 77 00006751 39302D3D0809 <1> 78 00006757 71776572747975696F- <1> db 'qwertyuiop[]',13,-1,'asdfghjkl;',39 78 00006760 705B5D0DFF61736466- <1> 78 00006769 67686A6B6C3B27 <1> 79 00006770 60FF5C7A786376626E- <1> db 96,-1,92,'zxcvbnm,./',-1,'*',-1,' ',-1 79 00006779 6D2C2E2FFF2AFF20FF <1> 80 <1> ;----- LC TABLE SCAN 81 00006782 3B3C3D3E3F <1> db 59,60,61,62,63 ; BASE STATE OF F1 - F10 82 00006787 4041424344 <1> db 64,65,66,67,68 83 0000678C FFFF <1> db -1,-1 ; NL, SL 84 <1> 85 <1> ;----- KEYPAD TABLE 86 0000678E 474849FF4BFF <1> K15: db 71,72,73,-1,75,-1 ; BASE STATE OF KEYPAD KEYS 87 00006794 4DFF4F50515253 <1> db 77,-1,79,80,81,82,83 88 0000679B FFFF5C8586 <1> db -1,-1,92,133,134 ; SysRq, Undef, WT, F11, F12 89 <1> 90 <1> ;----- TABLES FOR UPPER CASE ---------- 91 000067A0 1B21402324255E262A- <1> K11: db 27,'!@#$%',94,'&*()_+',8,0 91 000067A9 28295F2B0800 <1> 92 000067AF 51574552545955494F- <1> db 'QWERTYUIOP{}',13,-1,'ASDFGHJKL:"' 92 000067B8 507B7D0DFF41534446- <1> 92 000067C1 47484A4B4C3A22 <1> 93 000067C8 7EFF7C5A584356424E- <1> db 126,-1,'|ZXCVBNM<>?',-1,'*',-1,' ',-1 93 000067D1 4D3C3E3FFF2AFF20FF <1> 94 <1> ;----- UC TABLE SCAN 95 000067DA 5455565758 <1> K12: db 84,85,86,87,88 ; SHIFTED STATE OF F1 - F10 96 000067DF 595A5B5C5D <1> db 89,90,91,92,93 97 000067E4 FFFF <1> db -1,-1 ; NL, SL 98 <1> 99 <1> ;----- NUM STATE TABLE 100 000067E6 3738392D3435362B31- <1> K14: db '789-456+1230.' ; NUMLOCK STATE OF KEYPAD KEYS 100 000067EF 3233302E <1> 101 <1> ; 102 000067F3 FFFF7C8788 <1> db -1,-1,124,135,136 ; SysRq, Undef, WT, F11, F12 103 <1> 104 <1> ; 26/08/2014 105 <1> ; Retro UNIX 8086 v1 - UNIX.ASM (03/03/2014) 106 <1> ; Derived from IBM "pc-at" 107 <1> ; rombios source code (06/10/1985) 108 <1> ; 'dseg.inc' 109 <1> 110 <1> ;---------------------------------------; 111 <1> ; SYSTEM DATA AREA ; 112 <1> ;---------------------------------------- 113 000067F8 00 <1> BIOS_BREAK db 0 ; BIT 7=1 IF BREAK KEY HAS BEEN PRESSED 114 <1> 115 <1> ;---------------------------------------- 116 <1> ; KEYBOARD DATA AREAS ; 117 <1> ;---------------------------------------- 118 <1> 119 000067F9 00 <1> KB_FLAG db 0 ; KEYBOARD SHIFT STATE AND STATUS FLAGS 120 000067FA 00 <1> KB_FLAG_1 db 0 ; SECOND BYTE OF KEYBOARD STATUS 121 000067FB 00 <1> KB_FLAG_2 db 0 ; KEYBOARD LED FLAGS 122 000067FC 00 <1> KB_FLAG_3 db 0 ; KEYBOARD MODE STATE AND TYPE FLAGS 123 000067FD 00 <1> ALT_INPUT db 0 ; STORAGE FOR ALTERNATE KEY PAD ENTRY 124 000067FE [0E680000] <1> BUFFER_START dd KB_BUFFER ; OFFSET OF KEYBOARD BUFFER START 125 00006802 [2E680000] <1> BUFFER_END dd KB_BUFFER + 32 ; OFFSET OF END OF BUFFER 126 00006806 [0E680000] <1> BUFFER_HEAD dd KB_BUFFER ; POINTER TO HEAD OF KEYBOARD BUFFER 127 0000680A [0E680000] <1> BUFFER_TAIL dd KB_BUFFER ; POINTER TO TAIL OF KEYBOARD BUFFER 128 <1> ; ------ HEAD = TAIL INDICATES THAT THE BUFFER IS EMPTY 129 0000680E 0000 <1> KB_BUFFER times 16 dw 0 ; ROOM FOR 16 SCAN CODE ENTRIES 130 <1> 131 <1> ; /// End Of KEYBOARD DATA /// 3425 %include 'vidata.s' ; VIDEO (BIOS) DATA 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.10 - vidata.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 21/12/2025 (Previous: 17/10/2023 - Kernel v2.0.7) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 16/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; vidata.inc (11/03/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-AT' BIOS source code (1985) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - VIDATA.S 20 <1> ; Last Modification: 11/03/2015 21 <1> ; (Data section for 'VIDEO.INC') 22 <1> ; 23 <1> ; ///////// VIDEO DATA /////////////// 24 <1> 25 <1> ;---------------------------------------- 26 <1> ; VIDEO DISPLAY DATA AREA ; 27 <1> ;---------------------------------------- 28 0000682E 03 <1> CRT_MODE: db 3 ; CURRENT DISPLAY MODE (TYPE) 29 0000682F 29 <1> CRT_MODE_SET: db 29h ; CURRENT SETTING OF THE 3X8 REGISTER 30 <1> ; (29h default setting for video mode 3) 31 <1> ; Mode Select register Bits 32 <1> ; BIT 0 - 80x25 (1), 40x25 (0) 33 <1> ; BIT 1 - ALPHA (0), 320x200 GRAPHICS (1) 34 <1> ; BIT 2 - COLOR (0), BW (1) 35 <1> ; BIT 3 - Video Sig. ENABLE (1), DISABLE (0) 36 <1> ; BIT 4 - 640x200 B&W Graphics Mode (1) 37 <1> ; BIT 5 - ALPHA mode BLINKING (1) 38 <1> ; BIT 6, 7 - Not Used 39 <1> 40 <1> ; Mode 0 - 2Ch = 101100b ; 40x25 text, 16 gray colors 41 <1> ; Mode 1 - 28h = 101000b ; 40x25 text, 16 fore colors, 8 back colors 42 <1> ; Mode 2 - 2Dh = 101101b ; 80x25 text, 16 gray colors 43 <1> ; Mode 3 - 29h = 101001b ; 80x25 text, 16 fore color, 8 back color 44 <1> ; Mode 4 - 2Ah = 101010b ; 320x200 graphics, 4 colors 45 <1> ; Mode 5 - 2Eh = 101110b ; 320x200 graphics, 4 gray colors 46 <1> ; Mode 6 - 1Eh = 011110b ; 640x200 graphics, 2 colors 47 <1> ; Mode 7 - 29h = 101001b ; 80x25 text, black & white colors 48 <1> ; Mode & 37h = Video signal OFF 49 <1> 50 <1> ; 24/06/2016 51 00006830 50 <1> CRT_COLS: db 80 ; Number of columns 52 <1> 53 <1> ; 01/07/2016 54 00006831 00 <1> CRT_PALETTE: db 0 ; Current palette setting 55 <1> 56 <1> ; 03/07/2016 57 00006832 10 <1> CHAR_HEIGHT: db 16 ; Default character height 58 00006833 60 <1> VGA_VIDEO_CTL: db 60h ; ROM BIOS DATA AREA Offset 87h 59 00006834 F9 <1> VGA_SWITCHES: db 0F9h ; Feature Bit Switches (the basic screen) 60 00006835 51 <1> VGA_MODESET_CTL: db 051h ; Basic mode set options (VGA video flags) 61 <1> ; ROM BIOS DATA AREA Offset 89h 62 <1> ; Bit 7, 4 : Mode 63 <1> ; 01 : 400-line mode 64 <1> ; Bit 6 : Display switch enabled = 1 65 <1> ; Bit 5 : Reserved = 0 66 <1> ; Bit 3 : Default palette loading 67 <1> ; disabled = 0 68 <1> ; Bit 2 : Color monitor = 0 69 <1> ; Bit 1 = Gray scale summing 70 <1> ; disabled = 0 71 <1> ; Bit 0 = VGA active = 1 72 00006836 19 <1> VGA_ROWS: db 25 73 <1> 74 <1> ; 16/01/2016 75 <1> chr_attrib: ; Character color/attributes for video pages (0 to 7) 76 00006837 0707070707070707 <1> db 07h, 07h, 07h, 07h, 07h, 07h, 07h, 07h 77 <1> ; 30/01/2016 78 <1> vmode: 79 0000683F 0303030303030303 <1> db 3,3,3,3,3,3,3,3 ; video modes for pseudo screens 80 <1> 81 <1> CURSOR_MODE: ; cursor start (ch) = 14, cursor end (cl) = 15 82 00006847 0F0E <1> db 15, 14 ; 07/07/2016 - TRDOS 386 (TRDOS v2.0) 83 <1> 84 <1> ;align 4 85 <1> ;VGA_BASE: ; 26/07/2016 86 <1> ; dd 0B8000h ; (Mode < 0Dh) or 0A0000h (mode >= 0Dh) 87 <1> 88 00006849 90 <1> align 2 89 <1> 90 <1> vga_modes: 91 <1> ; 25/07/2016 92 <1> ; 09/07/2016 93 <1> ; 03/07/2016 94 <1> ; valid (implemented) video modes (>7, extension to IBM PC CGA modes) 95 0000684A 0302010007040506 <1> db 03h, 02h, 01h, 00h, 07h, 04h, 05h, 06h 96 <1> vga_g_modes: ; 31/07/2016 97 00006852 13F0126A0D0E1011 <1> db 13h, 0F0h, 12h, 6Ah, 0Dh, 0Eh, 10h, 11h 98 <1> vga_mode_count equ $ - vga_modes 99 <1> vga_g_mode_count equ $ - vga_g_modes 100 <1> 101 <1> vga_mode_tbl_ptr: 102 <1> ; 25/07/2016 103 0000685A [BA680000] <1> dd vga_mode_03h 104 0000685E [BA680000] <1> dd vga_mode_03h ; mode 02h -> mode 03h 105 00006862 [FA680000] <1> dd vga_mode_01h 106 00006866 [FA680000] <1> dd vga_mode_01h ; mode 00h -> mode 01h 107 <1> ;dd vga_mode_07h 108 0000686A [BA680000] <1> dd vga_mode_03h ; mode 07h -> mode 03h 109 0000686E [3A690000] <1> dd vga_mode_04h 110 00006872 [3A690000] <1> dd vga_mode_04h ; mode 05h -> mode 04h 111 00006876 [7A690000] <1> dd vga_mode_06h 112 <1> vga_g_mode_tbl_ptr: ; 21/12/2025 113 0000687A [BA690000] <1> dd vga_mode_13h 114 0000687E [FA690000] <1> dd vga_mode_F0h 115 00006882 [3A6A0000] <1> dd vga_mode_12h 116 00006886 [7A6A0000] <1> dd vga_mode_6Ah 117 0000688A [BA6A0000] <1> dd vga_mode_0Dh 118 0000688E [FA6A0000] <1> dd vga_mode_0Eh 119 00006892 [3A6B0000] <1> dd vga_mode_10h 120 00006896 [7A6B0000] <1> dd vga_mode_11h 121 <1> 122 <1> vga_memmodel: 123 <1> ; 25/07/2016 124 <1> ; 07/07/2016 125 <1> CTEXT equ 0 126 <1> ;MTEXT equ 1 127 <1> MTEXT equ 0 ; mode 07h -> mode 03h 128 <1> CGA equ 2 129 <1> LINEAR8 equ 5 130 <1> PLANAR4 equ 4 131 <1> PLANAR1 equ 3 132 0000689A 0000000000020202 <1> db CTEXT, CTEXT, CTEXT, CTEXT, MTEXT, CGA, CGA, CGA 133 <1> vga_g_memmodel: ; 31/07/2016 134 000068A2 0504040404040403 <1> db LINEAR8, PLANAR4, PLANAR4, PLANAR4, PLANAR4, PLANAR4, PLANAR4, PLANAR1 135 <1> ;vga_pixbits: 136 <1> ; ; 25/07/2016 137 <1> ; ; 08/07/2016 138 <1> ; db 4, 4, 4, 4, 4, 2, 2, 1, 8, 4, 4, 4, 4, 4, 4, 1 139 <1> vga_dac_s: 140 000068AA 020202020001010103- <1> db 2, 2, 2, 2, 0, 1, 1, 1, 3, 3, 2, 2, 1, 1, 2, 2 140 000068B3 03020201010202 <1> 141 <1> ; (vgatables.h, VGAMODES, dac) 142 <1> ; 17/11/2020 143 <1> vga_params: 144 <1> ; 23/11/2020 145 <1> ; 16/11/2020 146 <1> ; 09/11/2020, 10/11/2020, 11/11/2020 (TRDOS 386 v2.0.3) 147 <1> ; 25/07/2016 148 <1> ; 19/07/2016 149 <1> ; 03/07/2016 150 <1> ; derived from 'Plex86/Bochs VGABios' source code 151 <1> ; vgabios-0.7a (2011) 152 <1> ; by the LGPL VGABios Developers Team (2001-2008) 153 <1> ; 'vgatables.h' 154 <1> ; Oracle VirtualBox 5.0.24 VGABios Source Code 155 <1> ; ('vgabios.c', 'vgatables.h', 'vgafonts.h', 'vgarom.asm') 156 <1> 157 <1> ; 09/11/2020 158 <1> ; Block Structure of Video Parameter Table 159 <1> ; 160 <1> ; Offset # Bytes Contents 161 <1> ; 162 <1> ; 0 1 # columns 163 <1> ; 1 1 # rows - 1 164 <1> ; 2 1 Pixels/character 165 <1> ; 3-4 2 Page length 166 <1> ; 5-8 4 Sequencer Registers 167 <1> ; 9 1 Miscellaneous Register 168 <1> ; 10-34 25 CRTC Registers 169 <1> ; 35-54 20 Attribute Registers 170 <1> ; 55-63 9 Graphics Controller Registers 171 <1> ; 172 <1> ; Ref: Programmer's Guide to EGA, VGA, and Super VGA cards 173 <1> ; (Richard F. Ferraro, 1994) 174 <1> 175 <1> ; 176 <1> vga_mode_03h: ; mode 03h, 80*25 text, CGA colors 177 <1> ; 11/11/2020 178 000068BA 5018100010 <1> db 80, 24, 16, 00h, 10h ; tw, th-1, ch, slength (5) 179 000068BF 00030002 <1> db 00h, 03h, 00h, 02h ; sequ regs (4) 180 000068C3 67 <1> db 67h ; misc reg (1) 181 000068C4 5F4F50825581BF1F <1> db 5Fh, 4Fh, 50h, 82h, 55h, 81h, 0BFh, 1Fh 182 <1> ; 09/11/2020 183 <1> ;db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0BFh, 1Fh 184 000068CC 004F <1> db 00h, 4Fh 185 <1> vga_p_cm_pos equ $ - vga_mode_03h 186 000068CE 0D0E00000000 <1> db 0Dh, 0Eh, 00h, 00h, 00h, 00h 187 000068D4 9C8E8F281F96B9A3 <1> db 9Ch, 8Eh, 8Fh, 28h, 1Fh, 96h, 0B9h, 0A3h 188 000068DC FF <1> db 0FFh ; crtc_regs (25) 189 000068DD 0001020304051407 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 14h, 07h 190 000068E5 38393A3B3C3D3E3F <1> db 38h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh 191 <1> ; 17/10/2023 192 000068ED 0C000F08 <1> db 0Ch, 00h, 0Fh, 08h ; actl regs (20) 193 <1> ;db 0Ch, 00h, 0Fh, 00h ; 19/11/2020 194 000068F1 0000000000100E0FFF <1> db 00h, 00h, 00h, 00h, 00h, 10h, 0Eh, 0Fh, 0FFh ; grdc regs (9) 195 <1> ; 09/11/2020 196 <1> ;db 00h, 00h, 00h, 00h, 00h, 10h, 0Eh, 00h, 0FFh ; grdc regs (9) 197 <1> vga_mode_01h: ; mode 01h, 40*25 text, CGA colors 198 000068FA 2818100008 <1> db 40, 24, 16, 00h, 08h ; tw, th-1, ch, slength 199 000068FF 08030002 <1> db 08h, 03h, 00h, 02h ; sequ regs 200 00006903 67 <1> db 67h ; misc reg 201 00006904 2D2728902BA0BF1F <1> db 2Dh, 27h, 28h, 90h, 2Bh, 0A0h, 0BFh, 1Fh 202 0000690C 004F0D0E00000000 <1> db 00h, 4Fh, 0Dh, 0Eh, 00h, 00h, 00h, 00h 203 00006914 9C8E8F141F96B9A3 <1> db 9Ch, 8Eh, 8Fh, 14h, 1Fh, 96h, 0B9h, 0A3h 204 0000691C FF <1> db 0FFh ; crtc_regs 205 0000691D 0001020304051407 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 14h, 07h 206 00006925 38393A3B3C3D3E3F <1> db 38h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh 207 <1> ;db 0Ch, 00h, 0Fh, 08h ; actl regs (20) 208 0000692D 0C000F00 <1> db 0Ch, 00h, 0Fh, 00h ; 19/11/2020 209 00006931 0000000000100E0FFF <1> db 00h, 00h, 00h, 00h, 00h, 10h, 0Eh, 0Fh, 0FFh ; grdc regs 210 <1> ;vga_mode_07h: ; mode 07h, 80*25 text, mono color 211 <1> ; db 80, 24, 16, 00h, 10h ; tw, th-1, ch, slength 212 <1> ; db 00h, 03h, 00h, 02h ; sequ regs 213 <1> ; db 66h ; misc reg 214 <1> ; db 5Fh, 4Fh, 50h, 82h, 55h, 81h, 0BFh, 1Fh 215 <1> ; db 00h, 4Fh, 0Dh, 0Eh, 00h, 00h, 00h, 00h 216 <1> ; db 9Ch, 8Eh, 8Fh, 28h, 0Fh, 96h, 0B9h, 0A3h 217 <1> ; db 0FFh ; crtc regs 218 <1> ; db 00h, 08h, 08h, 08h, 08h, 08h, 08h, 08h 219 <1> ; db 10h, 18h, 18h, 18h, 18h, 18h, 18h, 18h 220 <1> ; db 0Eh, 00h, 0Fh, 08h ; actl regs 221 <1> ; db 00h, 00h, 00h, 00h, 00h, 10h, 0Ah, 0Fh, 0FFh ; grdc regs 222 <1> vga_mode_04h: ; 320*200 graphics, 4 colors, CGA 223 <1> ; 11/11/2020 224 0000693A 2818080040 <1> db 40, 24, 8, 00h, 40h ; tw, th-1, ch, slength 225 0000693F 09030002 <1> db 09h, 03h, 00h, 02h ; sequ regs 226 00006943 63 <1> db 63h ; misc reg 227 00006944 2D2728902B80BF1F <1> db 2Dh, 27h, 28h, 90h, 2Bh, 80h, 0BFh, 1Fh 228 0000694C 00C1000000000000 <1> db 00h, 0C1h, 00h, 00h, 00h, 00h, 00h, 00h 229 00006954 9C8E8F140096B9A2 <1> db 9Ch, 8Eh, 8Fh, 14h, 00h, 96h, 0B9h, 0A2h 230 0000695C FF <1> db 0FFh ; crtc_regs 231 0000695D 0013151702040607 <1> db 00h, 13h, 15h, 17h, 02h, 04h, 06h, 07h 232 00006965 1011121314151617 <1> db 10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h 233 0000696D 01000300 <1> db 01h, 00h, 03h, 00h ; actl regs 234 00006971 0000000000300F0FFF <1> db 00h, 00h, 00h, 00h, 00h, 30h, 0Fh, 0Fh, 0FFh ; grdc regs 235 <1> vga_mode_06h: ; 640*200 graphics, 2 colors, CGA 236 <1> ; 11/11/2020 237 0000697A 5018080040 <1> db 80, 24, 8, 00h, 40h ; tw, th-1, ch, slength 238 0000697F 01010006 <1> db 01h, 01h, 00h, 06h ; sequ regs 239 00006983 63 <1> db 63h ; misc reg 240 00006984 5F4F50825480BF1F <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0BFh, 1Fh 241 0000698C 00C1000000000000 <1> db 00h, 0C1h, 00h, 00h, 00h, 00h, 00h, 00h 242 00006994 9C8E8F280096B9C2 <1> db 9Ch, 8Eh, 8Fh, 28h, 00h, 96h, 0B9h, 0C2h 243 0000699C FF <1> db 0FFh ; crtc regs 244 0000699D 0017171717171717 <1> db 00h, 17h, 17h, 17h, 17h, 17h, 17h, 17h 245 000069A5 1717171717171717 <1> db 17h, 17h, 17h, 17h, 17h, 17h, 17h, 17h 246 000069AD 01000100 <1> db 01h, 00h, 01, 00h ; actl regs 247 000069B1 0000000000000D0FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 0Dh, 0Fh, 0FFh ; grdc regs 248 <1> vga_mode_13h: ; mode 13h, 300*200, 256 colors, linear 249 <1> ; 11/11/2020 250 <1> ;db 40, 24, 8, 00h, 20h ; tw, th-1, ch, slength (5) 251 <1> ; 23/11/2020 - 10/11/2020 252 000069BA 28180800FA <1> db 40, 24, 8, 00h, 0FAh ; tw, th-1, ch, slength (5) 253 000069BF 010F000E <1> db 01h, 0Fh, 00h, 0Eh ; sequ regs (4) 254 000069C3 63 <1> db 63h ; misc reg (1) 255 000069C4 5F4F50825480BF1F <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0BFh, 1Fh 256 000069CC 0041000000000000 <1> db 00h, 041h, 00h, 00h, 00h, 00h, 00h, 00h 257 000069D4 9C8E8F284096B9A3 <1> db 9Ch, 8Eh, 8Fh, 28h, 40h, 96h, 0B9h, 0A3h 258 <1> ;db 9Ch, 0Eh, 8Fh, 28h, 40h, 96h, 0B9h, 0A3h ; 17/10/2023 259 000069DC FF <1> db 0FFh ; crtc regs (25) 260 000069DD 0001020304050607 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h 261 000069E5 08090A0B0C0D0E0F <1> db 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 0Fh 262 000069ED 41000F00 <1> db 41h, 00h, 0Fh, 00h ; actl regs (20) 263 <1> ; 10/11/2020 264 <1> ;db 41h, 01h, 0Fh, 13h ; actl regs (20) 265 000069F1 000000000040050FFF <1> db 00h, 00h, 00h, 00h, 00h, 40h, 05h, 0Fh, 0FFh ; grdc regs (9) 266 <1> vga_mode_setl equ $ - vga_mode_13h ; = 64 267 <1> vga_mode_F0h: ; mode X ; 320*240, 256 colors, planar 268 000069FA 2818080000 <1> db 40, 24, 8, 00h, 00h ; tw, th-1, ch, slength 269 000069FF 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 270 00006A03 E3 <1> db 0E3h ; misc reg 271 00006A04 5F4F508254800D3E <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0Dh, 3Eh 272 00006A0C 0041000000000000 <1> db 00h, 41h, 00h, 00h, 00h, 00h, 00h, 00h 273 00006A14 EAACDF2800E706E3 <1> db 0EAh, 0ACh, 0DFh, 28h, 00h, 0E7h, 06h, 0E3h 274 00006A1C FF <1> db 0FFh ; crtc regs (25) 275 00006A1D 0001020304050607 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h 276 00006A25 08090A0B0C0D0E0F <1> db 08h, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 0Eh, 0Fh 277 00006A2D 41000F00 <1> db 41h, 00h, 0Fh, 00h ; actl regs 278 00006A31 000000000040050FFF <1> db 00h, 00h, 00h, 00h, 00h, 40h, 05h, 0Fh, 0FFh ; grdc regs 279 <1> vga_mode_12h: ; mode 12h, 640*480, 16 colors, planar 280 <1> ; 11/11/2020 281 <1> ;db 80, 29, 16, 0, 0 ; tw, th-1, ch, slength 282 <1> ; 09/11/2020 283 00006A3A 501D1000A0 <1> db 80, 29, 16, 00h, 0A0h ; tw, th-1, ch, slength 284 00006A3F 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 285 00006A43 E3 <1> db 0E3h ; misc reg 286 00006A44 5F4F508254800B3E <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0Bh, 3Eh 287 <1> ; 09/11/2020 288 <1> ;db 5Fh, 4Fh, 50h, 82h, 53h, 9Fh, 0Bh, 3Eh 289 00006A4C 0040000000000000 <1> db 00h, 40h, 00h, 00h, 00h, 00h, 00h, 00h 290 00006A54 EA8CDF2800E704E3 <1> db 0EAh, 8Ch, 0DFh, 28h, 00h, 0E7h, 04h, 0E3h 291 <1> ; 09/11/2020 292 <1> ;db 0E9h, 8Bh, 0DFh, 28h, 00h, 0E7h, 04h, 0E3h 293 00006A5C FF <1> db 0FFh ; crtc regs 294 00006A5D 0001020304051407 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 14h, 07h 295 00006A65 38393A3B3C3D3E3F <1> db 38h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh 296 00006A6D 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 297 00006A71 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 298 <1> vga_mode_6Ah: ; mode 6Ah, 800*600, 16 colors, planar 299 <1> ; 11/11/2020 300 00006A7A 6424100000 <1> db 100, 36, 16, 00h, 00h ; tw, th-1, ch, slength 301 00006A7F 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 302 00006A83 E3 <1> db 0E3h ; misc reg 303 00006A84 7F6363836B1B72F0 <1> db 7Fh, 63h, 63h, 83h, 6Bh, 1Bh, 72h, 0F0h 304 00006A8C 0060000000000000 <1> db 00h, 60h, 00h, 00h, 00h, 00h, 00h, 00h 305 00006A94 598D5732005773E3 <1> db 59h, 8Dh, 57h, 32h, 00h, 57h, 73h, 0E3h 306 00006A9C FF <1> db 0FFh ; crtc regs 307 00006A9D 0001020304051407 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 14h, 07h 308 00006AA5 38393A3B3C3D3E3F <1> db 38h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh 309 00006AAD 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 310 00006AB1 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 311 <1> vga_mode_0Dh: ; mode 0Dh, 320*200, 16 colors, planar 312 00006ABA 2818080020 <1> db 40, 24, 8, 00h, 20h ; tw, th-1, ch, slength 313 00006ABF 090F0006 <1> db 09h, 0Fh, 00h, 06h ; sequ regs 314 00006AC3 63 <1> db 63h ; misc reg 315 00006AC4 2D2728902B80BF1F <1> db 2Dh, 27h, 28h, 90h, 2Bh, 80h, 0BFh, 1Fh 316 00006ACC 00C0000000000000 <1> db 00h, 0C0h, 00h, 00h, 00h, 00h, 00h, 00h 317 00006AD4 9C8E8F140096B9E3 <1> db 9Ch, 8Eh, 8Fh, 14h, 00h, 96h, 0B9h, 0E3h 318 00006ADC FF <1> db 0FFh ; crtc regs 319 00006ADD 0001020304050607 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h 320 00006AE5 1011121314151617 <1> db 10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h 321 00006AED 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 322 00006AF1 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 323 <1> vga_mode_0Eh: ; mode 0Eh, 640*200, 16 colors, planar 324 00006AFA 5018080040 <1> db 80, 24, 8, 00h, 40h ; tw, th-1, ch, slength 325 00006AFF 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 326 00006B03 63 <1> db 63h ; misc reg 327 00006B04 5F4F50825480BF1F <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0BFh, 1Fh 328 00006B0C 00C0000000000000 <1> db 00h, 0C0h, 00h, 00h, 00h, 00h, 00h, 00h 329 00006B14 9C8E8F280096B9E3 <1> db 9Ch, 8Eh, 8Fh, 28h, 00h, 96h, 0B9h, 0E3h 330 00006B1C FF <1> db 0FFh ; crtc regs 331 00006B1D 0001020304050607 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h 332 00006B25 1011121314151617 <1> db 10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h 333 00006B2D 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 334 00006B31 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 335 <1> vga_mode_10h: ; mode 10h, 640*350, 16 colors, planar 336 00006B3A 50180E0080 <1> db 80, 24, 14, 00h, 80h ; tw, th-1, ch, slength 337 00006B3F 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 338 00006B43 A3 <1> db 0A3h ; misc reg 339 00006B44 5F4F50825480BF1F <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0BFh, 1Fh 340 00006B4C 0040000000000000 <1> db 00h, 40h, 00h, 00h, 00h, 00h, 00h, 00h 341 00006B54 83855D280F63BAE3 <1> db 83h, 85h, 5Dh, 28h, 0Fh, 63h, 0BAh, 0E3h 342 00006B5C FF <1> db 0FFh ; crtc regs 343 00006B5D 0001020304051407 <1> db 00h, 01h, 02h, 03h, 04h, 05h, 14h, 07h 344 00006B65 38393A3B3C3D3E3F <1> db 38h, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh 345 00006B6D 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 346 00006B71 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 347 <1> vga_mode_11h: ; mode 11h, 640*480, mono color, planar 348 <1> ; 11/11/2020 349 00006B7A 501D1000A0 <1> db 80, 29, 16, 00h, 0A0h ; tw, th-1, ch, slength 350 00006B7F 010F0006 <1> db 01h, 0Fh, 00h, 06h ; sequ regs 351 00006B83 E3 <1> db 0E3h ; misc reg 352 00006B84 5F4F508254800B3E <1> db 5Fh, 4Fh, 50h, 82h, 54h, 80h, 0Bh, 3Eh 353 00006B8C 0040000000000000 <1> db 00h, 40h, 00h, 00h, 00h, 00h, 00h, 00h 354 00006B94 EA8CDF2800E704C3 <1> db 0EAh, 8Ch, 0DFh, 28h, 00h, 0E7h, 04h, 0C3h ; 11/11/2020 355 00006B9C FF <1> db 0FFh ; crtc regs 356 00006B9D 003F003F003F003F <1> db 00h, 3Fh, 00h, 3Fh, 00h, 3Fh, 00h, 3Fh 357 00006BA5 003F003F003F003F <1> db 00h, 3Fh, 00h, 3Fh, 00h, 3Fh, 00h, 3Fh 358 00006BAD 01000F00 <1> db 01h, 00h, 0Fh, 00h ; actl regs 359 00006BB1 000000000000050FFF <1> db 00h, 00h, 00h, 00h, 00h, 00h, 05h, 0Fh, 0FFh ; grdc regs 360 <1> end_of_vga_params: 361 <1> 362 <1> ; /// End Of VIDEO DATA /// 363 <1> 364 <1> ; 23/11/2020 365 <1> ; VBE 2 BOCHS/QEMU emulator extensions 366 <1> ; for TRDOS 386 v2 kernel (video bios) 367 <1> 368 <1> ; vbetables.h by Volker Rupper (02/01/2020) 369 <1> 370 <1> b_vbe_modes: 371 <1> ;/* standard VESA modes */ 372 00006BBA 0001800290010800 <1> dw 100h, 640, 400, 8 373 00006BC2 01018002E0010800 <1> dw 101h, 640, 480, 8 374 00006BCA 0301200358020800 <1> dw 103h, 800, 600, 8 375 00006BD2 0501000400030800 <1> dw 105h, 1024, 768, 8 376 00006BDA 0E014001C8001000 <1> dw 10Eh, 320, 200, 16 377 00006BE2 0F014001C8001800 <1> dw 10Fh, 320, 200, 24 378 00006BEA 11018002E0011000 <1> dw 111h, 640, 480, 16 379 00006BF2 12018002E0011800 <1> dw 112h, 640, 480, 24 380 00006BFA 1401200358021000 <1> dw 114h, 800, 600, 16 381 00006C02 1501200358021800 <1> dw 115h, 800, 600, 24 382 00006C0A 1701000400031000 <1> dw 117h, 1024, 768, 16 383 00006C12 1801000400031800 <1> dw 118h, 1024, 768, 24 384 <1> 385 <1> ;/* BOCHS/PLEX86 'own' mode numbers */ 386 00006C1A 40014001C8002000 <1> dw 140h, 320, 200, 32 387 00006C22 4101800290012000 <1> dw 141h, 640, 400, 32 388 00006C2A 42018002E0012000 <1> dw 142h, 640, 480, 32 389 00006C32 4301200358022000 <1> dw 143h, 800, 600, 32 390 00006C3A 4401000400032000 <1> dw 144h, 1024, 768, 32 391 00006C42 46014001C8000800 <1> dw 146h, 320, 200, 8 392 00006C4A 8D010005D0021000 <1> dw 18Dh, 1280, 720, 16 393 00006C52 8E010005D0021800 <1> dw 18Eh, 1280, 720, 24 394 00006C5A 8F010005D0022000 <1> dw 18Fh, 1280, 720, 32 395 00006C62 9001800738041000 <1> dw 190h, 1920, 1080, 16 396 00006C6A 9101800738041800 <1> dw 191h, 1920, 1080, 24 397 00006C72 9201800738042000 <1> dw 192h, 1920, 1080, 32 398 <1> 399 <1> end_of_b_vbe_modes: 400 <1> 401 <1> MA1 equ VBE_MODE_ATTRIBUTE_SUPPORTED 402 <1> MA2 equ VBE_MODE_ATTRIBUTE_EXTENDED_INFO_AVAILABLE 403 <1> MA3 equ VBE_MODE_ATTRIBUTE_COLOR_MODE 404 <1> MA4 equ VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE 405 <1> MA5 equ VBE_MODE_ATTRIBUTE_GRAPHICS_MODE 406 <1> 407 <1> MODE_ATTRIBUTES equ MA1|MA2|MA3|MA4|MA5 408 <1> 409 <1> WA1 equ VBE_WINDOW_ATTRIBUTE_RELOCATABLE 410 <1> WA2 equ VBE_WINDOW_ATTRIBUTE_READABLE 411 <1> WA3 equ VBE_WINDOW_ATTRIBUTE_WRITEABLE 412 <1> 413 <1> WINA_ATTRIBUTES equ WA1|WA2|WA3 414 <1> 415 <1> ; 24/11/2020 416 <1> 417 <1> %if 0 418 <1> 419 <1> MODE_INFO_LIST: 420 <1> 421 <1> ; 24/11/2020 422 <1> ; '%if 0' disables 24 mode info tables here, until %endif 423 <1> ; ('set_mode_info_list' will set only 1 list for selected mode) 424 <1> ; (Purpose: To save about 1 KB kernel size by removing fixed data) 425 <1> 426 <1> dw 0100h ; 640x400x8 427 <1> ModeAttributes1: dw MODE_ATTRIBUTES 428 <1> WinAAttributes1: db WINA_ATTRIBUTES 429 <1> WinBAttributes1: db 0 430 <1> WinGranularity1: dw VBE_DISPI_BANK_SIZE_KB 431 <1> WinSize1: dw VBE_DISPI_BANK_SIZE_KB 432 <1> WinASegment1: dw VGAMEM_GRAPH 433 <1> WinBSegment1: dw 0000h 434 <1> WinFuncPtr1: dd 0 435 <1> BytesPerScanLine1: dw 640 436 <1> XResolution1: dw 640 437 <1> YResolution1: dw 400 438 <1> XCharSize1: db 8 439 <1> YCharSize1: db 16 440 <1> NumberOfPlanes1: db 1 441 <1> BitsPerPixel1: db 8 442 <1> NumberOfBanks1: db 4 443 <1> MemoryModel1: db VBE_MEMORYMODEL_PACKED_PIXEL 444 <1> BankSize1: db 0 445 <1> NumberOfImagePages1: db 64 446 <1> Reserved_page1: db 0 447 <1> RedMaskSize1: db 0 448 <1> RedFieldPosition1: db 0 449 <1> GreenMaskSize1: db 0 450 <1> GreenFieldPosition1: db 0 451 <1> BlueMaskSize1: db 0 452 <1> BlueFieldPosition1: db 0 453 <1> RsvdMaskSize1: db 0 454 <1> RsvdFieldPosition1: db 0 455 <1> DirectColorModeInfo1: db 0 456 <1> PhysBasePtr1: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 457 <1> OffScreenMemOffset1: dd 0 458 <1> OffScreenMemSize1: dw 0 459 <1> LinBytesPerScanLine1: dw 640 460 <1> BnkNumberOfPages1: db 0 461 <1> LinNumberOfPages1: db 0 462 <1> LinRedMaskSize1: db 0 463 <1> LinRedFieldPosition1: db 0 464 <1> LinGreenMaskSize1: db 0 465 <1> LinGreenFieldPosition1: db 0 466 <1> LinBlueMaskSize1: db 0 467 <1> LinBlueFieldPosition1: db 0 468 <1> LinRsvdMaskSize1: db 0 469 <1> LinRsvdFieldPosition1: db 0 470 <1> MaxPixelClock1: dd 0 471 <1> 472 <1> dw 0101h ; 640x480x8 473 <1> ModeAttributes2: dw MODE_ATTRIBUTES 474 <1> WinAAttributes2: db WINA_ATTRIBUTES 475 <1> WinBAttributes2: db 0 476 <1> WinGranularity2: dw VBE_DISPI_BANK_SIZE_KB 477 <1> WinSize2: dw VBE_DISPI_BANK_SIZE_KB 478 <1> WinASegment2: dw VGAMEM_GRAPH 479 <1> WinBSegment2: dw 0000h 480 <1> WinFuncPtr2: dd 0 481 <1> BytesPerScanLine2: dw 640 482 <1> XResolution2: dw 640 483 <1> YResolution2: dw 480 484 <1> XCharSize2: db 8 485 <1> YCharSize2: db 16 486 <1> NumberOfPlanes2: db 1 487 <1> BitsPerPixel2: db 8 488 <1> NumberOfBanks2: db 5 489 <1> MemoryModel2: db VBE_MEMORYMODEL_PACKED_PIXEL 490 <1> BankSize2: db 0 491 <1> NumberOfImagePages2: db 53 492 <1> Reserved_page2: db 0 493 <1> RedMaskSize2: db 0 494 <1> RedFieldPosition2: db 0 495 <1> GreenMaskSize2: db 0 496 <1> GreenFieldPosition2: db 0 497 <1> BlueMaskSize2: db 0 498 <1> BlueFieldPosition2: db 0 499 <1> RsvdMaskSize2: db 0 500 <1> RsvdFieldPosition2: db 0 501 <1> DirectColorModeInfo2: db 0 502 <1> PhysBasePtr2: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 503 <1> OffScreenMemOffset2: dd 0 504 <1> OffScreenMemSize2: dw 0 505 <1> LinBytesPerScanLine2: dw 640 506 <1> BnkNumberOfPages2: db 0 507 <1> LinNumberOfPages2: db 0 508 <1> LinRedMaskSize2: db 0 509 <1> LinRedFieldPosition2: db 0 510 <1> LinGreenMaskSize2: db 0 511 <1> LinGreenFieldPosition2: db 0 512 <1> LinBlueMaskSize2: db 0 513 <1> LinBlueFieldPosition2: db 0 514 <1> LinRsvdMaskSize2: db 0 515 <1> LinRsvdFieldPosition2: db 0 516 <1> MaxPixelClock2: dd 0 517 <1> 518 <1> dw 0103h ; 800x600x8 519 <1> ModeAttributes3: dw MODE_ATTRIBUTES 520 <1> WinAAttributes3: db WINA_ATTRIBUTES 521 <1> WinBAttributes3: db 0 522 <1> WinGranularity3: dw VBE_DISPI_BANK_SIZE_KB 523 <1> WinSize3: dw VBE_DISPI_BANK_SIZE_KB 524 <1> WinASegment3: dw VGAMEM_GRAPH 525 <1> WinBSegment3: dw 0000h 526 <1> WinFuncPtr3: dd 0 527 <1> BytesPerScanLine3: dw 800 528 <1> XResolution3: dw 800 529 <1> YResolution3: dw 600 530 <1> XCharSize3: db 8 531 <1> YCharSize3: db 16 532 <1> NumberOfPlanes3: db 1 533 <1> BitsPerPixel3: db 8 534 <1> NumberOfBanks3: db 8 535 <1> MemoryModel3: db VBE_MEMORYMODEL_PACKED_PIXEL 536 <1> BankSize3: db 0 537 <1> NumberOfImagePages3: db 33 538 <1> Reserved_page3: db 0 539 <1> RedMaskSize3: db 0 540 <1> RedFieldPosition3: db 0 541 <1> GreenMaskSize3: db 0 542 <1> GreenFieldPosition3: db 0 543 <1> BlueMaskSize3: db 0 544 <1> BlueFieldPosition3: db 0 545 <1> RsvdMaskSize3: db 0 546 <1> RsvdFieldPosition3: db 0 547 <1> DirectColorModeInfo3: db 0 548 <1> PhysBasePtr3: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 549 <1> OffScreenMemOffset3: dd 0 550 <1> OffScreenMemSize3: dw 0 551 <1> LinBytesPerScanLine3: dw 800 552 <1> BnkNumberOfPages3: db 0 553 <1> LinNumberOfPages3: db 0 554 <1> LinRedMaskSize3: db 0 555 <1> LinRedFieldPosition3: db 0 556 <1> LinGreenMaskSize3: db 0 557 <1> LinGreenFieldPosition: db 0 558 <1> LinBlueMaskSize: db 0 559 <1> LinBlueFieldPosition: db 0 560 <1> LinRsvdMaskSize: db 0 561 <1> LinRsvdFieldPosition: db 0 562 <1> MaxPixelClock: dd 0 563 <1> 564 <1> dw 0105h ; 1024x768x8 565 <1> ModeAttributes4: dw MODE_ATTRIBUTES 566 <1> WinAAttributes4: db WINA_ATTRIBUTES 567 <1> WinBAttributes4: db 0 568 <1> WinGranularity4: dw VBE_DISPI_BANK_SIZE_KB 569 <1> WinSize4: dw VBE_DISPI_BANK_SIZE_KB 570 <1> WinASegment4: dw VGAMEM_GRAPH 571 <1> WinBSegment4: dw 0000h 572 <1> WinFuncPtr4: dd 0 573 <1> BytesPerScanLine4: dw 1024 574 <1> XResolution4: dw 1024 575 <1> YResolution4: dw 768 576 <1> XCharSize4: db 8 577 <1> YCharSize4: db 16 578 <1> NumberOfPlanes4: db 1 579 <1> BitsPerPixel4: db 8 580 <1> NumberOfBanks4: db 12 581 <1> MemoryModel4: db VBE_MEMORYMODEL_PACKED_PIXEL 582 <1> BankSize4: db 0 583 <1> NumberOfImagePages4: db 20 584 <1> Reserved_page4: db 0 585 <1> RedMaskSize4: db 0 586 <1> RedFieldPosition4: db 0 587 <1> GreenMaskSize4: db 0 588 <1> GreenFieldPosition4: db 0 589 <1> BlueMaskSize4: db 0 590 <1> BlueFieldPosition4: db 0 591 <1> RsvdMaskSize4: db 0 592 <1> RsvdFieldPosition4: db 0 593 <1> DirectColorModeInfo4: db 0 594 <1> PhysBasePtr4: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 595 <1> OffScreenMemOffset4: dd 0 596 <1> OffScreenMemSize4: dw 0 597 <1> LinBytesPerScanLine4: dw 1024 598 <1> BnkNumberOfPages4: db 0 599 <1> LinNumberOfPages4: db 0 600 <1> LinRedMaskSize4: db 0 601 <1> LinRedFieldPosition4: db 0 602 <1> LinGreenMaskSize4: db 0 603 <1> LinGreenFieldPosition4: db 0 604 <1> LinBlueMaskSize4: db 0 605 <1> LinBlueFieldPosition4: db 0 606 <1> LinRsvdMaskSize4: db 0 607 <1> LinRsvdFieldPosition4: db 0 608 <1> MaxPixelClock4: dd 0 609 <1> 610 <1> dw 010Eh ; 320x200x16 611 <1> ModeAttributes5: dw MODE_ATTRIBUTES 612 <1> WinAAttributes5: db WINA_ATTRIBUTES 613 <1> WinBAttributes5: db 0 614 <1> WinGranularity5: dw VBE_DISPI_BANK_SIZE_KB 615 <1> WinSize5: dw VBE_DISPI_BANK_SIZE_KB 616 <1> WinASegment5: dw VGAMEM_GRAPH 617 <1> WinBSegment5: dw 0000h 618 <1> WinFuncPtr5: dd 0 619 <1> BytesPerScanLine5: dw 640 620 <1> XResolution5: dw 320 621 <1> YResolution5: dw 200 622 <1> XCharSize5: db 8 623 <1> YCharSize5: db 16 624 <1> NumberOfPlanes5: db 1 625 <1> BitsPerPixel5: db 16 626 <1> NumberOfBanks5: db 2 627 <1> MemoryModel5: db VBE_MEMORYMODEL_DIRECT_COLOR 628 <1> BankSize5: db 0 629 <1> NumberOfImagePages5: db 130 630 <1> Reserved_page5: db 0 631 <1> RedMaskSize5: db 5 632 <1> RedFieldPosition5: db 11 633 <1> GreenMaskSize5: db 6 634 <1> GreenFieldPosition5: db 5 635 <1> BlueMaskSize5: db 5 636 <1> BlueFieldPosition5: db 0 637 <1> RsvdMaskSize5: db 0 638 <1> RsvdFieldPosition5: db 0 639 <1> DirectColorModeInfo5: db 0 640 <1> PhysBasePtr5: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 641 <1> OffScreenMemOffset5: dd 0 642 <1> OffScreenMemSize5: dw 0 643 <1> LinBytesPerScanLine5: dw 640 644 <1> BnkNumberOfPages5: db 0 645 <1> LinNumberOfPages5: db 0 646 <1> LinRedMaskSize5: db 5 647 <1> LinRedFieldPosition5: db 11 648 <1> LinGreenMaskSize5: db 6 649 <1> LinGreenFieldPosition5: db 5 650 <1> LinBlueMaskSize5: db 5 651 <1> LinBlueFieldPosition5: db 0 652 <1> LinRsvdMaskSize5: db 0 653 <1> LinRsvdFieldPosition5: db 0 654 <1> MaxPixelClock5: dd 0 655 <1> 656 <1> dw 010Fh ; 320x200x24 657 <1> ModeAttributes6: dw MODE_ATTRIBUTES 658 <1> WinAAttributes6: db WINA_ATTRIBUTES 659 <1> WinBAttributes6: db 0 660 <1> WinGranularity6: dw VBE_DISPI_BANK_SIZE_KB 661 <1> WinSize6: dw VBE_DISPI_BANK_SIZE_KB 662 <1> WinASegment6: dw VGAMEM_GRAPH 663 <1> WinBSegment6: dw 0000h 664 <1> WinFuncPtr6: dd 0 665 <1> BytesPerScanLine6: dw 960 666 <1> XResolution6: dw 320 667 <1> YResolution6: dw 200 668 <1> XCharSize6: db 8 669 <1> YCharSize6: db 16 670 <1> NumberOfPlanes6: db 1 671 <1> BitsPerPixel6: db 24 672 <1> NumberOfBanks6: db 3 673 <1> MemoryModel6: db VBE_MEMORYMODEL_DIRECT_COLOR 674 <1> BankSize6: db 0 675 <1> NumberOfImagePages6: db 86 676 <1> Reserved_page6: db 0 677 <1> RedMaskSize6: db 8 678 <1> RedFieldPosition6: db 16 679 <1> GreenMaskSize6: db 8 680 <1> GreenFieldPosition6: db 8 681 <1> BlueMaskSize6: db 8 682 <1> BlueFieldPosition6: db 0 683 <1> RsvdMaskSize6: db 0 684 <1> RsvdFieldPosition6: db 0 685 <1> DirectColorModeInfo6: db 0 686 <1> PhysBasePtr6: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 687 <1> OffScreenMemOffset6: dd 0 688 <1> OffScreenMemSize6: dw 0 689 <1> LinBytesPerScanLine6: dw 960 690 <1> BnkNumberOfPages6: db 0 691 <1> LinNumberOfPages6: db 0 692 <1> LinRedMaskSize6: db 8 693 <1> LinRedFieldPosition6: db 16 694 <1> LinGreenMaskSize6: db 8 695 <1> LinGreenFieldPosition6: db 8 696 <1> LinBlueMaskSize6: db 8 697 <1> LinBlueFieldPosition6: db 0 698 <1> LinRsvdMaskSize6: db 0 699 <1> LinRsvdFieldPosition6: db 0 700 <1> MaxPixelClock6: dd 0 701 <1> 702 <1> dw 0111h ; 640x480x16 703 <1> ModeAttributes7: dw MODE_ATTRIBUTES 704 <1> WinAAttributes7: db WINA_ATTRIBUTES 705 <1> WinBAttributes7: db 0 706 <1> WinGranularity7: dw VBE_DISPI_BANK_SIZE_KB 707 <1> WinSize7: dw VBE_DISPI_BANK_SIZE_KB 708 <1> WinASegment7: dw VGAMEM_GRAPH 709 <1> WinBSegment7: dw 0000h 710 <1> WinFuncPtr7: dd 0 711 <1> BytesPerScanLine7: dw 1280 712 <1> XResolution7: dw 640 713 <1> YResolution7: dw 480 714 <1> XCharSize7: db 8 715 <1> YCharSize7: db 16 716 <1> NumberOfPlanes7: db 1 717 <1> BitsPerPixel7: db 16 718 <1> NumberOfBanks7: db 10 719 <1> MemoryModel7: db VBE_MEMORYMODEL_DIRECT_COLOR 720 <1> BankSize7: db 0 721 <1> NumberOfImagePages7: db 26 722 <1> Reserved_page7: db 0 723 <1> RedMaskSize7: db 5 724 <1> RedFieldPosition7: db 11 725 <1> GreenMaskSize7: db 6 726 <1> GreenFieldPosition7: db 5 727 <1> BlueMaskSize7: db 5 728 <1> BlueFieldPosition7: db 0 729 <1> RsvdMaskSize7: db 0 730 <1> RsvdFieldPosition7: db 0 731 <1> DirectColorModeInfo7: db 0 732 <1> PhysBasePtr7: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS, 733 <1> OffScreenMemOffset7: dd 0 734 <1> OffScreenMemSize7: dw 0 735 <1> LinBytesPerScanLine7: dw 1280 736 <1> BnkNumberOfPages7: db 0 737 <1> LinNumberOfPages7: db 0 738 <1> LinRedMaskSize7: db 5 739 <1> LinRedFieldPosition7: db 11 740 <1> LinGreenMaskSize7: db 6 741 <1> LinGreenFieldPosition7: db 5 742 <1> LinBlueMaskSize7: db 5 743 <1> LinBlueFieldPosition7: db 0 744 <1> LinRsvdMaskSize7: db 0 745 <1> LinRsvdFieldPosition7: db 0 746 <1> MaxPixelClock7: dd 0 747 <1> 748 <1> dw 0112h ; 640x480x24 749 <1> ModeAttributes8: dw MODE_ATTRIBUTES 750 <1> WinAAttributes8: db WINA_ATTRIBUTES 751 <1> WinBAttributes8: db 0 752 <1> WinGranularity8: dw VBE_DISPI_BANK_SIZE_KB 753 <1> WinSize8: dw VBE_DISPI_BANK_SIZE_KB 754 <1> WinASegment8: dw VGAMEM_GRAPH 755 <1> WinBSegment8: dw 0000h 756 <1> WinFuncPtr8: dd 0 757 <1> BytesPerScanLine8: dw 1920 758 <1> XResolution8: dw 640 759 <1> YResolution8: dw 480 760 <1> XCharSize8: db 8 761 <1> YCharSize8: db 16 762 <1> NumberOfPlanes8: db 1 763 <1> BitsPerPixel8: db 24 764 <1> NumberOfBanks8: db 15 765 <1> MemoryModel8: db VBE_MEMORYMODEL_DIRECT_COLOR 766 <1> BankSize8: db 0 767 <1> NumberOfImagePages8: db 17 768 <1> Reserved_page8: db 0 769 <1> RedMaskSize8: db 8 770 <1> RedFieldPosition8: db 16 771 <1> GreenMaskSize8: db 8 772 <1> GreenFieldPosition8: db 8 773 <1> BlueMaskSize8: db 8 774 <1> BlueFieldPosition8: db 0 775 <1> RsvdMaskSize8: db 0 776 <1> RsvdFieldPosition8: db 0 777 <1> DirectColorModeInfo8: db 0 778 <1> PhysBasePtr8: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 779 <1> OffScreenMemOffset8: dd 0 780 <1> OffScreenMemSize8: dw 0 781 <1> LinBytesPerScanLine8: dw 1920 782 <1> BnkNumberOfPages8: db 0 783 <1> LinNumberOfPages8: db 0 784 <1> LinRedMaskSize8: db 8 785 <1> LinRedFieldPosition8: db 16 786 <1> LinGreenMaskSize8: db 8 787 <1> LinGreenFieldPosition8: db 8 788 <1> LinBlueMaskSize8: db 8 789 <1> LinBlueFieldPosition8: db 0 790 <1> LinRsvdMaskSize8: db 0 791 <1> LinRsvdFieldPosition8: db 0 792 <1> MaxPixelClock8: dd 0 793 <1> 794 <1> dw 0114h ; 800x600x16 795 <1> ModeAttributes9: dw MODE_ATTRIBUTES 796 <1> WinAAttributes9: db WINA_ATTRIBUTES 797 <1> WinBAttributes9: db 0 798 <1> WinGranularity9: dw VBE_DISPI_BANK_SIZE_KB 799 <1> WinSize9: dw VBE_DISPI_BANK_SIZE_KB 800 <1> WinASegment9: dw VGAMEM_GRAPH 801 <1> WinBSegment9: dw 0000h 802 <1> WinFuncPtr9: dd 0 803 <1> BytesPerScanLine9: dw 1600 804 <1> XResolution9: dw 800 805 <1> YResolution9: dw 600 806 <1> XCharSize9: db 8 807 <1> YCharSize9: db 16 808 <1> NumberOfPlanes9: db 1 809 <1> BitsPerPixel9: db 16 810 <1> NumberOfBanks9: db 15 811 <1> MemoryModel9: db VBE_MEMORYMODEL_DIRECT_COLOR 812 <1> BankSize9: db 0 813 <1> NumberOfImagePages9: db 16 814 <1> Reserved_page9: db 0 815 <1> RedMaskSize9: db 5 816 <1> RedFieldPosition9: db 11 817 <1> GreenMaskSize9: db 6 818 <1> GreenFieldPosition9: db 5 819 <1> BlueMaskSize9: db 5 820 <1> BlueFieldPosition9: db 0 821 <1> RsvdMaskSize9: db 0 822 <1> RsvdFieldPosition9: db 0 823 <1> DirectColorModeInfo9: db 0 824 <1> PhysBasePtr9: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 825 <1> OffScreenMemOffset9: dd 0 826 <1> OffScreenMemSize9: dw 0 827 <1> LinBytesPerScanLine9: dw 1600 828 <1> BnkNumberOfPages9: db 0 829 <1> LinNumberOfPages9: db 0 830 <1> LinRedMaskSize9: db 5 831 <1> LinRedFieldPosition9: db 11 832 <1> LinGreenMaskSize9: db 6 833 <1> LinGreenFieldPosition9: db 5 834 <1> LinBlueMaskSize9: db 5 835 <1> LinBlueFieldPosition9: db 0 836 <1> LinRsvdMaskSize9: db 0 837 <1> LinRsvdFieldPosition9: db 0 838 <1> MaxPixelClock9: dd 0 839 <1> 840 <1> dw 0115h ; 800x600x24 841 <1> ModeAttributes10: dw MODE_ATTRIBUTES 842 <1> WinAAttributes10: db WINA_ATTRIBUTES 843 <1> WinBAttributes10: db 0 844 <1> WinGranularity10: dw VBE_DISPI_BANK_SIZE_KB 845 <1> WinSize10: dw VBE_DISPI_BANK_SIZE_KB 846 <1> WinASegment10: dw VGAMEM_GRAPH 847 <1> WinBSegment10: dw 0000h 848 <1> WinFuncPtr10: dd 0 849 <1> BytesPerScanLine10: dw 2400 850 <1> XResolution10: dw 800 851 <1> YResolution10: dw 600 852 <1> XCharSize10: db 8 853 <1> YCharSize10: db 16 854 <1> NumberOfPlanes10: db 1 855 <1> BitsPerPixel10: db 24 856 <1> NumberOfBanks10: db 22 857 <1> MemoryModel10: db VBE_MEMORYMODEL_DIRECT_COLOR 858 <1> BankSize10: db 0 859 <1> NumberOfImagePages10: db 10 860 <1> Reserved_page10: db 0 861 <1> RedMaskSize10: db 8 862 <1> RedFieldPosition10: db 16 863 <1> GreenMaskSize10: db 8 864 <1> GreenFieldPosition10: db 8 865 <1> BlueMaskSize10: db 8 866 <1> BlueFieldPosition10: db 0 867 <1> RsvdMaskSize10: db 0 868 <1> RsvdFieldPosition10: db 0 869 <1> DirectColorModeInfo10: db 0 870 <1> PhysBasePtr10: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 871 <1> OffScreenMemOffset10: dd 0 872 <1> OffScreenMemSize10: dw 0 873 <1> LinBytesPerScanLine10: dw 2400 874 <1> BnkNumberOfPages10: db 0 875 <1> LinNumberOfPages10: db 0 876 <1> LinRedMaskSize10: db 8 877 <1> LinRedFieldPosition10: db 16 878 <1> LinGreenMaskSize10: db 8 879 <1> LinGreenFieldPosition10:db 8 880 <1> LinBlueMaskSize10: db 8 881 <1> LinBlueFieldPosition10: db 0 882 <1> LinRsvdMaskSize10: db 0 883 <1> LinRsvdFieldPosition10: db 0 884 <1> MaxPixelClock10: dd 0 885 <1> 886 <1> dw 0117h ; 1024x768x16 887 <1> ModeAttributes11: dw MODE_ATTRIBUTES 888 <1> WinAAttributes11: db WINA_ATTRIBUTES 889 <1> WinBAttributes11: db 0 890 <1> WinGranularity11: dw VBE_DISPI_BANK_SIZE_KB 891 <1> WinSize11: dw VBE_DISPI_BANK_SIZE_KB 892 <1> WinASegment11: dw VGAMEM_GRAPH 893 <1> WinBSegment11: dw 0000h 894 <1> WinFuncPtr11: dd 0 895 <1> BytesPerScanLine11: dw 2048 896 <1> XResolution11: dw 1024 897 <1> YResolution11: dw 768 898 <1> XCharSize11: db 8 899 <1> YCharSize11: db 16 900 <1> NumberOfPlanes11: db 1 901 <1> BitsPerPixel11: db 16 902 <1> NumberOfBanks11: db 24 903 <1> MemoryModel11: db VBE_MEMORYMODEL_DIRECT_COLOR 904 <1> BankSize11: db 0 905 <1> NumberOfImagePages11: db 9 906 <1> Reserved_page11: db 0 907 <1> RedMaskSize11: db 5 908 <1> RedFieldPosition11: db 11 909 <1> GreenMaskSize11: db 6 910 <1> GreenFieldPosition11: db 5 911 <1> BlueMaskSize11: db 5 912 <1> BlueFieldPosition11: db 0 913 <1> RsvdMaskSize11: db 0 914 <1> RsvdFieldPosition11: db 0 915 <1> DirectColorModeInfo11: db 0 916 <1> PhysBasePtr11: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS, 917 <1> OffScreenMemOffset11: dd 0 918 <1> OffScreenMemSize11: dw 0 919 <1> LinBytesPerScanLine11: dw 2048 920 <1> BnkNumberOfPages11: db 0 921 <1> LinNumberOfPages11: db 0 922 <1> LinRedMaskSize11: db 5 923 <1> LinRedFieldPosition11: db 11 924 <1> LinGreenMaskSize11: db 6 925 <1> LinGreenFieldPosition11:db 5 926 <1> LinBlueMaskSize11: db 5 927 <1> LinBlueFieldPosition11: db 0 928 <1> LinRsvdMaskSize11: db 0 929 <1> LinRsvdFieldPosition11: db 0 930 <1> MaxPixelClock11: dd 0 931 <1> 932 <1> dw 0118h ; 1024x768x24 933 <1> ModeAttributes12: dw MODE_ATTRIBUTES 934 <1> WinAAttributes12: db WINA_ATTRIBUTES 935 <1> WinBAttributes12: db 0 936 <1> WinGranularity12: dw VBE_DISPI_BANK_SIZE_KB 937 <1> WinSize12: dw VBE_DISPI_BANK_SIZE_KB 938 <1> WinASegment12: dw VGAMEM_GRAPH 939 <1> WinBSegment12: dw 0000h 940 <1> WinFuncPtr12: dd 0 941 <1> BytesPerScanLine12: dw 3072 942 <1> XResolution12: dw 1024 943 <1> YResolution12: dw 768 944 <1> XCharSize12: db 8 945 <1> YCharSize12: db 16 946 <1> NumberOfPlanes12: db 1 947 <1> BitsPerPixel12: db 24 948 <1> NumberOfBanks12: db 36 949 <1> MemoryModel12: db VBE_MEMORYMODEL_DIRECT_COLOR 950 <1> BankSize12: db 0 951 <1> NumberOfImagePages12: db 6 952 <1> Reserved_page12: db 0 953 <1> RedMaskSize12: db 8 954 <1> RedFieldPosition12: db 16 955 <1> GreenMaskSize12: db 8 956 <1> GreenFieldPosition12: db 8 957 <1> BlueMaskSize12: db 8 958 <1> BlueFieldPosition12: db 0 959 <1> RsvdMaskSize12: db 0 960 <1> RsvdFieldPosition12: db 0 961 <1> DirectColorModeInfo12: db 0 962 <1> PhysBasePtr12: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 963 <1> OffScreenMemOffset12: dd 0 964 <1> OffScreenMemSize12: dw 0 965 <1> LinBytesPerScanLine12: dw 3072 966 <1> BnkNumberOfPages12: db 0 967 <1> LinNumberOfPages12: db 0 968 <1> LinRedMaskSize12: db 8 969 <1> LinRedFieldPosition12: db 16 970 <1> LinGreenMaskSize12: db 8 971 <1> LinGreenFieldPosition12:db 8 972 <1> LinBlueMaskSize12: db 8 973 <1> LinBlueFieldPosition12: db 0 974 <1> LinRsvdMaskSize12: db 0 975 <1> LinRsvdFieldPosition12: db 0 976 <1> MaxPixelClock12: dd 0 977 <1> 978 <1> dw 0140h ; 320x200x32 979 <1> ModeAttributes13: dw MODE_ATTRIBUTES 980 <1> WinAAttributes13: db WINA_ATTRIBUTES 981 <1> WinBAttributes13: db 0 982 <1> WinGranularity13: dw VBE_DISPI_BANK_SIZE_KB 983 <1> WinSize13: dw VBE_DISPI_BANK_SIZE_KB 984 <1> WinASegment13: dw VGAMEM_GRAPH 985 <1> WinBSegment13: dw 0000h 986 <1> WinFuncPtr13: dd 0 987 <1> BytesPerScanLine13: dw 1280 988 <1> XResolution13: dw 320 989 <1> YResolution13: dw 200 990 <1> XCharSize13: db 8 991 <1> YCharSize13: db 16 992 <1> NumberOfPlanes13: db 1 993 <1> BitsPerPixel13: db 32 994 <1> NumberOfBanks13: db 4 995 <1> MemoryModel13: db VBE_MEMORYMODEL_DIRECT_COLOR 996 <1> BankSize13: db 0 997 <1> NumberOfImagePages13: db 64 998 <1> Reserved_page13: db 0 999 <1> RedMaskSize13: db 8 1000 <1> RedFieldPosition13: db 16 1001 <1> GreenMaskSize13: db 8 1002 <1> GreenFieldPosition13: db 8 1003 <1> BlueMaskSize13: db 8 1004 <1> BlueFieldPosition13: db 0 1005 <1> RsvdMaskSize13: db 8 1006 <1> RsvdFieldPosition13: db 24 1007 <1> DirectColorModeInfo13: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 1008 <1> PhysBasePtr13: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1009 <1> OffScreenMemOffset13: dd 0 1010 <1> OffScreenMemSize13: dw 0 1011 <1> LinBytesPerScanLine13: dw 1280 1012 <1> BnkNumberOfPages13: db 0 1013 <1> LinNumberOfPages13: db 0 1014 <1> LinRedMaskSize13: db 8 1015 <1> LinRedFieldPosition13: db 16 1016 <1> LinGreenMaskSize13: db 8 1017 <1> LinGreenFieldPosition13:db 8 1018 <1> LinBlueMaskSize13: db 8 1019 <1> LinBlueFieldPosition13: db 0 1020 <1> LinRsvdMaskSize13: db 8 1021 <1> LinRsvdFieldPosition13: db 24 1022 <1> MaxPixelClock13: dd 0 1023 <1> 1024 <1> dw 0141h ; 640x400x32 1025 <1> ModeAttributes14: dw MODE_ATTRIBUTES 1026 <1> WinAAttributes14: db WINA_ATTRIBUTES 1027 <1> WinBAttributes14: db 0 1028 <1> WinGranularity14: dw VBE_DISPI_BANK_SIZE_KB 1029 <1> WinSize14: dw VBE_DISPI_BANK_SIZE_KB 1030 <1> WinASegment14: dw VGAMEM_GRAPH 1031 <1> WinBSegment14: dw 0000h 1032 <1> WinFuncPtr14: dd 0 1033 <1> BytesPerScanLine14: dw 2560 1034 <1> XResolution14: dw 640 1035 <1> YResolution14: dw 400 1036 <1> XCharSize14: db 8 1037 <1> YCharSize14: db 16 1038 <1> NumberOfPlanes14: db 1 1039 <1> BitsPerPixel14: db 32 1040 <1> NumberOfBanks14: db 16 1041 <1> MemoryModel14: db VBE_MEMORYMODEL_DIRECT_COLOR 1042 <1> BankSize14: db 0 1043 <1> NumberOfImagePages14: db 15 1044 <1> Reserved_page14: db 0 1045 <1> RedMaskSize14: db 8 1046 <1> RedFieldPosition14: db 16 1047 <1> GreenMaskSize14: db 8 1048 <1> GreenFieldPosition14: db 8 1049 <1> BlueMaskSize14: db 8 1050 <1> BlueFieldPosition14: db 0 1051 <1> RsvdMaskSize14: db 8 1052 <1> RsvdFieldPosition14: db 24 1053 <1> DirectColorModeInfo14: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 1054 <1> PhysBasePtr14: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1055 <1> OffScreenMemOffset14: dd 0 1056 <1> OffScreenMemSize14: dw 0 1057 <1> LinBytesPerScanLine14: dw 2560 1058 <1> BnkNumberOfPages14: db 0 1059 <1> LinNumberOfPages14: db 0 1060 <1> LinRedMaskSize14: db 8 1061 <1> LinRedFieldPosition14: db 16 1062 <1> LinGreenMaskSize14: db 8 1063 <1> LinGreenFieldPosition14:db 8 1064 <1> LinBlueMaskSize14: db 8 1065 <1> LinBlueFieldPosition14: db 0 1066 <1> LinRsvdMaskSize14: db 8 1067 <1> LinRsvdFieldPosition14: db 24 1068 <1> MaxPixelClock14: dd 0 1069 <1> 1070 <1> dw 0142 ; 640x480x32 1071 <1> ModeAttributes15: dw MODE_ATTRIBUTES 1072 <1> WinAAttributes15: db WINA_ATTRIBUTES 1073 <1> WinBAttributes15: db 0 1074 <1> WinGranularity15: dw VBE_DISPI_BANK_SIZE_KB 1075 <1> WinSize15: dw VBE_DISPI_BANK_SIZE_KB 1076 <1> WinASegment15: dw VGAMEM_GRAPH 1077 <1> WinBSegment15: dw 0000h 1078 <1> WinFuncPtr15: dd 0 1079 <1> BytesPerScanLine15: dw 2560 1080 <1> XResolution15: dw 640 1081 <1> YResolution15: dw 480 1082 <1> XCharSize15: db 8 1083 <1> YCharSize15: db 16 1084 <1> NumberOfPlanes15: db 1 1085 <1> BitsPerPixel15: db 32 1086 <1> NumberOfBanks15: db 19 1087 <1> MemoryModel15: db VBE_MEMORYMODEL_DIRECT_COLOR 1088 <1> BankSize15: db 0 1089 <1> NumberOfImagePages15: db 12 1090 <1> Reserved_page15: db 0 1091 <1> RedMaskSize15: db 8 1092 <1> RedFieldPosition15: db 16 1093 <1> GreenMaskSize15: db 8 1094 <1> GreenFieldPosition15: db 8 1095 <1> BlueMaskSize15: db 8 1096 <1> BlueFieldPosition15: db 0 1097 <1> RsvdMaskSize15: db 8 1098 <1> RsvdFieldPosition15: db 24 1099 <1> DirectColorModeInfo15: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE, 1100 <1> PhysBasePtr15: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS, 1101 <1> OffScreenMemOffset15: dd 0 1102 <1> OffScreenMemSize15: dw 0 1103 <1> LinBytesPerScanLine15: dw 2560 1104 <1> BnkNumberOfPages15: db 0 1105 <1> LinNumberOfPages15: db 0 1106 <1> LinRedMaskSize15: db 8 1107 <1> LinRedFieldPosition15: db 16 1108 <1> LinGreenMaskSize15: db 8 1109 <1> LinGreenFieldPosition15:db 8 1110 <1> LinBlueMaskSize15: db 8 1111 <1> LinBlueFieldPosition15: db 0 1112 <1> LinRsvdMaskSize15: db 8 1113 <1> LinRsvdFieldPosition15: db 24 1114 <1> MaxPixelClock15: dd 0 1115 <1> 1116 <1> dw 0143h ; 800x600x32 1117 <1> ModeAttributes16: dw MODE_ATTRIBUTES 1118 <1> WinAAttributes16: db WINA_ATTRIBUTES 1119 <1> WinBAttributes16: db 0 1120 <1> WinGranularity16: dw VBE_DISPI_BANK_SIZE_KB 1121 <1> WinSize16: dw VBE_DISPI_BANK_SIZE_KB 1122 <1> WinASegment16: dw VGAMEM_GRAPH 1123 <1> WinBSegment16: dw 0000h 1124 <1> WinFuncPtr16: dd 0 1125 <1> BytesPerScanLine16: dw 3200 1126 <1> XResolution16: dw 800 1127 <1> YResolution16: dw 600 1128 <1> XCharSize16: db 8 1129 <1> YCharSize16: db 16 1130 <1> NumberOfPlanes16: db 1 1131 <1> BitsPerPixel16: db 32 1132 <1> NumberOfBanks16: db 30 1133 <1> MemoryModel16: db VBE_MEMORYMODEL_DIRECT_COLOR 1134 <1> BankSize16: db 0 1135 <1> NumberOfImagePages16: db 7 1136 <1> Reserved_page16: db 0 1137 <1> RedMaskSize16: db 8 1138 <1> RedFieldPosition16: db 16 1139 <1> GreenMaskSize16: db 8 1140 <1> GreenFieldPosition16: db 8 1141 <1> BlueMaskSize16: db 8 1142 <1> BlueFieldPosition16: db 0 1143 <1> RsvdMaskSize16: db 8 1144 <1> RsvdFieldPosition16: db 24 1145 <1> DirectColorModeInfo16: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE, 1146 <1> PhysBasePtr16: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS, 1147 <1> OffScreenMemOffset16: dd 0 1148 <1> OffScreenMemSize16: dw 0 1149 <1> LinBytesPerScanLine16: dw 3200 1150 <1> BnkNumberOfPages16: db 0 1151 <1> LinNumberOfPages16: db 0 1152 <1> LinRedMaskSize16: db 8 1153 <1> LinRedFieldPosition16: db 16 1154 <1> LinGreenMaskSize16: db 8 1155 <1> LinGreenFieldPosition16:db 8 1156 <1> LinBlueMaskSize16: db 8 1157 <1> LinBlueFieldPosition16: db 0 1158 <1> LinRsvdMaskSize16: db 8 1159 <1> LinRsvdFieldPosition16: db 24 1160 <1> MaxPixelClock16: dd 0 1161 <1> 1162 <1> dw 0144h ; 1024x768x32 1163 <1> ModeAttributes17: dw MODE_ATTRIBUTES 1164 <1> WinAAttributes17: db WINA_ATTRIBUTES 1165 <1> WinBAttributes17: db 0 1166 <1> WinGranularity17: dw VBE_DISPI_BANK_SIZE_KB 1167 <1> WinSize17: dw VBE_DISPI_BANK_SIZE_KB 1168 <1> WinASegment17: dw VGAMEM_GRAPH 1169 <1> WinBSegment17: dw 0000h 1170 <1> WinFuncPtr17: dd 0 1171 <1> BytesPerScanLine17: dw 4096 1172 <1> XResolution17: dw 1024 1173 <1> YResolution17: dw 768 1174 <1> XCharSize17: db 8 1175 <1> YCharSize17: db 16 1176 <1> NumberOfPlanes17: db 1 1177 <1> BitsPerPixel17: db 32 1178 <1> NumberOfBanks17: db 48 1179 <1> MemoryModel17: db VBE_MEMORYMODEL_DIRECT_COLOR 1180 <1> BankSize17: db 0 1181 <1> NumberOfImagePages17: db 4 1182 <1> Reserved_page17: db 0 1183 <1> RedMaskSize17: db 8 1184 <1> RedFieldPosition17: db 16 1185 <1> GreenMaskSize17: db 8 1186 <1> GreenFieldPosition17: db 8 1187 <1> BlueMaskSize17: db 8 1188 <1> BlueFieldPosition17: db 0 1189 <1> RsvdMaskSize17: db 8 1190 <1> RsvdFieldPosition17: db 24 1191 <1> DirectColorModeInfo17: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 1192 <1> PhysBasePtr17: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1193 <1> OffScreenMemOffset17: dd 0 1194 <1> OffScreenMemSize17: dw 0 1195 <1> LinBytesPerScanLine17: dw 4096 1196 <1> BnkNumberOfPages17: db 0 1197 <1> LinNumberOfPages17: db 0 1198 <1> LinRedMaskSize17: db 8 1199 <1> LinRedFieldPosition17: db 16 1200 <1> LinGreenMaskSize17: db 8 1201 <1> LinGreenFieldPosition17:db 8 1202 <1> LinBlueMaskSize17: db 8 1203 <1> LinBlueFieldPosition17: db 0 1204 <1> LinRsvdMaskSize17: db 8 1205 <1> LinRsvdFieldPosition17: db 24 1206 <1> MaxPixelClock17: dd 0 1207 <1> 1208 <1> dw 0146h ; 320x200x8 1209 <1> ModeAttributes18: dw MODE_ATTRIBUTES 1210 <1> WinAAttributes18: db WINA_ATTRIBUTES 1211 <1> WinBAttributes18: db 0 1212 <1> WinGranularity18: dw VBE_DISPI_BANK_SIZE_KB 1213 <1> WinSize18: dw VBE_DISPI_BANK_SIZE_KB 1214 <1> WinASegment18: dw VGAMEM_GRAPH 1215 <1> WinBSegment18: dw 0000h 1216 <1> WinFuncPtr18: dd 0 1217 <1> BytesPerScanLine18: dw 320 1218 <1> XResolution18: dw 320 1219 <1> YResolution18: dw 200 1220 <1> XCharSize18: db 8 1221 <1> YCharSize18: db 16 1222 <1> NumberOfPlanes18: db 1 1223 <1> BitsPerPixel18: db 8 1224 <1> NumberOfBanks18: db 1 1225 <1> MemoryModel18: db VBE_MEMORYMODEL_PACKED_PIXEL 1226 <1> BankSize18: db 0 1227 <1> NumberOfImagePages18: db 255 ; 261 in vbetables.h (03/01/2020) ! 1228 <1> Reserved_page18: db 0 1229 <1> RedMaskSize18: db 0 1230 <1> RedFieldPosition18: db 0 1231 <1> GreenMaskSize18: db 0 1232 <1> GreenFieldPosition18: db 0 1233 <1> BlueMaskSize18: db 0 1234 <1> BlueFieldPosition18: db 0 1235 <1> RsvdMaskSize18: db 0 1236 <1> RsvdFieldPosition18: db 0 1237 <1> DirectColorModeInfo18: db 0 1238 <1> PhysBasePtr18: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1239 <1> OffScreenMemOffset18: dd 0 1240 <1> OffScreenMemSize18: dw 0 1241 <1> LinBytesPerScanLine18: dw 320 1242 <1> BnkNumberOfPages18: db 0 1243 <1> LinNumberOfPages18: db 0 1244 <1> LinRedMaskSize18: db 0 1245 <1> LinRedFieldPosition18: db 0 1246 <1> LinGreenMaskSize18: db 0 1247 <1> LinGreenFieldPosition18:db 0 1248 <1> LinBlueMaskSize18: db 0 1249 <1> LinBlueFieldPosition18: db 0 1250 <1> LinRsvdMaskSize18: db 0 1251 <1> LinRsvdFieldPosition18: db 0 1252 <1> MaxPixelClock18: dd 0 1253 <1> 1254 <1> dw 018Dh ; 1280x720x16 1255 <1> ModeAttributes19: dw MODE_ATTRIBUTES 1256 <1> WinAAttributes19: db WINA_ATTRIBUTES 1257 <1> WinBAttributes19: db 0 1258 <1> WinGranularity19: dw VBE_DISPI_BANK_SIZE_KB 1259 <1> WinSize19: dw VBE_DISPI_BANK_SIZE_KB 1260 <1> WinASegment19: dw VGAMEM_GRAPH 1261 <1> WinBSegment19: dw 0000h 1262 <1> WinFuncPtr19: dd 0 1263 <1> BytesPerScanLine19: dw 2560 1264 <1> XResolution19: dw 1280 1265 <1> YResolution19: dw 720 1266 <1> XCharSize19: db 8 1267 <1> YCharSize19: db 16 1268 <1> NumberOfPlanes19: db 1 1269 <1> BitsPerPixel19: db 16 1270 <1> NumberOfBanks19: db 29 1271 <1> MemoryModel19: db VBE_MEMORYMODEL_DIRECT_COLOR 1272 <1> BankSize19: db 0 1273 <1> NumberOfImagePages19: db 8 1274 <1> Reserved_page19: db 0 1275 <1> RedMaskSize19: db 5 1276 <1> RedFieldPosition19: db 11 1277 <1> GreenMaskSize19: db 6 1278 <1> GreenFieldPosition19: db 5 1279 <1> BlueMaskSize19: db 5 1280 <1> BlueFieldPosition19: db 0 1281 <1> RsvdMaskSize19: db 0 1282 <1> RsvdFieldPosition19: db 0 1283 <1> DirectColorModeInfo19: db 0 1284 <1> PhysBasePtr19: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1285 <1> OffScreenMemOffset19: dd 0 1286 <1> OffScreenMemSize19: dw 0 1287 <1> LinBytesPerScanLine19: dw 2560 1288 <1> BnkNumberOfPages19: db 0 1289 <1> LinNumberOfPages19: db 0 1290 <1> LinRedMaskSize19: db 5 1291 <1> LinRedFieldPosition19: db 11 1292 <1> LinGreenMaskSize19: db 6 1293 <1> LinGreenFieldPosition19:db 5 1294 <1> LinBlueMaskSize19: db 5 1295 <1> LinBlueFieldPosition19: db 0 1296 <1> LinRsvdMaskSize19: db 0 1297 <1> LinRsvdFieldPosition19: db 0 1298 <1> MaxPixelClock19: dd 0 1299 <1> 1300 <1> dw 018Eh ; 1280x720x24 1301 <1> ModeAttributes20: dw MODE_ATTRIBUTES 1302 <1> WinAAttributes20: db WINA_ATTRIBUTES 1303 <1> WinBAttributes20: db 0 1304 <1> WinGranularity20: dw VBE_DISPI_BANK_SIZE_KB 1305 <1> WinSize20: dw VBE_DISPI_BANK_SIZE_KB 1306 <1> WinASegment20: dw VGAMEM_GRAPH 1307 <1> WinBSegment20: dw 0000h 1308 <1> WinFuncPtr20: dd 0 1309 <1> BytesPerScanLine20: dw 3840 1310 <1> XResolution20: dw 1280 1311 <1> YResolution20: dw 720 1312 <1> XCharSize20: db 8 1313 <1> YCharSize20: db 16 1314 <1> NumberOfPlanes20: db 1 1315 <1> BitsPerPixel20: db 24 1316 <1> NumberOfBanks20: db 43 1317 <1> MemoryModel20: db VBE_MEMORYMODEL_DIRECT_COLOR 1318 <1> BankSize20: db 0 1319 <1> NumberOfImagePages20: db 5 1320 <1> Reserved_page20: db 0 1321 <1> RedMaskSize20: db 8 1322 <1> RedFieldPosition20: db 16 1323 <1> GreenMaskSize20: db 8 1324 <1> GreenFieldPosition20: db 8 1325 <1> BlueMaskSize20: db 8 1326 <1> BlueFieldPosition20: db 0 1327 <1> RsvdMaskSize20: db 0 1328 <1> RsvdFieldPosition20: db 0 1329 <1> DirectColorModeInfo20: db 0 1330 <1> PhysBasePtr20: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1331 <1> OffScreenMemOffset20: dd 0 1332 <1> OffScreenMemSize20: dw 0 1333 <1> LinBytesPerScanLine20: dw 3840 1334 <1> BnkNumberOfPages20: db 0 1335 <1> LinNumberOfPages20: db 0 1336 <1> LinRedMaskSize20: db 8 1337 <1> LinRedFieldPosition20: db 16 1338 <1> LinGreenMaskSize20: db 8 1339 <1> LinGreenFieldPosition20:db 8 1340 <1> LinBlueMaskSize20: db 8 1341 <1> LinBlueFieldPosition20: db 0 1342 <1> LinRsvdMaskSize20: db 0 1343 <1> LinRsvdFieldPosition20: db 0 1344 <1> MaxPixelClock20: dd 0 1345 <1> 1346 <1> dw 018Fh ; 1280x720x32 1347 <1> ModeAttributes21: dw MODE_ATTRIBUTES 1348 <1> WinAAttributes21: db WINA_ATTRIBUTES 1349 <1> WinBAttributes21: db 0 1350 <1> WinGranularity21: dw VBE_DISPI_BANK_SIZE_KB 1351 <1> WinSize21: dw VBE_DISPI_BANK_SIZE_KB 1352 <1> WinASegment21: dw VGAMEM_GRAPH 1353 <1> WinBSegment21: dw 0000h 1354 <1> WinFuncPtr21: dd 0 1355 <1> BytesPerScanLine21: dw 5120 1356 <1> XResolution21: dw 1280 1357 <1> YResolution21: dw 720 1358 <1> XCharSize21: db 8 1359 <1> YCharSize21: db 16 1360 <1> NumberOfPlanes21: db 1 1361 <1> BitsPerPixel21: db 32 1362 <1> NumberOfBanks21: db 57 1363 <1> MemoryModel21: db VBE_MEMORYMODEL_DIRECT_COLOR 1364 <1> BankSize21: db 0 1365 <1> NumberOfImagePages21: db 3 1366 <1> Reserved_page21: db 0 1367 <1> RedMaskSize21: db 8 1368 <1> RedFieldPosition21: db 16 1369 <1> GreenMaskSize21: db 8 1370 <1> GreenFieldPosition21: db 8 1371 <1> BlueMaskSize21: db 8 1372 <1> BlueFieldPosition21: db 0 1373 <1> RsvdMaskSize21: db 8 1374 <1> RsvdFieldPosition21: db 24 1375 <1> DirectColorModeInfo21: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 1376 <1> PhysBasePtr21: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1377 <1> OffScreenMemOffset21: dd 0 1378 <1> OffScreenMemSize21: dw 0 1379 <1> LinBytesPerScanLine21: dw 5120 1380 <1> BnkNumberOfPages21: db 0 1381 <1> LinNumberOfPages21: db 0 1382 <1> LinRedMaskSize21: db 8 1383 <1> LinRedFieldPosition21: db 16 1384 <1> LinGreenMaskSize21: db 8 1385 <1> LinGreenFieldPosition21:db 8 1386 <1> LinBlueMaskSize21: db 8 1387 <1> LinBlueFieldPosition21: db 0 1388 <1> LinRsvdMaskSize21: db 8 1389 <1> LinRsvdFieldPosition21: db 24 1390 <1> MaxPixelClock21: dd 0 1391 <1> 1392 <1> dw 0190h ; 1920x1080x16 1393 <1> ModeAttributes22: dw MODE_ATTRIBUTES 1394 <1> WinAAttributes22: db WINA_ATTRIBUTES 1395 <1> WinBAttributes22: db 0 1396 <1> WinGranularity22: dw VBE_DISPI_BANK_SIZE_KB 1397 <1> WinSize22: dw VBE_DISPI_BANK_SIZE_KB 1398 <1> WinASegment22: dw VGAMEM_GRAPH 1399 <1> WinBSegment22: dw 0000h 1400 <1> WinFuncPtr22: dd 0 1401 <1> BytesPerScanLine22: dw 3840 1402 <1> XResolution22: dw 1920 1403 <1> YResolution22: dw 1080 1404 <1> XCharSize22: db 8 1405 <1> YCharSize22: db 16 1406 <1> NumberOfPlanes22: db 1 1407 <1> BitsPerPixel22: db 16 1408 <1> NumberOfBanks22: db 64 1409 <1> MemoryModel22: db VBE_MEMORYMODEL_DIRECT_COLOR, 1410 <1> BankSize22: db 0 1411 <1> NumberOfImagePages22: db 3 1412 <1> Reserved_page22: db 0 1413 <1> RedMaskSize22: db 5 1414 <1> RedFieldPosition22: db 11 1415 <1> GreenMaskSize22: db 6 1416 <1> GreenFieldPosition22: db 5 1417 <1> BlueMaskSize22: db 5 1418 <1> BlueFieldPosition22: db 0 1419 <1> RsvdMaskSize22: db 0 1420 <1> RsvdFieldPosition22: db 0 1421 <1> DirectColorModeInfo22: db 0 1422 <1> PhysBasePtr22: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1423 <1> OffScreenMemOffset22: dd 0 1424 <1> OffScreenMemSize22: dw 0 1425 <1> LinBytesPerScanLine22: dw 3840 1426 <1> BnkNumberOfPages22: db 0 1427 <1> LinNumberOfPages22: db 0 1428 <1> LinRedMaskSize22: db 5 1429 <1> LinRedFieldPosition22: db 11 1430 <1> LinGreenMaskSize22: db 6 1431 <1> LinGreenFieldPosition22:db 5 1432 <1> LinBlueMaskSize22: db 5 1433 <1> LinBlueFieldPosition22: db 0 1434 <1> LinRsvdMaskSize22: db 0 1435 <1> LinRsvdFieldPosition22: db 0 1436 <1> MaxPixelClock22: dd 0 1437 <1> 1438 <1> dw 0191h ; 1920x1080x24 1439 <1> ModeAttributes23: dw MODE_ATTRIBUTES 1440 <1> WinAAttributes23: db WINA_ATTRIBUTES 1441 <1> WinBAttributes23: db 0 1442 <1> WinGranularity23: dw VBE_DISPI_BANK_SIZE_KB 1443 <1> WinSize23: dw VBE_DISPI_BANK_SIZE_KB 1444 <1> WinASegment23: dw VGAMEM_GRAPH 1445 <1> WinBSegment23: dw 0000h 1446 <1> WinFuncPtr23: dd 0 1447 <1> BytesPerScanLine23: dw 5760 1448 <1> XResolution23: dw 1920 1449 <1> YResolution23: dw 1080 1450 <1> XCharSize23: db 8 1451 <1> YCharSize23: db 16 1452 <1> NumberOfPlanes23: db 1 1453 <1> BitsPerPixel23: db 24 1454 <1> NumberOfBanks23: db 95 1455 <1> MemoryModel23: db VBE_MEMORYMODEL_DIRECT_COLOR 1456 <1> BankSize23: db 0 1457 <1> NumberOfImagePages23: db 1 1458 <1> Reserved_page23: db 0 1459 <1> RedMaskSize23: db 8 1460 <1> RedFieldPosition23: db 16 1461 <1> GreenMaskSize23: db 8 1462 <1> GreenFieldPosition23: db 8 1463 <1> BlueMaskSize23: db 8 1464 <1> BlueFieldPosition23: db 0 1465 <1> RsvdMaskSize23: db 0 1466 <1> RsvdFieldPosition23: db 0 1467 <1> DirectColorModeInfo23: db 0 1468 <1> PhysBasePtr23: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1469 <1> OffScreenMemOffset23: dd 0 1470 <1> OffScreenMemSize23: dw 0 1471 <1> LinBytesPerScanLine23: dw 5760 1472 <1> BnkNumberOfPages23: db 0 1473 <1> LinNumberOfPages23: db 0 1474 <1> LinRedMaskSize23: db 8 1475 <1> LinRedFieldPosition23: db 16 1476 <1> LinGreenMaskSize23: db 8 1477 <1> LinGreenFieldPosition23:db 8 1478 <1> LinBlueMaskSize23: db 8 1479 <1> LinBlueFieldPosition23: db 0 1480 <1> LinRsvdMaskSize23: db 0 1481 <1> LinRsvdFieldPosition23: db 0 1482 <1> MaxPixelClock23: dd 0 1483 <1> 1484 <1> dw 0192h ; 1920x1080x32 1485 <1> ModeAttributes24: dw MODE_ATTRIBUTES 1486 <1> WinAAttributes24: db WINA_ATTRIBUTES 1487 <1> WinBAttributes24: db 0 1488 <1> WinGranularity24: dw VBE_DISPI_BANK_SIZE_KB 1489 <1> WinSize24: dw VBE_DISPI_BANK_SIZE_KB 1490 <1> WinASegment24: dw VGAMEM_GRAPH 1491 <1> WinBSegment24: dw 0000h 1492 <1> WinFuncPtr24: dd 0 1493 <1> BytesPerScanLine24: dw 7680 1494 <1> XResolution24: dw 1920 1495 <1> YResolution24: dw 1080 1496 <1> XCharSize24: db 8 1497 <1> YCharSize24: db 16 1498 <1> NumberOfPlanes24: db 1 1499 <1> BitsPerPixel24: db 32 1500 <1> NumberOfBanks24: db 127 1501 <1> MemoryModel24: db VBE_MEMORYMODEL_DIRECT_COLOR 1502 <1> BankSize24: db 0 1503 <1> NumberOfImagePages24: db 1 1504 <1> Reserved_page24: db 0 1505 <1> RedMaskSize24: db 8 1506 <1> RedFieldPosition24: db 16 1507 <1> GreenMaskSize24: db 8 1508 <1> GreenFieldPosition24: db 8 1509 <1> BlueMaskSize24: db 8 1510 <1> BlueFieldPosition24: db 0 1511 <1> RsvdMaskSize24: db 8 1512 <1> RsvdFieldPosition24: db 24 1513 <1> DirectColorModeInfo24: db VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE 1514 <1> PhysBasePtr24: dd VBE_DISPI_LFB_PHYSICAL_ADDRESS 1515 <1> OffScreenMemOffset24: dd 0 1516 <1> OffScreenMemSize24: dw 0 1517 <1> LinBytesPerScanLine24: dw 7680 1518 <1> BnkNumberOfPages24: db 0 1519 <1> LinNumberOfPages24: db 0 1520 <1> LinRedMaskSize24: db 8 1521 <1> LinRedFieldPosition24: db 16 1522 <1> LinGreenMaskSize24: db 8 1523 <1> LinGreenFieldPosition24:db 8 1524 <1> LinBlueMaskSize24: db 8 1525 <1> LinBlueFieldPosition24: db 0 1526 <1> LinRsvdMaskSize24: db 8 1527 <1> LinRsvdFieldPosition24: db 24 1528 <1> MaxPixelClock24: dd 0 1529 <1> 1530 <1> VBE_VESA_MODE_END_OF_LIST: dw 0 1531 <1> 1532 <1> %endif 1533 <1> 1534 <1> ; 24/11/2020 1535 <1> 1536 <1> direct_color_fields: 1537 <1> ; 24/11/2020 1538 <1> 1539 <1> ; (vbetables-gen.c) 1540 <1> ; // Direct Color fields 1541 <1> ; (required for direct/6 and YUV/7 memory models) 1542 <1> ; switch(pm->depth) { 1543 <1> 1544 <1> ;case 8: 1545 00006C7A 00 <1> r_size_8: db 0 1546 00006C7B 00 <1> r_pos_8: db 0 1547 00006C7C 00 <1> g_size_8: db 0 1548 00006C7D 00 <1> g_pos_8: db 0 1549 00006C7E 00 <1> b_size_8: db 0 1550 00006C7F 00 <1> b_pos_8: db 0 1551 00006C80 00 <1> a_size_8: db 0 1552 00006C81 00 <1> a_pos_8: db 0 1553 <1> 1554 <1> ;case 16: 1555 00006C82 05 <1> r_size_16: db 5 1556 00006C83 0B <1> r_pos_16: db 11 1557 00006C84 06 <1> g_size_16: db 6 1558 00006C85 05 <1> g_pos_16: db 5 1559 00006C86 05 <1> b_size_16: db 5 1560 00006C87 00 <1> b_pos_16: db 0 1561 00006C88 00 <1> a_size_16: db 0 1562 00006C89 00 <1> a_pos_16: db 0 1563 <1> 1564 <1> ;case 24: 1565 00006C8A 08 <1> r_size_24: db 8 1566 00006C8B 10 <1> r_pos_24: db 16 1567 00006C8C 08 <1> g_size_24: db 8 1568 00006C8D 08 <1> g_pos_24: db 8 1569 00006C8E 08 <1> b_size_24: db 8 1570 00006C8F 00 <1> b_pos_24: db 0 1571 00006C90 00 <1> a_size_24: db 0 1572 00006C91 00 <1> a_pos_24: db 0 1573 <1> 1574 <1> ;case 32: 1575 00006C92 08 <1> r_size_32: db 8 1576 00006C93 10 <1> r_pos_32: db 16 1577 00006C94 08 <1> g_size_32: db 8 1578 00006C95 08 <1> g_pos_32: db 8 1579 00006C96 08 <1> b_size_32: db 8 1580 00006C97 00 <1> b_pos_32: db 0 1581 00006C98 08 <1> a_size_32: db 8 1582 00006C99 18 <1> a_pos_32: db 24 3426 ;%include 'diskdata.s' ; DISK (BIOS) DATA (initialized) 3427 ;;; 3428 3429 Align 2 3430 3431 %include 'sysdefs.s' ; 24/01/2015 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.5) - SYSTEM DEFINITIONS : sysdefs.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 23/07/2022 (Previous: 31/12/2017) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.11 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 11 <1> ; sysdefs.inc (14/11/2015) 12 <1> ; **************************************************************************** 13 <1> 14 <1> ; Retro UNIX 386 v1 Kernel - SYSDEFS.INC 15 <1> ; Last Modification: 14/11/2015 16 <1> ; 17 <1> ; ///////// RETRO UNIX 386 V1 SYSTEM DEFINITIONS /////////////// 18 <1> ; (Modified from 19 <1> ; Retro UNIX 8086 v1 system definitions in 'UNIX.ASM', 01/09/2014) 20 <1> ; ((UNIX.ASM (RETRO UNIX 8086 V1 Kernel), 11/03/2013 - 01/09/2014)) 21 <1> ; UNIX.ASM (MASM 6.11) --> SYSDEFS.INC (NASM 2.11) 22 <1> ; ---------------------------------------------------------------------------- 23 <1> ; 24 <1> ; Derived from UNIX Operating System (v1.0 for PDP-11) 25 <1> ; (Original) Source Code by Ken Thompson (1971-1972) 26 <1> ; 27 <1> ; 28 <1> ; 29 <1> ; **************************************************************************** 30 <1> 31 <1> nproc equ 16 ; number of processes 32 <1> ;nfiles equ 50 33 <1> ntty equ 8 ; 8+1 -> 8 (10/05/2013) 34 <1> nbuf equ 4 ; 6 ;; 21/08/2015 - 'namei' buffer problem when nbuf > 4 35 <1> ; NOTE: If fd0 super block buffer addres is beyond of the 1st 36 <1> ; 32K, DMA r/w routine or someting else causes a jump to 37 <1> ; kernel panic routine (in 'alloc' routine, in u5.s) 38 <1> ; because of invalid buffer content (r/w error). 39 <1> ; When all buffers are set before the end of the 1st 32k, 40 <1> ; there is no problem!? (14/11/2015) 41 <1> 42 <1> ;csgmnt equ 2000h ; 26/05/2013 (segment of process 1) 43 <1> ;core equ 0 ; 19/04/2013 44 <1> ;ecore equ 32768 - 64 ; 04/06/2013 (24/05/2013) 45 <1> ; (if total size of argument list and arguments is 128 bytes) 46 <1> ; maximum executable file size = 32768-(64+40+128-6) = 32530 bytes 47 <1> ; maximum stack size = 40 bytes (+6 bytes for 'IRET' at 32570) 48 <1> ; initial value of user's stack pointer = 32768-64-128-2 = 32574 49 <1> ; (sp=32768-args_space-2 at the beginning of execution) 50 <1> ; argument list offset = 32768-64-128 = 32576 (if it is 128 bytes) 51 <1> ; 'u' structure offset (for the '/core' dump file) = 32704 52 <1> ; '/core' dump file size = 32768 bytes 53 <1> 54 <1> ; 08/03/2014 55 <1> ;sdsegmnt equ 6C0h ; 256*16 bytes (swap data segment size for 16 processes) 56 <1> ; 19/04/2013 Retro UNIX 8086 v1 feaure only ! 57 <1> ;;sdsegmnt equ 740h ; swap data segment (for user structures and registers) 58 <1> 59 <1> ; 30/08/2013 60 <1> time_count equ 4 ; 10 --> 4 01/02/2014 61 <1> 62 <1> ; 05/02/2014 63 <1> ; process status 64 <1> ;SFREE equ 0 65 <1> ;SRUN equ 1 66 <1> ;SWAIT equ 2 67 <1> ;SZOMB equ 3 68 <1> ;SSLEEP equ 4 ; Retro UNIX 8086 V1 extension (for sleep and wakeup) 69 <1> 70 <1> ; 09/03/2015 71 <1> userdata equ 80000h ; user structure data address for current user ; temporary 72 <1> swap_queue equ 90000h - 2000h ; swap queue address ; temporary 73 <1> swap_alloc_table equ 0D0000h ; swap allocation table address ; temporary 74 <1> 75 <1> ; 17/09/2015 76 <1> ESPACE equ 48 ; [u.usp] (at 'sysent') - [u.sp] value for error return 77 <1> 78 <1> ; 31/12/2017 79 <1> ; 19/02/2017 80 <1> ; 15/10/2016 81 <1> ; 20/05/2016 82 <1> ; 19/05/2016 83 <1> ; 18/05/2016 84 <1> ; 29/04/2016 85 <1> ; TRDOS 386 (TRDOS v2.0) system calls - temporary List 86 <1> ; 14/07/2013 - 21/09/2015 (Retro UNIX 8086 & 386 system calls) 87 <1> _ver equ 0 ; Get TRDOS version (v2.0) 88 <1> _exit equ 1 89 <1> _fork equ 2 90 <1> _read equ 3 91 <1> _write equ 4 92 <1> _open equ 5 93 <1> _close equ 6 94 <1> _wait equ 7 95 <1> _creat equ 8 96 <1> _rename equ 9 ; TRDOS 386, Rename File (31/12/2017) 97 <1> _delete equ 10 ; TRDOS 386, Delete File (29/12/2017) 98 <1> _exec equ 11 99 <1> _chdir equ 12 100 <1> _time equ 13 ; TRDOS 386, Get Sys Date&Time (30/12/2017) 101 <1> _mkdir equ 14 102 <1> _chmod equ 15 ; TRDOS 386, Change Attributes (30/12/2017) 103 <1> _rmdir equ 16 ; TRDOS 386, Remove Directory (29/12/2017) 104 <1> _break equ 17 105 <1> _drive equ 18 ; TRDOS 386, Get/Set Current Drv (30/12/2017) 106 <1> _seek equ 19 107 <1> _tell equ 20 108 <1> _mem equ 21 ; TRDOS 386, Get Total&Free Mem (31/12/2017) 109 <1> _prompt equ 22 ; TRDOS 386, Change Cmd Prompt (31/12/2017) 110 <1> _path equ 23 ; TRDOS 386, Get/Set Run Path (31/12/2017) 111 <1> _env equ 24 ; TRDOS 386, Get/Set Env Vars (31/12/2017) 112 <1> _stime equ 25 ; TRDOS 386, Set Sys Date&Time (30/12/2017) 113 <1> _quit equ 26 114 <1> _intr equ 27 115 <1> _dir equ 28 ; TRDOS 386, Get Curr Drive&Dir (30/12/2017) 116 <1> _emt equ 29 117 <1> _ldrvt equ 30 ; TRDOS 386, Get Logical DOS DDT (30/12/2017) 118 <1> _video equ 31 ; TRDOS 386 Video Functions (16/05/2016) 119 <1> _audio equ 32 ; TRDOS 386 Video Functions (16/05/2016) 120 <1> _timer equ 33 ; TRDOS 386 Timer Functions (18/05/2016) 121 <1> _sleep equ 34 ; Retro UNIX 8086 v1 feature only ! 122 <1> _msg equ 35 ; Retro UNIX 386 v1 feature only ! 123 <1> _geterr equ 36 ; Retro UNIX 386 v1 feature only ! 124 <1> _fpsave equ 37 ; TRDOS 386 FPU state option (28/02/2017) 125 <1> _pri equ 38 ; change priority - TRDOS 386 (20/05/2016) 126 <1> _rele equ 39 ; TRDOS 386 (19/05/2016) 127 <1> _fff equ 40 ; Find First File - TRDOS 386 (15/10/2016) 128 <1> _fnf equ 41 ; Find Next File - TRDOS 386 (15/10/2016) 129 <1> _alloc equ 42 ; Allocate memory - TRDOS 386 (19/02/2017) 130 <1> ; TRDOS 386 (19/02/2017) DMA buff fuctions 131 <1> _dalloc equ 43 ; Deallocate mem - TRDOS 386 (19/02/2017) 132 <1> _calbac equ 44 ; Set IRQ callback - TRDOS 386 (20/02/2017) 133 <1> _dma equ 45 ; DMA service - TRDOS 386 (20/08/2017) 134 <1> 135 <1> %macro sys 1-4 136 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 137 <1> ; 03/09/2015 138 <1> ; 13/04/2015 139 <1> ; Retro UNIX 386 v1 system call. 140 <1> %if %0 >= 2 141 <1> mov ebx, %2 142 <1> %if %0 >= 3 143 <1> mov ecx, %3 144 <1> %if %0 = 4 145 <1> mov edx, %4 146 <1> %endif 147 <1> %endif 148 <1> %endif 149 <1> mov eax, %1 150 <1> ;int 30h 151 <1> int 40h ; TRDOS 386 (TRDOS v2.0) 152 <1> %endmacro 153 <1> 154 <1> ; TRDOS 386 system calls, interrupt number 155 <1> ; 25/12/2016 156 <1> SYSCALL_INT_NUM equ '40' ; '40h' 157 <1> 158 <1> ; 13/05/2015 - ERROR CODES 159 <1> ERR_FILE_NOT_OPEN equ 10 ; 'file not open !' error 160 <1> ERR_FILE_ACCESS equ 11 ; 'permission denied !' error 161 <1> ; 14/05/2015 162 <1> ERR_DIR_ACCESS equ 11 ; 'permission denied !' error 163 <1> ERR_FILE_NOT_FOUND equ 12 ; 'file not found !' error 164 <1> ERR_TOO_MANY_FILES equ 13 ; 'too many open files !' error 165 <1> ERR_DIR_EXISTS equ 14 ; 'directory already exists !' error 166 <1> ; 16/05/2015 167 <1> ERR_DRV_NOT_RDY equ 15 ; 'drive not ready !' error 168 <1> ; 18/05/2015 169 <1> ERR_DEV_NOT_RDY equ 15 ; 'device not ready !' error 170 <1> ERR_DEV_ACCESS equ 11 ; 'permission denied !' error 171 <1> ERR_DEV_NOT_OPEN equ 10 ; 'device not open !' error 172 <1> ; 07/06/2015 173 <1> ERR_FILE_EOF equ 16 ; 'end of file !' error 174 <1> ERR_DEV_VOL_SIZE equ 16 ; 'out of volume !' error 175 <1> ; 09/06/2015 176 <1> ERR_DRV_READ equ 17 ; 'disk read error !' 177 <1> ERR_DRV_WRITE equ 18 ; 'disk write error !' 178 <1> ; 16/06/2015 179 <1> ERR_NOT_DIR equ 19 ; 'not a (valid) directory !' error 180 <1> ERR_FILE_SIZE equ 20 ; 'file size error !' 181 <1> ; 22/06/2015 182 <1> ERR_NOT_SUPERUSER equ 11 ; 'permission denied !' error 183 <1> ERR_NOT_OWNER equ 11 ; 'permission denied !' error 184 <1> ERR_NOT_FILE equ 11 ; 'permission denied !' error 185 <1> ; 23/06/2015 186 <1> ERR_FILE_EXISTS equ 14 ; 'file already exists !' error 187 <1> ERR_DRV_NOT_SAME equ 21 ; 'not same drive !' error 188 <1> ERR_DIR_NOT_FOUND equ 12 ; 'directory not found !' error 189 <1> ERR_NOT_EXECUTABLE equ 22 ; 'not executable file !' error 190 <1> ; 27/06/2015 191 <1> ERR_INV_PARAMETER equ 23 ; 'invalid parameter !' error 192 <1> ERR_INV_DEV_NAME equ 24 ; 'invalid device name !' error 193 <1> ; 29/06/2015 194 <1> ERR_TIME_OUT equ 25 ; 'time out !' error 195 <1> ERR_DEV_NOT_RESP equ 25 ; 'device not responding !' error 196 <1> ; 10/10/2016 197 <1> ERR_INV_FILE_NAME equ 26 ; 'invalid file name !' error 198 <1> ERR_INV_FLAGS equ 23 ; 'invalid flags !' error 199 <1> ; For code compatibility with previous version of TRDOS (2011) 200 <1> ; (Temporary error codes for current TRDOS 386 -2016- version) 201 <1> ERR_NO_MORE_FILES equ 12 ; 'no more files !' error 202 <1> ERR_PATH_NOT_FOUND equ 3 ; 'path not found !' error 203 <1> ; 'dir not found !' ; TRDOS 8086 204 <1> ERR_NOT_FOUND equ 2 ; 'file not found !' ; TRDOS 8086 205 <1> ERR_DISK_SPACE equ 39 ; 'out of volume !' TRDOS 8086 206 <1> ; 'insufficient disk space !' ; 27h 207 <1> ERR_DISK_WRITE equ 30 ; 'disk write protected !' ; 16/10/2016 208 <1> ERR_ACCESS_DENIED equ 5 ; 'access denied !' ; TRDOS 8086 209 <1> ; 28/02/2017 210 <1> ERR_PERM_DENIED equ 11 ; 'permission denied !' error 211 <1> ; 18/05/2016 212 <1> ERR_MISC equ 27 ; miscellaneous/other errors 213 <1> ; 15/10/2016 214 <1> ; TRDOS 8086 -> TRDOS 386 (0Bh -> 28) 215 <1> ERR_INV_FORMAT equ 28 ; 'invalid format !' error 216 <1> ; TRDOS 8086 -> TRDOS 386 (0Dh -> 29) 217 <1> ERR_INV_DATA equ 29 ; 'invalid data !' error 218 <1> ; TRDOS 8086 -> TRDOS 386 (0Eh -> 20) 219 <1> ERR_ZERO_LENGTH equ 20 ; 'zero length !' error 220 <1> ; TRDOS 8086 -> TRDOS 386 (15h -> 17, 1Dh -> 18, 1Eh -> 17) 221 <1> ERR_DRV_NR_READ equ 17 ; 'drive not ready or read error !' 222 <1> ERR_DRV_NR_WRITE equ 18 ; 'drive not ready or write error !' 223 <1> ; 15/10/2016 224 <1> ERR_INV_PATH_NAME equ 19 ; 'bad path name !' error 225 <1> ERR_BAD_CMD_ARG equ 1 ; 'bad command argument !' ; TRDOS 8086 226 <1> ERR_INV_FNUMBER equ 1 ; 'invalid function number !' ; TRDOS 8086 227 <1> ERR_BIG_FILE equ 8 ; 'big file & out of memory ! ; TRDOS 8086 228 <1> ERR_BIG_DATA equ 8 ; 'big data & out of memory ! ; TRDOS 8086 229 <1> ERR_CLUSTER equ 35 ; 'cluster not available !' ; TRDOS 8086 230 <1> ERR_OUT_OF_MEMORY equ 4 ; 'out of memory !' 231 <1> ; 'insufficient memory !' 232 <1> ERR_P_VIOLATION equ 6 ; 'protection violation !' 233 <1> ERR_PAGE_FAULT equ 224 ;'page fault !' ;0E0h 234 <1> ERR_SWP_DISK_READ equ 40 235 <1> ERR_SWP_DISK_NOT_PRESENT equ 41 236 <1> ERR_SWP_SECTOR_NOT_PRESENT equ 42 237 <1> ERR_SWP_NO_FREE_SPACE equ 43 238 <1> ERR_SWP_DISK_WRITE equ 44 239 <1> ERR_SWP_NO_PAGE_TO_SWAP equ 45 240 <1> ; 10/04/2017 241 <1> ERR_BUFFER equ 46 ; 'buffer error !' 242 <1> ; 28/08/2017 (20/08/2017) 243 <1> ERR_DMA equ -1 ; DMA buffer (allocation/misc.) error! 244 <1> 245 <1> ; 26/08/2015 246 <1> ; 24/07/2015 247 <1> ; 24/06/2015 248 <1> MAX_ARG_LEN equ 256 ; max. length of sys exec arguments 249 <1> ; 01/07/2015 250 <1> MAX_MSG_LEN equ 255 ; max. msg length for 'sysmsg' 251 <1> ; 252 <1> ; 06/10/2016 253 <1> ;OPENFILES equ 10 ; max. number of open files (system) 254 <1> ; 23/07/2022 255 <1> OPENFILES equ 32 ; max. number of open files (system) 256 <1> ; 07/10/2016 257 <1> ;NUMOFDEVICES equ 20 ; max. num of available devices (sys) 3432 %include 'trdosk0.s' ; 04/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.0) - DEFINITIONS : trdosk0.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 29/02/2016 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 04/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.11 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; TRDOS2.ASM (09/11/2011) 12 <1> ; **************************************************************************** 13 <1> ; TRDOS2.ASM (c) 2004-2011 Erdogan TAN [ 17/01/2004 ] Last Update: 09/11/2011 14 <1> ; 15 <1> ; Masterboot / Partition Table at Beginning+1BEh 16 <1> ptBootable equ 0 17 <1> ptBeginHead equ 1 18 <1> ptBeginSector equ 2 19 <1> ptBeginCylinder equ 3 20 <1> ptFileSystemID equ 4 21 <1> ptEndHead equ 5 22 <1> ptEndSector equ 6 23 <1> ptEndCylinder equ 7 24 <1> ptStartSector equ 8 25 <1> ptSectors equ 12 26 <1> 27 <1> ; Boot Sector Parameters at 7C00h 28 <1> DataArea1 equ -4 29 <1> DataArea2 equ -2 30 <1> BootStart equ 0h 31 <1> OemName equ 03h 32 <1> BytesPerSec equ 0Bh 33 <1> SecPerClust equ 0Dh 34 <1> ResSectors equ 0Eh 35 <1> FATs equ 10h 36 <1> RootDirEnts equ 11h 37 <1> Sectors equ 13h 38 <1> Media equ 15h 39 <1> FATSecs equ 16h 40 <1> SecPerTrack equ 18h 41 <1> Heads equ 1Ah 42 <1> Hidden1 equ 1Ch 43 <1> Hidden2 equ 1Eh 44 <1> HugeSec1 equ 20h 45 <1> HugeSec2 equ 22h 46 <1> DriveNumber equ 24h 47 <1> Reserved1 equ 25h 48 <1> bootsignature equ 26h 49 <1> VolumeID equ 27h 50 <1> VolumeLabel equ 2Bh 51 <1> FileSysType equ 36h 52 <1> Reserved2 equ 3Eh ; Starting cluster of P2000 53 <1> 54 <1> ; FAT32 BPB Structure 55 <1> FAT32_FAT_Size equ 36 56 <1> FAT32_RootFClust equ 44 57 <1> FAT32_FSInfoSec equ 48 58 <1> FAT32_DrvNum equ 64 59 <1> FAT32_BootSig equ 66 60 <1> FAT32_VolID equ 67 61 <1> FAT32_VolLab equ 71 62 <1> FAT32_FilSysType equ 82 63 <1> 64 <1> ; BIOS Disk Parameters 65 <1> DPDiskNumber equ 0h 66 <1> DPDType equ 1h 67 <1> DPReturn equ 2h 68 <1> DPHeads equ 3h 69 <1> DPCylinders equ 4h 70 <1> DPSecPerTrack equ 6h 71 <1> DPDisks equ 7h 72 <1> DPTableOff equ 8h 73 <1> DPTableSeg equ 0Ah 74 <1> DPNumOfSecs equ 0Ch 75 <1> 76 <1> ; BIOS INT 13h Extensions (LBA extensions) 77 <1> ; Just After DP Data (DPDiskNumber+) 78 <1> DAP_PacketSize equ 10h ; If extensions present, this byte will be >=10h 79 <1> DAP_Reserved1 equ 11h ; Reserved Byte 80 <1> DAP_NumOfBlocks equ 12h ; Value of this byte must be 0 to 127 81 <1> DAP_Reserved2 equ 13h ; Reserved Byte 82 <1> DAP_Destination equ 14h ; Address of Transfer Buffer as SEGMENT:OFFSET 83 <1> DAP_LBA_Address equ 18h ; LBA=(C1*H0+H1)*S0+S1-1 84 <1> ; C1= Selected Cylinder Number 85 <1> ; H0= Number Of Heads (Maximum Head Number + 1) 86 <1> ; H1= Selected Head Number 87 <1> ; S0= Maximum Sector Number 88 <1> ; S1= Selected Sector Number 89 <1> ; QUAD WORD 90 <1> ; DAP_Flat_Destination equ 20h ; 64 bit address, if value in 4h is FFFF:FFFFh 91 <1> ; QUAD WORD (Also, value in 0h must be 18h) 92 <1> ; TR-DOS will not use 64 bit Flat Address 93 <1> 94 <1> ; INT 13h Function 48h "Get Enhanced Disk Drive Parameters" 95 <1> ; Just After DP Data (DPDiskNumber+) 96 <1> GetDParams_48h equ 20h ; Word. Data Length, must be 26 (1Ah) for short data. 97 <1> GDP_48h_InfoFlag equ 22h ; Word 98 <1> ; Bit 1 = 1 -> The geometry returned in bytes 4-15 is valid. 99 <1> GDP_48h_NumOfPCyls equ 24h ; Double Word. Number physical cylinders. 100 <1> GDP_48h_NumOfPHeads equ 28h ; Double Word. Number of physical heads. 101 <1> GDP_48h_NumOfPSpT equ 2Ch ; Double word. Num of physical sectors per track. 102 <1> GDP_48h_LBA_Sectors equ 30h ; 8 bytes. Number of physical/LBA sectors. 103 <1> GDP_48h_BytesPerSec equ 38h ; Word. Number of bytes in a sector. 104 <1> 105 <1> ; TR-DOS Standalone Program Extensions to the DiskParams Block 106 <1> ; Just After DP Data (DPDiskNumber+) 107 <1> TRDP_CurrentSector equ 3Ah ; DX:AX (LBA) 108 <1> TRDP_SectorCount equ 3Eh ; CX (or Counter) 109 <1> 110 <1> 111 <1> ; DOS Logical Disks 112 <1> LD_Name equ 0 113 <1> LD_DiskType equ 1 114 <1> LD_PhyDrvNo equ 2 115 <1> LD_FATType equ 3 116 <1> LD_FSType equ 4 117 <1> LD_LBAYes equ 5 118 <1> LD_BPB equ 6 119 <1> LD_FATBegin equ 96 120 <1> LD_ROOTBegin equ 100 121 <1> LD_DATABegin equ 104 122 <1> LD_StartSector equ 108 123 <1> LD_TotalSectors equ 112 124 <1> LD_FreeSectors equ 116 125 <1> LD_Clusters equ 120 126 <1> LD_PartitionEntry equ 124 127 <1> LD_DParamEntry equ 125 128 <1> LD_MediaChanged equ 126 129 <1> LD_CDirLevel equ 127 130 <1> LD_CurrentDirectory equ 128 131 <1> 132 <1> ; Singlix FS Extensions to DOS Logical Disks 133 <1> ; 03/01/2010 (LD_BPB compatibility for CHS r/w) 134 <1> 135 <1> LD_FS_Name equ 0 136 <1> LD_FS_DiskType equ 1 137 <1> LD_FS_PhyDrvNo equ 2 138 <1> LD_FS_FATType equ 3 139 <1> LD_FS_FSType equ 4 140 <1> LD_FS_LBAYes equ 5 141 <1> LD_FS_BPB equ 6 142 <1> LD_FS_MediaAttrib equ 6 143 <1> LD_FS_VersionMajor equ 7 144 <1> LD_FS_RootDirD equ 8 145 <1> LD_FS_MATLocation equ 12 146 <1> LD_FS_Reserved1 equ 16 ;1 reserved byte 147 <1> LD_FS_BytesPerSec equ 17 ; LD_BPB + 0Bh 148 <1> LD_FS_Reserved2 equ 19 ;2 reserved byte 149 <1> LD_FS_DATLocation equ 20 150 <1> LD_FS_DATSectors equ 24 151 <1> LD_FS_Reserved3 equ 28 ;3 reserved word 152 <1> LD_FS_SecPerTrack equ 30 ; LD_BPB + 18h 153 <1> LD_FS_NumHeads equ 32 ; LD_BPB + 1Ah 154 <1> LD_FS_UnDelDirD equ 34 155 <1> LD_FS_Reserved4 equ 38 ;4 reserved word 156 <1> LD_FS_VolumeSerial equ 40 157 <1> LD_FS_VolumeName equ 44 158 <1> LD_FS_BeginSector equ 108 159 <1> LD_FS_VolumeSize equ 112 160 <1> LD_FS_FreeSectors equ 116 161 <1> LD_FS_FirstFreeSector equ 120 162 <1> LD_FS_PartitionEntry equ 124 163 <1> LD_FS_DParamEntry equ 125 164 <1> LD_FS_MediaChanged equ 126 165 <1> LD_FS_CDirLevel equ 127 166 <1> LD_FS_CDIR_Converted equ 128 167 <1> 168 <1> ; Valid FAT Types 169 <1> FS_FAT12 equ 1 170 <1> FS_FAT16_CHS equ 2 171 <1> FS_FAT32_CHS equ 3 172 <1> FS_FAT16_LBA equ 4 173 <1> FS_FAT32_LBA equ 5 174 <1> 175 <1> ; Cursor Location 176 <1> CCCpointer equ 0450h ; BIOS data, current cursor column 177 <1> ; FAT Clusters EOC sign 178 <1> FAT12EOC equ 0FFFh 179 <1> FAT16EOC equ 0FFFFh 180 <1> ;FAT32EOC equ 0FFFFFFFh ; It is not direct usable for 8086 code 181 <1> ; BAD Cluster 182 <1> FAT12BADC equ 0FF7h 183 <1> FAT16BADC equ 0FFF7h 184 <1> ;FAT32BADC equ 0FFFFFF7h ; It is not direct usable for 8086 code 185 <1> ; MS-DOS FAT16 FS (Maximum Possible) Last Cluster Number= 0FFF6h 186 <1> 187 <1> ; TRFS 188 <1> 189 <1> bs_FS_JmpBoot equ 0 ; jmp short bsBootCode 190 <1> ; db 0EBh, db 3Fh, db 90h 191 <1> bs_FS_Identifier equ 3 ; db 'FS', db 0 192 <1> bs_FS_BytesPerSec equ 6 ; dw 512 193 <1> bs_FS_MediaAttrib equ 8 ; db 3 194 <1> bs_FS_PartitionID equ 9 ; db 0A1h 195 <1> bs_FS_VersionMaj equ 10 ; db 01h 196 <1> bs_FS_VersionMin equ 11 ; db 0 197 <1> bs_FS_BeginSector equ 12 ; dd 0 198 <1> bs_FS_VolumeSize equ 16 ; dd 2880 199 <1> bs_FS_StartupFD equ 20 ; dd 0 200 <1> bs_FS_MATLocation equ 24 ; dd 1 201 <1> bs_FS_RootDirD equ 28 ; dd 8 202 <1> bs_FS_SystemConfFD equ 32 ; dd 0 203 <1> bs_FS_SwapFD equ 36 ; dd 0 204 <1> bs_FS_UnDelDirD equ 40 ; dd 0 205 <1> bs_FS_DriveNumber equ 44 ; db 0 206 <1> bs_FS_LBA_Ready equ 45 ; db 0 207 <1> bs_FS_MagicWord equ 46 208 <1> bs_FS_SecPerTrack equ 46 ; db 0A1h 209 <1> bs_FS_Heads equ 47 ; db 01h 210 <1> bs_FS_OperationSys equ 48 ; db "TR-SINGLIX v1.0b" 211 <1> bs_FS_Terminator equ 64 ; db 0 212 <1> bs_FS_BootCode equ 65 213 <1> 214 <1> FS_MAT_DATLocation equ 12 215 <1> FS_MAT_DATScount equ 16 216 <1> FS_MAT_FreeSectors equ 20 217 <1> FS_MAT_FirstFreeSector equ 24 218 <1> FS_RDT_VolumeSerialNo equ 28 219 <1> FS_RDT_VolumeName equ 64 220 <1> 221 <1> ; FAT12 + FAT16 + FAT32 222 <1> BS_JmpBoot equ 0 223 <1> BS_OEMName equ 3 224 <1> BPB_BytsPerSec equ 11 225 <1> BPB_SecPerClust equ 13 226 <1> BPB_RsvdSecCnt equ 14 227 <1> BPB_NumFATs equ 16 228 <1> BPB_RootEntCnt equ 17 229 <1> BPB_TotalSec16 equ 19 230 <1> BPB_Media equ 21 231 <1> BPB_FATSz16 equ 22 232 <1> BPB_SecPerTrk equ 24 233 <1> BPB_NumHeads equ 26 234 <1> BPB_HiddSec equ 28 235 <1> BPB_TotalSec32 equ 32 236 <1> 237 <1> ; FAT12 and FAT16 only 238 <1> BS_DrvNum equ 36 239 <1> BS_Reserved1 equ 37 240 <1> BS_BootSig equ 38 241 <1> BS_VolID equ 39 242 <1> BS_VolLab equ 43 243 <1> BS_FilSysType equ 54 ; 8 bytes 244 <1> BS_BootCode equ 62 245 <1> 246 <1> ; FAT32 only 247 <1> BPB_FATSz32 equ 36 ; FAT32, 4 bytes 248 <1> BPB_ExtFlags equ 40 ; FAT32, 2 bytes 249 <1> BPB_FSVer equ 42 ; FAT32, 2 bytes 250 <1> BPB_RootClus equ 44 ; FAT32, 4 bytes 251 <1> BPB_FSInfo equ 48 ; FAT 32, 2 bytes 252 <1> BPB_BkBootSec equ 50 ; FAT32, 2 bytes 253 <1> BPB_Reserved equ 52 ; FAT32, 12 bytes 254 <1> BS_FAT32_DrvNum equ 64 ; FAT32, 1 byte 255 <1> BS_FAT32_Reserved1 equ 65 ; FAT32, 1 byte 256 <1> BS_FAT32_BootSig equ 66 ; FAT32, 1 byte 257 <1> BS_FAT32_VolID equ 67 ; FAT32, 4 bytes 258 <1> BS_FAT32_VolLab equ 71 ; FAT32, 11 bytes 259 <1> BS_FAT32_FilSysType equ 82 ; FAT32, 8 bytes 260 <1> BS_FAT32_BootCode equ 90 261 <1> 262 <1> ; 29/02/2016 263 <1> ;(FAT32 Free Cluster Count & First Free Cluster values) 264 <1> ;[BPB_Reserved] = Free Cluster Count (offset 52) 265 <1> ;[BPB_Reserved+4] = First Free Cluster (offset 56) 266 <1> 267 <1> BS_Validation equ 510 268 <1> 269 <1> ; 15/02/2016 270 <1> ; FILE.ASM - 09/10/2011 271 <1> ; Directory Entry Structure 272 <1> ; 29/10/2009 (According to Microsoft FAT32 File System Specification) 273 <1> DirEntry_Name equ 0 274 <1> DirEntry_Attr equ 11 275 <1> DirEntry_NTRes equ 12 276 <1> DirEntry_CrtTimeTenth equ 13 277 <1> DirEntry_CrtTime equ 14 278 <1> DirEntry_CrtDate equ 16 279 <1> DirEntry_LastAccDate equ 18 280 <1> DirEntry_FstClusHI equ 20 281 <1> DirEntry_WrtTime equ 22 282 <1> DirEntry_WrtDate equ 24 283 <1> DirEntry_FstClusLO equ 26 284 <1> DirEntry_FileSize equ 28 3433 %include 'trdosk1.s' ; 04/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.9) - SYS INIT : trdosk1.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 26/09/2024 (Previous: 25/07/2022) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 04/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; TRDOS2.ASM (09/11/2011) 12 <1> ; **************************************************************************** 13 <1> ; TRDOS2.ASM (c) 2004-2011 Erdogan TAN [ 17/01/2004 ] Last Update: 09/11/2011 14 <1> ; 15 <1> 16 <1> sys_init: 17 <1> ; 26/09/2024 (TRDOS v2.0.9) 18 <1> ; 18/04/2021 (TRDOS 386 v2.0.4) 19 <1> ; 20/01/2018 (v2.0.1) 20 <1> ; 23/01/2017 (v2.0.0) 21 <1> ; 07/05/2016 22 <1> ; 02/05/2016 23 <1> ; 24/04/2016 24 <1> ; 14/04/2016 25 <1> ; 13/04/2016 26 <1> ; 30/03/2016 27 <1> ; 24/01/2016 28 <1> ; 06/01/2016 29 <1> ; 04/01/2016 (TRDOS 386 v2.0 - Beginning) 30 <1> 31 <1> ; 23/01/2017 - reset timer frequency (to 18.2Hz) 32 00006C9A B036 <1> mov al, 00110110b ; 36h 33 00006C9C E643 <1> out 43h, al 34 00006C9E 31C0 <1> xor eax, eax ; sub al, al ; 0 35 00006CA0 E640 <1> out 40h, al ; LB 36 00006CA2 E640 <1> out 40h, al ; HB 37 <1> ; 38 <1> ; 30/03/2016 39 <1> ; Clear Logical DOS Disk Description Tables Area 40 <1> ;xor eax, eax 41 00006CA4 BF00010900 <1> mov edi, Logical_DOSDisks 42 00006CA9 B980060000 <1> mov ecx, 6656/4 ; 26*256 = 6656 bytes 43 00006CAE F3AB <1> rep stosd ; 1664 times 4 bytes 44 <1> 45 00006CB0 B83F3A2F00 <1> mov eax, '?:/' 46 00006CB5 A3[77770100] <1> mov [Current_Dir_Drv], eax 47 <1> 48 <1> ; Logical DRV INIT (only for hard disks) 49 00006CBA E8C3030000 <1> call ldrv_init ; trdosk2.s 50 <1> 51 <1> ; When floppy_drv_init call is disabled 52 <1> ; media changed sign is needed 53 <1> ; for proper drive initialization 54 <1> 55 00006CBF BE00010900 <1> mov esi, Logical_DOSDisks 56 00006CC4 B001 <1> mov al, 1 ; Initialization sign (invalid_fd_parameter) 57 00006CC6 83C67E <1> add esi, LD_MediaChanged ; Media Change Status = 1 (init needed) 58 00006CC9 8806 <1> mov [esi], al ; A: 59 <1> ; Temporary - 26/09/2024 60 <1> ;;mov dword [esi+LD_Clusters], -1 ; * 61 <1> ;dec dword [esi+LD_Clusters] 62 00006CCB 81C600010000 <1> add esi, 100h 63 00006CD1 8806 <1> mov [esi], al ; B: 64 <1> ;;mov dword [esi+LD_Clusters], -1 ; * 65 <1> ;dec dword [esi+LD_Clusters] 66 <1> 67 <1> _current_drive_bootdisk: 68 00006CD3 8A15[88660000] <1> mov dl, [boot_drv] ; physical drive number 69 00006CD9 80FAFF <1> cmp dl, 0FFh 70 00006CDC 740A <1> je short _last_dos_diskno_check 71 <1> _boot_drive_check: 72 00006CDE 80FA80 <1> cmp dl, 80h 73 00006CE1 7218 <1> jb short _current_drive_a 74 00006CE3 80EA7E <1> sub dl, 7Eh ; C = 2 , D = 3 75 00006CE6 EB13 <1> jmp short _current_drive_a 76 <1> 77 <1> _last_dos_diskno_check: 78 00006CE8 8A15[8D2E0100] <1> mov dl, [Last_DOS_DiskNo] 79 00006CEE 80FA02 <1> cmp dl, 2 80 00006CF1 7706 <1> ja short _current_drive_c 81 00006CF3 7406 <1> je short _current_drive_a 82 00006CF5 30D2 <1> xor dl, dl ; A: 83 00006CF7 EB02 <1> jmp short _current_drive_a 84 <1> 85 <1> _current_drive_c: 86 00006CF9 B202 <1> mov dl, 2 ; C: 87 <1> 88 <1> _current_drive_a: 89 00006CFB 8815[89660000] <1> mov [drv], dl 90 00006D01 BE[8F2E0100] <1> mov esi, msg_CRLF_temp 91 00006D06 E8AF000000 <1> call print_msg 92 <1> 93 00006D0B 8A15[89660000] <1> mov dl, [drv] 94 <1> _default_drive_c: 95 00006D11 E8DA090000 <1> call change_current_drive 96 00006D16 731C <1> jnc short _start_mainprog 97 <1> 98 <1> _drv_not_ready_error: 99 00006D18 BE[53310100] <1> mov esi, msgl_drv_not_ready 100 00006D1D E898000000 <1> call print_msg 101 <1> ;jmp _end_of_mainprog 102 <1> 103 <1> ; 20/01/2018 104 00006D22 B202 <1> mov dl, 2 105 00006D24 3815[89660000] <1> cmp [drv], dl 106 00006D2A 736C <1> jnb short _end_of_mainprog 107 00006D2C 8815[89660000] <1> mov [drv], dl 108 00006D32 EBDD <1> jmp short _default_drive_c 109 <1> 110 <1> _start_mainprog: 111 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 112 <1> ; 18/04/2021 (TRDOS 386 v2.0.4 - Beginning) 113 <1> ; 07/01/2017 114 <1> ; 07/05/2016 115 <1> ; 02/05/2016 116 <1> ; 24/04/2016 (TRDOS 386 v2) 117 <1> ; Retro UNIX 386 v1, 'sys_init' (u0.s) 118 <1> ; 23/06/2015 119 <1> 120 <1> ; 02/05/2016 121 <1> ; 24/04/2016 122 <1> ;mov ax, 1 123 <1> ; 18/04/2021 - TRDOS 386 v2.0.4 124 00006D34 31C0 <1> xor eax, eax 125 00006D36 FEC0 <1> inc al ; eax = 1 126 00006D38 A2[BD8E0100] <1> mov [u.uno], al 127 00006D3D 66A3[548E0100] <1> mov [mpid], ax 128 00006D43 66A3[408D0100] <1> mov [p.pid], ax 129 00006D49 A2[A08D0100] <1> mov [p.stat], al 130 00006D4E C605[B48E0100]04 <1> mov byte [u.quant], time_count ; 07/01/2017 131 <1> ; 132 00006D55 A1[B0760100] <1> mov eax, [k_page_dir] 133 00006D5A A3[C48E0100] <1> mov [u.pgdir], eax ; reset 134 <1> ; 135 00006D5F E8C6EAFFFF <1> call allocate_page 136 <1> ;jc panic 137 <1> ; 25/07/2022 138 00006D64 7305 <1> jnc short _start_mainprog_1 139 00006D66 E9AE000000 <1> jmp panic 140 <1> 141 <1> _start_mainprog_1: 142 00006D6B A3[C08E0100] <1> mov [u.upage], eax ; user structure page 143 00006D70 A3[B08D0100] <1> mov [p.upage], eax 144 00006D75 E821EBFFFF <1> call clear_page 145 <1> ; 146 <1> ; 24/08/2015 147 00006D7A FE0D[608E0100] <1> dec byte [sysflg] ; FFh = ready for system call 148 <1> ; 0 = executing a system call 149 <1> ; 13/04/2016 150 <1> ; Clear Environment Variables Page/Area 151 00006D80 BF00300900 <1> mov edi, Env_Page ; 93000h 152 00006D85 B980000000 <1> mov ecx, Env_Page_Size / 4 ; 512/4 (4096/4) 153 00006D8A 31C0 <1> xor eax, eax 154 00006D8C F3AB <1> rep stosd 155 <1> 156 <1> ; 14/04/2016 157 00006D8E E880300000 <1> call mainprog_startup_configuration 158 <1> 159 00006D93 E8870A0000 <1> call dos_prompt 160 <1> 161 <1> _end_of_mainprog: 162 00006D98 BE[8F2E0100] <1> mov esi, msg_CRLF_temp 163 00006D9D E818000000 <1> call print_msg 164 00006DA2 BE[952E0100] <1> mov esi, mainprog_Version 165 00006DA7 E80E000000 <1> call print_msg 166 <1> ; 24/01/2016 167 00006DAC 28E4 <1> sub ah, ah 168 00006DAE E85FA1FFFF <1> call int16h ; call getch 169 00006DB3 E9EDA5FFFF <1> jmp cpu_reset 170 <1> 171 00006DB8 EBFE <1> infinitiveloop: jmp short infinitiveloop 172 <1> 173 <1> print_msg: 174 <1> ; 13/05/2016 175 <1> ; 04/01/2016 176 <1> ; 01/07/2015 177 <1> ; 13/03/2015 (Retro UNIX 386 v1) 178 <1> ; 07/03/2014 (Retro UNIX 8086 v1) 179 <1> ; (Modified registers: EAX, EBX, ECX, EDX, ESI, EDI) 180 <1> ; 181 00006DBA 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] ; 04/01/2016 (ptty) 182 <1> ;mov bl, 07h ; Black background, light gray forecolor 183 <1> 184 00006DC0 AC <1> lodsb 185 <1> pmsg1: 186 00006DC1 56 <1> push esi 187 <1> ;mov bh, [ACTIVE_PAGE] ; 04/01/2016 (ptty) 188 00006DC2 B307 <1> mov bl, 07h ; Black background, light gray forecolor 189 00006DC4 E816B5FFFF <1> call _write_tty 190 00006DC9 5E <1> pop esi 191 00006DCA AC <1> lodsb 192 00006DCB 20C0 <1> and al, al 193 00006DCD 75F2 <1> jnz short pmsg1 194 00006DCF C3 <1> retn 195 <1> 196 <1> clear_screen: 197 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 198 <1> ; 06/12/2020 199 <1> ; 03/12/2020 (TRDOS 386 v2.0.3) 200 <1> ; 13/05/2016 201 <1> ; 30/01/2016 202 <1> ; 24/01/2016 203 <1> ; 04/01/2016 204 00006DD0 0FB61D[DE760100] <1> movzx ebx, byte [ACTIVE_PAGE] ; video page number (0 to 7) 205 <1> ; 25/07/2022 206 <1> ;sub al, al 207 <1> ; al = 0 208 00006DD7 8AA3[3F680000] <1> mov ah, [ebx+vmode] ; default = 03h (80x25 text) 209 00006DDD 80FC04 <1> cmp ah, 4 210 00006DE0 7205 <1> jb short cls1 211 00006DE2 80FC07 <1> cmp ah, 7 212 00006DE5 752B <1> jne short vga_clear 213 <1> cls1: 214 <1> ;mov bh, bl 215 <1> ;mov bl, 7 216 00006DE7 3A25[2E680000] <1> cmp ah, [CRT_MODE] ; current video mode ? 217 00006DED 740D <1> je short cls2 ; yes (current video mode = 3) 218 <1> ;;call set_mode_3 ; set video mode to 3 (& clear screen) 219 <1> ;;retn 220 <1> ; 06/12/2020 221 <1> ;cmp byte [pmi32], 0 222 <1> ; 25/07/2022 223 00006DEF 383D[249D0100] <1> cmp [pmi32], bh ; 0 224 00006DF5 771B <1> ja short vga_clear 225 00006DF7 E9EDB4FFFF <1> jmp set_mode_3 226 <1> cls2: 227 00006DFC 88DF <1> mov bh, bl ; video page (0 to 7) 228 00006DFE B307 <1> mov bl, 07h ; attribute to be used on blanked line 229 <1> ; 25/07/2022 230 <1> ;sub al, al ; 0 = entire window 231 <1> ;xor cx, cx 232 <1> ; 25/07/2022 233 <1> ; al = 0 234 00006E00 31C9 <1> xor ecx, ecx 235 00006E02 66BA4F18 <1> mov dx, 184Fh 236 00006E06 E826B2FFFF <1> call _scroll_up ; 24/01/2016 237 <1> ; 238 <1> ;mov bh, [ACTIVE_PAGE] ; video page number (0 to 7) 239 <1> ;xor dx, dx 240 <1> ; 25/07/2022 241 00006E0B 31D2 <1> xor edx, edx 242 <1> ;call _set_cpos ; 24/01/2016 243 <1> ;;retn 244 <1> ; 03/12/2020 245 00006E0D E965B5FFFF <1> jmp _set_cpos ; returns to the caller of this proc 246 <1> ;cls3: 247 <1> ; retn 248 <1> 249 <1> ; 06/12/2020 250 <1> vga_clear: 251 <1> ; 03/12/2020 252 <1> ; set mode by using _int10h 253 <1> ; (also clears screen) 254 <1> ;mov al, ah 255 <1> ;sub ah, ah ; set current video mode 256 <1> ; 25/07/2022 257 00006E12 86E0 <1> xchg ah, al 258 <1> ; ah = 0 259 <1> ; al = video mode 260 <1> ;call _int10h ; simulates int 10h in TRDOS 386 kernel 261 <1> ;jmp short cls3 262 00006E14 E901A9FFFF <1> jmp _int10h ; returns to the caller of this proc 263 <1> 264 <1> panic: 265 <1> ; 13/05/2016 (TRDOS 386 = TRDOS v2) 266 <1> ; 13/03/2015 (Retro UNIX 386 v1) 267 <1> ; 07/03/2014 (Retro UNIX 8086 v1) 268 00006E19 BE[3F390100] <1> mov esi, panic_msg 269 00006E1E E897FFFFFF <1> call print_msg 270 <1> key_to_reboot: 271 <1> ; 24/01/2016 272 00006E23 28E4 <1> sub ah, ah 273 00006E25 E8E8A0FFFF <1> call int16h ; call getch 274 <1> ; wait for a character from the current tty 275 <1> ; 276 00006E2A B00A <1> mov al, 0Ah 277 00006E2C 8A3D[DE760100] <1> mov bh, [ptty] ; [ACTIVE_PAGE] 278 00006E32 B307 <1> mov bl, 07h ; Black background, 279 <1> ; light gray forecolor 280 00006E34 E8A6B4FFFF <1> call _write_tty 281 00006E39 E967A5FFFF <1> jmp cpu_reset 282 <1> 283 <1> ctrlbrk: 284 <1> ; 21/08/2024 (TRDOS 386 Kernel v2.0.9) 285 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 286 <1> ; 12/11/2015 287 <1> ; 13/03/2015 (Retro UNIX 386 v1) 288 <1> ; 06/12/2013 (Retro UNIX 8086 v1) 289 <1> ; 290 <1> ; INT 1Bh (control+break) handler 291 <1> ; 292 <1> ; Retro Unix 8086 v1 feature only! 293 <1> ; 294 <1> 295 <1> ; 25/07/2022 296 00006E3E 52 <1> push edx 297 00006E3F 31D2 <1> xor edx, edx 298 <1> 299 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 300 <1> %if 0 301 <1> ;cmp word [u.intr], 0 302 <1> cmp [u.intr], dx ; 0 303 <1> jna short cbrk4 304 <1> cbrk0: 305 <1> ; 12/11/2015 306 <1> ; 06/12/2013 307 <1> ;cmp word [u.quit], 0 308 <1> cmp [u.quit], dx ; 0 ; 25/07/2022 309 <1> jz short cbrk4 310 <1> %endif 311 <1> ; 20/09/2013 312 <1> ;push ax 313 00006E41 50 <1> push eax ; 25/07/2022 314 00006E42 A0[DE760100] <1> mov al, [ptty] 315 <1> 316 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 317 <1> %if 1 318 00006E47 3A05[A28E0100] <1> cmp al, [u.ttyn] 319 00006E4D 7509 <1> jne short cbrk3 320 <1> %else 321 <1> ; 12/11/2015 322 <1> ; 323 <1> ; ctrl+break (EOT, CTRL+D) from serial port 324 <1> ; or ctrl+break from console (pseudo) tty 325 <1> ; (!redirection!) 326 <1> 327 <1> cmp al, 8 ; serial port tty nums > 7 328 <1> jb short cbrk1 ; console (pseudo) tty 329 <1> 330 <1> ; Serial port interrupt handler sets [ptty] 331 <1> ; to the port's tty number (as temporary). 332 <1> ; 333 <1> ; If active process is using a stdin or 334 <1> ; stdout redirection (by the shell), 335 <1> ; console tty keyboard must be available 336 <1> ; to terminate running process, 337 <1> ; in order to prevent a deadlock. 338 <1> 339 <1> ; 25/07/2022 340 <1> ;push edx 341 <1> ;movzx edx, byte [u.uno] 342 <1> mov dl, [u.uno] 343 <1> cmp al, [edx+p.ttyc-1] ; console tty (rw) 344 <1> ;pop edx 345 <1> je short cbrk2 346 <1> cbrk1: 347 <1> inc al ; [u.ttyp] : 1 based tty number 348 <1> ; 06/12/2013 349 <1> cmp al, [u.ttyp] ; recent open tty (r) 350 <1> je short cbrk2 351 <1> cmp al, [u.ttyp+1] ; recent open tty (w) 352 <1> jne short cbrk3 353 <1> cbrk2: 354 <1> ;; 06/12/2013 355 <1> ;mov ax, [u.quit] 356 <1> ;and ax, ax 357 <1> ;jz short cbrk3 358 <1> %endif 359 <1> ;xor ax, ax ; 0 360 <1> ;dec ax 361 <1> ; 0FFFFh = 'ctrl+brk' keystroke 362 <1> ; 25/07/2022 363 <1> ;xor eax, eax ; 0 364 <1> ;dec eax ; -1 ; 0FFFFFFFFh 365 <1> ;mov [u.quit], ax 366 <1> ; 21/08/2024 367 <1> ; set CTRL+BREAK flag (even if it is not activated) 368 <1> ; (u.intr is it's activation flag, 0 = disabled)) 369 00006E4F 66C705[BA8E0100]FF- <1> mov word [u.quit], -1 ; 0FFFFh 369 00006E57 FF <1> 370 <1> cbrk3: 371 <1> ;pop ax 372 00006E58 58 <1> pop eax ; 25/07/2022 373 <1> cbrk4: 374 <1> ; 25/07/2022 375 00006E59 5A <1> pop edx 376 00006E5A C3 <1> retn 377 <1> 378 <1> ; 31/12/2017 379 <1> ; TRDOS 386 - 30/12/2017 380 <1> %define get_rtc_date RTC_40 381 <1> %define get_rtc_time RTC_20 382 <1> %define set_rtc_date RTC_50 383 <1> %define set_rtc_time RTC_30 384 <1> get_rtc_date_time: 385 <1> ; Retro UNIX 8086 v1 - UNIX.ASM (01/09/2014) 386 <1> ;epoch: 387 <1> ; 18/04/2021 (TRDOS 386 v2.0.3) 388 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 389 <1> ; 15/03/2015 (Retro UNIX 386 v1 - 32 bit version) 390 <1> ; 09/04/2013 (Retro UNIX 8086 v1 - UNIX.ASM) 391 <1> ; 'epoch' procedure prototype: 392 <1> ; UNIXCOPY.ASM, 10/03/2013 393 <1> ; 14/11/2012 394 <1> ; unixboot.asm (boot file configuration) 395 <1> ; version of "epoch" procedure in "unixproc.asm" 396 <1> ; 21/7/2012 397 <1> ; 15/7/2012 398 <1> ; 14/7/2012 399 <1> ; Erdogan Tan - RETRO UNIX v0.1 400 <1> ; compute current date and time as UNIX Epoch/Time 401 <1> ; UNIX Epoch: seconds since 1/1/1970 00:00:00 402 <1> ; 403 <1> ; ((Modified registers: EAX, EDX, ECX, EBX)) 404 <1> ; 405 <1> 406 <1> ; 18/04/2021 407 <1> ; INPUT: 408 <1> ; none (real time clock) 409 <1> ; OUTPUT: 410 <1> ; eax = unix epoch time value 411 <1> ; (seconds since 1/1/1970 00:00:00) 412 <1> 413 00006E5B E8FDF4FFFF <1> call get_rtc_time ; Return Current Time 414 <1> ;xchg ch, cl ; 18/04/2021 415 00006E60 66890D[7A730100] <1> mov [hour], cx ; BCD, cl = minute, ch = hour 416 <1> ;xchg dh, dl ; 18/04/2021 417 <1> ;mov [second], dx ; BCD, dh = second, dl = dse 418 <1> ; 18/04/2021 419 00006E67 8835[7E730100] <1> mov [second], dh ; second 420 <1> ; 421 00006E6D E856F5FFFF <1> call get_rtc_date ; Return Current Date 422 <1> ;xchg ch, cl ; 18/04/2021 423 00006E72 66890D[74730100] <1> mov [year], cx ; BCD, cl = year, ch = century 424 <1> ;xchg dh, dl ; 18/04/2021 425 00006E79 668915[76730100] <1> mov [month], dx ; BCD, dl = day, dh = month 426 <1> ; 427 <1> ;mov al, [hour] ; Hour 428 <1> ; 18/04/2021 429 00006E80 A0[7B730100] <1> mov al, [hour+1] ; Hour 430 <1> ; AL <-- BCD number 431 00006E85 D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 432 <1> ; AH = AL / 10h 433 <1> ; AL = AL MOD 10h 434 00006E87 D50A <1> aad ; AX= AH*10+AL 435 <1> ;mov [hour], al 436 <1> ;mov al, [hour+1] ; Minute 437 00006E89 8605[7A730100] <1> xchg al, [hour] ; [hour] = hour, al = minute 438 <1> ; AL <-- BCD number 439 00006E8F D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 440 <1> ; AH = AL / 10h 441 <1> ; AL = AL MOD 10h 442 00006E91 D50A <1> aad ; AX= AH*10+AL 443 00006E93 A2[7C730100] <1> mov [minute], al 444 00006E98 A0[7E730100] <1> mov al, [second] ; Second 445 <1> ; AL <-- BCD number 446 00006E9D D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 447 <1> ; AH = AL / 10h 448 <1> ; AL = AL MOD 10h 449 00006E9F D50A <1> aad ; AX= AH*10+AL 450 00006EA1 A2[7E730100] <1> mov [second], al 451 00006EA6 66A1[74730100] <1> mov ax, [year] ; Year (century) 452 <1> ; 18/04/2021 453 <1> ;push eax ; puhs ax 454 <1> ;mov al, ah ; century ; 18/04/2021 455 <1> ; AL <-- BCD number 456 00006EAC D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 457 <1> ; AH = AL / 10h 458 <1> ; AL = AL MOD 10h 459 00006EAE D50A <1> aad ; AX= AH*10+AL 460 <1> ;mov ah, 100 461 <1> ;mul ah 462 <1> ;mov [year], ax 463 <1> ; 18/04/2021 464 <1> ; ax = al = year (0 to 99) 465 00006EB0 668705[74730100] <1> xchg ax, [year] ; [year+1] = century -> ah 466 <1> ;pop eax ; pop ax 467 00006EB7 88E0 <1> mov al, ah ; century 468 <1> ; AL <-- BCD number 469 00006EB9 D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 470 <1> ; AH = AL / 10h 471 <1> ; AL = AL MOD 10h 472 00006EBB D50A <1> aad ; AX= AH*10+AL 473 <1> ; 18/04/2021 474 00006EBD B464 <1> mov ah, 100 ; 100*(century byte of year) 475 00006EBF F6E4 <1> mul ah 476 <1> ; 477 00006EC1 660105[74730100] <1> add [year], ax 478 <1> ;mov al, [month] ; Month 479 <1> ; 18/04/2021 480 00006EC8 A0[77730100] <1> mov al, [month+1] ; Month 481 <1> ; AL <-- BCD number 482 00006ECD D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 483 <1> ; AH = AL / 10h 484 <1> ; AL = AL MOD 10h 485 00006ECF D50A <1> aad ; AX= AH*10+AL 486 <1> ;mov [month], al 487 <1> ;mov al, [month+1] ; Day 488 <1> ; 18/04/2021 489 00006ED1 8605[76730100] <1> xchg al, [month] ; [month] = month, al = day 490 <1> ; AL <-- BCD number 491 00006ED7 D410 <1> db 0D4h, 10h ; Undocumented inst. AAM 492 <1> ; AH = AL / 10h 493 <1> ; AL = AL MOD 10h 494 00006ED9 D50A <1> aad ; AX= AH*10+AL 495 00006EDB A2[78730100] <1> mov [day], al 496 <1> 497 00006EE0 C3 <1> retn ; 30/12/2017 498 <1> 499 <1> epoch: 500 00006EE1 E875FFFFFF <1> call get_rtc_date_time ; TRDOS 386 - 30/12/2017 501 <1> 502 <1> convert_to_epoch: 503 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 504 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 505 <1> ; 15/03/2015 (Retro UNIX 386 v1 - 32 bit modification) 506 <1> ; 09/04/2013 (Retro UNIX 8086 v1) 507 <1> ; 508 <1> ; ((Modified registers: EAX, EDX, EBX)) 509 <1> ; 510 <1> ; Derived from DALLAS Semiconductor 511 <1> ; Application Note 31 (DS1602/DS1603) 512 <1> ; 6 May 1998 513 00006EE6 29C0 <1> sub eax, eax 514 00006EE8 66A1[74730100] <1> mov ax, [year] 515 00006EEE 662DB207 <1> sub ax, 1970 516 00006EF2 BA6D010000 <1> mov edx, 365 517 00006EF7 F7E2 <1> mul edx 518 00006EF9 31DB <1> xor ebx, ebx 519 00006EFB 8A1D[76730100] <1> mov bl, [month] 520 00006F01 FECB <1> dec bl 521 00006F03 D0E3 <1> shl bl, 1 522 <1> ;sub edx, edx 523 00006F05 668B93[80730100] <1> mov dx, [EBX+DMonth] 524 00006F0C 8A1D[78730100] <1> mov bl, [day] 525 00006F12 FECB <1> dec bl 526 00006F14 01D0 <1> add eax, edx 527 00006F16 01D8 <1> add eax, ebx 528 <1> ; EAX = days since 1/1/1970 529 00006F18 668B15[74730100] <1> mov dx, [year] 530 00006F1F 6681EAB107 <1> sub dx, 1969 531 <1> ;shr dx, 1 532 <1> ;shr dx, 1 533 <1> ; 25/07/2022 534 00006F24 C1EA02 <1> shr edx, 2 535 <1> ; (year-1969)/4 536 00006F27 01D0 <1> add eax, edx 537 <1> ; + leap days since 1/1/1970 538 00006F29 803D[76730100]02 <1> cmp byte [month], 2 ; if past february 539 00006F30 760E <1> jna short cte1 540 00006F32 668B15[74730100] <1> mov dx, [year] 541 00006F39 6683E203 <1> and dx, 3 ; year mod 4 542 00006F3D 7501 <1> jnz short cte1 543 <1> ; and if leap year 544 <1> ;add eax, 1 ; add this year's leap day (february 29) 545 <1> ; 25/07/2022 546 00006F3F 40 <1> inc eax 547 <1> cte1: ; compute seconds since 1/1/1970 548 00006F40 BA18000000 <1> mov edx, 24 549 00006F45 F7E2 <1> mul edx 550 00006F47 8A15[7A730100] <1> mov dl, [hour] 551 00006F4D 01D0 <1> add eax, edx 552 <1> ; EAX = hours since 1/1/1970 00:00:00 553 <1> ;mov ebx, 60 554 00006F4F B33C <1> mov bl, 60 555 00006F51 F7E3 <1> mul ebx 556 00006F53 8A15[7C730100] <1> mov dl, [minute] 557 00006F59 01D0 <1> add eax, edx 558 <1> ; EAX = minutes since 1/1/1970 00:00:00 559 <1> ;mov ebx, 60 560 00006F5B F7E3 <1> mul ebx 561 00006F5D 8A15[7E730100] <1> mov dl, [second] 562 00006F63 01D0 <1> add eax, edx 563 <1> ; EAX -> seconds since 1/1/1970 00:00:00 564 00006F65 C3 <1> retn 565 <1> 566 <1> ;set_date_time: 567 <1> convert_from_epoch: 568 <1> ; 25/07/2022 (v2.0.5) 569 <1> ; 18/04/2021 (v2.0.4) 570 <1> ; 31/12/2017 (v2.0.0) 571 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 572 <1> ; 15/03/2015 (Retro UNIX 386 v1 - 32 bit version) 573 <1> ; 20/06/2013 (Retro UNIX 8086 v1) 574 <1> ; 'convert_from_epoch' procedure prototype: 575 <1> ; UNIXCOPY.ASM, 10/03/2013 576 <1> ; 577 <1> ; ((Modified registers: EAX, EDX, ECX, EBX)) 578 <1> ; 579 <1> ; Derived from DALLAS Semiconductor 580 <1> ; Application Note 31 (DS1602/DS1603) 581 <1> ; 6 May 1998 582 <1> ; 583 <1> ; INPUT: 584 <1> ; EAX = Unix (Epoch) Time 585 <1> ; 586 00006F66 31D2 <1> xor edx, edx 587 <1> ;mov ecx, 60 588 <1> ; 25/07/2022 589 00006F68 29C9 <1> sub ecx, ecx 590 00006F6A B13C <1> mov cl, 60 591 00006F6C F7F1 <1> div ecx 592 <1> ;mov [imin], eax ; whole minutes 593 <1> ; since 1/1/1970 594 00006F6E 668915[7E730100] <1> mov [second], dx ; leftover seconds 595 00006F75 29D2 <1> sub edx, edx 596 00006F77 F7F1 <1> div ecx 597 <1> ;mov [ihrs], eax ; whole hours 598 <1> ; ; since 1/1/1970 599 00006F79 668915[7C730100] <1> mov [minute], dx ; leftover minutes 600 00006F80 31D2 <1> xor edx, edx 601 <1> ;mov cx, 24 602 00006F82 B118 <1> mov cl, 24 603 00006F84 F7F1 <1> div ecx 604 <1> ;mov [iday], ax ; whole days 605 <1> ; since 1/1/1970 606 00006F86 668915[7A730100] <1> mov [hour], dx ; leftover hours 607 00006F8D 05DB020000 <1> add eax, 365+366 ; whole day since 608 <1> ; 1/1/1968 609 <1> ;mov [iday], ax 610 00006F92 50 <1> push eax 611 00006F93 29D2 <1> sub edx, edx 612 <1> ;mov ecx, (4*365)+1 ; 4 years = 1461 days 613 <1> ; 25/07/2022 614 00006F95 66B9B505 <1> mov cx, (4*365)+1 615 00006F99 F7F1 <1> div ecx 616 00006F9B 59 <1> pop ecx 617 <1> ;mov [lday], ax ; count of quadyrs (4 years) 618 <1> ;push dx 619 <1> ; 18/04/2021 620 00006F9C 52 <1> push edx 621 <1> ;mov [qday], dx ; days since quadyr began 622 00006F9D 6683FA3C <1> cmp dx, 31+29 ; if past feb 29 then 623 00006FA1 F5 <1> cmc ; add this quadyr's leap day 624 00006FA2 83D000 <1> adc eax, 0 ; to # of qadyrs (leap days) 625 <1> ;mov [lday], ax ; since 1968 626 <1> ;mov cx, [iday] 627 00006FA5 91 <1> xchg ecx, eax ; ECX = lday, EAX = iday 628 00006FA6 29C8 <1> sub eax, ecx ; iday - lday 629 <1> ;mov ecx, 365 630 <1> ; 25/07/2022 631 00006FA8 66B96D01 <1> mov cx, 365 632 00006FAC 31D2 <1> xor edx, edx 633 <1> ; EAX = iday-lday, EDX = 0 634 00006FAE F7F1 <1> div ecx 635 <1> ;mov [iyrs], ax ; whole years since 1968 636 <1> ;jday = iday - (iyrs*365) - lday 637 <1> ;mov [jday], dx ; days since 1/1 of current year 638 <1> ;add eax, 1968 639 00006FB0 6605B007 <1> add ax, 1968 ; compute year 640 00006FB4 66A3[74730100] <1> mov [year], ax 641 <1> ;mov cx, dx 642 <1> ; 25/07/2022 643 00006FBA 89D1 <1> mov ecx, edx 644 <1> ;;mov dx, [qday] 645 <1> ;pop dx 646 <1> ; 18/04/2021 647 00006FBC 5A <1> pop edx 648 00006FBD 6681FA6D01 <1> cmp dx, 365 ; if qday <= 365 and qday >= 60 649 00006FC2 7708 <1> ja short cfe1 ; jday = jday +1 650 00006FC4 6683FA3C <1> cmp dx, 60 ; if past 2/29 and leap year then 651 00006FC8 F5 <1> cmc ; add a leap day to the # of whole 652 <1> ;adc cx, 0 ; days since 1/1 of current year 653 <1> ; 25/07/2022 654 00006FC9 83D100 <1> adc ecx, 0 655 <1> cfe1: 656 <1> ;mov [jday], cx 657 <1> ;mov bx, 12 ; estimate month 658 <1> ; 18/04/2021 659 00006FCC 29DB <1> sub ebx, ebx 660 00006FCE B30C <1> mov bl, 12 661 00006FD0 66BA6E01 <1> mov dx, 366 ; mday, max. days since 1/1 is 365 662 00006FD4 6683E003 <1> and ax, 11b ; year mod 4 (and dx, 3) 663 <1> cfe2: ; Month calculation ; 0 to 11 (11 to 0) 664 <1> ;cmp cx, dx ; mday = # of days passed from 1/1 665 <1> ; 25/07/2022 666 00006FD8 39D1 <1> cmp ecx, edx 667 00006FDA 731B <1> jnb short cfe3 668 <1> ;dec bx ; month = month - 1 669 <1> ;shl bx, 1 670 <1> ; 18/04/2021 671 00006FDC FECB <1> dec bl 672 00006FDE D0E3 <1> shl bl, 1 673 00006FE0 668B93[80730100] <1> mov dx, [EBX+DMonth] ; # elapsed days at 1st of month 674 <1> ; 18/04/2021 675 <1> ;shr bx, 1 ; bx = month - 1 (0 to 11) 676 00006FE7 D0EB <1> shr bl, 1 677 <1> ;cmp bx, 1 ; if month > 2 and year mod 4 = 0 678 00006FE9 80FB01 <1> cmp bl, 1 679 00006FEC 76EA <1> jna short cfe2 ; then mday = mday + 1 680 00006FEE 76E8 <1> jna short cfe2 ; then mday = mday + 1 681 00006FF0 08C0 <1> or al, al ; if past 2/29 and leap year then 682 00006FF2 75E4 <1> jnz short cfe2 ; add leap day (to mday) 683 <1> ;inc dx ; mday = mday + 1 684 <1> ; 25/07/2022 685 00006FF4 42 <1> inc edx 686 00006FF5 EBE1 <1> jmp short cfe2 687 <1> cfe3: 688 <1> ;inc bx ; -> bx = month, 1 to 12 689 <1> ; 18/04/2021 690 00006FF7 FEC3 <1> inc bl 691 00006FF9 66891D[76730100] <1> mov [month], bx 692 <1> ;sub cx, dx ; day = jday - mday + 1 693 <1> ; 25/07/2022 694 00007000 29D1 <1> sub ecx, edx 695 <1> ;inc cx 696 <1> ; 18/04/2021 697 00007002 FEC1 <1> inc cl 698 <1> ;mov [day], cx 699 00007004 880D[78730100] <1> mov [day], cl 700 <1> 701 <1> ; eax, ebx, ecx, edx is changed at return 702 <1> ; output -> 703 <1> ; [year], [month], [day], [hour], [minute], [second] 704 <1> 705 0000700A C3 <1> retn ; 31/12/2017 (TRDOS 386) 706 <1> 707 <1> set_rtc_date_time: 708 <1> ; 31/12/2017 (v2.0.0) 709 <1> ; 30/12/2017 (TRDOS 386) 710 <1> ; 15/03/2015 (Retro UNIX 386 v1 - 32 bit version) 711 <1> ; 20/06/2013 (Retro UNIX 8086 v1) 712 0000700B E80F000000 <1> call set_date_bcd 713 <1> ; Set real-time clock date 714 00007010 E8D9F3FFFF <1> call set_rtc_date ; RTC_50 715 <1> ; Set real-time clock time 716 00007015 E832000000 <1> call set_time_bcd 717 0000701A E96CF3FFFF <1> jmp set_rtc_time ; RTC_30 718 <1> 719 <1> ; 31/12/2017 720 <1> set_date_bcd: 721 0000701F A0[75730100] <1> mov al, [year+1] 722 00007024 D40A <1> aam ; ah = al / 10, al = al mod 10 723 00007026 D510 <1> db 0D5h, 10h ; Undocumented inst. AAD 724 <1> ; AL = AH * 10h + AL 725 00007028 88C5 <1> mov ch, al ; century (BCD) 726 0000702A A0[74730100] <1> mov al, [year] 727 0000702F D40A <1> aam ; ah = al / 10, al = al mod 10 728 00007031 D510 <1> db 0D5h, 10h ; Undocumented inst. AAD 729 <1> ; AL = AH * 10h + AL 730 00007033 88C1 <1> mov cl, al ; year (BCD) 731 00007035 A0[76730100] <1> mov al, [month] 732 0000703A D40A <1> aam ; ah = al / 10, al = al mod 10 733 0000703C D510 <1> db 0D5h, 10h ; Undocumented inst. AAD 734 <1> ; AL = AH * 10h + AL 735 0000703E 88C6 <1> mov dh, al ; month (BCD) 736 00007040 A0[78730100] <1> mov al, [day] 737 00007045 D40A <1> aam ; ah = al / 10, al = al mod 10 738 00007047 D510 <1> db 0D5h, 10h ; Undocumented inst. AAD 739 <1> ; AL = AH * 10h + AL 740 <1> ; 18/04/2021 741 00007049 88C2 <1> mov dl, al ; day (BCD) 742 0000704B C3 <1> retn ; 30/12/2017 743 <1> 744 <1> ; 31/12/2017 745 <1> set_time_bcd: 746 <1> ; Read real-time clock time 747 <1> ; (get day light saving time bit status) 748 0000704C FA <1> cli 749 0000704D E8D7F4FFFF <1> call UPD_IPR ; CHECK FOR UPDATE IN PROCESS 750 <1> ; cf = 1 -> al = 0 751 00007052 7207 <1> jc short stime1 752 00007054 B00B <1> mov al, CMOS_REG_B ; ADDRESS ALARM REGISTER 753 00007056 E804F5FFFF <1> call CMOS_READ ; READ CURRENT VALUE OF DSE BIT 754 <1> stime1: 755 0000705B FB <1> sti 756 0000705C 2401 <1> and al, 00000001b ; MASK FOR VALID DSE BIT 757 0000705E 88C2 <1> mov dl, al ; SET [DL] TO ZERO FOR NO DSE BIT 758 <1> ; DL = 1 or 0 (day light saving time) 759 <1> 760 00007060 A0[7A730100] <1> mov al, [hour] 761 00007065 D40A <1> aam ; ah = al / 10, al = al mod 10 762 00007067 D510 <1> db 0D5h,10h ; Undocumented inst. AAD 763 <1> ; AL = AH * 10h + AL 764 00007069 88C5 <1> mov ch, al ; hour (BCD) 765 0000706B A0[7C730100] <1> mov al, [minute] 766 00007070 D40A <1> aam ; ah = al / 10, al = al mod 10 767 00007072 D510 <1> db 0D5h,10h ; Undocumented inst. AAD 768 <1> ; AL = AH * 10h + AL 769 00007074 88C1 <1> mov cl, al ; minute (BCD) 770 00007076 A0[7E730100] <1> mov al, [second] 771 0000707B D40A <1> aam ; ah = al / 10, al = al mod 10 772 0000707D D510 <1> db 0D5h,10h ; Undocumented inst. AAD 773 <1> ; AL = AH * 10h + AL 774 0000707F 88C6 <1> mov dh, al ; second (BCD) 775 00007081 C3 <1> retn ; 30/12/2017 3434 %include 'trdosk2.s' ; 04/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - DRV INIT : trdosk2.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 19/12/2025 (Previous: 22/05/2024, TRDOS 386 v2.0.8) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 04/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.14 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; TRDOS2.ASM (09/11/2011) 12 <1> ; **************************************************************************** 13 <1> ; DRV_INIT.ASM (c) 2009-2011 Erdogan TAN [26/09/2009] Last Update: 07/08/2011 14 <1> ; 15 <1> 16 <1> ldrv_init: ; Logical Drive Initialization 17 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 18 <1> ; 22/05/2024 (TRDOS 386 Kernel v2.0.8) 19 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 20 <1> ; 30/08/2020 21 <1> ; 25/08/2020 22 <1> ; 11/08/2020 - 13/08/2020 23 <1> ; 17/07/2020 - 20/07/2020 24 <1> ; 14/07/2020 - 15/07/2020 25 <1> ; 30/01/2018 26 <1> ; 27/12/2017 27 <1> ; 12/02/2016 28 <1> ; 06/01/2016 29 <1> ; ('diskinit.inc', 'diskio.inc' integration) 30 <1> ; 04/01/2016 (TRDOS 386 = TRDOS v2.0) 31 <1> ; 07/08/2011 32 <1> ; 20/09/2009 33 <1> ; 2005 34 <1> 35 <1> ; 15/07/2020 36 <1> ;movzx ecx, byte [HF_NUM] ; number of fixed disks 37 <1> ;cmp cl, 1 38 <1> ;jnb short load_hd_partition_tables 39 <1> 40 00007082 A0[48770100] <1> mov al, [HF_NUM] ; number of fixed disks 41 00007087 20C0 <1> and al, al 42 00007089 7501 <1> jnz short load_hd_partition_tables 43 <1> 44 <1> ; no any hard disks 45 0000708B C3 <1> retn 46 <1> 47 <1> load_hd_partition_tables: 48 <1> ;mov esi, [HDPM_TBL_VEC] ; primary master disk FDPT 49 <1> ; 15/07/2020 50 0000708C BE[4C770100] <1> mov esi, HDPM_TBL_VEC 51 00007091 BF[767B0100] <1> mov edi, PTable_hd0 52 00007096 B280 <1> mov dl, 80h 53 <1> ; 15/07/2020 54 00007098 A2[8B660000] <1> mov [hdc], al 55 <1> ;xor ecx, ecx ; 0 56 <1> load_next_hd_partition_table: 57 <1> ; 20/07/2020 58 0000709D 31C9 <1> xor ecx, ecx ; 0 59 <1> ;push ecx 60 0000709F 57 <1> push edi ; * 61 <1> ;push esi ; FDPT (+ DPTE) address 62 <1> ; 15/07/2020 63 000070A0 AD <1> lodsd 64 000070A1 56 <1> push esi ; ** ; next FDPT (+ DPTE) address ptr 65 <1> 66 <1> ;mov al, [esi+20] ; DPTE offset 4 67 <1> ;and al, 40h ; LBA bit (bit 6) 68 <1> ;;shr al, 6 69 <1> ;mov [HD_LBA_yes], al 70 <1> 71 <1> ; 15/07/2020 72 000070A2 8A4814 <1> mov cl, [eax+20] 73 000070A5 80E140 <1> and cl, 40h 74 <1> ;mov [HD_LBA_yes], cl 75 <1> ; 22/05/2024 (BugFix) 76 000070A8 0FB6C2 <1> movzx eax, dl 77 000070AB 05[F67B0100] <1> add eax, HD_LBA_yes - 80h 78 000070B0 8808 <1> mov [eax], cl 79 <1> 80 000070B2 E81A030000 <1> call load_masterboot 81 <1> ;jc short pass_pt_this_hard_disk 82 <1> ; 13/08/2020 83 <1> ;jc pass_pt_this_hard_disk 84 <1> ; 25/07/2022 85 000070B7 7302 <1> jnc short load_mbr_ok 86 000070B9 EB7C <1> jmp pass_pt_this_hard_disk 87 <1> 88 <1> load_mbr_ok: 89 000070BB BB[347B0100] <1> mov ebx, PartitionTable 90 000070C0 89DE <1> mov esi, ebx 91 <1> ;mov ecx, 16 92 000070C2 B110 <1> mov cl, 16 93 000070C4 F3A5 <1> rep movsd 94 000070C6 89DE <1> mov esi, ebx 95 <1> ;mov byte [hdc], 4 ; 4 - partition index 96 <1> ; 15/07/2020 97 000070C8 C605[7B7C0100]04 <1> mov byte [PP_Counter], 4 98 <1> loc_validate_hdp_partition: 99 <1> ;cmp byte [esi+ptFileSystemID], 0 100 <1> ;jna short loc_validate_next_hdp_partition2 101 <1> ; 13/08/2020 102 000070CF 8A4604 <1> mov al, [esi+ptFileSystemID] 103 000070D2 20C0 <1> and al, al 104 000070D4 7449 <1> jz short loc_validate_next_hdp_partition2 105 <1> 106 000070D6 56 <1> push esi ; *** ; Masterboot partition table offset 107 000070D7 52 <1> push edx ; **** ; dl = Physical drive number 108 <1> 109 <1> ; 13/08/2020 110 000070D8 3C05 <1> cmp al, 05h ; Extended partition CHS 111 000070DA 7404 <1> je short loc_set_ep_counter 112 000070DC 3C0F <1> cmp al, 0Fh ; Extended partition LBA 113 000070DE 7511 <1> jne short loc_validate_next_hdp_partition0 114 <1> 115 <1> ;;inc byte [PP_Counter] 116 <1> ; 15/07/2020 117 <1> ;inc byte [EP_Counter] ; disk has valid partition(s) 118 <1> 119 <1> loc_set_ep_counter: 120 <1> ; 13/08/2020 121 000070E0 803D[7C7C0100]80 <1> cmp byte [EP_Counter], 80h 122 000070E7 7334 <1> jnb short loc_validate_next_hdp_partition1 123 <1> 124 000070E9 8815[7C7C0100] <1> mov byte [EP_Counter], dl ; disk drv has extd. part. 125 <1> 126 000070EF EB2C <1> jmp short loc_validate_next_hdp_partition1 127 <1> 128 <1> loc_validate_next_hdp_partition0: 129 000070F1 31FF <1> xor edi, edi ; 0 130 <1> ; Input -> ESI = PartitionTable offset 131 <1> ; DL = Hard disk drive number 132 <1> ; EDI = 0 -> Primary Partition 133 <1> ; EDI > 0 -> Extended Partition's Start Sector 134 000070F3 E87E010000 <1> call validate_hd_fat_partition 135 <1> 136 <1> ; 19/12/2025 137 <1> %if 0 138 <1> jnc short loc_set_valid_hdp_partition_entry 139 <1> 140 <1> ;pop edx 141 <1> ;push edx 142 <1> mov edx, [esp] ; **** 143 <1> mov esi, [esp+4] ; *** ; 30/01/2018 144 <1> call validate_hd_fs_partition 145 <1> %endif 146 000070F8 7223 <1> jc short loc_validate_next_hdp_partition1 147 <1> 148 <1> loc_set_valid_hdp_partition_entry: 149 000070FA 8A0D[8D2E0100] <1> mov cl, [Last_DOS_DiskNo] 150 00007100 80C141 <1> add cl, 'A' 151 <1> ; ESI = Logical dos drive description table address 152 00007103 880E <1> mov [esi+LD_Name], cl 153 <1> ; 15/07/2020 154 00007105 8A4602 <1> mov al, [esi+LD_PhyDrvNo] ; Physical drive number 155 <1> ;mov al, [esp] ; **** 156 00007108 2C7F <1> sub al, 7Fh 157 <1> ; AL = 1 to 4 158 0000710A C0E002 <1> shl al, 2 ; AL = 4 to 16 159 <1> 160 0000710D 8A15[7B7C0100] <1> mov dl, [PP_Counter] 161 <1> 162 <1> ;sub al, [PP_Counter] 163 00007113 28D0 <1> sub al, dl ; [PP_Counter] ; 4 - partition index 164 <1> 165 <1> ; AL = Partition entry/index, 0 based 166 <1> ; 0 -> hd 0, Partition Table offset = 0 167 <1> ; 15 -> hd 3, Partition Table offset = 3 168 <1> 169 <1> ;mov [esi+LD_PartitionEntry], al 170 <1> 171 <1> ; 15/07/2020 172 00007115 B404 <1> mov ah, 4 173 <1> ;sub ah, [PP_Counter] 174 00007117 28D4 <1> sub ah, dl 175 <1> 176 <1> ; AH = Primary partition index, 0 to 3 ; pt entry 177 <1> ; (4 to 7 for logical disk partitions) 178 <1> 179 <1> ;mov [esi+LD_DParamEntry], ah 180 00007119 6689467C <1> mov [esi+LD_PartitionEntry], ax 181 <1> 182 <1> loc_validate_next_hdp_partition1: 183 0000711D 5A <1> pop edx ; **** ; dl = Physical drive number 184 0000711E 5E <1> pop esi ; *** ; Masterboot partition table offset 185 <1> 186 <1> loc_validate_next_hdp_partition2: 187 <1> ; ESI = PartitionTable offset 188 <1> ; DL = Hard/Fixed disk drive number 189 <1> 190 <1> ;dec byte [hdc] ; 4 - partition index 191 <1> ;jz short pass_pt_this_hard_disk 192 <1> ; 15/07/2020 193 0000711F FE0D[7B7C0100] <1> dec byte [PP_Counter] ; 4 - partition index 194 00007125 7410 <1> jz short pass_pt_this_hard_disk 195 <1> 196 00007127 83C610 <1> add esi, 16 ; 10h 197 0000712A EBA3 <1> jmp short loc_validate_hdp_partition 198 <1> 199 <1> loc_not_any_extd_partitions: 200 <1> ; 15/07/2020 201 0000712C C3 <1> retn 202 <1> 203 <1> loc_next_hd_partition_table: 204 0000712D FEC2 <1> inc dl 205 <1> ; 15/07/2020 206 <1> ;add esi, 32 ; next FDPT address 207 0000712F 83C740 <1> add edi, 64 ; next partition table destination 208 00007132 E966FFFFFF <1> jmp load_next_hd_partition_table 209 <1> 210 <1> pass_pt_this_hard_disk: 211 <1> ;pop esi ; FDPT (+ DPTE) address 212 <1> ; 15/07/2020 213 00007137 5E <1> pop esi ; ** ; next FDPT (+ DPTE) address ptr 214 00007138 5F <1> pop edi ; * ; Ptable_hd? 215 <1> ;pop ecx 216 <1> ;loop loc_next_hd_partition_table 217 00007139 FE0D[8B660000] <1> dec byte [hdc] 218 0000713F 75EC <1> jnz short loc_next_hd_partition_table 219 <1> 220 <1> ;cmp byte [PP_Counter], 1 221 <1> ;jnb short load_extended_dos_partitions 222 <1> ;; Empty partition table 223 <1> ;retn 224 <1> 225 <1> ; 11/08/2020 226 <1> ; 17/07/2020 227 <1> check_extended_partitions: 228 <1> ; 15/07/2020 229 <1> ;cmp byte [EP_Counter], 0 230 <1> ;jna short loc_not_any_extd_partitions 231 <1> ; 13/08/2020 232 00007141 A0[7C7C0100] <1> mov al, [EP_Counter] ; 1st disk drv has extd partition 233 00007146 08C0 <1> or al, al ; 0 ? 234 00007148 74E2 <1> jz short loc_not_any_extd_partitions 235 <1> 236 <1> load_extended_dos_partitions: 237 <1> ;mov byte [hdc], 80h 238 <1> ; 13/08/2020 239 0000714A A2[8B660000] <1> mov byte [hdc], al ; 1st disk drv has extd partition 240 <1> ; 25/08/2020 241 0000714F 2C80 <1> sub al, 80h 242 00007151 740E <1> jz short loc_set_ext_ptable_hd0 243 00007153 C0E006 <1> shl al, 6 ; * 64 244 00007156 0FB6F0 <1> movzx esi, al 245 00007159 81C6[767B0100] <1> add esi, PTable_hd0 246 0000715F EB05 <1> jmp short next_hd_extd_partition 247 <1> 248 <1> ; 25/08/2020 249 <1> loc_set_ext_ptable_hd0: 250 00007161 BE[767B0100] <1> mov esi, PTable_hd0 251 <1> 252 <1> next_hd_extd_partition: 253 <1> ; 17/07/2020 254 <1> ;mov byte [EP_Counter], 0 ; Reset for each physical disk 255 <1> ; 13/08/2020 256 <1> ;mov byte [LD_Counter], 0 ; Reset logical drive index 257 00007166 66C705[7C7C0100]00- <1> mov word [EP_Counter], 0 ; Reset EP index and LD index 257 0000716E 00 <1> 258 <1> 259 0000716F 56 <1> push esi ; **** ; PTable_hd? offset 260 <1> 261 00007170 C605[7B7C0100]04 <1> mov byte [PP_Counter], 4 262 <1> ; set for each extd partition table 263 <1> ;;mov ecx, 4 264 <1> ;mov cl, 4 265 00007177 8A15[8B660000] <1> mov dl, [hdc] 266 <1> hd_check_fs_id_05h: 267 0000717D 8A4604 <1> mov al, [esi+ptFileSystemID] 268 00007180 3C05 <1> cmp al, 05h ; Is it an extended dos partition ? 269 00007182 7411 <1> je short loc_set_ep_start_sector ; yes 270 <1> hd_check_fs_id_0Fh: 271 00007184 3C0F <1> cmp al, 0Fh ; Is it an extended win4 (LBA mode) partition ? 272 00007186 740D <1> je short loc_set_ep_start_sector ; yes 273 <1> 274 <1> continue_to_check_ep: 275 <1> ;add esi, 16 276 <1> ;loop hd_check_fs_id_05h 277 <1> ; 15/07/2020 278 <1> ;dec cl 279 <1> ;jz short continue_check_ep_next_disk 280 00007188 FE0D[7B7C0100] <1> dec byte [PP_Counter] ; 4 --> 0 281 0000718E 7432 <1> jz short continue_check_ep_next_disk 282 00007190 83C610 <1> add esi, 16 283 00007193 EBE8 <1> jmp short hd_check_fs_id_05h 284 <1> 285 <1> loc_set_ep_start_sector: 286 <1> ; dl = [hdc] ; Drive number 287 <1> ; 15/07/2020 288 00007195 8B4E08 <1> mov ecx, [esi+ptStartSector] 289 <1> ; 30/08/2020 290 00007198 890D[7E7C0100] <1> mov [MBR_EP_StartSector], ecx 291 <1> ; 20/07/2020 292 <1> loc_validate_hde_partition_next: 293 <1> ; 22/05/2024 (BugFix) 294 0000719E 0FB6FA <1> movzx edi, dl 295 000071A1 81C7[F67B0100] <1> add edi, HD_LBA_yes - 80h 296 <1> ; 297 000071A7 890D[827C0100] <1> mov [EP_StartSector], ecx ; Extended partition's start sector 298 000071AD BB[76790100] <1> mov ebx, MasterBootBuff 299 <1> ; 22/05/2024 300 000071B2 803F01 <1> cmp byte [edi], 1 ; LBA ready = Yes 301 <1> ;cmp byte [HD_LBA_yes], 1 ; LBA ready = Yes 302 000071B5 7227 <1> jb short loc_hd_load_ep_05h ; cf = 1 ; 20/07/2020 303 <1> ; 11/08/2020 304 <1> ; (BugFix for extended partition type 05h beyond CHS limit) 305 <1> ; (Infact if extended partition starts at the beyond of CHS limit, 306 <1> ; it's partition ID must be 0Fh but they/somebodies had used 05h.) 307 <1> ;cmp al, 05h 308 <1> ;je short loc_hd_load_ep_05h 309 <1> loc_hd_load_ep_0Fh: 310 <1> ; 04/01/2016 311 <1> ;push ecx 312 <1> ; 15/07/2020 313 <1> ;mov ecx, [esi+ptStartSector] ; sector number 314 <1> ;mov ebx, MasterBootBuff ; buffer address 315 <1> ; LBA read/write (with private LBA function) 316 <1> ;((Retro UNIX 386 v1 - DISK I/O code by Erdogan Tan)) 317 <1> ; dl = physical drive number (0,1, 80h, 81h, 82h, 83h) 318 <1> ;mov ah, 1Bh ; LBA read 319 <1> ;mov al, 1 ; sector count 320 000071B7 66B8011B <1> mov ax, 1B01h 321 000071BB E84FDEFFFF <1> call int13h 322 <1> ;pop ecx 323 <1> ;jnc short loc_hd_move_ep_table 324 <1> ; 15/07/2020 325 000071C0 732E <1> jnc short loc_validate_hde_partition 326 <1> 327 <1> continue_check_ep_next_disk: 328 <1> ; 15/07/2020 329 <1> ;pop edi ; PTable_ep? 330 000071C2 5E <1> pop esi ; **** ; PTable_hd? 331 000071C3 A0[48770100] <1> mov al, [HF_NUM] ; number of hard disks 332 000071C8 047F <1> add al, 7Fh 333 000071CA 3805[8B660000] <1> cmp [hdc], al 334 000071D0 730B <1> jnb short loc_validating_hd_partitions_ok 335 000071D2 83C640 <1> add esi, 64 336 <1> ; 15/07/2020 337 <1> ;add edi, 64 338 000071D5 FE05[8B660000] <1> inc byte [hdc] 339 000071DB EB89 <1> jmp short next_hd_extd_partition 340 <1> 341 <1> loc_validating_hd_partitions_ok: 342 <1> ; 15/07/2020 343 <1> ;mov al, [Last_DOS_DiskNo] 344 <1> loc_drv_init_retn: 345 000071DD C3 <1> retn 346 <1> 347 <1> loc_hd_load_ep_05h: 348 <1> ; 20/07/2020 ('diskio.s', int13h, cf = 1 -> bugfix) 349 <1> ;clc ; (Bug: int13h would not clear carry flag bit, 350 <1> ; ; even if there would not be an error) 351 <1> ; ; ((Fix: now, int13h procedure clears carry flag 352 <1> ; ; at the entrance of it.. 20/07/2020)) 353 <1> ; 15/07/2020 354 <1> ;push ecx 355 000071DE 8A7601 <1> mov dh, [esi+ptBeginHead] 356 000071E1 668B4E02 <1> mov cx, [esi+ptBeginSector] 357 000071E5 66B80102 <1> mov ax, 0201h ; Read 1 sector 358 <1> ;mov ebx, MasterBootBuff 359 000071E9 E821DEFFFF <1> call int13h ; 20/07/2020 360 <1> ; 'diskio.s' modification, 'clc' 361 <1> ;pop ecx 362 000071EE 72D2 <1> jc short continue_check_ep_next_disk 363 <1> ; 15/07/2020 364 <1> ;jmp short loc_validate_hde_partition 365 <1> 366 <1> ; 15/07/2020 367 <1> ;loc_hd_move_ep_table: 368 <1> ;;pop edi 369 <1> ;;push edi ; PTable_ep? 370 <1> ;mov edi, [esp] 371 <1> ;mov esi, PartitionTable ; Extended 372 <1> ;mov ebx, esi 373 <1> ;;mov ecx, 16 374 <1> ;mov cl, 16 375 <1> ;rep movsd 376 <1> ;mov esi, ebx 377 <1> ;loc_set_hde_sub_partition_count: 378 <1> ;mov byte [PP_Counter], 4 379 <1> ;mov byte [EP_Counter], 0 380 <1> 381 <1> loc_validate_hde_partition: 382 <1> ; 13/08/2020 383 <1> ; 15/07/2020 384 <1> ;mov byte [PP_Counter], 4 385 000071F0 BE[347B0100] <1> mov esi, PartitionTable ; (in MasterBootBuff) 386 <1> ; 13/08/2020 387 <1> ;jmp short get_minidisk_partition_entry 388 <1> 389 <1> ;get_minidisk_partition_entry: 390 <1> ; ; 20/07/2020 391 <1> ; cmp byte [esi+ptFileSystemID], 0 392 <1> ; ja short loc_validate_minidisk_partition 393 <1> ; ; 13/08/2020 394 <1> ; jmp short continue_check_ep_next_disk 395 <1> 396 <1> ; ; 11/08/2020 397 <1> ;get_minidisk_partition_entry_next: 398 <1> ; ; 13/08/2020 399 <1> ; ;dec byte [PP_Counter] 400 <1> ; ;jz short continue_check_ep_next_disk 401 <1> ; ; 20/07/2020 402 <1> ;;get_minidisk_partition_entry_next: 403 <1> ; ; 13/08/2020 404 <1> ; cmp esi, PartitionTable+64 405 <1> ; jnb short continue_check_ep_next_disk 406 <1> ; 407 <1> ; add esi, 16 ; 10h 408 <1> ; ;jmp short get_minidisk_partition_entry 409 <1> 410 <1> ; 13/08/2020 411 <1> get_minidisk_partition_entry: 412 <1> ; 20/07/2020 413 000071F5 807E0400 <1> cmp byte [esi+ptFileSystemID], 0 414 000071F9 76C7 <1> jna short continue_check_ep_next_disk ; 13/08/2020 415 <1> 416 <1> loc_validate_minidisk_partition: 417 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 418 <1> ; 13/08/2020 419 <1> ; 20/07/2020 420 <1> ;push esi ; *** ; Extended partition table offset 421 <1> 422 <1> ; 13/08/2020 423 000071FB FE05[7C7C0100] <1> inc byte [EP_Counter] ; current (sub partition) index 424 <1> ; in current extended partition 425 00007201 BF[827C0100] <1> mov edi, EP_StartSector 426 <1> 427 <1> ; Input -> ESI = PartitionTable offset 428 <1> ; DL = Hard disk drive number 429 <1> ; EDI = Extended partition start sector pointer 430 00007206 E86B000000 <1> call validate_hd_fat_partition 431 <1> ;pop ecx ; * 432 0000720B 7308 <1> jnc short loc_set_valid_hde_partition_entry 433 <1> ; jump down to deep !!! 434 <1> 435 <1> ;pop esi ; *** ; Extended partition table offset 436 <1> ; 13/08/2020 437 <1> ;mov esi, PartitionTable 438 <1> 439 <1> ; 11/08/2020 440 <1> ; ESI = Extended partition table offset 441 0000720D 8A15[8B660000] <1> mov dl, [hdc] 442 <1> 443 <1> ;; DL = Hard disk drive number 444 <1> ;dec byte [PP_Counter] 445 <1> ;jz short continue_check_ep_next_disk 446 <1> ;add esi, 16 ; 10h 447 <1> ;mov dl, [hdc] 448 <1> ;jmp short get_minidisk_partition_entry 449 <1> 450 <1> ; 11/08/2020 451 <1> ;jmp short get_minidisk_partition_entry_next 452 <1> 453 <1> ; 23/08/2020 454 00007213 EB3E <1> jmp short validate_next_minidisk_partition_ok 455 <1> 456 <1> ; 17/07/2020 457 <1> ;; jumping down to deep levels !!! 458 <1> ; ((That is a pitty microsoft preferred ep table chain 459 <1> ; instead of a single table as mbr partition table!?)) 460 <1> 461 <1> loc_set_valid_hde_partition_entry: 462 <1> ; 15/07/2020 463 00007215 A0[8B660000] <1> mov al, [hdc] ; Hard disk drive number (>=80h) 464 0000721A 88C2 <1> mov dl, al ; mov dl, [hdc] 465 0000721C 2C7F <1> sub al, 7Fh 466 <1> ; 1 to 4 467 0000721E C0E002 <1> shl al, 2 ; 4 to 16 468 00007221 2A05[7B7C0100] <1> sub al, [PP_Counter] ; al - (4 - partition index) 469 <1> ; (disk number * 4) + partition index 470 <1> 471 <1> ; AL = Partition entry/index, 0 based 472 <1> ; 0 -> hd 0, Partition Table offset = 0 473 <1> ; 15 -> hd 3, Partition Table offset = 3 474 <1> 475 <1> ;mov ah, 4 ; Logical dos partition (>= 4) 476 <1> ;add ah, [EP_Counter] 477 <1> ; Logical disk partition index = 4 to 7 478 <1> ; (Primary disk partition index = 0 to 3) 479 <1> 480 <1> ; 13/08/2020 481 00007227 8A25[7D7C0100] <1> mov ah, [LD_Counter] ; Logical drive index number 482 <1> ; (in current extended partition) 483 0000722D 80C404 <1> add ah, 4 ; 4 to 7 484 <1> 485 <1> ; 15/07/2020 486 <1> ; CX -> AX 487 <1> ;; 06/01/2016 (TRDOS v2.0) 488 <1> ;; BUGFIX * 489 <1> ;;mov [esi+LD_PartitionEntry], cl 490 <1> ;;mov [esi+LD_DParamEntry], ch 491 <1> ;mov [esi+LD_PartitionEntry], cx 492 00007230 6689467C <1> mov [esi+LD_PartitionEntry], ax 493 <1> 494 00007234 8A0D[8D2E0100] <1> mov cl, [Last_DOS_DiskNo] 495 0000723A 80C141 <1> add cl, 'A' 496 0000723D 880E <1> mov [esi+LD_Name], cl 497 <1> 498 <1> ; 17/07/2020 499 <1> ;cmp cl, 'Z' 500 <1> ;jb short logical_drive_count_ok_for_next 501 <1> ;pop esi ; *** 502 <1> ;pop esi ; **** 503 <1> ;retn 504 <1> 505 <1> ;logical_drive_count_ok_for_next: 506 <1> 507 <1> ;; 15/07/2020 508 <1> ;inc byte [EP_Counter] 509 <1> ; 13/08/2020 510 0000723F FE05[7D7C0100] <1> inc byte [LD_Counter] 511 <1> 512 <1> ;mov dl, [hdc] 513 <1> 514 <1> ; 17/07/2020 515 <1> ;; Now, 516 <1> ;; we are swimming in deep of an extended partition !!! 517 <1> ; (! sub or chained extended partition tables !) 518 <1> ; ((Logical dos partitions in extended partition were called 519 <1> ; as 'mini disk partition' in msdos 6.0 source code.)) 520 <1> 521 <1> validate_next_minidisk_partition: 522 <1> ; 13/08/2020 523 <1> ;pop esi ; *** ; Extended partition table offset 524 <1> 525 <1> ; 17/07/2020 526 <1> ;cmp byte [EP_Counter], 4 527 <1> ; 13/08/2020 528 00007245 803D[7D7C0100]04 <1> cmp byte [LD_Counter], 4 ; maximum 4 logical disks 529 <1> ; per extended partition 530 <1> ;jnb continue_check_ep_next_disk 531 <1> ; 25/07/2022 532 0000724C 7205 <1> jb short validate_next_minidisk_partition_ok 533 0000724E E96FFFFFFF <1> jmp continue_check_ep_next_disk 534 <1> 535 <1> validate_next_minidisk_partition_ok: 536 <1> ; 13/08/2020 537 <1> ;dec byte [PP_Counter] ; 4 --> 0 538 <1> ;jz continue_check_ep_next_disk 539 <1> 540 <1> ;cmp esi, PartitionTable+64 541 <1> ;jnb continue_check_ep_next_disk 542 <1> 543 <1> ;add esi, 16 544 <1> ; 13/08/2020 545 00007253 BE[447B0100] <1> mov esi, PartitionTable+16 546 <1> 547 <1> ; 20/07/2020 548 00007258 8A4604 <1> mov al, [esi+ptFileSystemID] 549 <1> 550 <1> ; 20/07/2020 551 0000725B 3C05 <1> cmp al, 05h ; Is it an extended dos partition ? 552 0000725D 7409 <1> je short loc_minidisk_next_ep_lba_chs ; 17/07/2020 553 0000725F 3C0F <1> cmp al, 0Fh ; Is it an extended win4 (LBA mode) partition ? 554 <1> ;jne continue_check_ep_next_disk ; AL must be 0 here 555 <1> ; (when it is not 05h or 0Fh) 556 <1> ; If AL is not ZERO -> EP Bug! 557 <1> ; (!Microsoft DOS convention!) 558 <1> ; 25/07/2022 559 00007261 7405 <1> je short loc_minidisk_next_ep_lba_chs 560 00007263 E95AFFFFFF <1> jmp continue_check_ep_next_disk 561 <1> 562 <1> loc_minidisk_next_ep_lba_chs: 563 <1> ; 17/07/2020 564 00007268 8B4E08 <1> mov ecx, [esi+ptStartSector] ; relative start sector number 565 <1> ;add ecx, [EP_StartSector] 566 <1> ; 30/08/2020 567 0000726B 030D[7E7C0100] <1> add ecx, [MBR_EP_StartSector] 568 <1> ; 20/07/2020 569 00007271 E928FFFFFF <1> jmp loc_validate_hde_partition_next 570 <1> 571 <1> validate_hd_fat_partition: 572 <1> ; 17/07/2020 573 <1> ; 15/07/2020 574 <1> ; (optimization) 575 <1> ; 14/07/2020 576 <1> ; (fat16 -big- partition search bugfix) 577 <1> ; 27/12/2017 578 <1> ; 12/02/2016 579 <1> ; 07/01/2016 (TRDOS 386 = TRDOS v2.0) 580 <1> ; 07/08/2011 581 <1> ; 23/07/2011 582 <1> ; Input 583 <1> ; DL = Hard/Fixed Disk Drive Number 584 <1> ; ESI = PartitionTable offset 585 <1> ; EDI = Extend. Part. Start Sector Pointer 586 <1> ; EDI = 0 -> Primary Partition 587 <1> ; byte [Last_DOS_DiskNo] 588 <1> ; Output 589 <1> ; cf=0 -> Validated 590 <1> ; ESI = Logical dos drv desc. table 591 <1> ; EBX = FAT boot sector buffer 592 <1> ; byte [Last_DOS_DiskNo] 593 <1> ; cf=1 -> Not a valid FAT partition 594 <1> ; EAX, EDX, ECX, EDI -> changed 595 <1> 596 <1> ;mov esi, PartitionTable 597 00007276 8A6604 <1> mov ah, [esi+ptFileSystemID] 598 00007279 B002 <1> mov al, 2 ; 27/12/2017 599 0000727B 80FC06 <1> cmp ah, 06h ; FAT16 CHS partition (>=32MB) 600 <1> ; 12/02/2016 601 <1> ;;jb short loc_not_a_valid_fat_partition2 602 <1> ;jnb short vhdp_FAT16_32 603 <1> ; 14/07/2020 (BugFix) 604 0000727E 7711 <1> ja short vhdp_FAT16_32 605 00007280 7425 <1> je short loc_set_valid_hd_partition_params 606 <1> 607 <1> vhdp_FAT12_16: 608 <1> ; 27/12/2017 609 00007282 FEC8 <1> dec al ; mov al, 1 610 00007284 38C4 <1> cmp ah, al ; 1 ; FAT12 partition 611 00007286 741F <1> je short loc_set_valid_hd_partition_params 612 <1> ; 613 00007288 FEC0 <1> inc al ; mov al, 2 614 0000728A 80FC04 <1> cmp ah, 04h ; FAT16 CHS partition (< 32MB) 615 0000728D 7418 <1> je short loc_set_valid_hd_partition_params 616 <1> 617 <1> ; 15/07/2020 618 <1> ; (ah = 05h, 02h or 03h) 619 <1> loc_not_a_valid_fat_partition1: 620 0000728F F9 <1> stc 621 <1> ; cf=1 622 00007290 C3 <1> retn 623 <1> 624 <1> vhdp_FAT16_32: 625 <1> ; 15/07/2020 626 <1> ;mov al, 3 627 00007291 FEC0 <1> inc al 628 00007293 80FC0C <1> cmp ah, 0Ch ; FAT32 LBA partition 629 00007296 740F <1> je short loc_set_valid_hd_partition_params 630 00007298 7706 <1> ja short vhdp_check_FAT16_lba 631 <1> 632 <1> vhdp_check_FAT32_chs: 633 0000729A 80FC0B <1> cmp ah, 0Bh ; FAT32 CHS partition 634 0000729D 7408 <1> je short loc_set_valid_hd_partition_params 635 <1> ;jne short loc_not_a_valid_fat_partition1 636 <1> 637 <1> ;stc 638 <1> loc_not_a_valid_fat_partition2: 639 0000729F C3 <1> retn 640 <1> 641 <1> vhdp_check_FAT16_lba: 642 000072A0 80FC0E <1> cmp ah, 0Eh ; FAT16 LBA partition 643 000072A3 75EA <1> jne short loc_not_a_valid_fat_partition1 644 <1> 645 <1> ;mov al, 2 646 000072A5 FEC8 <1> dec al 647 <1> 648 <1> loc_set_valid_hd_partition_params: 649 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 650 <1> ; 30/07/2022 651 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 652 <1> ; 15/07/2020 653 <1> ;inc byte [Last_DOS_DiskNo] ; > 1 654 <1> ; 655 000072A7 31DB <1> xor ebx, ebx 656 000072A9 8A3D[8D2E0100] <1> mov bh, [Last_DOS_DiskNo] ; * 256 657 000072AF FEC7 <1> inc bh ; 15/07/2020 658 000072B1 81C300010900 <1> add ebx, Logical_DOSDisks 659 <1> ; 660 000072B7 C6430102 <1> mov byte [ebx+LD_DiskType], 2 661 000072BB 885302 <1> mov byte [ebx+LD_PhyDrvNo], dl 662 <1> ;mov byte [ebx+LD_FATType], al ; 2 or 3 663 <1> ;mov byte [ebx+LD_FSType], ah ; 06h, 0Eh, 0Bh, 0Ch 664 000072BE 66894303 <1> mov word [ebx+LD_FATType], ax 665 <1> ; 666 000072C2 8B4E08 <1> mov ecx, [esi+ptStartSector] 667 000072C5 09FF <1> or edi, edi 668 000072C7 7402 <1> jz short pass_hd_FAT_ep_start_sector_adding 669 <1> loc_add_hd_FAT_ep_start_sector: 670 <1> ; 17/07/2020 671 000072C9 030F <1> add ecx, [edi] 672 <1> pass_hd_FAT_ep_start_sector_adding: 673 000072CB 894B6C <1> mov [ebx+LD_StartSector], ecx 674 <1> loc_hd_FAT_logical_drv_init: 675 000072CE 89DD <1> mov ebp, ebx 676 <1> ;mov dl, [ebx+LD_PhyDrvNo] 677 000072D0 A0[767C0100] <1> mov al, [HD_LBA_yes] ; 07/01/2016 678 000072D5 884305 <1> mov [ebx+LD_LBAYes], al 679 000072D8 BB[867C0100] <1> mov ebx, DOSBootSectorBuff ; buffer address 680 000072DD 08C0 <1> or al, al 681 000072DF 740C <1> jz short loc_hd_FAT_drv_init_load_bs_chs 682 <1> loc_hd_FAT_drv_init_load_bs_lba: 683 <1> ; DL = Physical drive number 684 <1> ;mov ecx, [esi+ptStartSector] ; sector number 685 <1> ;mov ebx, DOSBootSectorBuff ; buffer address 686 <1> ; LBA read/write (with private LBA function) 687 <1> ;((Retro UNIX 386 v1 - DISK I/O code by Erdogan Tan)) 688 <1> ; dl = physical drive number (0,1, 80h, 81h, 82h, 83h) 689 000072E1 B41B <1> mov ah, 1Bh ; LBA read 690 000072E3 B001 <1> mov al, 1 ; sector count 691 000072E5 E825DDFFFF <1> call int13h 692 000072EA 7313 <1> jnc short loc_hd_drv_FAT_boot_validation 693 <1> loc_not_a_valid_fat_partition3: 694 000072EC C3 <1> retn 695 <1> loc_hd_FAT_drv_init_load_bs_chs: 696 000072ED 8A7601 <1> mov dh, [esi+ptBeginHead] 697 000072F0 668B4E02 <1> mov cx, [esi+ptBeginSector] 698 000072F4 66B80102 <1> mov ax, 0201h ; Read 1 sector 699 <1> ;mov ebx, DOSBootSectorBuff 700 000072F8 E812DDFFFF <1> call int13h 701 000072FD 72ED <1> jc short loc_not_a_valid_fat_partition3 702 <1> loc_hd_drv_FAT_boot_validation: 703 <1> ;mov esi, DOSBootSectorBuff 704 000072FF 89DE <1> mov esi, ebx 705 00007301 6681BEFE01000055AA <1> cmp word [esi+BS_Validation], 0AA55h 706 0000730A 751C <1> jne short loc_not_a_valid_fat_partition4 707 0000730C 807E15F8 <1> cmp byte [esi+BPB_Media], 0F8h 708 00007310 7516 <1> jne short loc_not_a_valid_fat_partition4 709 <1> ; 19/12/2025 710 00007312 66817E0B0002 <1> cmp word [esi+BPB_BytsPerSec], 512 711 00007318 750E <1> jne short loc_not_a_valid_fat_partition4 712 <1> 713 <1> ; 25/07/2022 714 0000731A 31C9 <1> xor ecx, ecx 715 <1> 716 <1> ; 27/12/2017 717 0000731C 807D0303 <1> cmp byte [ebp+LD_FATType], 3 718 00007320 7508 <1> jne short loc_hd_FAT16_BPB 719 <1> 720 <1> loc_hd_drv_FAT32_boot_validation: 721 00007322 807E4229 <1> cmp byte [esi+BS_FAT32_BootSig], 29h 722 00007326 7413 <1> je short loc_hd_FAT32_BPB 723 <1> 724 <1> loc_not_a_valid_fat_partition4: 725 00007328 F9 <1> stc 726 00007329 C3 <1> retn 727 <1> 728 <1> loc_hd_FAT16_BPB: 729 0000732A 807E2629 <1> cmp byte [esi+BS_BootSig], 29h 730 0000732E 75F8 <1> jne short loc_not_a_valid_fat_partition4 731 <1> 732 00007330 66837E1600 <1> cmp word [esi+BPB_FATSz16], 0 733 00007335 7604 <1> jna short loc_hd_big_FAT16_BPB 734 <1> ;mov ecx, 32 735 <1> ; 25/07/2022 736 00007337 B120 <1> mov cl, 32 737 <1> ; ecx = 32 738 00007339 EB02 <1> jmp short loc_hd_move_FAT_BPB 739 <1> 740 <1> loc_hd_FAT32_BPB: 741 <1> ;cmp word [esi+BPB_FATSz16], 0 742 <1> ;ja short loc_not_a_valid_fat_partition4 743 <1> loc_hd_big_FAT16_BPB: 744 <1> ;mov ecx, 45 745 <1> ; 25/07/2022 746 0000733B B12D <1> mov cl, 45 747 <1> ; ecx = 45 748 <1> loc_hd_move_FAT_BPB: 749 0000733D 89EF <1> mov edi, ebp 750 <1> ;mov esi, ebx ; Boot sector 751 0000733F 57 <1> push edi 752 00007340 83C706 <1> add edi, LD_BPB 753 00007343 66F3A5 <1> rep movsw 754 00007346 5E <1> pop esi 755 00007347 0FB74614 <1> movzx eax, word [esi+LD_BPB+BPB_RsvdSecCnt] 756 0000734B 03466C <1> add eax, [esi+LD_StartSector] 757 0000734E 894660 <1> mov [esi+LD_FATBegin], eax 758 00007351 807E0303 <1> cmp byte [esi+LD_FATType], 3 759 00007355 7223 <1> jb short loc_set_FAT16_RootDirLoc 760 <1> loc_set_FAT32_RootDirLoc: 761 00007357 8B462A <1> mov eax, [esi+LD_BPB+BPB_FATSz32] 762 0000735A 0FB65E16 <1> movzx ebx, byte [esi+LD_BPB+BPB_NumFATs] 763 0000735E F7E3 <1> mul ebx 764 00007360 034660 <1> add eax, [esi+LD_FATBegin] 765 <1> loc_set_FAT32_data_begin: 766 00007363 894668 <1> mov [esi+LD_DATABegin], eax 767 00007366 894664 <1> mov [esi+LD_ROOTBegin], eax 768 <1> ; If Root Directory Cluster <> 2 then 769 <1> ; change the beginning sector value 770 <1> ; of the root dir by adding sector offset. 771 00007369 8B4632 <1> mov eax, [esi+LD_BPB+BPB_RootClus] 772 <1> ;sub eax, 2 773 <1> ; 30/07/2022 774 0000736C 48 <1> dec eax ; 2 -> 1 775 0000736D 48 <1> dec eax ; 1 -> 0 776 0000736E 7433 <1> jz short short loc_set_32bit_FAT_total_sectors 777 <1> ;movzx ebx, byte [esi+LD_BPB+BPB_SecPerClust] 778 00007370 8A5E13 <1> mov bl, [esi+LD_BPB+BPB_SecPerClust] 779 00007373 F7E3 <1> mul ebx 780 00007375 014664 <1> add [esi+LD_ROOTBegin], eax 781 00007378 EB29 <1> jmp short loc_set_32bit_FAT_total_sectors 782 <1> ; 783 <1> loc_set_FAT16_RootDirLoc: 784 0000737A 0FB64616 <1> movzx eax, byte [esi+LD_BPB+BPB_NumFATs] 785 0000737E 0FB7561C <1> movzx edx, word [esi+LD_BPB+BPB_FATSz16] 786 00007382 F7E2 <1> mul edx 787 00007384 034660 <1> add eax, [esi+LD_FATBegin] 788 00007387 894664 <1> mov [esi+LD_ROOTBegin], eax 789 <1> loc_set_FAT16_data_begin: 790 0000738A 894668 <1> mov [esi+LD_DATABegin], eax 791 <1> ;mov eax, 20h ; Size of a directory entry 792 <1> ;;movzx edx, word [esi+LD_BPB+BPB_RootEntCnt] 793 <1> ;mov dx, [esi+LD_BPB+BPB_RootEntCnt] 794 <1> ;mul edx 795 <1> ;;mov ecx, 511 796 <1> ;mov cx, 511 797 <1> ;add eax, ecx 798 <1> ;inc ecx ; 512 799 <1> ;div ecx 800 <1> ; 14/07/2020 801 0000738D 0FB74617 <1> movzx eax, word [esi+LD_BPB+BPB_RootEntCnt] 802 00007391 6683C00F <1> add ax, 15 803 <1> ;shr ax, 4 ; / 16 ; (16 entries per sector) 804 <1> ; 25/07/2022 805 00007395 C1E804 <1> shr eax, 4 806 00007398 014668 <1> add [esi+LD_DATABegin], eax 807 <1> ;movzx eax, word [esi+LD_BPB+BPB_TotalSec16] 808 0000739B 668B4619 <1> mov ax, [esi+LD_BPB+BPB_TotalSec16] 809 <1> ;test ax, ax 810 <1> ; 25/07/2022 811 0000739F 85C0 <1> test eax, eax 812 <1> ;jz short loc_set_32bit_FAT_total_sectors 813 <1> ;loc_set_16bit_FAT_total_sectors: 814 <1> ;mov [esi+LD_TotalSectors], eax 815 <1> ;jmp short loc_set_hd_FAT_cluster_count 816 <1> ; 14/07/2020 817 000073A1 7503 <1> jnz short loc_set_hd_FAT_cluster_count 818 <1> loc_set_32bit_FAT_total_sectors: 819 000073A3 8B4626 <1> mov eax, [esi+LD_BPB+BPB_TotalSec32] 820 <1> ;mov [esi+LD_TotalSectors], eax 821 <1> loc_set_hd_FAT_cluster_count: 822 000073A6 894670 <1> mov [esi+LD_TotalSectors], eax ; 14/07/2020 823 000073A9 8B5668 <1> mov edx, [esi+LD_DATABegin] 824 000073AC 2B566C <1> sub edx, [esi+LD_StartSector] 825 000073AF 29D0 <1> sub eax, edx 826 000073B1 31D2 <1> xor edx, edx ; 0 827 000073B3 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+BPB_SecPerClust] 828 000073B7 F7F1 <1> div ecx 829 000073B9 894678 <1> mov [esi+LD_Clusters], eax 830 <1> ; Maximum Valid Cluster Number= EAX +1 831 <1> ; with 2 reserved clusters= EAX +2 832 <1> loc_set_hd_FAT_fs_free_sectors: 833 <1> ;mov dword [esi+LD_FreeSectors], 0 834 000073BC E831000000 <1> call get_free_FAT_sectors 835 000073C1 720D <1> jc short loc_validate_hd_FAT_partition_retn 836 000073C3 894674 <1> mov [esi+LD_FreeSectors], eax 837 000073C6 C6467E06 <1> mov byte [esi+LD_MediaChanged], 6 ; Volume Name Reset 838 <1> 839 <1> ; 15/07/2020 840 000073CA FE05[8D2E0100] <1> inc byte [Last_DOS_DiskNo] ; > 1 841 <1> 842 <1> ;mov cl, [Last_DOS_DiskNo] 843 <1> ;add cl, 'A' 844 <1> ;mov [esi+LD_FS_Name], cl 845 <1> 846 <1> loc_validate_hd_FAT_partition_retn: 847 000073D0 C3 <1> retn 848 <1> 849 <1> ; 19/12/2025 850 <1> %if 0 851 <1> 852 <1> validate_hd_fs_partition: 853 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 854 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 855 <1> ; 03/02/2018 856 <1> ; 09/12/2017 857 <1> ; 13/02/2016 858 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 859 <1> ; 29/01/2011 860 <1> ; 23/07/2011 861 <1> ; Input 862 <1> ; DL = Hard/Fixed Disk Drive Number 863 <1> ; ESI = PartitionTable offset 864 <1> ; byte [Last_DOS_DiskNo] 865 <1> ; Output 866 <1> ; cf=0 -> Validated 867 <1> ; ESI = Logical dos drv desc. table 868 <1> ; EBX = Singlix FS boot sector buffer 869 <1> ; byte [Last_DOS_DiskNo] 870 <1> ; cf=1 -> Not a valid 'Singlix FS' partition 871 <1> ; EAX, EDX, ECX, EDI -> changed 872 <1> 873 <1> ;mov esi, PartitionTable 874 <1> mov ah, [esi+ptFileSystemID] 875 <1> cmp ah, 0A1h ; SINGLIX FS1 (trfs1) partition 876 <1> jne short loc_validate_hd_fs_partition_stc_retn 877 <1> loc_set_valid_hd_fs_partition_params: 878 <1> inc byte [Last_DOS_DiskNo] ; > 1 879 <1> xor al, al ; mov al, 0 880 <1> ;mov [drv], dl 881 <1> sub ebx, ebx ; 0 882 <1> mov bh, [Last_DOS_DiskNo] 883 <1> add ebx, Logical_DOSDisks 884 <1> mov byte [ebx+LD_DiskType], 2 885 <1> mov [ebx+LD_PhyDrvNo], dl 886 <1> ;mov [ebx+LD_FATType], al ; 0 887 <1> ;mov [ebx+LD_FSType], ah 888 <1> mov [ebx+LD_FATType], ax 889 <1> ;mov eax, [esi+ptStartSector] 890 <1> ;mov [ebx+LD_StartSector], eax 891 <1> loc_hd_fs_logical_drv_init: 892 <1> mov ebp, ebx ; 10/01/2016 893 <1> ;mov dl, [ebx+LD_PhyDrvNo] 894 <1> mov al, [HD_LBA_yes] ; 10/01/2016 895 <1> mov [ebx+LD_LBAYes], al 896 <1> mov esi, ebx 897 <1> mov ebx, DOSBootSectorBuff ; buffer address 898 <1> or al, al 899 <1> jnz short loc_hd_fs_drv_init_load_bs_lba 900 <1> loc_hd_fs_drv_init_load_bs_chs: 901 <1> mov dh, [esi+ptBeginHead] 902 <1> mov cx, [esi+ptBeginSector] 903 <1> mov ax, 0201h ; Read 1 sector 904 <1> ;mov ebx, DOSBootSectorBuff 905 <1> call int13h 906 <1> jnc short loc_hd_drv_fs_boot_validation 907 <1> loc_validate_hd_fs_partition_err_retn: 908 <1> retn 909 <1> loc_validate_hd_fs_partition_stc_retn: 910 <1> stc 911 <1> retn 912 <1> loc_hd_fs_drv_init_load_bs_lba: 913 <1> ; DL = Physical drive number 914 <1> ;mov esi, ebx 915 <1> mov ecx, [esi+ptStartSector] ; sector number 916 <1> ;mov ebx, DOSBootSectorBuff ; buffer address 917 <1> ; LBA read/write (with private LBA function) 918 <1> ;((Retro UNIX 386 v1 - DISK I/O code by Erdogan Tan)) 919 <1> ; dl = physical drive number (0,1, 80h, 81h, 82h, 83h) 920 <1> mov ah, 1Bh ; LBA read 921 <1> mov al, 1 ; sector count 922 <1> call int13h 923 <1> jc short loc_validate_hd_fs_partition_err_retn 924 <1> loc_hd_drv_fs_boot_validation: 925 <1> ;mov esi, DOSBootSectorBuff 926 <1> mov esi, ebx ; Boot sector buffer 927 <1> cmp word [esi+BS_Validation], 0AA55h 928 <1> jne short loc_validate_hd_fs_partition_stc_retn 929 <1> ; 930 <1> ;Singlix FS Extensions to TR-DOS (7/6/2009) 931 <1> cmp word [esi+bs_FS_Identifier], 'FS' ; 03/02/2018 932 <1> jne short loc_validate_hd_fs_partition_stc_retn 933 <1> ;'A1h' check is not necessary 934 <1> ; if 'FS' check is passed as OK/Yes. 935 <1> cmp byte [esi+bs_FS_PartitionID], 0A1h 936 <1> jne short loc_validate_hd_fs_partition_stc_retn 937 <1> ; 938 <1> mov edi, ebp ; 10/01/2016 939 <1> ; 940 <1> mov al, byte [esi+bs_FS_LBA_Ready] 941 <1> mov [edi+LD_FS_LBAYes], al 942 <1> ; 943 <1> ; 03/01/2010 CHS -> DOS FAT/BPB compatibility fix 944 <1> mov al, [esi+bs_FS_MediaAttrib] 945 <1> mov byte [edi+LD_FS_MediaAttrib], al 946 <1> ; 947 <1> mov al, [esi+bs_FS_VersionMaj] 948 <1> mov [edi+LD_FS_VersionMajor], al 949 <1> ; 950 <1> mov ax, [esi+bs_FS_BytesPerSec] 951 <1> mov [edi+LD_FS_BytesPerSec], ax 952 <1> mov al, [esi+bs_FS_SecPerTrack] 953 <1> xor ah, ah ; 09/12/2017 954 <1> mov [edi+LD_FS_SecPerTrack], ax 955 <1> mov al, [esi+bs_FS_Heads] 956 <1> mov [edi+LD_FS_NumHeads], ax 957 <1> ; 958 <1> mov eax, [esi+bs_FS_UnDelDirD] 959 <1> mov [edi+LD_FS_UnDelDirD], eax 960 <1> mov edx, [esi+bs_FS_MATLocation] 961 <1> mov [edi+LD_FS_MATLocation], edx 962 <1> mov eax, [esi+bs_FS_RootDirD] 963 <1> mov [edi+LD_FS_RootDirD], eax 964 <1> mov eax, [esi+bs_FS_BeginSector] 965 <1> mov [edi+LD_FS_BeginSector], eax 966 <1> mov eax, [edi+bs_FS_VolumeSize] 967 <1> mov [edi+LD_FS_VolumeSize], eax 968 <1> ; 969 <1> mov eax, edx ; [edi+LD_FS_MATLocation] 970 <1> add eax, [edi+LD_FS_BeginSector] 971 <1> mov esi, edi 972 <1> mread_hd_fs_MAT_sector: 973 <1> ;mov ebx, DOSBootSectorBuff 974 <1> ;mov ecx, 1 975 <1> ; 25/07/2022 976 <1> sub ecx, ecx 977 <1> inc cl 978 <1> ; ecx = 1 979 <1> call disk_read 980 <1> jc short loc_validate_hd_fs_partition_retn 981 <1> ; EDI will not be changed 982 <1> mov esi, ebx 983 <1> use_hdfs_mat_sector_params: 984 <1> mov eax, [esi+FS_MAT_DATLocation] 985 <1> mov [edi+LD_FS_DATLocation], eax 986 <1> mov eax, [esi+FS_MAT_DATScount] 987 <1> mov [edi+LD_FS_DATSectors], eax 988 <1> mov eax, [esi+FS_MAT_FreeSectors] 989 <1> mov [edi+LD_FS_FreeSectors], eax 990 <1> mov eax, [esi+FS_MAT_FirstFreeSector] 991 <1> mov [edi+LD_FS_FirstFreeSector], eax 992 <1> mov eax, [edi+LD_FS_RootDirD] 993 <1> add eax, [edi+LD_FS_BeginSector] 994 <1> mov esi, edi 995 <1> read_hd_fs_RDT_sector: 996 <1> mov ebx, DOSBootSectorBuff 997 <1> ;mov ecx, 1 998 <1> mov cl, 1 999 <1> call disk_read 1000 <1> jc short loc_validate_hd_fs_partition_retn 1001 <1> ; EDI will not be changed 1002 <1> mov esi, ebx 1003 <1> use_hdfs_RDT_sector_params: 1004 <1> mov eax, [esi+FS_RDT_VolumeSerialNo] 1005 <1> mov [edi+LD_FS_VolumeSerial], eax 1006 <1> push edi 1007 <1> ;mov ecx, 16 1008 <1> mov cl, 16 1009 <1> add esi, FS_RDT_VolumeName 1010 <1> add edi, LD_FS_VolumeName 1011 <1> rep movsd ; 64 bytes 1012 <1> pop esi 1013 <1> ; Volume Name Reset 1014 <1> mov byte [esi+LD_FS_MediaChanged], 6 1015 <1> ; 1016 <1> ;mov cl, [Last_DOS_DiskNo] 1017 <1> ;add cl, 'A' 1018 <1> ;mov [esi+LD_FS_Name], cl 1019 <1> 1020 <1> loc_validate_hd_fs_partition_retn: 1021 <1> retn 1022 <1> 1023 <1> %endif 1024 <1> 1025 <1> load_masterboot: 1026 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1027 <1> ; 14/07/2020 (Reset function has been removed) 1028 <1> ; 1029 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1030 <1> ; 2005 - 2011 1031 <1> ; input -> DL = drive number 1032 <1> ; mov ah, 0Dh ; Alternate disk reset 1033 <1> ; call int13h 1034 <1> ; jnc short pass_reset_error 1035 <1> ;harddisk_error: 1036 <1> ; retn 1037 <1> ;pass_reset_error: 1038 000073D1 BB[76790100] <1> mov ebx, MasterBootBuff 1039 <1> ;mov ax, 0201h 1040 <1> ;mov cx, 1 1041 <1> ; 25/07/2022 1042 <1> ;xor ecx, ecx 1043 <1> ;inc cl 1044 000073D6 B101 <1> mov cl, 1 1045 <1> ; ecx = 1 1046 000073D8 89C8 <1> mov eax, ecx ; ch = cylinder = 0 1047 000073DA B402 <1> mov ah, 2 ; chs read 1048 <1> ; eax = 0201h 1049 000073DC 30F6 <1> xor dh, dh ; head = 0 1050 000073DE E82CDCFFFF <1> call int13h 1051 000073E3 720C <1> jc short harddisk_error 1052 <1> ; 1053 000073E5 66813D[747B0100]55- <1> cmp word [MBIDCode], 0AA55h 1053 000073ED AA <1> 1054 000073EE 7401 <1> je short load_masterboot_ok 1055 000073F0 F9 <1> stc 1056 <1> harddisk_error: 1057 <1> load_masterboot_ok: 1058 000073F1 C3 <1> retn 1059 <1> 1060 <1> get_free_FAT_sectors: 1061 <1> ; 29/08/2023 1062 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1063 <1> ; 21/12/2017 1064 <1> ; 29/02/2016 1065 <1> ; 13/02/2016 1066 <1> ; 04/02/2016 1067 <1> ; 07/01/2016 (TRDOS 386 = TRDOS v2.0) 1068 <1> ; 11/07/2010 1069 <1> ; 21/06/2009 1070 <1> ; INPUT: ESI = Logical DOS Drive Description Table address 1071 <1> ; OUTPUT: STC => Error 1072 <1> ; cf = 0 and EAX = Free FAT sectors 1073 <1> ; Also, related parameters and FAT buffer will be reset and updated 1074 <1> 1075 000073F2 31C0 <1> xor eax, eax 1076 <1> ;mov [esi+LD_FreeSectors], eax ; Reset 1077 <1> 1078 000073F4 807E0302 <1> cmp byte [esi+LD_FATType], 2 1079 000073F8 7653 <1> jna short loc_gfc_get_fat_free_clusters 1080 <1> 1081 <1> ; 29/02/2016 1082 000073FA 48 <1> dec eax ; 0FFFFFFFFh 1083 000073FB 89463A <1> mov [esi+LD_BPB+BPB_Reserved], eax ; Free cluster count (reset) 1084 000073FE 89463E <1> mov [esi+LD_BPB+BPB_Reserved+4], eax ; First Free Cluster (reset) 1085 00007401 40 <1> inc eax ; 0 1086 <1> ; 1087 00007402 668B4636 <1> mov ax, [esi+LD_BPB+BPB_FSInfo] 1088 00007406 03466C <1> add eax, [esi+LD_StartSector] 1089 <1> 1090 00007409 BB[867C0100] <1> mov ebx, DOSBootSectorBuff 1091 <1> ;mov ecx, 1 1092 <1> ; 25/07/2022 1093 0000740E 31C9 <1> xor ecx, ecx 1094 00007410 FEC1 <1> inc cl 1095 <1> ; ecx = 1 1096 00007412 E8DCA50000 <1> call disk_read 1097 00007417 7301 <1> jnc short loc_gfc_check_fsinfo_signs 1098 <1> retn_gfc_get_fsinfo_sec: 1099 00007419 C3 <1> retn 1100 <1> 1101 <1> loc_gfc_check_fsinfo_signs: 1102 0000741A BB[867C0100] <1> mov ebx, DOSBootSectorBuff ; 13/02/2016 1103 0000741F 813B52526141 <1> cmp dword [ebx], 41615252h 1104 00007425 7524 <1> jne short retn_gfc_get_fsinfo_stc 1105 <1> ;add ebx, 484 1106 <1> ;cmp dword [ebx], 61417272h 1107 00007427 81BBE4010000727241- <1> cmp dword [ebx+484], 61417272h 1107 00007430 61 <1> 1108 00007431 7518 <1> jne short retn_gfc_get_fsinfo_stc 1109 <1> ;add ebx, 4 1110 <1> ;mov eax, [ebx] 1111 00007433 8B83E8010000 <1> mov eax, [ebx+488] 1112 <1> ; 29/02/2016 1113 00007439 89463A <1> mov [esi+LD_BPB+BPB_Reserved], eax ; Free cluster count 1114 0000743C 8B93EC010000 <1> mov edx, [ebx+492] 1115 <1> ; 29/08/2023 (BugFix) 1116 00007442 89563E <1> mov [esi+LD_BPB+BPB_Reserved+4], edx ; First Free Cluster 1117 <1> ; 21/12/2017 1118 00007445 89C3 <1> mov ebx, eax ; (initial value = 0FFFFFFFFh) 1119 00007447 43 <1> inc ebx ; 0FFFFFFFFh -> 0 1120 00007448 7513 <1> jnz short short retn_from_get_free_fat32_clusters 1121 0000744A C3 <1> retn 1122 <1> 1123 <1> retn_gfc_get_fsinfo_stc: 1124 0000744B F9 <1> stc 1125 0000744C C3 <1> retn 1126 <1> 1127 <1> loc_gfc_get_fat_free_clusters: 1128 <1> ;mov eax, 2 1129 0000744D B002 <1> mov al, 2 1130 <1> ;mov [FAT_CurrentCluster], eax 1131 <1> loc_gfc_loop_get_next_cluster: 1132 0000744F E8354B0000 <1> call get_next_cluster 1133 00007454 730E <1> jnc short loc_gfc_free_fat_clusters_cont 1134 00007456 21C0 <1> and eax, eax 1135 00007458 7411 <1> jz short loc_gfc_pass_inc_free_cluster_count 1136 <1> 1137 <1> retn_from_get_free_fat_clusters: 1138 0000745A 8B4674 <1> mov eax, [esi+LD_FreeSectors] ; Free clusters ! 1139 <1> retn_from_get_free_fat32_clusters: 1140 0000745D 0FB65E13 <1> movzx ebx, byte [esi+LD_BPB+BPB_SecPerClust] 1141 00007461 F7E3 <1> mul ebx 1142 <1> ;mov [esi+LD_FreeSectors], eax ; Free sectors 1143 <1> retn_get_free_sectors_calc: 1144 00007463 C3 <1> retn 1145 <1> 1146 <1> loc_gfc_free_fat_clusters_cont: 1147 00007464 09C0 <1> or eax, eax 1148 00007466 7503 <1> jnz short loc_gfc_pass_inc_free_cluster_count 1149 00007468 FF4674 <1> inc dword [esi+LD_FreeSectors] ; Free clusters ! 1150 <1> 1151 <1> loc_gfc_pass_inc_free_cluster_count: 1152 <1> ;mov eax, [FAT_CurrentCluster] 1153 0000746B 89C8 <1> mov eax, ecx ; [FAT_CurrentCluster] 1154 0000746D 3B4678 <1> cmp eax, [esi+LD_Clusters] 1155 00007470 77E8 <1> ja short retn_from_get_free_fat_clusters 1156 00007472 40 <1> inc eax 1157 <1> ;mov [FAT_CurrentCluster], eax 1158 00007473 EBDA <1> jmp short loc_gfc_loop_get_next_cluster 1159 <1> 1160 <1> floppy_drv_init: 1161 <1> ; 19/12/2025 (TRDOS 386 Kenrel v2.0.10) 1162 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1163 <1> ; 09/12/2017 1164 <1> ; 06/07/2016 1165 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1166 <1> ; 24/07/2011 1167 <1> ; 04/07/2009 1168 <1> ; INPUT -> 1169 <1> ; DL = Drive number (0,1) 1170 <1> ; OUTPUT -> 1171 <1> ; BL = drive name 1172 <1> ; BH = drive number 1173 <1> ; ESI = Logical DOS drv description table 1174 <1> ; EAX = Volume serial number 1175 <1> 1176 00007475 BE[8C660000] <1> mov esi, fd0_type ; 10/01/2016 1177 0000747A BF00010900 <1> mov edi, Logical_DOSDisks 1178 0000747F 08D2 <1> or dl, dl 1179 00007481 7407 <1> jz short loc_drv_init_fd0_fd1 1180 00007483 81C700010000 <1> add edi, 100h 1181 00007489 46 <1> inc esi ; fd1_type ; 10/01/2016 1182 <1> loc_drv_init_fd0_fd1: 1183 0000748A C6477E00 <1> mov byte [edi+LD_MediaChanged], 0 1184 0000748E 803E01 <1> cmp byte [esi], 1 ; type (>0 if it is existing) 1185 <1> ; 4 = 1.44 MB, 80 track, 3 1/2" 1186 00007491 7221 <1> jb short read_fd_boot_sector_retn 1187 00007493 885702 <1> mov [edi+LD_PhyDrvNo], dl 1188 <1> read_fd_boot_sector: 1189 00007496 30F6 <1> xor dh, dh 1190 00007498 B904000000 <1> mov ecx, 4 ; Retry Count 1191 <1> read_fd_boot_sector_again: 1192 0000749D 51 <1> push ecx 1193 <1> ;mov cx, 1 1194 0000749E B101 <1> mov cl, 1 1195 000074A0 66B80102 <1> mov ax, 0201h ; Read 1 sector 1196 000074A4 BB[867C0100] <1> mov ebx, DOSBootSectorBuff 1197 000074A9 E861DBFFFF <1> call int13h 1198 000074AE 59 <1> pop ecx 1199 000074AF 7304 <1> jnc short use_fd_boot_sector_params 1200 000074B1 E2EA <1> loop read_fd_boot_sector_again 1201 <1> 1202 <1> read_fd_boot_sector_stc_retn: 1203 000074B3 F9 <1> stc 1204 <1> read_fd_boot_sector_retn: 1205 000074B4 C3 <1> retn 1206 <1> 1207 <1> use_fd_boot_sector_params: 1208 <1> ;mov esi, DOSBootSectorBuff 1209 000074B5 89DE <1> mov esi, ebx 1210 000074B7 6681BEFE01000055AA <1> cmp word [esi+BS_Validation], 0AA55h 1211 000074C0 75F1 <1> jne short read_fd_boot_sector_stc_retn 1212 <1> 1213 <1> ; 19/12/2025 1214 <1> %if 0 1215 <1> cmp word [esi+bs_FS_Identifier], 'SF' 1216 <1> ;jne use_fd_fatfs_boot_sector_params 1217 <1> ; 25/07/2022 1218 <1> je short use_fdfs_boot_sector_params 1219 <1> jmp use_fd_fatfs_boot_sector_params 1220 <1> use_fdfs_boot_sector_params: 1221 <1> mov al, [esi+bs_FS_LBA_Ready] 1222 <1> mov [edi+LD_FS_LBAYes], al 1223 <1> ; 1224 <1> ; 03/01/2010 CHS -> DOS FAT/BPB compatibility fix 1225 <1> mov al, [esi+bs_FS_MediaAttrib] 1226 <1> mov [edi+LD_FS_MediaAttrib], al 1227 <1> ; 1228 <1> mov al, [esi+bs_FS_VersionMaj] 1229 <1> mov byte [edi+LD_FS_VersionMajor], al 1230 <1> mov ax, [esi+bs_FS_BytesPerSec] 1231 <1> mov [edi+LD_FS_BytesPerSec], ax 1232 <1> mov al, [esi+bs_FS_SecPerTrack] 1233 <1> sub ah, ah ; 09/12/2017 1234 <1> mov [edi+LD_FS_SecPerTrack], ax 1235 <1> mov al, [esi+bs_FS_Heads] 1236 <1> mov [edi+LD_FS_NumHeads], ax 1237 <1> ; 1238 <1> mov eax, [esi+bs_FS_UnDelDirD] 1239 <1> mov [edi+LD_FS_UnDelDirD], eax 1240 <1> mov eax, [esi+bs_FS_MATLocation] 1241 <1> mov [edi+LD_FS_MATLocation], eax 1242 <1> mov eax, [esi+bs_FS_RootDirD] 1243 <1> mov [edi+LD_FS_RootDirD], eax 1244 <1> mov eax, [esi+bs_FS_BeginSector] 1245 <1> mov [edi+LD_FS_BeginSector], eax 1246 <1> mov eax, [esi+bs_FS_VolumeSize] 1247 <1> mov [edi+LD_FS_VolumeSize], eax 1248 <1> ; 1249 <1> mov esi, edi 1250 <1> mov eax, [esi+LD_FS_MATLocation] 1251 <1> ;add eax, [edi+LD_FS_BeginSector] 1252 <1> read_fd_MAT_sector_again: 1253 <1> ;mov ebx, DOSBootSectorBuff 1254 <1> ;mov ecx, 1 1255 <1> mov cl, 1 1256 <1> call chs_read 1257 <1> mov esi, ebx 1258 <1> ;jnc short use_fdfs_mat_sector_params 1259 <1> ;jmp short read_fd_boot_sector_retn 1260 <1> ;retn 1261 <1> ; 25/07/2022 1262 <1> jc short read_fd_RDT_sector_retn 1263 <1> use_fdfs_mat_sector_params: 1264 <1> mov eax, [esi+FS_MAT_DATLocation] 1265 <1> mov [edi+LD_FS_DATLocation], eax 1266 <1> mov eax, [esi+FS_MAT_DATScount] 1267 <1> mov [edi+LD_FS_DATSectors], eax 1268 <1> mov eax, [edi+FS_MAT_FreeSectors] 1269 <1> mov [edi+LD_FS_FreeSectors], eax 1270 <1> mov eax, [esi+FS_MAT_FirstFreeSector] 1271 <1> mov [edi+LD_FS_FirstFreeSector], eax 1272 <1> ; 1273 <1> mov esi, edi 1274 <1> mov eax, [esi+LD_FS_RootDirD] 1275 <1> read_fd_RDT_sector_again: 1276 <1> ;mov ebx, DOSBootSectorBuff 1277 <1> ;mov cx, 1 1278 <1> mov cl, 1 1279 <1> call chs_read 1280 <1> mov esi, ebx 1281 <1> jc short read_fd_RDT_sector_retn 1282 <1> use_fdfs_RDT_sector_params: 1283 <1> mov eax, [esi+FS_RDT_VolumeSerialNo] 1284 <1> mov [edi+LD_FS_VolumeSerial], eax 1285 <1> push edi 1286 <1> ;mov ecx, 16 1287 <1> mov cl, 16 1288 <1> add esi, FS_RDT_VolumeName 1289 <1> add edi, LD_FS_VolumeName 1290 <1> rep movsd ; 64 bytes 1291 <1> pop esi 1292 <1> mov byte [esi+LD_FATType], 0 1293 <1> mov byte [esi+LD_FSType], 0A1h 1294 <1> jmp loc_cont_use_fd_boot_sector_params 1295 <1> 1296 <1> read_fd_RDT_sector_stc_retn: 1297 <1> stc 1298 <1> read_fd_RDT_sector_retn: 1299 <1> retn 1300 <1> %endif 1301 <1> 1302 <1> use_fd_fatfs_boot_sector_params: 1303 000074C2 807E2629 <1> cmp byte [esi+BS_BootSig], 29h 1304 <1> ;jne short read_fd_RDT_sector_stc_retn 1305 <1> ; 19/12/2025 1306 000074C6 75EB <1> jne short read_fd_boot_sector_stc_retn 1307 000074C8 807E15F0 <1> cmp byte [esi+BPB_Media], 0F0h 1308 <1> ;jb short read_fd_RDT_sector_retn 1309 <1> ; 19/12/2025 1310 000074CC 72E6 <1> jb short read_fd_boot_sector_retn 1311 000074CE 57 <1> push edi 1312 000074CF 83C706 <1> add edi, LD_BPB 1313 <1> ;mov ecx, 16 1314 000074D2 B110 <1> mov cl, 16 1315 000074D4 F3A5 <1> rep movsd ; 64 bytes 1316 000074D6 5E <1> pop esi 1317 000074D7 31C0 <1> xor eax, eax 1318 000074D9 89466C <1> mov [esi+LD_StartSector], eax ; 0 1319 000074DC 668B461C <1> mov ax, [esi+LD_BPB+BPB_FATSz16] 1320 000074E0 8A4E16 <1> mov cl, [esi+LD_BPB+BPB_NumFATs] 1321 000074E3 F7E1 <1> mul ecx 1322 <1> ; edx = 0 ! 1323 000074E5 668B5614 <1> mov dx, [esi+LD_BPB+BPB_RsvdSecCnt] 1324 000074E9 66895660 <1> mov [esi+LD_FATBegin], dx 1325 <1> ; 25/07/2022 1326 000074ED 01D0 <1> add eax, edx 1327 <1> ;add ax, dx 1328 000074EF 894664 <1> mov [esi+LD_ROOTBegin], eax 1329 000074F2 894668 <1> mov [esi+LD_DATABegin], eax 1330 000074F5 668B5617 <1> mov dx, [esi+LD_BPB+BPB_RootEntCnt] 1331 <1> ;;shl edx, 5 ; * 32 (Size of a directory entry) 1332 <1> ;shl dx, 5 1333 <1> ;;add edx, 511 1334 <1> ;add dx, 511 1335 <1> ;;shr edx, 9 ; edx = ((edx*32)+511) / 512 1336 <1> ;shr dx, 9 1337 000074F9 6683C20F <1> add dx, 15 ; 06/07/2016 (+(512/32)-1) 1338 <1> ;shr dx, 4 ; / 16 (==16 entries per sector) 1339 <1> ; 25/07/2022 1340 000074FD C1EA04 <1> shr edx, 4 1341 00007500 015668 <1> add [esi+LD_DATABegin], edx ; + rd sectors 1342 <1> ;movzx eax, word [esi+LD_BPB+BPB_TotalSec16] 1343 00007503 668B4619 <1> mov ax, [esi+LD_BPB+BPB_TotalSec16] 1344 00007507 894670 <1> mov [esi+LD_TotalSectors], eax 1345 0000750A 2B4668 <1> sub eax, [esi+LD_DATABegin] 1346 <1> ;movzx ecx, byte [esi+LD_BPB+BPB_SecPerClust] 1347 0000750D 8A4E13 <1> mov cl, [esi+LD_BPB+BPB_SecPerClust] 1348 00007510 80F901 <1> cmp cl, 1 1349 00007513 7604 <1> jna short save_fd_fatfs_cluster_count 1350 <1> ; 25/07/2022 1351 00007515 29D2 <1> sub edx, edx 1352 <1> ;sub dx, dx ; 0 1353 <1> ;sub dl, dl ; 06/07/2016 1354 00007517 F7F1 <1> div ecx 1355 <1> save_fd_fatfs_cluster_count: 1356 00007519 894678 <1> mov [esi+LD_Clusters], eax 1357 <1> 1358 <1> ; Maximum Valid Cluster Number = EAX +1 1359 <1> ; with 2 reserved clusters = EAX +2 1360 <1> 1361 <1> reset_FAT_buffer_decriptors: 1362 0000751C 29C0 <1> sub eax, eax ; 0 1363 0000751E A2[8A7E0100] <1> mov [FAT_BuffValidData], al ; 0 1364 00007523 A2[8B7E0100] <1> mov [FAT_BuffDrvName], al ; 0 1365 00007528 A3[8E7E0100] <1> mov [FAT_BuffSector], eax ; 0 1366 <1> 1367 <1> read_fd_FAT_sectors: 1368 0000752D BB001C0900 <1> mov ebx, FAT_Buffer 1369 00007532 668B4614 <1> mov ax, [esi+LD_BPB+BPB_RsvdSecCnt] 1370 <1> ;mov ecx, 3 1371 00007536 B103 <1> mov cl, 3 ; 3 sectors 1372 00007538 E8BCA40000 <1> call chs_read 1373 0000753D 7240 <1> jc short read_fd_FAT_sectors_retn 1374 <1> use_fd_FAT_sectors: 1375 0000753F 8A4602 <1> mov al, [esi+LD_PhyDrvNo] 1376 00007542 0441 <1> add al, 'A' 1377 00007544 A2[8B7E0100] <1> mov [FAT_BuffDrvName], al 1378 00007549 C605[8A7E0100]01 <1> mov byte [FAT_BuffValidData], 1 1379 00007550 E82B000000 <1> call fd_init_calculate_free_clusters 1380 00007555 7228 <1> jc short read_fd_FAT_sectors_retn 1381 <1> 1382 <1> loc_use_fd_boot_sector_params_FAT: 1383 00007557 C6460301 <1> mov byte [esi+LD_FATType], 1 ; FAT 12 1384 0000755B C6460401 <1> mov byte [esi+LD_FSType], 1 1385 0000755F 8B462D <1> mov eax, [esi+LD_BPB+VolumeID] 1386 <1> loc_cont_use_fd_boot_sector_params: 1387 00007562 8A7E02 <1> mov bh, [esi+LD_PhyDrvNo] 1388 00007565 887E7D <1> mov [esi+LD_DParamEntry], bh 1389 00007568 88FB <1> mov bl, bh 1390 0000756A 80C341 <1> add bl, 'A' 1391 0000756D 881E <1> mov byte [esi+LD_Name], bl 1392 0000756F C6460101 <1> mov byte [esi+LD_DiskType], 1 1393 00007573 C6460500 <1> mov byte [esi+LD_LBAYes], 0 1394 00007577 C6467C00 <1> mov byte [esi+LD_PartitionEntry], 0 1395 0000757B C6467E06 <1> mov byte [esi+LD_MediaChanged], 6 ; Volume Name Reset 1396 <1> 1397 <1> read_fd_FAT_sectors_retn: 1398 0000757F C3 <1> retn 1399 <1> 1400 <1> fd_init_calculate_free_clusters: 1401 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1402 <1> ; 09/12/2017 1403 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1404 <1> ; 04/07/2009 1405 <1> ; INPUT -> 1406 <1> ; ESI = Logical DOS drive description table address 1407 <1> ; OUTPUT -> 1408 <1> ; [ESI+LD_FreeSectors] will be set 1409 <1> 1410 00007580 29C0 <1> sub eax, eax 1411 00007582 894674 <1> mov [esi+LD_FreeSectors], eax ; 0 1412 00007585 B002 <1> mov al, 2 ; eax = 2 1413 <1> 1414 <1> fd_init_loop_get_next_cluster: 1415 00007587 E828000000 <1> call fd_init_get_next_cluster 1416 0000758C 7225 <1> jc short fd_init_calculate_free_clusters_retn 1417 <1> 1418 <1> fd_init_free_fat_clusters: 1419 <1> ;cmp eax, 0 1420 <1> ;ja short fd_init_pass_inc_free_cluster_count 1421 <1> ;and eax, eax 1422 <1> ;jnz short fd_init_pass_inc_free_cluster_count 1423 <1> ;and ax, ax 1424 0000758E 21C0 <1> and eax, eax ; 25/07/2022 1425 00007590 7503 <1> jnz short fd_init_pass_inc_free_cluster_count 1426 <1> ; 25/07/2022 1427 00007592 FF4674 <1> inc dword [esi+LD_FreeSectors] 1428 <1> ;inc word [esi+LD_FreeSectors] 1429 <1> 1430 <1> fd_init_pass_inc_free_cluster_count: 1431 <1> ; 25/07/2022 1432 00007595 A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 1433 <1> ;mov ax, [FAT_CurrentCluster] 1434 0000759A 3B4678 <1> cmp eax, [esi+LD_Clusters] 1435 <1> ;cmp ax, [esi+LD_Clusters] 1436 0000759D 7703 <1> ja short short retn_from_fd_init_calculate_free_clusters 1437 0000759F 40 <1> inc eax 1438 <1> ;inc ax 1439 000075A0 EBE5 <1> jmp short fd_init_loop_get_next_cluster 1440 <1> 1441 <1> retn_from_fd_init_calculate_free_clusters: 1442 <1> ; 25/07/2022 1443 <1> ;xor eax, eax 1444 000075A2 30E4 <1> xor ah, ah 1445 000075A4 8A4613 <1> mov al, [esi+LD_BPB+BPB_SecPerClust] 1446 000075A7 3C01 <1> cmp al, 1 1447 000075A9 7608 <1> jna short fd_init_calculate_free_clusters_retn 1448 <1> ;;movzx eax, al 1449 <1> ;xor ah, ah ; 09/12/2017 1450 <1> ; 25/07/2022 1451 000075AB 8B4E74 <1> mov ecx, [esi+LD_FreeSectors] 1452 <1> ;mov cx, [esi+LD_FreeSectors] ; Count of free clusters 1453 000075AE F7E1 <1> mul ecx 1454 <1> ;mul cx 1455 000075B0 894674 <1> mov [esi+LD_FreeSectors], eax 1456 <1> ;mov [esi+LD_FreeSectors], ax 1457 <1> fd_init_calculate_free_clusters_retn: 1458 000075B3 C3 <1> retn 1459 <1> 1460 <1> fd_init_get_next_cluster: 1461 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1462 <1> ; 04/02/2016 1463 <1> ; 02/02/2016 1464 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1465 <1> ; 04/07/2009 1466 <1> ; INPUT -> 1467 <1> ; EAX = Current cluster 1468 <1> ; ESI = Logical DOS drive description table address 1469 <1> ; EDX = 0 1470 <1> ; OUTPUT -> 1471 <1> ; EAX = Next cluster 1472 <1> 1473 000075B4 A3[867E0100] <1> mov [FAT_CurrentCluster], eax 1474 <1> fd_init_get_next_cluster_readnext: 1475 000075B9 29D2 <1> sub edx, edx ; 0 1476 000075BB BB00040000 <1> mov ebx, 1024 ; 400h 1477 000075C0 F7F3 <1> div ebx 1478 <1> ; EAX = Count of 3 FAT sectors 1479 <1> ; EDX = Buffer entry index 1480 000075C2 89C1 <1> mov ecx, eax 1481 <1> ;mov eax, 3 1482 000075C4 B003 <1> mov al, 3 1483 000075C6 F7E2 <1> mul edx ; Multiply by 3 1484 <1> ;shr ax, 1 ; Divide by 2 1485 <1> ; 25/07/2022 1486 000075C8 D1E8 <1> shr eax, 1 1487 000075CA 89C3 <1> mov ebx, eax ; Buffer byte offset 1488 000075CC 81C3001C0900 <1> add ebx, FAT_Buffer 1489 000075D2 89C8 <1> mov eax, ecx 1490 <1> ;mov edx, 3 1491 000075D4 66BA0300 <1> mov dx, 3 1492 000075D8 F7E2 <1> mul edx 1493 <1> ; EAX = FAT Beginning Sector 1494 <1> ; EDX = 0 1495 000075DA 8A0E <1> mov cl, [esi+LD_Name] 1496 <1> ;cmp byte [FAT_BuffValidData], 0 1497 <1> ;jna short fd_init_load_FAT_sectors0 1498 000075DC 3A0D[8B7E0100] <1> cmp cl, [FAT_BuffDrvName] 1499 000075E2 751D <1> jne short fd_init_load_FAT_sectors0 1500 000075E4 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 1501 000075EA 751B <1> jne short fd_init_load_FAT_sectors1 1502 <1> ; 25/07/2022 1503 000075EC A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 1504 <1> ;mov al, [FAT_CurrentCluster] 1505 000075F1 D1E8 <1> shr eax, 1 1506 <1> ;shr al, 1 1507 000075F3 668B03 <1> mov ax, [ebx] 1508 000075F6 7305 <1> jnc short fd_init_gnc_even 1509 <1> ;shr ax, 4 1510 <1> ; 25/04/2022 1511 000075F8 C1E804 <1> shr eax, 4 1512 <1> fd_init_gnc_clc_retn: 1513 000075FB F8 <1> clc 1514 000075FC C3 <1> retn 1515 <1> 1516 <1> fd_init_gnc_even: 1517 000075FD 80E40F <1> and ah, 0Fh 1518 00007600 C3 <1> retn 1519 <1> 1520 <1> fd_init_load_FAT_sectors0: 1521 00007601 880D[8B7E0100] <1> mov [FAT_BuffDrvName], cl 1522 <1> fd_init_load_FAT_sectors1: 1523 00007607 C605[8A7E0100]00 <1> mov byte [FAT_BuffValidData], 0 1524 0000760E A3[8E7E0100] <1> mov [FAT_BuffSector], eax 1525 00007613 034660 <1> add eax, [esi+LD_FATBegin] 1526 00007616 BB001C0900 <1> mov ebx, FAT_Buffer 1527 <1> ;movzx ecx, word [esi+LD_BPB+BPB_FATSz16] 1528 0000761B 668B4E1C <1> mov cx, [esi+LD_BPB+BPB_FATSz16] 1529 <1> ;sub cx, [FAT_BuffSector] 1530 <1> ; 25/07/2022 1531 0000761F 2B0D[8E7E0100] <1> sub ecx, [FAT_BuffSector] 1532 <1> ;sub edx, edx 1533 00007625 B203 <1> mov dl, 3 1534 <1> ; edx = 3 1535 <1> ;;cmp ecx, 3 1536 <1> ;cmp cx, 3 1537 00007627 39D1 <1> cmp ecx, edx ; 3 1538 00007629 7602 <1> jna short fdinit_pass_fix_sector_count_3 1539 <1> ;;mov ecx, 3 1540 <1> ;mov ecx, 3 1541 0000762B 89D1 <1> mov ecx, edx ; 3 1542 <1> fdinit_pass_fix_sector_count_3: 1543 0000762D E8C7A30000 <1> call chs_read 1544 00007632 730D <1> jnc short fd_init_FAT_sectors_no_load_error 1545 00007634 C605[8A7E0100]00 <1> mov byte [FAT_BuffValidData], 0 1546 <1> ; Drv not ready or read Error ! 1547 0000763B B80F000000 <1> mov eax, ERR_DRV_NOT_RDY ; 15 1548 <1> ;xor edx, edx 1549 00007640 C3 <1> retn 1550 <1> 1551 <1> fd_init_FAT_sectors_no_load_error: 1552 00007641 C605[8A7E0100]01 <1> mov byte [FAT_BuffValidData], 1 1553 00007648 A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 1554 0000764D E967FFFFFF <1> jmp fd_init_get_next_cluster_readnext 1555 <1> 1556 <1> get_FAT_volume_name: 1557 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 1558 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1559 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1560 <1> ; 12/09/2009 1561 <1> ; INPUT -> 1562 <1> ; BH = Logical DOS drive number (0,1,2,3,4 ...) 1563 <1> ; BL = 0 1564 <1> ; OUTPUT -> 1565 <1> ; CF = 0 -> ESI = Volume name address 1566 <1> ; CF = 1 -> Root volume name not found 1567 <1> 1568 <1> ;mov ah, 0FFh 1569 <1> ;mov al, [Last_Dos_DiskNo] 1570 <1> ;cmp al, bh 1571 <1> ;jb short loc_gfvn_dir_load_err 1572 <1> 1573 00007652 89DE <1> mov esi, ebx 1574 00007654 81E600FF0000 <1> and esi, 0FF00h ; esi = bh 1575 0000765A 81C600010900 <1> add esi, Logical_DOSDisks 1576 00007660 8A06 <1> mov al, [esi+LD_Name] 1577 00007662 8A6603 <1> mov ah, [esi+LD_FATType] 1578 <1> ; 19/12/2025 1579 <1> ;cmp ah, 1 1580 <1> ;jb short loc_gfvn_dir_load_err 1581 00007665 3C41 <1> cmp al, 'A' 1582 00007667 720C <1> jb short loc_gfvn_dir_load_err 1583 00007669 80FC02 <1> cmp ah, 2 1584 0000766C 7708 <1> ja short get_FAT32_root_cluster 1585 <1> 1586 0000766E E8544A0000 <1> call load_FAT_root_directory 1587 00007673 730B <1> jnc short loc_get_volume_name 1588 <1> 1589 <1> loc_gfvn_dir_load_err: 1590 <1> loc_get_volume_name_retn: ; 29/08/2023 1591 00007675 C3 <1> retn 1592 <1> 1593 <1> get_FAT32_root_cluster: 1594 00007676 8B4632 <1> mov eax, [esi+LD_BPB+BPB_RootClus] 1595 00007679 E8C74A0000 <1> call load_FAT_sub_directory 1596 0000767E 72F5 <1> jc short loc_get_volume_name_retn 1597 <1> 1598 <1> loc_get_volume_name: 1599 00007680 BE00000800 <1> mov esi, Directory_Buffer 1600 <1> ;xor cx, cx ; 0 1601 <1> ; 25/07/2022 1602 00007685 31C9 <1> xor ecx, ecx ; 0 1603 <1> check_root_volume_name: 1604 00007687 8A06 <1> mov al, [esi] 1605 00007689 08C0 <1> or al, al 1606 0000768B 74E8 <1> jz short loc_get_volume_name_retn 1607 0000768D 807E0B08 <1> cmp byte [esi+0Bh], 08h 1608 00007691 74E2 <1> je short loc_get_volume_name_retn 1609 00007693 663B0D[A07E0100] <1> cmp cx, [DirBuff_LastEntry] 1610 0000769A 7306 <1> jnb short pass_check_root_volume_name 1611 <1> ;inc cx 1612 <1> ; 25/07/2022 1613 0000769C 41 <1> inc ecx 1614 0000769D 83C620 <1> add esi, 32 1615 000076A0 EBE5 <1> jmp short check_root_volume_name 1616 <1> 1617 <1> ; 29/08/2023 1618 <1> ;loc_get_volume_name_retn: 1619 <1> ;retn 1620 <1> 1621 <1> pass_check_root_volume_name: 1622 000076A2 803D[9C7E0100]03 <1> cmp byte [DirBuff_FATType], 3 1623 000076A9 7230 <1> jb short loc_get_volume_name_retn_xor 1624 <1> 1625 000076AB BB001C0900 <1> mov ebx, FAT_Buffer 1626 000076B0 BE00010900 <1> mov esi, Logical_DOSDisks 1627 000076B5 31C0 <1> xor eax, eax 1628 000076B7 8A25[9B7E0100] <1> mov ah, [DirBuff_DRV] 1629 000076BD 80EC41 <1> sub ah, 'A' 1630 000076C0 01C6 <1> add esi, eax 1631 000076C2 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 1632 000076C7 E8BD480000 <1> call get_next_cluster 1633 000076CC 7305 <1> jnc short loc_gfvn_load_FAT32_dir_cluster 1634 <1> 1635 000076CE 83F801 <1> cmp eax, 1 1636 000076D1 F5 <1> cmc 1637 000076D2 C3 <1> retn 1638 <1> 1639 <1> loc_gfvn_load_FAT32_dir_cluster: 1640 000076D3 E86D4A0000 <1> call load_FAT_sub_directory 1641 000076D8 73A6 <1> jnc short loc_get_volume_name 1642 000076DA C3 <1> retn 1643 <1> 1644 <1> loc_get_volume_name_retn_xor: 1645 000076DB 31C0 <1> xor eax, eax 1646 000076DD C3 <1> retn 1647 <1> 1648 <1> get_media_change_status: 1649 <1> ; 10/01/2016 (TRDOS 386 = TRDOS v2.0) 1650 <1> ; 09/09/2009 1651 <1> ; INPUT: 1652 <1> ; DL = Drive number (physical) 1653 <1> ; OUTPUT: clc & AH = 6 media changed 1654 <1> ; clc & AH = 0 media not changed 1655 <1> ; stc -> Drive not ready or an error 1656 <1> 1657 000076DE B416 <1> mov ah, 16h 1658 000076E0 E82AD9FFFF <1> call int13h 1659 000076E5 80FC06 <1> cmp ah, 06h 1660 000076E8 7405 <1> je short loc_gmc_status_retn 1661 000076EA 08E4 <1> or ah, ah 1662 000076EC 7401 <1> jz short loc_gmc_status_retn 1663 <1> loc_gmc_status_stc_retn: 1664 000076EE F9 <1> stc 1665 <1> loc_gmc_status_retn: 1666 000076EF C3 <1> retn 3435 %include 'trdosk3.s' ; 06/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - MAIN PROGRAM : trdosk3.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 19/12/2025 (Previous: 26/09/2024, TRDOS 386 v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 06/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; MAINPROG.ASM (09/11/2011) 12 <1> ; **************************************************************************** 13 <1> ; MAINPROG.ASM [ TRDOS KERNEL - COMMAND EXECUTER SECTION - MAIN PROGRAM ] 14 <1> ; (c) 2004-2011 Erdogan TAN [ 17/01/2004 ] Last Update: 09/11/2011 15 <1> ; CMD_INTR.ASM [ TRDOS Command Interpreter Procedure ] Last Update: 09/11/2011 16 <1> ; DIR.ASM [ DIRECTORY FUNCTIONS ] Last Update: 09/10/2011 17 <1> ; FILE.ASM [ FILE FUNCTIONS ] Last Update: 09/10/2011 18 <1> 19 <1> change_current_drive: 20 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 21 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 22 <1> ; 16/10/2016 23 <1> ; 02/02/2016 24 <1> ; 15/01/2016 (TRDOS 386 = TRDOS v2.0) 25 <1> ; 18/08/2011 26 <1> ; 09/09/2009 27 <1> ; INPUT: 28 <1> ; DL = Logical DOS Drive Number 29 <1> ; OUTPUT: 30 <1> ; cf=1 -> Not successful 31 <1> ; EAX = Error code 32 <1> ; cf=0 -> 33 <1> ; EAX = 0 (successful) 34 <1> 35 000076F0 31DB <1> xor ebx, ebx 36 000076F2 88D7 <1> mov bh, dl 37 <1> 38 <1> ;cmp dl, 1 39 <1> ;jna short loc_ccdrv_initial_media_change_check 40 <1> ;cmp bh, [Last_Dos_DiskNo] 41 <1> ;ja short loc_ccdrv_drive_not_ready_err 42 <1> 43 <1> loc_ccdrv_initial_media_change_check: 44 000076F4 BE00010900 <1> mov esi, Logical_DOSDisks 45 000076F9 01DE <1> add esi, ebx 46 <1> loc_ccdrv_dos_drive_name_check: 47 000076FB 80FA02 <1> cmp dl, 2 48 000076FE 720E <1> jb short loc_ccdrv_dos_drive_name_check_ok 49 <1> 50 00007700 8A06 <1> mov al, [esi+LD_Name] 51 00007702 2C41 <1> sub al, 'A' 52 00007704 38D0 <1> cmp al, dl 53 00007706 7406 <1> je short loc_ccdrv_dos_drive_name_check_ok 54 <1> 55 <1> loc_ccdrv_drive_not_ready_err: 56 <1> ; 16/10/2016 (15h -> 15) 57 <1> ;mov eax, 15 ; Drive not ready 58 <1> ; 26/07/2022 59 00007708 29C0 <1> sub eax, eax 60 0000770A B00F <1> mov al, 15 61 <1> loc_change_current_drive_stc_retn: 62 0000770C F9 <1> stc 63 0000770D C3 <1> retn 64 <1> 65 <1> loc_ccdrv_dos_drive_name_check_ok: 66 0000770E 8A667E <1> mov ah, [esi+LD_MediaChanged] 67 00007711 80FC06 <1> cmp ah, 6 ; VOLUME NAME CHECK/MOVE SIGN 68 00007714 7455 <1> je short loc_ccdrv_get_FAT_volume_name_0 69 <1> 70 00007716 80FA01 <1> cmp dl, 1 71 00007719 7778 <1> ja short loc_gmcs_init_drv_hd 72 <1> 73 <1> loc_gmcs_init_drv_fd: 74 0000771B 08E4 <1> or ah, ah 75 <1> ; AH = 1 is initialization sign (invalid_fd_parameter) 76 0000771D 7517 <1> jnz short loc_ccdrv_call_fd_init 77 <1> 78 0000771F E8BAFFFFFF <1> call get_media_change_status 79 00007724 72E2 <1> jc short loc_ccdrv_drive_not_ready_err 80 <1> 81 00007726 20E4 <1> and ah, ah 82 00007728 7471 <1> jz short loc_change_current_drv3 83 <1> 84 0000772A 80F406 <1> xor ah, 6 85 0000772D 75D9 <1> jnz short loc_ccdrv_drive_not_ready_err 86 <1> 87 <1> loc_ccdrv_call_fd_init_check_vol_id: 88 0000772F E81C090000 <1> call get_volume_serial_number 89 00007734 730D <1> jnc short loc_ccdrv_check_vol_serial 90 <1> 91 <1> loc_ccdrv_call_fd_init: 92 00007736 E83AFDFFFF <1> call floppy_drv_init 93 0000773B 731A <1> jnc short loc_reset_drv_fd_current_dir 94 <1> 95 <1> loc_ccdrv_fdinit_fail_retn: 96 <1> ; 16/10/2016 97 0000773D B80F000000 <1> mov eax, 15 ; Drive not ready 98 00007742 C3 <1> retn 99 <1> 100 <1> loc_ccdrv_check_vol_serial: 101 00007743 A3[6C770100] <1> mov [Current_VolSerial], eax 102 <1> ;mov dl, bh 103 00007748 E828FDFFFF <1> call floppy_drv_init 104 0000774D 72EE <1> jc short loc_ccdrv_fdinit_fail_retn 105 <1> 106 0000774F 3B05[6C770100] <1> cmp eax, [Current_VolSerial] 107 00007755 7440 <1> je short loc_change_current_drv2 108 <1> 109 <1> loc_reset_drv_fd_current_dir: 110 00007757 31C0 <1> xor eax, eax 111 00007759 88467F <1> mov [esi+LD_CDirLevel], al 112 0000775C 89F7 <1> mov edi, esi 113 0000775E 81C780000000 <1> add edi, LD_CurrentDirectory 114 00007764 B920000000 <1> mov ecx, 32 115 00007769 F3AB <1> rep stosd 116 <1> 117 <1> loc_ccdrv_get_FAT_volume_name_0: 118 <1> ; 19/12/2025 119 <1> ;mov al, [esi+LD_FATType] 120 <1> ;or al, al 121 <1> ;jz short loc_change_current_drv2 122 <1> 123 0000776B 56 <1> push esi 124 <1> ;cmp al, 2 125 <1> ; 19/12/2025 126 0000776C 807E0302 <1> cmp byte [esi+LD_FATType], 2 127 00007770 7705 <1> ja short loc_ccdrv_get_FAT32_vol_name 128 <1> 129 <1> loc_ccdrv_get_FAT2_16_vol_name: 130 00007772 83C631 <1> add esi, LD_BPB + VolumeLabel 131 00007775 EB03 <1> jmp short loc_ccdrv_get_FAT_volume_name_1 132 <1> 133 <1> loc_ccdrv_get_FAT32_vol_name: 134 00007777 83C64D <1> add esi, LD_BPB + FAT32_VolLab 135 <1> loc_ccdrv_get_FAT_volume_name_1: 136 0000777A 53 <1> push ebx 137 0000777B 56 <1> push esi 138 0000777C E8D1FEFFFF <1> call get_FAT_volume_name 139 00007781 5F <1> pop edi 140 00007782 5B <1> pop ebx 141 <1> ; BL = 0 142 00007783 720B <1> jc short loc_change_current_drv1 143 00007785 20C0 <1> and al, al 144 00007787 7407 <1> jz short loc_change_current_drv1 145 <1> 146 <1> loc_ccdrv_move_FAT_volume_name: 147 00007789 B90B000000 <1> mov ecx, 11 148 0000778E F3A4 <1> rep movsb 149 <1> 150 <1> loc_change_current_drv1: 151 00007790 5E <1> pop esi 152 00007791 EB04 <1> jmp short loc_change_current_drv2 153 <1> 154 <1> loc_gmcs_init_drv_hd: 155 00007793 08E4 <1> or ah, ah 156 00007795 7404 <1> jz short loc_change_current_drv3 157 <1> ; BL = 0, BH = Logical DOS drive number 158 <1> loc_change_current_drv2: 159 00007797 C6467E00 <1> mov byte [esi+LD_MediaChanged], 0 160 <1> loc_change_current_drv3: 161 0000779B 883D[76770100] <1> mov [Current_Drv], bh 162 <1> 163 <1> ;call restore_current_directory 164 <1> ;retn 165 <1> 166 <1> restore_current_directory: 167 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 168 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 169 <1> ; 11/02/2016 170 <1> ; 15/01/2016 (TRDOS 386 = TRDOS v2.0) 171 <1> ; 25/01/2010 172 <1> ; 12/10/2009 173 <1> ; 174 <1> ; INPUT: 175 <1> ; ESI = Logical DOS Drive Description Table 176 <1> ; 177 <1> ; OUTPUT: 178 <1> ; ESI = Logical DOS Drive Description Table 179 <1> ; EDI = offset Current_Dir_Drv 180 <1> 181 000077A1 8A4603 <1> mov al, [esi+LD_FATType] 182 000077A4 A2[75770100] <1> mov [Current_FATType], al 183 <1> 184 000077A9 8A26 <1> mov ah, [esi+LD_Name] 185 000077AB 8825[77770100] <1> mov [Current_Dir_Drv], ah 186 <1> 187 <1> ; 19/12/2025 188 <1> ;and al, al 189 <1> ;jz short loc_restore_FS_current_directory 190 <1> 191 <1> loc_restore_FAT_current_directory: 192 000077B1 8A667F <1> mov ah, [esi+LD_CDirLevel] 193 000077B4 8825[74770100] <1> mov [Current_Dir_Level], ah 194 000077BA 08E4 <1> or ah, ah 195 000077BC 7410 <1> jz short loc_ccdrv_reset_cdir_FAT_12_16_32_fcluster 196 <1> 197 000077BE 0FB6D4 <1> movzx edx, ah 198 000077C1 C0E204 <1> shl dl, 4 ; * 16 199 000077C4 01F2 <1> add edx, esi 200 000077C6 8B828C000000 <1> mov eax, [edx+LD_CurrentDirectory+12] 201 000077CC EB24 <1> jmp short loc_ccdrv_reset_cdir_FAT_fcluster 202 <1> 203 <1> ; 19/12/2025 204 <1> %if 0 205 <1> loc_restore_FS_current_directory: 206 <1> ;call load_current_FS_directory 207 <1> ;retn 208 <1> ; 26/07/2022 209 <1> jmp load_current_FS_directory 210 <1> %endif 211 <1> 212 <1> loc_ccdrv_reset_cdir_FAT_12_16_32_fcluster: 213 000077CE 3C03 <1> cmp al, 3 214 000077D0 7205 <1> jb short loc_ccdrv_reset_cdir_FAT_12_16_fcluster 215 <1> loc_ccdrv_reset_cdir_FAT32_fcluster: 216 000077D2 8B4632 <1> mov eax, [esi+LD_BPB+FAT32_RootFClust] 217 000077D5 EB02 <1> jmp short loc_ccdrv_check_rootdir_sign 218 <1> loc_ccdrv_reset_cdir_FAT_12_16_fcluster: 219 <1> ;xor al, al ; xor eax, eax 220 <1> ; 26/07/2022 221 000077D7 31C0 <1> xor eax, eax 222 <1> ;xor edx, edx 223 <1> loc_ccdrv_check_rootdir_sign: 224 000077D9 80BE8000000000 <1> cmp byte [esi+LD_CurrentDirectory], 0 225 000077E0 7510 <1> jne short loc_ccdrv_reset_cdir_FAT_fcluster 226 <1> loc_ccdrv_set_rootdir_FAT_fcluster: 227 000077E2 89868C000000 <1> mov [esi+LD_CurrentDirectory+12], eax 228 000077E8 C78680000000524F4F- <1> mov dword [esi+LD_CurrentDirectory], 'ROOT' 228 000077F1 54 <1> 229 <1> 230 <1> loc_ccdrv_reset_cdir_FAT_fcluster: 231 000077F2 A3[70770100] <1> mov [Current_Dir_FCluster], eax 232 <1> 233 000077F7 BF[D47E0100] <1> mov edi, PATH_Array 234 000077FC 89F2 <1> mov edx, esi 235 000077FE 81C680000000 <1> add esi, LD_CurrentDirectory 236 00007804 B920000000 <1> mov ecx, 32 237 00007809 F3A5 <1> rep movsd 238 <1> 239 0000780B E8042B0000 <1> call change_prompt_dir_string 240 <1> 241 00007810 89D6 <1> mov esi, edx 242 <1> 243 00007812 29C0 <1> sub eax, eax 244 <1> ;sub edx, edx 245 00007814 BF[77770100] <1> mov edi, Current_Dir_Drv 246 <1> 247 00007819 A2[8E2E0100] <1> mov [Restore_CDIR], al ; 0 248 0000781E C3 <1> retn 249 <1> 250 <1> dos_prompt: 251 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 252 <1> ; 06/05/2016 253 <1> ; 30/01/2016 254 <1> ; 29/01/2016 255 <1> ; 16/01/2016 (TRDOS 386 = TRDOS v2.0) 256 <1> ; 15/09/2011 257 <1> ; 13/09/2009 258 <1> ; 2004-2005 259 <1> 260 <1> ; 06/05/2016 261 0000781F C705[34830100]- <1> mov dword [mainprog_return_addr], return_from_cmd_interpreter 261 00007825 [D1780000] <1> 262 <1> 263 <1> loc_TRDOS_prompt: 264 00007829 BF[76780100] <1> mov edi, TextBuffer 265 0000782E C6075B <1> mov byte [edi], "[" 266 00007831 47 <1> inc edi 267 00007832 BE[EA2E0100] <1> mov esi, TRDOSPromptLabel 268 <1> get_next_prompt_label_char: 269 00007837 803E20 <1> cmp byte [esi], 20h 270 0000783A 7203 <1> jb short pass_prompt_label 271 0000783C A4 <1> movsb 272 0000783D EBF8 <1> jmp short get_next_prompt_label_char 273 <1> pass_prompt_label: 274 0000783F C6075D <1> mov byte [edi], "]" 275 00007842 47 <1> inc edi 276 00007843 C60720 <1> mov byte [edi], 20h 277 00007846 47 <1> inc edi 278 00007847 BE[77770100] <1> mov esi, Current_Dir_Drv 279 0000784C 66A5 <1> movsw 280 0000784E A4 <1> movsb 281 <1> loc_prompt_current_directory: 282 0000784F 803E20 <1> cmp byte [esi], 20h 283 00007852 7203 <1> jb short pass_prompt_current_directory 284 00007854 A4 <1> movsb 285 00007855 EBF8 <1> jmp short loc_prompt_current_directory 286 <1> pass_prompt_current_directory: 287 00007857 C6073E <1> mov byte [edi], '>' 288 0000785A 47 <1> inc edi 289 0000785B C60700 <1> mov byte [edi], 0 290 0000785E BE[76780100] <1> mov esi, TextBuffer 291 00007863 E852F5FFFF <1> call print_msg 292 <1> 293 <1> ;sub bh, bh ; video page = 0 294 <1> ;call get_cpos ; get cursor position 295 00007868 668B15[CE760100] <1> mov dx, [CURSOR_POSN] ; video page 0 296 0000786F 8815[D6770100] <1> mov [CursorColumn], dl 297 <1> 298 <1> ; 30/01/2016 (to show cursor on the row, again) 299 <1> ; (Initial color attributes of video page 0 is 0) 300 <1> ; (see: 'StartPMP' in trdos386.s) 301 <1> ; 302 <1> ;mov edi, 0B8000h ; start of video page 0 303 <1> ;movzx ecx, dl ; column 304 <1> ;mov al, 80 305 <1> ;mul dh 306 <1> ;add ax, cx 307 <1> ;shl ax, 1 ; character + attribute 308 <1> ;add di, ax ; (2*80*row) + (2*column) 309 <1> ;neg cl 310 <1> ;add cl, 80 311 <1> ;mov ax, 700h ; ah = 7 (color attribute) 312 <1> ;rep stosw 313 <1> 314 <1> loc_rw_char: 315 00007875 E8AB000000 <1> call rw_char 316 <1> loc_move_command: 317 0000787A BE[26780100] <1> mov esi, CommandBuffer 318 0000787F 89F7 <1> mov edi, esi 319 00007881 31C9 <1> xor ecx, ecx 320 <1> first_command_char: 321 00007883 AC <1> lodsb 322 00007884 3C20 <1> cmp al, 20h 323 00007886 770C <1> ja short pass_space_control 324 00007888 723F <1> jb short loc_move_cmd_arguments_ok 325 0000788A 81FE[75780100] <1> cmp esi, CommandBuffer + 79 326 00007890 72F1 <1> jb short first_command_char 327 00007892 EB35 <1> jmp short loc_move_cmd_arguments_ok 328 <1> 329 <1> ; 26/07/2022 330 <1> pass_space_control: 331 00007894 3C61 <1> cmp al, 61h 332 00007896 7206 <1> jb short pass_capitalize 333 00007898 3C7A <1> cmp al, 7Ah 334 0000789A 7702 <1> ja short pass_capitalize 335 0000789C 24DF <1> and al, 0DFh 336 <1> pass_capitalize: 337 0000789E AA <1> stosb 338 0000789F FEC1 <1> inc cl 339 000078A1 81FE[75780100] <1> cmp esi, CommandBuffer + 79 340 <1> ;jb short next_command_char 341 <1> ; 26/07/2022 342 000078A7 7320 <1> jnb short loc_move_cmd_arguments_ok 343 <1> 344 <1> next_command_char: 345 000078A9 AC <1> lodsb 346 000078AA 3C20 <1> cmp al, 20h 347 000078AC 77E6 <1> ja short pass_space_control 348 000078AE 7219 <1> jb short loc_move_cmd_arguments_ok 349 <1> 350 <1> loc_1st_cmd_arg: ; 30/01/2016 351 000078B0 AC <1> lodsb 352 000078B1 3C20 <1> cmp al, 20h 353 000078B3 74FB <1> je short loc_1st_cmd_arg 354 000078B5 7212 <1> jb short loc_move_cmd_arguments_ok 355 <1> 356 000078B7 C60700 <1> mov byte [edi], 0 357 000078BA 47 <1> inc edi 358 <1> 359 <1> loc_move_cmd_arguments: 360 000078BB AA <1> stosb 361 000078BC 81FE[75780100] <1> cmp esi, CommandBuffer + 79 362 000078C2 7305 <1> jnb short loc_move_cmd_arguments_ok 363 000078C4 AC <1> lodsb 364 000078C5 3C20 <1> cmp al, 20h 365 000078C7 73F2 <1> jnb short loc_move_cmd_arguments 366 <1> ; 26/07/2022 367 <1> ;jmp short loc_move_cmd_arguments_ok 368 <1> 369 <1> ; 26/07/2022 370 <1> ;pass_space_control: 371 <1> ; cmp al, 61h 372 <1> ; jb short pass_capitalize 373 <1> ; cmp al, 7Ah 374 <1> ; ja short pass_capitalize 375 <1> ; and al, 0DFh 376 <1> ;pass_capitalize: 377 <1> ; stosb 378 <1> ; inc cl 379 <1> ; cmp esi, CommandBuffer + 79 380 <1> ; jb short next_command_char 381 <1> 382 <1> loc_move_cmd_arguments_ok: 383 000078C9 C60700 <1> mov byte [edi], 0 384 <1> 385 <1> call_command_interpreter: 386 000078CC E8A8070000 <1> call command_interpreter 387 <1> 388 <1> return_from_cmd_interpreter: 389 000078D1 B950000000 <1> mov ecx, 80 390 <1> ;mov cx, 80 391 000078D6 BF[26780100] <1> mov edi, CommandBuffer 392 000078DB 30C0 <1> xor al, al 393 000078DD F3AA <1> rep stosb 394 <1> ;cmp byte [Program_Exit], 0 395 <1> ;ja short loc_terminate_trdos 396 <1> 397 <1> ; 16/01/2016 398 000078DF 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; 80*25 color 399 000078E6 7419 <1> je short pass_set_txt_mode 400 <1> 401 000078E8 E896A2FFFF <1> call set_txt_mode ; set vide mode to 03h 402 <1> ; 07/01/2017 403 000078ED 30C0 <1> xor al, al 404 <1> 405 <1> loc_check_active_page: 406 <1> ;xor al, al 407 000078EF 3805[DE760100] <1> cmp [ACTIVE_PAGE], al ; 0 408 <1> ;je loc_TRDOS_prompt 409 <1> ; 26/07/2022 410 000078F5 7405 <1> je short loc_prompt_again 411 <1> 412 <1> ; AL = 0 = video page 0 413 000078F7 E8B7A6FFFF <1> call set_active_page 414 <1> loc_prompt_again: ; 26/07/2022 415 000078FC E928FFFFFF <1> jmp loc_TRDOS_prompt ; infinitive loop 416 <1> 417 <1> pass_set_txt_mode: 418 00007901 BE[17390100] <1> mov esi, nextline 419 00007906 E8AFF4FFFF <1> call print_msg 420 0000790B EBE2 <1> jmp short loc_check_active_page 421 <1> 422 <1> ;rw_char: 423 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 424 <1> loc_arrow: 425 0000790D 80FC4B <1> cmp ah, 4Bh 426 00007910 7426 <1> je short loc_back 427 00007912 80FC53 <1> cmp ah, 53h 428 00007915 7421 <1> je short loc_back 429 00007917 80FC4D <1> cmp ah, 4Dh 430 0000791A 7509 <1> jne short readnextchar 431 0000791C 80FA4F <1> cmp dl, 79 432 0000791F 7304 <1> jnb short readnextchar 433 00007921 FEC2 <1> inc dl 434 00007923 EB1D <1> jmp short set_cursor_pos 435 <1> 436 <1> rw_char: 437 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 438 <1> ; 13/05/2016 439 <1> ; 30/01/2016 440 <1> ; 29/01/2016 441 <1> ; 17/01/2016 (TRDOS 386 = TRDOS v2.0) 442 <1> ; 2004-2005 443 <1> 444 <1> ; DH = cursor row, DL = cursor column 445 <1> ; BH = 0 = video page number (active page) 446 <1> 447 <1> ;xor bh, bh ; 0 = video page 0 448 <1> 449 <1> readnextchar: 450 00007925 30E4 <1> xor ah, ah 451 00007927 E8E695FFFF <1> call int16h 452 0000792C 20C0 <1> and al, al 453 0000792E 74DD <1> jz short loc_arrow 454 00007930 3CE0 <1> cmp al, 0E0h 455 00007932 74D9 <1> je short loc_arrow 456 00007934 3C08 <1> cmp al, 08h 457 00007936 752A <1> jne short char_return 458 <1> loc_back: 459 00007938 3A15[D6770100] <1> cmp dl, [CursorColumn] 460 0000793E 76E5 <1> jna short readnextchar 461 <1> prev_column: 462 00007940 FECA <1> dec dl 463 <1> set_cursor_pos: 464 <1> ;push dx 465 00007942 52 <1> push edx ; 29/12/2017 466 <1> ;xor bh, bh ; 0 = video page 0 467 <1> ; DH = Row, DL = Column 468 00007943 E82FAAFFFF <1> call _set_cpos ; 17/01/2016 469 00007948 5A <1> pop edx ; 29/12/2017 470 <1> ;pop dx 471 <1> ;movzx ebx, dl 472 00007949 88D3 <1> mov bl, dl 473 0000794B 2A1D[D6770100] <1> sub bl, [CursorColumn] 474 00007951 B020 <1> mov al, 20h 475 00007953 8883[26780100] <1> mov [CommandBuffer+ebx], al 476 <1> ;sub bh, bh ; video page 0 477 <1> ;mov cx, 1 478 00007959 B307 <1> mov bl, 7 ; color attribute 479 <1> ; bh = 0 ; 26/07/2022 480 0000795B E8FEA8FFFF <1> call _write_c_current ; 17/01/2016 481 <1> ;mov dx, [CURSOR_POSN] 482 00007960 EBC3 <1> jmp short readnextchar 483 <1> 484 <1> ; 26/07/2022 485 <1> ;loc_arrow: 486 <1> ; cmp ah, 4Bh 487 <1> ; je short loc_back 488 <1> ; cmp ah, 53h 489 <1> ; je short loc_back 490 <1> ; cmp ah, 4Dh 491 <1> ; jne short readnextchar 492 <1> ; cmp dl, 79 493 <1> ; jnb short readnextchar 494 <1> ; inc dl 495 <1> ; jmp short set_cursor_pos 496 <1> 497 <1> char_return: 498 00007962 0FB6DA <1> movzx ebx, dl 499 00007965 2A1D[D6770100] <1> sub bl, [CursorColumn] 500 0000796B 3C20 <1> cmp al, 20h 501 0000796D 721D <1> jb short loc_escape 502 0000796F 8883[26780100] <1> mov [CommandBuffer+ebx], al 503 00007975 80FA4F <1> cmp dl, 79 504 00007978 73AB <1> jnb short readnextchar 505 0000797A 66BB0700 <1> mov bx, 7 ; color attribute 506 0000797E E85CA9FFFF <1> call _write_tty 507 00007983 668B15[CE760100] <1> mov dx, [CURSOR_POSN] ; video page 0 508 0000798A EB99 <1> jmp short readnextchar ; 26/07/2022 509 <1> 510 <1> loc_escape: 511 0000798C 3C1B <1> cmp al, 1Bh 512 0000798E 7414 <1> je short rw_char_retn 513 <1> ; 514 00007990 3C0D <1> cmp al, 0Dh ; CR 515 00007992 7591 <1> jne short readnextchar ; 26/07/2022 516 <1> 517 <1> ; 13/05/2016 518 00007994 66BB0700 <1> mov bx, 7 ; attribute/color (bl) 519 <1> ; video page 0 (bh=0) 520 00007998 E842A9FFFF <1> call _write_tty 521 <1> ;mov bx, 7 ; attribute/color 522 <1> ; video page 0 (bh=0) 523 0000799D B00A <1> mov al, 0Ah ; LF 524 0000799F E83BA9FFFF <1> call _write_tty 525 <1> rw_char_retn: 526 000079A4 C3 <1> retn 527 <1> 528 <1> show_date: 529 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 530 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 531 <1> ; 2004-2005 532 <1> 533 <1> ;mov ah, 04h 534 <1> ;call int1Ah 535 000079A5 E81EEAFFFF <1> call RTC_40 ; GET RTC DATE 536 <1> 537 000079AA 88D0 <1> mov al, dl 538 000079AC E85495FFFF <1> call bcd_to_ascii 539 000079B1 66A3[D62F0100] <1> mov [Day], ax 540 <1> 541 000079B7 88F0 <1> mov al, dh 542 000079B9 E84795FFFF <1> call bcd_to_ascii 543 000079BE 66A3[D92F0100] <1> mov [Month], ax 544 <1> 545 000079C4 88E8 <1> mov al, ch 546 000079C6 E83A95FFFF <1> call bcd_to_ascii 547 000079CB 66A3[DC2F0100] <1> mov [Century], ax 548 <1> 549 000079D1 88C8 <1> mov al, cl 550 000079D3 E82D95FFFF <1> call bcd_to_ascii 551 000079D8 66A3[DE2F0100] <1> mov [Year], ax 552 <1> 553 000079DE BE[C62F0100] <1> mov esi, Msg_Show_Date 554 <1> ;call print_msg 555 <1> ;retn 556 <1> ; 26/07/2022 557 000079E3 E9D2F3FFFF <1> jmp print_msg 558 <1> 559 <1> set_date: 560 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 561 <1> ; 13/05/2016 562 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 563 <1> ; 2004-2005 564 <1> 565 000079E8 BE[AA2F0100] <1> mov esi, Msg_Enter_Date 566 000079ED E8C8F3FFFF <1> call print_msg 567 <1> 568 <1> loc_enter_day_1: 569 000079F2 30E4 <1> xor ah, ah 570 000079F4 E81995FFFF <1> call int16h 571 <1> ; AL = ASCII Code of the Character 572 000079F9 3C0D <1> cmp al, 13 573 <1> ;je loc_set_date_retn 574 <1> ; 26/07/2022 575 000079FB 7404 <1> je short set_date_0 576 000079FD 3C1B <1> cmp al, 27 577 <1> ;je loc_set_date_retn 578 <1> ; 26/07/2022 579 000079FF 7511 <1> jne short set_date_1 580 <1> 581 <1> set_date_0: 582 <1> ;loc_set_date_retn: 583 00007A01 BE[17390100] <1> mov esi, nextline 584 <1> ;call print_msg 585 <1> ;retn 586 <1> ; 26/07/2022 587 00007A06 E9AFF3FFFF <1> jmp print_msg 588 <1> 589 <1> ; 26/07/2022 590 <1> loc_set_date_stc_0: 591 <1> ;xor bh, bh ; video page 0 592 00007A0B E8B9A9FFFF <1> call beeper ; BEEP ! 593 00007A10 EBE0 <1> jmp short loc_enter_day_1 594 <1> 595 <1> ; 26/07/2022 596 <1> set_date_1: 597 00007A12 A2[D62F0100] <1> mov [Day], al 598 00007A17 3C30 <1> cmp al, '0' 599 00007A19 72F0 <1> jb short loc_set_date_stc_0 600 00007A1B 3C33 <1> cmp al, '3' 601 00007A1D 77EC <1> ja short loc_set_date_stc_0 602 <1> ; 13/05/2016 603 <1> ;mov bx, 7 ; attribute/color (bl) 604 <1> ; video page 0 (bh) 605 00007A1F B307 <1> mov bl, 7 606 00007A21 E8B9A8FFFF <1> call _write_tty 607 <1> loc_enter_day_2: 608 00007A26 30E4 <1> xor ah, ah 609 00007A28 E8E594FFFF <1> call int16h 610 <1> ; AL = ASCII Code of the Character 611 00007A2D 3C1B <1> cmp al, 27 612 <1> ;je loc_set_date_retn 613 <1> ; 26/07/2022 614 00007A2F 74D0 <1> je short set_date_0 615 00007A31 A2[D72F0100] <1> mov [Day+1], al 616 00007A36 3C30 <1> cmp al, '0' 617 00007A38 7211 <1> jb short loc_set_date_stc_1 618 00007A3A 3C39 <1> cmp al, '9' 619 00007A3C 770D <1> ja short loc_set_date_stc_1 620 00007A3E 803D[D62F0100]33 <1> cmp byte [Day], '3' 621 00007A45 7219 <1> jb short pass_set_day_31 622 00007A47 3C31 <1> cmp al, '1' 623 <1> ;ja loc_set_date_stc_1 624 <1> ; 26/07/2022 625 00007A49 7615 <1> jna short pass_set_day_31 626 <1> 627 <1> ; 26/07/2022 628 <1> loc_set_date_stc_1: 629 00007A4B E8E4010000 <1> call check_for_backspace 630 00007A50 7407 <1> je short loc_set_date_bs_1 631 <1> ;xor bh, bh ; video page 0 632 00007A52 E872A9FFFF <1> call beeper ; BEEP ! 633 00007A57 EBCD <1> jmp short loc_enter_day_2 634 <1> loc_set_date_bs_1: 635 00007A59 E8C4010000 <1> call write_backspace 636 00007A5E EB92 <1> jmp short loc_enter_day_1 637 <1> 638 <1> pass_set_day_31: 639 <1> ; 13/05/2016 640 <1> ;mov bx, 7 ; attribute/color (bl) 641 <1> ; video page 0 (bh) 642 00007A60 B307 <1> mov bl, 7 643 00007A62 E878A8FFFF <1> call _write_tty 644 <1> loc_enter_separator_1: 645 00007A67 28E4 <1> sub ah, ah ; 0 646 00007A69 E8A494FFFF <1> call int16h 647 <1> ; AL = ASCII Code of the Character 648 00007A6E 3C1B <1> cmp al, 27 649 <1> ;je loc_set_date_retn 650 <1> ; 26/07/2022 651 00007A70 748F <1> je short set_date_0 652 00007A72 3C2D <1> cmp al, '-' 653 00007A74 7443 <1> je short pass_set_date_separator_1 654 00007A76 3C2F <1> cmp al, '/' 655 <1> ;jne loc_set_date_stc_2 656 <1> ; 26/07/2022 657 00007A78 743F <1> je short pass_set_date_separator_1 658 <1> 659 <1> ; 26/07/2022 660 <1> loc_set_date_stc_2: 661 00007A7A E8B5010000 <1> call check_for_backspace 662 00007A7F 7407 <1> je short loc_set_date_bs_2 663 <1> ;xor bh, bh ; video page 0 664 00007A81 E843A9FFFF <1> call beeper ; BEEP ! 665 00007A86 EBDF <1> jmp short loc_enter_separator_1 666 <1> loc_set_date_bs_2: 667 00007A88 E895010000 <1> call write_backspace 668 00007A8D EB97 <1> jmp short loc_enter_day_2 669 <1> 670 <1> ; 26/07/2022 671 <1> loc_set_date_stc_3: 672 00007A8F E8A0010000 <1> call check_for_backspace 673 00007A94 7407 <1> je short loc_set_date_bs_3 674 <1> ;xor bh, bh ; video page 0 675 00007A96 E82EA9FFFF <1> call beeper ; BEEP ! 676 00007A9B EB23 <1> jmp short loc_enter_month_1 677 <1> loc_set_date_bs_3: 678 00007A9D E880010000 <1> call write_backspace 679 00007AA2 EBC3 <1> jmp short loc_enter_separator_1 680 <1> 681 <1> ; 26/07/2022 682 <1> loc_set_date_stc_4: 683 00007AA4 E88B010000 <1> call check_for_backspace 684 00007AA9 7407 <1> je short loc_set_date_bs_4 685 <1> ;xor bh, bh ; video page 0 686 00007AAB E819A9FFFF <1> call beeper ; BEEP ! 687 00007AB0 EB2D <1> jmp short loc_enter_month_2 688 <1> loc_set_date_bs_4: 689 00007AB2 E86B010000 <1> call write_backspace 690 00007AB7 EB07 <1> jmp short loc_enter_month_1 691 <1> 692 <1> pass_set_date_separator_1: 693 <1> ; 13/05/2016 694 <1> ;mov bx, 7 ; attribute/color (bl) 695 <1> ; video page 0 (bh) 696 00007AB9 B307 <1> mov bl, 7 697 00007ABB E81FA8FFFF <1> call _write_tty 698 <1> loc_enter_month_1: 699 00007AC0 30E4 <1> xor ah, ah ; 0 700 00007AC2 E84B94FFFF <1> call int16h 701 <1> ; AL = ASCII Code of the Character 702 00007AC7 3C1B <1> cmp al, 27 703 <1> ;je loc_set_date_retn 704 <1> ; 26/07/2022 705 <1> ;je short loc_set_date_ok 706 <1> ; 07/08/2022 707 00007AC9 741F <1> je short jmp_loc_set_date_ok 708 00007ACB A2[D92F0100] <1> mov [Month], al 709 00007AD0 3C30 <1> cmp al, '0' 710 00007AD2 72BB <1> jb short loc_set_date_stc_3 711 00007AD4 3C31 <1> cmp al, '1' 712 00007AD6 77B7 <1> ja short loc_set_date_stc_3 713 <1> ; 13/05/2016 714 <1> ;mov bx, 7 ; attribute/color (bl) 715 <1> ; video page 0 (bh) 716 00007AD8 B307 <1> mov bl, 7 717 00007ADA E800A8FFFF <1> call _write_tty 718 <1> loc_enter_month_2: 719 00007ADF 30E4 <1> xor ah, ah 720 00007AE1 E82C94FFFF <1> call int16h 721 <1> ; AL = ASCII Code of the Character 722 00007AE6 3C1B <1> cmp al, 27 723 <1> ;;je loc_set_date_retn 724 <1> ; 26/07/2022 725 <1> ;je short loc_set_date_ok 726 <1> ; 07/08/2022 727 00007AE8 7505 <1> jne short loc_enter_month_3 728 <1> jmp_loc_set_date_ok: 729 00007AEA E996000000 <1> jmp loc_set_date_ok 730 <1> loc_enter_month_3: 731 00007AEF A2[DA2F0100] <1> mov [Month+1], al 732 00007AF4 3C30 <1> cmp al, '0' 733 00007AF6 72AC <1> jb short loc_set_date_stc_4 734 00007AF8 3C39 <1> cmp al, '9' 735 00007AFA 77A8 <1> ja short loc_set_date_stc_4 736 00007AFC 803D[D92F0100]31 <1> cmp byte [Month], '1' 737 00007B03 7204 <1> jb short pass_set_month_12 738 00007B05 3C32 <1> cmp al, '2' 739 00007B07 779B <1> ja short loc_set_date_stc_4 740 <1> pass_set_month_12: 741 <1> ; 13/05/2016 742 <1> ;mov bx, 7 ; attribute/color (bl) 743 <1> ; video page 0 (bh) 744 00007B09 B307 <1> mov bl, 7 745 00007B0B E8CFA7FFFF <1> call _write_tty 746 <1> loc_enter_separator_2: 747 00007B10 28E4 <1> sub ah, ah 748 00007B12 E8FB93FFFF <1> call int16h 749 <1> ; AL = ASCII Code of the Character 750 00007B17 3C1B <1> cmp al, 27 751 <1> ;je loc_set_date_retn 752 <1> ; 26/07/2022 753 00007B19 746A <1> je short loc_set_date_ok 754 00007B1B 3C2D <1> cmp al, '-' 755 00007B1D 7404 <1> je short pass_set_date_separator_2 756 00007B1F 3C2F <1> cmp al, '/' 757 00007B21 756C <1> jne short loc_set_date_stc_5 758 <1> pass_set_date_separator_2: 759 <1> ; 13/05/2016 760 <1> ;mov bx, 7 ; attribute/color (bl) 761 <1> ; video page 0 (bh) 762 00007B23 B307 <1> mov bl, 7 763 00007B25 E8B5A7FFFF <1> call _write_tty 764 <1> loc_enter_year_1: 765 00007B2A 30E4 <1> xor ah, ah 766 00007B2C E8E193FFFF <1> call int16h 767 <1> ; AL = ASCII Code of the Character 768 00007B31 3C1B <1> cmp al, 27 769 <1> ;je loc_set_date_retn 770 <1> ; 26/07/2022 771 00007B33 7450 <1> je short loc_set_date_ok 772 00007B35 A2[DE2F0100] <1> mov [Year], al 773 00007B3A 3C30 <1> cmp al, '0' 774 00007B3C 726C <1> jb short loc_set_date_stc_6 775 00007B3E 3C39 <1> cmp al, '9' 776 00007B40 7768 <1> ja short loc_set_date_stc_6 777 <1> ; 13/05/2016 778 <1> ;mov bx, 7 ; attribute/color (bl) 779 <1> ; video page 0 (bh) 780 00007B42 B307 <1> mov bl, 7 781 00007B44 E896A7FFFF <1> call _write_tty 782 <1> loc_enter_year_2: 783 00007B49 30E4 <1> xor ah, ah 784 00007B4B E8C293FFFF <1> call int16h 785 <1> ; AL = ASCII Code of the Character 786 00007B50 3C1B <1> cmp al, 27 787 <1> ;je short loc_set_date_retn 788 <1> ; 26/07/2022 789 00007B52 7431 <1> je short loc_set_date_ok 790 00007B54 A2[DF2F0100] <1> mov byte [Year+1], al 791 00007B59 3C30 <1> cmp al, '0' 792 00007B5B 7268 <1> jb short loc_set_date_stc_7 793 00007B5D 3C39 <1> cmp al, '9' 794 00007B5F 7764 <1> ja short loc_set_date_stc_7 795 <1> ; 13/05/2016 796 <1> ;mov bx, 7 ; attribute/color (bl) 797 <1> ; video page 0 (bh) 798 00007B61 B307 <1> mov bl, 7 799 00007B63 E877A7FFFF <1> call _write_tty 800 <1> loc_set_date_get_lchar_again: 801 00007B68 28E4 <1> sub ah, ah ; 0 802 00007B6A E8A393FFFF <1> call int16h 803 <1> ; AL = ASCII Code of the Character 804 00007B6F 3C0D <1> cmp al, 13 ; ENTER key 805 00007B71 746D <1> je short loc_set_date_progress 806 00007B73 3C1B <1> cmp al, 27 ; ESC key 807 <1> ;je short loc_set_date_retn 808 <1> ; 26/07/2022 809 00007B75 740E <1> je short loc_set_date_ok 810 <1> ; 811 00007B77 E8B8000000 <1> call check_for_backspace 812 00007B7C 75EA <1> jne short loc_set_date_get_lchar_again 813 <1> 814 <1> loc_set_date_bs_8: 815 00007B7E E89F000000 <1> call write_backspace 816 00007B83 EBC4 <1> jmp short loc_enter_year_2 817 <1> 818 <1> loc_set_date_ok: 819 <1> ;loc_set_date_retn: 820 00007B85 BE[17390100] <1> mov esi, nextline 821 <1> ;call print_msg 822 <1> ;retn 823 <1> ; 26/07/2022 824 00007B8A E92BF2FFFF <1> jmp print_msg 825 <1> 826 <1> ; 26/07/2022 827 <1> ;loc_set_date_stc_0: 828 <1> ; ;xor bh, bh ; video page 0 829 <1> ; call beeper ; BEEP ! 830 <1> ; jmp loc_enter_day_1 831 <1> ;loc_set_date_stc_1: 832 <1> ; call check_for_backspace 833 <1> ; je short loc_set_date_bs_1 834 <1> ; ;xor bh, bh ; video page 0 835 <1> ; call beeper ; BEEP ! 836 <1> ; jmp loc_enter_day_2 837 <1> ;loc_set_date_bs_1: 838 <1> ; call write_backspace 839 <1> ; jmp loc_enter_day_1 840 <1> ;loc_set_date_stc_2: 841 <1> ; call check_for_backspace 842 <1> ; je short loc_set_date_bs_2 843 <1> ; ;xor bh, bh ; video page 0 844 <1> ; call beeper ; BEEP ! 845 <1> ; jmp loc_enter_separator_1 846 <1> ;loc_set_date_bs_2: 847 <1> ; call write_backspace 848 <1> ; jmp loc_enter_day_2 849 <1> ;loc_set_date_stc_3: 850 <1> ; call check_for_backspace 851 <1> ; je short loc_set_date_bs_3 852 <1> ; ;xor bh, bh ; video page 0 853 <1> ; call beeper ; BEEP ! 854 <1> ; jmp loc_enter_month_1 855 <1> ;loc_set_date_bs_3: 856 <1> ; call write_backspace 857 <1> ; jmp loc_enter_separator_1 858 <1> ;loc_set_date_stc_4: 859 <1> ; call check_for_backspace 860 <1> ; je short loc_set_date_bs_4 861 <1> ; ;xor bh, bh ; video page 0 862 <1> ; call beeper ; BEEP ! 863 <1> ; jmp loc_enter_month_2 864 <1> ;loc_set_date_bs_4: 865 <1> ; call write_backspace 866 <1> ; jmp loc_enter_month_1 867 <1> 868 <1> ; 26/07/2022 869 <1> loc_set_date_stc_5: 870 00007B8F E8A0000000 <1> call check_for_backspace 871 00007B94 740A <1> je short loc_set_date_bs_5 872 <1> ;xor bh, bh ; video page 0 873 00007B96 E82EA8FFFF <1> call beeper ; BEEP ! 874 00007B9B E970FFFFFF <1> jmp loc_enter_separator_2 875 <1> loc_set_date_bs_5: 876 00007BA0 E87D000000 <1> call write_backspace 877 00007BA5 E935FFFFFF <1> jmp loc_enter_month_2 878 <1> loc_set_date_stc_6: 879 00007BAA E885000000 <1> call check_for_backspace 880 00007BAF 740A <1> je short loc_set_date_bs_6 881 <1> ;xor bh, bh ; video page 0 882 00007BB1 E813A8FFFF <1> call beeper ; BEEP ! 883 00007BB6 E96FFFFFFF <1> jmp loc_enter_year_1 884 <1> loc_set_date_bs_6: 885 00007BBB E862000000 <1> call write_backspace 886 00007BC0 E94BFFFFFF <1> jmp loc_enter_separator_2 887 <1> loc_set_date_stc_7: 888 00007BC5 E86A000000 <1> call check_for_backspace 889 00007BCA 740A <1> je short loc_set_date_bs_7 890 <1> ;xor bh, bh ; video page 0 891 00007BCC E8F8A7FFFF <1> call beeper ; BEEP ! 892 00007BD1 E973FFFFFF <1> jmp loc_enter_year_2 893 <1> loc_set_date_bs_7: 894 00007BD6 E847000000 <1> call write_backspace 895 00007BDB E94AFFFFFF <1> jmp loc_enter_year_1 896 <1> 897 <1> loc_set_date_progress: 898 <1> ; Get Current Date 899 <1> ;mov ah, 04h 900 <1> ;call int1Ah 901 00007BE0 E8E3E7FFFF <1> call RTC_40 ; GET RTC DATE 902 <1> ; CH = century (in BCD) 903 <1> 904 00007BE5 66A1[DE2F0100] <1> mov ax, [Year] 905 00007BEB 662D3030 <1> sub ax, '00' 906 00007BEF C0E004 <1> shl al, 4 ; * 16 907 00007BF2 88C1 <1> mov cl, al 908 00007BF4 00E1 <1> add cl, ah 909 00007BF6 66A1[D92F0100] <1> mov ax, [Month] 910 00007BFC 662D3030 <1> sub ax, '00' 911 00007C00 C0E004 <1> shl al, 4 ; * 16 912 00007C03 88C6 <1> mov dh, al 913 00007C05 00E6 <1> add dh, ah 914 00007C07 66A1[D62F0100] <1> mov ax, [Day] 915 00007C0D 662D3030 <1> sub ax, '00' 916 00007C11 C0E004 <1> shl al, 4 ; * 16 917 00007C14 88C2 <1> mov dl, al 918 00007C16 00E2 <1> add dl, ah 919 <1> 920 <1> ;mov ah, 05h 921 <1> ;call int1Ah 922 00007C18 E8D1E7FFFF <1> call RTC_50 ; SET RTC DATE 923 <1> 924 <1> ;loc_set_date_retn: 925 <1> ; mov esi, nextline 926 <1> ; ;call print_msg 927 <1> ; ;retn 928 <1> ; ; 26/07/2022 929 <1> ; jmp print_msg 930 <1> 931 <1> ; 26/07/2022 932 00007C1D E963FFFFFF <1> jmp loc_set_date_ok 933 <1> 934 <1> write_backspace: 935 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 936 00007C22 B008 <1> mov al, 08h ; BACKSPACE 937 <1> ; 13/05/2016 938 00007C24 66BB0700 <1> mov bx, 7 ; bl = attribute/color 939 <1> ; bh = video page = 0 940 00007C28 E8B2A6FFFF <1> call _write_tty 941 00007C2D B020 <1> mov al, 20h ; BLANK/SPACE char 942 <1> ;mov bx, 7 ; attribute/color 943 <1> ;call _write_c_current 944 <1> ;retn 945 00007C2F E92AA6FFFF <1> jmp _write_c_current 946 <1> 947 <1> check_for_backspace: 948 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 949 00007C34 663D080E <1> cmp ax, 0E08h 950 00007C38 7410 <1> je short cfbs_retn 951 00007C3A 663DE04B <1> cmp ax, 4BE0h 952 00007C3E 740A <1> je short cfbs_retn 953 00007C40 663D004B <1> cmp ax, 4B00h 954 00007C44 7404 <1> je short cfbs_retn 955 00007C46 663DE053 <1> cmp ax, 53E0h 956 <1> cfbs_retn: 957 00007C4A C3 <1> retn 958 <1> 959 <1> show_time: 960 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 961 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 962 <1> ; 2004-2005 963 <1> 964 <1> ;mov ah, 02h 965 <1> ;call int1Ah 966 00007C4B E80DE7FFFF <1> call RTC_20 ; GET RTC TIME 967 <1> 968 00007C50 88E8 <1> mov al, ch 969 00007C52 E8AE92FFFF <1> call bcd_to_ascii 970 00007C57 66A3[04300100] <1> mov [Hour], ax 971 <1> 972 00007C5D 88C8 <1> mov al, cl 973 00007C5F E8A192FFFF <1> call bcd_to_ascii 974 00007C64 66A3[07300100] <1> mov [Minute], ax 975 <1> 976 00007C6A 88F0 <1> mov al, dh 977 00007C6C E89492FFFF <1> call bcd_to_ascii 978 00007C71 66A3[0A300100] <1> mov [Second], ax 979 <1> 980 00007C77 BE[F42F0100] <1> mov esi, Msg_Show_Time 981 <1> ;call print_msg 982 <1> ;retn 983 <1> ; 26/07/2022 984 00007C7C E939F1FFFF <1> jmp print_msg 985 <1> 986 <1> set_time: 987 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 988 <1> ; 13/05/2016 989 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 990 <1> ; 2004-2005 991 <1> 992 00007C81 BE[E32F0100] <1> mov esi, Msg_Enter_Time 993 00007C86 E82FF1FFFF <1> call print_msg 994 <1> 995 <1> loc_enter_hour_1: 996 00007C8B 30E4 <1> xor ah, ah 997 00007C8D E88092FFFF <1> call int16h 998 <1> ; AL = ASCII Code of the Character 999 00007C92 3C0D <1> cmp al, 13 ; ENTER key 1000 00007C94 742D <1> je short loc_set_time_retn 1001 00007C96 3C1B <1> cmp al, 27 ; ESC key 1002 00007C98 7429 <1> je short loc_set_time_retn 1003 <1> set_time_0: 1004 00007C9A A2[04300100] <1> mov [Hour], al 1005 00007C9F 3C30 <1> cmp al, '0' 1006 00007CA1 7204 <1> jb short loc_set_time_stc_0 1007 00007CA3 3C32 <1> cmp al, '2' 1008 <1> ;ja loc_set_time_stc_0 1009 <1> ; 26/07/2022 1010 00007CA5 7626 <1> jna short set_time_1 1011 <1> 1012 <1> ; 26/07/2022 1013 <1> loc_set_time_stc_0: 1014 <1> ;xor bh, bh ; video page 0 1015 00007CA7 E81DA7FFFF <1> call beeper ; BEEP ! 1016 00007CAC EBDD <1> jmp short loc_enter_hour_1 1017 <1> 1018 <1> loc_set_time_stc_1: 1019 00007CAE E881FFFFFF <1> call check_for_backspace 1020 00007CB3 7407 <1> je short loc_set_time_bs_1 1021 <1> ;xor bh, bh ; video page 0 1022 00007CB5 E80FA7FFFF <1> call beeper ; BEEP ! 1023 00007CBA EB18 <1> jmp short loc_enter_hour_2 1024 <1> loc_set_time_bs_1: 1025 00007CBC E861FFFFFF <1> call write_backspace 1026 00007CC1 EBC8 <1> jmp short loc_enter_hour_1 1027 <1> 1028 <1> ; 26/07/2022 1029 <1> loc_set_time_retn: 1030 00007CC3 BE[17390100] <1> mov esi, nextline 1031 <1> ;call print_msg 1032 <1> ;retn 1033 00007CC8 E9EDF0FFFF <1> jmp print_msg 1034 <1> 1035 <1> set_time_1: 1036 <1> ; 13/05/2016 1037 <1> ;mov bx, 7 ; attribute/color (bl) 1038 <1> ; video page 0 (bh) 1039 00007CCD B307 <1> mov bl, 7 1040 00007CCF E80BA6FFFF <1> call _write_tty 1041 <1> loc_enter_hour_2: 1042 00007CD4 30E4 <1> xor ah, ah 1043 00007CD6 E83792FFFF <1> call int16h 1044 <1> ; AL = ASCII Code of the Character 1045 00007CDB 3C1B <1> cmp al, 27 1046 00007CDD 74E4 <1> je short loc_set_time_retn 1047 00007CDF A2[05300100] <1> mov [Hour+1], al 1048 00007CE4 3C30 <1> cmp al, '0' 1049 00007CE6 72C6 <1> jb short loc_set_time_stc_1 1050 00007CE8 3C39 <1> cmp al, '9' 1051 00007CEA 77C2 <1> ja short loc_set_time_stc_1 1052 00007CEC 803D[04300100]32 <1> cmp byte [Hour], '2' 1053 00007CF3 7204 <1> jb short pass_set_time_24 1054 00007CF5 3C34 <1> cmp al, '4' 1055 00007CF7 77B5 <1> ja short loc_set_time_stc_1 1056 <1> pass_set_time_24: 1057 <1> ; 13/05/2016 1058 <1> ;mov bx, 7 ; attribute/color (bl) 1059 <1> ; video page 0 (bh) 1060 00007CF9 B307 <1> mov bl, 7 1061 00007CFB E8DFA5FFFF <1> call _write_tty 1062 <1> loc_enter_time_separator_1: 1063 00007D00 28E4 <1> sub ah, ah ; 0 1064 00007D02 E80B92FFFF <1> call int16h 1065 <1> ; AL = ASCII Code of the Character 1066 00007D07 3C1B <1> cmp al, 27 1067 00007D09 74B8 <1> je short loc_set_time_retn 1068 00007D0B 3C3A <1> cmp al, ':' 1069 <1> ;jne loc_set_time_stc_2 1070 <1> ; 26/07/2022 1071 00007D0D 7415 <1> je short set_time_2 1072 <1> 1073 <1> ; 26/07/2022 1074 <1> loc_set_time_stc_2: 1075 00007D0F E820FFFFFF <1> call check_for_backspace 1076 00007D14 7407 <1> je short loc_set_time_bs_2 1077 <1> ;xor bh, bh ; video page 0 1078 00007D16 E8AEA6FFFF <1> call beeper ; BEEP ! 1079 00007D1B EBE3 <1> jmp short loc_enter_time_separator_1 1080 <1> loc_set_time_bs_2: 1081 00007D1D E800FFFFFF <1> call write_backspace 1082 00007D22 EBB0 <1> jmp short loc_enter_hour_2 1083 <1> 1084 <1> set_time_2: 1085 <1> ; 13/05/2016 1086 <1> ;mov bx, 7 ; attribute/color (bl) 1087 <1> ; video page 0 (bh) 1088 00007D24 B307 <1> mov bl, 7 1089 00007D26 E8B4A5FFFF <1> call _write_tty 1090 <1> loc_enter_minute_1: 1091 00007D2B 30E4 <1> xor ah, ah 1092 00007D2D E8E091FFFF <1> call int16h 1093 <1> ; AL = ASCII Code of the Character 1094 00007D32 3C1B <1> cmp al, 27 1095 00007D34 748D <1> je short loc_set_time_retn 1096 00007D36 A2[07300100] <1> mov [Minute], al 1097 00007D3B 3C30 <1> cmp al, '0' 1098 00007D3D 7204 <1> jb short loc_set_time_stc_3 1099 00007D3F 3C35 <1> cmp al, '5' 1100 <1> ;ja loc_set_time_stc_3 1101 <1> ; 26/07/2022 1102 00007D41 7615 <1> jna short set_time_3 1103 <1> 1104 <1> ; 26/07/2022 1105 <1> loc_set_time_stc_3: 1106 00007D43 E8ECFEFFFF <1> call check_for_backspace 1107 00007D48 7407 <1> je short loc_set_time_bs_3 1108 <1> ;xor bh, bh ; video page 0 1109 00007D4A E87AA6FFFF <1> call beeper ; BEEP !6 1110 00007D4F EBDA <1> jmp short loc_enter_minute_1 1111 <1> loc_set_time_bs_3: 1112 00007D51 E8CCFEFFFF <1> call write_backspace 1113 00007D56 EBA8 <1> jmp short loc_enter_time_separator_1 1114 <1> 1115 <1> set_time_3: 1116 <1> ; 13/05/2016 1117 <1> ;mov bx, 7 ; attribute/color (bl) 1118 <1> ; video page 0 (bh) 1119 00007D58 B307 <1> mov bl, 7 1120 00007D5A E880A5FFFF <1> call _write_tty 1121 <1> loc_enter_minute_2: 1122 00007D5F 30E4 <1> xor ah, ah 1123 00007D61 E8AC91FFFF <1> call int16h 1124 <1> ; AL = ASCII Code of the Character 1125 00007D66 3C1B <1> cmp al, 27 1126 <1> ;je short loc_set_time_retn 1127 <1> ; 07/08/2022 1128 00007D68 7505 <1> jne short loc_enter_minute_3 1129 00007D6A E954FFFFFF <1> jmp loc_set_time_retn 1130 <1> loc_enter_minute_3: 1131 00007D6F A2[08300100] <1> mov [Minute+1], al 1132 00007D74 3C30 <1> cmp al, '0' 1133 00007D76 7204 <1> jb short loc_set_time_stc_4 1134 00007D78 3C39 <1> cmp al, '9' 1135 <1> ;ja loc_set_time_stc_4 1136 <1> ; 26/07/2022 1137 00007D7A 7615 <1> jna short set_time_4 1138 <1> 1139 <1> ; 26/07/2022 1140 <1> loc_set_time_stc_4: 1141 00007D7C E8B3FEFFFF <1> call check_for_backspace 1142 00007D81 7407 <1> je short loc_set_time_bs_4 1143 <1> ;xor bh, bh ; video page 0 1144 00007D83 E841A6FFFF <1> call beeper ; BEEP ! 1145 00007D88 EBD5 <1> jmp short loc_enter_minute_2 1146 <1> loc_set_time_bs_4: 1147 00007D8A E893FEFFFF <1> call write_backspace 1148 00007D8F EB9A <1> jmp short loc_enter_minute_1 1149 <1> 1150 <1> set_time_4: 1151 <1> ; 13/05/2016 1152 <1> ;mov bx, 7 ; attribute/color (bl) 1153 <1> ; video page 0 (bh) 1154 00007D91 B307 <1> mov bl, 7 1155 00007D93 E847A5FFFF <1> call _write_tty 1156 <1> loc_enter_time_separator_2: 1157 00007D98 66C705[0A300100]30- <1> mov word [Second], 3030h 1157 00007DA0 30 <1> 1158 00007DA1 28E4 <1> sub ah, ah 1159 00007DA3 E86A91FFFF <1> call int16h 1160 <1> ; AL = ASCII Code of the Character 1161 00007DA8 3C0D <1> cmp al, 13 1162 <1> ;je short loc_set_time_progress 1163 <1> ; 07/08/2022 1164 00007DAA 7505 <1> jne short loc_enter_time_separator_3 1165 <1> jmp_loc_set_time_progress: 1166 00007DAC E9D4000000 <1> jmp loc_set_time_progress 1167 <1> loc_enter_time_separator_3: 1168 00007DB1 3C1B <1> cmp al, 27 1169 <1> ;;je loc_set_time_retn 1170 <1> ; 26/07/2022 1171 <1> ;je short loc_set_time_ok 1172 <1> ; 07/08/2022 1173 00007DB3 7505 <1> jne short loc_enter_time_separator_4 1174 00007DB5 E982000000 <1> jmp loc_set_time_ok 1175 <1> loc_enter_time_separator_4: 1176 00007DBA 3C3A <1> cmp al, ':' 1177 00007DBC 7563 <1> jne short loc_set_time_stc_5 1178 <1> 1179 <1> ; 13/05/2016 1180 <1> ;mov bx, 7 ; attribute/color (bl) 1181 <1> ; video page 0 (bh) 1182 00007DBE B307 <1> mov bl, 7 1183 00007DC0 E81AA5FFFF <1> call _write_tty 1184 <1> loc_enter_second_1: 1185 00007DC5 30E4 <1> xor ah, ah 1186 00007DC7 E84691FFFF <1> call int16h 1187 <1> ; AL = ASCII Code of the Character 1188 00007DCC 3C0D <1> cmp al, 13 1189 <1> ;je short loc_set_time_progress 1190 <1> ; 07/08/2022 1191 00007DCE 74DC <1> je short jmp_loc_set_time_progress 1192 00007DD0 3C1B <1> cmp al, 27 1193 <1> ;;je loc_set_time_retn 1194 <1> ; 26/07/2022 1195 <1> ;je short loc_set_time_ok 1196 <1> ; 07/08/2022 1197 00007DD2 7502 <1> jne short loc_enter_second_2 1198 00007DD4 EB66 <1> jmp loc_set_time_ok 1199 <1> loc_enter_second_2: 1200 00007DD6 A2[0A300100] <1> mov [Second], al 1201 00007DDB 3C30 <1> cmp al, '0' 1202 00007DDD 7267 <1> jb short loc_set_time_stc_6 1203 00007DDF 3C35 <1> cmp al, '5' 1204 00007DE1 7763 <1> ja short loc_set_time_stc_6 1205 <1> ; 13/05/2016 1206 <1> ;mov bx, 7 ; attribute/color (bl) 1207 <1> ; video page 0 (bh) 1208 00007DE3 B307 <1> mov bl, 7 1209 00007DE5 E8F5A4FFFF <1> call _write_tty 1210 <1> loc_enter_second_3: 1211 00007DEA 30E4 <1> xor ah, ah 1212 00007DEC E82191FFFF <1> call int16h 1213 <1> ; AL = ASCII Code of the Character 1214 00007DF1 3C1B <1> cmp al, 27 1215 <1> ;je short loc_set_time_retn 1216 <1> ; 26/07/2022 1217 00007DF3 7447 <1> je short loc_set_time_ok 1218 00007DF5 3C30 <1> cmp al, '0' 1219 00007DF7 7271 <1> jb short loc_set_time_stc_7 1220 00007DF9 3C39 <1> cmp al, '9' 1221 00007DFB 776D <1> ja short loc_set_time_stc_7 1222 <1> ; 13/05/2016 1223 <1> ;mov bx, 7 ; attribute/color (bl) 1224 <1> ; video page 0 (bh) 1225 00007DFD B307 <1> mov bl, 7 1226 00007DFF E8DBA4FFFF <1> call _write_tty 1227 <1> loc_set_time_get_lchar_again: 1228 00007E04 28E4 <1> sub ah, ah ; 0 1229 00007E06 E80791FFFF <1> call int16h 1230 <1> ; AL = ASCII Code of the Character 1231 00007E0B 3C0D <1> cmp al, 13 1232 00007E0D 7476 <1> je short loc_set_time_progress 1233 00007E0F 3C1B <1> cmp al, 27 1234 <1> ;je short loc_set_time_retn 1235 <1> ; 07/08/2022 1236 00007E11 7429 <1> je short loc_set_time_ok 1237 <1> ; 1238 00007E13 E81CFEFFFF <1> call check_for_backspace 1239 00007E18 75EA <1> jne short loc_set_time_get_lchar_again 1240 <1> 1241 <1> loc_set_time_bs_8: 1242 00007E1A E803FEFFFF <1> call write_backspace 1243 00007E1F EBC9 <1> jmp short loc_enter_second_3 1244 <1> 1245 <1> ; ; 26/07/2022 1246 <1> ;loc_set_time_retn: 1247 <1> ; mov esi, nextline 1248 <1> ; ;call print_msg 1249 <1> ; ;retn 1250 <1> ; jmp print_msg 1251 <1> 1252 <1> ; 26/07/2022 1253 <1> ;loc_set_time_stc_0: 1254 <1> ; ;xor bh, bh ; video page 0 1255 <1> ; call beeper ; BEEP ! 1256 <1> ; jmp loc_enter_hour_1 1257 <1> ;loc_set_time_stc_1: 1258 <1> ; call check_for_backspace 1259 <1> ; je short loc_set_time_bs_1 1260 <1> ; ;xor bh, bh ; video page 0 1261 <1> ; call beeper ; BEEP ! 1262 <1> ; jmp loc_enter_hour_2 1263 <1> ;loc_set_time_bs_1: 1264 <1> ; call write_backspace 1265 <1> ; jmp loc_enter_hour_1 1266 <1> ;loc_set_time_stc_2: 1267 <1> ; call check_for_backspace 1268 <1> ; je short loc_set_time_bs_2 1269 <1> ; ;xor bh, bh ; video page 0 1270 <1> ; call beeper ; BEEP ! 1271 <1> ; jmp loc_enter_time_separator_1 1272 <1> ;loc_set_time_bs_2: 1273 <1> ; call write_backspace 1274 <1> ; jmp loc_enter_hour_2 1275 <1> ;loc_set_time_stc_3: 1276 <1> ; call check_for_backspace 1277 <1> ; je short loc_set_time_bs_3 1278 <1> ; ;xor bh, bh ; video page 0 1279 <1> ; call beeper ; BEEP !6 1280 <1> ; jmp loc_enter_minute_1 1281 <1> ;loc_set_time_bs_3: 1282 <1> ; call write_backspace 1283 <1> ; jmp loc_enter_time_separator_1 1284 <1> ;loc_set_time_stc_4: 1285 <1> ; call check_for_backspace 1286 <1> ; je short loc_set_time_bs_4 1287 <1> ; ;xor bh, bh ; video page 0 1288 <1> ; call beeper ; BEEP ! 1289 <1> ; jmp loc_enter_minute_2 1290 <1> ;loc_set_time_bs_4: 1291 <1> ; call write_backspace 1292 <1> ; jmp loc_enter_minute_1 1293 <1> 1294 <1> ; 26/07/2022 1295 <1> loc_set_time_stc_5: 1296 00007E21 E80EFEFFFF <1> call check_for_backspace 1297 00007E26 740A <1> je short loc_set_time_bs_5 1298 <1> ;xor bh, bh ; video page 0 1299 00007E28 E89CA5FFFF <1> call beeper ; BEEP ! 1300 00007E2D E966FFFFFF <1> jmp loc_enter_time_separator_2 1301 <1> loc_set_time_bs_5: 1302 00007E32 E8EBFDFFFF <1> call write_backspace 1303 00007E37 E923FFFFFF <1> jmp loc_enter_minute_2 1304 <1> 1305 <1> ; 26/07/2022 1306 <1> loc_set_time_ok: 1307 00007E3C BE[17390100] <1> mov esi, nextline 1308 <1> ;call print_msg 1309 <1> ;retn 1310 00007E41 E974EFFFFF <1> jmp print_msg 1311 <1> 1312 <1> ; 07/08/2022 1313 <1> loc_set_time_stc_6: 1314 00007E46 E8E9FDFFFF <1> call check_for_backspace 1315 00007E4B 7413 <1> je short loc_set_time_bs_6 1316 <1> ;xor bh, bh ; video page 0 1317 00007E4D E877A5FFFF <1> call beeper ; BEEP ! 1318 00007E52 66C705[0A300100]30- <1> mov word [Second], 3030h 1318 00007E5A 30 <1> 1319 00007E5B E965FFFFFF <1> jmp loc_enter_second_1 1320 <1> loc_set_time_bs_6: 1321 00007E60 E8BDFDFFFF <1> call write_backspace 1322 00007E65 E92EFFFFFF <1> jmp loc_enter_time_separator_2 1323 <1> loc_set_time_stc_7: 1324 00007E6A E8C5FDFFFF <1> call check_for_backspace 1325 00007E6F 740A <1> je short loc_set_time_bs_7 1326 <1> ;xor bh, bh ; video page 0 1327 00007E71 E853A5FFFF <1> call beeper ; BEEP ! 1328 00007E76 E96FFFFFFF <1> jmp loc_enter_second_3 1329 <1> loc_set_time_bs_7: 1330 00007E7B E8A2FDFFFF <1> call write_backspace 1331 00007E80 E940FFFFFF <1> jmp loc_enter_second_1 1332 <1> 1333 <1> loc_set_time_progress: 1334 <1> ; Get Current Time 1335 <1> ;mov ah, 02h 1336 <1> ;call int1Ah 1337 00007E85 E8D3E4FFFF <1> call RTC_20 ; GET RTC TIME 1338 <1> ;DL = Daylight Savings Enable option (0-1) 1339 <1> 1340 00007E8A 66A1[04300100] <1> mov ax, [Hour] 1341 00007E90 662D3030 <1> sub ax, '00' 1342 00007E94 C0E004 <1> shl al, 4 ; * 16 1343 00007E97 88C5 <1> mov ch, al 1344 00007E99 00E5 <1> add ch, ah 1345 00007E9B 66A1[07300100] <1> mov ax, [Minute] 1346 00007EA1 662D3030 <1> sub ax, '00' 1347 00007EA5 C0E004 <1> shl al, 4 ; * 16 1348 00007EA8 88C1 <1> mov cl, al 1349 00007EAA 00E1 <1> add cl, ah 1350 00007EAC 66A1[0A300100] <1> mov ax, [Second] 1351 00007EB2 662D3030 <1> sub ax, '00' 1352 00007EB6 C0E004 <1> shl al, 4 ; * 16 1353 00007EB9 88C6 <1> mov dh, al 1354 00007EBB 00E6 <1> add dh, ah 1355 <1> 1356 <1> ;mov ah, 03h 1357 <1> ;call int1Ah 1358 00007EBD E8C9E4FFFF <1> call RTC_30 ; SET RTC TIME 1359 <1> 1360 <1> ; 26/07/2022 1361 00007EC2 E975FFFFFF <1> jmp loc_set_time_ok 1362 <1> 1363 <1> print_volume_info: 1364 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 1365 <1> ; 01/03/2016 1366 <1> ; 08/02/2016 1367 <1> ; 06/02/2016 1368 <1> ; 04/02/2016 1369 <1> ; 18/01/2016 (TRDOS 386 = TRDOS v2.0) 1370 <1> ; 25/10/2009 1371 <1> ; 1372 <1> ; "Volume Serial No: " 1373 <1> ; 1374 <1> ; INPUT : AL = DOS Drive Number 1375 <1> ; OUTPUT : AH = FS Type 1376 <1> ; AL = DOS Drive Name 1377 <1> ; CF = 0 -> OK 1378 <1> ; CF = 1 -> Drive not ready 1379 <1> 1380 00007EC7 88C4 <1> mov ah, al 1381 00007EC9 28C0 <1> sub al, al 1382 00007ECB 0FB7F0 <1> movzx esi, ax 1383 00007ECE 81C600010900 <1> add esi, Logical_DOSDisks 1384 00007ED4 8A06 <1> mov al, [esi] 1385 00007ED6 3C41 <1> cmp al, 'A' 1386 00007ED8 7304 <1> jnb short loc_pvi_set_vol_name 1387 00007EDA 8A6604 <1> mov ah, [esi+LD_FSType] 1388 00007EDD C3 <1> retn 1389 <1> 1390 <1> loc_pvi_set_vol_name: 1391 00007EDE A2[3E300100] <1> mov [Vol_Drv_Name], al 1392 00007EE3 56 <1> push esi 1393 00007EE4 E833010000 <1> call move_volume_name_and_serial_no ;;; 1394 00007EE9 7302 <1> jnc short loc_pvi_mvn_ok 1395 00007EEB 5E <1> pop esi 1396 00007EEC C3 <1> retn 1397 <1> 1398 <1> loc_pvi_mvn_ok: 1399 00007EED 8B3424 <1> mov esi, [esp] 1400 <1> 1401 <1> ; 19/12/2025 1402 <1> %if 0 1403 <1> cmp byte [esi+LD_FSType], 0A1h 1404 <1> jne short loc_pvi_fat_vol_size 1405 <1> mov eax, [esi+LD_FS_VolumeSize] 1406 <1> ; 19/12/2025 1407 <1> ;movzx ebx, word [esi+LD_FS_BytesPerSec] 1408 <1> jmp short loc_vol_size_mul32 1409 <1> %endif 1410 <1> 1411 <1> loc_pvi_fat_vol_size: 1412 00007EF0 8B4670 <1> mov eax, [esi+LD_TotalSectors] 1413 00007EF3 8B4670 <1> mov eax, [esi+LD_TotalSectors] 1414 <1> ; 19/12/2025 1415 <1> ;movzx ebx, word [esi+LD_BPB+BPB_BytsPerSec] 1416 <1> loc_vol_size_mul32: 1417 <1> ; 19/12/2025 1418 00007EF6 BB00020000 <1> mov ebx, 512 1419 00007EFB F7E3 <1> mul ebx 1420 00007EFD 09D2 <1> or edx, edx 1421 00007EFF 7507 <1> jnz short loc_vol_size_in_kbytes 1422 <1> loc_vol_size_in_bytes: 1423 00007F01 B9[1C300100] <1> mov ecx, VolSize_Bytes 1424 00007F06 EB0B <1> jmp short loc_write_vol_size_str 1425 <1> loc_vol_size_in_kbytes: 1426 <1> ;mov bx, 1024 1427 <1> ; 19/12/2025 1428 00007F08 D1E3 <1> shl ebx, 1 ; ebx = 1024 1429 00007F0A F7F3 <1> div ebx 1430 00007F0C B9[0F300100] <1> mov ecx, VolSize_KiloBytes 1431 00007F11 31D2 <1> xor edx, edx ; 0 1432 <1> loc_write_vol_size_str: 1433 00007F13 890D[AC7E0100] <1> mov [VolSize_Unit1], ecx 1434 <1> ; 1435 00007F19 BF[C27E0100] <1> mov edi, Vol_Tot_Sec_Str_End 1436 <1> ;mov byte [edi], 0 1437 00007F1E B90A000000 <1> mov ecx, 10 1438 <1> loc_write_vol_size_chr: 1439 00007F23 F7F1 <1> div ecx 1440 00007F25 80C230 <1> add dl, '0' 1441 00007F28 4F <1> dec edi 1442 00007F29 8817 <1> mov [edi], dl 1443 00007F2B 85C0 <1> test eax, eax 1444 00007F2D 7404 <1> jz short loc_write_vol_size_str_ok 1445 00007F2F 28D2 <1> sub dl, dl ; 0 1446 00007F31 EBF0 <1> jmp short loc_write_vol_size_chr 1447 <1> 1448 <1> loc_write_vol_size_str_ok: 1449 00007F33 893D[B47E0100] <1> mov [Vol_Tot_Sec_Str_Start], edi 1450 <1> ; 1451 00007F39 BF[27300100] <1> mov edi, Vol_FS_Name 1452 00007F3E 8A4E03 <1> mov cl, [esi+LD_FATType] 1453 <1> 1454 <1> ; 19/12/2025 1455 <1> %if 0 1456 <1> and cl, cl ; 0 ? 1457 <1> jnz short loc_write_vol_FAT_str_1 1458 <1> mov word [edi], 'TR' 1459 <1> mov dword [edi+4], ' FS1' 1460 <1> ; 19/12/2025 1461 <1> ;;movzx ebx, word [esi+LD_FS_BytesPerSec] 1462 <1> ;mov bx, [esi+LD_FS_BytesPerSec] 1463 <1> mov eax, [esi+LD_FS_FreeSectors] 1464 <1> jmp short loc_vol_freespace_mul32 1465 <1> %endif 1466 <1> 1467 <1> loc_write_vol_FAT_str_1: 1468 00007F41 66B83332 <1> mov ax, '32' ; FAT32 1469 00007F45 80F902 <1> cmp cl, 2 ; [esi+LD_FATType] 1470 00007F48 7708 <1> ja short loc_write_vol_FAT_str_2 1471 00007F4A 66B83132 <1> mov ax, '12' ; FAT12 1472 00007F4E 7202 <1> jb short loc_write_vol_FAT_str_2 1473 00007F50 B436 <1> mov ah, '6' ; FAT16 1474 <1> loc_write_vol_FAT_str_2: 1475 00007F52 C70746415420 <1> mov dword [edi], 'FAT ' 1476 00007F58 66894704 <1> mov word [edi+4], ax 1477 <1> ; 19/12/2025 1478 <1> ;;movzx ebx, word [esi+LD_BPB+BPB_BytsPerSec] 1479 <1> ;mov bx, [esi+LD_BPB+BPB_BytsPerSec] 1480 00007F5C 8B4674 <1> mov eax, [esi+LD_FreeSectors] 1481 <1> 1482 <1> loc_vol_freespace_recalc0: 1483 <1> ; 01/03/2016 1484 00007F5F 83F8FF <1> cmp eax, 0FFFFFFFFh 1485 00007F62 7209 <1> jb short loc_vol_freespace_mul32 1486 <1> ;inc eax ; 0 1487 <1> 1488 <1> ; 19/12/2025 1489 <1> %if 0 1490 <1> and cl, cl ; byte [esi+LD_FATType] 1491 <1> jz short loc_vol_freespace_mul32 1492 <1> %endif 1493 <1> ; 19/12/2025 1494 <1> ;push ebx 1495 00007F64 66BB00FF <1> mov bx, 0FF00h ; recalculate free sectors 1496 00007F68 E804460000 <1> call calculate_fat_freespace 1497 <1> ;pop ebx 1498 <1> 1499 <1> ; 19/12/2025 1500 <1> ; (if cf = 1, eax = -1) 1501 <1> ; if eax = -1 , free sector count is invalid 1502 <1> 1503 <1> loc_vol_freespace_mul32: 1504 00007F6D B9[1C300100] <1> mov ecx, VolSize_Bytes 1505 00007F72 BF[D27E0100] <1> mov edi, Vol_Free_Sectors_Str_End 1506 <1> ;mov byte [edi], 0 1507 00007F77 40 <1> inc eax ; * ; -1 -> 0 1508 00007F78 7506 <1> jnz short loc_vol_freespace_mul32_@ 1509 00007F7A 4F <1> dec edi 1510 00007F7B C6073F <1> mov byte [edi], '?' 1511 00007F7E EB32 <1> jmp short loc_write_vol_fspace_str_ok 1512 <1> 1513 <1> loc_vol_freespace_mul32_@: 1514 00007F80 48 <1> dec eax ; * 1515 <1> ; 19/12/2025 1516 00007F81 BB00020000 <1> mov ebx, 512 1517 00007F86 F7E3 <1> mul ebx 1518 00007F88 09D2 <1> or edx, edx 1519 <1> ;jnz short loc_vol_fspace_in_kbytes 1520 <1> loc_vol_fspace_in_bytes: 1521 <1> ; 19/12/2025 1522 <1> ;mov ecx, VolSize_Bytes 1523 <1> ;jmp short loc_write_vol_fspace_str 1524 00007F8A 740B <1> jz short loc_write_vol_fspace_str 1525 <1> loc_vol_fspace_in_kbytes: 1526 <1> ;mov bx, 1024 1527 <1> ; 19/12/2025 1528 00007F8C D1E3 <1> shl ebx, 1 ; ebx = 1024 1529 00007F8E F7F3 <1> div ebx 1530 00007F90 B9[0F300100] <1> mov ecx, VolSize_KiloBytes 1531 00007F95 31D2 <1> xor edx, edx ; 0 1532 <1> loc_write_vol_fspace_str: 1533 00007F97 890D[B07E0100] <1> mov [VolSize_Unit2], ecx 1534 <1> ; 1535 <1> ; 19/12/2025 1536 <1> ;mov edi, Vol_Free_Sectors_Str_End 1537 <1> ;mov byte [edi], 0 1538 00007F9D B90A000000 <1> mov ecx, 10 1539 <1> loc_write_vol_fspace_chr: 1540 00007FA2 F7F1 <1> div ecx 1541 00007FA4 80C230 <1> add dl, '0' 1542 00007FA7 4F <1> dec edi 1543 00007FA8 8817 <1> mov [edi], dl 1544 00007FAA 85C0 <1> test eax, eax 1545 00007FAC 7404 <1> jz short loc_write_vol_fspace_str_ok 1546 00007FAE 28D2 <1> sub dl, dl ; 0 1547 00007FB0 EBF0 <1> jmp short loc_write_vol_fspace_chr 1548 <1> 1549 <1> loc_write_vol_fspace_str_ok: 1550 00007FB2 893D[C47E0100] <1> mov [Vol_Free_Sectors_Str_Start], edi 1551 <1> ; 1552 00007FB8 BE[25300100] <1> mov esi, Volume_in_drive 1553 00007FBD E8F8EDFFFF <1> call print_msg 1554 00007FC2 BE[65300100] <1> mov esi, Vol_Name 1555 00007FC7 E8EEEDFFFF <1> call print_msg 1556 00007FCC BE[17390100] <1> mov esi, nextline 1557 00007FD1 E8E4EDFFFF <1> call print_msg 1558 <1> ; 1559 00007FD6 BE[C6300100] <1> mov esi, Vol_Total_Sector_Header 1560 00007FDB E8DAEDFFFF <1> call print_msg 1561 00007FE0 8B35[B47E0100] <1> mov esi, [Vol_Tot_Sec_Str_Start] 1562 00007FE6 E8CFEDFFFF <1> call print_msg 1563 00007FEB 8B35[AC7E0100] <1> mov esi, [VolSize_Unit1] 1564 00007FF1 E8C4EDFFFF <1> call print_msg 1565 <1> ; 1566 00007FF6 BE[D7300100] <1> mov esi, Vol_Free_Sectors_Header 1567 00007FFB E8BAEDFFFF <1> call print_msg 1568 00008000 8B35[C47E0100] <1> mov esi, [Vol_Free_Sectors_Str_Start] 1569 00008006 E8AFEDFFFF <1> call print_msg 1570 0000800B 8B35[B07E0100] <1> mov esi, [VolSize_Unit2] 1571 00008011 E8A4EDFFFF <1> call print_msg 1572 <1> ; 1573 00008016 5E <1> pop esi 1574 <1> 1575 <1> ;mov ah, [esi+LD_FSType] 1576 <1> ;mov al, [esi+LD_FATType] 1577 00008017 668B4603 <1> mov ax, [esi+LD_FATType] 1578 <1> 1579 0000801B C3 <1> retn 1580 <1> 1581 <1> move_volume_name_and_serial_no: 1582 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 1583 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 1584 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 1585 <1> ; this routine will be called by 1586 <1> ; "print_volume_info" and "print_directory" 1587 <1> ; INPUT -> 1588 <1> ; ESI = Logical DOS drv descripton table address 1589 <1> ; OUTPUT -> 1590 <1> ; *Volume name will be moved to text area 1591 <1> ; *Volume serial number will be converted to 1592 <1> ; text and will be moved to text area 1593 <1> ; cf = 1 -> invalid/unknown dos drive 1594 <1> ; cf = 0 -> ecx = 0 1595 <1> ; 1596 <1> ; (eax, edx, ecx, esi, edi will be changed) 1597 <1> 1598 <1> ; 26/07/2022 1599 0000801C 31C9 <1> xor ecx, ecx 1600 <1> 1601 0000801E BF[65300100] <1> mov edi, Vol_Name 1602 <1> 1603 <1> ;mov ah, [esi+LD_FSType] 1604 <1> ; 19/12/2025 1605 00008023 8A4603 <1> mov al, [esi+LD_FATType] 1606 <1> ;mov ax, [esi+LD_FATType] 1607 <1> 1608 <1> ; 19/12/2025 1609 <1> %if 0 1610 <1> cmp ah, 0A1h 1611 <1> je short mvn_2 1612 <1> or ah, ah 1613 <1> jz short mvn_0 1614 <1> or al, al 1615 <1> jnz short mvn_1 1616 <1> mvn_0: 1617 <1> mov al, [esi] 1618 <1> stc 1619 <1> retn 1620 <1> %endif 1621 <1> 1622 <1> mvn_1: 1623 00008026 3C02 <1> cmp al, 2 1624 00008028 7708 <1> ja short mvn_3 1625 <1> ;or al, al 1626 <1> ;jz short mvn_2 1627 0000802A 8B462D <1> mov eax, [esi+LD_BPB+VolumeID] 1628 0000802D 83C631 <1> add esi, LD_BPB+VolumeLabel 1629 00008030 EB06 <1> jmp short mvn_4 1630 <1> 1631 <1> ; 19/12/2025 1632 <1> %if 0 1633 <1> mvn_2: 1634 <1> mov eax, [esi+LD_FS_VolumeSerial] 1635 <1> add esi, LD_FS_VolumeName 1636 <1> ;mov ecx, 16 1637 <1> ; 26/07/2022 1638 <1> mov cl, 16 1639 <1> rep movsd 1640 <1> jmp short mvn_5 1641 <1> %endif 1642 <1> 1643 <1> mvn_3: 1644 00008032 8B4649 <1> mov eax, [esi+LD_BPB+FAT32_VolID] 1645 00008035 83C64D <1> add esi, LD_BPB+FAT32_VolLab 1646 <1> mvn_4: 1647 <1> ;mov ecx, 11 1648 <1> ; 26/07/2022 1649 00008038 B10B <1> mov cl, 11 1650 0000803A F3A4 <1> rep movsb 1651 0000803C C60700 <1> mov byte [edi], 0 1652 <1> mvn_5: 1653 <1> ;mov [Current_VolSerial], eax 1654 0000803F E8BBC1FFFF <1> call dwordtohex 1655 00008044 8915[BA300100] <1> mov [Vol_Serial1], edx 1656 0000804A A3[BF300100] <1> mov [Vol_Serial2], eax 1657 <1> ; ecx = 0 1658 0000804F C3 <1> retn 1659 <1> 1660 <1> get_volume_serial_number: 1661 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 1662 <1> ; 19/01/2016 (TRDOS 386 = TRDOS v2.0) 1663 <1> ; 08/08/2010 1664 <1> ; 1665 <1> ; INPUT -> DL = Logical DOS Drive number 1666 <1> ; OUTPUT -> EAX = Volume serial number 1667 <1> ; BL= FAT Type 1668 <1> ; BH = Logical DOS drv Number (DL input) 1669 <1> ; cf = 1 -> Drive not ready 1670 <1> 1671 00008050 31DB <1> xor ebx, ebx 1672 00008052 88D7 <1> mov bh, dl 1673 00008054 3815[8D2E0100] <1> cmp [Last_DOS_DiskNo], dl 1674 0000805A 7304 <1> jnb short loc_gvsn_start 1675 <1> loc_gvsn_stc_retn: 1676 0000805C 31C0 <1> xor eax, eax 1677 0000805E F9 <1> stc 1678 0000805F C3 <1> retn 1679 <1> loc_gvsn_start: 1680 00008060 56 <1> push esi 1681 00008061 BE00010900 <1> mov esi, Logical_DOSDisks 1682 00008066 01DE <1> add esi, ebx 1683 <1> ; 19/12/2025 1684 <1> %if 0 1685 <1> mov bl, [esi+LD_FATType] 1686 <1> and bl, bl 1687 <1> jz short loc_gvsn_fs 1688 <1> %endif 1689 00008068 80FB02 <1> cmp bl, 2 1690 0000806B 7705 <1> ja short loc_gvsn_fat32 1691 <1> loc_gvsn_fat: 1692 0000806D 83C62D <1> add esi, LD_BPB + VolumeID 1693 00008070 EB03 <1> jmp short loc_gvsn_return 1694 <1> loc_gvsn_fat32: 1695 00008072 83C649 <1> add esi, LD_BPB + FAT32_VolID 1696 <1> ; 19/12/2025 1697 <1> %if 0 1698 <1> jmp short loc_gvsn_return 1699 <1> loc_gvsn_fs: 1700 <1> cmp byte [esi+LD_FSType], 0A1h 1701 <1> jne short loc_gvsn_stc_retn 1702 <1> add esi, LD_FS_VolumeSerial 1703 <1> %endif 1704 <1> 1705 <1> loc_gvsn_return: 1706 00008075 8B06 <1> mov eax, [esi] 1707 00008077 5E <1> pop esi 1708 00008078 C3 <1> retn 1709 <1> 1710 <1> ; CMD_INTR.ASM [ TRDOS Command Interpreter Procedure ] 1711 <1> ; 09/11/2011 1712 <1> ; 29/01/2005 1713 <1> 1714 <1> command_interpreter: 1715 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 1716 <1> ; 16/10/2016 1717 <1> ; 12/10/2016 1718 <1> ; 13/05/2016 1719 <1> ; 07/05/2016 1720 <1> ; 04/03/2016 1721 <1> ; 04/02/2016 1722 <1> ; 03/02/2016 1723 <1> ; 30/01/2016 1724 <1> ; 29/01/2016 (TRDOS 386 = TRDOS 2.0) 1725 <1> ; 15/09/2011 1726 <1> ; 29/01/2005 1727 <1> 1728 <1> ; Input: ecx = command word length (CL) 1729 <1> ; CommandBuffer = Command string offset 1730 <1> 1731 00008079 C605[647F0100]00 <1> mov byte [Program_Exit], 0 1732 <1> 1733 <1> ;cmp cl, 4 1734 <1> ;ja c_6 1735 <1> ;jb c_2 1736 <1> 1737 <1> ; 26/07/2022 1738 00008080 80F903 <1> cmp cl, 3 1739 00008083 777C <1> ja short c_4 1740 00008085 7405 <1> je short c_3 1741 00008087 E9D2010000 <1> jmp c_2 1742 <1> c_3: 1743 <1> cmp_cmd_dir: 1744 0000808C BF[F62E0100] <1> mov edi, Cmd_Dir 1745 00008091 E8D1030000 <1> call cmp_cmd 1746 <1> ;jnc print_directory_list 1747 <1> ; 26/07/2022 1748 00008096 7205 <1> jc short cmp_cmd_cls 1749 00008098 E97D040000 <1> jmp print_directory_list 1750 <1> 1751 <1> cmp_cmd_cls: 1752 0000809D B103 <1> mov cl, 3 1753 0000809F BF[322F0100] <1> mov edi, Cmd_Cls 1754 000080A4 E8BE030000 <1> call cmp_cmd 1755 <1> ;jnc clear_screen 1756 <1> ; 26/07/2022 1757 000080A9 7205 <1> jc short cmp_cmd_ver 1758 000080AB E920EDFFFF <1> jmp clear_screen 1759 <1> 1760 <1> cmp_cmd_ver: 1761 000080B0 B103 <1> mov cl, 3 1762 000080B2 BF[002F0100] <1> mov edi, Cmd_Ver 1763 000080B7 E8AB030000 <1> call cmp_cmd 1764 000080BC 720A <1> jc short cmp_cmd_mem 1765 <1> 1766 000080BE BE[952E0100] <1> mov esi, mainprog_Version 1767 <1> ;call print_msg 1768 000080C3 E9F2ECFFFF <1> jmp print_msg 1769 <1> ;retn 1770 <1> 1771 <1> cmp_cmd_mem: 1772 000080C8 B103 <1> mov cl, 3 1773 000080CA BF[682F0100] <1> mov edi, Cmd_Mem 1774 000080CF E893030000 <1> call cmp_cmd 1775 <1> ;jnc memory_info 1776 <1> ; 26/07/2022 1777 000080D4 7205 <1> jc short cmp_cmd_del 1778 000080D6 E951C0FFFF <1> jmp memory_info 1779 <1> 1780 <1> cmp_cmd_del: 1781 000080DB B103 <1> mov cl, 3 1782 000080DD BF[3B2F0100] <1> mov edi, Cmd_Del 1783 000080E2 E880030000 <1> call cmp_cmd 1784 <1> ;jnc delete_file 1785 <1> ; 26/07/2022 1786 000080E7 7205 <1> jc short cmp_cmd_set 1787 000080E9 E9E2100000 <1> jmp delete_file 1788 <1> 1789 <1> cmp_cmd_set: 1790 000080EE B103 <1> mov cl, 3 1791 000080F0 BF[2E2F0100] <1> mov edi, Cmd_Set 1792 000080F5 E86D030000 <1> call cmp_cmd 1793 <1> ;jnc set_get_env 1794 <1> ; 26/07/2022 1795 000080FA 720F <1> jc short cmp_cmd_run 1796 000080FC E9F1180000 <1> jmp set_get_env 1797 <1> 1798 <1> ; 07/08/2022 1799 <1> c_4: 1800 <1> ; 26/07/2022 1801 00008101 80F904 <1> cmp cl, 4 1802 00008104 741D <1> je short cmp_cmd_4 1803 00008106 E937020000 <1> jmp c_6 1804 <1> 1805 <1> cmp_cmd_run: 1806 0000810B B103 <1> mov cl, 3 1807 0000810D BF[2A2F0100] <1> mov edi, Cmd_Run 1808 00008112 E850030000 <1> call cmp_cmd 1809 <1> ; 07/05/2016 1810 <1> ;jc cmp_cmd_external 1811 <1> ; 26/07/2022 1812 00008117 7305 <1> jnc short c3_run 1813 00008119 E92C030000 <1> jmp cmp_cmd_external 1814 <1> c3_run: 1815 0000811E E9D71E0000 <1> jmp load_and_execute_file 1816 <1> 1817 <1> cmp_cmd_4: 1818 <1> ; 26/07/2022 1819 <1> cmp_cmd_exit: 1820 00008123 BF[042F0100] <1> mov edi, Cmd_Exit 1821 00008128 E83A030000 <1> call cmp_cmd 1822 0000812D 7208 <1> jc short cmp_cmd_date 1823 <1> 1824 0000812F C605[647F0100]01 <1> mov byte [Program_Exit], 1 1825 00008136 C3 <1> retn 1826 <1> 1827 <1> cmp_cmd_date: 1828 00008137 B104 <1> mov cl, 4 1829 00008139 BF[202F0100] <1> mov edi, Cmd_Date 1830 0000813E E824030000 <1> call cmp_cmd 1831 00008143 720A <1> jc short cmp_cmd_time 1832 <1> 1833 00008145 E85BF8FFFF <1> call show_date 1834 <1> ;call set_date 1835 <1> ;retn 1836 <1> ; 26/07/2022 1837 0000814A E999F8FFFF <1> jmp set_date 1838 <1> 1839 <1> cmp_cmd_time: 1840 0000814F B104 <1> mov cl, 4 1841 00008151 BF[252F0100] <1> mov edi, Cmd_Time 1842 00008156 E80C030000 <1> call cmp_cmd 1843 0000815B 720A <1> jc short cmp_cmd_show 1844 <1> 1845 0000815D E8E9FAFFFF <1> call show_time 1846 <1> ;call set_time 1847 <1> ;retn 1848 <1> ; 26/07/2022 1849 00008162 E91AFBFFFF <1> jmp set_time 1850 <1> 1851 <1> cmp_cmd_show: 1852 00008167 B104 <1> mov cl, 4 1853 00008169 BF[362F0100] <1> mov edi, Cmd_Show 1854 0000816E E8F4020000 <1> call cmp_cmd 1855 <1> ;jnc show_file 1856 <1> ; 26/07/2022 1857 00008173 7205 <1> jc short cmp_cmd_echo 1858 00008175 E971090000 <1> jmp show_file 1859 <1> 1860 <1> cmp_cmd_echo: 1861 0000817A B104 <1> mov cl, 4 1862 0000817C BF[722F0100] <1> mov edi, Cmd_Echo 1863 00008181 E8E1020000 <1> call cmp_cmd 1864 00008186 7224 <1> jc short cmp_cmd_copy 1865 <1> 1866 <1> ; 22/11/2017 1867 <1> ; AL = 0 1868 00008188 803E20 <1> cmp byte [esi], 20h 1869 0000818B 7215 <1> jb short cmd_echo_nextline 1870 <1> ; 14/04/2016 1871 0000818D 56 <1> push esi 1872 <1> cmd_echo_asciiz: 1873 <1> ;inc esi 1874 <1> ;mov al, [esi] 1875 <1> ; 22/11/2017 1876 0000818E AC <1> lodsb 1877 0000818F 3C20 <1> cmp al, 20h 1878 00008191 73FB <1> jnb short cmd_echo_asciiz 1879 00008193 4E <1> dec esi 1880 00008194 C60600 <1> mov byte [esi], 0 1881 00008197 5E <1> pop esi 1882 00008198 89F7 <1> mov edi, esi 1883 0000819A E81BECFFFF <1> call print_msg 1884 0000819F C60700 <1> mov byte [edi], 0 1885 <1> cmd_echo_nextline: 1886 000081A2 BE[85390100] <1> mov esi, NextLine 1887 <1> ;call print_msg 1888 <1> ;retn 1889 000081A7 E90EECFFFF <1> jmp print_msg 1890 <1> 1891 <1> cmp_cmd_copy: 1892 000081AC B104 <1> mov cl, 4 1893 000081AE BF[592F0100] <1> mov edi, Cmd_Copy 1894 000081B3 E8AF020000 <1> call cmp_cmd 1895 <1> ;jnc copy_file 1896 <1> ; 26/07/2022 1897 000081B8 7205 <1> jc short cmp_cmd_move 1898 000081BA E995160000 <1> jmp copy_file 1899 <1> 1900 <1> cmp_cmd_move: 1901 000081BF B104 <1> mov cl, 4 1902 000081C1 BF[5E2F0100] <1> mov edi, Cmd_Move 1903 000081C6 E89C020000 <1> call cmp_cmd 1904 <1> ;jnc move_file 1905 <1> ; 26/07/2022 1906 000081CB 7205 <1> jc short cmp_cmd_path 1907 000081CD E940150000 <1> jmp move_file 1908 <1> 1909 <1> cmp_cmd_path: 1910 000081D2 B104 <1> mov cl, 4 1911 000081D4 BF[632F0100] <1> mov edi, Cmd_Path 1912 000081D9 E889020000 <1> call cmp_cmd 1913 <1> ;jnc set_get_path 1914 <1> ; 26/07/2022 1915 000081DE 7205 <1> jc short cmp_cmd_beep 1916 000081E0 E995180000 <1> jmp set_get_path 1917 <1> 1918 <1> cmp_cmd_beep: 1919 000081E5 B104 <1> mov cl, 4 1920 000081E7 BF[902F0100] <1> mov edi, Cmd_Beep 1921 000081EC E876020000 <1> call cmp_cmd 1922 000081F1 720B <1> jc short cmp_cmd_find 1923 <1> ; 13/05/2016 1924 000081F3 8A3D[DE760100] <1> mov bh, [ptty] ; [ACTIVE_PAGE] 1925 000081F9 E9CBA1FFFF <1> jmp beeper 1926 <1> 1927 <1> cmp_cmd_find: 1928 000081FE B104 <1> mov cl, 4 1929 00008200 BF[6D2F0100] <1> mov edi, Cmd_Find 1930 00008205 E85D020000 <1> call cmp_cmd 1931 <1> ;jc cmp_cmd_external 1932 <1> ; 26/07/2022 1933 0000820A 7305 <1> jnc short c4_find 1934 0000820C E939020000 <1> jmp cmp_cmd_external 1935 <1> c4_find: 1936 <1> ;call find_and_list_files 1937 00008211 E9FC200000 <1> jmp find_and_list_files 1938 <1> ;retn 1939 <1> 1940 <1> c_1: 1941 00008216 AD <1> lodsd 1942 <1> cmp_cmd_help: 1943 00008217 3C3F <1> cmp al, '?' 1944 00008219 751D <1> jne short cmp_cmd_remark 1945 <1> 1946 0000821B BE[F62E0100] <1> mov esi, Command_List 1947 <1> cmd_help_next_w: 1948 00008220 E895EBFFFF <1> call print_msg 1949 <1> 1950 00008225 803E20 <1> cmp byte [esi], 20h ; 0 1951 00008228 7233 <1> jb short cmd_help_retn 1952 <1> 1953 0000822A 56 <1> push esi 1954 0000822B BE[17390100] <1> mov esi, nextline 1955 00008230 E885EBFFFF <1> call print_msg 1956 00008235 5E <1> pop esi 1957 00008236 EBE8 <1> jmp short cmd_help_next_w 1958 <1> 1959 <1> cmp_cmd_remark: 1960 00008238 3C2A <1> cmp al, '*' 1961 <1> ;jne cmp_cmd_external 1962 <1> ; 26/07/2022 1963 0000823A 7405 <1> je short cmp_cmd_rem 1964 0000823C E909020000 <1> jmp cmp_cmd_external 1965 <1> cmp_cmd_rem: 1966 00008241 46 <1> inc esi 1967 00008242 BF[D8770100] <1> mov edi, Remark 1968 00008247 8A06 <1> mov al, [esi] 1969 00008249 3C20 <1> cmp al, 20h 1970 0000824B 7707 <1> ja short cmd_remark_write 1971 0000824D 89FE <1> mov esi, edi ; Remark 1972 0000824F E966EBFFFF <1> jmp print_msg 1973 <1> 1974 <1> cmd_remark_write: 1975 00008254 AA <1> stosb 1976 00008255 AC <1> lodsb 1977 00008256 3C20 <1> cmp al, 20h 1978 00008258 73FA <1> jnb short cmd_remark_write 1979 0000825A C60700 <1> mov byte [edi], 0 1980 <1> 1981 <1> cmd_help_retn: 1982 <1> cmd_remark_retn: 1983 <1> cd_retn: 1984 0000825D C3 <1> retn 1985 <1> c_2: 1986 <1> ; 26/07/2022 1987 0000825E BE[26780100] <1> mov esi, CommandBuffer 1988 00008263 80F902 <1> cmp cl, 2 1989 <1> ;ja c_3 1990 <1> ;mov esi, CommandBuffer 1991 00008266 72AE <1> jb short c_1 1992 <1> ; 26/07/2022 1993 <1> ;jne short c_1 1994 <1> 1995 <1> cmp_cmd_cd: 1996 00008268 66AD <1> lodsw 1997 0000826A 663D4344 <1> cmp ax, 'CD' 1998 0000826E 754E <1> jne short cmp_cmd_drive 1999 00008270 46 <1> inc esi 2000 <1> cd_0: 2001 00008271 668B06 <1> mov ax, [esi] 2002 00008274 3C20 <1> cmp al, 20h 2003 00008276 76E5 <1> jna short cd_retn 2004 <1> ; 10/02/2016 2005 00008278 80FC3A <1> cmp ah, ':' 2006 0000827B 7504 <1> jne short cd_1 2007 0000827D 46 <1> inc esi 2008 0000827E 46 <1> inc esi 2009 0000827F EB47 <1> jmp short cd_2 2010 <1> 2011 <1> cd_1: ; change current directory 2012 <1> ; 29/11/2009 2013 <1> ; AH = CDh ; to separate 'CD' command from others 2014 <1> ; for restoring current directory 2015 <1> ; 0CDh sign is for saving cdir into 2016 <1> ; DOS drv description table cdir area 2017 <1> 2018 00008281 B4CD <1> mov ah, 0CDh ; mov byte [CD_COMMAND], 0CDh 2019 <1> 2020 00008283 E863210000 <1> call change_current_directory 2021 <1> ;jnc change_prompt_dir_string 2022 <1> ; 26/07/2022 2023 00008288 7205 <1> jc short cd_error_messages 2024 0000828A E985200000 <1> jmp change_prompt_dir_string 2025 <1> 2026 <1> cd_error_messages: 2027 0000828F 3C03 <1> cmp al, 3 2028 00008291 740C <1> je short cd_path_not_found 2029 <1> ; 16/10/2016 (15h -> 15) 2030 00008293 3C0F <1> cmp al, 15 ; drive not ready error 2031 00008295 7453 <1> je short cd_drive_not_ready 2032 00008297 3C11 <1> cmp al, 17 ; read error 2033 00008299 744F <1> je short cd_drive_not_ready 2034 0000829B 3C13 <1> cmp al, 19 ; ; Bad directory/path name 2035 0000829D 7460 <1> je short cd_command_failed 2036 <1> 2037 <1> cd_path_not_found: 2038 0000829F 50 <1> push eax ; 29/12/2017 2039 <1> ;push ax 2040 000082A0 BE[99310100] <1> mov esi, Msg_Dir_Not_Found 2041 000082A5 E810EBFFFF <1> call print_msg 2042 <1> ;pop ax 2043 000082AA 58 <1> pop eax ; 29/12/2017 2044 000082AB 3A25[74770100] <1> cmp ah, [Current_Dir_Level] 2045 <1> ;jnb change_prompt_dir_string 2046 <1> ; 26/07/2022 2047 000082B1 7306 <1> jnb short cd_cpds 2048 000082B3 8825[74770100] <1> mov [Current_Dir_Level], ah 2049 <1> cd_cpds: 2050 000082B9 E956200000 <1> jmp change_prompt_dir_string 2051 <1> 2052 <1> cmp_cmd_drive: ; change current drive 2053 <1> ; C:, D:, E: etc. 2054 000082BE 80FC3A <1> cmp ah, ':' 2055 <1> ;jne cmp_cmd_external 2056 <1> ; 26/07/2022 2057 000082C1 7405 <1> je short cd_2 2058 <1> cmd_ext: 2059 000082C3 E982010000 <1> jmp cmp_cmd_external 2060 <1> 2061 <1> cd_2: ; 'CD C:', 'CD D:' ... 2062 000082C8 803E20 <1> cmp byte [esi], 20h 2063 <1> ;ja loc_cmd_failed 2064 <1> ; 26/07/2022 2065 000082CB 7706 <1> ja short cd_failed 2066 000082CD 24DF <1> and al, 0DFh 2067 000082CF 2C41 <1> sub al, 'A' 2068 <1> ;jc loc_cmd_failed 2069 <1> ; 26/07/2022 2070 000082D1 7305 <1> jnc short cd_3 2071 <1> cd_failed: 2072 000082D3 E97C010000 <1> jmp loc_cmd_failed 2073 <1> cd_3: 2074 000082D8 3A05[8D2E0100] <1> cmp al, [Last_DOS_DiskNo] 2075 000082DE 770A <1> ja short cd_drive_not_ready 2076 <1> 2077 000082E0 88C2 <1> mov dl, al 2078 000082E2 E809F4FFFF <1> call change_current_drive 2079 000082E7 7201 <1> jc short cd_drive_not_ready 2080 000082E9 C3 <1> retn 2081 <1> 2082 <1> cd_drive_not_ready: 2083 000082EA BE[56310100] <1> mov esi, Msg_Not_Ready_Read_Err 2084 000082EF E8C6EAFFFF <1> call print_msg 2085 <1> 2086 <1> cd_fail_drive_restart: 2087 000082F4 8A15[76770100] <1> mov dl, [Current_Drv] 2088 <1> ;call change_current_drive 2089 000082FA E9F1F3FFFF <1> jmp change_current_drive 2090 <1> ;retn 2091 <1> 2092 <1> cd_command_failed: 2093 000082FF BE[37310100] <1> mov esi, Msg_Bad_Command 2094 00008304 E8B1EAFFFF <1> call print_msg 2095 00008309 EBE9 <1> jmp short cd_fail_drive_restart 2096 <1> 2097 <1> c_5: 2098 <1> cmp_cmd_mkdir: 2099 0000830B BF[532F0100] <1> mov edi, Cmd_Mkdir 2100 00008310 E852010000 <1> call cmp_cmd 2101 <1> ;jnc make_directory 2102 <1> ; 26/07/2022 2103 00008315 7205 <1> jc short cmp_cmd_rmdir 2104 00008317 E9550A0000 <1> jmp make_directory 2105 <1> 2106 <1> cmp_cmd_rmdir: 2107 0000831C B105 <1> mov cl, 5 2108 0000831E BF[4D2F0100] <1> mov edi, Cmd_Rmdir 2109 00008323 E83F010000 <1> call cmp_cmd 2110 <1> ;jnc delete_directory 2111 <1> ; 26/07/2022 2112 00008328 7205 <1> jc short cmp_cmd_chdir 2113 0000832A E95E0B0000 <1> jmp delete_directory 2114 <1> 2115 <1> cmp_cmd_chdir: 2116 0000832F B105 <1> mov cl, 5 2117 00008331 BF[8A2F0100] <1> mov edi, Cmd_Chdir 2118 00008336 E82C010000 <1> call cmp_cmd 2119 <1> ;jc cmp_cmd_external 2120 <1> ; 26/07/2022 2121 0000833B 7286 <1> jc short cmd_ext 2122 <1> 2123 0000833D E92FFFFFFF <1> jmp cd_0 2124 <1> 2125 <1> c_6: 2126 00008342 80F906 <1> cmp cl, 6 2127 <1> ;ja c_8 2128 <1> ; 26/07/2022 2129 00008345 72C4 <1> jb short c_5 2130 00008347 7405 <1> je short cmd_6 2131 00008349 E9E4000000 <1> jmp c_8 2132 <1> 2133 <1> cmd_6: 2134 <1> cmp_cmd_prompt: 2135 0000834E BF[092F0100] <1> mov edi, Cmd_Prompt 2136 00008353 E80F010000 <1> call cmp_cmd 2137 00008358 722F <1> jc short cmp_cmd_volume 2138 <1> get_prompt_name_fchar: 2139 0000835A AC <1> lodsb 2140 0000835B 3C20 <1> cmp al, 20h 2141 0000835D 74FB <1> je short get_prompt_name_fchar 2142 0000835F 7713 <1> ja short loc_change_prompt_label 2143 <1> default_command_prompt: ; 31/12/2017 ('sysprompt') 2144 00008361 BE[EA2E0100] <1> mov esi, TRDOSPromptLabel 2145 00008366 C7065452444F <1> mov dword [esi], "TRDO" 2146 0000836C 66C746045300 <1> mov word [esi+4], "S" 2147 <1> loc_cmd_prompt_return: 2148 00008372 C3 <1> retn 2149 <1> 2150 <1> set_command_prompt: ; 31/12/2017 ('sysprompt') 2151 00008373 AC <1> lodsb 2152 <1> loc_change_prompt_label: 2153 <1> ;mov cx, 11 2154 <1> ; 26/07/2022 2155 00008374 29C9 <1> sub ecx, ecx 2156 00008376 B10B <1> mov cl, 11 2157 00008378 BF[EA2E0100] <1> mov edi, TRDOSPromptLabel 2158 <1> put_char_new_prompt_label: 2159 0000837D AA <1> stosb 2160 0000837E AC <1> lodsb 2161 0000837F 3C20 <1> cmp al, 20h 2162 00008381 7202 <1> jb short pass_put_new_prompt_label 2163 00008383 E2F8 <1> loop put_char_new_prompt_label 2164 <1> pass_put_new_prompt_label: 2165 00008385 C60700 <1> mov byte [edi], 0 2166 00008388 C3 <1> retn 2167 <1> 2168 <1> cmp_cmd_volume: 2169 00008389 B106 <1> mov cl, 6 2170 0000838B BF[102F0100] <1> mov edi, Cmd_Volume 2171 00008390 E8D2000000 <1> call cmp_cmd 2172 00008395 7259 <1> jc short cmp_cmd_attrib 2173 <1> 2174 <1> cmd_vol1: 2175 00008397 AC <1> lodsb 2176 00008398 3C20 <1> cmp al, 20h 2177 0000839A 7707 <1> ja short cmd_vol2 2178 0000839C A0[76770100] <1> mov al, [Current_Drv] 2179 000083A1 EB41 <1> jmp short cmd_vol4 2180 <1> cmd_vol2: 2181 000083A3 3C41 <1> cmp al, 'A' 2182 <1> ;jb loc_cmd_failed 2183 <1> ; 26/07/2022 2184 000083A5 722D <1> jb short cmd_vol_failed_1 2185 000083A7 3C7A <1> cmp al, 'z' 2186 <1> ;ja loc_cmd_failed 2187 <1> ; 26/07/2022 2188 000083A9 7731 <1> ja short cmd_vol_failed_2 2189 000083AB 3C5A <1> cmp al, 'Z' 2190 000083AD 7606 <1> jna short cmd_vol3 2191 000083AF 3C61 <1> cmp al, 'a' 2192 <1> ;jb loc_cmd_failed 2193 <1> ; 26/07/2022 2194 000083B1 722B <1> jb short cmd_vol_failed_3 2195 000083B3 24DF <1> and al, 0DFh 2196 <1> cmd_vol3: 2197 000083B5 8A26 <1> mov ah, [esi] 2198 000083B7 80FC3A <1> cmp ah, ':' 2199 000083BA 0F8594000000 <1> jne loc_cmd_failed 2200 000083C0 2C41 <1> sub al, 'A' 2201 000083C2 3A05[8D2E0100] <1> cmp al, [Last_DOS_DiskNo] 2202 000083C8 761A <1> jna short cmd_vol4 2203 <1> 2204 000083CA BE[56310100] <1> mov esi, Msg_Not_Ready_Read_Err 2205 000083CF E9E6E9FFFF <1> jmp print_msg 2206 <1> 2207 <1> ; 26/07/2022 2208 <1> ; (numeric characters and underscore are allowed) 2209 <1> cmd_vol_failed_1: 2210 <1> ; check for numeric characters 2211 000083D4 3C30 <1> cmp al, '0' 2212 000083D6 7204 <1> jb short cmd_vol_failed_2 2213 000083D8 3C39 <1> cmp al, '9' 2214 000083DA 76D9 <1> jna short cmd_vol3 2215 <1> cmd_vol_failed_2: 2216 000083DC EB76 <1> jmp loc_cmd_failed 2217 <1> cmd_vol_failed_3: 2218 000083DE 3C5F <1> cmp al, '_' ; underline ? 2219 000083E0 74D3 <1> je short cmd_vol3 ; is ok.. 2220 000083E2 EBF8 <1> jmp short cmd_vol_failed_2 2221 <1> 2222 <1> cmd_vol4: 2223 000083E4 E8DEFAFFFF <1> call print_volume_info 2224 <1> ;jc cd_drive_not_ready 2225 <1> ; 26/07/2022 2226 000083E9 7339 <1> jnc short cmd_vol5 2227 000083EB E9FAFEFFFF <1> jmp cd_drive_not_ready 2228 <1> ;cmd_vol5: 2229 <1> ; retn 2230 <1> 2231 <1> cmp_cmd_attrib: 2232 000083F0 B106 <1> mov cl, 6 2233 000083F2 BF[3F2F0100] <1> mov edi, Cmd_Attrib 2234 000083F7 E86B000000 <1> call cmp_cmd 2235 <1> ;jnc set_file_attributes 2236 <1> ; 26/07/2022 2237 000083FC 7205 <1> jc short cmp_cmd_rename 2238 000083FE E9D80E0000 <1> jmp set_file_attributes 2239 <1> 2240 <1> cmp_cmd_rename: 2241 00008403 B106 <1> mov cl, 6 2242 00008405 BF[462F0100] <1> mov edi, Cmd_Rename 2243 0000840A E858000000 <1> call cmp_cmd 2244 <1> ;jnc rename_file 2245 <1> ; 26/07/2022 2246 0000840F 7205 <1> jc short cmp_cmd_device 2247 00008411 E9BF100000 <1> jmp rename_file 2248 <1> 2249 <1> cmp_cmd_device: 2250 00008416 B106 <1> mov cl, 6 2251 00008418 BF[7B2F0100] <1> mov edi, Cmd_Device 2252 0000841D E845000000 <1> call cmp_cmd 2253 00008422 7226 <1> jc short cmp_cmd_external 2254 <1> ; 26/07/2022 2255 <1> cmd_vol5: 2256 <1> cmd_dev: 2257 00008424 C3 <1> retn 2258 <1> 2259 <1> c_7: 2260 <1> cmp_cmd_devlist: 2261 00008425 BF[822F0100] <1> mov edi, Cmd_DevList 2262 0000842A E838000000 <1> call cmp_cmd 2263 0000842F 7219 <1> jc short cmp_cmd_external 2264 <1> 2265 <1> loc_cmd_return: 2266 00008431 C3 <1> retn 2267 <1> 2268 <1> c_8: 2269 00008432 80F908 <1> cmp cl, 8 2270 00008435 7713 <1> ja short cmp_cmd_external 2271 00008437 72EC <1> jb short c_7 2272 <1> 2273 <1> cmp_cmd_longname: 2274 00008439 BF[172F0100] <1> mov edi, Cmd_LongName 2275 0000843E E824000000 <1> call cmp_cmd 2276 <1> ;jnc get_and_print_longname 2277 <1> ; 26/07/2022 2278 00008443 7205 <1> jc short cmp_cmd_external 2279 00008445 E95A060000 <1> jmp get_and_print_longname 2280 <1> 2281 <1> cmp_cmd_external: 2282 <1> ; 07/05/2016 2283 <1> ; 22/04/2016 2284 0000844A BE[26780100] <1> mov esi, CommandBuffer 2285 0000844F E9A61B0000 <1> jmp loc_run_check_filename 2286 <1> 2287 <1> loc_cmd_failed: 2288 00008454 803D[26780100]20 <1> cmp byte [CommandBuffer], 20h 2289 0000845B 76D4 <1> jna short loc_cmd_return 2290 0000845D BE[37310100] <1> mov esi, Msg_Bad_Command 2291 <1> ; call print_msg 2292 <1> ;loc_cmd_return: 2293 <1> ; retn 2294 00008462 E953E9FFFF <1> jmp print_msg 2295 <1> 2296 <1> cmp_cmd: 2297 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 2298 <1> ; 29/01/2016 (TRDOS 386 = TRDOS v2.0) 2299 00008467 BE[26780100] <1> mov esi, CommandBuffer 2300 <1> ; edi = internal command word (ASCIIZ) 2301 <1> ; ecx = command length (<=8) 2302 <1> cmp_cmd_1: 2303 0000846C AC <1> lodsb 2304 0000846D AE <1> scasb 2305 0000846E 750D <1> jne short cmp_cmd_3 2306 00008470 E2FA <1> loop cmp_cmd_1 2307 00008472 AC <1> lodsb 2308 00008473 3C20 <1> cmp al, 20h 2309 00008475 7703 <1> ja short cmp_cmd_2 2310 00008477 30C0 <1> xor al, al 2311 <1> ; ZF = 1 -> internal command word matches 2312 00008479 C3 <1> retn 2313 <1> cmp_cmd_2: 2314 <1> ; ZF = 0 (CF = 0) -> external command word 2315 0000847A 58 <1> pop eax ; no return to the caller from here 2316 0000847B EBCD <1> jmp short cmp_cmd_external ; 26/07/2022 2317 <1> cmp_cmd_3: 2318 0000847D F9 <1> stc 2319 <1> ; CF = 1 -> internal command word does not match 2320 0000847E C3 <1> retn 2321 <1> 2322 <1> loc_run_cmd_failed: 2323 <1> ; 26/07/2022 (TRDOS 386 Kernel v2.0.5) 2324 <1> ; 15/03/2016 2325 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 2326 <1> ; 07/12/2009 (CMD_INTR.ASM) 2327 <1> ; 29/11/2009 2328 <1> 2329 0000847F E863000000 <1> call restore_cdir_after_cmd_fail 2330 <1> 2331 <1> loc_run_cmd_failed_cmp_al: 2332 <1> ; End of Restore_CDIR code (29/11/2009) 2333 <1> 2334 00008484 3C01 <1> cmp al, 1 ; Bad command or file name 2335 00008486 74CC <1> je short loc_cmd_failed ; 26/07/2022 2336 <1> loc_run_dir_not_found: 2337 00008488 3C03 <1> cmp al, 3 2338 0000848A 750A <1> jne short loc_run_file_notfound_msg 2339 <1> ; Path not found (MS-DOS Error Code = 3) 2340 0000848C BE[99310100] <1> mov esi, Msg_Dir_Not_Found 2341 00008491 E924E9FFFF <1> jmp print_msg 2342 <1> 2343 <1> loc_run_file_notfound_msg: 2344 00008496 3C02 <1> cmp al, 2 ; File not found 2345 00008498 750A <1> jne short loc_run_file_drv_read_err 2346 <1> 2347 <1> loc_print_file_notfound_msg: 2348 0000849A BE[B0310100] <1> mov esi, Msg_File_Not_Found 2349 <1> ;call proc_printmsg 2350 <1> ;retn 2351 0000849F E916E9FFFF <1> jmp print_msg 2352 <1> 2353 <1> loc_run_file_drv_read_err: 2354 <1> ; Err: 17 (Read fault) 2355 000084A4 3C11 <1> cmp al, 17 ; Drive not ready or read error 2356 000084A6 7404 <1> je short loc_run_file_print_drv_read_err 2357 <1> ; 2358 000084A8 3C0F <1> cmp al, 15 ; Drive not ready (or read error) 2359 000084AA 750A <1> jne short loc_run_file_toobig 2360 <1> 2361 <1> loc_run_file_print_drv_read_err: 2362 000084AC BE[56310100] <1> mov esi, Msg_Not_Ready_Read_Err 2363 000084B1 E904E9FFFF <1> jmp print_msg 2364 <1> 2365 <1> loc_run_file_toobig: 2366 000084B6 3C08 <1> cmp al, 8 ; Not enough free memory to load&run file 2367 000084B8 750A <1> jne short loc_run_file_perm_denied 2368 000084BA BE[FB310100] <1> mov esi, Msg_Insufficient_Memory 2369 000084BF E9F6E8FFFF <1> jmp print_msg 2370 <1> 2371 <1> loc_run_file_perm_denied: 2372 <1> ; 29/12/2017 2373 000084C4 3C0B <1> cmp al, ERR_PERM_DENIED ; 11 ; Permission denied 2374 000084C6 750A <1> jne short loc_run_misc_error 2375 000084C8 BE[8F330100] <1> mov esi, Msg_Permission_Denied 2376 000084CD E9E8E8FFFF <1> jmp print_msg 2377 <1> 2378 <1> ; 15/03/2016 2379 <1> print_misc_error_msg: 2380 <1> loc_run_misc_error: 2381 <1> ; AL = Error code 2382 000084D2 E8E8BCFFFF <1> call bytetohex 2383 000084D7 66A3[2F320100] <1> mov [error_code_hex], ax 2384 <1> 2385 000084DD BE[12320100] <1> mov esi, Msg_Error_Code 2386 <1> ;call print_msg 2387 <1> ;retn 2388 000084E2 E9D3E8FFFF <1> jmp print_msg 2389 <1> 2390 <1> restore_cdir_after_cmd_fail: 2391 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 2392 000084E7 50 <1> push eax 2393 000084E8 8A3D[D37E0100] <1> mov bh, [RUN_CDRV] ; it is set at the beginning 2394 <1> ; of the 'run' command. 2395 000084EE 3A3D[76770100] <1> cmp bh, [Current_Drv] 2396 000084F4 7409 <1> je short loc_run_restore_cdir 2397 000084F6 88FA <1> mov dl, bh 2398 000084F8 E8F3F1FFFF <1> call change_current_drive 2399 000084FD EB19 <1> jmp short loc_run_err_pass_restore_cdir 2400 <1> 2401 <1> loc_run_restore_cdir: 2402 000084FF 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 2403 00008506 7610 <1> jna short loc_run_err_pass_restore_cdir 2404 00008508 30DB <1> xor bl, bl 2405 0000850A 0FB7F3 <1> movzx esi, bx 2406 0000850D 81C600010900 <1> add esi, Logical_DOSDisks 2407 00008513 E889F2FFFF <1> call restore_current_directory 2408 <1> 2409 <1> loc_run_err_pass_restore_cdir: 2410 00008518 58 <1> pop eax 2411 00008519 C3 <1> retn 2412 <1> 2413 <1> print_directory_list: 2414 <1> ; 02/12/2023 (TRDOS 386 v2.0.7) 2415 <1> ; 07/08/2022 2416 <1> ; 27/07/2022 (TRDOS 386 Kernel v2.0.5) 2417 <1> ; 10/02/2016 2418 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 2419 <1> ; 06/12/2009 ('cmp_cmd_dir') 2420 <1> ; 2421 0000851A 66C705[14800100]00- <1> mov word [AttributesMask], 0800h ; ..except volume names.. 2421 00008522 08 <1> 2422 00008523 A0[76770100] <1> mov al, [Current_Drv] 2423 00008528 A2[D37E0100] <1> mov [RUN_CDRV], al 2424 <1> ; 02/12/2023 2425 0000852D 3C02 <1> cmp al, 2 2426 0000852F 733A <1> jnb short get_dfname_fchar 2427 00008531 A0[31770100] <1> mov al, [TIMER_LOW+1] 2428 00008536 D0E8 <1> shr al, 1 ; 512/18.2 (>= 28 seconds) 2429 00008538 8605[9A7E0100] <1> xchg al, [P_TIMER] ; 28 seconds 2430 0000853E 3A05[9A7E0100] <1> cmp al, [P_TIMER] 2431 00008544 7425 <1> je short get_dfname_fchar 2432 00008546 E893F1FFFF <1> call get_media_change_status 2433 0000854B 7205 <1> jc short pdl_chdrv 2434 0000854D 80FC06 <1> cmp ah, 6 2435 00008550 7519 <1> jne short get_dfname_fchar 2436 <1> pdl_chdrv: 2437 00008552 56 <1> push esi 2438 00008553 8A15[D37E0100] <1> mov dl, [RUN_CDRV] 2439 00008559 E892F1FFFF <1> call change_current_drive 2440 0000855E 5E <1> pop esi 2441 0000855F 730A <1> jnc short get_dfname_fchar 2442 00008561 BE[56310100] <1> mov esi, Msg_Not_Ready_Read_Err 2443 <1> ;call print_msg 2444 <1> ;retn 2445 00008566 E94FE8FFFF <1> jmp print_msg 2446 <1> 2447 <1> get_dfname_fchar: 2448 0000856B AC <1> lodsb 2449 0000856C 3C20 <1> cmp al, 20h 2450 0000856E 74FB <1> je short get_dfname_fchar 2451 <1> ;jb loc_print_dir_call_all 2452 <1> ; 02/12/2023 2453 00008570 7705 <1> ja short get_dfname_fchar_2 2454 00008572 E9E0000000 <1> jmp loc_print_dir_call_all 2455 <1> get_dfname_fchar_2: 2456 00008577 3C2D <1> cmp al, '-' 2457 00008579 753C <1> jne short loc_print_dir_call_flt 2458 <1> get_next_attr_char: 2459 0000857B AC <1> lodsb 2460 0000857C 3C20 <1> cmp al, 20h 2461 0000857E 74FB <1> je short get_next_attr_char 2462 <1> ;jb loc_cmd_failed 2463 <1> ; 27/07/2022 2464 00008580 7305 <1> jnb short pdl_1 2465 <1> pdl_0: 2466 00008582 E9CDFEFFFF <1> jmp loc_cmd_failed 2467 <1> pdl_1: 2468 00008587 24DF <1> and al, 0DFh 2469 00008589 3C44 <1> cmp al, 'D' ; directories only ? 2470 0000858B 750E <1> jne short pass_only_directories 2471 0000858D AC <1> lodsb 2472 0000858E 3C20 <1> cmp al, 20h 2473 <1> ;ja loc_cmd_failed 2474 <1> ; 27/07/2022 2475 00008590 77F0 <1> ja short pdl_0 2476 00008592 800D[14800100]10 <1> or byte [AttributesMask], 10h ; ..directory.. 2477 00008599 EB10 <1> jmp short get_dfname_fchar_attr 2478 <1> pass_only_directories: 2479 0000859B 3C46 <1> cmp al, 'F' ; files only ? 2480 0000859D 7530 <1> jne short check_attr_s ; 27/07/2022 2481 0000859F AC <1> lodsb 2482 000085A0 3C20 <1> cmp al, 20h 2483 <1> ;ja loc_cmd_failed 2484 <1> ; 27/07/2022 2485 000085A2 77DE <1> ja short pdl_0 2486 000085A4 800D[15800100]10 <1> or byte [AttributesMask+1], 10h ; ..except directories.. 2487 <1> get_dfname_fchar_attr: 2488 000085AB AC <1> lodsb 2489 000085AC 3C20 <1> cmp al, 20h 2490 000085AE 74FB <1> je short get_dfname_fchar_attr 2491 <1> ;jb short loc_print_dir_call_all 2492 <1> ; 07/08/2022 2493 000085B0 7305 <1> jnb short loc_print_dir_call_flt 2494 000085B2 E9A0000000 <1> jmp loc_print_dir_call_all 2495 <1> loc_print_dir_call_flt: 2496 000085B7 4E <1> dec esi 2497 000085B8 BF[16800100] <1> mov edi, FindFile_Drv 2498 000085BD E8BC230000 <1> call parse_path_name 2499 000085C2 7352 <1> jnc short loc_print_dir_change_drv_1 2500 000085C4 3C01 <1> cmp al, 1 2501 <1> ;ja loc_run_cmd_failed 2502 <1> ; 27/07/2022 2503 000085C6 764E <1> jna short loc_print_dir_change_drv_1 2504 <1> pdl_2: 2505 000085C8 E9B2FEFFFF <1> jmp loc_run_cmd_failed 2506 <1> 2507 <1> ; 27/07/2022 2508 <1> check_attr_s_cap: 2509 000085CD 24DF <1> and al, 0DFh 2510 <1> check_attr_s: 2511 000085CF 3C53 <1> cmp al, 'S' 2512 000085D1 7510 <1> jne short pass_attr_s 2513 000085D3 800D[14800100]04 <1> or byte [AttributesMask], 4 ; system 2514 000085DA AC <1> lodsb 2515 000085DB 3C20 <1> cmp al, 20h 2516 000085DD 74CC <1> je short get_dfname_fchar_attr 2517 000085DF 7276 <1> jb short loc_print_dir_call_all 2518 000085E1 24DF <1> and al, 0DFh 2519 <1> pass_attr_s: 2520 000085E3 3C48 <1> cmp al, 'H' 2521 000085E5 7510 <1> jne short pass_attr_h 2522 000085E7 800D[14800100]02 <1> or byte [AttributesMask], 2 ; hidden 2523 <1> pass_attr_shr: 2524 000085EE AC <1> lodsb 2525 000085EF 3C20 <1> cmp al, 20h 2526 000085F1 74B8 <1> je short get_dfname_fchar_attr 2527 000085F3 7262 <1> jb short loc_print_dir_call_all 2528 000085F5 EBD6 <1> jmp short check_attr_s_cap 2529 <1> pass_attr_h: 2530 000085F7 3C52 <1> cmp al, 'R' 2531 000085F9 7509 <1> jne short pass_attr_r 2532 000085FB 800D[14800100]01 <1> or byte [AttributesMask], 1 ; read only 2533 00008602 EBEA <1> jmp short pass_attr_shr 2534 <1> pass_attr_r: 2535 00008604 3C41 <1> cmp al, 'A' 2536 <1> ;jne loc_cmd_failed 2537 <1> ; 27/07/2022 2538 00008606 7405 <1> je short pass_attr_a 2539 00008608 E947FEFFFF <1> jmp loc_cmd_failed 2540 <1> pass_attr_a: 2541 0000860D 800D[14800100]20 <1> or byte [AttributesMask], 20h ; archive 2542 00008614 EBD8 <1> jmp short pass_attr_shr 2543 <1> 2544 <1> ; 07/08/2022 2545 <1> loc_print_dir_change_drv_1: 2546 00008616 8A15[16800100] <1> mov dl, [FindFile_Drv] 2547 <1> loc_print_dir_change_drv_2: 2548 0000861C 3A15[D37E0100] <1> cmp dl, [RUN_CDRV] 2549 00008622 7407 <1> je short loc_print_dir_change_directory 2550 00008624 E8C7F0FFFF <1> call change_current_drive 2551 <1> ;jc loc_run_cmd_failed 2552 <1> ; 27/07/2022 2553 00008629 729D <1> jc short pdl_2 2554 <1> loc_print_dir_change_directory: 2555 0000862B 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h ; 0 or 20h ? 2556 00008632 7619 <1> jna short pass_print_dir_change_directory 2557 <1> 2558 00008634 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 2559 0000863A BE[17800100] <1> mov esi, FindFile_Directory 2560 0000863F 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 2561 00008641 E8A51D0000 <1> call change_current_directory 2562 <1> ;jc loc_run_cmd_failed 2563 <1> ; 27/07/2022 2564 00008646 7280 <1> jc short pdl_2 2565 <1> 2566 <1> loc_print_dir_change_prompt_dir_string: 2567 00008648 E8C71C0000 <1> call change_prompt_dir_string 2568 <1> 2569 <1> pass_print_dir_change_directory: 2570 0000864D BE[58800100] <1> mov esi, FindFile_Name 2571 00008652 803E20 <1> cmp byte [esi], 20h ; ; 0 or 20h ? 2572 00008655 7706 <1> ja short loc_print_dir_call 2573 <1> 2574 <1> loc_print_dir_call_all: 2575 00008657 C7062A2E2A00 <1> mov dword [esi], '*.*' 2576 <1> loc_print_dir_call: 2577 0000865D E82D000000 <1> call print_directory 2578 <1> 2579 00008662 8A15[D37E0100] <1> mov dl, [RUN_CDRV] ; it is set at the beginning 2580 00008668 3A15[76770100] <1> cmp dl, [Current_Drv] 2581 0000866E 7405 <1> je short loc_print_dir_call_restore_cdir_retn 2582 <1> ;call change_current_drive 2583 <1> ;retn 2584 <1> ; 27/07/2022 2585 00008670 E97BF0FFFF <1> jmp change_current_drive 2586 <1> 2587 <1> loc_print_dir_call_restore_cdir_retn: 2588 00008675 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 2589 0000867C 7610 <1> jna short pass_print_dir_call_restore_cdir_retn 2590 <1> 2591 0000867E BE00010900 <1> mov esi, Logical_DOSDisks 2592 00008683 31C0 <1> xor eax, eax 2593 00008685 88D4 <1> mov ah, dl 2594 00008687 01C6 <1> add esi, eax 2595 <1> 2596 <1> ;call restore_current_directory 2597 <1> ; 27/07/2022 2598 00008689 E913F1FFFF <1> jmp restore_current_directory 2599 <1> 2600 <1> pass_print_dir_call_restore_cdir_retn: 2601 0000868E C3 <1> retn 2602 <1> 2603 <1> print_directory: 2604 <1> ; 27/07/2022 (TRDOS 386 Kernel v2.0.5) 2605 <1> ; 13/05/2016 2606 <1> ; 11/02/2016 2607 <1> ; 10/02/2016 2608 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 2609 <1> ; 30/10/2010 ('proc_print_directory') 2610 <1> ; 19/09/2009 2611 <1> ; 2005 2612 <1> ; INPUT -> 2613 <1> ; ESI = Asciiz File/Dir Name Address 2614 <1> 2615 0000868F 56 <1> push esi 2616 <1> 2617 00008690 29C0 <1> sub eax, eax 2618 <1> 2619 00008692 66A3[A0800100] <1> mov [Dir_Count], ax ; 0 2620 00008698 66A3[9E800100] <1> mov [File_Count], ax ; 0 2621 0000869E A3[A2800100] <1> mov [Total_FSize], eax ; 0 2622 <1> 2623 000086A3 E828E7FFFF <1> call clear_screen 2624 <1> 2625 000086A8 31C9 <1> xor ecx, ecx 2626 000086AA 8A2D[76770100] <1> mov ch, [Current_Drv] ; DirBuff_Drv - 'A' 2627 000086B0 A0[77770100] <1> mov al, [Current_Dir_Drv] 2628 000086B5 A2[54300100] <1> mov [Dir_Drive_Name], al 2629 000086BA BE00010900 <1> mov esi, Logical_DOSDisks 2630 000086BF 01CE <1> add esi, ecx 2631 <1> 2632 000086C1 E856F9FFFF <1> call move_volume_name_and_serial_no 2633 000086C6 730C <1> jnc short print_dir_strlen_check 2634 <1> 2635 000086C8 5E <1> pop esi 2636 000086C9 8A3D[DE760100] <1> mov bh, [ptty] ; [ACTIVE_PAGE] 2637 <1> ;call beeper 2638 <1> ;retn 2639 000086CF E9F59CFFFF <1> jmp beeper ; beep ! and return 2640 <1> 2641 <1> print_dir_strlen_check: 2642 000086D4 BE[79770100] <1> mov esi, Current_Dir_Root 2643 000086D9 BF[F1300100] <1> mov edi, Dir_Str_Root 2644 <1> 2645 <1> ;xor ecx, ecx 2646 000086DE 8A0D[D5770100] <1> mov cl, [Current_Dir_StrLen] 2647 000086E4 FEC1 <1> inc cl 2648 000086E6 80F940 <1> cmp cl, 64 2649 000086E9 760D <1> jna short pass_print_dir_strlen_shorting 2650 000086EB 46 <1> inc esi 2651 000086EC 01CE <1> add esi, ecx 2652 000086EE 83EE40 <1> sub esi, 64 2653 000086F1 47 <1> inc edi 2654 000086F2 B82E2E2E20 <1> mov eax, '... ' 2655 000086F7 AB <1> stosd 2656 <1> 2657 <1> pass_print_dir_strlen_shorting: 2658 000086F8 F3A4 <1> rep movsb 2659 <1> 2660 000086FA BE[47300100] <1> mov esi, Dir_Drive_Str 2661 000086FF E8B6E6FFFF <1> call print_msg 2662 <1> 2663 00008704 BE[A6300100] <1> mov esi, Vol_Serial_Header 2664 00008709 E8ACE6FFFF <1> call print_msg 2665 <1> 2666 0000870E BE[E6300100] <1> mov esi, Dir_Str_Header 2667 00008713 E8A2E6FFFF <1> call print_msg 2668 <1> 2669 00008718 BE[15390100] <1> mov esi, next2line 2670 0000871D E898E6FFFF <1> call print_msg 2671 <1> 2672 <1> loc_print_dir_first_file: 2673 00008722 C605[B5800100]10 <1> mov byte [PrintDir_RowCounter], 16 2674 00008729 66A1[14800100] <1> mov ax, [AttributesMask] 2675 0000872F 5E <1> pop esi 2676 <1> 2677 00008730 E845020000 <1> call find_first_file 2678 <1> ;jc loc_dir_ok 2679 <1> ; 27/07/2022 2680 00008735 7305 <1> jnc short loc_dfname_use_this 2681 00008737 E97B010000 <1> jmp loc_dir_ok 2682 <1> 2683 <1> loc_dfname_use_this: 2684 <1> ; bl = File Attributes (bh = Long Name Entry Length) 2685 0000873C F6C310 <1> test bl, 10h ; Is it a directory? 2686 0000873F 741B <1> jz short loc_not_dir 2687 <1> 2688 00008741 66FF05[A0800100] <1> inc word [Dir_Count] 2689 00008748 89F2 <1> mov edx, esi ; FindFile_DirEntry address 2690 0000874A BE[35320100] <1> mov esi, Type_Dir ; ' ' 2691 0000874F BF[4C320100] <1> mov edi, Dir_Or_FileSize 2692 <1> ; move 10 bytes 2693 00008754 A5 <1> movsd 2694 00008755 A5 <1> movsd 2695 00008756 66A5 <1> movsw 2696 00008758 89D6 <1> mov esi, edx 2697 0000875A EB36 <1> jmp short loc_dir_attribute 2698 <1> 2699 <1> loc_not_dir: 2700 0000875C 66FF05[9E800100] <1> inc word [File_Count] 2701 00008763 0105[A2800100] <1> add [Total_FSize], eax 2702 <1> 2703 00008769 B90A000000 <1> mov ecx, 10 ; 32 bit divisor 2704 0000876E 89CF <1> mov edi, ecx 2705 00008770 81C7[4C320100] <1> add edi, Dir_Or_FileSize 2706 <1> loc_dir_rdivide: 2707 00008776 29D2 <1> sub edx, edx 2708 00008778 F7F1 <1> div ecx ; remainder in dl (< 10) 2709 0000877A 80C230 <1> add dl, '0' ; to make visible (ascii) 2710 0000877D 4F <1> dec edi 2711 0000877E 8817 <1> mov [edi], dl 2712 00008780 21C0 <1> and eax, eax 2713 00008782 75F2 <1> jnz short loc_dir_rdivide 2714 <1> 2715 <1> loc_dir_fill_space: 2716 00008784 81FF[4C320100] <1> cmp edi, Dir_Or_FileSize 2717 0000878A 7606 <1> jna short loc_dir_attribute 2718 0000878C 4F <1> dec edi 2719 0000878D C60720 <1> mov byte [edi], 20h 2720 00008790 EBF2 <1> jmp short loc_dir_fill_space 2721 <1> 2722 <1> loc_dir_attribute: 2723 00008792 C705[57320100]2020- <1> mov dword [File_Attribute], 20202020h 2723 0000879A 2020 <1> 2724 <1> 2725 0000879C 80FB20 <1> cmp bl, 20h ; Is it an archive file? 2726 0000879F 7207 <1> jb short loc_dir_pass_arch 2727 000087A1 C605[5A320100]41 <1> mov byte [File_Attribute+3], 'A' 2728 <1> 2729 <1> loc_dir_pass_arch: 2730 000087A8 80E307 <1> and bl, 7 2731 000087AB 7428 <1> jz short loc_dir_file_name 2732 000087AD 88DF <1> mov bh, bl 2733 000087AF 80E303 <1> and bl, 3 2734 000087B2 38DF <1> cmp bh, bl 2735 000087B4 7607 <1> jna short loc_dir_pass_s 2736 000087B6 C605[57320100]53 <1> mov byte [File_Attribute], 'S' 2737 <1> 2738 <1> loc_dir_pass_s: 2739 000087BD 80E302 <1> and bl,2 2740 000087C0 7407 <1> jz short loc_dir_pass_h 2741 000087C2 C605[58320100]48 <1> mov byte [File_Attribute+1], 'H' 2742 <1> loc_dir_pass_h: 2743 000087C9 80E701 <1> and bh,1 2744 000087CC 7407 <1> jz short loc_dir_file_name 2745 000087CE C605[59320100]52 <1> mov byte [File_Attribute+2], 'R' 2746 <1> loc_dir_file_name: 2747 <1> ;mov bx, [esi+18h] ; Date 2748 <1> ;mov dx, [esi+16h] ; Time 2749 000087D5 8B5E16 <1> mov ebx, [esi+16h] 2750 000087D8 89F1 <1> mov ecx, esi ; FindFile_DirEntry address 2751 000087DA BF[3F320100] <1> mov edi, File_Name 2752 <1> ; move 8 bytes 2753 000087DF A5 <1> movsd 2754 000087E0 A5 <1> movsd 2755 000087E1 C60720 <1> mov byte [edi], 20h 2756 000087E4 47 <1> inc edi 2757 <1> ; move 3 bytes 2758 000087E5 66A5 <1> movsw 2759 000087E7 A4 <1> movsb 2760 000087E8 89CE <1> mov esi, ecx 2761 <1> 2762 <1> Dir_Time_start: 2763 <1> ;mov ax, dx ; Time 2764 000087EA 6689D8 <1> mov ax, bx 2765 000087ED 66C1E805 <1> shr ax, 5 ; shift right 5 times 2766 000087F1 6683E03F <1> and ax, 0000111111b ; Minute Mask 2767 000087F5 D40A <1> aam ; Q([AL]/10)->AH 2768 <1> ; R([AL]/10)->AL 2769 <1> ; [AL]+[AH]= Minute as BCD 2770 000087F7 660D3030 <1> or ax, '00' ; Convert to ASCII 2771 000087FB 86E0 <1> xchg ah, al 2772 000087FD 66A3[6A320100] <1> mov [File_Minute], ax 2773 <1> 2774 <1> ;mov al, dh 2775 00008803 88F8 <1> mov al, bh 2776 00008805 C0E803 <1> shr al, 3 ; shift right 3 times 2777 00008808 D40A <1> aam ; [AL]+[AH]= Hours as BCD 2778 0000880A 660D3030 <1> or ax, '00' 2779 0000880E 86E0 <1> xchg ah, al 2780 00008810 66A3[67320100] <1> mov [File_Hour], ax 2781 <1> 2782 00008816 C1EB10 <1> shr ebx, 16 ; BX = Date 2783 <1> 2784 <1> Dir_Date_start: 2785 <1> ;mov ax, bx ; Date 2786 <1> ; 27/07/2022 2787 00008819 89D8 <1> mov eax, ebx 2788 0000881B 6683E01F <1> and ax, 00011111b ; Day Mask 2789 0000881F D40A <1> aam ; Q([AL]/10)->AH 2790 <1> ; R([AL]/10)->AL 2791 <1> ; [AL]+[AH]= Day as BCD 2792 00008821 660D3030 <1> or ax, '00' ; Convert to ASCII 2793 00008825 86C4 <1> xchg al, ah 2794 <1> 2795 00008827 66A3[5C320100] <1> mov [File_Day], ax 2796 <1> 2797 <1> ;mov ax, bx 2798 <1> ; 27/07/2022 2799 0000882D 89D8 <1> mov eax, ebx 2800 <1> ;shr ax, 5 ; shift right 5 times 2801 0000882F C1E805 <1> shr eax, 5 2802 00008832 6683E00F <1> and ax, 00001111b ; Month Mask 2803 00008836 D40A <1> aam 2804 00008838 660D3030 <1> or ax, '00' 2805 0000883C 86E0 <1> xchg ah, al 2806 0000883E 66A3[5F320100] <1> mov [File_Month], ax 2807 <1> 2808 <1> ;mov ax, bx 2809 <1> ; 27/07/2022 2810 00008844 89D8 <1> mov eax, ebx 2811 <1> ;shr ax, 9 2812 00008846 C1E809 <1> shr eax, 9 2813 00008849 6683E07F <1> and ax, 01111111b ; Result = Year - 1980 2814 0000884D 6605BC07 <1> add ax, 1980 2815 <1> 2816 00008851 B10A <1> mov cl, 10 2817 00008853 F6F1 <1> div cl ; Q -> AL, R -> AH 2818 00008855 80CC30 <1> or ah, '0' 2819 00008858 8825[65320100] <1> mov [File_Year+3], ah 2820 0000885E D40A <1> aam 2821 00008860 86E0 <1> xchg ah, al 2822 00008862 80CC30 <1> or ah, '0' ; Convert to ASCII 2823 00008865 8825[64320100] <1> mov [File_Year+2], ah 2824 0000886B D40A <1> aam 2825 0000886D 86C4 <1> xchg al, ah 2826 0000886F 660D3030 <1> or ax, '00' 2827 00008873 66A3[62320100] <1> mov [File_Year], ax 2828 <1> 2829 <1> loc_show_line: 2830 00008879 56 <1> push esi 2831 0000887A BE[3F320100] <1> mov esi, File_Name 2832 0000887F E836E5FFFF <1> call print_msg 2833 00008884 BE[17390100] <1> mov esi, nextline 2834 00008889 E82CE5FFFF <1> call print_msg 2835 0000888E 5E <1> pop esi 2836 <1> 2837 0000888F FE0D[B5800100] <1> dec byte [PrintDir_RowCounter] 2838 00008895 740C <1> jz short pause_dir_scroll ; 27/07/2022 2839 <1> 2840 <1> loc_next_entry: 2841 00008897 E88B010000 <1> call find_next_file 2842 <1> ;jnc loc_dfname_use_this 2843 <1> ; 27/07/2022 2844 0000889C 7219 <1> jc short loc_dir_ok 2845 0000889E E999FEFFFF <1> jmp loc_dfname_use_this 2846 <1> 2847 <1> ; 27/07/2022 2848 <1> pause_dir_scroll: 2849 000088A3 28E4 <1> sub ah, ah 2850 000088A5 E86886FFFF <1> call int16h 2851 000088AA 3C1B <1> cmp al, 1Bh 2852 000088AC 7409 <1> je short loc_dir_ok 2853 000088AE C605[B5800100]10 <1> mov byte [PrintDir_RowCounter], 16 ; Reset counter 2854 000088B5 EBE0 <1> jmp short loc_next_entry 2855 <1> 2856 <1> loc_dir_ok: 2857 000088B7 B90A000000 <1> mov ecx, 10 2858 <1> ;mov ax, [Dir_Count] 2859 <1> ; 27/07/2022 2860 000088BC 0FB705[A0800100] <1> movzx eax, word [Dir_Count] 2861 000088C3 BF[80320100] <1> mov edi, Decimal_Dir_Count 2862 <1> ;cmp ax, cx ; 10 2863 <1> ; 27/07/2022 2864 000088C8 39C8 <1> cmp eax, ecx 2865 000088CA 7216 <1> jb short pass_ddc 2866 000088CC 47 <1> inc edi 2867 000088CD 6683F864 <1> cmp ax, 100 2868 000088D1 720F <1> jb short pass_ddc 2869 000088D3 47 <1> inc edi 2870 000088D4 663DE803 <1> cmp ax, 1000 2871 000088D8 7208 <1> jb short pass_ddc 2872 000088DA 47 <1> inc edi 2873 000088DB 663D1027 <1> cmp ax, 10000 2874 000088DF 7201 <1> jb short pass_ddc 2875 000088E1 47 <1> inc edi 2876 <1> pass_ddc: 2877 000088E2 886F01 <1> mov [edi+1], ch ; 0 2878 <1> loc_ddc_rediv: 2879 000088E5 31D2 <1> xor edx, edx 2880 <1> ;div cx ; 10 2881 <1> ; 27/07/2022 2882 000088E7 F7F1 <1> div ecx 2883 000088E9 80C230 <1> add dl, '0' 2884 000088EC 8817 <1> mov [edi], dl 2885 000088EE 4F <1> dec edi 2886 <1> ;or ax, ax 2887 <1> ; 27/07/2022 2888 000088EF 09C0 <1> or eax, eax 2889 000088F1 75F2 <1> jnz short loc_ddc_rediv 2890 <1> 2891 000088F3 66A1[9E800100] <1> mov ax, [File_Count] 2892 000088F9 BF[6F320100] <1> mov edi, Decimal_File_Count 2893 <1> ;cmp ax, cx ; 10 2894 <1> ; 27/07/2022 2895 000088FE 39C8 <1> cmp eax, ecx ; 10 2896 00008900 7216 <1> jb short pass_dfc 2897 00008902 47 <1> inc edi 2898 00008903 6683F864 <1> cmp ax, 100 2899 00008907 720F <1> jb short pass_dfc 2900 00008909 47 <1> inc edi 2901 0000890A 663DE803 <1> cmp ax, 1000 2902 0000890E 7208 <1> jb short pass_dfc 2903 00008910 47 <1> inc edi 2904 00008911 663D1027 <1> cmp ax, 10000 2905 00008915 7201 <1> jb short pass_dfc 2906 00008917 47 <1> inc edi 2907 <1> pass_dfc: 2908 <1> ;mov cx, 10 2909 00008918 886F01 <1> mov [edi+1], ch ; 00 2910 <1> loc_dfc_rediv: 2911 <1> ;;xor dx, dx 2912 <1> ;xor dl, dl 2913 <1> ;div cx 2914 <1> ; 27/07/022 2915 0000891B 31D2 <1> xor edx, edx 2916 0000891D F7F1 <1> div ecx 2917 0000891F 80C230 <1> add dl, '0' 2918 00008922 8817 <1> mov [edi], dl 2919 00008924 4F <1> dec edi 2920 <1> ;or ax, ax 2921 <1> ; 27/07/2022 2922 00008925 09C0 <1> or eax, eax 2923 00008927 75F2 <1> jnz short loc_dfc_rediv 2924 <1> 2925 00008929 BF[B4800100] <1> mov edi, TFS_Dec_End 2926 <1> ;mov byte [edi], 0 2927 0000892E A1[A2800100] <1> mov eax, [Total_FSize] 2928 <1> ;mov ecx, 10 2929 <1> rediv_tfs_hex: 2930 00008933 29D2 <1> sub edx, edx ; 27/07/2022 2931 <1> ;sub dl, dl 2932 00008935 F7F1 <1> div ecx 2933 00008937 80C230 <1> add dl, '0' 2934 0000893A 4F <1> dec edi 2935 0000893B 8817 <1> mov [edi], dl 2936 0000893D 21C0 <1> and eax, eax 2937 0000893F 75F2 <1> jnz short rediv_tfs_hex 2938 <1> 2939 00008941 893D[A6800100] <1> mov [TFS_Dec_Begin], edi 2940 00008947 BE[6D320100] <1> mov esi, Decimal_File_Count_Header 2941 0000894C E869E4FFFF <1> call print_msg 2942 00008951 BE[75320100] <1> mov esi, str_files 2943 00008956 E85FE4FFFF <1> call print_msg 2944 0000895B BE[86320100] <1> mov esi, str_dirs 2945 00008960 E855E4FFFF <1> call print_msg 2946 00008965 8B35[A6800100] <1> mov esi, [TFS_Dec_Begin] 2947 0000896B E84AE4FFFF <1> call print_msg 2948 00008970 BE[97320100] <1> mov esi, str_bytes 2949 <1> ;call print_msg 2950 <1> ;retn 2951 <1> ; 27/07/2022 2952 00008975 E940E4FFFF <1> jmp print_msg 2953 <1> 2954 <1> find_first_file: 2955 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 2956 <1> ; 11/02/2016 2957 <1> ; 10/02/2016 2958 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 2959 <1> ; 09/10/2011 2960 <1> ; 17/09/2009 2961 <1> ; 2005 2962 <1> ; INPUT -> 2963 <1> ; ESI = ASCIIZ File/Dir Name Address (in Current Directory) 2964 <1> ; AL = Attributes AND mask (The AND result must be equal to AL) 2965 <1> ; bit 0 = Read Only 2966 <1> ; bir 1 = Hidden 2967 <1> ; bit 2 = System 2968 <1> ; bit 3 = Volume Label 2969 <1> ; bit 4 = Directory 2970 <1> ; bit 5 = Archive 2971 <1> ; bit 6 = Reserved, must be 0 2972 <1> ; bit 7 = Reserved, must be 0 2973 <1> ; AH = Attributes Negative AND mask (The AND result must be ZERO) 2974 <1> ; 2975 <1> ; OUTPUT -> 2976 <1> ; CF = 1 -> Error, Error Code in EAX (AL) 2977 <1> ; CF = 0 -> 2978 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 2979 <1> ; EDI = Directory Buffer Directory Entry Location 2980 <1> ; EAX = File Size 2981 <1> ; BL = Attributes of The File/Directory 2982 <1> ; BH = Long Name Yes/No Status (>0 is YES) 2983 <1> ; DX > 0 : Ambiguous filename chars are used 2984 <1> ; 2985 <1> ; (EAX, EBX, ECX, EDX, ESI, EDI will be changed) 2986 <1> 2987 0000897A 66A3[66800100] <1> mov [FindFile_AttributesMask], ax 2988 00008980 BF[68800100] <1> mov edi, FindFile_DirEntry ; TR-DOS Fullfilename formatted buffer 2989 00008985 31C0 <1> xor eax, eax 2990 <1> ;mov ecx, 11 2991 <1> ; 28/07/2022 2992 00008987 31C9 <1> xor ecx, ecx 2993 00008989 B10B <1> mov cl, 11 2994 0000898B F3AB <1> rep stosd ; 44 bytes 2995 <1> ;stosw ; +2 bytes 2996 <1> 2997 0000898D BF[58800100] <1> mov edi, FindFile_Name ; FFF structure, offset 66 2998 00008992 39FE <1> cmp esi, edi 2999 00008994 7408 <1> je short loc_fff_mfn_ok 3000 00008996 89FA <1> mov edx, edi 3001 <1> ; move 13 bytes 3002 00008998 A5 <1> movsd 3003 00008999 A5 <1> movsd 3004 0000899A A5 <1> movsd 3005 0000899B AA <1> stosb 3006 0000899C 89D6 <1> mov esi, edx 3007 <1> loc_fff_mfn_ok: 3008 0000899E BF[07800100] <1> mov edi, Dir_Entry_Name ; Dir Entry Format File Name 3009 000089A3 E80C1F0000 <1> call convert_file_name 3010 000089A8 89FE <1> mov esi, edi ; offset Dir_Entry_Name 3011 <1> 3012 000089AA 66A1[66800100] <1> mov ax, [FindFile_AttributesMask] 3013 <1> ;xor ecx, ecx 3014 000089B0 30C9 <1> xor cl, cl 3015 000089B2 E8511C0000 <1> call locate_current_dir_file 3016 000089B7 726D <1> jc short loc_fff_retn 3017 <1> ; EDI = Directory Entry 3018 <1> ; EBX = Directory Buffer Entry Index/Number 3019 <1> 3020 <1> loc_fff_fnf_ln_check: 3021 000089B9 30ED <1> xor ch, ch 3022 000089BB 80F60F <1> xor dh, 0Fh 3023 000089BE 7408 <1> jz short loc_fff_longname_yes 3024 000089C0 882D[65800100] <1> mov [FindFile_LongNameYes], ch ; 0 3025 000089C6 EB0C <1> jmp short loc_fff_longname_no 3026 <1> 3027 <1> loc_fff_longname_yes: 3028 <1> ;inc byte [FindFile_LongNameYes] 3029 000089C8 8A0D[727F0100] <1> mov cl, [LFN_EntryLength] 3030 000089CE 880D[65800100] <1> mov [FindFile_LongNameEntryLength], cl ; FindFile_LongNameYes 3031 <1> 3032 <1> loc_fff_longname_no: 3033 <1> ;mov bx, [DirBuff_CurrentEntry] 3034 000089D4 66891D[90800100] <1> mov [FindFile_DirEntryNumber], bx 3035 <1> ;mov dx, ax ; Ambiguous Filename chars used sign > 0 3036 <1> ; 28/07/2022 3037 000089DB 89C2 <1> mov edx, eax 3038 <1> 3039 000089DD A0[76770100] <1> mov al, [Current_Drv] 3040 000089E2 A2[16800100] <1> mov [FindFile_Drv], al 3041 <1> 3042 000089E7 A1[70770100] <1> mov eax, [Current_Dir_FCluster] 3043 000089EC A3[88800100] <1> mov [FindFile_DirFirstCluster], eax 3044 <1> 3045 000089F1 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 3046 000089F6 A3[8C800100] <1> mov [FindFile_DirCluster], eax 3047 <1> 3048 000089FB 66FF05[92800100] <1> inc word [FindFile_MatchCounter] 3049 <1> 3050 00008A02 89FB <1> mov ebx, edi 3051 00008A04 89FE <1> mov esi, edi 3052 00008A06 BF[68800100] <1> mov edi, FindFile_DirEntry 3053 00008A0B 89F8 <1> mov eax, edi 3054 00008A0D B108 <1> mov cl, 8 3055 00008A0F F3A5 <1> rep movsd 3056 00008A11 89C6 <1> mov esi, eax 3057 00008A13 89DF <1> mov edi, ebx 3058 <1> 3059 00008A15 A1[84800100] <1> mov eax, [FindFile_DirEntry+28] ; File Size 3060 <1> 3061 00008A1A 8A1D[73800100] <1> mov bl, [FindFile_DirEntry+11] ; File Attributes 3062 00008A20 8A3D[65800100] <1> mov bh, [FindFile_LongNameYes] 3063 <1> 3064 <1> ;mov cx, [DirBuff_EntryCounter] 3065 <1> ;mov [FindFile_DirEntryNumber], cx 3066 <1> ;mov cx, [FindFile_DirEntryNumber] 3067 <1> ; ecx = 0 3068 <1> 3069 <1> loc_fff_retn: 3070 00008A26 C3 <1> retn 3071 <1> 3072 <1> find_next_file: 3073 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 3074 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3075 <1> ; 15/10/2016 3076 <1> ; 10/02/2016 3077 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 3078 <1> ; 06/02/2011 3079 <1> ; 17/09/2009 3080 <1> ; 2005 3081 <1> ; INPUT -> 3082 <1> ; NONE, Find First File Parameters 3083 <1> ; OUTPUT -> 3084 <1> ; CF = 1 -> Error, Error Code in EAX (AL) 3085 <1> ; CF = 0 -> 3086 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 3087 <1> ; EDI = Directory Buffer Directory Entry Location 3088 <1> ; EAX = File Size 3089 <1> ; BL = Attributes of The File/Directory 3090 <1> ; BH = Long Name Yes/No Status (>0 is YES) 3091 <1> ; DX > 0 : Ambiguous filename chars are used 3092 <1> ; 3093 <1> ; (EAX, EBX, ECX, EDX, ESI, EDI will be changed) 3094 <1> 3095 00008A27 66833D[92800100]00 <1> cmp word [FindFile_MatchCounter], 0 3096 00008A2F 7707 <1> ja short loc_start_search_next_file 3097 <1> 3098 <1> loc_fnf_stc_retn: 3099 00008A31 F9 <1> stc 3100 <1> loc_fnf_ax12h_retn: 3101 00008A32 B80C000000 <1> mov eax, 12 ; No More files 3102 <1> ;loc_fnf_retn: 3103 00008A37 C3 <1> retn 3104 <1> 3105 <1> loc_start_search_next_file: 3106 00008A38 668B1D[90800100] <1> mov bx, [FindFile_DirEntryNumber] 3107 <1> ;inc bx 3108 <1> ; 28/07/2022 3109 00008A3F 43 <1> inc ebx 3110 00008A40 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 3111 00008A47 7719 <1> ja short loc_cont_search_next_file 3112 <1> 3113 <1> loc_fnf_search: 3114 00008A49 BE[07800100] <1> mov esi, Dir_Entry_Name 3115 00008A4E 66A1[66800100] <1> mov ax, [FindFile_AttributesMask] 3116 <1> ;xor cx, cx 3117 <1> ; 28/07/2022 3118 00008A54 31C9 <1> xor ecx, ecx 3119 00008A56 E8881C0000 <1> call find_directory_entry 3120 <1> ;jnc loc_fff_fnf_ln_check 3121 <1> ; 28/07/2022 3122 00008A5B 7205 <1> jc short loc_cont_search_next_file 3123 00008A5D E957FFFFFF <1> jmp loc_fff_fnf_ln_check 3124 <1> 3125 <1> loc_cont_search_next_file: 3126 00008A62 31DB <1> xor ebx, ebx 3127 00008A64 8A3D[76770100] <1> mov bh, [Current_Drv] 3128 00008A6A BE00010900 <1> mov esi, Logical_DOSDisks 3129 00008A6F 01DE <1> add esi, ebx 3130 <1> 3131 00008A71 803D[74770100]00 <1> cmp byte [Current_Dir_Level], 0 3132 <1> ; 19/12/2025 3133 <1> %if 0 3134 <1> jna short loc_fnf_check_FAT_type 3135 <1> 3136 <1> cmp byte [esi+LD_FATType], 1 3137 <1> jb short loc_fnf_ax12h_retn 3138 <1> 3139 <1> jmp short loc_fnf_check_next_cluster 3140 <1> %else 3141 <1> ; 19/12/2025 3142 00008A78 7706 <1> ja short loc_fnf_check_next_cluster 3143 <1> %endif 3144 <1> 3145 <1> loc_fnf_check_FAT_type: 3146 00008A7A 807E0303 <1> cmp byte [esi+LD_FATType], 3 3147 00008A7E 72B2 <1> jb short loc_fnf_ax12h_retn 3148 <1> 3149 <1> loc_fnf_check_next_cluster: 3150 00008A80 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 3151 00008A85 E8FF340000 <1> call get_next_cluster 3152 00008A8A 7306 <1> jnc short loc_fnf_load_next_dir_cluster 3153 00008A8C 09C0 <1> or eax, eax 3154 00008A8E 74A1 <1> jz short loc_fnf_stc_retn 3155 <1> ;mov eax, 17 ;Drive not ready or read error 3156 00008A90 F5 <1> cmc ;stc 3157 <1> loc_fnf_retn: 3158 00008A91 C3 <1> retn 3159 <1> 3160 <1> loc_fnf_load_next_dir_cluster: 3161 00008A92 E8AE360000 <1> call load_FAT_sub_directory 3162 00008A97 72F8 <1> jc short loc_fnf_retn 3163 <1> ;xor bx, bx 3164 <1> ; 28/07/2022 3165 00008A99 31DB <1> xor ebx, ebx 3166 00008A9B 66891D[90800100] <1> mov [FindFile_DirEntryNumber], bx 3167 00008AA2 EBA5 <1> jmp short loc_fnf_search 3168 <1> 3169 <1> get_and_print_longname: 3170 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 3171 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3172 <1> ; 16/10/2016 3173 <1> ; 13/02/2016 (TRDOS 386 = TRDOS v2.0) 3174 <1> ; 24/01/2010 3175 <1> ; 17/10/2009 (CMD_INTR.ASM, 'cmp_cmd_longname') 3176 <1> get_longname_fchar: 3177 00008AA4 803E20 <1> cmp byte [esi], 20h 3178 00008AA7 7701 <1> ja short loc_find_longname 3179 <1> ;jb short loc_longname_retn 3180 <1> ;inc esi 3181 <1> ;je short get_longname_fchar 3182 <1> ;loc_longname_retn: 3183 00008AA9 C3 <1> retn 3184 <1> loc_find_longname: 3185 00008AAA E86C1F0000 <1> call find_longname 3186 00008AAF 731D <1> jnc short loc_print_longname 3187 <1> 3188 00008AB1 08C0 <1> or al, al 3189 00008AB3 7412 <1> jz short loc_longname_not_found 3190 <1> 3191 <1> ; 16/10/2016 (15h -> 15, 17) 3192 00008AB5 3C0F <1> cmp al, 15 3193 <1> ;je cd_drive_not_ready ; drive not ready 3194 <1> ; 28/07/2022 3195 00008AB7 7505 <1> jne short loc_fln_err2 3196 <1> loc_fln_err1: 3197 00008AB9 E92CF8FFFF <1> jmp cd_drive_not_ready 3198 <1> loc_fln_err2: 3199 <1> ; or 3200 00008ABE 3C11 <1> cmp al, 17 ; read error 3201 <1> ;je cd_drive_not_ready 3202 <1> ; 28/07/2022 3203 <1> ;je short loc_fln_err1 3204 <1> 3205 <1> loc_ln_file_dir_not_found: 3206 00008AC0 BE[C2310100] <1> mov esi, Msg_File_Directory_Not_Found 3207 <1> ;;call print_msg 3208 <1> ;;retn 3209 <1> ;jmp print_msg 3210 <1> ; 28/07/2022 3211 00008AC5 EB1F <1> jmp short loc_lfn_err3 3212 <1> 3213 <1> loc_longname_not_found: 3214 00008AC7 BE[E1310100] <1> mov esi, Msg_LongName_Not_Found 3215 <1> ;;call print_msg 3216 <1> ;;retn 3217 <1> ;jmp print_msg 3218 <1> ; 28/07/2022 3219 00008ACC EB18 <1> jmp short loc_lfn_err3 3220 <1> 3221 <1> loc_print_longname: 3222 <1> ;mov esi, LongFileName 3223 00008ACE BF[76780100] <1> mov edi, TextBuffer 3224 00008AD3 57 <1> push edi 3225 <1> 3226 <1> ; 19/12/2025 3227 <1> %if 0 3228 <1> cmp al, 0 3229 <1> ja short loc_print_longname_1 3230 <1> loc_print_FS_longname: ; Singlix FS (64 byte ASCIIZ file name) 3231 <1> lodsb 3232 <1> stosb 3233 <1> or al, al 3234 <1> jnz short loc_print_FS_longname 3235 <1> jmp short loc_print_longname_2 3236 <1> %endif 3237 <1> ; 3238 <1> loc_print_longname_1: ; MS Windows long name (UNICODE chars) 3239 00008AD4 66AD <1> lodsw 3240 00008AD6 AA <1> stosb 3241 00008AD7 08C0 <1> or al, al 3242 00008AD9 75F9 <1> jnz short loc_print_longname_1 3243 <1> ; 3244 <1> loc_print_longname_2: 3245 00008ADB 5E <1> pop esi 3246 00008ADC E8D9E2FFFF <1> call print_msg 3247 00008AE1 BE[17390100] <1> mov esi, nextline 3248 <1> loc_lfn_err3: 3249 <1> ;call print_msg 3250 <1> ;retn 3251 00008AE6 E9CFE2FFFF <1> jmp print_msg 3252 <1> 3253 <1> show_file: 3254 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 3255 <1> ; 07/08/2022 3256 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3257 <1> ; 18/02/2016 3258 <1> ; 17/02/2016 3259 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 3260 <1> ; 13/09/2011 (CMD_INTR.ASM, 'cmp_cmd_show') 3261 <1> ; 08/11/2009 3262 <1> 3263 <1> loc_show_parse_path_name: 3264 00008AEB BF[16800100] <1> mov edi, FindFile_Drv 3265 00008AF0 E8891E0000 <1> call parse_path_name 3266 <1> ;jc loc_cmd_failed 3267 <1> ; 28/07/2022 3268 00008AF5 7305 <1> jnc short loc_show_check_filename_exists 3269 <1> show_file_err1: 3270 00008AF7 E958F9FFFF <1> jmp loc_cmd_failed 3271 <1> 3272 <1> loc_show_check_filename_exists: 3273 00008AFC BE[58800100] <1> mov esi, FindFile_Name 3274 00008B01 803E20 <1> cmp byte [esi], 20h 3275 <1> ;jna loc_cmd_failed 3276 <1> ; 28/07/2022 3277 00008B04 76F1 <1> jna short show_file_err1 3278 <1> 3279 <1> ; 15/02/2016 (invalid file name check) 3280 00008B06 E8CE010000 <1> call check_filename 3281 00008B0B 730A <1> jnc short loc_show_change_drv 3282 <1> 3283 00008B0D BE[AD320100] <1> mov esi, Msg_invalid_name_chars 3284 00008B12 E9A3E2FFFF <1> jmp print_msg 3285 <1> 3286 <1> loc_show_change_drv: 3287 00008B17 8A35[76770100] <1> mov dh, [Current_Drv] 3288 00008B1D 8835[D37E0100] <1> mov [RUN_CDRV], dh 3289 00008B23 8A15[16800100] <1> mov dl, [FindFile_Drv] 3290 00008B29 38F2 <1> cmp dl, dh 3291 00008B2B 740C <1> je short loc_show_change_directory 3292 00008B2D E8BEEBFFFF <1> call change_current_drive 3293 <1> ;;jc loc_file_rw_cmd_failed 3294 <1> ;jc loc_run_cmd_failed 3295 <1> ; 28/07/2022 3296 00008B32 7305 <1> jnc short loc_show_change_directory 3297 <1> show_file_err2: 3298 00008B34 E946F9FFFF <1> jmp loc_run_cmd_failed 3299 <1> 3300 <1> loc_show_change_directory: 3301 00008B39 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 3302 00008B40 7614 <1> jna short loc_findload_showfile 3303 <1> 3304 00008B42 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3305 00008B48 BE[17800100] <1> mov esi, FindFile_Directory 3306 00008B4D 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3307 00008B4F E897180000 <1> call change_current_directory 3308 <1> ;;jc loc_file_rw_cmd_failed 3309 <1> ;jc loc_run_cmd_failed 3310 <1> ; 28/07/2022 3311 00008B54 72DE <1> jc short show_file_err2 3312 <1> 3313 <1> ;loc_show_change_prompt_dir_string: 3314 <1> ;call change_prompt_dir_string 3315 <1> 3316 <1> loc_findload_showfile: 3317 <1> ; 15/02/2016 3318 00008B56 BE[58800100] <1> mov esi, FindFile_Name 3319 00008B5B BF[07800100] <1> mov edi, Dir_Entry_Name ; Dir Entry Format File Name 3320 00008B60 E84F1D0000 <1> call convert_file_name 3321 00008B65 89FE <1> mov esi, edi ; offset Dir_Entry_Name 3322 <1> 3323 00008B67 28C0 <1> sub al, al ; Attrib AND mask = 0 3324 <1> ; Directory attribute : 10h 3325 <1> ; Volume name attribute: 8h 3326 00008B69 B418 <1> mov ah, 00011000b ; 18h (Attrib NAND, AND --> zero mask) 3327 <1> ; 3328 <1> ;xor cx, cx 3329 <1> ; 28/07/2022 3330 00008B6B 31C9 <1> xor ecx, ecx 3331 00008B6D E8961A0000 <1> call locate_current_dir_file 3332 <1> ;;jc loc_file_rw_cmd_failed 3333 <1> ;jc loc_run_cmd_failed 3334 <1> ; 28/07/2022 3335 00008B72 72C0 <1> jc short show_file_err2 3336 <1> 3337 <1> loc_show_load_file: 3338 <1> ; EDI = Directory Entry 3339 00008B74 668B4714 <1> mov ax, [edi+DirEntry_FstClusHI] ; First Cluster High Word 3340 00008B78 C1E010 <1> shl eax, 16 3341 00008B7B 668B471A <1> mov ax, [edi+DirEntry_FstClusLO] ; First Cluster Low Word 3342 00008B7F A3[C0800100] <1> mov [Show_Cluster], eax 3343 00008B84 8B471C <1> mov eax, [edi+DirEntry_FileSize] ; File Size 3344 00008B87 21C0 <1> and eax, eax ; Empty file ! 3345 <1> ;jz end_of_show_file 3346 <1> ; 28/07/2022 3347 00008B89 7505 <1> jnz short loc_show_load_file_set_size 3348 00008B8B E994000000 <1> jmp end_of_show_file 3349 <1> 3350 <1> loc_show_load_file_set_size: ; 28/07/2022 3351 00008B90 A3[C4800100] <1> mov [Show_FileSize], eax 3352 00008B95 31C0 <1> xor eax, eax 3353 00008B97 A3[C8800100] <1> mov [Show_FilePointer], eax ; 0 3354 00008B9C 66A3[CC800100] <1> mov [Show_ClusterPointer], ax ; 0 3355 00008BA2 29DB <1> sub ebx, ebx 3356 00008BA4 8A3D[76770100] <1> mov bh, [Current_Drv] 3357 00008BAA BE00010900 <1> mov esi, Logical_DOSDisks 3358 00008BAF 01DE <1> add esi, ebx 3359 00008BB1 8935[BC800100] <1> mov [Show_LDDDT], esi ; Logical DOS Drv Description Table addr 3360 <1> 3361 <1> ; 19/12/2025 3362 <1> %if 0 3363 <1> cmp byte [esi+LD_FATType], 0 3364 <1> ja short loc_show_calculate_cluster_size 3365 <1> ; Singlix FS 3366 <1> ; First Cluster Number is FDT number (in compatibility buffer) 3367 <1> mov edx, [Show_Cluster] ; Compatibility dir. buffer value (FDT) 3368 <1> mov [Show_FDT], edx 3369 <1> ; 19/12/2025 3370 <1> ;xor eax, eax 3371 <1> mov [Show_Cluster], eax ; Sector index = 0 3372 <1> ; (next time it will be 1) 3373 <1> %endif 3374 <1> 3375 <1> loc_show_calculate_cluster_size: 3376 <1> ;mov bx, [esi+LD_BPB+BPB_BytsPerSec] ; FAT 12-16-32 (512) 3377 <1> ; 19/12/2025 3378 00008BB7 66BB0002 <1> mov bx, 512 3379 <1> ; BX = 512 = [esi+LD_FS_BytesPerSec] ; Singlix FS 3380 00008BBB 8A4613 <1> mov al, [esi+LD_BPB+BPB_SecPerClust] ; FAT 12-16-32 (<= 128) 3381 <1> ; AL = 1 = [esi+LD_FS_Reserved2] ; SectPerClust for Singlix FS 3382 00008BBE F7E3 <1> mul ebx 3383 <1> 3384 <1> ;cmp eax, 65536 ; non-compatible (very big) cluster size 3385 <1> ;ja short end_of_show_file 3386 00008BC0 66A3[CE800100] <1> mov [Show_ClusterSize], ax 3387 <1> 3388 <1> loc_start_show_file: 3389 00008BC6 BE[17390100] <1> mov esi, nextline 3390 00008BCB E8EAE1FFFF <1> call print_msg 3391 <1> 3392 00008BD0 A1[C0800100] <1> mov eax, [Show_Cluster] 3393 00008BD5 C605[D0800100]17 <1> mov byte [Show_RowCount], 23 3394 <1> 3395 <1> ; 17/02/2016 3396 00008BDC 8B35[BC800100] <1> mov esi, [Show_LDDDT] 3397 <1> 3398 <1> ; 07/08/2022 3399 <1> loc_show_next_cluster: 3400 <1> ; 15/02/2016 3401 00008BE2 BB00000700 <1> mov ebx, Cluster_Buffer ; 70000h (for current TRDOS 386 version) 3402 <1> ; ESI = Logical DOS drv description table address 3403 00008BE7 E88F350000 <1> call read_cluster 3404 <1> ;;jc loc_file_rw_cmd_failed 3405 <1> ;jc loc_run_cmd_failed 3406 <1> ; 07/08/2022 3407 00008BEC 7305 <1> jnc short loc_show_nc_rc_ok 3408 00008BEE E98CF8FFFF <1> jmp loc_run_cmd_failed 3409 <1> loc_show_nc_rc_ok: 3410 00008BF3 31DB <1> xor ebx, ebx 3411 <1> loc_show_next_byte: 3412 00008BF5 803D[D0800100]00 <1> cmp byte [Show_RowCount], 0 3413 00008BFC 7512 <1> jne short pass_show_wait_for_key 3414 00008BFE 30E4 <1> xor ah, ah 3415 00008C00 E80D83FFFF <1> call int16h 3416 00008C05 3C1B <1> cmp al, 1Bh 3417 <1> ;jne short pass_exit_show 3418 <1> ; 28/07/2022 3419 00008C07 741B <1> je short end_of_show_file 3420 <1> 3421 <1> ;end_of_show_file: 3422 <1> ;pass_show_file: 3423 <1> ; mov esi, nextline 3424 <1> ; call print_msg 3425 <1> ; jmp loc_file_rw_restore_retn 3426 <1> 3427 <1> pass_exit_show: 3428 00008C09 C605[D0800100]14 <1> mov byte [Show_RowCount], 20 3429 <1> pass_show_wait_for_key: 3430 00008C10 81C300000700 <1> add ebx, Cluster_Buffer 3431 00008C16 8A03 <1> mov al, [ebx] 3432 00008C18 3C0D <1> cmp al, 0Dh 3433 <1> ;jne loc_show_check_tab_space 3434 <1> ; 28/07/2022 3435 00008C1A 7417 <1> je short loc_show_dec_row_count 3436 00008C1C EB7E <1> jmp loc_show_check_tab_space 3437 <1> 3438 <1> ; 07/08/2022 3439 <1> loc_show_next: 3440 <1> ;and bx, bx ; 65536 -> 0 3441 <1> ; 28/07/2022 3442 00008C1E 21DB <1> and ebx, ebx 3443 00008C20 75D3 <1> jnz short loc_show_next_byte 3444 00008C22 EBBE <1> jmp short loc_show_next_cluster 3445 <1> 3446 <1> ; 19/12/2025 3447 <1> ; 28/07/2022 3448 <1> end_of_show_file: 3449 <1> pass_show_file: 3450 00008C24 BE[17390100] <1> mov esi, nextline 3451 00008C29 E88CE1FFFF <1> call print_msg 3452 00008C2E E915010000 <1> jmp loc_file_rw_restore_retn 3453 <1> 3454 <1> loc_show_dec_row_count: ; 28/07/2022 3455 00008C33 FE0D[D0800100] <1> dec byte [Show_RowCount] 3456 <1> pass_show_dec_rowcount: 3457 00008C39 B307 <1> mov bl, 7 ; (light gray character color, black background) 3458 00008C3B 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] ; [ptty] 3459 00008C41 E89996FFFF <1> call _write_tty 3460 <1> loc_show_check_eof: 3461 00008C46 FF05[C8800100] <1> inc dword [Show_FilePointer] 3462 00008C4C A1[C8800100] <1> mov eax, [Show_FilePointer] 3463 00008C51 3B05[C4800100] <1> cmp eax, [Show_FileSize] 3464 00008C57 73CB <1> jnb short end_of_show_file 3465 00008C59 66FF05[CC800100] <1> inc word [Show_ClusterPointer] 3466 00008C60 0FB71D[CC800100] <1> movzx ebx, word [Show_ClusterPointer] 3467 <1> 3468 <1> ; 17/02/2016 3469 <1> ; (sector boundary -9 bits- check, 512 = 0) 3470 00008C67 66F7C3FF01 <1> test bx, 1FFh ; 1 to 511 3471 00008C6C 7587 <1> jnz short loc_show_next_byte 3472 <1> 3473 <1> ; 16/02/2016 3474 00008C6E 8B35[BC800100] <1> mov esi, [Show_LDDDT] 3475 <1> 3476 <1> ; 19/12/2025 3477 <1> %if 0 3478 <1> cmp byte [esi+LD_FATType], 0 3479 <1> ja short loc_show_check_fat_cluster_size 3480 <1> 3481 <1> ; Singlix FS 3482 <1> ; 1 sector, more... (cluster size = 1 sector) 3483 <1> mov eax, [Show_Cluster] 3484 <1> inc eax 3485 <1> mov [Show_Cluster], eax 3486 <1> 3487 <1> ; 07/08/2022 3488 <1> jmp short loc_show_next 3489 <1> 3490 <1> ; 28/07/2022 3491 <1> end_of_show_file: 3492 <1> pass_show_file: 3493 <1> mov esi, nextline 3494 <1> call print_msg 3495 <1> jmp loc_file_rw_restore_retn 3496 <1> %endif 3497 <1> 3498 <1> loc_show_check_fat_cluster_size: 3499 <1> ; 17/02/2016 3500 00008C74 663B1D[CE800100] <1> cmp bx, [Show_ClusterSize] ; cluster size in bytes 3501 <1> ;jb short loc_show_next_byte ; 28/07/2022 3502 <1> ; 07/08/2022 3503 00008C7B 7305 <1> jnb short loc_show_file_cluster_ok 3504 00008C7D E973FFFFFF <1> jmp loc_show_next_byte 3505 <1> 3506 <1> loc_show_file_cluster_ok: 3507 00008C82 66C705[CC800100]00- <1> mov word [Show_ClusterPointer], 0 3507 00008C8A 00 <1> 3508 <1> 3509 00008C8B A1[C0800100] <1> mov eax, [Show_Cluster] 3510 <1> ;mov esi, [Show_LDDDT] 3511 <1> loc_show_get_next_cluster: 3512 00008C90 E8F4320000 <1> call get_next_cluster 3513 <1> ;;jc loc_file_rw_cmd_failed 3514 <1> ;jc loc_run_cmd_failed 3515 <1> ; 28/07/2022 3516 00008C95 7338 <1> jnc short loc_show_update_ccluster 3517 00008C97 E9E3F7FFFF <1> jmp loc_run_cmd_failed 3518 <1> 3519 <1> loc_show_check_tab_space: 3520 00008C9C 3C09 <1> cmp al, 09h 3521 <1> ;jne short pass_show_dec_rowcount ; 28/07/2022 3522 <1> ; 07/08/2022 3523 00008C9E 7402 <1> je short loc_show_put_tab_space 3524 00008CA0 EB97 <1> jmp pass_show_dec_rowcount 3525 <1> loc_show_put_tab_space: 3526 00008CA2 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] ; [ptty] 3527 00008CA8 E8D092FFFF <1> call get_cpos 3528 <1> ; dl = cursor column 3529 00008CAD 80E207 <1> and dl, 7 ; 18/02/2016 3530 <1> ;shr bh, 1 ; [ACTIVE_PAGE] 3531 00008CB0 8A3D[DE760100] <1> mov bh, [ACTIVE_PAGE] 3532 00008CB6 B307 <1> mov bl, 7 ; color attribute 3533 <1> loc_show_put_space_chars: 3534 00008CB8 B020 <1> mov al, 20h ; space 3535 <1> ;mov bh, [ACTIVE_PAGE] ; [ptty] 3536 <1> ;mov bl, 7 ; color attribute 3537 <1> ;push dx 3538 00008CBA 52 <1> push edx ; 29/12/2017 3539 00008CBB E81F96FFFF <1> call _write_tty 3540 00008CC0 5A <1> pop edx ; 29/12/2017 3541 <1> ;pop dx 3542 <1> ; 18/02/2016 3543 00008CC1 80FA07 <1> cmp dl, 7 3544 <1> ;jnb short loc_show_check_eof ; 28/07/2022 3545 <1> ; 07/08/2022 3546 00008CC4 7205 <1> jb short loc_show_next_tab_space 3547 00008CC6 E97BFFFFFF <1> jmp loc_show_check_eof 3548 <1> loc_show_next_tab_space: 3549 00008CCB FEC2 <1> inc dl 3550 00008CCD EBE9 <1> jmp short loc_show_put_space_chars 3551 <1> 3552 <1> loc_show_update_ccluster: 3553 00008CCF A3[C0800100] <1> mov [Show_Cluster], eax 3554 00008CD4 E909FFFFFF <1> jmp loc_show_next_cluster 3555 <1> 3556 <1> check_filename: 3557 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3558 <1> ; 10/10/2016 3559 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 3560 <1> ; 07/08/2010 (FILE.ASM, 'proc_check_filename') 3561 <1> ; 10/07/2010 3562 <1> ; Derived from 'proc_check_filename' 3563 <1> ; in the old TRDOS.ASM (09/02/2005). 3564 <1> ; 3565 <1> ; INPUT -> 3566 <1> ; ESI = Dot File Name Location 3567 <1> ; OUTPUT -> 3568 <1> ; cf = 1 -> error code in AL 3569 <1> ; AL = ERR_INV_FILE_NAME (=26) 3570 <1> ; Invalid file name chars 3571 <1> ; cf = 0 -> valid file name 3572 <1> ; 3573 <1> ; (EAX, ECX, EDI will be changed) 3574 <1> 3575 <1> check_invalid_filename_chars: 3576 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3577 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 3578 <1> ; 10/07/2010 (FILE.ASM, 'proc_check_invalid_filename_chars') 3579 <1> ; 10/02/2010 3580 <1> ; Derived from 'proc_check_invalid_filename_chars' 3581 <1> ; in the old TRDOS.ASM (09/02/2005). 3582 <1> ; 3583 <1> ; INPUT -> 3584 <1> ; ESI = ASCIIZ FileName 3585 <1> ; OUTPUT -> 3586 <1> ; cf = 1 -> invalid 3587 <1> ; cf = 0 -> valid 3588 <1> ; 3589 <1> ;(EAX, ECX, EDI will be changed) 3590 <1> 3591 00008CD9 56 <1> push esi 3592 <1> 3593 00008CDA BF[962F0100] <1> mov edi, invalid_fname_chars 3594 00008CDF AC <1> lodsb 3595 <1> check_filename_next_char: 3596 00008CE0 B914000000 <1> mov ecx, sizeInvFnChars 3597 00008CE5 BF[962F0100] <1> mov edi, invalid_fname_chars 3598 <1> loc_scan_invalid_filename_char: 3599 00008CEA AE <1> scasb 3600 00008CEB 741E <1> je short loc_invalid_filename_stc 3601 00008CED E2FB <1> loop loc_scan_invalid_filename_char 3602 00008CEF AC <1> lodsb 3603 00008CF0 3C1F <1> cmp al, 1Fh ; 20h and above 3604 00008CF2 77EC <1> ja short check_filename_next_char 3605 <1> 3606 <1> check_filename_dot: 3607 00008CF4 8B3424 <1> mov esi, [esp] 3608 <1> 3609 00008CF7 B421 <1> mov ah, 21h 3610 <1> ;mov ecx, 8 3611 <1> ; 28/07/2022 3612 00008CF9 29C9 <1> sub ecx, ecx 3613 00008CFB B108 <1> mov cl, 8 3614 <1> loc_check_filename_next_char: 3615 00008CFD AC <1> lodsb 3616 00008CFE 3C2E <1> cmp al, 2Eh 3617 00008D00 7511 <1> jne short pass_check_fn_dot_check 3618 <1> loc_check_filename_ext_0: 3619 00008D02 AC <1> lodsb 3620 00008D03 38E0 <1> cmp al, ah ; 21h 3621 00008D05 7205 <1> jb short loc_invalid_filename 3622 00008D07 3C2E <1> cmp al, 2Eh 3623 00008D09 7519 <1> jne short loc_check_filename_ext_1 3624 <1> 3625 <1> loc_invalid_filename_stc: 3626 <1> loc_check_fn_stc_rtn: 3627 00008D0B F9 <1> stc 3628 <1> loc_invalid_filename: 3629 <1> ; 10/10/2016 (0Bh -> 26) 3630 00008D0C B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; (=26) 3631 <1> ; Invalid file name chars 3632 <1> loc_check_fn_rtn: 3633 00008D11 5E <1> pop esi 3634 00008D12 C3 <1> retn 3635 <1> 3636 <1> pass_check_fn_dot_check: 3637 00008D13 38E0 <1> cmp al, ah ; 21h 3638 00008D15 7224 <1> jb short loc_check_fn_clc_rtn 3639 00008D17 E2E4 <1> loop loc_check_filename_next_char 3640 00008D19 AC <1> lodsb 3641 00008D1A 38E0 <1> cmp al, ah ; 21h 3642 00008D1C 721D <1> jb short loc_check_fn_clc_rtn 3643 00008D1E 3C2E <1> cmp al, 2Eh 3644 00008D20 75E9 <1> jne short loc_check_fn_stc_rtn 3645 00008D22 EBDE <1> jmp short loc_check_filename_ext_0 3646 <1> 3647 <1> loc_check_filename_ext_1: 3648 00008D24 AC <1> lodsb 3649 00008D25 38E0 <1> cmp al, ah ; 21h 3650 00008D27 7212 <1> jb short loc_check_fn_clc_rtn 3651 00008D29 3C2E <1> cmp al, 2Eh 3652 00008D2B 74DE <1> je short loc_check_fn_stc_rtn 3653 00008D2D AC <1> lodsb 3654 00008D2E 38E0 <1> cmp al, ah ; 21h 3655 00008D30 7209 <1> jb short loc_check_fn_clc_rtn 3656 00008D32 3C2E <1> cmp al, 2Eh 3657 00008D34 74D5 <1> je short loc_check_fn_stc_rtn 3658 00008D36 AC <1> lodsb 3659 00008D37 38E0 <1> cmp al, ah ; 21h 3660 00008D39 73D0 <1> jnb short loc_check_fn_stc_rtn 3661 <1> 3662 <1> loc_check_fn_clc_rtn: 3663 00008D3B 5E <1> pop esi 3664 00008D3C F8 <1> clc 3665 00008D3D C3 <1> retn 3666 <1> 3667 <1> loc_print_deleted_message: 3668 00008D3E BE[82330100] <1> mov esi, Msg_Deleted 3669 00008D43 E872E0FFFF <1> call print_msg 3670 <1> 3671 <1> ;clc 3672 <1> 3673 <1> loc_file_rw_restore_retn: 3674 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 3675 <1> ; 28/02/2010 (CMD_INTR.ASM) 3676 <1> loc_file_rw_cmd_failed: 3677 00008D48 9C <1> pushf 3678 00008D49 E899F7FFFF <1> call restore_cdir_after_cmd_fail 3679 00008D4E 9D <1> popf 3680 00008D4F 720D <1> jc short loc_file_rw_check_write_fault 3681 00008D51 C3 <1> retn 3682 <1> 3683 <1> loc_permission_denied: 3684 <1> ; 27/02/2016 3685 00008D52 BE[8F330100] <1> mov esi, Msg_Permission_Denied 3686 00008D57 E85EE0FFFF <1> call print_msg 3687 00008D5C EBEA <1> jmp short loc_file_rw_restore_retn 3688 <1> 3689 <1> loc_file_rw_check_write_fault: 3690 <1> ;cmp al, 1Dh ; Write Fault 3691 00008D5E 3C12 <1> cmp al, 18 ; 05/11/2016 3692 <1> ;jne loc_run_cmd_failed_cmp_al 3693 <1> ; 28/07/2022 3694 00008D60 7405 <1> je short loc_file_rw_fault 3695 00008D62 E91DF7FFFF <1> jmp loc_run_cmd_failed_cmp_al 3696 <1> 3697 <1> loc_file_rw_fault: 3698 00008D67 BE[77310100] <1> mov esi, Msg_Not_Ready_Write_Err 3699 <1> ;call print_msg 3700 <1> ;retn 3701 00008D6C E949E0FFFF <1> jmp print_msg 3702 <1> 3703 <1> make_directory: 3704 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3705 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 3706 <1> ; 12/03/2011 (CMD_INTR.ASM, 'cmp_cmd_mkdir') 3707 <1> ; 14/08/2010 3708 <1> ; 10/07/2010 3709 <1> ; 29/11/2009 3710 <1> ; 3711 <1> get_mkdir_fchar: 3712 <1> ; esi = directory name 3713 00008D71 803E20 <1> cmp byte [esi], 20h 3714 00008D74 7701 <1> ja short loc_mkdir_parse_path_name 3715 <1> 3716 <1> loc_mkdir_nodirname_retn: 3717 00008D76 C3 <1> retn 3718 <1> 3719 <1> loc_mkdir_parse_path_name: 3720 00008D77 BF[16800100] <1> mov edi, FindFile_Drv 3721 00008D7C E8FD1B0000 <1> call parse_path_name 3722 <1> ;jc loc_cmd_failed 3723 <1> ; 28/07/2022 3724 00008D81 7305 <1> jnc short loc_mkdir_check_dirname_exists 3725 <1> loc_mkdir_cmd_failed: 3726 00008D83 E9CCF6FFFF <1> jmp loc_cmd_failed 3727 <1> 3728 <1> loc_mkdir_check_dirname_exists: 3729 00008D88 BE[58800100] <1> mov esi, FindFile_Name 3730 00008D8D 803E20 <1> cmp byte [esi], 20h 3731 <1> ;jna loc_cmd_failed 3732 <1> ; 28/07/2022 3733 00008D90 76F1 <1> jna short loc_mkdir_cmd_failed 3734 00008D92 8935[D4800100] <1> mov [DelFile_FNPointer], esi 3735 00008D98 E83CFFFFFF <1> call check_filename 3736 00008D9D 725B <1> jc short loc_mkdir_invalid_dir_name_chars 3737 <1> 3738 <1> loc_mkdir_drv: 3739 00008D9F 8A35[76770100] <1> mov dh, [Current_Drv] 3740 00008DA5 8835[D37E0100] <1> mov [RUN_CDRV], dh 3741 <1> 3742 00008DAB 8A15[16800100] <1> mov dl, [FindFile_Drv] 3743 00008DB1 38F2 <1> cmp dl, dh 3744 00008DB3 7409 <1> je short loc_mkdir_change_directory 3745 <1> 3746 00008DB5 E836E9FFFF <1> call change_current_drive 3747 <1> ;jc loc_file_rw_cmd_failed 3748 <1> ; 28/07/2022 3749 00008DBA 7302 <1> jnc short loc_mkdir_change_directory 3750 00008DBC EB8A <1> jmp loc_file_rw_cmd_failed 3751 <1> 3752 <1> loc_mkdir_change_directory: 3753 00008DBE 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 3754 00008DC5 7614 <1> jna short loc_mkdir_find_directory 3755 <1> 3756 00008DC7 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3757 00008DCD BE[17800100] <1> mov esi, FindFile_Directory 3758 00008DD2 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3759 00008DD4 E812160000 <1> call change_current_directory 3760 00008DD9 7226 <1> jc short loc_mkdir_check_error_code 3761 <1> 3762 <1> ;loc_mkdir_change_prompt_dir_string: 3763 <1> ;call change_prompt_dir_string 3764 <1> 3765 <1> loc_mkdir_find_directory: 3766 <1> ;mov esi, FindFile_Name 3767 00008DDB 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 3768 <1> ;xor eax, eax 3769 00008DE1 6631C0 <1> xor ax, ax ; any name (dir, file, volume) 3770 00008DE4 E891FBFFFF <1> call find_first_file 3771 00008DE9 7216 <1> jc short loc_mkdir_check_error_code 3772 <1> 3773 <1> loc_mkdir_directory_found: 3774 00008DEB BE[DA320100] <1> mov esi, Msg_Name_Exists 3775 <1> loc_mkdir_inv_dname_chrs_msg: 3776 00008DF0 E8C5DFFFFF <1> call print_msg 3777 00008DF5 E94EFFFFFF <1> jmp loc_file_rw_restore_retn 3778 <1> 3779 <1> loc_mkdir_invalid_dir_name_chars: 3780 00008DFA BE[AD320100] <1> mov esi, Msg_invalid_name_chars 3781 <1> ;call print_msg 3782 <1> ;jmp loc_file_rw_restore_retn 3783 <1> ; 28/07/2022 3784 00008DFF EBEF <1> jmp short loc_mkdir_inv_dname_chrs_msg 3785 <1> 3786 <1> loc_mkdir_check_error_code: 3787 00008E01 3C02 <1> cmp al, 2 3788 <1> ;je short loc_mkdir_directory_not_found 3789 00008E03 7406 <1> je short loc_mkdir_ask_for_yes_no 3790 00008E05 F9 <1> stc 3791 00008E06 E93DFFFFFF <1> jmp loc_file_rw_cmd_failed 3792 <1> 3793 <1> loc_mkdir_directory_not_found: 3794 <1> loc_mkdir_ask_for_yes_no: 3795 00008E0B BE[FB320100] <1> mov esi, Msg_DoYouWantMkdir 3796 00008E10 E8A5DFFFFF <1> call print_msg 3797 00008E15 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 3798 00008E1B E89ADFFFFF <1> call print_msg 3799 00008E20 BE[1A330100] <1> mov esi, Msg_YesNo 3800 00008E25 E890DFFFFF <1> call print_msg 3801 <1> 3802 00008E2A C605[24330100]20 <1> mov byte [Y_N_nextline], 20h 3803 <1> 3804 <1> loc_mkdir_ask_again: 3805 00008E31 30E4 <1> xor ah, ah 3806 00008E33 E8DA80FFFF <1> call int16h 3807 00008E38 3C1B <1> cmp al, 1Bh 3808 <1> ;je short loc_do_not_make_directory 3809 00008E3A 743B <1> je short loc_mkdir_y_n_escape 3810 00008E3C 24DF <1> and al, 0DFh ; y -> Y, n -> N 3811 00008E3E 3C59 <1> cmp al, 'Y' ; 'yes' 3812 00008E40 7404 <1> je short loc_mkdir_yes_make_directory 3813 00008E42 3C4E <1> cmp al, 'N' ; 'no' 3814 00008E44 75EB <1> jne short loc_mkdir_ask_again 3815 <1> 3816 <1> loc_do_not_make_directory: 3817 <1> loc_mkdir_yes_make_directory: 3818 00008E46 E830000000 <1> call y_n_answer ; 29/12/2017 3819 <1> ;cmp al, 'Y' ; 'yes' 3820 <1> ;cmc 3821 <1> ;jnc loc_file_rw_restore_retn 3822 00008E4B 3C4E <1> cmp al, 'N' ; 'no' 3823 <1> ;je loc_file_rw_restore_retn 3824 <1> ; 28/07/2022 3825 00008E4D 7505 <1> jne short loc_mkdir_call_make_sub_dir 3826 00008E4F E9F4FEFFFF <1> jmp loc_file_rw_restore_retn 3827 <1> 3828 <1> loc_mkdir_call_make_sub_dir: 3829 00008E54 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 3830 00008E5A B110 <1> mov cl, 10h ; Directory attributes 3831 00008E5C E8001C0000 <1> call make_sub_directory 3832 <1> loc_rename_file_ok: ; 06/03/2016 3833 <1> ;jc loc_file_rw_cmd_failed 3834 <1> ; 28/07/2022 3835 00008E61 7305 <1> jnc short move_source_file_to_dest_OK 3836 00008E63 E9E0FEFFFF <1> jmp loc_file_rw_cmd_failed 3837 <1> move_source_file_to_dest_OK: 3838 00008E68 BE[28330100] <1> mov esi, Msg_OK 3839 00008E6D E848DFFFFF <1> call print_msg 3840 00008E72 E9D1FEFFFF <1> jmp loc_file_rw_restore_retn 3841 <1> 3842 <1> loc_mkdir_y_n_escape: 3843 00008E77 B04E <1> mov al, 'N' ; 'no' 3844 00008E79 EBCB <1> jmp short loc_do_not_make_directory 3845 <1> 3846 <1> y_n_answer: 3847 <1> ; 29/12/2017 3848 00008E7B A2[24330100] <1> mov [Y_N_nextline], al 3849 <1> ;push ax 3850 00008E80 50 <1> push eax 3851 00008E81 BE[24330100] <1> mov esi, Y_N_nextline 3852 00008E86 E82FDFFFFF <1> call print_msg 3853 00008E8B 58 <1> pop eax 3854 <1> ;pop ax 3855 00008E8C C3 <1> retn 3856 <1> 3857 <1> delete_directory: 3858 <1> ; 17/07/2025 (TRDOS 386 Kernel v2.0.10) 3859 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 3860 <1> ; 29/12/2017 3861 <1> ; 15/10/2016 3862 <1> ; 01/03/2016, 06/03/2016 3863 <1> ; 27/02/2016, 28/02/2016, 29/02/2016 3864 <1> ; 26/02/2016 (TRDOS 386 = TRDOS v2.0) 3865 <1> ; 16/10/2010 (CMD_INTR.ASM, 'cmp_cmd_rmdir') 3866 <1> ; 05/06/2010 3867 <1> ; 3868 <1> get_fchar: 3869 <1> ; esi = directory name 3870 00008E8D 803E20 <1> cmp byte [esi], 20h 3871 00008E90 7701 <1> ja short loc_rmdir_parse_path_name 3872 <1> 3873 <1> loc_rmdir_nodirname_retn: 3874 00008E92 C3 <1> retn 3875 <1> 3876 <1> loc_rmdir_parse_path_name: 3877 00008E93 BF[16800100] <1> mov edi, FindFile_Drv 3878 00008E98 E8E11A0000 <1> call parse_path_name 3879 <1> ;jc loc_cmd_failed 3880 <1> ; 28/07/2022 3881 00008E9D 7305 <1> jnc short loc_rmdir_check_dirname_exists 3882 <1> lc_del_dir_failed: 3883 00008E9F E9B0F5FFFF <1> jmp loc_cmd_failed 3884 <1> 3885 <1> loc_rmdir_check_dirname_exists: 3886 00008EA4 BE[58800100] <1> mov esi, FindFile_Name 3887 00008EA9 803E20 <1> cmp byte [esi], 20h 3888 <1> ;jna loc_cmd_failed 3889 <1> ; 28/07/2022 3890 00008EAC 76F1 <1> jna short lc_del_dir_failed 3891 00008EAE 8935[D4800100] <1> mov [DelFile_FNPointer], esi 3892 <1> 3893 <1> loc_rmdir_drv: 3894 00008EB4 8A35[76770100] <1> mov dh, [Current_Drv] 3895 00008EBA 8835[D37E0100] <1> mov [RUN_CDRV], dh 3896 <1> 3897 <1> ;;;; 3898 <1> ; 17/07/2025 - TRDOS 386 v2.0.10 3899 00008EC0 8835[1C810100] <1> mov [rmdir_drv], dh 3900 00008EC6 8B1D[70770100] <1> mov ebx, [Current_Dir_FCluster] 3901 00008ECC 891D[18810100] <1> mov [rmdir_dir_fcluster], ebx 3902 <1> ;;;; 3903 <1> 3904 00008ED2 8A15[16800100] <1> mov dl, [FindFile_Drv] 3905 00008ED8 38F2 <1> cmp dl, dh 3906 00008EDA 7407 <1> je short loc_rmdir_change_directory 3907 <1> 3908 00008EDC E80FE8FFFF <1> call change_current_drive 3909 <1> ;jc loc_file_rw_cmd_failed 3910 <1> ; 28/07/2022 3911 <1> ;jnc short loc_rmdir_change_directory 3912 <1> ;jmp loc_file_rw_cmd_failed 3913 00008EE1 7233 <1> jc short loc_rmdir_chdrv_failed 3914 <1> 3915 <1> loc_rmdir_change_directory: 3916 00008EE3 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 3917 00008EEA 7614 <1> jna short loc_rmdir_find_directory 3918 <1> 3919 00008EEC FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3920 00008EF2 BE[17800100] <1> mov esi, FindFile_Directory 3921 00008EF7 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3922 00008EF9 E8ED140000 <1> call change_current_directory 3923 00008EFE 7211 <1> jc short loc_rmdir_check_error_code 3924 <1> 3925 <1> ;loc_rmdir_change_prompt_dir_string: 3926 <1> ;call change_prompt_dir_string 3927 <1> 3928 <1> loc_rmdir_find_directory: 3929 <1> ;mov esi, FindFile_Name 3930 00008F00 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 3931 00008F06 66B81008 <1> mov ax, 0810h ; Only directories 3932 00008F0A E86BFAFFFF <1> call find_first_file 3933 00008F0F 730A <1> jnc short loc_rmdir_ambgfn_check 3934 <1> 3935 <1> loc_rmdir_check_error_code: 3936 00008F11 3C02 <1> cmp al, 2 3937 00008F13 740B <1> je short loc_rmdir_directory_not_found 3938 00008F15 F9 <1> stc 3939 <1> loc_rmdir_chdrv_failed: 3940 00008F16 E92DFEFFFF <1> jmp loc_file_rw_cmd_failed 3941 <1> 3942 <1> loc_rmdir_ambgfn_check: 3943 00008F1B 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 3944 00008F1E 740F <1> jz short loc_rmdir_directory_found 3945 <1> 3946 <1> loc_rmdir_directory_not_found: 3947 00008F20 BE[99310100] <1> mov esi, Msg_Dir_Not_Found 3948 00008F25 E890DEFFFF <1> call print_msg 3949 <1> 3950 00008F2A E919FEFFFF <1> jmp loc_file_rw_restore_retn 3951 <1> 3952 <1> loc_rmdir_directory_found: 3953 00008F2F 80E307 <1> and bl, 07h ; Attributes 3954 <1> ;jnz loc_permission_denied 3955 <1> ; 28/07/2022 3956 00008F32 7405 <1> jz short loc_rmdir_save_lnel 3957 00008F34 E919FEFFFF <1> jmp loc_permission_denied 3958 <1> 3959 <1> loc_rmdir_save_lnel: ; 28/02/2016 3960 <1> ;mov bh, [LongName_EntryLength] 3961 00008F39 883D[DE800100] <1> mov [DelFile_LNEL], bh ; Long name entry length (if > 0) 3962 <1> ; edi = Directory Entry Offset (DirBuff) 3963 <1> ; esi = Directory Entry (FFF Structure) 3964 <1> ;mov [DelFile_DirEntryAddr], edi ; not required 3965 <1> ;mov ax, [edi+20] ; First Cluster High Word 3966 <1> ;shl eax, 16 3967 <1> ;mov ax, [edi+26] ; First Cluster Low Word 3968 <1> ; ROOT Dir First Cluster = 0 3969 <1> ;cmp eax, 2 3970 <1> ;jb loc_update_direntry_1 3971 <1> 3972 <1> pass_rmdir_fc_check: 3973 00008F3F 57 <1> push edi ; * (29/02/2016) 3974 <1> 3975 00008F40 BE[2E330100] <1> mov esi, Msg_DoYouWantRmDir 3976 00008F45 E870DEFFFF <1> call print_msg 3977 00008F4A 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 3978 00008F50 E865DEFFFF <1> call print_msg 3979 00008F55 BE[1A330100] <1> mov esi, Msg_YesNo 3980 00008F5A E85BDEFFFF <1> call print_msg 3981 <1> 3982 <1> loc_rmdir_ask_again: 3983 00008F5F 30E4 <1> xor ah, ah 3984 00008F61 E8AC7FFFFF <1> call int16h 3985 00008F66 3C1B <1> cmp al, 1Bh 3986 <1> ;je short loc_do_not_delete_directory 3987 00008F68 742F <1> je short loc_rmdir_y_n_escape ; 06/03/2016 3988 00008F6A 24DF <1> and al, 0DFh 3989 00008F6C A2[24330100] <1> mov [Y_N_nextline], al 3990 00008F71 3C59 <1> cmp al, 'Y' 3991 00008F73 7404 <1> je short loc_rmdir_yes_delete_directory 3992 00008F75 3C4E <1> cmp al, 'N' 3993 00008F77 75E6 <1> jne short loc_rmdir_ask_again 3994 <1> 3995 <1> loc_do_not_delete_directory: 3996 <1> loc_rmdir_yes_delete_directory: 3997 00008F79 E8FDFEFFFF <1> call y_n_answer ; 29/12/2017 3998 00008F7E 5F <1> pop edi ; * (29/02/2016) 3999 <1> ;cmp al, 'Y' ; 'yes' 4000 <1> ;cmc 4001 <1> ;jnc loc_file_rw_restore_retn 4002 00008F7F 3C4E <1> cmp al, 'N' ; 'no' 4003 <1> ;je loc_file_rw_restore_retn 4004 <1> ; 28/07/2022 4005 <1> ;jne short loc_delete_sub_dir 4006 <1> ;jmp loc_file_rw_restore_retn 4007 00008F81 7411 <1> je short loc_rmdir_rw_restore_retn 4008 <1> 4009 <1> loc_delete_sub_dir: 4010 <1> ; 29/12/2017 4011 00008F83 E85E000000 <1> call delete_sub_directory 4012 00008F88 7213 <1> jc short loc_rmdir_cmd_failed 4013 <1> 4014 <1> loc_rmdir_ok: 4015 00008F8A BE[28330100] <1> mov esi, Msg_OK 4016 00008F8F E826DEFFFF <1> call print_msg 4017 <1> loc_rmdir_rw_restore_retn: ; 28/07/2022 4018 00008F94 E9AFFDFFFF <1> jmp loc_file_rw_restore_retn 4019 <1> 4020 <1> loc_rmdir_y_n_escape: 4021 00008F99 B04E <1> mov al, 'N' ; 'no' 4022 00008F9B EBDC <1> jmp loc_do_not_delete_directory 4023 <1> 4024 <1> loc_rmdir_cmd_failed: 4025 <1> ; 29/12/2017 4026 00008F9D 09C0 <1> or eax, eax ; EAX = 0 -> Directory not empty! 4027 00008F9F 7423 <1> jz short loc_rmdir_directory_not_empty 4028 <1> 4029 <1> ; EAX > 0 -> Error code in AL (or AX or EAX) 4030 <1> 4031 00008FA1 833D[927E0100]01 <1> cmp dword [FAT_ClusterCounter], 1 4032 <1> ;jb loc_file_rw_cmd_failed 4033 <1> ; 28/07/2022 4034 00008FA8 7305 <1> jnb short loc_rmdir_failed 4035 00008FAA E999FDFFFF <1> jmp loc_file_rw_cmd_failed 4036 <1> 4037 <1> loc_rmdir_failed: 4038 00008FAF F9 <1> stc 4039 <1> loc_rmdir_cmd_return: 4040 <1> ; 01/03/2016 4041 00008FB0 9C <1> pushf 4042 <1> ; ESI = Logical DOS Drive Description Table address 4043 00008FB1 66BB00FF <1> mov bx, 0FF00h ; BH = FFh -> use ESI for Drive parameters 4044 <1> ; BL = 0 -> Recalculate free cluster count 4045 00008FB5 50 <1> push eax 4046 00008FB6 E8B6350000 <1> call calculate_fat_freespace 4047 00008FBB 58 <1> pop eax 4048 00008FBC 9D <1> popf 4049 <1> ;jc loc_file_rw_cmd_failed 4050 <1> ;jmp loc_file_rw_restore_retn 4051 <1> ; 28/07/2022 4052 00008FBD 73D5 <1> jnc short loc_rmdir_rw_restore_retn 4053 00008FBF E984FDFFFF <1> jmp loc_file_rw_cmd_failed 4054 <1> 4055 <1> loc_rmdir_directory_not_empty: 4056 00008FC4 BE[4F330100] <1> mov esi, Msg_Dir_Not_Empty 4057 00008FC9 E8ECDDFFFF <1> call print_msg 4058 <1> ; 01/03/2016 4059 00008FCE A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 4060 00008FD3 09C0 <1> or eax, eax ; 0 ? 4061 <1> ;jz loc_file_rw_restore_retn 4062 <1> ; 28/07/2022 4063 00008FD5 74BD <1> jz short loc_rmdir_rw_restore_retn 4064 <1> 4065 <1> ; ESI = Logical DOS Drive Description Table address 4066 00008FD7 66BB01FF <1> mov bx, 0FF01h ; BH = FFh -> use ESI for Drive parameters 4067 <1> ; BL = 1 -> add free clusters 4068 00008FDB E891350000 <1> call calculate_fat_freespace 4069 00008FE0 09C9 <1> or ecx, ecx 4070 <1> ;jz loc_file_rw_restore_retn ; ecx = 0 -> OK 4071 <1> ;; ecx > 0 -> Error (Recalculation is needed) 4072 <1> ;jmp short loc_rmdir_cmd_return 4073 <1> ; 28/07/2022 4074 00008FE2 75CC <1> jnz short loc_rmdir_cmd_return 4075 00008FE4 EBAE <1> jmp short loc_rmdir_rw_restore_retn 4076 <1> ;jmp loc_file_rw_restore_retn 4077 <1> 4078 <1> delete_sub_directory: 4079 <1> ; 19/12/2025 4080 <1> ; 17/07/2025 (TRDOS 386 Kernel v2.0.10) 4081 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 4082 <1> ; 29/12/2017 4083 <1> ; (moved here from 'delete_directory' for 'sysrmdir' ) 4084 <1> 4085 <1> ; EDI = Directory buffer entry offset/address 4086 <1> 4087 <1> loc_rmdir_delete_short_name_check_dir_empty: 4088 00008FE6 668B4714 <1> mov ax, [edi+20] ; First Cluster High Word 4089 00008FEA C1E010 <1> shl eax, 16 4090 00008FED 668B471A <1> mov ax, [edi+26] ; First Cluster Low Word 4091 <1> 4092 <1> ;;; 4093 <1> ; 17/07/2025 4094 <1> ; (sure it is not the current directory) 4095 00008FF1 8A15[1C810100] <1> mov dl, [rmdir_drv] 4096 00008FF7 3A15[76770100] <1> cmp dl, [Current_Drv] 4097 00008FFD 7508 <1> jne short loc_rmdir_delete_short_name_check_dot 4098 00008FFF 3B05[18810100] <1> cmp eax, [rmdir_dir_fcluster] 4099 00009005 743F <1> je short loc_rmdir_permission_denied 4100 <1> loc_rmdir_delete_short_name_check_dot: 4101 <1> ; (DOT and DOTDOT can not be deleted) 4102 00009007 803F2E <1> cmp byte [edi], '.' 4103 0000900A 750F <1> jne short loc_rmdir_delete_short_name_skip_dot 4104 0000900C 66813F2E20 <1> cmp word [edi], '. ' 4105 00009011 7433 <1> je short loc_rmdir_permission_denied 4106 00009013 813F2E2E2020 <1> cmp dword [edi], '.. ' 4107 00009019 742B <1> je short loc_rmdir_permission_denied 4108 <1> loc_rmdir_delete_short_name_skip_dot: 4109 <1> ;;; 4110 <1> 4111 <1> ;mov [DelFile_FCluster], eax 4112 <1> 4113 <1> ;;mov bx, [DirBuff_EntryCounter] 4114 <1> ;mov bx, [FindFile_DirEntryNumber] ; 27/02/2016 4115 <1> ;mov [DelFile_EntryCounter], bx 4116 <1> 4117 0000901B 29DB <1> sub ebx, ebx 4118 <1> ; 29/12/2017 4119 0000901D 891D[927E0100] <1> mov [FAT_ClusterCounter], ebx ; 0 ; Reset 4120 <1> 4121 00009023 8A3D[16800100] <1> mov bh, [FindFile_Drv] 4122 00009029 BE00010900 <1> mov esi, Logical_DOSDisks 4123 0000902E 01DE <1> add esi, ebx 4124 <1> 4125 <1> ; 19/12/2025 4126 <1> ;cmp word [edi+DirEntry_NTRes], 01A1h 4127 <1> ;je short loc_rmdir_check_fs_directory 4128 <1> 4129 <1> ;cmp byte [esi+LD_FATType], 1 4130 <1> ;jb short loc_rmdir_get__last_cluster_0 4131 <1> 4132 <1> ; 29/12/2017 4133 00009030 83F802 <1> cmp eax, 2 4134 00009033 7306 <1> jnb short loc_rmdir_get_last_cluster_1 4135 <1> ; eax < 2 4136 <1> loc_rmdir_get_last_cluster_0: 4137 <1> ;mov eax, ERR_INV_FORMAT ; invalid format! 4138 00009035 B813000000 <1> mov eax, ERR_NOT_DIR ; not a valid directory! 4139 <1> ;stc 4140 0000903A C3 <1> retn 4141 <1> 4142 <1> loc_rmdir_get_last_cluster_1: 4143 0000903B 807E0303 <1> cmp byte [esi+LD_FATType], 3 ; FAT32 4144 0000903F 750C <1> jne short loc_rmdir_get_last_cluster_2 4145 <1> 4146 <1> ; is it root directory ? 4147 00009041 3B4632 <1> cmp eax, [esi+LD_BPB+BPB_RootClus] 4148 00009044 7507 <1> jne short loc_rmdir_get_last_cluster_2 4149 <1> 4150 <1> ; root directory can not be deleted !! 4151 <1> loc_rmdir_permission_denied: 4152 00009046 B80B000000 <1> mov eax, ERR_PERM_DENIED ; permission denied! 4153 0000904B F9 <1> stc 4154 0000904C C3 <1> retn 4155 <1> 4156 <1> loc_rmdir_get_last_cluster_2: 4157 <1> ; 29/12/2017 4158 0000904D A3[D8800100] <1> mov [DelFile_FCluster], eax 4159 <1> 4160 <1> ;mov dx, [DirBuff_EntryCounter] 4161 00009052 668B15[90800100] <1> mov dx, [FindFile_DirEntryNumber] ; 27/02/2016 4162 00009059 668915[DC800100] <1> mov [DelFile_EntryCounter], dx 4163 <1> 4164 00009060 8B15[A27E0100] <1> mov edx, [DirBuff_Cluster] 4165 00009066 8915[0C810100] <1> mov [RmDir_ParentDirCluster], edx 4166 <1> 4167 0000906C 893D[08810100] <1> mov [RmDir_DirEntryOffset], edi 4168 <1> 4169 <1> ; 01/03/2016 4170 <1> ;mov dword [FAT_ClusterCounter], 0 ; Reset 4171 <1> 4172 <1> loc_rmdir_get_last_cluster_3: 4173 00009072 E878360000 <1> call get_last_cluster 4174 <1> ;jc loc_rmdir_cmd_failed 4175 00009077 7211 <1> jc short loc_delete_sub_dir_retn ; 29/12/2017 4176 <1> 4177 00009079 3B05[D8800100] <1> cmp eax, [DelFile_FCluster] 4178 0000907F 750A <1> jne short loc_rmdir_multi_dir_clusters 4179 <1> 4180 00009081 C605[07810100]00 <1> mov byte [RmDir_MultiClusters], 0 4181 00009088 EB08 <1> jmp short pass_rmdir_multi_dir_clusters 4182 <1> 4183 <1> ; 19/12/2025 4184 <1> %if 0 4185 <1> 4186 <1> loc_rmdir_check_fs_directory: 4187 <1> ; 29/12/2017 4188 <1> cmp byte [esi+LD_FSType], 0A1h 4189 <1> jne short loc_rmdir_permission_denied 4190 <1> 4191 <1> loc_rmdir_delete_fs_directory: 4192 <1> call delete_fs_directory 4193 <1> ;jnc loc_print_deleted_message 4194 <1> jnc short loc_delete_sub_dir_retn ; 29/12/2017 4195 <1> 4196 <1> ; EAX=0 -> Directory not empty ! 4197 <1> ; EAX>0 -> Disk r/w error or another (misc) error 4198 <1> 4199 <1> ;or eax, eax 4200 <1> ;jz loc_rmdir_directory_not_empty_2 4201 <1> ;;stc 4202 <1> ;;jmp loc_file_rw_cmd_failed 4203 <1> 4204 <1> %endif 4205 <1> 4206 <1> loc_delete_sub_dir_retn: 4207 0000908A C3 <1> retn 4208 <1> 4209 <1> loc_rmdir_multi_dir_clusters: 4210 0000908B C605[07810100]01 <1> mov byte [RmDir_MultiClusters], 1 4211 <1> 4212 <1> pass_rmdir_multi_dir_clusters: 4213 00009092 A3[10810100] <1> mov [RmDir_DirLastCluster], eax 4214 00009097 890D[14810100] <1> mov [RmDir_PreviousCluster], ecx 4215 <1> 4216 <1> loc_rmdir_load_fat_sub_directory: 4217 0000909D E8A3300000 <1> call load_FAT_sub_directory 4218 <1> ;jc loc_rmdir_cmd_failed 4219 000090A2 72E6 <1> jc short loc_delete_sub_dir_retn 4220 <1> 4221 <1> loc_rmdir_find_last_dir_entry: 4222 000090A4 56 <1> push esi 4223 000090A5 BE[FA7F0100] <1> mov esi, Dir_File_Name 4224 000090AA C6062A <1> mov byte [esi], '*' 4225 000090AD C646082A <1> mov byte [esi+8], '*' 4226 000090B1 31DB <1> xor ebx, ebx ; Entry offset = 0 4227 <1> loc_rmdir_find_last_dir_entry_next: 4228 <1> ;mov ax, 0800h ; Except volume/long names 4229 <1> ;xor cx, cx ; 0 = Find a valid file or dir name 4230 <1> ; 28/07/2022 4231 000090B3 31C0 <1> xor eax, eax 4232 000090B5 B408 <1> mov ah, 8 4233 <1> ; eax = 0800h 4234 000090B7 31C9 <1> xor ecx, ecx ; 0 4235 000090B9 E825160000 <1> call find_directory_entry 4236 000090BE 7225 <1> jc short loc_rmdir_empty_dir_cluster 4237 000090C0 83FB01 <1> cmp ebx, 1 4238 000090C3 771B <1> ja short loc_rmdir_directory_not_empty_1 4239 <1> loc_rmdir_dot_entry_check: 4240 000090C5 80FD2E <1> cmp ch, '.' ; The first char of the dir entry 4241 000090C8 7516 <1> jne short loc_rmdir_directory_not_empty_1 4242 000090CA 08DB <1> or bl, bl 4243 000090CC 7506 <1> jnz short loc_rmdir_dotdot_entry_check 4244 000090CE 807F0120 <1> cmp byte [edi+1], 20h 4245 000090D2 EB06 <1> jmp short pass_rmdir_dot_entry_check 4246 <1> 4247 <1> loc_rmdir_dotdot_entry_check: 4248 000090D4 66817F012E20 <1> cmp word [edi+1], '. ' 4249 <1> pass_rmdir_dot_entry_check: 4250 000090DA 7504 <1> jne short loc_rmdir_directory_not_empty_1 4251 000090DC FEC3 <1> inc bl 4252 000090DE EBD3 <1> jmp short loc_rmdir_find_last_dir_entry_next 4253 <1> 4254 <1> loc_rmdir_directory_not_empty_1: 4255 000090E0 58 <1> pop eax ; pushed esi 4256 000090E1 31C0 <1> xor eax, eax ; 0 4257 <1> loc_rmdir_directory_not_empty_2: 4258 <1> loc_delete_sub_dir_stc_retn: 4259 000090E3 F9 <1> stc 4260 000090E4 C3 <1> retn 4261 <1> 4262 <1> loc_rmdir_empty_dir_cluster: 4263 000090E5 5E <1> pop esi 4264 <1> 4265 <1> loc_rmdir_set_prev_cluster_dir_last_cluster: 4266 000090E6 803D[07810100]00 <1> cmp byte [RmDir_MultiClusters], 0 4267 000090ED 7613 <1> jna short loc_rmdir_unlink_dir_last_cluster 4268 <1> 4269 000090EF A1[14810100] <1> mov eax, [RmDir_PreviousCluster] 4270 <1> ;xor ecx, ecx 4271 000090F4 49 <1> dec ecx ; FFFFFFFFh 4272 000090F5 E876310000 <1> call update_cluster 4273 000090FA 7306 <1> jnc short loc_rmdir_unlink_dir_last_cluster 4274 <1> 4275 <1> ; 01/03/2016 4276 <1> ;cmp eax, 1 ; eax = 0 -> end of cluster chain 4277 <1> ;cmc 4278 <1> ;jc short loc_rmdir_cmd_failed 4279 <1> ;jmp short loc_rmdir_save_fat_buffer 4280 <1> ; 29/12/2017 4281 000090FC 21C0 <1> and eax, eax 4282 000090FE 75E3 <1> jnz short loc_delete_sub_dir_stc_retn 4283 00009100 EB12 <1> jmp short loc_rmdir_save_fat_buffer 4284 <1> 4285 <1> loc_rmdir_unlink_dir_last_cluster: 4286 00009102 A1[10810100] <1> mov eax, [RmDir_DirLastCluster] 4287 00009107 31C9 <1> xor ecx, ecx ; 0 4288 00009109 E862310000 <1> call update_cluster 4289 0000910E 7327 <1> jnc short loc_rmdir_unlink_stc_retn_0Bh 4290 <1> ; Because of it is the last cluster 4291 <1> ; 'update_cluster' must return with eocc error 4292 00009110 09C0 <1> or eax, eax 4293 <1> ;jz short loc_rmdir_save_fat_buffer ; eocc 4294 <1> ;stc 4295 <1> ;jmp short loc_rmdir_cmd_failed 4296 <1> ; 29/12/2017 4297 00009112 75CF <1> jnz short loc_delete_sub_dir_stc_retn 4298 <1> 4299 <1> loc_rmdir_save_fat_buffer: 4300 00009114 803D[8A7E0100]02 <1> cmp byte [FAT_BuffValidData], 2 4301 0000911B 7527 <1> jne short loc_rmdir_calculate_FAT_freespace 4302 0000911D E8C2330000 <1> call save_fat_buffer 4303 <1> ;jc short loc_rmdir_cmd_failed 4304 <1> ; 29/12/2017 4305 00009122 7219 <1> jc short loc_rmdir_unlink_error_retn 4306 <1> 4307 <1> ; 01/03/2016 4308 00009124 803D[07810100]00 <1> cmp byte [RmDir_MultiClusters], 0 4309 0000912B 7617 <1> jna short loc_rmdir_calculate_FAT_freespace 4310 <1> 4311 0000912D A1[D8800100] <1> mov eax, [DelFile_FCluster] 4312 00009132 E93BFFFFFF <1> jmp loc_rmdir_get_last_cluster_3 4313 <1> 4314 <1> loc_rmdir_unlink_stc_retn_0Bh: 4315 <1> ; 15/10/2016 (0Bh -> 28) 4316 00009137 B81C000000 <1> mov eax, ERR_INV_FORMAT ; 28 = Invalid format 4317 <1> loc_rmdir_unlink_stc_retn: 4318 0000913C F9 <1> stc 4319 <1> loc_rmdir_unlink_error_retn: 4320 0000913D C3 <1> retn 4321 <1> 4322 <1> loc_rmdir_delete_short_name_invalid_data: 4323 <1> ;mov eax, 29 ; Invalid data (15/10/2016) 4324 <1> ; 28/07/2022 4325 0000913E 29C0 <1> sub eax, eax 4326 00009140 B01D <1> mov al, 29 4327 <1> ;stc 4328 <1> ;jmp loc_rmdir_cmd_failed 4329 <1> ; 29/12/2017 4330 00009142 EBF8 <1> jmp short loc_rmdir_unlink_stc_retn 4331 <1> 4332 <1> loc_rmdir_calculate_FAT_freespace: 4333 <1> ;mov eax, [FAT_ClusterCounter] 4334 <1> ; 29/12/2017 4335 00009144 29C0 <1> sub eax, eax ; 0 4336 00009146 8705[927E0100] <1> xchg eax, [FAT_ClusterCounter] 4337 <1> ; 4338 0000914C 66BB01FF <1> mov bx, 0FF01h 4339 <1> ; BL = 1 -> Add EAX to free space count 4340 <1> ; BH = FFh -> 4341 <1> ; ESI = Logical DOS Drive Description Table address 4342 00009150 E81C340000 <1> call calculate_fat_freespace 4343 <1> 4344 00009155 21C9 <1> and ecx, ecx ; ecx = 0 -> valid free sector count 4345 00009157 7409 <1> jz short loc_rmdir_delete_short_name_continue 4346 <1> 4347 <1> loc_rmdir_recalculate_FAT_freespace: 4348 00009159 66BB00FF <1> mov bx, 0FF00h ; BL = 0 -> Recalculate free space 4349 0000915D E80F340000 <1> call calculate_fat_freespace 4350 <1> 4351 <1> loc_rmdir_delete_short_name_continue: 4352 00009162 A1[0C810100] <1> mov eax, [RmDir_ParentDirCluster] 4353 00009167 83F802 <1> cmp eax, 2 4354 0000916A 7309 <1> jnb short loc_rmdir_del_short_name_load_sub_dir 4355 0000916C E8562F0000 <1> call load_FAT_root_directory 4356 <1> ;jc loc_file_rw_cmd_failed 4357 <1> ; 29/12/2017 4358 00009171 72CA <1> jc short loc_rmdir_unlink_error_retn 4359 00009173 EB07 <1> jmp short loc_rmdir_del_short_name_ld_chk_fclust 4360 <1> 4361 <1> loc_rmdir_del_short_name_load_sub_dir: 4362 00009175 E8CB2F0000 <1> call load_FAT_sub_directory 4363 <1> ;jc loc_file_rw_cmd_failed 4364 <1> ; 29/12/2017 4365 0000917A 72C1 <1> jc short loc_rmdir_unlink_error_retn 4366 <1> 4367 <1> loc_rmdir_del_short_name_ld_chk_fclust: 4368 0000917C 0FB73D[08810100] <1> movzx edi, word [RmDir_DirEntryOffset] 4369 00009183 81C700000800 <1> add edi, Directory_Buffer 4370 <1> 4371 00009189 668B4714 <1> mov ax, [edi+20] ; First Cluster High Word 4372 0000918D C1E010 <1> shl eax, 16 4373 00009190 668B471A <1> mov ax, [edi+26] ; First Cluster Low Word 4374 <1> ; Not necessary... 4375 00009194 3B05[D8800100] <1> cmp eax, [DelFile_FCluster] 4376 0000919A 75A2 <1> jne short loc_rmdir_delete_short_name_invalid_data 4377 <1> ; 4378 0000919C C607E5 <1> mov byte [edi], 0E5h ; 'Deleted' sign 4379 <1> ; 27/02/2016 4380 <1> ; TRDOS v1 has a bug here! it does not set 4381 <1> ; 'DirBuff_ValidData' to 2; as result of this bug, 4382 <1> ; 'save_directory_buffer' would not save the change ! 4383 0000919F C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 ; change sign 4384 <1> ; 4385 000091A6 E8E61B0000 <1> call save_directory_buffer 4386 <1> ;jc loc_file_rw_cmd_failed 4387 <1> ; 29/12/2017 4388 000091AB 7290 <1> jc short loc_rmdir_unlink_error_retn 4389 <1> 4390 <1> loc_rmdir_del_long_name: 4391 000091AD 0FB615[DE800100] <1> movzx edx, byte [DelFile_LNEL] 4392 000091B4 08D2 <1> or dl, dl 4393 000091B6 7410 <1> jz short loc_rmdir_update_parent_dir_lmdt 4394 <1> 4395 000091B8 0FB705[DC800100] <1> movzx eax, word [DelFile_EntryCounter] 4396 000091BF 29D0 <1> sub eax, edx 4397 <1> ; 29/12/2017 4398 000091C1 7205 <1> jc short loc_rmdir_update_parent_dir_lmdt 4399 <1> 4400 <1> ; EAX = Directory Entry Number of the long name last entry 4401 000091C3 E8091D0000 <1> call delete_longname 4402 <1> 4403 <1> loc_rmdir_update_parent_dir_lmdt: 4404 000091C8 E84D1C0000 <1> call update_parent_dir_lmdt 4405 <1> ;jc short loc_file_rw_cmd_failed 4406 <1> ; 29/12/2017 4407 <1> ;jc short loc_rmdir_unlink_error_retn 4408 <1> 4409 <1> loc_delete_sub_directory_ok: 4410 <1> ; 29/12/2017 4411 000091CD 31C0 <1> xor eax, eax ; 0 ; cf = 0 4412 000091CF C3 <1> retn 4413 <1> 4414 <1> delete_file: 4415 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 4416 <1> ; 29/02/2016 4417 <1> ; 28/02/2016 (TRDOS 386 = TRDOS v2.0) 4418 <1> ; 09/08/2010 (CMD_INTR.ASM, 'cmp_cmd_del') 4419 <1> ; 28/02/2010 4420 <1> 4421 <1> get_delfile_fchar: 4422 <1> ; esi = file name 4423 000091D0 803E20 <1> cmp byte [esi], 20h 4424 000091D3 7701 <1> ja short loc_delfile_parse_path_name 4425 <1> 4426 <1> loc_delfile_nofilename_retn: 4427 000091D5 C3 <1> retn 4428 <1> 4429 <1> loc_delfile_parse_path_name: 4430 000091D6 BF[16800100] <1> mov edi, FindFile_Drv 4431 000091DB E89E170000 <1> call parse_path_name 4432 <1> ;jc loc_cmd_failed 4433 <1> ; 28/07/2022 4434 000091E0 7305 <1> jnc short loc_delfile_check_filename_exists 4435 <1> loc_delfile_failed: 4436 000091E2 E96DF2FFFF <1> jmp loc_cmd_failed 4437 <1> 4438 <1> loc_delfile_check_filename_exists: 4439 000091E7 BE[58800100] <1> mov esi, FindFile_Name 4440 000091EC 803E20 <1> cmp byte [esi], 20h 4441 <1> ;jna loc_cmd_failed 4442 <1> ; 28/07/2022 4443 000091EF 76F1 <1> jna short loc_delfile_failed 4444 000091F1 8935[D4800100] <1> mov [DelFile_FNPointer], esi 4445 <1> 4446 <1> loc_delfile_drv: 4447 000091F7 8A15[16800100] <1> mov dl, [FindFile_Drv] 4448 000091FD 8A35[76770100] <1> mov dh, [Current_Drv] 4449 00009203 8835[D37E0100] <1> mov [RUN_CDRV], dh 4450 00009209 38F2 <1> cmp dl, dh 4451 0000920B 7407 <1> je short loc_delfile_change_directory 4452 <1> 4453 0000920D E8DEE4FFFF <1> call change_current_drive 4454 <1> ;jc loc_file_rw_cmd_failed 4455 <1> ; 28/07/2022 4456 <1> ;jnc short loc_delfile_change_directory 4457 <1> ;jmp loc_file_rw_cmd_failed 4458 00009212 721D <1> jc short loc_delfile_chdrv_failed 4459 <1> 4460 <1> loc_delfile_change_directory: 4461 00009214 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 4462 0000921B 7619 <1> jna short loc_delfile_find 4463 <1> 4464 0000921D FE05[8E2E0100] <1> inc byte [Restore_CDIR] 4465 00009223 BE[17800100] <1> mov esi, FindFile_Directory 4466 00009228 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 4467 0000922A E8BC110000 <1> call change_current_directory 4468 <1> ;jc loc_file_rw_cmd_failed 4469 <1> ; 28/07/2022 4470 0000922F 7305 <1> jnc short loc_delfile_chdir_ok 4471 <1> loc_delfile_chdrv_failed: 4472 <1> loc_delfile_fff_failed: 4473 00009231 E912FBFFFF <1> jmp loc_file_rw_cmd_failed 4474 <1> 4475 <1> loc_delfile_chdir_ok: ; 28/07/2022 4476 <1> 4477 <1> ;loc_delfile_change_prompt_dir_string: 4478 <1> ;call change_prompt_dir_string 4479 <1> 4480 <1> loc_delfile_find: 4481 <1> ;mov esi, FindFile_Name 4482 00009236 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 4483 0000923C 66B80018 <1> mov ax, 1800h ; Except volume label and dirs 4484 00009240 E835F7FFFF <1> call find_first_file 4485 <1> ;jc loc_file_rw_cmd_failed 4486 <1> ; 28/07/2022 4487 00009245 72EA <1> jc short loc_delfile_fff_failed 4488 <1> 4489 <1> loc_delfile_ambgfn_check: 4490 00009247 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 4491 0000924A 740A <1> jz short loc_delfile_found 4492 <1> 4493 <1> loc_file_not_found: 4494 <1> ;mov eax, 2 ; File not found sign 4495 <1> ; 28/07/2022 4496 0000924C 31C0 <1> xor eax, eax 4497 0000924E B002 <1> mov al, 2 4498 00009250 F9 <1> stc 4499 00009251 E9F2FAFFFF <1> jmp loc_file_rw_cmd_failed 4500 <1> 4501 <1> loc_delfile_found: 4502 00009256 80E307 <1> and bl, 07h ; Attributes 4503 <1> ;jnz loc_permission_denied 4504 <1> ; 28/07/2022 4505 00009259 7405 <1> jz short loc_delfile_attrb_ok 4506 0000925B E9F2FAFFFF <1> jmp loc_permission_denied 4507 <1> 4508 <1> loc_delfile_attrb_ok: ; 28/07/2022 4509 <1> 4510 <1> ;loc_delfile_found_save_lnel: 4511 <1> ; mov [DelFile_LNEL], bh ; Long name entry length (if > 0) 4512 <1> 4513 <1> loc_delfile_ask_for_delete: 4514 00009260 57 <1> push edi ; * (29/02/2016) 4515 <1> 4516 00009261 BE[66330100] <1> mov esi, Msg_DoYouWantDelete 4517 00009266 E84FDBFFFF <1> call print_msg 4518 0000926B 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 4519 00009271 E844DBFFFF <1> call print_msg 4520 00009276 BE[1A330100] <1> mov esi, Msg_YesNo 4521 0000927B E83ADBFFFF <1> call print_msg 4522 <1> 4523 <1> loc_delfile_ask_again: 4524 00009280 30E4 <1> xor ah, ah 4525 00009282 E88B7CFFFF <1> call int16h 4526 00009287 3C1B <1> cmp al, 1Bh 4527 <1> ;je short loc_do_not_delete_file 4528 00009289 744C <1> je short loc_delfile_y_n_escape ; 06/03/2016 4529 0000928B 24DF <1> and al, 0DFh 4530 0000928D A2[24330100] <1> mov [Y_N_nextline], al 4531 00009292 3C59 <1> cmp al, 'Y' 4532 00009294 7404 <1> je short loc_yes_delete_file 4533 00009296 3C4E <1> cmp al, 'N' 4534 00009298 75E6 <1> jne short loc_delfile_ask_again 4535 <1> 4536 <1> loc_do_not_delete_file: 4537 <1> loc_yes_delete_file: 4538 0000929A E8DCFBFFFF <1> call y_n_answer ; 29/12/2017 4539 0000929F 5F <1> pop edi ; * (29/02/2016) 4540 <1> ;cmp al, 'Y' ; 'yes' 4541 <1> ;cmc 4542 <1> ;jnc loc_file_rw_restore_retn 4543 000092A0 3C4E <1> cmp al, 'N' ; 'no' 4544 <1> ;je loc_file_rw_restore_retn 4545 <1> ; 28/07/2022 4546 000092A2 7505 <1> jne short loc_delete_file 4547 000092A4 E99FFAFFFF <1> jmp loc_file_rw_restore_retn 4548 <1> 4549 <1> loc_delete_file: 4550 000092A9 8A3D[16800100] <1> mov bh, [FindFile_Drv] 4551 <1> ;mov bl, [DelFile_LNEL] 4552 000092AF 8A1D[65800100] <1> mov bl, [FindFile_LongNameEntryLength] 4553 <1> ;mov cx, [DirBuff_EntryCounter] 4554 000092B5 668B0D[90800100] <1> mov cx, [FindFile_DirEntryNumber] 4555 <1> ; (*) EDI = Directory buffer entry offset/address 4556 000092BC E8E81D0000 <1> call remove_file ; (FILE.ASM, 'proc_delete_file') 4557 <1> ;jnc loc_print_deleted_message 4558 <1> ; 28/07/2022 4559 000092C1 7205 <1> jc short loc_delete_file_err1 4560 000092C3 E976FAFFFF <1> jmp loc_print_deleted_message 4561 <1> 4562 <1> loc_delete_file_err1: 4563 <1> ;cmp al, 05h 4564 000092C8 3C0B <1> cmp al, ERR_PERM_DENIED ; 29/12/2017 (5 -> 11) 4565 <1> ;je loc_permission_denied 4566 <1> ; 28/07/2022 4567 000092CA 7505 <1> jne short loc_delete_file_err2 4568 000092CC E981FAFFFF <1> jmp loc_permission_denied 4569 <1> loc_delete_file_err2: 4570 000092D1 F9 <1> stc 4571 000092D2 E971FAFFFF <1> jmp loc_file_rw_cmd_failed 4572 <1> 4573 <1> loc_delfile_y_n_escape: 4574 000092D7 B04E <1> mov al, 'N' ; 'no' 4575 000092D9 EBBF <1> jmp short loc_do_not_delete_file 4576 <1> 4577 <1> set_file_attributes: 4578 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 4579 <1> ; 26/09/2024 (TRDOS 386 v2.0.9) 4580 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 4581 <1> ; 06/03/2016 4582 <1> ; 04/03/2016 (TRDOS 386 = TRDOS v2.0) 4583 <1> ; 10/07/2010 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_attrib') 4584 <1> ; 23/05/2010 4585 <1> ; 17/12/2000 (P2000.ASM) 4586 <1> 4587 <1> ; esi = file or directory name 4588 <1> ;xor ax, ax 4589 <1> ; 28/07/2022 4590 000092DB 31C0 <1> xor eax, eax 4591 000092DD 66A3[B7330100] <1> mov [Attr_Chars], ax 4592 000092E3 A2[30810100] <1> mov [Attributes], al 4593 <1> 4594 <1> get_attrib_fchar: 4595 <1> ; esi = file name 4596 000092E8 8A06 <1> mov al, [esi] 4597 000092EA 3C20 <1> cmp al, 20h 4598 000092EC 7621 <1> jna short loc_attr_file_nofilename_retn 4599 <1> 4600 <1> loc_scan_attrib_params: 4601 000092EE 3C2D <1> cmp al, '-' 4602 <1> ;ja loc_attr_file_parse_path_name 4603 <1> ;je short loc_attr_space 4604 <1> ; 28/07/2022 4605 000092F0 7207 <1> jb short loc_sfa_1 4606 000092F2 740E <1> je short loc_attr_space 4607 000092F4 E911010000 <1> jmp loc_attr_file_parse_path_name 4608 <1> 4609 <1> loc_sfa_1: 4610 <1> ; 28/07/2022 4611 000092F9 3C2B <1> cmp al, '+' 4612 <1> ;jne loc_cmd_failed 4613 000092FB 7405 <1> je short loc_attr_space 4614 <1> loc_sfa_2: 4615 000092FD E952F1FFFF <1> jmp loc_cmd_failed 4616 <1> loc_attr_space: 4617 00009302 8A6601 <1> mov ah, [esi+1] 4618 00009305 80FC20 <1> cmp ah, 20h 4619 00009308 7706 <1> ja short pass_attr_space 4620 <1> ;jb loc_cmd_failed 4621 <1> ; 28/07/2022 4622 0000930A 72F1 <1> jb short loc_sfa_2 4623 0000930C 46 <1> inc esi 4624 0000930D EBF3 <1> jmp short loc_attr_space 4625 <1> 4626 <1> loc_attr_file_nofilename_retn: 4627 0000930F C3 <1> retn 4628 <1> 4629 <1> pass_attr_space: 4630 00009310 80E4DF <1> and ah, 0DFh 4631 00009313 80FC53 <1> cmp ah, 'S' 4632 <1> ;ja loc_cmd_failed 4633 <1> ; 28/07/2022 4634 00009316 77E5 <1> ja short loc_sfa_2 4635 00009318 7204 <1> jb short pass_attr_system 4636 0000931A B404 <1> mov ah, 04h ; System 4637 0000931C EB1D <1> jmp short pass_attr_archive 4638 <1> 4639 <1> pass_attr_system: 4640 0000931E 80FC48 <1> cmp ah, 'H' 4641 00009321 7706 <1> ja short pass_attr_hidden 4642 00009323 720F <1> jb short pass_attr_read_only 4643 00009325 B402 <1> mov ah, 02h ; Hidden 4644 00009327 EB12 <1> jmp short pass_attr_archive 4645 <1> 4646 <1> pass_attr_hidden: 4647 00009329 80FC52 <1> cmp ah, 'R' 4648 <1> ;ja loc_cmd_failed 4649 <1> ; 28/07/2022 4650 0000932C 77CF <1> ja short loc_sfa_2 4651 0000932E 7204 <1> jb short pass_attr_read_only ; Read only 4652 00009330 B401 <1> mov ah, 01h 4653 00009332 EB07 <1> jmp short pass_attr_archive 4654 <1> 4655 <1> pass_attr_read_only: 4656 00009334 80FC41 <1> cmp ah, 'A' 4657 00009337 753B <1> jne short loc_chk_attr_enter 4658 00009339 B420 <1> mov ah, 20h ; Archive 4659 <1> 4660 <1> pass_attr_archive: 4661 0000933B 3C2D <1> cmp al, '-' 4662 0000933D 7508 <1> jne short pass_reducing_attributes 4663 0000933F 0825[B7330100] <1> or [Attr_Chars], ah 4664 00009345 EB06 <1> jmp short loc_change_attributes_inc 4665 <1> 4666 <1> pass_reducing_attributes: 4667 00009347 0825[B8330100] <1> or [Attr_Chars+1], ah 4668 <1> 4669 <1> loc_change_attributes_inc: 4670 0000934D 46 <1> inc esi 4671 0000934E 8A6601 <1> mov ah, [esi+1] 4672 00009351 80FC20 <1> cmp ah, 20h 4673 00009354 7228 <1> jb short pass_change_attr 4674 00009356 74F5 <1> je short loc_change_attributes_inc 4675 00009358 80FC2D <1> cmp ah, '-' 4676 0000935B 770D <1> ja short loc_chk_next_attr_char1 4677 0000935D 7405 <1> je short loc_chk_next_attr_char0 4678 0000935F 80FC2B <1> cmp ah, '+' 4679 00009362 7506 <1> jne short loc_chk_next_attr_char1 4680 <1> 4681 <1> loc_chk_next_attr_char0: 4682 00009364 46 <1> inc esi 4683 00009365 668B06 <1> mov ax, [esi] 4684 00009368 EBA6 <1> jmp short pass_attr_space 4685 <1> 4686 <1> loc_chk_next_attr_char1: 4687 0000936A 803E2D <1> cmp byte [esi], '-' 4688 0000936D 77A1 <1> ja short pass_attr_space 4689 0000936F E989000000 <1> jmp loc_attr_file_check_fname_fchar 4690 <1> 4691 <1> loc_chk_attr_enter: 4692 00009374 80FC0D <1> cmp ah, 0Dh 4693 <1> ;jne loc_cmd_failed 4694 <1> ; 28/07/202 4695 00009377 7405 <1> je short pass_change_attr 4696 00009379 E9D6F0FFFF <1> jmp loc_cmd_failed 4697 <1> 4698 <1> pass_change_attr: 4699 0000937E A0[B7330100] <1> mov al, [Attr_Chars] 4700 00009383 F6D0 <1> not al 4701 00009385 2005[30810100] <1> and [Attributes], al 4702 0000938B A0[B8330100] <1> mov al, [Attr_Chars+1] 4703 00009390 0805[30810100] <1> or [Attributes], al 4704 <1> 4705 <1> loc_show_attributes: 4706 00009396 BE[17390100] <1> mov esi, nextline 4707 0000939B E81ADAFFFF <1> call print_msg 4708 <1> 4709 <1> loc_show_attributes_no_nextline: 4710 000093A0 C705[B7330100]4E4F- <1> mov dword [Attr_Chars], 'NORM' 4710 000093A8 524D <1> 4711 000093AA 66C705[BB330100]41- <1> mov word [Attr_Chars+4], 'AL' 4711 000093B2 4C <1> 4712 000093B3 BE[B7330100] <1> mov esi, Attr_Chars 4713 000093B8 A0[30810100] <1> mov al, [Attributes] 4714 000093BD A804 <1> test al, 04h 4715 000093BF 7406 <1> jz short pass_put_attr_s 4716 000093C1 66C7065300 <1> mov word [esi], 0053h ; S 4717 000093C6 46 <1> inc esi 4718 <1> 4719 <1> pass_put_attr_s: 4720 000093C7 A802 <1> test al, 02h 4721 000093C9 7406 <1> jz short pass_put_attr_h 4722 000093CB 66C7064800 <1> mov word [esi], 0048h ; H 4723 000093D0 46 <1> inc esi 4724 <1> 4725 <1> pass_put_attr_h: 4726 000093D1 A801 <1> test al, 01h 4727 000093D3 7406 <1> jz short pass_put_attr_r 4728 000093D5 66C7065200 <1> mov word [esi], 0052h ; R 4729 000093DA 46 <1> inc esi 4730 <1> 4731 <1> pass_put_attr_r: 4732 000093DB 3C20 <1> cmp al, 20h 4733 000093DD 7205 <1> jb short pass_put_attr_a 4734 000093DF 66C7064100 <1> mov word [esi], 0041h ; A 4735 <1> 4736 <1> pass_put_attr_a: 4737 000093E4 BE[AA330100] <1> mov esi, Str_Attributes 4738 000093E9 E8CCD9FFFF <1> call print_msg 4739 000093EE BE[17390100] <1> mov esi, nextline 4740 000093F3 E8C2D9FFFF <1> call print_msg 4741 000093F8 E94BF9FFFF <1> jmp loc_file_rw_restore_retn 4742 <1> 4743 <1> loc_attr_file_check_fname_fchar: 4744 000093FD 46 <1> inc esi 4745 000093FE 803E20 <1> cmp byte [esi], 20h 4746 00009401 74FA <1> je short loc_attr_file_check_fname_fchar 4747 <1> ;jb pass_change_attr 4748 <1> ; 28/07/2022 4749 00009403 7705 <1> ja short loc_attr_file_parse_path_name 4750 00009405 E974FFFFFF <1> jmp pass_change_attr 4751 <1> 4752 <1> loc_attr_file_parse_path_name: 4753 0000940A BF[16800100] <1> mov edi, FindFile_Drv 4754 0000940F E86A150000 <1> call parse_path_name 4755 <1> ;jc loc_cmd_failed 4756 <1> ; 28/07/2022 4757 00009414 7305 <1> jnc short loc_attr_file_check_filename_exists 4758 <1> loc_sfa_3: 4759 00009416 E939F0FFFF <1> jmp loc_cmd_failed 4760 <1> 4761 <1> loc_attr_file_check_filename_exists: 4762 0000941B BE[58800100] <1> mov esi, FindFile_Name 4763 00009420 803E20 <1> cmp byte [esi], 20h 4764 <1> ;jna loc_cmd_failed 4765 <1> ; 28/07/2022 4766 00009423 76F1 <1> jna short loc_sfa_3 4767 00009425 8935[D4800100] <1> mov [DelFile_FNPointer], esi 4768 <1> 4769 <1> loc_attr_file_drv: 4770 0000942B 8A35[76770100] <1> mov dh, [Current_Drv] 4771 00009431 8835[D37E0100] <1> mov [RUN_CDRV], dh 4772 <1> 4773 00009437 8A15[16800100] <1> mov dl, [FindFile_Drv] 4774 0000943D 38F2 <1> cmp dl, dh 4775 0000943F 7407 <1> je short loc_attr_file_change_directory 4776 <1> 4777 00009441 E8AAE2FFFF <1> call change_current_drive 4778 <1> ;jc loc_file_rw_cmd_failed 4779 <1> ; 28/07/2022 4780 00009446 722E <1> jc short loc_sfa_4 4781 <1> 4782 <1> loc_attr_file_change_directory: 4783 00009448 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 4784 0000944F 7614 <1> jna short loc_attr_file_find 4785 <1> 4786 00009451 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 4787 <1> 4788 00009457 BE[17800100] <1> mov esi, FindFile_Directory 4789 0000945C 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 4790 0000945E E8880F0000 <1> call change_current_directory 4791 <1> ;jc loc_file_rw_cmd_failed 4792 <1> ; 28/07/2022 4793 00009463 7211 <1> jc short loc_sfa_4 4794 <1> 4795 <1> ;loc_attr_file_change_prompt_dir_string: 4796 <1> ;call change_prompt_dir_string 4797 <1> 4798 <1> loc_attr_file_find: 4799 <1> ;mov esi, FindFile_Name 4800 00009465 8B35[D4800100] <1> mov esi, [DelFile_FNPointer] 4801 0000946B 66B80008 <1> mov ax, 0800h ; Except volume labels 4802 0000946F E806F5FFFF <1> call find_first_file 4803 <1> ;jc loc_file_rw_cmd_failed 4804 <1> ; 28/07/2022 4805 00009474 7305 <1> jnc short loc_attr_file_ambgfn_check 4806 <1> loc_sfa_4: 4807 00009476 E9CDF8FFFF <1> jmp loc_file_rw_cmd_failed 4808 <1> 4809 <1> loc_attr_file_ambgfn_check: 4810 0000947B 6609D2 <1> or dx, dx ; Ambiguous filename chars used sign (DX>0) 4811 <1> ; (Note: It was BX in TRDOS v1) 4812 <1> ;;jz short loc_attr_file_found 4813 <1> ;jnz loc_file_not_found ; 06/03/2016 4814 <1> ; 28/07/2022 4815 0000947E 7405 <1> jz short loc_attr_file_found 4816 00009480 E9C7FDFFFF <1> jmp loc_file_not_found 4817 <1> 4818 <1> ;mov eax, 2 ; File not found sign 4819 <1> ;stc 4820 <1> ;jmp loc_file_rw_cmd_failed 4821 <1> 4822 <1> loc_attr_file_found: 4823 <1> ; EDI = Directory buffer entry offset/address 4824 <1> ; BL = File (or Directory) Attributes 4825 <1> ; (Note: It was 'CL' in TRDOS v1) 4826 <1> ; mov bl, [EDI+0Bh] 4827 <1> 4828 00009485 66833D[B7330100]00 <1> cmp word [Attr_Chars], 0 4829 0000948D 770B <1> ja short loc_attr_file_change_attributes 4830 0000948F 881D[30810100] <1> mov [Attributes], bl 4831 00009495 E9FCFEFFFF <1> jmp loc_show_attributes 4832 <1> 4833 <1> loc_attr_file_change_attributes: 4834 0000949A A0[B7330100] <1> mov al, [Attr_Chars] 4835 0000949F F6D0 <1> not al 4836 000094A1 20C3 <1> and bl, al 4837 000094A3 A0[B8330100] <1> mov al, [Attr_Chars+1] 4838 000094A8 08C3 <1> or bl, al 4839 <1> 4840 <1> ; 19/12/2025 4841 <1> ;cmp word [edi+DirEntry_NTRes], 01A1h ; Singlix FS 4842 <1> ;je short loc_attr_file_fs_check 4843 <1> 4844 000094AA 881D[30810100] <1> mov [Attributes], bl 4845 000094B0 885F0B <1> mov [edi+0Bh], bl ; Attributes (New!) 4846 <1> 4847 <1> ; 04/03/2016 4848 <1> ; TRDOS v1 has a bug here! it does not set 4849 <1> ; 'DirBuff_ValidData' to 2; as result of this bug, 4850 <1> ; 'save_directory_buffer' would not save the new attributes ! 4851 <1> 4852 000094B3 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 4853 <1> 4854 000094BA E8D2180000 <1> call save_directory_buffer 4855 <1> ;jc loc_file_rw_cmd_failed 4856 <1> ;jmp short loc_print_attr_changed_message 4857 <1> ; 28/07/2022 4858 000094BF 7305 <1> jnc short loc_print_attr_changed_message 4859 <1> loc_sfa_5: 4860 000094C1 E982F8FFFF <1> jmp loc_file_rw_cmd_failed 4861 <1> 4862 <1> ; 19/12/2025 4863 <1> %if 0 4864 <1> loc_attr_file_fs_check: 4865 <1> sub eax, eax 4866 <1> mov ah, [DirBuff_DRV] 4867 <1> ; 26/09/2024 (BugFix) 4868 <1> sub ah, 'A' 4869 <1> mov esi, Logical_DOSDisks 4870 <1> add esi, eax 4871 <1> cmp byte [esi+LD_FSType], 0A1h 4872 <1> jnc short loc_attr_file_change_fs_file_attributes 4873 <1> ; 29/12/2017 (0Dh -> 29) 4874 <1> mov ax, 29 ; Invalid Data 4875 <1> jmp loc_file_rw_cmd_failed 4876 <1> 4877 <1> loc_attr_file_change_fs_file_attributes: 4878 <1> ; BL = New MS-DOS File Attributes 4879 <1> mov al, bl ; File/Directory Attributes 4880 <1> xor ah, ah ; Attributes in MS-DOS format sign 4881 <1> call change_fs_file_attributes 4882 <1> ;jc loc_file_rw_cmd_failed 4883 <1> ; 28/07/2022 4884 <1> jc short loc_sfa_5 4885 <1> 4886 <1> mov [Attributes], bl 4887 <1> %endif 4888 <1> 4889 <1> loc_print_attr_changed_message: 4890 000094C6 BE[A5330100] <1> mov esi, Msg_New 4891 000094CB E8EAD8FFFF <1> call print_msg 4892 000094D0 E9CBFEFFFF <1> jmp loc_show_attributes_no_nextline 4893 <1> 4894 <1> rename_file: 4895 <1> ; 25/07/2025 (BugFix) 4896 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 4897 <1> ; 13/11/2017 4898 <1> ; 06/11/2016 4899 <1> ; 05/11/2016 4900 <1> ; 16/10/2016 4901 <1> ; 08/03/2016 4902 <1> ; 06/03/2016 (TRDOS 386 = TRDOS v2.0) 4903 <1> ; 20/11/2010 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_rename') 4904 <1> ; 16/11/2010 4905 <1> 4906 <1> get_rename_source_fchar: 4907 <1> ; esi = file name 4908 000094D5 803E20 <1> cmp byte [esi], 20h 4909 000094D8 7613 <1> jna short loc_rename_nofilename_retn 4910 <1> 4911 000094DA 8935[58810100] <1> mov [SourceFilePath], esi 4912 <1> 4913 <1> rename_scan_source_file: 4914 000094E0 46 <1> inc esi 4915 000094E1 803E20 <1> cmp byte [esi], 20h 4916 000094E4 7408 <1> je short rename_scan_destination_file_1 4917 <1> ;;jb short loc_rename_nofilename_retn 4918 <1> ;jb loc_cmd_failed 4919 <1> ;jmp short rename_scan_source_file 4920 <1> ; 28/07/2022 4921 000094E6 77F8 <1> ja short rename_scan_source_file 4922 <1> loc_rename_failed: 4923 000094E8 E967EFFFFF <1> jmp loc_cmd_failed 4924 <1> 4925 <1> loc_rename_nofilename_retn: ; 08/03/2016 4926 000094ED C3 <1> retn 4927 <1> 4928 <1> rename_scan_destination_file_1: 4929 000094EE C60600 <1> mov byte [esi], 0 4930 <1> 4931 <1> rename_scan_destination_file_2: 4932 000094F1 46 <1> inc esi 4933 000094F2 803E20 <1> cmp byte [esi], 20h 4934 000094F5 74FA <1> je short rename_scan_destination_file_2 4935 <1> ;;jb short loc_rename_nofilename_retn 4936 <1> ;jb loc_cmd_failed 4937 <1> ; 28/07/2022 4938 000094F7 72EF <1> jb short loc_rename_failed 4939 <1> 4940 000094F9 8935[5C810100] <1> mov [DestinationFilePath], esi 4941 <1> 4942 <1> rename_scan_destination_file_3: 4943 000094FF 46 <1> inc esi 4944 00009500 803E20 <1> cmp byte [esi], 20h 4945 00009503 77FA <1> ja short rename_scan_destination_file_3 4946 <1> 4947 00009505 C60600 <1> mov byte [esi], 0 4948 <1> 4949 <1> loc_rename_save_current_drive: 4950 00009508 8A35[76770100] <1> mov dh, [Current_Drv] 4951 0000950E 8835[D37E0100] <1> mov byte [RUN_CDRV], dh 4952 <1> 4953 <1> loc_rename_sf_parse_path_name: 4954 00009514 8B35[58810100] <1> mov esi, [SourceFilePath] 4955 0000951A BF[16800100] <1> mov edi, FindFile_Drv 4956 0000951F E85A140000 <1> call parse_path_name 4957 <1> ;jc loc_cmd_failed 4958 <1> ; 28/07/2022 4959 00009524 72C2 <1> jc short loc_rename_failed 4960 <1> 4961 <1> loc_rename_sf_check_filename_exists: 4962 00009526 BE[58800100] <1> mov esi, FindFile_Name 4963 0000952B 803E20 <1> cmp byte [esi], 20h 4964 <1> ;jna loc_cmd_failed 4965 <1> ; 28/07/2022 4966 0000952E 76B8 <1> jna short loc_rename_failed 4967 <1> 4968 <1> ;mov [DelFile_FNPointer], esi 4969 <1> 4970 <1> loc_rename_sf_drv: 4971 <1> ;mov dh, [Current_Drv] 4972 <1> ;mov [RUN_CDRV], dh 4973 <1> 4974 00009530 8A15[16800100] <1> mov dl, [FindFile_Drv] 4975 00009536 38F2 <1> cmp dl, dh ; dh = [Current_Drv] 4976 00009538 7407 <1> je short rename_sf_change_directory 4977 <1> 4978 0000953A E8B1E1FFFF <1> call change_current_drive 4979 <1> ;jc loc_file_rw_cmd_failed 4980 <1> ; 28/07/2022 4981 0000953F 722D <1> jc short loc_rename_fff_failed 4982 <1> 4983 <1> rename_sf_change_directory: 4984 00009541 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 4985 00009548 7614 <1> jna short rename_sf_find 4986 <1> 4987 0000954A FE05[8E2E0100] <1> inc byte [Restore_CDIR] 4988 00009550 BE[17800100] <1> mov esi, FindFile_Directory 4989 00009555 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 4990 00009557 E88F0E0000 <1> call change_current_directory 4991 <1> ;jc loc_file_rw_cmd_failed 4992 <1> ; 28/07/2022 4993 0000955C 7210 <1> jc short loc_rename_fff_failed 4994 <1> 4995 <1> ;rename_sf_change_prompt_dir_string: 4996 <1> ;call change_prompt_dir_string 4997 <1> 4998 <1> rename_sf_find: 4999 <1> ;mov esi, [DelFile_FNPointer] 5000 0000955E BE[58800100] <1> mov esi, FindFile_Name 5001 <1> 5002 00009563 66B80008 <1> mov ax, 0800h ; Except volume labels 5003 00009567 E80EF4FFFF <1> call find_first_file 5004 <1> ;jc loc_file_rw_cmd_failed 5005 <1> ; 28/07/2022 5006 0000956C 7305 <1> jnc short loc_rename_sf_ambgfn_check 5007 <1> 5008 <1> loc_rename_fff_failed: 5009 0000956E E9D5F7FFFF <1> jmp loc_file_rw_cmd_failed 5010 <1> 5011 <1> loc_rename_sf_ambgfn_check: 5012 00009573 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 5013 <1> ; (Note: It was BX in TRDOS v1) 5014 <1> ;;jz short loc_rename_sf_found 5015 <1> ;jnz loc_file_not_found 5016 <1> ; 28/07/2022 5017 00009576 7405 <1> jz short loc_rename_sf_found 5018 00009578 E9CFFCFFFF <1> jmp loc_file_not_found 5019 <1> 5020 <1> ;mov eax, 2 ; File not found sign 5021 <1> ;stc 5022 <1> ;jmp loc_file_rw_cmd_failed 5023 <1> 5024 <1> loc_rename_sf_found: 5025 <1> ; EDI = Directory buffer entry offset/address 5026 <1> ; BL = File (or Directory) Attributes 5027 <1> ; (Note: It was 'CL' in TRDOS v1) 5028 <1> ; mov bl, [EDI+0Bh] 5029 <1> 5030 0000957D F6C307 <1> test bl, 07h ; Attributes, S-H-R 5031 <1> ;jnz loc_permission_denied 5032 <1> ; 28/07/2022 5033 00009580 7405 <1> jz short loc_rename_attrb_ok 5034 00009582 E9CBF7FFFF <1> jmp loc_permission_denied 5035 <1> 5036 <1> loc_rename_attrb_ok: 5037 00009587 BE[16800100] <1> mov esi, FindFile_Drv 5038 0000958C BF[60810100] <1> mov edi, SourceFile_Drv 5039 00009591 B920000000 <1> mov ecx, 32 5040 00009596 F3A5 <1> rep movsd 5041 <1> 5042 <1> loc_rename_df_parse_path_name: 5043 00009598 8B35[5C810100] <1> mov esi, [DestinationFilePath] 5044 0000959E BF[16800100] <1> mov edi, FindFile_Drv 5045 000095A3 E8D6130000 <1> call parse_path_name 5046 000095A8 7219 <1> jc short loc_rename_df_cmd_failed 5047 <1> 5048 <1> ;mov dh, [RUN_CDRV] 5049 000095AA 8A35[76770100] <1> mov dh, [Current_Drv] 5050 <1> 5051 <1> ; 'rename' command is valid only for same dos drive and same dir! 5052 <1> ; ('move' command must be used if source file and destination file 5053 <1> ; directories are not same!) 5054 000095B0 8A15[16800100] <1> mov dl, [FindFile_Drv] 5055 000095B6 38F2 <1> cmp dl, dh ; are source and destination drives different ?! 5056 000095B8 7509 <1> jne short loc_rename_df_cmd_failed ; yes! 5057 <1> 5058 <1> rename_df_check_dirname_exists: 5059 000095BA 803D[17800100]00 <1> cmp byte [FindFile_Directory], 0 5060 000095C1 760B <1> jna short rename_df_check_filename_exists 5061 <1> 5062 <1> ; different source file and destination file directories ! 5063 <1> loc_rename_df_cmd_failed: 5064 000095C3 B801000000 <1> mov eax, 1 ; TRDOS 'Bad command or file name' error 5065 000095C8 F9 <1> stc 5066 000095C9 E97AF7FFFF <1> jmp loc_file_rw_cmd_failed 5067 <1> 5068 <1> rename_df_check_filename_exists: 5069 000095CE BE[58800100] <1> mov esi, FindFile_Name 5070 000095D3 E801F7FFFF <1> call check_filename 5071 <1> ;jc loc_mkdir_invalid_dir_name_chars 5072 <1> ; 28/07/2022 5073 000095D8 7305 <1> jnc short loc_rename_file_name_ok 5074 000095DA E91BF8FFFF <1> jmp loc_mkdir_invalid_dir_name_chars 5075 <1> 5076 <1> loc_rename_file_name_ok: 5077 <1> ;mov [DelFile_FNPointer], esi 5078 <1> ;cmp byte [esi], 20h 5079 <1> ;ja short loc_rename_df_find 5080 <1> 5081 <1> ;mov dh, [Current_Drv] ; dh has not been changed 5082 <1> 5083 <1> rename_df_drv_check_writable: 5084 <1> ;movzx esi, dh 5085 <1> ;;movzx esi, byte [Current_Drv] 5086 <1> ;add esi, Logical_DOSDisks 5087 <1> ; 25/07/2025 (BugFix) 5088 000095DF 31C0 <1> xor eax, eax 5089 000095E1 88F4 <1> mov ah, dh 5090 000095E3 BE00010900 <1> mov esi, Logical_DOSDisks 5091 000095E8 01C6 <1> add esi, eax 5092 <1> 5093 000095EA 88F2 <1> mov dl, dh ; dl = [Current_Drv] 5094 000095EC 8A7601 <1> mov dh, [esi+LD_DiskType] 5095 <1> 5096 000095EF 80FE01 <1> cmp dh, 1 ; 0 = Invalid 5097 000095F2 7310 <1> jnb short rename_df_compare_sf_df_name 5098 <1> 5099 <1> ; 16/10/2016 (13h -> 30) 5100 000095F4 B81E000000 <1> mov eax, 30 ; 'Disk write-protected' error 5101 000095F9 8B1D[5C810100] <1> mov ebx, [DestinationFilePath] 5102 000095FF E944F7FFFF <1> jmp loc_file_rw_cmd_failed 5103 <1> 5104 <1> rename_df_compare_sf_df_name: 5105 00009604 BE[58800100] <1> mov esi, FindFile_Name 5106 00009609 BF[A2810100] <1> mov edi, SourceFile_Name 5107 <1> ;mov ecx, 12 5108 <1> ; 28/07/2022 5109 0000960E 29C9 <1> sub ecx, ecx 5110 00009610 B10C <1> mov cl, 12 5111 <1> rename_df_compare_sf_df_name_next: 5112 00009612 AC <1> lodsb 5113 00009613 AE <1> scasb 5114 00009614 7506 <1> jne short loc_rename_df_find 5115 00009616 08C0 <1> or al, al 5116 00009618 74A9 <1> jz short loc_rename_df_cmd_failed 5117 0000961A E2F6 <1> loop rename_df_compare_sf_df_name_next 5118 <1> 5119 <1> loc_rename_df_find: 5120 <1> ;mov esi, [DelFile_FNPointer] 5121 0000961C BE[58800100] <1> mov esi, FindFile_Name 5122 <1> 5123 <1> ;xor ax, ax ; Any 5124 <1> ; 28/07/2022 5125 00009621 31C0 <1> xor eax, eax ; 0 ; Any 5126 00009623 E852F3FFFF <1> call find_first_file 5127 <1> ;;jnc short loc_rename_df_found 5128 <1> ;; 29/12/2017 5129 <1> ;jnc loc_permission_denied 5130 <1> ; 28/07/2022 5131 00009628 7205 <1> jc short loc_rename_df_check_error_code 5132 0000962A E923F7FFFF <1> jmp loc_permission_denied 5133 <1> 5134 <1> loc_rename_df_check_error_code: 5135 <1> ;cmp eax, 2 5136 0000962F 3C02 <1> cmp al, 2 ; Not found error 5137 00009631 7406 <1> je short rename_df_move_find_struct_to_dest 5138 00009633 F9 <1> stc 5139 00009634 E90FF7FFFF <1> jmp loc_file_rw_cmd_failed 5140 <1> 5141 <1> ;loc_rename_df_found: 5142 <1> ; 05/11/2016 5143 <1> ; Permission denied error 5144 <1> ;mov eax, ERR_PERM_DENIED ; 29/12/2017 5145 <1> ;stc 5146 <1> ;jmp loc_permission_denied ; 06/11/2016 5147 <1> 5148 <1> rename_df_move_find_struct_to_dest: 5149 00009639 BE[16800100] <1> mov esi, FindFile_Drv 5150 0000963E BF[E0810100] <1> mov edi, DestinationFile_Drv 5151 <1> ;mov ecx, 32 5152 <1> ; 28/07/2022 5153 00009643 29C9 <1> sub ecx, ecx 5154 00009645 B120 <1> mov cl, 32 5155 00009647 F3A5 <1> rep movsd 5156 <1> 5157 <1> loc_rename_df_process_q_sf: 5158 <1> ;mov ecx, 12 5159 00009649 B10C <1> mov cl, 12 5160 0000964B BE[A2810100] <1> mov esi, SourceFile_Name 5161 00009650 BF[E6330100] <1> mov edi, Rename_OldName 5162 <1> rename_df_process_q_nml_1_sf: 5163 00009655 AC <1> lodsb 5164 00009656 3C20 <1> cmp al, 20h 5165 00009658 7603 <1> jna short rename_df_process_q_nml_2_sf 5166 0000965A AA <1> stosb 5167 0000965B E2F8 <1> loop rename_df_process_q_nml_1_sf 5168 <1> 5169 <1> rename_df_process_q_nml_2_sf: 5170 0000965D C60700 <1> mov byte [edi], 0 5171 <1> 5172 <1> loc_rename_df_process_q_df: 5173 <1> ;mov ecx, 12 5174 00009660 B10C <1> mov cl, 12 5175 00009662 BE[22820100] <1> mov esi, DestinationFile_Name 5176 00009667 BF[F7330100] <1> mov edi, Rename_NewName 5177 <1> rename_df_process_q_nml_1_df: 5178 0000966C AC <1> lodsb 5179 0000966D 3C20 <1> cmp al, 20h 5180 0000966F 7603 <1> jna short loc_rename_df_process_q_nml_2_df 5181 00009671 AA <1> stosb 5182 00009672 E2F8 <1> loop rename_df_process_q_nml_1_df 5183 <1> 5184 <1> loc_rename_df_process_q_nml_2_df: 5185 00009674 C60700 <1> mov byte [edi], 0 5186 <1> 5187 <1> loc_rename_confirmation_question: 5188 00009677 BE[BE330100] <1> mov esi, Msg_DoYouWantRename 5189 0000967C E839D7FFFF <1> call print_msg 5190 <1> 5191 00009681 A0[BD810100] <1> mov al, [SourceFile_DirEntry+11] ; Attributes 5192 00009686 2410 <1> and al, 10h 5193 00009688 750C <1> jnz short rename_confirmation_question_dir 5194 <1> 5195 <1> rename_confirmation_question_file: 5196 0000968A BE[D5330100] <1> mov esi, Rename_File 5197 0000968F E826D7FFFF <1> call print_msg 5198 00009694 EB0A <1> jmp short rename_confirmation_question_as 5199 <1> 5200 <1> rename_confirmation_question_dir: 5201 00009696 BE[DB330100] <1> mov esi, Rename_Directory 5202 0000969B E81AD7FFFF <1> call print_msg 5203 <1> 5204 <1> rename_confirmation_question_as: 5205 000096A0 BE[E6330100] <1> mov esi, Rename_OldName 5206 000096A5 E810D7FFFF <1> call print_msg 5207 000096AA BE[F3330100] <1> mov esi, Msg_File_rename_as 5208 000096AF E806D7FFFF <1> call print_msg 5209 000096B4 BE[1A330100] <1> mov esi, Msg_YesNo 5210 000096B9 E8FCD6FFFF <1> call print_msg 5211 <1> 5212 <1> loc_rename_ask_again: 5213 000096BE 30E4 <1> xor ah, ah 5214 000096C0 E84D78FFFF <1> call int16h 5215 000096C5 3C1B <1> cmp al, 1Bh 5216 000096C7 740F <1> je short loc_do_not_rename_file 5217 000096C9 24DF <1> and al, 0DFh 5218 000096CB A2[24330100] <1> mov [Y_N_nextline], al 5219 000096D0 3C59 <1> cmp al, 'Y' 5220 000096D2 7404 <1> je short loc_yes_rename_file 5221 000096D4 3C4E <1> cmp al, 'N' 5222 000096D6 75E6 <1> jne short loc_rename_ask_again 5223 <1> 5224 <1> loc_do_not_rename_file: 5225 <1> loc_yes_rename_file: 5226 000096D8 E89EF7FFFF <1> call y_n_answer ; 29/12/2017 5227 <1> ;cmp al, 'Y' ; 'yes' 5228 <1> ;cmc 5229 <1> ;jnc loc_file_rw_restore_retn 5230 000096DD 3C4E <1> cmp al, 'N' ; 'no' 5231 <1> ;je loc_file_rw_restore_retn 5232 <1> ; 28/07/2022 5233 000096DF 7505 <1> jne short loc_rename_file_yes 5234 000096E1 E962F6FFFF <1> jmp loc_file_rw_restore_retn 5235 <1> 5236 <1> loc_rename_file_yes: ; 28/07/2022 5237 000096E6 BE[F7330100] <1> mov esi, Rename_NewName 5238 000096EB 668B0D[DA810100] <1> mov cx, [SourceFile_DirEntryNumber] 5239 000096F2 66A1[C6810100] <1> mov ax, [SourceFile_DirEntry+20] ; First Cluster, HW 5240 000096F8 C1E010 <1> shl eax, 16 ; 13/11/2017 5241 000096FB 66A1[CC810100] <1> mov ax, [SourceFile_DirEntry+26] ; First Cluster, LW 5242 <1> 5243 00009701 0FB61D[AF810100] <1> movzx ebx, byte [SourceFile_LongNameEntryLength] 5244 00009708 E8201A0000 <1> call rename_directory_entry 5245 0000970D E94FF7FFFF <1> jmp loc_rename_file_ok 5246 <1> ;loc_rename_file_ok: 5247 <1> ; jc loc_run_cmd_failed 5248 <1> ; mov esi, Msg_OK 5249 <1> ; call proc_printmsg 5250 <1> ; jmp loc_file_rw_restore_retn 5251 <1> 5252 <1> move_file: 5253 <1> ; 07/08/2022 5254 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 5255 <1> ; 11/03/2016 5256 <1> ; 09/03/2016 5257 <1> ; 08/03/2016 (TRDOS 386 = TRDOS v2.0) 5258 <1> ; 21/05/2011 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_move') 5259 <1> ; 23/04/2011 5260 <1> 5261 <1> get_move_source_fchar: 5262 <1> ; esi = file name 5263 00009712 803E20 <1> cmp byte [esi], 20h 5264 00009715 7613 <1> jna short loc_move_nofilename_retn 5265 <1> 5266 00009717 8935[58810100] <1> mov [SourceFilePath], esi 5267 <1> 5268 <1> move_scan_source_file: 5269 0000971D 46 <1> inc esi 5270 0000971E 803E20 <1> cmp byte [esi], 20h 5271 00009721 7408 <1> je short move_scan_destination_1 5272 <1> ;;jb short loc_move_nofilename_retn 5273 <1> ;jb loc_cmd_failed 5274 <1> ;jmp short move_scan_source_file 5275 <1> ; 28/07/2022 5276 00009723 77F8 <1> ja short move_scan_source_file 5277 <1> loc_move_failed: 5278 00009725 E92AEDFFFF <1> jmp loc_cmd_failed 5279 <1> 5280 <1> loc_move_nofilename_retn: 5281 0000972A C3 <1> retn 5282 <1> 5283 <1> move_scan_destination_1: 5284 0000972B C60600 <1> mov byte [esi], 0 5285 <1> 5286 <1> move_scan_destination_2: 5287 0000972E 46 <1> inc esi 5288 0000972F 803E20 <1> cmp byte [esi], 20h 5289 00009732 74FA <1> je short move_scan_destination_2 5290 <1> ;;jb short loc_move_nofilename_retn 5291 <1> ;jb loc_cmd_failed 5292 <1> ; 28/07/2022 5293 00009734 72EF <1> jb short loc_move_failed 5294 <1> 5295 00009736 8935[5C810100] <1> mov [DestinationFilePath], esi 5296 <1> 5297 <1> move_scan_destination_3: 5298 0000973C 46 <1> inc esi 5299 0000973D 803E20 <1> cmp byte [esi], 20h 5300 00009740 77FA <1> ja short move_scan_destination_3 5301 00009742 C60600 <1> mov byte [esi], 0 5302 <1> 5303 <1> loc_move_scan_destination_OK: 5304 00009745 8B35[58810100] <1> mov esi, [SourceFilePath] 5305 0000974B 8B3D[5C810100] <1> mov edi, [DestinationFilePath] 5306 <1> 5307 00009751 B001 <1> mov al, 1 ; move procedure Phase 1 5308 00009753 E8411A0000 <1> call move_source_file_to_destination_file 5309 00009758 7325 <1> jnc short move_source_file_to_destination_question 5310 <1> 5311 <1> loc_move_cmd_failed_1: 5312 0000975A 08C0 <1> or al, al 5313 <1> ;jz loc_cmd_failed 5314 <1> ; 28/07/2022 5315 0000975C 74C7 <1> jz short loc_move_failed 5316 <1> 5317 0000975E 3C11 <1> cmp al, 11h 5318 00009760 7409 <1> je short loc_msg_not_same_device 5319 <1> ;cmp al, 05h 5320 <1> ;cmp al, ERR_PERM_DENIED ; 29/12/2017 5321 <1> ;jne loc_run_cmd_failed 5322 <1> ;jmp loc_permission_denied 5323 00009762 3C0B <1> cmp al, ERR_PERM_DENIED 5324 <1> ;je loc_permission_denied 5325 <1> ; 28/07/2022 5326 00009764 7414 <1> je short loc_move_perm_denied 5327 00009766 E914EDFFFF <1> jmp loc_run_cmd_failed 5328 <1> 5329 <1> ;mov esi, Msg_Permission_denied 5330 <1> ;call print_msg 5331 <1> ;jmp loc_file_rw_restore_retn 5332 <1> 5333 <1> loc_msg_not_same_device: 5334 0000976B BE[04340100] <1> mov esi, msg_not_same_drv 5335 00009770 E845D6FFFF <1> call print_msg 5336 00009775 E9CEF5FFFF <1> jmp loc_file_rw_restore_retn 5337 <1> 5338 <1> ; 28/07/2022 5339 <1> loc_move_perm_denied: 5340 0000977A E9D3F5FFFF <1> jmp loc_permission_denied 5341 <1> 5342 <1> move_source_file_to_destination_question: 5343 0000977F A0[60810100] <1> mov al, [SourceFile_Drv] 5344 00009784 0441 <1> add al, 'A' 5345 00009786 A2[66340100] <1> mov [msg_source_file_drv], al 5346 0000978B A0[E0810100] <1> mov al, [DestinationFile_Drv] 5347 00009790 0441 <1> add al, 'A' 5348 00009792 A2[85340100] <1> mov [msg_destination_file_drv], al 5349 <1> 5350 00009797 57 <1> push edi ; * 5351 <1> 5352 00009798 BE[4A340100] <1> mov esi, msg_source_file 5353 0000979D E818D6FFFF <1> call print_msg 5354 000097A2 BE[61810100] <1> mov esi, SourceFile_Directory 5355 000097A7 803E20 <1> cmp byte [esi], 20h 5356 000097AA 7605 <1> jna short msftdfq_sfn 5357 000097AC E809D6FFFF <1> call print_msg 5358 <1> msftdfq_sfn: 5359 000097B1 BE[A2810100] <1> mov esi, SourceFile_Name 5360 000097B6 E8FFD5FFFF <1> call print_msg 5361 000097BB BE[69340100] <1> mov esi, msg_destination_file 5362 000097C0 E8F5D5FFFF <1> call print_msg 5363 000097C5 BE[E1810100] <1> mov esi, DestinationFile_Directory 5364 000097CA 803E20 <1> cmp byte [esi], 20h 5365 000097CD 7605 <1> jna short msftdfq_dfn 5366 000097CF E8E6D5FFFF <1> call print_msg 5367 <1> msftdfq_dfn: 5368 000097D4 BE[22820100] <1> mov esi, DestinationFile_Name 5369 000097D9 E8DCD5FFFF <1> call print_msg 5370 000097DE BE[88340100] <1> mov esi, msg_copy_nextline 5371 000097E3 E8D2D5FFFF <1> call print_msg 5372 000097E8 BE[88340100] <1> mov esi, msg_copy_nextline 5373 000097ED E8C8D5FFFF <1> call print_msg 5374 <1> 5375 <1> loc_move_ask_for_new_file_yes_no: 5376 000097F2 BE[16340100] <1> mov esi, Msg_DoYouWantMoveFile 5377 000097F7 E8BED5FFFF <1> call print_msg 5378 000097FC BE[1A330100] <1> mov esi, Msg_YesNo 5379 00009801 E8B4D5FFFF <1> call print_msg 5380 <1> loc_move_ask_for_new_file_again: 5381 00009806 30E4 <1> xor ah, ah 5382 00009808 E80577FFFF <1> call int16h 5383 0000980D 3C1B <1> cmp al, 1Bh 5384 <1> ;je short loc_do_not_move_file 5385 0000980F 743F <1> je short loc_move_y_n_escape 5386 00009811 24DF <1> and al, 0DFh 5387 00009813 A2[24330100] <1> mov [Y_N_nextline], al 5388 00009818 3C59 <1> cmp al, 'Y' 5389 0000981A 7404 <1> je short loc_yes_move_file 5390 0000981C 3C4E <1> cmp al, 'N' 5391 0000981E 75E6 <1> jne short loc_move_ask_for_new_file_again 5392 <1> 5393 <1> loc_do_not_move_file: 5394 <1> loc_yes_move_file: 5395 00009820 E856F6FFFF <1> call y_n_answer ; 29/12/2017 5396 00009825 5F <1> pop edi ; * 5397 <1> ;cmp al, 'Y' ; 'yes' 5398 <1> ;cmc 5399 <1> ;jnc loc_file_rw_restore_retn 5400 00009826 3C4E <1> cmp al, 'N' ; 'no' 5401 <1> ;je loc_file_rw_restore_retn 5402 <1> ; 28/07/2022 5403 00009828 7421 <1> je short loc_move_rw_restore_retn 5404 <1> 5405 <1> loc_move_yes_move_file: 5406 0000982A B002 <1> mov al, 2 ; move procedure Phase 2 5407 0000982C E868190000 <1> call move_source_file_to_destination_file 5408 <1> ;;jc short loc_move_cmd_failed_2 5409 <1> ;jnc move_source_file_to_dest_OK 5410 <1> ; 28/07/2022 5411 00009831 7205 <1> jc short loc_move_cmd_failed_2 5412 <1> ; 07/08/2022 5413 00009833 E930F6FFFF <1> jmp move_source_file_to_dest_OK 5414 <1> 5415 <1> ;move_source_file_to_destination_OK: 5416 <1> ; mov esi, Msg_OK 5417 <1> ; call print_msg 5418 <1> ; jmp loc_file_rw_restore_retn 5419 <1> 5420 <1> loc_move_cmd_failed_2: 5421 00009838 3C27 <1> cmp al, 27h 5422 <1> ;jne loc_run_cmd_failed 5423 <1> ; 28/07/2022 5424 0000983A 7405 <1> je short loc_move_ids_err 5425 0000983C E93EECFFFF <1> jmp loc_run_cmd_failed 5426 <1> 5427 <1> loc_move_ids_err: ; 28/07/2022 5428 00009841 BE[2F340100] <1> mov esi, msg_insufficient_disk_space 5429 00009846 E86FD5FFFF <1> call print_msg 5430 <1> 5431 <1> loc_move_rw_restore_retn: ; 28/07/2022 5432 0000984B E9F8F4FFFF <1> jmp loc_file_rw_restore_retn 5433 <1> 5434 <1> loc_move_y_n_escape: 5435 00009850 B04E <1> mov al, 'N' ; 'no' 5436 00009852 EBCC <1> jmp short loc_do_not_move_file 5437 <1> 5438 <1> copy_file: 5439 <1> ; 31/08/2024 - TRDOS 386 v2.0.9 5440 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 5441 <1> ; 15/10/2016 5442 <1> ; 24/03/2016 5443 <1> ; 21/03/2016 5444 <1> ; 15/03/2016 (TRDOS 386 = TRDOS v2.0) 5445 <1> ; 21/05/2011 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_copy') 5446 <1> ; 01/08/2010 5447 <1> 5448 <1> get_copy_source_fchar: 5449 <1> ; esi = file name 5450 00009854 803E20 <1> cmp byte [esi], 20h 5451 00009857 7613 <1> jna short loc_copy_nofilename_retn 5452 <1> 5453 00009859 8935[58810100] <1> mov [SourceFilePath], esi 5454 <1> 5455 <1> copy_scan_source_file: 5456 0000985F 46 <1> inc esi 5457 00009860 803E20 <1> cmp byte [esi], 20h 5458 00009863 7408 <1> je short copy_scan_destination_1 5459 <1> ;;jb short loc_copy_nofilename_retn 5460 <1> ;jb loc_cmd_failed 5461 <1> ;jmp short copy_scan_source_file 5462 <1> ; 25/07/2022 5463 00009865 73F8 <1> jnb short copy_scan_source_file 5464 <1> copy_scan_destination_0: 5465 00009867 E9E8EBFFFF <1> jmp loc_cmd_failed 5466 <1> 5467 <1> loc_copy_nofilename_retn: 5468 0000986C C3 <1> retn 5469 <1> 5470 <1> copy_scan_destination_1: 5471 0000986D C60600 <1> mov byte [esi], 0 5472 <1> 5473 <1> copy_scan_destination_2: 5474 00009870 46 <1> inc esi 5475 00009871 803E20 <1> cmp byte [esi], 20h 5476 00009874 74FA <1> je short copy_scan_destination_2 5477 <1> ;;jb short loc_copy_nofilename_retn 5478 <1> ;jb loc_cmd_failed 5479 <1> ; 25/07/2022 5480 00009876 72EF <1> jb short copy_scan_destination_0 5481 <1> 5482 00009878 8935[5C810100] <1> mov [DestinationFilePath], esi 5483 <1> 5484 <1> copy_scan_destination_3: 5485 0000987E 46 <1> inc esi 5486 0000987F 803E20 <1> cmp byte [esi], 20h 5487 00009882 77FA <1> ja short copy_scan_destination_3 5488 00009884 C60600 <1> mov byte [esi], 0 5489 <1> 5490 <1> loc_copy_save_current_drive: 5491 00009887 8A35[76770100] <1> mov dh, [Current_Drv] 5492 0000988D 8835[D37E0100] <1> mov [RUN_CDRV], dh 5493 <1> 5494 <1> copy_source_file_to_destination_phase_1: 5495 00009893 8B35[58810100] <1> mov esi, [SourceFilePath] 5496 00009899 8B3D[5C810100] <1> mov edi, [DestinationFilePath] 5497 <1> 5498 0000989F B001 <1> mov al, 1 ; copy procedure Phase 1 5499 000098A1 E8571B0000 <1> call copy_source_file_to_destination_file 5500 000098A6 7327 <1> jnc short copy_source_file_to_destination_question 5501 <1> 5502 <1> loc_copy_cmd_failed_1: 5503 <1> ; 18/03/2016 (restore current drive and directory) 5504 000098A8 08C0 <1> or al, al 5505 000098AA 7507 <1> jnz short loc_copy_cmd_failed_2 5506 <1> 5507 000098AC FEC0 <1> inc al ; mov al, 1 ; Bad command or file name ! 5508 <1> loc_copy_cmd_failed_3: ; 25/07/2022 5509 000098AE E9CCEBFFFF <1> jmp loc_run_cmd_failed 5510 <1> 5511 <1> loc_copy_cmd_failed_2: 5512 000098B3 3C27 <1> cmp al, 27h ; Insufficient disk space 5513 000098B5 7409 <1> je short loc_file_write_insuff_disk_space_msg 5514 <1> 5515 <1> ; 29/12/2017 5516 <1> ;cmp al, 05h 5517 000098B7 3C0B <1> cmp al, ERR_PERM_DENIED 5518 <1> ;jne loc_run_cmd_failed 5519 <1> ; 25/07/2022 5520 000098B9 75F3 <1> jne short loc_copy_cmd_failed_3 5521 <1> 5522 000098BB E992F4FFFF <1> jmp loc_permission_denied 5523 <1> 5524 <1> loc_file_write_insuff_disk_space_msg: 5525 000098C0 BE[2F340100] <1> mov esi, msg_insufficient_disk_space 5526 000098C5 E8F0D4FFFF <1> call print_msg 5527 000098CA E979F4FFFF <1> jmp loc_file_rw_restore_retn 5528 <1> 5529 <1> copy_source_file_to_destination_question: 5530 000098CF 57 <1> push edi ; * 5531 <1> 5532 <1> ; dh = source file attributes 5533 <1> ; dl > 0 -> destination file found 5534 000098D0 20D2 <1> and dl, dl 5535 000098D2 7446 <1> jz short copy_source_file_to_destination_pass_owrq 5536 <1> 5537 <1> loc_copy_ask_for_owr_yes_no: 5538 000098D4 BE[8B340100] <1> mov esi, Msg_DoYouWantOverWriteFile 5539 000098D9 E8DCD4FFFF <1> call print_msg 5540 000098DE BE[22820100] <1> mov esi, DestinationFile_Name 5541 000098E3 E8D2D4FFFF <1> call print_msg 5542 000098E8 BE[1A330100] <1> mov esi, Msg_YesNo 5543 000098ED E8C8D4FFFF <1> call print_msg 5544 <1> 5545 <1> loc_copy_ask_for_owr_again: 5546 000098F2 30E4 <1> xor ah, ah 5547 000098F4 E81976FFFF <1> call int16h 5548 000098F9 3C1B <1> cmp al, 1Bh 5549 <1> ;je loc_do_not_copy_file 5550 000098FB 7419 <1> je short loc_copy_y_n_escape 5551 000098FD 24DF <1> and al, 0DFh 5552 000098FF A2[24330100] <1> mov [Y_N_nextline], al 5553 00009904 3C59 <1> cmp al, 'Y' 5554 <1> ;je loc_yes_copy_file 5555 <1> ; 25/07/2022 5556 00009906 7505 <1> jne short loc_copy_ask_for_owr_n 5557 00009908 E9AD000000 <1> jmp loc_yes_copy_file 5558 <1> 5559 <1> loc_copy_ask_for_owr_n: ; 25/07/2022 5560 0000990D 3C4E <1> cmp al, 'N' 5561 <1> ;je loc_do_not_copy_file 5562 <1> ;jmp short loc_copy_ask_for_owr_again 5563 <1> ; 25/07/2022 5564 0000990F 75E1 <1> jne short loc_copy_ask_for_owr_again 5565 <1> loc_do_not_copy_file_j: 5566 00009911 E9A4000000 <1> jmp loc_do_not_copy_file 5567 <1> 5568 <1> loc_copy_y_n_escape: 5569 00009916 B04E <1> mov al, 'N' ; 'no' 5570 <1> ;jmp loc_do_not_copy_file 5571 <1> ; 25/07/2022 5572 00009918 EBF7 <1> jmp short loc_do_not_copy_file_j 5573 <1> 5574 <1> copy_source_file_to_destination_pass_owrq: 5575 0000991A A0[60810100] <1> mov al, [SourceFile_Drv] 5576 0000991F 0441 <1> add al, 'A' 5577 00009921 A2[66340100] <1> mov [msg_source_file_drv], al 5578 00009926 A0[E0810100] <1> mov al, [DestinationFile_Drv] 5579 0000992B 0441 <1> add al, 'A' 5580 0000992D A2[85340100] <1> mov [msg_destination_file_drv], al 5581 <1> 5582 00009932 BE[4A340100] <1> mov esi, msg_source_file 5583 00009937 E87ED4FFFF <1> call print_msg 5584 0000993C BE[61810100] <1> mov esi, SourceFile_Directory 5585 00009941 803E20 <1> cmp byte [esi], 20h 5586 00009944 7605 <1> jna short csftdfq_sfn 5587 00009946 E86FD4FFFF <1> call print_msg 5588 <1> csftdfq_sfn: 5589 0000994B BE[A2810100] <1> mov esi, SourceFile_Name 5590 00009950 E865D4FFFF <1> call print_msg 5591 00009955 BE[69340100] <1> mov esi, msg_destination_file 5592 0000995A E85BD4FFFF <1> call print_msg 5593 0000995F BE[E1810100] <1> mov esi, DestinationFile_Directory 5594 00009964 803E20 <1> cmp byte [esi], 20h 5595 00009967 7605 <1> jna short csftdfq_dfn 5596 00009969 E84CD4FFFF <1> call print_msg 5597 <1> csftdfq_dfn: 5598 0000996E BE[22820100] <1> mov esi, DestinationFile_Name 5599 00009973 E842D4FFFF <1> call print_msg 5600 00009978 BE[88340100] <1> mov esi, msg_copy_nextline 5601 0000997D E838D4FFFF <1> call print_msg 5602 00009982 BE[88340100] <1> mov esi, msg_copy_nextline 5603 00009987 E82ED4FFFF <1> call print_msg 5604 <1> 5605 <1> loc_copy_ask_for_new_file_yes_no: 5606 0000998C BE[AA340100] <1> mov esi, Msg_DoYouWantCopyFile 5607 00009991 E824D4FFFF <1> call print_msg 5608 00009996 BE[1A330100] <1> mov esi, Msg_YesNo 5609 0000999B E81AD4FFFF <1> call print_msg 5610 <1> 5611 <1> loc_copy_ask_for_new_file_again: 5612 000099A0 30E4 <1> xor ah, ah 5613 000099A2 E86B75FFFF <1> call int16h 5614 000099A7 3C1B <1> cmp al, 1Bh 5615 000099A9 740F <1> je short loc_do_not_copy_file 5616 000099AB 24DF <1> and al, 0DFh 5617 000099AD A2[24330100] <1> mov [Y_N_nextline], al 5618 000099B2 3C59 <1> cmp al, 'Y' 5619 000099B4 7404 <1> je short loc_yes_copy_file 5620 000099B6 3C4E <1> cmp al, 'N' 5621 000099B8 75E6 <1> jne short loc_copy_ask_for_new_file_again 5622 <1> 5623 <1> loc_do_not_copy_file: 5624 <1> loc_yes_copy_file: 5625 000099BA E8BCF4FFFF <1> call y_n_answer ; 29/12/2017 5626 000099BF 5F <1> pop edi ; * 5627 <1> ;cmp al, 'Y' ; 'yes' 5628 <1> ;cmc 5629 <1> ;jnc loc_file_rw_restore_retn 5630 000099C0 3C4E <1> cmp al, 'N' ; 'no' 5631 <1> ;je loc_file_rw_restore_retn 5632 <1> ; 25/07/2022 5633 000099C2 7505 <1> jne short copy_source_file_to_destination_pass_q 5634 000099C4 E97FF3FFFF <1> jmp loc_file_rw_restore_retn 5635 <1> 5636 <1> copy_source_file_to_destination_pass_q: 5637 000099C9 B002 <1> mov al, 2 ; copy procedure Phase 2 5638 000099CB E82D1A0000 <1> call copy_source_file_to_destination_file 5639 <1> ;jc short loc_file_write_check_disk_space_err 5640 <1> 5641 <1> ; 31/08/2024 5642 000099D0 9C <1> pushf 5643 <1> 5644 <1> ; 24/03/2016 5645 <1> ;;push cx 5646 <1> ;push ecx ; 29/12/2017 5647 <1> 5648 000099D1 BE[88340100] <1> mov esi, msg_copy_nextline 5649 000099D6 E8DFD3FFFF <1> call print_msg 5650 <1> 5651 <1> ;pop eax ; 29/12/2017 5652 <1> ;;pop cx 5653 <1> ;pop ax 5654 <1> 5655 <1> ; 31/08/2024 5656 000099DB 9D <1> popf 5657 000099DC 7305 <1> jnc short copy_source_file_to_destination_OK 5658 <1> 5659 <1> ; 31/08/2024 5660 <1> ;;or cl, cl 5661 <1> ;;or al, al 5662 <1> ;jz short copy_source_file_to_destination_OK 5663 <1> ; 5664 <1> ;; 15/10/2016 (1Dh -> 18) 5665 <1> ;; 18/03/2016 (1Dh) 5666 <1> ;;cmp cl, 18 ; write error 5667 <1> ;cmp al, 18 5668 <1> ;jne short copy_source_file_to_destination_not_OK 5669 <1> ;; 5670 <1> ;;mov al, cl ; error number (write fault!) 5671 <1> ;stc 5672 <1> 5673 000099DE E965F3FFFF <1> jmp loc_file_rw_cmd_failed 5674 <1> 5675 <1> ; 31/08/2024 5676 <1> ;copy_source_file_to_destination_not_OK: 5677 <1> ;mov esi, Msg_read_file_error_before_EOF 5678 <1> ;call print_msg 5679 <1> ;jmp loc_file_rw_restore_retn 5680 <1> 5681 <1> copy_source_file_to_destination_OK: 5682 000099E3 BE[28330100] <1> mov esi, Msg_OK 5683 000099E8 E8CDD3FFFF <1> call print_msg 5684 <1> 5685 000099ED E956F3FFFF <1> jmp loc_file_rw_restore_retn 5686 <1> 5687 <1> ;loc_file_write_check_disk_space_err: 5688 <1> ;cmp al, 27h ; Insufficient disk space 5689 <1> ;je loc_file_write_insuff_disk_space_msg 5690 <1> ;jb loc_file_rw_cmd_failed 5691 <1> 5692 <1> ;call print_misc_error_msg ; 15/03/2016 5693 <1> ;jmp loc_file_rw_restore_retn 5694 <1> 5695 <1> ; 19/12/2025 5696 <1> %if 0 5697 <1> change_fs_file_attributes: 5698 <1> ; 04/03/2016 ; Temporary 5699 <1> ; AL = File or directory attributes 5700 <1> ; AH = 0 -> Attributes are in MS-DOS format 5701 <1> ; AH > 0 -> Attributes are in SINGLIX format 5702 <1> ;push ebx 5703 <1> ; ... do somethings here ... 5704 <1> ;pop ebx 5705 <1> ; BL = File or directory attributes 5706 <1> retn 5707 <1> %endif 5708 <1> 5709 <1> set_get_env: 5710 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 5711 <1> ; 11/04/2016 (TRDOS 386 = TRDOS v2.0) 5712 <1> ; 02/09/2011 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_set') 5713 <1> ; 2005 - 28/08/2011 5714 <1> get_setenv_fchar: 5715 <1> ; esi = environment variable/string 5716 000099F2 8A06 <1> mov al, [esi] 5717 000099F4 3C20 <1> cmp al, 20h 5718 000099F6 771E <1> ja short loc_find_env 5719 <1> 5720 000099F8 BE00300900 <1> mov esi, Env_Page 5721 <1> loc_print_setline: 5722 000099FD 803E00 <1> cmp byte [esi], 0 5723 00009A00 7613 <1> jna short loc_setenv_retn 5724 00009A02 E8B3D3FFFF <1> call print_msg 5725 00009A07 56 <1> push esi 5726 00009A08 BE[17390100] <1> mov esi, nextline 5727 00009A0D E8A8D3FFFF <1> call print_msg 5728 00009A12 5E <1> pop esi 5729 00009A13 EBE8 <1> jmp short loc_print_setline 5730 <1> 5731 <1> loc_setenv_retn: 5732 00009A15 C3 <1> retn 5733 <1> 5734 <1> loc_find_env: 5735 00009A16 3C3D <1> cmp al, '=' 5736 <1> ;je loc_cmd_failed 5737 <1> ; 25/07/2022 5738 00009A18 7505 <1> jne short loc_find_envr 5739 00009A1A E935EAFFFF <1> jmp loc_cmd_failed 5740 <1> 5741 <1> loc_find_envr: ; 25/07/2022 5742 00009A1F 56 <1> push esi 5743 <1> loc_repeat_env_equal_check: 5744 00009A20 46 <1> inc esi 5745 00009A21 803E3D <1> cmp byte [esi], '=' 5746 00009A24 7430 <1> je short pass_env_equal_check 5747 00009A26 803E20 <1> cmp byte [esi], 20h 5748 00009A29 73F5 <1> jnb short loc_repeat_env_equal_check 5749 00009A2B C60600 <1> mov byte [esi], 0 5750 00009A2E 5E <1> pop esi 5751 <1> ; 25/07/2022 (*) 5752 <1> loc_print_env_string: 5753 00009A2F BF[76780100] <1> mov edi, TextBuffer ; out buffer 5754 00009A34 B9FF000000 <1> mov ecx, 255 ; maximum size (limit) 5755 00009A39 30C0 <1> xor al, al ; 0 -> use [ESI] 5756 00009A3B E877000000 <1> call get_environment_string 5757 00009A40 72D3 <1> jc short loc_setenv_retn 5758 <1> ; 25/07/2022 5759 <1> ;loc_print_env_string: 5760 00009A42 BE[76780100] <1> mov esi, TextBuffer 5761 00009A47 E86ED3FFFF <1> call print_msg 5762 00009A4C BE[17390100] <1> mov esi, nextline 5763 <1> ;call print_msg 5764 <1> ;retn 5765 <1> ; 25/07/2022 5766 00009A51 E964D3FFFF <1> jmp print_msg 5767 <1> 5768 <1> pass_env_equal_check: 5769 00009A56 46 <1> inc esi 5770 00009A57 803E20 <1> cmp byte [esi], 20h 5771 00009A5A 73FA <1> jnb short pass_env_equal_check 5772 00009A5C C60600 <1> mov byte [esi], 0 5773 <1> 5774 <1> loc_call_set_env_string: 5775 00009A5F 5E <1> pop esi 5776 00009A60 E815010000 <1> call set_environment_string 5777 00009A65 73AE <1> jnc short loc_setenv_retn 5778 <1> 5779 <1> loc_set_cmd_failed: 5780 00009A67 3C08 <1> cmp al, 08h 5781 <1> ;jne loc_cmd_failed 5782 <1> ; 25/07/2022 5783 00009A69 7405 <1> je short loc_set_cmd_failed_spc 5784 00009A6B E9E4E9FFFF <1> jmp loc_cmd_failed 5785 <1> 5786 <1> loc_set_cmd_failed_spc: 5787 00009A70 BE[03350100] <1> mov esi, Msg_No_Set_Space 5788 <1> ;call print_msg 5789 <1> ;retn 5790 <1> ; 25/07/2022 5791 00009A75 E940D3FFFF <1> jmp print_msg 5792 <1> 5793 <1> set_get_path: 5794 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 5795 <1> ; 11/04/2016 (TRDOS 386 = TRDOS v2.0) 5796 <1> ; 03/09/2011 (TRDOS v1, CMD_INTR.ASM, 'cmp_cmd_path') 5797 <1> ; 2005 5798 <1> get_path_fchar: 5799 <1> ; esi = path 5800 00009A7A 803E20 <1> cmp byte [esi], 20h 5801 00009A7D 7711 <1> ja short loc_set_path 5802 <1> 5803 00009A7F BE00300900 <1> mov esi, Env_Page 5804 <1> loc_print_path: 5805 00009A84 803E00 <1> cmp byte [esi], 0 5806 00009A87 762D <1> jna short loc_path_retn 5807 <1> 5808 00009A89 BE[632F0100] <1> mov esi, Cmd_Path ; 'PATH' address 5809 <1> ; 25/07/2022 (*) 5810 00009A8E EB9F <1> jmp short loc_print_env_string 5811 <1> ; 25/07/2022 5812 <1> ; mov edi, TextBuffer ; out buffer 5813 <1> ; xor al, al ; use [ESI] 5814 <1> ; mov ecx, 255 ; maximum size (limit) 5815 <1> ; call get_environment_string 5816 <1> ; ;jc short loc_path_retn 5817 <1> ; ; 25/07/2022 5818 <1> ; jnc short loc_print_env_string 5819 <1> ; retn 5820 <1> 5821 <1> ; mov esi, TextBuffer 5822 <1> ; call print_msg 5823 <1> ; mov esi, nextline 5824 <1> ; ;call print_msg 5825 <1> ;loc_path_retn: 5826 <1> ; ;retn 5827 <1> ; ; 25/07/2022 5828 <1> ; jmp print_msg 5829 <1> 5830 <1> loc_set_path: 5831 00009A90 56 <1> push esi 5832 <1> loc_set_path_find_end: 5833 00009A91 46 <1> inc esi 5834 00009A92 803E20 <1> cmp byte [esi], 20h 5835 00009A95 73FA <1> jnb short loc_set_path_find_end 5836 00009A97 C60600 <1> mov byte [esi], 0 5837 <1> loc_set_path_header: 5838 00009A9A 5E <1> pop esi 5839 <1> set_path_x: ; 31/12/2017 ('syspath') 5840 00009A9B 4E <1> dec esi 5841 00009A9C C6063D <1> mov byte [esi], '=' 5842 00009A9F 4E <1> dec esi 5843 00009AA0 C60648 <1> mov byte [esi], 'H' 5844 00009AA3 4E <1> dec esi 5845 00009AA4 C60654 <1> mov byte [esi], 'T' 5846 00009AA7 4E <1> dec esi 5847 00009AA8 C60641 <1> mov byte [esi], 'A' 5848 00009AAB 4E <1> dec esi 5849 00009AAC C60650 <1> mov byte [esi], 'P' 5850 <1> 5851 <1> loc_path_call_set_env_string: 5852 00009AAF E8C6000000 <1> call set_environment_string 5853 00009AB4 72B1 <1> jc short loc_set_cmd_failed 5854 <1> loc_path_retn: ; 25/07/2022 5855 00009AB6 C3 <1> retn 5856 <1> 5857 <1> get_environment_string: 5858 <1> ; 12/04/2016 5859 <1> ; 11/04/2016 5860 <1> ; 05/04/2016 (TRDOS 386 = TRDOS v2.0) 5861 <1> ; 02/09/2011 (TRDOS v1, MAINPROG.ASM) 5862 <1> ; 28/08/2011 5863 <1> ; INPUT-> 5864 <1> ; EDI = Output buffer 5865 <1> ; CX = Buffer length (<= ENV_PAGE_SIZE) 5866 <1> ; 5867 <1> ; AL > 0 = AL = String sequence number 5868 <1> ; AL = 0 -> ESI = ASCIIZ Set word 5869 <1> ; (environment variable) 5870 <1> ; OUTPUT -> 5871 <1> ; ESI is not changed 5872 <1> ; EDI is not changed 5873 <1> ; EAX = String length (with zero tail) 5874 <1> ; EDX = Environment variables page address 5875 <1> ; CF = 1 -> Not found (EAX not valid) 5876 <1> ; 5877 <1> ; (Modified registers: EAX, EDX) 5878 <1> 5879 00009AB7 BA00300900 <1> mov edx, Env_Page 5880 00009ABC 803A00 <1> cmp byte [edx], 0 5881 00009ABF 7474 <1> jz short get_env_string_with_word_stc_retn 5882 <1> 5883 00009AC1 66890D[E2820100] <1> mov [env_var_length], cx 5884 <1> 5885 00009AC8 51 <1> push ecx ; * 5886 00009AC9 56 <1> push esi ; ** 5887 <1> 5888 00009ACA 08C0 <1> or al, al 5889 00009ACC 7449 <1> jz short get_env_string_with_word 5890 <1> 5891 <1> get_env_string_with_seq_number: 5892 00009ACE B101 <1> mov cl, 1 5893 00009AD0 88C5 <1> mov ch, al 5894 00009AD2 31C0 <1> xor eax, eax 5895 00009AD4 89D6 <1> mov esi, edx ; Env_Page 5896 <1> 5897 <1> get_env_string_seq_number_check: 5898 00009AD6 38CD <1> cmp ch, cl 5899 00009AD8 7726 <1> ja short get_env_string_seq_number_next 5900 <1> 5901 <1> get_env_string_move_to_buff: 5902 00009ADA 57 <1> push edi ; *** 5903 <1> 5904 00009ADB 29D2 <1> sub edx, edx 5905 <1> 5906 <1> get_env_string_seq_number_repeat1: 5907 00009ADD 42 <1> inc edx 5908 00009ADE AC <1> lodsb 5909 00009ADF AA <1> stosb 5910 <1> 5911 00009AE0 66FF0D[E2820100] <1> dec word [env_var_length] 5912 00009AE7 7508 <1> jnz short get_env_string_seq_number_repeat3 5913 <1> 5914 <1> get_env_string_seq_number_repeat2: 5915 00009AE9 20C0 <1> and al, al 5916 00009AEB 7408 <1> jz short get_env_string_seq_number_ok 5917 00009AED 42 <1> inc edx 5918 00009AEE AC <1> lodsb 5919 00009AEF EBF8 <1> jmp short get_env_string_seq_number_repeat2 5920 <1> 5921 <1> get_env_string_seq_number_repeat3: 5922 00009AF1 08C0 <1> or al, al 5923 00009AF3 75E8 <1> jnz short get_env_string_seq_number_repeat1 5924 <1> 5925 <1> get_env_string_seq_number_ok: 5926 00009AF5 5F <1> pop edi ; *** 5927 00009AF6 89D0 <1> mov eax, edx ; Length of the environment string 5928 <1> ; (ASCIIZ, includes ZERO tail) 5929 00009AF8 BA00300900 <1> mov edx, Env_Page 5930 <1> 5931 <1> get_env_string_stc_retn: 5932 00009AFD 5E <1> pop esi ; ** 5933 00009AFE 59 <1> pop ecx ; * 5934 00009AFF C3 <1> retn 5935 <1> 5936 <1> get_env_string_seq_number_next: 5937 00009B00 AC <1> lodsb 5938 00009B01 08C0 <1> or al, al 5939 00009B03 75FB <1> jnz short get_env_string_seq_number_next 5940 <1> 5941 00009B05 81FE00320900 <1> cmp esi, Env_Page + Env_Page_Size ; +512 (+4096) 5942 00009B0B F5 <1> cmc 5943 00009B0C 72EF <1> jc short get_env_string_stc_retn 5944 <1> 5945 00009B0E AC <1> lodsb 5946 00009B0F 3C01 <1> cmp al, 1 5947 00009B11 72EA <1> jb short get_env_string_stc_retn 5948 00009B13 FEC1 <1> inc cl 5949 00009B15 EBBF <1> jmp short get_env_string_seq_number_check 5950 <1> 5951 <1> get_env_string_with_word: 5952 00009B17 31C9 <1> xor ecx, ecx 5953 <1> 5954 <1> get_env_string_calc_word_length: 5955 00009B19 AC <1> lodsb 5956 00009B1A 3C20 <1> cmp al, 20h 5957 00009B1C 7211 <1> jb short get_env_string_calc_word_length_ok 5958 <1> ;inc cx 5959 00009B1E FEC1 <1> inc cl 5960 <1> 5961 00009B20 3C61 <1> cmp al, 'a' 5962 00009B22 72F5 <1> jb short get_env_string_calc_word_length 5963 00009B24 3C7A <1> cmp al, 'z' 5964 00009B26 77F1 <1> ja short get_env_string_calc_word_length 5965 00009B28 24DF <1> and al, 0DFh 5966 00009B2A 8846FF <1> mov [esi-1], al 5967 00009B2D EBEA <1> jmp short get_env_string_calc_word_length 5968 <1> 5969 <1> get_env_string_calc_word_length_ok: 5970 00009B2F 08C9 <1> or cl, cl 5971 00009B31 7506 <1> jnz short get_env_string_calc_word_length_save 5972 <1> 5973 00009B33 5E <1> pop esi ; ** 5974 <1> 5975 <1> get_env_string_stc_retn1: 5976 00009B34 59 <1> pop ecx ; * 5977 <1> 5978 <1> get_env_string_with_word_stc_retn: 5979 00009B35 31C0 <1> xor eax, eax 5980 00009B37 F9 <1> stc 5981 00009B38 C3 <1> retn 5982 <1> 5983 <1> get_env_string_calc_word_length_save: 5984 00009B39 871C24 <1> xchg ebx, [esp] ; ** 5985 00009B3C 89DE <1> mov esi, ebx 5986 <1> ; Start of the env string (to be searched) 5987 <1> 5988 00009B3E 57 <1> push edi ; *** 5989 00009B3F 89D7 <1> mov edi, edx ; Env_Page 5990 <1> 5991 <1> get_env_string_compare: 5992 00009B41 57 <1> push edi ; **** 5993 00009B42 51 <1> push ecx ; ***** ; Variable name length 5994 <1> 5995 <1> get_env_string_compare_rep: 5996 00009B43 AC <1> lodsb 5997 00009B44 AE <1> scasb 5998 00009B45 7511 <1> jne short get_env_string_compare_next1 5999 00009B47 E2FA <1> loop get_env_string_compare_rep 6000 <1> 6001 00009B49 803F3D <1> cmp byte [edi], '=' 6002 00009B4C 750A <1> jne short get_env_string_compare_next1 6003 <1> 6004 00009B4E 59 <1> pop ecx ; ***** 6005 00009B4F 5F <1> pop edi ; **** 6006 00009B50 89FE <1> mov esi, edi 6007 00009B52 5F <1> pop edi ; *** 6008 00009B53 871C24 <1> xchg ebx, [esp] ; ** 6009 00009B56 EB82 <1> jmp short get_env_string_move_to_buff 6010 <1> 6011 <1> get_env_string_compare_next1: 6012 00009B58 89FE <1> mov esi, edi 6013 00009B5A 59 <1> pop ecx ; ***** 6014 00009B5B 5F <1> pop edi ; **** 6015 <1> get_env_string_compare_next2: 6016 00009B5C 81FEFF310900 <1> cmp esi, Env_Page + Env_Page_Size - 1 ; +511 (+4095) 6017 00009B62 7310 <1> jnb short get_env_string_compare_not_ok 6018 00009B64 20C0 <1> and al, al 6019 00009B66 AC <1> lodsb 6020 00009B67 75F3 <1> jnz short get_env_string_compare_next2 6021 00009B69 08C0 <1> or al, al 6022 00009B6B 7407 <1> jz short get_env_string_compare_not_ok 6023 00009B6D 4E <1> dec esi ; 12/04/2016 6024 00009B6E 89F7 <1> mov edi, esi 6025 00009B70 89DE <1> mov esi, ebx 6026 00009B72 EBCD <1> jmp short get_env_string_compare 6027 <1> 6028 <1> get_env_string_compare_not_ok: 6029 00009B74 5F <1> pop edi ; *** 6030 00009B75 89DE <1> mov esi, ebx 6031 00009B77 5B <1> pop ebx ; ** 6032 00009B78 EBBA <1> jmp short get_env_string_stc_retn1 6033 <1> 6034 <1> set_environment_string: 6035 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 6036 <1> ; 13/04/2016 6037 <1> ; 12/04/2016 6038 <1> ; 11/04/2016 6039 <1> ; 06/04/2016 6040 <1> ; 05/04/2016 (TRDOS 386 = TRDOS v2.0) 6041 <1> ; 02/09/2011 (TRDOS v1, MAINPROG.ASM) 6042 <1> ; 29/08/2011 6043 <1> ; 29/08/2011 6044 <1> ; INPUT-> 6045 <1> ; ESI = ASCIIZ environment string 6046 <1> ; OUTPUT -> 6047 <1> ; ESI is not changed 6048 <1> ; CF = 1 -> Could not set, 6049 <1> ; insufficient environment space 6050 <1> ; 6051 <1> ; (EAX, EDX will be changed) 6052 <1> ; 6053 <1> ; (EAX = Start address of the env string if > 0) 6054 <1> ; (EDX = Environment string length) 6055 <1> 6056 00009B7A 56 <1> push esi ; * 6057 <1> 6058 00009B7B 31C0 <1> xor eax, eax 6059 <1> 6060 <1> set_env_chk_validation1: 6061 00009B7D FEC4 <1> inc ah ; variable (string) length 6062 00009B7F AC <1> lodsb 6063 00009B80 3C3D <1> cmp al, '=' 6064 00009B82 7415 <1> je short set_env_chk_validation2 6065 00009B84 3C20 <1> cmp al, 20h 6066 00009B86 720F <1> jb short set_env_string_stc 6067 <1> 6068 <1> ; 06/04/2016 6069 00009B88 3C61 <1> cmp al, 'a' 6070 00009B8A 72F1 <1> jb short set_env_chk_validation1 6071 00009B8C 3C7A <1> cmp al, 'z' 6072 00009B8E 77ED <1> ja short set_env_chk_validation1 6073 00009B90 2C20 <1> sub al, 'a'-'A' 6074 00009B92 8846FF <1> mov [esi-1], al 6075 00009B95 EBE6 <1> jmp short set_env_chk_validation1 6076 <1> 6077 <1> set_env_string_stc: 6078 00009B97 5E <1> pop esi ; * 6079 <1> ;stc 6080 00009B98 C3 <1> retn 6081 <1> 6082 <1> set_env_chk_validation2: 6083 00009B99 51 <1> push ecx ; ** 6084 00009B9A 53 <1> push ebx ; *** 6085 00009B9B 57 <1> push edi ; **** 6086 <1> 6087 <1> ; 12/04/2016 6088 <1> ;mov ebx, [esp+12] 6089 <1> ; 25/07/2022 6090 00009B9C 8B54240C <1> mov edx, [esp+12] 6091 <1> 6092 <1> set_env_chk_validation2w: 6093 00009BA0 89F7 <1> mov edi, esi 6094 00009BA2 4F <1> dec edi 6095 <1> 6096 00009BA3 807FFF20 <1> cmp byte [edi-1], 20h 6097 00009BA7 771A <1> ja short set_env_chk_validation2z 6098 <1> 6099 00009BA9 56 <1> push esi 6100 00009BAA 89FE <1> mov esi, edi 6101 00009BAC 4E <1> dec esi 6102 <1> 6103 <1> set_env_chk_validation2x: 6104 00009BAD 4E <1> dec esi 6105 <1> 6106 <1> ;cmp esi, ebx 6107 00009BAE 39D6 <1> cmp esi, edx ; 25/07/2022 6108 00009BB0 7207 <1> jb short set_env_chk_validation2y 6109 <1> 6110 00009BB2 4F <1> dec edi 6111 <1> 6112 00009BB3 8A06 <1> mov al, [esi] 6113 00009BB5 8807 <1> mov [edi], al 6114 <1> 6115 00009BB7 EBF4 <1> jmp short set_env_chk_validation2x 6116 <1> 6117 <1> set_env_chk_validation2y: 6118 00009BB9 5E <1> pop esi 6119 <1> 6120 <1> ;;mov byte [ebx], 20h 6121 <1> ; 25/07/2022 6122 <1> ;mov byte [edx], 20h 6123 <1> 6124 <1> ;inc ebx 6125 <1> ;mov [esp+12], ebx 6126 <1> ; 25/07/2022 6127 00009BBA 42 <1> inc edx 6128 00009BBB 8954240C <1> mov [esp+12], edx 6129 <1> 6130 00009BBF FECC <1> dec ah ; 13/04/2016 6131 <1> 6132 00009BC1 EBDD <1> jmp short set_env_chk_validation2w 6133 <1> 6134 <1> set_env_chk_validation2z: 6135 <1> ;mov edx, Env_Page 6136 <1> ;mov edi, edx 6137 <1> ; 25/07/2022 6138 00009BC3 BB00300900 <1> mov ebx, Env_Page 6139 00009BC8 89DF <1> mov edi, ebx 6140 <1> 6141 <1> set_env_chk_validation3: 6142 00009BCA AC <1> lodsb 6143 00009BCB 3C20 <1> cmp al, 20h 6144 00009BCD 74FB <1> je short set_env_chk_validation3 6145 <1> 6146 00009BCF 9C <1> pushf 6147 <1> 6148 <1> ; 12/04/2016 6149 <1> set_env_chk_validation3n: 6150 00009BD0 3C61 <1> cmp al, 'a' 6151 00009BD2 720C <1> jb short set_env_chk_validation3c 6152 00009BD4 3C7A <1> cmp al, 'z' 6153 00009BD6 7705 <1> ja short set_env_chk_validation3x 6154 00009BD8 2C20 <1> sub al, 'a'-'A' 6155 00009BDA 8846FF <1> mov [esi-1], al 6156 <1> 6157 <1> set_env_chk_validation3x: 6158 00009BDD AC <1> lodsb 6159 00009BDE EBF0 <1> jmp short set_env_chk_validation3n 6160 <1> 6161 <1> set_env_chk_validation3c: 6162 00009BE0 3C20 <1> cmp al, 20h 6163 00009BE2 73F9 <1> jnb short set_env_chk_validation3x 6164 <1> 6165 00009BE4 803F00 <1> cmp byte [edi], 0 6166 00009BE7 772B <1> ja short set_env_chk_validation4 6167 <1> 6168 00009BE9 9D <1> popf 6169 00009BEA 7222 <1> jb short set_env_string_nothing 6170 <1> 6171 00009BEC B900020000 <1> mov ecx, Env_Page_Size ; 512 (4096) 6172 <1> 6173 <1> ;mov esi, ebx ; 12/04/2016 6174 <1> ; 25/07/2022 6175 00009BF1 89D6 <1> mov esi, edx 6176 <1> 6177 <1> ; 25/07/2022 6178 00009BF3 89CA <1> mov edx, ecx 6179 <1> 6180 <1> set_env_string_copy_to_envb: 6181 00009BF5 AC <1> lodsb 6182 00009BF6 3C20 <1> cmp al, 20h 6183 00009BF8 7207 <1> jb short set_env_string_copy_to_envb_z 6184 00009BFA AA <1> stosb 6185 00009BFB E2F8 <1> loop set_env_string_copy_to_envb 6186 <1> 6187 <1> ; 11/04/2016 6188 <1> ;mov edi, edx ; Env_Page 6189 <1> ; 25/07/2022 6190 00009BFD 89DF <1> mov edi, ebx 6191 <1> ; 25/07/2022 6192 <1> ;mov ecx, Env_Page_Size 6193 00009BFF 89D1 <1> mov ecx, edx 6194 <1> 6195 <1> set_env_string_copy_to_envb_z: 6196 <1> ; 25/07/2022 6197 <1> ;push edx ; Start address of the variable 6198 <1> 6199 <1> ;;mov edx, Env_Page_Size 6200 <1> ;; 25/07/2022 6201 00009C01 29CA <1> sub edx, ecx ; variable (string) length 6202 <1> 6203 00009C03 28C0 <1> sub al, al ; 0 6204 00009C05 F3AA <1> rep stosb ; clear remain bytes of the env page 6205 <1> 6206 <1> ;pop eax ; Start address of the variable 6207 <1> ; 25/07/2022 6208 00009C07 89D8 <1> mov eax, ebx 6209 <1> 6210 <1> set_env_string_allocate_envb_retn: ; stc or clc return 6211 00009C09 5F <1> pop edi ; **** 6212 00009C0A 5B <1> pop ebx ; *** 6213 00009C0B 59 <1> pop ecx ; ** 6214 00009C0C 5E <1> pop esi ; * 6215 00009C0D C3 <1> retn 6216 <1> 6217 <1> set_env_string_nothing: 6218 00009C0E 31C0 <1> xor eax, eax 6219 00009C10 31D2 <1> xor edx, edx ; 11/04/2016 6220 00009C12 EBF5 <1> jmp short set_env_string_allocate_envb_retn 6221 <1> 6222 <1> set_env_chk_validation4: 6223 <1> ; 11/04/2016 6224 00009C14 9D <1> popf 6225 <1> 6226 <1> ;mov esi, edx ; Env_Page 6227 <1> ; 25/07/2022 6228 00009C15 89DE <1> mov esi, ebx 6229 <1> 6230 <1> set_env_chk_validation5: 6231 <1> ;mov edi, ebx ; ASCIIZ environment string address 6232 <1> ; 25/07/2022 6233 00009C17 89D7 <1> mov edi, edx 6234 00009C19 0FB6CC <1> movzx ecx, ah ; Variable (string) length (with '=') 6235 <1> 6236 <1> set_env_chk_validation5_loop: 6237 00009C1C AC <1> lodsb 6238 00009C1D AE <1> scasb 6239 00009C1E 7508 <1> jne short set_env_chk_validation6 6240 00009C20 E2FA <1> loop set_env_chk_validation5_loop 6241 <1> 6242 00009C22 3C3D <1> cmp al, '=' 6243 <1> ;je set_env_change_variable 6244 <1> ; 25/07/2022 6245 00009C24 7502 <1> jne short set_env_chk_validation6 6246 00009C26 EB7E <1> jmp set_env_change_variable 6247 <1> 6248 <1> set_env_chk_validation6: 6249 00009C28 08C0 <1> or al, al ; 0 6250 00009C2A 7403 <1> jz short set_env_chk_validation7 6251 <1> 6252 00009C2C AC <1> lodsb 6253 00009C2D EBF9 <1> jmp short set_env_chk_validation6 6254 <1> 6255 <1> set_env_chk_validation7: 6256 00009C2F 88E1 <1> mov cl, ah 6257 00009C31 01F1 <1> add ecx, esi 6258 00009C33 81F9FF310900 <1> cmp ecx, Env_Page + Env_Page_Size - 1 6259 <1> ; 511 (4095) 6260 <1> ; strlen + '=' + 0 6261 00009C39 72DC <1> jb short set_env_chk_validation5 6262 <1> 6263 <1> set_env_chk_validation8: ; variable not found 6264 00009C3B 0FB6F4 <1> movzx esi, ah ; variable name length (with '=') 6265 <1> ;add esi, ebx ; position just after of the '=' 6266 <1> ; 25/07/2022 6267 00009C3E 01D6 <1> add esi, edx 6268 <1> 6269 <1> set_env_chk_validation8_loop: 6270 00009C40 AC <1> lodsb 6271 00009C41 3C20 <1> cmp al, 20h 6272 00009C43 74FB <1> je short set_env_chk_validation8_loop 6273 00009C45 72C7 <1> jb short set_env_string_nothing 6274 <1> 6275 <1> set_env_chk_validation9: 6276 00009C47 AC <1> lodsb 6277 00009C48 3C20 <1> cmp al, 20h 6278 00009C4A 73FB <1> jnb short set_env_chk_validation9 6279 <1> 6280 <1> ; End of ASCIIZ environment string 6281 <1> 6282 <1> set_env_add_variable: 6283 <1> ;sub esi, ebx ; variable+definition length 6284 <1> ; 25/07/2022 6285 00009C4C 29D6 <1> sub esi, edx 6286 <1> 6287 00009C4E 56 <1> push esi ; ***** 6288 <1> 6289 <1> ;mov esi, edx ; Environment page address 6290 <1> ; 25/07/2022 6291 00009C4F 89DE <1> mov esi, ebx 6292 <1> 6293 00009C51 B900020000 <1> mov ecx, Env_Page_Size ; 512 (4096) 6294 <1> 6295 <1> set_env_add_variable_loop: 6296 00009C56 AC <1> lodsb 6297 00009C57 20C0 <1> and al, al 6298 00009C59 7406 <1> jz short set_env_add_variable_chk1 ; 0 6299 00009C5B E2F9 <1> loop set_env_add_variable_loop 6300 <1> 6301 <1> ; 11/04/2016 6302 00009C5D 884EFF <1> mov [esi-1], cl ; 0 6303 00009C60 41 <1> inc ecx 6304 <1> 6305 <1> set_env_add_variable_chk1: 6306 00009C61 49 <1> dec ecx 6307 00009C62 7408 <1> jz short set_env_add_variable_nspc 6308 00009C64 AC <1> lodsb 6309 00009C65 08C0 <1> or al, al 6310 00009C67 740B <1> jz short set_env_add_variable_chk2 ; 00 6311 00009C69 49 <1> dec ecx 6312 00009C6A 75EA <1> jnz short set_env_add_variable_loop 6313 <1> 6314 <1> set_env_add_variable_nspc: ; no space on environment page 6315 00009C6C 58 <1> pop eax ; ***** 6316 <1> ;mov eax, 8 ; No space for new environment string 6317 <1> ; 25/07/2022 6318 00009C6D 29C0 <1> sub eax, eax 6319 00009C6F B008 <1> mov al, 8 6320 00009C71 F9 <1> stc 6321 00009C72 EB95 <1> jmp short set_env_string_allocate_envb_retn 6322 <1> 6323 <1> set_env_add_variable_chk2: 6324 00009C74 8B0C24 <1> mov ecx, [esp] ; ***** 6325 00009C77 4E <1> dec esi ; beginning address of the new variable 6326 00009C78 89F0 <1> mov eax, esi 6327 00009C7A 01C8 <1> add eax, ecx ; string length (with CR) 6328 <1> ;add edx, Env_Page_Size ; 512 (4096) 6329 <1> ; 25/07/2022 6330 00009C7C 81C300020000 <1> add ebx, Env_Page_Size 6331 <1> ;cmp eax, edx 6332 00009C82 39D8 <1> cmp eax, ebx ; 25/07/2022 6333 00009C84 77E6 <1> ja short set_env_add_variable_nspc 6334 00009C86 49 <1> dec ecx ; except CR at the end 6335 <1> ;mov edx, ecx ; 12/04/2016 6336 <1> ; 25/07/2022 6337 00009C87 89CB <1> mov ebx, ecx 6338 00009C89 89F7 <1> mov edi, esi 6339 00009C8B 893C24 <1> mov [esp], edi ; ***** ; Start address of new variable 6340 <1> ;mov esi, ebx ; ASCIIZ environment string address 6341 <1> ; 25/07/2022 6342 00009C8E 89D6 <1> mov esi, edx 6343 00009C90 F3A4 <1> rep movsb 6344 00009C92 28C0 <1> sub al, al 6345 00009C94 AA <1> stosb 6346 00009C95 58 <1> pop eax ; ***** ; Beginning address of new variable 6347 00009C96 81FF00320900 <1> cmp edi, Env_Page + Env_Page_Size ; 12/04/2016 6348 <1> ;jnb set_env_string_allocate_envb_retn ; OK ! 6349 <1> ; 25/07/2022 6350 00009C9C 7303 <1> jnb short set_env_add_variable_chk3 6351 00009C9E 880F <1> mov [edi], cl ; 0 6352 00009CA0 F8 <1> clc ; 13/04/2016 6353 <1> set_env_add_variable_chk3: 6354 00009CA1 E963FFFFFF <1> jmp set_env_string_allocate_envb_retn ; OK ! 6355 <1> 6356 <1> set_env_change_variable: 6357 <1> ; 06/04/2016 6358 <1> ; esi = Variable's address in environment page (after '=') 6359 <1> ; edi = ASCIIZ environment string address (after '=') 6360 <1> 6361 <1> ; ah = variable length from start to the '=' 6362 00009CA6 8825[E2820100] <1> mov [env_var_length], ah 6363 <1> 6364 00009CAC 28C9 <1> sub cl, cl ; ecx = 0 6365 <1> 6366 00009CAE 57 <1> push edi ; ***** 6367 <1> 6368 00009CAF 89F7 <1> mov edi, esi ; 11/04/2016 6369 <1> 6370 <1> set_env_change_variable_calc1: 6371 00009CB1 AC <1> lodsb 6372 00009CB2 08C0 <1> or al, al 6373 00009CB4 7403 <1> jz short set_env_change_variable_calc2 6374 <1> 6375 00009CB6 41 <1> inc ecx ; length of environment string (after the '=') 6376 <1> 6377 00009CB7 EBF8 <1> jmp short set_env_change_variable_calc1 6378 <1> 6379 <1> set_env_change_variable_calc2: 6380 00009CB9 8B3424 <1> mov esi, [esp] ; ASCIIZ environment string address 6381 <1> 6382 00009CBC 29D2 <1> sub edx, edx 6383 <1> 6384 <1> set_env_change_variable_calc3: 6385 00009CBE AC <1> lodsb 6386 00009CBF 3C20 <1> cmp al, 20h 6387 00009CC1 7203 <1> jb short set_env_change_variable_calc4 6388 <1> 6389 00009CC3 42 <1> inc edx ; length of ASCIIZ string (after the '=') 6390 <1> 6391 00009CC4 EBF8 <1> jmp short set_env_change_variable_calc3 6392 <1> 6393 <1> set_env_change_variable_calc4: 6394 00009CC6 C646FF00 <1> mov byte [esi-1], 0 ; put ZERO instead of CR 6395 <1> 6396 00009CCA 5E <1> pop esi ; ***** ; ASCIIZ string address (after '=') 6397 <1> 6398 <1> ; EDI = Old variable's address (after '=') 6399 <1> 6400 <1> ; compare the new string with the old string 6401 00009CCB 39CA <1> cmp edx, ecx 6402 00009CCD 7718 <1> ja short set_env_change_variable_calc5 ; longer 6403 <1> ;jb set_env_change_variable_calc9 ; shorter 6404 <1> ; 25/07/2022 6405 00009CCF 7405 <1> je short set_env_change_variable_calc22 6406 00009CD1 E98C000000 <1> jmp set_env_change_variable_calc9 6407 <1> 6408 <1> set_env_change_variable_calc22: 6409 <1> ;same length (simple copy) 6410 00009CD6 0FB6C4 <1> movzx eax, ah 6411 00009CD9 01C2 <1> add edx, eax 6412 00009CDB F7D8 <1> neg eax 6413 00009CDD 01F8 <1> add eax, edi 6414 <1> ; EAX = Start address of the variable 6415 <1> ; EDX = Variable length (without ZERO at the end of variable) 6416 <1> 6417 00009CDF F3A4 <1> rep movsb 6418 00009CE1 F8 <1> clc ; 13/04/2016 6419 00009CE2 E922FFFFFF <1> jmp set_env_string_allocate_envb_retn ; OK ! 6420 <1> 6421 <1> set_env_change_variable_calc5: 6422 <1> ; 11/04/2016 6423 00009CE7 52 <1> push edx ; ***** 6424 00009CE8 29CA <1> sub edx, ecx ; difference ; (the new string is longer) 6425 00009CEA 89F3 <1> mov ebx, esi 6426 00009CEC 89FE <1> mov esi, edi 6427 <1> 6428 <1> set_env_change_variable_calc6: 6429 00009CEE AC <1> lodsb 6430 00009CEF 20C0 <1> and al, al 6431 00009CF1 75FB <1> jnz short set_env_change_variable_calc6 6432 <1> 6433 00009CF3 81FE00320900 <1> cmp esi, Env_Page + Env_Page_Size ; 512 (4096) 6434 00009CF9 0F836DFFFFFF <1> jnb set_env_add_variable_nspc 6435 <1> 6436 00009CFF 89F9 <1> mov ecx, edi ; current (old) variable's address 6437 00009D01 89F7 <1> mov edi, esi ; next variable's address 6438 <1> 6439 00009D03 AC <1> lodsb 6440 00009D04 08C0 <1> or al, al 6441 00009D06 7417 <1> jz short set_env_change_variable_calc8 ; 00 6442 <1> 6443 <1> set_env_change_variable_calc7: 6444 00009D08 AC <1> lodsb 6445 00009D09 20C0 <1> and al, al 6446 00009D0B 75FB <1> jnz short set_env_change_variable_calc7 6447 <1> 6448 00009D0D 81FE00320900 <1> cmp esi, Env_Page + Env_Page_Size ; 512 (4096) 6449 <1> ;jnb set_env_add_variable_nspc 6450 <1> ; 25/07/2022 6451 00009D13 7205 <1> jb short set_env_change_variable_calc24 6452 <1> set_env_change_variable_calc23: 6453 00009D15 E952FFFFFF <1> jmp set_env_add_variable_nspc 6454 <1> 6455 <1> set_env_change_variable_calc24: 6456 00009D1A AC <1> lodsb 6457 00009D1B 08C0 <1> or al, al 6458 00009D1D 75E9 <1> jnz short set_env_change_variable_calc7 6459 <1> 6460 <1> set_env_change_variable_calc8: 6461 00009D1F 4E <1> dec esi ; address of the second (last) 0 of the 00 6462 <1> 6463 00009D20 01F2 <1> add edx, esi ; final position of the last 0 6464 <1> 6465 00009D22 81FA00320900 <1> cmp edx, Env_Page + Env_Page_Size ; 512 (4096) 6466 <1> ;jnb set_env_add_variable_nspc 6467 <1> ; 25/07/2022 6468 00009D28 73EB <1> jnb short set_env_change_variable_calc23 6469 <1> 6470 00009D2A 89C8 <1> mov eax, ecx ; old variable's address (after '=') 6471 <1> 6472 00009D2C 89F1 <1> mov ecx, esi 6473 00009D2E 29F9 <1> sub ecx, edi ; count of bytes to move forward 6474 <1> 6475 <1> ; 13/04/2016 6476 00009D30 C60200 <1> mov byte [edx], 0 6477 00009D33 89D7 <1> mov edi, edx 6478 00009D35 29F2 <1> sub edx, esi ; difference (additional byte count) 6479 00009D37 4F <1> dec edi ; the last zero address (first byte of the 00) 6480 00009D38 89FE <1> mov esi, edi 6481 00009D3A 29D6 <1> sub esi, edx ; - displacement 6482 <1> 6483 00009D3C FA <1> cli ; disable interrupts 6484 00009D3D FD <1> std ; backward 6485 <1> 6486 00009D3E F3A4 <1> rep movsb ; move ECX bytes from DS:ESI to ES:EDI 6487 <1> 6488 00009D40 FC <1> cld ; forward (default) 6489 00009D41 FB <1> sti ; enable interrupts 6490 <1> 6491 00009D42 89C7 <1> mov edi, eax 6492 00009D44 59 <1> pop ecx ; ***** ; byte count (after '=') 6493 00009D45 89CA <1> mov edx, ecx 6494 00009D47 89DE <1> mov esi, ebx ; ASCIIZ string address (after '=') 6495 00009D49 89FB <1> mov ebx, edi 6496 <1> 6497 00009D4B F3A4 <1> rep movsb 6498 <1> 6499 00009D4D 880F <1> mov [edi], cl ; 0 ; end of variable 6500 <1> 6501 00009D4F 0FB605[E2820100] <1> movzx eax, byte [env_var_length] 6502 00009D56 01C2 <1> add edx, eax ; variable length (total) 6503 00009D58 F7D8 <1> neg eax 6504 00009D5A 01D8 <1> add eax, ebx ; start address of the variable 6505 00009D5C F8 <1> clc ; 13/04/2016 6506 00009D5D E9A7FEFFFF <1> jmp set_env_string_allocate_envb_retn ; OK ! 6507 <1> 6508 <1> set_env_change_variable_calc9: 6509 <1> ; 11/04/2016 6510 00009D62 21D2 <1> and edx, edx ; is empty ? 6511 00009D64 753B <1> jnz short set_env_change_variable_calc15 6512 <1> 6513 00009D66 0FB6DC <1> movzx ebx, ah 6514 00009D69 F7DB <1> neg ebx 6515 00009D6B 01FB <1> add ebx, edi 6516 <1> 6517 <1> ; EBX = Start address of the variable (in env page) 6518 <1> ; EDX = Variable length = 0 6519 <1> 6520 00009D6D 89FE <1> mov esi, edi 6521 <1> 6522 <1> set_env_change_variable_calc10: 6523 00009D6F AC <1> lodsb 6524 00009D70 08C0 <1> or al, al 6525 00009D72 75FB <1> jnz short set_env_change_variable_calc10 6526 <1> 6527 00009D74 B9FF310900 <1> mov ecx, Env_Page + Env_Page_Size - 1 6528 <1> 6529 00009D79 39CE <1> cmp esi, ecx ; +511 (+4095) 6530 00009D7B 7604 <1> jna short set_env_change_variable_calc11 6531 <1> 6532 00009D7D 89CE <1> mov esi, ecx 6533 00009D7F 8806 <1> mov [esi], al ; 0 6534 <1> 6535 <1> set_env_change_variable_calc11: 6536 00009D81 89DF <1> mov edi, ebx ; old variable's start address 6537 <1> 6538 <1> set_env_change_variable_calc12: 6539 00009D83 AC <1> lodsb 6540 00009D84 AA <1> stosb 6541 00009D85 20C0 <1> and al, al 6542 00009D87 75FA <1> jnz short set_env_change_variable_calc12 6543 00009D89 39CE <1> cmp esi, ecx 6544 00009D8B 7706 <1> ja short set_env_change_variable_calc13 6545 00009D8D AC <1> lodsb 6546 00009D8E AA <1> stosb 6547 00009D8F 20C0 <1> and al, al 6548 00009D91 75F0 <1> jnz short set_env_change_variable_calc12 6549 <1> 6550 <1> set_env_change_variable_calc13: 6551 00009D93 29F9 <1> sub ecx, edi 6552 00009D95 7203 <1> jb short set_env_change_variable_calc14 6553 00009D97 41 <1> inc ecx ; 1-512 (1-4096) 6554 00009D98 F3AA <1> rep stosb ; al = 0 6555 <1> 6556 <1> set_env_change_variable_calc14: 6557 00009D9A 29C0 <1> sub eax, eax ; Start address of the variable 6558 <1> ; EAX = 0 -> Variable is removed 6559 <1> ; EDX = Variable length = 0 6560 <1> 6561 00009D9C E968FEFFFF <1> jmp set_env_string_allocate_envb_retn ; OK ! 6562 <1> 6563 <1> set_env_change_variable_calc15: 6564 00009DA1 52 <1> push edx ; ***** 6565 00009DA2 F7DA <1> neg edx 6566 00009DA4 01CA <1> add edx, ecx ; difference (the old string is longer) 6567 00009DA6 89F3 <1> mov ebx, esi 6568 00009DA8 89FE <1> mov esi, edi 6569 <1> 6570 <1> set_env_change_variable_calc16: 6571 00009DAA AC <1> lodsb 6572 00009DAB 20C0 <1> and al, al 6573 00009DAD 75FB <1> jnz short set_env_change_variable_calc16 6574 <1> 6575 00009DAF B900320900 <1> mov ecx, Env_Page + Env_Page_Size 6576 <1> 6577 00009DB4 39CE <1> cmp esi, ecx ; +512 (+4096) 6578 00009DB6 7605 <1> jna short set_env_change_variable_calc17 6579 <1> 6580 00009DB8 89CE <1> mov esi, ecx 6581 00009DBA 8846FF <1> mov [esi-1], al ; 0 6582 <1> 6583 <1> set_env_change_variable_calc17: 6584 00009DBD 89F9 <1> mov ecx, edi ; current (old) variable's address 6585 00009DBF 89F7 <1> mov edi, esi ; next variable's address 6586 <1> 6587 00009DC1 AC <1> lodsb 6588 00009DC2 08C0 <1> or al, al 6589 00009DC4 741D <1> jz short set_env_change_variable_calc20 6590 <1> 6591 <1> set_env_change_variable_calc18: 6592 00009DC6 AC <1> lodsb 6593 00009DC7 20C0 <1> and al, al 6594 00009DC9 75FB <1> jnz short set_env_change_variable_calc18 6595 <1> 6596 00009DCB 81FE00320900 <1> cmp esi, Env_Page + Env_Page_Size 6597 00009DD1 720B <1> jb short set_env_change_variable_calc19 6598 00009DD3 740E <1> je short set_env_change_variable_calc20 6599 <1> 6600 00009DD5 BEFF310900 <1> mov esi, Env_Page + Env_Page_Size - 1 6601 00009DDA 8806 <1> mov [esi], al ; 0 6602 00009DDC EB06 <1> jmp short set_env_change_variable_calc21 6603 <1> 6604 <1> set_env_change_variable_calc19: 6605 00009DDE AC <1> lodsb 6606 00009DDF 08C0 <1> or al, al 6607 00009DE1 75E3 <1> jnz short set_env_change_variable_calc18 6608 <1> 6609 <1> set_env_change_variable_calc20: 6610 00009DE3 4E <1> dec esi ; address of the second (last) 0 of the 00 6611 <1> 6612 <1> set_env_change_variable_calc21: 6613 <1> ; edx = difference (byte count) 6614 <1> 6615 00009DE4 89C8 <1> mov eax, ecx ; old variable's address (after '=') 6616 <1> 6617 00009DE6 89F1 <1> mov ecx, esi 6618 00009DE8 29F9 <1> sub ecx, edi ; count of bytes to move backward 6619 <1> 6620 00009DEA 89FE <1> mov esi, edi ; next variable's address 6621 00009DEC 29D7 <1> sub edi, edx ; (displacement) 6622 <1> 6623 00009DEE F3A4 <1> rep movsb 6624 <1> 6625 00009DF0 880F <1> mov [edi], cl ; 0 ; 00 ; end of environment variables 6626 <1> 6627 00009DF2 89C7 <1> mov edi, eax 6628 00009DF4 5A <1> pop edx ; ***** ; byte count (after '=') 6629 00009DF5 89D1 <1> mov ecx, edx 6630 00009DF7 89DE <1> mov esi, ebx ; ASCIIZ string address (after '=') 6631 00009DF9 89FB <1> mov ebx, edi 6632 <1> 6633 00009DFB F3A4 <1> rep movsb 6634 <1> 6635 00009DFD 880F <1> mov [edi], cl ; 0 ; end of variable 6636 <1> 6637 00009DFF 0FB605[E2820100] <1> movzx eax, byte [env_var_length] 6638 00009E06 01C2 <1> add edx, eax ; variable length (total) 6639 00009E08 F7D8 <1> neg eax 6640 00009E0A 01D8 <1> add eax, ebx ; start address of the variable 6641 00009E0C F8 <1> clc ; 13/04/2016 6642 00009E0D E9F7FDFFFF <1> jmp set_env_string_allocate_envb_retn ; OK ! 6643 <1> 6644 <1> ; 19/12/2025 6645 <1> loc_load_mainprog_cfg_exit: 6646 00009E12 C3 <1> retn 6647 <1> 6648 <1> mainprog_startup_configuration: 6649 <1> ; 19/12/2025 - TRDOS 386 Kernel v2.10.10 6650 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 6651 <1> ; 22/11/2017 6652 <1> ; 06/05/2016 6653 <1> ; 14/04/2016 (TRDOS 386 = TRDOS v2.0) 6654 <1> ; 17/09/2011 (TRDOS v1, MAINPROG.ASM) 6655 <1> ; 6656 <1> loc_load_mainprog_cfg_file: 6657 00009E13 BE[DD2E0100] <1> mov esi, MainProgCfgFile 6658 00009E18 66B80018 <1> mov ax, 1800h ; Except volume label and dirs 6659 00009E1C E859EBFFFF <1> call find_first_file 6660 00009E21 72EF <1> jc short loc_load_mainprog_cfg_exit 6661 <1> 6662 <1> ;or eax, eax 6663 <1> ;jz short loc_load_mainprog_cfg_exit 6664 <1> 6665 <1> loc_start_mainprog_configuration: 6666 <1> ; ESI = FindFile_DirEntry Location 6667 <1> ; EAX = File Size 6668 <1> 6669 00009E23 A3[64770100] <1> mov [MainProgCfg_FileSize], eax 6670 <1> 6671 00009E28 668B5614 <1> mov dx, [esi+DirEntry_FstClusHI] 6672 00009E2C C1E210 <1> shl edx, 16 6673 00009E2F 668B561A <1> mov dx, [esi+DirEntry_FstClusLO] 6674 <1> ;mov [csftdf_sf_cluster], edx 6675 <1> ; 19/12/2025 6676 00009E33 8915[98820100] <1> mov [MainProgCfg_cluster], edx 6677 <1> 6678 00009E39 89C1 <1> mov ecx, eax 6679 00009E3B 29C0 <1> sub eax, eax 6680 <1> 6681 <1> ; TRDOS 386 (TRDOS v2.0) 6682 <1> ; Allocate contiguous memory block for loading the file 6683 <1> 6684 <1> ; eax = 0 (Allocate memory from the beginning) 6685 <1> ; ecx = File (Allocation) size in bytes 6686 <1> 6687 00009E3D E803BFFFFF <1> call allocate_memory_block 6688 00009E42 72CE <1> jc short loc_load_mainprog_cfg_exit 6689 <1> 6690 <1> ;mov [csftdf_sf_mem_addr], eax ; loading address 6691 <1> ;mov [csftdf_sf_mem_bsize], ecx ; block size 6692 <1> ; 19/12/2025 6693 00009E44 A3[90820100] <1> mov [MainProgCfg_mem_addr], eax ; loading address 6694 00009E49 890D[94820100] <1> mov [MainProgCfg_mem_bsize], ecx ; block size 6695 <1> 6696 00009E4F 31DB <1> xor ebx, ebx 6697 <1> ;;mov [csftdf_sf_rbytes], ebx ; 0, reset 6698 <1> ; 19/12/2025 6699 <1> ;mov [MainProgCfg_rbytes], ebx ; 0, reset 6700 <1> 6701 00009E51 8A3D[76770100] <1> mov bh, [Current_Drv] ; [FindFile_Drv] 6702 00009E57 BE00010900 <1> mov esi, Logical_DOSDisks 6703 00009E5C 01DE <1> add esi, ebx 6704 <1> 6705 <1> ;mov ebx, [csftdf_sf_mem_addr] ; memory block address 6706 <1> ; 19/12/2025 6707 00009E5E 8B1D[90820100] <1> mov ebx, [MainProgCfg_mem_addr] 6708 <1> 6709 <1> ; 19/12/2025 6710 <1> %if 0 6711 <1> cmp byte [esi+LD_FATType], 0 6712 <1> ja short loc_mcfg_load_fat_file 6713 <1> 6714 <1> ;mov dword [csftdf_r_size], 65536 6715 <1> ; 19/12/2025 6716 <1> mov dword [MainProgCfg_r_size], 65536 6717 <1> jmp loc_mcfg_load_fs_file 6718 <1> 6719 <1> loc_load_mainprog_cfg_exit: 6720 <1> retn 6721 <1> %endif 6722 <1> 6723 <1> loc_mcfg_load_fat_file: 6724 <1> ;movzx eax, word [esi+LD_BPB+BytesPerSec] 6725 <1> ; 19/12/2025 6726 00009E64 B800020000 <1> mov eax, 512 6727 00009E69 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+SecPerClust] 6728 00009E6D F7E1 <1> mul ecx 6729 <1> ;mov [csftdf_r_size], eax 6730 <1> ; 19/12/2025 6731 00009E6F A3[A0820100] <1> mov [MainProgCfg_r_size], eax 6732 <1> 6733 <1> loc_mcfg_load_fat_file_next: 6734 00009E74 E817010000 <1> call mcfg_read_fat_file_sectors 6735 00009E79 7259 <1> jc short mcfg_deallocate_mem ; 25/07/2022 6736 <1> 6737 00009E7B 09D2 <1> or edx, edx ; edx > 0 -> EOF 6738 00009E7D 74F5 <1> jz short loc_mcfg_load_fat_file_next 6739 <1> 6740 <1> loc_mcfg_load_fat_file_ok: 6741 <1> ; 06/05/2016 6742 00009E7F C705[34830100]- <1> mov dword [mainprog_return_addr], loc_mcfg_ci_return_addr 6742 00009E85 [519F0000] <1> 6743 <1> ; 6744 <1> ;mov esi, [csftdf_sf_mem_addr] 6745 <1> ; 19/12/2025 6746 00009E89 8B35[90820100] <1> mov esi, [MainProgCfg_mem_addr] 6747 00009E8F 8935[68770100] <1> mov [MainProgCfg_LineOffset], esi 6748 <1> 6749 00009E95 A1[64770100] <1> mov eax, [MainProgCfg_FileSize] 6750 00009E9A 89C2 <1> mov edx, eax 6751 00009E9C 01F2 <1> add edx, esi 6752 <1> 6753 <1> loc_mcfg_process_next_line_check: 6754 00009E9E 89C1 <1> mov ecx, eax 6755 <1> 6756 00009EA0 803E2A <1> cmp byte [esi], "*" ; Remark sign 6757 00009EA3 7503 <1> jne short loc_mcfg_process_next_line 6758 00009EA5 46 <1> inc esi 6759 00009EA6 EB16 <1> jmp short loc_move_mainprog_cfg_nl1 6760 <1> 6761 <1> loc_mcfg_process_next_line: 6762 00009EA8 83F94F <1> cmp ecx, 79 6763 00009EAB 7604 <1> jna short loc_start_mainprog_cfg_process 6764 <1> 6765 <1> ;mov ecx, 79 6766 <1> ; 25/07/2022 6767 00009EAD 29C9 <1> sub ecx, ecx 6768 00009EAF B14F <1> mov cl, 79 6769 <1> 6770 <1> loc_start_mainprog_cfg_process: 6771 00009EB1 BF[26780100] <1> mov edi, CommandBuffer 6772 <1> 6773 <1> loc_move_mainprog_cfg_line: 6774 00009EB6 AC <1> lodsb 6775 00009EB7 3C20 <1> cmp al, 20h 6776 00009EB9 720C <1> jb short loc_move_mainprog_cfg_nl2 6777 00009EBB AA <1> stosb 6778 00009EBC E2F8 <1> loop loc_move_mainprog_cfg_line 6779 <1> 6780 <1> loc_move_mainprog_cfg_nl1: 6781 00009EBE 39D6 <1> cmp esi, edx ; + configuration file size 6782 00009EC0 7322 <1> jnb short loc_end_of_mainprog_cfg_line 6783 00009EC2 AC <1> lodsb 6784 00009EC3 3C20 <1> cmp al, 20h 6785 00009EC5 73F7 <1> jnb short loc_move_mainprog_cfg_nl1 6786 <1> 6787 <1> loc_move_mainprog_cfg_nl2: 6788 00009EC7 39D6 <1> cmp esi, edx 6789 00009EC9 7319 <1> jnb short loc_end_of_mainprog_cfg_line 6790 00009ECB 8A06 <1> mov al, [esi] 6791 00009ECD 3C20 <1> cmp al, 20h 6792 00009ECF 7713 <1> ja short loc_end_of_mainprog_cfg_line 6793 00009ED1 46 <1> inc esi 6794 00009ED2 EBF3 <1> jmp short loc_move_mainprog_cfg_nl2 6795 <1> 6796 <1> ; 25/07/2022 6797 <1> mcfg_deallocate_mem: 6798 <1> ;mov eax, [csftdf_sf_mem_addr] ; start address 6799 <1> ;mov ecx, [csftdf_sf_mem_bsize] ; block size 6800 <1> ; 19/12/2025 6801 00009ED4 A1[90820100] <1> mov eax, [MainProgCfg_mem_addr] ; start address 6802 00009ED9 8B0D[94820100] <1> mov ecx, [MainProgCfg_mem_bsize] ; block size 6803 <1> 6804 <1> ;call deallocate_memory_block 6805 <1> ;retn 6806 00009EDF E97BC0FFFF <1> jmp deallocate_memory_block 6807 <1> 6808 <1> loc_end_of_mainprog_cfg_line: 6809 00009EE4 C60700 <1> mov byte [edi], 0 6810 <1> 6811 00009EE7 8935[68770100] <1> mov [MainProgCfg_LineOffset], esi 6812 <1> 6813 <1> ; 22/11/2017 6814 00009EED BE[2E780100] <1> mov esi, CommandBuffer + 8 6815 00009EF2 29FE <1> sub esi, edi 6816 00009EF4 7606 <1> jna short loc_move_mainprog_cfg_command 6817 00009EF6 30C0 <1> xor al, al 6818 <1> loc_mainprog_cfg_clear_chrs: 6819 00009EF8 AA <1> stosb 6820 00009EF9 4E <1> dec esi 6821 00009EFA 75FC <1> jnz short loc_mainprog_cfg_clear_chrs 6822 <1> 6823 <1> loc_move_mainprog_cfg_command: 6824 00009EFC BE[26780100] <1> mov esi, CommandBuffer 6825 00009F01 89F7 <1> mov edi, esi 6826 00009F03 31DB <1> xor ebx, ebx 6827 <1> ;xor ecx, ecx 6828 00009F05 30C9 <1> xor cl, cl 6829 <1> 6830 <1> loc_move_mcfg_first_cmd_char: 6831 00009F07 8A041E <1> mov al, [esi+ebx] 6832 00009F0A FEC3 <1> inc bl 6833 00009F0C 3C20 <1> cmp al, 20h 6834 00009F0E 7712 <1> ja short loc_move_mcfg_cmd_capitalizing 6835 00009F10 7237 <1> jb short loc_move_mcfg_cmd_arguments_ok 6836 00009F12 80FB4F <1> cmp bl, 79 6837 00009F15 72F0 <1> jb short loc_move_mcfg_first_cmd_char 6838 00009F17 EB30 <1> jmp short loc_move_mcfg_cmd_arguments_ok 6839 <1> 6840 <1> loc_move_mcfg_next_cmd_char: 6841 00009F19 8A041E <1> mov al, [esi+ebx] 6842 00009F1C FEC3 <1> inc bl 6843 00009F1E 3C20 <1> cmp al, 20h 6844 00009F20 7614 <1> jna short loc_move_mcfg_cmd_ok 6845 <1> 6846 <1> loc_move_mcfg_cmd_capitalizing: 6847 00009F22 3C61 <1> cmp al, 61h ; 'a' 6848 00009F24 7206 <1> jb short loc_move_mcfg_cmd_caps_ok 6849 00009F26 3C7A <1> cmp al, 7Ah ; 'z' 6850 00009F28 7702 <1> ja short loc_move_mcfg_cmd_caps_ok 6851 00009F2A 24DF <1> and al, 0DFh ; sub al, 'a'-'A' 6852 <1> 6853 <1> loc_move_mcfg_cmd_caps_ok: 6854 00009F2C AA <1> stosb 6855 00009F2D FEC1 <1> inc cl 6856 00009F2F 80FB4F <1> cmp bl, 79 6857 00009F32 72E5 <1> jb short loc_move_mcfg_next_cmd_char 6858 00009F34 EB13 <1> jmp short loc_move_mcfg_cmd_arguments_ok 6859 <1> 6860 <1> loc_move_mcfg_cmd_ok: 6861 00009F36 30C0 <1> xor al, al ; 0 6862 <1> 6863 <1> loc_move_mcfg_cmd_arguments: 6864 00009F38 8807 <1> mov [edi], al 6865 00009F3A 47 <1> inc edi 6866 00009F3B 80FB4F <1> cmp bl, 79 6867 00009F3E 7309 <1> jnb short loc_move_mcfg_cmd_arguments_ok 6868 00009F40 8A041E <1> mov al, [esi+ebx] 6869 00009F43 FEC3 <1> inc bl 6870 00009F45 3C20 <1> cmp al, 20h 6871 00009F47 73EF <1> jnb short loc_move_mcfg_cmd_arguments 6872 <1> 6873 <1> loc_move_mcfg_cmd_arguments_ok: 6874 00009F49 C60700 <1> mov byte [edi], 0 6875 <1> 6876 <1> loc_mcfg_process_cmd_interpreter: 6877 00009F4C E828E1FFFF <1> call command_interpreter 6878 <1> 6879 <1> loc_mcfg_ci_return_addr: 6880 00009F51 A1[64770100] <1> mov eax, [MainProgCfg_FileSize] 6881 00009F56 89C2 <1> mov edx, eax 6882 00009F58 8B35[68770100] <1> mov esi, [MainProgCfg_LineOffset] 6883 00009F5E 01F2 <1> add edx, esi 6884 <1> ;add eax, [csftdf_sf_mem_addr] 6885 <1> ; 19/12/2025 6886 00009F60 0305[90820100] <1> add eax, [MainProgCfg_mem_addr] 6887 00009F66 29F0 <1> sub eax, esi 6888 00009F68 0F8730FFFFFF <1> ja loc_mcfg_process_next_line_check 6889 <1> 6890 00009F6E E861FFFFFF <1> call mcfg_deallocate_mem 6891 <1> 6892 00009F73 B94F000000 <1> mov ecx, 79 ; 80 ? 6893 00009F78 BF[26780100] <1> mov edi, CommandBuffer 6894 00009F7D 30C0 <1> xor al, al 6895 00009F7F F3AA <1> rep stosb 6896 <1> 6897 <1> ; 06/05/2016 6898 00009F81 BE[17390100] <1> mov esi, nextline 6899 00009F86 E82FCEFFFF <1> call print_msg 6900 00009F8B E98FD8FFFF <1> jmp dos_prompt 6901 <1> 6902 <1> ; 05/12/2025 6903 <1> ;mcfg_read_file_sectors: 6904 <1> ; 14/04/2016 6905 <1> ;cmp byte [esi+LD_FATType], 0 6906 <1> ;jna short mcfg_read_fs_file_sectors 6907 <1> 6908 <1> mcfg_read_fat_file_sectors: 6909 <1> ; return: 6910 <1> ; CF = 0 & EDX > 0 -> END OF FILE 6911 <1> ; CF = 0 & EDX = 0 -> not EOF 6912 <1> ; CF = 1 -> read error (error code in AL) 6913 <1> 6914 <1> mcfg_read_fat_file_secs_0: 6915 00009F90 8B15[64770100] <1> mov edx, [MainProgCfg_FileSize] 6916 <1> ;sub edx, [csftdf_sf_rbytes] 6917 <1> ; 19/12/2025 6918 00009F96 2B15[A8820100] <1> sub edx, [MainProgCfg_rbytes] 6919 <1> ;cmp edx, [csftdf_r_size] 6920 00009F9C 3B15[A0820100] <1> cmp edx, [MainProgCfg_r_size] 6921 00009FA2 7306 <1> jnb short mcfg_read_fat_file_secs_1 6922 <1> ;mov [csftdf_r_size], edx 6923 <1> ; 19/12/2025 6924 00009FA4 8915[A0820100] <1> mov [MainProgCfg_r_size], edx 6925 <1> 6926 <1> mcfg_read_fat_file_secs_1: 6927 <1> ;mov eax, [csftdf_r_size] 6928 <1> ; 19/12/2025 6929 00009FAA A1[A0820100] <1> mov eax, [MainProgCfg_r_size] 6930 00009FAF 29D2 <1> sub edx, edx 6931 <1> ;movzx ecx, word [esi+LD_BPB+BytesPerSec] 6932 <1> ; 19/12/2025 6933 00009FB1 B900020000 <1> mov ecx, 512 6934 00009FB6 01C8 <1> add eax, ecx 6935 00009FB8 48 <1> dec eax 6936 00009FB9 F7F1 <1> div ecx 6937 00009FBB 89C1 <1> mov ecx, eax ; sector count 6938 <1> ;mov eax, [csftdf_sf_cluster] 6939 <1> ; 19/12/2025 6940 00009FBD A1[98820100] <1> mov eax, [MainProgCfg_cluster] 6941 <1> 6942 <1> ; EBX = memory block address (current) 6943 <1> 6944 00009FC2 E8B8210000 <1> call read_fat_file_sectors 6945 00009FC7 7230 <1> jc short mcfg_read_fat_file_secs_3 6946 <1> 6947 <1> ; EBX = next memory address 6948 <1> 6949 <1> ;mov eax, [csftdf_sf_rbytes] 6950 <1> ; 19/12/2025 6951 00009FC9 A1[A8820100] <1> mov eax, [MainProgCfg_rbytes] 6952 <1> ;add eax, [csftdf_r_size] 6953 00009FCE 0305[A0820100] <1> add eax, [MainProgCfg_r_size] 6954 00009FD4 8B15[64770100] <1> mov edx, [MainProgCfg_FileSize] 6955 00009FDA 39D0 <1> cmp eax, edx 6956 00009FDC 731B <1> jnb short mcfg_read_fat_file_secs_3 ; edx > 0 6957 <1> ;mov [csftdf_sf_rbytes], eax 6958 <1> ; 19/12/2025 6959 00009FDE A3[A8820100] <1> mov [MainProgCfg_rbytes], eax 6960 <1> 6961 00009FE3 53 <1> push ebx ; * 6962 <1> ; get next cluster (csftdf_r_size! bytes) 6963 <1> ;mov eax, [csftdf_sf_cluster] 6964 <1> ; 19/12/2025 6965 00009FE4 A1[98820100] <1> mov eax, [MainProgCfg_cluster] 6966 00009FE9 E89B1F0000 <1> call get_next_cluster 6967 00009FEE 5B <1> pop ebx ; * 6968 00009FEF 7301 <1> jnc short mcfg_read_fat_file_secs_2 6969 <1> 6970 <1> ;mov eax, 17; Read error ! 6971 00009FF1 C3 <1> retn 6972 <1> 6973 <1> mcfg_read_fat_file_secs_2: 6974 00009FF2 29D2 <1> sub edx, edx ; 0 6975 <1> ;mov [csftdf_sf_cluster], eax ; next cluster 6976 <1> ; 19/12/2025 6977 00009FF4 A3[98820100] <1> mov [MainProgCfg_cluster], eax 6978 <1> 6979 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 6980 <1> 6981 <1> mcfg_read_fat_file_secs_3: 6982 <1> ; 19/12/2025 6983 <1> ; ;retn 6984 <1> ; 6985 <1> ;mcfg_read_fs_file_sectors: 6986 <1> ; ;retn 6987 <1> ; 6988 <1> ;loc_mcfg_load_fs_file: 6989 00009FF9 C3 <1> retn 6990 <1> 6991 <1> load_and_execute_file: 6992 <1> ; 02/12/2025 6993 <1> ; 04/07/2025 6994 <1> ; 03/07/2025 - TRDOS 386 Kernel v2.0.10 6995 <1> ; 03/09/2024 - TRDOS 386 Kernel v2.0.9 6996 <1> ; 30/08/2023 - TRDOS 386 Kernel v2.0.6 6997 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 6998 <1> ; 04/01/2017 6999 <1> ; 06/05/2016 - 07/05/2016 - 11/05/2016 7000 <1> ; 23/04/2016 - 24/04/2016 7001 <1> ; 22/04/2016 (TRDOS 386 = TRDOS v2.0) 7002 <1> ; 05/11/2011 7003 <1> ; (TRDOS v1, CMDINTR.ASM, 'cmp_cmd_run', 'cmp_cmd_external') 7004 <1> ; ('loc_run_check_filename') 7005 <1> ; 29/08/2011 7006 <1> ; 10/09/2011 7007 <1> ; INPUT-> 7008 <1> ; ESI = Path Name address (CommandBuffer address) 7009 <1> ; OUTPUT -> 7010 <1> ; none (error message will be shown if an error will occur) 7011 <1> ; 7012 <1> ; (EAX, EBX, ECX, EDX, ESI, EDI, EBP will be changed) 7013 <1> ; 7014 <1> loc_run_check_filename: 7015 00009FFA 803E20 <1> cmp byte [esi], 20h 7016 <1> ;jb loc_cmd_failed 7017 <1> ; 25/07/2022 7018 00009FFD 7237 <1> jb short loc_run_ppn_failed 7019 00009FFF 7703 <1> ja short loc_run_check_filename_ok 7020 0000A001 46 <1> inc esi 7021 0000A002 EBF6 <1> jmp short loc_run_check_filename 7022 <1> 7023 <1> loc_run_check_filename_ok: 7024 0000A004 C605[D7770100]00 <1> mov byte [CmdArgStart], 0 ; reset 7025 0000A00B 56 <1> push esi ; * 7026 <1> loc_run_get_first_arg_pos: 7027 0000A00C 46 <1> inc esi 7028 0000A00D 8A06 <1> mov al, [esi] 7029 0000A00F 3C20 <1> cmp al, 20h 7030 0000A011 77F9 <1> ja short loc_run_get_first_arg_pos 7031 0000A013 C60600 <1> mov byte [esi], 0 7032 <1> loc_run_get_external_arg_pos: 7033 <1> ; 11/05/2016 7034 0000A016 46 <1> inc esi 7035 0000A017 8A06 <1> mov al, [esi] 7036 0000A019 3C20 <1> cmp al, 20h 7037 0000A01B 760C <1> jna short loc_run_parse_path_name 7038 0000A01D 89F0 <1> mov eax, esi 7039 0000A01F 2D[26780100] <1> sub eax, CommandBuffer 7040 0000A024 A2[D7770100] <1> mov byte [CmdArgStart], al 7041 <1> loc_run_parse_path_name: 7042 0000A029 5E <1> pop esi ; * 7043 0000A02A BF[16800100] <1> mov edi, FindFile_Drv 7044 0000A02F E84A090000 <1> call parse_path_name 7045 <1> ;jc loc_cmd_failed 7046 <1> ; 25/07/2022 7047 0000A034 7305 <1> jnc short loc_run_check_filename_exists 7048 <1> loc_run_ppn_failed: 7049 0000A036 E919E4FFFF <1> jmp loc_cmd_failed 7050 <1> 7051 <1> loc_run_check_filename_exists: 7052 0000A03B BE[58800100] <1> mov esi, FindFile_Name 7053 0000A040 803E20 <1> cmp byte [esi], 20h 7054 <1> ;jna loc_cmd_failed 7055 <1> ; 25/07/2022 7056 0000A043 76F1 <1> jna short loc_run_ppn_failed 7057 <1> 7058 <1> loc_run_check_exe_filename_ext: 7059 0000A045 E896020000 <1> call check_prg_filename_ext 7060 <1> ;jc loc_cmd_failed 7061 <1> ; 25/07/2022 7062 0000A04A 72EA <1> jc short loc_run_ppn_failed 7063 <1> ; 03/07/2025 7064 <1> ; if al = 0 -> ah = file name length 7065 <1> 7066 <1> loc_run_check_exe_filename_ext_ok: 7067 0000A04C 66A3[31830100] <1> mov word [EXE_ID], ax ; 'P.' or 'P'+0 7068 <1> 7069 <1> loc_run_drv: 7070 0000A052 C605[30830100]00 <1> mov byte [Run_Manual_Path], 0 7071 0000A059 A1[70770100] <1> mov eax, [Current_Dir_FCluster] 7072 0000A05E A3[24830100] <1> mov [Run_CDirFC], eax 7073 <1> ; 7074 0000A063 8A35[76770100] <1> mov dh, [Current_Drv] 7075 0000A069 8835[D37E0100] <1> mov [RUN_CDRV], dh 7076 <1> 7077 0000A06F 8A15[16800100] <1> mov dl, [FindFile_Drv] 7078 0000A075 38F2 <1> cmp dl, dh 7079 0000A077 7413 <1> je short loc_run_change_directory 7080 <1> 7081 0000A079 8005[30830100]02 <1> add byte [Run_Manual_Path], 2 7082 <1> 7083 0000A080 E86BD6FFFF <1> call change_current_drive 7084 <1> ;jc loc_run_cmd_failed 7085 <1> ; 25/07/2022 7086 0000A085 7305 <1> jnc short loc_run_change_directory 7087 0000A087 E9F3E3FFFF <1> jmp loc_run_cmd_failed 7088 <1> 7089 <1> loc_run_change_directory: 7090 0000A08C 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 7091 0000A093 7624 <1> jna short loc_run_find_executable_file 7092 <1> 7093 0000A095 FE05[30830100] <1> inc byte [Run_Manual_Path] 7094 <1> 7095 0000A09B FE05[8E2E0100] <1> inc byte [Restore_CDIR] 7096 <1> 7097 0000A0A1 BE[17800100] <1> mov esi, FindFile_Directory 7098 0000A0A6 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 7099 0000A0A8 E83E030000 <1> call change_current_directory 7100 <1> ;jc loc_run_cmd_failed 7101 <1> ; 25/07/2022 7102 0000A0AD 7305 <1> jnc short loc_run_change_prompt_dir_string 7103 0000A0AF E9CBE3FFFF <1> jmp loc_run_cmd_failed 7104 <1> 7105 <1> loc_run_change_prompt_dir_string: 7106 0000A0B4 E85B020000 <1> call change_prompt_dir_string 7107 <1> 7108 <1> loc_run_find_executable_file: 7109 0000A0B9 66C705[2C830100]00- <1> mov word [Run_Auto_Path], 0 7109 0000A0C1 00 <1> 7110 <1> 7111 <1> loc_run_find_executable_file_next: 7112 0000A0C2 BE[58800100] <1> mov esi, FindFile_Name 7113 <1> loc_run_find_program_file_next: 7114 0000A0C7 66B80018 <1> mov ax, 1800h ; Except volume label and dirs 7115 0000A0CB E8AAE8FFFF <1> call find_first_file 7116 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 7117 <1> ; EDI = Directory Buffer Directory Entry Location 7118 <1> ; EAX = File size 7119 <1> ;jnc loc_load_and_run_file 7120 <1> ; 25/07/2022 7121 0000A0D0 7216 <1> jc short loc_run_program_file_not_found 7122 <1> 7123 <1> ; 02/12/2025 (TRDOS 386 v2.0.10) 7124 0000A0D2 8B471C <1> mov eax, [edi+DirEntry_FileSize] 7125 0000A0D5 21C0 <1> and eax, eax ; zero file size check? 7126 0000A0D7 750A <1> jnz short loc_load_and_run_file_@ 7127 0000A0D9 B814000000 <1> mov eax, ERR_FILE_SIZE 7128 <1> ; 20, 'file size error !' 7129 <1> ;mov eax, ERR_ZERO_LENGTH 7130 <1> ; 20, 'zero length !' error 7131 0000A0DE E99CE3FFFF <1> jmp loc_run_cmd_failed 7132 <1> 7133 <1> loc_load_and_run_file_@: 7134 0000A0E3 E957010000 <1> jmp loc_load_and_run_file 7135 <1> 7136 <1> loc_run_program_file_not_found: 7137 0000A0E8 3C02 <1> cmp al, 2 ; file not found 7138 <1> ;jne loc_run_cmd_failed 7139 <1> ; 25/07/2022 7140 0000A0EA 7405 <1> je short loc_run_progr_file_chk_prg_ext 7141 0000A0EC E98EE3FFFF <1> jmp loc_run_cmd_failed 7142 <1> 7143 <1> loc_run_progr_file_chk_prg_ext: ; 25/07/2022 7144 0000A0F1 66A1[31830100] <1> mov ax, word [EXE_ID] 7145 <1> 7146 <1> ;cmp ah, '.' ; File name has extension sign 7147 <1> ;je short loc_run_check_auto_path 7148 <1> ;or al, al 7149 <1> ;jnz short loc_run_check_auto_path 7150 <1> ; 03/07/2025 7151 0000A0F7 663D502E <1> cmp ax, 'P.' 7152 0000A0FB 7420 <1> je short loc_run_check_auto_path 7153 <1> 7154 0000A0FD 80FC08 <1> cmp ah, 8 ; count of file name chars 7155 0000A100 771B <1> ja short loc_run_check_auto_path 7156 <1> 7157 <1> loc_run_change_file_ext_to_prg: 7158 0000A102 0FB6DC <1> movzx ebx, ah ; count of file name chars 7159 0000A105 BE[58800100] <1> mov esi, FindFile_Name 7160 0000A10A 01F3 <1> add ebx, esi 7161 <1> ; 07/05/2016 7162 0000A10C C7032E505247 <1> mov dword [ebx], '.PRG' 7163 0000A112 66C705[31830100]50- <1> mov word [EXE_ID], 'P.' 7163 0000A11A 2E <1> 7164 0000A11B EBAA <1> jmp short loc_run_find_program_file_next 7165 <1> 7166 <1> loc_run_check_auto_path: 7167 <1> ; NOTE: /// 07/05/2016 /// 7168 <1> ; If the path is given, value of byte [Run_Manual_Path] 7169 <1> ; will not be ZERO. If so, file searching by using 7170 <1> ; Automatic Path (via 'PATH' environment variable) 7171 <1> ; will not be applicable, because the program file 7172 <1> ; is already/absolutely not found. 7173 <1> 7174 0000A11D A0[30830100] <1> mov al, [Run_Manual_Path] 7175 0000A122 08C0 <1> or al, al 7176 <1> ;jnz loc_cmd_failed 7177 <1> ; 25/07/2022 7178 0000A124 752B <1> jnz short loc_run_cap_failed 7179 <1> 7180 <1> loc_run_check_auto_path_again: 7181 <1> ;cmp word [Run_Auto_Path], 0FFFFh 7182 <1> ; ; 0FFFFh = Not a valid run path (in ENV block) 7183 <1> ;;jnb loc_cmd_failed 7184 <1> ;; 25/07/2022 7185 <1> ;jnb short loc_run_cap_failed 7186 <1> ; 03/07/2025 7187 0000A126 FF05[2C830100] <1> inc dword [Run_Auto_Path] ; 0FFFFFFFFh -> 0 7188 0000A12C 7423 <1> jz short loc_run_cap_failed ; -1 -> 0 7189 <1> 7190 <1> ; 03/07/2025 7191 0000A12E BF[76780100] <1> mov edi, TextBuffer 7192 0000A133 FF0D[2C830100] <1> dec dword [Run_Auto_Path] ; 0 -> init auto path 7193 0000A139 751D <1> jnz short loc_run_chk_filename_ext_next 7194 <1> 7195 <1> ;xor al, al 7196 0000A13B BE[632F0100] <1> mov esi, Cmd_Path ; 'PATH' 7197 <1> ; 03/07/2025 7198 <1> ;mov edi, TextBuffer 7199 <1> ; al = 0 7200 <1> ; 03/09/2024 (bugfix) 7201 0000A140 66B90001 <1> mov cx, 256 ; TextBuffer (maximum) length 7202 0000A144 E86EF9FFFF <1> call get_environment_string 7203 0000A149 7315 <1> jnc short loc_run_chk_filename_ext_again 7204 <1> ;mov word [Run_Auto_Path], 0FFFFh ; invalid 7205 <1> ; 03/07/2025 7206 0000A14B FF0D[2C830100] <1> dec dword [Run_Auto_Path] ; -1 (invalid) 7207 <1> loc_run_cap_failed: ; 25/07/2022 7208 <1> ;jmp loc_cmd_failed 7209 <1> ; 30/08/2023 7210 0000A151 B001 <1> mov al, 1 ; (force jump to loc_cmd_failed at the end) 7211 0000A153 E927E3FFFF <1> jmp loc_run_cmd_failed ; (restore cdir if it is needed) 7212 <1> 7213 <1> ; 03/07/2025 7214 <1> loc_run_chk_filename_ext_next: 7215 0000A158 8B0D[28830100] <1> mov ecx, [Run_Path_Length] 7216 0000A15E EB09 <1> jmp short loc_run_chk_filename_ext_again_@ 7217 <1> 7218 <1> loc_run_chk_filename_ext_again: 7219 0000A160 89C1 <1> mov ecx, eax ; string length (with zero tail) 7220 0000A162 49 <1> dec ecx ; without zero tail 7221 <1> ; 03/07/2025 7222 0000A163 890D[28830100] <1> mov [Run_Path_Length], ecx 7223 <1> loc_run_chk_filename_ext_again_@: 7224 <1> ; 04/07/2025 7225 <1> ;mov ax, [EXE_ID] 7226 <1> ;cmp ah, '.' 7227 <1> ;je short loc_run_chk_auto_path_pos 7228 <1> 7229 <1> loc_run_change_file_ext_to_noext_again: 7230 <1> ; 04/07/2025 7231 <1> ;movzx ebx, ah 7232 0000A169 BE[58800100] <1> mov esi, FindFile_Name 7233 <1> ;add ebx, esi 7234 0000A16E 31C0 <1> xor eax, eax 7235 <1> loc_run_change_file_ext_to_noext_@: 7236 0000A170 46 <1> inc esi 7237 0000A171 FEC4 <1> inc ah 7238 <1> ;cmp al, '.' 7239 0000A173 803E2E <1> cmp byte [esi], '.' 7240 0000A176 75F8 <1> jne short loc_run_change_file_ext_to_noext_@ 7241 0000A178 66A3[31830100] <1> mov [EXE_ID], ax 7242 <1> ; al = 0, ah = file name length 7243 <1> ;sub eax, eax 7244 <1> ;;mov [ebx], eax ; 0 ; erase extension (.PRG) 7245 <1> ;mov [esi], eax ; 0 7246 0000A17E 8806 <1> mov [esi], al ; 0 7247 <1> 7248 <1> loc_run_chk_auto_path_pos: 7249 <1> ;;movzx eax, word [Run_Auto_Path] 7250 <1> ;mov ax, [Run_Auto_Path] 7251 <1> ; 03/07/2025 7252 0000A180 A1[2C830100] <1> mov eax, [Run_Auto_Path] 7253 0000A185 39C8 <1> cmp eax, ecx ; ecx = string length (except zero tail) 7254 <1> ;jnb loc_cmd_failed 7255 <1> ; 25/07/2022 7256 0000A187 73C8 <1> jnb short loc_run_cap_failed 7257 <1> 7258 <1> ; 03/07/2025 7259 0000A189 09C0 <1> or eax, eax 7260 <1> ;or ax, ax 7261 0000A18B 7502 <1> jnz short loc_run_auto_path_pos_move 7262 0000A18D B005 <1> mov al, 5 7263 <1> 7264 <1> loc_run_auto_path_pos_move: 7265 0000A18F 89FE <1> mov esi, edi ; offset TextBuffer 7266 <1> ; 04/07/2025 7267 0000A191 BF[F6780100] <1> mov edi, RunPathBuffer 7268 0000A196 01C6 <1> add esi, eax 7269 <1> 7270 <1> loc_run_auto_path_pos_space_loop: 7271 0000A198 AC <1> lodsb 7272 0000A199 3C20 <1> cmp al, 20h 7273 0000A19B 74FB <1> je short loc_run_auto_path_pos_space_loop 7274 <1> ;jb loc_cmd_failed 7275 <1> ; 25/07/2022 7276 0000A19D 72B2 <1> jb short loc_run_cap_failed 7277 <1> ; 7278 <1> loc_run_auto_path_pos_move_next_@: 7279 0000A19F AA <1> stosb 7280 <1> loc_run_auto_path_pos_move_next: 7281 0000A1A0 AC <1> lodsb 7282 0000A1A1 3C3B <1> cmp al, ';' 7283 0000A1A3 741B <1> je short loc_run_auto_path_pos_move_last_byte 7284 0000A1A5 3C20 <1> cmp al, 20h 7285 0000A1A7 74F7 <1> je short loc_run_auto_path_pos_move_next 7286 <1> ;jb short loc_byte_ptr_end_of_path 7287 <1> ;stosb 7288 <1> ;jmp short loc_run_auto_path_pos_move_next 7289 <1> ; 03/09/2024 7290 0000A1A9 73F4 <1> jnb short loc_run_auto_path_pos_move_next_@ 7291 <1> 7292 <1> loc_byte_ptr_end_of_path: 7293 0000A1AB 66C705[2C830100]FF- <1> mov word [Run_Auto_Path], 0FFFFh ; end of path 7293 0000A1B3 FF <1> 7294 <1> ; 03/07/2025 7295 0000A1B4 C705[2C830100]FFFF- <1> mov dword [Run_Auto_Path], 0FFFFFFFFh 7295 0000A1BC FFFF <1> 7296 0000A1BE EB0C <1> jmp short loc_run_auto_path_move_ok 7297 <1> 7298 <1> loc_run_auto_path_pos_move_last_byte: 7299 0000A1C0 89F0 <1> mov eax, esi 7300 0000A1C2 2D[76780100] <1> sub eax, TextBuffer 7301 <1> ;mov [Run_Auto_Path], ax ; next path position 7302 <1> ; 03/07/2025 7303 0000A1C7 A3[2C830100] <1> mov [Run_Auto_Path], eax 7304 <1> 7305 <1> loc_run_auto_path_move_ok: 7306 0000A1CC 4F <1> dec edi 7307 0000A1CD B02F <1> mov al, '/' 7308 0000A1CF 3807 <1> cmp [edi], al 7309 0000A1D1 7403 <1> je short loc_run_auto_path_move_file_name 7310 0000A1D3 47 <1> inc edi 7311 0000A1D4 8807 <1> mov [edi], al 7312 <1> 7313 <1> loc_run_auto_path_move_file_name: 7314 0000A1D6 47 <1> inc edi 7315 0000A1D7 BE[58800100] <1> mov esi, FindFile_Name 7316 <1> 7317 <1> loc_run_auto_path_move_fn_loop: 7318 0000A1DC AC <1> lodsb 7319 0000A1DD AA <1> stosb 7320 0000A1DE 08C0 <1> or al, al 7321 0000A1E0 75FA <1> jnz short loc_run_auto_path_move_fn_loop 7322 <1> 7323 <1> ;mov esi, TextBuffer 7324 <1> ; 04/07/2025 7325 0000A1E2 BE[F6780100] <1> mov esi, RunPathBuffer 7326 0000A1E7 BF[16800100] <1> mov edi, FindFile_Drv 7327 0000A1EC E88D070000 <1> call parse_path_name 7328 <1> ;jc loc_run_cmd_failed 7329 <1> ; 25/07/2022 7330 <1> ;jnc short loc_run_change_current_drive 7331 <1> ;jmp loc_run_cmd_failed 7332 0000A1F1 723D <1> jc short loc_run_path_failed 7333 <1> 7334 <1> loc_run_change_current_drive: 7335 0000A1F3 8A35[76770100] <1> mov dh, [Current_Drv] 7336 0000A1F9 8A15[16800100] <1> mov dl, [FindFile_Drv] 7337 0000A1FF 38F2 <1> cmp dl, dh 7338 0000A201 7407 <1> je short loc_run_change_directory_again 7339 <1> 7340 0000A203 E8E8D4FFFF <1> call change_current_drive 7341 <1> ;jc loc_run_cmd_failed 7342 <1> ; 25/07/2022 7343 <1> ;jnc short loc_run_change_directory_again 7344 <1> ;jmp loc_run_cmd_failed 7345 0000A208 7226 <1> jc short loc_run_path_failed 7346 <1> 7347 <1> loc_run_change_directory_again: 7348 0000A20A 803D[17800100]20 <1> cmp byte [FindFile_Directory], 20h 7349 0000A211 7627 <1> jna short loc_load_executable_cdir_chk_again 7350 <1> 7351 0000A213 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 7352 0000A219 BE[17800100] <1> mov esi, FindFile_Directory 7353 0000A21E 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 7354 0000A220 E8C6010000 <1> call change_current_directory 7355 <1> ;jc loc_run_cmd_failed 7356 <1> ; 25/07/2022 7357 0000A225 730E <1> jnc short loc_run_chg_prompt_dir_str_again 7358 <1> 7359 <1> ; 03/07/2025 7360 <1> ; ignore 'directory not found' error 7361 <1> ; if auto path in progress 7362 0000A227 803D[30830100]00 <1> cmp byte [Run_Manual_Path], 0 7363 0000A22E 760A <1> jna short jmp_loc_run_find_executable_file_next 7364 <1> 7365 <1> loc_run_path_failed: ; 25/07/2022 7366 0000A230 E94AE2FFFF <1> jmp loc_run_cmd_failed 7367 <1> 7368 <1> loc_run_chg_prompt_dir_str_again: 7369 0000A235 E8DA000000 <1> call change_prompt_dir_string 7370 <1> 7371 <1> loc_load_executable_cdir_chk_again: 7372 <1> ; 04/07/2025 7373 <1> %if 0 7374 <1> ; 03/07/2025 7375 <1> mov al, [Current_Drv] 7376 <1> cmp al, [RUN_CDRV] 7377 <1> jne short jmp_loc_run_find_executable_file_next 7378 <1> ; 7379 <1> mov eax, [Current_Dir_FCluster] 7380 <1> cmp eax, [Run_CDirFC] 7381 <1> ;jne loc_run_find_executable_file_next 7382 <1> ; 30/08/2023 7383 <1> je short jmp_loc_run_check_auto_path_again 7384 <1> 7385 <1> jmp_loc_run_find_executable_file_next: ; 03/07/2025 7386 <1> jmp loc_run_find_executable_file_next 7387 <1> jmp_loc_run_check_auto_path_again: 7388 <1> xor al, al ; 0 7389 <1> jmp loc_run_check_auto_path_again 7390 <1> %else 7391 <1> ; 04/07/2025 7392 <1> jmp_loc_run_find_executable_file_next: 7393 0000A23A E983FEFFFF <1> jmp loc_run_find_executable_file_next 7394 <1> %endif 7395 <1> 7396 <1> loc_load_and_run_file: 7397 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 7398 <1> ; 13/11/2017 7399 <1> ; 04/01/2017 7400 <1> ; 23/04/2016 7401 0000A23F BE[58800100] <1> mov esi, FindFile_Name 7402 0000A244 BF[76780100] <1> mov edi, TextBuffer 7403 <1> 7404 <1> ; 24/04/2016 7405 0000A249 31D2 <1> xor edx, edx 7406 <1> ;mov word [argc], dx ; 0 7407 <1> ; 25/07/2022 7408 0000A24B 8915[688F0100] <1> mov dword [argc], edx 7409 0000A251 8915[988E0100] <1> mov dword [u.nread], edx ; 0 7410 <1> 7411 <1> loc_load_and_run_file_1: 7412 0000A257 AC <1> lodsb 7413 0000A258 AA <1> stosb 7414 0000A259 FF05[988E0100] <1> inc dword [u.nread] 7415 0000A25F 20C0 <1> and al, al 7416 0000A261 75F4 <1> jnz short loc_load_and_run_file_1 7417 <1> 7418 0000A263 A0[D7770100] <1> mov al, [CmdArgStart] 7419 0000A268 20C0 <1> and al, al 7420 0000A26A 7442 <1> jz short loc_load_and_run_file_7 7421 <1> 7422 0000A26C 0FB6F0 <1> movzx esi, al ; 11/05/2016 7423 <1> ;mov ecx, 80 7424 <1> ; 25/07/2022 7425 0000A26F 31C9 <1> xor ecx, ecx 7426 0000A271 B150 <1> mov cl, 80 7427 <1> ;sub ecx, esi 7428 0000A273 28C1 <1> sub cl, al 7429 0000A275 81C6[26780100] <1> add esi, CommandBuffer 7430 <1> 7431 <1> ;inc word [argc] ; 11/05/2016 7432 <1> ; 25/07/2022 7433 0000A27B FF05[688F0100] <1> inc dword [argc] 7434 <1> 7435 <1> loc_load_and_run_file_2: 7436 0000A281 AC <1> lodsb 7437 0000A282 3C20 <1> cmp al, 20h 7438 0000A284 7716 <1> ja short loc_load_and_run_file_5 7439 0000A286 721D <1> jb short loc_load_and_run_file_6 7440 <1> 7441 <1> loc_load_and_run_file_3: 7442 0000A288 803E20 <1> cmp byte [esi], 20h 7443 0000A28B 7707 <1> ja short loc_load_and_run_file_4 7444 0000A28D 7216 <1> jb short loc_load_and_run_file_6 7445 0000A28F 46 <1> inc esi 7446 0000A290 E2F6 <1> loop loc_load_and_run_file_3 7447 0000A292 EB11 <1> jmp short loc_load_and_run_file_6 7448 <1> 7449 <1> loc_load_and_run_file_4: 7450 0000A294 28C0 <1> sub al, al ; 0 7451 <1> ;inc word [argc] 7452 <1> ; 25/07/2022 7453 0000A296 FF05[688F0100] <1> inc dword [argc] 7454 <1> loc_load_and_run_file_5: 7455 0000A29C AA <1> stosb 7456 0000A29D FF05[988E0100] <1> inc dword [u.nread] 7457 0000A2A3 E2DC <1> loop loc_load_and_run_file_2 7458 <1> 7459 <1> loc_load_and_run_file_6: 7460 0000A2A5 30C0 <1> xor al, al ; 0 7461 0000A2A7 AA <1> stosb 7462 0000A2A8 FF05[988E0100] <1> inc dword [u.nread] 7463 <1> loc_load_and_run_file_7: 7464 0000A2AE 8807 <1> mov [edi], al ; 0 7465 <1> ;inc word [argc] ; 24/04/2016 7466 <1> ; 25/07/2022 7467 0000A2B0 FF05[688F0100] <1> inc dword [argc] 7468 0000A2B6 FF05[988E0100] <1> inc dword [u.nread] ; 24/04/2016 7469 0000A2BC BE[76780100] <1> mov esi, TextBuffer 7470 0000A2C1 8B15[84800100] <1> mov edx, [FindFile_DirEntry+DirEntry_FileSize] 7471 0000A2C7 66A1[7C800100] <1> mov ax, [FindFile_DirEntry+DirEntry_FstClusHI] 7472 0000A2CD C1E010 <1> shl eax, 16 ; 13/11/2017 7473 0000A2D0 66A1[82800100] <1> mov ax, [FindFile_DirEntry+DirEntry_FstClusLO] 7474 <1> ; EAX = First Cluster number 7475 <1> ; EDX = File Size 7476 <1> ; ESI = Argument list address 7477 <1> ; [argc] = argument count 7478 <1> ; [u.nread] = argument list length 7479 0000A2D6 E8BA620000 <1> call load_and_run_file ; trdosk6.s 7480 <1> ;jc loc_run_cmd_failed ; 04/01/2017 7481 <1> loc_load_and_run_file_8: ; 06/05/2016 7482 0000A2DB E968EAFFFF <1> jmp loc_file_rw_restore_retn 7483 <1> 7484 <1> check_prg_filename_ext: 7485 <1> ; 23/04/2016 (TRDOS 386 = TRDOS v2.0) 7486 <1> ; 10/09/2011 7487 <1> ; (TRDOS v1, CMDINTR.ASM, 'proc_check_exe_filename_ext') 7488 <1> ; 14/11/2009 7489 <1> ; INPUT -> 7490 <1> ; ESI = Dot File Name 7491 <1> ; OUTPUT -> 7492 <1> ; cf = 0 -> EXE_ID in AL 7493 <1> ; ESI = Last char + 1 position 7494 <1> ; cf = 1 -> Invalid executable file name 7495 <1> ; or no file name extension if AH<=8 7496 <1> ; AL = Last file name char 7497 <1> ; cf = 0 -> AL='P' (PRG), AL=0 (no extension) 7498 <1> ; 7499 <1> ; (Modified registers: EAX, ESI) 7500 <1> 7501 0000A2E0 30E4 <1> xor ah, ah 7502 <1> loc_run_check_filename_ext: 7503 0000A2E2 AC <1> lodsb 7504 0000A2E3 3C21 <1> cmp al, 21h 7505 0000A2E5 7229 <1> jb short loc_check_exe_fn_retn 7506 0000A2E7 FEC4 <1> inc ah 7507 0000A2E9 3C2E <1> cmp al, '.' 7508 0000A2EB 75F5 <1> jne short loc_run_check_filename_ext 7509 <1> 7510 <1> loc_run_check_filename_ext_dot: 7511 0000A2ED 80FC02 <1> cmp ah, 2 ; .??? is not valid 7512 0000A2F0 88C4 <1> mov ah, al ; '.' 7513 0000A2F2 7219 <1> jb short loc_check_prg_fn_retn 7514 <1> 7515 <1> loc_run_check_filename_ext_dot_ok: 7516 0000A2F4 AC <1> lodsb 7517 0000A2F5 24DF <1> and al, 0DFh 7518 <1> 7519 <1> loc_run_check_filename_ext_prg: 7520 0000A2F7 3C50 <1> cmp al, 'P' 7521 0000A2F9 7212 <1> jb short loc_check_prg_fn_retn 7522 0000A2FB 7711 <1> ja short loc_check_prg_fn_stc 7523 0000A2FD AC <1> lodsb 7524 0000A2FE 24DF <1> and al, 0DFh 7525 0000A300 3C52 <1> cmp al, 'R' 7526 0000A302 750A <1> jne short loc_check_prg_fn_stc 7527 0000A304 AC <1> lodsb 7528 0000A305 24DF <1> and al, 0DFh 7529 0000A307 3C47 <1> cmp al, 'G' 7530 0000A309 7503 <1> jne short loc_check_prg_fn_stc 7531 <1> 7532 0000A30B B050 <1> mov al, 'P' 7533 <1> loc_check_prg_fn_retn: 7534 0000A30D C3 <1> retn 7535 <1> 7536 <1> ; 25/07/2022 - TRDOS 386 Kernel v2.0.5 7537 <1> 7538 <1> loc_check_prg_fn_stc: 7539 0000A30E F9 <1> stc 7540 0000A30F C3 <1> retn 7541 <1> 7542 <1> loc_check_exe_fn_retn: 7543 0000A310 28C0 <1> sub al, al ; 0 7544 <1> ;retn 7545 <1> 7546 <1> find_and_list_files: 7547 <1> ;retn 7548 <1> set_exec_arguments: 7549 0000A312 C3 <1> retn 7550 <1> 7551 <1> ; 19/12/2025 7552 <1> ;delete_fs_directory: 7553 <1> ; xor eax, eax 7554 0000A313 C3 <1> retn 3436 %include 'trdosk4.s' ; 24/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - Directory Functions : trdosk4.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 19/12/2025 (Previous: 03/09/2024, v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; DIR.ASM (09/10/2011) 12 <1> ; **************************************************************************** 13 <1> 14 <1> ; DIR.ASM [ TRDOS KERNEL - COMMAND EXECUTER SECTION - DIRECTORY FUNCTIONS ] 15 <1> ; (c) 2004-2010 Erdogan TAN [ 17/01/2004 ] Last Update: 09/10/2011 16 <1> ; FILE.ASM [ FILE FUNCTIONS ] Last Update: 09/10/2011 17 <1> 18 <1> change_prompt_dir_string: 19 <1> ; 05/10/2016 20 <1> ; 24/01/2016 (TRDOS 386 = TRDOS v2.0) 21 <1> ; 27/03/2011 22 <1> ; 09/10/2009 23 <1> ; INPUT/OUTPUT => none 24 <1> ; this procedure changes current directory string/text 25 <1> ; 2005 26 <1> 27 0000A314 BE[D47E0100] <1> mov esi, PATH_Array 28 <1> change_prompt_dir_str: ; 05/10/2016 (call from 'set_working_path') 29 0000A319 BF[7A770100] <1> mov edi, Current_Directory 30 0000A31E 8A25[74770100] <1> mov ah, [Current_Dir_Level] 31 0000A324 E807000000 <1> call set_current_directory_string 32 0000A329 880D[D5770100] <1> mov [Current_Dir_StrLen], cl 33 <1> 34 0000A32F C3 <1> retn 35 <1> 36 <1> set_current_directory_string: 37 <1> ; 11/08/2022 (TRDOS 386 Kernel v2.0.5) 38 <1> ; 24/01/2016 (TRDOS 386 = TRDOS v2.0) 39 <1> ; 27/03/2011 40 <1> ; 09/10/2009 41 <1> ; INPUT: 42 <1> ; ESI = Path Array Address 43 <1> ; EDI = Current Directory String Buffer 44 <1> ; AH = Current Directory Level 45 <1> ; OUTPUT => EAX, EBX, ESI will be changed 46 <1> ; EDI will be same with input 47 <1> ; ECX = Current Directory String Length 48 <1> 49 0000A330 57 <1> push edi 50 0000A331 80FC00 <1> cmp ah, 0 51 0000A334 7651 <1> jna short pass_write_path 52 0000A336 83C610 <1> add esi, 16 53 0000A339 89F3 <1> mov ebx, esi 54 <1> loc_write_path: 55 <1> ;mov ecx, 8 56 <1> ; 11/08/2022 57 0000A33B 29C9 <1> sub ecx, ecx 58 0000A33D B108 <1> mov cl, 8 59 <1> path_write_dirname1: 60 0000A33F AC <1> lodsb 61 0000A340 3C20 <1> cmp al, 20h 62 0000A342 7612 <1> jna short pass_write_dirname1 63 0000A344 AA <1> stosb 64 0000A345 81FF[D4770100] <1> cmp edi, End_Of_Current_Dir_Str 65 0000A34B 733A <1> jnb short pass_write_path 66 0000A34D E2F0 <1> loop path_write_dirname1 67 0000A34F 803E20 <1> cmp byte [esi], 20h 68 0000A352 7624 <1> jna short pass_write_dirname2 69 0000A354 EB0A <1> jmp short loc_put_dot_cont_ext 70 <1> pass_write_dirname1: 71 0000A356 89DE <1> mov esi, ebx 72 0000A358 83C608 <1> add esi, 8 73 0000A35B 803E20 <1> cmp byte [esi], 20h 74 0000A35E 7618 <1> jna short pass_write_dirname2 75 <1> loc_put_dot_cont_ext: 76 0000A360 C6072E <1> mov byte [edi], "." 77 <1> ;mov ecx, 3 78 0000A363 B103 <1> mov cl, 3 79 <1> loc_check_dir_name_ext: 80 0000A365 AC <1> lodsb 81 0000A366 47 <1> inc edi 82 0000A367 3C20 <1> cmp al, 20h 83 0000A369 760D <1> jna short pass_write_dirname2 84 0000A36B 8807 <1> mov [edi], al 85 0000A36D 81FF[D4770100] <1> cmp edi, End_Of_Current_Dir_Str 86 0000A373 7312 <1> jnb short pass_write_path 87 0000A375 E2EE <1> loop loc_check_dir_name_ext 88 0000A377 47 <1> inc edi 89 <1> pass_write_dirname2: 90 0000A378 FECC <1> dec ah 91 0000A37A 740B <1> jz short pass_write_path 92 0000A37C 83C310 <1> add ebx, 16 93 0000A37F 89DE <1> mov esi, ebx 94 0000A381 C6072F <1> mov byte [edi],"/" 95 0000A384 47 <1> inc edi 96 0000A385 EBB4 <1> jmp short loc_write_path 97 <1> pass_write_path: 98 0000A387 C60700 <1> mov byte [edi], 0 99 0000A38A 47 <1> inc edi 100 0000A38B 89F9 <1> mov ecx, edi 101 0000A38D 5F <1> pop edi 102 0000A38E 29F9 <1> sub ecx, edi 103 <1> ; ECX = Current Directory String Length 104 0000A390 C3 <1> retn 105 <1> 106 <1> get_current_directory: 107 <1> ; 29/08/2023 (TRDOS 386 Kernel v2.0.6) 108 <1> ; 11/08/2022 109 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 110 <1> ; 15/10/2016 111 <1> ; 14/02/2016 112 <1> ; 24/01/2016 (TRDOS 386 = TRDOS v2.0) 113 <1> ; 27/03/2011 114 <1> ; 115 <1> ; INPUT-> ESI = Current Directory Buffer 116 <1> ; DL = TRDOS Logical Dos Drive Number + 1 117 <1> ; (0 = Default/Current Drive) 118 <1> ; 119 <1> ; Note: Required dir buffer length may be <= 92 bytes 120 <1> ; for TRDOS (7*12 name chars + 7 slash + 0) 121 <1> ; OUTPUT -> ESI = Current Directory Buffer 122 <1> ; EAX, EBX, ECX, EDX, EDI will be changed 123 <1> ; CX/CL = Current Directory String Length 124 <1> ; DL = Drive Number (0 based) 125 <1> ; (If input is 0, output is current drv number) 126 <1> ; DH = same with input 127 <1> ; cf = 0 -> AL = 0 128 <1> ; cf = 1 -> error code in AL 129 <1> 130 <1> loc_get_current_drive_0: 131 <1> ; 29/08/2023 132 0000A391 29C0 <1> sub eax, eax ; 0 133 <1> ;cmp dl, 0 134 0000A393 38C2 <1> cmp dl, al 135 0000A395 7724 <1> ja short loc_get_current_drive_1 136 0000A397 8A15[76770100] <1> mov dl, [Current_Drv] 137 <1> ; 29/08/2023 138 <1> ;jmp short loc_get_current_drive_2 139 <1> 140 <1> loc_get_current_drive_2: 141 <1> ; 29/08/2023 142 <1> ;xor eax, eax 143 <1> ; eax = 0 144 0000A39D 88D4 <1> mov ah, dl 145 0000A39F 56 <1> push esi ; (*) 146 0000A3A0 BE00010900 <1> mov esi, Logical_DOSDisks 147 0000A3A5 01C6 <1> add esi, eax 148 0000A3A7 8A06 <1> mov al, [esi+LD_Name] 149 0000A3A9 3C41 <1> cmp al, 'A' 150 0000A3AB 721C <1> jb short loc_get_current_drive_not_ready_retn 151 <1> 152 <1> ; 28/07/2022 153 0000A3AD 31C9 <1> xor ecx, ecx 154 <1> 155 0000A3AF 8A667F <1> mov ah, [esi+LD_CDirLevel] 156 0000A3B2 08E4 <1> or ah, ah 157 0000A3B4 7519 <1> jnz short loc_get_current_drive_3 158 <1> 159 <1> ;xor ah, ah ; mov ah, 0 160 <1> 161 <1> ; 11/08/2022 - BugFix (*) 162 0000A3B6 5E <1> pop esi ; (*) Current Directory Buffer address 163 <1> 164 0000A3B7 8826 <1> mov [esi], ah 165 <1> ; 28/07/2022 166 <1> ;xor ecx, ecx 167 0000A3B9 EB2D <1> jmp short loc_get_current_drive_4 168 <1> 169 <1> ; 29/08/2023 170 <1> loc_get_current_drive_1: 171 0000A3BB FECA <1> dec dl 172 0000A3BD 3A15[8D2E0100] <1> cmp dl, [Last_DOS_DiskNo] 173 0000A3C3 76D8 <1> jna short loc_get_current_drive_2 174 <1> ;mov eax, 0Fh ; Invalid drive (Drive not ready!) 175 <1> ;cmc ; stc 176 <1> ; 28/07/2022 177 <1> ;sub eax, eax ; 29/08/2023 178 <1> ; eax = 0 179 0000A3C5 B00F <1> mov al, 0Fh 180 0000A3C7 F9 <1> stc 181 0000A3C8 C3 <1> retn 182 <1> 183 <1> loc_get_current_drive_not_ready_retn: 184 0000A3C9 5E <1> pop esi 185 <1> ;mov eax, 15 186 0000A3CA 66B80F00 <1> mov ax, 15 ; Drive not ready 187 0000A3CE C3 <1> retn 188 <1> 189 <1> loc_get_current_drive_3: 190 0000A3CF BF[D47E0100] <1> mov edi, PATH_Array 191 0000A3D4 57 <1> push edi 192 0000A3D5 81C680000000 <1> add esi, LD_CurrentDirectory 193 <1> ;mov ecx, 32 194 <1> ; 28/07/2022 195 0000A3DB B120 <1> mov cl, 32 196 0000A3DD F3A5 <1> rep movsd 197 0000A3DF 5E <1> pop esi ; Path Array Address 198 0000A3E0 5F <1> pop edi ; pushed esi (current dir buffer offset) 199 <1> ; 200 0000A3E1 E84AFFFFFF <1> call set_current_directory_string 201 0000A3E6 89FE <1> mov esi, edi 202 <1> 203 <1> loc_get_current_drive_4: 204 0000A3E8 30C0 <1> xor al, al 205 0000A3EA C3 <1> retn 206 <1> 207 <1> change_current_directory: 208 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 209 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 210 <1> ; 02/03/2021 (TRDOS 386 v2.0.3) ((BugFix)) 211 <1> ; 19/02/2016 212 <1> ; 11/02/2016 213 <1> ; 10/02/2016 214 <1> ; 08/02/2016 215 <1> ; 06/02/2016 (TRDOS 386 = TRDOS v2.0) 216 <1> ; 18/09/2011 (DIR.ASM, 09/10/2011) 217 <1> ; 04/10/2009 218 <1> ; 2005 219 <1> ; INPUT -> 220 <1> ; ESI = Directory string 221 <1> ; ah = CD command (CDh = save current dir string) 222 <1> ; OUTPUT -> 223 <1> ; EDI = DOS Drive Description Table 224 <1> ; cf = 1 -> error 225 <1> ; EAX = Error code 226 <1> ; cf = 0 -> successful 227 <1> ; ESI = PATH_Array 228 <1> ; EAX = Current Directory First Cluster 229 <1> ; 230 <1> ; (EAX, EBX, ECX, EDX, ESI, EDI will be changed) 231 <1> 232 0000A3EB 8825[627F0100] <1> mov [CD_COMMAND], ah 233 0000A3F1 803E2F <1> cmp byte [esi], '/' 234 0000A3F4 7505 <1> jne short loc_ccd_cdir_level 235 0000A3F6 46 <1> inc esi 236 0000A3F7 30C0 <1> xor al, al 237 0000A3F9 EB05 <1> jmp short loc_ccd_parse_path_name 238 <1> loc_ccd_cdir_level: 239 0000A3FB A0[74770100] <1> mov al, [Current_Dir_Level] 240 <1> loc_ccd_parse_path_name: 241 0000A400 88C4 <1> mov ah, al 242 0000A402 BF[D47E0100] <1> mov edi, PATH_Array 243 <1> 244 <1> ; Reset directory levels > cdir level 245 <1> ; is this required !? 246 <1> ; 247 <1> ; Relations: 248 <1> ; MAINPROG.ASM (pass_ccdrv_reset_cdir_FAT_fcluster) 249 <1> ; proc_parse_dir_name, 250 <1> ; proc_change_current_directory (this procedure) 251 <1> ; proc_change_prompt_dir_string 252 <1> 253 0000A407 0FB6C8 <1> movzx ecx, al 254 0000A40A FEC1 <1> inc cl 255 0000A40C C0E104 <1> shl cl, 4 256 0000A40F 01CF <1> add edi, ecx 257 0000A411 B107 <1> mov cl, 7 258 0000A413 28C1 <1> sub cl, al 259 0000A415 C0E102 <1> shl cl, 2 260 0000A418 89C3 <1> mov ebx, eax 261 0000A41A 31C0 <1> xor eax, eax ; 0 262 0000A41C F3AB <1> rep stosd 263 0000A41E 89D8 <1> mov eax, ebx 264 <1> 265 0000A420 BF[D47E0100] <1> mov edi, PATH_Array 266 <1> 267 0000A425 803E20 <1> cmp byte [esi], 20h 268 0000A428 F5 <1> cmc 269 0000A429 7305 <1> jnc short pass_ccd_parse_dir_name 270 <1> 271 <1> ; ESI = Path name 272 <1> ; AL = CCD_Level 273 0000A42B E83B010000 <1> call parse_dir_name 274 <1> ; AL = CCD_Level 275 <1> ; AH = Last_Dir_Level 276 <1> ; (EDI = PATH_Array) 277 <1> 278 <1> pass_ccd_parse_dir_name: 279 0000A430 9C <1> pushf 280 <1> 281 <1> ;mov [CCD_Level], al 282 <1> ;mov [Last_Dir_Level], ah 283 0000A431 66A3[587F0100] <1> mov [CCD_Level], ax 284 <1> 285 0000A437 31DB <1> xor ebx, ebx 286 0000A439 8A3D[76770100] <1> mov bh, [Current_Drv] 287 0000A43F BE00010900 <1> mov esi, Logical_DOSDisks 288 0000A444 01DE <1> add esi, ebx 289 <1> 290 0000A446 9D <1> popf 291 0000A447 720A <1> jc short loc_ccd_bad_path_name_retn 292 <1> 293 0000A449 8935[547F0100] <1> mov [CCD_DriveDT], esi 294 <1> 295 0000A44F 3C07 <1> cmp al, 7 296 0000A451 7208 <1> jb short loc_ccd_load_child_dir 297 <1> 298 <1> loc_ccd_bad_path_name_retn: 299 0000A453 87F7 <1> xchg esi, edi 300 <1> ;mov eax, 19 ; Bad directory/path name 301 <1> ; 28/07/2022 302 0000A455 29C0 <1> sub eax, eax 303 0000A457 B013 <1> mov al, 19 304 0000A459 F9 <1> stc 305 <1> loc_ccd_retn_p: 306 0000A45A C3 <1> retn 307 <1> 308 <1> loc_ccd_load_child_dir: 309 <1> ; AL = CCD_Level 310 0000A45B 08C0 <1> or al, al 311 0000A45D 744C <1> jz short loc_ccd_load_root_dir 312 <1> 313 <1> ;mov cx, ax 314 <1> ; 28/07/2022 315 0000A45F 89C1 <1> mov ecx, eax 316 0000A461 C0E004 <1> shl al, 4 317 0000A464 0FB6F0 <1> movzx esi, al 318 0000A467 01FE <1> add esi, edi ; offset PATH_Array 319 <1> 320 0000A469 8B460C <1> mov eax, [esi+12] 321 0000A46C 38E9 <1> cmp cl, ch 322 <1> ;je loc_ccd_load_sub_directory 323 <1> ; 28/07/2022 324 0000A46E 7505 <1> jne short loc_ccd_1 325 0000A470 E992000000 <1> jmp loc_ccd_load_sub_directory 326 <1> 327 <1> loc_ccd_1: ; 28/07/2022 328 0000A475 A3[70770100] <1> mov [Current_Dir_FCluster], eax 329 <1> 330 <1> loc_ccd_load_child_dir_next: 331 0000A47A 83C610 <1> add esi, 16 ; DOS DirEntry Format FileName Address 332 <1> 333 <1> ; Directory attribute : 10h 334 0000A47D B010 <1> mov al, 00010000b ; 10h (Attrib AND mask) 335 <1> ;mov ah, 11001000b ; C8h 336 <1> ; Volume name attribute: 8h 337 0000A47F B408 <1> mov ah, 00001000b ; 08h (Attrib NAND, AND --> zero mask) 338 <1> 339 <1> ;xor cx, cx 340 0000A481 31C9 <1> xor ecx, ecx ; 02/03/2021 341 0000A483 E880010000 <1> call locate_current_dir_file 342 0000A488 733C <1> jnc short loc_ccd_set_dir_cluster_ptr 343 <1> 344 <1> ; 19/02/2016 345 <1> ;mov edi, [CCD_DriveDT] 346 0000A48A 8A25[587F0100] <1> mov ah, [CCD_Level] 347 0000A490 803D[627F0100]CD <1> cmp byte [CD_COMMAND], 0CDh ;'CD' command or another 348 0000A497 7509 <1> jne short loc_ccd_load_child_dir_err 349 <1> ; It is better to save recent successful part 350 <1> ; of the (requested) path as current directory. 351 <1> ; (Otherwise the path would be reset to back 352 <1> ; on the next 'CD' command.) 353 0000A499 88E1 <1> mov cl, ah 354 0000A49B 50 <1> push eax 355 0000A49C E8AE000000 <1> call loc_ccd_save_current_dir 356 0000A4A1 58 <1> pop eax 357 <1> loc_ccd_load_child_dir_err: 358 0000A4A2 3C03 <1> cmp al, 3 ; AL = 2 => File not found error 359 0000A4A4 7202 <1> jb short loc_ccd_path_not_found_retn 360 0000A4A6 F9 <1> stc 361 0000A4A7 C3 <1> retn 362 <1> 363 <1> loc_ccd_path_not_found_retn: 364 0000A4A8 B003 <1> mov al, 3 ; Path not found 365 0000A4AA C3 <1> retn 366 <1> 367 <1> loc_ccd_load_root_dir: ; 19/12/2025 368 <1> loc_ccd_load_FAT_root_dir: 369 0000A4AB 803D[75770100]02 <1> cmp byte [Current_FATType], 2 370 0000A4B2 774B <1> ja short loc_ccd_load_FAT32_root_dir 371 <1> 372 <1> ;mov esi, [CCD_DriveDT] 373 <1> ;push esi 374 0000A4B4 E80E1C0000 <1> call load_FAT_root_directory 375 <1> ;pop edi ; Dos Drv Description Table 376 <1> 377 0000A4B9 89F7 <1> mov edi, esi 378 0000A4BB BE[D47E0100] <1> mov esi, PATH_Array 379 0000A4C0 7298 <1> jc short loc_ccd_retn_p 380 <1> 381 0000A4C2 31C0 <1> xor eax, eax 382 0000A4C4 EB58 <1> jmp short loc_ccd_set_cdfc 383 <1> 384 <1> ; 19/12/2025 385 <1> %if 0 386 <1> loc_ccd_load_root_dir: 387 <1> cmp byte [Current_FATType], 1 388 <1> jnb short loc_ccd_load_FAT_root_dir 389 <1> 390 <1> loc_ccd_load_FS_root_dir: 391 <1> call load_FS_root_directory 392 <1> jmp short pass_ccd_load_FAT_sub_directory 393 <1> 394 <1> loc_ccd_load_FS_sub_directory_next: 395 <1> call load_FS_sub_directory 396 <1> jmp short pass_ccd_set_dir_cluster_ptr 397 <1> %endif 398 <1> 399 <1> loc_ccd_set_dir_cluster_ptr: 400 <1> ; EDI = Directory Entry 401 0000A4C6 668B4714 <1> mov ax, [edi+20] ; First Cluster High Word 402 0000A4CA C1E010 <1> shl eax, 16 403 0000A4CD 668B471A <1> mov ax, [edi+26] ; First Cluster Low Word 404 <1> 405 0000A4D1 8B35[547F0100] <1> mov esi, [CCD_DriveDT] 406 <1> 407 <1> ; 19/12/2025 408 <1> %if 0 409 <1> cmp byte [Current_FATType], 1 410 <1> jb short loc_ccd_load_FS_sub_directory_next 411 <1> %endif 412 <1> ;push esi 413 0000A4D7 E8691C0000 <1> call load_FAT_sub_directory 414 <1> ;pop edi ; Dos Drv Description Table 415 <1> 416 <1> pass_ccd_set_dir_cluster_ptr: 417 <1> ;mov edi, esi 418 0000A4DC BE[D47E0100] <1> mov esi, PATH_Array 419 0000A4E1 7265 <1> jc short loc_ccd_retn_c 420 <1> 421 0000A4E3 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 422 <1> 423 0000A4E8 FE05[587F0100] <1> inc byte [CCD_Level] 424 0000A4EE 0FB61D[587F0100] <1> movzx ebx, byte [CCD_Level] 425 0000A4F5 C0E304 <1> shl bl, 4 ; * 16 (<= 128) 426 0000A4F8 01DE <1> add esi, ebx ; 19/02/2016 427 0000A4FA 89460C <1> mov [esi+12], eax 428 0000A4FD EB1F <1> jmp short loc_ccd_set_cdfc 429 <1> 430 <1> loc_ccd_load_FAT32_root_dir: 431 0000A4FF BE[D47E0100] <1> mov esi, PATH_Array 432 0000A504 8B460C <1> mov eax, [esi+12] 433 <1> 434 <1> loc_ccd_load_sub_directory: ; 19/12/2025 435 0000A507 8B35[547F0100] <1> mov esi, [CCD_DriveDT] 436 <1> 437 <1> loc_ccd_load_FAT_sub_directory: 438 <1> ;push esi 439 0000A50D E8331C0000 <1> call load_FAT_sub_directory 440 <1> ;pop edi ; Dos Drv Description Table 441 <1> 442 <1> pass_ccd_load_FAT_sub_directory: 443 <1> ;mov edi, esi 444 0000A512 BE[D47E0100] <1> mov esi, PATH_Array 445 0000A517 722F <1> jc short loc_ccd_retn_c 446 <1> 447 0000A519 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 448 <1> 449 <1> loc_ccd_set_cdfc: 450 0000A51E 8A0D[587F0100] <1> mov cl, [CCD_Level] 451 0000A524 880D[74770100] <1> mov [Current_Dir_Level], cl 452 0000A52A A3[70770100] <1> mov [Current_Dir_FCluster], eax 453 <1> 454 0000A52F 8A2D[597F0100] <1> mov ch, [Last_Dir_Level] 455 0000A535 38E9 <1> cmp cl, ch 456 <1> ;jb loc_ccd_load_child_dir_next 457 <1> ; 28/07/2022 458 0000A537 7305 <1> jnb short loc_ccd_2 459 0000A539 E93CFFFFFF <1> jmp loc_ccd_load_child_dir_next 460 <1> loc_ccd_2: 461 0000A53E 803D[627F0100]CD <1> cmp byte [CD_COMMAND], 0CDh ;'CD' command or another 462 0000A545 7408 <1> je short loc_ccd_save_current_dir 463 <1> 464 <1> ; jne -> don't save, restore (the previous cdir) later ! 465 <1> ; (saving the cdir would prevent previous cdir restoration!) 466 <1> 467 0000A547 F8 <1> clc 468 <1> 469 <1> loc_ccd_retn_c: 470 0000A548 8B3D[547F0100] <1> mov edi, [CCD_DriveDT] 471 0000A54E C3 <1> retn 472 <1> 473 <1> ; 19/12/2025 474 <1> %if 0 475 <1> loc_ccd_load_sub_directory: 476 <1> mov esi, [CCD_DriveDT] 477 <1> cmp byte [Current_FATType], 1 478 <1> jnb short loc_ccd_load_FAT_sub_directory 479 <1> call load_FS_sub_directory 480 <1> jmp short pass_ccd_load_FAT_sub_directory 481 <1> %endif 482 <1> 483 <1> loc_ccd_save_current_dir: 484 <1> ; 02/03/2021 (TRDOS 386 v2.0.3) ((BugFix)) 485 <1> ; ('find_directory_entry' has been fixed to prevent large 486 <1> ; ECX value > 65535) 487 <1> ; 488 0000A54F BE[D47E0100] <1> mov esi, PATH_Array ; 19/02/2016 489 0000A554 8B3D[547F0100] <1> mov edi, [CCD_DriveDT] 490 0000A55A 57 <1> push edi 491 0000A55B 83C77F <1> add edi, LD_CDirLevel 492 0000A55E 880F <1> mov [edi], cl 493 0000A560 47 <1> inc edi ; LD_CurrentDirectory 494 0000A561 56 <1> push esi 495 <1> ;;mov ecx, 32 ; always < 65536 (in this procedure) 496 0000A562 66B92000 <1> mov cx, 32 497 <1> ; 02/03/2021 498 <1> ;mov ecx, 32 499 0000A566 F3A5 <1> rep movsd 500 <1> ; Current directory has been saved to 501 <1> ; the DOS drive description table, cdir area ! 502 0000A568 5E <1> pop esi ; PATH_Array 503 0000A569 5F <1> pop edi ; Dos Drv Description Table 504 <1> 505 0000A56A C3 <1> retn 506 <1> 507 <1> parse_dir_name: 508 <1> ; 11/02/2016 509 <1> ; 10/02/2016 510 <1> ; 07/02/2016 (TRDOS 386 = TRDOS v2.0) 511 <1> ; 18/09/2011 512 <1> ; 17/10/2009 513 <1> ; INPUT -> 514 <1> ; ESI = ASCIIZ Directory String Address 515 <1> ; AL = Current Directory Level 516 <1> ; EDI = Destination Adress 517 <1> ; (8 levels, each one 12+4 byte) 518 <1> ; OUTPUT -> 519 <1> ; EDI = Dir Entry Formatted Array 520 <1> ; with zero cluster pointer at the last level 521 <1> ; AH = Last Dir Level 522 <1> ; AL = Current Dir Level 523 <1> ; 524 <1> ; (esi, ebx, ecx will be changed) 525 <1> 526 <1> ;mov [PATH_Array_Ptr], edi 527 0000A56B 88C4 <1> mov ah, al 528 0000A56D 66A3[F87F0100] <1> mov [PATH_CDLevel], ax 529 <1> repeat_ppdn_check_slash: 530 0000A573 AC <1> lodsb 531 0000A574 3C2F <1> cmp al, '/' 532 0000A576 74FB <1> je short repeat_ppdn_check_slash 533 0000A578 3C21 <1> cmp al, 21h 534 0000A57A 7219 <1> jb short loc_ppdn_retn 535 0000A57C 57 <1> push edi 536 <1> loc_ppdn_get_dir_name: 537 0000A57D B90C000000 <1> mov ecx, 12 538 0000A582 BF[FA7F0100] <1> mov edi, Dir_File_Name 539 <1> repeat_ppdn_get_dir_name: 540 0000A587 AA <1> stosb 541 0000A588 AC <1> lodsb 542 0000A589 3C2F <1> cmp al, '/' 543 0000A58B 740A <1> je short loc_check_level_dot_conv_dir_name 544 0000A58D 3C20 <1> cmp al, 20h 545 0000A58F 7605 <1> jna short loc_ppdn_end_of_path_scan 546 0000A591 E2F4 <1> loop repeat_ppdn_get_dir_name 547 0000A593 5F <1> pop edi 548 0000A594 F9 <1> stc 549 <1> loc_ppdn_retn: 550 0000A595 C3 <1> retn 551 <1> 552 <1> loc_ppdn_end_of_path_scan: 553 0000A596 4E <1> dec esi 554 <1> loc_check_level_dot_conv_dir_name: 555 0000A597 31C0 <1> xor eax, eax 556 0000A599 AA <1> stosb 557 0000A59A 89F3 <1> mov ebx, esi 558 0000A59C BE[FA7F0100] <1> mov esi, Dir_File_Name 559 0000A5A1 AC <1> lodsb 560 <1> repeat_ppdn_name_check_dot: 561 0000A5A2 3C2E <1> cmp al, '.' 562 0000A5A4 7509 <1> jne short loc_ppdn_convert_sub_dir_name 563 <1> repeat_ppdn_name_dot_dot: 564 0000A5A6 AC <1> lodsb 565 0000A5A7 3C2E <1> cmp al, '.' 566 0000A5A9 743E <1> je short loc_ppdn_dot_dot 567 0000A5AB 3C21 <1> cmp al, 21h 568 0000A5AD 7226 <1> jb short pass_ppdn_convert_sub_dir_name 569 <1> loc_ppdn_convert_sub_dir_name: 570 0000A5AF 8A25[F97F0100] <1> mov ah, [PATH_Level] 571 0000A5B5 80FC07 <1> cmp ah, 7 572 0000A5B8 731B <1> jnb short pass_ppdn_convert_sub_dir_name 573 0000A5BA FEC4 <1> inc ah 574 0000A5BC 8825[F97F0100] <1> mov [PATH_Level], ah 575 0000A5C2 BE[FA7F0100] <1> mov esi, Dir_File_Name 576 <1> ;mov edi, [PATH_Array_Ptr] 577 0000A5C7 B010 <1> mov al, 16 578 0000A5C9 F6E4 <1> mul ah 579 0000A5CB 8B3C24 <1> mov edi, [esp] 580 <1> ;push edi 581 0000A5CE 01C7 <1> add edi, eax 582 0000A5D0 E8DF020000 <1> call convert_file_name 583 <1> ;pop edi 584 <1> pass_ppdn_convert_sub_dir_name: 585 0000A5D5 89DE <1> mov esi, ebx 586 <1> repeat_ppdn_check_last_slash: 587 0000A5D7 AC <1> lodsb 588 0000A5D8 3C2F <1> cmp al, '/' 589 0000A5DA 74FB <1> je short repeat_ppdn_check_last_slash 590 0000A5DC 3C21 <1> cmp al, 21h 591 0000A5DE 739D <1> jnb short loc_ppdn_get_dir_name 592 <1> end_of_parse_dir_name: 593 0000A5E0 5F <1> pop edi 594 0000A5E1 F5 <1> cmc 595 <1> ;mov al, [PATH_CDLevel] 596 <1> ;mov ah, [PATH_Level] 597 0000A5E2 66A1[F87F0100] <1> mov ax, [PATH_CDLevel] 598 0000A5E8 C3 <1> retn 599 <1> 600 <1> loc_ppdn_dot_dot: 601 0000A5E9 AC <1> lodsb 602 0000A5EA 3C21 <1> cmp al, 21h 603 0000A5EC 73F2 <1> jnb short end_of_parse_dir_name 604 <1> loc_ppdn_dot_dot_prev_level: 605 0000A5EE 66A1[F87F0100] <1> mov ax, [PATH_CDLevel] 606 0000A5F4 80EC01 <1> sub ah, 1 607 0000A5F7 80D400 <1> adc ah, 0 608 0000A5FA 38E0 <1> cmp al, ah 609 0000A5FC 7602 <1> jna short pass_ppdn_set_al_to_ah 610 0000A5FE 88E0 <1> mov al, ah 611 <1> pass_ppdn_set_al_to_ah: 612 0000A600 66A3[F87F0100] <1> mov [PATH_CDLevel], ax 613 0000A606 EBCD <1> jmp short pass_ppdn_convert_sub_dir_name 614 <1> 615 <1> locate_current_dir_file: 616 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 617 <1> ; 26/08/2024 (TRDOS 386 v2.0.9) 618 <1> ; 26/08/2024 (TRDOS 386 v2.0.9) 619 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 620 <1> ; 20/11/2017 621 <1> ; 14/02/2016 622 <1> ; 13/02/2016 623 <1> ; 10/02/2016 624 <1> ; 06/02/2016 (TRDOS 386 = TRDOS v2.0) 625 <1> ; 14/08/2010 626 <1> ; 19/09/2009 627 <1> ; 2005 628 <1> ; INPUT -> 629 <1> ; ESI = DOS DirEntry Format FileName Address 630 <1> ; AL = Attributes Mask 631 <1> ; ( must be equal to AL) 632 <1> ; AH = Negative Attributes Mask (If AH>0) 633 <1> ; ( must be ZERO) 634 <1> ; CH > 0 Find First Free Dir Entry or Deleted Entry 635 <1> ; CL = 0 -> Return the First Free Dir Entry 636 <1> ; CL = E5h -> Return the 1st deleted entry 637 <1> ; CL = FFh -> Return the 1st deleted or free entry 638 <1> ; CL > 0 and CL <> E5h and CL <> FFh -> Return the first 639 <1> ; proper entry (which fits with Atributes Masks) 640 <1> ; CX = 0 Find Valid File/Directory/VolumeName 641 <1> ; ? = Any One Char 642 <1> ; * = Every Chars 643 <1> ; OUTPUT -> 644 <1> ; EDI = Directory Entry Address (in Directory Buffer) 645 <1> ; ESI = DOS DirEntry Format FileName Address 646 <1> ; CF = 0 -> No Error, Proper Entry, 647 <1> ; DL = Attributes 648 <1> ; DH = Previous Entry Attr (LongName Check) 649 <1> ; AL > 0 -> Ambiguous filename wildcard "?" used 650 <1> ; AH > 0 -> Ambiguous filename wildcard "*" used 651 <1> ; AX = 0 -> Filename full fits with directory entry 652 <1> ; CH = The 1st Name Char of Current Dir Entry 653 <1> ; CF = 1 -> Proper entry not found, Error Code in EAX/AL 654 <1> ; CL = 0 and CH = 0 -> Free Entry (End Of Dir) 655 <1> ; CL = 0 and CH = E5h -> Deleted Entry fits with filters 656 <1> ; CL > 0 -> Entry not found, CH invalid 657 <1> ; CF = 0 -> 658 <1> ; EBX = Current Directory Entry Index/Number (BX) 659 <1> 660 <1> ;mov word [DirBuff_EntryCounter], 0 ; Zero Based 661 <1> 662 0000A608 8935[5C7F0100] <1> mov [CDLF_FNAddress], esi 663 0000A60E 66A3[5A7F0100] <1> mov [CDLF_AttributesMask], ax 664 0000A614 66890D[607F0100] <1> mov [CDLF_DEType], cx 665 <1> 666 0000A61B 31DB <1> xor ebx, ebx 667 0000A61D 881D[707F0100] <1> mov [PreviousAttr], bl ; 0 ; 13/02/2016 668 <1> 669 0000A623 8A3D[76770100] <1> mov bh, [Current_Drv] 670 0000A629 381D[9D7E0100] <1> cmp byte [DirBuff_ValidData], bl ; 0 671 0000A62F 761D <1> jna short loc_lcdf_reload_current_dir2 672 0000A631 8A1D[9B7E0100] <1> mov bl, [DirBuff_DRV] 673 0000A637 80EB41 <1> sub bl, 'A' 674 0000A63A 38DF <1> cmp bh, bl 675 0000A63C 750E <1> jne short loc_lcdf_reload_current_dir1 676 0000A63E 8B15[A27E0100] <1> mov edx, [DirBuff_Cluster] 677 0000A644 3B15[70770100] <1> cmp edx, [Current_Dir_FCluster] 678 0000A64A 7412 <1> je short loc_cdir_locatefile_search 679 <1> 680 <1> loc_lcdf_reload_current_dir1: 681 0000A64C 30DB <1> xor bl, bl 682 <1> loc_lcdf_reload_current_dir2: 683 0000A64E 89DE <1> mov esi, ebx 684 0000A650 81C600010900 <1> add esi, Logical_DOSDisks 685 0000A656 E866000000 <1> call reload_current_directory 686 0000A65B 734F <1> jnc short loc_locatefile_search_again 687 0000A65D C3 <1> retn 688 <1> 689 <1> loc_cdir_locatefile_search: 690 0000A65E 31DB <1> xor ebx, ebx 691 0000A660 55 <1> push ebp ; 20/11/2017 692 0000A661 E87D000000 <1> call find_directory_entry 693 0000A666 5D <1> pop ebp ; 20/11/2017 694 0000A667 733B <1> jnc short loc_cdir_locate_file_retn 695 <1> 696 <1> loc_locatefile_check_stc_reason: 697 0000A669 08ED <1> or ch, ch 698 0000A66B 7436 <1> jz short loc_cdir_locate_file_stc_retn 699 <1> 700 <1> loc_locatefile_check_next_entryblock: 701 <1> ;mov bh, [Current_Drv] 702 <1> ;sub bl, bl 703 <1> ;movzx esi, bx 704 <1> ; 28/07/2022 705 0000A66D 31DB <1> xor ebx, ebx 706 0000A66F 8A3D[76770100] <1> mov bh, [Current_Drv] 707 0000A675 89DE <1> mov esi, ebx 708 0000A677 81C600010900 <1> add esi, Logical_DOSDisks 709 <1> 710 0000A67D 803D[74770100]00 <1> cmp byte [Current_Dir_Level], 0 711 <1> ; 19/12/2025 712 <1> %if 0 713 <1> jna short loc_locatefile_check_FAT_type 714 <1> 715 <1> cmp byte [Current_FATType], 1 716 <1> jnb short loc_locatefile_load_subdir_cluster 717 <1> retn 718 <1> %else 719 <1> ; 19/12/2025 720 0000A684 7709 <1> ja short loc_locatefile_load_subdir_cluster 721 <1> %endif 722 <1> 723 <1> loc_locatefile_check_FAT_type: 724 0000A686 803D[75770100]03 <1> cmp byte [Current_FATType], 3 725 0000A68D 7215 <1> jb short loc_cdir_locate_file_retn 726 <1> 727 <1> loc_locatefile_load_subdir_cluster: 728 0000A68F A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 729 0000A694 E8F0180000 <1> call get_next_cluster 730 0000A699 730A <1> jnc short loc_locatefile_next_cluster 731 0000A69B 09C0 <1> or eax, eax 732 0000A69D 7504 <1> jnz short loc_locatefile_drive_not_ready_read_err 733 <1> ;stc 734 <1> ; 28/07/2022 735 <1> ;loc_locatefile_file_notfound: 736 <1> ;mov eax, 2 ; File/Directory/VolName not found 737 <1> ;xor eax, eax 738 <1> ; 26/08/2024 739 <1> ; eax = 0 740 0000A69F B002 <1> mov al, 2 741 0000A6A1 F9 <1> stc 742 0000A6A2 C3 <1> retn 743 <1> 744 <1> loc_locatefile_drive_not_ready_read_err: 745 <1> ;mov eax, 17 ;Drive not ready or read error 746 <1> loc_cdir_locate_file_stc_retn: 747 0000A6A3 F5 <1> cmc ;stc 748 <1> loc_cdir_locate_file_retn: 749 0000A6A4 C3 <1> retn 750 <1> 751 <1> loc_locatefile_next_cluster: 752 0000A6A5 E89B1A0000 <1> call load_FAT_sub_directory 753 <1> ;jc short loc_locatefile_drive_not_ready_read_err 754 0000A6AA 72F8 <1> jc short loc_cdir_locate_file_retn 755 <1> 756 <1> loc_locatefile_search_again: 757 0000A6AC 8B35[5C7F0100] <1> mov esi, [CDLF_FNAddress] 758 0000A6B2 66A1[5A7F0100] <1> mov ax, [CDLF_AttributesMask] 759 0000A6B8 668B0D[607F0100] <1> mov cx, [CDLF_DEType] 760 0000A6BF EB9D <1> jmp short loc_cdir_locatefile_search 761 <1> 762 <1> reload_current_directory: 763 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 764 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 765 <1> ; 06/02/2016 (TRDOS 386 = TRDOS v2.0) 766 <1> ; 13/06/2010 767 <1> ; 22/09/2009 768 <1> ; 769 <1> ; INPUT -> 770 <1> ; ESI = Dos drive description table address 771 <1> 772 <1> ;mov al, [esi+LD_FATType] 773 0000A6C1 A0[75770100] <1> mov al, [Current_FATType] 774 0000A6C6 3C02 <1> cmp al, 2 775 0000A6C8 770F <1> ja short loc_reload_FAT_sub_directory 776 0000A6CA 8A25[74770100] <1> mov ah, [Current_Dir_Level] 777 <1> ; 19/12/2025 778 <1> %if 0 779 <1> or al, al 780 <1> jz short loc_reload_FS_directory 781 <1> %endif 782 0000A6D0 08E4 <1> or ah, ah 783 0000A6D2 7505 <1> jnz short loc_reload_FAT_sub_directory 784 <1> loc_reload_FAT_12_16_root_directory: 785 <1> ;call load_FAT_root_directory 786 <1> ;retn 787 <1> ; 28/07/2022 788 0000A6D4 E9EE190000 <1> jmp load_FAT_root_directory 789 <1> 790 <1> ; 19/12/2025 791 <1> %if 0 792 <1> loc_reload_FS_directory: 793 <1> and ah, ah 794 <1> jnz short loc_reload_FS_sub_directory 795 <1> loc_reload_FS_root_directory: 796 <1> ;call load_FS_root_directory 797 <1> ;retn 798 <1> ; 28/07/2022 799 <1> jmp load_FS_root_directory 800 <1> loc_reload_FS_sub_directory: 801 <1> mov eax, [Current_Dir_FCluster] 802 <1> ;call load_FS_sub_directory 803 <1> ;retn 804 <1> jmp load_FS_sub_directory 805 <1> %endif 806 <1> 807 <1> loc_reload_FAT_sub_directory: 808 0000A6D9 A1[70770100] <1> mov eax, [Current_Dir_FCluster] 809 <1> ;call load_FAT_sub_directory 810 <1> ;retn 811 <1> ; 28/07/2022 812 0000A6DE E9621A0000 <1> jmp load_FAT_sub_directory 813 <1> 814 <1> find_directory_entry: 815 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 816 <1> ; 02/03/2021 (TRDOS 386 v2.0.3) ((BugFix)) 817 <1> ; 14/02/2016 818 <1> ; 13/02/2016 819 <1> ; 10/02/2016 820 <1> ; 06/02/2016 (TRDOS 386 = TRDOS v2.0) 821 <1> ; 14/08/2010 (DIR.ASM, "proc_find_direntry") 822 <1> ; 19/09/2009 823 <1> ; 2005 824 <1> ; INPUT -> 825 <1> ; ESI = Sub Dir or File Name Address 826 <1> ; AL = Attributes Mask 827 <1> ; ( must be equal to AL) 828 <1> ; AH = Negative Attributes Mask (If AH>0) 829 <1> ; ( must be ZERO) 830 <1> ; CH > 0 Find First Free Dir Entry or Deleted Entry 831 <1> ; CL = 0 -> Return the First Free Dir Entry 832 <1> ; CL = E5h -> Return the 1st deleted entry 833 <1> ; CL = FFh -> Return the 1st deleted or free entry 834 <1> ; CL > 0 and CL <> E5h and CL <> FFh -> Return the first 835 <1> ; proper entry (which fits with Atributes Masks) 836 <1> ; CX = 0 -> Find Valid File/Directory/VolumeName 837 <1> ; ? = Any One Char 838 <1> ; * = Every Chars 839 <1> ; EBX = Current Dir Entry (BX) 840 <1> ; 841 <1> ; OUTPUT -> 842 <1> ; EDI = Directory Entry Address (in DirectoryBuffer) 843 <1> ; ESI = Sub Dir or File Name Address 844 <1> ; CF = 0 -> No Error, Proper Entry, 845 <1> ; DL = Attributes 846 <1> ; DH = Previous Entry Attr (LongName Check) 847 <1> ; AL > 0 -> Ambiguous filename wildcard "?" used 848 <1> ; AH > 0 -> Ambiguous filename wildcard "*" used 849 <1> ; AX = 0 -> Filename full fits with directory entry 850 <1> ; EBX = CurrentDirEntry (BX) 851 <1> ; CH = The 1st Name Char of Current Dir Entry 852 <1> ; CF = 1 -> Proper entry not found, Error Code in AX/AL 853 <1> ; CL = 0 and CH = 0 -> Free Entry (End Of Dir) 854 <1> ; CL = 0 and CH = E5h -> Deleted Entry fits with filters 855 <1> ; CL > 0 -> Entry not found, CH invalid 856 <1> ; 857 <1> ; (EAX, EBX, ECX, EDX, EDI, EBP will be changed) 858 <1> 859 0000A6E3 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 860 0000A6EA 7728 <1> ja short loc_ffde_stc_retn_255 ; 28/07/2022 861 <1> 862 <1> ;mov [DirBuff_CurrentEntry], bx 863 <1> 864 0000A6EC BF00000800 <1> mov edi, Directory_Buffer 865 0000A6F1 66A3[6C7F0100] <1> mov [FDE_AttrMask], ax 866 <1> 867 0000A6F7 29C0 <1> sub eax, eax 868 <1> 869 <1> ;;mov [PreviousAttr], al ; 0 ;; 13/02/2016 870 0000A6F9 66A3[6E7F0100] <1> mov [AmbiguousFileName], ax ; 0 871 <1> 872 0000A6FF 6689D8 <1> mov ax, bx 873 <1> ;shl ax, 5 ; ; * 32 ; Directory entry size 874 <1> ; 28/07/2022 875 0000A702 C1E005 <1> shl eax, 5 876 0000A705 01C7 <1> add edi, eax 877 <1> 878 0000A707 08ED <1> or ch, ch 879 <1> ;jnz loc_find_free_deleted_entry_0 880 <1> ; 28/07/2022 881 0000A709 7405 <1> jz short loc_fde_any_valid_entry_opt 882 0000A70B E911010000 <1> jmp loc_find_free_deleted_entry_0 883 <1> 884 <1> loc_fde_any_valid_entry_opt: 885 0000A710 08C9 <1> or cl, cl 886 <1> ;jnz loc_ffde_stc_retn_255 887 <1> ; 28/07/2022 888 0000A712 742E <1> jz short check_find_dir_entry 889 <1> 890 <1> ; 28/07/2022 891 <1> loc_ffde_stc_retn_255: 892 <1> ; 02/03/2021 (TRDOS 386 v2.0.3) ((BugFix)) 893 <1> ; (ECX must not be > 65535) 894 <1> ; ((because 'loc_ccd_save_current_dir' 895 <1> ; sets CX to 32 for 'rep movsd')) 896 0000A714 66B9FFFF <1> mov cx, 0FFFFh 897 <1> ;xor ecx, ecx 898 <1> ;dec ecx ; 0FFFFFFFFh 899 <1> ;xor eax, eax 900 <1> loc_find_direntry_stc_retn: 901 <1> loc_check_ffde_retn_1: 902 <1> ;mov ax, 2 903 <1> ;mov eax, 2 ; File Not Found 904 <1> ; 28/07/2022 905 0000A718 29C0 <1> sub eax, eax 906 0000A71A B002 <1> mov al, 2 907 0000A71C 8A35[707F0100] <1> mov dh, [PreviousAttr] 908 0000A722 66891D[9E7E0100] <1> mov [DirBuff_CurrentEntry], bx 909 0000A729 F9 <1> stc 910 0000A72A C3 <1> retn 911 <1> 912 <1> ; 28/07/2022 913 <1> loc_find_dir_next_entry_prevdeleted: 914 0000A72B 80CA80 <1> or dl, 80h ; Bit 7 -> deleted entry sign 915 <1> ;jmp short loc_find_dir_next_entry 916 <1> 917 <1> ; 28/07/2022 918 <1> loc_find_dir_next_entry: 919 0000A72E 8815[707F0100] <1> mov byte [PreviousAttr], dl ; LongName check 920 <1> loc_find_dir_next_entry_1: 921 0000A734 5E <1> pop esi 922 0000A735 83C720 <1> add edi, 32 923 <1> ;;inc word [DirBuff_EntryCounter] 924 <1> ;inc bx 925 <1> ; 28/07/2022 926 0000A738 43 <1> inc ebx 927 0000A739 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 928 0000A740 77D2 <1> ja short loc_ffde_stc_retn_255 929 <1> ; 28/07/2022 930 <1> ;jmp short check_find_dir_entry 931 <1> 932 <1> check_find_dir_entry: 933 0000A742 66A1[6C7F0100] <1> mov ax, [FDE_AttrMask] 934 0000A748 8A2F <1> mov ch, [edi] 935 0000A74A 80FD00 <1> cmp ch, 0 ; Is it never used entry? 936 <1> ;jna loc_find_direntry_stc_retn 937 <1> ; 28/07/2022 938 0000A74D 7702 <1> ja short loc_fde_check_attrib 939 <1> ; end of directory entries 940 0000A74F EBC7 <1> jmp loc_find_direntry_stc_retn 941 <1> loc_fde_check_attrib: 942 0000A751 56 <1> push esi 943 0000A752 8A570B <1> mov dl, [edi+0Bh] ; File attributes 944 0000A755 80FDE5 <1> cmp ch, 0E5h ; Is it a deleted file? 945 0000A758 74D1 <1> je short loc_find_dir_next_entry_prevdeleted 946 <1> 947 0000A75A 80FA0F <1> cmp dl, 0Fh ; longname sub component check 948 0000A75D 7505 <1> jne short loc_check_attributes_mask 949 0000A75F E8A6010000 <1> call save_longname_sub_component 950 <1> 951 <1> loc_check_attributes_mask: 952 0000A764 88C6 <1> mov dh, al 953 0000A766 20D6 <1> and dh, dl 954 <1> ; 28/07/2022 955 0000A768 38F0 <1> cmp al, dh 956 0000A76A 75C2 <1> jne short loc_find_dir_next_entry 957 0000A76C 20D4 <1> and ah, dl 958 0000A76E 75BE <1> jnz short loc_find_dir_next_entry 959 0000A770 80FA0F <1> cmp dl, 0Fh 960 0000A773 7515 <1> jne short pass_direntry_attr_check 961 <1> 962 0000A775 3C0F <1> cmp al, 0Fh ; AL = 0Fh -> find long name 963 0000A777 75B5 <1> jne short loc_find_dir_next_entry 964 <1> 965 0000A779 5E <1> pop esi 966 <1> ;xor ax, ax 967 <1> ; 28/07/2022 968 <1> ;sub eax, eax 969 0000A77A 30C0 <1> xor al, al 970 0000A77C 8A35[707F0100] <1> mov dh, [PreviousAttr] 971 0000A782 66891D[9E7E0100] <1> mov [DirBuff_CurrentEntry], bx 972 0000A789 C3 <1> retn 973 <1> 974 <1> pass_direntry_attr_check: 975 0000A78A 89FD <1> mov ebp, edi ; 14/02/2016 976 <1> ;mov ecx, 8 977 <1> ; 28/07/2022 978 0000A78C 29C9 <1> sub ecx, ecx 979 0000A78E B108 <1> mov cl, 8 980 <1> loc_lodsb_find_dir: 981 0000A790 AC <1> lodsb 982 0000A791 3C2A <1> cmp al, '*' 983 0000A793 7508 <1> jne short pass_fde_ambiguous1_check 984 0000A795 FE05[6F7F0100] <1> inc byte [AmbiguousFileName+1] 985 0000A79B EB23 <1> jmp short loc_check_direntry_extension 986 <1> 987 <1> pass_fde_ambiguous1_check: 988 0000A79D 3C3F <1> cmp al, '?' 989 0000A79F 750D <1> jne short pass_fde_ambiguous2_check 990 0000A7A1 FE05[6E7F0100] <1> inc byte [AmbiguousFileName] 991 0000A7A7 803F20 <1> cmp byte [edi], 20h 992 0000A7AA 763E <1> jna short loc_find_dir_next_entry_ebp 993 0000A7AC EB0F <1> jmp short loc_scasb_find_dir_inc_di 994 <1> 995 <1> pass_fde_ambiguous2_check: 996 0000A7AE 3C20 <1> cmp al, 20h 997 0000A7B0 7507 <1> jne short loc_scasb_find_dir 998 0000A7B2 803F20 <1> cmp byte [edi], 20h 999 0000A7B5 7533 <1> jne short loc_find_dir_next_entry_ebp 1000 0000A7B7 EB07 <1> jmp short loc_check_direntry_extension 1001 <1> 1002 <1> loc_scasb_find_dir: 1003 0000A7B9 3A07 <1> cmp al, [edi] 1004 0000A7BB 752D <1> jne short loc_find_dir_next_entry_ebp 1005 <1> loc_scasb_find_dir_inc_di: 1006 0000A7BD 47 <1> inc edi 1007 0000A7BE E2D0 <1> loop loc_lodsb_find_dir 1008 <1> 1009 <1> loc_check_direntry_extension: 1010 0000A7C0 BE08000000 <1> mov esi, 8 1011 0000A7C5 89F7 <1> mov edi, esi ; 8 1012 0000A7C7 033424 <1> add esi, [esp] ; Sub Dir or File Name Address 1013 0000A7CA 01EF <1> add edi, ebp 1014 0000A7CC B103 <1> mov cl, 3 1015 <1> loc_lodsb_find_dir_ext: 1016 0000A7CE AC <1> lodsb 1017 0000A7CF 3C2A <1> cmp al, '*' 1018 0000A7D1 7508 <1> jne short pass_fde_ambiguous3_check 1019 0000A7D3 FE05[6F7F0100] <1> inc byte [AmbiguousFileName+1] 1020 0000A7D9 EB1F <1> jmp short loc_find_dir_proper_direntry 1021 <1> 1022 <1> pass_fde_ambiguous3_check: 1023 0000A7DB 3C3F <1> cmp al, '?' 1024 0000A7DD 7512 <1> jne short pass_fde_ambiguous4_check 1025 0000A7DF FE05[6E7F0100] <1> inc byte [AmbiguousFileName] 1026 0000A7E5 803F20 <1> cmp byte [edi], 20h 1027 <1> ;jna short loc_find_dir_next_entry_ebp 1028 <1> ;jmp short loc_scasb_find_dir_ext_inc_di 1029 <1> ; 28/07/2022 1030 0000A7E8 7732 <1> ja short loc_scasb_find_dir_ext_inc_di 1031 <1> 1032 <1> loc_find_dir_next_entry_ebp: 1033 0000A7EA 89EF <1> mov edi, ebp ; 14/02/2016 1034 0000A7EC E93DFFFFFF <1> jmp loc_find_dir_next_entry ; 28/07/2022 1035 <1> 1036 <1> pass_fde_ambiguous4_check: 1037 0000A7F1 3C20 <1> cmp al, 20h 1038 0000A7F3 7523 <1> jne short loc_scasb_find_dir_ext 1039 0000A7F5 803F20 <1> cmp byte [edi], 20h 1040 <1> ; 28/07/2022 1041 0000A7F8 75F0 <1> jne short loc_find_dir_next_entry_ebp 1042 <1> ;jmp short loc_find_dir_proper_direntry 1043 <1> 1044 <1> loc_find_dir_proper_direntry: 1045 0000A7FA 30C9 <1> xor cl, cl 1046 <1> loc_find_dir_proper_direntry_1: 1047 0000A7FC 5E <1> pop esi 1048 0000A7FD 89EF <1> mov edi, ebp 1049 0000A7FF 8A2F <1> mov ch, [edi] 1050 0000A801 8A570B <1> mov dl, [edi+0Bh] ; Dir entry attributes 1051 0000A804 66A1[6E7F0100] <1> mov ax, [AmbiguousFileName] 1052 <1> loc_find_dir_proper_direntry_2: 1053 0000A80A 8A35[707F0100] <1> mov dh, [PreviousAttr] 1054 0000A810 66891D[9E7E0100] <1> mov [DirBuff_CurrentEntry], bx 1055 0000A817 C3 <1> retn 1056 <1> 1057 <1> loc_scasb_find_dir_ext: 1058 0000A818 3A07 <1> cmp al, [edi] 1059 0000A81A 75CE <1> jne short loc_find_dir_next_entry_ebp 1060 <1> loc_scasb_find_dir_ext_inc_di: 1061 0000A81C 47 <1> inc edi 1062 0000A81D E2AF <1> loop loc_lodsb_find_dir_ext 1063 0000A81F EBDB <1> jmp short loc_find_dir_proper_direntry_1 1064 <1> 1065 <1> loc_find_free_deleted_entry_0: 1066 0000A821 66A1[6C7F0100] <1> mov ax, [FDE_AttrMask] 1067 0000A827 8A2F <1> mov ch, [edi] 1068 0000A829 8A570B <1> mov dl, [edi+0Bh] ; File attributes 1069 0000A82C 08C9 <1> or cl, cl 1070 0000A82E 7407 <1> jz short loc_check_ffde_0_repeat 1071 <1> ;cmp cl, 0E5h 1072 <1> ;je short pass_loc_check_ffde_0_err 1073 0000A830 80F9FF <1> cmp cl, 0FFh 1074 0000A833 7430 <1> je short loc_find_free_deleted_entry_1 1075 0000A835 EB4A <1> jmp short pass_loc_check_ffde_0_err 1076 <1> 1077 <1> loc_check_ffde_0_repeat: 1078 0000A837 08ED <1> or ch, ch 1079 0000A839 7510 <1> jnz short loc_check_ffde_0_next 1080 <1> 1081 <1> loc_check_ffde_retn_2: 1082 <1> ;sub ax, ax 1083 <1> ; 28/07/2022 1084 0000A83B 29C0 <1> sub eax, eax 1085 0000A83D 8A35[707F0100] <1> mov dh, [PreviousAttr] 1086 0000A843 66891D[9E7E0100] <1> mov [DirBuff_CurrentEntry], bx 1087 0000A84A C3 <1> retn 1088 <1> 1089 <1> loc_check_ffde_0_next: 1090 <1> ;inc bx 1091 <1> ; 28/07/2022 1092 0000A84B 43 <1> inc ebx 1093 0000A84C 83C720 <1> add edi, 32 1094 <1> ;inc word [DirBuff_EntryCounter] 1095 <1> 1096 0000A84F 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 1097 <1> ;ja short loc_ffde_stc_retn_255 1098 <1> ; 07/08/2022 1099 0000A856 773A <1> ja short jmp_ffde_stc_retn_255 1100 <1> 1101 0000A858 8815[707F0100] <1> mov [PreviousAttr], dl 1102 0000A85E 8A2F <1> mov ch, [edi] 1103 0000A860 8A570B <1> mov dl, [edi+0Bh] ; file attributes 1104 0000A863 EBD2 <1> jmp short loc_check_ffde_0_repeat 1105 <1> 1106 <1> loc_find_free_deleted_entry_1: 1107 0000A865 28D2 <1> sub dl, dl 1108 <1> loc_find_free_deleted_entry_2: 1109 0000A867 20ED <1> and ch, ch 1110 0000A869 74D0 <1> jz short loc_check_ffde_retn_2 1111 0000A86B 80FDE5 <1> cmp ch, 0E5h 1112 0000A86E 74CB <1> je short loc_check_ffde_retn_2 1113 <1> ;inc bx 1114 <1> ; 28/07/2022 1115 0000A870 43 <1> inc ebx 1116 0000A871 83C720 <1> add edi, 32 1117 0000A874 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 1118 <1> ;ja short loc_ffde_stc_retn_255 1119 <1> ; 07/08/2022 1120 0000A87B 7715 <1> ja short jmp_ffde_stc_retn_255 1121 <1> 1122 0000A87D 8A2F <1> mov ch, [edi] 1123 0000A87F EBE6 <1> jmp short loc_find_free_deleted_entry_2 1124 <1> 1125 <1> pass_loc_check_ffde_0_err: 1126 0000A881 38CD <1> cmp ch, cl 1127 0000A883 741F <1> je short loc_check_ffde_attrib 1128 <1> 1129 <1> ;inc bx 1130 <1> ; 28/07/2022 1131 0000A885 43 <1> inc ebx 1132 0000A886 83C720 <1> add edi, 32 1133 0000A889 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 1134 <1> ;ja loc_ffde_stc_retn_255 1135 <1> ; 28/07/2022 1136 0000A890 7605 <1> jna short loc_ffe_save_prev_attr 1137 <1> jmp_ffde_stc_retn_255: ; 07/08/2022 1138 0000A892 E97DFEFFFF <1> jmp loc_ffde_stc_retn_255 1139 <1> 1140 <1> loc_ffe_save_prev_attr: ; 28/07/2022 1141 0000A897 8815[707F0100] <1> mov [PreviousAttr], dl 1142 0000A89D 8A2F <1> mov ch, [edi] 1143 0000A89F 8A570B <1> mov dl, [edi+0Bh] 1144 0000A8A2 EBDD <1> jmp short pass_loc_check_ffde_0_err 1145 <1> 1146 <1> loc_check_ffde_attrib: 1147 0000A8A4 88C6 <1> mov dh, al 1148 0000A8A6 20D6 <1> and dh, dl 1149 0000A8A8 38F0 <1> cmp al, dh 1150 0000A8AA 759F <1> jne short loc_check_ffde_0_next 1151 0000A8AC 20D4 <1> and ah, dl 1152 0000A8AE 759B <1> jnz short loc_check_ffde_0_next 1153 0000A8B0 30C9 <1> xor cl, cl 1154 0000A8B2 EB87 <1> jmp short loc_check_ffde_retn_2 1155 <1> 1156 <1> convert_file_name: 1157 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1158 <1> ; 06/03/2016 1159 <1> ; 11/02/2016 1160 <1> ; 07/02/2016 (TRDOS 386 = TRDOS v2.0) 1161 <1> ; 06/10/2009 1162 <1> ; 2005 1163 <1> ; 1164 <1> ; INPUT -> 1165 <1> ; ESI = Dot File Name Location 1166 <1> ; EDI = Dir Entry Format File Name Location 1167 <1> ; OUTPUT -> 1168 <1> ; EDI = Dir Entry Format File Name Location 1169 <1> ; ESI = Dot File Name Location (capitalized) 1170 <1> ; 1171 <1> ; (ECX, AL will be changed) 1172 <1> 1173 0000A8B4 56 <1> push esi 1174 0000A8B5 57 <1> push edi 1175 <1> 1176 <1> ;mov ecx, 11 1177 <1> ; 29/07 2022 1178 0000A8B6 29C9 <1> sub ecx, ecx 1179 0000A8B8 B10B <1> mov cl, 11 1180 0000A8BA B020 <1> mov al, 20h 1181 0000A8BC F3AA <1> rep stosb 1182 <1> 1183 0000A8BE 8B3C24 <1> mov edi, [esp] 1184 <1> 1185 0000A8C1 B10C <1> mov cl, 12 ; file name length (max.) 1186 <1> ; 06/03/2016 1187 <1> ; Directory entry name limit (11 bytes) check for 1188 <1> ; 'rename_directory_entry' procedure. 1189 <1> ; (EDI points to Directory Entry) 1190 <1> ; (If the file name would not contain a dot 1191 <1> ; and file name length would be 12, this would cause to 1192 <1> ; overwrite the attributes byte of the directory entry.) 1193 <1> ; 1194 0000A8C3 B50B <1> mov ch, 11 ; directory entry's name length 1195 <1> loc_check_first_dot: 1196 0000A8C5 8A06 <1> mov al, [esi] 1197 0000A8C7 3C2E <1> cmp al, 2Eh 1198 0000A8C9 750C <1> jne short pass_check_first_dot 1199 0000A8CB 8807 <1> mov [edi], al 1200 0000A8CD 47 <1> inc edi 1201 0000A8CE 46 <1> inc esi 1202 0000A8CF FEC9 <1> dec cl 1203 0000A8D1 75F2 <1> jnz short loc_check_first_dot 1204 <1> ;;(ecx <= 12) 1205 <1> ;;loop loc_check_first_dot 1206 0000A8D3 EB30 <1> jmp short stop_convert_file 1207 <1> 1208 <1> loc_get_fchar: 1209 0000A8D5 8A06 <1> mov al, [esi] 1210 <1> pass_check_first_dot: 1211 0000A8D7 3C61 <1> cmp al, 61h ; 'a' 1212 0000A8D9 7208 <1> jb short pass_name_capitalize 1213 0000A8DB 3C7A <1> cmp al, 7Ah ; 'z' 1214 0000A8DD 7704 <1> ja short pass_name_capitalize 1215 0000A8DF 24DF <1> and al, 0DFh 1216 0000A8E1 8806 <1> mov [esi], al 1217 <1> pass_name_capitalize: 1218 0000A8E3 3C21 <1> cmp al, 21h 1219 0000A8E5 721E <1> jb short stop_convert_file 1220 0000A8E7 3C2E <1> cmp al, 2Eh ; '.' 1221 0000A8E9 750C <1> jne short pass_dot_space 1222 <1> add_dot_space: 1223 0000A8EB 80F904 <1> cmp cl, 4 1224 0000A8EE 760E <1> jna short inc_and_loop 1225 0000A8F0 47 <1> inc edi 1226 0000A8F1 FECD <1> dec ch ; 06/03/2016 1227 0000A8F3 FEC9 <1> dec cl 1228 0000A8F5 EBF4 <1> jmp short add_dot_space 1229 <1> 1230 <1> ;mov al, 4 1231 <1> ;cmp cl, al 1232 <1> ;jna short inc_and_loop 1233 <1> ;sub cl, al 1234 <1> ;add edi, ecx 1235 <1> ;mov cl, al 1236 <1> ;jmp short inc_and_loop 1237 <1> 1238 <1> pass_dot_space: 1239 0000A8F7 8807 <1> mov [edi], al 1240 <1> loc_after_double_dot: 1241 <1> ; 06/03/2016 1242 0000A8F9 FECD <1> dec ch ; count down for 11 bytes dir entry limit 1243 0000A8FB 740A <1> jz short stop_convert_file_x 1244 0000A8FD 47 <1> inc edi 1245 <1> inc_and_loop: 1246 0000A8FE FEC9 <1> dec cl ; count down for 12 bytes filename limit 1247 0000A900 7403 <1> jz short stop_convert_file 1248 0000A902 46 <1> inc esi 1249 <1> ;;(ecx <= 12) 1250 <1> ;;loop loc_get_fchar 1251 0000A903 EBD0 <1> jmp short loc_get_fchar 1252 <1> 1253 <1> stop_convert_file: 1254 <1> ; 06/03/2016 1255 0000A905 30ED <1> xor ch, ch 1256 <1> ; ECX < 256 ; 'find_first_file' -> xor cl, cl 1257 <1> stop_convert_file_x: 1258 0000A907 5F <1> pop edi 1259 0000A908 5E <1> pop esi 1260 0000A909 C3 <1> retn 1261 <1> 1262 <1> save_longname_sub_component: 1263 <1> ; 13/02/2016 1264 <1> ; 06/02/2016 (TRDOS 386 = TRDOS v2.0) 1265 <1> ; 28/02/2010 1266 <1> ; 17/10/2009 1267 <1> ; INPUT -> 1268 <1> ; EDI = Directory Entry 1269 <1> ; // This procedure is called 1270 <1> ; // from 'find_directory_entry' procedure. 1271 <1> ; // If the last entry returns with 1272 <1> ; // a non-zero LongnameFound value and 1273 <1> ; // if LFN_CheckSum value is equal to 1274 <1> ; // the next shortname checksum, 1275 <1> ; // long name is valid. 1276 <1> ; // If a longname is longer than 65 bytes, 1277 <1> ; // it is invalid for trdos. (>45h) 1278 <1> 1279 0000A90A 57 <1> push edi 1280 0000A90B 56 <1> push esi 1281 <1> ;push ebx 1282 <1> ;push ecx 1283 <1> ;push edx 1284 0000A90C 50 <1> push eax 1285 <1> 1286 0000A90D 29C9 <1> sub ecx, ecx 1287 <1> ;sub eax, eax 1288 0000A90F B11A <1> mov cl, 26 1289 <1> 1290 0000A911 0FB607 <1> movzx eax, byte [edi] ; LDIR_Order 1291 0000A914 3C41 <1> cmp al, 41h ; 40h (last long entry sign) + 1 1292 0000A916 722B <1> jb short pass_pslnsc_last_long_entry 1293 <1> 1294 0000A918 88C4 <1> mov ah, al 1295 0000A91A 80EC40 <1> sub ah, 40h 1296 0000A91D 8825[727F0100] <1> mov [LFN_EntryLength], ah 1297 <1> 1298 0000A923 3C45 <1> cmp al, 45h ; 40h (last long entry sign) + 5 1299 <1> ; Max 130 byte length is usable in TRDOS 1300 <1> ; 26*5 = 130 1301 0000A925 7753 <1> ja short loc_pslnsc_retn 1302 <1> 1303 0000A927 2407 <1> and al, 07h ; 0Fh 1304 0000A929 A2[717F0100] <1> mov [LongNameFound], al 1305 <1> 1306 0000A92E FEC8 <1> dec al 1307 <1> ;mov cl, 26 1308 0000A930 F6E1 <1> mul cl 1309 <1> 1310 0000A932 89C6 <1> mov esi, eax 1311 0000A934 01CE <1> add esi, ecx 1312 <1> ; to make is an ASCIIZ string 1313 <1> ; with ax+26 bytes length 1314 0000A936 81C6[747F0100] <1> add esi, LongFileName 1315 0000A93C 66C7060000 <1> mov word [esi], 0 1316 0000A941 EB16 <1> jmp short loc_pslsc_move_ldir_name2 1317 <1> 1318 <1> pass_pslnsc_last_long_entry: 1319 0000A943 3C04 <1> cmp al, 04h 1320 0000A945 7733 <1> ja short loc_pslnsc_retn 1321 0000A947 FE0D[717F0100] <1> dec byte [LongNameFound] 1322 0000A94D 3A05[717F0100] <1> cmp al, [LongNameFound] 1323 0000A953 7525 <1> jne short loc_pslnsc_retn 1324 <1> 1325 <1> loc_pslsc_move_ldir_name1: 1326 0000A955 FEC8 <1> dec al 1327 <1> ;mov cl, 26 1328 0000A957 F6E1 <1> mul cl 1329 <1> 1330 <1> loc_pslsc_move_ldir_name2: 1331 0000A959 8A4F0D <1> mov cl, [edi+0Dh] ; long name checksum 1332 0000A95C 880D[737F0100] <1> mov [LFN_CheckSum], cl 1333 0000A962 89FE <1> mov esi, edi ; LDIR_Order 1334 0000A964 BF[747F0100] <1> mov edi, LongFileName 1335 0000A969 01C7 <1> add edi, eax 1336 0000A96B 46 <1> inc esi 1337 0000A96C B105 <1> mov cl, 5 ; chars 1 to 5 1338 0000A96E 66F3A5 <1> rep movsw 1339 0000A971 83C603 <1> add esi, 3 1340 0000A974 A5 <1> movsd ; char 6 & 7 1341 0000A975 A5 <1> movsd ; char 8 & 9 1342 0000A976 A5 <1> movsd ; char 10 & 11 1343 0000A977 46 <1> inc esi 1344 0000A978 46 <1> inc esi 1345 0000A979 A5 <1> movsd ; char 12 & 13 1346 <1> 1347 <1> loc_pslnsc_retn: 1348 0000A97A 58 <1> pop eax 1349 <1> ;pop edx 1350 <1> ;pop ecx 1351 <1> ;pop ebx 1352 0000A97B 5E <1> pop esi 1353 0000A97C 5F <1> pop edi 1354 <1> 1355 0000A97D C3 <1> retn 1356 <1> 1357 <1> parse_path_name: 1358 <1> ; 02/12/2025 (TRDOS 386 v2.0.10, BugFix) 1359 <1> ; 03/09/2024 (TRDOS 386 v2.0.9) 1360 <1> ; 09/08/2022 1361 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1362 <1> ; 10/02/2016 1363 <1> ; 08/02/2016 (TRDOS 386 = TRDOS v2.0) 1364 <1> ; 10/009/2011 ('proc_parse_pathname') 1365 <1> ; 27/11/2009 1366 <1> ; 05/12/2004 1367 <1> ; 1368 <1> ; INPUT -> 1369 <1> ; ESI = Beginning of ASCIIZ pathname string 1370 <1> ; EDI = Destination Address 1371 <1> ; (which is TR-DOS FindFile data buffer) 1372 <1> ; OUTPUT -> 1373 <1> ; CF = 1 -> Error 1374 <1> ; EAX = Error Code (AL) 1375 <1> ; 1376 <1> ; (Modified registers: eax, ecx, esi, edi) 1377 <1> 1378 <1> ; Clear the pathname bytes in TR-DOS Findfile data buffer 1379 0000A97E 57 <1> push edi 1380 <1> ;mov ecx, 20 ; 80 bytes 1381 <1> ; 29/07/2022 1382 0000A97F 29C9 <1> sub ecx, ecx 1383 0000A981 B114 <1> mov cl, 20 1384 0000A983 31C0 <1> xor eax, eax 1385 0000A985 F3AB <1> rep stosd 1386 0000A987 5F <1> pop edi 1387 <1> 1388 0000A988 668B06 <1> mov ax, [esi] 1389 0000A98B 80FC3A <1> cmp ah, ':' 1390 0000A98E 741C <1> je short loc_ppn_change_drive 1391 0000A990 A0[76770100] <1> mov al, [Current_Drv] 1392 0000A995 EB33 <1> jmp short pass_ppn_change_drive 1393 <1> 1394 <1> pass_ppn_cdir: 1395 0000A997 8B35[96800100] <1> mov esi, [First_Path_Pos] 1396 0000A99D AC <1> lodsb 1397 <1> loc_ppn_get_filename: 1398 0000A99E 83C741 <1> add edi, 65 ; FindFile_Name location 1399 <1> ; TRDOS Filename length must not be more than 12 bytes 1400 <1> ;mov ecx, 12 1401 0000A9A1 B10C <1> mov cl, 12 1402 <1> loc_ppn_get_fnchar_next: 1403 0000A9A3 AA <1> stosb 1404 0000A9A4 AC <1> lodsb 1405 0000A9A5 3C21 <1> cmp al, 21h 1406 0000A9A7 7269 <1> jb short loc_ppn_clc_return 1407 0000A9A9 E2F8 <1> loop loc_ppn_get_fnchar_next 1408 <1> loc_ppn_return: 1409 0000A9AB C3 <1> retn 1410 <1> 1411 <1> loc_ppn_change_drive: 1412 <1> ; 29/07/2022 1413 <1> ; ecx = 0 1414 0000A9AC 24DF <1> and al, 0DFh 1415 0000A9AE 2C41 <1> sub al, 'A' ; A: 1416 0000A9B0 7264 <1> jc short loc_ppn_invalid_drive 1417 0000A9B2 3805[8D2E0100] <1> cmp [Last_DOS_DiskNo], al 1418 0000A9B8 725C <1> jb short loc_ppn_invalid_drive 1419 <1> 1420 0000A9BA 46 <1> inc esi 1421 0000A9BB 46 <1> inc esi 1422 0000A9BC 8A26 <1> mov ah, [esi] 1423 0000A9BE 80FC21 <1> cmp ah, 21h 1424 0000A9C1 7307 <1> jnb short pass_ppn_change_drive 1425 <1> 1426 <1> loc_ppn_cmd_failed: 1427 <1> ; File or directory name is not existing 1428 0000A9C3 8807 <1> mov [edi], al ; Drv 1429 0000A9C5 66B80100 <1> mov ax, 1 ; eax = 1 1430 <1> ; TR-DOS Error Code 01h = Bad Command Argument 1431 <1> ; MS-DOS Error Code 01h : Invalid Function Number 1432 <1> ;stc 1433 <1> ; (MainProg ErrMsg: "Bad command or file name!") 1434 0000A9C9 C3 <1> retn 1435 <1> 1436 <1> pass_ppn_change_drive: 1437 0000A9CA 8935[96800100] <1> mov [First_Path_Pos], esi 1438 <1> ;mov dword [Last_Slash_Pos], 0 1439 <1> ; 29/07/2022 1440 0000A9D0 890D[9A800100] <1> mov [Last_Slash_Pos], ecx ; 0 1441 0000A9D6 AA <1> stosb 1442 0000A9D7 8A06 <1> mov al, [esi] 1443 <1> loc_scan_ppn_dslash: 1444 0000A9D9 3C2F <1> cmp al, '/' 1445 0000A9DB 7506 <1> jne short loc_scan_next_slash_pos 1446 0000A9DD 8935[9A800100] <1> mov [Last_Slash_Pos], esi 1447 <1> loc_scan_next_slash_pos: 1448 0000A9E3 46 <1> inc esi 1449 0000A9E4 8A06 <1> mov al, [esi] 1450 0000A9E6 3C20 <1> cmp al, 20h 1451 0000A9E8 77EF <1> ja short loc_scan_ppn_dslash 1452 <1> ;cmp dword [Last_Slash_Pos], 0 1453 <1> ; 09/08/2022 1454 <1> ;cmp [Last_Slash_Pos], ecx ; 0 ? 1455 <1> ;jna short pass_ppn_cdir 1456 <1> 1457 0000A9EA 8B0D[9A800100] <1> mov ecx, [Last_Slash_Pos] 1458 <1> ; 03/09/2024 1459 <1> ;jcxz pass_ppn_cdir 1460 <1> ; 02/12/2025 1461 0000A9F0 E3A5 <1> jecxz pass_ppn_cdir 1462 <1> 1463 0000A9F2 8B35[96800100] <1> mov esi, [First_Path_Pos] 1464 0000A9F8 29F1 <1> sub ecx, esi 1465 0000A9FA 41 <1> inc ecx 1466 <1> ;cmp ecx, 64 1467 0000A9FB 80F940 <1> cmp cl, 64 1468 0000A9FE 7715 <1> ja short loc_ppn_invalid_drive_stc 1469 <1> 1470 0000AA00 89F8 <1> mov eax, edi ; Dest Dir String Location (65 bytes) 1471 0000AA02 F3A4 <1> rep movsb 1472 <1> ;mov [edi], cl ; 0, End of Dir String 1473 0000AA04 8B35[9A800100] <1> mov esi, [Last_Slash_Pos] 1474 0000AA0A 46 <1> inc esi 1475 0000AA0B 89C7 <1> mov edi, eax 1476 0000AA0D AC <1> lodsb 1477 0000AA0E 3C21 <1> cmp al, 21h 1478 0000AA10 738C <1> jnb short loc_ppn_get_filename 1479 <1> loc_ppn_clc_return: 1480 <1> ;clc 1481 0000AA12 31C0 <1> xor eax, eax 1482 0000AA14 C3 <1> retn 1483 <1> 1484 <1> loc_ppn_invalid_drive_stc: 1485 0000AA15 F5 <1> cmc ; stc 1486 <1> loc_ppn_invalid_drive: 1487 <1> ; cf = 1 1488 <1> ; The Drive Letter/Char < "A" or > "Z" 1489 0000AA16 66B80F00 <1> mov ax, 0Fh 1490 <1> ; MS-DOS Error Code 0Fh = Disk Drive Invalid 1491 <1> ; (MainProg ErrMsg: "Drive not ready or read error!") 1492 0000AA1A C3 <1> retn 1493 <1> 1494 <1> find_longname: 1495 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 1496 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1497 <1> ; 13/02/2016 (TRDOS 386 = TRDOS v2.0) 1498 <1> ; 24/01/2010 (DIR.ASM, 'proc_find_longname') 1499 <1> ; 17/10/2009 1500 <1> 1501 <1> ; INPUT -> 1502 <1> ; ESI = DOS short file name address 1503 <1> ; for example: "filename.ext" 1504 <1> ; 1505 <1> ; OUTPUT -> 1506 <1> ; ESI = ASCIIZ longname address (cf = 0) 1507 <1> ; cf = 1 -> error number returns in EAX (AL) 1508 <1> ; AL = 0 & CF=1 -> longname not found 1509 <1> ; the file/directory has no longname 1510 <1> ; cf = 0 -> AL = FAT Type 1511 <1> 1512 <1> ; 17/10/2009 1513 <1> ; ASCIIZ string will be returned 1514 <1> ; as LongFileName 1515 <1> ; clearing/reset is not needed 1516 <1> ;mov ecx, 33 1517 <1> ;mov edi, LongFileName 1518 <1> ;sub ax, ax ; 0 1519 <1> ;rep stosw 1520 <1> 1521 <1> ;mov byte [LongNameFound], 0 1522 <1> 1523 <1> ; ESI = ASCIIZ file/directory name address 1524 <1> ; AL = Attributes AND mask 1525 <1> ; (Result of AND must be equal to AL) 1526 <1> ; AH = Negative attributes mask 1527 <1> ; (Result of AND must be ZERO) 1528 0000AA1B 66B80008 <1> mov ax, 0800h 1529 <1> ; it must not be volume name or longname 1530 0000AA1F E856DFFFFF <1> call find_first_file 1531 0000AA24 7207 <1> jc short loc_fln_retn 1532 <1> 1533 <1> ; 19/12/2025 1534 <1> %if 0 1535 <1> loc_fln_check_FAT_Type: 1536 <1> cmp byte [Current_FATType], 1 1537 <1> jnb short loc_fln_check_longname_yes_sign 1538 <1> 1539 <1> ;call get_fs_longname 1540 <1> ;retn 1541 <1> ; 29/07/2022 1542 <1> jmp get_fs_longname 1543 <1> %endif 1544 <1> 1545 <1> loc_fln_check_longname_yes_sign: 1546 0000AA26 08FF <1> or bh, bh 1547 0000AA28 7504 <1> jnz short loc_fln_check_longnamefound_number 1548 <1> loc_fln_longname_not_found_retn: 1549 0000AA2A 31C0 <1> xor eax, eax 1550 <1> ; cf = 1 & al = 0 -> longname not found 1551 0000AA2C F9 <1> stc 1552 <1> loc_fln_retn: 1553 0000AA2D C3 <1> retn 1554 <1> 1555 <1> loc_fln_check_longnamefound_number: 1556 <1> ; 'LongNameFound' is set by 1557 <1> ; by 'save_longname_sub_component' 1558 <1> ; which is called from 1559 <1> ; 'find_directory_entry' 1560 <1> ; which is called from 1561 <1> ; 'find_first_file' 1562 <1> ; It must 1 if the longname is valid 1563 0000AA2E 803D[717F0100]01 <1> cmp byte [LongNameFound], 1 1564 0000AA35 75F3 <1> jne short loc_fln_longname_not_found_retn 1565 <1> 1566 <1> loc_fln_calculate_checksum: 1567 0000AA37 E813000000 <1> call calculate_checksum 1568 <1> ; AL = shortname checksum 1569 <1> 1570 <1> loc_fln_longname_validation: 1571 <1> ; 'LFN_CheckSum' has been set already 1572 <1> ; by 'save_longname_sub_component' 1573 <1> ; which is called from 1574 <1> ; 'find_directory_entry' 1575 <1> ; which is called from 1576 <1> ; 'find_first_file' 1577 0000AA3C 3805[737F0100] <1> cmp [LFN_CheckSum], al 1578 0000AA42 75E6 <1> jne short loc_fln_longname_not_found_retn 1579 <1> 1580 0000AA44 BE[747F0100] <1> mov esi, LongFileName 1581 0000AA49 A0[75770100] <1> mov al, [Current_FATType] 1582 0000AA4E C3 <1> retn 1583 <1> 1584 <1> calculate_checksum: 1585 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1586 <1> ; 13/02/2016 (TRDOS 386 = TRDOS v2.0) 1587 <1> ; 17/10/2009 (DIR.ASM, 'proc_calculate_checksum') 1588 <1> ; 1589 <1> ; INPUT -> 1590 <1> ; ESI = 11 byte DOS File Name location 1591 <1> ; (in DOS Directory Entry Format) 1592 <1> ; OUTPUT -> 1593 <1> ; AL = 8 bit checksum (CRC) value 1594 <1> ; 1595 <1> ; (Modified registers: EAX, ECX, ESI) 1596 <1> 1597 <1> ; Erdogan Tan [ 17-10-2009 ] 1598 <1> ; 'ror al, 1' instruction 1599 <1> 1600 <1> ; Erdogan Tan [ 20-06-2004 ] 1601 <1> ; This 8086 assembly code is an original code 1602 <1> ; which is adapted from C code in 1603 <1> ; Microsoft FAT32 File System Specification 1604 <1> ; Version 1.03, December 6, 2000 1605 <1> ; Page 28 1606 <1> 1607 0000AA4F 30C0 <1> xor al, al 1608 <1> ;mov ecx, 11 1609 <1> ; 29/07/2022 1610 0000AA51 29C9 <1> sub ecx, ecx 1611 0000AA53 B10B <1> mov cl, 11 1612 <1> loc_next_sum: 1613 <1> ;xor ah, ah 1614 <1> ;test al, 1 1615 <1> ;jz short pass_ah_80h 1616 <1> ;mov ah, 80h 1617 <1> ;pass_ah_80h: 1618 <1> ;shr al, 1 1619 0000AA55 D0C8 <1> ror al, 1 ; 17/10/2009 1620 0000AA57 0206 <1> add al, [esi] 1621 0000AA59 46 <1> inc esi 1622 <1> ;add al, ah 1623 0000AA5A E2F9 <1> loop loc_next_sum 1624 0000AA5C C3 <1> retn 1625 <1> 1626 <1> get_fs_longname: 1627 <1> ; temporary (13/02/2016) 1628 0000AA5D 31C0 <1> xor eax, eax 1629 0000AA5F F9 <1> stc 1630 0000AA60 C3 <1> retn 1631 <1> 1632 <1> make_sub_directory: 1633 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 1634 <1> ; 07/08/2022 1635 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1636 <1> ; 16/10/2016 1637 <1> ; 02/03/2016, 03/03/2016 1638 <1> ; 26/02/2016, 27/02/2016 1639 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 1640 <1> ; 01/08/2011 (DIR.ASM, 'proc_make_directory') 1641 <1> ; 10/07/2010 1642 <1> ; INPUT -> 1643 <1> ; ESI = ASCIIZ Directory Name 1644 <1> ; CL = Directory Attributes 1645 <1> ; OUTPUT -> 1646 <1> ; EAX = New sub dir's first cluster 1647 <1> ; ESI = Logical Dos Drv Descr. Table Addr. 1648 <1> ; CF = 1 -> error code in AL (EAX) 1649 <1> 1650 <1> ;test cl, 10h ; directory 1651 <1> ;jz short loc_make_directory_access_denied 1652 <1> ;test cl, 08h ; volume name 1653 <1> ;jnz short loc_make_directory_access_denied 1654 <1> 1655 0000AA61 80E107 <1> and cl, 07h 1656 0000AA64 880D[F4800100] <1> mov byte [mkdir_attrib], cl 1657 <1> 1658 0000AA6A 56 <1> push esi 1659 0000AA6B 31DB <1> xor ebx, ebx 1660 0000AA6D 8A3D[76770100] <1> mov bh, [Current_Drv] 1661 0000AA73 BE00010900 <1> mov esi, Logical_DOSDisks 1662 0000AA78 01DE <1> add esi, ebx 1663 0000AA7A 5B <1> pop ebx 1664 <1> 1665 <1> ; 10/07/2010 -> 1st writable disk check for trdos 1666 <1> ; LD_DiskType = 0 for write protection (read only) 1667 0000AA7B 807E0101 <1> cmp byte [esi+LD_DiskType], 1 ; 0 = Invalid 1668 0000AA7F 7308 <1> jnb short loc_mkdir_check_file_sytem 1669 <1> ; 16/10/2016 (13h -> 30) 1670 <1> ;mov eax, 30 ; 'Disk write-protected' error 1671 <1> ;mov edx, 0 1672 <1> ; 29/07/2022 1673 0000AA81 29C0 <1> sub eax, eax 1674 0000AA83 B01E <1> mov al, 30 1675 0000AA85 29D2 <1> sub edx, edx ; 0 1676 0000AA87 F9 <1> stc 1677 <1> ; err retn: EDX = 0, EBX = Dir name offset 1678 <1> ;ESI = Logical DOS drive description table address 1679 0000AA88 C3 <1> retn 1680 <1> 1681 <1> ;loc_make_directory_access_denied: 1682 <1> ;mov ax, 05h ; access denied (invalid attributes input) 1683 <1> ;stc 1684 <1> ;retn 1685 <1> 1686 <1> loc_mkdir_check_file_sytem: 1687 <1> ; 19/12/2025 1688 <1> %if 0 1689 <1> cmp byte [esi+LD_FATType], 1 1690 <1> jnb short loc_mkdir_check_free_sectors 1691 <1> 1692 <1> loc_make_fs_directory: 1693 <1> mov eax, [Current_Dir_FCluster] 1694 <1> 1695 <1> ; EAX = Parent directory DDT Address 1696 <1> ; ESI = Logical DOS Drive DT Address 1697 <1> ; EBX = Directory name offset (as ASCIIZ name) 1698 <1> 1699 <1> ;call make_fs_directory 1700 <1> ;retn 1701 <1> ; 29/07/2022 1702 <1> jmp make_fs_directory 1703 <1> %endif 1704 <1> 1705 <1> loc_mkdir_check_free_sectors: 1706 0000AA89 0FB64613 <1> movzx eax, byte [esi+LD_BPB+SecPerClust] 1707 0000AA8D 8B4E74 <1> mov ecx, [esi+LD_FreeSectors] 1708 0000AA90 39C1 <1> cmp ecx, eax 1709 0000AA92 7254 <1> jb short loc_mkdir_insufficient_disk_space 1710 <1> 1711 <1> loc_make_fat_directory: 1712 0000AA94 891D[E4800100] <1> mov [mkdir_DirName_Offset], ebx 1713 0000AA9A 890D[F0800100] <1> mov [mkdir_FreeSectors], ecx 1714 <1> 1715 <1> ;mov al, [esi+LD_BPB+SecPerClust] 1716 0000AAA0 A2[F6800100] <1> mov byte [mkdir_SecPerClust], al 1717 <1> 1718 <1> loc_mkdir_gffc_1: 1719 0000AAA5 E8F1160000 <1> call get_first_free_cluster 1720 0000AAAA 722A <1> jc short loc_mkdir_gffc_retn 1721 <1> 1722 <1> ;loc_mkdir_gffc_1_cont: 1723 <1> ;cmp eax, 2 1724 <1> ;jb short loc_mkdir_gffc_insufficient_disk_space 1725 <1> 1726 <1> ;loc_mkdir_gffc_1_save_fcluster: 1727 0000AAAC A3[E8800100] <1> mov [mkdir_FFCluster], eax 1728 <1> 1729 <1> loc_mkdir_locate_ffe: 1730 <1> ; Current directory fcluster <> Directory buffer cluster 1731 <1> ; Current directory will be reloaded by 1732 <1> ; 'locate_current_dir_file' procedure 1733 <1> ; 1734 <1> ; ESI = Logical DOS Drive Description Table Address 1735 <1> ;push esi ; 27/02/2016 1736 0000AAB1 31C0 <1> xor eax, eax 1737 0000AAB3 89C1 <1> mov ecx, eax 1738 0000AAB5 6649 <1> dec cx ; FFFFh 1739 <1> ; CX = FFFFh -> find first deleted or free entry 1740 <1> ; ESI would be ASCIIZ filename address if the call 1741 <1> ; would not be for first free or deleted dir entry 1742 0000AAB7 E84CFBFFFF <1> call locate_current_dir_file 1743 0000AABC 734A <1> jnc short loc_mkdir_set_ff_dir_entry_1 1744 <1> ;pop esi 1745 <1> ; ESI = Logical DOS Drive Description Table Address 1746 0000AABE 83F802 <1> cmp eax, 2 ; cmp al, 2 ; File/Dir not found ! 1747 0000AAC1 7529 <1> jne short loc_mkdir_stc_return 1748 <1> 1749 <1> loc_mkdir_add_new_cluster: 1750 0000AAC3 3805[75770100] <1> cmp byte [Current_FATType], al ; 2 1751 <1> ;cmp byte ptr [esi+LD_FATType], 2 1752 0000AAC9 770C <1> ja short loc_mkdir_add_new_cluster_check_fsc 1753 0000AACB 803D[74770100]01 <1> cmp byte [Current_Dir_Level], 1 1754 <1> ;cmp byte [esi+LD_CDirLevel], 1 1755 0000AAD2 7303 <1> jnb short loc_mkdir_add_new_cluster_check_fsc 1756 <1> 1757 0000AAD4 B00C <1> mov al, 12 ; No more files 1758 <1> loc_mkdir_gffc_retn: 1759 0000AAD6 C3 <1> retn 1760 <1> 1761 <1> loc_mkdir_add_new_cluster_check_fsc: 1762 0000AAD7 8B0D[F0800100] <1> mov ecx, [mkdir_FreeSectors] 1763 <1> ;movzx eax, byte [mkdir_SecPerClust] 1764 0000AADD A0[F6800100] <1> mov al, [mkdir_SecPerClust] 1765 <1> ;shl ax, 1 ; AX = 2 * AX 1766 <1> ; 29/07/2022 1767 0000AAE2 D1E0 <1> shl eax, 1 1768 0000AAE4 39C1 <1> cmp ecx, eax 1769 0000AAE6 7350 <1> jnb short loc_mkdir_add_new_subdir_cluster 1770 <1> 1771 <1> loc_mkdir_insufficient_disk_space: 1772 <1> ;mov edx, ecx 1773 <1> ;loc_mkdir_gffc_insufficient_disk_space: 1774 <1> ; 29/07/2022 1775 <1> ;mov ax, 27h ; MSDOS err => insufficient disk space 1776 <1> 1777 <1> ; err retn: EDX = Free sectors, EBX = Dir name offset 1778 <1> ; ESI -> Dos drive description table address 1779 <1> ;; ecx = edx 1780 <1> 1781 <1> ;retn 1782 <1> 1783 <1> ; 29/07/2022 1784 0000AAE8 30E4 <1> xor ah, ah 1785 0000AAEA B027 <1> mov al, 27h 1786 <1> 1787 <1> loc_mkdir_stc_return: 1788 0000AAEC F9 <1> stc 1789 0000AAED C3 <1> retn 1790 <1> 1791 <1> loc_mkdir_gffc_2: 1792 0000AAEE E8A8160000 <1> call get_first_free_cluster 1793 0000AAF3 72E1 <1> jc short loc_mkdir_gffc_retn 1794 <1> 1795 <1> ;loc_mkdir_gffc_1_cont: 1796 <1> ;cmp eax, 2 1797 <1> ;jb short loc_mkdir_gffc_insufficient_disk_space 1798 <1> 1799 <1> ;loc_mkdir_gffc_2_save_fcluster: 1800 0000AAF5 A3[E8800100] <1> mov [mkdir_FFCluster], eax 1801 <1> 1802 0000AAFA A1[EC800100] <1> mov eax, [mkdir_LastDirCluster] 1803 <1> 1804 0000AAFF E841160000 <1> call load_FAT_sub_directory 1805 0000AB04 72D0 <1> jc short loc_mkdir_gffc_retn 1806 <1> 1807 0000AB06 31FF <1> xor edi, edi 1808 <1> loc_mkdir_set_ff_dir_entry_1: 1809 <1> ; 27/02/2016 1810 0000AB08 56 <1> push esi ; Logical DOS Drv Desc. Tbl. address 1811 <1> ; EDI = Directory Entry Address 1812 0000AB09 8B35[E4800100] <1> mov esi, [mkdir_DirName_Offset] 1813 0000AB0F A1[E8800100] <1> mov eax, [mkdir_FFCluster] 1814 <1> 1815 0000AB14 66B91000 <1> mov cx, 10h ; CL = Directory attribute 1816 <1> ; CH = 0 -> File size is 0 1817 0000AB18 0A0D[F4800100] <1> or cl, [mkdir_attrib] ; S, H, R 1818 0000AB1E E89B010000 <1> call make_directory_entry 1819 <1> 1820 0000AB23 5E <1> pop esi 1821 <1> 1822 0000AB24 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 1823 0000AB2B E861020000 <1> call save_directory_buffer 1824 <1> ;jnc loc_mkdir_set_ff_dir_entry_2 1825 <1> ; 29/07/2022 1826 0000AB30 7205 <1> jc short loc_mkdir_return 1827 0000AB32 E9CA000000 <1> jmp loc_mkdir_set_ff_dir_entry_2 1828 <1> 1829 <1> loc_mkdir_return: 1830 0000AB37 C3 <1> retn 1831 <1> 1832 <1> loc_mkdir_add_new_subdir_cluster: 1833 0000AB38 8B15[A27E0100] <1> mov edx, [DirBuff_Cluster] 1834 0000AB3E 8915[EC800100] <1> mov [mkdir_LastDirCluster], edx 1835 <1> 1836 0000AB44 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 1837 0000AB49 E8F7150000 <1> call load_FAT_sub_directory 1838 0000AB4E 72E7 <1> jc short loc_mkdir_return 1839 <1> ; eax = 0 1840 <1> ; ecx = directory buffer sector count (<= 128) 1841 <1> 1842 <1> pass_mkdir_add_new_subdir_cluster: 1843 <1> 1844 <1> ; 29/07/2022 1845 <1> ; ;sub edi, edi ; 0 1846 <1> ; ; 29/07/2022 - BUGFIX ! 1847 <1> ; mov edi, Directory_Buffer 1848 <1> ; 1849 <1> ; ;mov al, 128 ; double word 1850 <1> ; ;mul ecx ; ecx = directory buffer sector count 1851 <1> ; ;mov ecx, eax 1852 <1> ; ;shl cx, 7 ; 128 * sector count 1853 <1> ; mov ax, [esi+LD_BPB+BytesPerSec] ; 512 1854 <1> ; ;shr ax, 2 ; 'byte count / 4' for 'stosd' 1855 <1> ; ; 29/07/2022 1856 <1> ; shr eax, 2 1857 <1> ; ;mul cx ; max = 128*(512/4) -> 16384 (stosd) 1858 <1> ; ;mov cx, ax 1859 <1> ; ;sub ax, ax ; 0 1860 <1> ; ; 29/07/2022 1861 <1> ; mul ecx 1862 <1> ; mov ecx, eax 1863 <1> ; sub eax, eax 1864 <1> ; rep stosd ; clear directory buffer 1865 <1> 1866 <1> ; 29/07/2022 1867 0000AB50 E85C010000 <1> call clear_directory_buffer 1868 <1> 1869 0000AB55 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 1870 0000AB5C E830020000 <1> call save_directory_buffer 1871 0000AB61 72D4 <1> jc short loc_mkdir_return 1872 <1> 1873 <1> loc_mkdir_save_added_cluster: 1874 0000AB63 A1[EC800100] <1> mov eax, [mkdir_LastDirCluster] 1875 0000AB68 8B0D[E8800100] <1> mov ecx, [mkdir_FFCluster] 1876 <1> ; 01/03/2016 1877 0000AB6E 31D2 <1> xor edx, edx 1878 0000AB70 8915[927E0100] <1> mov [FAT_ClusterCounter], edx ; 0 ; reset 1879 0000AB76 E8F5160000 <1> call update_cluster 1880 0000AB7B 7304 <1> jnc short loc_mkdir_save_fat_buffer_0 1881 0000AB7D 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 1882 0000AB7F 7518 <1> jnz short loc_mkdir_save_fat_buffer_stc_retn 1883 <1> 1884 <1> loc_mkdir_save_fat_buffer_0: 1885 0000AB81 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 1886 0000AB86 A3[EC800100] <1> mov [mkdir_LastDirCluster], eax 1887 <1> 1888 0000AB8B 31C9 <1> xor ecx, ecx 1889 0000AB8D 49 <1> dec ecx ; FFFFFFFFh 1890 <1> ; ESI = Logical DOS Drive Description Table address 1891 0000AB8E E8DD160000 <1> call update_cluster 1892 0000AB93 731A <1> jnc short loc_mkdir_save_fat_buffer_1 1893 0000AB95 09C0 <1> or eax, eax 1894 0000AB97 7416 <1> jz short loc_mkdir_save_fat_buffer_1 1895 <1> 1896 <1> loc_mkdir_save_fat_buffer_stc_retn: 1897 <1> ; 01/03/2016 1898 0000AB99 803D[927E0100]01 <1> cmp byte [FAT_ClusterCounter], 1 1899 0000ABA0 720C <1> jb short loc_mkdir_save_fat_buffer_retn 1900 <1> 1901 0000ABA2 66BB00FF <1> mov bx, 0FF00h ; recalculate free space (BL = 0) 1902 <1> ; (BH = FFh -> Use ESI as Drv Param. Tbl.) 1903 0000ABA6 50 <1> push eax 1904 0000ABA7 E8C5190000 <1> call calculate_fat_freespace 1905 0000ABAC 58 <1> pop eax 1906 0000ABAD F9 <1> stc 1907 <1> loc_mkdir_save_fat_buffer_retn: 1908 0000ABAE C3 <1> retn 1909 <1> 1910 <1> loc_mkdir_save_fat_buffer_1: 1911 <1> ; byte [FAT_BuffValidData] = 2 1912 0000ABAF E830190000 <1> call save_fat_buffer 1913 0000ABB4 72E3 <1> jc short loc_mkdir_save_fat_buffer_stc_retn 1914 <1> 1915 <1> ; 01/03/2016 1916 0000ABB6 803D[927E0100]01 <1> cmp byte [FAT_ClusterCounter], 1 1917 0000ABBD 721B <1> jb short loc_mkdir_save_fat_buffer_2 1918 <1> 1919 <1> ; ESI = Logical DOS Drive Description Table address 1920 0000ABBF A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 1921 0000ABC4 66BB01FF <1> mov bx, 0FF01h ; add free clusters 1922 0000ABC8 E8A4190000 <1> call calculate_fat_freespace 1923 <1> 1924 <1> ;inc eax ; 0FFFFFFFFh -> 0 ; recalculation is needed! 1925 <1> ;jnz short loc_mkdir_save_fat_buffer_2 1926 <1> 1927 <1> ; ecx > 0 -> Recalculation is needed 1928 0000ABCD 09C9 <1> or ecx, ecx 1929 0000ABCF 7409 <1> jz short loc_mkdir_save_fat_buffer_2 1930 <1> 1931 0000ABD1 66BB00FF <1> mov bx, 0FF00h ; ; recalculate free space 1932 0000ABD5 E897190000 <1> call calculate_fat_freespace 1933 <1> 1934 <1> loc_mkdir_save_fat_buffer_2: 1935 0000ABDA C605[F7800100]01 <1> mov byte [mkdir_add_new_cluster], 1 1936 0000ABE1 E9B0000000 <1> jmp loc_mkdir_upd_parent_dir_lmdt 1937 <1> 1938 <1> loc_mkdir_update_sub_dir_cluster: 1939 0000ABE6 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 1940 0000ABEB 29C9 <1> sub ecx, ecx ; 0 1941 <1> ; 01/03/2016 1942 0000ABED 890D[927E0100] <1> mov [FAT_ClusterCounter], ecx ; 0 ; Reset 1943 0000ABF3 49 <1> dec ecx ; 0FFFFFFFFh 1944 <1> 1945 <1> ; ESI = Logical DOS Drive Description Table address 1946 0000ABF4 E877160000 <1> call update_cluster 1947 0000ABF9 7364 <1> jnc short loc_mkdir_save_fat_buffer_3 1948 0000ABFB 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 1949 0000ABFD 7460 <1> jz short loc_mkdir_save_fat_buffer_3 1950 <1> ; 01/03/2016 1951 0000ABFF EB98 <1> jmp short loc_mkdir_save_fat_buffer_stc_retn 1952 <1> 1953 <1> loc_mkdir_set_ff_dir_entry_2: 1954 <1> ; ESI = Logical DOS Drive Description Table address 1955 0000AC01 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 1956 <1> ; Load disk sectors as a directory cluster 1957 0000AC06 E83A150000 <1> call load_FAT_sub_directory 1958 0000AC0B 7251 <1> jc short retn_make_fat_directory 1959 <1> 1960 <1> ; eax = 0 1961 <1> ; ecx = directory buffer sector count (<= 128) 1962 <1> 1963 <1> ; 29/07/2022 1964 <1> ; mov edi, Directory_Buffer + 64 ; 26/02/2016 1965 <1> ; 1966 <1> ; ; 02/03/2016 1967 <1> ; mov ax, [esi+LD_BPB+BytesPerSec] ; 512 1968 <1> ; ;shr ax, 2 ; 'byte count / 4' for 'stosd' 1969 <1> ; ; 29/07/2022 1970 <1> ; shr eax, 2 1971 <1> ; mul ecx 1972 <1> ; mov ecx, eax 1973 <1> ; ; 1974 <1> ; ; 29/07/2022 - BUGFIX ! 1975 <1> ; sub ecx, 16 ; - 64 bytes 1976 <1> ; ; (space for '.' & '..' entries) 1977 <1> ; ;sub ax, ax 1978 <1> ; sub eax, eax 1979 <1> ; rep stosd 1980 <1> ; 1981 <1> ; ;;mov al, 128 ; double word (count in sector) 1982 <1> ; ;;mul ecx ; ecx = directory buffer sector count 1983 <1> ; ;;mov ecx, eax 1984 <1> ; ;shl cx, 7 ; 128 * sector count 1985 <1> ; ;sub ecx, 64 ; 29/07/2022 1986 <1> ; ;;sub eax, eax 1987 <1> ; ;;sub al, al ; 0 1988 <1> ; ;rep stosd ; clear directory buffer 1989 <1> 1990 <1> ; 29/07/2022 1991 0000AC0D E89F000000 <1> call clear_directory_buffer 1992 <1> 1993 0000AC12 BF00000800 <1> mov edi, Directory_Buffer ; 26/02/2016 1994 <1> 1995 0000AC17 56 <1> push esi 1996 <1> 1997 0000AC18 BE[F8800100] <1> mov esi, mkdir_Name 1998 0000AC1D 66C7062E00 <1> mov word [esi], 2Eh ; db '.', '0' 1999 <1> 2000 0000AC22 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 2001 <1> ;mov cx, 10h ; CL = Directory attribute 2002 <1> ; CH = 0 -> File size is 0 2003 <1> ; 29/07/2022 2004 0000AC27 B110 <1> mov cl, 10h 2005 0000AC29 E890000000 <1> call make_directory_entry 2006 <1> 2007 0000AC2E BF20000800 <1> mov edi, Directory_Buffer + 32 ; 26/02/2016 2008 <1> 2009 <1> ; 03/03/2016 2010 <1> ; Following modification has been done according to 2011 <1> ; 'Microsoft Extensible Firmware Initiative 2012 <1> ; FAT32 File System Specification' document, 2013 <1> ; 'FAT: General Overview of On-Disk Format—Page 25'. 2014 <1> ; "Finally, you set DIR_FstClusLO and DIR_FstClusHI 2015 <1> ; for the dotdot entry (the second entry) to the 2016 <1> ; first cluster number of the directory in which you 2017 <1> ; just created the directory (value is 0 if this directory 2018 <1> ; is the root directory even for FAT32 volumes)." 2019 <1> ; (Correctness of this modification has been verified 2020 <1> ; by using Windows 98 'scandisk.exe'.) 2021 <1> 2022 0000AC33 29C0 <1> sub eax, eax 2023 0000AC35 3805[74770100] <1> cmp byte [Current_Dir_Level], al ; 0 2024 0000AC3B 7605 <1> jna short loc_mkdir_set_ff_dir_entry_3 2025 0000AC3D A1[70770100] <1> mov eax, [Current_Dir_FCluster] ; parent dir 2026 <1> loc_mkdir_set_ff_dir_entry_3: 2027 0000AC42 66C746012E00 <1> mov word [esi+1], 2Eh ; db '.', '0' 2028 <1> 2029 <1> ;mov cx, 10h 2030 0000AC48 E871000000 <1> call make_directory_entry 2031 <1> 2032 0000AC4D 5E <1> pop esi 2033 <1> 2034 0000AC4E C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 2035 0000AC55 E837010000 <1> call save_directory_buffer 2036 <1> ;jnc loc_mkdir_update_sub_dir_cluster 2037 <1> ; 29/07/2022 2038 0000AC5A 7202 <1> jc short retn_make_fat_directory 2039 0000AC5C EB88 <1> jmp loc_mkdir_update_sub_dir_cluster 2040 <1> 2041 <1> retn_make_fat_directory: 2042 0000AC5E C3 <1> retn 2043 <1> 2044 <1> loc_mkdir_save_fat_buffer_3: 2045 <1> ; 01/03/2016 2046 <1> ; byte [FAT_BuffValidData] = 2 2047 0000AC5F E880180000 <1> call save_fat_buffer 2048 <1> ;jc short loc_mkdir_save_fat_buffer_stc_retn 2049 <1> ; 07/08/2022 2050 0000AC64 7305 <1> jnc short loc_mkdir_save_fat_buffer_4 2051 0000AC66 E92EFFFFFF <1> jmp loc_mkdir_save_fat_buffer_stc_retn 2052 <1> 2053 <1> loc_mkdir_save_fat_buffer_4: 2054 0000AC6B 803D[927E0100]01 <1> cmp byte [FAT_ClusterCounter], 1 2055 0000AC72 721B <1> jb short loc_mkdir_save_fat_buffer_5 2056 <1> 2057 <1> ; ESI = Logical DOS Drive Description Table address 2058 0000AC74 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 2059 0000AC79 66BB01FF <1> mov bx, 0FF01h ; add free clusters 2060 0000AC7D E8EF180000 <1> call calculate_fat_freespace 2061 <1> 2062 <1> ;inc eax ; 0FFFFFFFFh -> 0 ; recalculation is needed! 2063 <1> ;jnz short loc_mkdir_save_fat_buffer_5 2064 <1> 2065 <1> ; ecx > 0 -> Recalculation is needed 2066 0000AC82 09C9 <1> or ecx, ecx 2067 0000AC84 7409 <1> jz short loc_mkdir_save_fat_buffer_5 2068 <1> 2069 0000AC86 66BB00FF <1> mov bx, 0FF00h ; recalculate free space 2070 0000AC8A E8E2180000 <1> call calculate_fat_freespace 2071 <1> 2072 <1> loc_mkdir_save_fat_buffer_5: 2073 0000AC8F C605[F7800100]00 <1> mov byte [mkdir_add_new_cluster], 0 2074 <1> 2075 <1> loc_mkdir_upd_parent_dir_lmdt: 2076 0000AC96 E87F010000 <1> call update_parent_dir_lmdt 2077 <1> 2078 <1> ; 01/03/2016 2079 0000AC9B 803D[F7800100]00 <1> cmp byte [mkdir_add_new_cluster], 0 2080 <1> ;ja loc_mkdir_gffc_2 2081 <1> ; 29/07/2022 2082 0000ACA2 7605 <1> jna short loc_mkdir_retn_new_dir_cluster 2083 0000ACA4 E945FEFFFF <1> jmp loc_mkdir_gffc_2 2084 <1> 2085 <1> loc_mkdir_retn_new_dir_cluster: 2086 0000ACA9 A1[E8800100] <1> mov eax, [mkdir_FFCluster] 2087 0000ACAE 31D2 <1> xor edx, edx 2088 <1> loc_mkdir_retn: 2089 0000ACB0 C3 <1> retn 2090 <1> 2091 <1> clear_directory_buffer: 2092 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 2093 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2094 <1> ; 2095 <1> ; eax = 0 2096 <1> ; ecx = directory buffer sector count (<= 128) 2097 <1> ; 2098 0000ACB1 BF00000800 <1> mov edi, Directory_Buffer 2099 <1> ;mov al, 128 ; double word 2100 <1> ;mul ecx ; ecx = directory buffer sector count 2101 <1> ;mov ecx, eax 2102 <1> ;shl cx, 7 ; 128 * sector count 2103 <1> ; 19/12/2025 2104 <1> ;mov ax, [esi+LD_BPB+BytesPerSec] ; 512 2105 <1> ;shr eax, 2 ; 'byte count / 4' for 'stosd' 2106 <1> ;mov ax, 128 ; 512/4 2107 <1> ;mul ecx ; max = 128*(512/4) -> 16384 (stosd) 2108 <1> ;mov ecx, eax 2109 0000ACB6 C1E107 <1> shl ecx, 7 ; (512/4) * sector count 2110 0000ACB9 29C0 <1> sub eax, eax 2111 0000ACBB F3AB <1> rep stosd ; clear directory buffer 2112 0000ACBD C3 <1> retn 2113 <1> 2114 <1> make_directory_entry: 2115 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2116 <1> ; 02/03/2016 2117 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 2118 <1> ; 09/08/2010 (DIR.ASM, 'proc_make_directory_entry') 2119 <1> ; 17/07/2010 2120 <1> ; INPUT -> 2121 <1> ; EDI = Directory Entry Address 2122 <1> ; ESI = Dot File Name Location 2123 <1> ; EAX = First Cluster 2124 <1> ; File Size = 0 (Must be set later) 2125 <1> ; CL = Attributes 2126 <1> ; CH = 0 (File size = 0) 2127 <1> ; (If CH>0, File size is in dword [EBX]) (*) 2128 <1> ; OUTPUT -> 2129 <1> ; EDI = Directory Entry Address 2130 <1> ; ESI = Dot File Name Location (Capitalized) 2131 <1> ; If CH input = 0, File Size = 0 2132 <1> ; Otherwise file size is as dword [EBX] (*) 2133 <1> ; DX = Date, AX = Time in DOS Dir Entry format 2134 <1> ; EBX = same 2135 <1> ; ECX = same 2136 <1> 2137 0000ACBE 51 <1> push ecx 2138 <1> 2139 0000ACBF 884F0B <1> mov [edi+11], cl ; Attributes 2140 0000ACC2 6689471A <1> mov [edi+26], ax ; FClusterLw, 26 2141 0000ACC6 C1E810 <1> shr eax, 16 2142 0000ACC9 66894714 <1> mov [edi+20], ax ; FClusterHw, 20 2143 <1> ;xor ax, ax 2144 <1> ; 29/07/2022 2145 0000ACCD 31C0 <1> xor eax, eax 2146 0000ACCF 6689470C <1> mov [edi+12], ax ; NTReserved, 12 2147 <1> ; CrtTimeTenth, 13 2148 0000ACD3 08ED <1> or ch, ch 2149 0000ACD5 7402 <1> jz short loc_make_direntry_set_filesize 2150 <1> 2151 0000ACD7 8B03 <1> mov eax, [ebx] 2152 <1> 2153 <1> loc_make_direntry_set_filesize: 2154 0000ACD9 89471C <1> mov [edi+28], eax ; FileSize, 28 2155 <1> 2156 0000ACDC E8D3FBFFFF <1> call convert_file_name 2157 <1> ; EDI = Dir Entry Format File Name Location 2158 <1> ; ESI = Dot File Name Location (capitalized) 2159 <1> 2160 0000ACE1 E816000000 <1> call convert_current_date_time 2161 <1> ; OUTPUT -> DX = Date in dos dir entry format 2162 <1> ; AX = Time in dos dir entry format 2163 0000ACE6 6689470E <1> mov [edi+14], ax ; CrtTime, 14 2164 0000ACEA 66895710 <1> mov [edi+16], dx ; CrtDate, 16 2165 0000ACEE 66895712 <1> mov [edi+18], dx ; LastAccDate, 18 2166 0000ACF2 66894716 <1> mov [edi+22], ax ; WrtTime, 14 2167 0000ACF6 66895718 <1> mov [edi+24], dx ; WrtDate, 16 2168 0000ACFA 59 <1> pop ecx 2169 <1> 2170 0000ACFB C3 <1> retn 2171 <1> 2172 <1> convert_current_date_time: 2173 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2174 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 2175 <1> ; 13/06/2010 (DIR.ASM, 'proc_convert_current_date_time') 2176 <1> ; converts date&time to dos dir entry format 2177 <1> ; INPUT -> none 2178 <1> ; OUTPUT -> DX = Date in dos dir entry format 2179 <1> ; AX = Time in dos dir entry format 2180 <1> 2181 0000ACFC B404 <1> mov ah, 04h ; Return Current Date 2182 0000ACFE E8E6B5FFFF <1> call int1Ah 2183 <1> 2184 0000AD03 88E8 <1> mov al, ch ; <- century BCD 2185 0000AD05 240F <1> and al, 0Fh 2186 0000AD07 88EC <1> mov ah, ch 2187 0000AD09 C0EC04 <1> shr ah, 4 2188 0000AD0C D50A <1> aad 2189 0000AD0E 88C5 <1> mov ch, al ; -> century 2190 <1> 2191 0000AD10 88C8 <1> mov al, cl ; <- year BCD 2192 0000AD12 240F <1> and al, 0Fh 2193 0000AD14 88CC <1> mov ah, cl 2194 0000AD16 C0EC04 <1> shr ah, 4 2195 0000AD19 D50A <1> aad 2196 0000AD1B 88C1 <1> mov cl, al ; -> year 2197 <1> 2198 <1> ;mov al, ch 2199 <1> ;mov ah, 100 2200 <1> ;mul ah 2201 <1> ; 29/07/2022 2202 0000AD1D B064 <1> mov al, 100 2203 0000AD1F F6E5 <1> mul ch 2204 <1> 2205 <1> ;xor ch, ch 2206 <1> ;add ax, cx 2207 <1> ; 29/07/2022 2208 0000AD21 00C8 <1> add al, cl 2209 0000AD23 80D400 <1> adc ah, 0 2210 0000AD26 662DBC07 <1> sub ax, 1980 ; ms-dos epoch 2211 <1> ;mov cx, ax 2212 <1> ; 29/07/2022 2213 0000AD2A 88C1 <1> mov cl, al 2214 <1> ;mov ecx, eax 2215 <1> 2216 0000AD2C 88F0 <1> mov al, dh ; <- month in bcd 2217 0000AD2E 240F <1> and al, 0Fh 2218 0000AD30 88F4 <1> mov ah, dh 2219 0000AD32 C0EC04 <1> shr ah, 4 2220 0000AD35 D50A <1> aad 2221 0000AD37 88C6 <1> mov dh, al ; -> month 2222 <1> 2223 0000AD39 88D0 <1> mov al, dl ; <- day BCD 2224 0000AD3B 240F <1> and al, 0Fh 2225 0000AD3D 88D4 <1> mov ah, dl 2226 0000AD3F C0EC04 <1> shr ah, 4 2227 0000AD42 D50A <1> aad 2228 0000AD44 88C2 <1> mov dl, al ; -> day 2229 <1> 2230 0000AD46 88C8 <1> mov al, cl ; count of years from 1980 2231 <1> ;shl ax, 4 2232 <1> ; 29/07/2022 2233 <1> ;mov eax, ecx 2234 0000AD48 C1E004 <1> shl eax, 4 2235 <1> 2236 0000AD4B 08F0 <1> or al, dh ; month of year, 1 to 12 2237 <1> ;shl ax, 5 2238 <1> ; 29/07/2022 2239 0000AD4D C1E005 <1> shl eax, 5 2240 0000AD50 08D0 <1> or al, dl ; day of year, 1 to 31 2241 <1> 2242 <1> ;push ax ; push date 2243 <1> ; 29/07/2022 2244 0000AD52 50 <1> push eax 2245 <1> 2246 0000AD53 B402 <1> mov ah, 02h ; Return Current Time 2247 0000AD55 E88FB5FFFF <1> call int1Ah 2248 <1> 2249 0000AD5A 88E8 <1> mov al, ch ; <- hours BCD 2250 0000AD5C 240F <1> and al, 0Fh 2251 0000AD5E 88EC <1> mov ah, ch 2252 0000AD60 C0EC04 <1> shr ah, 4 2253 0000AD63 D50A <1> aad 2254 0000AD65 88C5 <1> mov ch, al ; -> hours 2255 <1> 2256 0000AD67 88C8 <1> mov al, cl ; <- minutes BCD 2257 0000AD69 240F <1> and al, 0Fh 2258 0000AD6B 88CC <1> mov ah, cl 2259 0000AD6D C0EC04 <1> shr ah, 4 2260 0000AD70 D50A <1> aad 2261 0000AD72 88C1 <1> mov cl, al ; -> minutes 2262 <1> 2263 0000AD74 88F0 <1> mov al, dh ; <- seconds BCD 2264 0000AD76 240F <1> and al, 0Fh 2265 0000AD78 88F4 <1> mov ah, dh 2266 0000AD7A C0EC04 <1> shr ah, 4 2267 0000AD7D D50A <1> aad 2268 0000AD7F 88C6 <1> mov dh, al ; -> seconds 2269 <1> 2270 0000AD81 88E8 <1> mov al, ch ; hours 2271 <1> ;shl ax, 6 2272 <1> ; 29/07/2022 2273 0000AD83 C1E006 <1> shl eax, 6 2274 0000AD86 08C8 <1> or al, cl ; minutes 2275 <1> ;shl ax, 5 2276 <1> ; 29/07/2022 2277 0000AD88 C1E005 <1> shl eax, 5 2278 0000AD8B D0EE <1> shr dh, 1 ; 2 seconds 2279 <1> ; There is a bug in TRDOS v1 here ! 2280 <1> ; it was 'or al, dl' ! 2281 0000AD8D 08F0 <1> or al, dh ; seconds 2282 <1> 2283 <1> ;pop dx ; pop date 2284 <1> ; 29/07/2022 2285 0000AD8F 5A <1> pop edx 2286 <1> 2287 0000AD90 C3 <1> retn 2288 <1> 2289 <1> save_directory_buffer: 2290 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 2291 <1> ; 30/07/2022 2292 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2293 <1> ; 15/10/2016 2294 <1> ; 23/03/2016 2295 <1> ; 26/02/2016 2296 <1> ; 22/02/2016 (TRDOS 386 = TRDOS v2.0) 2297 <1> ; 01/08/2011 2298 <1> ; 14/03/2010 2299 <1> ; INPUT -> 2300 <1> ; none 2301 <1> ; OUTPUT -> 2302 <1> ; cf = 0 -> write OK... 2303 <1> ; cf = 1 -> error code in AL (EAX) 2304 <1> ; cf = 1 & AL = 0Dh => CH & CL = FS & FAT type 2305 <1> ; EBX = Directory Buffer Address 2306 <1> ; 2307 <1> ; (EAX, ECX, EDX will be modified) 2308 <1> 2309 0000AD91 BB00000800 <1> mov ebx, Directory_Buffer 2310 0000AD96 803D[9D7E0100]02 <1> cmp byte [DirBuff_ValidData], 2 2311 0000AD9D 7403 <1> je short loc_save_dir_buffer 2312 0000AD9F 31C0 <1> xor eax, eax 2313 0000ADA1 C3 <1> retn 2314 <1> 2315 <1> loc_save_dir_buffer: 2316 0000ADA2 56 <1> push esi 2317 0000ADA3 31DB <1> xor ebx, ebx 2318 0000ADA5 8A3D[9B7E0100] <1> mov bh, [DirBuff_DRV] 2319 0000ADAB 80EF41 <1> sub bh, 'A' 2320 0000ADAE BE00010900 <1> mov esi, Logical_DOSDisks 2321 0000ADB3 01DE <1> add esi, ebx 2322 <1> 2323 <1> ; 19/12/2025 2324 <1> %if 0 2325 <1> mov cx, [esi+LD_FATType] 2326 <1> ; CH = FS Type (A1h for FS) 2327 <1> ; CL = FAT Type (0 for FS) 2328 <1> or cl, cl 2329 <1> jz short loc_save_dir_buff_stc_retn 2330 <1> %endif 2331 <1> 2332 <1> loc_save_dir_buffer_check_cluster_no: 2333 0000ADB5 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 2334 0000ADBA 28FF <1> sub bh, bh ; ebx = 0 2335 0000ADBC 09C0 <1> or eax, eax 2336 0000ADBE 7537 <1> jnz short loc_save_sub_dir_buffer 2337 0000ADC0 8A25[9C7E0100] <1> mov ah, [DirBuff_FATType] 2338 <1> 2339 <1> ; 19/12/2025 2340 <1> %if 0 2341 <1> inc bl ; bl = 1 2342 <1> cmp ah, bl 2343 <1> jb short loc_save_dir_buff_inv_data_retn 2344 <1> inc bl ; bl = 2 2345 <1> cmp bl, ah 2346 <1> jb short loc_save_dir_buff_inv_data_retn 2347 <1> %else 2348 <1> ; 19/12/2025 2349 0000ADC6 80FC03 <1> cmp ah, 3 ; FAT32 ? 2350 0000ADC9 7314 <1> jnb short loc_save_dir_buff_stc_retn ; yes 2351 <1> %endif 2352 <1> 2353 <1> loc_save_root_dir_buffer: 2354 0000ADCB 668B5E17 <1> mov bx, [esi+LD_BPB+RootDirEnts] 2355 0000ADCF 6683C30F <1> add bx, 15 2356 <1> ;shr bx, 4 ; 16 dir entries per sector 2357 <1> ; 29/07/2022 2358 0000ADD3 C1EB04 <1> shr ebx, 4 2359 <1> ;or bx, bx 2360 0000ADD6 09DB <1> or ebx, ebx 2361 0000ADD8 7405 <1> jz short loc_save_dir_buff_stc_retn 2362 <1> ;mov ecx, ebx 2363 0000ADDA 8B4664 <1> mov eax, [esi+LD_ROOTBegin] ; 26/02/2016 2364 0000ADDD EB22 <1> jmp short loc_write_directory_to_disk 2365 <1> 2366 <1> loc_save_dir_buff_stc_retn: 2367 0000ADDF F9 <1> stc 2368 <1> loc_save_dir_buff_inv_data_retn: 2369 <1> ; 15/10/2016 (0Dh -> 29) 2370 0000ADE0 B01D <1> mov al, 29 ; Invalid data ! 2371 0000ADE2 C605[9D7E0100]00 <1> mov byte [DirBuff_ValidData], 0 2372 0000ADE9 EB05 <1> jmp short loc_save_dir_buff_retn 2373 <1> 2374 <1> loc_write_directory_to_disk_err: 2375 <1> ; 15/10/2016 (disk write error code, 1Dh -> 18) 2376 0000ADEB B812000000 <1> mov eax, 18 ; Drive not ready or write error 2377 <1> 2378 <1> loc_save_dir_buff_retn: 2379 0000ADF0 BB00000800 <1> mov ebx, Directory_Buffer 2380 0000ADF5 5E <1> pop esi 2381 0000ADF6 C3 <1> retn 2382 <1> 2383 <1> loc_save_sub_dir_buffer: 2384 <1> ; ebx = 0 2385 <1> ;sub eax, 2 2386 <1> ; 30/07/2022 2387 0000ADF7 48 <1> dec eax 2388 0000ADF8 48 <1> dec eax 2389 0000ADF9 8A5E13 <1> mov bl, [esi+LD_BPB+SecPerClust] 2390 0000ADFC F7E3 <1> mul ebx 2391 0000ADFE 034668 <1> add eax, [esi+LD_DATABegin] 2392 <1> ;mov ecx, ebx 2393 <1> 2394 <1> loc_write_directory_to_disk: 2395 0000AE01 89D9 <1> mov ecx, ebx 2396 0000AE03 BB00000800 <1> mov ebx, Directory_Buffer 2397 0000AE08 E8D76B0000 <1> call disk_write 2398 0000AE0D 72DC <1> jc short loc_write_directory_to_disk_err 2399 <1> 2400 <1> loc_save_dir_buff_validate_retn: 2401 0000AE0F C605[9D7E0100]01 <1> mov byte [DirBuff_ValidData], 1 2402 0000AE16 31C0 <1> xor eax, eax 2403 <1> ; 26/02/2016 2404 0000AE18 EBD6 <1> jmp short loc_save_dir_buff_retn 2405 <1> 2406 <1> update_parent_dir_lmdt: 2407 <1> ; 19/12/2025 2408 <1> ; 16/07/2025 (TRDOS 386 Kernel v2.0.10) (BugFix) 2409 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2410 <1> ; 29/12/2017 2411 <1> ; 22/02/2016 (TRDOS 386 = TRDOS v2.0) 2412 <1> ; 01/08/2011 2413 <1> ; 16/10/2010 2414 <1> ; 2415 <1> ; INPUT -> 2416 <1> ; none 2417 <1> ; OUTPUT -> 2418 <1> ; (last modification date & time of the parent dir 2419 <1> ; will be changed/updated) 2420 <1> ; 2421 <1> ; (EAX, EBX, ECX, EDX, EDI will be changed) 2422 <1> 2423 0000AE1A 29C0 <1> sub eax, eax 2424 0000AE1C 8A25[74770100] <1> mov ah, [Current_Dir_Level] 2425 <1> 2426 <1> ; 19/12/2025 2427 <1> %if 0 2428 <1> mov al, [Current_FATType] 2429 <1> cmp al, 1 2430 <1> jb short loc_UPDLMDT_proc_retn 2431 <1> %endif 2432 <1> 2433 <1> loc_update_parent_dir_lm_date_time: 2434 0000AE22 08E4 <1> or ah, ah 2435 0000AE24 7433 <1> jz short loc_UPDLMDT_proc_retn 2436 <1> 2437 0000AE26 56 <1> push esi ; * 2438 0000AE27 8825[DF800100] <1> mov [UPDLMDT_CDirLevel], ah 2439 0000AE2D 8B15[70770100] <1> mov edx, [Current_Dir_FCluster] 2440 0000AE33 8915[E0800100] <1> mov [UPDLMDT_CDirFCluster], edx 2441 <1> 2442 0000AE39 FECC <1> dec ah 2443 <1> ;mov ecx, 12 2444 <1> ; 29/07/2022 2445 0000AE3B 29C9 <1> sub ecx, ecx 2446 0000AE3D B10C <1> mov cl, 12 2447 <1> ; 2448 0000AE3F BE[D47E0100] <1> mov esi, PATH_Array 2449 <1> 2450 0000AE44 8825[74770100] <1> mov [Current_Dir_Level], ah 2451 0000AE4A 08E4 <1> or ah, ah 2452 0000AE4C 750C <1> jnz short loc_update_parent_dir_lmdt_load_sub_dir_1 2453 0000AE4E 803D[75770100]02 <1> cmp byte [Current_FATType], 2 2454 0000AE55 7709 <1> ja short loc_update_parent_dir_lmdt_load_sub_dir_2 2455 <1> ; 19/12/2025 2456 <1> ;sub al, al 2457 <1> ; eax = 0 2458 0000AE57 EB0A <1> jmp short loc_update_parent_dir_lmdt_load_sub_dir_3 2459 <1> 2460 <1> loc_UPDLMDT_proc_retn: 2461 0000AE59 C3 <1> retn 2462 <1> 2463 <1> loc_update_parent_dir_lmdt_load_sub_dir_1: 2464 0000AE5A B010 <1> mov al, 16 2465 0000AE5C F6E4 <1> mul ah 2466 0000AE5E 01C6 <1> add esi, eax 2467 <1> 2468 <1> loc_update_parent_dir_lmdt_load_sub_dir_2: 2469 0000AE60 8B460C <1> mov eax, [esi+12] ; Parent Dir First Cluster 2470 <1> 2471 <1> loc_update_parent_dir_lmdt_load_sub_dir_3: 2472 0000AE63 A3[70770100] <1> mov [Current_Dir_FCluster], eax 2473 <1> 2474 0000AE68 83C610 <1> add esi, 16 2475 <1> ;mov di, Dir_File_Name 2476 <1> ; 16/07/2025 (BugFix) 2477 0000AE6B BF[FA7F0100] <1> mov edi, Dir_File_Name 2478 0000AE70 F3A4 <1> rep movsb 2479 <1> 2480 0000AE72 BE00010900 <1> mov esi, Logical_DOSDisks 2481 0000AE77 29DB <1> sub ebx, ebx 2482 0000AE79 8A3D[76770100] <1> mov bh, [Current_Drv] 2483 0000AE7F 01DE <1> add esi, ebx 2484 0000AE81 E83BF8FFFF <1> call reload_current_directory 2485 0000AE86 722F <1> jc short loc_update_parent_dir_lmdt_restore_cdirlevel 2486 <1> 2487 <1> loc_update_parent_dir_lmdt_locate_dir: 2488 0000AE88 BE[FA7F0100] <1> mov esi, Dir_File_Name 2489 <1> ;xor cx, cx 2490 <1> ; 29/07/2022 2491 0000AE8D 31C9 <1> xor ecx, ecx 2492 0000AE8F 66B81008 <1> mov ax, 0810h ; Only directories 2493 0000AE93 E870F7FFFF <1> call locate_current_dir_file 2494 <1> ; EDI = DirBuff Directory Entry Address 2495 0000AE98 721D <1> jc short loc_update_parent_dir_lmdt_restore_cdirlevel 2496 <1> 2497 0000AE9A E85DFEFFFF <1> call convert_current_date_time 2498 0000AE9F 66895712 <1> mov [edi+18], dx ; Last Access Date 2499 0000AEA3 66895718 <1> mov [edi+24], dx ; Last Write Date 2500 0000AEA7 66894716 <1> mov [edi+22], ax ; Last Write Time 2501 <1> 2502 0000AEAB C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 2503 0000AEB2 E8DAFEFFFF <1> call save_directory_buffer 2504 <1> ; 29/12/2017 2505 <1> ;jc short loc_update_parent_dir_lmdt_restore_cdirlevel 2506 <1> ;xor al, al 2507 <1> loc_update_parent_dir_lmdt_restore_cdirlevel: 2508 <1> ;current directory level restoration 2509 0000AEB7 8A25[DF800100] <1> mov ah, [UPDLMDT_CDirLevel] 2510 0000AEBD 8825[74770100] <1> mov [Current_Dir_Level], ah 2511 0000AEC3 8B15[E0800100] <1> mov edx, [UPDLMDT_CDirFCluster] 2512 0000AEC9 8915[70770100] <1> mov [Current_Dir_FCluster], edx 2513 <1> 2514 0000AECF 5E <1> pop esi ; * 2515 0000AED0 C3 <1> retn 2516 <1> 2517 <1> delete_longname: 2518 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2519 <1> ; 27/02/2016 (TRDOS 386 = TRDOS v2.0) 2520 <1> ; 01/08/2011 (DIR.ASM, 'proc_delete_longname') 2521 <1> ; 14/03/2010 2522 <1> ; INPUT -> 2523 <1> ; EAX = Directory Entry (Index) Number (< 65536) 2524 <1> ; OUTPUT -> 2525 <1> ; cf = 0 -> OK (EAX = 0) 2526 <1> ; cf = 1 -> error code in EAX (AL) 2527 <1> ; 2528 <1> ; (Modified registers: EAX, EDX, ECX, EBX, EDI) 2529 <1> 2530 0000AED1 66A3[48810100] <1> mov [DLN_EntryNumber], ax 2531 0000AED7 C605[4A810100]40 <1> mov byte [DLN_40h], 40h 2532 <1> 2533 0000AEDE E857000000 <1> call locate_current_dir_entry 2534 0000AEE3 7307 <1> jnc short loc_dln_check_attributes 2535 0000AEE5 C3 <1> retn 2536 <1> 2537 <1> loc_dln_longname_not_found: 2538 <1> ;mov eax, 2 2539 <1> ; 29/07/2022 2540 0000AEE6 29C0 <1> sub eax, eax 2541 0000AEE8 B002 <1> mov al, 2 2542 0000AEEA F9 <1> stc 2543 0000AEEB C3 <1> retn 2544 <1> 2545 <1> loc_dln_check_attributes: 2546 0000AEEC B00F <1> mov al, 0Fh ; long name 2547 0000AEEE 8A670B <1> mov ah, [edi+0Bh] ; dir entry attributes 2548 0000AEF1 38C4 <1> cmp ah, al 2549 0000AEF3 75F1 <1> jne short loc_dln_longname_not_found 2550 0000AEF5 8A27 <1> mov ah, [edi] 2551 0000AEF7 2A25[4A810100] <1> sub ah, [DLN_40h] 2552 0000AEFD 76E7 <1> jna short loc_dln_longname_not_found 2553 0000AEFF 80FC14 <1> cmp ah, 14h ; 84-64=20 -> 20*13=260 bytes 2554 0000AF02 77E2 <1> ja short loc_dln_longname_not_found 2555 <1> 2556 0000AF04 C607E5 <1> mov byte [edi], 0E5h ; deleted sign 2557 0000AF07 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 ; changed/write sign 2558 0000AF0E C605[4A810100]00 <1> mov byte [DLN_40h], 0 ; 40h -> 0 2559 <1> 2560 <1> loc_dln_delete_next_ln_entry: 2561 0000AF15 80FC01 <1> cmp ah, 1 2562 0000AF18 7616 <1> jna short loc_dln_longname_retn 2563 <1> loc_dln_delete_next_ln_entry_0: 2564 0000AF1A 66FF05[48810100] <1> inc word [DLN_EntryNumber] 2565 0000AF21 0FB705[48810100] <1> movzx eax, word [DLN_EntryNumber] 2566 0000AF28 E80D000000 <1> call locate_current_dir_entry 2567 0000AF2D 73BD <1> jnc short loc_dln_check_attributes 2568 <1> 2569 <1> loc_dln_longname_stc_retn: 2570 0000AF2F C3 <1> retn 2571 <1> 2572 <1> loc_dln_longname_retn: 2573 <1> ;cmp byte [DirBuff_ValidData], 2 2574 <1> ;jne short loc_dln_longname_retn_xor_eax 2575 0000AF30 E85CFEFFFF <1> call save_directory_buffer 2576 0000AF35 72F8 <1> jc short loc_dln_longname_stc_retn 2577 <1> 2578 <1> loc_dln_longname_retn_xor_eax: 2579 0000AF37 31C0 <1> xor eax, eax 2580 0000AF39 C3 <1> retn 2581 <1> 2582 <1> locate_current_dir_entry: 2583 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 2584 <1> ; 30/07/2022 2585 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2586 <1> ; 16/10/2016 2587 <1> ; 15/10/2016 2588 <1> ; 23/03/2016 2589 <1> ; 27/02/2016 (TRDOS 386 = TRDOS v2.0) 2590 <1> ; 01/08/2011 (DIR.ASM, 'proc_locate_current_dir_entry') 2591 <1> ; 07/03/2010 2592 <1> ; INPUT -> 2593 <1> ; EAX = Directory Entry (Index) Number (< 65536) 2594 <1> ; OUTPUT -> 2595 <1> ; EDI = Directory Entry Address 2596 <1> ; EAX = Cluster Number of Directory Buffer 2597 <1> ; EBX = Directory Buffer Entry Offset 2598 <1> ; ECX = DirBuff Valid Data identifier (CL) 2599 <1> ; If CF = 0 and CL = 2 then 2600 <1> ; directory buffer modified and 2601 <1> ; must be written to disk. 2602 <1> ; If CF = 0 and CL = 1 then 2603 <1> ; dir buffer has been written to disk, already. 2604 <1> ; CF = 1 -> Error code in EAX (AL) 2605 <1> ; 2606 <1> ; (Modified registers: EAX, EDX, ECX, EBX, EDI) 2607 <1> 2608 <1> loc_locate_current_dir_entry: 2609 0000AF3A 56 <1> push esi 2610 0000AF3B 89C1 <1> mov ecx, eax 2611 <1> ;mov edx, 32 2612 <1> ; 29/07/2022 2613 0000AF3D 29D2 <1> sub edx, edx 2614 0000AF3F B220 <1> mov dl, 32 2615 0000AF41 F7E2 <1> mul edx 2616 0000AF43 A3[54810100] <1> mov [LCDE_ByteOffset], eax 2617 0000AF48 31DB <1> xor ebx, ebx 2618 0000AF4A 8A3D[76770100] <1> mov bh, [Current_Drv] 2619 0000AF50 A0[9B7E0100] <1> mov al, [DirBuff_DRV] 2620 0000AF55 2C41 <1> sub al, 'A' 2621 0000AF57 BE00010900 <1> mov esi, Logical_DOSDisks 2622 0000AF5C 01DE <1> add esi, ebx 2623 0000AF5E 38C7 <1> cmp bh, al 2624 <1> ;jne loc_lcde_reload_current_directory 2625 <1> ; 29/07/2022 2626 0000AF60 7405 <1> je short loc_lcde_cdl_check 2627 0000AF62 E986000000 <1> jmp loc_lcde_reload_current_directory 2628 <1> loc_lcde_cdl_check: 2629 <1> ; 29/07/2022 2630 0000AF67 31C0 <1> xor eax, eax 2631 0000AF69 803D[74770100]00 <1> cmp byte [Current_Dir_Level], 0 2632 0000AF70 7728 <1> ja short loc_lcde_calc_dirbuff_cluster_offset 2633 <1> ; 27/02/2016 2634 <1> ; TRDOS v1 has bug here for FAT32 fs ! 2635 <1> ; (Root Directory Entries for FAT32 = 0) 2636 0000AF72 807E0303 <1> cmp byte [esi+LD_FATType], 3 ; FAT32 2637 0000AF76 7322 <1> jnb short loc_lcde_calc_dirbuff_cluster_offset 2638 <1> 2639 <1> loc_lcde_cdl_check_FAT12_16: 2640 <1> ; 29/07/2022 2641 <1> ;xor eax, eax 2642 0000AF78 668B4617 <1> mov ax, [esi+LD_BPB+RootDirEnts] 2643 <1> ;dec ax 2644 0000AF7C 48 <1> dec eax 2645 <1> ;xor dx, dx 2646 <1> ;cmp ax, cx ; cx = Directory Entry (Index) Number 2647 <1> ; 29/07/2022 2648 0000AF7D 39C8 <1> cmp eax, ecx 2649 0000AF7F 720E <1> jb short loc_lcde_stc_12h_retn 2650 0000AF81 66890D[4C810100] <1> mov [LCDE_EntryIndex], cx 2651 0000AF88 31C0 <1> xor eax, eax 2652 0000AF8A E985000000 <1> jmp loc_lcde_check_dir_buffer_cluster 2653 <1> 2654 <1> loc_lcde_stc_12h_retn: 2655 0000AF8F 5E <1> pop esi 2656 0000AF90 89CB <1> mov ebx, ecx 2657 0000AF92 89D1 <1> mov ecx, edx 2658 <1> ; 16/10/2016 (12h -> 12) 2659 0000AF94 B80C000000 <1> mov eax, 12 ; No more files 2660 0000AF99 C3 <1> retn 2661 <1> 2662 <1> loc_lcde_calc_dirbuff_cluster_offset: 2663 <1> ;mov bl, [esi+LD_BPB+SecPerClust] 2664 <1> ;xor bh, bh 2665 <1> ;mov ax, [esi+LD_BPB+BytesPerSec] 2666 <1> ;mul bx 2667 <1> ;;or dx, dx ; If bytes per cluster > 32KB it is invalid 2668 <1> ;; 29/07/2022 2669 <1> ;or dl, dl 2670 <1> ;jnz short loc_lcde_invalid_format 2671 <1> ; 29/07/2022 2672 0000AF9A 31DB <1> xor ebx, ebx 2673 0000AF9C 8A5E13 <1> mov bl, [esi+LD_BPB+SecPerClust] 2674 <1> ;mov ax, [esi+LD_BPB+BytesPerSec] 2675 <1> ; 19/12/2025 2676 0000AF9F 66B80002 <1> mov ax, 512 2677 0000AFA3 F7E3 <1> mul ebx 2678 0000AFA5 89C1 <1> mov ecx, eax 2679 <1> ;mov cx, ax ; BYTES PER CLUSTER 2680 0000AFA7 A1[54810100] <1> mov eax, [LCDE_ByteOffset] 2681 <1> ;sub edx, edx 2682 0000AFAC F7F1 <1> div ecx 2683 0000AFAE 3DFFFF0000 <1> cmp eax, 65535 2684 0000AFB3 7746 <1> ja short loc_lcde_invalid_format 2685 <1> 2686 <1> ; cluster sequence number of directory (< 65536) 2687 0000AFB5 66A3[4E810100] <1> mov [LCDE_ClusterSN], ax 2688 <1> 2689 <1> ;mov ax, dx ; byte offset in cluster (directory buffer) 2690 <1> ; 29/07/2022 2691 0000AFBB 89D0 <1> mov eax, edx 2692 <1> ;mov bx, 32 ; 1 dir entry = 32 bytes 2693 0000AFBD B320 <1> mov bl, 32 2694 <1> ;sub dx, dx ; 0 2695 <1> ;div bx 2696 0000AFBF 29D2 <1> sub edx, edx 2697 0000AFC1 F7F3 <1> div ebx 2698 0000AFC3 66A3[4C810100] <1> mov [LCDE_EntryIndex], ax ; dir entry index/sequence number 2699 <1> ; (in directory buffer/cluster) 2700 <1> loc_lcde_get_current_sub_dir_fcluster: 2701 0000AFC9 A1[70770100] <1> mov eax, [Current_Dir_FCluster] 2702 <1> 2703 <1> loc_lcde_get_next_cluster: 2704 0000AFCE 66833D[4E810100]00 <1> cmp word [LCDE_ClusterSN], 0 2705 0000AFD6 763C <1> jna short loc_lcde_check_dir_buffer_cluster 2706 0000AFD8 A3[50810100] <1> mov [LCDE_Cluster], eax 2707 0000AFDD E8A70F0000 <1> call get_next_cluster 2708 0000AFE2 721E <1> jc short loc_lcde_check_gnc_error 2709 0000AFE4 66FF0D[4E810100] <1> dec word [LCDE_ClusterSN] 2710 0000AFEB EBE1 <1> jmp short loc_lcde_get_next_cluster 2711 <1> 2712 <1> loc_lcde_reload_current_directory: 2713 0000AFED 51 <1> push ecx 2714 0000AFEE E8CEF6FFFF <1> call reload_current_directory 2715 0000AFF3 59 <1> pop ecx 2716 <1> ;jnc loc_lcde_cdl_check 2717 <1> ;pop esi 2718 <1> ;retn 2719 <1> ; 09/08/2022 2720 0000AFF4 727E <1> jc short loc_lcde_retn 2721 0000AFF6 E96CFFFFFF <1> jmp loc_lcde_cdl_check 2722 <1> 2723 <1> loc_lcde_invalid_format: 2724 <1> ; 15/10/2016 (0Bh -> 28) 2725 <1> ;mov eax, 28 ; Invalid Format ! 2726 <1> ; 29/07/2022 2727 0000AFFB 29C0 <1> sub eax, eax 2728 0000AFFD B01C <1> mov al, 28 2729 <1> loc_lcde_drive_not_ready_read_err: 2730 0000AFFF F9 <1> stc 2731 0000B000 5E <1> pop esi 2732 0000B001 C3 <1> retn 2733 <1> 2734 <1> loc_lcde_check_gnc_error: 2735 0000B002 09C0 <1> or eax, eax 2736 0000B004 75F9 <1> jnz short loc_lcde_drive_not_ready_read_err 2737 0000B006 66FF0D[4E810100] <1> dec word [LCDE_ClusterSN] 2738 0000B00D 75EC <1> jnz short loc_lcde_invalid_format 2739 0000B00F A1[50810100] <1> mov eax, [LCDE_Cluster] 2740 <1> 2741 <1> loc_lcde_check_dir_buffer_cluster: 2742 0000B014 3B05[A27E0100] <1> cmp eax, [DirBuff_Cluster] 2743 0000B01A 755A <1> jne short loc_lcde_load_dir_cluster 2744 0000B01C 803D[9D7E0100]00 <1> cmp byte [DirBuff_ValidData], 0 2745 0000B023 7726 <1> ja short lcde_check_dir_buffer_cluster_next 2746 0000B025 803D[74770100]00 <1> cmp byte [Current_Dir_Level], 0 2747 0000B02C 775D <1> ja short loc_lcde_load_dir_cluster_0 2748 <1> ; 27/02/2016 2749 <1> ; TRDOS v1 has bug here for FAT32 fs ! 2750 0000B02E 807E0303 <1> cmp byte [esi+LD_FATType], 3 ; FAT32 2751 0000B032 7357 <1> jnb short loc_lcde_load_dir_cluster_0 2752 <1> ; 2753 0000B034 0FB74E17 <1> movzx ecx, word [esi+LD_BPB+RootDirEnts] 2754 0000B038 6683C10F <1> add cx, 15 ; round up (16 entries per sector) 2755 <1> ;shr cx, 4 ; 1 sector contains 16 dir entries 2756 <1> ; 29/07/2022 2757 0000B03C C1E904 <1> shr ecx, 4 2758 0000B03F 8B4664 <1> mov eax, [esi+LD_ROOTBegin] 2759 0000B042 EB52 <1> jmp short loc_lcde_load_dir_cluster_1 2760 <1> 2761 <1> loc_lcde_validate_dirBuff: 2762 0000B044 C605[9D7E0100]01 <1> mov byte [DirBuff_ValidData], 1 2763 <1> 2764 <1> lcde_check_dir_buffer_cluster_next: 2765 0000B04B 0FB71D[4C810100] <1> movzx ebx, word [LCDE_EntryIndex] 2766 0000B052 663B1D[A07E0100] <1> cmp bx, [DirBuff_LastEntry] 2767 0000B059 77A0 <1> ja short loc_lcde_invalid_format 2768 <1> ;mov eax, 32 2769 <1> ; 29/07/2022 2770 0000B05B 31C0 <1> xor eax, eax 2771 0000B05D B020 <1> mov al, 32 2772 0000B05F F7E3 <1> mul ebx 2773 <1> ;or edx, edx 2774 <1> ;jnz short loc_lcde_invalid_format 2775 <1> 2776 0000B061 BF00000800 <1> mov edi, Directory_Buffer 2777 0000B066 01C7 <1> add edi, eax ; add entry offset to buffer address 2778 <1> 2779 <1> loc_lcde_dir_buffer_last_check: 2780 0000B068 A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 2781 0000B06D 0FB60D[9D7E0100] <1> movzx ecx, byte [DirBuff_ValidData] 2782 <1> 2783 <1> loc_lcde_retn: 2784 0000B074 5E <1> pop esi 2785 0000B075 C3 <1> retn 2786 <1> 2787 <1> loc_lcde_load_dir_cluster: 2788 <1> ;cmp byte [DirBuff_ValidData], 2 2789 <1> ;jne short loc_lcde_load_dir_cluster_n2 2790 0000B076 50 <1> push eax 2791 0000B077 E815FDFFFF <1> call save_directory_buffer 2792 0000B07C 58 <1> pop eax 2793 0000B07D 72F5 <1> jc short loc_lcde_retn 2794 <1> 2795 <1> loc_lcde_load_dir_cluster_n2: 2796 0000B07F C605[9D7E0100]00 <1> mov byte [DirBuff_ValidData], 0 2797 0000B086 A3[A27E0100] <1> mov [DirBuff_Cluster], eax 2798 <1> 2799 <1> loc_lcde_load_dir_cluster_0: 2800 <1> ;sub eax, 2 2801 <1> ; 30/07/2022 2802 0000B08B 48 <1> dec eax 2803 0000B08C 48 <1> dec eax 2804 0000B08D 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+SecPerClust] 2805 0000B091 F7E1 <1> mul ecx 2806 0000B093 034668 <1> add eax, [esi+LD_DATABegin] 2807 <1> 2808 <1> loc_lcde_load_dir_cluster_1: 2809 0000B096 BB00000800 <1> mov ebx, Directory_Buffer 2810 <1> ; ecx = sector count 2811 0000B09B E853690000 <1> call disk_read 2812 0000B0A0 73A2 <1> jnc short loc_lcde_validate_dirBuff 2813 <1> 2814 <1> ; 15/10/2016 2815 <1> ; (Disk read error instead of drv not ready err) 2816 0000B0A2 B811000000 <1> mov eax, 17 ; Drive not ready or read error ! 2817 0000B0A7 EBCB <1> jmp short loc_lcde_retn 2818 <1> 2819 <1> remove_file: 2820 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 2821 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2822 <1> ; 15/10/2016 2823 <1> ; 28/02/2016 (TRDOS 386 = TRDOS v2.0) 2824 <1> ; 10/04/2011 (FILE.ASM, 'proc_delete_file') 2825 <1> ; 09/08/2010 2826 <1> ; INPUT -> 2827 <1> ; EDI = Directory Buffer Entry Address 2828 <1> ; CX = Directory Buffer Entry Counter/Index 2829 <1> ; BL = Longname Entry Length 2830 <1> ; BH = Logical DOS Drive Number 2831 <1> 2832 0000B0A9 29C0 <1> sub eax, eax 2833 0000B0AB 88FC <1> mov ah, bh 2834 0000B0AD BE00010900 <1> mov esi, Logical_DOSDisks 2835 0000B0B2 01C6 <1> add esi, eax 2836 <1> 2837 <1> ; 19/12/2025 2838 <1> %if 0 2839 <1> cmp byte [esi+LD_FATType], 1 2840 <1> jnb short loc_del_fat_file 2841 <1> 2842 <1> cmp byte [esi+LD_FSType], 0A1h 2843 <1> je short loc_del_fs_file 2844 <1> 2845 <1> loc_del_file_invalid_format: 2846 <1> xor ah, ah 2847 <1> ; 15/10/2016 (0Bh -> 28) 2848 <1> mov al, 28 ; Invalid Format 2849 <1> stc 2850 <1> retn 2851 <1> 2852 <1> loc_del_fs_file: 2853 <1> ;call delete_fs_file 2854 <1> ;retn 2855 <1> ; 29/07/2022 2856 <1> jmp delete_fs_file 2857 <1> %endif 2858 <1> 2859 <1> loc_del_fat_file: 2860 0000B0B4 E808000000 <1> call delete_directory_entry 2861 0000B0B9 7205 <1> jc short loc_del_file_err_retn 2862 <1> 2863 <1> loc_delfile_unlink_cluster_chain: 2864 0000B0BB E85E160000 <1> call truncate_cluster_chain 2865 <1> ;jc short loc_del_file_err_retn 2866 <1> 2867 <1> loc_delfile_return: 2868 <1> loc_del_file_err_retn: 2869 0000B0C0 C3 <1> retn 2870 <1> 2871 <1> delete_directory_entry: 2872 <1> ; 15/10/2016 2873 <1> ; 28/02/2016 (TRDOS 386 = TRDOS v2.0) 2874 <1> ; 01/08/2011 (DIR.ASM, 'proc_delete_directory_entry') 2875 <1> ; 10/04/2011 2876 <1> ; INPUT -> 2877 <1> ; ESI = Logical Dos Drive Descripton Table Address 2878 <1> ; EDI = Directory Buffer Entry Address 2879 <1> ; CX = Directory Buffer Entry Counter/Index 2880 <1> ; BL = Longname Entry Length 2881 <1> ; OUTPUT -> 2882 <1> ; ESI = Logical dos drive descripton table address 2883 <1> ; EAX = First cluster to be truncated/unlinked 2884 <1> ; CF = 1 -> Error code in EAX (AL) 2885 <1> ; CF = 0 & BH <> 0 -> LMDT write error (BH = 1) 2886 <1> ; CF = 0 & BL <> 0 -> Long name delete error (BL = FFh) 2887 <1> ; 2888 <1> ; (EDI, EBX, ECX register contents will be changed) 2889 <1> 2890 0000B0C1 881D[DE800100] <1> mov [DelFile_LNEL], bl 2891 0000B0C7 66890D[DC800100] <1> mov [DelFile_EntryCounter], cx 2892 <1> 2893 0000B0CE 668B4714 <1> mov ax, [edi+20] ; First Cluster High Word 2894 0000B0D2 C1E010 <1> shl eax, 16 2895 0000B0D5 668B471A <1> mov ax, [edi+26] ; First Cluster Low Word 2896 <1> 2897 0000B0D9 A3[D8800100] <1> mov [DelFile_FCluster], eax 2898 <1> 2899 <1> loc_del_short_name: 2900 0000B0DE C607E5 <1> mov byte [edi], 0E5h ; Deleted sign 2901 <1> 2902 0000B0E1 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 2903 0000B0E8 E8A4FCFFFF <1> call save_directory_buffer 2904 0000B0ED 723D <1> jc short loc_delete_direntry_err_return 2905 <1> 2906 <1> loc_del_long_name: 2907 0000B0EF 0FB615[DE800100] <1> movzx edx, byte [DelFile_LNEL] 2908 0000B0F6 08D2 <1> or dl, dl 2909 0000B0F8 7416 <1> jz short loc_del_dir_entry_update_parent_dir_lm_date 2910 <1> 2911 0000B0FA 8835[DE800100] <1> mov [DelFile_LNEL], dh ; 0 2912 <1> 2913 0000B100 0FB705[DC800100] <1> movzx eax, word [DelFile_EntryCounter] 2914 0000B107 29D0 <1> sub eax, edx 2915 <1> ;jnc short loc_del_long_name_continue 2916 0000B109 7205 <1> jc short loc_del_dir_entry_update_parent_dir_lm_date 2917 <1> 2918 <1> ;loc_del_direntry_inv_data_return: ; 15/10/2016 (0Dh -> 29) 2919 <1> ; mov eax, 29 ; 0Dh (TRDOS 8086) ; Invalid data 2920 <1> ; retn 2921 <1> 2922 <1> loc_del_long_name_continue: 2923 <1> ; AX = Directory Entry Number of the long name last entry 2924 0000B10B E8C1FDFFFF <1> call delete_longname 2925 <1> ;jc short loc_delete_direntry_err_return 2926 <1> 2927 <1> loc_del_dir_entry_update_parent_dir_lm_date: 2928 0000B110 801D[DE800100]00 <1> sbb byte [DelFile_LNEL], 0 ; 0FFh if cf = 1 2929 <1> 2930 0000B117 E8FEFCFFFF <1> call update_parent_dir_lmdt 2931 0000B11C B700 <1> mov bh, 0 2932 0000B11E 80D700 <1> adc bh, 0 2933 <1> 2934 0000B121 8A1D[DE800100] <1> mov bl, byte [DelFile_LNEL] 2935 <1> 2936 <1> loc_delete_direntry_return: 2937 0000B127 A1[D8800100] <1> mov eax, [DelFile_FCluster] 2938 <1> loc_delete_direntry_err_return: 2939 0000B12C C3 <1> retn 2940 <1> 2941 <1> rename_directory_entry: 2942 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 2943 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 2944 <1> ; 13/11/2017 2945 <1> ; 15/10/2016 2946 <1> ; 06/03/2016 (TRDOS 386 = TRDOS v2.0) 2947 <1> ; 01/08/2011 (DIR.ASM, 'proc_rename_directory_entry') 2948 <1> ; 19/11/2010 2949 <1> ; INPUT -> (Current Directory) 2950 <1> ; CX = Directory Entry Number 2951 <1> ; EAX = First Cluster number of file or directory 2952 <1> ; EBX = Longname Length (dir entry count) (< 256) 2953 <1> ; ESI = New file (or directory) name (no path). 2954 <1> ; (ASCIIZ string) 2955 <1> ; OUTPUT -> 2956 <1> ; CF = 0 -> successfull 2957 <1> ; CF = 1 -> error code in EAX (AL) 2958 <1> ; 2959 <1> ; (EAX, EBX, ECX, EDX, ESI, EDI will be changed) 2960 <1> 2961 <1> ; 19/12/2025 2962 <1> %if 0 2963 <1> cmp byte [Current_FATType], 0 2964 <1> ja short loc_rename_directory_entry 2965 <1> 2966 <1> ;call rename_fs_file_or_directory 2967 <1> ;retn 2968 <1> ; 29/07/2022 2969 <1> jmp rename_fs_file_or_directory 2970 <1> %endif 2971 <1> 2972 <1> loc_rename_directory_entry: 2973 0000B12D 881D[DE800100] <1> mov [DelFile_LNEL], bl 2974 0000B133 66890D[DC800100] <1> mov [DelFile_EntryCounter], cx 2975 0000B13A A3[D8800100] <1> mov [DelFile_FCluster], eax 2976 <1> 2977 0000B13F 0FB7C1 <1> movzx eax, cx 2978 0000B142 E8F3FDFFFF <1> call locate_current_dir_entry 2979 0000B147 7307 <1> jnc short loc_rename_direntry_check_fcluster 2980 <1> 2981 <1> loc_rename_direntry_pop_retn: 2982 0000B149 C3 <1> retn 2983 <1> 2984 <1> loc_rename_direntry_pop_invd_retn: 2985 <1> ; 29/07/2022 2986 <1> ;stc 2987 <1> loc_rename_direntry_invd_retn: 2988 <1> ; 15/10/2016 (0Dh -> 29) 2989 <1> ;mov eax, 29 ; Invalid data 2990 <1> ; 29/07/2022 2991 0000B14A 29C0 <1> sub eax, eax 2992 0000B14C B01D <1> mov al, 29 2993 0000B14E F9 <1> stc 2994 <1> loc_rename_retn: 2995 0000B14F C3 <1> retn 2996 <1> 2997 <1> loc_rename_direntry_check_fcluster: 2998 0000B150 668B5714 <1> mov dx, [edi+20] ; First Cluster HW 2999 0000B154 C1E210 <1> shl edx, 16 ; 13/11/2017 3000 0000B157 668B571A <1> mov dx, [edi+26] ; First Cluster LW 3001 0000B15B 3B15[D8800100] <1> cmp edx, [DelFile_FCluster] 3002 0000B161 75E7 <1> jne short loc_rename_direntry_pop_invd_retn 3003 <1> ; ESI = New file (or directory) name. (ASCIIZ string) 3004 <1> ; 06/03/2016 3005 <1> ; TRDOS v2 - NOTE: 'convert_file_name' procedure 3006 <1> ; has been modified for eliminating following situation. 3007 <1> ; 3008 <1> ; TRDOS v1 - NOTE: If file/dir name is more than 11 bytes 3009 <1> ; without a dot, attributes (edi+11) byte will be overwritten ! 3010 <1> ; (Dot file name input must be proper for 11 byte dir entry 3011 <1> ; type file name output.) 3012 0000B163 E84CF7FFFF <1> call convert_file_name 3013 <1> 3014 0000B168 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 3015 0000B16F E81DFCFFFF <1> call save_directory_buffer 3016 0000B174 72D9 <1> jc short loc_rename_retn 3017 <1> 3018 <1> loc_rename_direntry_del_ln: 3019 0000B176 0FB615[DE800100] <1> movzx edx, byte [DelFile_LNEL] 3020 0000B17D 08D2 <1> or dl, dl 3021 0000B17F 7410 <1> jz short loc_rename_direntry_update_parent_dir_lm_date 3022 <1> 3023 0000B181 0FB705[DC800100] <1> movzx eax, word [DelFile_EntryCounter] 3024 0000B188 29D0 <1> sub eax, edx 3025 0000B18A 72BE <1> jc short loc_rename_direntry_invd_retn 3026 <1> 3027 <1> loc_rename_direntry_del_ln_continue: 3028 <1> ; EAX = Directory Entry Number of the long name last entry 3029 0000B18C E840FDFFFF <1> call delete_longname 3030 <1> 3031 <1> loc_rename_direntry_update_parent_dir_lm_date: 3032 0000B191 E884FCFFFF <1> call update_parent_dir_lmdt 3033 0000B196 31C0 <1> xor eax, eax 3034 0000B198 C3 <1> retn 3035 <1> 3036 <1> move_source_file_to_destination_file: 3037 <1> ; 19/12/2025 3038 <1> ; 11/08/2025 (TRDOS 386 Kernel v2.0.10) 3039 <1> ; 07/08/2022 3040 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 3041 <1> ; 15/10/2016 3042 <1> ; 11/03/2016 3043 <1> ; 10/03/2016 (TRDOS 386 = TRDOS v2.0) 3044 <1> ; 01/08/2011 (FILE.ASM) 3045 <1> ; 04/08/2010 3046 <1> ; 3047 <1> ; Phase 1 -> Check destination file, 3048 <1> ; 'not found' is required 3049 <1> ; Phase 2 -> Check source file 3050 <1> ; 'found' and proper attributes is required 3051 <1> ; Phase 3 -> Make destination directory entry, 3052 <1> ; add new dir cluster or section if it is required 3053 <1> ; Phase 4 -> Delete source directory entry. 3054 <1> ; cf = 1 causes to return before the phase 4. 3055 <1> ; (source file protection against any possible errors) 3056 <1> ; 3057 <1> ; 08/05/2011 major modification 3058 <1> ; -> destination file deleting is removed 3059 <1> ; for msdos move/rename compatibility. 3060 <1> ; (Access denied error will return if 3061 <1> ; the destination file is found...) 3062 <1> ; INPUT -> 3063 <1> ; ESI = Source File Pathname (Asciiz) 3064 <1> ; EDI = Destination File Pathname (Asciiz) 3065 <1> ; AL = 0 --> Interrupt (System call) 3066 <1> ; AL > 0 --> Command Interpreter (Question) 3067 <1> ; AL = 1 --> Question Phase 3068 <1> ; AL = 2 --> Progress Phase 3069 <1> ; OUTPUT -> 3070 <1> ; cf = 0 -> OK 3071 <1> ; EAX = Destination directory first cluster 3072 <1> ; ESI = Logical DOS drive description table 3073 <1> ; EBX = Destination file structure offset 3074 <1> ; CX = 0 (CX > 0 --> calculate free space error) 3075 <1> ; cf = 1 -> Error code in EAX (AL) 3076 <1> ; 3077 <1> ; (EDX, ECX, EBX, ESI, EDI will be changed) 3078 <1> 3079 0000B199 3C02 <1> cmp al, 2 3080 <1> ;je msftdf_df2_check_directory 3081 <1> ; 29/07/2022 3082 0000B19B 7505 <1> jne short msftdf 3083 0000B19D E96D010000 <1> jmp msftdf_df2_check_directory 3084 <1> msftdf: 3085 0000B1A2 A2[62820100] <1> mov [move_cmd_phase], al 3086 <1> 3087 <1> msftdf_parse_sf_path: 3088 <1> ; ESI = ASCIIZ pathname (Source) 3089 0000B1A7 57 <1> push edi 3090 0000B1A8 BF[60810100] <1> mov edi, SourceFile_Drv 3091 0000B1AD E8CCF7FFFF <1> call parse_path_name 3092 0000B1B2 5E <1> pop esi 3093 0000B1B3 7211 <1> jc short msftdf_psf_retn 3094 <1> 3095 <1> msftdf_parse_df_path: 3096 <1> ; ESI = ASCIIZ pathname (Destination) 3097 0000B1B5 BF[E0810100] <1> mov edi, DestinationFile_Drv 3098 0000B1BA E8BFF7FFFF <1> call parse_path_name 3099 0000B1BF 7306 <1> jnc short msftdf_check_sf_drv 3100 <1> 3101 0000B1C1 3C01 <1> cmp al, 1 ; File or directory name is not existing 3102 0000B1C3 7602 <1> jna short msftdf_check_sf_drv 3103 <1> 3104 <1> msftdf_stc_retn: 3105 0000B1C5 F9 <1> stc 3106 <1> msftdf_psf_retn: 3107 0000B1C6 C3 <1> retn 3108 <1> 3109 <1> msftdf_check_sf_drv: 3110 0000B1C7 A0[60810100] <1> mov al, [SourceFile_Drv] 3111 <1> 3112 <1> msftdf_check_df_drv: 3113 0000B1CC 8A15[E0810100] <1> mov dl, [DestinationFile_Drv] 3114 <1> 3115 <1> msftdf_compare_sf_df_drv: 3116 <1> ; 11/08/2025 3117 <1> ;sub ebx, ebx 3118 <1> ;mov bh, [Current_Drv] 3119 0000B1D2 38C2 <1> cmp dl, al 3120 0000B1D4 7408 <1> je short msftdf_check_sf_df_drv_ok 3121 <1> 3122 <1> msftdf_not_same_drv: 3123 <1> ; DL = source file's drive number 3124 0000B1D6 88C6 <1> mov dh, al ; destination file's drive number 3125 <1> ; 15/10/2016 (11h -> 21) 3126 <1> ;mov eax, 21 ; Not the same drive 3127 <1> ; 29/07/2022 3128 0000B1D8 29C0 <1> sub eax, eax 3129 0000B1DA B015 <1> mov al, 21 3130 0000B1DC F9 <1> stc 3131 0000B1DD C3 <1> retn 3132 <1> 3133 <1> msftdf_check_sf_df_drv_ok: 3134 0000B1DE 8815[63820100] <1> mov [msftdf_sf_df_drv], dl 3135 <1> 3136 0000B1E4 29C0 <1> sub eax, eax 3137 0000B1E6 88D4 <1> mov ah, dl 3138 0000B1E8 0500010900 <1> add eax, Logical_DOSDisks 3139 0000B1ED A3[64820100] <1> mov [msftdf_drv_offset], eax 3140 <1> 3141 <1> ;cmp dl, bh ; byte [Current_Drv] 3142 <1> ; 11/08/2025 3143 0000B1F2 3A15[76770100] <1> cmp dl, [Current_Drv] 3144 0000B1F8 7407 <1> je short msftdf_df_check_directory 3145 <1> 3146 <1> msftdf_change_drv: 3147 0000B1FA E8F1C4FFFF <1> call change_current_drive 3148 0000B1FF 726C <1> jc short msftdf_df_error_retn 3149 <1> 3150 <1> msftdf_check_destination_file: 3151 <1> msftdf_df_check_directory: 3152 0000B201 BE[E1810100] <1> mov esi, DestinationFile_Directory 3153 0000B206 803E20 <1> cmp byte [esi], 20h 3154 0000B209 760F <1> jna short msftdf_df_find_1 3155 <1> 3156 <1> msftdf_df_change_directory: 3157 0000B20B FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3158 0000B211 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3159 0000B213 E8D3F1FFFF <1> call change_current_directory 3160 0000B218 7253 <1> jc short msftdf_df_error_retn 3161 <1> 3162 <1> ;msftdf_df_change_prompt_dir_string: 3163 <1> ; call change_prompt_dir_string 3164 <1> 3165 <1> msftdf_df_find_1: 3166 0000B21A BE[22820100] <1> mov esi, DestinationFile_Name 3167 0000B21F 803E20 <1> cmp byte [esi], 20h 3168 0000B222 7631 <1> jna short msftdf_df_copy_sf_name 3169 <1> 3170 <1> msftdf_df_find_2: 3171 <1> ;xor ax, ax ; DestinationFile_AttributesMask -> any/zero 3172 <1> ; 11/08/2025 3173 0000B224 31C0 <1> xor eax, eax 3174 0000B226 E84FD7FFFF <1> call find_first_file 3175 <1> ;jnc msftdf_permission_denied_retn 3176 <1> ; 29/07/2022 3177 0000B22B 7205 <1> jc short msftdf_df_check_error_code 3178 0000B22D E98B000000 <1> jmp msftdf_permission_denied_retn 3179 <1> 3180 <1> msftdf_df_check_error_code: 3181 <1> ;cmp eax, 2 ; File not found error 3182 0000B232 3C02 <1> cmp al, 2 3183 0000B234 7536 <1> jne short msftdf_df_stc_retn 3184 <1> 3185 <1> msftdf_df_check_fname: 3186 <1> ; 15/10/2016 3187 0000B236 BE[22820100] <1> mov esi, DestinationFile_Name ; * 3188 0000B23B E899DAFFFF <1> call check_filename 3189 0000B240 7307 <1> jnc short msftdf_convert_df_direntry_name 3190 <1> ; invalid file name chars ! 3191 0000B242 B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; 26 3192 0000B247 EB23 <1> jmp short msftdf_df_stc_retn 3193 <1> 3194 <1> msftdf_convert_df_direntry_name: 3195 <1> ;mov esi, DestinationFile_Name ; * 3196 0000B249 BF[32820100] <1> mov edi, DestinationFile_DirEntry 3197 0000B24E E861F6FFFF <1> call convert_file_name 3198 0000B253 EB19 <1> jmp short msftdf_restore_current_dir_1 3199 <1> 3200 <1> msftdf_df_copy_sf_name: 3201 0000B255 89F7 <1> mov edi, esi 3202 0000B257 57 <1> push edi 3203 0000B258 BE[A2810100] <1> mov esi, SourceFile_Name 3204 <1> ;mov ecx, 12 3205 <1> ; 29/07/2022 3206 0000B25D 29C9 <1> sub ecx, ecx 3207 0000B25F B10C <1> mov cl, 12 3208 <1> msftdf_df_copy_sf_name_loop: 3209 0000B261 AC <1> lodsb 3210 0000B262 AA <1> stosb 3211 0000B263 08C0 <1> or al, al 3212 0000B265 7402 <1> jz short msftdf_df_copy_sf_name_ok 3213 0000B267 E2F8 <1> loop msftdf_df_copy_sf_name_loop 3214 <1> msftdf_df_copy_sf_name_ok: 3215 0000B269 5E <1> pop esi 3216 0000B26A EBB8 <1> jmp short msftdf_df_find_2 3217 <1> 3218 <1> msftdf_df_stc_retn: 3219 0000B26C F9 <1> stc 3220 <1> msftdf_restore_cdir_failed: 3221 <1> msftdf_df_error_retn: 3222 0000B26D C3 <1> retn 3223 <1> 3224 <1> msftdf_restore_current_dir_1: 3225 0000B26E 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 3226 0000B275 760D <1> jna short msftdf_sf_check_directory 3227 0000B277 8B35[64820100] <1> mov esi, [msftdf_drv_offset] 3228 0000B27D E81FC5FFFF <1> call restore_current_directory 3229 0000B282 72E9 <1> jc short msftdf_restore_cdir_failed 3230 <1> 3231 <1> msftdf_sf_check_directory: 3232 0000B284 BE[61810100] <1> mov esi, SourceFile_Directory 3233 0000B289 803E20 <1> cmp byte [esi], 20h 3234 0000B28C 760F <1> jna short msftdf_sf_find 3235 <1> msftdf_sf_change_directory: 3236 0000B28E FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3237 0000B294 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3238 0000B296 E850F1FFFF <1> call change_current_directory 3239 0000B29B 7225 <1> jc short msftdf_return 3240 <1> 3241 <1> ;msftdf_sf_change_prompt_dir_string: 3242 <1> ; call change_prompt_dir_string 3243 <1> 3244 <1> msftdf_sf_find: 3245 0000B29D BE[A2810100] <1> mov esi, SourceFile_Name ; Offset 66 3246 0000B2A2 66B80018 <1> mov ax, 1800h ; Only files 3247 0000B2A6 E8CFD6FFFF <1> call find_first_file 3248 0000B2AB 7215 <1> jc short msftdf_return 3249 <1> 3250 <1> msftdf_sf_ambgfn_check: 3251 0000B2AD 6609D2 <1> or dx, dx ; Ambiguous filename chars used sign (DX>0) 3252 0000B2B0 7406 <1> jz short msftdf_sf_found 3253 <1> 3254 <1> msftdf_ambiguous_file_name_error: 3255 <1> ;mov eax, 2 ; File not found error 3256 <1> ; 29/07/2022 3257 0000B2B2 29C0 <1> sub eax, eax 3258 0000B2B4 B002 <1> mov al, 2 3259 0000B2B6 F9 <1> stc 3260 0000B2B7 C3 <1> retn 3261 <1> 3262 <1> msftdf_sf_found: 3263 0000B2B8 80E31F <1> and bl, 1Fh ; Attributes, D-V-S-H-R 3264 0000B2BB 7415 <1> jz short msftdf_save_sf_structure 3265 <1> 3266 <1> msftdf_permission_denied_retn: 3267 <1> ;mov eax, 05h ; Access (Permission) denied ! 3268 <1> ; 29/07/2022 3269 0000B2BD 29C0 <1> sub eax, eax 3270 0000B2BF B005 <1> mov al, 5 3271 0000B2C1 F9 <1> stc 3272 <1> msftdf_rest_cdir_err_retn: 3273 <1> msftdf_return: 3274 0000B2C2 C3 <1> retn 3275 <1> 3276 <1> msftdf_phase_1_return: 3277 0000B2C3 31C0 <1> xor eax, eax 3278 0000B2C5 A2[62820100] <1> mov [move_cmd_phase], al ; 0 3279 0000B2CA FEC0 <1> inc al ; mov al, 1 3280 0000B2CC BB[0FB30000] <1> mov ebx, msftdf_df2_check_directory 3281 <1> ;mov edx, 0FFFFFFFFh 3282 0000B2D1 C3 <1> retn 3283 <1> 3284 <1> msftdf_save_sf_structure: 3285 0000B2D2 BE[68800100] <1> mov esi, FindFile_DirEntry 3286 0000B2D7 BF[B2810100] <1> mov edi, SourceFile_DirEntry 3287 <1> ;mov ecx, 8 3288 <1> ; 29/07/2022 3289 0000B2DC 29C9 <1> sub ecx, ecx 3290 0000B2DE B108 <1> mov cl, 8 3291 0000B2E0 F3A5 <1> rep movsd 3292 <1> 3293 <1> msftdf_df_copy_sf_parameters: 3294 <1> ;mov esi, 11 3295 <1> ;mov edi, esi 3296 <1> ;add esi, SourceFile_DirEntry 3297 <1> ;add edi, DestinationFile_DirEntry 3298 <1> ; 11/08/2025 3299 0000B2E2 BE[BD810100] <1> mov esi, SourceFile_DirEntry+11 3300 0000B2E7 BF[3D820100] <1> mov edi, DestinationFile_DirEntry+11 3301 <1> ;mov ecx, 21 3302 0000B2EC B115 <1> mov cl, 21 3303 0000B2EE F3A4 <1> rep movsb 3304 <1> 3305 <1> msftdf_restore_current_dir_2: 3306 0000B2F0 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 3307 0000B2F7 760D <1> jna short msftdf_df2_check_move_cmd_phase 3308 0000B2F9 8B35[64820100] <1> mov esi, [msftdf_drv_offset] 3309 0000B2FF E89DC4FFFF <1> call restore_current_directory 3310 0000B304 72BC <1> jc short msftdf_rest_cdir_err_retn 3311 <1> 3312 <1> msftdf_df2_check_move_cmd_phase: 3313 0000B306 803D[62820100]01 <1> cmp byte [move_cmd_phase], 1 3314 0000B30D 74B4 <1> je short msftdf_phase_1_return 3315 <1> 3316 <1> msftdf_df2_check_directory: 3317 0000B30F BE[E1810100] <1> mov esi, DestinationFile_Directory 3318 0000B314 803E20 <1> cmp byte [esi], 20h 3319 0000B317 760F <1> jna short msftdf_make_dfde_locate_ffe_on_directory 3320 <1> msftdf_df2_change_directory: 3321 0000B319 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3322 0000B31F 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3323 0000B321 E8C5F0FFFF <1> call change_current_directory 3324 0000B326 729A <1> jc short msftdf_return 3325 <1> 3326 <1> ;msftdf_df2_change_prompt_dir_string: 3327 <1> ; call change_prompt_dir_string 3328 <1> 3329 <1> msftdf_make_dfde_locate_ffe_on_directory: 3330 <1> ; Current directory fcluster <> Directory buffer cluster 3331 <1> ; Current directory will be reloaded by 3332 <1> ; 'locate_current_dir_file' procedure 3333 <1> ; 3334 <1> ;xor ax, ax 3335 0000B328 31C0 <1> xor eax, eax 3336 0000B32A 89C1 <1> mov ecx, eax 3337 0000B32C 6649 <1> dec cx ; FFFFh 3338 <1> ; CX = FFFFh -> find first deleted or free entry 3339 <1> ; ESI would be ASCIIZ filename address if the call 3340 <1> ; would not be for first free or deleted dir entry 3341 0000B32E E8D5F2FFFF <1> call locate_current_dir_file 3342 <1> ; 07/08/2022 3343 0000B333 7328 <1> jnc short msftdf_make_dfde_set_ff_dir_entry 3344 <1> 3345 <1> ;cmp eax, 2 3346 0000B335 3C02 <1> cmp al, 2 3347 0000B337 7520 <1> jne short msftdf_error_retn 3348 <1> 3349 <1> msftdf_add_new_dir_entry_check_fs: 3350 0000B339 8B35[64820100] <1> mov esi, [msftdf_drv_offset] 3351 0000B33F A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 3352 <1> 3353 <1> ; 19/12/2025 3354 <1> %if 0 3355 <1> cmp byte [esi+LD_FATType], 0 3356 <1> ja short msftdf_add_new_subdir_cluster 3357 <1> 3358 <1> msftdf_add_new_fs_subdir_section: 3359 <1> ;CL=0, CH=E5h --> deleted entry, CH=0 --> free entry 3360 <1> ;xor cx, cx 3361 <1> xor ch, ch ; cx = 0 --> add a new subdir section 3362 <1> call add_new_fs_section 3363 <1> jc short msftdf_dsfde_error_retn 3364 <1> ;mov [createfile_LastDirCluster], eax 3365 <1> 3366 <1> call load_FS_sub_directory 3367 <1> ;mov ebx, Directory_Buffer 3368 <1> jnc short msftdf_add_new_fs_subdir_section_ok 3369 <1> retn 3370 <1> %endif 3371 <1> 3372 <1> msftdf_add_new_subdir_cluster: 3373 0000B344 E8C3140000 <1> call add_new_cluster 3374 0000B349 720F <1> jc short msftdf_dsfde_error_retn 3375 <1> 3376 <1> ;mov [createfile_LastDirCluster], eax 3377 <1> 3378 0000B34B E8F50D0000 <1> call load_FAT_sub_directory 3379 0000B350 7309 <1> jnc short msftdf_add_new_subdir_cluster_ok 3380 <1> ; EBX = Directory buffer address 3381 <1> 3382 <1> msftdf_ansdc_update_parent_dir_lmdt: 3383 <1> msftdf_make_dfde_err_upd_pdir_lmdt: 3384 0000B352 50 <1> push eax 3385 0000B353 E8C2FAFFFF <1> call update_parent_dir_lmdt 3386 0000B358 58 <1> pop eax 3387 <1> 3388 <1> msftdf_error_retn: 3389 0000B359 F9 <1> stc 3390 <1> msftdf_dsfde_restore_cdir_failed: 3391 <1> msftdf_dsfde_error_retn: 3392 0000B35A C3 <1> retn 3393 <1> 3394 <1> msftdf_add_new_fs_subdir_section_ok: 3395 <1> msftdf_add_new_subdir_cluster_ok: 3396 0000B35B 89DF <1> mov edi, ebx ; Directory buffer address 3397 <1> 3398 <1> msftdf_make_dfde_set_ff_dir_entry: 3399 0000B35D 8B15[70770100] <1> mov edx, [Current_Dir_FCluster] 3400 0000B363 8915[C8820100] <1> mov [createfile_FFCluster], edx 3401 <1> ; EDI = Directory entry offset 3402 0000B369 BE[32820100] <1> mov esi, DestinationFile_DirEntry 3403 <1> ;mov ecx, 8 3404 <1> ; 29/07/2022 3405 0000B36E 29C9 <1> sub ecx, ecx 3406 0000B370 B108 <1> mov cl, 8 3407 0000B372 F3A5 <1> rep movsd 3408 <1> 3409 0000B374 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 3410 0000B37B E811FAFFFF <1> call save_directory_buffer 3411 0000B380 72D0 <1> jc short msftdf_make_dfde_err_upd_pdir_lmdt 3412 <1> 3413 <1> msftdf_make_dfde_update_pdir_lmdt: 3414 0000B382 E893FAFFFF <1> call update_parent_dir_lmdt 3415 <1> 3416 <1> msftdf_dsfde_restore_current_dir_1: 3417 0000B387 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 3418 0000B38E 760D <1> jna short msftdf_dsfde_check_directory 3419 0000B390 8B35[64820100] <1> mov esi, [msftdf_drv_offset] 3420 0000B396 E806C4FFFF <1> call restore_current_directory 3421 0000B39B 72BD <1> jc short msftdf_dsfde_restore_cdir_failed 3422 <1> 3423 <1> msftdf_dsfde_check_directory: 3424 0000B39D BE[61810100] <1> mov esi, SourceFile_Directory 3425 0000B3A2 803E20 <1> cmp byte [esi], 20h 3426 0000B3A5 760F <1> jna short msftdf_dsfde_find_file 3427 <1> 3428 <1> msftdf_dsfde_change_directory: 3429 0000B3A7 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3430 0000B3AD 28E4 <1> sub ah, ah ; CD_COMMAND sign -> 0 3431 0000B3AF E837F0FFFF <1> call change_current_directory 3432 0000B3B4 72A4 <1> jc short msftdf_dsfde_error_retn 3433 <1> 3434 <1> ;msftdf_dsfde_sf_change_prompt_dir_string: 3435 <1> ; call change_prompt_dir_string 3436 <1> 3437 <1> msftdf_dsfde_find_file: 3438 0000B3B6 BE[A2810100] <1> mov esi, SourceFile_Name ; Offset 66 3439 0000B3BB 668B460E <1> mov ax, [esi+14] ; 80 -> SourceFile_AttributesMask 3440 0000B3BF E8B6D5FFFF <1> call find_first_file 3441 0000B3C4 7294 <1> jc short msftdf_dsfde_error_retn 3442 <1> 3443 <1> msftdf_dsfde_delete_direntry: 3444 0000B3C6 8B35[64820100] <1> mov esi, [msftdf_drv_offset] 3445 <1> 3446 <1> ; 19/12/2025 3447 <1> %if 0 3448 <1> cmp byte [esi+LD_FATType], 0 3449 <1> ja short msftdf_delete_FAT_direntry 3450 <1> 3451 <1> xor bl, bl 3452 <1> ; BL = 0 -> File 3453 <1> ; EDI -> Directory buffer entry offset/address 3454 <1> call delete_fs_directory_entry 3455 <1> jnc short msftdf_dsfde_restore_current_dir_2 3456 <1> retn 3457 <1> %endif 3458 <1> 3459 <1> msftdf_delete_FAT_direntry: 3460 0000B3CC 8A1D[65800100] <1> mov bl, [FindFile_LongNameEntryLength] 3461 0000B3D2 668B0D[90800100] <1> mov cx, [FindFile_DirEntryNumber] 3462 <1> ; ESI = Logical DOS drive description table address 3463 <1> ; EDI = Directory buffer entry offset/address 3464 0000B3D9 E8E3FCFFFF <1> call delete_directory_entry 3465 0000B3DE 721C <1> jc short msftdf_retn 3466 <1> 3467 <1> msftdf_dsfde_restore_current_dir_2: 3468 0000B3E0 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 3469 0000B3E7 7607 <1> jna short msftdf_new_dir_fcluster_retn 3470 <1> ;mov esi, [msftdf_drv_offset] 3471 0000B3E9 E8B3C3FFFF <1> call restore_current_directory 3472 0000B3EE 720C <1> jc short msftdf_retn 3473 <1> 3474 <1> msftdf_new_dir_fcluster_retn: 3475 0000B3F0 31C9 <1> xor ecx, ecx 3476 0000B3F2 A1[C8820100] <1> mov eax, [createfile_FFCluster] 3477 0000B3F7 BB[E0810100] <1> mov ebx, DestinationFile_Drv 3478 <1> 3479 <1> msftdf_retn: 3480 0000B3FC C3 <1> retn 3481 <1> 3482 <1> copy_source_file_to_destination_file: 3483 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 3484 <1> ; 31/08/2024 3485 <1> ; 30/08/2024 3486 <1> ; 29/08/2024 3487 <1> ; 26/08/2024 3488 <1> ; 25/08/2024 (TRDOS 386 v2.0.9) 3489 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 3490 <1> ; 17/10/2016 3491 <1> ; 16/10/2016 3492 <1> ; 15/10/2016 3493 <1> ; 30/03/2016, 31/03/2016 3494 <1> ; 24/03/2016, 25/03/2016, 28/03/2016 3495 <1> ; 21/03/2016, 22/03/2016, 23/03/2016 3496 <1> ; 16/03/2016, 17/03/2016, 18/03/2016 3497 <1> ; 15/03/2016 (TRDOS 386 = TRDOS v2.0) 3498 <1> ; 02/09/2011 (FILE.ASM 'copy_source_file_to_destination_file') 3499 <1> ; 01/08/2010 - 18/05/2011 3500 <1> ; 3501 <1> ; Command Interpreter phase 1 enter -> 3502 <1> ; AL = 1 -> Caller is command interpreter 3503 <1> ; AL = 2 -> The second call, re-enter/continue 3504 <1> ; Phase 1 -> Check source file 3505 <1> ; 'found' is required 3506 <1> ; Phase 2 -> Check destination file, 3507 <1> ; save 'found' or 'not found' status 3508 <1> ; 'permission denied' error will be return 3509 <1> ; if attributes have not for ordinary file 3510 <1> ; without readonly attribute 3511 <1> ; Command Interpreter phase 1 return -> 3512 <1> ; DH = Source file attributes 3513 <1> ; DL = Destination file found status 3514 <1> ; EAX = 0 3515 <1> ; Command Interpreter phase 2 enter -> 3516 <1> ; AL = 2 -> Continue from the last position 3517 <1> ; AH = 3518 <1> ; Phase 3 -> Load source file or use read/write cluster method 3519 <1> ; Phase 4 -> Create destination file if it is not found 3520 <1> ; Phase 5 -> Open destination file 3521 <1> ; Phase 6 -> Read from source and write to destination 3522 <1> ; Phase 7 -> Unload source file, if it is loaded at memory 3523 <1> ; cf = 1 causes to return before the phase 7 3524 <1> ; but loaded file will be unloaded 3525 <1> ; (allocated memory block will be deallocated) 3526 <1> ; 3527 <1> ; INPUT -> 3528 <1> ; ESI = Source File Pathname (Asciiz) 3529 <1> ; EDI = Destination File Pathname (Asciiz) 3530 <1> ; AL = 0 --> Interrupt (System call) 3531 <1> ; AL > 0 --> Command Interpreter (Question) 3532 <1> ; AL = 1 --> Question Phase 3533 <1> ; AL = 2 --> Progress Phase 3534 <1> ; 3535 <1> ; OUTPUT -> 3536 <1> ; cf = 0 -> OK ; (*) 3537 <1> ; EAX = Destination file first cluster 3538 <1> ; 3539 <1> ; 31/08/2024 - TRDOS v2.0.9 ; (*) 3540 <1> ; obsolete ;CL > 0 if there is file reading error before EOF 3541 <1> ; ; (incomplete copy) 3542 <1> ; ;CH > 0 if file is (full) loaded at memory 3543 <1> ; 3544 <1> ; cf = 1 -> Error code in AL (EAX) ; (*) 3545 <1> ; 3546 <1> ; (EBX, ECX, ESI, EDI register contents will be changed) 3547 <1> 3548 0000B3FD 3C02 <1> cmp al, 2 3549 <1> ;je csftdf2_check_cdrv 3550 <1> ; 29/07/2022 3551 0000B3FF 7205 <1> jb short csftdf_ph1 3552 <1> ;jmp csftdf2_check_cdrv 3553 0000B401 E943020000 <1> jmp csftdf_ph2 3554 <1> 3555 <1> ; Phase 1 3556 <1> ; 29/07/2022 3557 <1> csftdf_ph1: 3558 0000B406 A2[88820100] <1> mov byte [copy_cmd_phase], al 3559 <1> 3560 0000B40B 57 <1> push edi ; * 3561 <1> 3562 <1> csftdf_parse_sf_path: 3563 0000B40C BF[60810100] <1> mov edi, SourceFile_Drv 3564 0000B411 E868F5FFFF <1> call parse_path_name 3565 0000B416 721C <1> jc short csftdf_parse_sf_path_failed 3566 <1> 3567 <1> csftdf_parse_df_path: 3568 0000B418 5E <1> pop esi ; * (pushed edi) 3569 <1> 3570 <1> csftdf_sf_check_filename_exists: 3571 0000B419 803D[A2810100]21 <1> cmp byte [SourceFile_Name], 21h 3572 0000B420 7214 <1> jb short csftdf_sf_file_not_found_error 3573 <1> 3574 0000B422 BF[E0810100] <1> mov edi, DestinationFile_Drv 3575 0000B427 E852F5FFFF <1> call parse_path_name 3576 0000B42C 730E <1> jnc short csftdf_check_sf_cdrv 3577 <1> 3578 0000B42E 3C01 <1> cmp al, 1 ; File or directory name is not existing 3579 0000B430 760A <1> jna short csftdf_check_sf_cdrv 3580 <1> 3581 <1> csftdf_parse_df_path_failed: 3582 0000B432 F9 <1> stc 3583 <1> csftdf_sf_error_retn: 3584 0000B433 C3 <1> retn 3585 <1> 3586 <1> csftdf_parse_sf_path_failed: 3587 0000B434 5F <1> pop edi ; * 3588 <1> ;jmp short csftdf_sf_error_retn 3589 <1> ; 25/08/2024 3590 0000B435 C3 <1> retn 3591 <1> 3592 <1> csftdf_sf_file_not_found_error: 3593 0000B436 B802000000 <1> mov eax, 2 ; File not found 3594 <1> ;jmp short csftdf_sf_error_retn 3595 <1> ; 25/08/2024 3596 0000B43B C3 <1> retn 3597 <1> 3598 <1> csftdf_check_sf_cdrv: 3599 0000B43C 8A3D[76770100] <1> mov bh, [Current_Drv] 3600 <1> 3601 0000B442 883D[8B820100] <1> mov [csftdf_cdrv], bh ; 23/03/2016 3602 <1> 3603 0000B448 8A15[60810100] <1> mov dl, [SourceFile_Drv] 3604 0000B44E 38FA <1> cmp dl, bh ; byte [Current_Drv] 3605 0000B450 7407 <1> je short csftdf_sf_check_directory 3606 <1> 3607 0000B452 E899C2FFFF <1> call change_current_drive 3608 0000B457 72DA <1> jc short csftdf_sf_error_retn 3609 <1> 3610 <1> csftdf_sf_check_directory: 3611 0000B459 BE[61810100] <1> mov esi, SourceFile_Directory 3612 0000B45E 803E20 <1> cmp byte [esi], 20h 3613 0000B461 760F <1> jna short csftdf_find_sf 3614 <1> 3615 <1> csftdf_sf_change_directory: 3616 0000B463 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3617 0000B469 30E4 <1> xor ah, ah ; CD_COMMAND sign -> 0 3618 0000B46B E87BEFFFFF <1> call change_current_directory 3619 0000B470 72C1 <1> jc short csftdf_sf_error_retn 3620 <1> 3621 <1> ;csftdf_sf_change_prompt_dir_string: 3622 <1> ; call change_prompt_dir_string 3623 <1> 3624 <1> csftdf_find_sf: 3625 0000B472 BE[A2810100] <1> mov esi, SourceFile_Name 3626 0000B477 66B80018 <1> mov ax, 1800h ; Except volume label and dirs 3627 0000B47B E8FAD4FFFF <1> call find_first_file 3628 0000B480 72B1 <1> jc short csftdf_sf_error_retn 3629 <1> 3630 <1> csftdf_sf_ambgfn_check: 3631 0000B482 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 3632 0000B485 7406 <1> jz short csftdf_sf_found 3633 <1> 3634 <1> csftdf_ambiguous_file_name_error: 3635 <1> ;mov eax, 2 ; File not found error 3636 <1> ; 29/07/2022 3637 0000B487 29C0 <1> sub eax, eax 3638 0000B489 B002 <1> mov al, 2 3639 0000B48B F9 <1> stc 3640 0000B48C C3 <1> retn 3641 <1> 3642 <1> csftdf_sf_found: 3643 0000B48D A3[8C820100] <1> mov [csftdf_filesize], eax 3644 <1> 3645 0000B492 09C0 <1> or eax, eax 3646 0000B494 7504 <1> jnz short csftdf_set_source_file_direntry 3647 <1> 3648 <1> ;csftdf_sf_file_size_zero: 3649 <1> ;mov eax, 20 ; TRDOS zero length (file size) error 3650 <1> ; 25/08/2024 3651 <1> ; eax = 0 3652 <1> ; 29/07/2022 3653 <1> ;sub eax, eax 3654 0000B496 B014 <1> mov al, 20 3655 0000B498 F9 <1> stc 3656 0000B499 C3 <1> retn 3657 <1> 3658 <1> csftdf_set_source_file_direntry: 3659 0000B49A BE[68800100] <1> mov esi, FindFile_DirEntry 3660 0000B49F BF[B2810100] <1> mov edi, SourceFile_DirEntry 3661 <1> ;mov ecx, 8 3662 <1> ; 29/07/2022 3663 0000B4A4 31C9 <1> xor ecx, ecx 3664 0000B4A6 B108 <1> mov cl, 8 3665 0000B4A8 F3A5 <1> rep movsd 3666 <1> 3667 <1> csftdf_sf_restore_cdrv: 3668 <1> ; 22/03/2016 3669 0000B4AA 8A15[8B820100] <1> mov dl, [csftdf_cdrv] 3670 0000B4B0 3A15[76770100] <1> cmp dl, [Current_Drv] 3671 0000B4B6 7407 <1> je short csftdf_sf_restore_cdir 3672 0000B4B8 E833C2FFFF <1> call change_current_drive 3673 0000B4BD 724F <1> jc short csftdf_df_error_retn ; 30/03/2016 3674 <1> 3675 <1> csftdf_sf_restore_cdir: 3676 0000B4BF 803D[8E2E0100]00 <1> cmp byte [Restore_CDIR], 0 3677 0000B4C6 7612 <1> jna short csftdf_df_check_filename_exists 3678 0000B4C8 29C0 <1> sub eax, eax 3679 0000B4CA BE00010900 <1> mov esi, Logical_DOSDisks 3680 0000B4CF 88D4 <1> mov ah, dl ; byte [csftdf_cdrv] 3681 0000B4D1 01C6 <1> add esi, eax 3682 0000B4D3 E8C9C2FFFF <1> call restore_current_directory 3683 0000B4D8 7234 <1> jc short csftdf_df_error_retn 3684 <1> 3685 <1> csftdf_df_check_filename_exists: 3686 0000B4DA 803D[22820100]20 <1> cmp byte [DestinationFile_Name], 20h 3687 0000B4E1 7716 <1> ja short csftdf_check_df_cdrv 3688 <1> 3689 <1> csftdf_copy_sf_name: 3690 0000B4E3 BF[22820100] <1> mov edi, DestinationFile_Name 3691 0000B4E8 BE[A2810100] <1> mov esi, SourceFile_Name 3692 0000B4ED B10C <1> mov cl, 12 3693 <1> 3694 <1> csftdf_df_copy_sf_name_loop: 3695 0000B4EF AC <1> lodsb 3696 0000B4F0 AA <1> stosb 3697 0000B4F1 08C0 <1> or al, al 3698 0000B4F3 7404 <1> jz short csftdf_check_df_cdrv 3699 0000B4F5 FEC9 <1> dec cl 3700 0000B4F7 75F6 <1> jnz csftdf_df_copy_sf_name_loop 3701 <1> 3702 <1> csftdf_check_df_cdrv: 3703 0000B4F9 8A15[E0810100] <1> mov dl, [DestinationFile_Drv] 3704 0000B4FF 3A15[76770100] <1> cmp dl, [Current_Drv] 3705 0000B505 7408 <1> je short csftdf_df_check_directory 3706 <1> 3707 0000B507 E8E4C1FFFF <1> call change_current_drive 3708 0000B50C 7301 <1> jnc short csftdf_df_check_directory 3709 <1> 3710 <1> csftdf_df_error_retn: 3711 0000B50E C3 <1> retn 3712 <1> 3713 <1> csftdf_df_check_directory: 3714 0000B50F BE[E1810100] <1> mov esi, DestinationFile_Directory 3715 0000B514 803E20 <1> cmp byte [esi], 20h 3716 0000B517 760F <1> jna short csftdf_find_df 3717 <1> 3718 <1> csftdf_df_change_directory: 3719 0000B519 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 3720 0000B51F 28E4 <1> sub ah, ah ; CD_COMMAND sign -> 0 3721 0000B521 E8C5EEFFFF <1> call change_current_directory 3722 0000B526 72E6 <1> jc short csftdf_df_error_retn 3723 <1> 3724 <1> ;csftdf_df_change_prompt_dir_string: 3725 <1> ; call change_prompt_dir_string 3726 <1> 3727 <1> csftdf_find_df: 3728 <1> ; 23/03/2016 3729 0000B528 29DB <1> sub ebx, ebx 3730 0000B52A 8A3D[E0810100] <1> mov bh, [DestinationFile_Drv] 3731 0000B530 81C300010900 <1> add ebx, Logical_DOSDisks 3732 0000B536 891D[B8820100] <1> mov [csftdf_df_drv_dt], ebx 3733 <1> 3734 0000B53C BE[22820100] <1> mov esi, DestinationFile_Name 3735 <1> ;xor ax, ax 3736 <1> ; 25/08/2024 3737 0000B541 31C0 <1> xor eax, eax 3738 <1> ; DestinationFile_AttributesMask -> any/zero 3739 0000B543 E832D4FFFF <1> call find_first_file 3740 0000B548 7217 <1> jc short csftdf_df_check_error_code 3741 <1> 3742 <1> csftdf_df_ambgfn_check: 3743 0000B54A 6609D2 <1> or dx, dx ; Ambiguous filename chars used sign (DX>0) 3744 0000B54D 7529 <1> jnz short csftdf_df_error_inv_fname 3745 <1> 3746 <1> csftdf_df_found: 3747 0000B54F C605[8A820100]01 <1> mov byte [DestinationFileFound], 1 3748 <1> ; 17/10/2016 (cl -> bl) 3749 0000B556 80E31F <1> and bl, 1Fh ; Attributes, D-V-S-H-R 3750 0000B559 7452 <1> jz short csftdf_df_save_first_cluster 3751 <1> 3752 <1> csftdf_df_permission_denied_retn: 3753 <1> ;mov eax, 05h ; Access/Permission denied. 3754 <1> ; 29/07/2022 3755 0000B55B 29C0 <1> sub eax, eax 3756 0000B55D B005 <1> mov al, 5 3757 <1> csftdf_df_error_stc_retn: 3758 0000B55F F9 <1> stc 3759 0000B560 C3 <1> retn 3760 <1> 3761 <1> csftdf_df_check_error_code: 3762 <1> ;cmp eax, 2 3763 0000B561 3C02 <1> cmp al, 2 3764 0000B563 75FA <1> jne short csftdf_df_error_stc_retn 3765 <1> 3766 0000B565 C605[8A820100]00 <1> mov byte [DestinationFileFound], 0 3767 <1> 3768 <1> ; 15/10/2016 3769 0000B56C BE[58800100] <1> mov esi, FindFile_Name ; * 3770 0000B571 E863D7FFFF <1> call check_filename 3771 0000B576 7306 <1> jnc short csftdf_df_valid_fname 3772 <1> csftdf_df_error_inv_fname: ; 'invalid file name !' 3773 <1> ;mov eax, ERR_INV_FILE_NAME ; 26 3774 <1> ; 29/07/2022 3775 0000B578 29C0 <1> sub eax, eax 3776 0000B57A B01A <1> mov al, ERR_INV_FILE_NAME ; 26 3777 0000B57C F9 <1> stc 3778 0000B57D C3 <1> retn 3779 <1> 3780 <1> csftdf_df_valid_fname: 3781 <1> ; 21/03/2016 3782 <1> ; (Capitalized file name) 3783 <1> ;mov esi, FindFile_Name ; * ; 15/10/2016 3784 0000B57E BF[22820100] <1> mov edi, DestinationFile_Name 3785 0000B583 A5 <1> movsd 3786 0000B584 A5 <1> movsd 3787 0000B585 A5 <1> movsd 3788 <1> ;movsb 3789 <1> 3790 <1> csftdf_check_disk_free_size_0: 3791 0000B586 A1[CE810100] <1> mov eax, [SourceFile_DirEntry+DirEntry_FileSize] 3792 <1> 3793 <1> csftdf_check_disk_free_size_1: 3794 <1> ;sub ebx, ebx 3795 <1> ;mov esi, Logical_DOSDisks 3796 <1> ;mov bh, [DestinationFile_Drv] 3797 <1> ;add esi, ebx 3798 <1> 3799 0000B58B 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] ; 23/03/2016 3800 <1> 3801 <1> ;movzx ecx, word [esi+LD_BPB+BytesPerSec] ; 17, LD_BPB + 0Bh 3802 <1> ; 19/12/2025 3803 0000B591 B900020000 <1> mov ecx, 512 3804 0000B596 01C8 <1> add eax, ecx 3805 0000B598 48 <1> dec eax ; file size (additional bytes) + 511 (round up) 3806 <1> csftdf_check_disk_free_size_3: ; 16/03/2016 3807 0000B599 29D2 <1> sub edx, edx 3808 0000B59B F7F1 <1> div ecx ; bytes per sector 3809 <1> 3810 <1> csftdf_check_disk_free_size: 3811 0000B59D 3B4674 <1> cmp eax, [esi+LD_FreeSectors] 3812 <1> ;jb csftdf_check_disk_free_size_ok 3813 <1> ; 25/08/2024 3814 <1> ; 29/07/2022 3815 <1> ;jb short csftdf_check_dfs_ok 3816 0000B5A0 7705 <1> ja short csftdf_df_insufficient_disk_space 3817 <1> 3818 <1> ; 25/08/2024 3819 <1> ;cmp byte [esi+LD_FATType], 0 ; FS needs FDT sector also. 3820 <1> ;;ja csftdf_check_disk_free_size_ok 3821 <1> ;; 29/07/2022 3822 <1> ;jna short csftdf_df_insufficient_disk_space 3823 <1> 3824 <1> csftdf_check_dfs_ok: 3825 0000B5A2 E985000000 <1> jmp csftdf_check_disk_free_size_ok 3826 <1> 3827 <1> csftdf_df_insufficient_disk_space: 3828 <1> ;mov eax, 27h ; insufficient disk space 3829 <1> ; 29/07/2022 3830 0000B5A7 29C0 <1> sub eax, eax 3831 0000B5A9 B027 <1> mov al, 27h 3832 <1> ;jmp short csftdf_df_error_stc_retn 3833 <1> ; 25/08/2024 3834 0000B5AB F9 <1> stc 3835 0000B5AC C3 <1> retn 3836 <1> 3837 <1> csftdf_df_save_first_cluster: 3838 <1> ; ESI = FindFile_DirEntry (for the old destination file) 3839 <1> ; EAX = Old destination file size 3840 <1> ; 24/03/2016 3841 <1> ; EDI = Directory entry address (within Dir Buffer boundaries) 3842 0000B5AD 81EF00000800 <1> sub edi, Directory_Buffer ; (<65536) 3843 <1> ;shr di, 5 ; Convert entry offset to entry index/number 3844 <1> ; 29/07/2022 3845 0000B5B3 C1EF05 <1> shr edi, 5 3846 0000B5B6 66893D[5A820100] <1> mov [DestinationFile_DirEntryNumber], di ; (<2048) 3847 <1> 3848 <1> csftdf_df_check_sf_df_fcluster: 3849 0000B5BD 668B5614 <1> mov dx, [esi+DirEntry_FstClusHI] 3850 0000B5C1 C1E210 <1> shl edx, 16 3851 0000B5C4 668B561A <1> mov dx, [esi+DirEntry_FstClusLO] 3852 0000B5C8 8915[9C820100] <1> mov [csftdf_df_cluster], edx 3853 <1> csftdf_df_check_sf_df_fcluster_1: 3854 0000B5CE 668B15[C6810100] <1> mov dx, [SourceFile_DirEntry+DirEntry_FstClusHI] 3855 0000B5D5 C1E210 <1> shl edx, 16 3856 0000B5D8 668B15[CC810100] <1> mov dx, [SourceFile_DirEntry+DirEntry_FstClusLO] 3857 0000B5DF 3B15[9C820100] <1> cmp edx, [csftdf_df_cluster] 3858 0000B5E5 7512 <1> jne short csftdf_df_check_sf_df_fcluster_ok 3859 <1> csftdf_df_check_sf_df_drv: 3860 0000B5E7 8A15[60810100] <1> mov dl, [SourceFile_Drv] 3861 0000B5ED 3A15[E0810100] <1> cmp dl, [DestinationFile_Drv] 3862 0000B5F3 7504 <1> jne short csftdf_df_check_sf_df_fcluster_ok 3863 <1> 3864 <1> ; source and destination files are same ! 3865 <1> ; (they have same first cluster value on same logical disk) 3866 <1> 3867 0000B5F5 31C0 <1> xor eax, eax ; mov eax, 0 -> Bad command or file name ! 3868 0000B5F7 F9 <1> stc 3869 0000B5F8 C3 <1> retn 3870 <1> 3871 <1> csftdf_df_check_sf_df_fcluster_ok: 3872 <1> csftdf_df_move_findfile_struct: 3873 <1> ; mov esi, FindFile_DirEntry 3874 0000B5F9 BF[32820100] <1> mov edi, DestinationFile_DirEntry 3875 <1> ;mov ecx, 8 3876 0000B5FE 31C9 <1> xor ecx, ecx 3877 0000B600 B108 <1> mov cl, 8 3878 0000B602 F3A5 <1> rep movsd 3879 <1> 3880 <1> ;csftdf_check_disk_free_size_2: 3881 0000B604 89C2 <1> mov edx, eax ; Old destination file size 3882 <1> 3883 <1> ;mov eax, [SourceFile_DirEntry+DirEntry_FileSize] 3884 0000B606 A1[8C820100] <1> mov eax, [csftdf_filesize] ; 23/03/2016 3885 <1> 3886 <1> ;;sub ecx, ecx ; 0 3887 <1> ;mov esi, Logical_DOSDisks 3888 <1> ;mov ch, [DestinationFile_Drv] 3889 <1> ;add esi, ecx 3890 <1> ; 3891 <1> ;mov [csftdf_df_drv_dt], esi 3892 <1> 3893 0000B60B 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] ; 23/03/2016 3894 <1> 3895 <1> ;mov cx, [esi+LD_BPB+BytesPerSec] ; 17, LD_BPB + 0Bh 3896 <1> ; 19/12/2025 3897 0000B611 66B90002 <1> mov cx, 512 3898 0000B615 01CA <1> add edx, ecx ; + 512 3899 0000B617 01C8 <1> add eax, ecx ; + 512 3900 0000B619 4A <1> dec edx ; old file size + 511 (round up) 3901 0000B61A 48 <1> dec eax ; new file size + 511 (round up) 3902 0000B61B F7D9 <1> neg ecx ; -512 ; 0FFFFFE00h 3903 0000B61D 21CA <1> and edx, ecx ; = old sector count * 512 3904 0000B61F 21C8 <1> and eax, ecx ; = new sector count * 512 3905 <1> 3906 0000B621 29D0 <1> sub eax, edx ; new file size - old file size (on disk) 3907 0000B623 7607 <1> jna short csftdf_check_disk_free_size_ok 3908 <1> 3909 0000B625 F7D9 <1> neg ecx ; 512 (bytes per sector) ; 200h 3910 <1> ; check free space for additional sectors 3911 <1> ; eax = number of additional sectors * bytes per sector 3912 <1> ; esi = Logical DOS drive number (of destination disk) 3913 0000B627 E96DFFFFFF <1> jmp csftdf_check_disk_free_size_3 3914 <1> 3915 <1> csftdf_check_disk_free_size_ok: 3916 <1> ; 18/03/2016 3917 <1> csftdf_df_check_copy_cmd_phase: 3918 0000B62C A0[88820100] <1> mov al, [copy_cmd_phase] 3919 0000B631 3C01 <1> cmp al, 1 3920 0000B633 7514 <1> jne short csftdf2_check_cdrv 3921 <1> 3922 0000B635 31C0 <1> xor eax, eax 3923 0000B637 A2[88820100] <1> mov [copy_cmd_phase], al ; 0 3924 <1> 3925 0000B63C 8A15[8A820100] <1> mov dl, [DestinationFileFound] 3926 0000B642 8A35[BD810100] <1> mov dh, [SourceFile_DirEntry+11] ; Attributes 3927 <1> 3928 <1> csftdf_return: 3929 0000B648 C3 <1> retn 3930 <1> 3931 <1> ; Phase 2 3932 <1> csftdf_ph2: 3933 <1> ; 29/07/2022 3934 <1> csftdf2_check_cdrv: 3935 <1> ; 18/03/2016 3936 <1> ; Here, destination drive and directory are ready ! 3937 <1> ; (checking/restoring is not needed) 3938 <1> ; (Since at the end of the phase 1) 3939 <1> 3940 <1> ; mov dl, [DestinationFile_Drv] 3941 <1> ; cmp dl, [Current_Drv] 3942 <1> ; je short csftdf2_df_check_directory 3943 <1> ; 3944 <1> ; call change_current_drive 3945 <1> ; jc short csftdf2_read_error 3946 <1> ; 3947 <1> ;csftdf2_df_check_directory: 3948 <1> ; mov esi, DestinationFile_Directory 3949 <1> ; cmp byte [esi], 20h 3950 <1> ; jna short csftdf2_df_check_found_or_not 3951 <1> ; 3952 <1> ;csftdf2_df_change_directory: 3953 <1> ; inc byte [Restore_CDIR] 3954 <1> ; xor ah, ah ; CD_COMMAND sign -> 0 3955 <1> ; call change_current_directory 3956 <1> ; jc short csftdf2_stc_return 3957 <1> ; 3958 <1> ;;csftdf2_df_change_prompt_dir_string: 3959 <1> ;; call change_prompt_dir_string 3960 <1> 3961 <1> csftdf2_df_check_found_or_not: 3962 <1> ; 21/03/2016 3963 0000B649 803D[8A820100]00 <1> cmp byte [DestinationFileFound], 0 3964 0000B650 7742 <1> ja short csftdf2_set_sf_percentage 3965 <1> 3966 <1> csftdf2_create_file: 3967 0000B652 BE[22820100] <1> mov esi, DestinationFile_Name 3968 0000B657 A1[8C820100] <1> mov eax, [csftdf_filesize] 3969 0000B65C 30C9 <1> xor cl, cl ; 0 3970 <1> 3971 0000B65E 31DB <1> xor ebx, ebx ; 0 3972 0000B660 4B <1> dec ebx ; 0FFFFFFFFh 3973 <1> 3974 <1> ; INPUT -> 3975 <1> ; EAX -> File Size 3976 <1> ; ESI = ASCIIZ File name 3977 <1> ; CL = File attributes 3978 <1> ; EBX = FFFFFFFFh -> empty file sign for FAT fs 3979 <1> ; EBX <> FFFFFFFFh -> use file size for FAT fs 3980 <1> ; 3981 <1> ; OUTPUT -> 3982 <1> ; EAX = New file's first cluster 3983 <1> ; (0 for empty file) ; 29/08/2024 3984 <1> ; ESI = Logical Dos Drv Descr. Table Addr. 3985 <1> ; ;EBX = CreateFile_Size address 3986 <1> ; ;ECX = Sectors per cluster (<256) 3987 <1> ; ;EDX = Directory Entry Index/Number (<65536) 3988 <1> ; ; 29/08/2024 3989 <1> ; EBX = File Size (0 for a new, empty file) 3990 <1> ; ECX = Directory Entry Index/Number (<2048) 3991 <1> ; (in directory cluster, not in directory) 3992 <1> ; EDX = Directory Cluster Number (of the file) 3993 <1> ; 3994 <1> ; cf = 1 -> error code in AL (EAX) 3995 <1> 3996 0000B661 E80D060000 <1> call create_file 3997 <1> ;pop esi 3998 <1> ;jc csftdf2_rw_error 3999 <1> ; 29/07/2022 4000 0000B666 7305 <1> jnc short csftdf2_create_file_OK 4001 0000B668 E978050000 <1> jmp csftdf2_rw_error 4002 <1> 4003 <1> csftdf2_create_file_OK: 4004 <1> 4005 0000B66D A3[9C820100] <1> mov [csftdf_df_cluster], eax 4006 <1> ; 27/08/2024 4007 <1> ; eax = 0 4008 <1> 4009 <1> ; 24/03/2016 4010 <1> ;mov [DestinationFile_DirEntryNumber], dx 4011 <1> ; 29/08/2024 4012 <1> ; (these 3 parameters are needed for 4013 <1> ; loading same dir entry for first cluster update) 4014 0000B672 8915[56820100] <1> mov [DestinationFile_DirCluster], edx 4015 0000B678 66890D[5A820100] <1> mov [DestinationFile_DirEntryNumber], cx 4016 <1> 4017 <1> ; 30/08/2024 4018 <1> ; edx -> ecx 4019 <1> ; 21/03/2016 4020 0000B67F BE00000800 <1> mov esi, Directory_Buffer 4021 <1> ;shl edx, 5 ; 32 * index number 4022 0000B684 C1E105 <1> shl ecx, 5 4023 <1> ;add esi, edx 4024 0000B687 01CE <1> add esi, ecx 4025 0000B689 BF[32820100] <1> mov edi, DestinationFile_DirEntry 4026 <1> ;mov cl, 8 ; 32 bytes 4027 <1> ; 29/08/2024 4028 0000B68E 29C9 <1> sub ecx, ecx 4029 0000B690 B108 <1> mov cl,8 4030 0000B692 F3A5 <1> rep movsd 4031 <1> 4032 <1> ;mov cl, [esi] ; L.D.D.D.T. 4033 <1> ;mov [DestinationFile_Drv], cl 4034 <1> 4035 <1> csftdf2_set_sf_percentage: 4036 <1> ; 17/03/2016 4037 0000B694 31C0 <1> xor eax, eax 4038 0000B696 A2[B0820100] <1> mov [csftdf_percentage], al ; 0, reset 4039 <1> 4040 0000B69B A3[A8820100] <1> mov [csftdf_sf_rbytes], eax ; 0, reset 4041 0000B6A0 A3[AC820100] <1> mov [csftdf_df_wbytes], eax ; 0, reset 4042 <1> 4043 0000B6A5 8A25[60810100] <1> mov ah, [SourceFile_Drv] 4044 0000B6AB BE00010900 <1> mov esi, Logical_DOSDisks 4045 0000B6B0 01C6 <1> add esi, eax 4046 <1> 4047 0000B6B2 8935[B4820100] <1> mov [csftdf_sf_drv_dt], esi ; 23/03/2016 4048 <1> 4049 0000B6B8 668B15[C6810100] <1> mov dx, [SourceFile_DirEntry+DirEntry_FstClusHI] 4050 0000B6BF C1E210 <1> shl edx, 16 4051 0000B6C2 668B15[CC810100] <1> mov dx, [SourceFile_DirEntry+DirEntry_FstClusLO] 4052 0000B6C9 8915[98820100] <1> mov [csftdf_sf_cluster], edx 4053 <1> 4054 <1> ; 16/03/2016 4055 <1> ; Note: Singlix FS boot sector parameters (for cluster 4056 <1> ; related calculations) has same offset 4057 <1> ; values from LD_BPB as in FAT file system. 4058 <1> ; [esi+LD_BPB+SecPerClust] is 1 for Singlix FS. 4059 <1> ; 4060 0000B6CF 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+SecPerClust] 4061 0000B6D3 880D[DE810100] <1> mov [SourceFile_SecPerClust], cl 4062 <1> 4063 <1> ; 19/12/2025 4064 <1> %if 0 4065 <1> ; 17/03/2016 4066 <1> cmp [esi+LD_FATType], ch ; 0 4067 <1> ja short csftdf2_set_sf_percent_rsize1 4068 <1> 4069 <1> mov eax, 65536 ; read/write buffer size for Singlix FS 4070 <1> jmp short csftdf2_set_sf_percent_rsize2 4071 <1> %endif 4072 <1> 4073 <1> csftdf2_set_sf_percent_rsize1: 4074 <1> ;mov ax, [esi+LD_BPB+BytesPerSec] 4075 <1> ; 19/12/2025 4076 0000B6D9 66B80002 <1> mov ax, 512 4077 0000B6DD F7E1 <1> mul ecx 4078 <1> ;sub edx, edx 4079 <1> csftdf2_set_sf_percent_rsize2: 4080 0000B6DF A3[A0820100] <1> mov [csftdf_r_size], eax 4081 <1> 4082 <1> csftdf2_set_df_percentage: 4083 <1> ;sub eax, eax 4084 <1> ;mov ah, [DestinationFile_Drv] 4085 <1> ;mov edi, Logical_DOSDisks 4086 <1> ;add edi, eax 4087 <1> ;mov [csftdf_df_drv_dt], edi ; 17/03/2016 4088 <1> 4089 0000B6E4 8B3D[B8820100] <1> mov edi, [csftdf_df_drv_dt] ; 23/03/2016 4090 <1> 4091 <1> ; 16/03/2016 4092 <1> ; Note: Singlix FS boot sector parameters (for cluster 4093 <1> ; related calculations) has same offset 4094 <1> ; values from LD_BPB as in FAT file system. 4095 <1> ; [edi+LD_BPB+SecPerClust] is 1 for Singlix FS. 4096 <1> ; 4097 <1> ;movzx ecx, byte [edi+LD_BPB+SecPerClust] 4098 0000B6EA 8A4F13 <1> mov cl, [edi+LD_BPB+SecPerClust] 4099 0000B6ED 880D[5E820100] <1> mov [DestinationFile_SecPerClust], cl 4100 <1> 4101 <1> ; 19/12/2025 4102 <1> %if 0 4103 <1> ; 17/03/2016 4104 <1> cmp [edi+LD_FATType], ch ; 0 4105 <1> ja short csftdf2_set_df_percent_wsize1 4106 <1> 4107 <1> mov eax, 65536 ; read/write buffer size for Singlix FS 4108 <1> jmp short csftdf2_set_df_percent_wsize2 4109 <1> %endif 4110 <1> 4111 <1> csftdf2_set_df_percent_wsize1: 4112 <1> ;movzx eax, word [edi+LD_BPB+BytesPerSec] 4113 <1> ; 19/12/2025 4114 0000B6F3 B800020000 <1> mov eax, 512 4115 0000B6F8 F7E1 <1> mul ecx 4116 <1> ;sub edx, edx 4117 <1> csftdf2_set_df_percent_wsize2: 4118 0000B6FA A3[A4820100] <1> mov [csftdf_w_size], eax 4119 <1> 4120 0000B6FF A1[8C820100] <1> mov eax, [csftdf_filesize] 4121 <1> 4122 0000B704 3D00000100 <1> cmp eax, 65536 ; 64KB ; small file 4123 0000B709 721F <1> jb short csftdf2_load_file ; do not display percentage 4124 <1> 4125 <1> csftdf2_reset_wf_percent_ptr_chk_64k: 4126 0000B70B B201 <1> mov dl, 1 ; 25/03/2016 4127 <1> 4128 0000B70D 3D00000400 <1> cmp eax, 65536*4 ; 256KB 4129 0000B712 7310 <1> jnb short csftdf2_enable_percentage_display ; big file 4130 <1> 4131 <1> ; 64-128KB file size for floppy disks 4132 0000B714 3815[60810100] <1> cmp byte [SourceFile_Drv], dl ; 1 ; read from floppy disk ? 4133 0000B71A 7608 <1> jna short csftdf2_enable_percentage_display 4134 <1> 4135 0000B71C 3815[E0810100] <1> cmp byte [DestinationFile_Drv], dl ; 1 ; write to floppy disk ? 4136 0000B722 7706 <1> ja short csftdf2_load_file 4137 <1> 4138 <1> csftdf2_enable_percentage_display: 4139 0000B724 8815[B0820100] <1> mov [csftdf_percentage], dl ; 1 4140 <1> 4141 <1> csftdf2_load_file: 4142 <1> ; 13/05/2016 4143 <1> ; 19/03/2016 4144 <1> ; 18/03/2016 4145 <1> ; 17/03/2016 4146 0000B72A B40F <1> mov ah, 0Fh 4147 0000B72C E8E95FFFFF <1> call _int10h 4148 <1> ; 13/05/2016 4149 0000B731 883D[B1820100] <1> mov [csftdf_videopage], bh ; active video page 4150 0000B737 B403 <1> mov ah, 03h 4151 0000B739 E8DC5FFFFF <1> call _int10h 4152 0000B73E 668915[B2820100] <1> mov [csftdf_cursorpos], dx 4153 <1> 4154 0000B745 29C0 <1> sub eax, eax 4155 0000B747 A2[89820100] <1> mov [csftdf_rw_err], al ; 0 4156 <1> 4157 <1> ; /// 4158 <1> csftdf_sf_amb: ; 15/03/2016 4159 0000B74C 8B0D[8C820100] <1> mov ecx, [csftdf_filesize] ; 23/03/2016 4160 <1> 4161 <1> ; TRDOS 386 (TRDOS v2.0) 4162 <1> ; Allocate contiguous memory block for loading the file 4163 <1> 4164 <1> ;mov ecx, [SourceFile_DirEntry+DirEntry_FileSize] 4165 <1> 4166 <1> ;sub eax, eax ; First free memory aperture 4167 <1> 4168 <1> ; eax = 0 (Allocate memory from the beginning) 4169 <1> ; ecx = File (Allocation) size in bytes 4170 <1> 4171 <1> ; 31/08/2024 - temporary 4172 <1> ;%if 0 4173 0000B752 E8EEA5FFFF <1> call allocate_memory_block 4174 0000B757 7304 <1> jnc short loc_check_sf_save_loading_parms 4175 <1> ;%endif 4176 <1> 4177 <1> csftdf_use_cluster_buff: ; 27/08/2024 4178 <1> 4179 0000B759 29C0 <1> sub eax, eax 4180 0000B75B 29C9 <1> sub ecx, ecx 4181 <1> 4182 <1> loc_check_sf_save_loading_parms: 4183 0000B75D A3[90820100] <1> mov [csftdf_sf_mem_addr], eax ; loading address 4184 0000B762 890D[94820100] <1> mov [csftdf_sf_mem_bsize], ecx ; block size 4185 <1> ; /// 4186 <1> ; 19/03/2016 4187 0000B768 8B35[B4820100] <1> mov esi, [csftdf_sf_drv_dt] ; logical dos drv desc. tbl. 4188 <1> 4189 <1> ; 17/03/2016 4190 0000B76E 09C0 <1> or eax, eax ; contiguous free memory block address 4191 <1> ;jz csftdf2_read_sf_cluster 4192 <1> ; 29/07/2022 4193 0000B770 7505 <1> jnz short csftdf2_1 4194 0000B772 E949010000 <1> jmp csftdf2_read_sf_cluster 4195 <1> 4196 <1> csftdf2_1: 4197 <1> ; 18/03/2016 4198 0000B777 8B1D[90820100] <1> mov ebx, [csftdf_sf_mem_addr] ; memory block address 4199 <1> 4200 <1> ; 19/12/2025 4201 <1> %if 0 4202 <1> cmp byte [esi+LD_FATType], 0 4203 <1> ;jna csftdf2_load_fs_file 4204 <1> ; 29/07/2022 4205 <1> ja short csftdf2_load_fat_file 4206 <1> jmp csftdf2_load_fs_file 4207 <1> %endif 4208 <1> 4209 <1> csftdf2_load_fat_file: 4210 0000B77D 53 <1> push ebx ; * 4211 <1> 4212 <1> csftdf2_load_fat_file_next: 4213 0000B77E BE[E6340100] <1> mov esi, msg_reading 4214 0000B783 E832B6FFFF <1> call print_msg 4215 <1> 4216 0000B788 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4217 0000B78F 7605 <1> jna short csftdf2_load_fat_file_1 4218 <1> 4219 0000B791 E87E000000 <1> call csftdf2_print_percentage ; 19/03/2016 4220 <1> 4221 <1> csftdf2_load_fat_file_1: 4222 0000B796 8B35[B4820100] <1> mov esi, [csftdf_sf_drv_dt] 4223 0000B79C 5B <1> pop ebx ; * 4224 <1> 4225 <1> csftdf2_load_fat_file_2: 4226 0000B79D E8AF000000 <1> call csftdf2_read_fat_file_sectors ; 19/03/2016 4227 <1> ;jc csftdf2_rw_error ; eocc! or disk error! 4228 <1> ; 29/07/2022 4229 0000B7A2 7305 <1> jnc short csftdf2_load_fat_file_3 4230 0000B7A4 E93C040000 <1> jmp csftdf2_rw_error 4231 <1> csftdf2_load_fat_file_3: 4232 0000B7A9 09D2 <1> or edx, edx ; edx > 0 -> EOF 4233 0000B7AB 7520 <1> jnz short csftdf2_load_fat_file_ok 4234 <1> 4235 0000B7AD 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4236 0000B7B4 76E7 <1> jna short csftdf2_load_fat_file_2 4237 <1> 4238 0000B7B6 53 <1> push ebx ; * 4239 <1> 4240 <1> ; Set cursor position 4241 <1> ; AH= 02h, BH= Page Number, DH= Row, DL= Column 4242 0000B7B7 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4243 0000B7BD 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4244 0000B7C4 B402 <1> mov ah, 2 4245 0000B7C6 E84F5FFFFF <1> call _int10h 4246 0000B7CB EBB1 <1> jmp short csftdf2_load_fat_file_next 4247 <1> 4248 <1> csftdf2_load_fat_file_ok: 4249 0000B7CD 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4250 <1> ;jna csftdf2_save_file ; 25/03/2016 4251 <1> ; 29/07/2022 4252 0000B7D4 7705 <1> ja short csftdf2_2 4253 0000B7D6 E941020000 <1> jmp csftdf2_save_file 4254 <1> csftdf2_2: 4255 <1> ; "Reading... 100%" 4256 0000B7DB BF[FE340100] <1> mov edi, percentagestr 4257 0000B7E0 B031 <1> mov al, '1' 4258 0000B7E2 AA <1> stosb 4259 0000B7E3 B030 <1> mov al, '0' 4260 0000B7E5 AA <1> stosb 4261 0000B7E6 AA <1> stosb 4262 <1> 4263 0000B7E7 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4264 0000B7ED 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4265 0000B7F4 B402 <1> mov ah, 2 4266 0000B7F6 E81F5FFFFF <1> call _int10h 4267 <1> 4268 0000B7FB BE[E6340100] <1> mov esi, msg_reading 4269 0000B800 E8B5B5FFFF <1> call print_msg 4270 <1> 4271 0000B805 BE[FE340100] <1> mov esi, percentagestr 4272 0000B80A E8ABB5FFFF <1> call print_msg 4273 <1> 4274 0000B80F E908020000 <1> jmp csftdf2_save_file ; 25/03/2016 4275 <1> 4276 <1> csftdf2_print_percentage: 4277 <1> ; 09/12/2017 4278 <1> ; 19/03/2016 4279 <1> ; 18/03/2016 4280 0000B814 B020 <1> mov al, 20h 4281 0000B816 BF[FE340100] <1> mov edi, percentagestr 4282 0000B81B AA <1> stosb 4283 0000B81C AA <1> stosb 4284 0000B81D A1[A8820100] <1> mov eax, [csftdf_sf_rbytes] 4285 <1> ;mov edx, 100 4286 <1> ; 29/07/2022 4287 0000B822 29D2 <1> sub edx, edx 4288 0000B824 B264 <1> mov dl, 100 4289 0000B826 F7E2 <1> mul edx 4290 0000B828 8B0D[8C820100] <1> mov ecx, [csftdf_filesize] 4291 0000B82E F7F1 <1> div ecx 4292 0000B830 B10A <1> mov cl, 10 4293 0000B832 F6F1 <1> div cl 4294 0000B834 80C430 <1> add ah, '0' 4295 0000B837 8827 <1> mov [edi], ah 4296 0000B839 20C0 <1> and al, al 4297 0000B83B 740A <1> jz short csftdf2_print_percent_1 4298 0000B83D 4F <1> dec edi 4299 <1> ;cbw 4300 0000B83E 28E4 <1> sub ah, ah ; 09/12/2017 4301 0000B840 F6F1 <1> div cl 4302 0000B842 80C430 <1> add ah, '0' 4303 0000B845 8827 <1> mov [edi], ah 4304 <1> ;and al, al 4305 <1> ;jz short csftdf2_print_percent_1 4306 <1> ;dec edi 4307 <1> ;mov [edi], '1' ; 100% 4308 <1> 4309 <1> csftdf2_print_percent_1: 4310 0000B847 BE[FE340100] <1> mov esi, percentagestr 4311 <1> ;call print_msg 4312 <1> ;retn 4313 0000B84C E969B5FFFF <1> jmp print_msg 4314 <1> 4315 <1> csftdf2_read_file_sectors: 4316 <1> 4317 <1> ; 19/12/2025 4318 <1> %if 0 4319 <1> ; 19/03/2016 4320 <1> cmp byte [esi+LD_FATType], 0 4321 <1> ;jna csftdf2_read_fs_file_sectors 4322 <1> ; 29/07/2022 4323 <1> ja short csftdf2_read_fat_file_sectors 4324 <1> jmp csftdf2_read_fs_file_sectors 4325 <1> %endif 4326 <1> 4327 <1> csftdf2_read_fat_file_sectors: 4328 <1> ; 19/03/2016 4329 <1> ; 18/03/2016 4330 <1> ; return: 4331 <1> ; CF = 0 & EDX > 0 -> END OF FILE 4332 <1> ; CF = 0 & EDX = 0 -> not EOF 4333 <1> ; CF = 1 -> read error (error code in AL) 4334 <1> 4335 <1> csftdf2_read_fat_file_secs_0: 4336 0000B851 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4337 0000B857 2B15[A8820100] <1> sub edx, [csftdf_sf_rbytes] 4338 0000B85D 3B15[A0820100] <1> cmp edx, [csftdf_r_size] 4339 0000B863 7306 <1> jnb short csftdf2_read_fat_file_secs_1 4340 0000B865 8915[A0820100] <1> mov [csftdf_r_size], edx 4341 <1> 4342 <1> csftdf2_read_fat_file_secs_1: 4343 0000B86B A1[A0820100] <1> mov eax, [csftdf_r_size] 4344 0000B870 29D2 <1> sub edx, edx 4345 <1> ;movzx ecx, word [esi+LD_BPB+BytesPerSec] 4346 <1> ; 19/12/2025 4347 0000B872 B900020000 <1> mov ecx, 512 4348 0000B877 01C8 <1> add eax, ecx 4349 0000B879 48 <1> dec eax 4350 0000B87A F7F1 <1> div ecx 4351 0000B87C 89C1 <1> mov ecx, eax ; sector count 4352 0000B87E A1[98820100] <1> mov eax, [csftdf_sf_cluster] 4353 <1> 4354 <1> ; EBX = memory block address (current) 4355 <1> 4356 0000B883 E8F7080000 <1> call read_fat_file_sectors 4357 0000B888 7235 <1> jc short csftdf2_read_fat_file_secs_3 4358 <1> 4359 <1> ; EBX = next memory address 4360 <1> 4361 0000B88A A1[A8820100] <1> mov eax, [csftdf_sf_rbytes] 4362 0000B88F 0305[A0820100] <1> add eax, [csftdf_r_size] 4363 0000B895 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4364 0000B89B 39D0 <1> cmp eax, edx 4365 0000B89D 7320 <1> jnb short csftdf2_read_fat_file_secs_3 ; edx > 0 4366 0000B89F A3[A8820100] <1> mov [csftdf_sf_rbytes], eax 4367 <1> 4368 0000B8A4 53 <1> push ebx ; * 4369 <1> ; get next cluster (csftdf_r_size! bytes) 4370 0000B8A5 A1[98820100] <1> mov eax, [csftdf_sf_cluster] 4371 0000B8AA E8DA060000 <1> call get_next_cluster 4372 0000B8AF 5B <1> pop ebx ; * 4373 0000B8B0 7306 <1> jnc short csftdf2_read_fat_file_secs_2 4374 <1> 4375 <1> ; 15/10/2016 4376 <1> ; Disk read error instead of drv not ready err 4377 0000B8B2 B811000000 <1> mov eax, 17 ; Read error ! 4378 0000B8B7 C3 <1> retn 4379 <1> 4380 <1> csftdf2_read_fat_file_secs_2: 4381 0000B8B8 29D2 <1> sub edx, edx ; 0 4382 0000B8BA A3[98820100] <1> mov [csftdf_sf_cluster], eax ; next cluster 4383 <1> 4384 <1> csftdf2_read_fat_file_secs_3: 4385 0000B8BF C3 <1> retn 4386 <1> 4387 <1> csftdf2_read_sf_cluster: 4388 <1> ; 19/03/2016 4389 0000B8C0 BB00000700 <1> mov ebx, Cluster_Buffer ; buffer address (64KB) 4390 <1> 4391 0000B8C5 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4392 0000B8CC 760D <1> jna short csftdf2_read_sf_clust_2 4393 <1> 4394 0000B8CE 53 <1> push ebx ; * 4395 <1> 4396 <1> csftdf2_read_sf_clust_next: 4397 0000B8CF E840FFFFFF <1> call csftdf2_print_percentage 4398 <1> 4399 <1> csftdf2_read_sf_clust_0: 4400 0000B8D4 8B35[B4820100] <1> mov esi, [csftdf_sf_drv_dt] 4401 <1> csftdf2_read_sf_clust_1: 4402 0000B8DA 5B <1> pop ebx ; * 4403 <1> 4404 <1> csftdf2_read_sf_clust_2: 4405 0000B8DB 89DA <1> mov edx, ebx 4406 0000B8DD 0315[A0820100] <1> add edx, [csftdf_r_size] 4407 0000B8E3 81FA00000800 <1> cmp edx, Cluster_Buffer + 65536 4408 0000B8E9 772B <1> ja short csftdf2_write_df_cluster 4409 <1> 4410 0000B8EB E861FFFFFF <1> call csftdf2_read_file_sectors ; 19/03/2016 4411 <1> ;jc csftdf2_save_fat_file_err2 ; eocc! or disk error! 4412 <1> ; 29/07/2022 4413 0000B8F0 723C <1> jc short csftdf2_3 4414 <1> 4415 0000B8F2 09D2 <1> or edx, edx ; edx > 0 -> EOF 4416 0000B8F4 7520 <1> jnz short csftdf2_write_df_cluster 4417 <1> 4418 0000B8F6 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4419 0000B8FD 76DC <1> jna short csftdf2_read_sf_clust_2 4420 <1> 4421 0000B8FF 53 <1> push ebx ; * 4422 <1> 4423 <1> ; Set cursor position 4424 <1> ; AH= 02h, BH= Page Number, DH= Row, DL= Column 4425 0000B900 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4426 0000B906 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4427 0000B90D B402 <1> mov ah, 2 4428 0000B90F E8065EFFFF <1> call _int10h 4429 0000B914 EBB9 <1> jmp short csftdf2_read_sf_clust_next 4430 <1> 4431 <1> csftdf2_write_df_cluster: 4432 <1> 4433 <1> ; 31/08/2024 4434 <1> %if 1 4435 <1> ; 27/08/2024 4436 <1> ; 19/03/2016 4437 <1> ;mov esi, [csftdf_df_drv_dt] ; (!) 4438 <1> ;mov ebx, Cluster_Buffer ; buffer address (64KB) 4439 <1> ;;; 4440 <1> ; 27/08/2024 4441 0000B916 E8FF020000 <1> call csftdf2_update_df_fclust 4442 <1> ; 31/08/2024 4443 0000B91B 7305 <1> jnc short csftdf2_update_df_fclust_ok 4444 0000B91D E9C3020000 <1> jmp csftdf2_rw_error 4445 <1> 4446 <1> csftdf2_update_df_fclust_ok: 4447 <1> %endif 4448 <1> ; esi = [csftdf_df_drv_dt] 4449 <1> 4450 <1> ;mov esi, [csftdf_df_drv_dt] 4451 0000B922 BB00000700 <1> mov ebx, Cluster_Buffer ; buffer address (64KB) 4452 <1> 4453 <1> csftdf2_write_df_clust_next: 4454 0000B927 E85B000000 <1> call csftdf2_write_file_sectors ; 19/03/2016 4455 <1> ;jc csftdf2_save_fat_file_err2 ; eocc! or disk error! 4456 <1> ; 29/07/2022 4457 0000B92C 7305 <1> jnc short csftdf2_4 4458 <1> csftdf2_3: 4459 0000B92E E939020000 <1> jmp csftdf2_save_fat_file_err2 4460 <1> csftdf2_4: 4461 0000B933 09D2 <1> or edx, edx ; edx > 0 -> EOF 4462 0000B935 7513 <1> jnz short csftdf2_rw_f_clust_ok 4463 <1> 4464 0000B937 81FB00000800 <1> cmp ebx, Cluster_Buffer + 65536 4465 0000B93D 72E8 <1> jb short csftdf2_write_df_clust_next 4466 <1> 4467 <1> ; 31/08/2024 4468 0000B93F 8B35[B4820100] <1> mov esi, [csftdf_sf_drv_dt] 4469 <1> 4470 0000B945 E976FFFFFF <1> jmp csftdf2_read_sf_cluster ; 31/08/2024 4471 <1> 4472 <1> csftdf2_rw_f_clust_ok: 4473 0000B94A 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4474 <1> ;jna csftdf2_save_fat_file_4 ; 25/03/2016 4475 <1> ; 29/07/2022 4476 0000B951 762A <1> jna short csftdf2_5 4477 <1> 4478 <1> ; "100%" 4479 0000B953 BF[FE340100] <1> mov edi, percentagestr 4480 0000B958 B031 <1> mov al, '1' 4481 0000B95A AA <1> stosb 4482 0000B95B B030 <1> mov al, '0' 4483 0000B95D AA <1> stosb 4484 0000B95E AA <1> stosb 4485 <1> 4486 0000B95F 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4487 0000B965 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4488 0000B96C B402 <1> mov ah, 2 4489 0000B96E E8A75DFFFF <1> call _int10h 4490 <1> 4491 0000B973 BE[FE340100] <1> mov esi, percentagestr 4492 0000B978 E83DB4FFFF <1> call print_msg 4493 <1> csftdf2_5: 4494 0000B97D E974010000 <1> jmp csftdf2_save_fat_file_4 4495 <1> 4496 <1> csftdf2_load_fs_file: 4497 <1> ; temporary - 18/03/2016 4498 0000B982 E95C020000 <1> jmp csftdf2_read_error 4499 <1> 4500 <1> csftdf2_write_file_sectors: 4501 <1> 4502 <1> ; 19/12/2025 4503 <1> %if 0 4504 <1> ; 31/08/2024 4505 <1> ; 30/08/2024 4506 <1> ; 19/03/2016 4507 <1> cmp byte [esi+LD_FATType], 0 4508 <1> ;jna csftdf2_write_fs_file_sectors 4509 <1> ; 29/07/2022 4510 <1> ja short csftdf2_write_fat_file_sectors 4511 <1> jmp csftdf2_write_fs_file_sectors 4512 <1> %endif 4513 <1> 4514 <1> csftdf2_write_fat_file_sectors: 4515 <1> ; 30/08/2024 4516 <1> ; 19/03/2016 4517 <1> ; 18/03/2016 4518 <1> ; return: 4519 <1> ; CF = 0 & EDX > 0 -> END OF FILE 4520 <1> ; CF = 0 & EDX = 0 -> not EOF 4521 <1> ; CF = 1 -> write error (error code in AL) 4522 <1> 4523 <1> csftdf2_write_fat_file_secs_0: 4524 0000B987 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4525 0000B98D 2B15[AC820100] <1> sub edx, [csftdf_df_wbytes] 4526 0000B993 3B15[A4820100] <1> cmp edx, [csftdf_w_size] 4527 0000B999 7306 <1> jnb short csftdf2_write_fat_file_secs_1 4528 0000B99B 8915[A4820100] <1> mov [csftdf_w_size], edx 4529 <1> 4530 <1> csftdf2_write_fat_file_secs_1: 4531 <1> 4532 <1> ; 31/08/2024 4533 <1> %if 0 4534 <1> ;;; 4535 <1> ; 30/08/2024 4536 <1> mov eax, [csftdf_df_cluster] 4537 <1> and eax, eax 4538 <1> jnz short csftdf2_write_fat_file_secs_@ 4539 <1> push ebx 4540 <1> call add_new_cluster 4541 <1> pop ebx 4542 <1> jc short csftdf2_write_fat_file_secs_5 4543 <1> mov [csftdf_df_cluster], eax 4544 <1> csftdf2_write_fat_file_secs_@: 4545 <1> ;;; 4546 <1> %endif 4547 <1> 4548 0000B9A1 A1[A4820100] <1> mov eax, [csftdf_w_size] 4549 0000B9A6 29D2 <1> sub edx, edx 4550 <1> ;movzx ecx, word [esi+LD_BPB+BytesPerSec] 4551 <1> ; 19/12/2025 4552 0000B9A8 B900020000 <1> mov ecx, 512 4553 0000B9AD 01C8 <1> add eax, ecx 4554 0000B9AF 48 <1> dec eax 4555 0000B9B0 F7F1 <1> div ecx 4556 0000B9B2 89C1 <1> mov ecx, eax ; sector count 4557 0000B9B4 A1[9C820100] <1> mov eax, [csftdf_df_cluster] 4558 <1> 4559 <1> ; EBX = memory block address (current) 4560 <1> 4561 0000B9B9 E8DF0E0000 <1> call write_fat_file_sectors 4562 0000B9BE 7254 <1> jc short csftdf2_write_fat_file_secs_4 4563 <1> 4564 <1> ; EBX = next memory address 4565 <1> 4566 0000B9C0 A1[AC820100] <1> mov eax, [csftdf_df_wbytes] 4567 0000B9C5 0305[A4820100] <1> add eax, [csftdf_w_size] 4568 0000B9CB 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4569 0000B9D1 39D0 <1> cmp eax, edx 4570 0000B9D3 733F <1> jnb short csftdf2_write_fat_file_secs_4 4571 0000B9D5 A3[AC820100] <1> mov [csftdf_df_wbytes], eax 4572 <1> ; 4573 0000B9DA A3[4E820100] <1> mov [DestinationFile_DirEntry+DirEntry_FileSize], eax 4574 <1> 4575 <1> 4576 0000B9DF 53 <1> push ebx ; * 4577 <1> 4578 <1> ; 30/08/2024 4579 0000B9E0 A1[9C820100] <1> mov eax, [csftdf_df_cluster] ; last cluster 4580 <1> 4581 0000B9E5 803D[8A820100]01 <1> cmp byte [DestinationFileFound], 1 4582 0000B9EC 720B <1> jb short csftdf2_write_fat_file_secs_2 4583 <1> 4584 <1> ; get next cluster (csftdf_w_size! bytes) 4585 <1> ;mov eax, [csftdf_df_cluster] 4586 0000B9EE E896050000 <1> call get_next_cluster 4587 0000B9F3 7317 <1> jnc short csftdf2_write_fat_file_secs_3 4588 <1> 4589 0000B9F5 21C0 <1> and eax, eax ; end of cluster chain!? 4590 0000B9F7 751C <1> jnz short csftdf2_write_fat_file_secs_5 ; disk error ! 4591 <1> 4592 <1> csftdf2_write_fat_file_secs_2: 4593 <1> ;mov eax, [csftdf_df_cluster] ; last cluster 4594 <1> ; 30/08/2024 4595 0000B9F9 E80E0E0000 <1> call add_new_cluster 4596 0000B9FE 7215 <1> jc short csftdf2_write_fat_file_secs_5 4597 <1> 4598 <1> ; NOTE: Destination file size may be bigger than 4599 <1> ; source file size when the last reading fails after here. 4600 <1> ; (The last -empty- cluster of destination file must be 4601 <1> ; truncated and LMDT must be current date&time for partial 4602 <1> ; copy result!) 4603 0000BA00 8B15[A4820100] <1> mov edx, [csftdf_w_size] ; < = bytes per cluster 4604 0000BA06 0115[4E820100] <1> add [DestinationFile_DirEntry+DirEntry_FileSize], edx 4605 <1> 4606 <1> csftdf2_write_fat_file_secs_3: 4607 <1> ; 30/08/2024 4608 <1> ;pop ebx ; * 4609 0000BA0C 29D2 <1> sub edx, edx ; 0 4610 0000BA0E A3[9C820100] <1> mov [csftdf_df_cluster], eax ; next cluster 4611 <1> 4612 <1> ; 30/08/2024 4613 0000BA13 5B <1> pop ebx ; * 4614 <1> 4615 <1> csftdf2_write_fat_file_secs_4: 4616 0000BA14 C3 <1> retn 4617 <1> 4618 <1> csftdf2_write_fat_file_secs_5: 4619 0000BA15 5B <1> pop ebx ; * 4620 0000BA16 B812000000 <1> mov eax, 18 ; Write error ! 4621 <1> ; 16/10/2016 (1Dh -> 18) 4622 0000BA1B C3 <1> retn 4623 <1> 4624 <1> csftdf2_save_file: 4625 <1> ; 19/12/2025 4626 <1> ; 31/08/2024 4627 <1> ; 26/08/2024, 30/08/2024 4628 <1> ; 09/12/2017 4629 <1> ; 19/03/2016, 25/03/2016 4630 <1> ; 18/03/2016 4631 0000BA1C 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] ; logical dos drv desc. tbl. 4632 0000BA22 8B1D[90820100] <1> mov ebx, [csftdf_sf_mem_addr] ; memory block address 4633 <1> 4634 <1> ; 19/12/2025 4635 <1> %if 0 4636 <1> cmp byte [esi+LD_FATType], 0 4637 <1> ;jna csftdf2_save_fs_file 4638 <1> ; 29/07/2022 4639 <1> ja short csftdf2_save_fat_file 4640 <1> jmp csftdf2_save_fs_file 4641 <1> %endif 4642 <1> 4643 <1> csftdf2_save_fat_file: 4644 <1> 4645 <1> ; 31/08/2024 4646 <1> %if 1 4647 <1> ; 30/08/2024 4648 0000BA28 53 <1> push ebx ; * 4649 <1> ;;; 4650 <1> ; 27/08/2024 4651 <1> ;call csftdf2_update_df_fclust 4652 0000BA29 E8F2010000 <1> call csftdf2_update_df_fclust_@ ; 31/08/2024 4653 0000BA2E 5B <1> pop ebx ; * 4654 0000BA2F 7236 <1> jc short csftdf2_save_fat_file_err 4655 <1> ; esi = [csftdf_df_drv_dt] ; (*) 4656 <1> ;;; 4657 <1> %endif 4658 <1> 4659 0000BA31 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4660 0000BA38 7726 <1> ja short csftdf2_save_fat_file_0 ; 30/08/2024 4661 <1> 4662 0000BA3A 53 <1> push ebx ; ** 4663 <1> 4664 <1> ; Set cursor position 4665 <1> ; AH= 02h, BH= Page Number, DH= Row, DL= Column 4666 0000BA3B 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4667 0000BA41 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4668 0000BA48 B402 <1> mov ah, 2 4669 0000BA4A E8CB5CFFFF <1> call _int10h 4670 <1> 4671 0000BA4F BE[F2340100] <1> mov esi, msg_writing 4672 0000BA54 E861B3FFFF <1> call print_msg 4673 <1> 4674 <1> csftdf2_save_fat_file_next: 4675 0000BA59 5B <1> pop ebx ; ** 4676 <1> 4677 <1> ; 31/08/2024 4678 0000BA5A 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] 4679 <1> 4680 <1> csftdf2_save_fat_file_0: ; 30/08/2024 4681 <1> 4682 <1> csftdf2_save_fat_file_1: 4683 0000BA60 E822FFFFFF <1> call csftdf2_write_file_sectors ; 19/03/2016 4684 <1> ;jc csftdf2_rw_error ; eocc! or disk error! 4685 <1> ; 29/07/2022 4686 0000BA65 7305 <1> jnc short csftdf2_6 4687 <1> csftdf2_save_fat_file_err: ; 27/08/2024 4688 0000BA67 E979010000 <1> jmp csftdf2_rw_error 4689 <1> 4690 <1> csftdf2_6: 4691 0000BA6C 09D2 <1> or edx, edx ; edx > 0 -> EOF 4692 0000BA6E 756C <1> jnz short csftdf2_save_fat_file_3 ; 25/03/2016 4693 <1> 4694 0000BA70 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4695 0000BA77 76E7 <1> jna short csftdf2_save_fat_file_1 4696 <1> 4697 0000BA79 B020 <1> mov al, 20h 4698 0000BA7B BF[FE340100] <1> mov edi, percentagestr 4699 0000BA80 AA <1> stosb 4700 0000BA81 AA <1> stosb 4701 0000BA82 A1[AC820100] <1> mov eax, [csftdf_df_wbytes] 4702 <1> ;mov edx, 100 4703 <1> ; 29/07/2022 4704 0000BA87 31D2 <1> xor edx, edx 4705 0000BA89 B264 <1> mov dl, 100 4706 0000BA8B F7E2 <1> mul edx 4707 0000BA8D 8B0D[8C820100] <1> mov ecx, [csftdf_filesize] 4708 0000BA93 F7F1 <1> div ecx 4709 0000BA95 B10A <1> mov cl, 10 4710 0000BA97 F6F1 <1> div cl 4711 0000BA99 80C430 <1> add ah, '0' 4712 0000BA9C 8827 <1> mov [edi], ah 4713 0000BA9E 20C0 <1> and al, al 4714 0000BAA0 740A <1> jz short csftdf2_save_fat_file_2 4715 0000BAA2 4F <1> dec edi 4716 <1> ;cbw 4717 0000BAA3 30E4 <1> xor ah, ah ; 09/12/2017 4718 0000BAA5 F6F1 <1> div cl 4719 0000BAA7 80C430 <1> add ah, '0' 4720 0000BAAA 8827 <1> mov [edi], ah 4721 <1> ;and al, al 4722 <1> ;jz short csftdf2_save_fat_file_2 4723 <1> ;dec edi 4724 <1> ;mov [edi], '1' ; 100% 4725 <1> 4726 <1> csftdf2_save_fat_file_2: 4727 0000BAAC 53 <1> push ebx ; * 4728 <1> 4729 0000BAAD E802000000 <1> call csftdf2_print_wr_percentage ; 25/03/2016 4730 <1> 4731 0000BAB2 EBA5 <1> jmp csftdf2_save_fat_file_next 4732 <1> 4733 <1> csftdf2_print_wr_percentage: 4734 <1> ; Set cursor position 4735 <1> ; AH= 02h, BH= Page Number, DH= Row, DL= Column 4736 0000BAB4 8A3D[B1820100] <1> mov bh, [csftdf_videopage] 4737 0000BABA 668B15[B2820100] <1> mov dx, [csftdf_cursorpos] 4738 0000BAC1 B402 <1> mov ah, 2 4739 0000BAC3 E8525CFFFF <1> call _int10h 4740 <1> 4741 0000BAC8 BE[F2340100] <1> mov esi, msg_writing 4742 0000BACD E8E8B2FFFF <1> call print_msg 4743 <1> 4744 0000BAD2 BE[FE340100] <1> mov esi, percentagestr 4745 <1> ;call print_msg 4746 <1> ;retn 4747 0000BAD7 E9DEB2FFFF <1> jmp print_msg 4748 <1> 4749 <1> csftdf2_save_fat_file_3: 4750 0000BADC 803D[B0820100]00 <1> cmp byte [csftdf_percentage], 0 4751 <1> ;jna csftdf2_save_fat_file_4 ; 25/03/2016 4752 <1> ; 29/07/2022 4753 <1> ;ja short csftdf2_7 4754 <1> ;jmp csftdf2_save_fat_file_4 4755 <1> ; 31/08/2024 4756 0000BAE3 7611 <1> jna short csftdf2_save_fat_file_4 4757 <1> 4758 <1> csftdf2_7: 4759 <1> ; "100%" 4760 0000BAE5 BF[FE340100] <1> mov edi, percentagestr 4761 0000BAEA B031 <1> mov al, '1' 4762 0000BAEC AA <1> stosb 4763 0000BAED B030 <1> mov al, '0' 4764 0000BAEF AA <1> stosb 4765 0000BAF0 AA <1> stosb 4766 <1> 4767 0000BAF1 E8BEFFFFFF <1> call csftdf2_print_wr_percentage 4768 <1> 4769 <1> csftdf2_save_fat_file_4: 4770 0000BAF6 803D[8A820100]00 <1> cmp byte [DestinationFileFound], 0 4771 0000BAFD 7645 <1> jna short csftdf2_save_fat_file_6 4772 <1> 4773 0000BAFF 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] ; 31/03/2016 4774 <1> 4775 0000BB05 A1[9C820100] <1> mov eax, [csftdf_df_cluster] ; last cluster 4776 0000BB0A E87A040000 <1> call get_next_cluster 4777 0000BB0F 7233 <1> jc short csftdf2_save_fat_file_6 ; eocc! or disk error! 4778 <1> 4779 0000BB11 A1[9C820100] <1> mov eax, [csftdf_df_cluster] ; last cluster 4780 <1> ; 29/08/2024 4781 0000BB16 31C9 <1> xor ecx, ecx 4782 <1> ;mov [FAT_ClusterCounter], ecx ; 0 ; reset 4783 0000BB18 49 <1> dec ecx ; 0FFFFFFFFh 4784 <1> ;shr ecx, 4 ; 28 bit ; 0FFFFFFFh 4785 <1> ; 29/08/2024 4786 <1> ; (update_cluster will save 28 bit cluster value) 4787 <1> ;mov ecx, 0FFFFFFFh 4788 0000BB19 E852070000 <1> call update_cluster 4789 0000BB1E 7224 <1> jc short csftdf2_save_fat_file_6 ; really last cluster!? 4790 <1> 4791 0000BB20 A3[9C820100] <1> mov [csftdf_df_cluster], eax ; next cluster 4792 <1> 4793 <1> ; byte [FAT_BuffValidData] = 2 4794 0000BB25 E8BA090000 <1> call save_fat_buffer 4795 0000BB2A 730E <1> jnc short csftdf2_save_fat_file_5 4796 <1> 4797 0000BB2C 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4798 0000BB32 8915[4E820100] <1> mov [DestinationFile_DirEntry+DirEntry_FileSize], edx 4799 0000BB38 EB57 <1> jmp short csftdf2_save_fat_file_err3 4800 <1> 4801 <1> csftdf2_save_fat_file_5: 4802 0000BB3A A1[9C820100] <1> mov eax, [csftdf_df_cluster] 4803 <1> 4804 <1> ; EAX = First cluster to be truncated/unlinked 4805 <1> ; ESI = Logical dos drive description table address 4806 0000BB3F E8DA0B0000 <1> call truncate_cluster_chain 4807 <1> 4808 <1> csftdf2_save_fat_file_6: 4809 <1> ; 28/03/2016 4810 0000BB44 BE[BD810100] <1> mov esi, SourceFile_DirEntry+DirEntry_Attr ; +11 to + 18 4811 0000BB49 BF[3D820100] <1> mov edi, DestinationFile_DirEntry+DirEntry_Attr ; +11 to + 18 4812 0000BB4E A4 <1> movsb ; +11 4813 0000BB4F A5 <1> movsd ; +12 .. +15 4814 0000BB50 66A5 <1> movsw ; +16 .. +17 4815 <1> ; + 18 4816 0000BB52 83C604 <1> add esi, 4 4817 0000BB55 83C704 <1> add edi, 4 4818 0000BB58 A5 <1> movsd ; DirEntry_WrtTime ; +22 .. +25 4819 <1> 4820 0000BB59 8B15[8C820100] <1> mov edx, [csftdf_filesize] 4821 0000BB5F 8915[4E820100] <1> mov [DestinationFile_DirEntry+DirEntry_FileSize], edx 4822 <1> 4823 0000BB65 E892F1FFFF <1> call convert_current_date_time 4824 <1> ; DX = Date in dos dir entry format 4825 <1> ; AX = Time in dos dir entry format 4826 0000BB6A EB4C <1> jmp short csftdf2_save_fat_file_7 4827 <1> 4828 <1> ; 31/08/2024 4829 <1> ;csftdf2_save_fat_file_err1: 4830 <1> ;pop ebx ; * 4831 <1> 4832 <1> csftdf2_save_fat_file_err2: 4833 0000BB6C A1[AC820100] <1> mov eax, [csftdf_df_wbytes] 4834 0000BB71 8B15[4E820100] <1> mov edx, [DestinationFile_DirEntry+DirEntry_FileSize] 4835 0000BB77 39C2 <1> cmp edx, eax 4836 0000BB79 7616 <1> jna short csftdf2_save_fat_file_err3 4837 0000BB7B A1[9C820100] <1> mov eax, [csftdf_df_cluster] ; last (empty) cluster 4838 <1> ; ESI = Logical dos drive description table address 4839 0000BB80 E8990B0000 <1> call truncate_cluster_chain 4840 0000BB85 720A <1> jc short csftdf2_save_fat_file_err3 4841 0000BB87 A1[AC820100] <1> mov eax, [csftdf_df_wbytes] 4842 0000BB8C A3[4E820100] <1> mov [DestinationFile_DirEntry+DirEntry_FileSize], eax 4843 <1> csftdf2_save_fat_file_err3: 4844 0000BB91 E866F1FFFF <1> call convert_current_date_time 4845 <1> ; DX = Date in dos dir entry format 4846 <1> ; AX = Time in dos dir entry format 4847 0000BB96 C605[3F820100]00 <1> mov byte [DestinationFile_DirEntry+DirEntry_CrtTimeTenth], 0 4848 0000BB9D 66A3[40820100] <1> mov [DestinationFile_DirEntry+DirEntry_CrtTime], ax 4849 0000BBA3 668915[42820100] <1> mov [DestinationFile_DirEntry+DirEntry_CrtDate], dx 4850 0000BBAA 66A3[48820100] <1> mov [DestinationFile_DirEntry+DirEntry_WrtTime], ax 4851 0000BBB0 668915[4A820100] <1> mov [DestinationFile_DirEntry+DirEntry_WrtDate], dx 4852 0000BBB7 F9 <1> stc 4853 <1> csftdf2_save_fat_file_7: 4854 0000BBB8 9C <1> pushf 4855 0000BBB9 668915[44820100] <1> mov [DestinationFile_DirEntry+DirEntry_LastAccDate], dx 4856 0000BBC0 BE[32820100] <1> mov esi, DestinationFile_DirEntry 4857 0000BBC5 BF00000800 <1> mov edi, Directory_Buffer 4858 0000BBCA 0FB70D[5A820100] <1> movzx ecx, word [DestinationFile_DirEntryNumber] ; (<2048) 4859 <1> ;shl cx, 5 ; 32 * directory entry number 4860 <1> ; 29/07/2022 4861 0000BBD1 C1E105 <1> shl ecx, 5 4862 0000BBD4 01CF <1> add edi, ecx 4863 <1> ;mov ecx, 8 4864 <1> ;mov cx, 8 4865 <1> ; 31/08/2024 4866 <1> ; 29/07/2022 4867 0000BBD6 29C9 <1> sub ecx, ecx 4868 <1> ;sub ch, ch 4869 0000BBD8 B108 <1> mov cl, 8 4870 0000BBDA F3A5 <1> rep movsd 4871 0000BBDC 9D <1> popf 4872 0000BBDD 730B <1> jnc short csftdf2_write_file_OK 4873 <1> 4874 <1> csftdf2_write_error: 4875 <1> ; 18/03/2016 4876 <1> ;mov al, 1Dh ; write error 4877 <1> ; 31/08/2024 4878 0000BBDF B012 <1> mov al, ERR_DRV_WRITE ; 18 ; write error 4879 0000BBE1 EB02 <1> jmp short csftdf2_rw_error 4880 <1> 4881 <1> ; 16/03/2016 4882 <1> csftdf2_read_error: 4883 0000BBE3 B011 <1> mov al, 17 ; ; Drive not ready or read error! 4884 <1> csftdf2_rw_error: 4885 0000BBE5 A2[89820100] <1> mov [csftdf_rw_err], al 4886 <1> 4887 <1> csftdf2_write_file_OK: 4888 <1> ; 18/03/2016 4889 0000BBEA C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 4890 0000BBF1 E89BF1FFFF <1> call save_directory_buffer 4891 <1> 4892 <1> ; Update last modification date&time of destination 4893 <1> ; file's (parent) directory 4894 0000BBF6 E81FF2FFFF <1> call update_parent_dir_lmdt 4895 <1> ; 4896 0000BBFB A1[90820100] <1> mov eax, [csftdf_sf_mem_addr] ; start address 4897 <1> 4898 0000BC00 21C0 <1> and eax, eax 4899 0000BC02 7509 <1> jnz short csftdf2_dealloc_mblock 4900 <1> 4901 <1> ; 31/08/2024 4902 <1> ;mov ch, al ; 0 (Cluster r/w, not full loading) 4903 <1> csftdf2_dealloc_retn: 4904 <1> ;mov cl, [csftdf_rw_err] 4905 <1> ;mov eax, [csftdf_df_cluster] 4906 <1> ; 31/08/2024 4907 0000BC04 A0[89820100] <1> mov al, [csftdf_rw_err] 4908 0000BC09 3C01 <1> cmp al, 1 4909 0000BC0B F5 <1> cmc 4910 <1> ; if al > 0 -> cf = 1 4911 <1> csftdf2_write_df_error: ; 31/08/2024 4912 <1> csftdf2_write_df_clust_@@: ; 31/08/2024 4913 0000BC0C C3 <1> retn 4914 <1> 4915 <1> csftdf2_dealloc_mblock: 4916 0000BC0D 8B0D[94820100] <1> mov ecx, [csftdf_sf_mem_bsize] ; block size 4917 0000BC13 E847A3FFFF <1> call deallocate_memory_block 4918 <1> ; 31/08/2024 4919 <1> ;mov ch, 0FFh ; (File was full loaded at memory) 4920 0000BC18 EBEA <1> jmp short csftdf2_dealloc_retn 4921 <1> 4922 <1> ;;;; 4923 <1> csftdf2_update_df_fclust: 4924 <1> ; 31/08/2024 4925 <1> ; 27/08/2024 - TRDOS 386 v2.0.9 4926 <1> ; update (directory entry of) 4927 <1> ; the new (created) destination file 4928 <1> ; with new first cluster (it was 0 before) 4929 <1> 4930 0000BC1A 8B35[B8820100] <1> mov esi, [csftdf_df_drv_dt] ; (!) 4931 <1> 4932 <1> csftdf2_update_df_fclust_@: ; 31/08/2024 4933 0000BC20 A1[9C820100] <1> mov eax, [csftdf_df_cluster] 4934 0000BC25 21C0 <1> and eax, eax 4935 0000BC27 75E3 <1> jnz short csftdf2_write_df_clust_@@ 4936 <1> ; if eax = 0, add new cluster 4937 <1> ; 31/08/2024 4938 <1> %if 0 4939 <1> call get_first_free_cluster 4940 <1> jc short csftdf2_write_df_error 4941 <1> ; EAX >= 2 and EAX < FFFFFFFFh is valid 4942 <1> 4943 <1> cmp eax, 0FFFFFFFFh ; no free space 4944 <1> jne short csftdf2_write_df_clust_@ 4945 <1> inc eax ; 0 4946 <1> stc 4947 <1> mov al, 27h ; insufficient disk space 4948 <1> csftdf2_write_df_error: 4949 <1> retn 4950 <1> %else 4951 <1> ; 31/08/2024 4952 0000BC29 E8DE0B0000 <1> call add_new_cluster 4953 0000BC2E 72DC <1> jc short csftdf2_write_df_error 4954 <1> %endif 4955 <1> 4956 <1> csftdf2_write_df_clust_@: 4957 <1> ; 31/08/2024 4958 0000BC30 A3[9C820100] <1> mov [csftdf_df_cluster], eax 4959 <1> ; 4960 <1> ; eax = (new) first cluster 4961 0000BC35 56 <1> push esi 4962 0000BC36 BE[32820100] <1> mov esi, DestinationFile_DirEntry 4963 0000BC3B 0FB73D[5A820100] <1> movzx edi, word [DestinationFile_DirEntryNumber] 4964 0000BC42 C1E705 <1> shl edi, 5 ; 32 * index number 4965 0000BC45 81C700000800 <1> add edi, Directory_Buffer 4966 0000BC4B C1C010 <1> rol eax, 16 4967 0000BC4E 66894614 <1> mov [esi+DirEntry_FstClusHI],ax 4968 0000BC52 C1C810 <1> ror eax, 16 4969 0000BC55 6689461A <1> mov [esi+DirEntry_FstClusLO],ax 4970 0000BC59 B908000000 <1> mov ecx, 8 ; 32 bytes 4971 0000BC5E F3A5 <1> rep movsd 4972 0000BC60 5E <1> pop esi 4973 <1> ; 4974 0000BC61 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 ; change sign 4975 <1> 4976 <1> ; 31/08/2024 4977 <1> %if 0 4978 <1> call save_directory_buffer 4979 <1> jc short csftdf2_write_df_error 4980 <1> ; 4981 <1> ; +1 cluster is in use (as first cluster) 4982 <1> mov ebx, [esi+LD_FreeSectors] 4983 <1> inc ebx ; 0FFFFFFFFh ? invalid ? 4984 <1> jz short csftdf2_write_df_clust_@@ ; yes 4985 <1> xor ebx, ebx 4986 <1> mov bl, [esi+LD_BPB+BPB_SecPerClust] 4987 <1> sub [esi+LD_FreeSectors], ebx 4988 <1> ; 4989 <1> csftdf2_write_df_clust_@@: 4990 <1> retn 4991 <1> ;;;; 4992 <1> %else 4993 <1> ; 31/08/2024 4994 0000BC68 E924F1FFFF <1> jmp save_directory_buffer 4995 <1> %endif 4996 <1> 4997 <1> csftdf2_save_fs_file: 4998 <1> ; 16/10/2016 (1Dh -> 18) 4999 <1> ; temporary - (21/03/2016) 5000 <1> ;mov eax, 18 ; write error 5001 <1> ; 29/07/2022 5002 0000BC6D 31C0 <1> xor eax, eax 5003 0000BC6F B012 <1> mov al, 18 5004 0000BC71 F9 <1> stc 5005 0000BC72 C3 <1> retn 5006 <1> 5007 <1> create_file: 5008 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 5009 <1> ; 31/08/2024 5010 <1> ; 29/08/2024 5011 <1> ; 27/08/2024 5012 <1> ; 26/08/2024 (TRDOS 386 v2.0.9) 5013 <1> ; 30/07/2022 5014 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 5015 <1> ; 16/10/2016 5016 <1> ; 24/03/2016, 31/03/2016 5017 <1> ; 20/03/2016, 21/03/2016, 23/03/2016 5018 <1> ; 19/03/2016 (TRDOS 396 = TRDOS v2.0) 5019 <1> ; 03/09/2011 (FILE.ASM, 'proc_create_file') 5020 <1> ; 09/08/2010 5021 <1> ; 5022 <1> ; INPUT -> 5023 <1> ; EAX = File Size 5024 <1> ; ESI = ASCIIZ File Name 5025 <1> ; CL = File Attributes 5026 <1> ; EBX = FFFFFFFFh -> create empty file 5027 <1> ; (only for FAT fs) 5028 <1> ; OUTPUT -> 5029 <1> ; EAX = New file's first cluster 5030 <1> ; (0 for empty file) ; 29/08/2024 5031 <1> ; ESI = Logical Dos Drv Descr. Table Addr. 5032 <1> ; ;EBX = CreateFile_Size address 5033 <1> ; ;ECX = Sectors per cluster (<256) 5034 <1> ; ;EDX = Directory Entry Index/Number (<65536) 5035 <1> ; ; 29/08/2024 5036 <1> ; EBX = File Size (0 for a new, empty file) 5037 <1> ; ECX = Directory Entry Index/Number (<2048) 5038 <1> ; (in directory cluster, not in directory) 5039 <1> ; EDX = Directory Cluster Number (of the file) 5040 <1> ; 5041 <1> ; cf = 1 -> error code in AL (EAX) 5042 <1> ; 5043 <1> ; (Modified registers: eax, ebx, ecx, edx, esi, edi) 5044 <1> ; 5045 <1> 5046 <1> ; test cl, 18h (directory or volume name) 5047 <1> ; jnz short loc_createfile_access_denied 5048 0000BC73 80E107 <1> and cl, 07h ; S, H, R 5049 0000BC76 880D[D8820100] <1> mov [createfile_attrib], cl 5050 <1> 5051 0000BC7C 89D9 <1> mov ecx, ebx 5052 0000BC7E 89F3 <1> mov ebx, esi ; ASCIIZ File Name address 5053 0000BC80 29D2 <1> sub edx, edx 5054 0000BC82 8A35[76770100] <1> mov dh, [Current_Drv] 5055 0000BC88 BE00010900 <1> mov esi, Logical_DOSDisks 5056 0000BC8D 01D6 <1> add esi, edx 5057 <1> 5058 0000BC8F 8815[E1820100] <1> mov [createfile_UpdatePDir], dl ; 0 ; 31/03/2016 5059 <1> 5060 <1> ; LD_DiskType = 0 for write protection (read only) 5061 0000BC95 807E0101 <1> cmp byte [esi+LD_DiskType], 1 ; 0 = Invalid 5062 0000BC99 7308 <1> jnb short loc_createfile_check_file_sytem 5063 <1> ; 16/10/2016 (TRDOS Error code: 30, disk write protected) 5064 <1> ;mov eax, 30 ; 13h, MSDOS err : Disk write-protected 5065 <1> ;mov dx, 0 5066 <1> ; 29/07/2022 5067 0000BC9B 31D2 <1> xor edx, edx ; 0 5068 0000BC9D 31C0 <1> xor eax, eax ; 0 5069 0000BC9F B01E <1> mov al, 30 5070 0000BCA1 F9 <1> stc 5071 <1> ; err retn: EDX = 0, EBX = File name offset 5072 <1> ; ESI -> Dos drive description table address 5073 0000BCA2 C3 <1> retn 5074 <1> 5075 <1> ;loc_createfile_access_denied: 5076 <1> ; mov eax, 05h ; access denied (invalid attributes input) 5077 <1> ; stc 5078 <1> ; retn 5079 <1> 5080 <1> loc_createfile_check_file_sytem: 5081 <1> ; 27/08/2024 5082 0000BCA3 A3[C4820100] <1> mov [createfile_size], eax 5083 <1> 5084 <1> ; 19/12/2025 5085 <1> %if 0 5086 <1> cmp byte [esi+LD_FATType], 1 5087 <1> jnb short loc_createfile_chk_empty_FAT_file_sign1 5088 <1> 5089 <1> ; 27/08/2024 5090 <1> ;mov [createfile_size], eax 5091 <1> ; ESI = Logical Dos Drive Description Table address 5092 <1> ; EBX = ASCIIZ File Name address 5093 <1> jmp create_fs_file 5094 <1> %endif 5095 <1> 5096 <1> loc_createfile_chk_empty_FAT_file_sign1: 5097 <1> ; ECX = FFFFFFFFh -> create empty file if drive has FAT fs 5098 0000BCA8 41 <1> inc ecx 5099 0000BCA9 7506 <1> jnz short loc_createfile_chk_empty_FAT_file_sign2 5100 <1> 5101 0000BCAB 890D[C4820100] <1> mov [createfile_size], ecx ; 0 ; empty file 5102 <1> 5103 <1> loc_createfile_chk_empty_FAT_file_sign2: 5104 <1> ; 19/12/2025 5105 <1> ; 23/03/2016 5106 <1> ;mov cx, [esi+LD_BPB+BytesPerSec] 5107 <1> ;mov [createfile_BytesPerSec], cx 5108 <1> 5109 <1> ; EBX = ASCIIZ File Name address 5110 0000BCB1 0FB65613 <1> movzx edx, byte [esi+LD_BPB+SecPerClust] 5111 0000BCB5 8815[D9820100] <1> mov [createfile_SecPerClust], dl 5112 0000BCBB 8B4E74 <1> mov ecx, [esi+LD_FreeSectors] 5113 0000BCBE 39D1 <1> cmp ecx, edx ; byte [createfile_SecPerClust] 5114 0000BCC0 7306 <1> jnb short loc_create_fat_file 5115 <1> 5116 <1> loc_createfile_insufficient_disk_space: 5117 0000BCC2 B827000000 <1> mov eax, 27h 5118 <1> loc_createfile_gffc_retn: 5119 0000BCC7 C3 <1> retn 5120 <1> 5121 <1> loc_create_fat_file: 5122 0000BCC8 891D[BC820100] <1> mov [createfile_Name_Offset], ebx 5123 0000BCCE 890D[C0820100] <1> mov [createfile_FreeSectors], ecx 5124 <1> 5125 <1> ; 27/08/2024 5126 <1> ;loc_createfile_gffc_1: 5127 <1> ;call get_first_free_cluster 5128 <1> ;jc short loc_createfile_gffc_retn 5129 <1> ; 5130 <1> ;mov [createfile_FFCluster], eax 5131 <1> 5132 <1> loc_createfile_locate_ffe_on_directory: 5133 <1> ; Current directory fcluster <> Directory buffer cluster 5134 <1> ; Current directory will be reloaded by 5135 <1> ; 'locate_current_dir_file' procedure 5136 <1> ; 5137 <1> ; ESI = Logical Dos Drv Desc. Table Adress 5138 0000BCD4 56 <1> push esi ; * 5139 0000BCD5 31C0 <1> xor eax, eax 5140 <1> 5141 0000BCD7 A3[927E0100] <1> mov [FAT_ClusterCounter], eax ; 0 5142 <1> ; 21/03/2016 5143 0000BCDC A2[E0820100] <1> mov [createfile_wfc], al ; 0 5144 <1> 5145 0000BCE1 89C1 <1> mov ecx, eax 5146 0000BCE3 6649 <1> dec cx ; FFFFh 5147 <1> ; CX = FFFFh -> find first deleted or free entry 5148 <1> ; ESI would be ASCIIZ filename address if the call 5149 <1> ; would not be for first free or deleted dir entry 5150 0000BCE5 E81EE9FFFF <1> call locate_current_dir_file 5151 <1> ;jnc loc_createfile_set_ff_dir_entry 5152 <1> ; 29/07/2022 5153 0000BCEA 7205 <1> jc short loc_createfile_locate_file_err 5154 <1> ; 26/08/2024 5155 <1> ; cl = 0FFh, ch=0 or ch=0E5h 5156 <1> ; 27/08/2024 5157 <1> ;xor ecx, ecx ; 26/08/2024 5158 0000BCEC E9DA000000 <1> jmp loc_createfile_set_ff_dir_entry 5159 <1> 5160 <1> loc_createfile_locate_file_err: ; 29/07/2022 5161 0000BCF1 5E <1> pop esi ; * 5162 <1> ; ESI = Logical DOS Drv. Description Table Address 5163 0000BCF2 83F802 <1> cmp eax, 2 5164 0000BCF5 7402 <1> je short loc_createfile_add_new_cluster 5165 <1> loc_createfile_locate_file_stc_retn: 5166 0000BCF7 F9 <1> stc 5167 0000BCF8 C3 <1> retn 5168 <1> 5169 <1> loc_createfile_add_new_cluster: 5170 0000BCF9 803D[75770100]02 <1> cmp byte [Current_FATType], 2 5171 <1> ;cmp byte [esi+LD_FATType], 2 5172 0000BD00 770C <1> ja short loc_createfile_add_new_cluster_check_fsc 5173 0000BD02 803D[74770100]01 <1> cmp byte [Current_Dir_Level], 1 5174 <1> ;cmp byte [esi+LD_CDirLevel], 1 5175 0000BD09 7303 <1> jnb short loc_createfile_add_new_cluster_check_fsc 5176 <1> 5177 <1> ;mov eax, 12 5178 0000BD0B B00C <1> mov al, 12 ; No more files 5179 <1> 5180 <1> loc_createfile_anc_retn: 5181 0000BD0D C3 <1> retn 5182 <1> 5183 <1> loc_createfile_add_new_cluster_check_fsc: 5184 0000BD0E 8B0D[C0820100] <1> mov ecx, [createfile_FreeSectors] 5185 0000BD14 0FB605[D9820100] <1> movzx eax, byte [createfile_SecPerClust] 5186 <1> ;shl ax, 1 ; AX = 2 * AX 5187 <1> ; 29/07/2022 5188 0000BD1B D1E0 <1> shl eax, 1 5189 0000BD1D 39C1 <1> cmp ecx, eax 5190 0000BD1F 72A1 <1> jb short loc_createfile_insufficient_disk_space 5191 <1> 5192 <1> loc_createfile_add_new_subdir_cluster: 5193 0000BD21 8B15[A27E0100] <1> mov edx, [DirBuff_Cluster] 5194 0000BD27 8915[CC820100] <1> mov [createfile_LastDirCluster], edx 5195 <1> 5196 <1> ; 27/08/2024 5197 <1> ;;; 5198 0000BD2D E869040000 <1> call get_first_free_cluster 5199 0000BD32 72D9 <1> jc short loc_createfile_anc_retn 5200 0000BD34 A3[C8820100] <1> mov [createfile_FFCluster], eax 5201 <1> ;;; 5202 <1> ; 27/08/2024 5203 <1> ;;; 5204 <1> ;mov eax, [createfile_FFCluster] 5205 <1> ; eax = cluster address of the new directory sector 5206 <1> ;;; 5207 <1> 5208 0000BD39 E807040000 <1> call load_FAT_sub_directory 5209 0000BD3E 72CD <1> jc short loc_createfile_anc_retn 5210 <1> 5211 <1> ; 27/08/2024 5212 <1> ; [DirBuff_Cluster] = [createfile_FFCluster] 5213 <1> 5214 <1> pass_createfile_add_new_subdir_cluster: 5215 <1> ; clear directory buffer (new dir sector) ; 27/08/2024 5216 <1> ;;movzx eax, word [esi+LD_BPB+BytesPerSec] 5217 <1> ;movzx eax, word [createfile_BytesPerSec] ; 23/03/2016 5218 <1> ; 19/12/2025 5219 <1> ;mov eax, 512 5220 <1> ; ecx = directory buffer sector count 5221 <1> ; (sectors per cluster) 5222 <1> ;mul ecx 5223 <1> ;mov ecx, eax 5224 <1> ; (bytes per cluster or directory buffer size) 5225 <1> ;shr ecx, 2 ; dword count 5226 <1> ; 19/12/2025 5227 0000BD40 C1E107 <1> shl ecx, 7 ; 512/4 (dword count) 5228 <1> 5229 0000BD43 29C0 <1> sub eax, eax ; 0 5230 0000BD45 F3AB <1> rep stosd 5231 <1> ; 5232 0000BD47 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 5233 0000BD4E E83EF0FFFF <1> call save_directory_buffer 5234 0000BD53 72B8 <1> jc short loc_createfile_anc_retn 5235 <1> 5236 <1> loc_createfile_save_added_subdir_cluster: 5237 0000BD55 A1[CC820100] <1> mov eax, [createfile_LastDirCluster] 5238 0000BD5A 8B0D[C8820100] <1> mov ecx, [createfile_FFCluster] 5239 0000BD60 E80B050000 <1> call update_cluster 5240 0000BD65 7304 <1> jnc short loc_createfile_save_fat_buffer_0 5241 0000BD67 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 5242 0000BD69 7518 <1> jnz short loc_createfile_save_fat_buffer_stc_retn 5243 <1> 5244 <1> loc_createfile_save_fat_buffer_0: 5245 0000BD6B A1[C8820100] <1> mov eax, [createfile_FFCluster] 5246 0000BD70 A3[CC820100] <1> mov [createfile_LastDirCluster], eax 5247 <1> ;mov ecx, 0FFFFFFFh ; 28 bit 5248 <1> ; 29/08/2024 5249 <1> ; (update_cluster will save 28 bit cluster value) 5250 <1> ;mov ecx, 0FFFFFFFFh 5251 0000BD75 29C9 <1> sub ecx, ecx 5252 0000BD77 49 <1> dec ecx ; 0FFFFFFFFh 5253 0000BD78 E8F3040000 <1> call update_cluster 5254 0000BD7D 7306 <1> jnc short loc_createfile_save_fat_buffer_1 5255 0000BD7F 09C0 <1> or eax, eax ; Was it EOF ? 5256 0000BD81 7402 <1> jz short loc_createfile_save_fat_buffer_1 ; yes 5257 <1> 5258 <1> loc_createfile_save_fat_buffer_stc_retn: 5259 0000BD83 F9 <1> stc 5260 <1> loc_createfile_save_fat_buffer_retn: 5261 <1> loc_createfile_gffc_2_stc_retn: 5262 0000BD84 C3 <1> retn 5263 <1> 5264 <1> loc_createfile_save_fat_buffer_1: 5265 <1> ; byte [FAT_BuffValidData] = 2 5266 0000BD85 E85A070000 <1> call save_fat_buffer 5267 0000BD8A 72F8 <1> jc short loc_createfile_save_fat_buffer_retn 5268 <1> 5269 0000BD8C 803D[927E0100]01 <1> cmp byte [FAT_ClusterCounter], 1 5270 0000BD93 7222 <1> jb short loc_createfile_save_fat_buffer_2 5271 <1> 5272 <1> ; ESI = Logical DOS Drive Description Table address 5273 0000BD95 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 5274 <1> 5275 0000BD9A C605[927E0100]00 <1> mov byte [FAT_ClusterCounter], 0 ; 21/03/2016 5276 <1> 5277 0000BDA1 66BB01FF <1> mov bx, 0FF01h ; add free clusters 5278 0000BDA5 E8C7070000 <1> call calculate_fat_freespace 5279 <1> 5280 <1> ;inc eax ; 0FFFFFFFFh -> 0 ; recalculation is needed! 5281 <1> ;jnz short loc_createfile_save_fat_buffer_2 5282 <1> 5283 <1> ; ecx > 0 -> Recalculation is needed 5284 0000BDAA 09C9 <1> or ecx, ecx 5285 0000BDAC 7409 <1> jz short loc_createfile_save_fat_buffer_2 5286 <1> 5287 0000BDAE 66BB00FF <1> mov bx, 0FF00h ; recalculate free space 5288 0000BDB2 E8BA070000 <1> call calculate_fat_freespace 5289 <1> 5290 <1> loc_createfile_save_fat_buffer_2: 5291 <1> ;call update_parent_dir_lmdt 5292 <1> 5293 <1> ; 27/08/2024 5294 <1> ;loc_createfile_gffc_2: 5295 <1> ;call get_first_free_cluster 5296 <1> ;jc short loc_createfile_gffc_2_stc_retn 5297 <1> ; 5298 <1> ;mov [createfile_FFCluster], eax 5299 <1> ; 5300 <1> 5301 0000BDB7 A1[CC820100] <1> mov eax, [createfile_LastDirCluster] 5302 <1> 5303 0000BDBC E884030000 <1> call load_FAT_sub_directory 5304 0000BDC1 72C1 <1> jc short loc_createfile_gffc_2_stc_retn 5305 <1> 5306 0000BDC3 BF00000800 <1> mov edi, Directory_Buffer 5307 <1> 5308 <1> ; 27/08/2024 5309 <1> ;sub bx, bx ; directory entry index/number = 0 5310 0000BDC8 29DB <1> sub ebx, ebx 5311 <1> ; 29/07/2022 5312 <1> ;sub ecx, ecx 5313 <1> 5314 0000BDCA 56 <1> push esi ; * ; 23/03/2016 5315 <1> 5316 <1> loc_createfile_set_ff_dir_entry: 5317 <1> ;;; 5318 <1> ; 29/08/2024 5319 0000BDCB A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 5320 0000BDD0 A3[CC820100] <1> mov [createfile_LastDirCluster], eax 5321 <1> ;;; 5322 <1> 5323 <1> ; 27/08/2024 5324 0000BDD5 66891D[DA820100] <1> mov [createfile_DirIndex], bx 5325 <1> ; 29/07/2022 5326 <1> ;mov [createfile_DirIndex], cx ; 0 5327 <1> 5328 <1> ;;; 5329 0000BDDC A1[C4820100] <1> mov eax, [createfile_size] 5330 0000BDE1 09C0 <1> or eax, eax 5331 0000BDE3 740A <1> jz short loc_createfile_sffc 5332 <1> ; 31/08/2024 5333 0000BDE5 8B3424 <1> mov esi, [esp] ; * ; LDDDT address 5334 0000BDE8 E8AE030000 <1> call get_first_free_cluster 5335 0000BDED 7295 <1> jc short loc_createfile_gffc_2_stc_retn 5336 <1> loc_createfile_sffc: 5337 0000BDEF A3[C8820100] <1> mov [createfile_FFCluster], eax 5338 0000BDF4 29C9 <1> sub ecx, ecx ; 0 5339 <1> ;;; 5340 <1> 5341 <1> ; EDI = Directory entry address 5342 0000BDF6 8B35[BC820100] <1> mov esi, [createfile_Name_Offset] 5343 <1> ;;; 5344 <1> ; 27/08/2024 5345 <1> ;mov eax, [createfile_FFCluster] 5346 <1> ;;; 5347 0000BDFC A3[D0820100] <1> mov [createfile_Cluster], eax ; 24/03/2016 5348 <1> ;mov ch, 0FFh 5349 <1> ; 29/07/2022 5350 <1> ; ecx = 0 5351 0000BE01 FECD <1> dec ch ; 0 -> 0FFh 5352 0000BE03 8A0D[D8820100] <1> mov cl, [createfile_attrib] ; file attributes 5353 <1> ; CH > 0 -> File size is in [EBX] 5354 0000BE09 BB[C4820100] <1> mov ebx, createfile_size 5355 <1> 5356 0000BE0E E8ABEEFFFF <1> call make_directory_entry 5357 <1> 5358 0000BE13 5E <1> pop esi ; * ; ESI = Logical Dos Drv Desc. Table address 5359 <1> 5360 0000BE14 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 5361 0000BE1B E871EFFFFF <1> call save_directory_buffer 5362 0000BE20 7213 <1> jc short loc_createfile_set_ff_dir_entry_retn 5363 <1> 5364 0000BE22 C605[E1820100]01 <1> mov byte [createfile_UpdatePDir], 1 ; 31/03/2016 5365 <1> 5366 <1> loc_createfile_get_set_write_file_cluster: 5367 0000BE29 A1[C4820100] <1> mov eax, [createfile_size] 5368 0000BE2E 09C0 <1> or eax, eax ; 0 ? 5369 0000BE30 755B <1> jnz short loc_createfile_get_set_wfc_cont ; no 5370 0000BE32 40 <1> inc eax ; eax = 1 5371 <1> 5372 <1> ; 27/08/2024 (empty file) 5373 <1> ;;; 5374 <1> ; 23/03/2016 5375 <1> ;movzx ebx, byte [createfile_SecPerClust] 5376 <1> ;;movzx ecx, word [esi+LD_BPB+BytesPerSec] ; 512 5377 <1> ;movzx ecx, word [createfile_BytesPerSec] ; 512 5378 <1> ;;; 5379 0000BE33 EB72 <1> jmp loc_createfile_set_cluster_count 5380 <1> 5381 <1> loc_createfile_set_ff_dir_entry_retn: 5382 0000BE35 C3 <1> retn 5383 <1> 5384 <1> loc_createfile_write_fcluster_to_disk: 5385 0000BE36 034668 <1> add eax, [esi+LD_DATABegin] ; convert to physical address 5386 0000BE39 BB00000700 <1> mov ebx, Cluster_Buffer 5387 <1> ; ESI = Logical DOS Drv. Desc. Tbl. address 5388 <1> ; EAX = Disk address 5389 <1> ; EBX = Sector Buffer 5390 <1> ; ECX = sectors per cluster 5391 0000BE3E E8A15B0000 <1> call disk_write 5392 0000BE43 7211 <1> jc short loc_createfile_dsk_wr_err 5393 <1> 5394 <1> loc_createfile_update_fat_cluster: 5395 <1> ; 21/03/2016 5396 0000BE45 803D[E0820100]00 <1> cmp byte [createfile_wfc], 0 5397 0000BE4C 7711 <1> ja short loc_createfile_update_fat_cluster_n1 5398 <1> 5399 0000BE4E FE05[E0820100] <1> inc byte [createfile_wfc] ; 1 5400 0000BE54 EB1F <1> jmp short loc_createfile_update_fat_cluster_n2 5401 <1> 5402 <1> loc_createfile_dsk_wr_err: 5403 <1> ; 16/10/2016 (1Dh -> 18) 5404 <1> ; 23/03/2016 5405 <1> ;mov eax, 18 ; Drive not ready or write error ! 5406 <1> ; 29/07/2022 5407 0000BE56 29C0 <1> sub eax, eax 5408 0000BE58 B012 <1> mov al, 18 5409 <1> loc_cf_stc_retn: 5410 0000BE5A E9BA000000 <1> jmp loc_createfile_stc_retn 5411 <1> 5412 <1> loc_createfile_update_fat_cluster_n1: 5413 0000BE5F A1[D4820100] <1> mov eax, [createfile_PCluster] 5414 0000BE64 8B0D[D0820100] <1> mov ecx, [createfile_Cluster] 5415 0000BE6A E801040000 <1> call update_cluster 5416 0000BE6F 7304 <1> jnc short loc_createfile_update_fat_cluster_n2 5417 0000BE71 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 5418 <1> ;jnz loc_createfile_stc_retn 5419 <1> ; 29/07/2022 5420 0000BE73 75E5 <1> jnz short loc_cf_stc_retn 5421 <1> 5422 <1> loc_createfile_update_fat_cluster_n2: 5423 0000BE75 A1[D0820100] <1> mov eax, [createfile_Cluster] 5424 <1> ;mov ecx, 0FFFFFFFh 5425 <1> ; 29/08/2024 5426 <1> ; (update_cluster will save 28 bit cluster value) 5427 <1> ;mov ecx, 0FFFFFFFFh 5428 0000BE7A 29C9 <1> sub ecx, ecx 5429 0000BE7C 49 <1> dec ecx 5430 0000BE7D E8EE030000 <1> call update_cluster 5431 0000BE82 7353 <1> jnc short loc_createfile_save_fat_buffer_3 5432 0000BE84 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 5433 0000BE86 744F <1> jz short loc_createfile_save_fat_buffer_3 5434 <1> 5435 <1> loc_cf_upd_fat_fcluster_stc_retn: 5436 0000BE88 E98C000000 <1> jmp loc_createfile_stc_retn 5437 <1> 5438 <1> loc_createfile_get_set_wfc_cont: 5439 <1> ;;movzx ecx, word [esi+LD_BPB+BytesPerSec] ; 512 5440 <1> ;movzx ecx, word [createfile_BytesPerSec] ; 512 5441 <1> ; 19/12/2025 5442 0000BE8D B900020000 <1> mov ecx, 512 5443 0000BE92 01C8 <1> add eax, ecx 5444 0000BE94 48 <1> dec eax ; add eax, 511 5445 0000BE95 29D2 <1> sub edx, edx 5446 0000BE97 F7F1 <1> div ecx 5447 0000BE99 0FB61D[D9820100] <1> movzx ebx, byte [createfile_SecPerClust] 5448 0000BEA0 01D8 <1> add eax, ebx 5449 0000BEA2 48 <1> dec eax ; add eax, SecPerClust - 1 5450 <1> ;xor dx, dx 5451 <1> ; 27/08/2024 5452 0000BEA3 31D2 <1> xor edx, edx 5453 0000BEA5 F7F3 <1> div ebx 5454 <1> 5455 <1> loc_createfile_set_cluster_count: 5456 0000BEA7 A3[DC820100] <1> mov [createfile_CCount], eax 5457 <1> 5458 <1> ; 31/08/2024 5459 <1> ;;; 5460 0000BEAC 833D[C4820100]00 <1> cmp dword [createfile_size], 0 ; empty file ? 5461 0000BEB3 7422 <1> jz short loc_createfile_save_fat_buffer_3 5462 <1> ;;; 5463 <1> 5464 0000BEB5 BF00000700 <1> mov edi, Cluster_Buffer 5465 0000BEBA 89C8 <1> mov eax, ecx ; Bytes per Sector 5466 0000BEBC F7E3 <1> mul ebx ; Sectors per Cluster 5467 <1> ; EAX = Bytes per Cluster 5468 0000BEBE 89C1 <1> mov ecx, eax 5469 0000BEC0 C1E902 <1> shr ecx, 2 ; dword count 5470 0000BEC3 31C0 <1> xor eax, eax 5471 0000BEC5 F3AB <1> rep stosd ; clear cluster buffer 5472 <1> 5473 0000BEC7 A1[D0820100] <1> mov eax, [createfile_Cluster] ; 24/03/2016 5474 <1> 5475 0000BECC 89D9 <1> mov ecx, ebx 5476 <1> 5477 <1> loc_createfile_get_set_wf_fclust_cont: 5478 <1> ;sub eax, 2 5479 <1> ; 30/07/2022 5480 0000BECE 48 <1> dec eax 5481 0000BECF 48 <1> dec eax 5482 0000BED0 F7E1 <1> mul ecx 5483 <1> ; EAX = Logical DOS disk address (offset) 5484 0000BED2 E95FFFFFFF <1> jmp loc_createfile_write_fcluster_to_disk 5485 <1> 5486 <1> loc_createfile_save_fat_buffer_3: 5487 <1> ; byte [FAT_BuffValidData] = 2 5488 0000BED7 E808060000 <1> call save_fat_buffer 5489 <1> ;jc loc_createfile_stc_retn 5490 <1> ; 29/07/2022 5491 0000BEDC 72AA <1> jc short loc_cf_upd_fat_fcluster_stc_retn 5492 <1> 5493 <1> ; 21/03/2016 5494 <1> ;cmp byte [FAT_ClusterCounter], 1 5495 <1> ;jb short loc_createfile_save_fat_buffer_4 5496 <1> ; 31/08/2024 5497 0000BEDE 803D[927E0100]00 <1> cmp byte [FAT_ClusterCounter], 0 5498 0000BEE5 761B <1> jna short loc_createfile_save_fat_buffer_4 ; cf = 0 5499 <1> 5500 <1> ; ESI = Logical DOS Drive Description Table address 5501 0000BEE7 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 5502 0000BEEC 66BB01FF <1> mov bx, 0FF01h ; add free clusters 5503 0000BEF0 E87C060000 <1> call calculate_fat_freespace 5504 <1> 5505 <1> ;inc eax ; 0FFFFFFFFh -> 0 ; recalculation is needed! 5506 <1> ;jnz short loc_createfile_save_fat_buffer_4 5507 <1> 5508 <1> ; ecx > 0 -> Recalculation is needed 5509 0000BEF5 09C9 <1> or ecx, ecx 5510 0000BEF7 7409 <1> jz short loc_createfile_save_fat_buffer_4 5511 <1> 5512 0000BEF9 66BB00FF <1> mov bx, 0FF00h ; ; recalculate free space 5513 0000BEFD E86F060000 <1> call calculate_fat_freespace 5514 <1> 5515 <1> loc_createfile_save_fat_buffer_4: 5516 0000BF02 FF0D[DC820100] <1> dec dword [createfile_CCount] 5517 <1> ;jz short loc_createfile_upd_dir_modif_date_time 5518 0000BF08 743D <1> jz short loc_createfile_stc_retn_cc ; 31/03/2016 5519 <1> 5520 <1> loc_createfile_get_set_write_next_cluster: 5521 0000BF0A E88C020000 <1> call get_first_free_cluster 5522 0000BF0F 7208 <1> jc short loc_createfile_stc_retn 5523 <1> 5524 <1> loc_createfile_get_set_write_next_cluster_1: 5525 0000BF11 83F8FF <1> cmp eax, 0FFFFFFFFh 5526 0000BF14 7211 <1> jb short loc_createfile_get_set_write_next_cluster_2 5527 <1> 5528 <1> ;loc_createfile_wnc_insufficient_disk_space: 5529 <1> ;mov eax, 27h ; Insufficient disk space 5530 <1> ; 29/07/2022 5531 <1> ;xor eax, eax 5532 <1> ; 29/08/2024 5533 <1> ; eax = FFFFFFFFh 5534 0000BF16 40 <1> inc eax ; eax = 0 5535 0000BF17 B027 <1> mov al, 27h 5536 <1> 5537 <1> loc_createfile_stc_retn: 5538 0000BF19 803D[E0820100]01 <1> cmp byte [createfile_wfc], 1 5539 0000BF20 7324 <1> jnb short loc_createfile_err_retn 5540 0000BF22 C3 <1> retn 5541 <1> 5542 <1> loc_createfile_wnc_inv_format_retn: 5543 <1> ;mov eax, 28 5544 0000BF23 B01C <1> mov al, 28 ; Invalid format 5545 0000BF25 EBF2 <1> jmp short loc_createfile_stc_retn 5546 <1> 5547 <1> loc_createfile_get_set_write_next_cluster_2: 5548 0000BF27 83F802 <1> cmp eax, 2 5549 0000BF2A 72F7 <1> jb short loc_createfile_wnc_inv_format_retn 5550 <1> 5551 <1> loc_createfile_get_set_write_next_cluster_3: 5552 0000BF2C 8B0D[D0820100] <1> mov ecx, [createfile_Cluster] 5553 0000BF32 A3[D0820100] <1> mov [createfile_Cluster], eax 5554 0000BF37 890D[D4820100] <1> mov [createfile_PCluster], ecx 5555 0000BF3D 0FB60D[D9820100] <1> movzx ecx, byte [createfile_SecPerClust] 5556 0000BF44 EB88 <1> jmp short loc_createfile_get_set_wf_fclust_cont 5557 <1> 5558 <1> loc_createfile_err_retn: 5559 0000BF46 F9 <1> stc 5560 <1> 5561 <1> ;loc_createfile_upd_dir_modif_date_time: 5562 <1> loc_createfile_stc_retn_cc: ; 31/03/2016 5563 0000BF47 9C <1> pushf ; cpu is here for an error return or completion 5564 0000BF48 50 <1> push eax ; error code if cf = 1 5565 <1> 5566 <1> ;call update_parent_dir_lmdt 5567 <1> 5568 <1> ;loc_createfile_stc_retn_cc: 5569 0000BF49 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 5570 0000BF4E 09C0 <1> or eax, eax 5571 0000BF50 741A <1> jz short loc_createfile_stc_retn_pop_eax 5572 0000BF52 8A3D[76770100] <1> mov bh, [Current_Drv] 5573 0000BF58 B301 <1> mov bl, 01h ; BL = 1 -> add clusters 5574 <1> ; NOTE: EAX value will be added to Free Cluster Count 5575 <1> ; (If EAX value is negative, Free Cluster Count will be decreased) 5576 0000BF5A E812060000 <1> call calculate_fat_freespace 5577 <1> ; ESI = Logical DOS Drive Description Table Address 5578 <1> ;jc short loc_createfile_stc_retn_pop_eax_cf 5579 0000BF5F 21C9 <1> and ecx, ecx ; cx = 0 -> valid free sector count 5580 0000BF61 7409 <1> jz short loc_createfile_stc_retn_pop_eax 5581 <1> 5582 <1> loc_createfile_stc_retn_recalc_FAT_freespace: 5583 0000BF63 66BB00FF <1> mov bx, 0FF00h ; bh = 0FFh -> 5584 <1> ; ESI = Logical DOS Drv DT Addr 5585 <1> ; BL = 0 -> Recalculate 5586 0000BF67 E805060000 <1> call calculate_fat_freespace 5587 <1> 5588 <1> loc_createfile_stc_retn_pop_eax: 5589 0000BF6C 58 <1> pop eax 5590 0000BF6D 9D <1> popf 5591 0000BF6E 7218 <1> jc short loc_createfile_retn 5592 <1> 5593 <1> loc_createfile_retn_fcluster: 5594 0000BF70 A1[C8820100] <1> mov eax, [createfile_FFCluster] 5595 <1> ;mov ebx, createfile_size 5596 <1> ;;movzx ecx, byte [esi+LD_BPB+SecPerClust] 5597 <1> ;movzx ecx, byte [createfile_SecPerClust] ; 23/03/2016 5598 <1> ;movzx edx, word [createfile_DirIndex] 5599 <1> ; 29/08/2024 - TRDOS 386 v2.0.9 5600 0000BF75 8B1D[C4820100] <1> mov ebx, [createfile_size] 5601 0000BF7B 0FB70D[DA820100] <1> movzx ecx, word [createfile_DirIndex] ; = directory entry index 5602 0000BF82 8B15[CC820100] <1> mov edx, [createfile_LastDirCluster] ; = [DirBuff_Cluster] 5603 <1> ; esi = Logical DOS Drive Description Table address 5604 <1> ; byte [esi] = drive name ; 'A','B','C','D' 5605 <1> 5606 <1> loc_createfile_retn: 5607 0000BF88 C3 <1> retn 5608 <1> 5609 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 5610 <1> ; 28/07/2022 (TRDOS 386 Kernel v2.0.5) 5611 <1> ; 5612 <1> ;create_fs_file: 5613 <1> ; ; temporary (21/03/2016) 5614 <1> ; ;retn 5615 <1> ; 5616 <1> ;delete_fs_file: 5617 <1> ; ; temporary (28/02/2016) 5618 <1> ; ;retn 5619 <1> ; 5620 <1> ;rename_fs_file_or_directory: 5621 <1> ; ;retn 5622 <1> ; 5623 <1> ;make_fs_directory: 5624 <1> ; ; temporary (21/02/2016) 5625 <1> ; ;retn 5626 <1> ; 5627 <1> ;add_new_fs_section: 5628 <1> ; ; temporary (11/03/2016) 5629 <1> ; ;retn 5630 <1> ; 5631 <1> ;delete_fs_directory_entry: 5632 <1> ; ; temporary (11/03/2016) 5633 <1> ; ;retn 5634 <1> ; 5635 <1> ;csftdf2_read_fs_file_sectors: 5636 <1> ; ; temporary (19/03/2016) 5637 <1> ; ;retn 5638 <1> ; 5639 <1> ;csftdf2_write_fs_file_sectors: 5640 <1> ; ; temporary (19/03/2016) 5641 <1> ; retn 3437 %include 'trdosk5.s' ; 24/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - File System Procedures : trdosk5s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 21/12/2025 (Previous: 31/08/2024, v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.11 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; DRV_FAT.ASM (21/08/2011) 12 <1> ; **************************************************************************** 13 <1> ; DRV_FAT.ASM (c) 2005-2011 Erdogan TAN [ 07/07/2009 ] Last Update: 21/08/2011 14 <1> 15 <1> get_next_cluster: 16 <1> ; 07/08/2022 17 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 18 <1> ; 15/10/2016 19 <1> ; 23/03/2016 20 <1> ; 01/02/2016 (TRDOS 386 = TRDOS v2.0) 21 <1> ; 05/07/2011 22 <1> ; 07/07/2009 23 <1> ; 2005 24 <1> ; INPUT -> 25 <1> ; EAX = Cluster Number (32 bit) 26 <1> ; ESI = Logical DOS Drive Parameters Table 27 <1> ; OUTPUT -> 28 <1> ; cf = 0 -> No Error, EAX valid 29 <1> ; cf = 1 & EAX = 0 -> End Of Cluster Chain 30 <1> ; cf = 1 & EAX > 0 -> Error 31 <1> ; ECX = Current/Previous cluster (if CF = 0) 32 <1> ; EAX = Next Cluster Number (32 bit) 33 <1> ; 34 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 35 <1> 36 0000BF89 A3[867E0100] <1> mov [FAT_CurrentCluster], eax 37 <1> check_next_cluster_fat_type: 38 0000BF8E 29D2 <1> sub edx, edx ; 0 39 0000BF90 807E0302 <1> cmp byte [esi+LD_FATType], 2 40 0000BF94 7243 <1> jb short get_FAT12_next_cluster 41 <1> ;ja get_FAT32_next_cluster 42 <1> ; 25/07/2022 43 0000BF96 7605 <1> jna short get_FAT16_next_cluster 44 0000BF98 E9B2000000 <1> jmp get_FAT32_next_cluster 45 <1> 46 <1> get_FAT16_next_cluster: 47 0000BF9D BB00030000 <1> mov ebx, 300h ;768 48 0000BFA2 F7F3 <1> div ebx 49 <1> ; EAX = Count of 3 FAT sectors 50 <1> ; EDX = Cluster Offset (< 768) 51 <1> ;shl dx, 1 ; Multiply by 2 52 <1> ; 25/07/2022 53 0000BFA4 D1E2 <1> shl edx, 1 54 0000BFA6 89D3 <1> mov ebx, edx ; Byte Offset 55 0000BFA8 81C3001C0900 <1> add ebx, FAT_Buffer 56 0000BFAE 66BA0300 <1> mov dx, 3 57 0000BFB2 F7E2 <1> mul edx 58 <1> ; EAX = FAT Sector (<= 256) 59 <1> ; EDX = 0 60 0000BFB4 8A0E <1> mov cl, [esi+LD_Name] 61 <1> ;cmp byte [FAT_BuffValidData], 0 62 0000BFB6 3815[8A7E0100] <1> cmp [FAT_BuffValidData], dl ; 0 63 0000BFBC 7674 <1> jna short load_FAT_sectors0 64 0000BFBE 3A0D[8B7E0100] <1> cmp cl, [FAT_BuffDrvName] 65 0000BFC4 756C <1> jne short load_FAT_sectors0 66 0000BFC6 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 67 0000BFCC 756A <1> jne short load_FAT_sectors1 68 <1> ;movzx eax, word [ebx] 69 0000BFCE 668B03 <1> mov ax, [ebx] 70 <1> ; 01/02/2016 71 <1> ; DRV_FAT.ASM (21/08/2011) had a FATal bug here ! 72 <1> ; (cmp ah, 0Fh) ! (ax >= FF7h) 73 <1> ; (how can i do a such mistake!?) 74 <1> ;cmp al, 0F7h 75 <1> ;jb short loc_pass_gnc_FAT16_eoc_check 76 <1> ;cmp ah, 0FFh 77 <1> ;jb short loc_pass_gnc_FAT16_eoc_check 78 0000BFD1 6683F8F7 <1> cmp ax, 0FFF7h 79 0000BFD5 724E <1> jb short loc_pass_gnc_FAT16_eoc_check 80 <1> ; ax >= FFF7h (cluster 0002h to FFF6h is valid, in use) 81 0000BFD7 EB4A <1> jmp short loc_pass_gnc_FAT16_eoc_check_xor_eax 82 <1> 83 <1> get_FAT12_next_cluster: 84 0000BFD9 BB00040000 <1> mov ebx, 400h ;1024 85 0000BFDE F7F3 <1> div ebx 86 <1> ; EAX = Count of 3 FAT sectors 87 <1> ; EDX = Cluster Offset (< 1024) 88 <1> ; 25/07/2022 89 <1> ;push ax 90 0000BFE0 50 <1> push eax 91 <1> ;mov ax, 3 92 0000BFE1 B003 <1> mov al, 3 93 <1> ;mul dx ; Multiply by 3 94 0000BFE3 F7E2 <1> mul edx 95 <1> ;shr ax, 1 ; Divide by 2 96 0000BFE5 D1E8 <1> shr eax, 1 97 <1> ;mov bx, ax ; Byte Offset 98 0000BFE7 89C3 <1> mov ebx, eax 99 0000BFE9 81C3001C0900 <1> add ebx, FAT_Buffer 100 0000BFEF 58 <1> pop eax 101 <1> ;pop ax 102 <1> ;mov dx, 3 103 0000BFF0 B203 <1> mov dl, 3 104 0000BFF2 F7E2 <1> mul edx 105 <1> ; EAX = FAT Sector (<= 12) 106 <1> ; EDX = 0 107 0000BFF4 8A0E <1> mov cl, [esi+LD_Name] 108 <1> ;cmp byte [FAT_BuffValidData], 0 109 0000BFF6 3815[8A7E0100] <1> cmp [FAT_BuffValidData], dl ; 0 110 0000BFFC 7634 <1> jna short load_FAT_sectors0 111 0000BFFE 3A0D[8B7E0100] <1> cmp cl, [FAT_BuffDrvName] 112 0000C004 752C <1> jne short load_FAT_sectors0 113 0000C006 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 114 0000C00C 752A <1> jne short load_FAT_sectors1 115 0000C00E A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 116 <1> ;shr ax, 1 117 <1> ; 25/07/2022 118 0000C013 D1E8 <1> shr eax, 1 119 <1> ;movzx eax, word [ebx] 120 0000C015 668B03 <1> mov ax, [ebx] 121 0000C018 7313 <1> jnc short get_FAT12_nc_even 122 <1> ;shr ax, 4 123 0000C01A C1E804 <1> shr eax, 4 124 <1> loc_gnc_fat12_eoc_check: 125 <1> ;cmp al, 0F7h 126 <1> ;jb short loc_pass_gnc_FAT16_eoc_check 127 <1> ;cmp ah, 0Fh 128 <1> ;jb short loc_pass_gnc_FAT16_eoc_check 129 0000C01D 663DF70F <1> cmp ax, 0FF7h 130 0000C021 7202 <1> jb short loc_pass_gnc_FAT16_eoc_check 131 <1> ; ax >= FF7h (cluster 0002h to FF6h is valid, in use) 132 <1> 133 <1> loc_pass_gnc_FAT16_eoc_check_xor_eax: 134 0000C023 31C0 <1> xor eax, eax ; 0 135 <1> loc_pass_gnc_FAT16_eoc_check: 136 <1> loc_pass_gnc_FAT32_eoc_check: 137 0000C025 8B0D[867E0100] <1> mov ecx, [FAT_CurrentCluster] 138 0000C02B F5 <1> cmc 139 0000C02C C3 <1> retn 140 <1> 141 <1> get_FAT12_nc_even: 142 0000C02D 80E40F <1> and ah, 0Fh 143 0000C030 EBEB <1> jmp short loc_gnc_fat12_eoc_check 144 <1> 145 <1> load_FAT_sectors0: 146 0000C032 880D[8B7E0100] <1> mov [FAT_BuffDrvName], cl 147 <1> load_FAT_sectors1: 148 <1> ; 25/07/2022 149 <1> ;sub edx, edx 150 <1> ; edx = 0 151 0000C038 A3[8E7E0100] <1> mov [FAT_BuffSector], eax 152 0000C03D 89C3 <1> mov ebx, eax 153 0000C03F 034660 <1> add eax, [esi+LD_FATBegin] 154 0000C042 B202 <1> mov dl, 2 155 <1> ;cmp byte [esi+LD_FATType], 2 156 0000C044 385603 <1> cmp [esi+LD_FATType], dl ; 2 157 0000C047 7748 <1> ja short load_FAT_sectors3 158 0000C049 0FB74E1C <1> movzx ecx, word [esi+LD_BPB+BPB_FATSz16] 159 0000C04D EB45 <1> jmp short load_FAT_sectors4 160 <1> 161 <1> ; 07/08/2022 162 <1> get_FAT32_next_cluster: 163 0000C04F BB80010000 <1> mov ebx, 180h ;384 164 0000C054 F7F3 <1> div ebx 165 <1> ; EAX = Count of 3 FAT sectors 166 <1> ; EDX = Cluster Offset (< 384) 167 <1> ;shl dx, 2 ; Multiply by 4 168 <1> ; 25/07/2022 169 0000C056 C1E202 <1> shl edx, 2 170 0000C059 89D3 <1> mov ebx, edx ; Byte Offset 171 0000C05B 81C3001C0900 <1> add ebx, FAT_Buffer 172 0000C061 66BA0300 <1> mov dx, 3 173 0000C065 F7E2 <1> mul edx 174 <1> ; EAX = FAT Sector (<= 2097152) ; (FFFFFF7h * 4) / 512 175 <1> ; for 32KB cluster size: 176 <1> ; EAX <= 1024 = (4GB / 32KB) * 4) / 512 177 <1> ; EDX = 0 178 0000C067 8A0E <1> mov cl, [esi+LD_Name] 179 <1> ;cmp byte [FAT_BuffValidData], 0 180 0000C069 3815[8A7E0100] <1> cmp [FAT_BuffValidData], dl ; 0 181 0000C06F 76C1 <1> jna short load_FAT_sectors0 182 0000C071 3A0D[8B7E0100] <1> cmp cl, [FAT_BuffDrvName] 183 0000C077 75B9 <1> jne short load_FAT_sectors0 184 0000C079 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] ; 0, 3, 6, 9 ... 185 0000C07F 75B7 <1> jne short load_FAT_sectors1 186 0000C081 8B03 <1> mov eax, [ebx] 187 0000C083 25FFFFFF0F <1> and eax, 0FFFFFFFh ; 28 bit Cluster 188 0000C088 3DF7FFFF0F <1> cmp eax, 0FFFFFF7h 189 0000C08D 7296 <1> jb short loc_pass_gnc_FAT32_eoc_check 190 <1> ; eax >= FFFFFF7h (cluster 0002h to FFFFFF6h is valid) 191 0000C08F EB92 <1> jmp short loc_pass_gnc_FAT16_eoc_check_xor_eax 192 <1> 193 <1> load_FAT_sectors3: 194 0000C091 8B4E2A <1> mov ecx, [esi+LD_BPB+BPB_FATSz32] 195 <1> load_FAT_sectors4: 196 0000C094 29D9 <1> sub ecx, ebx ; [FAT_BuffSector] 197 <1> ; 25/07/2022 198 0000C096 FEC2 <1> inc dl 199 <1> ; edx = 3 200 <1> ;cmp ecx, 3 201 0000C098 39D1 <1> cmp ecx, edx ; 3 202 0000C09A 7602 <1> jna short load_FAT_sectors5 203 <1> ;mov ecx, 3 204 <1> ; 25/07/2022 205 0000C09C 89D1 <1> mov ecx, edx ; 3 206 <1> load_FAT_sectors5: 207 0000C09E BB001C0900 <1> mov ebx, FAT_Buffer 208 0000C0A3 E84B590000 <1> call disk_read 209 0000C0A8 730C <1> jnc short load_FAT_sectors_ok 210 <1> ; 15/10/2016 (15h -> 17) 211 <1> ; 23/03/2016 (15h) 212 0000C0AA B811000000 <1> mov eax, 17 ; Drive not ready or read error 213 <1> ;mov byte [FAT_BuffValidData], 0 214 <1> ; 25/07/2022 215 0000C0AF 8825[8A7E0100] <1> mov byte [FAT_BuffValidData], ah ; 0 216 0000C0B5 C3 <1> retn 217 <1> load_FAT_sectors_ok: 218 0000C0B6 C605[8A7E0100]01 <1> mov byte [FAT_BuffValidData], 1 219 0000C0BD A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 220 0000C0C2 E9C7FEFFFF <1> jmp check_next_cluster_fat_type 221 <1> 222 <1> load_FAT_root_directory: 223 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 224 <1> ; 23/10/2016 225 <1> ; 15/10/2016 226 <1> ; 07/02/2016 227 <1> ; 02/02/2016 228 <1> ; 01/02/2016 (TRDOS 386 = TRDOS v2.0) 229 <1> ; 21/05/2011 230 <1> ; 22/08/2009 231 <1> ; 232 <1> ; INPUT -> 233 <1> ; ESI = Logical DOS Drive Description Table 234 <1> ; OUTPUT -> 235 <1> ; cf = 1 -> Root directory could not be loaded 236 <1> ; EAX > 0 -> Error number 237 <1> ; cf = 0 -> EAX = 0 238 <1> ; ECX = Directory buffer size in sectors (CL) 239 <1> ; EBX = Directory buffer address 240 <1> ; NOTE: DirBuffer_Size is in bytes ! (word) 241 <1> ; 242 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 243 <1> 244 <1> ; NOTE: Only for FAT12 and FAT16 file systems ! 245 <1> ; (FAT32 fs root dir must be loaded as sub directory) 246 <1> 247 0000C0C7 8A1E <1> mov bl, [esi+LD_Name] 248 0000C0C9 8A7E03 <1> mov bh, [esi+LD_FATType] 249 <1> 250 <1> ;mov [DirBuff_DRV], bl 251 <1> ;mov [DirBuff_FATType], bh 252 0000C0CC 66891D[9B7E0100] <1> mov [DirBuff_DRV], bx 253 <1> 254 <1> ;cmp bh, 2 255 <1> ;ja short load_FAT32_root_dir0 ; FAT32 root dir 256 <1> 257 <1> load_FAT_root_dir0: ; 23/10/2016 258 0000C0D3 0FB75617 <1> movzx edx, word [esi+LD_BPB+RootDirEnts] 259 <1> 260 <1> ;or dx, dx ; 0 for FAT32 file systems 261 <1> ;jz short load_FAT32_root_dir0 ; FAT32 root dir 262 <1> 263 <1> ; 25/07/2022 264 0000C0D7 89D0 <1> mov eax, edx 265 0000C0D9 6681FA0002 <1> cmp dx, 512 ; Number of Root Dir Entries 266 0000C0DE 740B <1> je short lrd_mov_ecx_32 267 <1> ;mov eax, edx ; 25/07/2022 268 <1> ; 23/10/2016 269 0000C0E0 89C1 <1> mov ecx, eax 270 0000C0E2 6683C10F <1> add cx, 15 ; round up 271 <1> ;shr cx, 4 ; 16 entries per sector (512/32) 272 <1> ; 25/07/2022 273 0000C0E6 C1E904 <1> shr ecx, 4 274 <1> ; ecx = Root directory size in sectors 275 <1> ;;shl ax, 5 ; Root directory size in bytes 276 <1> ; 25/07/2022 277 <1> ;shl eax, 5 278 <1> ;;dec dx ; Last entry number of root dir 279 <1> ;dec edx 280 <1> ; cx = Dir Buffer sector count 281 0000C0E9 EB04 <1> jmp short lrd_check_dir_buffer 282 <1> 283 <1> lrd_mov_ecx_32: 284 <1> ;mov ecx, 32 285 <1> ; 25/07/2022 286 0000C0EB 29C9 <1> sub ecx, ecx 287 0000C0ED B120 <1> mov cl, 32 288 <1> ;dec dx ; 511 289 <1> ;mov ax, 32*512 290 <1> 291 <1> lrd_check_dir_buffer: 292 <1> ; 25/07/2022 293 0000C0EF 4A <1> dec edx ; root dir entries - 1 294 0000C0F0 C1E005 <1> shl eax, 5 ; * 32 295 <1> ; 296 0000C0F3 29DB <1> sub ebx, ebx ; 0 297 0000C0F5 881D[9D7E0100] <1> mov [DirBuff_ValidData], bl ; 0 298 0000C0FB 668915[A07E0100] <1> mov [DirBuff_LastEntry], dx 299 0000C102 891D[A27E0100] <1> mov [DirBuff_Cluster], ebx ; 0 300 0000C108 66A3[A67E0100] <1> mov [DirBuffer_Size], ax 301 <1> 302 0000C10E 8B4664 <1> mov eax, [esi+LD_ROOTBegin] 303 <1> read_directory: 304 0000C111 BB00000800 <1> mov ebx, Directory_Buffer 305 0000C116 51 <1> push ecx ; Directory buffer sector count 306 0000C117 53 <1> push ebx 307 0000C118 E8D6580000 <1> call disk_read 308 0000C11D 5B <1> pop ebx 309 0000C11E 720B <1> jc short load_DirBuff_error 310 <1> 311 <1> validate_DirBuff_and_return: 312 0000C120 59 <1> pop ecx ; Number of loaded sectors 313 0000C121 C605[9D7E0100]01 <1> mov byte [DirBuff_ValidData], 1 314 0000C128 31C0 <1> xor eax, eax ; 0 = no error 315 0000C12A C3 <1> retn 316 <1> 317 <1> load_DirBuff_error: 318 0000C12B 89C8 <1> mov eax, ecx ; remaining sectors 319 0000C12D 59 <1> pop ecx ; sector count 320 0000C12E 29C1 <1> sub ecx, eax ; Number of loaded sectors 321 <1> ; 15/10/2016 (15h -> 17) 322 <1> ;mov eax, 17 ; DRV NOT READY OR READ ERROR ! 323 <1> ; 25/07/2022 324 <1> ;sub eax, eax 325 0000C130 B011 <1> mov al, 17 326 0000C132 F9 <1> stc 327 0000C133 C3 <1> retn 328 <1> 329 <1> load_FAT32_root_directory: 330 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 331 <1> ; 02/02/2016 (TRDOS 386 = TRDOS v2.0) 332 <1> ; 333 <1> ; INPUT -> 334 <1> ; ESI = Logical DOS Drive Description Table 335 <1> ; OUTPUT -> 336 <1> ; cf = 1 -> Root directory could not be loaded 337 <1> ; EAX > 0 -> Error number 338 <1> ; cf = 0 -> EAX = 0 339 <1> ; ECX = Directory buffer size in sectors (CL) 340 <1> ; EBX = Directory buffer address 341 <1> ; NOTE: DirBuffer_Size is in bytes ! (word) 342 <1> ; 343 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 344 <1> 345 0000C134 8A1E <1> mov bl, [esi+LD_Name] 346 0000C136 8A7E03 <1> mov bh, [esi+LD_FATType] 347 <1> 348 <1> ;mov [DirBuff_DRV], bl 349 <1> ;mov [DirBuff_FATType], bh 350 0000C139 66891D[9B7E0100] <1> mov [DirBuff_DRV], bx 351 <1> 352 <1> load_FAT32_root_dir0: 353 0000C140 8B4632 <1> mov eax, [esi+LD_BPB+FAT32_RootFClust] 354 0000C143 EB0C <1> jmp short load_FAT_sub_dir0 355 <1> 356 <1> load_FAT_sub_directory: 357 <1> ; 19/12/2025 (TRDOS 386 Kernel v2.0.10) 358 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 359 <1> ; 01/02/2016 (TRDOS 386 = TRDOS v2.0) 360 <1> ; 05/07/2011 361 <1> ; 23/08/2009 362 <1> ; 363 <1> ; INPUT -> 364 <1> ; ESI = Logical DOS Drive Description Table 365 <1> ; EAX = Cluster Number 366 <1> ; OUTPUT -> 367 <1> ; cf = 1 -> Sub directory could not be loaded 368 <1> ; EAX > 0 -> Error number 369 <1> ; cf = 0 -> EAX = 0 370 <1> ; ECX = Directory buffer size in sectors (CL) 371 <1> ; EBX = Directory buffer address 372 <1> ; 373 <1> ; NOTE: DirBuffer_Size is in bytes ! (word) 374 <1> ; 375 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 376 <1> 377 0000C145 8A1E <1> mov bl, [esi+LD_Name] 378 0000C147 8A7E03 <1> mov bh, [esi+LD_FATType] 379 <1> 380 <1> ;mov [DirBuff_DRV], bl 381 <1> ;mov [DirBuff_FATType], bh 382 0000C14A 66891D[9B7E0100] <1> mov [DirBuff_DRV], bx 383 <1> 384 <1> load_FAT_sub_dir0: 385 0000C151 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+SecPerClust] 386 <1> 387 0000C155 882D[9D7E0100] <1> mov [DirBuff_ValidData], ch ; 0 388 0000C15B A3[A27E0100] <1> mov [DirBuff_Cluster], eax 389 <1> 390 <1> ;movzx eax, word [esi+LD_BPB+BytesPerSec] ; 512 391 <1> ;mul ecx 392 <1> ;shr eax, 5 ; directory entry count (dir size / 32) 393 <1> ; 19/12/2025 394 0000C160 89C8 <1> mov eax, ecx 395 0000C162 C1E004 <1> shl eax, 4 ; 512/32 (16 entries per sector) 396 <1> 397 <1> ;dec ax ; last entry 398 <1> ; 25/07/2022 399 0000C165 48 <1> dec eax 400 0000C166 66A3[A07E0100] <1> mov [DirBuff_LastEntry], ax 401 <1> 402 0000C16C A1[A27E0100] <1> mov eax, [DirBuff_Cluster] 403 0000C171 83E802 <1> sub eax, 2 404 0000C174 F7E1 <1> mul ecx 405 0000C176 034668 <1> add eax, [esi+LD_DATABegin] 406 <1> ; ecx = sectors per cluster (dir buffer size <= 128 sectors) 407 0000C179 EB96 <1> jmp short read_directory 408 <1> 409 <1> ; DRV_FS.ASM 410 <1> 411 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 412 <1> 413 <1> ; 19/12/2025 414 <1> ;load_current_FS_directory: 415 <1> ; ;retn 416 <1> ;load_FS_root_directory: 417 <1> ; ;retn 418 <1> ;load_FS_sub_directory: 419 <1> ; retn 420 <1> 421 <1> read_cluster: 422 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 423 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 424 <1> ; 15/10/2016 425 <1> ; 18/03/2016 426 <1> ; 16/03/2016 427 <1> ; 17/02/2016 428 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 429 <1> ; 430 <1> ; INPUT -> 431 <1> ; EAX = Cluster Number (Sector index for SINGLIX FS) 432 <1> ; ESI = Logical DOS Drive Description Table address 433 <1> ; EBX = Cluster (File R/W) Buffer address (max. 64KB) 434 <1> ; Only for SINGLIX FS: 435 <1> ; EDX = File Number (The 1st FDT address) 436 <1> ; OUTPUT -> 437 <1> ; cf = 1 -> Cluster can not be loaded at the buffer 438 <1> ; EAX > 0 -> Error number 439 <1> ; cf = 0 -> Cluster has been loaded at the buffer 440 <1> ; 441 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 442 <1> 443 0000C17B 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+BPB_SecPerClust] 444 <1> ; CL = 1 = [esi+LD_FS_Reserved2] ; SectPerClust for Singlix FS 445 <1> 446 <1> read_file_sectors: ; 16/03/2016 447 <1> 448 <1> ; 19/12/2025 449 <1> %if 0 450 <1> ;cmp byte [esi+LD_FATType], 0 451 <1> ; 25/07/2022 452 <1> cmp [esi+LD_FATType], ch ; 0 453 <1> jna short read_fs_cluster 454 <1> %endif 455 <1> 456 <1> read_fat_file_sectors: ; 18/03/2016 457 0000C17F 83E802 <1> sub eax, 2 ; Beginning cluster number is always 2 458 0000C182 0FB65613 <1> movzx edx, byte [esi+LD_BPB+BPB_SecPerClust] ; 18/03/2016 459 0000C186 F7E2 <1> mul edx 460 0000C188 034668 <1> add eax, [esi+LD_DATABegin] ; absolute address of the cluster 461 <1> 462 <1> ; EAX = Disk sector address 463 <1> ; ECX = Sector count 464 <1> ; EBX = Buffer address 465 <1> ; (EDX = 0) 466 <1> ; ESI = Logical DOS drive description table address 467 <1> 468 0000C18B E863580000 <1> call disk_read 469 0000C190 7306 <1> jnc short rclust_retn 470 <1> 471 <1> ; 15/10/2016 (15h -> 17) 472 0000C192 B811000000 <1> mov eax, 17 ; Drive not ready or read error ! 473 0000C197 C3 <1> retn 474 <1> 475 <1> rclust_retn: 476 0000C198 29C0 <1> sub eax, eax ; 0 477 0000C19A C3 <1> retn 478 <1> 479 <1> ; 19/12/2025 480 <1> %if 0 481 <1> 482 <1> read_fs_cluster: 483 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 484 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 485 <1> ; Singlix FS 486 <1> 487 <1> ; EAX = Cluster number is sector index number of the file (eax) 488 <1> 489 <1> ; EDX = File number is the first File Descriptor Table address 490 <1> ; of the file. (Absolute address of the FDT). 491 <1> 492 <1> ; eax = sector index (0 for the first sector) 493 <1> ; edx = FDT0 address 494 <1> ; 64 KB buffer = 128 sectors (limit) 495 <1> ;mov ecx, 128 ; maximum count of sectors (before eof) 496 <1> ; 25/07/2022 497 <1> sub ecx, ecx 498 <1> mov cl, 128 499 <1> ;call read_fs_sectors 500 <1> ;retn 501 <1> ;jmp short read_fs_sectors 502 <1> 503 <1> read_fs_sectors: 504 <1> ; 15/02/2016 (TRDOS 386 = TRDOS v2.0) 505 <1> stc 506 <1> retn 507 <1> 508 <1> %endif 509 <1> 510 <1> get_first_free_cluster: 511 <1> ; 21/12/2025 (TRDOS 386 Kernel v2.0.10) 512 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 513 <1> ; 02/03/2016 514 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 515 <1> ; 26/10/2010 (DRV_FAT.ASM, 'proc_get_first_free_cluster') 516 <1> ; 10/07/2010 517 <1> ; INPUT -> 518 <1> ; ESI = Logical DOS Drive Description Table address 519 <1> ; OUTPUT -> 520 <1> ; cf = 1 -> Error code in AL (EAX) 521 <1> ; cf = 0 -> 522 <1> ; EAX = Cluster number 523 <1> ; If EAX = FFFFFFFFh -> no free space 524 <1> ; If the drive has FAT32 fs: 525 <1> ; EBX = FAT32 FSI sector buffer address (if > 0) 526 <1> ; 527 <1> ; (Modified registers: eax, ebx, ecx, edx) 528 <1> ; 529 <1> 530 0000C19B 8B4678 <1> mov eax, [esi+LD_Clusters] 531 0000C19E 40 <1> inc eax ; add eax, 1 532 0000C19F A3[28810100] <1> mov [gffc_last_free_cluster], eax 533 <1> 534 0000C1A4 31DB <1> xor ebx, ebx ; 0 ; 02/03/2016 535 <1> 536 0000C1A6 807E0302 <1> cmp byte [esi+LD_FATType], 2 537 0000C1AA 760D <1> jna short loc_gffc_get_first_fat_free_cluster0 538 <1> 539 <1> ; 21/12/2025 - TRDOS 386 v2.0.10 540 <1> %if 1 541 <1> ; FAT32 - FSINFO - first free cluster 542 0000C1AC 31D2 <1> xor edx, edx 543 0000C1AE 4A <1> dec edx ; -1 544 0000C1AF 87563E <1> xchg edx, [esi+LD_BPB+BPB_Reserved+4] 545 <1> 546 <1> %else 547 <1> loc_gffc_get_first_fat32_free_cluster: 548 <1> ; 02/03/2016 549 <1> call get_fat32_fsinfo_sector_parms 550 <1> jc short loc_gffc_get_first_fat_free_cluster0 551 <1> %endif 552 <1> 553 <1> loc_gffc_check_fsinfo_parms: 554 <1> ;;mov ebx, DOSBootSectorBuff 555 <1> ;cmp dword [ebx], 41615252h 556 <1> ;jne short loc_gffc_fat32_fsinfo_err 557 <1> ;cmp dword [ebx+484], 61417272h 558 <1> ;jne short loc_gffc_fat32_fsinfo_err 559 <1> ;mov eax, [ebx+492] ; FSI_Next_Free 560 <1> ;EAX = First free cluster 561 <1> ;(from FAT32 FSInfo sector) 562 0000C1B2 89D0 <1> mov eax, edx ; FSI_Next_Free (First Free Cluster) 563 0000C1B4 83F8FF <1> cmp eax, 0FFFFFFFFh ; invalid (unknown) ! 564 0000C1B7 7204 <1> jb short loc_gffc_get_first_fat_free_cluster1 565 <1> 566 <1> ; Start from the 1st cluster of the FAT(32) file system 567 <1> loc_gffc_get_first_fat_free_cluster0: 568 <1> ;mov eax, 2 569 <1> ; 25/07/2022 570 0000C1B9 29C0 <1> sub eax, eax 571 0000C1BB B002 <1> mov al, 2 572 <1> ;xor edx, edx 573 <1> 574 <1> loc_gffc_get_first_fat_free_cluster1: 575 0000C1BD 53 <1> push ebx ; 02/03/2016 576 <1> 577 <1> loc_gffc_get_first_fat_free_cluster2: 578 0000C1BE A3[24810100] <1> mov [gffc_first_free_cluster], eax 579 0000C1C3 A3[20810100] <1> mov [gffc_next_free_cluster], eax 580 <1> 581 <1> ; EBX = FAT32 FSINFO sector buffer address 582 <1> ; (EBX = 0, if the drive has not got FAT32 fs or 583 <1> ; FAT32 FSINFO sector buffer is invalid.) 584 <1> 585 <1> loc_gffc_get_first_fat_free_cluster3: 586 0000C1C8 E8BCFDFFFF <1> call get_next_cluster 587 0000C1CD 7307 <1> jnc short loc_gffc_get_first_fat_free_cluster4 588 0000C1CF 09C0 <1> or eax, eax 589 0000C1D1 740B <1> jz short loc_gffc_first_free_fat_cluster_next 590 0000C1D3 5B <1> pop ebx ; 02/03/2016 591 0000C1D4 F5 <1> cmc ; stc 592 0000C1D5 C3 <1> retn 593 <1> 594 <1> loc_gffc_get_first_fat_free_cluster4: 595 0000C1D6 21C0 <1> and eax, eax ; next cluster value 596 0000C1D8 7504 <1> jnz short loc_gffc_first_free_fat_cluster_next 597 0000C1DA 89C8 <1> mov eax, ecx ; current (previous cluster) value 598 0000C1DC EB22 <1> jmp short loc_gffc_check_for_set 599 <1> 600 <1> loc_gffc_first_free_fat_cluster_next: 601 0000C1DE A1[20810100] <1> mov eax, [gffc_next_free_cluster] 602 0000C1E3 3B05[28810100] <1> cmp eax, [gffc_last_free_cluster] 603 0000C1E9 7308 <1> jnb short retn_stc_from_get_first_free_cluster 604 <1> pass_gffc_last_cluster_eax_check: 605 0000C1EB 40 <1> inc eax ; add eax, 1 606 0000C1EC A3[20810100] <1> mov [gffc_next_free_cluster], eax 607 0000C1F1 EBD5 <1> jmp short loc_gffc_get_first_fat_free_cluster3 608 <1> 609 <1> retn_stc_from_get_first_free_cluster: 610 0000C1F3 A1[24810100] <1> mov eax, [gffc_first_free_cluster] 611 0000C1F8 83F802 <1> cmp eax, 2 612 0000C1FB 7712 <1> ja short loc_gffc_check_previous_clusters 613 0000C1FD 29C0 <1> sub eax, eax 614 0000C1FF 48 <1> dec eax ; FFFFFFFFh 615 <1> 616 <1> loc_gffc_check_for_set: 617 <1> ; 02/03/2016 618 0000C200 5B <1> pop ebx 619 <1> 620 <1> ; 21/12/2025 621 <1> ;;; 622 0000C201 807E0302 <1> cmp byte [esi+LD_FATType], 2 623 0000C205 7603 <1> jna short loc_gffc_check_for_set_@ 624 <1> 625 0000C207 89463E <1> mov [esi+LD_BPB+BPB_Reserved+4], eax 626 <1> 627 <1> loc_gffc_check_for_set_@: 628 <1> ;;; 629 <1> 630 <1> ; EBX = FAT32 FSINFO sector buffer address 631 <1> ; (EBX = 0, if the drive has not got FAT32 fs or 632 <1> ; FAT32 FSINFO sector buffer is invalid.) 633 <1> 634 0000C20A 09DB <1> or ebx, ebx 635 0000C20C 750D <1> jnz short loc_gffc_set_ffree_fat32_cluster 636 <1> 637 <1> ;cmp byte [esi+LD_FATType], 3 638 <1> ;jnb short loc_gffc_set_ffree_fat32_cluster 639 <1> 640 <1> ;xor ebx, ebx ; 0 641 <1> 642 <1> loc_gffc_retn: 643 0000C20E C3 <1> retn 644 <1> 645 <1> loc_gffc_check_previous_clusters: 646 0000C20F 48 <1> dec eax ; sub eax, 1 647 0000C210 A3[28810100] <1> mov [gffc_last_free_cluster], eax 648 <1> ;mov eax, 2 649 <1> ; 25/07/2022 650 0000C215 31C0 <1> xor eax, eax 651 0000C217 B002 <1> mov al, 2 652 <1> ; eax = 2 653 <1> ;xor edx, edx 654 0000C219 EBA3 <1> jmp short loc_gffc_get_first_fat_free_cluster2 655 <1> 656 <1> loc_gffc_set_ffree_fat32_cluster: 657 <1> ;call set_first_free_cluster 658 <1> ;retn 659 <1> ;jmp short set_first_free_cluster 660 <1> 661 <1> set_first_free_cluster: 662 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 663 <1> ; 15/10/2016 664 <1> ; 23/03/2016 665 <1> ; 02/03/2016 666 <1> ; 29/02/2016 667 <1> ; 26/02/2016 668 <1> ; 21/02/2016 (TRDOS 386 = TRDOS v2.0) 669 <1> ; 21/08/2011 (DRV_FAT.ASM, 'proc_set_first_free_cluster') 670 <1> ; 11/07/2010 671 <1> ; INPUT -> 672 <1> ; ESI = Logical DOS Drive Description Table address 673 <1> ; EAX = First free cluster 674 <1> ; EBX = FSINFO sector buffer address 675 <1> ; ;;If EBX > 0, it is FSINFO sector buffer address 676 <1> ; ;;EBX = 0, if FSINFO sector is not loaded 677 <1> ; OUTPUT-> 678 <1> ; ESI = Logical DOS Drive Description Table address 679 <1> ; If EBX > 0, it is FSINFO sector buffer address 680 <1> ; EBX = 0, if FSINFO sector could not be loaded 681 <1> ; CF = 1 -> Error code in AL (EAX) 682 <1> ; CF = 0 -> first free cluster is successfully updated 683 <1> 684 <1> ;cmp byte [esi+LD_FATType], 3 685 <1> ;jb short loc_sffc_invalid_drive 686 <1> 687 <1> ; Save First Free Cluster value for 'update_cluster' 688 0000C21B 89463E <1> mov [esi+LD_BPB+BPB_Reserved+4], eax ; First free Cluster 689 <1> 690 <1> ;or ebx, ebx 691 <1> ;jnz short loc_sffc_read_fsinfo_sector 692 <1> 693 0000C21E 813B52526141 <1> cmp dword [ebx], 41615252h 694 0000C224 753C <1> jne short loc_sffc_read_fsinfo_sector 695 0000C226 81BBE4010000727241- <1> cmp dword [ebx+484], 61417272h 695 0000C22F 61 <1> 696 0000C230 7530 <1> jne short loc_sffc_read_fsinfo_sector 697 <1> 698 0000C232 3B83EC010000 <1> cmp eax, [ebx+492] ; FSI_Next_Free 699 0000C238 741E <1> je short loc_sffc_retn 700 <1> 701 <1> loc_sffc_write_fsinfo_sector: 702 <1> ; EBX = FSINFO sector buffer 703 <1> ; [CFS_FAT32FSINFOSEC] is set in 'get_fat32_fsinfo_sector_parms' 704 0000C23A 8983EC010000 <1> mov [ebx+492], eax 705 0000C240 A1[38810100] <1> mov eax, [CFS_FAT32FSINFOSEC] 706 <1> ;mov ecx, 1 707 <1> ; 25/07/2022 708 0000C245 31C9 <1> xor ecx, ecx 709 0000C247 FEC1 <1> inc cl 710 <1> ; ecx = 1 711 0000C249 53 <1> push ebx 712 0000C24A E895570000 <1> call disk_write 713 0000C24F 7208 <1> jc short loc_sffc_read_fsinfo_sector_err1 714 0000C251 5B <1> pop ebx 715 <1> 716 0000C252 8B83EC010000 <1> mov eax, [ebx+492] ; First (Next) Free Cluster 717 <1> 718 <1> loc_sffc_retn: 719 0000C258 C3 <1> retn 720 <1> 721 <1> ;loc_sffc_invalid_drive: 722 <1> ; mov eax, 0Fh ; MSDOS Error : Invalid drive 723 <1> ; push edx 724 <1> 725 <1> loc_sffc_read_fsinfo_sector_err1: 726 <1> ; 25/07/2022 727 <1> ;mov ebx, 0 728 <1> ; 15/10/2016 (1Dh -> 18) 729 <1> ; 23/03/2016 (1Dh) 730 <1> ;mov eax, 18 ; Drive not ready or write error 731 0000C259 31C0 <1> xor eax, eax 732 0000C25B 89C3 <1> mov ebx, eax ; 0 733 0000C25D B012 <1> mov al, 18 734 0000C25F F9 <1> stc 735 <1> loc_sffc_read_fsinfo_sector_err2: 736 0000C260 5A <1> pop edx 737 0000C261 C3 <1> retn 738 <1> 739 <1> loc_sffc_read_fsinfo_sector: 740 0000C262 50 <1> push eax 741 <1> 742 0000C263 E84F050000 <1> call get_fat32_fsinfo_sector_parms 743 0000C268 72F6 <1> jc short loc_sffc_read_fsinfo_sector_err2 744 <1> 745 0000C26A 58 <1> pop eax 746 <1> ; EDX = First (Next) Free Cluster value from FSINFO sector 747 <1> ; EAX = First Free Cluster value from 'get_next_cluster' 748 <1> ; (edx = old value) 749 0000C26B 39D0 <1> cmp eax, edx ; First free Cluster (eax = new value) 750 0000C26D 75CB <1> jne short loc_sffc_write_fsinfo_sector 751 <1> 752 0000C26F C3 <1> retn 753 <1> 754 <1> update_cluster: 755 <1> ; 31/08/2024 756 <1> ; 29/08/2024 757 <1> ; 26/08/2024 758 <1> ; 24/08/2024 (TRDOS 386 Kernel v2.0.9) 759 <1> ; 07/08/2022 760 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 761 <1> ; 23/10/2016 762 <1> ; 23/03/2016 763 <1> ; 02/03/2016 764 <1> ; 01/03/2016 765 <1> ; 29/02/2016 766 <1> ; 27/02/2016 767 <1> ; 26/02/2016 768 <1> ; 22/02/2016 (TRDOS 386 = TRDOS v2.0) 769 <1> ; 11/08/2011 770 <1> ; 09/02/2005 771 <1> ; INPUT -> 772 <1> ; EAX = Cluster Number 773 <1> ; ECX = New Cluster Value 774 <1> ; ESI = Logical Dos Drive Parameters Table 775 <1> ; 776 <1> ; /// dword [FAT_ClusterCounter] /// 777 <1> ; 778 <1> ; OUTPUT -> 779 <1> ; cf = 0 -> No Error, EAX is valid 780 <1> ; cf = 1 & EAX = 0 -> End Of Cluster Chain 781 <1> ; cf = 1 & EAX > 0 -> Error 782 <1> ; (ECX -> any value) 783 <1> ; EAX = Next Cluster 784 <1> ; ECX = New Cluster Value 785 <1> ; 786 <1> ; /// [FAT_ClusterCounter] is updated, 787 <1> ; /// decreased when a free cluster is assigned, 788 <1> ; /// increased if an assigned cluster is freed. 789 <1> ; 790 <1> ; 791 <1> ; (Modified registers: EAX, EBX, -ECX-, EDX) 792 <1> 793 0000C270 A3[867E0100] <1> mov [FAT_CurrentCluster], eax 794 0000C275 890D[2C810100] <1> mov [ClusterValue], ecx 795 <1> 796 <1> loc_update_cluster_check_fat_buffer: 797 0000C27B 8A1E <1> mov bl, [esi+LD_Name] 798 0000C27D 381D[8B7E0100] <1> cmp [FAT_BuffDrvName], bl 799 0000C283 7418 <1> je short loc_update_cluster_check_fat_type 800 0000C285 803D[8A7E0100]02 <1> cmp byte [FAT_BuffValidData], 2 801 <1> ;je loc_uc_save_fat_buffer 802 <1> ; 25/07/2022 803 0000C28C 7502 <1> jne short loc_uc_reset_fat_buffer_validation 804 0000C28E EB66 <1> jmp loc_uc_save_fat_buffer 805 <1> 806 <1> loc_uc_reset_fat_buffer_validation: 807 0000C290 C605[8A7E0100]00 <1> mov byte [FAT_BuffValidData], 0 808 <1> 809 <1> loc_uc_check_fat_type_reset_drvname: 810 0000C297 881D[8B7E0100] <1> mov [FAT_BuffDrvName], bl 811 <1> 812 <1> loc_update_cluster_check_fat_type: 813 0000C29D 29D2 <1> sub edx, edx ; 26/02/2016 814 0000C29F 8A5E03 <1> mov bl, [esi+LD_FATType] 815 0000C2A2 83F802 <1> cmp eax, 2 816 0000C2A5 7218 <1> jb short update_cluster_inv_data 817 <1> 818 <1> ;;; 819 <1> ; 24/08/2024 820 <1> ; edx = 0 ; 24/08/2024 821 0000C2A7 8B4E78 <1> mov ecx, [esi+LD_Clusters] 822 0000C2AA 41 <1> inc ecx 823 0000C2AB 890D[967E0100] <1> mov [LastCluster], ecx 824 <1> ; 825 0000C2B1 39C8 <1> cmp eax, ecx 826 <1> ;ja short return_uc_fat32_stc ; 25/07/2022 827 <1> ; edx = 0 ; (must be -1 or > 0 after here) 828 0000C2B3 7717 <1> ja short return_uc_fat_stc 829 <1> ;;; 830 <1> 831 0000C2B5 80FB02 <1> cmp bl, 2 832 <1> ;ja update_fat32_cluster 833 <1> ; 25/07/2022 834 0000C2B8 7608 <1> jna short loc_uc_check_fat_type_1 835 0000C2BA E97B010000 <1> jmp update_fat32_cluster 836 <1> 837 <1> ; 24/08/2024 838 <1> ;loc_uc_check_fat_type_1: 839 <1> ; ;cmp bl, 1 840 <1> ; ;jb short update_cluster_inv_data 841 <1> ; mov ecx, [esi+LD_Clusters] 842 <1> ; inc ecx 843 <1> ; mov [LastCluster], ecx 844 <1> ; cmp eax, ecx ; dword [LastCluster] 845 <1> ; ;ja return_uc_fat_stc 846 <1> ; ; 25/07/2022 847 <1> ; jna short loc_uc_check_fat_type_2 848 <1> ; ; 24/08/2024 849 <1> ; ; edx = 0 ; (must be -1 or > 0 after here) 850 <1> ; jmp return_uc_fat_stc 851 <1> 852 <1> ; 25/07/2022 853 <1> update_cluster_inv_data: 854 <1> ;;mov eax, 0Dh 855 <1> ;mov al, 0Dh ; Invalid Data 856 <1> ; 31/08/2024 857 0000C2BF B01D <1> mov al, ERR_INV_DATA ; 29 ; Invalid Data 858 0000C2C1 C3 <1> retn 859 <1> 860 <1> ; 24/08/2024 861 <1> loc_uc_check_fat_type_1: 862 <1> loc_uc_check_fat_type_2: 863 <1> ; TRDOS v1 has a FATal bug here ! 864 <1> ; or bl, bl ; cmp bl, 0 865 <1> ; jz short update_fat12_cluster 866 <1> ; !! It would destroy FAT12 floppy disk fs here !! 867 <1> ; ('A:' disks of TRDOS v1 operating system project 868 <1> ; had 'singlix fs', so, I could not differ this mistake 869 <1> ; on a drive 'A:') 870 0000C2C2 80FB01 <1> cmp bl, 1 ; correct comparison is this ! 871 <1> ;jna update_fat12_cluster 872 <1> ; 25/07/2022 873 0000C2C5 770B <1> ja short update_fat16_cluster 874 0000C2C7 E9CF000000 <1> jmp update_fat12_cluster 875 <1> 876 <1> ; 24/08/2024 877 <1> ;return_uc_fat16_stc: 878 <1> ; 25/07/2022 879 <1> return_uc_fat_stc: 880 <1> ; 24/08/2024 881 <1> ; edx = 0 882 0000C2CC 4A <1> dec edx 883 <1> ; edx = -1 ; 0FFFFFFFFh 884 <1> ; ecx > 0 885 <1> return_uc_fat16_stc: ; 24/08/2024 886 <1> loc_fat_buffer_stc_0: ; 24/08/2024 887 <1> ; 01/03/2016 888 0000C2CD 31C0 <1> xor eax, eax 889 0000C2CF F9 <1> stc 890 0000C2D0 EB70 <1> jmp short loc_fat_buffer_stc_1 891 <1> 892 <1> update_fat16_cluster: 893 <1> pass_uc_fat16_errc: 894 <1> ;sub edx, edx 895 <1> ; edx = 0 896 0000C2D2 BB00030000 <1> mov ebx, 300h ; 768 897 0000C2D7 F7F3 <1> div ebx 898 <1> ; EAX = Count of 3 FAT sectors 899 <1> ; DX = Cluster index in FAT buffer 900 <1> ;mov bx, dx 901 <1> ; 25/07/2022 902 0000C2D9 89D3 <1> mov ebx, edx 903 <1> ;shl bx, 1 ; Multiply by 2 904 <1> ; 25/07/2022 905 0000C2DB D1E3 <1> shl ebx, 1 906 0000C2DD 66BA0300 <1> mov dx, 3 907 0000C2E1 F7E2 <1> mul edx 908 <1> ; EAX = FAT Sector 909 <1> ; EDX = 0 910 <1> ; EBX = Byte offset in FAT buffer 911 0000C2E3 8A0D[8A7E0100] <1> mov cl, [FAT_BuffValidData] 912 0000C2E9 80F902 <1> cmp cl, 2 913 0000C2EC 7518 <1> jne short loc_uc_check_fat16_buff_sector_load 914 <1> 915 <1> loc_uc_check_fat16_buff_sector_save: 916 0000C2EE 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 917 <1> ;jne short loc_uc_save_fat_buffer 918 <1> ;jmp short loc_update_fat16_cell 919 <1> ; 07/08/2022 920 0000C2F4 741D <1> je short loc_update_fat16_cell 921 <1> ;jmp loc_uc_save_fat_buffer 922 <1> 923 <1> ; 07/08/2022 924 <1> loc_uc_save_fat_buffer: 925 <1> ; byte [FAT_BuffValidData] = 2 926 0000C2F6 E8E9010000 <1> call save_fat_buffer 927 0000C2FB 7267 <1> jc short loc_fat_sectors_rw_error2 928 <1> ;mov byte [FAT_BuffValidData], 1 929 0000C2FD A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 930 <1> ;mov ecx, [ClusterValue] 931 <1> ;jmp short loc_update_cluster_check_fat_buffer 932 0000C302 8A1E <1> mov bl, [esi+LD_Name] ; 01/03/2016 933 0000C304 EB8A <1> jmp loc_uc_reset_fat_buffer_validation 934 <1> 935 <1> loc_uc_check_fat16_buff_sector_load: 936 0000C306 80F901 <1> cmp cl, 1 ; byte [FAT_BuffValidData] 937 0000C309 7560 <1> jne short loc_uc_load_fat_sectors 938 0000C30B 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 939 0000C311 7558 <1> jne short loc_uc_load_fat_sectors 940 <1> 941 <1> loc_update_fat16_cell: 942 <1> loc_update_fat16_buffer: 943 0000C313 81C3001C0900 <1> add ebx, FAT_Buffer ; 26/02/2016 944 <1> ;movzx eax, word [ebx] 945 0000C319 668B03 <1> mov ax, [ebx] 946 <1> ; 01/03/2016 947 0000C31C 89C2 <1> mov edx, eax ; old value of the cluster 948 0000C31E A3[867E0100] <1> mov [FAT_CurrentCluster], eax 949 0000C323 8B0D[2C810100] <1> mov ecx, [ClusterValue] ; 32 bits 950 0000C329 66890B <1> mov [ebx], cx ; 16 bits ! 951 <1> 952 0000C32C C605[8A7E0100]02 <1> mov byte [FAT_BuffValidData], 2 953 <1> 954 0000C333 6683F802 <1> cmp ax, 2 955 0000C337 7294 <1> jb short return_uc_fat16_stc 956 0000C339 3B05[967E0100] <1> cmp eax, [LastCluster] 957 0000C33F 778C <1> ja short return_uc_fat16_stc 958 <1> 959 <1> loc_fat_buffer_updated: 960 <1> ; 01/03/2016 961 0000C341 F8 <1> clc 962 <1> loc_fat_buffer_stc_1: 963 0000C342 9C <1> pushf 964 0000C343 21C9 <1> and ecx, ecx 965 0000C345 7506 <1> jnz short loc_fat_buffer_updated_1 966 <1> 967 <1> ; 01/03/2016 968 <1> ; new value of the cluster = 0 (free) 969 <1> ; increase free(d) cluster count 970 0000C347 FF05[927E0100] <1> inc dword [FAT_ClusterCounter] 971 <1> 972 <1> loc_fat_buffer_updated_1: ; new value of the cluster > 0 973 0000C34D 09D2 <1> or edx, edx ; 02/03/2016 974 0000C34F 7506 <1> jnz short loc_fat_buffer_updated_2 975 <1> ; old value of the cluster = 0 (it was free cluster) 976 <1> ; decrease free(d) cluster count 977 0000C351 FF0D[927E0100] <1> dec dword [FAT_ClusterCounter] ; it may be negative number 978 <1> 979 <1> loc_fat_buffer_updated_2: 980 0000C357 9D <1> popf 981 0000C358 C3 <1> retn 982 <1> 983 <1> ; 25/07/2022 984 <1> loc_fat_sectors_rw_error1: 985 <1> ;mov byte [FAT_BuffValidData], 0 986 <1> ; 23/10/2016 (15h -> 17) 987 <1> ; 23/03/2016 988 0000C359 B811000000 <1> mov eax, 17 ; Drive not ready or read error 989 0000C35E 8825[8A7E0100] <1> mov [FAT_BuffValidData], ah ; 0 990 <1> 991 <1> loc_fat_sectors_rw_error2: 992 <1> ;mov eax, error code 993 <1> ;mov edx, 0 994 0000C364 8B0D[2C810100] <1> mov ecx, [ClusterValue] 995 0000C36A C3 <1> retn 996 <1> 997 <1> ; 25/07/2022 998 <1> loc_uc_load_fat_sectors: 999 0000C36B A3[8E7E0100] <1> mov [FAT_BuffSector], eax 1000 <1> 1001 <1> load_uc_fat_sectors_zero: 1002 0000C370 034660 <1> add eax, [esi+LD_FATBegin] 1003 0000C373 BB001C0900 <1> mov ebx, FAT_Buffer 1004 0000C378 B903000000 <1> mov ecx, 3 1005 0000C37D E871560000 <1> call disk_read 1006 0000C382 72D5 <1> jc short loc_fat_sectors_rw_error1 1007 <1> 1008 0000C384 C605[8A7E0100]01 <1> mov byte [FAT_BuffValidData], 1 1009 0000C38B A1[867E0100] <1> mov eax, [FAT_CurrentCluster] 1010 0000C390 8B0D[2C810100] <1> mov ecx, [ClusterValue] 1011 0000C396 E902FFFFFF <1> jmp loc_update_cluster_check_fat_type 1012 <1> 1013 <1> update_fat12_cluster: 1014 <1> pass_uc_fat12_errc: 1015 <1> ;sub edx, edx 1016 0000C39B BB00040000 <1> mov ebx, 400h ; 1024 1017 0000C3A0 F7F3 <1> div ebx 1018 <1> ; EAX = Count of 3 FAT sectors 1019 <1> ; DX = Cluster index in FAT buffer 1020 <1> ;mov cx, 3 1021 <1> ; 25/07/2022 1022 0000C3A2 29C9 <1> sub ecx, ecx 1023 0000C3A4 B103 <1> mov cl, 3 1024 <1> ; ecx = 3 1025 <1> ;mov bx, ax 1026 0000C3A6 89C3 <1> mov ebx, eax 1027 <1> ;mov ax, cx ; 3 1028 0000C3A8 89C8 <1> mov eax, ecx 1029 <1> ;mul dx ; Multiply by 3 1030 0000C3AA F7E2 <1> mul edx 1031 <1> ;shr ax, 1 ; Divide by 2 1032 0000C3AC D1E8 <1> shr eax, 1 1033 <1> ;xchg bx, ax 1034 0000C3AE 93 <1> xchg ebx, eax 1035 <1> ; EAX = Count of 3 FAT sectors 1036 <1> ; EBX = Byte Offset in FAT buffer 1037 <1> ;mul cx ; 3 * AX 1038 0000C3AF F7E1 <1> mul ecx ; 3 * EAX 1039 <1> ; EAX = FAT Beginning Sector 1040 <1> ; EDX = 0 1041 0000C3B1 8A0D[8A7E0100] <1> mov cl, [FAT_BuffValidData] 1042 <1> ; TRDOS v1 has a FATal bug here ! 1043 <1> ; (it does not have 'cmp cl, 2' instruction here ! 1044 <1> ; while 'jne' is existing !) 1045 0000C3B7 80F902 <1> cmp cl, 2 ; 2 = dirty buffer (must be written to disk) 1046 0000C3BA 750D <1> jne short loc_uc_check_fat12_buff_sector_load 1047 <1> 1048 <1> loc_uc_check_fat12_buff_sector_save: 1049 0000C3BC 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 1050 <1> ;jne short loc_uc_save_fat_buffer 1051 <1> ;jmp short loc_update_fat12_cell 1052 <1> ; 07/08/2022 1053 0000C3C2 7412 <1> je short loc_update_fat12_cell 1054 0000C3C4 E92DFFFFFF <1> jmp loc_uc_save_fat_buffer 1055 <1> 1056 <1> loc_uc_check_fat12_buff_sector_load: 1057 0000C3C9 80F901 <1> cmp cl, 1 ; byte ptr [FAT_BuffValidData] 1058 0000C3CC 759D <1> jne short loc_uc_load_fat_sectors 1059 0000C3CE 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 1060 0000C3D4 7595 <1> jne short loc_uc_load_fat_sectors 1061 <1> ; 07/08/2022 1062 <1> ;je short loc_update_fat12_cell 1063 <1> ;jmp loc_uc_load_fat_sectors 1064 <1> 1065 <1> loc_update_fat12_cell: 1066 0000C3D6 81C3001C0900 <1> add ebx, FAT_Buffer ; 26/02/2016 1067 <1> ;mov cx, [FAT_CurrentCluster] 1068 <1> ; 25/07/2022 1069 0000C3DC 8B0D[867E0100] <1> mov ecx, [FAT_CurrentCluster] 1070 <1> ;shr cx, 1 1071 <1> ; 25/07/2022 1072 0000C3E2 D1E9 <1> shr ecx, 1 1073 0000C3E4 668B03 <1> mov ax, [ebx] 1074 <1> ;mov dx, ax 1075 0000C3E7 89C2 <1> mov edx, eax ; 25/07/2022 1076 <1> ; 24/08/2024 (*) 1077 0000C3E9 8B0D[2C810100] <1> mov ecx, [ClusterValue] ; 32 bits 1078 0000C3EF 7336 <1> jnc short uc_fat12_nc_even 1079 <1> 1080 <1> ; 26/08/2024 1081 <1> ; ODD cluster number 1082 <1> ; eax = current value (before updated) 1083 <1> ; ecx = new value of the cluster 1084 <1> ; of the cluster 1085 <1> ; low 4 bit of al is high 4 bit 1086 <1> ; of the previous cluster 1087 <1> ; (it must not be overwritten) 1088 <1> 1089 <1> ;and ax, 0Fh 1090 <1> ; 25/07/2022 1091 0000C3F1 240F <1> and al, 0Fh 1092 <1> ; 24/08/2024 (*) 1093 <1> ;mov ecx, [ClusterValue] ; 32 bits 1094 <1> ;shl cx, 4 1095 0000C3F3 C1E104 <1> shl ecx, 4 1096 <1> ;or cx, ax 1097 0000C3F6 08C1 <1> or cl, al ; 25/07/2022 1098 <1> ;mov ax, dx 1099 0000C3F8 89D0 <1> mov eax, edx 1100 0000C3FA 66890B <1> mov [ebx], cx ; 16 bits ! 1101 <1> ;shr ax, 4 ; al(bit4..7)+ah(bit0..7) 1102 <1> ; 25/07/2022 1103 0000C3FD C1E804 <1> shr eax, 4 1104 <1> 1105 <1> update_fat12_buffer: 1106 <1> ;;; 1107 <1> ; 24/08/2024 1108 0000C400 8B0D[2C810100] <1> mov ecx, [ClusterValue] 1109 <1> ;;; 1110 0000C406 A3[867E0100] <1> mov [FAT_CurrentCluster], eax 1111 0000C40B 89C2 <1> mov edx, eax ; 01/03/2016 1112 0000C40D C605[8A7E0100]02 <1> mov byte [FAT_BuffValidData], 2 1113 0000C414 6683F802 <1> cmp ax, 2 1114 0000C418 724A <1> jb short return_uc_fat12_stc 1115 0000C41A 3B05[967E0100] <1> cmp eax, [LastCluster] 1116 0000C420 7742 <1> ja short return_uc_fat12_stc 1117 0000C422 E91AFFFFFF <1> jmp loc_fat_buffer_updated 1118 <1> 1119 <1> uc_fat12_nc_even: 1120 <1> ; 26/08/2024 1121 <1> ; EVEN cluster number 1122 <1> ; eax = current value (before updated) 1123 <1> ; ecx = new value of the cluster 1124 <1> ; of the cluster 1125 <1> ; high 4 bit of ah is low 4 bit 1126 <1> ; of the next cluster (it must not be overwritten) 1127 <1> 1128 0000C427 662500F0 <1> and ax, 0F000h 1129 <1> ; 24/08/2024 (*) 1130 <1> ;mov ecx, [ClusterValue] ; 32 bits 1131 0000C42B 80E50F <1> and ch, 0Fh 1132 <1> ;or cx, ax 1133 <1> ; 25/07/2022 1134 0000C42E 09C1 <1> or ecx, eax 1135 <1> ;mov ax, dx 1136 0000C430 89D0 <1> mov eax, edx 1137 0000C432 66890B <1> mov [ebx], cx ; 16 bits ! 1138 0000C435 80E40F <1> and ah, 0Fh ; al(bit0..7)+ah(bit0..3) 1139 0000C438 EBC6 <1> jmp short update_fat12_buffer 1140 <1> 1141 <1> update_fat32_cluster: 1142 <1> ; edx = 0 ; 24/08/2024 1143 <1> ;mov ecx, [esi+LD_Clusters] 1144 <1> ;inc ecx 1145 <1> ;mov [LastCluster], ecx 1146 <1> ; 24/08/2024 1147 <1> ; ecx = [LastCluster] 1148 <1> 1149 <1> ; 24/08/2024 1150 <1> ;cmp eax, ecx 1151 <1> ;;ja short return_uc_fat32_stc ; 25/07/2022 1152 <1> ;; 24/08/2024 1153 <1> ;; edx = 0 ; (must be -1 or > 0 after here) 1154 <1> ;ja short return_uc_fat_stc 1155 <1> 1156 <1> pass_uc_fat32_errc: 1157 <1> ;sub edx, edx 1158 0000C43A BB80010000 <1> mov ebx, 180h ; 384 1159 0000C43F F7F3 <1> div ebx 1160 <1> ; EAX = Count of 3 FAT sectors 1161 <1> ; DX = Cluster index in FAT buffer 1162 0000C441 89D3 <1> mov ebx, edx 1163 0000C443 C1E302 <1> shl ebx, 2 ; Multiply by 4 1164 <1> ;mov edx, 3 1165 <1> ; 25/07/2022 1166 <1> ;xor dh, dh 1167 <1> ;mov dl, 3 1168 0000C446 66BA0300 <1> mov dx, 3 1169 0000C44A F7E2 <1> mul edx 1170 <1> ; EBX = Cluster Offset in FAT buffer 1171 <1> ; EAX = FAT Sector 1172 <1> ; EDX = 0 1173 0000C44C 8A0D[8A7E0100] <1> mov cl, [FAT_BuffValidData] 1174 0000C452 80F902 <1> cmp cl, 2 1175 0000C455 7512 <1> jne short loc_uc_check_fat32_buff_sector_load 1176 <1> 1177 <1> loc_uc_check_fat32_buff_sector_save: 1178 0000C457 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 1179 <1> ;jne loc_uc_save_fat_buffer 1180 <1> ;jmp short loc_update_fat32_cell 1181 <1> ; 25/07/2022 1182 0000C45D 741C <1> je short loc_update_fat32_cell 1183 0000C45F E992FEFFFF <1> jmp loc_uc_save_fat_buffer 1184 <1> 1185 <1> return_uc_fat12_stc: 1186 <1> return_uc_fat32_stc: 1187 <1> ; 24/08/2024 1188 0000C464 E964FEFFFF <1> jmp loc_fat_buffer_stc_0 ; (*) 1189 <1> ; 25/07/2022 1190 <1> ;sub eax, eax 1191 <1> ;stc 1192 <1> ;jmp loc_fat_buffer_stc_1 ; (*) 1193 <1> 1194 <1> loc_uc_check_fat32_buff_sector_load: 1195 0000C469 80F901 <1> cmp cl, 1 ; byte [FAT_BuffValidData] 1196 <1> ;jne loc_uc_load_fat_sectors 1197 <1> ; 25/07/2022 1198 0000C46C 7508 <1> jne short loc_uc_load_fat_sects 1199 0000C46E 3B05[8E7E0100] <1> cmp eax, [FAT_BuffSector] 1200 <1> ;jne loc_uc_load_fat_sectors 1201 <1> ; 25/07/2022 1202 0000C474 7405 <1> je short loc_update_fat32_cell 1203 <1> loc_uc_load_fat_sects: 1204 0000C476 E9F0FEFFFF <1> jmp loc_uc_load_fat_sectors 1205 <1> 1206 <1> loc_update_fat32_cell: 1207 <1> loc_update_fat32_buffer: 1208 0000C47B 81C3001C0900 <1> add ebx, FAT_Buffer ; 26/02/2016 1209 0000C481 8B03 <1> mov eax, [ebx] 1210 0000C483 25FFFFFF0F <1> and eax, 0FFFFFFFh ; 28 bit cluster value 1211 <1> 1212 0000C488 8B15[867E0100] <1> mov edx, [FAT_CurrentCluster] ; 01/03/2016 1213 <1> 1214 0000C48E A3[867E0100] <1> mov [FAT_CurrentCluster], eax 1215 0000C493 8B0D[2C810100] <1> mov ecx, [ClusterValue] 1216 <1> ;;; 1217 <1> ; 29/08/2024 1218 0000C499 81E1FFFFFF0F <1> and ecx, 0FFFFFFFh ; 28 bit cluster value 1219 <1> ;;; 1220 0000C49F 890B <1> mov [ebx], ecx ; 29/02/2016 1221 <1> 1222 0000C4A1 C605[8A7E0100]02 <1> mov byte [FAT_BuffValidData], 2 1223 <1> 1224 <1> ; 01/03/2016 1225 0000C4A8 21C0 <1> and eax, eax ; was it free cluster ? 1226 0000C4AA 7513 <1> jnz short loc_upd_fat32_c0 1227 <1> 1228 <1> ;or ecx, ecx ; it will be left free ?! 1229 <1> ;jz short loc_upd_fat32_c3 1230 <1> 1231 0000C4AC 3B563E <1> cmp edx, [esi+LD_BPB+BPB_Reserved+4] ; First free cluster 1232 0000C4AF 751F <1> jne short loc_upd_fat32_c3 1233 <1> 1234 0000C4B1 3B15[967E0100] <1> cmp edx, [LastCluster] 1235 0000C4B7 7206 <1> jb short loc_upd_fat32_c0 1236 <1> 1237 <1> ;mov edx, 2 ; rewind ! 1238 <1> ; 25/07/2022 1239 0000C4B9 29D2 <1> sub edx, edx 1240 0000C4BB B202 <1> mov dl, 2 1241 0000C4BD EB0E <1> jmp short loc_upd_fat32_c2 1242 <1> 1243 <1> loc_upd_fat32_c0: 1244 0000C4BF FF463E <1> inc dword [esi+LD_BPB+BPB_Reserved+4] ; set it to next cluster 1245 0000C4C2 EB0C <1> jmp short loc_upd_fat32_c3 1246 <1> 1247 <1> loc_upd_fat32_c1: 1248 0000C4C4 09C9 <1> or ecx, ecx ; will it be free cluster ? 1249 0000C4C6 7508 <1> jnz short loc_upd_fat32_c3 1250 <1> 1251 0000C4C8 3B563E <1> cmp edx, [esi+LD_BPB+BPB_Reserved+4] ; First free cluster 1252 0000C4CB 7303 <1> jnb short loc_upd_fat32_c3 1253 <1> 1254 <1> loc_upd_fat32_c2: 1255 0000C4CD 89563E <1> mov [esi+LD_BPB+BPB_Reserved+4], edx 1256 <1> 1257 <1> loc_upd_fat32_c3: 1258 0000C4D0 89C2 <1> mov edx, eax 1259 <1> 1260 <1> loc_upd_fat32_c4: 1261 0000C4D2 83F802 <1> cmp eax, 2 1262 0000C4D5 728D <1> jb short return_uc_fat32_stc ; 25/07/2022 1263 <1> 1264 <1> pass_uc_fat32_c_zero_check_2: 1265 0000C4D7 3B05[967E0100] <1> cmp eax, [LastCluster] 1266 0000C4DD 7785 <1> ja short return_uc_fat32_stc ; 25/07/2022 1267 <1> 1268 0000C4DF E95DFEFFFF <1> jmp loc_fat_buffer_updated 1269 <1> 1270 <1> save_fat_buffer: 1271 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 1272 <1> ; 31/08/2024 (TRDOS 386 v2.0.9) 1273 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1274 <1> ; 15/10/2016 1275 <1> ; 01/03/2016 1276 <1> ; 22/02/2016 (TRDOS 386 = TRDOS v2.0) 1277 <1> ; 11/08/2011 1278 <1> ; 09/02/2005 1279 <1> ; INPUT -> 1280 <1> ; None 1281 <1> ; OUTPUT -> 1282 <1> ; cf = 0 -> OK. 1283 <1> ; cf = 1 -> error code in AL (EAX) 1284 <1> ; 1285 <1> ; EBX = FAT_Buffer address 1286 <1> ; 1287 <1> ; (EAX, EDX, ECX, EBX will be modified) 1288 <1> 1289 <1> ;cmp byte [FAT_BuffValidData], 2 1290 <1> ;je short loc_save_fat_buff 1291 <1> 1292 <1> ;loc_save_fat_buffer_retn: 1293 <1> ; xor eax, eax 1294 <1> ; retn 1295 <1> 1296 <1> loc_save_fat_buff: 1297 0000C4E4 31D2 <1> xor edx, edx 1298 0000C4E6 8A35[8B7E0100] <1> mov dh, [FAT_BuffDrvName] 1299 0000C4EC 80FE41 <1> cmp dh, 'A' 1300 0000C4EF 724E <1> jb short loc_save_fat_buffer_inv_data_retn 1301 0000C4F1 80EE41 <1> sub dh, 'A' 1302 0000C4F4 56 <1> push esi ; * 1303 0000C4F5 BE00010900 <1> mov esi, Logical_DOSDisks 1304 0000C4FA 01D6 <1> add esi, edx 1305 <1> 1306 0000C4FC 8A5603 <1> mov dl, [esi+LD_FATType] 1307 <1> ; 19/12/2025 1308 <1> %if 0 1309 <1> and dl, dl 1310 <1> jz short loc_save_fat_buffer_inv_data_pop_retn 1311 <1> %endif 1312 0000C4FF A1[8E7E0100] <1> mov eax, [FAT_BuffSector] 1313 0000C504 80FA02 <1> cmp dl, 2 1314 0000C507 772E <1> ja short loc_save_fat32_buff 1315 <1> 1316 <1> loc_save_fat_12_16_buff: 1317 <1> ; 01/03/2016 1318 <1> ; TRDOS v1 has a FATal bug here! 1319 <1> ; Correct code: mov dx, word ptr [FAT_BuffSector]+2 1320 <1> ; (DX:AX in TRDOS v1 -> EAX in TRDOS v2) 1321 <1> ; 1322 0000C509 0FB74E1C <1> movzx ecx, word [esi+LD_BPB+FATSecs] 1323 0000C50D 29C1 <1> sub ecx, eax 1324 <1> ; TRDOS v1 has a bug here... ('pop esi' was forgotten!) 1325 <1> ;jna short loc_save_fat_buffer_inv_data_retn ; wrong addr! 1326 0000C50F 762D <1> jna short loc_save_fat_buffer_inv_data_pop_retn ; correct addr. 1327 <1> ; 25/07/2022 1328 <1> ;jmp short loc_save_fat_buffer_check_rs3 1329 <1> 1330 <1> loc_save_fat_buffer_check_rs3: 1331 <1> ; 25/07/2022 1332 0000C511 29DB <1> sub ebx, ebx 1333 0000C513 B303 <1> mov bl, 3 1334 <1> ;cmp ecx, 3 1335 0000C515 39D9 <1> cmp ecx, ebx ; 3 1336 0000C517 7602 <1> jna short loc_save_fat_buff_continue 1337 0000C519 89D9 <1> mov ecx, ebx ; mov ecx, 3 1338 <1> loc_save_fat_buff_continue: 1339 0000C51B BB001C0900 <1> mov ebx, FAT_Buffer 1340 0000C520 034660 <1> add eax, [esi+LD_FATBegin] 1341 0000C523 51 <1> push ecx 1342 0000C524 E8BB540000 <1> call disk_write 1343 0000C529 59 <1> pop ecx 1344 0000C52A 7239 <1> jc short loc_save_FAT_buff_write_err 1345 <1> 1346 0000C52C 807E0302 <1> cmp byte [esi+LD_FATType], 2 1347 0000C530 7613 <1> jna short loc_calc_2nd_fat12_16_addr 1348 <1> 1349 <1> loc_calc_2nd_fat32_addr: 1350 0000C532 8B462A <1> mov eax, [esi+LD_BPB+FAT32_FAT_Size] 1351 0000C535 EB12 <1> jmp short loc_calc_2nd_fat_addr 1352 <1> 1353 <1> ; 25/07/2022 1354 <1> loc_save_fat32_buff: 1355 0000C537 8B4E2A <1> mov ecx, [esi+LD_BPB+FAT32_FAT_Size] 1356 0000C53A 29C1 <1> sub ecx, eax 1357 0000C53C 77D3 <1> ja short loc_save_fat_buffer_check_rs3 1358 <1> 1359 <1> loc_save_fat_buffer_inv_data_pop_retn: 1360 0000C53E 5E <1> pop esi ; * 1361 <1> loc_save_fat_buffer_inv_data_retn: 1362 <1> ;mov eax, 0Dh ; Invalid DATA 1363 <1> ; 25/07/2022 1364 0000C53F 29C0 <1> sub eax, eax 1365 <1> ;mov al, 0Dh ; Invalid Data 1366 <1> ; 31/08/2024 1367 0000C541 B01D <1> mov al, ERR_INV_DATA ; 29 ; Invalid Data 1368 0000C543 F9 <1> stc ; cf = 1 1369 0000C544 C3 <1> retn 1370 <1> 1371 <1> loc_calc_2nd_fat12_16_addr: 1372 0000C545 0FB7461C <1> movzx eax, word [esi+LD_BPB+FATSecs] 1373 <1> 1374 <1> loc_calc_2nd_fat_addr: 1375 0000C549 034660 <1> add eax, [esi+LD_FATBegin] 1376 0000C54C 0305[8E7E0100] <1> add eax, [FAT_BuffSector] 1377 0000C552 BB001C0900 <1> mov ebx, FAT_Buffer 1378 <1> ; ecx = 1 to 3 1379 0000C557 E888540000 <1> call disk_write 1380 0000C55C 7207 <1> jc short loc_save_FAT_buff_write_err 1381 <1> ; Valid buffer (1 = valid but do not save) 1382 0000C55E C605[8A7E0100]01 <1> mov byte [FAT_BuffValidData], 1 1383 <1> 1384 <1> loc_save_FAT_buff_write_err: 1385 0000C565 5E <1> pop esi ; * 1386 0000C566 BB001C0900 <1> mov ebx, FAT_Buffer 1387 <1> ; 15/10/2016 (1Dh -> 18) 1388 <1> ; 23/03/2016 (1Dh) 1389 0000C56B B812000000 <1> mov eax, 18 ; Drive not ready or write error 1390 0000C570 C3 <1> retn 1391 <1> 1392 <1> calculate_fat_freespace: 1393 <1> ; 21/12/2025 (TRDOS 386 Kernel v2.0.10) 1394 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1395 <1> ; 23/03/2016 1396 <1> ; 02/03/2016 1397 <1> ; 01/03/2016 1398 <1> ; 29/02/2016 1399 <1> ; 22/02/2016 (TRDOS 386 = TRDOS v2.0) 1400 <1> ; 30/04/2011 1401 <1> ; 03/04/2010 1402 <1> ; 2005 1403 <1> ; INPUT -> 1404 <1> ; EAX = Cluster count to be added or subtracted 1405 <1> ; If BH = FFh, ESI = TR-DOS Logical Drive Description Table 1406 <1> ; If BH < FFh, BH = TR-DOS Logical Drive Number 1407 <1> ; BL: 1408 <1> ; 0 = Calculate, 1 = Add, 2 = Subtract, 3 = Get (Not Set/Calc) 1409 <1> ; OUTPUT -> 1410 <1> ; EAX = Free Space in sectors 1411 <1> ; ESI = Logical Dos Drive Description Table address 1412 <1> ; BH = Logical Dos Drive Number (same with input value of BH) 1413 <1> ; BL = Type of operation (same with input value of BL) 1414 <1> ; ECX = 0 -> valid 1415 <1> ; ECX > 0 -> error or invalid 1416 <1> ; If EAX = FFFFFFFFh, it is 're-calculation needed' 1417 <1> ; sign due to r/w error 1418 <1> ; 1419 <1> ; (Modifed registers: eax, ebx, ecx, edx, esi) 1420 <1> ; 1421 <1> 1422 0000C571 66891D[32810100] <1> mov [CFS_OPType], bx 1423 0000C578 A3[34810100] <1> mov [CFS_CC], eax 1424 <1> 1425 0000C57D 80FFFF <1> cmp bh, 0FFh 1426 0000C580 740B <1> je short pass_calculate_freespace_get_drive_dt_offset 1427 <1> 1428 <1> loc_calculate_freespace_get_drive_dt_offset: 1429 0000C582 31C0 <1> xor eax, eax 1430 0000C584 88FC <1> mov ah, bh 1431 0000C586 BE00010900 <1> mov esi, Logical_DOSDisks 1432 0000C58B 01C6 <1> add esi, eax 1433 <1> 1434 <1> pass_calculate_freespace_get_drive_dt_offset: 1435 0000C58D 08DB <1> or bl, bl 1436 0000C58F 7436 <1> jz short loc_reset_fcc 1437 <1> 1438 <1> loc_get_free_sectors: 1439 0000C591 8B4674 <1> mov eax, [esi+LD_FreeSectors] 1440 <1> 1441 <1> ;xor ecx, ecx 1442 <1> ;dec ecx ; 0FFFFFFFFh 1443 <1> ;cmp eax, ecx ; 29/02/2016 1444 <1> ;je short loc_get_free_sectors_retn ; recalculation is needed! 1445 <1> 1446 <1> ; 23/03/2016 1447 0000C594 8B4E70 <1> mov ecx, [esi+LD_TotalSectors] 1448 0000C597 39C1 <1> cmp ecx, eax ; Total sectors must be greater than Free sectors ! 1449 0000C599 7707 <1> ja short loc_get_free_sectors_check_optype 1450 <1> 1451 0000C59B 31C0 <1> xor eax, eax 1452 0000C59D 48 <1> dec eax ; 0FFFFFFFFh ; recalculation is needed! 1453 0000C59E 894674 <1> mov [esi+LD_FreeSectors], eax ; reset (for recalculation) 1454 <1> 1455 <1> loc_get_free_sectors_retn: 1456 0000C5A1 C3 <1> retn 1457 <1> 1458 <1> loc_get_free_sectors_check_optype: 1459 0000C5A2 80FB03 <1> cmp bl, 3 1460 0000C5A5 7203 <1> jb short loc_set_fcc_1 ; 25/07/2022 1461 <1> 1462 0000C5A7 29C9 <1> sub ecx, ecx ; 0 1463 <1> 1464 0000C5A9 C3 <1> retn 1465 <1> 1466 <1> loc_set_fcc_1: 1467 0000C5AA 807E0302 <1> cmp byte [esi+LD_FATType], 2 1468 <1> ;ja loc_update_FAT32_fs_info_fcc 1469 <1> ; 25/07/2022 1470 0000C5AE 7605 <1> jna short loc_set_fcc_2 1471 0000C5B0 E9DD000000 <1> jmp loc_update_FAT32_fs_info_fcc 1472 <1> 1473 <1> loc_set_fcc_2: 1474 <1> ;mov eax, [esi+LD_FreeSectors] 1475 0000C5B5 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+SecPerClust] 1476 0000C5B9 29D2 <1> sub edx, edx 1477 0000C5BB F7F1 <1> div ecx 1478 <1> ;or dx, dx 1479 <1> ; ; DX -> Remain sectors < SecPerClust 1480 <1> ; ; DX > 0 -> invalid free sector count 1481 <1> ;jnz short loc_reset_fcc 1482 <1> 1483 <1> ;pass_set_fcc_div32: 1484 0000C5BD A3[A87E0100] <1> mov [FreeClusterCount], eax 1485 0000C5C2 E986000000 <1> jmp loc_set_free_sectors_FAT12_FAT16 1486 <1> 1487 <1> loc_reset_fcc: 1488 0000C5C7 31C0 <1> xor eax, eax 1489 0000C5C9 A3[A87E0100] <1> mov [FreeClusterCount], eax ; 0 1490 0000C5CE 8B5678 <1> mov edx, [esi+LD_Clusters] 1491 0000C5D1 42 <1> inc edx 1492 0000C5D2 8915[967E0100] <1> mov [LastCluster], edx 1493 <1> 1494 0000C5D8 807E0302 <1> cmp byte [esi+LD_FATType], 2 1495 0000C5DC 7645 <1> jna short loc_count_free_fat_clusters_0 1496 <1> 1497 0000C5DE 48 <1> dec eax ; FFFFFFFFh 1498 0000C5DF A3[3C810100] <1> mov [CFS_FAT32FC], eax 1499 <1> 1500 <1> ; 29/02/2016 1501 0000C5E4 89463A <1> mov [esi+LD_BPB+BPB_Reserved], eax ; reset 1502 0000C5E7 89463E <1> mov [esi+LD_BPB+BPB_Reserved+4], eax ; reset 1503 <1> 1504 <1> ;mov eax, 2 1505 <1> ; 25/07/2022 1506 0000C5EA 40 <1> inc eax ; eax = 0 1507 0000C5EB B002 <1> mov al, 2 1508 <1> 1509 <1> loc_count_fc_next_cluster_0: 1510 0000C5ED 50 <1> push eax 1511 0000C5EE E896F9FFFF <1> call get_next_cluster 1512 0000C5F3 7310 <1> jnc short loc_check_fat32_ff_cluster 1513 0000C5F5 09C0 <1> or eax, eax 1514 0000C5F7 741E <1> jz short pass_inc_cfs_fcc_0 1515 <1> 1516 <1> loc_put_fcc_unknown_sign: 1517 0000C5F9 58 <1> pop eax 1518 <1> ; "Free count is Unknown" sign 1519 <1> ;mov dword [FreeClusterCount], 0FFFFFFFFh 1520 <1> 1521 <1> ; 29/02/2016 1522 <1> ; Save Free Cluster Count value in FAT32 'BPB_Reserved' area 1523 <1> ;mov [esi+LD_BPB+BPB_Reserved], 0FFFFFFFFh ; unknown! 1524 0000C5FA 8B15[3C810100] <1> mov edx, [CFS_FAT32FC] ; First Free Cluster 1525 <1> ; Save First Free Cluster value in FAT32 'BPB_Reserved+4' area 1526 0000C600 89563E <1> mov [esi+LD_BPB+BPB_Reserved+4], edx 1527 <1> 1528 0000C603 EB7D <1> jmp loc_put_fcc_invalid_sign 1529 <1> 1530 <1> loc_check_fat32_ff_cluster: 1531 0000C605 09C0 <1> or eax, eax 1532 0000C607 750E <1> jnz short pass_inc_cfs_fcc_0 1533 0000C609 58 <1> pop eax 1534 0000C60A A3[3C810100] <1> mov [CFS_FAT32FC], eax 1535 <1> ;mov dword [FreeClusterCount], 1 1536 0000C60F FF05[A87E0100] <1> inc dword [FreeClusterCount] 1537 0000C615 EB27 <1> jmp short pass_inc_cfs_fcc_1 1538 <1> 1539 <1> pass_inc_cfs_fcc_0: 1540 0000C617 58 <1> pop eax 1541 <1> 1542 <1> pass_inc_cfs_fcc_0c: 1543 0000C618 40 <1> inc eax ; add eax, 1 1544 0000C619 3B05[967E0100] <1> cmp eax, [LastCluster] 1545 0000C61F 76CC <1> jna short loc_count_fc_next_cluster_0 1546 0000C621 EB6F <1> jmp short loc_update_FAT32_fs_info_fcc 1547 <1> 1548 <1> loc_count_free_fat_clusters_0: 1549 <1> ;mov eax, 2 1550 0000C623 B002 <1> mov al, 2 1551 <1> 1552 <1> loc_count_fc_next_cluster: 1553 0000C625 50 <1> push eax 1554 0000C626 E85EF9FFFF <1> call get_next_cluster 1555 0000C62B 720C <1> jc short loc_count_fcc_stc 1556 <1> 1557 <1> loc_count_free_clusters_1: 1558 0000C62D 21C0 <1> and eax, eax 1559 0000C62F 750C <1> jnz short pass_inc_cfs_fcc 1560 <1> 1561 0000C631 FF05[A87E0100] <1> inc dword [FreeClusterCount] 1562 0000C637 EB04 <1> jmp short pass_inc_cfs_fcc 1563 <1> 1564 <1> loc_count_fcc_stc: 1565 0000C639 09C0 <1> or eax, eax 1566 0000C63B 75BC <1> jnz short loc_put_fcc_unknown_sign ; 29/02/2016 1567 <1> 1568 <1> pass_inc_cfs_fcc: 1569 0000C63D 58 <1> pop eax 1570 <1> 1571 <1> pass_inc_cfs_fcc_1: 1572 0000C63E 40 <1> inc eax ; add eax, 1 1573 0000C63F 3B05[967E0100] <1> cmp eax, [LastCluster] 1574 0000C645 76DE <1> jna short loc_count_fc_next_cluster 1575 <1> 1576 <1> loc_set_free_sectors: 1577 0000C647 807E0302 <1> cmp byte [esi+LD_FATType], 2 1578 0000C64B 7745 <1> ja short loc_update_FAT32_fs_info_fcc 1579 <1> 1580 <1> loc_set_free_sectors_FAT12_FAT16: 1581 0000C64D 803D[32810100]00 <1> cmp byte [CFS_OPType], 0 1582 0000C654 761C <1> jna short pass_FAT_add_sub_fcc 1583 0000C656 A1[34810100] <1> mov eax, [CFS_CC] 1584 0000C65B 803D[32810100]01 <1> cmp byte [CFS_OPType], 1 1585 0000C662 7708 <1> ja short pass_FAT_add_fcc 1586 0000C664 0105[A87E0100] <1> add [FreeClusterCount], eax 1587 0000C66A EB06 <1> jmp short pass_FAT_add_sub_fcc 1588 <1> 1589 <1> pass_FAT_add_fcc: 1590 0000C66C 2905[A87E0100] <1> sub [FreeClusterCount], eax 1591 <1> 1592 <1> pass_FAT_add_sub_fcc: 1593 0000C672 0FB64613 <1> movzx eax, byte [esi+LD_BPB+SecPerClust] 1594 0000C676 8B15[A87E0100] <1> mov edx, [FreeClusterCount] 1595 0000C67C F7E2 <1> mul edx 1596 <1> 1597 0000C67E 31C9 <1> xor ecx, ecx 1598 0000C680 EB05 <1> jmp short loc_cfs_retn_params 1599 <1> 1600 <1> loc_put_fcc_invalid_sign: 1601 0000C682 29C0 <1> sub eax, eax ; 0 1602 0000C684 48 <1> dec eax ; FFFFFFFFh 1603 <1> loc_fat32_ffc_recalc_needed: 1604 0000C685 89C1 <1> mov ecx, eax 1605 <1> 1606 <1> loc_cfs_retn_params: 1607 0000C687 894674 <1> mov [esi+LD_FreeSectors], eax 1608 0000C68A 0FB71D[32810100] <1> movzx ebx, word [CFS_OPType] 1609 0000C691 C3 <1> retn 1610 <1> 1611 <1> loc_update_FAT32_fs_info_fcc: 1612 <1> loc_check_fcc_FSINFO_op: 1613 <1> ; 29/02/2016 1614 <1> ; EAX = Free cluster count (before this update) ; value from disk 1615 <1> ; EDX = First Free Cluster (before this update) ; value from disk 1616 0000C692 803D[32810100]01 <1> cmp byte [CFS_OPType], 1 1617 0000C699 7221 <1> jb short loc_cfs_FAT32_get_rcalc_parms ; 0 = recalculated 1618 0000C69B 7406 <1> je short loc_check_fcc_FSINFO_op1 ; 1 = add 1619 <1> loc_check_fcc_FSINFO_op2: ; subtract 1620 0000C69D F71D[34810100] <1> neg dword [CFS_CC] ; prepare to subtract ; 2 = sub (add negative) 1621 <1> loc_check_fcc_FSINFO_op1: 1622 <1> ; 01/03/2016 1623 0000C6A3 31D2 <1> xor edx, edx ; 0 1624 0000C6A5 4A <1> dec edx ; 0FFFFFFFFh 1625 0000C6A6 8B463A <1> mov eax, [esi+LD_BPB+BPB_Reserved] 1626 0000C6A9 39D0 <1> cmp eax, edx 1627 <1> ;jnb short loc_put_fcc_invalid_sign 1628 <1> ; 21/12/2025 1629 0000C6AB 73D8 <1> jnb short loc_fat32_ffc_recalc_needed 1630 <1> 1631 0000C6AD 0305[34810100] <1> add eax, [CFS_CC] ; free cluster count on disk + current count 1632 0000C6B3 72CD <1> jc short loc_put_fcc_invalid_sign 1633 <1> 1634 0000C6B5 A3[A87E0100] <1> mov [FreeClusterCount], eax 1635 0000C6BA EB0E <1> jmp short loc_cfs_write_FSINFO_sector 1636 <1> 1637 <1> loc_cfs_FAT32_get_rcalc_parms: 1638 0000C6BC 8B15[3C810100] <1> mov edx, [CFS_FAT32FC] 1639 0000C6C2 A1[A87E0100] <1> mov eax, [FreeClusterCount] 1640 0000C6C7 89563E <1> mov [esi+LD_BPB+BPB_Reserved+4], edx ; First Free Cluster 1641 <1> loc_cfs_write_FSINFO_sector: 1642 0000C6CA 89463A <1> mov [esi+LD_BPB+BPB_Reserved], eax ; Free cluster count 1643 <1> 1644 0000C6CD E8BC000000 <1> call set_fat32_fsinfo_sector_parms 1645 0000C6D2 72AE <1> jc short loc_put_fcc_invalid_sign 1646 <1> 1647 <1> loc_set_FAT32_free_sectors: 1648 <1> ; 29/02/2016 1649 <1> ;mov eax, [FreeClusterCount] 1650 <1> ;mov ecx, eax 1651 <1> ;cmp eax, 0FFFFFFFFh ; Invalid ! 1652 <1> ;je short loc_cfs_retn_params 1653 <1> ; 1654 0000C6D4 8B0D[A87E0100] <1> mov ecx, [FreeClusterCount] 1655 0000C6DA 0FB64613 <1> movzx eax, byte [esi+LD_BPB+SecPerClust] 1656 0000C6DE F7E1 <1> mul ecx 1657 <1> ; 29/02/2016 1658 0000C6E0 31C9 <1> xor ecx, ecx ; 0 1659 0000C6E2 09D2 <1> or edx, edx ; 0 ? 1660 0000C6E4 759C <1> jnz short loc_put_fcc_invalid_sign ; 25/07/2022 1661 0000C6E6 394670 <1> cmp [esi+LD_TotalSectors], eax ; Volume size in sectors 1662 0000C6E9 7697 <1> jna short loc_put_fcc_invalid_sign 1663 <1> ; 1664 <1> loc_set_FAT32_free_sectors_ok: 1665 0000C6EB 31D2 <1> xor edx, edx ; 0 1666 0000C6ED EB98 <1> jmp short loc_cfs_retn_params 1667 <1> ; 1668 <1> 1669 <1> get_last_cluster: 1670 <1> ; 22/10/2016 1671 <1> ; 27/02/2016 (TRDOS 386 = TRDOS v2.0) 1672 <1> ; 12/06/2010 (DRV_FAT.ASM, 'proc_get_last_custer') 1673 <1> ; 06/06/2010 1674 <1> ; INPUT -> 1675 <1> ; EAX = First Cluster Number 1676 <1> ; ESI = Logical Dos Drive Parameters Table 1677 <1> ; OUTPUT -> 1678 <1> ; cf = 0 -> No Error, EAX is valid 1679 <1> ; cf = 1 -> EAX > 0 -> Error 1680 <1> ; EAX = Last Cluster Number 1681 <1> ; ECX = Previous Cluster -just before the last cluster- 1682 <1> ; ; 22/10/2016 1683 <1> ; [glc_index] = cluster index number of the last cluster 1684 <1> ; 1685 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 1686 <1> 1687 0000C6EF 89C1 <1> mov ecx, eax 1688 <1> 1689 0000C6F1 C705[44810100]FFFF- <1> mov dword [glc_index], 0FFFFFFFFh ; 22/10/2016 1689 0000C6F9 FFFF <1> 1690 <1> 1691 <1> loc_glc_get_next_cluster_1: 1692 0000C6FB 890D[40810100] <1> mov [glc_prevcluster], ecx 1693 <1> ; 22/10/2016 1694 0000C701 FF05[44810100] <1> inc dword [glc_index] 1695 <1> 1696 <1> loc_glc_get_next_cluster_2: 1697 0000C707 E87DF8FFFF <1> call get_next_cluster 1698 <1> ; ecx = current/previous cluster 1699 <1> ; eax = next/last cluster 1700 0000C70C 73ED <1> jnc short loc_glc_get_next_cluster_1 1701 <1> 1702 0000C70E 09C0 <1> or eax, eax 1703 0000C710 7509 <1> jnz short loc_glc_stc_retn 1704 <1> 1705 <1> ; ecx = previous cluster 1706 0000C712 89C8 <1> mov eax, ecx 1707 <1> 1708 <1> ; previous cluster becomes last cluster (ecx -> eax) 1709 <1> ; previous of previous cluster becomes previous cluster (ecx) 1710 <1> 1711 <1> loc_glc_prev_cluster_retn: 1712 0000C714 8B0D[40810100] <1> mov ecx, [glc_prevcluster] 1713 0000C71A C3 <1> retn 1714 <1> 1715 <1> loc_glc_stc_retn: 1716 0000C71B F5 <1> cmc ;stc 1717 0000C71C EBF6 <1> jmp short loc_glc_prev_cluster_retn 1718 <1> 1719 <1> truncate_cluster_chain: 1720 <1> ; 31/08/2024 - TRDOS 386 v2.0.9 1721 <1> ; 01/03/2016 1722 <1> ; 28/02/2016 (TRDOS 386 = TRDOS v2.0) 1723 <1> ; 22/01/2011 (DRV_FAT.ASM, 'proc_truncate_cluster_chain') 1724 <1> ; 11/09/2010 1725 <1> ; INPUT -> 1726 <1> ; ESI = Logical dos drive description table address 1727 <1> ; EAX = First cluster to be truncated/unlinked 1728 <1> ; OUTPUT -> 1729 <1> ; ESI = Logical dos drive description table address 1730 <1> ; ECX = Count of truncated/removed clusters 1731 <1> ; CF = 0 -> EAX = Free sectors 1732 <1> ; CF = 1 -> Error code in EAX (AL) 1733 <1> 1734 <1> ; NOTE: This procedure does not update lm date&time ! 1735 <1> 1736 <1> loc_truncate_cc: 1737 0000C71E 31C9 <1> xor ecx, ecx ; mov ecx, 0 1738 <1> ;mov byte [FAT_BuffValidData], 0 1739 0000C720 890D[927E0100] <1> mov [FAT_ClusterCounter], ecx ; 0 ; reset 1740 <1> 1741 <1> ;;; 1742 <1> ; 31/08/2024 1743 0000C726 21C0 <1> and eax, eax ; 0 1744 0000C728 740D <1> jz short loc_tcc_unlink_zero_cluster ; zero 1745 <1> ;cmp eax, 0FFFFFF7h 1746 0000C72A 3DFFFFFF0F <1> cmp eax, 0FFFFFFFh ; 28 bit cluster number limit (EOF) 1747 0000C72F 7207 <1> jb short loc_tcc_unlink_clusters 1748 <1> 1749 <1> ; (possible FAT32) EOF signature... 1750 <1> ; not a valid cluster number 1751 <1> ; 1752 <1> ; NOTE: update_cluster returns EOF (if eax > [LastCluster]) 1753 <1> ; instead of invalid data error 1754 <1> 1755 0000C731 B81D000000 <1> mov eax, ERR_INV_DATA ; invalid cluster number 1756 0000C736 F9 <1> stc 1757 <1> loc_tcc_unlink_zero_cluster: ; nothing to do 1758 0000C737 C3 <1> retn 1759 <1> ;;; 1760 <1> 1761 <1> loc_tcc_unlink_clusters: 1762 0000C738 E833FBFFFF <1> call update_cluster 1763 <1> ; EAX = Next Cluster 1764 <1> ; ECX = Cluster Value 1765 <1> ; Note: 1766 <1> ; Returns count of unlinked clusters in 1767 <1> ; dword ptr FAT_ClusterCounter 1768 0000C73D 73F9 <1> jnc short loc_tcc_unlink_clusters 1769 <1> 1770 <1> ; error or EOF (end of cluster chain) ; 31/08/2024 1771 <1> 1772 <1> pass_tcc_unlink_clusters: 1773 0000C73F A2[4B810100] <1> mov byte [TCC_FATErr], al 1774 0000C744 803D[8A7E0100]02 <1> cmp byte [FAT_BuffValidData], 2 1775 0000C74B 750E <1> jne short loc_tcc_calculate_FAT_freespace 1776 0000C74D E892FDFFFF <1> call save_fat_buffer 1777 0000C752 7307 <1> jnc short loc_tcc_calculate_FAT_freespace 1778 0000C754 A2[4B810100] <1> mov byte [TCC_FATErr], al ; Error 1779 <1> ;mov byte [FAT_BuffValidData], 0 1780 <1> 1781 <1> ; 01/03/2016 1782 0000C759 EB12 <1> jmp short loc_tcc_recalculate_FAT_freespace 1783 <1> 1784 <1> loc_tcc_calculate_FAT_freespace: 1785 0000C75B A1[927E0100] <1> mov eax, [FAT_ClusterCounter] ; signed (+-) number 1786 0000C760 66BB01FF <1> mov bx, 0FF01h ; BH = FFh -> ESI = Dos drv desc. table 1787 <1> ; BL = 1 -> add cluster(s) 1788 0000C764 E808FEFFFF <1> call calculate_fat_freespace 1789 0000C769 21C9 <1> and ecx, ecx ; cx = 0 -> valid free sector count 1790 0000C76B 7409 <1> jz short pass_truncate_cc_recalc_FAT_freespace 1791 <1> 1792 <1> loc_tcc_recalculate_FAT_freespace: 1793 0000C76D 66BB00FF <1> mov bx, 0FF00h ; recalculate ! 1794 0000C771 E8FBFDFFFF <1> call calculate_fat_freespace 1795 <1> 1796 <1> loc_tcc_calculate_FAT_freespace_err: 1797 <1> pass_truncate_cc_recalc_FAT_freespace: 1798 0000C776 8B0D[927E0100] <1> mov ecx, [FAT_ClusterCounter] 1799 <1> 1800 0000C77C 803D[4B810100]00 <1> cmp byte [TCC_FATErr], 0 1801 0000C783 7608 <1> jna short loc_tcc_unlink_clusters_retn 1802 <1> 1803 <1> loc_tcc_unlink_clusters_error: 1804 0000C785 0FB605[4B810100] <1> movzx eax, byte [TCC_FATErr] 1805 0000C78C F9 <1> stc 1806 <1> loc_tcc_unlink_clusters_retn: 1807 0000C78D C3 <1> retn 1808 <1> 1809 <1> set_fat32_fsinfo_sector_parms: 1810 <1> ; 15/10/2016 1811 <1> ; 23/03/2016 1812 <1> ; 29/02/2016 (TRDOS 386 = TRDOS v2.0) 1813 <1> ; INPUT -> 1814 <1> ; ESI = Logical dos drive description table address 1815 <1> ; [esi+LD_BPB+BPB_Reserved] = Free Cluster Count 1816 <1> ; [esi+LD_BPB+BPB_Reserved+4] = First Free Cluster 1817 <1> ; OUTPUT -> 1818 <1> ; ESI = Logical dos drive description table address 1819 <1> ; CF = 0 -> OK.. 1820 <1> ; CF = 1 -> Error code in EAX (AL) 1821 <1> ; 1822 <1> ; (Modified registers: EAX, EBX, ECX, EDX) 1823 <1> 1824 0000C78E E824000000 <1> call get_fat32_fsinfo_sector_parms 1825 0000C793 7221 <1> jc short update_fat32_fsinfo_sector_retn 1826 <1> 1827 0000C795 8B463A <1> mov eax, [esi+LD_BPB+BPB_Reserved] ; Free Cluster Count 1828 0000C798 8B563E <1> mov edx, [esi+LD_BPB+BPB_Reserved+4] ; First free Cluster 1829 <1> 1830 <1> ;mov ebx, DOSBootSectorBuff 1831 0000C79B 8983E8010000 <1> mov [ebx+488], eax 1832 0000C7A1 8993EC010000 <1> mov [ebx+492], edx 1833 <1> 1834 0000C7A7 A1[38810100] <1> mov eax, [CFS_FAT32FSINFOSEC] 1835 0000C7AC B901000000 <1> mov ecx, 1 1836 0000C7B1 E82E520000 <1> call disk_write 1837 <1> ;jnc short update_fat32_fsinfo_sector_retn 1838 <1> 1839 <1> ; 15/10/2016 (1Dh -> 18) 1840 <1> ; 23/03/2016 (1Dh) 1841 <1> ;mov eax, 18 ; Drive not ready or write error 1842 <1> 1843 <1> update_fat32_fsinfo_sector_retn: 1844 0000C7B6 C3 <1> retn 1845 <1> 1846 <1> get_fat32_fsinfo_sector_parms: 1847 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1848 <1> ; 15/10/2016 1849 <1> ; 23/03/2016 1850 <1> ; 01/03/2016 1851 <1> ; 29/02/2016 (TRDOS 386 = TRDOS v2.0) 1852 <1> ; INPUT -> 1853 <1> ; ESI = Logical dos drive description table address 1854 <1> ; OUTPUT -> 1855 <1> ; ESI = Logical dos drive description table address 1856 <1> ; EBX = FSINFO sector buffer address (DOSBootSectorBuff) 1857 <1> ; CF = 0 -> OK.. 1858 <1> ; EAX = FsInfo sector address 1859 <1> ; ECX = Free cluster count 1860 <1> ; EDX = First free cluster 1861 <1> ; CF = 1 -> Error code in AL (EAX) 1862 <1> ; EBX = 0 1863 <1> ; 1864 <1> ; [CFS_FAT32FSINFOSEC] = FAT32 FSINFO sector address 1865 <1> ; 1866 <1> ; (Modified registers: EAX, EBX, ECX, EDX) 1867 <1> 1868 0000C7B7 0FB74636 <1> movzx eax, word [esi+LD_BPB+FAT32_FSInfoSec] 1869 0000C7BB 03466C <1> add eax, [esi+LD_StartSector] 1870 0000C7BE A3[38810100] <1> mov [CFS_FAT32FSINFOSEC], eax 1871 <1> 1872 0000C7C3 BB[867C0100] <1> mov ebx, DOSBootSectorBuff 1873 <1> ;mov ecx, 1 1874 <1> ; 25/07/2022 1875 0000C7C8 29C9 <1> sub ecx, ecx 1876 0000C7CA FEC1 <1> inc cl 1877 <1> ; ecx = 1 1878 0000C7CC E822520000 <1> call disk_read 1879 0000C7D1 722F <1> jc short loc_read_FAT32_fsinfo_sec_err 1880 <1> 1881 0000C7D3 BB[867C0100] <1> mov ebx, DOSBootSectorBuff 1882 <1> 1883 0000C7D8 813B52526141 <1> cmp dword [ebx], 41615252h 1884 0000C7DE 751E <1> jne short loc_read_FAT32_fsinfo_sec_stc 1885 <1> 1886 0000C7E0 81BBE4010000727241- <1> cmp dword [ebx+484], 61417272h 1886 0000C7E9 61 <1> 1887 0000C7EA 7512 <1> jne short loc_read_FAT32_fsinfo_sec_stc 1888 <1> 1889 0000C7EC A1[38810100] <1> mov eax, [CFS_FAT32FSINFOSEC] 1890 0000C7F1 8B8BE8010000 <1> mov ecx, [ebx+488] ; free cluster count 1891 0000C7F7 8B93EC010000 <1> mov edx, [ebx+492] ; first (next) free cluster 1892 <1> 1893 0000C7FD C3 <1> retn 1894 <1> 1895 <1> loc_read_FAT32_fsinfo_sec_stc: 1896 <1> ; 15/10/2016 (0Bh -> 28) 1897 <1> ;mov eax, 28 ; Invalid format! 1898 <1> ; 25/07/2022 1899 0000C7FE B31C <1> mov bl, 28 1900 0000C800 EB02 <1> jmp short loc_read_FAT32_fsinfo_sec_stc_retn 1901 <1> 1902 <1> loc_read_FAT32_fsinfo_sec_err: 1903 <1> ; 15/10/2016 (15h -> 17) 1904 <1> ; 23/03/2016 (15h) 1905 <1> ;mov eax, 17 ; Drive not ready or read error 1906 <1> ; 25/07/2022 1907 0000C802 B311 <1> mov bl, 17 1908 <1> loc_read_FAT32_fsinfo_sec_stc_retn: 1909 <1> ; 25/07/2022 1910 0000C804 29C0 <1> sub eax, eax 1911 0000C806 88D8 <1> mov al, bl ; error code 1912 <1> ; eax = error code 1913 0000C808 29DB <1> sub ebx, ebx ; 0 1914 0000C80A F9 <1> stc 1915 0000C80B C3 <1> retn 1916 <1> 1917 <1> add_new_cluster: 1918 <1> ; 30/08/2024 1919 <1> ; 27/08/2024 1920 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 1921 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 1922 <1> ; 15/10/2016 1923 <1> ; 16/05/2016 1924 <1> ; 18/03/2016, 24/03/2016 1925 <1> ; 11/03/2016 (TRDOS 386 = TRDOS v2.0) 1926 <1> ; 30/07/2011 (DRV_FAT.ASM) 1927 <1> ; 11/09/2010 1928 <1> ; INPUT -> 1929 <1> ; ESI = Logical dos drv desc. table address 1930 <1> ; EAX = Last cluster 1931 <1> ; OUTPUT -> 1932 <1> ; ESI = Logical dos drv desc. table address 1933 <1> ; EAX = New Last cluster (next cluster) 1934 <1> ; cf = 1 -> error code in EAX (AL) 1935 <1> ; cf = 1 -> EBX = sectors per cluster 1936 <1> ; ECX = Free sectors 1937 <1> ;;; 25/07/2022 1938 <1> ; (EBX = sectors per cluster -not used-) 1939 <1> ; EDX = 0 (if cf = 0) 1940 <1> ; NOTE: 1941 <1> ; This procedure does not update lm date&time ! 1942 <1> ; ; 30/08/2024 1943 <1> ; and doesn't update 1st clust and file size fields ! 1944 <1> ; 1945 <1> ; (Modified registers: EAX, EBX, ECX, EDX, EDI) 1946 <1> 1947 0000C80C A3[68820100] <1> mov [FAT_anc_LCluster], eax 1948 <1> 1949 0000C811 E885F9FFFF <1> call get_first_free_cluster 1950 0000C816 7206 <1> jc short loc_add_new_cluster_retn 1951 <1> ; EAX >= 2 and EAX < FFFFFFFFh is valid 1952 <1> 1953 <1> ;mov edx, eax 1954 <1> ; 1955 <1> ;inc edx 1956 <1> ;;jnz short loc_add_new_cluster_check_ffc_eax 1957 <1> ;jnz short loc_add_new_cluster_save_fcc 1958 <1> 1959 <1> ; 27/08/2024 1960 0000C818 40 <1> inc eax ; (*) 1961 0000C819 750D <1> jnz short loc_add_new_cluster_save_fcc 1962 <1> 1963 <1> loc_add_new_cluster_no_disk_space_retn: 1964 <1> ;mov eax, 27h ; MSDOS err => insufficient disk space 1965 <1> ; 27/08/2024 1966 <1> ; eax = 0 1967 <1> ; 25/07/2022 1968 <1> ;xor eax, eax 1969 0000C81B B027 <1> mov al, 27h 1970 <1> loc_add_new_cluster_stc_retn: 1971 0000C81D F9 <1> stc 1972 <1> loc_add_new_cluster_retn: 1973 <1> ; 25/07/2022 1974 <1> ;movzx ebx, byte [esi+LD_BPB+SecPerClust] 1975 0000C81E 8B4E74 <1> mov ecx, [esi+LD_FreeSectors] 1976 <1> ;xor edx, edx 1977 <1> ;stc 1978 0000C821 C3 <1> retn 1979 <1> 1980 <1> loc_anc_invalid_format_stc_retn: 1981 <1> ; 27/08/2024 1982 <1> ;stc 1983 <1> loc_add_new_cluster_invalid_format_retn: 1984 <1> ; 15/10/2016 (0Bh -> 28) 1985 <1> ;mov eax, 28 ; Invalid format 1986 <1> ;jmp short loc_add_new_cluster_retn 1987 <1> ; 25/07/2022 1988 0000C822 29C0 <1> sub eax, eax 1989 0000C824 B01C <1> mov al, 28 1990 0000C826 EBF5 <1> jmp short loc_add_new_cluster_stc_retn 1991 <1> 1992 <1> ;loc_add_new_cluster_check_ffc_eax: 1993 <1> ; cmp eax, 2 1994 <1> ; jb short loc_add_new_cluster_invalid_format_retn 1995 <1> 1996 <1> loc_add_new_cluster_save_fcc: 1997 <1> ;;; 1998 <1> ; 27/08/2024 1999 0000C828 48 <1> dec eax ; (*) 2000 <1> ;;; 2001 0000C829 A3[6C820100] <1> mov [FAT_anc_FFCluster], eax 2002 <1> 2003 <1> ; 27/08/2024 (TRDOS 386 v2.0.9) 2004 <1> %if 0 2005 <1> sub eax, 2 2006 <1> movzx ebx, byte [esi+LD_BPB+SecPerClust] 2007 <1> mul ebx 2008 <1> or edx, edx 2009 <1> jnz short loc_anc_invalid_format_stc_retn 2010 <1> 2011 <1> loc_add_new_cluster_allocate_cluster: 2012 <1> ; 18/03/2016 2013 <1> xchg edx, eax ; eax = 0 2014 <1> ; 16/05/2016 2015 <1> ;cmp [ClusterBuffer_Valid], al ; 0 2016 <1> ;jna short loc_anc_clear_cluster_buffer 2017 <1> ;; 'copy' command, 2018 <1> ;; writing destination file clust after reading source file clust 2019 <1> ;mov [ClusterBuffer_Valid], al ; 0 ; reset 2020 <1> ;jmp short loc_add_new_cluster_write_nc_to_disk 2021 <1> 2022 <1> loc_anc_clear_cluster_buffer: 2023 <1> ; 11/03/2016 2024 <1> ; Clear buffer 2025 <1> mov edi, Cluster_Buffer ; 70000h (for current TRDOS 386 version) 2026 <1> mov ecx, ebx ; sector count 2027 <1> shl ecx, 7 ; 1 sector = 512 bytes -> 128 double words 2028 <1> ;xor eax, eax ; 0 2029 <1> rep stosd 2030 <1> 2031 <1> loc_add_new_cluster_write_nc_to_disk: 2032 <1> ; 11/03/2016 2033 <1> ;xchg eax, edx ; edx = 0, eax = sector offset 2034 <1> mov eax, edx 2035 <1> add eax, [esi+LD_DATABegin] 2036 <1> jc short loc_add_new_cluster_invalid_format_retn 2037 <1> 2038 <1> mov ecx, ebx ; ECX = sectors per cluster (<256) 2039 <1> mov ebx, Cluster_Buffer 2040 <1> call disk_write 2041 <1> jnc short loc_add_new_cluster_update_fat_nlc 2042 <1> 2043 <1> ; 15/10/2016 (1Dh -> 18) 2044 <1> ;mov eax, 18 ; Write Error 2045 <1> ; 25/07/2022 2046 <1> xor eax, eax 2047 <1> mov al, 18 2048 <1> jmp short loc_add_new_cluster_stc_retn 2049 <1> 2050 <1> loc_add_new_cluster_update_fat_nlc: 2051 <1> mov eax, [FAT_anc_FFCluster] 2052 <1> %endif 2053 <1> ; 30/08/2024 2054 <1> ; eax = [FAT_anc_FFCluster] ; first free cluster 2055 0000C82E 31C9 <1> xor ecx, ecx ; 0 2056 0000C830 890D[927E0100] <1> mov [FAT_ClusterCounter], ecx ; 0 ; reset 2057 0000C836 49 <1> dec ecx ; -1 ; 0FFFFFFFFh 2058 0000C837 850D[68820100] <1> test [FAT_anc_LCluster], ecx ; 0 ? 2059 0000C83D 7416 <1> jz short loc_add_new_cluster_update_fat_fc ; yes 2060 <1> 2061 <1> ; 27/08/2024 2062 <1> ; eax = (first free) cluster to be added as last cluster 2063 <1> ;;; 2064 <1> ;xor ecx, ecx 2065 <1> 2066 <1> loc_add_new_cluster_update_fat_nlc: ; 30/08/2024 2067 <1> ;mov [FAT_ClusterCounter], ecx ; 0 ; reset 2068 <1> ;dec ecx ; 0FFFFFFFFh ; last cluster 2069 0000C83F E82CFAFFFF <1> call update_cluster 2070 0000C844 7304 <1> jnc short loc_add_new_cluster_update_fat_plc 2071 0000C846 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 2072 0000C848 75D3 <1> jnz short loc_add_new_cluster_stc_retn 2073 <1> 2074 <1> loc_add_new_cluster_update_fat_plc: 2075 0000C84A A1[68820100] <1> mov eax, [FAT_anc_LCluster] 2076 0000C84F 8B0D[6C820100] <1> mov ecx, [FAT_anc_FFCluster] 2077 <1> loc_add_new_cluster_update_fat_fc: ; 30/08/2024 2078 0000C855 E816FAFFFF <1> call update_cluster 2079 0000C85A 7311 <1> jnc short loc_add_new_cluster_save_fat_buffer 2080 <1> 2081 0000C85C 09C0 <1> or eax, eax ; EAX = 0 -> cluster value is 0 or eocc 2082 0000C85E 740D <1> jz short loc_add_new_cluster_save_fat_buffer 2083 <1> 2084 <1> loc_anc_save_fat_buffer_err_retn: 2085 <1> ;cmp byte [FAT_ClusterCounter], 1 2086 <1> ;jb short loc_add_new_cluster_retn 2087 <1> 2088 0000C860 66BB00FF <1> mov bx, 0FF00h ; recalculate free space (BL = 0) 2089 <1> ; (BH = FFh -> Use ESI as Drv Param. Tbl.) 2090 0000C864 50 <1> push eax 2091 0000C865 E807FDFFFF <1> call calculate_fat_freespace 2092 0000C86A 58 <1> pop eax 2093 0000C86B EBB0 <1> jmp loc_add_new_cluster_stc_retn 2094 <1> 2095 <1> loc_add_new_cluster_save_fat_buffer: 2096 <1> ;cmp byte [FAT_BuffValidData], 2 2097 <1> ;jne short loc_add_new_cluster_calc_FAT_freespace 2098 <1> ;Byte [FAT_BuffValidData] = 2 2099 0000C86D E872FCFFFF <1> call save_fat_buffer 2100 0000C872 72EC <1> jc short loc_anc_save_fat_buffer_err_retn 2101 <1> 2102 <1> loc_add_new_cluster_calc_FAT_freespace: 2103 <1> ;mov eax, 1 ; Only one Cluster 2104 0000C874 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 2105 0000C879 66BB01FF <1> mov bx, 0FF01h ; BH = FFh -> ESI -> Dos drv desc. table 2106 <1> ; BL = 1 -> add cluster(s) 2107 <1> ;mov bl, 01h ; 27/08/2024 2108 <1> ; NOTE: EAX value will be added to Free Cluster Count 2109 <1> ; (Free Cluster Count is decreased when EAX value is negative) 2110 0000C87D E8EFFCFFFF <1> call calculate_fat_freespace 2111 <1> ; ECX = 0 -> no error, ECX > 0 -> error or invalid return 2112 0000C882 21C9 <1> and ecx, ecx ; ECX = 0 -> valid free sector count 2113 0000C884 7409 <1> jz short loc_add_new_cluster_return_cluster_number 2114 <1> 2115 <1> loc_add_new_cluster_recalc_FAT_freespace: 2116 0000C886 66BB00FF <1> mov bx, 0FF00h ; recalculate free space 2117 0000C88A E8E2FCFFFF <1> call calculate_fat_freespace 2118 <1> ; cf = 0 2119 <1> loc_add_new_cluster_return_cluster_number: 2120 0000C88F 89C1 <1> mov ecx, eax ; Free sector count 2121 0000C891 A1[6C820100] <1> mov eax, [FAT_anc_FFCluster] 2122 <1> ;mov edi, Cluster_Buffer 2123 <1> ; 25/07/2022 (EBX is not used by callers of this sprocedure) 2124 <1> ;movzx ebx, byte [esi+LD_BPB+SecPerClust] 2125 0000C896 31D2 <1> xor edx, edx ; 0 2126 0000C898 C3 <1> retn 2127 <1> 2128 <1> write_cluster: 2129 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 2130 <1> ; 31/08/2024 - TRDOS 386 v2.0.9 2131 <1> ; 15/10/2016 2132 <1> ; 21/03/2016 (TRDOS 386 = TRDOS v2.0) 2133 <1> ; 2134 <1> ; INPUT -> 2135 <1> ; EAX = Cluster Number (Sector index for SINGLIX FS) 2136 <1> ; ESI = Logical DOS Drive Description Table address 2137 <1> ; EBX = Cluster (File R/W) Buffer address (max. 64KB) 2138 <1> ; Only for SINGLIX FS: 2139 <1> ; EDX = File Number (The 1st FDT address) 2140 <1> ; OUTPUT -> 2141 <1> ; cf = 1 -> Cluster can not be written onto disk 2142 <1> ; EAX > 0 -> Error number 2143 <1> ; cf = 0 -> Cluster has been written successfully 2144 <1> ; 2145 <1> ; (Modified registers: EAX, ECX, EBX, EDX) 2146 <1> 2147 0000C899 0FB64E13 <1> movzx ecx, byte [esi+LD_BPB+BPB_SecPerClust] 2148 <1> ; CL = 1 = [esi+LD_FS_Reserved2] ; SectPerClust for Singlix FS 2149 <1> 2150 <1> write_file_sectors: ; 16/03/2016 2151 <1> 2152 <1> ; 19/12/2025 2153 <1> %if 0 2154 <1> cmp byte [esi+LD_FATType], 0 2155 <1> jna short write_fs_cluster 2156 <1> %endif 2157 <1> 2158 <1> write_fat_file_sectors: 2159 <1> ; 31/08/2024 2160 <1> ; ecx = sector count (may be different than sectors per cluster) 2161 0000C89D 83E802 <1> sub eax, 2 ; Beginning cluster number is always 2 2162 0000C8A0 0FB65613 <1> movzx edx, byte [esi+LD_BPB+BPB_SecPerClust] ; 18/03/2016 2163 0000C8A4 F7E2 <1> mul edx 2164 0000C8A6 034668 <1> add eax, [esi+LD_DATABegin] ; absolute address of the cluster 2165 <1> 2166 <1> ; EAX = Disk sector address 2167 <1> ; ECX = Sector count 2168 <1> ; EBX = Buffer address 2169 <1> ; (EDX = 0) 2170 <1> ; ESI = Logical DOS drive description table address 2171 <1> 2172 0000C8A9 E836510000 <1> call disk_write 2173 0000C8AE 7306 <1> jnc short wclust_retn 2174 <1> 2175 <1> ; 15/10/2016 (1Dh -> 18) 2176 0000C8B0 B812000000 <1> mov eax, 18 ; Drive not ready or write error ! 2177 0000C8B5 C3 <1> retn 2178 <1> 2179 <1> wclust_retn: 2180 0000C8B6 29C0 <1> sub eax, eax ; 0 2181 0000C8B8 C3 <1> retn 2182 <1> 2183 <1> ; 19/12/2025 2184 <1> %if 0 2185 <1> 2186 <1> write_fs_cluster: 2187 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 2188 <1> ; 21/03/2016 (TRDOS 386 = TRDOS v2.0) 2189 <1> ; Singlix FS 2190 <1> 2191 <1> ; EAX = Cluster number is sector index number of the file (eax) 2192 <1> 2193 <1> ; EDX = File number is the first File Descriptor Table address 2194 <1> ; of the file. (Absolute address of the FDT). 2195 <1> 2196 <1> ; eax = sector index (0 for the first sector) 2197 <1> ; edx = FDT0 address 2198 <1> ; 64 KB buffer = 128 sectors (limit) 2199 <1> ;mov ecx, 128 ; maximum count of sectors (before eof) 2200 <1> ; 25/07/2022 2201 <1> sub ecx, ecx 2202 <1> mov cl, 128 2203 <1> ;call write_fs_sectors 2204 <1> ;retn 2205 <1> ;jmp short write_fs_sectors 2206 <1> 2207 <1> write_fs_sectors: 2208 <1> ; 21/03/2016 (TRDOS 386 = TRDOS v2.0) 2209 <1> stc 2210 <1> retn 2211 <1> 2212 <1> %endif 2213 <1> 2214 <1> get_cluster_by_index: 2215 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 2216 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 2217 <1> ; 29/04/2016 (TRDOS 386 = TRDOS v2.0) 2218 <1> ; INPUT -> 2219 <1> ; EAX = Beginning cluster 2220 <1> ; EDX = Sector index in disk/file section 2221 <1> ; (Only for SINGLIX file system!) 2222 <1> ; ECX = Cluster sequence number after the beginning cluster 2223 <1> ; ESI = Logical DOS Drive Description Table address 2224 <1> ; OUTPUT -> 2225 <1> ; EAX = Cluster number 2226 <1> ; cf = 1 -> Error code in AL (EAX) 2227 <1> ; 2228 <1> ;(Modified registers: EAX, ECX, EBX, EDX) 2229 <1> 2230 <1> ; 19/12/2025 2231 <1> %if 0 2232 <1> cmp byte [esi+LD_FATType], 1 2233 <1> jb short get_fs_section_by_index 2234 <1> %endif 2235 0000C8B9 3B4E78 <1> cmp ecx, [esi+LD_Clusters] 2236 0000C8BC 7206 <1> jb short gcbi_1 2237 <1> gcbi_0: 2238 <1> ;stc 2239 <1> ;mov eax, 23h ; Cluster not available ! 2240 <1> ; MSDOS error code: FCB unavailable 2241 <1> ; 25/07/2022 2242 0000C8BE 29C0 <1> sub eax, eax 2243 <1> gcbi_4: 2244 0000C8C0 B023 <1> mov al, 23h 2245 0000C8C2 F9 <1> stc 2246 0000C8C3 C3 <1> retn 2247 <1> gcbi_1: 2248 0000C8C4 51 <1> push ecx 2249 0000C8C5 E8BFF6FFFF <1> call get_next_cluster 2250 0000C8CA 59 <1> pop ecx 2251 0000C8CB 7203 <1> jc short gcbi_3 2252 0000C8CD E2F5 <1> loop gcbi_1 2253 <1> gcbi_2: 2254 0000C8CF C3 <1> retn 2255 <1> gcbi_3: 2256 0000C8D0 09C0 <1> or eax, eax 2257 <1> ;jz short gcbi_0 2258 <1> ; 25/07/2022 2259 0000C8D2 74EC <1> jz short gcbi_4 2260 0000C8D4 F5 <1> cmc ; stc 2261 0000C8D5 C3 <1> retn 2262 <1> 2263 <1> ; 19/12/2025 2264 <1> %if 0 2265 <1> 2266 <1> get_fs_section_by_index: 2267 <1> ; 29/04/2016 (TRDOS 386 = TRDOS v2.0) 2268 <1> ; INPUT -> 2269 <1> ; EAX = Beginning FDT number/address 2270 <1> ; EDX = Sector index in disk/file section 2271 <1> ; ECX = Sector sequence number after the beginning FDT 2272 <1> ; ESI = Logical DOS Drive Description Table address 2273 <1> ; OUTPUT -> 2274 <1> ; EAX = FDT number/address 2275 <1> ; EDX = Sector index of the section (0,1,2,3,4...) 2276 <1> ; cf = 1 -> Error code in AL (EAX) 2277 <1> ; 2278 <1> ;(Modified registers: EAX, ECX, EBX, EDX) 2279 <1> ; 2280 <1> mov eax, 0FFFFFFFFh 2281 <1> retn 2282 <1> 2283 <1> get_last_section: 2284 <1> ; 22/10/2016 (TRDOS 386 = TRDOS v2.0) 2285 <1> ; INPUT -> 2286 <1> ; EAX = (The 1st) FDT number/address 2287 <1> ; ESI = Logical DOS Drive Description Table address 2288 <1> ; OUTPUT -> 2289 <1> ; EAX = FDT number/address of the last section 2290 <1> ; EDX = Last sector of the section (0,1,2,3,4...) 2291 <1> ; [glc_index] = sector index number of the last sector 2292 <1> ; (for file, not for the last section) 2293 <1> ; 2294 <1> ; cf = 1 -> Error code in AL (EAX) 2295 <1> ; 2296 <1> ;(Modified registers: EAX, ECX, EBX, EDX) 2297 <1> ; 2298 <1> mov eax, 0 2299 <1> mov edx, 0 2300 <1> retn 2301 <1> 2302 <1> %endif 3438 %include 'trdosk6.s' ; 24/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - MAIN PROGRAM : trdosk6.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 10/01/2026 (Previous: 27/09/2024, v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 11 <1> ; u1.s (27/17/2015), u2.s (03/01/2016) 12 <1> ; **************************************************************************** 13 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 14 <1> ; TRDOS2.ASM (09/11/2011) 15 <1> ; ---------------------------------------------------------------------------- 16 <1> ; INT_21H.ASM (c) 2009-2011 Erdogan TAN [14/11/2009] Last Update: 08/11/2011 17 <1> 18 <1> ; Ref: Retro UNIX 386 v1.2 Kernel (v0.2.2.3) - ux.s - 15/07/2022 19 <1> 20 <1> sysent: ; < enter to system call > 21 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 22 <1> ; 17/03/2017 23 <1> ; 03/03/2017 24 <1> ; 19/02/2017 25 <1> ; 13/01/2017 26 <1> ; 06/06/2016 27 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 28 <1> ; 16/04/2015 - 19/10/2015 (Retro UNIX 386 v1) 29 <1> ; 10/04/2013 - 18/01/2014 (Retro UNIX 8086 v1) 30 <1> ; 31 <1> ; 'unkni' or 'sysent' is sytem entry from various traps. 32 <1> ; The trap type is determined and an indirect jump is made to 33 <1> ; the appropriate system call handler. If there is a trap inside 34 <1> ; the system a jump to panic is made. All user registers are saved 35 <1> ; and u.sp points to the end of the users stack. The sys (trap) 36 <1> ; instructor is decoded to get the the system code part (see 37 <1> ; trap instruction in the PDP-11 handbook) and from this 38 <1> ; the indirect jump address is calculated. If a bad system call is 39 <1> ; made, i.e., the limits of the jump table are exceeded, 'badsys' 40 <1> ; is called. If the call is legitimate control passes to the 41 <1> ; appropriate system routine. 42 <1> ; 43 <1> ; Calling sequence: 44 <1> ; Through a trap caused by any sys call outside the system. 45 <1> ; Arguments: 46 <1> ; Arguments of particular system call. 47 <1> ; ............................................................... 48 <1> ; 49 <1> ; Retro UNIX 8086 v1 modification: 50 <1> ; System call number is in EAX register. 51 <1> ; 52 <1> ; Other parameters are in EDX, EBX, ECX, ESI, EDI, EBP 53 <1> ; registers depending of function details. 54 <1> ; 55 <1> ; 16/04/2015 56 0000C8D6 368925[648E0100] <1> mov [ss:u.sp], esp ; Kernel stack points to return address 57 <1> 58 <1> ; save user registers 59 0000C8DD 1E <1> push ds 60 0000C8DE 06 <1> push es 61 0000C8DF 0FA0 <1> push fs 62 0000C8E1 0FA8 <1> push gs 63 0000C8E3 60 <1> pushad ; eax, ecx, edx, ebx, esp -before pushad-, ebp, esi, edi 64 <1> ; 65 <1> ; ESPACE = [ss:u.sp] - esp ; 4*12 = 48 ; 17/09/2015 ; 06/06/2016 66 <1> ; (ESPACE is size of space in kernel stack 67 <1> ; for saving/restoring user registers.) 68 <1> ; 69 0000C8E4 50 <1> push eax ; 01/07/2015 70 0000C8E5 66B81000 <1> mov ax, KDATA 71 0000C8E9 8ED8 <1> mov ds, ax 72 0000C8EB 8EC0 <1> mov es, ax 73 0000C8ED 8EE0 <1> mov fs, ax 74 0000C8EF 8EE8 <1> mov gs, ax 75 0000C8F1 A1[B0760100] <1> mov eax, [k_page_dir] 76 0000C8F6 0F22D8 <1> mov cr3, eax 77 0000C8F9 58 <1> pop eax ; 01/07/2015 78 <1> ; 19/10/2015 79 0000C8FA FC <1> cld 80 <1> ; 81 0000C8FB FE05[608E0100] <1> inc byte [sysflg] 82 <1> ; incb sysflg / indicate a system routine is in progress 83 0000C901 FB <1> sti ; 18/01/2014 84 <1> ;jnz panic ; 24/05/2013 85 <1> ; beq 1f 86 <1> ; jmp panic ; / called if trap inside system 87 <1> ; 23/07/2022 88 0000C902 7405 <1> jz short sysent0 89 0000C904 E910A5FFFF <1> jmp panic 90 <1> ;1: 91 <1> sysent0: 92 <1> ; 17/03/2017 93 0000C909 80642438FE <1> and byte [esp+ESPACE+8], ~1 ; clear carry flag 94 <1> 95 <1> ; 16/04/2015 96 0000C90E A3[6C8E0100] <1> mov [u.r0], eax 97 0000C913 8925[688E0100] <1> mov [u.usp], esp ; kernel stack points to user's registers 98 <1> 99 <1> ; 13/01/2017 (TRDOS 386 Feaure only !) 100 0000C919 803D[E48E0100]00 <1> cmp byte [u.t_lock], 0 ; timer interrupt lock ? 101 <1> ;ja sysrele ; yes, sys release only !!! 102 <1> ; 23/07/2022 103 0000C920 7605 <1> jna short sysent1 104 0000C922 E902020000 <1> jmp sysrele 105 <1> ; mov $s.syst+2,clockp 106 <1> ; mov r0,-(sp) / save user registers 107 <1> ; mov sp,u.r0 / pointer to bottom of users stack 108 <1> ; / in u.r0 109 <1> ; mov r1,-(sp) 110 <1> ; mov r2,-(sp) 111 <1> ; mov r3,-(sp) 112 <1> ; mov r4,-(sp) 113 <1> ; mov r5,-(sp) 114 <1> ; mov ac,-(sp) / "accumulator" register for extended 115 <1> ; / arithmetic unit 116 <1> ; mov mq,-(sp) / "multiplier quotient" register for the 117 <1> ; / extended arithmetic unit 118 <1> ; mov sc,-(sp) / "step count" register for the extended 119 <1> ; / arithmetic unit 120 <1> ; mov sp,u.sp / u.sp points to top of users stack 121 <1> ; mov 18.(sp),r0 / store pc in r0 122 <1> ; mov -(r0),r0 / sys inst in r0 123 <1> ; sub $sys,r0 / get xxx code 124 <1> sysent1: 125 0000C927 C1E002 <1> shl eax, 2 126 <1> ; asl r0 / multiply by 2 to jump indirect in bytes 127 0000C92A 3DBC000000 <1> cmp eax, end_of_syscalls - syscalls 128 <1> ; cmp r0,$2f-1f / limit of table (35) exceeded 129 <1> ;jnb short badsys 130 <1> ; bhis badsys / yes, bad system call 131 0000C92F F5 <1> cmc 132 0000C930 9C <1> pushf 133 0000C931 50 <1> push eax 134 0000C932 8B2D[648E0100] <1> mov ebp, [u.sp] ; Kernel stack at the beginning of sys call 135 0000C938 B0FE <1> mov al, 0FEh ; 11111110b 136 0000C93A 1400 <1> adc al, 0 ; al = al + cf 137 0000C93C 204508 <1> and [ebp+8], al ; flags (reset carry flag) 138 <1> ; bic $341,20.(sp) / set users processor priority to 0 139 <1> ; / and clear carry bit 140 0000C93F 5D <1> pop ebp ; eax 141 0000C940 9D <1> popf 142 0000C941 720B <1> jc short badsys ; 23/07/2022 143 0000C943 A1[6C8E0100] <1> mov eax, [u.r0] 144 <1> ; system call registers: EAX, EDX, ECX, EBX, ESI, EDI 145 0000C948 FFA5[9BC90000] <1> jmp dword [ebp+syscalls] 146 <1> ; jmp *1f(r0) / jump indirect thru table of addresses 147 <1> ; / to proper system routine. 148 <1> 149 <1> ; 20/08/2024 (exit code) 150 <1> ; 30/07/2022 151 <1> ; 23/07/2022 152 <1> badsys: 153 <1> ; 25/12/2016 154 <1> ; 18/04/2016 (TRDOS 386 = TRDOS v2.0) 155 <1> ; 17/04/2011 (TRDOS v1.0, 'IFC.ASM') 156 <1> ; 03/02/2011 ('trdos_ifc_routine') 157 <1> ; 158 <1> ; 16/04/2015 (Retro UNIX 386 v1, 'badsys') 159 <1> ; (EIP, EAX values will be shown on screen with error message) 160 <1> ; (EIP = 'CD 40h' instruction address -INT 40h-) 161 <1> ; (EAX = Function number) 162 <1> ; 163 0000C94E FE05[BC8E0100] <1> inc byte [u.bsys] 164 <1> ; 165 0000C954 8B1D[648E0100] <1> mov ebx, [u.sp] ; esp at the beginning of 'sysent' 166 0000C95A 8B03 <1> mov eax, [ebx] ; EIP (return address, not 'INT 30h' address) 167 <1> ;sub eax, 2 ; CDh, ##h 168 <1> ; 30/07/2022 169 0000C95C 48 <1> dec eax 170 0000C95D 48 <1> dec eax 171 0000C95E E89C78FFFF <1> call dwordtohex 172 0000C963 8915[A4350100] <1> mov [eip_str], edx 173 0000C969 A3[A8350100] <1> mov [eip_str+4], eax 174 0000C96E A1[6C8E0100] <1> mov eax, [u.r0] 175 0000C973 E88778FFFF <1> call dwordtohex 176 0000C978 8915[93350100] <1> mov [eax_str], edx 177 0000C97E A3[97350100] <1> mov [eax_str+4], eax 178 <1> 179 0000C983 66C705[88350100]34- <1> mov word [int_num_str], SYSCALL_INT_NUM ; 25/12/2016 179 0000C98B 30 <1> 180 <1> 181 0000C98C BE[5A350100] <1> mov esi, ifc_msg ; "invalid function call !" msg (trdosk9.s) 182 <1> 183 0000C991 E824A4FFFF <1> call print_msg 184 <1> 185 <1> ;; 20/08/2024 - temporary 186 <1> ; mov ebx, 07h 187 <1> ; mov ah, 0Eh 188 <1> ;p_fc_msg: 189 <1> ; lodsb 190 <1> ; and al, al 191 <1> ; jz short p_fc_ms_ok 192 <1> ; call _int10h 193 <1> ; jmp short p_fc_msg 194 <1> ;p_fc_ms_ok: 195 <1> 196 <1> ;jmp sysexit 197 <1> 198 <1> ; 20/08/2024 (exit code) 199 <1> ;mov bl, 0FFh ; -1 200 <1> ;jmp sysexit 201 <1> ; 202 0000C996 E92C020000 <1> jmp sysexit_0FFh 203 <1> 204 <1> syscalls: ; 1: 205 <1> ; 20/08/2024 - TRDOS 386 v2.0.9 206 <1> ; 31/12/2017 207 <1> ; 28/02/2017 208 <1> ; 20/02/2017 209 <1> ; 19/02/2017 210 <1> ; 15/10/2016 211 <1> ; 20/05/2016 212 <1> ; 19/05/2016 213 <1> ; 16/05/2016 214 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 215 <1> ; 21/09/2015 216 <1> ; 01/07/2015 217 <1> ; 16/04/2015 (32 bit address modification) 218 0000C99B [670A0100] <1> dd sysver ; 0 ; Get TRDOS 386 version number (v2.0) 219 0000C99F [CCCB0000] <1> dd sysexit ; 1 220 0000C9A3 [F4CD0000] <1> dd sysfork ; 2 221 0000C9A7 [C1D10000] <1> dd sysread ; 3 222 0000C9AB [E0D10000] <1> dd syswrite ; 4 223 0000C9AF [DECF0000] <1> dd sysopen ; 5 224 0000C9B3 [97D10000] <1> dd sysclose ; 6 225 0000C9B7 [58CD0000] <1> dd syswait ; 7 226 0000C9BB [01CF0000] <1> dd syscreat ; 8 227 0000C9BF [53170100] <1> dd sysrename ; 9 ; TRDOS 386, Rename File (31/12/2017) 228 0000C9C3 [00130100] <1> dd sysdelete ; 10 ; TRDOS 386, Delete File (29/12/2017) 229 0000C9C7 [8EFE0000] <1> dd sysexec ; 11 230 0000C9CB [30140100] <1> dd syschdir ; 12 231 0000C9CF [BD150100] <1> dd systime ; 13 ; TRDOS 386, Get Sys Date&Time (30/12/2017) 232 0000C9D3 [5AD10000] <1> dd sysmkdir ; 14 233 0000C9D7 [64140100] <1> dd syschmod ; 15 ; TRDOS 386, Change Attributes (30/12/2017) 234 0000C9DB [67130100] <1> dd sysrmdir ; 16 ; TRDOS 386, Remove Directory (29/12/2017) 235 0000C9DF [16030100] <1> dd sysbreak ; 17 236 0000C9E3 [12150100] <1> dd sysdrive ; 18 ; TRDOS 386, Get/Set Current Drv (30/12/2017) 237 0000C9E7 [85030100] <1> dd sysseek ; 19 238 0000C9EB [9C030100] <1> dd systell ; 20 239 0000C9EF [5E180100] <1> dd sysmem ; 21 ; TRDOS 386, Get Total&Free Mem (31/12/2017) 240 0000C9F3 [94180100] <1> dd sysprompt ; 22 ; TRDOS 386, Change Cmd Prompt (31/12/2017) 241 0000C9F7 [D5180100] <1> dd syspath ; 23 ; TRDOS 386, Get/Set Run Path (31/12/2017) 242 0000C9FB [3A190100] <1> dd sysenv ; 24 ; TRDOS 386, Get/Set Env Vars (31/12/2017) 243 0000C9FF [3E160100] <1> dd sysstime ; 25 ; TRDOS 386, Set Sys Date&Time (30/12/2017) 244 0000CA03 [FB030100] <1> dd sysquit ; 26 245 0000CA07 [E4030100] <1> dd sysintr ; 27 246 0000CA0B [61150100] <1> dd sysdir ; 28 ; TRDOS 386, Get Curr Drive&Dir (30/12/2017) 247 0000CA0F [57CA0000] <1> dd sysemt ; 29 248 0000CA13 [9C150100] <1> dd sysldrvt ; 30 ; TRDOS 386, Get Logical DOS DDT (30/12/2017) 249 0000CA17 [DBD30000] <1> dd sysvideo ; 31 ; TRDOS 386 Video Functions (16/05/2016) 250 0000CA1B [62200100] <1> dd sysaudio ; 32 ; TRDOS 386 Audio Functions (16/05/2016) 251 0000CA1F [46D20000] <1> dd systimer ; 33 ; TRDOS 386 Timer Functions (18/05/2016) 252 0000CA23 [17040100] <1> dd syssleep ; 34 ; Retro UNIX 8086 v1 feature only ! 253 <1> ; 11/06/2014 254 0000CA27 [57040100] <1> dd sysmsg ; 35 ; Retro UNIX 386 v1 feature only ! 255 <1> ; 01/07/2015 256 0000CA2B [72050100] <1> dd sysgeterr ; 36 ; Retro UNIX 386 v1 feature only ! 257 <1> ; 21/09/2015 - get last error number 258 0000CA2F [D7120100] <1> dd sysfpstat ; 37 ; TRDOS 386 FPU state option (28/02/2017) 259 0000CA33 [760A0100] <1> dd syspri ; 38 ; change priority - TRDOS 386 (20/05/2016) 260 0000CA37 [29CB0000] <1> dd sysrele ; 39 ; TRDOS 386 (19/05/2016) (0 -> 39) 261 0000CA3B [A10B0100] <1> dd sysfff ; 40 ; Find First File - TRDOS 386 (15/10/2016) 262 0000CA3F [7B0C0100] <1> dd sysfnf ; 41 ; Find Next File - TRDOS 386 (15/10/2016) 263 0000CA43 [C5110100] <1> dd sysalloc ; 42 ; Allocate contiguous memory block/pages 264 <1> ; TRDOS 386 (19/02/2017) DMA buff fuctions 265 0000CA47 [7F120100] <1> dd sysdalloc ; 43 ; Deallocate contiguous memory block/pages 266 <1> ; TRDOS 386 (19/02/2017) DMA buff fuctions 267 0000CA4B [BA120100] <1> dd syscalbac ; 44 ; IRQ Callback and Signal Response Byte 268 <1> ; service setup - TRDOS 386 (20/02/2017) 269 <1> ; 28/08/2017 (20/08/2017) 270 0000CA4F [43290100] <1> dd sysdma ; 45 ; TRDOS 386 - (ISA) DMA service 271 0000CA53 [7F2C0100] <1> dd sysstdio ; 46 ; TRDOS 386 v2.0.9 (STDIN/STDOUT functions) 272 <1> 273 <1> end_of_syscalls: 274 <1> 275 <1> sysemt: ; enable (or disable) multi tasking -time sharing- 276 <1> ; 277 <1> ; 08/08/2022 278 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 279 <1> ; 23/05/2016 - TRDOS 386 (TRDOS v2.0) 280 <1> ; 14/05/2015 (Retro UNIX 386 v1) 281 <1> ; 10/12/2013 - 20/04/2014 (Retro UNIX 8086 v1) 282 <1> ; 283 <1> ; Retro UNIX 8086 v1 modification: 284 <1> ; 'Enable Multi Tasking' system call instead 285 <1> ; of 'Emulator Trap' in original UNIX v1 for PDP-11. 286 <1> ; 287 <1> ; Retro UNIX 8086 v1 feature only! 288 <1> ; Using purpose: Kernel will start without time-out 289 <1> ; (internal clock/timer) functionality. 290 <1> ; Then etc/init will enable clock/timer for 291 <1> ; multi tasking. 292 <1> ; 293 <1> ; INPUT -> 294 <1> ; BL = 0 -> disable multi tasking 295 <1> ; BL > 1 -> enable multi tasking (time sharing) 296 <1> ; OUTPUT -> 297 <1> ; none 298 <1> ; 299 <1> ; Note: Multi tasking is disabled during system 300 <1> ; initialization, it must be enabled by using 301 <1> ; this system call. (Otherwise, running proces 302 <1> ; will not be changed by another process within 303 <1> ; run time sequence/schedule, if running process 304 <1> ; will not 'release' itself. Only 'wakeup' procedure 305 <1> ; for waiting processes and programmed timer events 306 <1> ; for other processes can change running process 307 <1> ; while multi tasking is disabled.) ** 23/05/2016 ** 308 <1> 309 0000CA57 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; root ? 310 <1> ;ja short error 311 <1> ; 23/07/2022 312 <1> ;ja short badsys ; 14/05/2015 313 <1> ; 08/08/2022 314 0000CA5E 7605 <1> jna short sysemt_root 315 0000CA60 E9E9FEFFFF <1> jmp badsys 316 <1> sysemt_root: ; 08/08/2022 317 0000CA65 FA <1> cli 318 0000CA66 881D[46830100] <1> mov [multi_tasking], bl ; 0 to disable, >0 to enable 319 0000CA6C EB20 <1> jmp sysret 320 <1> 321 <1> error: 322 <1> ; 18/05/2016 323 <1> ; 13/05/2016 324 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 325 <1> ; 16/04/2015 - 17/09/2015 (Retro UNIX 386 v1) 326 <1> ; 10/04/2013 - 07/08/2013 (Retro UNIX 8086 v1) 327 <1> ; 328 <1> ; 'error' merely sets the error bit off the processor status (c-bit) 329 <1> ; then falls right into the 'sysret', 'sysrele' return sequence. 330 <1> ; 331 <1> ; INPUTS -> none 332 <1> ; OUTPUTS -> 333 <1> ; processor status - carry (c) bit is set (means error) 334 <1> ; 335 <1> ; 26/05/2013 (Stack pointer must be reset here! 336 <1> ; Because, jumps to error procedure 337 <1> ; disrupts push-pop nesting balance) 338 <1> ; 339 0000CA6E 8B2D[648E0100] <1> mov ebp, [u.sp] ; interrupt (system call) return (iretd) address 340 0000CA74 804D0801 <1> or byte [ebp+8], 1 ; set carry bit of flags register 341 <1> ; (system call will return with cf = 1) 342 <1> ; bis $1,20.(r1) / set c bit in processor status word below 343 <1> ; / users stack 344 <1> ; 17/09/2015 345 0000CA78 83ED30 <1> sub ebp, ESPACE ; 48 ; total size of stack frame ('sysdefs.inc') 346 <1> ; for saving/restoring user registers 347 <1> ;cmp ebp, [u.usp] 348 <1> ;je short err0 349 0000CA7B 892D[688E0100] <1> mov [u.usp], ebp 350 <1> ;err0: 351 <1> ; 01/09/2015 352 0000CA81 8B25[688E0100] <1> mov esp, [u.usp] ; Retro Unix 8086 v1 modification! 353 <1> ; 10/04/2013 354 <1> ; (If an I/O error occurs during disk I/O, 355 <1> ; related procedures will jump to 'error' 356 <1> ; procedure directly without returning to 357 <1> ; the caller procedure. So, stack pointer 358 <1> ; must be restored here.) 359 <1> ; 13/05/2016 360 <1> ; NOTE: (The last) error code is in 'u.error', it can be retrieved by 361 <1> ; 'get last error' system call later. 362 <1> 363 <1> ; 03/09/2015 - 09/06/2015 - 07/08/2013 364 0000CA87 C605[D28E0100]00 <1> mov byte [u.kcall], 0 ; namei_r, mkdir_w reset 365 <1> 366 <1> sysret: ; < return from system call> 367 <1> ; 28/08/2024 - TRDOS 386 Kernel v2.0.9 368 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 369 <1> ; 01/03/2017 370 <1> ; 28/02/2017 371 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 372 <1> ; 16/04/2015 - 10/09/2015 (Retro UNIX 386 v1) 373 <1> ; 10/04/2013 - 23/02/2014 (Retro UNIX 8086 v1) 374 <1> ; 375 <1> ; 'sysret' first checks to see if process is about to be 376 <1> ; terminated (u.bsys). If it is, 'sysexit' is called. 377 <1> ; If not, following happens: 378 <1> ; 1) The user's stack pointer is restored. 379 <1> ; 2) r1=0 and 'iget' is called to see if last mentioned 380 <1> ; i-node has been modified. If it has, it is written out 381 <1> ; via 'ppoke'. 382 <1> ; 3) If the super block has been modified, it is written out 383 <1> ; via 'ppoke'. 384 <1> ; 4) If the dismountable file system's super block has been 385 <1> ; modified, it is written out to the specified device 386 <1> ; via 'ppoke'. 387 <1> ; 5) A check is made if user's time quantum (uquant) ran out 388 <1> ; during his execution. If so, 'tswap' is called to give 389 <1> ; another user a chance to run. 390 <1> ; 6) 'sysret' now goes into 'sysrele'. 391 <1> ; (See 'sysrele' for conclusion.) 392 <1> ; 393 <1> ; Calling sequence: 394 <1> ; jump table or 'br sysret' 395 <1> ; Arguments: 396 <1> ; - 397 <1> ; ............................................................... 398 <1> ; 399 <1> ; ((AX=r1 for 'iget' input)) 400 <1> ; 401 0000CA8E 31C0 <1> xor eax, eax ; 28/02/2017 402 <1> sysret0: ; 29/07/2015 (eax = 0, jump from sysexec) 403 0000CA90 FEC0 <1> inc al ; 04/05/2013 404 0000CA92 3805[BC8E0100] <1> cmp [u.bsys], al ; 1 405 <1> ; tstb u.bsys / is a process about to be terminated because 406 <1> ;jnb sysexit ; 04/05/2013 407 <1> ; bne sysexit / of an error? yes, go to sysexit 408 <1> ; 23/07/2022 409 0000CA98 7205 <1> jb short sysret1 410 <1> ;jmp sysexit 411 <1> ; 22/08/2024 412 0000CA9A E92B010000 <1> jmp sysexit_@ ; BL = 0FFh ; -1 413 <1> sysret1: ; 23/07/2022 414 <1> ;mov esp, [u.usp] ; 24/05/2013 (that is not needed here) 415 <1> ; mov u.sp,sp / no point stack to users stack 416 0000CA9F FEC8 <1> dec al ; mov ax, 0 417 <1> ; clr r1 / zero r1 to check last mentioned i-node 418 0000CAA1 E83D4F0000 <1> call iget 419 <1> ; jsr r0,iget / if last mentioned i-node has been modified 420 <1> ; / it is written out 421 <1> ; 10/01/2017 422 <1> ; 09/01/2017 423 <1> ;sysrele: ; < release > 424 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 425 <1> ; 16/04/2015 - 14/10/2015 (Retro UNIX 386 v1) 426 <1> ; 10/04/2013 - 07/03/2014 (Retro UNIX 8086 v1) 427 <1> ; 428 <1> ; 'sysrele' first calls 'tswap' if the time quantum for a user is 429 <1> ; zero (see 'sysret'). It then restores the user's registers and 430 <1> ; turns off the system flag. It then checked to see if there is 431 <1> ; an interrupt from the user by calling 'isintr'. If there is, 432 <1> ; the output gets flashed (see isintr) and interrupt action is 433 <1> ; taken by a branch to 'intract'. If there is no interrupt from 434 <1> ; the user, a rti is made. 435 <1> ; 436 <1> ; Calling sequence: 437 <1> ; Fall through a 'bne' in 'sysret' & ? 438 <1> ; Arguments: 439 <1> ; - 440 <1> ; ............................................................... 441 <1> ; 442 <1> ; 23/02/2014 (swapret) 443 <1> ; 22/09/2013 444 <1> sysrel0: ;1: 445 0000CAA6 803D[B48E0100]00 <1> cmp byte [u.quant], 0 ; 16/05/2013 446 <1> ; tstb uquant / is the time quantum 0? 447 0000CAAD 7705 <1> ja short swapret 448 <1> ; bne 1f / no, don't swap it out 449 <1> sysrelease: ; 07/12/2013 (jump from 'clock') 450 0000CAAF E87C3E0000 <1> call tswap 451 <1> ; jsr r0,tswap / yes, swap it out 452 <1> 453 <1> ; Retro Unix 8086 v1 feature: return from 'swap' to 'swapret' address. 454 <1> swapret: ;1: 455 <1> ; 10/09/2015 456 <1> ; 01/09/2015 457 <1> ; 14/05/2015 458 <1> ; 16/04/2015 (Retro UNIX 386 v1 - 32 bit, pm modifications) 459 <1> ; 26/05/2013 (Retro UNIX 8086 v1) 460 <1> ; cli 461 <1> ; 24/07/2015 462 <1> ; 463 <1> ;; 'esp' must be already equal to '[u.usp]' here ! 464 <1> ;; mov esp, [u.usp] 465 <1> 466 <1> ; 22/09/2013 467 0000CAB4 E8234F0000 <1> call isintr 468 <1> ; 20/10/2013 469 0000CAB9 7405 <1> jz short sysrel1 470 0000CABB E8F4000000 <1> call intract 471 <1> ; jsr r0,isintr / is there an interrupt from the user 472 <1> ; br intract / yes, output gets flushed, take interrupt 473 <1> ; / action 474 <1> sysrel1: 475 0000CAC0 FA <1> cli ; 14/10/2015 476 <1> sysrel2: 477 <1> ; 28/02/2017 478 <1> ; Check if there is a (delayed) callback for current user/process 479 0000CAC1 A0[E78E0100] <1> mov al, [u.irqwait] 480 0000CAC6 240F <1> and al, 0Fh ; is there a waiting IRQ callback service ? 481 0000CAC8 7444 <1> jz short sysrel8 ; no 482 <1> 483 <1> ; Set return to IRQ callback service and return from the service 484 0000CACA 0FB6D8 <1> movzx ebx, al 485 0000CACD 883D[E78E0100] <1> mov [u.irqwait], bh ; 0 ; reset 486 0000CAD3 8A9B[B0350100] <1> mov bl, [ebx+IRQenum] ; (available) IRQ index +1 (1 to 9) 487 <1> ; 01/03/2017 488 0000CAD9 FECB <1> dec bl ; IRQ index number, 0 to 8 489 0000CADB 7831 <1> js short sysrel8 ; 0 -> FFh (not in use!?) 490 <1> ; 491 0000CADD A0[BD8E0100] <1> mov al, [u.uno] ; current process (user) number 492 0000CAE2 3883[94880100] <1> cmp [ebx+IRQ.owner], al 493 0000CAE8 7524 <1> jne short sysrel8 ; it is not the current user/process !? 494 0000CAEA F683[A6880100]01 <1> test byte [ebx+IRQ.method], 1 ; callback ? 495 0000CAF1 741B <1> jz short sysrel8 ; not a callback method !? 496 <1> 497 0000CAF3 8B93[B8880100] <1> mov edx, [ebx+IRQ.addr] ; IRQ callback service address (virtual) 498 0000CAF9 C605[E88E0100]01 <1> mov byte [u.r_lock], 1 ; IRQ callback service in progress flag 499 <1> 500 0000CB00 E8D23E0000 <1> call wswap ; save user's registers & status 501 <1> ; (for return from IRQ callback service) 502 <1> 503 0000CB05 8B2D[648E0100] <1> mov ebp, [u.sp]; kernel's stack, points to EIP (user) 504 0000CB0B 895500 <1> mov [ebp], edx ; IRQ call back service address 505 <1> sysrel8: 506 0000CB0E FE0D[608E0100] <1> dec byte [sysflg] 507 <1> ; decb sysflg / turn system flag off 508 <1> 509 0000CB14 A1[C48E0100] <1> mov eax, [u.pgdir] 510 0000CB19 0F22D8 <1> mov cr3, eax ; 1st PDE points to Kernel Page Table 0 (1st 4 MB) 511 <1> ; (others are different than kernel page tables) 512 <1> ; 10/09/2015 513 0000CB1C 61 <1> popad ; edi, esi, ebp, temp (icrement esp by 4), ebx, edx, ecx, eax 514 <1> ; mov (sp)+,sc / restore user registers 515 <1> ; mov (sp)+,mq 516 <1> ; mov (sp)+,ac 517 <1> ; mov (sp)+,r5 518 <1> ; mov (sp)+,r4 519 <1> ; mov (sp)+,r3 520 <1> ; mov (sp)+,r2 521 <1> ; 522 0000CB1D A1[6C8E0100] <1> mov eax, [u.r0] ; ((return value in EAX)) 523 0000CB22 0FA9 <1> pop gs 524 0000CB24 0FA1 <1> pop fs 525 0000CB26 07 <1> pop es 526 0000CB27 1F <1> pop ds 527 <1> ;or word [esp+8], 200h ; 22/01/2017 ; force enabling interrupts 528 0000CB28 CF <1> iretd 529 <1> ; rti / no, return from interrupt 530 <1> 531 <1> sysrele: 532 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 533 <1> ; 24/03/2017 534 <1> ; 28/02/2017 535 <1> ; 27/02/2017 536 <1> ; 29/01/2017 537 <1> ; 14/01/2017 538 <1> ; 13/01/2017 539 <1> ; 09/01/2017 - 10/01/2017 - 12/01/2017 540 <1> ; Major modification for TRDOS 386 (CallBack return) 541 <1> ; 542 <1> ; 'sysrele' system call restores previously saved 543 <1> ; registers and addresses of the process 544 <1> ; (Main purpose -in TRDOS 386- is to return from 545 <1> ; timer callback service routine in ring 3 -user mode-.) 546 <1> ; 547 <1> ; check if the process is in timer callback phase 548 0000CB29 803D[E48E0100]00 <1> cmp byte [u.t_lock], 0 ; TIMER INT LOCK 549 <1> ;je short sysrel0 ; classic (Retro UNIX 386 type) sysrele 550 0000CB30 7735 <1> ja short sysrel3 551 <1> ; 27/02/2017 552 0000CB32 803D[E88E0100]00 <1> cmp byte [u.r_lock], 0 ; IRQ callback lock 553 <1> ;jna sysrel0 ; classic sysrele ; 24/03/2017 554 <1> ; 23/07/2022 555 0000CB39 7705 <1> ja short sysrel9 556 0000CB3B E966FFFFFF <1> jmp sysrel0 557 <1> sysrel9: ; 23/07/2022 558 0000CB40 E859000000 <1> call sysrel7 559 0000CB45 803D[E88E0100]00 <1> cmp byte [u.r_lock], 0 ; IRQ callback service lock 560 0000CB4C 7628 <1> jna short sysrel4 561 0000CB4E C605[E88E0100]00 <1> mov byte [u.r_lock], 0 ; reset 562 <1> ;mov byte [u.irqwait], 0 ; reset ; 28/02/2017 563 0000CB55 A0[E98E0100] <1> mov al, [u.r_mode] 564 0000CB5A 08C0 <1> or al, al 565 0000CB5C 7518 <1> jnz short sysrel4 566 0000CB5E FEC8 <1> dec al 567 0000CB60 A2[E98E0100] <1> mov [u.r_mode], al ; 0FFh ; not necessary !? 568 0000CB65 EB32 <1> jmp short sysrel6 569 <1> sysrel3: 570 <1> ; 27/02/2017 571 0000CB67 E832000000 <1> call sysrel7 572 <1> ; 14/01/2017 573 0000CB6C 28C0 <1> sub al, al 574 0000CB6E 3805[E48E0100] <1> cmp [u.t_lock], al ; 0 ; TIMER INT LOCK 575 0000CB74 770E <1> ja short sysrel5 ; yes 576 <1> sysrel4: 577 <1> ; 29/01/2017 578 0000CB76 8B44241C <1> mov eax, [esp+28] ; eax 579 0000CB7A A3[6C8E0100] <1> mov [u.r0], eax 580 0000CB7F E93DFFFFFF <1> jmp sysrel2 581 <1> sysrel5: 582 0000CB84 A2[E48E0100] <1> mov [u.t_lock], al ; 0 ; reset 583 0000CB89 A0[E58E0100] <1> mov al, [u.t_mode] 584 0000CB8E 20C0 <1> and al, al 585 <1> ;jnz short sysrel2 ; 0FFh ; user mode 586 0000CB90 75E4 <1> jnz short sysrel4 ; 29/01/2017 587 0000CB92 FEC8 <1> dec al 588 0000CB94 A2[E58E0100] <1> mov [u.t_mode], al ; 0FFh ; not necessary !? 589 <1> sysrel6: 590 <1> ; cpu will continue from the interrupted sytem call addr 591 0000CB99 61 <1> popad ; edi, esi, ebp, esp, ebx, edx, ecx, eax 592 0000CB9A 83C410 <1> add esp, 16 ; pass segment segisters: ds, es, fs, gs 593 0000CB9D CF <1> iretd ; eip, cs, eflags 594 <1> 595 <1> sysrel7: 596 0000CB9E 0FB61D[BD8E0100] <1> movzx ebx, byte [u.uno] ; current process number 597 <1> ;shl bx, 2 598 <1> ; 23/07/2022 599 0000CBA5 C1E302 <1> shl ebx, 2 600 <1> ;cmp [ebx+p.tcb-4], eax ; 0 ; is there callback address ? 601 <1> ;jna short sysrel0 602 <1> ; yes, reset callback address then restore process registers 603 <1> ;mov [ebx+p.tcb-4], eax ; 0 ; reset 604 0000CBA8 8B83[AC8D0100] <1> mov eax, [ebx+p.upage-4] ; UPAGE address 605 0000CBAE FA <1> cli ; disable interrupts till 'iretd' 606 0000CBAF E95B3E0000 <1> jmp rswap ; restore process 'u' structure 607 <1> 608 <1> intract: ; / interrupt action 609 <1> ; 14/10/2015 610 <1> ; 16/04/2015 (Retro UNIX 386 v1 - Beginning) 611 <1> ; 09/05/2013 - 07/12/2013 (Retro UNIX 8086 v1) 612 <1> ; 613 <1> ; Retro UNIX 8086 v1 modification ! 614 <1> ; (Process/task switching and quit routine by using 615 <1> ; Retro UNIX 8086 v1 keyboard interrupt output.)) 616 <1> ; 617 <1> ; input -> 'u.quit' (also value of 'u.intr' > 0) 618 <1> ; output -> If value of 'u.quit' = FFFFh ('ctrl+brk' sign) 619 <1> ; 'intract' will jump to 'sysexit'. 620 <1> ; Intract will return to the caller 621 <1> ; if value of 'u.quit' <> FFFFh. 622 <1> ; 14/10/2015 623 0000CBB4 FB <1> sti 624 <1> ; 07/12/2013 625 0000CBB5 66FF05[BA8E0100] <1> inc word [u.quit] 626 0000CBBC 7408 <1> jz short intrct0 ; FFFFh -> 0 627 0000CBBE 66FF0D[BA8E0100] <1> dec word [u.quit] 628 <1> ; 16/04/2015 629 0000CBC5 C3 <1> retn 630 <1> intrct0: 631 0000CBC6 58 <1> pop eax ; call intract -> retn 632 <1> ; 633 <1> ; 20/08/2024 634 <1> ;xor eax, eax 635 <1> ;inc al ; mov ax, 1 636 <1> ;;; 637 <1> ; UNIX v1 original 'intract' routine... 638 <1> ; / interrupt action 639 <1> ;cmp *(sp),$rti / are you in a clock interrupt? 640 <1> ; bne 1f / no, 1f 641 <1> ; cmp (sp)+,(sp)+ / pop clock pointer 642 <1> ; 1: / now in user area 643 <1> ; mov r1,-(sp) / save r1 644 <1> ; mov u.ttyp,r1 645 <1> ; / pointer to tty buffer in control-to r1 646 <1> ; cmpb 6(r1),$177 647 <1> ; / is the interrupt char equal to "del" 648 <1> ; beq 1f / yes, 1f 649 <1> ; clrb 6(r1) 650 <1> ; / no, clear the byte 651 <1> ; / (must be a quit character) 652 <1> ; mov (sp)+,r1 / restore r1 653 <1> ; clr u.quit / clear quit flag 654 <1> ; bis $20,2(sp) 655 <1> ; / set trace for quit (sets t bit of 656 <1> ; / ps-trace trap) 657 <1> ; rti ; / return from interrupt 658 <1> ; 1: / interrupt char = del 659 <1> ; clrb 6(r1) / clear the interrupt byte 660 <1> ; / in the buffer 661 <1> ; mov (sp)+,r1 / restore r1 662 <1> ; cmp u.intr,$core / should control be 663 <1> ; / transferred to loc core? 664 <1> ; blo 1f 665 <1> ; jmp *u.intr / user to do rti yes, 666 <1> ; / transfer to loc core 667 <1> ; 1: 668 <1> ; sys 1 / exit 669 <1> 670 <1> ; 20/08/2024 671 <1> ; ctrl+break -> exit code = -1 672 <1> sysexit_0FFh: 673 <1> ; 20/08/2024 674 0000CBC7 31C0 <1> xor eax, eax 675 0000CBC9 40 <1> inc eax ; mov eax, 1 676 <1> sysexit_@: ; 22/08/2024 677 0000CBCA B3FF <1> mov bl, 0FFh ; exit code ; -1 678 <1> 679 <1> sysexit: ; 680 <1> ; 08/01/2026 - TRDOS 386 v2.0.10 681 <1> ; 22/08/2024 682 <1> ; 20/08/2024 683 <1> ; 18/08/2024 - TRDOS 386 v2.0.9 684 <1> ; 30/07/2022 685 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 686 <1> ; 14/11/2017 687 <1> ; 27/05/2017 688 <1> ; 10/04/2017 689 <1> ; 26/02/2017 - 28/02/2017 690 <1> ; 02/01/2017 - 23/01/2017 691 <1> ; 06/06/2016 - 10/06/2016 692 <1> ; 19/05/2016 - 23/05/2016 693 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 694 <1> ; 16/04/2015 - 01/09/2015 (Retro UNIX 386 v1) 695 <1> ; 19/04/2013 - 14/02/2014 (Retro UNIX 8086 v1) 696 <1> ; 697 <1> ; 'sysexit' terminates a process. First each file that 698 <1> ; the process has opened is closed by 'flose'. The process 699 <1> ; status is then set to unused. The 'p.pid' table is then 700 <1> ; searched to find children of the dying process. If any of 701 <1> ; children are zombies (died by not waited for), they are 702 <1> ; set free. The 'p.pid' table is then searched to find the 703 <1> ; dying process's parent. When the parent is found, it is 704 <1> ; checked to see if it is free or it is a zombie. If it is 705 <1> ; one of these, the dying process just dies. If it is waiting 706 <1> ; for a child process to die, it notified that it doesn't 707 <1> ; have to wait anymore by setting it's status from 2 to 1 708 <1> ; (waiting to active). It is awakened and put on runq by 709 <1> ; 'putlu'. The dying process enters a zombie state in which 710 <1> ; it will never be run again but stays around until a 'wait' 711 <1> ; is completed by it's parent process. If the parent is not 712 <1> ; found, process just dies. This means 'swap' is called with 713 <1> ; 'u.uno=0'. What this does is the 'wswap' is not called 714 <1> ; to write out the process and 'rswap' reads the new process 715 <1> ; over the one that dies..i.e., the dying process is 716 <1> ; overwritten and destroyed. 717 <1> ; 718 <1> ; Calling sequence: 719 <1> ; sysexit or conditional branch. 720 <1> ; Arguments: 721 <1> ; - 722 <1> ; ............................................................... 723 <1> ; 724 <1> ; Retro UNIX 8086 v1 modification: 725 <1> ; System call number (=1) is in EAX register. 726 <1> ; 727 <1> ; Other parameters are in EDX, EBX, ECX, ESI, EDI, EBP 728 <1> ; registers depending of function details. 729 <1> ; 730 <1> ; ('swap' procedure is mostly different than original UNIX v1.) 731 <1> ; 732 <1> ; / terminate process 733 <1> ; AX = 1 734 <1> ;dec ax ; 0 735 <1> ; 18/08/2024 736 0000CBCC 48 <1> dec eax 737 0000CBCD 66A3[B88E0100] <1> mov [u.intr], ax ; 0 738 <1> ; clr u.intr / clear interrupt control word 739 <1> ; clr r1 / clear r1 740 <1> ; 18/08/2024 - exit code (in EBX, BL) 741 0000CBD3 881D[EA8E0100] <1> mov [u.exit], bl 742 <1> sysexit_0: 743 <1> ; 08/01/2026 (BugFix) 744 <1> ; 30/07/2022 745 <1> ; 23/01/2017 746 <1> ; 02/01/2017 747 <1> ; 10/06/2016 748 <1> ; 06/06/2016 749 <1> ; 23/05/2016 750 <1> ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 751 <1> ; Check and stop/clear timer event(s) of this (dying) process 752 <1> ; if there is. 753 <1> 754 <1> ; 02/01/2017 755 0000CBD9 FA <1> cli ; disable interrupts 756 <1> ; 23/01/2017 - reset timer frequency (to 18.2Hz) 757 0000CBDA B036 <1> mov al, 00110110b ; 36h 758 0000CBDC E643 <1> out 43h, al 759 0000CBDE 28C0 <1> sub al, al ; 0 760 0000CBE0 E640 <1> out 40h, al ; LB 761 0000CBE2 E640 <1> out 40h, al ; HB 762 <1> ; 763 0000CBE4 0FB61D[BD8E0100] <1> movzx ebx, byte [u.uno] 764 <1> ;mov bl, [u.uno] ; process number of dying process 765 0000CBEB 3883[EF8D0100] <1> cmp byte [ebx+p.timer-1], al ; 0 766 0000CBF1 7639 <1> jna short sysexit_12 ; no timer events for this process 767 0000CBF3 8883[EF8D0100] <1> mov byte [ebx+p.timer-1], al ; 0 ; reset 768 <1> ;mov al, [timer_events] 769 <1> ;or al, al 770 <1> ;jz short sysexit_12 ; no timer events 771 <1> ;mov cl, al 772 0000CBF9 8A0D[47830100] <1> mov cl, [timer_events] ; 14/11/2017 773 <1> ;cli ; disable interrupts 774 0000CBFF B410 <1> mov ah, 16 ; number of available timer events 775 0000CC01 BE[808F0100] <1> mov esi, timer_set ; beginning address of timer events 776 <1> sysexit_7: 777 0000CC06 8A06 <1> mov al, [esi] ; process number (of timer event) 778 0000CC08 38D8 <1> cmp al, bl ; process number comparison 779 0000CC0A 7413 <1> je short sysexit_10 780 0000CC0C 20C0 <1> and al, al 781 0000CC0E 7406 <1> jz short sysexit_9 782 <1> sysexit_8: 783 0000CC10 FEC9 <1> dec cl 784 0000CC12 7416 <1> jz short sysexit_11 785 <1> ; 08/01/2026 (BugFix) 786 0000CC14 B000 <1> mov al, 0 787 <1> sysexit_9: 788 0000CC16 FECC <1> dec ah 789 0000CC18 7412 <1> jz short sysexit_12 790 0000CC1A 83C610 <1> add esi, 16 791 0000CC1D EBE7 <1> jmp short sysexit_7 792 <1> 793 <1> sysexit_10: 794 <1> ; set timer event as free 795 0000CC1F C60600 <1> mov byte [esi], 0 ; 08/01/2026 796 <1> ;mov word [esi], 0 797 <1> ;mov dword [esi+12], 0 798 <1> ; 799 0000CC22 FE0D[47830100] <1> dec byte [timer_events] ; 02/01/2017 800 <1> ; 801 0000CC28 EBE6 <1> jmp short sysexit_8 802 <1> 803 <1> sysexit_11: 804 <1> ;sub ax, ax ; 0 ; 26/02/2017 805 <1> ; 30/07/2022 806 0000CC2A 29C0 <1> sub eax, eax ; 0 807 <1> sysexit_12: 808 <1> ; 26/02/2017 (Unlink IRQ callbacks belong to the user) 809 <1> ;cmp byte [u.irqc], 0 ; Count of IRQ callbacks 810 <1> ; 08/01/2026 811 <1> ; eax = 0 812 0000CC2C 3805[E68E0100] <1> cmp byte [u.irqc], al ; 0 ? 813 0000CC32 7E53 <1> jng short sysexit_16 ; zero or invalid 814 <1> ; 28/02/2017 815 <1> ; clear IRQ callback flags (for 'sysrele' and 'sysret') 816 0000CC34 A2[E78E0100] <1> mov [u.irqwait], al ; 0 ; force to clear waiting flag 817 0000CC39 A2[E88E0100] <1> mov [u.r_lock], al ; 0 ; force to clear busy flag 818 0000CC3E BE[94880100] <1> mov esi, IRQ.owner 819 <1> sysexit_13: 820 0000CC43 AC <1> lodsb 821 0000CC44 3A05[BD8E0100] <1> cmp al, [u.uno] ; owner = current user ? 822 0000CC4A 7531 <1> jne short sysexit_14 823 0000CC4C C646FF00 <1> mov byte [esi-1], 0 ; owner = 0 : Free 824 <1> 825 <1> ;;; 826 <1> ; 22/08/2024 - Reset Hardware Interrupt Handler 827 0000CC50 89F1 <1> mov ecx, esi 828 0000CC52 81E9[94880100] <1> sub ecx, IRQ.owner 829 <1> ; CL = (user configurable) IRQ index + 1 (1 to 9) 830 0000CC58 B8[B0350100] <1> mov eax, IRQenum 831 <1> sysexit_18: 832 0000CC5D 3A08 <1> cmp cl, [eax] 833 0000CC5F 740A <1> je short sysexit_19 834 0000CC61 3D[BF350100] <1> cmp eax, IRQenum+15 835 0000CC66 730D <1> jnb short sysexit_20 836 0000CC68 40 <1> inc eax 837 0000CC69 EBF2 <1> jmp short sysexit_18 838 <1> sysexit_19: 839 0000CC6B 2D[B0350100] <1> sub eax, IRQenum 840 <1> ; AL = IRQ number (will be reset to system's IRQ handler) 841 <1> ; AH = 0 842 <1> ;mov ah, 0 ; reset 843 0000CC70 E8A7510000 <1> call set_hardware_int_vector 844 <1> sysexit_20: 845 <1> ;;; 846 <1> 847 0000CC75 FE0D[E68E0100] <1> dec byte [u.irqc] 848 0000CC7B 7408 <1> jz short sysexit_15 849 <1> sysexit_14: 850 0000CC7D 81FE[9C880100] <1> cmp esi, IRQ.owner + 8 ; the last IRQ index number ? 851 0000CC83 76BE <1> jna short sysexit_13 ; no 852 <1> sysexit_15: 853 <1> ;xor al, al ; 0 854 <1> ; 22/08/2024 855 0000CC85 31C0 <1> xor eax, eax 856 <1> sysexit_16: ; 2: 857 0000CC87 FB <1> sti ; enable interrupts 858 <1> ; 859 <1> ; AX = 0 860 <1> sysexit_1: ; 1: 861 <1> ; AX = File descriptor 862 <1> ; / r1 has file descriptor (index to u.fp list) 863 <1> ; / Search the whole list 864 0000CC88 E8CE350000 <1> call fclose 865 <1> ; jsr r0,fclose / close all files the process opened 866 <1> ;; ignore error return 867 <1> ; br .+2 / ignore error return 868 <1> ;;inc ax 869 <1> ;inc al 870 <1> ; 22/08/2024 871 0000CC8D 40 <1> inc eax 872 <1> ; inc r1 / increment file descriptor 873 <1> ;cmp ax, 10 874 0000CC8E 3C0A <1> cmp al, 10 875 <1> ; cmp r1,$10. / end of u.fp list? 876 0000CC90 72F6 <1> jb short sysexit_1 877 <1> ; blt 1b / no, go back 878 <1> 879 <1> ; 22/08/2024 880 <1> ; reset IRQs if owned by the current (dying) process 881 0000CC92 BE[94880100] <1> mov esi, IRQ.owner 882 <1> 883 <1> ;movzx ebx, byte [u.uno] 884 0000CC97 8A1D[BD8E0100] <1> mov bl, [u.uno] ; 02/01/2017 885 <1> ; movb u.uno,r1 / yes, move dying process's number to r1 886 0000CC9D 88A3[9F8D0100] <1> mov [ebx+p.stat-1], ah ; 0, SFREE 887 <1> ; clrb p.stat-1(r1) / free the process 888 <1> ; 10/04/2017 889 0000CCA3 381D[11890100] <1> cmp [audio_user], bl 890 0000CCA9 7518 <1> jne short sysexit_17 891 <1> ; reset audio device (current) owner and 'initializated' flag 892 0000CCAB 883D[11890100] <1> mov [audio_user], bh ; 0 893 <1> ; 27/05/2017 894 0000CCB1 8B0D[F8880100] <1> mov ecx, [audio_buffer] 895 0000CCB7 09C9 <1> or ecx, ecx 896 0000CCB9 7408 <1> jz short sysexit_17 897 <1> ; 'deallocate_user_pages' is not necessary in sysexit !!! 898 <1> ;push ebx 899 <1> ;mov ebx, ecx 900 <1> ;mov ecx, [audio_buff_size] 901 <1> ;call deallocate_user_pages 902 <1> ;; (Modified Registers -> EAX, EDX, ESI, EDI, EBX, ECX, EBP) 903 0000CCBB 29C9 <1> sub ecx, ecx 904 0000CCBD 890D[F8880100] <1> mov [audio_buffer], ecx ; 0 905 <1> ;pop ebx 906 <1> sysexit_17: 907 <1> ;shl bx, 1 908 0000CCC3 D0E3 <1> shl bl, 1 909 <1> ; 22/08/2024 910 <1> ;shl ebx, 1 911 <1> ; asl r1 / use r1 for index into the below tables 912 0000CCC5 668B8B[3E8D0100] <1> mov cx, [ebx+p.pid-2] 913 <1> ; mov p.pid-2(r1),r3 / move dying process's name to r3 914 0000CCCC 668B93[5E8D0100] <1> mov dx, [ebx+p.ppid-2] 915 <1> ; mov p.ppid-2(r1),r4 / move its parents name to r4 916 <1> ;xor bx, bx ; 0 917 0000CCD3 30DB <1> xor bl, bl ; 0 918 <1> ; clr r2 919 0000CCD5 31F6 <1> xor esi, esi ; 0 920 <1> ; clr r5 / initialize reg 921 <1> sysexit_2: ; 1: 922 <1> ; / find children of this dying process, 923 <1> ; / if they are zombies, free them 924 <1> ;add bx, 2 925 0000CCD7 80C302 <1> add bl, 2 926 <1> ; add $2,r2 / search parent process table 927 <1> ; / for dying process's name 928 0000CCDA 66398B[5E8D0100] <1> cmp [ebx+p.ppid-2], cx 929 <1> ; cmp p.ppid-2(r2),r3 / found it? 930 0000CCE1 7513 <1> jne short sysexit_4 931 <1> ; bne 3f / no 932 <1> ;shr bx, 1 933 0000CCE3 D0EB <1> shr bl, 1 934 <1> ; asr r2 / yes, it is a parent 935 0000CCE5 80BB[9F8D0100]03 <1> cmp byte [ebx+p.stat-1], 3 ; SZOMB 936 <1> ; cmpb p.stat-1(r2),$3 / is the child of this 937 <1> ; / dying process a zombie 938 0000CCEC 7506 <1> jne short sysexit_3 939 <1> ; bne 2f / no 940 0000CCEE 88A3[9F8D0100] <1> mov [ebx+p.stat-1], ah ; 0, SFREE 941 <1> ; clrb p.stat-1(r2) / yes, free the child process 942 <1> sysexit_3: ; 2: 943 <1> ;shr bx, 1 944 0000CCF4 D0E3 <1> shl bl, 1 945 <1> ; asl r2 946 <1> sysexit_4: ; 3: 947 <1> ; / search the process name table 948 <1> ; / for the dying process's parent 949 0000CCF6 663993[3E8D0100] <1> cmp [ebx+p.pid-2], dx 950 <1> ; cmp p.pid-2(r2),r4 / found it? 951 0000CCFD 7502 <1> jne short sysexit_5 952 <1> ; bne 3f / no 953 0000CCFF 89DE <1> mov esi, ebx 954 <1> ; mov r2,r5 / yes, put index to p.pid table (parents 955 <1> ; / process # x2) in r5 956 <1> sysexit_5: ; 3: 957 <1> ;cmp bx, nproc + nproc 958 0000CD01 80FB20 <1> cmp bl, nproc + nproc 959 <1> ; cmp r2,$nproc+nproc / has whole table been searched? 960 0000CD04 72D1 <1> jb short sysexit_2 961 <1> ; blt 1b / no, go back 962 <1> ; mov r5,r1 / yes, r1 now has parents process # x2 963 0000CD06 21F6 <1> and esi, esi ; r5=r1 964 0000CD08 743F <1> jz short sysexit_6 965 <1> ; beq 2f / no parent has been found. 966 <1> ; / The process just dies 967 <1> ;shr si, 1 968 <1> ; 23/07/2022 969 0000CD0A D1EE <1> shr esi, 1 970 <1> ; asr r1 / set up index to p.stat 971 0000CD0C 8A86[9F8D0100] <1> mov al, [esi+p.stat-1] 972 <1> ; movb p.stat-1(r1),r2 / move status of parent to r2 973 0000CD12 20C0 <1> and al, al 974 0000CD14 7433 <1> jz short sysexit_6 975 <1> ; beq 2f / if its been freed, 2f 976 0000CD16 3C03 <1> cmp al, 3 977 <1> ; cmp r2,$3 / is parent a zombie? 978 0000CD18 742F <1> je short sysexit_6 979 <1> ; beq 2f / yes, 2f 980 <1> 981 <1> ; BH = 0 982 0000CD1A 8A1D[BD8E0100] <1> mov bl, [u.uno] 983 <1> ; movb u.uno,r3 / move dying process's number to r3 984 0000CD20 C683[9F8D0100]03 <1> mov byte [ebx+p.stat-1], 3 ; SZOMB 985 <1> ; movb $3,p.stat-1(r3) / make the process a zombie 986 <1> 987 0000CD27 3C01 <1> cmp al, 1 ; SRUN 988 0000CD29 741E <1> je short sysexit_6 989 <1> ;cmp al, 2 990 <1> ; cmp r2,$2 / is the parent waiting for 991 <1> ; / this child to die 992 <1> ;jne short sysexit_6 993 <1> ; bne 2f / yes, notify parent not to wait any more 994 <1> ; p.stat = 2 --> waiting 995 <1> ; p.stat = 4 --> sleeping 996 0000CD2B C686[9F8D0100]01 <1> mov byte [esi+p.stat-1], 1 ; SRUN 997 <1> ;;; 998 <1> ; 18/08/2024 - exit code 999 0000CD32 A0[EA8E0100] <1> mov al, [u.exit] ; exit code of the child 1000 <1> ; 20/08/2024 1001 0000CD37 8883[3F8E0100] <1> mov [ebx+p.exitc-1], al ; save it to use by the parent 1002 <1> ;;; 1003 <1> ;dec byte [esi+p.stat-1] 1004 <1> ; decb p.stat-1(r1) / awaken it by putting it (parent) 1005 <1> ;;; 1006 <1> ;mov ax, si ; r1 (process number in AL) 1007 <1> ; 18/08/2024 1008 0000CD3D 89F0 <1> mov eax, esi 1009 <1> ;;; 1010 <1> ;mov ebx, runq + 4 1011 <1> ; mov $runq+4,r2 / on the runq 1012 0000CD3F BB[5C8E0100] <1> mov ebx, runq+2 ; normal run queue ; 02/01/2017 1013 0000CD44 E8FE3C0000 <1> call putlu 1014 <1> ; jsr r0, putlu 1015 <1> sysexit_6: 1016 <1> ; / the process dies 1017 0000CD49 C605[BD8E0100]00 <1> mov byte [u.uno], 0 1018 <1> ; clrb u.uno / put zero as the process number, 1019 <1> ; / so "swap" will 1020 0000CD50 E8F53B0000 <1> call swap 1021 <1> ; jsr r0,swap / overwrite process with another process 1022 <1> hlt_sys: 1023 <1> ;sti 1024 <1> hlts0: 1025 0000CD55 F4 <1> hlt 1026 0000CD56 EBFD <1> jmp short hlts0 1027 <1> ; 0 / and thereby kill it; halt? 1028 <1> 1029 <1> syswait: ; < wait for a processs to die > 1030 <1> ; 20/08/2024 1031 <1> ; 30/07/2022 1032 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 1033 <1> ; 17/09/2015 1034 <1> ; 02/09/2015 1035 <1> ; 01/09/2015 1036 <1> ; 16/04/2015 (Retro UNIX 386 v1 - Beginning) 1037 <1> ; 24/05/2013 - 05/02/2014 (Retro UNIX 8086 v1) 1038 <1> ; 1039 <1> ; 'syswait' waits for a process die. 1040 <1> ; It works in following way: 1041 <1> ; 1) From the parent process number, the parent's 1042 <1> ; process name is found. The p.ppid table of parent 1043 <1> ; names is then searched for this process name. 1044 <1> ; If a match occurs, r2 contains child's process 1045 <1> ; number. The child status is checked to see if it is 1046 <1> ; a zombie, i.e; dead but not waited for (p.stat=3) 1047 <1> ; If it is, the child process is freed and it's name 1048 <1> ; is put in (u.r0). A return is then made via 'sysret'. 1049 <1> ; If the child is not a zombie, nothing happens and 1050 <1> ; the search goes on through the p.ppid table until 1051 <1> ; all processes are checked or a zombie is found. 1052 <1> ; 2) If no zombies are found, a check is made to see if 1053 <1> ; there are any children at all. If there are none, 1054 <1> ; an error return is made. If there are, the parent's 1055 <1> ; status is set to 2 (waiting for child to die), 1056 <1> ; the parent is swapped out, and a branch to 'syswait' 1057 <1> ; is made to wait on the next process. 1058 <1> ; 1059 <1> ; Calling sequence: 1060 <1> ; ? 1061 <1> ; Arguments: 1062 <1> ; - 1063 <1> ; Inputs: - 1064 <1> ; Outputs: if zombie found, it's name put in u.r0. 1065 <1> ; ............................................................... 1066 <1> ; 1067 <1> 1068 <1> ; / wait for a process to die 1069 <1> 1070 <1> syswait_0: 1071 0000CD58 0FB61D[BD8E0100] <1> movzx ebx, byte [u.uno] ; 01/09/2015 1072 <1> ; movb u.uno,r1 / put parents process number in r1 1073 0000CD5F D0E3 <1> shl bl, 1 1074 <1> ;shl bx, 1 1075 <1> ; asl r1 / x2 to get index into p.pid table 1076 0000CD61 668B83[3E8D0100] <1> mov ax, [ebx+p.pid-2] 1077 <1> ; mov p.pid-2(r1),r1 / get the name of this process 1078 0000CD68 31F6 <1> xor esi, esi 1079 <1> ; clr r2 1080 0000CD6A 31C9 <1> xor ecx, ecx ; 30/10/2013 1081 <1> ;xor cl, cl 1082 <1> ; clr r3 / initialize reg 3 1083 <1> syswait_1: ; 1: 1084 <1> ;add si, 2 1085 <1> ; 23/07/2022 1086 0000CD6C 46 <1> inc esi 1087 0000CD6D 46 <1> inc esi 1088 <1> ; add $2,r2 / use r2 for index into p.ppid table 1089 <1> ; / search table of parent processes 1090 <1> ; / for this process name 1091 0000CD6E 663B86[5E8D0100] <1> cmp ax, [esi+p.ppid-2] 1092 <1> ; cmp p.ppid-2(r2),r1 / r2 will contain the childs 1093 <1> ; / process number 1094 0000CD75 7542 <1> jne short syswait_3 1095 <1> ;bne 3f / branch if no match of parent process name 1096 <1> ;inc cx 1097 0000CD77 FEC1 <1> inc cl 1098 <1> ;inc r3 / yes, a match, r3 indicates number of children 1099 <1> ;shr si, 1 1100 <1> ; 23/07/2022 1101 0000CD79 D1EE <1> shr esi, 1 1102 <1> ; asr r2 / r2/2 to get index to p.stat table 1103 <1> ; The possible states ('p.stat' values) of a process are: 1104 <1> ; 0 = free or unused 1105 <1> ; 1 = active 1106 <1> ; 2 = waiting for a child process to die 1107 <1> ; 3 = terminated, but not yet waited for (zombie). 1108 0000CD7B 80BE[9F8D0100]03 <1> cmp byte [esi+p.stat-1], 3 ; SZOMB, 05/02/2014 1109 <1> ; cmpb p.stat-1(r2),$3 / is the child process a zombie? 1110 0000CD82 7533 <1> jne short syswait_2 1111 <1> ; bne 2f / no, skip it 1112 0000CD84 88BE[9F8D0100] <1> mov [esi+p.stat-1], bh ; 0 1113 <1> ; clrb p.stat-1(r2) / yes, free it 1114 <1> 1115 <1> ; 20/08/2024 (ebx = child's exit code) 1116 0000CD8A 31C0 <1> xor eax, eax 1117 0000CD8C 8A86[3F8E0100] <1> mov al, [esi+p.exitc-1] ; exit code 1118 0000CD92 8B2D[688E0100] <1> mov ebp, [u.usp] 1119 <1> ; 22/08/2024 1120 0000CD98 894510 <1> mov [ebp+16], eax ; ebx 1121 <1> 1122 <1> ;shl si, 1 1123 <1> ; 23/07/2022 1124 0000CD9B D1E6 <1> shl esi, 1 1125 <1> ; asl r2 / r2x2 to get index into p.pid table 1126 <1> ;movzx eax, word [esi+p.pid-2] 1127 <1> ; 20/08/2024 1128 0000CD9D 668B86[3E8D0100] <1> mov ax, [esi+p.pid-2] 1129 0000CDA4 A3[6C8E0100] <1> mov [u.r0], eax 1130 <1> ; mov p.pid-2(r2),*u.r0 1131 <1> ; / put childs process name in (u.r0) 1132 <1> ; 1133 <1> ; Retro UNIX 386 v1 modification ! (17/09/2015) 1134 <1> ; 1135 <1> ; Parent process ID -p.ppid- field (of the child process) 1136 <1> ; must be cleared in order to prevent infinitive 'syswait' 1137 <1> ; system call loop from the application/program if it calls 1138 <1> ; 'syswait' again (mistakenly) while there is not a zombie 1139 <1> ; or running child process to wait. ('forktest.s', 17/09/2015) 1140 <1> ; 1141 <1> ; Note: syswait will return with error if there is not a 1142 <1> ; zombie or running process to wait. 1143 <1> 1144 <1> ;sub ax, ax 1145 <1> ; 30/07/2022 1146 0000CDA9 29C0 <1> sub eax, eax ; 0 1147 0000CDAB 668986[5E8D0100] <1> mov [esi+p.ppid-2], ax ; 0 ; 17/09/2015 1148 0000CDB2 E9D9FCFFFF <1> jmp sysret0 ; ax = 0 1149 <1> ; 1150 <1> ;jmp sysret 1151 <1> ; br sysret1 / return cause child is dead 1152 <1> syswait_2: ; 2: 1153 <1> ;shl si, 1 1154 <1> ; 23/07/2022 1155 0000CDB7 D1E6 <1> shl esi, 1 1156 <1> ; asl r2 / r2x2 to get index into p.ppid table 1157 <1> syswait_3: ; 3: 1158 0000CDB9 6683FE20 <1> cmp si, nproc+nproc 1159 <1> ; cmp r2,$nproc+nproc / have all processes been checked? 1160 0000CDBD 72AD <1> jb short syswait_1 1161 <1> ; blt 1b / no, continue search 1162 <1> ;and cx, cx 1163 0000CDBF 20C9 <1> and cl, cl 1164 <1> ; tst r3 / one gets here if there are no children 1165 <1> ; / or children that are still active 1166 <1> ; 30/10/2013 1167 0000CDC1 7515 <1> jnz short syswait_4 1168 <1> ;jz error 1169 <1> ; beq error1 / there are no children, error 1170 0000CDC3 890D[6C8E0100] <1> mov [u.r0], ecx ; 0 1171 <1> 1172 <1> ; 20/08/2024 (ebx = child's exit code) 1173 0000CDC9 8B2D[688E0100] <1> mov ebp, [u.usp] 1174 0000CDCF 49 <1> dec ecx ; -1 ; 0FFFFFFFFh 1175 <1> ; 22/08/2024 1176 0000CDD0 894D10 <1> mov [ebp+16], ecx ; ebx 1177 <1> 1178 0000CDD3 E996FCFFFF <1> jmp error 1179 <1> syswait_4: 1180 0000CDD8 8A1D[BD8E0100] <1> mov bl, [u.uno] 1181 <1> ; movb u.uno,r1 / there are children so put 1182 <1> ; / parent process number in r1 1183 0000CDDE FE83[9F8D0100] <1> inc byte [ebx+p.stat-1] ; 2, SWAIT, 05/02/2014 1184 <1> ; incb p.stat-1(r1) / it is waiting for 1185 <1> ; / other children to die 1186 <1> ; 04/11/2013 1187 0000CDE4 E8613B0000 <1> call swap 1188 <1> ; jsr r0,swap / swap it out, because it's waiting 1189 <1> 1190 <1> ; 23/08/2024 - bugfix 1191 <1> ; restore [u.usp] 1192 <1> ; (swap above changes [u.usp] just before wswap) 1193 0000CDE9 8925[688E0100] <1> mov [u.usp], esp 1194 <1> ; points to user's regs on top ofn system stack 1195 <1> 1196 0000CDEF E964FFFFFF <1> jmp syswait_0 1197 <1> ; br syswait / wait on next process 1198 <1> 1199 <1> sysfork: ; < create a new process > 1200 <1> ; 19/08/2024 - TRDOS 386 Kernel v2.0.9 (STDIN/STDOUT) 1201 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 1202 <1> ; 02/01/2017 (TRDOS 386 modification) 1203 <1> ; 04/09/2015 - 18/05/2015 1204 <1> ; 28/08/2015 - 01/09/2015 - 02/09/2015 1205 <1> ; 09/05/2015 - 10/05/2015 - 14/05/2015 1206 <1> ; 06/05/2015 (Retro UNIX 386 v1 - Beginning) 1207 <1> ; 24/05/2013 - 14/02/2014 (Retro UNIX 8086 v1) 1208 <1> ; 1209 <1> ; 'sysfork' creates a new process. This process is referred 1210 <1> ; to as the child process. This new process core image is 1211 <1> ; a copy of that of the caller of 'sysfork'. The only 1212 <1> ; distinction is the return location and the fact that (u.r0) 1213 <1> ; in the old process (parent) contains the process id (p.pid) 1214 <1> ; of the new process (child). This id is used by 'syswait'. 1215 <1> ; 'sysfork' works in the following manner: 1216 <1> ; 1) The process status table (p.stat) is searched to find 1217 <1> ; a process number that is unused. If none are found 1218 <1> ; an error occurs. 1219 <1> ; 2) when one is found, it becomes the child process number 1220 <1> ; and it's status (p.stat) is set to active. 1221 <1> ; 3) If the parent had a control tty, the interrupt 1222 <1> ; character in that tty buffer is cleared. 1223 <1> ; 4) The child process is put on the lowest priority run 1224 <1> ; queue via 'putlu'. 1225 <1> ; 5) A new process name is gotten from 'mpid' (actually 1226 <1> ; it is a unique number) and is put in the child's unique 1227 <1> ; identifier; process id (p.pid). 1228 <1> ; 6) The process name of the parent is then obtained and 1229 <1> ; placed in the unique identifier of the parent process 1230 <1> ; name is then put in 'u.r0'. 1231 <1> ; 7) The child process is then written out on disk by 1232 <1> ; 'wswap',i.e., the parent process is copied onto disk 1233 <1> ; and the child is born. (The child process is written 1234 <1> ; out on disk/drum with 'u.uno' being the child process 1235 <1> ; number.) 1236 <1> ; 8) The parent process number is then restored to 'u.uno'. 1237 <1> ; 9) The child process name is put in 'u.r0'. 1238 <1> ; 10) The pc on the stack sp + 18 is incremented by 2 to 1239 <1> ; create the return address for the parent process. 1240 <1> ; 11) The 'u.fp' list as then searched to see what files 1241 <1> ; the parent has opened. For each file the parent has 1242 <1> ; opened, the corresponding 'fsp' entry must be updated 1243 <1> ; to indicate that the child process also has opened 1244 <1> ; the file. A branch to 'sysret' is then made. 1245 <1> ; 1246 <1> ; Calling sequence: 1247 <1> ; from shell ? 1248 <1> ; Arguments: 1249 <1> ; - 1250 <1> ; Inputs: - 1251 <1> ; Outputs: *u.r0 - child process name 1252 <1> ; ............................................................... 1253 <1> ; 1254 <1> ; Retro UNIX 8086 v1 modification: 1255 <1> ; AX = r0 = PID (>0) (at the return of 'sysfork') 1256 <1> ; = process id of child a parent process returns 1257 <1> ; = process id of parent when a child process returns 1258 <1> ; 1259 <1> ; In original UNIX v1, sysfork is called and returns as 1260 <1> ; in following manner: (with an example: c library, fork) 1261 <1> ; 1262 <1> ; 1: 1263 <1> ; sys fork 1264 <1> ; br 1f / child process returns here 1265 <1> ; bes 2f / parent process returns here 1266 <1> ; / pid of new process in r0 1267 <1> ; rts pc 1268 <1> ; 2: / parent process condionally branches here 1269 <1> ; mov $-1,r0 / pid = -1 means error return 1270 <1> ; rts pc 1271 <1> ; 1272 <1> ; 1: / child process brances here 1273 <1> ; clr r0 / pid = 0 in child process 1274 <1> ; rts pc 1275 <1> ; 1276 <1> ; In UNIX v7x86 (386) by Robert Nordier (1999) 1277 <1> ; // pid = fork(); 1278 <1> ; // 1279 <1> ; // pid == 0 in child process; 1280 <1> ; // pid == -1 means error return 1281 <1> ; // in child, 1282 <1> ; // parents id is in par_uid if needed 1283 <1> ; 1284 <1> ; _fork: 1285 <1> ; mov $.fork,eax 1286 <1> ; int $0x30 1287 <1> ; jmp 1f 1288 <1> ; jnc 2f 1289 <1> ; jmp cerror 1290 <1> ; 1: 1291 <1> ; mov eax,_par_uid 1292 <1> ; xor eax,eax 1293 <1> ; 2: 1294 <1> ; ret 1295 <1> ; 1296 <1> ; In Retro UNIX 8086 v1, 1297 <1> ; 'sysfork' returns in following manner: 1298 <1> ; 1299 <1> ; mov ax, sys_fork 1300 <1> ; mov bx, offset @f ; routine for child 1301 <1> ; int 20h 1302 <1> ; jc error 1303 <1> ; 1304 <1> ; ; Routine for parent process here (just after 'jc') 1305 <1> ; mov word ptr [pid_of_child], ax 1306 <1> ; jmp next_routine_for_parent 1307 <1> ; 1308 <1> ; @@: ; routine for child process here 1309 <1> ; .... 1310 <1> ; NOTE: 'sysfork' returns to specified offset 1311 <1> ; for child process by using BX input. 1312 <1> ; (at first, parent process will return then 1313 <1> ; child process will return -after swapped in- 1314 <1> ; 'syswait' is needed in parent process 1315 <1> ; if return from child process will be waited for.) 1316 <1> ; 1317 <1> 1318 <1> ; / create a new process 1319 <1> ; EBX = return address for child process 1320 <1> ; (Retro UNIX 8086 v1 modification !) 1321 0000CDF4 31F6 <1> xor esi, esi 1322 <1> ; clr r1 1323 <1> sysfork_1: ; 1: / search p.stat table for unused process number 1324 0000CDF6 46 <1> inc esi 1325 <1> ; inc r1 1326 0000CDF7 80BE[9F8D0100]00 <1> cmp byte [esi+p.stat-1], 0 ; SFREE, 05/02/2014 1327 <1> ; tstb p.stat-1(r1) / is process active, unused, dead 1328 0000CDFE 760B <1> jna short sysfork_2 1329 <1> ; beq 1f / it's unused so branch 1330 0000CE00 6683FE10 <1> cmp si, nproc 1331 <1> ; cmp r1,$nproc / all processes checked 1332 0000CE04 72F0 <1> jb short sysfork_1 1333 <1> ; blt 1b / no, branch back 1334 <1> ; 1335 <1> ; Retro UNIX 8086 v1. modification: 1336 <1> ; Parent process returns from 'sysfork' to address 1337 <1> ; which is just after 'sysfork' system call in parent 1338 <1> ; process. Child process returns to address which is put 1339 <1> ; in BX register by parent process for 'sysfork'. 1340 <1> ; 1341 <1> ; add $2,18.(sp) / add 2 to pc when trap occured, points 1342 <1> ; / to old process return 1343 <1> ; br error1 / no room for a new process 1344 <1> sysfork_err: 1345 0000CE06 E963FCFFFF <1> jmp error 1346 <1> sysfork_2: ; 1: 1347 0000CE0B E81A8AFFFF <1> call allocate_page 1348 <1> ;jc error 1349 <1> ; 23/07/2022 1350 0000CE10 72F4 <1> jc short sysfork_err 1351 0000CE12 50 <1> push eax ; UPAGE (user structure page) address 1352 <1> ; Retro UNIX 386 v1 modification! 1353 0000CE13 E8028CFFFF <1> call duplicate_page_dir 1354 <1> ; EAX = New page directory 1355 0000CE18 730B <1> jnc short sysfork_3 1356 0000CE1A 58 <1> pop eax ; UPAGE (user structure page) address 1357 0000CE1B E8C98BFFFF <1> call deallocate_page 1358 0000CE20 E949FCFFFF <1> jmp error 1359 <1> sysfork_3: 1360 <1> ; Retro UNIX 386 v1 modification ! 1361 0000CE25 56 <1> push esi 1362 0000CE26 E8AC3B0000 <1> call wswap ; save current user (u) structure, user registers 1363 <1> ; and interrupt return components (for IRET) 1364 0000CE2B 8705[C48E0100] <1> xchg eax, [u.pgdir] ; page directory of the child process 1365 0000CE31 A3[C88E0100] <1> mov [u.ppgdir], eax ; page directory of the parent process 1366 0000CE36 5E <1> pop esi 1367 0000CE37 58 <1> pop eax ; UPAGE (user structure page) address 1368 <1> ; [u.usp] = esp 1369 0000CE38 89F7 <1> mov edi, esi 1370 <1> ;shl di, 2 1371 <1> ; 23/07/2022 1372 0000CE3A C1E702 <1> shl edi, 2 1373 0000CE3D 8987[AC8D0100] <1> mov [edi+p.upage-4], eax ; memory page for 'user' struct 1374 0000CE43 A3[C08E0100] <1> mov [u.upage], eax ; memory page for 'user' struct (child) 1375 <1> ;;; 1376 <1> ; 19/08/2024 - reset STDIN/STDOUT redirections (and ungetchar) 1377 0000CE48 31C0 <1> xor eax, eax ; 0 1378 <1> ; 19/08/2024 1379 <1> ;mov [u.stdin], al ; 0 1380 <1> ;mov [u.stdout], al ; 0 1381 <1> ;mov [u.ungetc], al ; 0 1382 <1> ;mov [u.getc], al ; 0 1383 0000CE4A A3[D48E0100] <1> mov [u.stdin], eax ; 0 1384 <1> ;;; 1385 <1> 1386 <1> ; 28/08/2015 1387 <1> ;movzx eax, byte [u.uno] ; parent process number 1388 <1> ; 19/08/2024 1389 <1> ; eax = 0 1390 0000CE4F A0[BD8E0100] <1> mov al, [u.uno] ; parent process number 1391 <1> ; movb u.uno,-(sp) / save parent process number 1392 0000CE54 89C7 <1> mov edi, eax 1393 0000CE56 50 <1> push eax ; ** 1394 0000CE57 8A87[7F8D0100] <1> mov al, [edi+p.ttyc-1] ; console tty (parent) 1395 <1> ; 18/09/2015 1396 <1> ;;mov [esi+p.ttyc-1], al ; set child's console tty 1397 <1> ;;mov [esi+p.waitc-1], ah ; 0 ; reset child's wait channel 1398 <1> ;mov [esi+p.ttyc-1], ax ; al - set child's console tty 1399 <1> ; ah - reset child's wait channel 1400 <1> ; 23/07/2022 1401 0000CE5D 8886[7F8D0100] <1> mov [esi+p.ttyc-1], al ; set child's console tty 1402 0000CE63 89F0 <1> mov eax, esi 1403 0000CE65 A2[BD8E0100] <1> mov [u.uno], al ; child process number 1404 <1> ;movb r1,u.uno / set child process number to r1 1405 0000CE6A FE86[9F8D0100] <1> inc byte [esi+p.stat-1] ; 1, SRUN, 05/02/2014 1406 <1> ; incb p.stat-1(r1) / set p.stat entry for child 1407 <1> ; / process to active status 1408 <1> ; mov u.ttyp,r2 / put pointer to parent process' 1409 <1> ; / control tty buffer in r2 1410 <1> ; beq 2f / branch, if no such tty assigned 1411 <1> ; clrb 6(r2) / clear interrupt character in tty buffer 1412 <1> ; 2: 1413 0000CE70 53 <1> push ebx ; * return address for the child process 1414 <1> ; * Retro UNIX 8086 v1 feature only ! 1415 <1> ; (Retro UNIX 8086 v1 modification!) 1416 <1> ; mov $runq+4,r2 1417 0000CE71 BB[5C8E0100] <1> mov ebx, runq+2 ; normal run queue ; 02/01/2017 1418 0000CE76 E8CC3B0000 <1> call putlu 1419 <1> ; jsr r0,putlu / put child process on lowest priority 1420 <1> ; / run queue 1421 <1> ; 23/07/2022 1422 0000CE7B D1E6 <1> shl esi, 1 1423 <1> ;shl si, 1 1424 <1> ; asl r1 / multiply r1 by 2 to get index 1425 <1> ; / into p.pid table 1426 0000CE7D 66FF05[548E0100] <1> inc word [mpid] 1427 <1> ; inc mpid / increment m.pid; get a new process name 1428 0000CE84 66A1[548E0100] <1> mov ax, [mpid] 1429 0000CE8A 668986[3E8D0100] <1> mov [esi+p.pid-2], ax 1430 <1> ;mov mpid,p.pid-2(r1) / put new process name 1431 <1> ; / in child process' name slot 1432 0000CE91 5A <1> pop edx ; * return address for the child process 1433 <1> ; * Retro UNIX 8086 v1 feature only ! 1434 0000CE92 5B <1> pop ebx ; ** 1435 <1> ;mov ebx, [esp] ; ** parent process number 1436 <1> ; movb (sp),r2 / put parent process number in r2 1437 <1> ; 23/07/2022 1438 0000CE93 D1E3 <1> shl ebx, 1 1439 <1> ;shl bx, 1 1440 <1> ;asl r2 / multiply by 2 to get index into below tables 1441 <1> ;movzx eax, word [ebx+p.pid-2] 1442 0000CE95 668B83[3E8D0100] <1> mov ax, [ebx+p.pid-2] 1443 <1> ; mov p.pid-2(r2),r2 / get process name of parent 1444 <1> ; / process 1445 0000CE9C 668986[5E8D0100] <1> mov [esi+p.ppid-2], ax 1446 <1> ; mov r2,p.ppid-2(r1) / put parent process name 1447 <1> ; / in parent process slot for child 1448 0000CEA3 A3[6C8E0100] <1> mov [u.r0], eax 1449 <1> ; mov r2,*u.r0 / put parent process name on stack 1450 <1> ; / at location where r0 was saved 1451 0000CEA8 8B2D[648E0100] <1> mov ebp, [u.sp] ; points to return address (EIP for IRET) 1452 0000CEAE 895500 <1> mov [ebp], edx ; *, CS:EIP -> EIP 1453 <1> ; * return address for the child process 1454 <1> ; mov $sysret1,-(sp) / 1455 <1> ; mov sp,u.usp / contents of sp at the time when 1456 <1> ; / user is swapped out 1457 <1> ; mov $sstack,sp / point sp to swapping stack space 1458 <1> ; 04/09/2015 - 01/09/2015 1459 <1> ; [u.usp] = esp 1460 0000CEB1 68[8ECA0000] <1> push sysret ; *** 1461 0000CEB6 8925[688E0100] <1> mov [u.usp], esp ; points to 'sysret' address (***) 1462 <1> ; (for child process) 1463 0000CEBC 31C0 <1> xor eax, eax 1464 0000CEBE 66A3[A08E0100] <1> mov [u.ttyp], ax ; 0 1465 <1> ; 1466 0000CEC4 E80E3B0000 <1> call wswap ; Retro UNIX 8086 v1 modification ! 1467 <1> ; jsr r0,wswap / put child process out on drum 1468 <1> ; jsr r0,unpack / unpack user stack 1469 <1> ; mov u.usp,sp / restore user stack pointer 1470 <1> ; tst (sp)+ / bump stack pointer 1471 <1> ; Retro UNIX 386 v1 modification ! 1472 0000CEC9 58 <1> pop eax ; *** 1473 <1> ;shl bx, 1 1474 <1> ; 23/07/2022 1475 0000CECA D1E3 <1> shl ebx, 1 1476 0000CECC 8B83[AC8D0100] <1> mov eax, [ebx+p.upage-4] ; UPAGE address ; 14/05/2015 1477 0000CED2 E8383B0000 <1> call rswap ; restore parent process 'u' structure, 1478 <1> ; registers and return address (for IRET) 1479 <1> ;movb (sp)+,u.uno / put parent process number in u.uno 1480 0000CED7 0FB705[548E0100] <1> movzx eax, word [mpid] 1481 0000CEDE A3[6C8E0100] <1> mov [u.r0], eax 1482 <1> ; mov mpid,*u.r0 / put child process name on stack 1483 <1> ; / where r0 was saved 1484 <1> ; add $2,18.(sp) / add 2 to pc on stack; gives parent 1485 <1> ; / process return 1486 <1> ;xor ebx, ebx 1487 0000CEE3 31F6 <1> xor esi, esi 1488 <1> ;clr r1 1489 <1> sysfork_4: ; 1: / search u.fp list to find the files 1490 <1> ; / opened by the parent process 1491 <1> ; 01/09/2015 1492 <1> ;xor bh, bh 1493 <1> ;mov bl, [esi+u.fp] 1494 0000CEE5 8A86[768E0100] <1> mov al, [esi+u.fp] 1495 <1> ; movb u.fp(r1),r2 / get an open file for this process 1496 <1> ;or bl, bl 1497 0000CEEB 08C0 <1> or al, al 1498 0000CEED 7406 <1> jz short sysfork_5 1499 <1> ; beq 2f / file has not been opened by parent, 1500 <1> ; / so branch 1501 <1> ;mov ah, 10 ; Retro UNIX 386 v1 fsp structure size = 10 bytes 1502 <1> ;mul ah 1503 <1> ; 23/07/2022 1504 <1> ; Retro UNIX 386 v2 & TRDOS 386 v2.0.5 fsp struc size = 16 bytes 1505 <1> ;mov ebx, eax 1506 <1> ;shl ebx, 4 ; * 16 1507 <1> ;inc byte [ebx+fsp-10] 1508 <1> 1509 <1> ; 23/07/2022 (BugFix) 1510 0000CEEF FE80[58840100] <1> inc byte [OF_OPENCOUNT+eax] 1511 <1> 1512 <1> ;;movzx ebx, ax 1513 <1> ;mov bx, ax 1514 <1> ;shl bx, 3 1515 <1> ; asl r2 / multiply by 8 1516 <1> ; asl r2 / to get index into fsp table 1517 <1> ; asl r2 1518 <1> ;inc byte [ebx+fsp-2] 1519 <1> ; incb fsp-2(r2) / increment number of processes 1520 <1> ; / using file, because child will now be 1521 <1> ; / using this file 1522 <1> sysfork_5: ; 2: 1523 0000CEF5 46 <1> inc esi 1524 <1> ; inc r1 / get next open file 1525 <1> ; 23/07/2022 1526 0000CEF6 6683FE20 <1> cmp si, OPENFILES ; = 10 1527 <1> ;cmp si, 10 1528 <1> ; cmp r1,$10. / 10. files is the maximum number which 1529 <1> ; / can be opened 1530 0000CEFA 72E9 <1> jb short sysfork_4 1531 <1> ; blt 1b / check next entry 1532 0000CEFC E98DFBFFFF <1> jmp sysret 1533 <1> ; br sysret1 1534 <1> 1535 <1> syscreat: ; < create file > 1536 <1> ; 29/08/2024 1537 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 1538 <1> ; 08/08/2022 1539 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 1540 <1> ; 13/11/2017 1541 <1> ; 27/10/2016 1542 <1> ; 25/10/2016 - 26/10/2016 1543 <1> ; 15/10/2016 - 16/10/2016 - 17/10/2016 1544 <1> ; 10/10/2016 (TRDOS 386 = TRDOS v2.0) 1545 <1> ; -derived from INT_21H.ASM- 1546 <1> ; ("loc_INT21h_create_file") 1547 <1> ; 10/07/2011 (12/03/2011) 1548 <1> ; INT 21h Function AH = 3Ch 1549 <1> ; Create File 1550 <1> ; INPUT 1551 <1> ; CX = Attributes 1552 <1> ; DS:DX= Address of zero terminaned path name 1553 <1> ; 1554 <1> ; 27/12/2015 (Retro UNIX 386 v1.1) 1555 <1> ; 14/05/2015 (Retro UNIX 386 v1 - Beginning) 1556 <1> ; 27/05/2013 (Retro UNIX 8086 v1) 1557 <1> ; 1558 <1> ; 'syscreat' called with two arguments; name and mode. 1559 <1> ; u.namep points to name of the file and mode is put 1560 <1> ; on the stack. 'namei' is called to get i-number of the file. 1561 <1> ; If the file aready exists, it's mode and owner remain 1562 <1> ; unchanged, but it is truncated to zero length. If the file 1563 <1> ; did not exist, an i-node is created with the new mode via 1564 <1> ; 'maknod' whether or not the file already existed, it is 1565 <1> ; open for writing. The fsp table is then searched for a free 1566 <1> ; entry. When a free entry is found, proper data is placed 1567 <1> ; in it and the number of this entry is put in the u.fp list. 1568 <1> ; The index to the u.fp (also know as the file descriptor) 1569 <1> ; is put in the user's r0. 1570 <1> ; 1571 <1> ; Calling sequence: 1572 <1> ; syscreate; name; mode 1573 <1> ; Arguments: 1574 <1> ; name - name of the file to be created 1575 <1> ; mode - mode of the file to be created 1576 <1> ; Inputs: (arguments) 1577 <1> ; Outputs: *u.r0 - index to u.fp list 1578 <1> ; (the file descriptor of new file) 1579 <1> ; ............................................................... 1580 <1> ; 1581 <1> ; Retro UNIX 8086 v1 modification: 1582 <1> ; 'syscreate' system call has two arguments; so, 1583 <1> ; * 1st argument, name is pointed to by BX register 1584 <1> ; * 2nd argument, mode is in CX register 1585 <1> ; 1586 <1> ; AX register (will be restored via 'u.r0') will return 1587 <1> ; to the user with the file descriptor/number 1588 <1> ; (index to u.fp list). 1589 <1> ; 1590 <1> ;call arg2 1591 <1> ; * name - 'u.namep' points to address of file/path name 1592 <1> ; in the user's program segment ('u.segmnt') 1593 <1> ; with offset in BX register (as sysopen argument 1). 1594 <1> ; * mode - sysopen argument 2 is in CX register 1595 <1> ; which is on top of stack. 1596 <1> ; 1597 <1> ; TRDOS 386 (10/10/2016) 1598 <1> ; 1599 <1> ; INPUT -> 1600 <1> ; CL = File Attributes 1601 <1> ; bit 0 (1) - Read only file (R) 1602 <1> ; bit 1 (1) - Hidden file (H) 1603 <1> ; bit 2 (1) - System file (R) 1604 <1> ; bit 3 (1) - Volume label/name (V) 1605 <1> ; bit 4 (1) - Subdirectory (D) 1606 <1> ; bit 5 (1) - File has been archived (A) 1607 <1> ; EBX = Pointer to filename (ASCIIZ) -path- 1608 <1> ; 1609 <1> ; OUTPUT -> 1610 <1> ; eax = File/Device Handle/Number (index) (AL) 1611 <1> ; cf = 1 -> Error code in AL 1612 <1> ; 1613 <1> ; Modified Registers: EAX (at the return of system call) 1614 <1> ; 1615 <1> ; Note: If the file is existing and it has not any one 1616 <1> ; of S,H,R,V,D attributes, it will be truncated 1617 <1> ; to zero length; otherwise, access error will be 1618 <1> ; returned. 1619 <1> 1620 <1> sysmkdir_0: 1621 0000CF01 F6C108 <1> test cl, 08h ; Volume name 1622 0000CF04 740A <1> jz short syscreat_0 1623 <1> 1624 <1> ; Volume name or long name creation 1625 <1> ; is not permitted (in TRDOS 386)! 1626 0000CF06 B80B000000 <1> mov eax, ERR_FILE_ACCESS ; 11 ; 'permission denied !' 1627 0000CF0B E9D8000000 <1> jmp sysopen_dev_err ; 08/08/2022 1628 <1> syscreat_0: 1629 <1> ;mov [u.namep], ebx 1630 0000CF10 51 <1> push ecx 1631 0000CF11 89DE <1> mov esi, ebx 1632 <1> ; file name is forced, change directory as temporary 1633 <1> ;mov ax, 1 1634 <1> ;mov [FFF_Valid], ah ; 0 ; reset ; 17/10/2016 1635 <1> ;call set_working_path 1636 0000CF13 E8BD4D0000 <1> call set_working_path_x ; 17/10/2016 1637 <1> ;jc short syscreat_err 1638 <1> ; 23/07/2022 1639 0000CF18 7305 <1> jnc short syscreat_3 1640 0000CF1A E9E2000000 <1> jmp syscreat_err 1641 <1> 1642 <1> syscreat_3: 1643 <1> ; 16/10/2016 1644 0000CF1F 803D[6F830100]00 <1> cmp byte [SWP_inv_fname], 0 1645 0000CF26 7776 <1> ja short syscreat_inv_fname ; invalid file name ! 1646 <1> 1647 <1> ; Here, we have a valid path and also a valid file name 1648 <1> ; (Working dir has been changed if the path 1649 <1> ; -file name string- had contained a dir name.) 1650 <1> 1651 <1> ;xor ax, ax 1652 <1> ; 25/08/2024 1653 0000CF28 31C0 <1> xor eax, eax 1654 <1> ;mov esi, FindFile_Name 1655 0000CF2A E84BBAFFFF <1> call find_first_file 1656 0000CF2F 59 <1> pop ecx 1657 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 1658 <1> ; EDI = Directory Buffer Directory Entry Location 1659 <1> ; EAX = File Size 1660 <1> ; BL = Attributes of The File/Directory 1661 <1> ; BH = Long Name Yes/No Status (>0 is YES) 1662 <1> ; DX > 0 : Ambiguous filename chars are used 1663 0000CF30 7274 <1> jc short syscreat_1 ; file not found (the good!) 1664 <1> ; or another error (the bad!) 1665 <1> 1666 <1> ; (& the uggly!) truncate file to zero length before open 1667 <1> 1668 <1> ;'*' and '?' already checked at 'set_working_path' stage 1669 <1> ;and dx, dx 1670 <1> ;jnz short sysmkdir_err ; permission denied 1671 <1> ; invalid filename chars 1672 <1> 1673 <1> ;test cl, 10h ; subdirectory ? 1674 <1> ;jnz short sysmkdir_err 1675 <1> 1676 <1> ; BL = File Attributes: 1677 <1> ; bit 0 (1) - Read only file (R) 1678 <1> ; bit 1 (1) - Hidden file (H) 1679 <1> ; bit 2 (1) - System file (R) 1680 <1> ; bit 3 (1) - Volume label/name (V) 1681 <1> ; bit 4 (1) - Subdirectory (D) 1682 <1> ; bit 5 (1) - File has been archived 1683 <1> 1684 <1> ; * existing directory must not be truncated 1685 <1> ; (we don't know it is empty or not, at this stage) 1686 <1> ; * existing volume name (or a long name) can not be 1687 <1> ; re-created or truncated by 'syscreat' 1688 <1> ; * A file with S, H, R attributes must not be truncated 1689 <1> ; (change attributes to normal, if you need truncate it) 1690 <1> 1691 0000CF32 F6C31F <1> test bl, 00011111b ; check attributes of existing file 1692 0000CF35 7559 <1> jnz short sysmkdir_err 1693 <1> 1694 <1> ;; normal file, OK to continue... 1695 <1> 1696 <1> ; ESI = FindFile_DirEntry 1697 0000CF37 668B4614 <1> mov ax, [esi+DirEntry_FstClusHI] ; 20 1698 0000CF3B C1E010 <1> shl eax, 16 ; 13/11/2017 1699 0000CF3E 668B461A <1> mov ax, [esi+DirEntry_FstClusLO] ; 26 1700 <1> 1701 <1> ; 24/08/2024 1702 0000CF42 21C0 <1> and eax, eax 1703 0000CF44 7426 <1> jz short skip_truncate ; first cluster is 0 ! 1704 <1> 1705 <1> ; EAX = First cluster to be truncated/unlinked 1706 0000CF46 57 <1> push edi 1707 0000CF47 51 <1> push ecx 1708 0000CF48 BE00010900 <1> mov esi, Logical_DOSDisks 1709 0000CF4D 29C9 <1> sub ecx, ecx 1710 <1> ;mov ch, [Current_Drv] ; = [FindFile_Drv] 1711 <1> ; 03/09/2024 1712 0000CF4F 8A2D[16800100] <1> mov ch, [FindFile_Drv] 1713 0000CF55 01CE <1> add esi, ecx 1714 <1> ; ESI = Logical dos drive description table address 1715 0000CF57 E8C2F7FFFF <1> call truncate_cluster_chain 1716 0000CF5C 59 <1> pop ecx 1717 0000CF5D 5F <1> pop edi 1718 0000CF5E 7237 <1> jc short syscreate_truncate_err 1719 <1> 1720 <1> ; 03/09/2024 1721 0000CF60 66C747140000 <1> mov word [edi+DirEntry_FstClusHI], 0 1722 0000CF66 66C7471A0000 <1> mov word [edi+DirEntry_FstClusLO], 0 1723 <1> 1724 <1> ; 24/08/2024 1725 <1> skip_truncate: 1726 <1> ; 26/10/2016 1727 <1> ; EDI = Directory entry address in directory buffer 1728 <1> ; Update directory entry 1729 0000CF6C E88BDDFFFF <1> call convert_current_date_time 1730 <1> ; OUTPUT -> DX = Date in dos dir entry format 1731 <1> ; AX = Time in dos dir entry format 1732 0000CF71 66894716 <1> mov [edi+DirEntry_WrtTime], ax 1733 0000CF75 66895718 <1> mov [edi+DirEntry_WrtDate], dx 1734 0000CF79 66895712 <1> mov [edi+DirEntry_LastAccDate], dx 1735 0000CF7D 31C0 <1> xor eax, eax ; file size = 0 1736 0000CF7F 89471C <1> mov [edi+DirEntry_FileSize], eax ; 0 1737 0000CF82 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 ; data changed sign 1738 <1> ;mov esi, FindFile_DirEntry 1739 <1> ; 03/09/2024 1740 0000CF89 B201 <1> mov dl, 1 ; open file for writing 1741 0000CF8B E9AB000000 <1> jmp sysopen_2 ; 08/08/2022 1742 <1> 1743 <1> sysmkdir_err: 1744 <1> ; 1 = write, 2 = read & write, >2 = invalid 1745 0000CF90 B80B000000 <1> mov eax, ERR_FILE_ACCESS ; 11 ; 'permission denied !' 1746 0000CF95 EB74 <1> jmp short sysopen_err 1747 <1> 1748 <1> syscreate_truncate_err: 1749 0000CF97 B812000000 <1> mov eax, ERR_DRV_WRITE ; 18 ; 'disk write error !' 1750 0000CF9C EB6D <1> jmp short sysopen_err 1751 <1> 1752 <1> syscreat_inv_fname: ; invalid file name chars 1753 <1> ; 16/10/2016 1754 0000CF9E B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; 26 ; invalid file name chars 1755 0000CFA3 59 <1> pop ecx 1756 0000CFA4 EB65 <1> jmp short sysopen_err 1757 <1> 1758 <1> syscreat_1: 1759 <1> ; Error code in EAX 1760 0000CFA6 3C02 <1> cmp al, 02h ; 'File not found' error 1761 0000CFA8 7561 <1> jne short sysopen_err 1762 <1> 1763 0000CFAA F6C110 <1> test cl, 10h ; Directory 1764 <1> ;jnz sysmkdir_2 1765 <1> ; 23/07/2022 1766 0000CFAD 7405 <1> jz short syscreat_2 1767 0000CFAF E9C3010000 <1> jmp sysmkdir_2 1768 <1> 1769 <1> syscreat_2: 1770 0000CFB4 BE[58800100] <1> mov esi, FindFile_Name 1771 <1> ;xor edx, edx 1772 0000CFB9 31C0 <1> xor eax, eax ; File Size = 0 1773 0000CFBB 31DB <1> xor ebx, ebx 1774 0000CFBD 4B <1> dec ebx ; FFFFFFFFh -> create empty file 1775 <1> ; (only for FAT fs) 1776 <1> ; CL = File Attributes 1777 0000CFBE E8B0ECFFFF <1> call create_file 1778 0000CFC3 7246 <1> jc short sysopen_err 1779 <1> ; EAX = New file's first cluster 1780 <1> ; ESI = Logical Dos Drv Descr. Table Addr. 1781 <1> ; EBX = offset CreateFile_Size 1782 <1> ; ECX = Sectors per cluster (<256) 1783 <1> ; EDX = Directory entry index/number (<65536) 1784 <1> ; 29/08/2024 1785 <1> ; EBX = File Size (0 for a new, empty file) 1786 <1> ; ECX = Directory Entry Index/Number (<2048) 1787 <1> ; (in directory cluster, not in directory) 1788 <1> ; EDX = Directory Cluster Number (of the file) 1789 <1> 1790 <1> ; 26/10/2016 1791 <1> ;mov esi, Directory_Buffer 1792 <1> ;shl dx, 5 ; *32 1793 <1> ;add esi, edx 1794 <1> ;; esi = directory entry address in directory buffer 1795 <1> 1796 <1> ; Here, directory entry has been created but last 1797 <1> ; modification date & time of the parent dir has not 1798 <1> ; been updated, yet! 1799 <1> ; (Note: Directory and FAT buffers have been updated...) 1800 <1> 1801 0000CFC5 E850DEFFFF <1> call update_parent_dir_lmdt ; now, it is OK too! 1802 <1> 1803 <1> ; 25/10/2016 1804 0000CFCA 66B80018 <1> mov ax, 1800h 1805 0000CFCE BE[58800100] <1> mov esi, FindFile_Name 1806 0000CFD3 E8A2B9FFFF <1> call find_first_file 1807 0000CFD8 7231 <1> jc short sysopen_err 1808 <1> 1809 <1> ; Only possible error after here is 1810 <1> ; "too many open files !" error. 1811 <1> ; 1812 <1> ; If "syscreat" will return with that error, 1813 <1> ; (the file has been created but it could not be opened) 1814 <1> ; the user must retry to open this file again 1815 <1> ; or must close another file before using 1816 <1> ; "sysopen" system call. 1817 <1> 1818 0000CFDA B201 <1> mov dl, 1 ; open file for writing 1819 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 1820 <1> ; EAX = File Size (= 0) 1821 0000CFDC EB5D <1> jmp short sysopen_2 1822 <1> 1823 <1> sysopen: ; 1824 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 1825 <1> ; 03/09/2024 1826 <1> ; 19/08/2024 - TRDOS 386 v2.0.9 1827 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 1828 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 1829 <1> ; (temporary modifications) 1830 <1> ; 26/10/2016 1831 <1> ; 24/10/2016 1832 <1> ; 17/10/2016 1833 <1> ; 15/10/2016 1834 <1> ; 06/10/2016, 07/10/2016, 08/10/2016 1835 <1> ; 05/10/2016 (TRDOS 386 = TRDOS v2.0) 1836 <1> ; -derived from INT_21H.ASM- 1837 <1> ; ("loc_INT21h_open_file") 1838 <1> ; 26/02/2011 1839 <1> ; INT 21h Function AH = 3Dh 1840 <1> ; Open File 1841 <1> ; INPUT 1842 <1> ; AL= File Access Value 1843 <1> ; 0- Open for reading 1844 <1> ; 1- Open for writing 1845 <1> ; 2- Open for reading and writing 1846 <1> ; DS:DX= Pointer to filename (ASCIIZ) 1847 <1> ; 1848 <1> ; 14/05/2015 (Retro UNIX 386 v1 - Beginning) 1849 <1> ; 22/05/2013 - 27/05/2013 (Retro UNIX 8086 v1) 1850 <1> ; 1851 <1> ; 'sysopen' opens a file in following manner: 1852 <1> ; 1) The second argument in a sysopen says whether to 1853 <1> ; open the file ro read (0) or write (>0). 1854 <1> ; 2) I-node of the particular file is obtained via 'namei'. 1855 <1> ; 3) The file is opened by 'iopen'. 1856 <1> ; 4) Next housekeeping is performed on the fsp table 1857 <1> ; and the user's open file list - u.fp. 1858 <1> ; a) u.fp and fsp are scanned for the next available slot. 1859 <1> ; b) An entry for the file is created in the fsp table. 1860 <1> ; c) The number of this entry is put on u.fp list. 1861 <1> ; d) The file descriptor index to u.fp list is pointed 1862 <1> ; to by u.r0. 1863 <1> ; 1864 <1> ; Calling sequence: 1865 <1> ; sysopen; name; mode 1866 <1> ; Arguments: 1867 <1> ; name - file name or path name 1868 <1> ; mode - 0 to open for reading 1869 <1> ; 1 to open for writing 1870 <1> ; Inputs: (arguments) 1871 <1> ; Outputs: *u.r0 - index to u.fp list (the file descriptor) 1872 <1> ; is put into r0's location on the stack. 1873 <1> ; ............................................................... 1874 <1> ; 1875 <1> ; Retro UNIX 8086 v1 modification: 1876 <1> ; 'sysopen' system call has two arguments; so, 1877 <1> ; * 1st argument, name is pointed to by BX register 1878 <1> ; * 2nd argument, mode is in CX register 1879 <1> ; 1880 <1> ; AX register (will be restored via 'u.r0') will return 1881 <1> ; to the user with the file descriptor/number 1882 <1> ; (index to u.fp list). 1883 <1> ; 1884 <1> ;call arg2 1885 <1> ; * name - 'u.namep' points to address of file/path name 1886 <1> ; in the user's program segment ('u.segmnt') 1887 <1> ; with offset in BX register (as sysopen argument 1). 1888 <1> ; * mode - sysopen argument 2 is in CX register 1889 <1> ; which is on top of stack. 1890 <1> ; 1891 <1> ; jsr r0,arg2 / get sys args into u.namep and on stack 1892 <1> ; 1893 <1> ; system call registers: ebx, ecx (through 'sysenter') 1894 <1> ; 1895 <1> ; TRDOS 386 (05/10/2016) 1896 <1> ; 1897 <1> ; INPUT -> 1898 <1> ; CL = File Access Value (Open Mode) 1899 <1> ; 0 - Open file for reading 1900 <1> ; 1 - Open file for writing 1901 <1> ; 2 - Open device for reading 1902 <1> ; 3 - Open device for writing 1903 <1> ; EBX = Pointer to filename/devicename (ASCIIZ) 1904 <1> ; OUTPUT -> 1905 <1> ; eax = File/Device Handle/Number (index) (AL) 1906 <1> ; cf = 1 -> Error code in AL 1907 <1> ; 1908 <1> ; Modified Registers: EAX (at the return of system call) 1909 <1> ; 1910 <1> 1911 0000CFDE 80F901 <1> cmp cl, 1 ; read file (0), write file (1) 1912 0000CFE1 7614 <1> jna short sysopen_0 1913 <1> 1914 <1> ; 17/04/2021 (temporary) 1915 <1> ;cmp cl, 3 1916 <1> ;jna sysopen_device 1917 <1> 1918 <1> ; Invalid access code 1919 0000CFE3 B817000000 <1> mov eax, ERR_INV_PARAMETER 1920 <1> ;jmp sysopen_dev_err 1921 <1> 1922 <1> sysopen_dev_err: 1923 0000CFE8 A3[6C8E0100] <1> mov [u.r0], eax 1924 0000CFED A3[D88E0100] <1> mov [u.error], eax 1925 0000CFF2 E977FAFFFF <1> jmp error 1926 <1> 1927 <1> sysopen_0: 1928 <1> ;mov [u.namep], ebx 1929 0000CFF7 51 <1> push ecx 1930 0000CFF8 89DE <1> mov esi, ebx 1931 <1> ; file name is forced, change directory as temporary 1932 <1> ;mov ax, 1 1933 <1> ;mov [FFF_Valid], ah ; 0 ; reset ; 17/10/2016 1934 <1> ;call set_working_path 1935 0000CFFA E8D64C0000 <1> call set_working_path_x ; 17/10/2016 1936 0000CFFF 731E <1> jnc short sysopen_1 1937 <1> 1938 <1> syscreat_err: ; ecx = file attributes (for 'syscreat') 1939 0000D001 59 <1> pop ecx ; open mode 1940 0000D002 21C0 <1> and eax, eax ; 0 -> Bad Path! 1941 0000D004 7505 <1> jnz short sysopen_err 1942 <1> ; eax = 0 1943 0000D006 B80C000000 <1> mov eax, ERR_DIR_NOT_FOUND ; Directory not found ! 1944 <1> sysopen_err: 1945 0000D00B A3[6C8E0100] <1> mov [u.r0], eax 1946 0000D010 A3[D88E0100] <1> mov [u.error], eax 1947 0000D015 E8904D0000 <1> call reset_working_path 1948 0000D01A E94FFAFFFF <1> jmp error 1949 <1> 1950 <1> sysopen_1: 1951 <1> ;mov esi, FindFile_Name 1952 0000D01F 66B80018 <1> mov ax, 1800h ; Only files 1953 0000D023 E852B9FFFF <1> call find_first_file 1954 0000D028 5A <1> pop edx 1955 0000D029 72E0 <1> jc short sysopen_err ; eax = 2 (File not found !) 1956 <1> 1957 <1> ; check_open_file_attr_access_code 1958 <1> 1959 0000D02B F6C307 <1> test bl, 7 ; system, hidden, readonly 1960 0000D02E 740B <1> jz short sysopen_2 1961 <1> 1962 0000D030 20D2 <1> and dl, dl ; 0 = read mode 1963 0000D032 7407 <1> jz short sysopen_2 1964 <1> 1965 <1> sysopen_access_err: 1966 <1> ; 1 = write, 2 = read & write, >2 = invalid 1967 0000D034 B80B000000 <1> mov eax, ERR_FILE_ACCESS ; 11 = 'permission denied !' 1968 0000D039 EBD0 <1> jmp short sysopen_err 1969 <1> 1970 <1> sysopen_2: 1971 <1> ; esi = Directory Entry (FindFile_DirEntry) Location 1972 <1> ;mov ebx, esi 1973 <1> ; 03/09/2024 1974 0000D03B 89FB <1> mov ebx, edi ; Directory entry in directory buffer 1975 0000D03D 31F6 <1> xor esi, esi ; 0 1976 0000D03F 31FF <1> xor edi, edi ; 0 1977 <1> sysopen_3: ; scan the list of entries in fsp table 1978 0000D041 80BE[768E0100]00 <1> cmp byte [esi+u.fp], 0 1979 0000D048 760E <1> jna short sysopen_4 ; empty slot 1980 <1> ;inc si 1981 <1> ; 19/08/2024 1982 0000D04A 46 <1> inc esi 1983 0000D04B 6683FE0A <1> cmp si, 10 1984 0000D04F 72F0 <1> jb short sysopen_3 1985 <1> toomanyf: 1986 0000D051 B80D000000 <1> mov eax, ERR_TOO_MANY_FILES ; too many open files ! 1987 0000D056 EBB3 <1> jmp short sysopen_err 1988 <1> 1989 <1> sysopen_4: 1990 0000D058 80BF[18840100]00 <1> cmp byte [edi+OF_MODE], 0 ; Scan open files table 1991 0000D05F 7609 <1> jna short sysopen_5 1992 <1> 1993 <1> ;inc di 1994 <1> ; 19/08/2024 1995 0000D061 47 <1> inc edi 1996 0000D062 6683FF20 <1> cmp di, OPENFILES ; max. number of open files (sytem) 1997 0000D066 72F0 <1> jb short sysopen_4 1998 0000D068 EBE7 <1> jmp short toomanyf 1999 <1> 2000 <1> sysopen_5: 2001 <1> ; 19/08/2024 2002 <1> ;;; 2003 0000D06A 50 <1> push eax ; size 2004 0000D06B 668B4314 <1> mov ax, [ebx+DirEntry_FstClusHI] 2005 0000D06F C1E010 <1> shl eax, 16 2006 0000D072 668B431A <1> mov ax, [ebx+DirEntry_FstClusLO] 2007 0000D076 5B <1> pop ebx ; size 2008 <1> ; eax = First Cluster 2009 <1> ; ebx = File Size 2010 0000D077 80FA01 <1> cmp dl, 1 ; is open mode = open for write ? 2011 0000D07A 7535 <1> jne short sysopen_8 2012 <1> ; check if the file is already open for write 2013 0000D07C 57 <1> push edi 2014 0000D07D 29FF <1> sub edi, edi 2015 0000D07F 8A15[16800100] <1> mov dl, [FindFile_Drv] 2016 <1> sysopen_5_@: 2017 0000D085 80BF[18840100]02 <1> cmp byte [edi+OF_MODE], 2 ; open for write 2018 0000D08C 7519 <1> jne short sysopen_5_@@@ 2019 0000D08E 3A97[F8830100] <1> cmp dl, [edi+OF_DRIVE] 2020 0000D094 7511 <1> jne short sysopen_5_@@@ 2021 0000D096 C1E702 <1> shl edi, 2 2022 0000D099 3B87[78830100] <1> cmp eax, [edi+OF_FCLUSTER] 2023 0000D09F 7503 <1> jne short sysopen_5_@@ 2024 0000D0A1 5F <1> pop edi 2025 0000D0A2 EB90 <1> jmp short sysopen_access_err 2026 <1> sysopen_5_@@: 2027 0000D0A4 C1EF02 <1> shr edi, 2 2028 <1> ;;; 2029 <1> sysopen_5_@@@: 2030 0000D0A7 47 <1> inc edi 2031 0000D0A8 6683FF20 <1> cmp di, OPENFILES 2032 0000D0AC 72D7 <1> jb short sysopen_5_@ 2033 0000D0AE 5F <1> pop edi 2034 0000D0AF B201 <1> mov dl, 1 ; open for write 2035 <1> sysopen_8: 2036 0000D0B1 FEC2 <1> inc dl 2037 0000D0B3 8897[18840100] <1> mov [edi+OF_MODE], dl 2038 0000D0B9 8A15[16800100] <1> mov dl, [FindFile_Drv] 2039 0000D0BF 8897[F8830100] <1> mov [edi+OF_DRIVE], dl ; Logical DOS drive number 2040 <1> ;shl di, 2 ; *4 (dword offset) 2041 <1> ; 23/07/2022 2042 0000D0C5 C1E702 <1> shl edi, 2 2043 <1> 2044 <1> ; 19/08/2024 2045 <1> ;mov [edi+OF_SIZE], eax ; File size in bytes 2046 0000D0C8 899F[F8840100] <1> mov [edi+OF_SIZE], ebx ; File size in bytes 2047 <1> 2048 <1> ; 19/08/2024 2049 <1> ; eax = Fist Cluster 2050 <1> ;mov ax, [ebx+DirEntry_FstClusHI] 2051 <1> ;shl eax, 16 2052 <1> ;mov ax, [ebx+DirEntry_FstClusLO] 2053 <1> 2054 0000D0CE 8987[78830100] <1> mov [edi+OF_FCLUSTER], eax ; First cluster 2055 0000D0D4 8987[F8860100] <1> mov [edi+OF_CCLUSTER], eax ; Current cluster 2056 <1> 2057 0000D0DA 31DB <1> xor ebx, ebx 2058 0000D0DC 899F[78840100] <1> mov [edi+OF_POINTER], ebx ; offset pointer (0) 2059 0000D0E2 899F[78870100] <1> mov [edi+OF_CCINDEX], ebx ; cluster index (0) 2060 <1> 2061 0000D0E8 A1[88800100] <1> mov eax, [FindFile_DirFirstCluster] 2062 0000D0ED 8987[78850100] <1> mov [edi+OF_DIRFCLUSTER], eax 2063 <1> 2064 0000D0F3 A1[8C800100] <1> mov eax, [FindFile_DirCluster] 2065 0000D0F8 8987[F8850100] <1> mov [edi+OF_DIRCLUSTER], eax 2066 <1> 2067 <1> ; Get (& Save) Volume ID 2068 <1> ; Important for files of removable drives 2069 <1> ; (In order to check the drive has same volume/disk) 2070 0000D0FE 88D7 <1> mov bh, dl 2071 0000D100 81C300010900 <1> add ebx, Logical_DOSDisks 2072 <1> 2073 0000D106 8A4303 <1> mov al, [ebx+LD_FATType] 2074 <1> 2075 <1> ; 19/12/2025 2076 <1> %if 0 2077 <1> cmp al, 1 2078 <1> jb short sysopen_6_fs 2079 <1> %endif 2080 0000D109 3C02 <1> cmp al, 2 2081 0000D10B 7705 <1> ja short sysopen_6_fat32 2082 <1> sysopen_6_fat: 2083 0000D10D 8B432D <1> mov eax, [ebx+LD_BPB+VolumeID] 2084 0000D110 EB03 <1> jmp short sysopen_7 2085 <1> 2086 <1> ; 19/12/2025 2087 <1> %if 0 2088 <1> sysopen_6_fs: 2089 <1> mov eax, [ebx+LD_FS_VolumeSerial] 2090 <1> jmp short sysopen_7 2091 <1> %endif 2092 <1> 2093 <1> sysopen_6_fat32: 2094 0000D112 8B4349 <1> mov eax, [ebx+LD_BPB+FAT32_VolID] 2095 <1> sysopen_7: 2096 0000D115 A3[6C770100] <1> mov [Current_VolSerial], eax 2097 <1> 2098 0000D11A 8987[78860100] <1> mov [edi+OF_VOLUMEID], eax 2099 <1> 2100 <1> ; 24/10/2016 2101 <1> ;shr di, 1 ; 4/2, word offset 2102 <1> ; 23/07/2022 2103 0000D120 D1EF <1> shr edi, 1 2104 0000D122 668B1D[90800100] <1> mov bx, [FindFile_DirEntryNumber] 2105 0000D129 66899F[F8870100] <1> mov [edi+OF_DIRENTRY], bx 2106 <1> 2107 0000D130 31D2 <1> xor edx, edx 2108 <1> ;;shr di, 2 ; /4 (byte offset) 2109 <1> ;shr di, 1 ; 2/2, byte offset 2110 <1> ; 23/07/2022 2111 0000D132 D1EF <1> shr edi, 1 2112 0000D134 8897[58840100] <1> mov byte [edi+OF_OPENCOUNT], dl ; 0 2113 0000D13A 8897[38840100] <1> mov byte [edi+OF_STATUS], dl ; 0 2114 <1> 2115 0000D140 89FB <1> mov ebx, edi 2116 0000D142 FEC3 <1> inc bl 2117 <1> 2118 0000D144 889E[768E0100] <1> mov [esi+u.fp], bl ; Open File Entry Number 2119 0000D14A 8935[6C8E0100] <1> mov [u.r0], esi ; move index to u.fp list 2120 <1> ; into eax on stack 2121 <1> 2122 0000D150 E8554C0000 <1> call reset_working_path 2123 <1> 2124 0000D155 E934F9FFFF <1> jmp sysret 2125 <1> 2126 <1> 2127 <1> ; fsp table (original UNIX v1) 2128 <1> ; 2129 <1> ;Entry 2130 <1> ; 15 0 2131 <1> ; 1 |---|---------------------------------------| 2132 <1> ; |r/w| i-number of open file | 2133 <1> ; |---|---------------------------------------| 2134 <1> ; | device number | 2135 <1> ; |-------------------------------------------| 2136 <1> ; (*) | offset pointer, i.e., r/w pointer to file | 2137 <1> ; |-------------------------------------------| 2138 <1> ; | flag that says | number of processes | 2139 <1> ; | file deleted | that have file open | 2140 <1> ; |-------------------------------------------| 2141 <1> ; 2 | | 2142 <1> ; |-------------------------------------------| 2143 <1> ; | | 2144 <1> ; |-------------------------------------------| 2145 <1> ; | | 2146 <1> ; |-------------------------------------------| 2147 <1> ; | | 2148 <1> ; |-------------------------------------------| 2149 <1> ; 3 | | 2150 <1> ; | | 2151 <1> ; 2152 <1> ; (*) Retro UNIX 386 v1 modification: 32 bit offset pointer 2153 <1> 2154 <1> ; 27/03/2020 - Retro UNIX 386 v2 - FSP (OPEN FILES) TABLE 2155 <1> 2156 <1> ;Entry 2157 <1> ; 15 7 0 2158 <1> ; 1 |-------------------------------------------| 2159 <1> ; | i-number of open file | 2160 <1> ; |-------------------------------------------| 2161 <1> ; | high word of 32 bit i-number | 2162 <1> ; |-------------------------------------------| 2163 <1> ; | open mode & status | device number | 2164 <1> ; |-------------------------------------------| 2165 <1> ; | reserved byte | open count | 2166 <1> ; |-------------------------------------------| 2167 <1> ; | offset pointer, i.e., r/w pointer to file | 2168 <1> ; |-------------------------------------------| 2169 <1> ; | 64 bit file offset pointer (bit 16-31) | 2170 <1> ; |-------------------------------------------| 2171 <1> ; | 64 bit file offset pointer (bit 32-47) | 2172 <1> ; |-------------------------------------------| 2173 <1> ; | 64 bit file offset pointer (bit 48-63) | 2174 <1> ; |-------------------------------------------| 2175 <1> ; 2 | | 2176 <1> ; |-------------------------------------------| 2177 <1> ; | | 2178 <1> ; |-------------------------------------------| 2179 <1> ; | | 2180 <1> ; |-------------------------------------------| 2181 <1> ; | | 2182 <1> ; |-------------------------------------------| 2183 <1> ; | | 2184 <1> 2185 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 2186 <1> ; OPENFILES equ 10 (sysdefs.s) 2187 <1> ;; 06/10/2016 2188 <1> ;; Open File Parameters (trdoskx.s) 2189 <1> ;OF_FCLUSTER: resd OPENFILES ; First clusters of open files 2190 <1> ;OF_DRIVE: resb OPENFILES ; Logical DOS drive numbers of open files 2191 <1> ;OF_MODE: resb OPENFILES ; Open mode (1 = read, 2 = write, 3 = r&w) 2192 <1> ;OF_STATUS: resb OPENFILES ; (bit 0 = read, bit 1 = write) 2193 <1> ;OF_OPENCOUNT: resb OPENFILES ; Open counts of open files 2194 <1> ;OF_POINTER: resd OPENFILES ; File seek/read/write pointer 2195 <1> ;OF_SIZE: resd OPENFILES ; File sizes of open files (in bytes) 2196 <1> ;OF_DIRFCLUSTER: resd OPENFILES ; Directory First Clusters of open files 2197 <1> ;OF_DIRCLUSTER: resd OPENFILES ; Directory (Entry) Clusters of open files 2198 <1> ;OF_VOLUMEID: resd OPENFILES ; Vol ID for removable drives of open files 2199 <1> ;OF_CCLUSTER: resd OPENFILES ; Current clusters of open files 2200 <1> ;OF_CCINDEX: resd OPENFILES ; Cluster index numbers of current clusters 2201 <1> ;; 24/10/2016 2202 <1> ;OF_DIRENTRY: resw OPENFILES ; Directory entry index no. in dir cluster 2203 <1> 2204 <1> ; 17/04/2021 2205 <1> ; ('sysopen_device' procedure is disabled as temporary) 2206 <1> 2207 <1> ;sysopen_device: 2208 <1> ; ; 15/10/2016 2209 <1> ; ; 08/10/2016 2210 <1> ; ; 07/10/2016 (TRDOS 386 = TRDOS v2.0) 2211 <1> ; push ecx ; open mode 2212 <1> ; mov ebp, esp 2213 <1> ; mov ecx, 16 ; transfer length = 16 bytes 2214 <1> ; sub esp, ecx 2215 <1> ; mov edi, esp ; destination address 2216 <1> ; mov esi, ebx ; dev name in user's memory space 2217 <1> ; call transfer_from_user_buffer 2218 <1> ; jnc short sysopen_dev_0 2219 <1> ; ; eax = ERR_OUT_OF_MEMORY = 4 = ERR_MINOR_IM 2220 <1> ; pop ecx 2221 <1> ;sysopen_dev_err: 2222 <1> ; mov [u.r0], eax 2223 <1> ; mov [u.error], eax 2224 <1> ; jmp error 2225 <1> ;sysopen_dev_0: 2226 <1> ; mov esi, edi ; Device name addr (max. 16 bytes, ASCIIZ) 2227 <1> ; ; for example: "tty, TTY, /dev/tty" 2228 <1> ; call get_device_number 2229 <1> ; mov esp, ebp 2230 <1> ; pop ecx 2231 <1> ; jnc short sysopen_dev_1 2232 <1> ; mov eax, ERR_INV_DEV_NAME ; 24 ; 'invalid device name !' 2233 <1> ; jmp short sysopen_dev_err 2234 <1> ;sysopen_dev_1: 2235 <1> ; ; eax = Device Number (AL) 2236 <1> ; ; cl = Open mode (2 = device read, 3 = device write) 2237 <1> ; xor ebx, ebx ; 0 2238 <1> ;sysopen_dev_2: ; scan the list of entries 2239 <1> ; cmp [ebx+u.fp], bl ; 0 2240 <1> ; jna short sysopen_dev_3 ; empty slot 2241 <1> ; inc bl 2242 <1> ; cmp bl, 10 2243 <1> ; jb short sysopen_dev_2 2244 <1> ; ; 2245 <1> ; mov eax, ERR_TOO_MANY_FILES ; too many open files ! 2246 <1> ; jmp short sysopen_dev_err 2247 <1> ;sysopen_dev_3: 2248 <1> ; mov [u.r0], ebx ; File/Device index/handle/descriptor 2249 <1> ; ; eax = device number (entry offset) 2250 <1> ; mov ch, [eax+DEV_ACCESS] ; bit 0 = accessable by users 2251 <1> ; ; bit 1 = read access perm 2252 <1> ; ; bit 2 = write access perm 2253 <1> ; ; bit 3 = IOCTL permit to users 2254 <1> ; ; bit 4 = block device if set 2255 <1> ; ; bit 5 = 16 bit or 1024 byte 2256 <1> ; ; bit 6 = 32 bit or 2048 byte 2257 <1> ; ; bit 7 = installable device drv 2258 <1> ; test ch, 1 ; accessable by normal users (except root) 2259 <1> ; jnz short sysopen_dev_4 ; yes, permission has been given 2260 <1> ; cmp byte [u.uid], 0 ; root? 2261 <1> ; jna short sysopen_dev_4 ; superuser can open all devices 2262 <1> ;sysopen_dev_perm_err: 2263 <1> ; mov eax, ERR_DEV_ACCESS ; 11 = 'permission denied !' 2264 <1> ; jmp short sysopen_dev_err 2265 <1> ;sysopen_dev_4: 2266 <1> ; shr ch, 1 ; result: 1 = read, 2 = write, 3 = r & w 2267 <1> ; dec cl ; result: 1 = read, 2 = write 2268 <1> ; test cl, ch 2269 <1> ; jz short sysopen_dev_perm_err 2270 <1> ; 2271 <1> ; shl ch, 1 ; bit 0 = 0 2272 <1> ; ; eax = device number (entry offset) 2273 <1> ; call device_open 2274 <1> ; jc short sysopen_dev_perm_err 2275 <1> ; 2276 <1> ; ; eax = device number (entry offset) 2277 <1> ; or al, 80h ; set device bit (set bit 7 to 1) 2278 <1> ; mov ebx, [u.r0] 2279 <1> ; mov [ebx+u.fp], al ; bit 7 (=1) points to device 2280 <1> ; 2281 <1> ; jmp sysret 2282 <1> 2283 <1> sysmkdir: ; < make directory > 2284 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 2285 <1> ; 15/10/2016 2286 <1> ; 10/10/2016 (TRDOS 386 = TRDOS v2.0) 2287 <1> ; -derived from INT_21H.ASM- 2288 <1> ; ("loc_INT21h_create_file") 2289 <1> ; 10/07/2011 (12/03/2011) 2290 <1> ; INT 21h Function AH = 3Ch 2291 <1> ; Create File 2292 <1> ; INPUT 2293 <1> ; CX = Attributes 2294 <1> ; DS:DX= Address of zero terminaned path name 2295 <1> ; 2296 <1> ; 2297 <1> ; 14/05/2015 (Retro UNIX 386 v1 - Beginning) 2298 <1> ; 27/05/2013 - 02/08/2013 (Retro UNIX 8086 v1) 2299 <1> ; 2300 <1> ; 'sysmkdir' creates an empty directory whose name is 2301 <1> ; pointed to by arg 1. The mode of the directory is arg 2. 2302 <1> ; The special entries '.' and '..' are not present. 2303 <1> ; Errors are indicated if the directory already exists or 2304 <1> ; user is not the super user. 2305 <1> ; 2306 <1> ; Calling sequence: 2307 <1> ; sysmkdir; name; mode 2308 <1> ; Arguments: 2309 <1> ; name - points to the name of the directory 2310 <1> ; mode - mode of the directory 2311 <1> ; Inputs: (arguments) 2312 <1> ; Outputs: - 2313 <1> ; (sets 'directory' flag to 1; 2314 <1> ; 'set user id on execution' and 'executable' flags to 0) 2315 <1> ; ............................................................... 2316 <1> ; 2317 <1> ; Retro UNIX 8086 v1 modification: 2318 <1> ; 'sysmkdir' system call has two arguments; so, 2319 <1> ; * 1st argument, name is pointed to by BX register 2320 <1> ; * 2nd argument, mode is in CX register 2321 <1> ; 2322 <1> ; TRDOS 386 (10/10/2016) 2323 <1> ; 2324 <1> ; INPUT -> 2325 <1> ; CL = Directory Attributes 2326 <1> ; bit 0 (1) - Read only file/dir (R) 2327 <1> ; bit 1 (1) - Hidden file/dir (H) 2328 <1> ; bit 2 (1) - System file/dir (R) 2329 <1> ; bit 3 (1) - Volume label/name (V) 2330 <1> ; bit 4 (1) - Subdirectory (D) 2331 <1> ; bit 5 (1) - File/Dir has been archived (A) 2332 <1> ; CX = 0 -> create normal directory 2333 <1> ; EBX = Pointer to directory name (ASCIIZ) -path- 2334 <1> ; 2335 <1> ; OUTPUT -> 2336 <1> ; eax = First cluster of the new directory 2337 <1> ; cf = 1 -> Error code in AL 2338 <1> ; 2339 <1> ; Modified Registers: EAX (at the return of system call) 2340 <1> ; 2341 <1> ; Note: If the file or directory is existing 2342 <1> ; an access error will be returned. 2343 <1> 2344 0000D15A 6621C9 <1> and cx, cx ; if cx = 0 -> create a normal subdir 2345 0000D15D 7414 <1> jz short sysmkdir_1 2346 <1> 2347 0000D15F F6C110 <1> test cl, 10h ; if dir flags set, also use other flags 2348 <1> ;jnz sysmkdir_0 ; jump to head of 'syscreat' 2349 <1> ; 23/07/2022 2350 0000D162 7405 <1> jz short sysmkdir_invf 2351 <1> sysmkdir_3: 2352 0000D164 E998FDFFFF <1> jmp sysmkdir_0 2353 <1> 2354 <1> sysmkdir_invf: 2355 <1> ; CX has wrong flags 2356 0000D169 B817000000 <1> mov eax, ERR_INV_FLAGS 2357 0000D16E E975FEFFFF <1> jmp sysopen_dev_err 2358 <1> 2359 <1> sysmkdir_1: 2360 0000D173 B110 <1> mov cl, 10h ; set subdir flag and reset other flags 2361 <1> ;jmp sysmkdir_0 2362 <1> ; 23/07/2022 2363 0000D175 EBED <1> jmp short sysmkdir_3 ; jump to head of 'syscreat' 2364 <1> sysmkdir_2: 2365 <1> ; jump from 'syscreat' ; from 'syscreat_1' 2366 <1> ; CL = Directory attributes/flags 2367 0000D177 BE[58800100] <1> mov esi, FindFile_Name 2368 0000D17C E8E0D8FFFF <1> call make_sub_directory 2369 <1> ;jc sysopen_err ; NOTE: Old type (TRDOS 8086) 2370 <1> ; error codes must be modified 2371 <1> ; for next TRDOS 386 versions 2372 <1> ; (10/10/2016) 2373 <1> ; Old (MSDOS type) 2374 <1> ; error codes (2011): 2375 <1> ; 2 = file not found 2376 <1> ; 3 = directory not found 2377 <1> ; 5 = access denied 2378 <1> ; 12 = no more files 2379 <1> ; 19 = disk write protected 2380 <1> ; 39 = insufficient disk space 2381 <1> ; 'sysdefs.s' ; 10/10/2016 2382 <1> ; 23/07/2022 2383 0000D181 7305 <1> jnc short sysmkdir_4 2384 0000D183 E983FEFFFF <1> jmp sysopen_err 2385 <1> 2386 <1> sysmkdir_4: 2387 0000D188 A3[6C8E0100] <1> mov [u.r0], eax ; New sub dir's first cluster 2388 0000D18D E8184C0000 <1> call reset_working_path 2389 0000D192 E9F7F8FFFF <1> jmp sysret 2390 <1> 2391 <1> sysclose: ; 2392 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 2393 <1> ; 06/10/2016 (TRDOS 386 = TRDOS v2.0) 2394 <1> ; 2395 <1> ; 14/05/2015 (Retro UNIX 386 v1 - Beginning) 2396 <1> ; 22/05/2013 - 26/05/2013 (Retro UNIX 8086 v1) 2397 <1> ; 2398 <1> ; 'sysclose', given a file descriptor in 'u.r0', closes the 2399 <1> ; associated file. The file descriptor (index to 'u.fp' list) 2400 <1> ; is put in r1 and 'fclose' is called. 2401 <1> ; 2402 <1> ; Calling sequence: 2403 <1> ; sysclose 2404 <1> ; Arguments: 2405 <1> ; - 2406 <1> ; Inputs: *u.r0 - file descriptor 2407 <1> ; Outputs: - 2408 <1> ; ............................................................... 2409 <1> ; 2410 <1> ; Retro UNIX 8086 v1 modification: 2411 <1> ; The user/application program puts file descriptor 2412 <1> ; in BX register as 'sysclose' system call argument. 2413 <1> ; (argument transfer method 1) 2414 <1> 2415 <1> ; TRDOS 386 (06/10/2016) 2416 <1> ; 2417 <1> ; INPUT -> 2418 <1> ; EBX = File Handle/Number (file index) (AL) 2419 <1> ; OUTPUT -> 2420 <1> ; cf = 0 -> EAX = 0 2421 <1> ; cf = 1 -> Error code in EAX (ERR_FILE_NOT_OPEN) 2422 <1> ; 2423 <1> ; Modified Registers: EAX (at the return of system call) 2424 <1> ; 2425 <1> 2426 0000D197 89D8 <1> mov eax, ebx 2427 0000D199 31DB <1> xor ebx, ebx 2428 0000D19B 891D[6C8E0100] <1> mov [u.r0], ebx ; 0 ; return value of EAX 2429 0000D1A1 E8B5300000 <1> call fclose 2430 <1> ;jnc sysret 2431 <1> ; 23/07/2022 2432 0000D1A6 7205 <1> jc short sysclose_err 2433 0000D1A8 E9E1F8FFFF <1> jmp sysret 2434 <1> sysclose_err: 2435 <1> ; 24/04/2025 2436 <1> seektell_err: 2437 <1> device_rw_err: 2438 0000D1AD B80A000000 <1> mov eax, ERR_FILE_NOT_OPEN ; file not open ! 2439 0000D1B2 A3[D88E0100] <1> mov [u.error], eax ; 2440 0000D1B7 A3[6C8E0100] <1> mov [u.r0], eax ; ! invalid handle ! 2441 0000D1BC E9ADF8FFFF <1> jmp error 2442 <1> 2443 <1> sysread: ; < read from file > 2444 <1> ; 27/09/2024 2445 <1> ; 18/09/2024 2446 <1> ; 03/09/2024 (TRDOS v2.0.9) 2447 <1> ; 11/10/2016 (TRDOS 386 = TRDOS v2.0) 2448 <1> ; -derived from INT_21H.ASM- 2449 <1> ; ("loc_INT21h_read_file") 2450 <1> ; 13/03/2011 (05/03/2011) 2451 <1> ; INT 21h Function AH = 3Fh 2452 <1> ; Read from a File 2453 <1> ; INPUT 2454 <1> ; BX = File Handle 2455 <1> ; CX = Number of bytes to read 2456 <1> ; DS:DX= Buffer address 2457 <1> ; 2458 <1> ; Note: TRDOS 386 'sysread' has been derived from 2459 <1> ; Retro UNIX 386 v1 'sysread', except a few 2460 <1> ; code modifications. 2461 <1> ; 2462 <1> ; 13/05/2015 (Retro UNIX 386 v1) 2463 <1> ; 11/05/2015 (Retro UNIX 386 v1 - Beginning) 2464 <1> ; 23/05/2013 (Retro UNIX 8086 v1) 2465 <1> ; 2466 <1> ; 'sysread' is given a buffer to read into and the number of 2467 <1> ; characters to be read. If finds the file from the file 2468 <1> ; descriptor located in *u.r0 (r0). This file descriptor 2469 <1> ; is returned from a successful open call (sysopen). 2470 <1> ; The i-number of file is obtained via 'rw1' and the data 2471 <1> ; is read into core via 'readi'. 2472 <1> ; 2473 <1> ; Calling sequence: 2474 <1> ; sysread; buffer; nchars 2475 <1> ; Arguments: 2476 <1> ; buffer - location of contiguous bytes where 2477 <1> ; input will be placed. 2478 <1> ; nchars - number of bytes or characters to be read. 2479 <1> ; Inputs: *u.r0 - file descriptor (& arguments) 2480 <1> ; Outputs: *u.r0 - number of bytes read. 2481 <1> ; ............................................................... 2482 <1> ; 2483 <1> ; Retro UNIX 8086 v1 modification: 2484 <1> ; 'sysread' system call has three arguments; so, 2485 <1> ; * 1st argument, file descriptor is in BX register 2486 <1> ; * 2nd argument, buffer address/offset in CX register 2487 <1> ; * 3rd argument, number of bytes is in DX register 2488 <1> ; 2489 <1> ; AX register (will be restored via 'u.r0') will return 2490 <1> ; to the user with number of bytes read. 2491 <1> ; 2492 <1> ; TRDOS 386 (05/10/2016) 2493 <1> ; 2494 <1> ; INPUT -> 2495 <1> ; EBX = File handle (descriptor/index) 2496 <1> ; ECX = Buffer address 2497 <1> ; EDX = Number of bytes 2498 <1> ; OUTPUT -> 2499 <1> ; EAX = Number of bytes have been read 2500 <1> ; cf = 1 -> Error code in AL 2501 <1> ; 2502 <1> ; Modified Registers: EAX (at the return of system call) 2503 <1> ; 2504 <1> 2505 <1> ; EBX = File descriptor 2506 0000D1C1 E8DA300000 <1> call getf1 2507 0000D1C6 723A <1> jc short device_read ; read data from device 2508 <1> 2509 <1> ; EAX = First cluster of the file 2510 <1> 2511 0000D1C8 E837000000 <1> call rw1 ; 03/09/2024 (major modification) 2512 0000D1CD 730A <1> jnc short sysread_0 2513 <1> 2514 <1> sysrw_err: ; 03/09/2024 2515 0000D1CF A3[6C8E0100] <1> mov [u.r0], eax ; error code 2516 0000D1D4 E995F8FFFF <1> jmp error 2517 <1> 2518 <1> sysread_0: 2519 0000D1D9 E8A8340000 <1> call readi 2520 0000D1DE EB13 <1> jmp short rw0 2521 <1> 2522 <1> syswrite: ; < write to file > 2523 <1> ; 27/09/2024 2524 <1> ; 18/09/2024 2525 <1> ; 03/09/2024 2526 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 2527 <1> ; 23/10/2016 2528 <1> ; 11/10/2016 (TRDOS 386 = TRDOS v2.0) 2529 <1> ; -derived from INT_21H.ASM- 2530 <1> ; ("loc_INT21h_write_file") 2531 <1> ; 13/03/2011 (05/03/2011) 2532 <1> ; INT 21h Function AH = 40h 2533 <1> ; Write to a File 2534 <1> ; INPUT 2535 <1> ; BX = File Handle 2536 <1> ; CX = Number of bytes to write 2537 <1> ; DS:DX= Buffer address 2538 <1> ; 2539 <1> ; Note: TRDOS 386 'sysrwrite' has been derived from 2540 <1> ; Retro UNIX 386 v1 'syswrite', except a few 2541 <1> ; code modifications. 2542 <1> ; 2543 <1> 2544 <1> ; 13/05/2015 (Retro UNIX 386 v1) 2545 <1> ; 11/05/2015 (Retro UNIX 386 v1 - Beginning) 2546 <1> ; 23/05/2013 (Retro UNIX 8086 v1) 2547 <1> ; 2548 <1> ; 'syswrite' is given a buffer to write onto an output file 2549 <1> ; and the number of characters to write. If finds the file 2550 <1> ; from the file descriptor located in *u.r0 (r0). This file 2551 <1> ; descriptor is returned from a successful open or create call 2552 <1> ; (sysopen or syscreat). The i-number of file is obtained via 2553 <1> ; 'rw1' and buffer is written on the output file via 'write'. 2554 <1> ; 2555 <1> ; Calling sequence: 2556 <1> ; syswrite; buffer; nchars 2557 <1> ; Arguments: 2558 <1> ; buffer - location of contiguous bytes to be writtten. 2559 <1> ; nchars - number of characters to be written. 2560 <1> ; Inputs: *u.r0 - file descriptor (& arguments) 2561 <1> ; Outputs: *u.r0 - number of bytes written. 2562 <1> ; ............................................................... 2563 <1> ; 2564 <1> ; Retro UNIX 8086 v1 modification: 2565 <1> ; 'syswrite' system call has three arguments; so, 2566 <1> ; * 1st argument, file descriptor is in BX register 2567 <1> ; * 2nd argument, buffer address/offset in CX register 2568 <1> ; * 3rd argument, number of bytes is in DX register 2569 <1> ; 2570 <1> ; AX register (will be restored via 'u.r0') will return 2571 <1> ; to the user with number of bytes written. 2572 <1> ; 2573 <1> ; INPUT -> 2574 <1> ; EBX = File handle (descriptor/index) 2575 <1> ; ECX = Buffer address 2576 <1> ; EDX = Number of bytes 2577 <1> ; OUTPUT -> 2578 <1> ; EAX = Number of bytes have been written 2579 <1> ; cf = 1 -> Error code in AL 2580 <1> ; 2581 <1> ; Modified Registers: EAX (at the return of system call) 2582 <1> ; 2583 <1> 2584 <1> ; EBX = File descriptor 2585 0000D1E0 E8BB300000 <1> call getf1 2586 0000D1E5 721B <1> jc short device_write ; write data to device 2587 <1> ; EAX = First cluster of the file 2588 <1> ; EBX = File number (Open file number) ; 23/10/2016 2589 <1> 2590 0000D1E7 E818000000 <1> call rw1 ; 03/09/2024 (major modification) 2591 <1> ; 03/09/2024 2592 0000D1EC 72E1 <1> jc short sysrw_err 2593 <1> 2594 <1> ; 25/08/2024 (*) 2595 <1> ;jnc short syswrite_0 2596 <1> ;mov [u.r0], eax ; error code 2597 <1> ;jmp error 2598 <1> 2599 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 (bugfix) (*) 2600 <1> ; (if eax = 0, lets add a cluster at 'mget_w_0') 2601 <1> ; ('mget_w' and 'add_new_cluster' procs are modified) 2602 <1> 2603 <1> syswrite_0: 2604 0000D1EE E86C3B0000 <1> call writei ; 24/08/2024 ('mget_w' modification) 2605 <1> rw0: ; 1: 2606 0000D1F3 A1[988E0100] <1> mov eax, [u.nread] 2607 0000D1F8 A3[6C8E0100] <1> mov [u.r0], eax 2608 0000D1FD E98CF8FFFF <1> jmp sysret 2609 <1> 2610 <1> ; 17/04/2021 (temporary) 2611 <1> device_write: 2612 <1> device_read: 2613 <1> ; 26/09/2024 2614 <1> ; 18/09/2024 - TRDOS 386 v2.0.9 2615 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 2616 <1> ; (temporary modifications) 2617 <1> ; 2618 <1> ; 11/10/2016 (TRDOS 386 = TRDOS v2.0) 2619 <1> ; cl = DEV_OPENMODE ; open mode 2620 <1> ; ch = DEV_ACCESS ; access flags 2621 <1> ; al = DEV_DRIVER ; device number (eax) 2622 <1> 2623 <1> ; 24/04/2025 - TRDOS 386 v2.0.10 2624 <1> ;; 18/09/2024 (temporary) 2625 <1> ;call rw2 ; file not open ; cf = 1 2626 <1> ;;jmp error 2627 <1> ;; 26/09/2024 2628 <1> ;jmp short sysrw_err 2629 <1> ; 24/04/2025 2630 0000D202 EBA9 <1> jmp short device_rw_err 2631 <1> 2632 <1> 2633 <1> ; test cl, 1 ; 1 = read, 2 = write, 3 = read&write 2634 <1> ; jz short rw3 2635 <1> ; 2636 <1> ; mov ebx, eax 2637 <1> ; shl bx, 2 ; *4 2638 <1> ; 2639 <1> ; test ch, 80h ; bit 7, installable device driver flag 2640 <1> ; jz short d_read_2 ; Kernel device 2641 <1> ; ; installable device 2642 <1> ;d_read_1: 2643 <1> ; jmp dword [ebx+IDEV_RADDR-4] 2644 <1> ;d_read_2: 2645 <1> ; jmp dword [ebx+KDEV_RADDR-4] 2646 <1> 2647 <1> ;device_write: 2648 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 2649 <1> ; (temporary modifications) 2650 <1> ; 2651 <1> ; 11/10/2016 (TRDOS 386 = TRDOS v2.0) 2652 <1> ; cl = DEV_OPENMODE ; open mode 2653 <1> ; ch = DEV_ACCESS ; access flags 2654 <1> ; al = DEV_DRIVER ; device number (eax) 2655 <1> 2656 <1> ; 17/04/2021 (temporary) 2657 <1> ;jmp short rw2 ; file not open 2658 <1> 2659 <1> ; test cl, 2 ; 1 = read, 2 = write, 3 = read&write 2660 <1> ; jz short rw3 2661 <1> ; 2662 <1> ; mov ebx, eax 2663 <1> ; shl bx, 2 ; *4 2664 <1> ; 2665 <1> ; test ch, 80h ; bit 7, installable device driver flag 2666 <1> ; jz short d_write_2 ; Kernel device 2667 <1> ; ; installable device 2668 <1> ;d_write_1: 2669 <1> ; jmp dword [ebx+IDEV_WADDR-4] 2670 <1> ;d_write_2: 2671 <1> ; jmp dword [ebx+KDEV_WADDR-4] 2672 <1> 2673 <1> rw1: 2674 <1> ; 27/09/2024 2675 <1> ; 03/09/2024 (TRDOS 386 v2.0.9) 2676 <1> ; 17/04/2021 (TRDOS 386 v2.0.4) 2677 <1> ; 11/10/2016 (TRDOS 386 = TRDOS v2.0) 2678 <1> ; 14/05/2015 (Retro UNIX 386 v1) 2679 <1> ; 11/05/2015 (Retro UNIX 386 v1 - Beginning) 2680 <1> ; 23/05/2013 - 24/05/2013 (Retro UNIX 8086 v1) 2681 <1> ; System call registers: ebx, ecx, edx (through 'sysenter') 2682 <1> ; 2683 <1> ; EBX = File descriptor 2684 <1> ;call getf1 ; calling point in 'getf' from 'rw1' 2685 <1> ;jc short device_rw ; read/write data from/to device 2686 <1> ; EAX = First cluster of the file 2687 <1> 2688 <1> ; 03/09/2024 2689 0000D204 09C0 <1> or eax, eax 2690 0000D206 7421 <1> jz short rw7 ; eax = 0 -> empty file (OK for now) 2691 <1> 2692 0000D208 83F802 <1> cmp eax, 2 ; is it valid cluster number ? 2693 <1> ;jb short rw2 2694 <1> ; 03/09/2024 2695 0000D20B 7307 <1> jnb short rw6 ; yes, check upper limit 2696 <1> 2697 <1> ;;; 2698 <1> ; eax = 1 -> invalid cluster number 2699 <1> rw5: 2700 0000D20D B823000000 <1> mov eax, ERR_CLUSTER ; 35 ; 'cluster not available !' 2701 0000D212 EB2C <1> jmp short rw4 ; cf = 1 2702 <1> 2703 <1> rw6: ; 03/09/2024 (check cluster number is valid or not) 2704 0000D214 53 <1> push ebx 2705 <1> ; ebx <= OPENFILES-1 ; 0-31 2706 0000D215 8ABB[F8830100] <1> mov bh, [ebx+OF_DRIVE] ; drive number * 256 2707 0000D21B 28DB <1> sub bl, bl ; 27/09/2024 2708 0000D21D 8B9B78010900 <1> mov ebx, [ebx+Logical_DOSDisks+LD_Clusters] 2709 0000D223 43 <1> inc ebx ; cluster count + 1 = last cluster number 2710 0000D224 39C3 <1> cmp ebx, eax 2711 0000D226 5B <1> pop ebx 2712 0000D227 72E4 <1> jb short rw5 2713 <1> rw7: 2714 <1> ;;; 2715 <1> 2716 0000D229 890D[908E0100] <1> mov [u.base], ecx ; buffer address/offset 2717 <1> ;(in the user's virtual memory space) 2718 0000D22F 8915[948E0100] <1> mov [u.count], edx 2719 0000D235 C705[D88E0100]0000- <1> mov dword [u.error], 0 ; reset the last error code 2719 0000D23D 0000 <1> 2720 0000D23F C3 <1> retn 2721 <1> 2722 <1> ; 24/04/2025 - TRDOS 386 v2.0.10 2723 <1> %if 0 2724 <1> 2725 <1> rw2: 2726 <1> mov eax, ERR_FILE_NOT_OPEN ; file not open ! 2727 <1> ;mov dword [u.error], eax 2728 <1> ;retn 2729 <1> 2730 <1> %endif 2731 <1> ; 03/09/2024 2732 <1> ; 17/04/2021 2733 <1> ;jmp short rw4 2734 <1> 2735 <1> ; 03/09/2024 2736 <1> rw3: 2737 <1> ; mov eax, ERR_FILE_ACCESS ; permission denied ! 2738 <1> ; stc 2739 <1> 2740 <1> rw4: ; 17/04/2021 2741 0000D240 A3[D88E0100] <1> mov dword [u.error], eax 2742 0000D245 C3 <1> retn 2743 <1> 2744 <1> systimer: 2745 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 2746 <1> ; 02/01/2017 2747 <1> ; 21/12/2016 2748 <1> ; 19/12/2016 2749 <1> ; 10/12/2016 (callback) 2750 <1> ; 10/06/2016 2751 <1> ; 07/06/2016 2752 <1> ; 06/06/2016 2753 <1> ; 21/05/2016 2754 <1> ; 19/05/2016 2755 <1> ; 18/05/2016 - TRDOS 386 (TRDOS v2.0) 2756 <1> ; (TRDOS 386 feature only!) 2757 <1> ; 2758 <1> ; (start or stop timer event(s)) 2759 <1> ; 2760 <1> ; INPUT -> 2761 <1> ; BL = Signal return byte (response byte) 2762 <1> ; (Any requested value between 0 and 255) 2763 <1> ; (Kernel will put it at the requested address) 2764 <1> ; BH = Time count unit 2765 <1> ; 0 = Stop timer event 2766 <1> ; 1 = 18.2 ticks per second 2767 <1> ; 2 = 10 milliseconds 2768 <1> ; 3 = 1 second (for real time clock interrupt) 2769 <1> ; 4 = time/tick count in current time count unit 2770 <1> ; // 10/12/2016 2771 <1> ; 80h = Stop timer event (callback method) 2772 <1> ; 81h = 18.2 ticks per second, callback method 2773 <1> ; 82h = 10 milliseconds, callback method 2774 <1> ; 83h = 1 second (for RTC int), callback method 2775 <1> ; 84h = current time count unit, callback method 2776 <1> ; 2777 <1> ; Note: Only 03h or 83h will set real time clock 2778 <1> ; (RTC) events (Others are for PIT events)! 2779 <1> ; 2780 <1> ; NOTE: If callback (user service) method is used, 2781 <1> ; EDX will point to the return address (of service 2782 <1> ; procedure) in user's space instead of signal 2783 <1> ; response byte address. (TRDOS 386 kernel will 2784 <1> ; direct the cpu to that address -in user's space- 2785 <1> ; at the return of system call or interrupt 2786 <1> ; just after the adjusted count/time is elapsed.) 2787 <1> ; User's sevice routine must be ended with a 2788 <1> ; 'iret'. Normal return addresses from system 2789 <1> ; calls or and interrupts will be kept same except 2790 <1> ; the timer returns. 2791 <1> ; 2792 <1> ; BH = 0 -> Stop timer event 2793 <1> ; BL = Timer event number (1 to 255) if BH = 0 2794 <1> ; If BL = 0, all timer events (which are belongs 2795 <1> ; to running process) will be stopped 2796 <1> ; ECX = Time/Tick count (depending on time count unit) 2797 <1> ; EDX = Signal return (Response) byte address 2798 <1> ; (virtual address in user's memory space) 2799 <1> ; OUTPUT -> 2800 <1> ; AL = Timer event number (1 to 255) (max. value = 16) 2801 <1> ; IF BH Input = 0 & CF = 0 & AL = 0 -> 2802 <1> ; timer event(s) has/have been stopped/finished 2803 <1> ; CF = 1 & AL = 0 -> no timer setting space to set 2804 <1> ; CF = 1 & AL > 0 -> timer count unit is not usable 2805 <1> ; 2806 <1> ; NOTE: To modify a time count for a user function, 2807 <1> ; at first, current timer event must be stopped 2808 <1> ; then a new timer event (which is related with 2809 <1> ; same user function) must be started. 2810 <1> ; 2811 <1> ; Signal return (response) byte may be used for 2812 <1> ; several purposes. Kernel will put this value 2813 <1> ; to requested address during timer interrupt, 2814 <1> ; program/user can check this value to understand 2815 <1> ; which event has been occurred and what is changed. 2816 <1> ; (Multi timer events can share same signal address) 2817 <1> ; 2818 <1> ; NOTE: If the process is running while the time count 2819 <1> ; is reached, kernel will put signal return (response) 2820 <1> ; byte value at requested address during timer 2821 <1> ; interrupt and the process will continue to run. 2822 <1> ; Program/process must call (jump to) it's timer event 2823 <1> ; function as required, for checking the timer event 2824 <1> ; status via signal return (response) byte address. 2825 <1> ; 2826 <1> ; If the process is not running (waiting or sleeping 2827 <1> ; or released) while the time count is reached, 2828 <1> ; it is restarted from where it left, to ensure 2829 <1> ; proper multi media (video, audio, clock, timer) 2830 <1> ; functionality. 2831 <1> ; 2832 <1> ; (It is better to use 'syswait' or 'syssleep', 2833 <1> ; or 'sysrele' system call just after the timer 2834 <1> ; function. Otherwise, timer events may block other 2835 <1> ; processes which are not using timer events.) 2836 <1> ; 2837 <1> ; Timer Event Structure: (max. 16 timer events, 16*16 bytes) 2838 <1> ; Owner: resb 1 ; 0 = free 2839 <1> ; ;>0 = process number (u.uno) 2840 <1> ; Calback: resb 1 ; 1 = callback, 0 = response byte 2841 <1> ; Interrupt: resb 1 ; 0 = Timer interrupt (or none) 2842 <1> ; ; 1 = Real Time Clock interrupt 2843 <1> ; Response: resb 1 ; 0 to 255, signal return value 2844 <1> ; Count Limit: resd 1 ; count of ticks (total/set) 2845 <1> ; Current Count: resd 1 ; count of ticks (current) 2846 <1> ; Response Addr: resd 1 ; response byte (pointer) address 2847 <1> ; 2848 <1> 2849 <1> ; 19/12/2016 (timer callback) 2850 0000D246 C605[50880100]00 <1> mov byte [tcallback], 0 2851 0000D24D C605[51880100]00 <1> mov byte [trtc], 0 2852 0000D254 C705[E08E0100]0000- <1> mov dword [u.tcb], 0 ; this is not necessary... 2852 0000D25C 0000 <1> 2853 <1> 2854 0000D25E 80FF80 <1> cmp bh, 80h 2855 0000D261 7224 <1> jb short systimer_cb2 2856 0000D263 7704 <1> ja short systimer_cb0 2857 <1> 2858 0000D265 31D2 <1> xor edx, edx ; 0, reset callback address 2859 0000D267 EB0B <1> jmp short systimer_cb1 2860 <1> 2861 <1> systimer_cb0: 2862 0000D269 80FF84 <1> cmp bh, 84h 2863 0000D26C 7764 <1> ja short systimer_5 ; undefined, error 2864 <1> 2865 <1> ;mov byte [tcallback], 1 ; 19/12/2016 2866 0000D26E FE05[50880100] <1> inc byte [tcallback] 2867 <1> 2868 <1> systimer_cb1: 2869 0000D274 0FB635[BD8E0100] <1> movzx esi, byte [u.uno] ; process number 2870 <1> ;shl si, 2 2871 <1> ; 23/07/2022 2872 0000D27B C1E602 <1> shl esi, 2 2873 0000D27E 8996[FC8D0100] <1> mov [esi+p.tcb-4], edx ; set process timer callback address 2874 <1> ; (overwrite prev value if it is set!) 2875 0000D284 80E77F <1> and bh, 7Fh 2876 <1> 2877 <1> systimer_cb2: 2878 0000D287 80FF02 <1> cmp bh, 2 2879 0000D28A 7446 <1> je short systimer_5 ; only 18.2 ticks per second is usable 2880 <1> ; 10 milliseconds (100 Hertz) timer 2881 <1> ; will be set later (18/05/2016) 2882 0000D28C 774C <1> ja short systimer_6 2883 <1> 2884 0000D28E 20FF <1> and bh, bh 2885 <1> ;jz systimer_9 ; stop timer event(s) 2886 <1> ; 23/07/2022 2887 0000D290 7505 <1> jnz short systimer_19 2888 0000D292 E9BA000000 <1> jmp systimer_9 2889 <1> 2890 <1> ; bh = 1 (timer interrupt, 18.2 Hz, IBM PC/AT ROMBIOS default) 2891 <1> 2892 <1> systimer_19: 2893 0000D297 B00A <1> mov al, 10 ; (*) 2894 <1> 2895 <1> systimer_0: 2896 0000D299 B710 <1> mov bh, 16 2897 <1> ; 2898 0000D29B 383D[47830100] <1> cmp [timer_events], bh ; 16 ; 07/06/2016 2899 0000D2A1 7319 <1> jnb short systimer_3 ; max. 16 timer events 2900 <1> ; 2901 0000D2A3 50 <1> push eax ; (*) 2902 <1> 2903 0000D2A4 BF[808F0100] <1> mov edi, timer_set ; beginning address of timer events 2904 <1> ; setting space 2905 0000D2A9 30C0 <1> xor al, al ; 0 2906 <1> systimer_1: 2907 0000D2AB FEC0 <1> inc al 2908 0000D2AD 803F00 <1> cmp byte [edi], 0 ; is it free space ? 2909 0000D2B0 7639 <1> jna short systimer_7 ; yes 2910 0000D2B2 FECF <1> dec bh 2911 0000D2B4 7405 <1> jz short systimer_2 2912 0000D2B6 83C710 <1> add edi, 16 2913 0000D2B9 EBF0 <1> jmp short systimer_1 ; next event space 2914 <1> 2915 <1> systimer_2: 2916 0000D2BB 58 <1> pop eax ; (*) discard 2917 <1> systimer_3: 2918 0000D2BC C605[6C8E0100]00 <1> mov byte [u.r0], 0 2919 <1> systimer_4: 2920 0000D2C3 C705[D88E0100]1B00- <1> mov dword [u.error], ERR_MISC 2920 0000D2CB 0000 <1> 2921 <1> ; one of miscellaneous/other errors 2922 0000D2CD E99CF7FFFF <1> jmp error ; cf -> 1 2923 <1> 2924 <1> systimer_5: 2925 0000D2D2 883D[6C8E0100] <1> mov [u.r0], bh ; Time count unit (=2 or >3) 2926 0000D2D8 EBE9 <1> jmp short systimer_4 ; 07/06/2016 2927 <1> 2928 <1> systimer_6: 2929 0000D2DA 80FF04 <1> cmp bh, 4 2930 0000D2DD 77F3 <1> ja short systimer_5 ; undefined time count unit 2931 <1> ;jb short systimer_16 2932 <1> 2933 <1> ;mov al, 1 ; default (use current timer unit) 2934 <1> ; countdown value is in ECX ! 2935 <1> ; max. value of ecx = 4294967296/10 2936 <1> ;jmp short systimer_0 2937 <1> ;jmp short systimer_19 2938 0000D2DF 74B6 <1> je short systimer_19 2939 <1> 2940 <1> systimer_16: 2941 <1> ; bh = 3 2942 <1> ; timer event via real time clock interrupt 2943 <1> ; interrupt/update frequency: 1 Hz (1 tick per second) 2944 <1> 2945 0000D2E1 B0B6 <1> mov al, 182 ; (*) ; 18.2 * 10 2946 0000D2E3 FE05[51880100] <1> inc byte [trtc] ; timer event via real time clock 2947 0000D2E9 EBAE <1> jmp short systimer_0 2948 <1> 2949 <1> systimer_7: 2950 0000D2EB A2[6C8E0100] <1> mov [u.r0], al ; timer event number 2951 <1> ; 2952 <1> ; edi = address of empty timer event area 2953 0000D2F0 A0[BD8E0100] <1> mov al, [u.uno] 2954 0000D2F5 FA <1> cli ; disable interrupts 2955 0000D2F6 AA <1> stosb ; process number 2956 0000D2F7 A0[50880100] <1> mov al, [tcallback] ; timer callback flag 2957 0000D2FC AA <1> stosb ; 1= callback method, 0= signal response byte method 2958 0000D2FD A0[51880100] <1> mov al, [trtc] ; timer interrupt type 2959 0000D302 AA <1> stosb ; 1= real time clock, 0= programmable interval timer 2960 0000D303 88D8 <1> mov al, bl ; Signal return (Response) value 2961 0000D305 AA <1> stosb ; response byte 2962 0000D306 58 <1> pop eax ; (*) ; 10 or 182 2963 0000D307 89D3 <1> mov ebx, edx ; virtual address for response/signal byte 2964 0000D309 F7E1 <1> mul ecx 2965 <1> ; (eax = 10 * count of 18.2 Hz timer ticks) 2966 <1> ; (count down step = 10) 2967 0000D30B AB <1> stosd ; count limit (reset value) 2968 0000D30C AB <1> stosd ; current count value 2969 <1> 2970 <1> ; 19/12/2016 2971 0000D30D 803D[50880100]00 <1> cmp byte [tcallback], 0 ; timer callback method ? 2972 0000D314 7604 <1> jna short systimer_17 ; no 2973 0000D316 89D8 <1> mov eax, ebx ; virtual address for callback routine 2974 0000D318 EB0D <1> jmp short systimer_18 2975 <1> 2976 <1> systimer_17: ; signal response byte method 2977 <1> ; ebx = virtual address 2978 <1> ; [u.pgdir] = page directory's physical address 2979 <1> ; 20/02/2017 2980 0000D31A FE05[52880100] <1> inc byte [no_page_swap] ; 1 2981 <1> ; Do not add this page to swap queue 2982 <1> ; and remove it from swap queue if it is 2983 <1> ; on the queue. 2984 0000D320 E8EB88FFFF <1> call get_physical_addr 2985 0000D325 721A <1> jc short systimer_8 ; 07/06/2016 2986 <1> ; eax = physical address of the virtual address in user's space 2987 <1> systimer_18: 2988 0000D327 AB <1> stosd ; response addr (physical) or callback addr (virtual) 2989 0000D328 FE05[47830100] <1> inc byte [timer_events] ; 07/06/201 2990 <1> ; 02/01/2017 2991 0000D32E 0FB605[BD8E0100] <1> movzx eax, byte [u.uno] 2992 0000D335 FE80[EF8D0100] <1> inc byte [eax+p.timer-1] 2993 <1> ; 2994 0000D33B FB <1> sti ; enable interrupts 2995 0000D33C E94DF7FFFF <1> jmp sysret 2996 <1> 2997 <1> systimer_8: 2998 <1> ; 10/06/2016 2999 <1> ; 07/06/2016 3000 0000D341 28C0 <1> sub al, al ; 0 3001 0000D343 8847F4 <1> mov [edi-12], al ; clear process number (free timer event) 3002 <1> ;mov dword [edi], eax ; 0 3003 0000D346 FB <1> sti 3004 0000D347 A2[6C8E0100] <1> mov [u.r0], al ; 0 3005 0000D34C E91DF7FFFF <1> jmp error 3006 <1> 3007 <1> systimer_9: 3008 <1> ; 10/06/2016 3009 <1> ; 07/06/2016 3010 0000D351 28C0 <1> sub al, al 3011 0000D353 A2[6C8E0100] <1> mov byte [u.r0], al ; 0 3012 0000D358 3805[47830100] <1> cmp byte [timer_events], al ; 0 3013 0000D35E 7631 <1> jna short systimer_12 3014 <1> 3015 <1> ; Note: ecx and edx are undefined here 3016 <1> ; (for stop timer function) 3017 <1> 3018 0000D360 BE[808F0100] <1> mov esi, timer_set ; beginning address of timer events 3019 <1> ; setting space 3020 0000D365 A0[BD8E0100] <1> mov al, [u.uno] 3021 <1> 3022 0000D36A B710 <1> mov bh, 16 3023 <1> 3024 0000D36C 08DB <1> or bl, bl 3025 0000D36E 7544 <1> jnz short systimer_15 3026 <1> 3027 <1> ; clear timer event areas belong to current process 3028 <1> ; (for stopping all timer events belong to current process) 3029 0000D370 FA <1> cli ; disable interrupts 3030 <1> systimer_10: 3031 <1> ; 10/06/2016 3032 <1> ; 07/06/2016 3033 0000D371 8A26 <1> mov ah, [esi] 3034 0000D373 08E4 <1> or ah, ah ; 0 ? 3035 0000D375 7411 <1> jz short systimer_11 3036 0000D377 38C4 <1> cmp ah, al ; is the process number (owner) same ? 3037 0000D379 750D <1> jne short systimer_11 ; no 3038 <1> 3039 <1> ;mov byte [esi], 0 3040 0000D37B 66C7060000 <1> mov word [esi], 0 ; clear 3041 <1> ;mov dword [esi+12], 0 ; clear 3042 <1> 3043 0000D380 FE0D[47830100] <1> dec byte [timer_events] 3044 0000D386 7409 <1> jz short systimer_12 3045 <1> 3046 <1> systimer_11: 3047 0000D388 FECF <1> dec bh 3048 0000D38A 7405 <1> jz short systimer_12 3049 0000D38C 83C610 <1> add esi, 16 3050 0000D38F EBE0 <1> jmp short systimer_10 3051 <1> 3052 <1> systimer_12: 3053 0000D391 0FB635[BD8E0100] <1> movzx esi, byte [u.uno] 3054 0000D398 08DB <1> or bl, bl ; all timer events or one timer event ? 3055 0000D39A 740C <1> jz short systimer_13 3056 0000D39C 8A9E[EF8D0100] <1> mov bl, [esi+p.timer-1] 3057 0000D3A2 20DB <1> and bl, bl ; previous number of timer events for the process 3058 0000D3A4 7408 <1> jz short systimer_14 3059 0000D3A6 FECB <1> dec bl ; previous number of timer events for the process - 1 3060 <1> systimer_13: 3061 0000D3A8 889E[EF8D0100] <1> mov [esi+p.timer-1], bl ; 0 ; no timer events for process 3062 <1> systimer_14: 3063 0000D3AE FB <1> sti ; enable interrupts 3064 0000D3AF E9DAF6FFFF <1> jmp sysret 3065 <1> 3066 <1> systimer_15: 3067 0000D3B4 38FB <1> cmp bl, bh ; 16 3068 <1> ;ja systimer_4 ; max. 16 timer events ! 3069 <1> ; 23/07/2022 3070 0000D3B6 7605 <1> jna short systimer_21 3071 <1> systimer_20: 3072 0000D3B8 E906FFFFFF <1> jmp systimer_4 3073 <1> systimer_21: ; 23/07/2022 3074 0000D3BD 88DA <1> mov dl, bl 3075 0000D3BF FECA <1> dec dl ; 16 -> 15 ... 1 -> 0 3076 0000D3C1 C0E204 <1> shl dl, 4 ; * 16 3077 0000D3C4 0FB6FA <1> movzx edi, dl 3078 0000D3C7 01F7 <1> add edi, esi ; timer_set 3079 <1> 3080 0000D3C9 3A07 <1> cmp al, [edi] ; process number 3081 <1> ;jne systimer_4 3082 <1> ; 23/07/2022 3083 0000D3CB 75EB <1> jne short systimer_20 ; jmp systimer_4 3084 <1> 3085 <1> ; same process ID 3086 0000D3CD FA <1> cli ; disable interrupts 3087 <1> ; 10/06/2016 ; 02/01/2017 3088 <1> ;mov byte [edi], 0 3089 0000D3CE 66C7070000 <1> mov word [edi], 0 ; clear 3090 <1> ;mov dword [edi+12], 0 ; clear 3091 0000D3D3 FE0D[47830100] <1> dec byte [timer_events] 3092 0000D3D9 EBB6 <1> jmp short systimer_12 3093 <1> 3094 <1> sysvideo: ; VIDEO DATA TRANSFER FUNCTIONS 3095 <1> ; 11/08/2022 3096 <1> ; 08/08/2022 3097 <1> ; 23/07/2022 (TRDOS 386 v2.0.5) 3098 <1> ; 06/03/2021 3099 <1> ; 02/03/2021 3100 <1> ; 28/02/2021 3101 <1> ; 27/02/2021 3102 <1> ; 26/02/2021 3103 <1> ; 25/02/2021 3104 <1> ; 21/02/2021, 22/02/2021, 23/02/2021 3105 <1> ; 15/02/2021, 16/02/2021, 18/02/2021 3106 <1> ; 10/02/2021, 11/02/2021, 12/02/2021 3107 <1> ; 07/02/2021, 08/02/2021 3108 <1> ; 01/02/2021, 02/02/2021, 05/02/2021 3109 <1> ; 29/01/2021, 30/01/2021, 31/01/2021 3110 <1> ; 23/01/2021, 24/01/2021, 28/01/2021 3111 <1> ; 18/01/2021, 19/01/2021, 22/01/2021 3112 <1> ; 04/01/2021, 10/01/2021, 11/01/2021 3113 <1> ; 01/01/2021, 02/01/2021, 03/01/2021 3114 <1> ; 28/12/2020, 29/12/2020, 30/12/2020 3115 <1> ; 25/12/2020, 26/12/2020 3116 <1> ; 21/12/2020, 23/12/2020 3117 <1> ; 12/12/2020, 14/12/2020 3118 <1> ; 10/12/2020, 11/12/2020 3119 <1> ; 03/12/2020, 04/12/2020 3120 <1> ; 22/11/2020, 23/11/2020 3121 <1> ; 21/11/2020 (TRDOS 386 v2.0.3) 3122 <1> ; 12/05/2017 3123 <1> ; 11/07/2016 3124 <1> ; 13/06/2016 3125 <1> ; 16/05/2016 - TRDOS 386 (TRDOS v2.0) 3126 <1> ; 3127 <1> ; VIDEO DATA TRANSFER FUNCTIONS: 3128 <1> ; 3129 <1> ; Inputs: 3130 <1> ; ; 07/02/2021 3131 <1> ; BH = 0 = VIDEO BIOS Mode 3, tty/text mode data transfers 3132 <1> ; BL = 3133 <1> ; Bits 0&1, Transfer direction 3134 <1> ; 0 - System to system 3135 <1> ; 1 - User to system 3136 <1> ; 2 - System to user 3137 <1> ; 3 - Exhange (Swap) - 28/01/2021 3138 <1> ; Bits 2, Transfer Type 3139 <1> ; 0 - Display page (complete) transfer 3140 <1> ; 1 - Display page window (col,row) transfer 3141 <1> ; ; 28/01/2021 3142 <1> ; Bits 3..7 - Reserved, undefined (must be 0) 3143 <1> ; ; 28/01/2021 3144 <1> ; /// BL = 0 -> System to system (display page) transfer 3145 <1> ; CL = Source page (0FFh = current video page) 3146 <1> ; DL = Destination page (0FFh = current video page) 3147 <1> ; (Note: Nothing to do if src & dest are same page) 3148 <1> ; /// BL = 1&2 -> user to system & system to user transfer 3149 <1> ; ECX = User's buffer address 3150 <1> ; DL = Video page (0FFh = current video page) 3151 <1> ; /// BL = 3 -> exchange (swap) display page ; 28/01/2021 3152 <1> ; ECX = User's buffer address 3153 <1> ; DL = Video page (0FFh = current video page) 3154 <1> ; EDI = Swap address in user's memory (must be > 0) 3155 <1> ; /// BL = 5&6&7 -> user to system, system to user transfer 3156 <1> ; (system window is in current/active display page) 3157 <1> ; ESI = User's buffer address 3158 <1> ; ECX Low 16 bits = Top left column (X1 position) 3159 <1> ; ECX High 16 bits = Top row (Y1 position) 3160 <1> ; EDX Low 16 bits = Bottom right column (X2 position) 3161 <1> ; EDX High 16 bits = Bottom row (Y2 position) 3162 <1> ; If BL = 5 or BL bit 0 & bit 1 are 1 ; 28/01/2021 3163 <1> ; EDI = Swap address (in user's memory space) 3164 <1> ; (If swap address > 0, previous content of the window 3165 <1> ; will be saved into swap area in user's memory space) 3166 <1> ; /// BL = 4 -> system to system transfer 3167 <1> ; ESI = System's source buffer (video page) address 3168 <1> ; ECX Low 16 bits = Top left column (X1 position) 3169 <1> ; ECX High 16 bits = Top row (Y1 position) 3170 <1> ; EDX Low 16 bits = Bottom right column (X2 position) 3171 <1> ; EDX High 16 bits = Bottom row (Y2 position) 3172 <1> ; EDI = System's destination buffer (video page) addr 3173 <1> ; 3174 <1> ; ; 06/02/2021 3175 <1> ; ; 05/02/2021 3176 <1> ; ; 01/02/2021, 02/02/2021 3177 <1> ; ; 30/01/2021, 31/02/2021 3178 <1> ; ; 29/01/2021 (major modification) 3179 <1> ; ; 23/11/2020 (major modification) 3180 <1> ; ; 22/11/2020 (bugfixes and extensions) 3181 <1> ; BH = 1 = VGA Graphics (0A0000h) data transfers 3182 <1> ; BL bit 7 3183 <1> ; resolution (screen width) option 3184 <1> ; 0 = 320 pixels 3185 <1> ; 1 = 640 pixels 3186 <1> ; .. followings are same with SVGA transfer function 3187 <1> ; BL bit 6 3188 <1> ; direction option 3189 <1> ; 0 = user to system (video memory) 3190 <1> ; 1 = system to user 3191 <1> ; BL bit 5 3192 <1> ; masked/direct (non-masked) operations 3193 <1> ; 1 = masked, 0 = non-masked (direct) 3194 <1> ; BL bit 4 3195 <1> ; page/window option 3196 <1> ; 1 = window, 0 = display page (screen) 3197 <1> ; BL bit 0 to 3 (pixel operation types) 3198 <1> ; 0 = Copy pixels (colors) ((mask color)) 3199 <1> ; 1 = Change (New, Fill) color 3200 <1> ; 2 = Add color 3201 <1> ; 3 = Sub color 3202 <1> ; 4 = OR color 3203 <1> ; 5 = AND color 3204 <1> ; 6 = XOR color 3205 <1> ; 7 = NOT color 3206 <1> ; 8 = NEG color 3207 <1> ; 9 = INC color 3208 <1> ; 10 = DEC color 3209 <1> ; 11 = Mix (Average) colors 3210 <1> ; 12 = Replace pixel colors 3211 <1> ; 13 = Copy pixel block(s) 3212 <1> ; 14 = Write line(s) 3213 <1> ; 15 = Write character (font) 3214 <1> ; 3215 <1> ; Input Registers for pixel operations: 3216 <1> ; Same with LFB data transfer function below 3217 <1> ; 3218 <1> ; ; 25/02/2021 3219 <1> ; ; 05/02/2021, 06/02/2021 3220 <1> ; ; 01/02/2021, 02/02/2021 3221 <1> ; ; 30/01/2021, 31/02/2021 3222 <1> ; ; 29/01/2021 (major modification) 3223 <1> ; ; 23/11/2020 (major modification) 3224 <1> ; ; 22/11/2020 (bugfixes and extensions) 3225 <1> ; BH = 2 = Super VGA, LINEAR FRAME BUFFER data transfers 3226 <1> ; BL bit 7 3227 <1> ; unused (invalid), must be 0 3228 <1> ; BL bit 6 3229 <1> ; direction option 3230 <1> ; 0 = user to system (video memory) 3231 <1> ; 1 = system to user 3232 <1> ; BL bit 5 3233 <1> ; masked/direct (non-masked) operations 3234 <1> ; 1 = masked, 0 = non-masked (direct) 3235 <1> ; BL bit 4 3236 <1> ; page/window option 3237 <1> ; 1 = window, 0 = display page (screen) 3238 <1> ; BL bit 0 to 3 (pixel operation types) 3239 <1> ; 0 = Copy pixels (colors) ((mask color)) 3240 <1> ; 1 = Change (New, Fill) color 3241 <1> ; 2 = Add color 3242 <1> ; 3 = Sub color 3243 <1> ; 4 = OR color 3244 <1> ; 5 = AND color 3245 <1> ; 6 = XOR color 3246 <1> ; 7 = NOT color 3247 <1> ; 8 = NEG color 3248 <1> ; 9 = INC color 3249 <1> ; 10 = DEC color 3250 <1> ; 11 = Mix (Average) colors 3251 <1> ; 12 = Replace pixel colors 3252 <1> ; 13 = Copy pixel block(s) 3253 <1> ; 14 = Write line(s) 3254 <1> ; 15 = Write character (font) 3255 <1> ; 3256 <1> ; Note: If HW of EBX > 0, it is VESA VBE mode number 3257 <1> ; otherwise, function will be applied 3258 <1> ; to current (VESA VBE) video mode. 3259 <1> ; 3260 <1> ; Input Registers for pixel operations: 3261 <1> ; -- user to system & system to system -- 3262 <1> ; -- (BL = 0 to 0Fh) -- non-masked, screen -- 3263 <1> ; -- (BL = 10h to 1Fh) -- non-masked, window -- 3264 <1> ; -- (BL = 20h to 2Fh) -- masked, screen -- 3265 <1> ; -- (BL = 30h to 3Fh) -- masked, window -- 3266 <1> ; (*) window, (**) masked (***) sys to sys 3267 <1> ; for BL bit 0 to 3 3268 <1> ; 00h: COPY PIXELS 3269 <1> ; If BL bit 4 = 0 ; 21/02/2021 3270 <1> ; full screen copy 3271 <1> ; ECX & EDX will not be used 3272 <1> ; (user buffer must fit to display page) 3273 <1> ; If BL bit 4 = 1 ; 21/02/2021 3274 <1> ; ECX = start position (row, column) (*) 3275 <1> ; (HW = row, CX = column) 3276 <1> ; EDX = size (rows, colums) (*) 3277 <1> ; (HW = rows, DX = columns) 3278 <1> ; (0 -> invalid) 3279 <1> ; (1 -> horizontal or vertical line) 3280 <1> ; ESI = user's buffer address 3281 <1> ; EDI = mask color (**) ; 25/02/2021 3282 <1> ; (this color will be excluded) 3283 <1> ; 01h: CHANGE PIXEL COLORS 3284 <1> ; 02h: ADD PIXEL COLORS 3285 <1> ; 03h: SUB PIXEL COLORS 3286 <1> ; 04h: OR PIXEL COLORS 3287 <1> ; 05h: AND PIXEL COLORS 3288 <1> ; 06h: XOR PIXEL COLORS 3289 <1> ; 0Bh: MIX PIXEL COLORS 3290 <1> ; CL = color (8 bit, 256 colors) 3291 <1> ; ECX = color (16 bit and true colors) 3292 <1> ; EDX = start position (row, column) (*) 3293 <1> ; (HW = row, DX = column) 3294 <1> ; ESI = size (rows, colums) (*) 3295 <1> ; (HW = rows, SI = columns) 3296 <1> ; EDI = mask color (**) ; 25/02/2021 3297 <1> ; (this color will be excluded) 3298 <1> ; 07h: NOT PIXEL COLORS 3299 <1> ; 08h: NEG PIXEL COLORS 3300 <1> ; 09h: INC PIXEL COLORS 3301 <1> ; 0Ah: DEC PIXEL COLORS 3302 <1> ; ECX = start position (row, column) (*) 3303 <1> ; (HW = row, CX = column) 3304 <1> ; EDX = size (rows, colums) (*) 3305 <1> ; (HW = rows, DX = columns) 3306 <1> ; (0 -> invalid) 3307 <1> ; (1 -> horizontal or vertical line) 3308 <1> ; EDI = mask color (**) ; 25/02/2021 3309 <1> ; (this color will be excluded) 3310 <1> ; 0Ch: REPLACE PIXEL COLORS 3311 <1> ; CL = current color (8 bit, 256 colors) 3312 <1> ; ECX = current color (16 bit and true colors) 3313 <1> ; DL = new color (8 bit, 256 colors) 3314 <1> ; EDX = new color (16 bit and true colors) 3315 <1> ; ESI = start position (row, column) (*) 3316 <1> ; (HW = row, SI = column) 3317 <1> ; EDI = size (rows, colums) (*) 3318 <1> ; (HW = rows, DI = columns) 3319 <1> ; 0Dh: COPY PIXEL BLOCK(S) -full screen- 3320 <1> ; -If BL bit 5 is 0- 3321 <1> ; ECX = start position (row, column) (*) 3322 <1> ; (HW = row, CX = column) 3323 <1> ; EDX = size (rows, colums) (*) 3324 <1> ; (HW = rows, DX = columns) 3325 <1> ; (0 -> invalid) 3326 <1> ; (1 -> horizontal or vertical line) 3327 <1> ; ESI = destination (row, column) (***) 3328 <1> ; -If BL bit 5 is 1- 3329 <1> ; CL = color (8 bit, 256 colors) 3330 <1> ; ECX = color (16 bit and true colors) 3331 <1> ; EDX = count of blocks (not bytes) 3332 <1> ; (limit: 2048 blocks) 3333 <1> ; ESI = user's buffer address 3334 <1> ; contains 64 bits block data 3335 <1> ; BLOCK ADDRESS - (row, col), dword 3336 <1> ; (first 32 bits) 3337 <1> ; BLOCK SIZE - (rows, cols), dword 3338 <1> ; (second 32 bits) 3339 <1> ; ; 10/02/2021 3340 <1> ; 0Eh: WRITE LINE(s) -full screen- 3341 <1> ; -If BL bit 5 is 0- 3342 <1> ; CL = color (8 bit, 256 colors) 3343 <1> ; ECX = color (16 bit and true colors) 3344 <1> ; DX = low 12 bits - size (length) 3345 <1> ; high 4 bits - direction or type 3346 <1> ; 0 - Horizontal line 3347 <1> ; 1 - Vertical line 3348 <1> ; > 1 - undefined, invalid 3349 <1> ; ESI = start position (row, column) 3350 <1> ; (HW = row, SI = column) 3351 <1> ; -If BL bit 5 is 1- 3352 <1> ; CL = color (8 bit, 256 colors) 3353 <1> ; ECX = color (16 bit and true colors) 3354 <1> ; DX = number of lines (in user buffer) 3355 <1> ; (limit: 2048 lines) 3356 <1> ; ESI = user's buffer 3357 <1> ; contains 64 bit data for lines 3358 <1> ; START POINT: 32 bit (row, col) 3359 <1> ; LENGTH: 32 bit 3360 <1> ; high 16 bits - 0 3361 <1> ; bit 0-11 - length 3362 <1> ; bit 12-15 - type (length) 3363 <1> ; 0Fh: WRITE CHARACTER (FONT) 3364 <1> ; CL = char's color (8 bit, 256 colors) 3365 <1> ; ECX = char's color (16 bit and true colors) 3366 <1> ; DL = Character's ASCII code 3367 <1> ; DH bit 0 -> font height 3368 <1> ; 0 -> 8x16 character font 3369 <1> ; 1 -> 8x8 character font 3370 <1> ; DH bit 1 & 2 -> scale 3371 <1> ; 0 = 1/1 (8 pixels per char row) 3372 <1> ; 1 = 2/1 (16 pixels per char row) 3373 <1> ; 2 = 3/1 (24 pixels per char row) 3374 <1> ; 3 = 4/1 (32 pixels per char row) 3375 <1> ; DH bit 6 -> [ufont] option (1 = use [ufont]) 3376 <1> ; If DH bit 7 = 1 3377 <1> ; USER FONT (from user buffer) 3378 <1> ; DL = 0 -> 8x8 (width: 1 byte per row) 3379 <1> ; DL = 1 -> 8x16 3380 <1> ; DL = 2 -> 16x16 (width: 2 bytes) 3381 <1> ; DL = 3 -> 16x32 3382 <1> ; DL = 4 -> 24x24 (width: 3 bytes) 3383 <1> ; DL = 5 -> 24x48 3384 <1> ; DL = 6 -> 32x32 (width: 4 bytes) 3385 <1> ; DL = 7 -> 32x64 3386 <1> ; DL > 7 -> invalid (unused) 3387 <1> ; EDI = user's font buffer address 3388 <1> ; (NOTE: byte order is as row0,row1,row2..) 3389 <1> ; ESI = start position (row, column) (*) 3390 <1> ; (HW = row, SI = column) 3391 <1> ; 3392 <1> ; -- system to user -- 3393 <1> ; BL (bit 0 to 7) 3394 <1> ; 40h: COPY PIXELS (full screen, display page) 3395 <1> ; EDI = user's buffer address 3396 <1> ; 41h: COPY PIXELS (window) 3397 <1> ; ECX = start position (row, column) (*) 3398 <1> ; (HW = row, CX = column) 3399 <1> ; EDX = size (rows, colums) (*) 3400 <1> ; (HW = rows, DX = columns) 3401 <1> ; (<=1 -> horizontal or vertical line) 3402 <1> ; EDI = user's buffer address 3403 <1> ; 3404 <1> ; Example: (29/01/2021) 3405 <1> ; ecx = 00400064h (start at row 64, column 100) 3406 <1> ; edx = 00320048h (size: 50 rows, 72 columns) 3407 <1> ; (end at row 114, column 172) 3408 <1> ; If video memory starts at 0A0000h 3409 <1> ; and if resolution is 320x200 (256 colors) .. 3410 <1> ; window start offset: (64*320)+100 = 20580 3411 <1> ; window size: 16072 bytes (pixels) 3412 <1> ; window end offset: 20580+16072 = 36652 3413 <1> ; window start address: 0A0000h+564h = 0A5064h 3414 <1> ; Outputs: 3415 <1> ; EAX = transfer/byte count 3416 <1> ; 3417 <1> ; NOTE: If the source or destination address passes out of 3418 <1> ; video pages (display memory limits), data will not be transferred 3419 <1> ; and EAX will return as 0. 3420 <1> ; 3421 <1> ; 08/02/2021 3422 <1> ; 07/02/2021 3423 <1> ; 04/01/2021 3424 <1> ; PIXEL READ/WRITE (in current/active video mode) 3425 <1> ; 3426 <1> ; BH = 3 = Read/Write pixel(s) -for all graphics modes- 3427 <1> ; BL = 3428 <1> ; 0 = Read pixel 3429 <1> ; 1 = Write pixel 3430 <1> ; 2 = swap pixel colors 3431 <1> ; 3 = mix pixel colors 3432 <1> ; 29/01/2021 3433 <1> ; 4 = read pixels from user defined positions 3434 <1> ; 5 = write single color pixels to user defined positions 3435 <1> ; 6 = write multi color pixels to user defined positions 3436 <1> ; 3437 <1> ; > 6 = invalid/unimplemented 3438 <1> ; 3439 <1> ; .. for BL = 0 to 5 3440 <1> ; CL = color for writing pixel(s) or 3441 <1> ; ECX = color for writing pixel(s) in true color modes 3442 <1> ; 3443 <1> ; EDX = Offset from start of video memory (0A0000h) 3444 <1> ; or start of linear frame buffer 3445 <1> ; 3446 <1> ; 07/02/2021 3447 <1> ; .. for BL = 4 3448 <1> ; EDI = user's destination buffer address for pixel colors 3449 <1> ; 29/01/2021 3450 <1> ; .. for BL = 4 & 5 3451 <1> ; ESI = user's source buffer address for BL = 4 & 5 3452 <1> ; (buffer contains dword offset positions for pixels) 3453 <1> ; EDX = number of pixels 3454 <1> ; .. for BL = 6 3455 <1> ; ESI = user's buffer address for BL = 6 3456 <1> ; (buffer contains dword offset position and dword color 3457 <1> ; value for each pixel) 3458 <1> ; EDX = number of pixels 3459 <1> ; 3460 <1> ; Note: 3461 <1> ; Pixel read/write will be performed in current video mode. 3462 <1> ; If [CRT_MODE] < 0FFh, 0A0000h will be used 3463 <1> ; as video memory and limit will be 65536 3464 <1> ; (new/mix pixel color will be in CL) 3465 <1> ; if [CRT_MODE] = 0FFh (VESA VBE video mode) 3466 <1> ; LFB base address will be used as video memory 3467 <1> ; and limit will be video page size 3468 <1> ; (new/mix pixel color will be in CL) 3469 <1> ; 3470 <1> ; Outputs: 3471 <1> ; EAX = pixel color (according to BL and ECX input) 3472 <1> ; EAX = 0 (pixel color is 0 or there is an error) 3473 <1> ; (BL will return as 0FFh if there is an error) 3474 <1> ; ; 29/01/2021 3475 <1> ; EAX = number of pixels (for BL input = 4&5&6) 3476 <1> ; 3477 <1> ; DIRECT (STANDARD VGA/CGA) DISPLAY MEMORY ACCESS FUNCTIONS: 3478 <1> ; 3479 <1> ; BH = 4 = CGA direct video memory (0B8000h, 32K) access 3480 <1> ; Page directory & page tables of the user's 3481 <1> ; program will be updated to direct access to 3482 <1> ; 0B8000h (32K) video (CGA, color) memory; if 3483 <1> ; there is not a permission conflict or lock! 3484 <1> ; (User's program/process will have permission to 3485 <1> ; access locked display memory if the owner is 3486 <1> ; it's parent.) 3487 <1> ; 3488 <1> ; Screen width = 320 3489 <1> ; 3490 <1> ; BH = 5 = VGA direct video memory (0A0000h, 64K) access 3491 <1> ; Page directory & page tables of the user's 3492 <1> ; program will be updated to direct access to 3493 <1> ; 0A0000h (64K) video (VGA) memory; if there is not 3494 <1> ; a permission conflict or lock! 3495 <1> ; (User's program/process will have permission to 3496 <1> ; access locked display memory if the owner is 3497 <1> ; it's parent.) 3498 <1> ; 3499 <1> ; ; 23/11/2020 3500 <1> ; Screen width options = 320, 640, 800 3501 <1> ; 3502 <1> ; Outputs: 3503 <1> ; EAX = Display memory address for direct access 3504 <1> ; 0A0000h for VGA, 0B8000h for CGA 3505 <1> ; (Display memory size: 32K for CGA, 64K for VGA) 3506 <1> ; EAX = 0 if display page access permission has been denied. 3507 <1> ; (Locked!) 3508 <1> ; 3509 <1> ; LINEAR FRAME BUFFER ACCESS FUNCTIONS: 3510 <1> ; 3511 <1> ; BH = 6 = Linear Frame Buffer direct video memory access 3512 <1> ; 3513 <1> ; Page directory & page tables of the user's 3514 <1> ; program will be updated to direct access to 3515 <1> ; the configured LFB (Linear Frame Buffer) address, 3516 <1> ; if there is not a permission conflict or lock! 3517 <1> ; (User's program/process will have permission to 3518 <1> ; access locked display memory if the owner is 3519 <1> ; it's parent.) 3520 <1> ; 3521 <1> ; ; 10/12/2020 3522 <1> ; BL = 0FFh -> Direct LFB access for current video mode 3523 <1> ; BL = XXh < 0FFh -> Direct LFB access 3524 <1> ; for VESA video mode 1XXh 3525 <1> ; 3526 <1> ; Return: EAX = Linear Frame Buffer address 3527 <1> ; (EAX = 0 -> error) 3528 <1> ; If EAX > 0 3529 <1> ; EDX = Frame Buffer Size in bytes 3530 <1> ; BH = Requested Video Mode - 100h 3531 <1> ; (VESA VBE video modes) 3532 <1> ; BL = bits per pixel 3533 <1> ; 8 = 256 colors, 8 3534 <1> ; 16 = 65536 colors, 5-6(G)-5 3535 <1> ; 24 = RGB, 16M colors, 8-8-8 3536 <1> ; 32 = RGB + alpha bytes, 8-8-8-8 3537 <1> ; If BH = 0FFh 3538 <1> ; BL = VGA/CGA video mode (also EAX = 0) 3539 <1> ; 3540 <1> ; ** Function will return with EAX = 0 if the mode 3541 <1> ; is not a valid VESA VBE video mode as 1??h ** 3542 <1> ; 3543 <1> ; ECX = Pixel resolution 3544 <1> ; CX = Width (320, 640, 800, 1024, 1366, 1920) 3545 <1> ; High 16 bits of ECX = Height 3546 <1> ; 3547 <1> ; 23/11/2020 3548 <1> ; *** GET VIDEO MODE & LINEAR FRAME BUFFER INFO 3549 <1> ; (This function -7- also is used for VGA and CGA modes) 3550 <1> ; 3551 <1> ; BH = 7 = Get Linear Frame Buffer info 3552 <1> ; 3553 <1> ; ; 22/01/2021 3554 <1> ; ; 10/12/2020 3555 <1> ; BL = any -not used- (22/01/2021) 3556 <1> ; 3557 <1> ; Return: 3558 <1> ; EAX = Frame Buffer Address (0 = is not in use) 3559 <1> ; EDX = Frame Buffer Size in bytes 3560 <1> ; BH = Current Video Mode - 100h ; 22/01/2021 3561 <1> ; (VESA VBE video modes) 3562 <1> ; BL = bits per pixel 3563 <1> ; 8 = 256 colors, 8 3564 <1> ; 16 = 65536 colors, 5-6(G)-5 3565 <1> ; 24 = RGB, 16M colors, 8-8-8 3566 <1> ; 32 = RGB + alpha bytes, 8-8-8-8 3567 <1> ; If BH = 0FFh 3568 <1> ; BL = VGA/CGA video mode (also EAX = 0) 3569 <1> ; 3570 <1> ; Note: 3571 <1> ; Alpha byte will be used as virtual color index. 3572 <1> ; (32 bit pixel colors.. byte 0,1,2 rgb and 3 alpha) 3573 <1> ; 3574 <1> ; ** Function will return with EAX = 0 if the mode 3575 <1> ; is not a valid VESA VBE video mode as 1??h ** 3576 <1> ; 3577 <1> ; ECX = Pixel resolution 3578 <1> ; CX = Width (320, 640, 800, 1024, 1366, 1920) 3579 <1> ; High 16 bits of ECX = Height 3580 <1> ; 3581 <1> ; NOTE: Each process will have it's own frame buffer 3582 <1> ; address and resolution parameters in 'u' area. 3583 <1> ; Then, if the current frame buffer & resolution 3584 <1> ; is different, frame buffer r/w functions 3585 <1> ; will use scale factor to convert process's 3586 <1> ; pixel coordinates to actual screen coordinates. 3587 <1> ; resolution -> dimensional scale 3588 <1> ; color size -> color scale 3589 <1> ; * RGB (TRUE) colors to 256 colors conversion: 3590 <1> ; TRUE Colors -> 8,8,8 (R,G,B; byte 0 is R) 3591 <1> ; 256 colors -> 2,2,2,2 (R,G,B,L; bit 0&1 is R) 3592 <1> ; bit 6&7 -> luminosity base level (0,1,2,3) 3593 <1> ; bit 4&5 -> blue level (0,1,2,3) 3594 <1> ; bit 2%3 -> green level (0,1,2,3) 3595 <1> ; bit 0&1 -> red level (0,1,2,3) 3596 <1> ; Example: total red level : luminosity + red level 3597 <1> ; Luminosity base level: 0 -> 16 3598 <1> ; 1 -> 32 3599 <1> ; 2 -> 64 3600 <1> ; 3 -> 128 3601 <1> ; Color level: 3602 <1> ; 0 -> 0 3603 <1> ; 1 -> luminosity level 3604 <1> ; 2 -> luminosity level + 64 3605 <1> ; 3 -> 255 3606 <1> ; Luminosity base level = min (R,G,B) 3607 <1> ; if it is <16, it will be set to 16 3608 <1> ; Color levels: Color values are fixed to (nearest) 3609 <1> ; one of all possible set level (step) values 3610 <1> ; (according to luminosity base level); then 3611 <1> ; color levels are set to R-L, G-L, B-L. 3612 <1> ; For example: If luminosity base level is 32 3613 <1> ; all possible set values are 0, 32, 96, 255. 3614 <1> ; 3615 <1> ; * RGB (TRUE) colors to 16 colors conversion: 3616 <1> ; 16 colors: R,B,G,L bits (4 bits) 3617 <1> ; If any one of R,G,B >= 128 L = 1 3618 <1> ; If max. value of (R,G,B) >= 32, it is 1 3619 <1> ; else all color bits (R&G&B&L) are 0 3620 <1> ; If the second value >= max. value / 2 3621 <1> ; it is 1 3622 <1> ; If the third value >= max. value / 2 3623 <1> ; it is 1 3624 <1> ; Example: R = 132, G = 64, B = 78 3625 <1> ; L = 1, R = 1 3626 <1> ; G < 66 --> G = 0 3627 <1> ; B >= 66 --> B = 1 3628 <1> ; 3629 <1> ; 10/12/2020 3630 <1> ; SET VIDEO MODE (& RETURN LFB INFO for VESA VBE VIDEO MODES) 3631 <1> ; 3632 <1> ; BH = 8 = Set Video Mode 3633 <1> ; 3634 <1> ; BL = Requested Video Mode (method) 3635 <1> ; If BL = 0FFh 3636 <1> ; CX = VESA VBE Video Mode 3637 <1> ; ; 11/12/2020 3638 <1> ; If EDX > 0 -> LFB INFO (user) buffer addr 3639 <1> ; If BL < 0FFh, it is VGA/CGA video mode and 3640 <1> ; CX & EDX will not be used 3641 <1> ; 3642 <1> ; NOTE: The last VESA VBE video mode is 11Bh but 3643 <1> ; TRDOS 386 will permit to set video mode upto 11Fh. 3644 <1> ; Above 11Fh, from 140h to 1FEh, it will be accepted 3645 <1> ; as Bochs/Plex86 emulator video mode and it will be 3646 <1> ; used only if [vbe3] = 2 and detected 3647 <1> ; video bios is BOCHS/PLEX86/QEMU/VIRTUALBOX vbios. 3648 <1> ; 3649 <1> ; Outputs: 3650 <1> ; EAX = Requested (Proper) video mode number + 1 3651 <1> ; ("dec eax" by user will give requested video mode), 3652 <1> ; 3653 <1> ; If BL input is 0FFh 3654 <1> ; EDX = LFBINFO table/structure (in user's buffer addr) 3655 <1> ; EDX = 0 -> Invalid LFBINFO (do not use it) 3656 <1> ; 3657 <1> ; EAX = 0 -> Error (but EDX will not be changed) 3658 <1> ; 3659 <1> ; 03/12/2020 3660 <1> ; VESA VBE3 VIDEO BIOS (32 bit) PROTECTED MODE INTERFACE SETTINGS 3661 <1> ; 3662 <1> ; BH = 9 = set/get VBE3 Protected Mode Interface parameters 3663 <1> ; 3664 <1> ; BL = 0 - Disable protected mode interface 3665 <1> ; ([pmi32] = 0) 3666 <1> ; Return: AL = 1 3667 <1> ; BL = 1 - Enable protected mode Interface 3668 <1> ; ([pmi32] = 1) 3669 <1> ; Return: AL = 2 3670 <1> ; BL = 2 - Get protected mode interface status 3671 <1> ; Return: AL = [pmi32] + 1 (AL = 1 or 2) 3672 <1> ; 3673 <1> ; If [vbe3] <> 3 --> AL = 0 3674 <1> ; 3675 <1> ; ; 17/01/2021 3676 <1> ; BL = 3 - Disable/Cancel restore permission to user 3677 <1> ; Return: AL = 1 (if disabled) or 0 3678 <1> ; BL = 4 - Enable/Give restore permission to user 3679 <1> ; Return: AL = 2 (if enabled) or 0 3680 <1> ; BL = 5 - Get video state save/restore status 3681 <1> ; (permission status) 3682 <1> ; Return: AL = Status (enabled = 1) 3683 <1> ; ; 22/01/2021 3684 <1> ; AH = state options ([srvso]) 3685 <1> ; BL = 6 - Return VESA VBE number/status 3686 <1> ; Return: AX = status 3687 <1> ; if AH = 2, AL > 0 : Emulator 3688 <1> ; AH = 3, VESA VBE3 video bios 3689 <1> ; ; 28/02/2021 3690 <1> ; BL = 7 - Set true color mode as 32bpp (default) 3691 <1> ; Return: AX = 32 (if VBE3) 3692 <1> ; NOTE: Initial/default value is 32bpp for vbe3. 3693 <1> ; Return: AX = 0 -> error 3694 <1> ; BL = 8 - Set true color mode as 24bpp (default) 3695 <1> ; Return: AX = 24 3696 <1> ; ;Return: AX = 0 -> error 3697 <1> ; BL = 9 - Return default/current true color mode 3698 <1> ; Return: AX = 32 (32 bpp) 3699 <1> ; Return: AX = 24 (24 bpp) 3700 <1> ; Return: AX = 0 -> error (not VESA bios) 3701 <1> ; 3702 <1> ; BL > 9 : not implemented (28/02/2021) 3703 <1> ; 3704 <1> ; ; 19/01/2021 ([u.uid] check) 3705 <1> ; Note: Enabling/Disabling are done by root ([u.uid] = 0) 3706 <1> ; while [multi_tasking] = 0. 3707 <1> ; 3708 <1> ; 23/12/2020 3709 <1> ; VIDEO MEMORY MAPPING: 3710 <1> ; BH = 10 = Map video memory to user's buffer 3711 <1> ; 3712 <1> ; BL = 0 : CGA memory (0B8000h) map (32K) 3713 <1> ; BL = 1 : VGA memory (0A0000h) map (64K) 3714 <1> ; BL = 2 : SVGA memory (LFB) map to user's buffer 3715 <1> ; 3716 <1> ; ECX = User's buffer addr (low 12 bits will be cleared) 3717 <1> ; EDX = Buffer size in bytes (if BL = 2) 3718 <1> ; (will be trimmed if LFB size < EDX) 3719 <1> ; Return: 3720 <1> ; EAX = physical address of video memory (buffer) 3721 <1> ; EBX = mapped (actual) size of video memory (bytes) 3722 <1> ; ECX = virtual start address of user's video buffer 3723 <1> ; EDX is same with EDX input 3724 <1> ; 3725 <1> ; (Note: Memory page boundaries will be applied 3726 <1> ; to buffer size and buff start addr by rounding down. 3727 <1> ; Rounded size & address values must not be zero.) 3728 <1> ; -Normally, it is expected to request mapping by using 3729 <1> ; correct buffer size of current or desired video mode- 3730 <1> ; 3731 <1> ; EAX = 0 -> error ! memory can not mapped to user 3732 <1> ; 3733 <1> ; 04/01/2021 3734 <1> ; SET/READ COLOR PALETTE (set/read DAC color registers) 3735 <1> ; ((256 colors (8bpp) VGA/CGA video hardware feature)) 3736 <1> ; 3737 <1> ; BH = 11 = Set/Read DAC color registers 3738 <1> ; 3739 <1> ; (BL<4 Original method for std VGA video hardware) 3740 <1> ; BL = 0 : Read all DAC color registers (256 colors) 3741 <1> ; (6 bit colors, in RGB order) 3742 <1> ; BL = 1 : Set all DAC color registers (256 colors) 3743 <1> ; (6 bit colors, in RGB order) 3744 <1> ; BL = 2 : Read single DAC color register 3745 <1> ; (6 bit color, in RGB order) 3746 <1> ; ((EAX will return with color value)) 3747 <1> ; CL = DAC color register (index) 3748 <1> ; BL = 3 : Set/Write single DAC color register 3749 <1> ; (6 bit color, in RGB order, bit 6&7 are 0) 3750 <1> ; ECX byte 0 - DAC color register 3751 <1> ; ECX byte 1 - Red (6 bit) 3752 <1> ; ECX byte 2 - Green (6 bit) 3753 <1> ; ECX byte 3 - Blue (6 bit) 3754 <1> ; (BL>3 Alternative method for BMP files etc.) 3755 <1> ; BL = 4 : Read all DAC color registers (256 colors) 3756 <1> ; (8 bit colors, in BGR order, bit 0&1 is 0) 3757 <1> ; BL = 5 : Set all DAC color registers (256 colors) 3758 <1> ; (8 bit colors, in BGR order, bit 0&1 is 0) 3759 <1> ; BL = 6 : Read single DAC color register 3760 <1> ; (8 bit color, in BGR order, bit 0&1 is 0) 3761 <1> ; ((EAX will return with color value)) 3762 <1> ; CL = DAC color register (index) 3763 <1> ; BL = 7 : Set/Write single DAC color register 3764 <1> ; (8 bit color, bit 0&1 are 0) 3765 <1> ; ECX byte 0 - DAC color register 3766 <1> ; ECX byte 1 - Blue (8 bit) 3767 <1> ; ECX byte 2 - Green (8 bit) 3768 <1> ; ECX byte 3 - Red (8 bit) 3769 <1> ; 3770 <1> ; BL > 7 : invalid (not implemented) 3771 <1> ; 3772 <1> ; if BL bit 2 is 1, 6 bit colors converted to 8 bit colors 3773 <1> ; (low two bits of color bytes will be 0) 3774 <1> ; ((color byte 00111111b will be converted to 11111100b)) 3775 <1> ; and RGB byte order will be 3776 <1> ; byte 0 - Blue (low 2 bits are 0) 3777 <1> ; byte 1 - Green (low 2 bits are 0) 3778 <1> ; byte 2 - Red (low 2 bits are 0) 3779 <1> ; byte 3 - pad (or zero byte) 3780 <1> ; and 256 colors buffer size must be 256*4 = 1024 bytes 3781 <1> ; if BL bit 2 is 0, 6 bit colors will be used directly 3782 <1> ; (high two bits of 8 bit color bytes will be 0) 3783 <1> ; ((dac color 111111b will be converted to 00111111b)) 3784 <1> ; byte 0 - Red (high 2 bits are 0) 3785 <1> ; byte 1 - Green (high 2 bits are 0) 3786 <1> ; byte 2 - Blue (high 2 bits are 0) 3787 <1> ; and 256 colors buffer size must be 256*3 = 768 bytes 3788 <1> ; 3789 <1> ; ECX = User's buffer addr (256*3 = 768 bytes) or 3790 <1> ; Color 3791 <1> ; 3792 <1> ; Return: 3793 <1> ; EAX = buffer size (for BL input = 0,1,4,5) 3794 <1> ; or color value (for BL input = 2,3,6,7) 3795 <1> ; 3796 <1> ; 10/01/2021 3797 <1> ; SET/READ FONT DATA 3798 <1> ; 3799 <1> ; BH = 12 = Set/Read Character Font Data 3800 <1> ; 3801 <1> ; BL = 0 : Disable system font overwrite 3802 <1> ; BL = 1 : Enable system font overwrite 3803 <1> ; BL = 2 : Read system font 8x8 3804 <1> ; BL = 3 : Read system font 8x14 3805 <1> ; BL = 4 : Read system font 8x16 3806 <1> ; BL = 5 : Read user defined font 8x8 3807 <1> ; BL = 6 : Read user defined font 8x16 3808 <1> ; BL = 7 : Write system font 8x8 3809 <1> ; BL = 8 : Write system font 8x14 3810 <1> ; BL = 9 : Write system font 8x16 3811 <1> ; BL = 10 : Write user defined font 8x8 3812 <1> ; BL = 11 : Write user defined font 8x16 3813 <1> ; 3814 <1> ; BL > 11 : invalid (not implemented) 3815 <1> ; 3816 <1> ; For BL = 1 to 11 3817 <1> ; ECX = number of characters (<= 256) 3818 <1> ; EDX = first character (ascii code in DL) 3819 <1> ; ESI = user's buffer address 3820 <1> ; 3821 <1> ; Return: 3822 <1> ; EAX = number of characters (ecx input) 3823 <1> ; EAX = 0 -> error 3824 <1> ; (EAX = 256 for BL = 0 and 1 if successful) 3825 <1> ; 3826 <1> ; Note: system font overwrite permission will be 3827 <1> ; given if [multi_tasking] = 0 3828 <1> ; and [u.uid] = 0 (BL = 1) ; 19/01/2021 3829 <1> ; and if [ufont] bit 7 is 1 (BL = 7,8,9) 3830 <1> ; 3831 <1> ; 18/01/2021 3832 <1> ; SAVE/RESTORE STANDARD VGA VIDEO STATE 3833 <1> ; 3834 <1> ; BH = 13 = Save/Restore std VGA video state 3835 <1> ; 3836 <1> ; BL = 0 : Save VGA state (without DAC regs) 3837 <1> ; Return: EAX = VideoStateID (>0) 3838 <1> ; EAX = 0 (failed!) 3839 <1> ; (size: 110 bytes for TRDOS 386 v2.0.3) 3840 <1> ; BL = 1 : Restore VGA state (without DAC regs) 3841 <1> ; ECX = VideoStateID (to be verified) 3842 <1> ; Return: EAX = Restore size (>0) 3843 <1> ; BL = 2 : Save VGA state (complete) 3844 <1> ; Return: EAX = VideoStateID (>0) 3845 <1> ; EAX = 0 (failed!) 3846 <1> ; (size: 882 bytes for TRDOS 386 v2.0.3) 3847 <1> ; BL = 3 : Restore VGA state (complete) 3848 <1> ; ECX = VideoStateID (to be verified) 3849 <1> ; Return: EAX = Restore size (>0) 3850 <1> ; 3851 <1> ; * Above options are for saving 3852 <1> ; * video state to system memory 3853 <1> ; * (location: VBE3VIDEOSTATE, 2048 bytes) 3854 <1> ; 3855 <1> ; BL = 4 : Save VGA state (without DAC regs) 3856 <1> ; ECX = buffer address 3857 <1> ; Return: EAX = transfer count 3858 <1> ; (size: 110 bytes for TRDOS 386 v2.0.3) 3859 <1> ; ECX = buffer address 3860 <1> ; BL = 5 : Restore VGA state (without DAC regs) 3861 <1> ; ECX = buffer address 3862 <1> ; Return: EAX = transfer count 3863 <1> ; BL = 6 : Save VGA state (complete) 3864 <1> ; ECX = buffer address 3865 <1> ; Return: EAX = transfer count 3866 <1> ; (size: 882 bytes for TRDOS 386 v2.0.3) 3867 <1> ; BL = 7 : Restore VGA state (complete) 3868 <1> ; ECX = buffer address 3869 <1> ; Return: EAX = transfer count 3870 <1> ; 3871 <1> ; * Above options are for saving 3872 <1> ; * video state to user's buffer 3873 <1> ; * (buffer size: 110 bytes or 882 bytes) 3874 <1> ; 3875 <1> ; BL > 7 : invalid (not implemented) 3876 <1> ; 3877 <1> ; 18/01/2021 3878 <1> ; SAVE/RESTORE SUPER VGA (VESA VBE 2/3) VIDEO STATE 3879 <1> ; 3880 <1> ; BH = 14 = Save/Restore SVGA video state 3881 <1> ; 3882 <1> ; BL = options 3883 <1> ; bit 0 - Save (0) or Restore (1) 3884 <1> ; bit 1 - controller hardware state 3885 <1> ; bit 2 - BIOS data state 3886 <1> ; bit 3 - DAC state 3887 <1> ; bit 4 - (extended) Register state 3888 <1> ; bit 5 - system (0) or user (1) memory 3889 <1> ; bit 6 - verify without transfer 3890 <1> ; bit 7 - not used (must be 0) 3891 <1> ; 3892 <1> ; if bit 0 = 0 and bit 5 = 0 3893 <1> ; Return: EAX = VideoStateID (>0) 3894 <1> ; if bit 0 = 1 3895 <1> ; ECX = VideoStateID (bit 5 = 0) 3896 <1> ; Return: EAX = restore (transfer) size 3897 <1> ; if bit 5 = 1 3898 <1> ; ECX = Buffer address 3899 <1> ; Return: EAX = transfer count (size) 3900 <1> ; 3901 <1> ; ECX = Buffer address or VideoStateID 3902 <1> ; 3903 <1> ; BL > 127 : invalid (not implemented) 3904 <1> ; 3905 <1> ; Note: Required buffer size may be > 2048 bytes 3906 <1> ; (function fails when buff size > 2048 bytes) 3907 <1> ; proper option must be used 3908 <1> ; 3909 <1> ; 18/01/2021 3910 <1> ; READ VESA EDID (EXTENDED DISPLAY IDENTIFICATION DATA) 3911 <1> ; 3912 <1> ; BH = 15 = Read VESA EDID for connected monitor 3913 <1> ; (copy EDID to user) 3914 <1> ; 3915 <1> ; BL = any 3916 <1> ; 3917 <1> ; Input: 3918 <1> ; ECX = user's (EDID) buffer address 3919 <1> ; (buffer size: 128 bytes) 3920 <1> ; Output: 3921 <1> ; EAX = 128 (EDID size) 3922 <1> ; or EAX = 0 -> Error! 3923 <1> ; (EDID not ready or buffer addr error) 3924 <1> ; 3925 <1> 3926 <1> ; 16/05/2016 3927 0000D3DB 31C0 <1> xor eax, eax 3928 0000D3DD A3[6C8E0100] <1> mov [u.r0], eax 3929 0000D3E2 20FF <1> and bh, bh 3930 <1> ;jnz sysvideo_13 ; 11/07/2016 3931 <1> ; 23/07/2022 3932 0000D3E4 7405 <1> jz short sysvideo_40 3933 0000D3E6 E974020000 <1> jmp sysvideo_13 3934 <1> 3935 <1> sysvideo_40: ; 23/07/2022 3936 <1> ;; 21/11/2020 (TRDOS 386 v2.0.3) 3937 <1> ;; tty/text mode transfers are only for video mode 3 3938 <1> 3939 <1> ; 22/11/2020 3940 <1> ;cmp byte [CRT_MODE], 3 ; 80x25 text, 16 colors 3941 <1> ;jne sysret ; invalid (nothing to do), [u.r0] = 0 3942 <1> 3943 <1> ; 23/11/2020 3944 <1> ; bit 7,6,5,4 of BL are reserved and it must be 0 3945 <1> ; for current 'sysvideo' version 3946 <1> ;test bl, 0F0h 3947 <1> ;;jnz sysret ; invalid (undefined) ! 3948 <1> ;; 28/01/2021 3949 <1> ;jnz short sysvideo_1_2 ; invalid (undefined) ! 3950 <1> ; 28/01/2021 3951 0000D3EB 80FB07 <1> cmp bl, 7 3952 0000D3EE 776E <1> ja short sysvideo_1_2 ; invalid (undefined) ! 3953 <1> 3954 <1> ; Video mode 0, 80*25 text mode, CGA 16 colors 3955 <1> ; [CRT_MODE] = 3 3956 <1> ;mov bh, bl 3957 <1> ;shr bh, 2 ; 4..7 -> 1, 8..11 -> 2, 12..15 -> 3 3958 <1> ;; 21/11/2020 3959 <1> ;;and bh, bh 3960 <1> ;jnz sysvideo_4 ; Display page window transfer etc. 3961 <1> 3962 <1> ; 28/01/2021 3963 0000D3F0 F6C304 <1> test bl, 4 ; bit 2 3964 <1> ;jnz sysvideo_4 ; Display page window transfer 3965 <1> ; 23/07/2022 3966 0000D3F3 7405 <1> jz short sysvideo_41 3967 0000D3F5 E9A1000000 <1> jmp sysvideo_4 3968 <1> sysvideo_41: ; 23/07/2022 3969 <1> ; Display page (complete) transfer 3970 0000D3FA 80FA07 <1> cmp dl, 7 3971 <1> ;jnz sysret ; invalid (nothing to do), [u.r0] = 0 3972 0000D3FD 760A <1> jna short sysvideo_0 ; 28/01/2021 3973 0000D3FF FEC2 <1> inc dl ; 0FFh -> 0 ("use current video page") 3974 0000D401 755B <1> jnz short sysvideo_1_2 ; invalid 3975 <1> ; dl = 0 -> use current current page 3976 0000D403 8A15[DE760100] <1> mov dl, [ACTIVE_PAGE] 3977 <1> sysvideo_0: 3978 <1> ; 28/01/2021 3979 0000D409 80FB03 <1> cmp bl, 3 3980 0000D40C 7206 <1> jb short sysvideo_0_0 3981 0000D40E 09FF <1> or edi, edi 3982 0000D410 744C <1> jz short sysvideo_1_2 ; invalid 3983 0000D412 89FE <1> mov esi, edi ; save swap/exchange buffer addr 3984 <1> ; ecx = user buffer for new video page content 3985 <1> ; esi = user (swap) buffer for saving current video page 3986 <1> sysvideo_0_0: 3987 0000D414 BF00800B00 <1> mov edi, 0B8000h 3988 <1> ; dl = display page number, destination 3989 0000D419 66B80010 <1> mov ax, 4096 ; 21/11/2020 3990 0000D41D 20D2 <1> and dl, dl 3991 0000D41F 7408 <1> jz short sysvideo_1 3992 <1> ; 07/02/2021 3993 0000D421 88D6 <1> mov dh, dl 3994 <1> sysvideo_0_1: 3995 <1> ; page length = 4096 bytes (but page content is 80*25*2 bytes) 3996 0000D423 01C7 <1> add edi, eax ; 21//11/2020 ([CRT_LEN] = 1000h for mode 3) 3997 0000D425 FECE <1> dec dh 3998 0000D427 75FA <1> jnz short sysvideo_0_1 3999 <1> sysvideo_1: 4000 0000D429 80E303 <1> and bl, 3 4001 0000D42C 7535 <1> jnz short sysvideo_2 ; user to system display page transfer 4002 <1> ; system to system video page (content) transfer 4003 <1> ; cl = display page number, source 4004 0000D42E 80F907 <1> cmp cl, 7 4005 <1> ;ja sysret ; invalid (nothing to do), [u.r0] = 0 4006 0000D431 760A <1> jna short sysvideo_1_0 4007 0000D433 FEC1 <1> inc cl ; 0FFh -> 0 ("use current video page") 4008 0000D435 7527 <1> jnz short sysvideo_1_2 ; invalid 4009 0000D437 8A0D[DE760100] <1> mov cl, [ACTIVE_PAGE] 4010 <1> sysvideo_1_0: 4011 <1> ; 28/01/2021 4012 0000D43D 38D1 <1> cmp cl, dl 4013 0000D43F 741D <1> je short sysvideo_1_2 ; same video page ! 4014 <1> 4015 <1> ; system to system video/display page transfer (mode 0) 4016 <1> ; 21/11/2020 4017 <1> ;mov esi, 0B8000h 4018 <1> ;movzx eax, cl 4019 <1> ;mov edx, 4096 ; [CRT_LEN] = 1000h for video mode 3 4020 <1> ;mov ecx, edx 4021 <1> ;mul edx 4022 <1> ;add esi, eax 4023 <1> ; 28/01/2021 4024 <1> ;movzx esi, cl 4025 <1> ;shl si, 12 ; * 4096 4026 <1> ;add esi, 0B8000h 4027 <1> 4028 <1> ; 28/01/2021 4029 0000D441 A3[6C8E0100] <1> mov [u.r0], eax ; 4096 4030 0000D446 BE00800B00 <1> mov esi, 0B8000h 4031 0000D44B 08C9 <1> or cl, cl 4032 0000D44D 7409 <1> jz short sysvideo_1_1 4033 <1> ; 07/02/2021 4034 <1> ;mov al, cl ; display/video page 4035 <1> ;xor ah, ah 4036 <1> ;shl ax, 12 ; * 4096 4037 <1> ; 23/07/2022 4038 0000D44F 30C0 <1> xor al, al 4039 <1> ;xor eax, eax 4040 0000D451 88CC <1> mov ah, cl ; CL * 256 4041 0000D453 C1E004 <1> shl eax, 4 ; * 16 = CL * 4096 4042 0000D456 01C6 <1> add esi, eax 4043 <1> sysvideo_1_1: 4044 <1> ; 21/11/2020 4045 <1> ;;mov ecx, 4096 4046 <1> ;mov ecx, eax ; 4096 4047 <1> ;;mov [u.r0], ecx ; 4096 bytes 4048 <1> ; 28/01/2021 4049 <1> ;mov [u.r0], cx 4050 0000D458 31C9 <1> xor ecx, ecx 4051 0000D45A B504 <1> mov ch, 4 ; mov ecx, 1024 4052 <1> ;shr cx, 2 ; / 4 4053 0000D45C F3A5 <1> rep movsd 4054 <1> sysvideo_1_2: 4055 0000D45E E92BF6FFFF <1> jmp sysret 4056 <1> sysvideo_2: 4057 0000D463 80FB02 <1> cmp bl, 2 4058 <1> ;ja sysret; invalid (user to user), [u.r0] = 0 4059 <1> ; 28/01/2021 4060 0000D466 7226 <1> jb short sysvideo_3 ; user to system 4061 0000D468 7404 <1> je short sysvideo_2_0 ; system to user 4062 <1> ; bl = 3 4063 0000D46A 89CA <1> mov edx, ecx ; save user's buffer addr 4064 0000D46C 89F1 <1> mov ecx, esi ; save swap address 4065 <1> sysvideo_2_0: 4066 <1> ; bl = 2 (or bl = 3, stage 1) 4067 <1> ; system to user video/display page transfer (mode 0) 4068 0000D46E 89FE <1> mov esi, edi 4069 0000D470 89CF <1> mov edi, ecx ; user buffer ; 28/01/2021 4070 <1> ; 21/11/2020 4071 0000D472 89C1 <1> mov ecx, eax ; 4096 4072 0000D474 E8A2360000 <1> call transfer_to_user_buffer ; fast transfer 4073 <1> ;jc sysret ; [u.r0] = 0 4074 0000D479 72E3 <1> jc short sysvideo_1_2 ; 28/01/2021 4075 <1> ; 28/01/2021 4076 0000D47B 80FB03 <1> cmp bl, 3 4077 0000D47E 7408 <1> je short sysvideo_2_2 4078 <1> sysvideo_2_1: 4079 <1> ; 21/11/2020 4080 0000D480 890D[6C8E0100] <1> mov [u.r0], ecx 4081 <1> ;;mov [u.r0], cx 4082 <1> ;jmp sysret 4083 0000D486 EBD6 <1> jmp short sysvideo_1_2 4084 <1> 4085 <1> sysvideo_2_2: 4086 <1> ; bl = 3 (exchange/swap) complete display page 4087 <1> ; esi = video page start address 4088 <1> ; edx = user's buffer address 4089 <1> 4090 <1> ;mov ecx, 4096 4091 0000D488 89F7 <1> mov edi, esi ; video page start address 4092 0000D48A 89D6 <1> mov esi, edx ; user's (new page) buffer address 4093 0000D48C EB04 <1> jmp short sysvideo_2_3 4094 <1> sysvideo_3: 4095 <1> ; bl = 1 (or bl = 3, stage 2) 4096 <1> ; user to system video/display page transfer (mode 0) 4097 0000D48E 89CE <1> mov esi, ecx ; user buffer 4098 <1> ; edi = video page address 4099 <1> ; 21/11/2020 4100 0000D490 89C1 <1> mov ecx, eax ; 4096 4101 <1> sysvideo_2_3: 4102 0000D492 E8CE360000 <1> call transfer_from_user_buffer ; fast transfer 4103 <1> ;jc sysret ; [u.r0] = 0 4104 0000D497 72C5 <1> jc short sysvideo_1_2 ; 28/01/2021 4105 0000D499 EBE5 <1> jmp short sysvideo_2_1 4106 <1> 4107 <1> ; 21/11/2020 4108 <1> ;mov [u.r0], ecx 4109 <1> ;;mov [u.r0], cx 4110 <1> ;;jmp sysret 4111 <1> ;jmp short sysvideo_1_2 ; 28/01/2021 4112 <1> 4113 <1> sysvideo_4: 4114 <1> ; 23/07/2022 4115 <1> ; 23/11/2020 (TRDOS 386 v2.0.3) 4116 <1> 4117 <1> ; Display page window transfer etc. 4118 0000D49B 80E303 <1> and bl, 3 4119 <1> ;jnz sysvideo_9 ; user to system or system to user 4120 <1> ; 23/07/2022 4121 0000D49E 7405 <1> jz short sysvideo_4_0 4122 0000D4A0 E9E3000000 <1> jmp sysvideo_9 4123 <1> sysvideo_4_0: 4124 <1> ; 21/11/2020 4125 <1> ; system to system video/display page window transfer (mode 0) 4126 0000D4A5 81FE00800B00 <1> cmp esi, 0B8000h ; source buffer address (system) 4127 <1> ;jb sysret 4128 <1> ; 23/07/2022 4129 0000D4AB 7245 <1> jb short sysvideo_4_3 ; jmp sysret 4130 0000D4AD 81FE00000C00 <1> cmp esi, 0B8000h+(4096*8) 4131 <1> ; 23/07/2022 4132 <1> ;jnb sysret 4133 0000D4B3 733D <1> jnb short sysvideo_4_3 ; jmp sysret 4134 0000D4B5 81FF00800B00 <1> cmp edi, 0B8000h ; destination buffer address (system) 4135 <1> ;jb sysret 4136 <1> ; 23/07/2022 4137 0000D4BB 7235 <1> jb short sysvideo_4_3 ; jmp sysret 4138 0000D4BD 81FF00000C00 <1> cmp edi, 0B8000h+(4096*8) 4139 <1> ; 23/07/2022 4140 <1> ;jnb sysret 4141 0000D4C3 732D <1> jnb short sysvideo_4_3 ; jmp sysret 4142 <1> ; 4143 0000D4C5 51 <1> push ecx ; X1 and Y1 position - top left column, row 4144 0000D4C6 0FB7C1 <1> movzx eax, cx ; top left column 4145 <1> ; 21/11/2020 4146 0000D4C9 C1E910 <1> shr ecx, 16 ; top row 4147 0000D4CC 740E <1> jz short sysvideo_4_1 ; bypass following code 4148 0000D4CE 52 <1> push edx ; X2 and Y2 position - bottom right column, row 4149 0000D4CF 50 <1> push eax 4150 0000D4D0 66B8A000 <1> mov ax, 80*2 ; 80 colums, 160 bytes per row 4151 0000D4D4 F7E1 <1> mul ecx 4152 <1> ; eax = offset for start row number 4153 0000D4D6 01C6 <1> add esi, eax 4154 0000D4D8 01C7 <1> add edi, eax 4155 0000D4DA 58 <1> pop eax 4156 0000D4DB 5A <1> pop edx 4157 <1> sysvideo_4_1: 4158 <1> ;shl ax, 1 ; * 2 ; convert start column number to offset 4159 <1> ; 23/07/2022 4160 0000D4DC D1E0 <1> shl eax, 1 4161 0000D4DE 7404 <1> jz short sysvideo_4_2 4162 0000D4E0 01C6 <1> add esi, eax 4163 0000D4E2 01C7 <1> add edi, eax 4164 <1> ; esi = source page window start offset 4165 <1> ; edi = destination page window start offset 4166 <1> sysvideo_4_2: 4167 0000D4E4 59 <1> pop ecx 4168 <1> ;mov eax, 0B8000h+(80*25*2*8) 4169 <1> ; 21/11/2020 4170 0000D4E5 B800000C00 <1> mov eax, 0B8000h+(4096*8) 4171 0000D4EA 39C6 <1> cmp esi, eax 4172 <1> ;jnb sysret ; out of video page 4173 <1> ; 23/07/2022 4174 0000D4EC 7304 <1> jnb short sysvideo_4_3 ; jmp sysret 4175 0000D4EE 39C6 <1> cmp esi, eax 4176 <1> ;jnb sysret ;out of video page 4177 <1> ; 23/07/2022 4178 0000D4F0 7205 <1> jb short sysvideo_4_4 4179 <1> sysvideo_4_3: 4180 0000D4F2 E997F5FFFF <1> jmp sysret 4181 <1> sysvideo_4_4: 4182 0000D4F7 56 <1> push esi ; **** 4183 0000D4F8 57 <1> push edi ; *** 4184 0000D4F9 52 <1> push edx ; ** 4185 0000D4FA 51 <1> push ecx ; * 4186 0000D4FB C1E910 <1> shr ecx, 16 ; top row 4187 0000D4FE C1EA10 <1> shr edx, 16 ; bottom row 4188 <1> ; 21/11/2020 4189 <1> ;cmp ecx, 24 ; max. 25 rows 4190 0000D501 6683F918 <1> cmp cx, 24 4191 0000D505 7778 <1> ja short sysvideo_6 ; invalid, [u.r0] = 0 4192 <1> ;cmp edx, 24 ; max. 25 rows 4193 0000D507 6683FA18 <1> cmp dx, 24 4194 0000D50B 7772 <1> ja short sysvideo_6 ; invalid, [u.r0] = 0 4195 0000D50D 28CA <1> sub dl, cl ; end >= start 4196 0000D50F 726E <1> jc short sysvideo_6 ; invalid, [u.r0] = 0 4197 <1> ; 21/11/2020 4198 0000D511 89D3 <1> mov ebx, edx ; row count - 1 4199 0000D513 7415 <1> jz short sysvideo_4_5 4200 0000D515 50 <1> push eax ; ***** 4201 0000D516 B8A0000000 <1> mov eax, 80*2 ; bytes per row 4202 0000D51B F7E3 <1> mul ebx ; 21/11/2020 4203 <1> ; eax = window end offset 4204 <1> ; (for the last row, before adding column bytes) 4205 0000D51D 01C6 <1> add esi, eax 4206 0000D51F 01C7 <1> add edi, eax 4207 0000D521 58 <1> pop eax ; ***** ; mode 3 video memory end (0C000h) 4208 0000D522 39C6 <1> cmp esi, eax 4209 <1> ;ja short sysvideo_6 ; invalid, [u.r0] = 0 4210 0000D524 7359 <1> jnb short sysvideo_6 ; 21/11/2020 4211 0000D526 39C7 <1> cmp edi, eax 4212 <1> ;ja short sysvideo_6 ; invalid, [u.r0] = 0 4213 0000D528 7355 <1> jnb short sysvideo_6 ; 21/11/2020 4214 <1> sysvideo_4_5: 4215 0000D52A 59 <1> pop ecx ; * 4216 0000D52B 5A <1> pop edx ; ** 4217 0000D52C 81E1FFFF0000 <1> and ecx, 0FFFFh 4218 0000D532 81E2FFFF0000 <1> and edx, 0FFFFh 4219 <1> ; 21/11/2020 4220 <1> ;cmp ecx, 79 ; max. 80 columns 4221 0000D538 6683F94F <1> cmp cx, 79 4222 0000D53C 7743 <1> ja short sysvideo_7 ; invalid, [u.r0] = 0 4223 <1> ;cmp edx, 79 ; max. 80 columns 4224 0000D53E 6683FA4F <1> cmp dx, 79 4225 0000D542 773D <1> ja short sysvideo_7 ; invalid, [u.r0] = 0 4226 0000D544 28CA <1> sub dl, cl 4227 0000D546 7639 <1> jna short sysvideo_7 ; invalid, [u.r0] = 0 4228 <1> ; 21/11/2020 4229 0000D548 740E <1> jz short sysvideo_4_6 4230 <1> ; edx = column count (width) - 1 4231 0000D54A D0E2 <1> shl dl, 1 ; * 2 ; byte offset (in end row) 4232 0000D54C 01D6 <1> add esi, edx 4233 0000D54E 01D7 <1> add edi, edx 4234 <1> ; esi = source page window end offset 4235 <1> ; edi = destination page window end offset 4236 0000D550 39C6 <1> cmp esi, eax ; video memory end 4237 <1> ;ja short sysvideo_7 4238 0000D552 732D <1> jnb short sysvideo_7 ; 21/11/2020 4239 0000D554 39C7 <1> cmp edi, eax ; video memory end 4240 <1> ;ja short sysvideo_7 4241 0000D556 7329 <1> jnb short sysvideo_7 ; 21/11/2020 4242 <1> sysvideo_4_6: 4243 0000D558 5F <1> pop edi ; *** 4244 0000D559 5E <1> pop esi ; **** 4245 0000D55A FEC3 <1> inc bl ; row count - 1 -> row count 4246 0000D55C FEC2 <1> inc dl ; column count 4247 0000D55E 88D7 <1> mov bh, dl 4248 0000D560 D0E2 <1> shl dl, 1 ; convert column count to byte offset 4249 <1> ; 21/11/2020 4250 <1> ; esi = source page window start offset 4251 <1> ; edi = destination page window start offset 4252 0000D562 B8A0000000 <1> mov eax, 80*2 ; bytes per row 4253 <1> ; Note: 160 bytes per row (even if move count < 160) 4254 <1> sysvideo_5: 4255 0000D567 88F9 <1> mov cl, bh ; move/transfer -word- count per row 4256 0000D569 0115[6C8E0100] <1> add [u.r0], edx ; transfer count in bytes 4257 0000D56F 66F3A5 <1> rep movsw 4258 0000D572 01C6 <1> add esi, eax ; + 160 bytes to next row 4259 0000D574 01C7 <1> add edi, eax ; + 160 bytes to next row 4260 0000D576 FECB <1> dec bl ; remain count of rows 4261 0000D578 75ED <1> jnz short sysvideo_5 4262 0000D57A E90FF5FFFF <1> jmp sysret 4263 <1> 4264 <1> sysvideo_6: 4265 0000D57F 59 <1> pop ecx ; * 4266 0000D580 5A <1> pop edx ; ** 4267 <1> sysvideo_7: 4268 0000D581 5F <1> pop edi ; *** 4269 0000D582 5E <1> pop esi ; **** 4270 <1> sysvideo_8: 4271 0000D583 E906F5FFFF <1> jmp sysret 4272 <1> 4273 <1> sysvideo_9: 4274 <1> ; user to system or system to user window transfer 4275 <1> ; 28/01/2021 (bl = 3 -> swap/exchange) 4276 <1> ;cmp bl, 2 4277 <1> ;;ja sysret ; user to user transfer is invalid 4278 <1> ; ; [u.r0] = 0 4279 <1> ;ja short sysvideo_8 ; 26/12/2020 4280 <1> 4281 <1> ; 28/01/2021 4282 0000D588 80FB02 <1> cmp bl, 2 4283 0000D58B 7604 <1> jna short sysvideo_9_8 4284 <1> 4285 <1> ; swap/ exchange video memory and user mem windows 4286 <1> ; edi = swap address in user's memory space 4287 0000D58D 21FF <1> and edi, edi 4288 0000D58F 74F2 <1> jz short sysvideo_8 ; invalid ; 28/01/2021 4289 <1> 4290 <1> sysvideo_9_8: 4291 0000D591 56 <1> push esi ; **** 4292 0000D592 57 <1> push edi ; *** 4293 0000D593 52 <1> push edx ; ** 4294 0000D594 51 <1> push ecx ; * 4295 <1> 4296 0000D595 C1E910 <1> shr ecx, 16 ; top row 4297 0000D598 C1EA10 <1> shr edx, 16 ; bottom row 4298 <1> 4299 <1> ; 21/11/2020 4300 <1> ;cmp ecx, 24 ; max. 25 rows 4301 0000D59B 6683F918 <1> cmp cx, 24 4302 0000D59F 77DE <1> ja short sysvideo_6 ; invalid, [u.r0] = 0 4303 <1> ;cmp edx, 24 ; max. 25 rows 4304 0000D5A1 6683FA18 <1> cmp dx, 24 4305 0000D5A5 77D8 <1> ja short sysvideo_6 ; invalid, [u.r0] = 0 4306 0000D5A7 28CA <1> sub dl, cl 4307 0000D5A9 72D4 <1> jc short sysvideo_6 ; invalid, [u.r0] = 0 4308 <1> 4309 <1> ;mov ch, cl ; top row 4310 <1> ;mov cl, [ACTIVE_PAGE] 4311 <1> 4312 <1> ;mov edi, 80*25*2 ; 4000 4313 <1> ; 21/11/2020 4314 <1> ;mov edi, 4096 ; [CRT_LEN = 4096 for video mode 3 4315 <1> ;shl edi, cl ; ! wrong for page 2 to page 7 ! 4316 <1> ;;add edi, 0B8000h - 80*25*2 4317 <1> ;add edi, 0B8000h - 1000h ; - 4096 4318 <1> 4319 <1> ; 21/11/2020 4320 <1> ;xor eax, eax 4321 <1> ;mov edi, 0B8000h 4322 <1> ;and cl, cl ; is video page = 0 ? 4323 <1> ;jz short sysvideo_9_1 ; yes 4324 <1> ; eax = 0 4325 <1> 4326 <1> ;sysvideo_9_0: 4327 <1> ;add ax, 4096 4328 <1> ;dec cl 4329 <1> ;jnz short sysvideo_9_0 4330 <1> ;add edi, eax 4331 <1> ; ; edi = video page start address 4332 <1> 4333 <1> ; 21/11/2020 4334 0000D5AB BF00800B00 <1> mov edi, 0B8000h 4335 0000D5B0 803D[DE760100]00 <1> cmp byte [ACTIVE_PAGE], 0 4336 0000D5B7 760C <1> jna short sysvideo_9_1 4337 <1> stsvideo_9_0: 4338 0000D5B9 B010 <1> mov al, 16 ; 4096/256 4339 0000D5BB F625[DE760100] <1> mul byte [ACTIVE_PAGE] 4340 0000D5C1 86E0 <1> xchg ah, al ; * 256 4341 0000D5C3 01C7 <1> add edi, eax 4342 <1> ; edi = video page start address 4343 <1> sysvideo_9_1: 4344 <1> ; bl = transfer direction 4345 <1> ; (1 = from user, 2 = to user) 4346 <1> ; (3 = swap) ; 28/01/2021 4347 0000D5C5 88D7 <1> mov bh, dl ; row count - 1 4348 <1> ;mov dl, ch ; top row 4349 <1> ; 21/11/2020 4350 0000D5C7 08C9 <1> or cl, cl ; top row number 4351 0000D5C9 7408 <1> jz short sysvideo_9_2 4352 <1> 4353 <1> ;mov eax, 80*2 4354 0000D5CB 66B8A000 <1> mov ax, 80*2 ; 160, bytes per row 4355 0000D5CF F7E1 <1> mul ecx ; 22/11/2020 4356 0000D5D1 01C7 <1> add edi, eax 4357 <1> ; edi = window start address for top row 4358 <1> sysvideo_9_2: 4359 0000D5D3 59 <1> pop ecx ; * 4360 0000D5D4 5A <1> pop edx ; ** 4361 0000D5D5 81E1FFFF0000 <1> and ecx, 0FFFFh 4362 0000D5DB 81E2FFFF0000 <1> and edx, 0FFFFh 4363 <1> ; 21/11/2020 4364 <1> ;cmp ecx, 79 ; max. 80 columns 4365 0000D5E1 6683F94F <1> cmp cx, 79 4366 0000D5E5 779A <1> ja short sysvideo_7 ; invalid, [u.r0] = 0 4367 <1> ;cmp edx, 79 ; max. 80 columns 4368 0000D5E7 6683FA4F <1> cmp dx, 79 4369 0000D5EB 7794 <1> ja short sysvideo_7 ; invalid, [u.r0] = 0 4370 <1> 4371 0000D5ED 28CA <1> sub dl, cl 4372 0000D5EF 7290 <1> jc short sysvideo_7 ; invalid, [u.r0] = 0 4373 <1> 4374 0000D5F1 08C9 <1> or cl, cl ; left column 4375 0000D5F3 7404 <1> jz short sysvideo_9_3 ; 0 4376 <1> 4377 <1> ; 21/11/2020 4378 0000D5F5 D0E1 <1> shl cl, 1 ; column * 2 4379 0000D5F7 01CF <1> add edi, ecx 4380 <1> ; edi = window start addr for top left column 4381 <1> sysvideo_9_3: 4382 0000D5F9 88D1 <1> mov cl, dl 4383 0000D5FB FEC1 <1> inc cl ; column count 4384 0000D5FD D0E1 <1> shl cl, 1 ; column count * 2 4385 <1> ; ecx = transfer count per row 4386 <1> 4387 0000D5FF 58 <1> pop eax ; *** (swap address) 4388 0000D600 5E <1> pop esi ; **** 4389 <1> 4390 0000D601 FEC7 <1> inc bh ; row count 4391 <1> 4392 <1> ;mov edx, 80*2 4393 0000D603 B2A0 <1> mov dl, 80*2 ; bytes per row 4394 <1> ; 4395 <1> ;cmp bl, 1 ; transfer direction 4396 <1> ;ja short sysvideo_11 ; system to user transfer 4397 <1> ; 28/01/2021 4398 0000D605 F6C301 <1> test bl, 1 4399 0000D608 7439 <1> jz short sysvideo_11 ; system to user transfer 4400 <1> 4401 <1> ; user to system video/display page window transfer (mode 0) 4402 0000D60A 21C0 <1> and eax, eax ; swap address 4403 0000D60C 741B <1> jz short sysvideo_10 ; no window swap 4404 <1> sysvideo_9_7: ; 28/01/2021 4405 <1> ; save previous window content in user's buffer (swap address) 4406 0000D60E 56 <1> push esi ; user buffer 4407 0000D60F 57 <1> push edi ; beginning address of the window 4408 <1> ; 21/11/2020 4409 0000D610 53 <1> push ebx ; save bh 4410 0000D611 89FE <1> mov esi, edi 4411 0000D613 89C7 <1> mov edi, eax 4412 <1> sysvideo_9_4: 4413 0000D615 E801350000 <1> call transfer_to_user_buffer ; fast transfer 4414 0000D61A 7208 <1> jc short sysvideo_9_5 4415 <1> ; ecx = actual transfer count (must be same with input) 4416 0000D61C 01D6 <1> add esi, edx ; next row address of (video page) window 4417 0000D61E 01CF <1> add edi, ecx ; next row address of user's window 4418 <1> ; Note: ecx may be less than row length of video page 4419 <1> ; user's window uses offset according to window width 4420 0000D620 FECF <1> dec bh 4421 0000D622 75F1 <1> jnz short sysvideo_9_4 ; repeat for next row 4422 <1> sysvideo_9_5: 4423 0000D624 5B <1> pop ebx ; restore bh 4424 0000D625 5F <1> pop edi 4425 0000D626 5E <1> pop esi 4426 <1> ;jnc short sysvideo_10 4427 0000D627 7215 <1> jc short sysvideo_9_6 ; 28/01/2021 4428 <1> ;sysvideo_9_6: 4429 <1> ; jmp sysret ; [u.r0] = 0 4430 <1> 4431 <1> sysvideo_10: 4432 <1> ; user to system video/display page window transfer (mode 0) 4433 <1> ; esi = user buffer 4434 0000D629 E837350000 <1> call transfer_from_user_buffer ; fast transfer 4435 <1> ;jc sysret 4436 0000D62E 720E <1> jc short sysvideo_9_6 ; 28/01/2021 4437 <1> ; ecx = actual transfer count (must be same with input) 4438 0000D630 010D[6C8E0100] <1> add [u.r0], ecx ; actual transfer count 4439 0000D636 01D7 <1> add edi, edx ; next row address of (video page) window 4440 0000D638 01CE <1> add esi, ecx ; next row address of user's window 4441 <1> ; Note: ecx may be less than row length of video page 4442 <1> ; user's window uses offset according to window width 4443 0000D63A FECF <1> dec bh 4444 0000D63C 75EB <1> jnz short sysvideo_10 ; repeat for next row 4445 <1> ;jmp sysret 4446 <1> sysvideo_9_6: 4447 0000D63E E94BF4FFFF <1> jmp sysret 4448 <1> 4449 <1> sysvideo_11: 4450 <1> ; system to user video/display page window transfer (mode 0) 4451 0000D643 87FE <1> xchg edi, esi 4452 <1> sysvideo_12: 4453 <1> ; esi = beginning addr of the (screen, video page) window 4454 <1> ; edi = user's buffer 4455 0000D645 E8D1340000 <1> call transfer_to_user_buffer ; fast transfer 4456 <1> ;jc sysret 4457 <1> ; 23/07/2022 4458 0000D64A 72F2 <1> jc short sysvideo_9_6 ; jmp sysret 4459 <1> 4460 <1> ; ecx = actual transfer count (must be same with input) 4461 0000D64C 010D[6C8E0100] <1> add [u.r0], ecx 4462 0000D652 01D6 <1> add esi, edx ; next row (edx = 160) 4463 0000D654 01CF <1> add edi, ecx ; next row of the user's window 4464 <1> ; (ecx <= 160) 4465 0000D656 FECF <1> dec bh 4466 0000D658 75EB <1> jnz short sysvideo_12 4467 <1> sysvideo_12_0: 4468 0000D65A E92FF4FFFF <1> jmp sysret 4469 <1> 4470 <1> sysvideo_13: 4471 <1> ; 28/12/2020 4472 0000D65F 80FF01 <1> cmp bh, 1 4473 0000D662 7752 <1> ja short sysvideo_15 ; 23/11/2020 4474 <1> 4475 <1> ; 25/02/2021 4476 <1> ; 12/02/2021 4477 <1> ; 29/01/2021, 31/01/2021 4478 <1> ; 23/11/2020 (TRDOS 386 v2.0.3) 4479 <1> ; (major modification, from mode 13h to all VGA modes, 4480 <1> ; except super VGA modes and liner frame buffer method) 4481 <1> 4482 <1> ; BH = 1 = VGA Graphics mode (0A0000h) data transfers 4483 <1> 4484 <1> ; 29/01/2021 4485 0000D664 66B84001 <1> mov ax, 320 ; 320 pixels 4486 0000D668 F6C380 <1> test bl, 80h ; bit 7 (screen width, 640 pixels) 4487 0000D66B 7407 <1> jz short sysvideo_13_0 4488 <1> ;shl ax, 1 ; 640 pixels 4489 <1> ; 23/07/2022 4490 0000D66D D1E0 <1> shl eax, 1 4491 <1> ; 4492 0000D66F 80E37F <1> and bl, 7Fh 4493 0000D672 7405 <1> jz short sysvideo_14 4494 <1> sysvideo_13_0: 4495 <1> ; 29/01/2021 4496 0000D674 80FB41 <1> cmp bl, 41h 4497 0000D677 77E1 <1> ja short sysvideo_12_0 ; invalid (unknown) sub function 4498 <1> sysvideo_14: 4499 0000D679 66A3[8E9D0100] <1> mov [v_width], ax ; save screen width 4500 0000D67F C705[929D0100]0000- <1> mov dword [v_mem], 0A0000h ; save video memory address 4500 0000D687 0A00 <1> 4501 0000D689 C705[969D0100]0000- <1> mov dword [v_siz], 65536 ; save video memory size 4501 0000D691 0100 <1> 4502 0000D693 C705[9E9D0100]0000- <1> mov dword [v_end], 0B0000h ; save end of video page 4502 0000D69B 0B00 <1> 4503 0000D69D B708 <1> mov bh, 8 4504 0000D69F 883D[919D0100] <1> mov [v_bpp], bh ; 8 ; bits per pixel (256 colors) 4505 0000D6A5 881D[909D0100] <1> mov [v_ops], bl ; VGA data transfer options 4506 <1> ;mov [maskbuff], edi ; 25/02/2021 4507 0000D6AB 893D[A29D0100] <1> mov [maskcolor], edi ; 25/02/2021 4508 <1> ; save mask color or bitmask buffer address 4509 0000D6B1 E9BE000000 <1> jmp sysvideo_15_7 4510 <1> 4511 <1> sysvideo_15: 4512 <1> ; 23/07/2022 4513 <1> ; 28/12/2020 4514 0000D6B6 80FF02 <1> cmp bh, 2 4515 <1> ;ja sysvideo_16 4516 <1> ; 23/07/2022 4517 0000D6B9 7605 <1> jna short sysvideo_15_17 4518 0000D6BB E9ED1E0000 <1> jmp sysvideo_16 4519 <1> sysvideo_15_17: ; 23/07/2022 4520 <1> ; 25/02/2021 4521 <1> ; 12/02/2021 4522 <1> ; 30/01/2021 - 31/01/2021 4523 <1> ; 01/01/2021 - 29/01/2021 4524 <1> ; 26/12/2020 - 27/12/2020 4525 <1> ; 25/12/2020 (TRDOS 386 v2.0.3) 4526 <1> ; 4527 <1> ; BH = 2 = SVGA (VESA VBE) Graphics mode (LFB) data transfers 4528 <1> 4529 <1> ; 25/12/2020 4530 <1> ; resolution table entry will be saved into EBP register 4531 <1> 4532 0000D6C0 803D[7C090000]02 <1> cmp byte [vbe3], 2 ; VESA VBE 3 video bios 4533 <1> ; or BOCHS/QEMU/VIRTUALBOX emu video bios 4534 0000D6C7 724E <1> jb short sysvideo_15_4 ; no, nothing to do ! 4535 0000D6C9 770B <1> ja short sysvideo_15_0 ; yes 4536 <1> 4537 <1> ; Only Bochs/Plex86 (emu) vbe2 video bios is usable in pmid 4538 <1> ; (if [vbe3] = 2) 4539 0000D6CB A0[7D090000] <1> mov al, [vbe2bios] ; Bochs vbios sign is from C0h to C5h 4540 0000D6D0 24F0 <1> and al, 0F0h 4541 0000D6D2 3CC0 <1> cmp al, 0C0h 4542 0000D6D4 7541 <1> jne short sysvideo_15_4 ; unknown (vbe2) video bios 4543 <1> sysvideo_15_0: 4544 <1> ; 29/01/2021 4545 0000D6D6 80FB41 <1> cmp bl, 41h 4546 0000D6D9 773C <1> ja short sysvideo_15_4 ; invalid (unknown) sub function 4547 <1> ; 29/01/2021 4548 0000D6DB 881D[909D0100] <1> mov [v_ops], bl ; SVGA data transfer options 4549 <1> 4550 0000D6E1 89D8 <1> mov eax, ebx ; hw of ebx is vesa vbe video mode 4551 0000D6E3 C1E810 <1> shr eax, 16 ; ax = vesa vbe video mode 4552 0000D6E6 7513 <1> jnz short sysvideo_15_2 4553 <1> ; ax = 0 4554 <1> 4555 <1> ; check & use current video mode 4556 0000D6E8 803D[2E680000]FF <1> cmp byte [CRT_MODE], 0FFh ; extended (SVGA) mode ? 4557 0000D6EF 7526 <1> jne short sysvideo_15_4 ; no 4558 <1> sysvideo_15_1: 4559 <1> ; use current vbe (svga) video mode 4560 0000D6F1 66A1[269D0100] <1> mov ax, [video_mode] ; extended (SVGA, VESA VBE) mode 4561 0000D6F7 6625FF01 <1> and ax, 1FFh ; vesa vbe video mode: 1XXh 4562 <1> sysvideo_15_2: 4563 <1> ; 29/01/2021 4564 <1> ;mov [maskbuff], edi ; 25/02/2021 4565 0000D6FB 893D[A29D0100] <1> mov [maskcolor], edi ; 25/02/2021 4566 <1> ; save mask color or bitmask buffer address 4567 0000D701 BD[BA6B0000] <1> mov ebp, b_vbe_modes ; vbe mode table (in 'vidata.s') 4568 <1> sysvideo_15_3: 4569 0000D706 663B4500 <1> cmp ax, [ebp] 4570 0000D70A 7410 <1> je short sysvideo_15_5 4571 0000D70C 83C508 <1> add ebp, 8 ; vbe mode table entry size 4572 0000D70F 81FD[7A6C0000] <1> cmp ebp, end_of_b_vbe_modes 4573 0000D715 72EF <1> jb short sysvideo_15_3 4574 <1> sysvideo_15_4: 4575 <1> ; desired video mode is not a valid (implemented) 4576 <1> ; extended (VESA VBE, SVGA) video mode 4577 <1> ; 4578 <1> ; nothing to do ! 4579 <1> 4580 <1> ; [u.r0] = 0 ; return value of EAX 4581 0000D717 E972F3FFFF <1> jmp sysret 4582 <1> 4583 <1> sysvideo_15_5: 4584 <1> ; get LFB address 4585 0000D71C A1[349D0100] <1> mov eax, [LFB_ADDR] ; [LFB_Info+LFBINFO.LFB_addr] 4586 0000D721 09C0 <1> or eax, eax 4587 0000D723 7509 <1> jnz short sysvideo_15_6 4588 0000D725 66A1[100F0000] <1> mov ax, [def_LFB_addr] ; default LFB addr 4589 <1> ; (for vbe mode 118h) 4590 0000D72B C1E010 <1> shl eax, 16 4591 <1> ; 27/12/2020 4592 <1> ;jz short sysvideo_15_4 4593 <1> sysvideo_15_6: 4594 <1> ; 29/01/2021 4595 0000D72E A3[929D0100] <1> mov [v_mem], eax ; save video memory address 4596 <1> 4597 <1> ; 27/12/2020 4598 <1> ; 26/12/2020 4599 0000D733 8B4502 <1> mov eax, [ebp+2] ; width, height 4600 <1> ; 29/01/2021 4601 0000D736 66A3[8E9D0100] <1> mov [v_width], ax ; save screen width 4602 <1> ; 28/12/2020 4603 0000D73C 8A7D06 <1> mov bh, [ebp+6] ; bpp 4604 <1> ; 28/02/2021 4605 <1> ; check default truecolor bpp value and use 4606 <1> ; 32bpp instead of 24bpp if the default value 4607 <1> ; has been set to 32bpp. 4608 0000D73F 80FF18 <1> cmp bh, 24 4609 0000D742 750B <1> jne short sysvideo_15_16 4610 0000D744 803D[73730100]20 <1> cmp byte [truecolor], 32 4611 <1> ; Default truecolor bpp value, 4612 <1> ; it is 32 for VBE3 video bios 4613 <1> ; (it can be set to 32 or 24) 4614 0000D74B 7502 <1> jne short sysvideo_15_16 ; not VBE3 ! 4615 <1> ; or it is set to 24 4616 0000D74D B720 <1> mov bh, 32 4617 <1> ; 28/02/2021 4618 <1> sysvideo_15_16: 4619 <1> ; 29/01/2021 4620 0000D74F 883D[919D0100] <1> mov [v_bpp], bh ; bits per pixel 4621 <1> 4622 0000D755 52 <1> push edx ; * 4623 0000D756 0FB7D0 <1> movzx edx, ax ; width 4624 0000D759 C1E810 <1> shr eax, 16 ; height 4625 0000D75C F7E2 <1> mul edx 4626 <1> ; eax = linear frame buffer size (pixels) 4627 <1> ; 29/01/2021 4628 0000D75E A3[969D0100] <1> mov [v_siz], eax ; save video page size 4629 0000D763 E8FD000000 <1> call pixels_to_byte_count 4630 0000D768 0305[929D0100] <1> add eax, [v_mem] 4631 0000D76E A3[9E9D0100] <1> mov [v_end], eax ; save end of video page 4632 0000D773 5A <1> pop edx ; * 4633 <1> 4634 <1> ; bh = bits per pixel 4635 <1> ; (bh will not be used after here, 29/01/2021) 4636 <1> 4637 <1> ; bl = pixel operations & options 4638 <1> ; ecx, edx, esi, edi input parameters 4639 <1> ; [maskcolor] = edi input ; 25/02/2021 4640 <1> 4641 <1> sysvideo_15_7: 4642 <1> ; 29/01/2021 4643 <1> ;test byte [v_ops], 40h ; system to user ? 4644 0000D774 F6C340 <1> test bl, 40h 4645 0000D777 7517 <1> jnz short sysvideo_15_9 4646 <1> 4647 0000D779 31C0 <1> xor eax, eax 4648 0000D77B 88D8 <1> mov al, bl 4649 0000D77D BB[A3D80000] <1> mov ebx, pixel_ops 4650 0000D782 240F <1> and al, 0Fh ; isolate 16 pixel operations 4651 0000D784 C0E002 <1> shl al, 2 ; * 4 for dword table pointers 4652 0000D787 01C3 <1> add ebx, eax 4653 <1> 4654 <1> ; ebx = subroutine address 4655 <1> 4656 <1> ; ecx, edx, esi, edi input parameters 4657 <1> ; [maskbuff] = edi input 4658 <1> ; [maskcolor] = edi input ; 25/02/2021 4659 <1> 4660 0000D789 FF13 <1> call [ebx] 4661 <1> sysvideo_15_8: 4662 0000D78B E9FEF2FFFF <1> jmp sysret 4663 <1> 4664 <1> sysvideo_15_9: 4665 <1> ; system to user display page or window copy 4666 <1> ;test byte [v_ops], 1 ; window copy ? 4667 0000D790 F6C301 <1> test bl, 1 4668 0000D793 7521 <1> jnz short sysvideo_15_10 4669 <1> 4670 <1> ; display page (full screen copy) 4671 0000D795 8B35[929D0100] <1> mov esi, [v_mem] ; LFB start address 4672 0000D79B A1[969D0100] <1> mov eax, [v_siz] 4673 0000D7A0 E8C0000000 <1> call pixels_to_byte_count 4674 0000D7A5 89C1 <1> mov ecx, eax ; transfer count in bytes 4675 <1> ;edi = user's buffer address 4676 0000D7A7 E86F330000 <1> call transfer_to_user_buffer 4677 0000D7AC 72DD <1> jc short sysvideo_15_8 4678 0000D7AE 890D[6C8E0100] <1> mov [u.r0], ecx 4679 0000D7B4 EBD5 <1> jmp short sysvideo_15_8 4680 <1> 4681 <1> sysvideo_15_10: 4682 0000D7B6 E820000000 <1> call sysvideo_15_12 ; window preparations 4683 0000D7BB 72CE <1> jc short sysvideo_15_8 4684 <1> 4685 0000D7BD 8B35[9A9D0100] <1> mov esi, [v_str] 4686 <1> sysvideo_15_11: 4687 <1> ; esi = window's current row address (video mem) 4688 <1> ; edi = current row (virtual) addr in user's buff 4689 <1> ; ecx = transfer count per row 4690 0000D7C3 E853330000 <1> call transfer_to_user_buffer 4691 0000D7C8 72C1 <1> jc short sysvideo_15_8 4692 0000D7CA 010D[6C8E0100] <1> add [u.r0], ecx 4693 0000D7D0 4B <1> dec ebx 4694 0000D7D1 74B8 <1> jz short sysvideo_15_8 ; ok. 4695 <1> ; next row 4696 0000D7D3 01CF <1> add edi, ecx ; next row in user's buffer 4697 0000D7D5 01D6 <1> add esi, edx ; next row of window (system) 4698 0000D7D7 EBEA <1> jmp short sysvideo_15_11 4699 <1> 4700 <1> sysvideo_15_14: 4701 0000D7D9 F9 <1> stc ; error ! 4702 <1> sysvideo_15_15: 4703 0000D7DA C3 <1> retn 4704 <1> 4705 <1> sysvideo_15_12: 4706 <1> ; 30/01/2021 4707 <1> ; 29/01/2021 4708 <1> ; Window address preparations for window copy 4709 0000D7DB 6621D2 <1> and dx, dx 4710 0000D7DE 74F9 <1> jz short sysvideo_15_14 ; invalid (zero columns) 4711 <1> ;test edx, 0FFFF0000h 4712 <1> ;jz short sysvideo_15_14 ; invalid (zero rows) 4713 0000D7E0 81FA00000100 <1> cmp edx, 65536 4714 0000D7E6 72F2 <1> jb short sysvideo_15_15 ; invalid (zero rows) 4715 0000D7E8 89C8 <1> mov eax, ecx ; start position (row, column) 4716 0000D7EA E899000000 <1> call calc_pixel_offset 4717 0000D7EF 3B05[969D0100] <1> cmp eax, [v_siz] 4718 0000D7F5 73E2 <1> jnb short sysvideo_15_14 ; out of display page 4719 <1> ; nothing to do 4720 0000D7F7 E869000000 <1> call pixels_to_byte_count 4721 0000D7FC 0305[929D0100] <1> add eax, [v_mem] 4722 0000D802 A3[9A9D0100] <1> mov [v_str], eax ; window start address 4723 <1> ; (addr of top left corner) 4724 <1> ; check column limit 4725 0000D807 89C8 <1> mov eax, ecx 4726 0000D809 6601D0 <1> add ax, dx ; add columns to start column 4727 0000D80C 72CC <1> jc short sysvideo_15_15 ; cf = 1 4728 0000D80E 663B05[8E9D0100] <1> cmp ax, [v_width] 4729 0000D815 77C2 <1> ja short sysvideo_15_14 4730 <1> 4731 0000D817 89D0 <1> mov eax, edx ; size 4732 0000D819 2D00000100 <1> sub eax, 65536 ; row count -> 0 based row # 4733 0000D81E E865000000 <1> call calc_pixel_offset 4734 0000D823 3B05[969D0100] <1> cmp eax, [v_siz] ; video (display) page size 4735 0000D829 77AE <1> ja short sysvideo_15_14 ; out of display page 4736 <1> ; nothing to do 4737 0000D82B E835000000 <1> call pixels_to_byte_count 4738 0000D830 0305[9A9D0100] <1> add eax, [v_str] ; window start address 4739 0000D836 3B05[9E9D0100] <1> cmp eax, [v_end] ; window end address (+1) 4740 <1> ; (addr of bottom right corner +1) 4741 0000D83C 779B <1> ja short sysvideo_15_14 ; out of display page 4742 <1> ; nothing to do 4743 0000D83E 89D3 <1> mov ebx, edx 4744 0000D840 C1EB10 <1> shr ebx, 16 4745 <1> ; ebx = row count 4746 0000D843 81E2FFFF0000 <1> and edx, 0FFFFh 4747 <1> ; edx = transfer count per row (from user's buffer) 4748 <1> ; (in pixels, window width) 4749 0000D849 89D0 <1> mov eax, edx 4750 0000D84B A3[A69D0100] <1> mov [pixcount], eax ; 27/02/2021 4751 0000D850 E810000000 <1> call pixels_to_byte_count 4752 0000D855 89C1 <1> mov ecx, eax 4753 <1> ; ecx = transfer count per row (from user's buffer) 4754 <1> ; (in bytes, window width) 4755 0000D857 66A1[8E9D0100] <1> mov ax, [v_width] 4756 0000D85D E803000000 <1> call pixels_to_byte_count 4757 0000D862 89C2 <1> mov edx, eax 4758 <1> ; edx = byte count per row 4759 0000D864 C3 <1> retn ; cf = 0 4760 <1> 4761 <1> pixels_to_byte_count: 4762 <1> ; 29/01/2021 4763 <1> ; INPUT: 4764 <1> ; eax = pixel count 4765 <1> ; OUTPUT: 4766 <1> ; eax = byte count 4767 <1> ; 4768 0000D865 803D[919D0100]08 <1> cmp byte [v_bpp], 8 4769 0000D86C 7619 <1> jna short pixtobc_3 ; 8 bit colors 4770 0000D86E 803D[919D0100]18 <1> cmp byte [v_bpp], 24 4771 0000D875 720A <1> jb short pixtobc_1 ; 16 bit colors 4772 0000D877 770B <1> ja short pixtobc_2 ; 32 bit colors 4773 <1> ; 24 bit pixels 4774 <1> ; eax = eax * 3 4775 <1> ;push edx 4776 <1> ;mov edx, eax 4777 <1> ;shl eax, 1 4778 <1> ;add eax, edx 4779 <1> ;pop edx 4780 0000D879 50 <1> push eax 4781 0000D87A D1E0 <1> shl eax, 1 4782 0000D87C 010424 <1> add [esp], eax 4783 0000D87F 58 <1> pop eax 4784 0000D880 C3 <1> retn 4785 <1> pixtobc_1: 4786 <1> ; 32 bit pixels 4787 <1> ; eax = eax * 2 4788 0000D881 D1E0 <1> shl eax, 1 4789 0000D883 C3 <1> retn 4790 <1> pixtobc_2: 4791 <1> ; 16 bit pixels 4792 <1> ; eax = eax * 4 4793 0000D884 C1E002 <1> shl eax, 2 4794 <1> pixtobc_3: 4795 0000D887 C3 <1> retn 4796 <1> 4797 <1> calc_pixel_offset: 4798 <1> ; 29/01/2021 4799 <1> ; INPUT: 4800 <1> ; eax = pixel position (row, column) 4801 <1> ; OUTPUT: 4802 <1> ; eax = pixel offset (linear address) 4803 <1> ; 4804 0000D888 52 <1> push edx 4805 0000D889 50 <1> push eax 4806 0000D88A C1E810 <1> shr eax, 16 4807 0000D88D 7409 <1> jz short cpixo_0 4808 <1> ; eax = row 4809 0000D88F 0FB715[8E9D0100] <1> movzx edx, word [v_width] 4810 0000D896 F7E2 <1> mul edx 4811 <1> cpixo_0: 4812 <1> ; eax = row * screen width 4813 0000D898 5A <1> pop edx 4814 0000D899 81E2FFFF0000 <1> and edx, 0FFFFh 4815 <1> ; edx = column 4816 0000D89F 01D0 <1> add eax, edx 4817 <1> ; eax = (row * screen width) + column 4818 0000D8A1 5A <1> pop edx 4819 0000D8A2 C3 <1> retn 4820 <1> 4821 <1> ; 02/02/2021 4822 <1> ; 29/01/2021 4823 <1> pixel_ops: 4824 0000D8A3 [E3D80000] <1> dd pix_op_cpy ; copy pixels (user to system) 4825 0000D8A7 [2EDE0000] <1> dd pix_op_new ; change (new, fill) color 4826 0000D8AB [4BD90000] <1> dd pix_op_add ; add color (up to 0FFh) 4827 0000D8AF [FDD90000] <1> dd pix_op_sub ; sub color (down to 0) 4828 0000D8B3 [18DC0000] <1> dd pix_op_orc ; or color 4829 0000D8B7 [CADC0000] <1> dd pix_op_and ; and color 4830 0000D8BB [7CDD0000] <1> dd pix_op_xor ; xor color 4831 0000D8BF [F2DE0000] <1> dd pix_op_not ; not color 4832 0000D8C3 [9CDF0000] <1> dd pix_op_neg ; neg color 4833 0000D8C7 [46E00000] <1> dd pix_op_inc ; inc color 4834 0000D8CB [F0E00000] <1> dd pix_op_dec ; dec color 4835 0000D8CF [AFDA0000] <1> dd pix_op_mix ; mix color 4836 0000D8D3 [76DB0000] <1> dd pix_op_rpl ; replace color 4837 0000D8D7 [9AE10000] <1> dd pix_op_blk ; copy pixel block(s) (sys) 4838 0000D8DB [48E20000] <1> dd pix_op_lin ; write line(s) 4839 0000D8DF [2BE60000] <1> dd pix_op_chr ; write character (font) 4840 <1> 4841 <1> pix_op_cpy: 4842 <1> ; 21/02/2021 4843 <1> ; 06/02/2021 4844 <1> ; 30/01/2021 4845 <1> ; COPY PIXELS 4846 <1> ; 4847 <1> ; INPUT: 4848 <1> ; If bit 4 of BL or [v_ops] = 1 -window copy- 4849 <1> ; ECX = start position (row, column) 4850 <1> ; (HW = row, CX = column) 4851 <1> ; EDX = size (rows, colums) 4852 <1> ; (HW = rows, DX = columns) 4853 <1> ; (0 -> invalid 4854 <1> ; (1 -> horizontal or vertical line) 4855 <1> ; If bit 4 of BL or [v_ops] = 0 -full screen- 4856 <1> ; ECX and EDX will not be used 4857 <1> ; ESI = user's buffer address 4858 <1> ; [maskcolor] = mask color (to be excluded) 4859 <1> ; 4860 <1> ; OUTPUT: 4861 <1> ; [u.r0] will be > 0 if succesful 4862 <1> 4863 0000D8E3 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 4864 0000D8EA 752E <1> jnz short pix_op_cpy_w ; window 4865 <1> 4866 0000D8EC 8B3D[929D0100] <1> mov edi, [v_mem] ; 21/02/2021 4867 <1> 4868 <1> ; Copy user's buffer content do display page 4869 <1> ; (full screen copy) 4870 0000D8F2 A1[969D0100] <1> mov eax, [v_siz] ; video page size 4871 0000D8F7 E869FFFFFF <1> call pixels_to_byte_count 4872 0000D8FC 89C1 <1> mov ecx, eax ; transfer count 4873 <1> ; esi = user's buffer address (virtual) 4874 0000D8FE F605[909D0100]20 <1> test byte [v_ops], 20h ; masked copy ? 4875 0000D905 7405 <1> jz short pix_op_cpy_0 ; no 4876 0000D907 E96F0F0000 <1> jmp m_pix_op_cpy ; copy pixels except mask color 4877 <1> pix_op_cpy_0: 4878 <1> ; esi = user buffer for full screen copy 4879 <1> ; edi = start of video memory 4880 <1> ; (start of display page) 4881 <1> ; ecx = byte count (display page size in bytes) 4882 0000D90C E854320000 <1> call transfer_from_user_buffer 4883 0000D911 7206 <1> jc short pix_op_cpy_1 4884 0000D913 890D[6C8E0100] <1> mov [u.r0], ecx 4885 <1> pix_op_cpy_1: 4886 0000D919 C3 <1> retn ; 06/02/2021 4887 <1> 4888 <1> pix_op_cpy_w: 4889 0000D91A E8BCFEFFFF <1> call sysvideo_15_12 ; window preparations 4890 0000D91F 72F8 <1> jc short pix_op_cpy_1 4891 <1> ; ecx = bytes per row (to be applied) 4892 <1> ; edx = screen width in bytes 4893 <1> ; ebx = row count 4894 0000D921 8B3D[9A9D0100] <1> mov edi, [v_str] 4895 0000D927 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked copy ? 4896 0000D92E 7405 <1> jz short pix_op_cpy_w_0 ; no 4897 0000D930 E909100000 <1> jmp m_pix_op_cpy_w ; window copy except mask color 4898 <1> pix_op_cpy_w_0: 4899 <1> ; esi = current row (virtual) addr in user's buff 4900 <1> ; edi = window's current row address (video mem) 4901 <1> ; ecx = transfer count per row 4902 0000D935 E82B320000 <1> call transfer_from_user_buffer 4903 0000D93A 72DD <1> jc short pix_op_cpy_1 4904 0000D93C 010D[6C8E0100] <1> add [u.r0], ecx 4905 0000D942 4B <1> dec ebx 4906 0000D943 74D4 <1> jz short pix_op_cpy_1 ; ok. 4907 <1> ; next row 4908 0000D945 01CE <1> add esi, ecx ; next row in user's buffer 4909 0000D947 01D7 <1> add edi, edx ; next row of window (system) 4910 0000D949 EBEA <1> jmp short pix_op_cpy_w_0 4911 <1> 4912 <1> pix_op_add: 4913 <1> ; 31/01/2021 4914 <1> ; 30/01/2021 4915 <1> ; ADD COLOR 4916 <1> ; 4917 <1> ; INPUT: 4918 <1> ; CL = color (8 bit, 256 colors) 4919 <1> ; ECX = color (16 bit and true colors) 4920 <1> ; EDX = start position (row, column) 4921 <1> ; (HW = row, DX = column) 4922 <1> ; ESI = size (rows, colums) 4923 <1> ; (HW = rows, SI = columns) 4924 <1> ; 4925 <1> ; [maskcolor] = mask color (to be excluded) 4926 <1> ; 4927 <1> ; OUTPUT: 4928 <1> ; [u.r0] will be > 0 if succesful 4929 <1> 4930 0000D94B F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 4931 0000D952 7555 <1> jnz short pix_op_add_w ; window 4932 <1> 4933 0000D954 8B3D[929D0100] <1> mov edi, [v_mem] 4934 0000D95A 89FE <1> mov esi, edi 4935 <1> ; ecx = color (CL, CX, ECX) 4936 0000D95C 89C8 <1> mov eax, ecx 4937 0000D95E 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 4938 <1> 4939 0000D964 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color adding ? 4940 0000D96B 7405 <1> jz short pix_op_add_0 ; no 4941 0000D96D E9CB100000 <1> jmp m_pix_op_add ; add color except mask color 4942 <1> pix_op_add_0: 4943 0000D972 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 4944 0000D979 7707 <1> ja short pix_op_add_1 4945 <1> 4946 <1> ; 256 colors (8bpp) 4947 0000D97B E84C0A0000 <1> call pix_op_add_8 4948 0000D980 EB1E <1> jmp short pix_op_add_4 4949 <1> 4950 <1> pix_op_add_1: 4951 0000D982 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 4952 0000D989 7710 <1> ja short pix_op_add_3 ; 32bpp 4953 0000D98B 7207 <1> jb short pix_op_add_2 ; 16bpp 4954 <1> 4955 <1> ; 24 bit true colors 4956 0000D98D E85A0A0000 <1> call pix_op_add_24 4957 0000D992 EB0C <1> jmp short pix_op_add_4 4958 <1> 4959 <1> ; 65536 colors (16bpp) 4960 <1> pix_op_add_2: 4961 0000D994 E8410A0000 <1> call pix_op_add_16 4962 0000D999 EB05 <1> jmp short pix_op_add_4 4963 <1> 4964 <1> ; 32 bit true colors 4965 <1> pix_op_add_3: 4966 0000D99B E86C0A0000 <1> call pix_op_add_32 4967 <1> pix_op_add_4: 4968 0000D9A0 29F7 <1> sub edi, esi 4969 0000D9A2 893D[6C8E0100] <1> mov [u.r0], edi 4970 <1> pix_op_add_5: 4971 0000D9A8 C3 <1> retn 4972 <1> 4973 <1> pix_op_add_w: 4974 <1> ; 31/01/2021 4975 0000D9A9 51 <1> push ecx ; * ; color 4976 0000D9AA 89D1 <1> mov ecx, edx ; win start pos 4977 0000D9AC 89F2 <1> mov edx, esi ; size (rows, cols) 4978 0000D9AE E828FEFFFF <1> call sysvideo_15_12 ; window preparations 4979 0000D9B3 58 <1> pop eax ; * ; color 4980 0000D9B4 72F2 <1> jc short pix_op_add_5 4981 <1> 4982 0000D9B6 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color adding ? 4983 0000D9BD 7405 <1> jz short pix_op_add_w_0 ; no 4984 0000D9BF E927110000 <1> jmp m_pix_op_add_w 4985 <1> ; window add color except mask color 4986 <1> pix_op_add_w_0: 4987 <1> ; ecx = bytes per row (to be applied) 4988 <1> ; edx = screen width in bytes 4989 <1> ; ebx = row count 4990 <1> ; eax = color 4991 <1> 4992 0000D9C4 8B3D[9A9D0100] <1> mov edi, [v_str] 4993 0000D9CA 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 4994 0000D9D1 7707 <1> ja short pix_op_add_w_1 4995 <1> 4996 <1> ; 256 colors (8bpp) 4997 0000D9D3 BD[CCE30000] <1> mov ebp, pix_op_add_8 4998 0000D9D8 EB1E <1> jmp short pix_op_add_w_4 4999 <1> 5000 <1> pix_op_add_w_1: 5001 0000D9DA 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5002 0000D9E1 7710 <1> ja short pix_op_add_w_3 ; 32bpp 5003 0000D9E3 7207 <1> jb short pix_op_add_w_2 ; 16bpp 5004 <1> 5005 <1> ; 24 bit true colors 5006 0000D9E5 BD[ECE30000] <1> mov ebp, pix_op_add_24 5007 0000D9EA EB0C <1> jmp short pix_op_add_w_4 5008 <1> 5009 <1> ; 65536 colors (16bpp) 5010 <1> pix_op_add_w_2: 5011 0000D9EC BD[DAE30000] <1> mov ebp, pix_op_add_16 5012 0000D9F1 EB05 <1> jmp short pix_op_add_w_4 5013 <1> 5014 <1> ; 32 bit true colors 5015 <1> pix_op_add_w_3: 5016 0000D9F3 BD[0CE40000] <1> mov ebp, pix_op_add_32 5017 <1> pix_op_add_w_4: 5018 0000D9F8 E95F010000 <1> jmp pix_op_add_w_x 5019 <1> 5020 <1> pix_op_sub: 5021 <1> ; 31/01/2021 5022 <1> ; SUB COLOR 5023 <1> ; 5024 <1> ; INPUT: 5025 <1> ; CL = color (8 bit, 256 colors) 5026 <1> ; ECX = color (16 bit and true colors) 5027 <1> ; EDX = start position (row, column) 5028 <1> ; (HW = row, DX = column) 5029 <1> ; ESI = size (rows, colums) 5030 <1> ; (HW = rows, SI = columns) 5031 <1> ; 5032 <1> ; [maskcolor] = mask color (to be excluded) 5033 <1> ; 5034 <1> ; OUTPUT: 5035 <1> ; [u.r0] will be > 0 if succesful 5036 <1> 5037 0000D9FD F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5038 0000DA04 7555 <1> jnz short pix_op_sub_w ; window 5039 <1> 5040 0000DA06 8B3D[929D0100] <1> mov edi, [v_mem] 5041 0000DA0C 89FE <1> mov esi, edi 5042 <1> ; ecx = color (CL, CX, ECX) 5043 0000DA0E 89C8 <1> mov eax, ecx 5044 0000DA10 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5045 <1> 5046 0000DA16 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color subtract ? 5047 0000DA1D 7405 <1> jz short pix_op_sub_0 ; no 5048 0000DA1F E9FA100000 <1> jmp m_pix_op_sub ; sub color except mask color 5049 <1> pix_op_sub_0: 5050 0000DA24 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5051 0000DA2B 7707 <1> ja short pix_op_sub_1 5052 <1> 5053 <1> ; 256 colors (8bpp) 5054 0000DA2D E8E9090000 <1> call pix_op_sub_8 5055 0000DA32 EB1E <1> jmp short pix_op_sub_4 5056 <1> 5057 <1> pix_op_sub_1: 5058 0000DA34 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5059 0000DA3B 7710 <1> ja short pix_op_sub_3 ; 32bpp 5060 0000DA3D 7207 <1> jb short pix_op_sub_2 ; 16bpp 5061 <1> 5062 <1> ; 24 bit true colors 5063 0000DA3F E8FA090000 <1> call pix_op_sub_24 5064 0000DA44 EB0C <1> jmp short pix_op_sub_4 5065 <1> 5066 <1> ; 65536 colors (16bpp) 5067 <1> pix_op_sub_2: 5068 0000DA46 E8E0090000 <1> call pix_op_sub_16 5069 0000DA4B EB05 <1> jmp short pix_op_sub_4 5070 <1> 5071 <1> ; 32 bit true colors 5072 <1> pix_op_sub_3: 5073 0000DA4D E8060A0000 <1> call pix_op_sub_32 5074 <1> pix_op_sub_4: 5075 0000DA52 29F7 <1> sub edi, esi 5076 0000DA54 893D[6C8E0100] <1> mov [u.r0], edi 5077 <1> pix_op_sub_5: 5078 0000DA5A C3 <1> retn 5079 <1> 5080 <1> pix_op_sub_w: 5081 <1> ; 31/01/2021 5082 0000DA5B 51 <1> push ecx ; * ; color 5083 0000DA5C 89D1 <1> mov ecx, edx ; win start pos 5084 0000DA5E 89F2 <1> mov edx, esi ; size (rows, cols) 5085 0000DA60 E876FDFFFF <1> call sysvideo_15_12 ; window preparations 5086 0000DA65 58 <1> pop eax ; * ; color 5087 0000DA66 72F2 <1> jc short pix_op_sub_5 5088 <1> 5089 0000DA68 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color subtract ? 5090 0000DA6F 7405 <1> jz short pix_op_sub_w_0 ; no 5091 0000DA71 E94B110000 <1> jmp m_pix_op_sub_w 5092 <1> ; window sub color except mask color 5093 <1> pix_op_sub_w_0: 5094 <1> ; ecx = bytes per row (to be applied) 5095 <1> ; edx = screen width in bytes 5096 <1> ; ebx = row count 5097 <1> ; eax = color 5098 <1> 5099 0000DA76 8B3D[9A9D0100] <1> mov edi, [v_str] 5100 0000DA7C 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5101 0000DA83 7707 <1> ja short pix_op_sub_w_1 5102 <1> 5103 <1> ; 256 colors (8bpp) 5104 0000DA85 BD[1BE40000] <1> mov ebp, pix_op_sub_8 5105 0000DA8A EB1E <1> jmp short pix_op_sub_w_4 5106 <1> 5107 <1> pix_op_sub_w_1: 5108 0000DA8C 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5109 0000DA93 7710 <1> ja short pix_op_sub_w_3 ; 32bpp 5110 0000DA95 7207 <1> jb short pix_op_sub_w_2 ; 16bpp 5111 <1> 5112 <1> ; 24 bit true colors 5113 0000DA97 BD[3EE40000] <1> mov ebp, pix_op_sub_24 5114 0000DA9C EB0C <1> jmp short pix_op_sub_w_4 5115 <1> 5116 <1> ; 65536 colors (16bpp) 5117 <1> pix_op_sub_w_2: 5118 0000DA9E BD[2BE40000] <1> mov ebp, pix_op_sub_16 5119 0000DAA3 EB05 <1> jmp short pix_op_sub_w_4 5120 <1> 5121 <1> ; 32 bit true colors 5122 <1> pix_op_sub_w_3: 5123 0000DAA5 BD[58E40000] <1> mov ebp, pix_op_sub_32 5124 <1> pix_op_sub_w_4: 5125 0000DAAA E9AD000000 <1> jmp pix_op_sub_w_x 5126 <1> 5127 <1> pix_op_mix: 5128 <1> ; 31/01/2021 5129 <1> ; MIX COLOR 5130 <1> ; 5131 <1> ; INPUT: 5132 <1> ; CL = color (8 bit, 256 colors) 5133 <1> ; ECX = color (16 bit and true colors) 5134 <1> ; EDX = start position (row, column) 5135 <1> ; (HW = row, DX = column) 5136 <1> ; ESI = size (rows, colums) 5137 <1> ; (HW = rows, SI = columns) 5138 <1> ; 5139 <1> ; [maskcolor] = mask color (to be excluded) 5140 <1> ; 5141 <1> ; OUTPUT: 5142 <1> ; [u.r0] will be > 0 if succesful 5143 <1> 5144 0000DAAF F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5145 0000DAB6 7555 <1> jnz short pix_op_mix_w ; window 5146 <1> 5147 0000DAB8 8B3D[929D0100] <1> mov edi, [v_mem] 5148 0000DABE 89FE <1> mov esi, edi 5149 <1> ; ecx = color (CL, CX, ECX) 5150 0000DAC0 89C8 <1> mov eax, ecx 5151 0000DAC2 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5152 <1> 5153 0000DAC8 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color mix ? 5154 0000DACF 7405 <1> jz short pix_op_mix_0 ; no 5155 0000DAD1 E91E110000 <1> jmp m_pix_op_mix ; mix colors except mask color 5156 <1> pix_op_mix_0: 5157 0000DAD6 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5158 0000DADD 7707 <1> ja short pix_op_mix_1 5159 <1> 5160 <1> ; 256 colors (8bpp) 5161 0000DADF E8F3090000 <1> call pix_op_mix_8 5162 0000DAE4 EB1E <1> jmp short pix_op_mix_4 5163 <1> 5164 <1> pix_op_mix_1: 5165 0000DAE6 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5166 0000DAED 7710 <1> ja short pix_op_mix_3 ; 32bpp 5167 0000DAEF 7207 <1> jb short pix_op_mix_2 ; 16bpp 5168 <1> 5169 <1> ; 24 bit true colors 5170 0000DAF1 E8FC090000 <1> call pix_op_mix_24 5171 0000DAF6 EB0C <1> jmp short pix_op_mix_4 5172 <1> 5173 <1> ; 65536 colors (16bpp) 5174 <1> pix_op_mix_2: 5175 0000DAF8 E8E6090000 <1> call pix_op_mix_16 5176 0000DAFD EB05 <1> jmp short pix_op_mix_4 5177 <1> 5178 <1> ; 32 bit true colors 5179 <1> pix_op_mix_3: 5180 0000DAFF E80A0A0000 <1> call pix_op_mix_32 5181 <1> pix_op_mix_4: 5182 0000DB04 29F7 <1> sub edi, esi 5183 0000DB06 893D[6C8E0100] <1> mov [u.r0], edi 5184 <1> pix_op_mix_5: 5185 0000DB0C C3 <1> retn 5186 <1> 5187 <1> pix_op_mix_w: 5188 <1> ; 31/01/2021 5189 0000DB0D 51 <1> push ecx ; * ; color 5190 0000DB0E 89D1 <1> mov ecx, edx ; win start pos 5191 0000DB10 89F2 <1> mov edx, esi ; size (rows, cols) 5192 0000DB12 E8C4FCFFFF <1> call sysvideo_15_12 ; window preparations 5193 0000DB17 58 <1> pop eax ; * ; color 5194 0000DB18 72F2 <1> jc short pix_op_mix_5 5195 <1> 5196 0000DB1A F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color mix ? 5197 0000DB21 7405 <1> jz short pix_op_mix_w_0 ; no 5198 0000DB23 E969110000 <1> jmp m_pix_op_mix_w 5199 <1> ; window mix colors except mask color 5200 <1> pix_op_mix_w_0: 5201 <1> ; ecx = bytes per row (to be applied) 5202 <1> ; edx = screen width in bytes 5203 <1> ; ebx = row count 5204 <1> ; eax = color 5205 <1> 5206 0000DB28 8B3D[9A9D0100] <1> mov edi, [v_str] 5207 0000DB2E 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5208 0000DB35 7707 <1> ja short pix_op_mix_w_1 5209 <1> 5210 <1> ; 256 colors (8bpp) 5211 0000DB37 BD[D7E40000] <1> mov ebp, pix_op_mix_8 5212 0000DB3C EB1E <1> jmp short pix_op_mix_w_x 5213 <1> 5214 <1> pix_op_mix_w_1: 5215 0000DB3E 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5216 0000DB45 7710 <1> ja short pix_op_mix_w_3 ; 32bpp 5217 0000DB47 7207 <1> jb short pix_op_mix_w_2 ; 16bpp 5218 <1> 5219 <1> ; 24 bit true colors 5220 0000DB49 BD[F2E40000] <1> mov ebp, pix_op_mix_24 5221 0000DB4E EB0C <1> jmp short pix_op_mix_w_x 5222 <1> 5223 <1> ; 65536 colors (16bpp) 5224 <1> pix_op_mix_w_2: 5225 0000DB50 BD[E3E40000] <1> mov ebp, pix_op_mix_16 5226 0000DB55 EB05 <1> jmp short pix_op_mix_w_x 5227 <1> 5228 <1> ; 32 bit true colors 5229 <1> pix_op_mix_w_3: 5230 0000DB57 BD[0EE50000] <1> mov ebp, pix_op_mix_32 5231 <1> ;jmp short pix_op_mix_w_x 5232 <1> 5233 <1> pix_op_mix_w_x: 5234 <1> pix_op_add_w_x: 5235 <1> pix_op_sub_w_x: 5236 <1> pix_op_rpl_w_x: 5237 <1> pix_op_orc_w_x: 5238 <1> pix_op_and_w_x: 5239 <1> pix_op_xor_w_x: 5240 <1> ; 27/02/2021 5241 <1> ; 31/01/2021 5242 <1> ; ecx = bytes per row (to be applied) 5243 <1> ; edx = windows (screen) width in bytes 5244 <1> ; ebx = row count 5245 <1> ; eax = color 5246 <1> ; ebp = pixel operation subroutine address 5247 0000DB5C 52 <1> push edx 5248 0000DB5D 51 <1> push ecx 5249 0000DB5E 57 <1> push edi 5250 0000DB5F 8B0D[A69D0100] <1> mov ecx, [pixcount] ; 27/02/2021 5251 0000DB65 FFD5 <1> call ebp ; call pixel-row operation 5252 0000DB67 5F <1> pop edi 5253 0000DB68 59 <1> pop ecx ; bytes per row 5254 0000DB69 010D[6C8E0100] <1> add [u.r0], ecx 5255 0000DB6F 5A <1> pop edx 5256 0000DB70 01D7 <1> add edi, edx ; next row 5257 0000DB72 4B <1> dec ebx 5258 0000DB73 75E7 <1> jnz short pix_op_mix_w_x 5259 0000DB75 C3 <1> retn 5260 <1> 5261 <1> pix_op_rpl: 5262 <1> ; 01/02/2021 5263 <1> ; REPLACE COLOR 5264 <1> ; 5265 <1> ; INPUT: 5266 <1> ; CL = old/current color (8 bit, 256 colors) 5267 <1> ; ECX = old/current color (16 bit and true colors) 5268 <1> ; DL = new color (8 bit, 256 colors) 5269 <1> ; EDX = new color (16 bit and true colors) 5270 <1> ; ESI = start position (row, column) 5271 <1> ; (HW = row, DX = column) 5272 <1> ; EDI = size (rows, colums) 5273 <1> ; (HW = rows, SI = columns) 5274 <1> ; OUTPUT: 5275 <1> ; [u.r0] will be > 0 if succesful 5276 <1> 5277 0000DB76 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5278 0000DB7D 754D <1> jnz short pix_op_rpl_w ; window 5279 <1> 5280 0000DB7F 8B3D[929D0100] <1> mov edi, [v_mem] 5281 0000DB85 89FE <1> mov esi, edi 5282 <1> ; ecx = old color (CL, CX, ECX) -to be replaced with- 5283 <1> ; edx = new color (CL, CX, ECX) -new one- 5284 0000DB87 89D0 <1> mov eax, edx ; new color 5285 0000DB89 890D[A29D0100] <1> mov [maskcolor], ecx ; old color 5286 0000DB8F 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5287 <1> pix_op_rpl_0: 5288 0000DB95 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5289 0000DB9C 7707 <1> ja short pix_op_rpl_1 5290 <1> 5291 <1> ; 256 colors (8bpp) 5292 0000DB9E E82F0A0000 <1> call pix_op_rpl_8 5293 0000DBA3 EB1E <1> jmp short pix_op_rpl_4 5294 <1> 5295 <1> pix_op_rpl_1: 5296 0000DBA5 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5297 0000DBAC 7710 <1> ja short pix_op_rpl_3 ; 32bpp 5298 0000DBAE 7207 <1> jb short pix_op_rpl_2 ; 16bpp 5299 <1> 5300 <1> ; 24 bit true colors 5301 0000DBB0 E8400A0000 <1> call pix_op_rpl_24 5302 0000DBB5 EB0C <1> jmp short pix_op_rpl_4 5303 <1> 5304 <1> ; 65536 colors (16bpp) 5305 <1> pix_op_rpl_2: 5306 0000DBB7 E8260A0000 <1> call pix_op_rpl_16 5307 0000DBBC EB05 <1> jmp short pix_op_rpl_4 5308 <1> 5309 <1> ; 32 bit true colors 5310 <1> pix_op_rpl_3: 5311 0000DBBE E8540A0000 <1> call pix_op_rpl_32 5312 <1> pix_op_rpl_4: 5313 0000DBC3 29F7 <1> sub edi, esi 5314 0000DBC5 893D[6C8E0100] <1> mov [u.r0], edi 5315 <1> pix_op_rpl_5: 5316 0000DBCB C3 <1> retn 5317 <1> 5318 <1> pix_op_rpl_w: 5319 <1> ; 01/02/2021 5320 0000DBCC 890D[A29D0100] <1> mov [maskcolor], ecx ; old color 5321 0000DBD2 52 <1> push edx ; * ; new color 5322 0000DBD3 89F1 <1> mov ecx, esi ; win start pos 5323 0000DBD5 89FA <1> mov edx, edi ; size (rows, cols) 5324 0000DBD7 E8FFFBFFFF <1> call sysvideo_15_12 ; window preparations 5325 0000DBDC 58 <1> pop eax ; * ; new color 5326 0000DBDD 72EC <1> jc short pix_op_rpl_5 5327 <1> 5328 <1> ; replace window color 5329 <1> pix_op_rpl_w_0: 5330 <1> ; ecx = bytes per row (to be applied) 5331 <1> ; edx = screen width in bytes 5332 <1> ; ebx = row count 5333 <1> ; eax = new color 5334 <1> ; [maskcolor] = old color 5335 <1> 5336 0000DBDF 8B3D[9A9D0100] <1> mov edi, [v_str] 5337 <1> 5338 0000DBE5 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5339 0000DBEC 7707 <1> ja short pix_op_rpl_w_1 5340 <1> 5341 <1> ; 256 colors (8bpp) 5342 0000DBEE BD[D2E50000] <1> mov ebp, pix_op_rpl_8 5343 0000DBF3 EB1E <1> jmp short pix_op_rpl_w_4 5344 <1> 5345 <1> pix_op_rpl_w_1: 5346 0000DBF5 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5347 0000DBFC 7710 <1> ja short pix_op_rpl_w_3 ; 32bpp 5348 0000DBFE 7207 <1> jb short pix_op_rpl_w_2 ; 16bpp 5349 <1> 5350 <1> ; 24 bit true colors 5351 0000DC00 BD[F5E50000] <1> mov ebp, pix_op_rpl_24 5352 0000DC05 EB0C <1> jmp short pix_op_rpl_w_4 5353 <1> 5354 <1> ; 65536 colors (16bpp) 5355 <1> pix_op_rpl_w_2: 5356 0000DC07 BD[E2E50000] <1> mov ebp, pix_op_rpl_16 5357 0000DC0C EB05 <1> jmp short pix_op_rpl_w_4 5358 <1> 5359 <1> ; 32 bit true colors 5360 <1> pix_op_rpl_w_3: 5361 0000DC0E BD[17E60000] <1> mov ebp, pix_op_rpl_32 5362 <1> pix_op_rpl_w_4: 5363 0000DC13 E944FFFFFF <1> jmp pix_op_rpl_w_x 5364 <1> 5365 <1> pix_op_orc: 5366 <1> ; 31/01/2021 5367 <1> ; OR COLOR 5368 <1> ; 5369 <1> ; INPUT: 5370 <1> ; CL = color (8 bit, 256 colors) 5371 <1> ; ECX = color (16 bit and true colors) 5372 <1> ; EDX = start position (row, column) 5373 <1> ; (HW = row, DX = column) 5374 <1> ; ESI = size (rows, colums) 5375 <1> ; (HW = rows, SI = columns) 5376 <1> ; 5377 <1> ; [maskcolor] = mask color (to be excluded) 5378 <1> ; 5379 <1> ; OUTPUT: 5380 <1> ; [u.r0] will be > 0 if succesful 5381 <1> 5382 0000DC18 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5383 0000DC1F 7555 <1> jnz short pix_op_or_w ; window 5384 <1> 5385 0000DC21 8B3D[929D0100] <1> mov edi, [v_mem] 5386 0000DC27 89FE <1> mov esi, edi 5387 <1> ; ecx = color (CL, CX, ECX) 5388 0000DC29 89C8 <1> mov eax, ecx 5389 0000DC2B 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5390 <1> 5391 0000DC31 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'or' ? 5392 0000DC38 7405 <1> jz short pix_op_or_0 ; no 5393 0000DC3A E945110000 <1> jmp m_pix_op_or ; 'or' color except mask color 5394 <1> pix_op_or_0: 5395 0000DC3F 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5396 0000DC46 7707 <1> ja short pix_op_or_1 5397 <1> 5398 <1> ; 256 colors (8bpp) 5399 0000DC48 E81B080000 <1> call pix_op_or_8 5400 0000DC4D EB1E <1> jmp short pix_op_or_4 5401 <1> 5402 <1> pix_op_or_1: 5403 0000DC4F 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5404 0000DC56 7710 <1> ja short pix_op_or_3 ; 32bpp 5405 0000DC58 7207 <1> jb short pix_op_or_2 ; 16bpp 5406 <1> 5407 <1> ; 24 bit true colors 5408 0000DC5A E817080000 <1> call pix_op_or_24 5409 0000DC5F EB0C <1> jmp short pix_op_or_4 5410 <1> 5411 <1> ; 65536 colors (16bpp) 5412 <1> pix_op_or_2: 5413 0000DC61 E808080000 <1> call pix_op_or_16 5414 0000DC66 EB05 <1> jmp short pix_op_or_4 5415 <1> 5416 <1> ; 32 bit true colors 5417 <1> pix_op_or_3: 5418 0000DC68 E818080000 <1> call pix_op_or_32 5419 <1> pix_op_or_4: 5420 0000DC6D 29F7 <1> sub edi, esi 5421 0000DC6F 893D[6C8E0100] <1> mov [u.r0], edi 5422 <1> pix_op_or_5: 5423 0000DC75 C3 <1> retn 5424 <1> 5425 <1> pix_op_or_w: 5426 <1> ; 31/01/2021 5427 0000DC76 51 <1> push ecx ; * ; color 5428 0000DC77 89D1 <1> mov ecx, edx ; win start pos 5429 0000DC79 89F2 <1> mov edx, esi ; size (rows, cols) 5430 0000DC7B E85BFBFFFF <1> call sysvideo_15_12 ; window preparations 5431 0000DC80 58 <1> pop eax ; * ; color 5432 0000DC81 72F2 <1> jc short pix_op_or_5 5433 <1> 5434 0000DC83 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'or' ? 5435 0000DC8A 7405 <1> jz short pix_op_or_w_0 ; no 5436 0000DC8C E980110000 <1> jmp m_pix_op_or_w 5437 <1> ; window 'or' color except mask color 5438 <1> pix_op_or_w_0: 5439 <1> ; ecx = bytes per row (to be applied) 5440 <1> ; edx = screen width in bytes 5441 <1> ; ebx = row count 5442 <1> ; eax = color 5443 <1> 5444 0000DC91 8B3D[9A9D0100] <1> mov edi, [v_str] 5445 0000DC97 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5446 0000DC9E 7707 <1> ja short pix_op_or_w_1 5447 <1> 5448 <1> ; 256 colors (8bpp) 5449 0000DCA0 BD[68E40000] <1> mov ebp, pix_op_or_8 5450 0000DCA5 EB1E <1> jmp short pix_op_or_w_4 5451 <1> 5452 <1> pix_op_or_w_1: 5453 0000DCA7 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5454 0000DCAE 7710 <1> ja short pix_op_or_w_3 ; 32bpp 5455 0000DCB0 7207 <1> jb short pix_op_or_w_2 ; 16bpp 5456 <1> 5457 <1> ; 24 bit true colors 5458 0000DCB2 BD[76E40000] <1> mov ebp, pix_op_or_24 5459 0000DCB7 EB0C <1> jmp short pix_op_or_w_4 5460 <1> 5461 <1> ; 65536 colors (16bpp) 5462 <1> pix_op_or_w_2: 5463 0000DCB9 BD[6EE40000] <1> mov ebp, pix_op_or_16 5464 0000DCBE EB05 <1> jmp short pix_op_or_w_4 5465 <1> 5466 <1> ; 32 bit true colors 5467 <1> pix_op_or_w_3: 5468 0000DCC0 BD[85E40000] <1> mov ebp, pix_op_or_32 5469 <1> pix_op_or_w_4: 5470 0000DCC5 E992FEFFFF <1> jmp pix_op_orc_w_x 5471 <1> 5472 <1> pix_op_and: 5473 <1> ; 31/01/2021 5474 <1> ; AND COLOR 5475 <1> ; 5476 <1> ; INPUT: 5477 <1> ; CL = color (8 bit, 256 colors) 5478 <1> ; ECX = color (16 bit and true colors) 5479 <1> ; EDX = start position (row, column) 5480 <1> ; (HW = row, DX = column) 5481 <1> ; ESI = size (rows, colums) 5482 <1> ; (HW = rows, SI = columns) 5483 <1> ; 5484 <1> ; [maskcolor] = mask color (to be excluded) 5485 <1> ; 5486 <1> ; OUTPUT: 5487 <1> ; [u.r0] will be > 0 if succesful 5488 <1> 5489 0000DCCA F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5490 0000DCD1 7555 <1> jnz short pix_op_and_w ; window 5491 <1> 5492 0000DCD3 8B3D[929D0100] <1> mov edi, [v_mem] 5493 0000DCD9 89FE <1> mov esi, edi 5494 <1> ; ecx = color (CL, CX, ECX) 5495 0000DCDB 89C8 <1> mov eax, ecx 5496 0000DCDD 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5497 <1> 5498 0000DCE3 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'and' ? 5499 0000DCEA 7405 <1> jz short pix_op_and_0 ; no 5500 0000DCEC E9D30F0000 <1> jmp m_pix_op_and ; 'and' color except mask color 5501 <1> pix_op_and_0: 5502 0000DCF1 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5503 0000DCF8 7707 <1> ja short pix_op_and_1 5504 <1> 5505 <1> ; 256 colors (8bpp) 5506 0000DCFA E88E070000 <1> call pix_op_and_8 5507 0000DCFF EB1E <1> jmp short pix_op_and_4 5508 <1> 5509 <1> pix_op_and_1: 5510 0000DD01 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5511 0000DD08 7710 <1> ja short pix_op_and_3 ; 32bpp 5512 0000DD0A 7207 <1> jb short pix_op_and_2 ; 16bpp 5513 <1> 5514 <1> ; 24 bit true colors 5515 0000DD0C E88A070000 <1> call pix_op_and_24 5516 0000DD11 EB0C <1> jmp short pix_op_and_4 5517 <1> 5518 <1> ; 65536 colors (16bpp) 5519 <1> pix_op_and_2: 5520 0000DD13 E87B070000 <1> call pix_op_and_16 5521 0000DD18 EB05 <1> jmp short pix_op_and_4 5522 <1> 5523 <1> ; 32 bit true colors 5524 <1> pix_op_and_3: 5525 0000DD1A E88B070000 <1> call pix_op_and_32 5526 <1> pix_op_and_4: 5527 0000DD1F 29F7 <1> sub edi, esi 5528 0000DD21 893D[6C8E0100] <1> mov [u.r0], edi 5529 <1> pix_op_and_5: 5530 0000DD27 C3 <1> retn 5531 <1> 5532 <1> pix_op_and_w: 5533 <1> ; 31/01/2021 5534 0000DD28 51 <1> push ecx ; * ; color 5535 0000DD29 89D1 <1> mov ecx, edx ; win start pos 5536 0000DD2B 89F2 <1> mov edx, esi ; size (rows, cols) 5537 0000DD2D E8A9FAFFFF <1> call sysvideo_15_12 ; window preparations 5538 0000DD32 58 <1> pop eax ; * ; color 5539 0000DD33 72F2 <1> jc short pix_op_and_5 5540 <1> 5541 0000DD35 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'and' ? 5542 0000DD3C 7405 <1> jz short pix_op_and_w_0 ; no 5543 0000DD3E E90E100000 <1> jmp m_pix_op_and_w 5544 <1> ; window 'and' color except mask color 5545 <1> pix_op_and_w_0: 5546 <1> ; ecx = bytes per row (to be applied) 5547 <1> ; edx = screen width in bytes 5548 <1> ; ebx = row count 5549 <1> ; eax = color 5550 <1> 5551 0000DD43 8B3D[9A9D0100] <1> mov edi, [v_str] 5552 0000DD49 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5553 0000DD50 7707 <1> ja short pix_op_and_w_1 5554 <1> 5555 <1> ; 256 colors (8bpp) 5556 0000DD52 BD[8DE40000] <1> mov ebp, pix_op_and_8 5557 0000DD57 EB1E <1> jmp short pix_op_and_w_4 5558 <1> 5559 <1> pix_op_and_w_1: 5560 0000DD59 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5561 0000DD60 7710 <1> ja short pix_op_and_w_3 ; 32bpp 5562 0000DD62 7207 <1> jb short pix_op_and_w_2 ; 16bpp 5563 <1> 5564 <1> ; 24 bit true colors 5565 0000DD64 BD[9BE40000] <1> mov ebp, pix_op_and_24 5566 0000DD69 EB0C <1> jmp short pix_op_and_w_4 5567 <1> 5568 <1> ; 65536 colors (16bpp) 5569 <1> pix_op_and_w_2: 5570 0000DD6B BD[93E40000] <1> mov ebp, pix_op_and_16 5571 0000DD70 EB05 <1> jmp short pix_op_and_w_4 5572 <1> 5573 <1> ; 32 bit true colors 5574 <1> pix_op_and_w_3: 5575 0000DD72 BD[AAE40000] <1> mov ebp, pix_op_and_32 5576 <1> pix_op_and_w_4: 5577 0000DD77 E9E0FDFFFF <1> jmp pix_op_and_w_x 5578 <1> 5579 <1> pix_op_xor: 5580 <1> ; 31/01/2021 5581 <1> ; XOR COLOR 5582 <1> ; 5583 <1> ; INPUT: 5584 <1> ; CL = color (8 bit, 256 colors) 5585 <1> ; ECX = color (16 bit and true colors) 5586 <1> ; EDX = start position (row, column) 5587 <1> ; (HW = row, DX = column) 5588 <1> ; ESI = size (rows, colums) 5589 <1> ; (HW = rows, SI = columns) 5590 <1> ; 5591 <1> ; [maskcolor] = mask color (to be excluded) 5592 <1> ; 5593 <1> ; OUTPUT: 5594 <1> ; [u.r0] will be > 0 if succesful 5595 <1> 5596 0000DD7C F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5597 0000DD83 7555 <1> jnz short pix_op_xor_w ; window 5598 <1> 5599 0000DD85 8B3D[929D0100] <1> mov edi, [v_mem] 5600 0000DD8B 89FE <1> mov esi, edi 5601 <1> ; ecx = color (CL, CX, ECX) 5602 0000DD8D 89C8 <1> mov eax, ecx 5603 0000DD8F 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5604 <1> 5605 0000DD95 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'xor' ? 5606 0000DD9C 7405 <1> jz short pix_op_xor_0 ; no 5607 0000DD9E E9A1100000 <1> jmp m_pix_op_xor ; 'xor' color except mask color 5608 <1> pix_op_xor_0: 5609 0000DDA3 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5610 0000DDAA 7707 <1> ja short pix_op_xor_1 5611 <1> 5612 <1> ; 256 colors (8bpp) 5613 0000DDAC E801070000 <1> call pix_op_xor_8 5614 0000DDB1 EB1E <1> jmp short pix_op_xor_4 5615 <1> 5616 <1> pix_op_xor_1: 5617 0000DDB3 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5618 0000DDBA 7710 <1> ja short pix_op_xor_3 ; 32bpp 5619 0000DDBC 7207 <1> jb short pix_op_xor_2 ; 16bpp 5620 <1> 5621 <1> ; 24 bit true colors 5622 0000DDBE E8FD060000 <1> call pix_op_xor_24 5623 0000DDC3 EB0C <1> jmp short pix_op_xor_4 5624 <1> 5625 <1> ; 65536 colors (16bpp) 5626 <1> pix_op_xor_2: 5627 0000DDC5 E8EE060000 <1> call pix_op_xor_16 5628 0000DDCA EB05 <1> jmp short pix_op_xor_4 5629 <1> 5630 <1> ; 32 bit true colors 5631 <1> pix_op_xor_3: 5632 0000DDCC E8FE060000 <1> call pix_op_xor_32 5633 <1> pix_op_xor_4: 5634 0000DDD1 29F7 <1> sub edi, esi 5635 0000DDD3 893D[6C8E0100] <1> mov [u.r0], edi 5636 <1> pix_op_xor_5: 5637 0000DDD9 C3 <1> retn 5638 <1> 5639 <1> pix_op_xor_w: 5640 <1> ; 31/01/2021 5641 0000DDDA 51 <1> push ecx ; * ; color 5642 0000DDDB 89D1 <1> mov ecx, edx ; win start pos 5643 0000DDDD 89F2 <1> mov edx, esi ; size (rows, cols) 5644 0000DDDF E8F7F9FFFF <1> call sysvideo_15_12 ; window preparations 5645 0000DDE4 58 <1> pop eax ; * ; color 5646 0000DDE5 72F2 <1> jc short pix_op_xor_5 5647 <1> 5648 0000DDE7 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'xor' ? 5649 0000DDEE 7405 <1> jz short pix_op_xor_w_0 ; no 5650 0000DDF0 E9DC100000 <1> jmp m_pix_op_xor_w 5651 <1> ; window 'xor' color except mask color 5652 <1> pix_op_xor_w_0: 5653 <1> ; ecx = bytes per row (to be applied) 5654 <1> ; edx = screen width in bytes 5655 <1> ; ebx = row count 5656 <1> ; eax = color 5657 <1> 5658 0000DDF5 8B3D[9A9D0100] <1> mov edi, [v_str] 5659 0000DDFB 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5660 0000DE02 7707 <1> ja short pix_op_xor_w_1 5661 <1> 5662 <1> ; 256 colors (8bpp) 5663 0000DE04 BD[B2E40000] <1> mov ebp, pix_op_xor_8 5664 0000DE09 EB1E <1> jmp short pix_op_xor_w_4 5665 <1> 5666 <1> pix_op_xor_w_1: 5667 0000DE0B 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5668 0000DE12 7710 <1> ja short pix_op_xor_w_3 ; 32bpp 5669 0000DE14 7207 <1> jb short pix_op_xor_w_2 ; 16bpp 5670 <1> 5671 <1> ; 24 bit true colors 5672 0000DE16 BD[C0E40000] <1> mov ebp, pix_op_xor_24 5673 0000DE1B EB0C <1> jmp short pix_op_xor_w_4 5674 <1> 5675 <1> ; 65536 colors (16bpp) 5676 <1> pix_op_xor_w_2: 5677 0000DE1D BD[B8E40000] <1> mov ebp, pix_op_xor_16 5678 0000DE22 EB05 <1> jmp short pix_op_xor_w_4 5679 <1> 5680 <1> ; 32 bit true colors 5681 <1> pix_op_xor_w_3: 5682 0000DE24 BD[CFE40000] <1> mov ebp, pix_op_xor_32 5683 <1> pix_op_xor_w_4: 5684 0000DE29 E92EFDFFFF <1> jmp pix_op_xor_w_x 5685 <1> 5686 <1> pix_op_new: 5687 <1> ; 31/01/2021 5688 <1> ; 30/01/2021 5689 <1> ; CHANGE COLOR 5690 <1> ; 5691 <1> ; INPUT: 5692 <1> ; CL = color (8 bit, 256 colors) 5693 <1> ; ECX = color (16 bit and true colors) 5694 <1> ; EDX = start position (row, column) 5695 <1> ; (HW = row, DX = column) 5696 <1> ; ESI = size (rows, colums) 5697 <1> ; (HW = rows, SI = columns) 5698 <1> ; 5699 <1> ; [maskcolor] = mask color (to be excluded) 5700 <1> ; 5701 <1> ; OUTPUT: 5702 <1> ; [u.r0] will be > 0 if succesful 5703 <1> 5704 0000DE2E F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5705 0000DE35 7554 <1> jnz short pix_op_new_w ; window 5706 <1> 5707 0000DE37 8B3D[929D0100] <1> mov edi, [v_mem] 5708 0000DE3D 89FE <1> mov esi, edi 5709 <1> ; ecx = color (CL, CX, ECX) 5710 0000DE3F 89C8 <1> mov eax, ecx 5711 0000DE41 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5712 <1> 5713 0000DE47 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color change ? 5714 0000DE4E 7405 <1> jz short pix_op_new_0 ; no 5715 0000DE50 E90A0B0000 <1> jmp m_pix_op_new ; change color except mask color 5716 <1> pix_op_new_0: 5717 0000DE55 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5718 0000DE5C 7706 <1> ja short pix_op_new_2 5719 <1> 5720 <1> ; 256 colors (8bpp) 5721 <1> pix_op_new_1: 5722 0000DE5E 88C4 <1> mov ah, al 5723 0000DE60 D1E9 <1> shr ecx, 1 5724 0000DE62 EB12 <1> jmp short pix_op_new_3 5725 <1> 5726 <1> pix_op_new_2: 5727 0000DE64 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5728 0000DE6B 7713 <1> ja short pix_op_new_4 ; 32bpp 5729 0000DE6D 7207 <1> jb short pix_op_new_3 ; 16bpp 5730 <1> 5731 <1> ; 31/01/2021 5732 <1> 5733 <1> ; 24 bit true colors 5734 0000DE6F E849050000 <1> call pix_op_new_24 5735 <1> 5736 0000DE74 EB0C <1> jmp short pix_op_new_5 5737 <1> 5738 <1> ; 65536 colors (16bpp) 5739 <1> pix_op_new_3: 5740 0000DE76 89C2 <1> mov edx, eax 5741 0000DE78 C1E010 <1> shl eax, 16 5742 0000DE7B 6689D0 <1> mov ax, dx 5743 0000DE7E D1E9 <1> shr ecx, 1 ; dword counts 5744 <1> ; 32 bit true colors 5745 <1> pix_op_new_4: 5746 0000DE80 F3AB <1> rep stosd 5747 <1> pix_op_new_5: 5748 0000DE82 29F7 <1> sub edi, esi 5749 0000DE84 893D[6C8E0100] <1> mov [u.r0], edi 5750 <1> pix_op_new_6: 5751 0000DE8A C3 <1> retn 5752 <1> 5753 <1> pix_op_new_w: 5754 <1> ; 31/01/2021 5755 <1> ; 30/01/2021 5756 0000DE8B 51 <1> push ecx ; * ; color 5757 0000DE8C 89D1 <1> mov ecx, edx ; win start pos 5758 0000DE8E 89F2 <1> mov edx, esi ; size (rows, cols) 5759 0000DE90 E846F9FFFF <1> call sysvideo_15_12 ; window preparations 5760 0000DE95 58 <1> pop eax ; * ; color 5761 0000DE96 72F2 <1> jc short pix_op_new_6 5762 <1> 5763 0000DE98 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color change ? 5764 0000DE9F 7405 <1> jz short pix_op_new_w_0 ; no 5765 0000DEA1 E9470B0000 <1> jmp m_pix_op_new_w 5766 <1> ; window chg color except mask color 5767 <1> pix_op_new_w_0: 5768 <1> ; ecx = bytes per row (to be applied) 5769 <1> ; edx = screen width in bytes 5770 <1> ; ebx = row count 5771 <1> ; eax = color 5772 <1> 5773 0000DEA6 8B3D[9A9D0100] <1> mov edi, [v_str] 5774 <1> 5775 0000DEAC 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5776 0000DEB3 7707 <1> ja short pix_op_new_w_1 5777 <1> 5778 <1> ; 256 colors (8bpp) 5779 0000DEB5 BD[B6E30000] <1> mov ebp, pix_op_new_8 5780 0000DEBA EB1E <1> jmp short pix_op_new_w_x 5781 <1> 5782 <1> pix_op_new_w_1: 5783 0000DEBC 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5784 0000DEC3 7710 <1> ja short pix_op_new_w_3 ; 32bpp 5785 0000DEC5 7207 <1> jb short pix_op_new_w_2 ; 16bpp 5786 <1> 5787 <1> ; 24 bit true colors 5788 0000DEC7 BD[BDE30000] <1> mov ebp, pix_op_new_24 5789 0000DECC EB0C <1> jmp short pix_op_new_w_x 5790 <1> 5791 <1> ; 65536 colors (16bpp) 5792 <1> pix_op_new_w_2: 5793 0000DECE BD[B9E30000] <1> mov ebp, pix_op_new_16 5794 0000DED3 EB05 <1> jmp short pix_op_new_w_x 5795 <1> 5796 <1> ; 32 bit true colors 5797 <1> pix_op_new_w_3: 5798 0000DED5 BD[C9E30000] <1> mov ebp, pix_op_new_32 5799 <1> ;jmp short pix_op_new_w_x 5800 <1> 5801 <1> pix_op_new_w_x: 5802 <1> pix_op_not_w_x: 5803 <1> pix_op_neg_w_x: 5804 <1> pix_op_inc_w_x: 5805 <1> pix_op_dec_w_x: 5806 <1> ; 27/02/2021 5807 <1> ; 01/02/2021 5808 <1> ; 31/01/2021 5809 <1> ; ecx = bytes per row (to be applied) 5810 <1> ; edx = windows (screen) width in bytes 5811 <1> ; ebx = row count 5812 <1> ; eax = color 5813 <1> ; ebp = pixel operation subroutine address 5814 <1> ;push edx ; 01/02/2021 5815 0000DEDA 51 <1> push ecx 5816 0000DEDB 57 <1> push edi 5817 0000DEDC 8B0D[A69D0100] <1> mov ecx, [pixcount] ; 27/02/2021 5818 0000DEE2 FFD5 <1> call ebp ; call pixel-row operation 5819 0000DEE4 5F <1> pop edi 5820 0000DEE5 59 <1> pop ecx ; bytes per row 5821 0000DEE6 010D[6C8E0100] <1> add [u.r0], ecx 5822 <1> ;pop edx ; 01/02/2021 5823 0000DEEC 01D7 <1> add edi, edx ; next row 5824 0000DEEE 4B <1> dec ebx 5825 0000DEEF 75E9 <1> jnz short pix_op_new_w_x 5826 0000DEF1 C3 <1> retn 5827 <1> 5828 <1> pix_op_not: 5829 <1> ; 31/01/2021 5830 <1> ; NOT COLOR 5831 <1> ; 5832 <1> ; INPUT: 5833 <1> ; ECX = start position (row, column) 5834 <1> ; (HW = row, CX = column) 5835 <1> ; EDX = size (rows, colums) 5836 <1> ; (HW = rows, DX = columns) 5837 <1> ; (0 -> invalid 5838 <1> ; (1 -> horizontal or vertical line) 5839 <1> ; [maskcolor] = mask color (to be excluded) 5840 <1> ; 5841 <1> ; OUTPUT: 5842 <1> ; [u.r0] will be > 0 if succesful 5843 <1> 5844 0000DEF2 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5845 0000DEF9 7553 <1> jnz short pix_op_not_w ; window 5846 <1> 5847 0000DEFB 8B3D[929D0100] <1> mov edi, [v_mem] 5848 0000DF01 89FE <1> mov esi, edi 5849 0000DF03 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5850 <1> 5851 0000DF09 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'not' ? 5852 0000DF10 7405 <1> jz short pix_op_not_0 ; no 5853 0000DF12 E9ED0F0000 <1> jmp m_pix_op_not ; 'not' color except mask color 5854 <1> pix_op_not_0: 5855 0000DF17 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5856 0000DF1E 7707 <1> ja short pix_op_not_1 5857 <1> 5858 <1> ; 256 colors (8bpp) 5859 0000DF20 E8F5050000 <1> call pix_op_not_8 5860 0000DF25 EB1E <1> jmp short pix_op_not_4 5861 <1> 5862 <1> pix_op_not_1: 5863 0000DF27 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5864 0000DF2E 7710 <1> ja short pix_op_not_3 ; 32bpp 5865 0000DF30 7207 <1> jb short pix_op_not_2 ; 16bpp 5866 <1> 5867 <1> ; 24 bit true colors 5868 0000DF32 E8F1050000 <1> call pix_op_not_24 5869 0000DF37 EB0C <1> jmp short pix_op_not_4 5870 <1> 5871 <1> ; 65536 colors (16bpp) 5872 <1> pix_op_not_2: 5873 0000DF39 E8E2050000 <1> call pix_op_not_16 5874 0000DF3E EB05 <1> jmp short pix_op_not_4 5875 <1> 5876 <1> ; 32 bit true colors 5877 <1> pix_op_not_3: 5878 0000DF40 E8EE050000 <1> call pix_op_not_32 5879 <1> pix_op_not_4: 5880 0000DF45 29F7 <1> sub edi, esi 5881 0000DF47 893D[6C8E0100] <1> mov [u.r0], edi 5882 <1> pix_op_not_5: 5883 0000DF4D C3 <1> retn 5884 <1> 5885 <1> pix_op_not_w: 5886 <1> ; 31/01/2021 5887 <1> ; ecx = win start pos (row, column) 5888 <1> ; edx = size (rows, columns) 5889 0000DF4E E888F8FFFF <1> call sysvideo_15_12 ; window preparations 5890 0000DF53 72F8 <1> jc short pix_op_not_5 5891 <1> 5892 0000DF55 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked color 'not' ? 5893 0000DF5C 7405 <1> jz short pix_op_not_w_0 ; no 5894 0000DF5E E926100000 <1> jmp m_pix_op_not_w 5895 <1> ; window 'not' color except mask color 5896 <1> pix_op_not_w_0: 5897 <1> ; ecx = bytes per row (to be applied) 5898 <1> ; edx = screen width in bytes 5899 <1> ; ebx = row count 5900 <1> 5901 0000DF63 8B3D[9A9D0100] <1> mov edi, [v_str] 5902 <1> 5903 0000DF69 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5904 0000DF70 7707 <1> ja short pix_op_not_w_1 5905 <1> 5906 <1> ; 256 colors (8bpp) 5907 0000DF72 BD[1AE50000] <1> mov ebp, pix_op_not_8 5908 0000DF77 EB1E <1> jmp short pix_op_not_w_4 5909 <1> 5910 <1> pix_op_not_w_1: 5911 0000DF79 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5912 0000DF80 7710 <1> ja short pix_op_not_w_3 ; 32bpp 5913 0000DF82 7207 <1> jb short pix_op_not_w_2 ; 16bpp 5914 <1> 5915 <1> ; 24 bit true colors 5916 0000DF84 BD[28E50000] <1> mov ebp, pix_op_not_24 5917 0000DF89 EB0C <1> jmp short pix_op_not_w_4 5918 <1> 5919 <1> ; 65536 colors (16bpp) 5920 <1> pix_op_not_w_2: 5921 0000DF8B BD[20E50000] <1> mov ebp, pix_op_not_16 5922 0000DF90 EB05 <1> jmp short pix_op_not_w_4 5923 <1> 5924 <1> ; 32 bit true colors 5925 <1> pix_op_not_w_3: 5926 0000DF92 BD[33E50000] <1> mov ebp, pix_op_not_32 5927 <1> pix_op_not_w_4: 5928 0000DF97 E93EFFFFFF <1> jmp pix_op_not_w_x 5929 <1> 5930 <1> pix_op_neg: 5931 <1> ; 31/01/2021 5932 <1> ; NEGATE COLOR 5933 <1> ; 5934 <1> ; INPUT: 5935 <1> ; ECX = start position (row, column) 5936 <1> ; (HW = row, CX = column) 5937 <1> ; EDX = size (rows, colums) 5938 <1> ; (HW = rows, DX = columns) 5939 <1> ; (0 -> invalid 5940 <1> ; (1 -> horizontal or vertical line) 5941 <1> ; [maskcolor] = mask color (to be excluded) 5942 <1> ; 5943 <1> ; OUTPUT: 5944 <1> ; [u.r0] will be > 0 if succesful 5945 <1> 5946 0000DF9C F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 5947 0000DFA3 7553 <1> jnz short pix_op_neg_w ; window 5948 <1> 5949 0000DFA5 8B3D[929D0100] <1> mov edi, [v_mem] 5950 0000DFAB 89FE <1> mov esi, edi 5951 0000DFAD 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 5952 <1> 5953 0000DFB3 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked negate color ? 5954 0000DFBA 7405 <1> jz short pix_op_neg_0 ; no 5955 0000DFBC E9FB0F0000 <1> jmp m_pix_op_neg ; 'neg' color except mask color 5956 <1> pix_op_neg_0: 5957 0000DFC1 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 5958 0000DFC8 7707 <1> ja short pix_op_neg_1 5959 <1> 5960 <1> ; 256 colors (8bpp) 5961 0000DFCA E86C050000 <1> call pix_op_neg_8 5962 0000DFCF EB1E <1> jmp short pix_op_neg_4 5963 <1> 5964 <1> pix_op_neg_1: 5965 0000DFD1 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 5966 0000DFD8 7710 <1> ja short pix_op_neg_3 ; 32bpp 5967 0000DFDA 7207 <1> jb short pix_op_neg_2 ; 16bpp 5968 <1> 5969 <1> ; 24 bit true colors 5970 0000DFDC E868050000 <1> call pix_op_neg_24 5971 0000DFE1 EB0C <1> jmp short pix_op_neg_4 5972 <1> 5973 <1> ; 65536 colors (16bpp) 5974 <1> pix_op_neg_2: 5975 0000DFE3 E859050000 <1> call pix_op_neg_16 5976 0000DFE8 EB05 <1> jmp short pix_op_neg_4 5977 <1> 5978 <1> ; 32 bit true colors 5979 <1> pix_op_neg_3: 5980 0000DFEA E86C050000 <1> call pix_op_neg_32 5981 <1> pix_op_neg_4: 5982 0000DFEF 29F7 <1> sub edi, esi 5983 0000DFF1 893D[6C8E0100] <1> mov [u.r0], edi 5984 <1> pix_op_neg_5: 5985 0000DFF7 C3 <1> retn 5986 <1> 5987 <1> pix_op_neg_w: 5988 <1> ; 31/01/2021 5989 <1> ; ecx = win start pos (row, column) 5990 <1> ; edx = size (rows, columns) 5991 0000DFF8 E8DEF7FFFF <1> call sysvideo_15_12 ; window preparations 5992 0000DFFD 72F8 <1> jc short pix_op_neg_5 5993 <1> 5994 0000DFFF F605[909D0100]20 <1> test byte [v_ops], 20h ; masked negate color ? 5995 0000E006 7405 <1> jz short pix_op_neg_w_0 ; no 5996 0000E008 E934100000 <1> jmp m_pix_op_neg_w 5997 <1> ; window 'neg' color except mask color 5998 <1> pix_op_neg_w_0: 5999 <1> ; ecx = bytes per row (to be applied) 6000 <1> ; edx = screen width in bytes 6001 <1> ; ebx = row count 6002 <1> 6003 0000E00D 8B3D[9A9D0100] <1> mov edi, [v_str] 6004 <1> 6005 0000E013 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6006 0000E01A 7707 <1> ja short pix_op_neg_w_1 6007 <1> 6008 <1> ; 256 colors (8bpp) 6009 0000E01C BD[3BE50000] <1> mov ebp, pix_op_neg_8 6010 0000E021 EB1E <1> jmp short pix_op_neg_w_4 6011 <1> 6012 <1> pix_op_neg_w_1: 6013 0000E023 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6014 0000E02A 7710 <1> ja short pix_op_neg_w_3 ; 32bpp 6015 0000E02C 7207 <1> jb short pix_op_neg_w_2 ; 16bpp 6016 <1> 6017 <1> ; 24 bit true colors 6018 0000E02E BD[49E50000] <1> mov ebp, pix_op_neg_24 6019 0000E033 EB0C <1> jmp short pix_op_neg_w_4 6020 <1> 6021 <1> ; 65536 colors (16bpp) 6022 <1> pix_op_neg_w_2: 6023 0000E035 BD[41E50000] <1> mov ebp, pix_op_neg_16 6024 0000E03A EB05 <1> jmp short pix_op_neg_w_4 6025 <1> 6026 <1> ; 32 bit true colors 6027 <1> pix_op_neg_w_3: 6028 0000E03C BD[5BE50000] <1> mov ebp, pix_op_neg_32 6029 <1> pix_op_neg_w_4: 6030 0000E041 E994FEFFFF <1> jmp pix_op_neg_w_x 6031 <1> 6032 <1> pix_op_inc: 6033 <1> ; 31/01/2021 6034 <1> ; INCREASE COLOR 6035 <1> ; 6036 <1> ; INPUT: 6037 <1> ; ECX = start position (row, column) 6038 <1> ; (HW = row, CX = column) 6039 <1> ; EDX = size (rows, colums) 6040 <1> ; (HW = rows, DX = columns) 6041 <1> ; (0 -> invalid 6042 <1> ; (1 -> horizontal or vertical line) 6043 <1> ; [maskcolor] = mask color (to be excluded) 6044 <1> ; 6045 <1> ; OUTPUT: 6046 <1> ; [u.r0] will be > 0 if succesful 6047 <1> 6048 0000E046 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 6049 0000E04D 7553 <1> jnz short pix_op_inc_w ; window 6050 <1> 6051 0000E04F 8B3D[929D0100] <1> mov edi, [v_mem] 6052 0000E055 89FE <1> mov esi, edi 6053 0000E057 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 6054 <1> 6055 0000E05D F605[909D0100]20 <1> test byte [v_ops], 20h ; masked increase color ? 6056 0000E064 7405 <1> jz short pix_op_inc_0 ; no 6057 0000E066 E909100000 <1> jmp m_pix_op_inc ; 'inc' color except mask color 6058 <1> pix_op_inc_0: 6059 0000E06B 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6060 0000E072 7707 <1> ja short pix_op_inc_1 6061 <1> 6062 <1> ; 256 colors (8bpp) 6063 0000E074 E8EA040000 <1> call pix_op_inc_8 6064 0000E079 EB1E <1> jmp short pix_op_inc_4 6065 <1> 6066 <1> pix_op_inc_1: 6067 0000E07B 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6068 0000E082 7710 <1> ja short pix_op_inc_3 ; 32bpp 6069 0000E084 7207 <1> jb short pix_op_inc_2 ; 16bpp 6070 <1> 6071 <1> ; 24 bit true colors 6072 0000E086 E8EF040000 <1> call pix_op_inc_24 6073 0000E08B EB0C <1> jmp short pix_op_inc_4 6074 <1> 6075 <1> ; 65536 colors (16bpp) 6076 <1> pix_op_inc_2: 6077 0000E08D E8DB040000 <1> call pix_op_inc_16 6078 0000E092 EB05 <1> jmp short pix_op_inc_4 6079 <1> 6080 <1> ; 32 bit true colors 6081 <1> pix_op_inc_3: 6082 0000E094 E8F5040000 <1> call pix_op_inc_32 6083 <1> pix_op_inc_4: 6084 0000E099 29F7 <1> sub edi, esi 6085 0000E09B 893D[6C8E0100] <1> mov [u.r0], edi 6086 <1> pix_op_inc_5: 6087 0000E0A1 C3 <1> retn 6088 <1> 6089 <1> pix_op_inc_w: 6090 <1> ; 31/01/2021 6091 <1> ; ecx = win start pos (row, column) 6092 <1> ; edx = size (rows, columns) 6093 0000E0A2 E834F7FFFF <1> call sysvideo_15_12 ; window preparations 6094 0000E0A7 72F8 <1> jc short pix_op_inc_5 6095 <1> 6096 0000E0A9 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked increase color ? 6097 0000E0B0 7405 <1> jz short pix_op_inc_w_0 ; no 6098 0000E0B2 E956100000 <1> jmp m_pix_op_inc_w 6099 <1> ; window 'inc' color except mask color 6100 <1> pix_op_inc_w_0: 6101 <1> ; ecx = bytes per row (to be applied) 6102 <1> ; edx = screen width in bytes 6103 <1> ; ebx = row count 6104 <1> 6105 0000E0B7 8B3D[9A9D0100] <1> mov edi, [v_str] 6106 <1> 6107 0000E0BD 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6108 0000E0C4 7707 <1> ja short pix_op_inc_w_1 6109 <1> 6110 <1> ; 256 colors (8bpp) 6111 0000E0C6 BD[63E50000] <1> mov ebp, pix_op_inc_8 6112 0000E0CB EB1E <1> jmp short pix_op_inc_w_4 6113 <1> 6114 <1> pix_op_inc_w_1: 6115 0000E0CD 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6116 0000E0D4 7710 <1> ja short pix_op_inc_w_3 ; 32bpp 6117 0000E0D6 7207 <1> jb short pix_op_inc_w_2 ; 16bpp 6118 <1> 6119 <1> ; 24 bit true colors 6120 0000E0D8 BD[7AE50000] <1> mov ebp, pix_op_inc_24 6121 0000E0DD EB0C <1> jmp short pix_op_inc_w_4 6122 <1> 6123 <1> ; 65536 colors (16bpp) 6124 <1> pix_op_inc_w_2: 6125 0000E0DF BD[6DE50000] <1> mov ebp, pix_op_inc_16 6126 0000E0E4 EB05 <1> jmp short pix_op_inc_w_4 6127 <1> 6128 <1> ; 32 bit true colors 6129 <1> pix_op_inc_w_3: 6130 0000E0E6 BD[8EE50000] <1> mov ebp, pix_op_inc_32 6131 <1> pix_op_inc_w_4: 6132 0000E0EB E9EAFDFFFF <1> jmp pix_op_inc_w_x 6133 <1> 6134 <1> pix_op_dec: 6135 <1> ; 31/01/2021 6136 <1> ; DECREASE COLOR 6137 <1> ; 6138 <1> ; INPUT: 6139 <1> ; ECX = start position (row, column) 6140 <1> ; (HW = row, CX = column) 6141 <1> ; EDX = size (rows, colums) 6142 <1> ; (HW = rows, DX = columns) 6143 <1> ; (0 -> invalid 6144 <1> ; (1 -> horizontal or vertical line) 6145 <1> ; [maskcolor] = mask color (to be excluded) 6146 <1> ; 6147 <1> ; OUTPUT: 6148 <1> ; [u.r0] will be > 0 if succesful 6149 <1> 6150 0000E0F0 F605[909D0100]10 <1> test byte [v_ops], 10h ; display page or window ? 6151 0000E0F7 7553 <1> jnz short pix_op_dec_w ; window 6152 <1> 6153 0000E0F9 8B3D[929D0100] <1> mov edi, [v_mem] 6154 0000E0FF 89FE <1> mov esi, edi 6155 0000E101 8B0D[969D0100] <1> mov ecx, [v_siz] ; display page pixel count 6156 <1> 6157 0000E107 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked decrease color ? 6158 0000E10E 7405 <1> jz short pix_op_dec_0 ; no 6159 0000E110 E92B100000 <1> jmp m_pix_op_dec ; 'dec' color except mask color 6160 <1> pix_op_dec_0: 6161 0000E115 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6162 0000E11C 7707 <1> ja short pix_op_dec_1 6163 <1> 6164 <1> ; 256 colors (8bpp) 6165 0000E11E E877040000 <1> call pix_op_dec_8 6166 0000E123 EB1E <1> jmp short pix_op_dec_4 6167 <1> 6168 <1> pix_op_dec_1: 6169 0000E125 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6170 0000E12C 7710 <1> ja short pix_op_dec_3 ; 32bpp 6171 0000E12E 7207 <1> jb short pix_op_dec_2 ; 16bpp 6172 <1> 6173 <1> ; 24 bit true colors 6174 0000E130 E87C040000 <1> call pix_op_dec_24 6175 0000E135 EB0C <1> jmp short pix_op_dec_4 6176 <1> 6177 <1> ; 65536 colors (16bpp) 6178 <1> pix_op_dec_2: 6179 0000E137 E868040000 <1> call pix_op_dec_16 6180 0000E13C EB05 <1> jmp short pix_op_dec_4 6181 <1> 6182 <1> ; 32 bit true colors 6183 <1> pix_op_dec_3: 6184 0000E13E E881040000 <1> call pix_op_dec_32 6185 <1> pix_op_dec_4: 6186 0000E143 29F7 <1> sub edi, esi 6187 0000E145 893D[6C8E0100] <1> mov [u.r0], edi 6188 <1> pix_op_dec_5: 6189 0000E14B C3 <1> retn 6190 <1> 6191 <1> pix_op_dec_w: 6192 <1> ; 31/01/2021 6193 <1> ; ecx = win start pos (row, column) 6194 <1> ; edx = size (rows, columns) 6195 0000E14C E88AF6FFFF <1> call sysvideo_15_12 ; window preparations 6196 0000E151 72F8 <1> jc short pix_op_dec_5 6197 <1> 6198 0000E153 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked decrease color ? 6199 0000E15A 7405 <1> jz short pix_op_dec_w_0 ; no 6200 0000E15C E973100000 <1> jmp m_pix_op_dec_w 6201 <1> ; window 'dec' color except mask color 6202 <1> pix_op_dec_w_0: 6203 <1> ; ecx = bytes per row (to be applied) 6204 <1> ; edx = screen width in bytes 6205 <1> ; ebx = row count 6206 <1> 6207 0000E161 8B3D[9A9D0100] <1> mov edi, [v_str] 6208 <1> 6209 0000E167 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6210 0000E16E 7707 <1> ja short pix_op_dec_w_1 6211 <1> 6212 <1> ; 256 colors (8bpp) 6213 0000E170 BD[9AE50000] <1> mov ebp, pix_op_dec_8 6214 0000E175 EB1E <1> jmp short pix_op_dec_w_4 6215 <1> 6216 <1> pix_op_dec_w_1: 6217 0000E177 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6218 0000E17E 7710 <1> ja short pix_op_dec_w_3 ; 32bpp 6219 0000E180 7207 <1> jb short pix_op_dec_w_2 ; 16bpp 6220 <1> 6221 <1> ; 24 bit true colors 6222 0000E182 BD[B1E50000] <1> mov ebp, pix_op_dec_24 6223 0000E187 EB0C <1> jmp short pix_op_dec_w_4 6224 <1> 6225 <1> ; 65536 colors (16bpp) 6226 <1> pix_op_dec_w_2: 6227 0000E189 BD[A4E50000] <1> mov ebp, pix_op_dec_16 6228 0000E18E EB05 <1> jmp short pix_op_dec_w_4 6229 <1> 6230 <1> ; 32 bit true colors 6231 <1> pix_op_dec_w_3: 6232 0000E190 BD[C4E50000] <1> mov ebp, pix_op_dec_32 6233 <1> pix_op_dec_w_4: 6234 0000E195 E940FDFFFF <1> jmp pix_op_dec_w_x 6235 <1> 6236 <1> pix_op_blk: 6237 <1> ; 11/08/2022 (TRDOS 386 Kernel v2.0.5) 6238 <1> ; 23/01/2021 6239 <1> ; 22/02/2021 6240 <1> ; 02/02/2021 6241 <1> ; COPY PIXEL BLOCK -system to system- 6242 <1> ; WRITE PIXEL BLOCKS -user to system- 6243 <1> ; 6244 <1> ; INPUT: 6245 <1> ; -If BL bit 5 is 0- 6246 <1> ; ECX = start position (row, column) (*) 6247 <1> ; (HW = row, CX = column) 6248 <1> ; EDX = size (rows, colums) (*) 6249 <1> ; (HW = rows, DX = columns) 6250 <1> ; (0 -> invalid) 6251 <1> ; (1 -> horizontal or vertical line) 6252 <1> ; ESI = destination (row, column) (***) 6253 <1> ; -If BL bit 5 is 1- 6254 <1> ; CL = color (8 bit, 256 colors) 6255 <1> ; ECX = color (16 bit and true colors) 6256 <1> ; EDX = count of blocks (not bytes) 6257 <1> ; (limit: 2048 blocks/windows) 6258 <1> ; ESI = user's buffer address 6259 <1> ; contains 64 bit block data 6260 <1> ; BLOCK ADDRESS - (row, col), dword 6261 <1> ; (first 32 bits) 6262 <1> ; BLOCK SIZE - (rows, cols), dword 6263 <1> ; (second 32 bits) 6264 <1> ; OUTPUT: 6265 <1> ; [u.r0] will be > 0 if succesful 6266 <1> 6267 <1> ; Window option ([v_ops] bit 4) will be ignored 6268 <1> ; (Function is used for display page coordinates) 6269 <1> 6270 0000E19A F605[909D0100]20 <1> test byte [v_ops], 20h ; masked or direct ? 6271 0000E1A1 755A <1> jnz short pix_op_blk_u ; blocks from user's buffer 6272 <1> 6273 0000E1A3 89F0 <1> mov eax, esi ; destination position (row, col) 6274 0000E1A5 E8DEF6FFFF <1> call calc_pixel_offset 6275 0000E1AA 3B05[969D0100] <1> cmp eax, [v_siz] 6276 0000E1B0 734A <1> jnb short pix_op_blk_retn ; out of display page 6277 0000E1B2 89C6 <1> mov esi, eax 6278 0000E1B4 E8ACF6FFFF <1> call pixels_to_byte_count 6279 0000E1B9 89C7 <1> mov edi, eax 6280 0000E1BB 89D0 <1> mov eax, edx ; size 6281 0000E1BD E8C6F6FFFF <1> call calc_pixel_offset 6282 <1> ; 22/02/2021 6283 0000E1C2 3B05[969D0100] <1> cmp eax, [v_siz] 6284 0000E1C8 7732 <1> ja short pix_op_blk_retn ; out of display page 6285 0000E1CA 01C6 <1> add esi, eax 6286 0000E1CC 3B35[969D0100] <1> cmp esi, [v_siz] 6287 0000E1D2 7728 <1> ja short pix_op_blk_retn ; out of display page 6288 <1> 6289 0000E1D4 033D[929D0100] <1> add edi, [v_mem] ; destination address 6290 <1> 6291 <1> ; 23/01/2021 6292 <1> ;call pixels_to_byte_count 6293 <1> ;add edi, eax 6294 <1> ;jc short pix_op_blk_retn ; out of display page 6295 <1> ;cmp edi, [v_end] 6296 <1> ;ja short pix_op_blk_retn ; out of display page 6297 <1> ;sub edi, eax 6298 <1> 6299 0000E1DA E8FCF5FFFF <1> call sysvideo_15_12 ; window preparations 6300 0000E1DF 721B <1> jc short pix_op_blk_retn ; something wrong !? 6301 <1> ; ecx = bytes per row (to be applied) 6302 <1> ; edx = screen width in bytes 6303 <1> ; ebx = row count 6304 <1> 6305 0000E1E1 8B35[9A9D0100] <1> mov esi, [v_str] ; source address 6306 <1> 6307 <1> ; Note: 6308 <1> ; ecx & edx are already adjusted for pixel sizes 6309 <1> ; so, following code is proper all pixel sizes 6310 <1> 6311 0000E1E7 29CA <1> sub edx, ecx ; screen width - window width 6312 <1> pix_op_blk_0: 6313 0000E1E9 89C8 <1> mov eax, ecx 6314 0000E1EB 0105[6C8E0100] <1> add [u.r0], eax 6315 0000E1F1 F3A4 <1> rep movsb 6316 0000E1F3 89C1 <1> mov ecx, eax 6317 0000E1F5 01D6 <1> add esi, edx ; next row 6318 0000E1F7 01D7 <1> add edi, edx ; next row 6319 0000E1F9 4B <1> dec ebx 6320 0000E1FA 75ED <1> jnz short pix_op_blk_0 6321 <1> pix_op_blk_retn: 6322 0000E1FC C3 <1> retn 6323 <1> 6324 <1> pix_op_blk_u: 6325 <1> ; fill blocks (windows) with desired color 6326 <1> ; according to block definitions in user's buffer 6327 0000E1FD 81FA00080000 <1> cmp edx, 2048 6328 0000E203 7605 <1> jna short pix_op_blk_u_0 6329 <1> ; Maximum 2048 blocks 6330 0000E205 BA00080000 <1> mov edx, 2048 6331 <1> pix_op_blk_u_0: 6332 0000E20A 8025[909D0100]DF <1> and byte [v_ops], ~20h ; clear masked bit 6333 0000E211 890D[A29D0100] <1> mov [maskcolor], ecx ; save pixel color 6334 <1> ; 22/02/2021 6335 <1> ;mov ebp, edx ; save blocks count 6336 <1> ;push ebp 6337 <1> pix_op_blk_u_next: 6338 0000E217 52 <1> push edx 6339 <1> ;mov ecx, 8 6340 <1> ; 11/08/2022 6341 0000E218 29C9 <1> sub ecx, ecx 6342 0000E21A B108 <1> mov cl, 8 6343 0000E21C BF[AA9D0100] <1> mov edi, buffer8 ; 8 bytes small buffer 6344 <1> ; esi = user's buffer address 6345 0000E221 E83F290000 <1> call transfer_from_user_buffer 6346 0000E226 72D4 <1> jc short pix_op_blk_retn 6347 0000E228 01CE <1> add esi, ecx ; 22/02/2021 6348 0000E22A 56 <1> push esi 6349 0000E22B 8B15[AA9D0100] <1> mov edx, [buffer8] ; block start pos (row,col) 6350 0000E231 8B35[AE9D0100] <1> mov esi, [buffer8+4] ; block size (rows,cols) 6351 0000E237 8B0D[A29D0100] <1> mov ecx, [maskcolor] 6352 0000E23D E849FCFFFF <1> call pix_op_new_w ; new (change) color (window) 6353 0000E242 5E <1> pop esi 6354 <1> ;pop ebp 6355 <1> ;dec ebp 6356 0000E243 5A <1> pop edx 6357 0000E244 4A <1> dec edx 6358 0000E245 75D0 <1> jnz short pix_op_blk_u_next 6359 0000E247 C3 <1> retn 6360 <1> 6361 <1> pix_op_lin: 6362 <1> ; 11/08/2022 6363 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 6364 <1> ; 12/02/2021 6365 <1> ; 11/02/2021 6366 <1> ; 10/02/2021 6367 <1> ; 05/02/2021 6368 <1> ; 02/02/2021 6369 <1> ; WRITE LINE -direct- 6370 <1> ; WRITE LINE(S) -via user's buffer- 6371 <1> ; 6372 <1> ; INPUT: 6373 <1> ; -If BL bit 5 is 0- 6374 <1> ; CL = color (8 bit, 256 colors) 6375 <1> ; ECX = color (16 bit and true colors) 6376 <1> ; DX = low 12 bits - size (length) 6377 <1> ; high 4 bits - direction or type 6378 <1> ; 0 - Horizontal line 6379 <1> ; 1 - Vertical line 6380 <1> ; > 1 - undefined, invalid 6381 <1> ; ESI = start position (row, column) 6382 <1> ; (HW = row, SI = column) 6383 <1> ; -If BL bit 5 is 1- 6384 <1> ; CL = color (8 bit, 256 colors) 6385 <1> ; ECX = color (16 bit and true colors) 6386 <1> ; DX = number of lines (in user buffer) 6387 <1> ; (limit: 2048 lines) 6388 <1> ; ESI = user's buffer 6389 <1> ; contains 64 bit data for lines 6390 <1> ; START POINT: 32 bit (row, col) 6391 <1> ; LENGTH: 32 bit 6392 <1> ; high 16 bits - 0 6393 <1> ; bit 0-11 - length 6394 <1> ; bit 12-15 - type (length) 6395 <1> ; OUTPUT: 6396 <1> ; [u.r0] will be > 0 if succesful 6397 <1> 6398 <1> ; Window option ([v_ops] bit 4) will be ignored 6399 <1> ; (Function is used for display page coordinates) 6400 <1> 6401 <1> ; 10/02/2021 6402 0000E248 F605[909D0100]20 <1> test byte [v_ops], 20h ; masked or direct ? 6403 0000E24F 7444 <1> jz short pix_op_lin_vh ; direct (v/h lines) 6404 <1> 6405 <1> ; lines from user's buffer 6406 <1> pix_op_lin_u: 6407 <1> ; draw lines with desired color 6408 <1> ; according to line definitions in user's buffer 6409 0000E251 81FA00080000 <1> cmp edx, 2048 6410 0000E257 7605 <1> jna short pix_op_lin_u_0 6411 <1> ; Maximum 2048 lines 6412 0000E259 BA00080000 <1> mov edx, 2048 6413 <1> pix_op_lin_u_0: 6414 0000E25E 890D[A29D0100] <1> mov [maskcolor], ecx ; save pixel color 6415 0000E264 89D5 <1> mov ebp, edx ; save line count 6416 <1> pix_op_lin_u_next: 6417 <1> ;mov ecx, 8 6418 <1> ; 11/08/2022 6419 0000E266 29C9 <1> sub ecx, ecx 6420 0000E268 B108 <1> mov cl, 8 6421 0000E26A BF[AA9D0100] <1> mov edi, buffer8 ; 8 bytes small buffer 6422 <1> ; esi = user's buffer address 6423 0000E26F E8F1280000 <1> call transfer_from_user_buffer 6424 0000E274 721E <1> jc short pix_op_lin_retn 6425 0000E276 01CE <1> add esi, ecx ; 11/02/2021 6426 0000E278 56 <1> push esi 6427 0000E279 8B35[AA9D0100] <1> mov esi, [buffer8] ; line start pos (row,col) 6428 0000E27F 8B15[AE9D0100] <1> mov edx, [buffer8+4] ; line length 6429 0000E285 8B0D[A29D0100] <1> mov ecx, [maskcolor] 6430 0000E28B E805000000 <1> call pix_op_lin_vh ; new (change) color (window) 6431 0000E290 5E <1> pop esi 6432 0000E291 4D <1> dec ebp 6433 0000E292 75D2 <1> jnz short pix_op_lin_u_next 6434 <1> pix_op_lin_retn: 6435 0000E294 C3 <1> retn 6436 <1> 6437 <1> pix_op_lin_vh: 6438 0000E295 81FA38140000 <1> cmp edx, 1438h ; 1920*1080 (780hx438h) limit 6439 0000E29B 7762 <1> ja short pix_op_lin_err1 ; invalid type 6440 <1> ; (for current version) 6441 0000E29D 66F7C2FF0F <1> test dx, 0FFFh 6442 0000E2A2 745B <1> jz short pix_op_lin_err1 ; zero length! 6443 <1> 6444 0000E2A4 89F0 <1> mov eax, esi ; start point (row, col) 6445 0000E2A6 E8DDF5FFFF <1> call calc_pixel_offset 6446 0000E2AB 3B05[969D0100] <1> cmp eax, [v_siz] 6447 0000E2B1 734C <1> jnb short pix_op_lin_err1 ; out of display page! 6448 0000E2B3 E8ADF5FFFF <1> call pixels_to_byte_count 6449 0000E2B8 89C7 <1> mov edi, eax ; start point offset 6450 0000E2BA 033D[929D0100] <1> add edi, [v_mem] ; LFB start address 6451 0000E2C0 89C8 <1> mov eax, ecx ; color 6452 <1> 6453 0000E2C2 F6C610 <1> test dh, 10h 6454 <1> ;jz pix_op_lin_h ; Horizontal line 6455 <1> ; 23/07/2022 6456 0000E2C5 7505 <1> jnz short pix_op_lin_v 6457 0000E2C7 E98A000000 <1> jmp pix_op_lin_h 6458 <1> 6459 <1> pix_op_lin_v: 6460 <1> ; Vertical line 6461 0000E2CC 80E60F <1> and dh, 0Fh ; low 12 bits 6462 0000E2CF 51 <1> push ecx ; color 6463 0000E2D0 89D1 <1> mov ecx, edx 6464 0000E2D2 0FB705[8E9D0100] <1> movzx eax, word [v_width] 6465 0000E2D9 89C3 <1> mov ebx, eax 6466 <1> ; 12/02/2021 6467 0000E2DB F7E2 <1> mul edx ; rows * [v_width] 6468 0000E2DD 01F8 <1> add eax, edi 6469 0000E2DF 3B05[9E9D0100] <1> cmp eax, [v_end] 6470 0000E2E5 58 <1> pop eax ; color 6471 0000E2E6 7717 <1> ja short pix_op_lin_err1 ; out of display page 6472 <1> ; ecx = rows 6473 0000E2E8 89CA <1> mov edx, ecx 6474 <1> 6475 0000E2EA 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6476 0000E2F1 770D <1> ja short pix_op_lin_v_2 6477 <1> ; 256 colors (1 byte per pixel) 6478 0000E2F3 010D[6C8E0100] <1> add [u.r0], ecx ; byte count 6479 <1> pix_op_lin_v_1: 6480 0000E2F9 8807 <1> mov [edi], al 6481 0000E2FB 01DF <1> add edi, ebx ; next row 6482 0000E2FD E2FA <1> loop pix_op_lin_v_1 6483 <1> pix_op_lin_err1: 6484 0000E2FF C3 <1> retn 6485 <1> 6486 <1> pix_op_lin_v_2: 6487 0000E300 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6488 0000E307 773A <1> ja short pix_op_lin_v_6 ; 32bpp 6489 0000E309 7226 <1> jb short pix_op_lin_v_4 ; 16bpp 6490 <1> 6491 <1> ; 24 bit true colors 6492 <1> ; * 3 6493 0000E30B 53 <1> push ebx ; screen width in pixels 6494 0000E30C D1E3 <1> shl ebx, 1 6495 0000E30E 011C24 <1> add [esp], ebx 6496 0000E311 5B <1> pop ebx ; screen width in bytes 6497 0000E312 010D[6C8E0100] <1> add [u.r0], ecx 6498 0000E318 D1E2 <1> shl edx, 1 6499 0000E31A 0115[6C8E0100] <1> add [u.r0], edx ; byte count 6500 <1> pix_op_lin_v_3: 6501 0000E320 668907 <1> mov [edi], ax 6502 0000E323 C1C810 <1> ror eax, 16 6503 0000E326 884702 <1> mov [edi+2], al 6504 0000E329 C1C010 <1> rol eax, 16 6505 0000E32C 01DF <1> add edi, ebx ; next row 6506 0000E32E E2F0 <1> loop pix_op_lin_v_3 6507 0000E330 C3 <1> retn 6508 <1> 6509 <1> pix_op_lin_v_4: 6510 <1> ; 16 bit (65536) colors 6511 0000E331 D1E3 <1> shl ebx, 1 6512 0000E333 D1E2 <1> shl edx, 1 6513 0000E335 0115[6C8E0100] <1> add [u.r0], edx 6514 <1> pix_op_lin_v_5: 6515 0000E33B 668907 <1> mov [edi], ax 6516 0000E33E 01DF <1> add edi, ebx ; next row 6517 0000E340 E2F9 <1> loop pix_op_lin_v_5 6518 0000E342 C3 <1> retn 6519 <1> 6520 <1> pix_op_lin_v_6: 6521 <1> ; 32 bit true colors 6522 0000E343 C1E302 <1> shl ebx, 2 6523 0000E346 C1E202 <1> shl edx, 2 6524 0000E349 0115[6C8E0100] <1> add [u.r0], edx ; byte count 6525 <1> pix_op_lin_v_7: 6526 0000E34F 8907 <1> mov [edi], eax 6527 0000E351 01DF <1> add edi, ebx ; next row 6528 0000E353 E2FA <1> loop pix_op_lin_v_7 6529 0000E355 C3 <1> retn 6530 <1> 6531 <1> pix_op_lin_h: 6532 <1> ; Horizontal line 6533 0000E356 80E60F <1> and dh, 0Fh ; low 12 bits 6534 0000E359 89D1 <1> mov ecx, edx 6535 0000E35B 6601D6 <1> add si, dx ; start column + columns 6536 0000E35E 663B35[8E9D0100] <1> cmp si, [v_width] ; screen width 6537 0000E365 7711 <1> ja short pix_op_lin_err2 ; out of columns limit 6538 <1> 6539 0000E367 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 6540 0000E36E 7709 <1> ja short pix_op_lin_h_1 6541 <1> ; 256 colors (1 byte per pixel) 6542 0000E370 010D[6C8E0100] <1> add [u.r0], ecx 6543 0000E376 F3AA <1> rep stosb 6544 <1> pix_op_lin_err2: 6545 0000E378 C3 <1> retn 6546 <1> 6547 <1> pix_op_lin_h_1: 6548 0000E379 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 6549 0000E380 7728 <1> ja short pix_op_lin_h_4 ; 32bpp 6550 0000E382 721A <1> jb short pix_op_lin_h_3 ; 16bpp 6551 <1> 6552 <1> ; 24 bit true colors 6553 <1> ; * 3 6554 0000E384 0115[6C8E0100] <1> add [u.r0], edx 6555 0000E38A D1E2 <1> shl edx, 1 6556 0000E38C 0115[6C8E0100] <1> add [u.r0], edx 6557 <1> pix_op_lin_h_2: 6558 0000E392 66AB <1> stosw 6559 0000E394 C1C810 <1> ror eax, 16 6560 0000E397 AA <1> stosb 6561 0000E398 C1C010 <1> rol eax, 16 6562 0000E39B E2F5 <1> loop pix_op_lin_h_2 6563 0000E39D C3 <1> retn 6564 <1> 6565 <1> pix_op_lin_h_3: 6566 <1> ; 16 bit (65536) colors 6567 0000E39E D1E2 <1> shl edx, 1 6568 0000E3A0 0115[6C8E0100] <1> add [u.r0], edx 6569 0000E3A6 66F3AB <1> rep stosw 6570 0000E3A9 C3 <1> retn 6571 <1> 6572 <1> pix_op_lin_h_4: 6573 <1> ; 32 bit true colors 6574 0000E3AA C1E202 <1> shl edx, 2 6575 0000E3AD 0115[6C8E0100] <1> add [u.r0], edx 6576 0000E3B3 F3AB <1> rep stosd 6577 0000E3B5 C3 <1> retn 6578 <1> 6579 <1> pix_op_new_8: 6580 <1> ; 8 bit colors (256 colors) 6581 <1> ; CHANGE PIXEL COLOR 6582 <1> ; ecx = pixel count per row 6583 <1> ; al = color 6584 <1> ; edi = start pixel address 6585 <1> 6586 0000E3B6 F3AA <1> rep stosb 6587 0000E3B8 C3 <1> retn 6588 <1> 6589 <1> pix_op_new_16: 6590 <1> ; 16 bit colors (65536 colors) 6591 <1> ; CHANGE PIXEL COLOR 6592 <1> ; ecx = pixel count per row 6593 <1> ; ax = color 6594 <1> ; edi = start pixel address 6595 <1> 6596 0000E3B9 66F3AB <1> rep stosw 6597 0000E3BC C3 <1> retn 6598 <1> 6599 <1> pix_op_new_24: 6600 <1> ; 24 bit true colors 6601 <1> ; CHANGE PIXEL COLOR 6602 <1> ; ecx = pixel count per row 6603 <1> ; eax = color 6604 <1> ; edi = start pixel address 6605 <1> 6606 0000E3BD 66AB <1> stosw 6607 0000E3BF C1C810 <1> ror eax, 16 6608 0000E3C2 AA <1> stosb 6609 0000E3C3 C1C010 <1> rol eax, 16 6610 0000E3C6 E2F5 <1> loop pix_op_new_24 6611 0000E3C8 C3 <1> retn 6612 <1> 6613 <1> pix_op_new_32: 6614 <1> ; 32 bit true colors 6615 <1> ; CHANGE PIXEL COLOR 6616 <1> ; ecx = pixel count per row 6617 <1> ; eax = color 6618 <1> ; edi = start pixel address 6619 <1> 6620 0000E3C9 F3AB <1> rep stosd 6621 0000E3CB C3 <1> retn 6622 <1> 6623 <1> pix_op_add_8: 6624 <1> ; 8 bit colors (256 colors) 6625 <1> ; ADD PIXEL COLOR 6626 <1> ; ecx = pixel count per row 6627 <1> ; al = color 6628 <1> ; edi = start pixel address 6629 <1> 6630 0000E3CC 88C4 <1> mov ah, al 6631 <1> pix_op_add_8_0: 6632 0000E3CE 0207 <1> add al, [edi] 6633 0000E3D0 7302 <1> jnc short pix_op_add_8_1 6634 0000E3D2 B0FF <1> mov al, 0FFh ; Max. value 6635 <1> pix_op_add_8_1: 6636 0000E3D4 AA <1> stosb 6637 0000E3D5 88E0 <1> mov al, ah 6638 0000E3D7 E2F5 <1> loop pix_op_add_8_0 6639 0000E3D9 C3 <1> retn 6640 <1> 6641 <1> pix_op_add_16: 6642 <1> ; 16 bit colors (65536 colors) 6643 <1> ; ADD PIXEL COLOR 6644 <1> ; ecx = pixel count per row 6645 <1> ; ax = color 6646 <1> ; edi = start pixel address 6647 <1> 6648 0000E3DA 89C2 <1> mov edx, eax 6649 <1> pix_op_add_16_0: 6650 0000E3DC 660307 <1> add ax, [edi] 6651 0000E3DF 7304 <1> jnc short pix_op_add_16_1 6652 0000E3E1 66B8FFFF <1> mov ax, 0FFFFh ; Max. value 6653 <1> pix_op_add_16_1: 6654 0000E3E5 66AB <1> stosw 6655 0000E3E7 89D0 <1> mov eax, edx 6656 0000E3E9 E2F1 <1> loop pix_op_add_16_0 6657 0000E3EB C3 <1> retn 6658 <1> 6659 <1> pix_op_add_24: 6660 <1> ; 24 bit true colors 6661 <1> ; ADD PIXEL COLOR 6662 <1> ; ecx = pixel count per row 6663 <1> ; eax = color 6664 <1> ; edi = start pixel address 6665 <1> 6666 0000E3EC 53 <1> push ebx 6667 0000E3ED BBFFFFFF00 <1> mov ebx, 0FFFFFFh 6668 <1> ;and eax, ebx ; 0FFFFFFh 6669 0000E3F2 89C2 <1> mov edx, eax 6670 <1> pix_op_add_24_0: 6671 0000E3F4 8B07 <1> mov eax, [edi] 6672 0000E3F6 21D8 <1> and eax, ebx ; 0FFFFFFh 6673 0000E3F8 01D0 <1> add eax, edx 6674 0000E3FA 39D8 <1> cmp eax, ebx 6675 0000E3FC 7602 <1> jna short pix_op_add_24_1 6676 0000E3FE 89D8 <1> mov eax, ebx ; 0FFFFFFh ; Max. value 6677 <1> pix_op_add_24_1: 6678 0000E400 66AB <1> stosw 6679 0000E402 C1E810 <1> shr eax, 16 6680 0000E405 AA <1> stosb 6681 0000E406 E2EC <1> loop pix_op_add_24_0 6682 0000E408 89D0 <1> mov eax, edx 6683 0000E40A 5B <1> pop ebx 6684 0000E40B C3 <1> retn 6685 <1> 6686 <1> pix_op_add_32: 6687 <1> ; 32 bit true colors 6688 <1> ; ADD PIXEL COLOR 6689 <1> ; ecx = pixel count per row 6690 <1> ; eax = color 6691 <1> ; edi = start pixel address 6692 <1> 6693 0000E40C 89C2 <1> mov edx, eax 6694 <1> pix_op_add_32_0: 6695 0000E40E 0307 <1> add eax, [edi] 6696 0000E410 7303 <1> jnc short pix_op_add_32_1 6697 <1> ;mov eax, 0FFFFFFFFh ; Max. value 6698 0000E412 29C0 <1> sub eax, eax 6699 0000E414 48 <1> dec eax 6700 <1> pix_op_add_32_1: 6701 0000E415 AB <1> stosd 6702 0000E416 89D0 <1> mov eax, edx 6703 0000E418 E2F4 <1> loop pix_op_add_32_0 6704 0000E41A C3 <1> retn 6705 <1> 6706 <1> pix_op_sub_8: 6707 <1> ; 8 bit colors (256 colors) 6708 <1> ; SUBTRACT PIXEL COLOR 6709 <1> ; ecx = pixel count per row 6710 <1> ; al = color 6711 <1> ; edi = start pixel address 6712 <1> 6713 0000E41B 88C4 <1> mov ah, al 6714 <1> pix_op_sub_8_0: 6715 0000E41D 8A07 <1> mov al, [edi] 6716 0000E41F 28E0 <1> sub al, ah 6717 0000E421 7302 <1> jnb short pix_op_sub_8_1 6718 0000E423 30C0 <1> xor al, al ; 0 ; Min. value 6719 <1> pix_op_sub_8_1: 6720 0000E425 AA <1> stosb 6721 0000E426 E2F5 <1> loop pix_op_sub_8_0 6722 0000E428 88E0 <1> mov al, ah 6723 0000E42A C3 <1> retn 6724 <1> 6725 <1> pix_op_sub_16: 6726 <1> ; 16 bit colors (65536 colors) 6727 <1> ; SUBTRACT PIXEL COLOR 6728 <1> ; ecx = pixel count per row 6729 <1> ; ax = color 6730 <1> ; edi = start pixel address 6731 <1> 6732 0000E42B 89C2 <1> mov edx, eax 6733 <1> pix_op_sub_16_0: 6734 0000E42D 668B07 <1> mov ax, [edi] 6735 0000E430 6629D0 <1> sub ax, dx 6736 0000E433 7302 <1> jnb short pix_op_sub_16_1 6737 0000E435 31C0 <1> xor eax, eax ; 0 ; Min. value 6738 <1> pix_op_sub_16_1: 6739 0000E437 66AB <1> stosw 6740 0000E439 E2F2 <1> loop pix_op_sub_16_0 6741 0000E43B 89D0 <1> mov eax, edx 6742 0000E43D C3 <1> retn 6743 <1> 6744 <1> pix_op_sub_24: 6745 <1> ; 24 bit true colors 6746 <1> ; SUBTRACT PIXEL COLOR 6747 <1> ; ecx = pixel count per row 6748 <1> ; eax = color 6749 <1> ; edi = start pixel address 6750 <1> 6751 <1> ;and eax, 0FFFFFFh 6752 0000E43E 89C2 <1> mov edx, eax 6753 <1> pix_op_sub_24_0: 6754 0000E440 8B07 <1> mov eax, [edi] 6755 <1> ; 27/02/2021 6756 0000E442 25FFFFFF00 <1> and eax, 0FFFFFFh 6757 0000E447 29D0 <1> sub eax, edx 6758 0000E449 7302 <1> jnb short pix_op_sub_24_1 6759 0000E44B 31C0 <1> xor eax, eax ; 0 ; Min. value 6760 <1> pix_op_sub_24_1: 6761 0000E44D 66AB <1> stosw 6762 0000E44F C1E810 <1> shr eax, 16 6763 0000E452 AA <1> stosb 6764 0000E453 E2EB <1> loop pix_op_sub_24_0 6765 0000E455 89D0 <1> mov eax, edx 6766 0000E457 C3 <1> retn 6767 <1> 6768 <1> pix_op_sub_32: 6769 <1> ; 32 bit true colors 6770 <1> ; SUBTRACT PIXEL COLOR 6771 <1> ; ecx = pixel count per row 6772 <1> ; eax = color 6773 <1> ; edi = start pixel address 6774 <1> 6775 0000E458 89C2 <1> mov edx, eax 6776 <1> pix_op_sub_32_0: 6777 0000E45A 8B07 <1> mov eax, [edi] 6778 0000E45C 29D0 <1> sub eax, edx 6779 0000E45E 7302 <1> jnb short pix_op_sub_32_1 6780 0000E460 31C0 <1> xor eax, eax ; 0 ; Min. value 6781 <1> pix_op_sub_32_1: 6782 0000E462 AB <1> stosd 6783 0000E463 E2F5 <1> loop pix_op_sub_32_0 6784 0000E465 89D0 <1> mov eax, edx 6785 0000E467 C3 <1> retn 6786 <1> 6787 <1> pix_op_or_8: 6788 <1> ; 8 bit colors (256 colors) 6789 <1> ; OR PIXEL COLOR 6790 <1> ; ecx = pixel count per row 6791 <1> ; al = color 6792 <1> ; edi = start pixel address 6793 <1> 6794 <1> pix_op_or_8_0: 6795 0000E468 0807 <1> or [edi], al 6796 0000E46A 47 <1> inc edi 6797 0000E46B E2FB <1> loop pix_op_or_8_0 6798 0000E46D C3 <1> retn 6799 <1> 6800 <1> pix_op_or_16: 6801 <1> ; 16 bit colors (65536 colors) 6802 <1> ; OR PIXEL COLOR 6803 <1> ; ecx = pixel count per row 6804 <1> ; ax = color 6805 <1> ; edi = start pixel address 6806 <1> 6807 <1> pix_op_or_16_0: 6808 0000E46E 660907 <1> or [edi], ax 6809 0000E471 47 <1> inc edi 6810 0000E472 47 <1> inc edi 6811 0000E473 E2F9 <1> loop pix_op_or_16_0 6812 0000E475 C3 <1> retn 6813 <1> 6814 <1> pix_op_or_24: 6815 <1> ; 24 bit true colors 6816 <1> ; OR PIXEL COLOR 6817 <1> ; ecx = pixel count per row 6818 <1> ; eax = color 6819 <1> ; edi = start pixel address 6820 <1> 6821 0000E476 89C2 <1> mov edx, eax 6822 <1> pix_op_or_24_0: 6823 0000E478 0B07 <1> or eax, [edi] 6824 0000E47A 66AB <1> stosw 6825 0000E47C C1E810 <1> shr eax, 16 6826 0000E47F AA <1> stosb 6827 0000E480 89D0 <1> mov eax, edx 6828 0000E482 E2F4 <1> loop pix_op_or_24_0 6829 0000E484 C3 <1> retn 6830 <1> 6831 <1> pix_op_or_32: 6832 <1> ; 32 bit true colors 6833 <1> ; OR PIXEL COLOR 6834 <1> ; ecx = pixel count per row 6835 <1> ; eax = color 6836 <1> ; edi = start pixel address 6837 <1> 6838 <1> ;mov edx, eax 6839 <1> pix_op_or_32_0: 6840 <1> ;or eax, [edi] 6841 <1> ;stosd 6842 <1> ;mov eax, edx 6843 0000E485 0907 <1> or [edi], eax 6844 0000E487 83C704 <1> add edi, 4 6845 0000E48A E2F9 <1> loop pix_op_or_32_0 6846 0000E48C C3 <1> retn 6847 <1> 6848 <1> pix_op_and_8: 6849 <1> ; 8 bit colors (256 colors) 6850 <1> ; AND PIXEL COLOR 6851 <1> ; ecx = pixel count per row 6852 <1> ; al = color 6853 <1> ; edi = start pixel address 6854 <1> 6855 <1> pix_op_and_8_0: 6856 0000E48D 2007 <1> and [edi], al 6857 0000E48F 47 <1> inc edi 6858 0000E490 E2FB <1> loop pix_op_and_8_0 6859 0000E492 C3 <1> retn 6860 <1> 6861 <1> pix_op_and_16: 6862 <1> ; 16 bit colors (65536 colors) 6863 <1> ; AND PIXEL COLOR 6864 <1> ; ecx = pixel count per row 6865 <1> ; ax = color 6866 <1> ; edi = start pixel address 6867 <1> 6868 <1> pix_op_and_16_0: 6869 0000E493 662107 <1> and [edi], ax 6870 0000E496 47 <1> inc edi 6871 0000E497 47 <1> inc edi 6872 0000E498 E2F9 <1> loop pix_op_and_16_0 6873 0000E49A C3 <1> retn 6874 <1> 6875 <1> pix_op_and_24: 6876 <1> ; 24 bit true colors 6877 <1> ; AND PIXEL COLOR 6878 <1> ; ecx = pixel count per row 6879 <1> ; eax = color 6880 <1> ; edi = start pixel address 6881 <1> 6882 0000E49B 89C2 <1> mov edx, eax 6883 <1> pix_op_and_24_0: 6884 0000E49D 2307 <1> and eax, [edi] 6885 0000E49F 66AB <1> stosw 6886 0000E4A1 C1E810 <1> shr eax, 16 6887 0000E4A4 AA <1> stosb 6888 0000E4A5 89D0 <1> mov eax, edx 6889 0000E4A7 E2F4 <1> loop pix_op_and_24_0 6890 0000E4A9 C3 <1> retn 6891 <1> 6892 <1> pix_op_and_32: 6893 <1> ; 32 bit true colors 6894 <1> ; AND PIXEL COLOR 6895 <1> ; ecx = pixel count per row 6896 <1> ; eax = color 6897 <1> ; edi = start pixel address 6898 <1> 6899 <1> ;mov edx, eax 6900 <1> pix_op_and_32_0: 6901 <1> ;and eax, [edi] 6902 <1> ;stosd 6903 <1> ;mov eax, edx 6904 0000E4AA 2107 <1> and [edi], eax 6905 0000E4AC 83C704 <1> add edi, 4 6906 0000E4AF E2F9 <1> loop pix_op_and_32_0 6907 0000E4B1 C3 <1> retn 6908 <1> 6909 <1> pix_op_xor_8: 6910 <1> ; 8 bit colors (256 colors) 6911 <1> ; XOR PIXEL COLOR 6912 <1> ; ecx = pixel count per row 6913 <1> ; al = color 6914 <1> ; edi = start pixel address 6915 <1> 6916 <1> pix_op_xor_8_0: 6917 0000E4B2 3007 <1> xor [edi], al 6918 0000E4B4 47 <1> inc edi 6919 0000E4B5 E2FB <1> loop pix_op_xor_8_0 6920 0000E4B7 C3 <1> retn 6921 <1> 6922 <1> pix_op_xor_16: 6923 <1> ; 16 bit colors (65536 colors) 6924 <1> ; XOR PIXEL COLOR 6925 <1> ; ecx = pixel count per row 6926 <1> ; ax = color 6927 <1> ; edi = start pixel address 6928 <1> 6929 <1> pix_op_xor_16_0: 6930 0000E4B8 663107 <1> xor [edi], ax 6931 0000E4BB 47 <1> inc edi 6932 0000E4BC 47 <1> inc edi 6933 0000E4BD E2F9 <1> loop pix_op_xor_16_0 6934 0000E4BF C3 <1> retn 6935 <1> 6936 <1> pix_op_xor_24: 6937 <1> ; 24 bit true colors 6938 <1> ; XOR PIXEL COLOR 6939 <1> ; ecx = pixel count per row 6940 <1> ; eax = color 6941 <1> ; edi = start pixel address 6942 <1> 6943 0000E4C0 89C2 <1> mov edx, eax 6944 <1> pix_op_xor_24_0: 6945 0000E4C2 3307 <1> xor eax, [edi] 6946 0000E4C4 66AB <1> stosw 6947 0000E4C6 C1E810 <1> shr eax, 16 6948 0000E4C9 AA <1> stosb 6949 0000E4CA 89D0 <1> mov eax, edx 6950 0000E4CC E2F4 <1> loop pix_op_xor_24_0 6951 0000E4CE C3 <1> retn 6952 <1> 6953 <1> pix_op_xor_32: 6954 <1> ; 32 bit true colors 6955 <1> ; XOR PIXEL COLOR 6956 <1> ; ecx = pixel count per row 6957 <1> ; eax = color 6958 <1> ; edi = start pixel address 6959 <1> 6960 <1> ;mov edx, eax 6961 <1> pix_op_xor_32_0: 6962 <1> ;xor eax, [edi] 6963 <1> ;stosd 6964 <1> ;mov eax, edx 6965 0000E4CF 3107 <1> xor [edi], eax 6966 0000E4D1 83C704 <1> add edi, 4 6967 0000E4D4 E2F9 <1> loop pix_op_xor_32_0 6968 0000E4D6 C3 <1> retn 6969 <1> 6970 <1> pix_op_mix_8: 6971 <1> ; 8 bit colors (256 colors) 6972 <1> ; MIX (AVERAGE) PIXEL COLORS 6973 <1> ; ecx = pixel count per row 6974 <1> ; al = color 6975 <1> ; edi = start pixel address 6976 <1> 6977 0000E4D7 88C4 <1> mov ah, al 6978 <1> pix_op_mix_8_0: 6979 0000E4D9 0207 <1> add al, [edi] 6980 0000E4DB D0D8 <1> rcr al, 1 6981 0000E4DD AA <1> stosb 6982 0000E4DE 88E0 <1> mov al, ah 6983 0000E4E0 E2F7 <1> loop pix_op_mix_8_0 6984 0000E4E2 C3 <1> retn 6985 <1> 6986 <1> pix_op_mix_16: 6987 <1> ; 16 bit colors (65536 colors) 6988 <1> ; MIX (AVERAGE) PIXEL COLORS 6989 <1> ; ecx = pixel count per row 6990 <1> ; ax = color 6991 <1> ; edi = start pixel address 6992 <1> 6993 0000E4E3 89C2 <1> mov edx, eax 6994 <1> pix_op_mix_16_0: 6995 0000E4E5 660307 <1> add ax, [edi] 6996 0000E4E8 66D1D8 <1> rcr ax, 1 6997 0000E4EB 66AB <1> stosw 6998 0000E4ED 89D0 <1> mov eax, edx 6999 0000E4EF E2F4 <1> loop pix_op_mix_16_0 7000 0000E4F1 C3 <1> retn 7001 <1> 7002 <1> pix_op_mix_24: 7003 <1> ; 24 bit true colors 7004 <1> ; MIX (AVERAGE) PIXEL COLORS 7005 <1> ; ecx = pixel count per row 7006 <1> ; eax = color 7007 <1> ; edi = start pixel address 7008 <1> 7009 0000E4F2 53 <1> push ebx 7010 0000E4F3 BBFFFFFF00 <1> mov ebx, 0FFFFFFh 7011 <1> ;and eax, ebx ; 0FFFFFFh 7012 0000E4F8 89C2 <1> mov edx, eax 7013 <1> pix_op_mix_24_0: 7014 0000E4FA 8B07 <1> mov eax, [edi] 7015 0000E4FC 21D8 <1> and eax, ebx ; 0FFFFFFh 7016 0000E4FE 01D0 <1> add eax, edx 7017 0000E500 D1E8 <1> shr eax, 1 7018 <1> ;rcr eax, 1 7019 0000E502 66AB <1> stosw 7020 0000E504 C1E810 <1> shr eax, 16 7021 0000E507 AA <1> stosb 7022 0000E508 E2F0 <1> loop pix_op_mix_24_0 7023 0000E50A 89D0 <1> mov eax, edx 7024 0000E50C 5B <1> pop ebx 7025 0000E50D C3 <1> retn 7026 <1> 7027 <1> pix_op_mix_32: 7028 <1> ; 32 bit true colors 7029 <1> ; MIX (AVERAGE) PIXEL COLORS 7030 <1> ; ecx = pixel count per row 7031 <1> ; eax = color 7032 <1> ; edi = start pixel address 7033 <1> 7034 0000E50E 89C2 <1> mov edx, eax 7035 <1> pix_op_mix_32_0: 7036 0000E510 0307 <1> add eax, [edi] 7037 0000E512 D1D8 <1> rcr eax, 1 7038 0000E514 AB <1> stosd 7039 0000E515 89D0 <1> mov eax, edx 7040 0000E517 E2F7 <1> loop pix_op_mix_32_0 7041 0000E519 C3 <1> retn 7042 <1> 7043 <1> pix_op_not_8: 7044 <1> ; 8 bit colors (256 colors) 7045 <1> ; NOT PIXEL COLOR 7046 <1> ; ecx = pixel count per row 7047 <1> ; edi = start pixel address 7048 <1> 7049 <1> pix_op_not_8_0: 7050 0000E51A F617 <1> not byte [edi] 7051 0000E51C 47 <1> inc edi 7052 0000E51D E2FB <1> loop pix_op_not_8_0 7053 0000E51F C3 <1> retn 7054 <1> 7055 <1> pix_op_not_16: 7056 <1> ; 16 bit colors (65536 colors) 7057 <1> ; NOT PIXEL COLOR 7058 <1> ; ecx = pixel count per row 7059 <1> ; edi = start pixel address 7060 <1> 7061 <1> pix_op_not_16_0: 7062 0000E520 66F717 <1> not word [edi] 7063 0000E523 47 <1> inc edi 7064 0000E524 47 <1> inc edi 7065 0000E525 E2F9 <1> loop pix_op_not_16_0 7066 0000E527 C3 <1> retn 7067 <1> 7068 <1> pix_op_not_24: 7069 <1> ; 24 bit true colors 7070 <1> ; NOT PIXEL COLOR 7071 <1> ; ecx = pixel count per row 7072 <1> ; edi = start pixel address 7073 <1> 7074 <1> pix_op_not_24_0: 7075 0000E528 66F717 <1> not word [edi] 7076 0000E52B 47 <1> inc edi 7077 0000E52C 47 <1> inc edi 7078 0000E52D F617 <1> not byte [edi] 7079 0000E52F 47 <1> inc edi 7080 0000E530 E2F6 <1> loop pix_op_not_24_0 7081 0000E532 C3 <1> retn 7082 <1> 7083 <1> pix_op_not_32: 7084 <1> ; 32 bit true colors 7085 <1> ; NOT PIXEL COLOR 7086 <1> ; ecx = pixel count per row 7087 <1> ; eax = color 7088 <1> ; edi = start pixel address 7089 <1> pix_op_not_32_0: 7090 0000E533 F717 <1> not dword [edi] 7091 0000E535 83C704 <1> add edi, 4 7092 0000E538 E2F9 <1> loop pix_op_not_32_0 7093 0000E53A C3 <1> retn 7094 <1> 7095 <1> pix_op_neg_8: 7096 <1> ; 8 bit colors (256 colors) 7097 <1> ; NEG PIXEL COLOR 7098 <1> ; ecx = pixel count per row 7099 <1> ; edi = start pixel address 7100 <1> 7101 <1> pix_op_neg_8_0: 7102 0000E53B F61F <1> neg byte [edi] 7103 0000E53D 47 <1> inc edi 7104 0000E53E E2FB <1> loop pix_op_neg_8_0 7105 0000E540 C3 <1> retn 7106 <1> 7107 <1> pix_op_neg_16: 7108 <1> ; 16 bit colors (65536 colors) 7109 <1> ; NEG PIXEL COLOR 7110 <1> ; ecx = pixel count per row 7111 <1> ; edi = start pixel address 7112 <1> 7113 <1> pix_op_neg_16_0: 7114 0000E541 66F71F <1> neg word [edi] 7115 0000E544 47 <1> inc edi 7116 0000E545 47 <1> inc edi 7117 0000E546 E2F9 <1> loop pix_op_neg_16_0 7118 0000E548 C3 <1> retn 7119 <1> 7120 <1> pix_op_neg_24: 7121 <1> ; 24 bit true colors 7122 <1> ; NEG PIXEL COLOR 7123 <1> ; ecx = pixel count per row 7124 <1> ; edi = start pixel address 7125 <1> 7126 <1> pix_op_neg_24_0: 7127 0000E549 8B07 <1> mov eax, [edi] 7128 0000E54B 25FFFFFF00 <1> and eax, 0FFFFFFh 7129 0000E550 F7D8 <1> neg eax 7130 0000E552 66AB <1> stosw 7131 0000E554 C1E810 <1> shr eax, 16 7132 0000E557 AA <1> stosb 7133 0000E558 E2EF <1> loop pix_op_neg_24_0 7134 0000E55A C3 <1> retn 7135 <1> 7136 <1> pix_op_neg_32: 7137 <1> ; 32 bit true colors 7138 <1> ; NEG PIXEL COLOR 7139 <1> ; ecx = pixel count per row 7140 <1> ; eax = color 7141 <1> ; edi = start pixel address 7142 <1> pix_op_neg_32_0: 7143 0000E55B F71F <1> neg dword [edi] 7144 0000E55D 83C704 <1> add edi, 4 7145 0000E560 E2F9 <1> loop pix_op_neg_32_0 7146 0000E562 C3 <1> retn 7147 <1> 7148 <1> pix_op_inc_8: 7149 <1> ; 8 bit colors (256 colors) 7150 <1> ; INCREASE PIXEL COLOR 7151 <1> ; ecx = pixel count per row 7152 <1> ; edi = start pixel address 7153 <1> 7154 <1> pix_op_inc_8_0: 7155 0000E563 FE07 <1> inc byte [edi] 7156 0000E565 7502 <1> jnz short pix_op_inc_8_1 7157 <1> ;mov [edi], 0FFh ; Max. value 7158 0000E567 FE0F <1> dec byte [edi] 7159 <1> pix_op_inc_8_1: 7160 0000E569 47 <1> inc edi 7161 0000E56A E2F7 <1> loop pix_op_inc_8_0 7162 0000E56C C3 <1> retn 7163 <1> 7164 <1> pix_op_inc_16: 7165 <1> ; 16 bit colors (65536 colors) 7166 <1> ; INCREASE PIXEL COLOR 7167 <1> ; ecx = pixel count per row 7168 <1> ; edi = start pixel address 7169 <1> 7170 <1> pix_op_inc_16_0: 7171 0000E56D 66FF07 <1> inc word [edi] 7172 0000E570 7503 <1> jnz short pix_op_inc_16_1 7173 <1> ;mov word [edi], 0FFFFh ; Max. value 7174 0000E572 66FF0F <1> dec word [edi] 7175 <1> pix_op_inc_16_1: 7176 0000E575 47 <1> inc edi 7177 0000E576 47 <1> inc edi 7178 0000E577 E2F4 <1> loop pix_op_inc_16_0 7179 0000E579 C3 <1> retn 7180 <1> 7181 <1> pix_op_inc_24: 7182 <1> ; 24 bit true colors 7183 <1> ; INCREASE PIXEL COLOR 7184 <1> ; ecx = pixel count per row 7185 <1> ; edi = start pixel address 7186 <1> 7187 <1> pix_op_inc_24_0: 7188 0000E57A 8B07 <1> mov eax, [edi] 7189 0000E57C 40 <1> inc eax 7190 0000E57D 25FFFFFF00 <1> and eax, 0FFFFFFh 7191 0000E582 7501 <1> jnz short pix_op_inc_24_1 7192 <1> ;mov eax, 0FFFFFFh ; Max. value 7193 0000E584 48 <1> dec eax ; 0FFFFFFFFh 7194 <1> pix_op_inc_24_1: 7195 0000E585 66AB <1> stosw 7196 0000E587 C1E810 <1> shr eax, 16 7197 0000E58A AA <1> stosb 7198 0000E58B E2ED <1> loop pix_op_inc_24_0 7199 0000E58D C3 <1> retn 7200 <1> 7201 <1> pix_op_inc_32: 7202 <1> ; 32 bit true colors 7203 <1> ; INCREASE PIXEL COLOR 7204 <1> ; ecx = pixel count per row 7205 <1> ; edi = start pixel address 7206 <1> 7207 <1> pix_op_inc_32_0: 7208 0000E58E FF07 <1> inc dword [edi] 7209 0000E590 7502 <1> jnz short pix_op_inc_32_1 7210 <1> ;mov dword [edi], 0FFFFFFFFh ; Max. value 7211 0000E592 FF0F <1> dec dword [edi] 7212 <1> pix_op_inc_32_1: 7213 0000E594 83C704 <1> add edi, 4 7214 0000E597 E2F5 <1> loop pix_op_inc_32_0 7215 0000E599 C3 <1> retn 7216 <1> 7217 <1> pix_op_dec_8: 7218 <1> ; 8 bit colors (256 colors) 7219 <1> ; DECREASE PIXEL COLOR 7220 <1> ; ecx = pixel count per row 7221 <1> ; edi = start pixel address 7222 <1> 7223 <1> pix_op_dec_8_0: 7224 0000E59A FE0F <1> dec byte [edi] 7225 0000E59C 7902 <1> jns short pix_op_dec_8_1 7226 0000E59E FE07 <1> inc byte [edi] ; 0 ; Min. value 7227 <1> pix_op_dec_8_1: 7228 0000E5A0 47 <1> inc edi 7229 0000E5A1 E2F7 <1> loop pix_op_dec_8_0 7230 0000E5A3 C3 <1> retn 7231 <1> 7232 <1> pix_op_dec_16: 7233 <1> ; 16 bit colors (65536 colors) 7234 <1> ; DECREASE PIXEL COLOR 7235 <1> ; ecx = pixel count per row 7236 <1> ; edi = start pixel address 7237 <1> 7238 <1> pix_op_dec_16_0: 7239 0000E5A4 66FF0F <1> dec word [edi] 7240 0000E5A7 7903 <1> jns short pix_op_dec_16_1 7241 0000E5A9 66FF07 <1> inc word [edi] ; 0 ; Min. value 7242 <1> pix_op_dec_16_1: 7243 0000E5AC 47 <1> inc edi 7244 0000E5AD 47 <1> inc edi 7245 0000E5AE E2F4 <1> loop pix_op_dec_16_0 7246 0000E5B0 C3 <1> retn 7247 <1> 7248 <1> pix_op_dec_24: 7249 <1> ; 24 bit true colors 7250 <1> ; DECREASE PIXEL COLOR 7251 <1> ; ecx = pixel count per row 7252 <1> ; edi = start pixel address 7253 <1> 7254 <1> pix_op_dec_24_0: 7255 0000E5B1 8B07 <1> mov eax, [edi] 7256 0000E5B3 25FFFFFF00 <1> and eax, 0FFFFFFh 7257 0000E5B8 7401 <1> jz short pix_op_dec_24_1 7258 <1> ; 0 ; Min. value 7259 0000E5BA 48 <1> dec eax 7260 <1> pix_op_dec_24_1: 7261 0000E5BB 66AB <1> stosw 7262 0000E5BD C1E810 <1> shr eax, 16 7263 0000E5C0 AA <1> stosb 7264 0000E5C1 E2B7 <1> loop pix_op_inc_24_0 7265 0000E5C3 C3 <1> retn 7266 <1> 7267 <1> pix_op_dec_32: 7268 <1> ; 32 bit true colors 7269 <1> ; DECREASE PIXEL COLOR 7270 <1> ; ecx = pixel count per row 7271 <1> ; edi = start pixel address 7272 <1> 7273 <1> pix_op_dec_32_0: 7274 0000E5C4 FF0F <1> dec dword [edi] 7275 0000E5C6 7902 <1> jns short pix_op_dec_32_1 7276 0000E5C8 FF07 <1> inc dword [edi] ; 0 ; Min. value 7277 <1> pix_op_dec_32_1: 7278 0000E5CA 83C704 <1> add edi, 4 7279 0000E5CD E2F5 <1> loop pix_op_dec_32_0 7280 0000E5CF 89D0 <1> mov eax, edx 7281 0000E5D1 C3 <1> retn 7282 <1> 7283 <1> pix_op_rpl_8: 7284 <1> ; 8 bit colors (256 colors) 7285 <1> ; REPLACE PIXEL COLORS 7286 <1> ; ecx = pixel count per row 7287 <1> ; al = new color 7288 <1> ; byte [maskcolor] = old color 7289 <1> ; edi = start pixel address 7290 <1> 7291 0000E5D2 8A25[A29D0100] <1> mov ah, [maskcolor] 7292 <1> pix_op_rpl_8_0: 7293 0000E5D8 3A27 <1> cmp ah, [edi] 7294 0000E5DA 7502 <1> jne short pix_op_rpl_8_1 7295 0000E5DC 8807 <1> mov [edi], al 7296 <1> pix_op_rpl_8_1: 7297 0000E5DE 47 <1> inc edi 7298 0000E5DF E2F7 <1> loop pix_op_rpl_8_0 7299 0000E5E1 C3 <1> retn 7300 <1> 7301 <1> pix_op_rpl_16: 7302 <1> ; 16 bit colors (65536 colors) 7303 <1> ; REPLACE PIXEL COLORS 7304 <1> ; ecx = pixel count per row 7305 <1> ; ax = new color 7306 <1> ; word [maskcolor] = old color 7307 <1> ; edi = start pixel address 7308 <1> 7309 0000E5E2 8B15[A29D0100] <1> mov edx, [maskcolor] 7310 <1> pix_op_rpl_16_0: 7311 0000E5E8 663B17 <1> cmp dx, [edi] 7312 0000E5EB 7503 <1> jne short pix_op_rpl_16_1 7313 0000E5ED 668907 <1> mov [edi], ax 7314 <1> pix_op_rpl_16_1: 7315 0000E5F0 47 <1> inc edi 7316 0000E5F1 47 <1> inc edi 7317 0000E5F2 E2F4 <1> loop pix_op_rpl_16_0 7318 0000E5F4 C3 <1> retn 7319 <1> 7320 <1> pix_op_rpl_24: 7321 <1> ; 24 bit true colors 7322 <1> ; REPLACE PIXEL COLORS 7323 <1> ; ecx = pixel count per row 7324 <1> ; eax = new color 7325 <1> ; [maskcolor] = old color 7326 <1> ; edi = start pixel address 7327 <1> 7328 <1> pix_op_rpl_24_0: 7329 0000E5F5 8B17 <1> mov edx, [edi] 7330 0000E5F7 81E2FFFFFF00 <1> and edx, 0FFFFFFh 7331 0000E5FD 3B15[A29D0100] <1> cmp edx, [maskcolor] 7332 0000E603 7406 <1> je short pix_op_rpl_24_1 7333 0000E605 83C703 <1> add edi, 3 7334 0000E608 E2EB <1> loop pix_op_rpl_24_0 7335 0000E60A C3 <1> retn 7336 <1> pix_op_rpl_24_1: 7337 0000E60B AA <1> stosb 7338 0000E60C C1C808 <1> ror eax, 8 7339 0000E60F 66AB <1> stosw 7340 0000E611 C1C008 <1> rol eax, 8 7341 0000E614 E2DF <1> loop pix_op_rpl_24_0 7342 0000E616 C3 <1> retn 7343 <1> 7344 <1> pix_op_rpl_32: 7345 <1> ; 32 bit true colors 7346 <1> ; REPLACE PIXEL COLORS 7347 <1> ; ecx = pixel count per row 7348 <1> ; eax = new color 7349 <1> ; [maskcolor] = old color 7350 <1> ; edi = start pixel address 7351 <1> 7352 0000E617 8B15[A29D0100] <1> mov edx, [maskcolor] 7353 <1> pix_op_rpl_32_0: 7354 0000E61D 3B17 <1> cmp edx, [edi] 7355 0000E61F 7504 <1> jne short pix_op_rpl_32_2 7356 0000E621 AB <1> stosd 7357 0000E622 E2F9 <1> loop pix_op_rpl_32_0 7358 0000E624 C3 <1> retn 7359 <1> pix_op_rpl_32_2: 7360 0000E625 83C704 <1> add edi, 4 7361 0000E628 E2F3 <1> loop pix_op_rpl_32_0 7362 0000E62A C3 <1> retn 7363 <1> 7364 <1> pix_op_chr: 7365 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 7366 <1> ; 15/02/2021 7367 <1> ; 05/02/2021 7368 <1> ; WRITE CHARACTER (FONT) 7369 <1> ; 05/01/2021 ([ufont]) 7370 <1> ; 01/01/2021 7371 <1> ; CL = char's color (8 bit, 256 colors) 7372 <1> ; ECX = char's color (16 bit and true colors) 7373 <1> ; DL = Character's ASCII code 7374 <1> ; DH bit 0 -> font height 7375 <1> ; 0 -> 8x16 character font 7376 <1> ; 1 -> 8x8 character font 7377 <1> ; DH bit 1 & 2 -> scale 7378 <1> ; 0 = 1/1 (8 pixels per char row) 7379 <1> ; 1 = 2/1 (16 pixels per char row) 7380 <1> ; 2 = 3/1 (24 pixels per char row) 7381 <1> ; 3 = 4/1 (32 pixels per char row) 7382 <1> ; DH bit 6 -> [ufont] option (1 = use [ufont]) 7383 <1> ; If DH bit 7 = 1 7384 <1> ; USER FONT (from user buffer) 7385 <1> ; DL = 0 -> 8x8 (width: 1 byte per row) 7386 <1> ; DL = 1 -> 8x16 7387 <1> ; DL = 2 -> 16x16 (width: 2 bytes) 7388 <1> ; DL = 3 -> 16x32 7389 <1> ; DL = 4 -> 24x24 (width: 3 bytes) 7390 <1> ; DL = 5 -> 24x48 7391 <1> ; DL = 6 -> 32x32 (width: 4 bytes) 7392 <1> ; DL = 7 -> 32x64 7393 <1> ; DL > 7 -> invalid (unused) 7394 <1> ; EDI = user's font buffer address 7395 <1> ; (NOTE: byte order is as row0,row1,row2..) 7396 <1> ; ESI = start position (row, column) (*) 7397 <1> ; (HW = row, SI = column) 7398 <1> 7399 0000E62B 89F0 <1> mov eax, esi ; start position 7400 0000E62D E856F2FFFF <1> call calc_pixel_offset 7401 0000E632 3B05[969D0100] <1> cmp eax, [v_siz] 7402 0000E638 736D <1> jnb short pix_op_chr_err ; out of display page! 7403 0000E63A E826F2FFFF <1> call pixels_to_byte_count 7404 <1> ; eax = font start offset 7405 0000E63F 0305[929D0100] <1> add eax, [v_mem] ; LFB start address 7406 0000E645 A3[9A9D0100] <1> mov [v_str], eax ; font start address 7407 <1> 7408 0000E64A 890D[A29D0100] <1> mov [maskcolor], ecx ; save char's color 7409 <1> 7410 0000E650 8835[909D0100] <1> mov [v_ops], dh 7411 <1> 7412 0000E656 81E6FFFF0000 <1> and esi, 0FFFFh 7413 0000E65C 8935[AA9D0100] <1> mov [buffer8], esi ; start column 7414 <1> 7415 0000E662 31DB <1> xor ebx, ebx ; 0 7416 0000E664 31C0 <1> xor eax, eax ; 15/02/2021 7417 <1> 7418 0000E666 F6C680 <1> test dh, 80h 7419 0000E669 7577 <1> jnz short pix_op_chr_u ; user font 7420 <1> 7421 0000E66B 80E63F <1> and dh, 3Fh ; clear bit 6, [UFONT] option bit 7422 0000E66E 7409 <1> jz short pix_op_chr_0 7423 <1> 7424 0000E670 80FE07 <1> cmp dh, 7 7425 0000E673 7732 <1> ja short pix_op_chr_err 7426 <1> ; invalid (undefined) option 7427 0000E675 88F4 <1> mov ah, dh 7428 0000E677 D0EC <1> shr ah, 1 7429 <1> ; ah = 0 to 3, scale 7430 <1> ;jmp short pix_op_chr_font_pixels 7431 <1> 7432 <1> pix_op_chr_font_pixels: 7433 <1> ; 05/02/2021 7434 <1> ; write scaled font to buffer 7435 <1> 7436 <1> ; DL = ASCII code of character 7437 <1> ; AH = scale 7438 <1> ; EDI = buffer address (kernel) 7439 <1> 7440 <1> pix_op_chr_0: 7441 0000E679 88D3 <1> mov bl, dl ; 15/02/2021 7442 0000E67B 31C9 <1> xor ecx, ecx 7443 0000E67D B610 <1> mov dh, 16 7444 0000E67F F605[909D0100]01 <1> test byte [v_ops], 1 ; 8x8 font ? 7445 0000E686 7428 <1> jz short pix_op_chr_2 ; 8x16 font 7446 0000E688 B608 <1> mov dh, 8 7447 0000E68A C1E303 <1> shl ebx, 3 ; * 8 7448 0000E68D F605[909D0100]40 <1> test byte [v_ops], 40h ; [ufont] option 7449 0000E694 7412 <1> jz short pix_op_chr_1 ; no 7450 <1> ; test 8x8 user font is ready flag 7451 0000E696 F605[869D0100]01 <1> test byte [ufont], 1 7452 0000E69D 7409 <1> jz short pix_op_chr_1 ; no 7453 0000E69F 81C300500900 <1> add ebx, VGAFONT8USER 7454 0000E6A5 EB2C <1> jmp short pix_op_chr_fpos_0 7455 <1> pix_op_chr_err: 7456 0000E6A7 C3 <1> retn 7457 <1> pix_op_chr_1: 7458 0000E6A8 81C3[404D0100] <1> add ebx, vgafont8 ; system font (8x8) 7459 0000E6AE EB23 <1> jmp short pix_op_chr_fpos_0 7460 <1> pix_op_chr_2: 7461 0000E6B0 C1E304 <1> shl ebx, 4 ; * 16 7462 0000E6B3 F605[909D0100]40 <1> test byte [v_ops], 40h ; [ufont] option 7463 0000E6BA 7411 <1> jz short pix_op_chr_3 ; no 7464 <1> ; test 8x16 user font is ready flag 7465 0000E6BC F605[869D0100]02 <1> test byte [ufont], 2 7466 0000E6C3 7408 <1> jz short pix_op_chr_3 ; no 7467 0000E6C5 81C300400900 <1> add ebx, VGAFONT16USER 7468 0000E6CB EB06 <1> jmp short pix_op_chr_fpos_0 7469 <1> pix_op_chr_3: 7470 0000E6CD 81C3[40630100] <1> add ebx, vgafont16 ; system font (8x16) 7471 <1> pix_op_chr_fpos_0: 7472 0000E6D3 20E4 <1> and ah, ah 7473 0000E6D5 754A <1> jnz short pix_op_chr_fpos_1 ; scale > 1 7474 <1> ; no scale (scale = 1) 7475 0000E6D7 89DE <1> mov esi, ebx ; 15/02/2021 7476 0000E6D9 88F1 <1> mov cl, dh ; rows/height (16 or 8) 7477 0000E6DB B608 <1> mov dh, 8 ; columns/width 7478 0000E6DD E9CB000000 <1> jmp pix_op_chr_f2p 7479 <1> pix_op_chr_u: 7480 <1> ; write user defined font 7481 0000E6E2 80FE80 <1> cmp dh, 80h 7482 0000E6E5 75C0 <1> jne short pix_op_chr_err 7483 0000E6E7 80FA07 <1> cmp dl, 7 7484 0000E6EA 77BB <1> ja short pix_op_chr_err 7485 <1> 7486 <1> ; 16/02/2021 7487 0000E6EC 89FE <1> mov esi, edi ; user's font buffer 7488 <1> 7489 <1> ;xor eax, eax 7490 <1> ; eax = 0 ; 15/02/2021 7491 0000E6EE 88D4 <1> mov ah, dl 7492 0000E6F0 D0EC <1> shr ah, 1 7493 0000E6F2 FEC4 <1> inc ah 7494 <1> ; ah = 1 to 4 7495 0000E6F4 88E0 <1> mov al, ah 7496 0000E6F6 C0E003 <1> shl al, 3 ; * 8 7497 <1> ; al = 8,16,24,32 7498 0000E6F9 88C3 <1> mov bl, al 7499 0000E6FB 88C7 <1> mov bh, al 7500 0000E6FD F6E4 <1> mul ah 7501 <1> ; ax = 8,32,72,128 bytes 7502 0000E6FF F6C201 <1> test dl, 1 7503 0000E702 7404 <1> jz short pix_op_chr_u_0 7504 <1> ;shl ax, 1 ; *2 7505 <1> ; 23/07/2022 7506 0000E704 D1E0 <1> shl eax, 1 7507 <1> ; ax = 16,32,144,256 bytes 7508 0000E706 D0E7 <1> shl bh, 1 7509 <1> pix_op_chr_u_0: 7510 <1> ; eax = byte count 7511 0000E708 89C1 <1> mov ecx, eax 7512 0000E70A BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 7513 <1> ; esi = user buffer 7514 0000E70F E851240000 <1> call transfer_from_user_buffer 7515 0000E714 7291 <1> jc short pix_op_chr_err 7516 <1> 7517 0000E716 88F9 <1> mov cl, bh ; rows/height 7518 0000E718 88DE <1> mov dh, bl ; columns (width) 7519 0000E71A 89FE <1> mov esi, edi ; VBE3SAVERESTOREBLOCK 7520 0000E71C E98C000000 <1> jmp pix_op_chr_f2p 7521 <1> 7522 <1> pix_op_chr_fpos_1: 7523 <1> ; 18/02/2021 7524 <1> ; scale > 1 7525 0000E721 88F5 <1> mov ch, dh ; 16 or 8 7526 0000E723 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 7527 0000E728 89FE <1> mov esi, edi 7528 0000E72A FECC <1> dec ah 7529 0000E72C 7522 <1> jnz short pix_op_chr_fpos_5 ; scale > 2 7530 <1> ; scale = 2 7531 <1> pix_op_chr_fpos_2: 7532 0000E72E B108 <1> mov cl, 8 7533 0000E730 8A13 <1> mov dl, [ebx] 7534 <1> pix_op_chr_fpos_3: 7535 <1> ;shl ax, 2 7536 <1> ; 23/07/2022 7537 0000E732 C1E002 <1> shl eax, 2 7538 0000E735 D0E2 <1> shl dl, 1 7539 0000E737 7302 <1> jnc short pix_op_chr_fpos_4 7540 0000E739 0C03 <1> or al, 3 7541 <1> pix_op_chr_fpos_4: 7542 0000E73B FEC9 <1> dec cl 7543 0000E73D 75F3 <1> jnz short pix_op_chr_fpos_3 7544 0000E73F 66AB <1> stosw 7545 <1> ; 18/02/2021 7546 0000E741 66AB <1> stosw 7547 0000E743 43 <1> inc ebx 7548 0000E744 FECD <1> dec ch 7549 0000E746 75E6 <1> jnz short pix_op_chr_fpos_2 7550 <1> ; scale = 2 7551 0000E748 88F1 <1> mov cl, dh ; 16 or 8 (height/rows) 7552 0000E74A D0E1 <1> shl cl, 1 ; 32 or 16 rows 7553 0000E74C B610 <1> mov dh, 16 ; columns (width) 7554 0000E74E EB5D <1> jmp short pix_op_chr_f2p 7555 <1> pix_op_chr_fpos_5: 7556 0000E750 FECC <1> dec ah 7557 0000E752 7538 <1> jnz short pix_op_chr_fpos_9 ; scale = 4 7558 <1> ; scale = 3 7559 <1> pix_op_chr_fpos_6: 7560 0000E754 B108 <1> mov cl, 8 7561 0000E756 8A13 <1> mov dl, [ebx] 7562 <1> pix_op_chr_fpos_7: 7563 0000E758 C1E003 <1> shl eax, 3 7564 0000E75B D0E2 <1> shl dl, 1 ; 18/02/2021 7565 0000E75D 7302 <1> jnc short pix_op_chr_fpos_8 7566 0000E75F 0C07 <1> or al, 7 7567 <1> pix_op_chr_fpos_8: 7568 0000E761 FEC9 <1> dec cl 7569 0000E763 75F3 <1> jnz short pix_op_chr_fpos_7 7570 0000E765 66AB <1> stosw 7571 <1> ; 18/02/2021 7572 0000E767 C1C810 <1> ror eax, 16 7573 0000E76A AA <1> stosb 7574 0000E76B C1C010 <1> rol eax, 16 7575 0000E76E 66AB <1> stosw 7576 0000E770 C1C810 <1> ror eax, 16 7577 0000E773 AA <1> stosb 7578 0000E774 C1C010 <1> rol eax, 16 7579 0000E777 66AB <1> stosw 7580 0000E779 C1E810 <1> shr eax, 16 ; 27/02/2021 7581 0000E77C AA <1> stosb 7582 0000E77D 43 <1> inc ebx 7583 <1> ; 18/02/2021 7584 0000E77E FECD <1> dec ch 7585 0000E780 75D2 <1> jnz short pix_op_chr_fpos_6 7586 <1> ; scale = 3 7587 0000E782 88F1 <1> mov cl, dh ; 16 or 8 (height/rows) 7588 0000E784 D0E1 <1> shl cl, 1 7589 0000E786 00F1 <1> add cl, dh ; 48 or 24 rows 7590 0000E788 B618 <1> mov dh, 24 ; columns (width) 7591 0000E78A EB21 <1> jmp short pix_op_chr_f2p 7592 <1> 7593 <1> pix_op_chr_fpos_9: 7594 <1> ; scale = 4 7595 0000E78C B108 <1> mov cl, 8 7596 0000E78E 8A13 <1> mov dl, [ebx] 7597 <1> pix_op_chr_fpos_10: 7598 <1> ; 18/02/2021 7599 0000E790 C1E004 <1> shl eax, 4 7600 0000E793 D0E2 <1> shl dl, 1 ; 18/02/2021 7601 0000E795 7302 <1> jnc short pix_op_chr_fpos_11 7602 0000E797 0C0F <1> or al, 0Fh ; or al, 15 7603 <1> pix_op_chr_fpos_11: 7604 0000E799 FEC9 <1> dec cl 7605 0000E79B 75F3 <1> jnz short pix_op_chr_fpos_10 7606 0000E79D AB <1> stosd 7607 <1> ; 18/02/2021 7608 0000E79E AB <1> stosd 7609 0000E79F AB <1> stosd 7610 0000E7A0 AB <1> stosd 7611 0000E7A1 43 <1> inc ebx 7612 0000E7A2 FECD <1> dec ch 7613 0000E7A4 75E6 <1> jnz short pix_op_chr_fpos_9 7614 <1> ; scale = 4 7615 0000E7A6 88F1 <1> mov cl, dh ; 16 or 8 (height/rows) 7616 0000E7A8 C0E102 <1> shl cl, 2 ; 64 or 32 rows 7617 0000E7AB B620 <1> mov dh, 32 ; columns (width) 7618 <1> ;jmp short pix_op_chr_f2p 7619 <1> 7620 <1> pix_op_chr_f2p: 7621 <1> ; write font pixels 7622 0000E7AD 8B3D[9A9D0100] <1> mov edi, [v_str] 7623 <1> ; 15/02/2021 7624 <1> pix_op_chr_f2p_next: 7625 0000E7B3 80FE08 <1> cmp dh, 8 7626 0000E7B6 7706 <1> ja short pix_op_chr_f2p_24 7627 <1> pix_op_chr_f2p_8: 7628 0000E7B8 AC <1> lodsb 7629 0000E7B9 C1E018 <1> shl eax, 24 ; 15/02/2021 7630 0000E7BC EB16 <1> jmp short pix_op_chr_f2p_0 7631 <1> pix_op_chr_f2p_24: 7632 0000E7BE 80FE18 <1> cmp dh, 24 7633 0000E7C1 7710 <1> ja short pix_op_chr_f2p_32 7634 0000E7C3 7207 <1> jb short pix_op_chr_f2p_16 7635 <1> ; 27/02/2021 7636 <1> ;mov eax, [esi] 7637 0000E7C5 AD <1> lodsd 7638 0000E7C6 C1E008 <1> shl eax, 8 7639 <1> ;add esi, 3 7640 0000E7C9 4E <1> dec esi 7641 0000E7CA EB08 <1> jmp short pix_op_chr_f2p_0 7642 <1> pix_op_chr_f2p_16: 7643 0000E7CC 66AD <1> lodsw 7644 0000E7CE C1E010 <1> shl eax, 16 ; 15/02/2021 7645 0000E7D1 EB01 <1> jmp short pix_op_chr_f2p_0 7646 <1> pix_op_chr_f2p_32: 7647 0000E7D3 AD <1> lodsd 7648 <1> pix_op_chr_f2p_0: 7649 <1> ; EAX = font row (8,16,24,32 pixels) 7650 <1> ; (bits are shifted to left) 7651 <1> ; CL = rows 7652 <1> ; DH = bits per row (8,16,24,32) 7653 0000E7D4 8B1D[AA9D0100] <1> mov ebx, [buffer8] ; start column 7654 0000E7DA 57 <1> push edi ; * 7655 0000E7DB 52 <1> push edx ; ** 7656 <1> pix_op_chr_f2p_1: 7657 0000E7DC E82E000000 <1> call pix_op_chr_w_pixel 7658 <1> pix_op_chr_f2p_2: 7659 0000E7E1 663B1D[8E9D0100] <1> cmp bx, [v_width] ; current column 7660 0000E7E8 7304 <1> jnb short pix_op_chr_f2p_3 7661 0000E7EA FECE <1> dec dh 7662 0000E7EC 75EE <1> jnz short pix_op_chr_f2p_1 ; next bit 7663 <1> pix_op_chr_f2p_3: 7664 <1> ;mov ebx, [buffer8] 7665 0000E7EE 5A <1> pop edx ; ** 7666 0000E7EF 58 <1> pop eax ; * 7667 0000E7F0 3B3D[9E9D0100] <1> cmp edi, [v_end] 7668 0000E7F6 7316 <1> jnb short pix_op_chr_f2p_4 7669 0000E7F8 FEC9 <1> dec cl 7670 0000E7FA 7412 <1> jz short pix_op_chr_f2p_4 7671 <1> ; 27/02/2021 7672 0000E7FC 89C7 <1> mov edi, eax 7673 0000E7FE 0FB705[8E9D0100] <1> movzx eax, word [v_width] 7674 0000E805 E85BF0FFFF <1> call pixels_to_byte_count 7675 0000E80A 01C7 <1> add edi, eax ; next position 7676 0000E80C EBA5 <1> jmp short pix_op_chr_f2p_next 7677 <1> pix_op_chr_f2p_4: 7678 0000E80E C3 <1> retn 7679 <1> 7680 <1> pix_op_chr_w_pixel: 7681 <1> ; 15/02/2021 7682 0000E80F 89C5 <1> mov ebp, eax 7683 0000E811 A1[A29D0100] <1> mov eax, [maskcolor] 7684 0000E816 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 7685 0000E81D 7711 <1> ja short pix_op_chr_wp_2 7686 <1> ; 256 colors (1 byte per pixel) 7687 0000E81F D1E5 <1> shl ebp, 1 7688 0000E821 7302 <1> jnc short pix_op_chr_wp_0 7689 0000E823 8807 <1> mov [edi], al 7690 <1> pix_op_chr_wp_0: 7691 0000E825 47 <1> inc edi 7692 0000E826 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 7693 <1> pix_op_chr_wp_1: 7694 0000E82C 43 <1> inc ebx 7695 0000E82D 89E8 <1> mov eax, ebp 7696 0000E82F C3 <1> retn 7697 <1> pix_op_chr_wp_2: 7698 0000E830 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 7699 0000E837 772E <1> ja short pix_op_chr_wp_6 ; 32bpp 7700 0000E839 721C <1> jb short pix_op_chr_wp_4 ; 16bpp 7701 <1> ; 24 bit true colors 7702 <1> ; * 3 7703 0000E83B D1E5 <1> shl ebp, 1 7704 0000E83D 7309 <1> jnc short pix_op_chr_wp_3 7705 0000E83F 668907 <1> mov [edi], ax 7706 0000E842 C1E810 <1> shr eax, 16 7707 0000E845 884702 <1> mov [edi+2], al 7708 <1> pix_op_chr_wp_3: 7709 0000E848 B803000000 <1> mov eax, 3 ; 27/02/2021 7710 0000E84D 01C7 <1> add edi, eax ; add edi, 3 7711 0000E84F 0105[6C8E0100] <1> add [u.r0], eax ; +3 7712 <1> 7713 0000E855 EBD5 <1> jmp short pix_op_chr_wp_1 7714 <1> 7715 <1> pix_op_chr_wp_4: 7716 <1> ; 16 bit (65536) colors 7717 0000E857 D1E5 <1> shl ebp, 1 7718 0000E859 7303 <1> jnc short pix_op_chr_wp_5 7719 0000E85B 668907 <1> mov [edi], ax 7720 <1> pix_op_chr_wp_5: 7721 0000E85E 47 <1> inc edi 7722 0000E85F FF05[6C8E0100] <1> inc dword [u.r0] ; +1 7723 0000E865 EBBE <1> jmp short pix_op_chr_wp_0 7724 <1> 7725 <1> pix_op_chr_wp_6: 7726 <1> ; 32 bit true colors 7727 0000E867 D1E5 <1> shl ebp, 1 7728 0000E869 7302 <1> jnc short pix_op_chr_wp_7 7729 0000E86B 8907 <1> mov [edi], eax 7730 <1> pix_op_chr_wp_7: 7731 0000E86D 31C0 <1> xor eax, eax 7732 0000E86F B004 <1> mov al, 4 7733 0000E871 01C7 <1> add edi, eax ; add edi, 4 7734 0000E873 0105[6C8E0100] <1> add [u.r0], eax ; +4 7735 0000E879 EBB1 <1> jmp short pix_op_chr_wp_1 7736 <1> 7737 <1> m_pix_op_cpy: 7738 <1> ; 26/02/2021 7739 <1> ; 06/02/2021 7740 <1> ; MASKED COPY PIXELS (full screen) 7741 <1> ; 7742 <1> ; jump from pix_op_cpy 7743 <1> ; 7744 <1> ; INPUT: 7745 <1> ; ecx = transfer count (bytes) 7746 <1> ; edi = [v_mem] = start address of LFB 7747 <1> ; esi = user's buffer address (virtual) 7748 <1> ; 7749 <1> ; OUTPUT: 7750 <1> ; [u.r0] will be > 0 if succesful 7751 <1> 7752 <1> ; Full screen masked copy 7753 <1> 7754 <1> ; Modified regs: eax, ebx, edx, esi, edi, ecx 7755 <1> 7756 <1> m_pix_op_cpy_0: 7757 <1> ;push ebx ; *** ; 26/02/2021 7758 0000E87B 57 <1> push edi ; ** 7759 0000E87C 51 <1> push ecx ; * 7760 0000E87D 81F9F8070000 <1> cmp ecx, 2040 ; (3*680) ; 26/02/2021 7761 0000E883 7605 <1> jna short m_pix_op_cpy_1 7762 0000E885 B9F8070000 <1> mov ecx, 2040 7763 <1> m_pix_op_cpy_1: 7764 0000E88A BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK ; temporary buff 7765 0000E88F E8D1220000 <1> call transfer_from_user_buffer 7766 0000E894 726C <1> jc short m_pix_op_cpy_3 7767 0000E896 01CE <1> add esi, ecx 7768 0000E898 89F5 <1> mov ebp, esi ; save user's buffer address 7769 0000E89A 89FE <1> mov esi, edi 7770 0000E89C 89CB <1> mov ebx, ecx 7771 0000E89E 59 <1> pop ecx ; * 7772 0000E89F 29D9 <1> sub ecx, ebx 7773 0000E8A1 5F <1> pop edi ; ** 7774 0000E8A2 31D2 <1> xor edx, edx ; 26/02/2021 7775 0000E8A4 803D[919D0100]08 <1> cmp byte [v_bpp], 8 7776 0000E8AB 7435 <1> je short m_pix_op_cpy_1_8 7777 0000E8AD 803D[919D0100]18 <1> cmp byte [v_bpp], 24 7778 0000E8B4 776D <1> ja short m_pix_op_cpy_1_32 7779 0000E8B6 724D <1> jb short m_pix_op_cpy_1_16 7780 <1> m_pix_op_cpy_1_24: 7781 <1> ; 24 bit masked copy 7782 <1> ;mov edx, 3 7783 0000E8B8 B203 <1> mov dl, 3 ; 26/02/2021 7784 <1> m_pix_op_cpy_1_24_0: 7785 0000E8BA 66AD <1> lodsw 7786 0000E8BC C1E010 <1> shl eax, 16 7787 0000E8BF AC <1> lodsb 7788 0000E8C0 C1C010 <1> rol eax, 16 7789 0000E8C3 3B05[A29D0100] <1> cmp eax, [maskcolor] 7790 0000E8C9 740F <1> je short m_pix_op_cpy_1_24_1 ; exclude 7791 0000E8CB 668907 <1> mov [edi], ax 7792 0000E8CE C1E810 <1> shr eax, 16 7793 0000E8D1 884702 <1> mov [edi+2], al 7794 0000E8D4 0115[6C8E0100] <1> add [u.r0], edx ; +3 7795 <1> m_pix_op_cpy_1_24_1: 7796 0000E8DA 01D7 <1> add edi, edx ; +3 7797 0000E8DC 29D3 <1> sub ebx, edx ; sub ebx, 3 7798 0000E8DE 77DA <1> ja short m_pix_op_cpy_1_24_0 7799 0000E8E0 EB15 <1> jmp short m_pix_op_cpy_2 7800 <1> 7801 <1> m_pix_op_cpy_1_8: 7802 <1> ; 8 bit masked copy 7803 0000E8E2 AC <1> lodsb 7804 0000E8E3 3A05[A29D0100] <1> cmp al, [maskcolor] 7805 0000E8E9 7408 <1> je short m_pix_op_cpy_1_8_1 ; exclude 7806 0000E8EB 8807 <1> mov [edi], al 7807 0000E8ED FF05[6C8E0100] <1> inc dword [u.r0] ; +1 7808 <1> m_pix_op_cpy_1_8_1: 7809 0000E8F3 47 <1> inc edi ; +1 7810 0000E8F4 4B <1> dec ebx 7811 0000E8F5 75EB <1> jnz short m_pix_op_cpy_1_8 7812 <1> m_pix_op_cpy_2: 7813 0000E8F7 89EE <1> mov esi, ebp ; restore user's buffer addr 7814 0000E8F9 09C9 <1> or ecx, ecx 7815 <1> ; 26/02/2021 7816 0000E8FB 7407 <1> jz short m_pix_of_cpy_4 7817 0000E8FD E979FFFFFF <1> jmp m_pix_op_cpy_0 7818 <1> m_pix_op_cpy_3: 7819 0000E902 59 <1> pop ecx ; * 7820 0000E903 5F <1> pop edi ; ** 7821 <1> m_pix_of_cpy_4: 7822 <1> ;pop ebx ; *** ; 26/02/2021 7823 0000E904 C3 <1> retn 7824 <1> 7825 <1> m_pix_op_cpy_1_16: 7826 <1> ; 16 bit masked copy 7827 <1> ;mov edx, 2 7828 0000E905 B202 <1> mov dl, 2 ; 26/02/2021 7829 <1> m_pix_op_cpy_1_16_0: 7830 0000E907 66AD <1> lodsw 7831 0000E909 663B05[A29D0100] <1> cmp ax, [maskcolor] 7832 0000E910 7409 <1> je short m_pix_op_cpy_1_16_1 ; exclude 7833 0000E912 668907 <1> mov [edi], ax 7834 0000E915 0115[6C8E0100] <1> add [u.r0], edx ; +2 7835 <1> m_pix_op_cpy_1_16_1: 7836 0000E91B 01D7 <1> add edi, edx ; +2 7837 0000E91D 29D3 <1> sub ebx, edx ; sub ebx, 2 7838 0000E91F 77E6 <1> ja short m_pix_op_cpy_1_16_0 7839 0000E921 EBD4 <1> jmp short m_pix_op_cpy_2 7840 <1> 7841 <1> m_pix_op_cpy_1_32: 7842 <1> ; 32 bit masked copy 7843 <1> ;mov edx, 4 7844 0000E923 B204 <1> mov dl, 4 ; 26/02/2021 7845 <1> m_pix_op_cpy_1_32_0: 7846 0000E925 AD <1> lodsd 7847 0000E926 3B05[A29D0100] <1> cmp eax, [maskcolor] 7848 0000E92C 7408 <1> je short m_pix_op_cpy_1_32_1 ; exclude 7849 0000E92E 8907 <1> mov [edi], eax 7850 0000E930 0115[6C8E0100] <1> add [u.r0], edx ; +4 7851 <1> m_pix_op_cpy_1_32_1: 7852 0000E936 01D7 <1> add edi, edx ; +4 7853 0000E938 29D3 <1> sub ebx, edx ; sub ebx, 4 7854 0000E93A 77E9 <1> ja short m_pix_op_cpy_1_32_0 7855 0000E93C EBB9 <1> jmp short m_pix_op_cpy_2 7856 <1> 7857 <1> m_pix_op_cpy_w: 7858 <1> ; 26/02/2021 7859 <1> ; 06/02/2021 7860 <1> ; MASKED COPY PIXELS (window) 7861 <1> ; 7862 <1> ; jump from pix_op_cpy_w 7863 <1> ; 7864 <1> ; INPUT: 7865 <1> ; ecx = bytes per row (to be applied) 7866 <1> ; edx = screen width in bytes 7867 <1> ; ebx = row count 7868 <1> ; esi = user's buffer address 7869 <1> ; [v_str] = window start address 7870 <1> ; 7871 <1> ; OUTPUT: 7872 <1> ; [u.r0] will be > 0 if succesful 7873 <1> 7874 <1> ; Window masked copy 7875 <1> 7876 <1> m_pix_op_cpy_w_0: 7877 0000E93E 8B3D[9A9D0100] <1> mov edi, [v_str] 7878 <1> m_pix_op_cpy_w_1: 7879 0000E944 57 <1> push edi 7880 0000E945 56 <1> push esi 7881 0000E946 53 <1> push ebx 7882 0000E947 52 <1> push edx 7883 0000E948 51 <1> push ecx 7884 0000E949 E82DFFFFFF <1> call m_pix_op_cpy ; 26/02/2021 7885 0000E94E 59 <1> pop ecx 7886 0000E94F 5A <1> pop edx 7887 0000E950 5B <1> pop ebx 7888 0000E951 5E <1> pop esi 7889 0000E952 5F <1> pop edi 7890 0000E953 7209 <1> jc short m_pix_op_cpy_w_2 7891 0000E955 4B <1> dec ebx 7892 0000E956 7406 <1> jz short m_pix_op_cpy_w_2 ; ok. 7893 <1> ; next row 7894 0000E958 01CE <1> add esi, ecx ; next row in user's buffer 7895 0000E95A 01D7 <1> add edi, edx ; next row of window (system) 7896 0000E95C EBE6 <1> jmp short m_pix_op_cpy_w_1 7897 <1> m_pix_op_cpy_w_2: 7898 0000E95E C3 <1> retn 7899 <1> 7900 <1> m_pix_op_new: 7901 <1> ; 06/02/2021 7902 <1> ; CHANGE COLOR (MASKED, full screen) 7903 <1> ; 7904 <1> ; jump from pix_op_new 7905 <1> ; 7906 <1> ; INPUT: 7907 <1> ; eax = color (AL, AX, EAX) 7908 <1> ; ecx = [v_siz] ; display page pixel count 7909 <1> ; esi = edi = [v_mem] ; LFB start address 7910 <1> ; 7911 <1> ; [maskcolor] = mask color (to be excluded) 7912 <1> ; 7913 <1> ; OUTPUT: 7914 <1> ; [u.r0] will be > 0 if succesful 7915 <1> 7916 <1> ; Full screen 7917 <1> m_pix_op_new_0: 7918 0000E95F 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 7919 0000E966 7717 <1> ja short m_pix_op_new_1 7920 <1> ; 256 colors (8bpp) 7921 <1> ;jmp short m_pix_op_new_8 7922 <1> m_pix_op_new_8: 7923 <1> ; 8 bit colors (256 colors) 7924 0000E968 88C2 <1> mov dl, al ; new color 7925 <1> m_pix_op_new_8_0: 7926 0000E96A AC <1> lodsb 7927 0000E96B 3A05[A29D0100] <1> cmp al, [maskcolor] 7928 0000E971 7408 <1> je short m_pix_op_new_8_1 ; exclude 7929 0000E973 8817 <1> mov [edi], dl 7930 0000E975 FF05[6C8E0100] <1> inc dword [u.r0] 7931 <1> m_pix_op_new_8_1: 7932 0000E97B 47 <1> inc edi 7933 0000E97C E2EC <1> loop m_pix_op_new_8_0 7934 0000E97E C3 <1> retn 7935 <1> m_pix_op_new_1: 7936 0000E97F 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 7937 0000E986 774B <1> ja short m_pix_op_new_3 ; 32bpp 7938 0000E988 722C <1> jb short m_pix_op_new_2 ; 16bpp 7939 <1> ; 24 bit true colors 7940 <1> ;jmp short m_pix_op_new_24 7941 <1> m_pix_op_new_24: 7942 <1> ; 24 bit true colors 7943 0000E98A 89C2 <1> mov edx, eax ; new color 7944 <1> m_pix_op_new_24_0: 7945 0000E98C 66AD <1> lodsw 7946 0000E98E C1E010 <1> shl eax, 16 7947 0000E991 AC <1> lodsb 7948 0000E992 C1C010 <1> rol eax, 16 7949 0000E995 3B05[A29D0100] <1> cmp eax, [maskcolor] 7950 0000E99B 7413 <1> je short m_pix_op_new_24_1 ; exclude 7951 0000E99D 668917 <1> mov [edi], dx 7952 0000E9A0 C1CA10 <1> ror edx, 16 7953 0000E9A3 885702 <1> mov [edi+2], dl 7954 0000E9A6 C1C210 <1> rol edx, 16 7955 0000E9A9 8305[6C8E0100]03 <1> add dword [u.r0], 3 7956 <1> m_pix_op_new_24_1: 7957 0000E9B0 83C703 <1> add edi, 3 7958 0000E9B3 E2D7 <1> loop m_pix_op_new_24_0 7959 0000E9B5 C3 <1> retn 7960 <1> ; 65536 colors (16bpp) 7961 <1> m_pix_op_new_2: 7962 <1> ;jmp short m_pix_op_new_16 7963 <1> m_pix_op_new_16: 7964 <1> ; 16 bit colors (65536 colors) 7965 0000E9B6 89C2 <1> mov edx, eax ; new color 7966 <1> m_pix_op_new_16_0: 7967 0000E9B8 66AD <1> lodsw 7968 0000E9BA 663B05[A29D0100] <1> cmp ax, [maskcolor] 7969 0000E9C1 740A <1> je short m_pix_op_new_16_1 ; exclude 7970 0000E9C3 668917 <1> mov [edi], dx 7971 0000E9C6 8305[6C8E0100]02 <1> add dword [u.r0], 2 7972 <1> m_pix_op_new_16_1: 7973 0000E9CD 83C702 <1> add edi, 2 7974 0000E9D0 E2E6 <1> loop m_pix_op_new_16_0 7975 0000E9D2 C3 <1> retn 7976 <1> m_pix_op_new_3: 7977 <1> ; 32 bit true colors 7978 <1> ;jmp short m_pix_op_new_32 7979 <1> m_pix_op_new_32: 7980 <1> ; 32 bit true colors 7981 0000E9D3 89C2 <1> mov edx, eax ; new color 7982 <1> m_pix_op_new_32_0: 7983 0000E9D5 AD <1> lodsd 7984 0000E9D6 3B05[A29D0100] <1> cmp eax, [maskcolor] 7985 0000E9DC 7409 <1> je short m_pix_op_new_32_1 ; exclude 7986 0000E9DE 8917 <1> mov [edi], edx 7987 0000E9E0 8305[6C8E0100]04 <1> add dword [u.r0], 4 7988 <1> m_pix_op_new_32_1: 7989 0000E9E7 83C704 <1> add edi, 4 7990 0000E9EA E2E9 <1> loop m_pix_op_new_32_0 7991 0000E9EC C3 <1> retn 7992 <1> 7993 <1> m_pix_op_new_w: 7994 <1> ; 06/02/2021 7995 <1> ; CHANGE COLOR (MASKED, window) 7996 <1> ; 7997 <1> ; jump from pix_op_new_w 7998 <1> ; 7999 <1> ; INPUT: 8000 <1> ; ecx = bytes per row (to be applied) 8001 <1> ; edx = screen width in bytes 8002 <1> ; ebx = row count 8003 <1> ; eax = color 8004 <1> ; 8005 <1> ; [maskcolor] = mask color (to be excluded) 8006 <1> ; 8007 <1> ; OUTPUT: 8008 <1> ; [u.r0] will be > 0 if succesful 8009 <1> 8010 <1> ; Window 8011 <1> ;mov edi, [v_str] ; LFB start address 8012 <1> ;mov esi, edi 8013 <1> 8014 0000E9ED 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8015 0000E9F4 7707 <1> ja short m_pix_op_new_w_1 8016 <1> 8017 <1> ; 256 colors (8bpp) 8018 0000E9F6 BD[68E90000] <1> mov ebp, m_pix_op_new_8 8019 0000E9FB EB1E <1> jmp short m_pix_op_new_w_x 8020 <1> 8021 <1> m_pix_op_new_w_1: 8022 0000E9FD 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8023 0000EA04 7710 <1> ja short m_pix_op_new_w_3 ; 32bpp 8024 0000EA06 7207 <1> jb short m_pix_op_new_w_2 ; 16bpp 8025 <1> 8026 <1> ; 24 bit true colors 8027 0000EA08 BD[8AE90000] <1> mov ebp, m_pix_op_new_24 8028 0000EA0D EB0C <1> jmp short m_pix_op_new_w_x 8029 <1> 8030 <1> ; 65536 colors (16bpp) 8031 <1> m_pix_op_new_w_2: 8032 0000EA0F BD[B6E90000] <1> mov ebp, m_pix_op_new_16 8033 0000EA14 EB05 <1> jmp short m_pix_op_new_w_x 8034 <1> 8035 <1> ; 32 bit true colors 8036 <1> m_pix_op_new_w_3: 8037 0000EA16 BD[D3E90000] <1> mov ebp, m_pix_op_new_32 8038 <1> ;jmp short m_pix_op_new_w_x 8039 <1> 8040 <1> m_pix_op_new_w_x: 8041 <1> m_pix_op_add_w_x: 8042 <1> m_pix_op_sub_w_x: 8043 <1> m_pix_op_mix_w_x: 8044 <1> m_pix_op_and_w_x: 8045 <1> m_pix_op_orc_w_x: 8046 <1> m_pix_op_xor_w_x: 8047 <1> m_pix_op_not_w_x: 8048 <1> m_pix_op_neg_w_x: 8049 <1> m_pix_op_inc_w_x: 8050 <1> m_pix_op_dec_w_x: 8051 <1> ; 27/02/2021 8052 <1> ; 26/02/2021 8053 <1> ; 06/02/2021 8054 <1> ; ecx = bytes per row (to be applied) 8055 <1> ; edx = windows (screen) width in bytes 8056 <1> ; ebx = row count 8057 <1> ; eax = color 8058 <1> ; ebp = pixel operation subroutine address 8059 <1> ; edi = esi = window start address 8060 <1> 8061 0000EA1B 8B3D[9A9D0100] <1> mov edi, [v_str] ; LFB start address 8062 0000EA21 89FE <1> mov esi, edi 8063 <1> m_pix_op_w_x_next: 8064 0000EA23 52 <1> push edx 8065 0000EA24 51 <1> push ecx 8066 0000EA25 56 <1> push esi 8067 0000EA26 57 <1> push edi 8068 0000EA27 50 <1> push eax ; 26/02/2021 8069 0000EA28 8B0D[A69D0100] <1> mov ecx, [pixcount] ; 27/02/2021 8070 0000EA2E FFD5 <1> call ebp ; call masked pixel-row operation 8071 0000EA30 58 <1> pop eax ; 26/02/2021 8072 0000EA31 5F <1> pop edi 8073 0000EA32 5E <1> pop esi 8074 0000EA33 59 <1> pop ecx 8075 0000EA34 5A <1> pop edx 8076 0000EA35 01D6 <1> add esi, edx ; next row 8077 0000EA37 01D7 <1> add edi, edx ; next row 8078 0000EA39 4B <1> dec ebx 8079 0000EA3A 75E7 <1> jnz short m_pix_op_w_x_next 8080 0000EA3C C3 <1> retn 8081 <1> 8082 <1> m_pix_op_add: 8083 <1> ; 06/02/2021 8084 <1> ; ADD COLOR (MASKED, full screen) 8085 <1> ; 8086 <1> ; jump from pix_op_add 8087 <1> ; 8088 <1> ; INPUT: 8089 <1> ; eax = color (AL, AX, EAX) 8090 <1> ; ecx = [v_siz] ; display page pixel count 8091 <1> ; esi = edi = [v_mem] ; LFB start address 8092 <1> ; 8093 <1> ; [maskcolor] = mask color (to be excluded) 8094 <1> ; 8095 <1> ; OUTPUT: 8096 <1> ; [u.r0] will be > 0 if succesful 8097 <1> 8098 <1> ; Full screen 8099 <1> m_pix_op_add_0: 8100 0000EA3D 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8101 0000EA44 771C <1> ja short m_pix_op_add_1 8102 <1> ; 256 colors (8bpp) 8103 <1> ;jmp short m_pix_op_add_8 8104 <1> m_pix_op_add_8: 8105 <1> ; 8 bit colors (256 colors) 8106 0000EA46 88C2 <1> mov dl, al ; new color 8107 <1> m_pix_op_add_8_0: 8108 0000EA48 AC <1> lodsb 8109 0000EA49 3A05[A29D0100] <1> cmp al, [maskcolor] 8110 0000EA4F 740D <1> je short m_pix_op_add_8_1 ; exclude 8111 0000EA51 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8112 0000EA57 0017 <1> add [edi], dl 8113 0000EA59 7303 <1> jnc short m_pix_op_add_8_1 8114 0000EA5B C607FF <1> mov byte [edi], 0FFh 8115 <1> m_pix_op_add_8_1: 8116 0000EA5E 47 <1> inc edi 8117 0000EA5F E2E7 <1> loop m_pix_op_add_8_0 8118 0000EA61 C3 <1> retn 8119 <1> m_pix_op_add_1: 8120 0000EA62 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8121 0000EA69 775E <1> ja short m_pix_op_add_3 ; 32bpp 8122 0000EA6B 7238 <1> jb short m_pix_op_add_2 ; 16bpp 8123 <1> ; 24 bit true colors 8124 <1> ;jmp short m_pix_op_add_24 8125 <1> m_pix_op_add_24: 8126 <1> ; 24 bit true colors 8127 0000EA6D 89C2 <1> mov edx, eax ; new color 8128 0000EA6F 81CA000000FF <1> or edx, 0FF000000h 8129 <1> m_pix_op_add_24_0: 8130 0000EA75 66AD <1> lodsw 8131 0000EA77 C1E010 <1> shl eax, 16 8132 0000EA7A AC <1> lodsb 8133 0000EA7B C1C010 <1> rol eax, 16 8134 0000EA7E 3B05[A29D0100] <1> cmp eax, [maskcolor] 8135 0000EA84 7419 <1> je short m_pix_op_add_24_2 ; exclude 8136 0000EA86 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8137 0000EA8D 01D0 <1> add eax, edx 8138 0000EA8F 7305 <1> jnc short m_pix_op_add_24_1 8139 0000EA91 B8FFFFFF00 <1> mov eax, 0FFFFFFh 8140 <1> m_pix_op_add_24_1: 8141 0000EA96 668907 <1> mov [edi], ax 8142 0000EA99 C1E810 <1> shr eax, 16 8143 0000EA9C 884702 <1> mov [edi+2], al 8144 <1> m_pix_op_add_24_2: 8145 0000EA9F 83C703 <1> add edi, 3 ; +3 8146 0000EAA2 E2D1 <1> loop m_pix_op_add_24_0 8147 0000EAA4 C3 <1> retn 8148 <1> ; 65536 colors (16bpp) 8149 <1> m_pix_op_add_2: 8150 <1> ;jmp short m_pix_op_add_16 8151 <1> m_pix_op_add_16: 8152 <1> ; 16 bit colors (65536 colors) 8153 0000EAA5 89C2 <1> mov edx, eax ; new color 8154 <1> m_pix_op_add_16_0: 8155 0000EAA7 66AD <1> lodsw 8156 0000EAA9 663B05[A29D0100] <1> cmp ax, [maskcolor] 8157 0000EAB0 7411 <1> je short m_pix_op_add_16_1 ; exclude 8158 0000EAB2 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8159 0000EAB9 660117 <1> add [edi], dx 8160 0000EABC 7305 <1> jnc short m_pix_op_add_16_1 8161 0000EABE 66C707FFFF <1> mov word [edi], 0FFFFh 8162 <1> m_pix_op_add_16_1: 8163 0000EAC3 83C702 <1> add edi, 2 ; +2 8164 0000EAC6 E2DF <1> loop m_pix_op_add_16_0 8165 0000EAC8 C3 <1> retn 8166 <1> m_pix_op_add_3: 8167 <1> ; 32 bit true colors 8168 <1> ;jmp short m_pix_op_add_32 8169 <1> m_pix_op_add_32: 8170 <1> ; 32 bit true colors 8171 0000EAC9 89C2 <1> mov edx, eax ; new color 8172 <1> m_pix_op_add_32_0: 8173 0000EACB AD <1> lodsd 8174 0000EACC 3B05[A29D0100] <1> cmp eax, [maskcolor] 8175 0000EAD2 7411 <1> je short m_pix_op_add_32_1 ; exclude 8176 0000EAD4 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8177 0000EADB 0117 <1> add [edi], edx 8178 0000EADD 7306 <1> jnc short m_pix_op_add_32_1 8179 0000EADF C707FFFFFFFF <1> mov dword [edi], 0FFFFFFFFh 8180 <1> m_pix_op_add_32_1: 8181 0000EAE5 83C704 <1> add edi, 4 ; +4 8182 0000EAE8 E2E1 <1> loop m_pix_op_add_32_0 8183 0000EAEA C3 <1> retn 8184 <1> 8185 <1> m_pix_op_add_w: 8186 <1> ; 06/02/2021 8187 <1> ; ADD COLOR (MASKED, window) 8188 <1> ; 8189 <1> ; jump from pix_op_add_w 8190 <1> ; 8191 <1> ; INPUT: 8192 <1> ; ecx = bytes per row (to be applied) 8193 <1> ; edx = screen width in bytes 8194 <1> ; ebx = row count 8195 <1> ; eax = color 8196 <1> ; 8197 <1> ; [maskcolor] = mask color (to be excluded) 8198 <1> ; 8199 <1> ; OUTPUT: 8200 <1> ; [u.r0] will be > 0 if succesful 8201 <1> 8202 <1> ; window 8203 <1> ;mov edi, [v_str] ; LFB start address 8204 <1> ;mov esi, edi 8205 <1> 8206 0000EAEB 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8207 0000EAF2 7707 <1> ja short m_pix_op_add_w_1 8208 <1> 8209 <1> ; 256 colors (8bpp) 8210 0000EAF4 BD[46EA0000] <1> mov ebp, m_pix_op_add_8 8211 0000EAF9 EB1E <1> jmp short m_pix_op_add_w_4 8212 <1> 8213 <1> m_pix_op_add_w_1: 8214 0000EAFB 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8215 0000EB02 7710 <1> ja short m_pix_op_add_w_3 ; 32bpp 8216 0000EB04 7207 <1> jb short m_pix_op_add_w_2 ; 16bpp 8217 <1> 8218 <1> ; 24 bit true colors 8219 0000EB06 BD[6DEA0000] <1> mov ebp, m_pix_op_add_24 8220 0000EB0B EB0C <1> jmp short m_pix_op_add_w_4 8221 <1> 8222 <1> ; 65536 colors (16bpp) 8223 <1> m_pix_op_add_w_2: 8224 0000EB0D BD[A5EA0000] <1> mov ebp, m_pix_op_add_16 8225 0000EB12 EB05 <1> jmp short m_pix_op_add_w_4 8226 <1> 8227 <1> ; 32 bit true colors 8228 <1> m_pix_op_add_w_3: 8229 0000EB14 BD[C9EA0000] <1> mov ebp, m_pix_op_add_32 8230 <1> m_pix_op_add_w_4: 8231 0000EB19 E9FDFEFFFF <1> jmp m_pix_op_add_w_x 8232 <1> 8233 <1> m_pix_op_sub: 8234 <1> ; 02/03/2021 8235 <1> ; 06/02/2021 8236 <1> ; SUBTRACT COLOR (MASKED, full screen) 8237 <1> ; 8238 <1> ; jump from pix_op_sub 8239 <1> ; 8240 <1> ; INPUT: 8241 <1> ; eax = color (AL, AX, EAX) 8242 <1> ; ecx = [v_siz] ; display page pixel count 8243 <1> ; esi = edi = [v_mem] ; LFB start address 8244 <1> ; 8245 <1> ; [maskcolor] = mask color (to be excluded) 8246 <1> ; 8247 <1> ; OUTPUT: 8248 <1> ; [u.r0] will be > 0 if succesful 8249 <1> 8250 <1> ; Full screen 8251 <1> m_pix_op_sub_0: 8252 0000EB1E 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8253 0000EB25 771C <1> ja short m_pix_op_sub_1 8254 <1> ; 256 colors (8bpp) 8255 <1> ;jmp short m_pix_op_sub_8 8256 <1> m_pix_op_sub_8: 8257 <1> ; 8 bit colors (256 colors) 8258 0000EB27 88C2 <1> mov dl, al ; new color 8259 <1> m_pix_op_sub_8_0: 8260 0000EB29 AC <1> lodsb 8261 0000EB2A 3A05[A29D0100] <1> cmp al, [maskcolor] 8262 0000EB30 740D <1> je short m_pix_op_sub_8_1 ; exclude 8263 0000EB32 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8264 0000EB38 2817 <1> sub [edi], dl 8265 0000EB3A 7303 <1> jnb short m_pix_op_sub_8_1 8266 0000EB3C C60700 <1> mov byte [edi], 0 8267 <1> m_pix_op_sub_8_1: 8268 0000EB3F 47 <1> inc edi 8269 0000EB40 E2E7 <1> loop m_pix_op_sub_8_0 8270 0000EB42 C3 <1> retn 8271 <1> m_pix_op_sub_1: 8272 0000EB43 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8273 0000EB4A 7755 <1> ja short m_pix_op_sub_3 ; 32bpp 8274 0000EB4C 722F <1> jb short m_pix_op_sub_2 ; 16bpp 8275 <1> ; 24 bit true colors 8276 <1> ;jmp short m_pix_op_sub_24 8277 <1> m_pix_op_sub_24: 8278 <1> ; 24 bit true colors 8279 0000EB4E 89C2 <1> mov edx, eax ; new color 8280 <1> ; 02/03/2021 8281 <1> m_pix_op_sub_24_0: 8282 0000EB50 66AD <1> lodsw 8283 0000EB52 C1E010 <1> shl eax, 16 8284 0000EB55 AC <1> lodsb 8285 0000EB56 C1C010 <1> rol eax, 16 8286 0000EB59 3B05[A29D0100] <1> cmp eax, [maskcolor] 8287 0000EB5F 7416 <1> je short m_pix_op_sub_24_2 ; exclude 8288 0000EB61 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8289 0000EB68 29D0 <1> sub eax, edx 8290 0000EB6A 7302 <1> jnb short m_pix_op_sub_24_1 8291 0000EB6C 31C0 <1> xor eax, eax ; 0 8292 <1> m_pix_op_sub_24_1: 8293 0000EB6E 668907 <1> mov [edi], ax 8294 0000EB71 C1E810 <1> shr eax, 16 8295 0000EB74 884702 <1> mov [edi+2], al 8296 <1> m_pix_op_sub_24_2: 8297 0000EB77 83C703 <1> add edi, 3 ; +3 8298 0000EB7A E2D4 <1> loop m_pix_op_sub_24_0 8299 0000EB7C C3 <1> retn 8300 <1> ; 65536 colors (16bpp) 8301 <1> m_pix_op_sub_2: 8302 <1> ;jmp short m_pix_op_sub_16 8303 <1> m_pix_op_sub_16: 8304 <1> ; 16 bit colors (65536 colors) 8305 0000EB7D 89C2 <1> mov edx, eax ; new color 8306 <1> m_pix_op_sub_16_0: 8307 0000EB7F 66AD <1> lodsw 8308 0000EB81 663B05[A29D0100] <1> cmp ax, [maskcolor] 8309 0000EB88 7411 <1> je short m_pix_op_sub_16_1 ; exclude 8310 0000EB8A 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8311 0000EB91 662917 <1> sub [edi], dx 8312 0000EB94 7305 <1> jnb short m_pix_op_sub_16_1 8313 0000EB96 31C0 <1> xor eax, eax 8314 0000EB98 668907 <1> mov [edi], ax ; 0 8315 <1> m_pix_op_sub_16_1: 8316 0000EB9B 83C702 <1> add edi, 2 ; +2 8317 0000EB9E E2DF <1> loop m_pix_op_sub_16_0 8318 0000EBA0 C3 <1> retn 8319 <1> m_pix_op_sub_3: 8320 <1> ; 32 bit true colors 8321 <1> ;jmp short m_pix_op_sub_32 8322 <1> m_pix_op_sub_32: 8323 <1> ; 32 bit true colors 8324 0000EBA1 89C2 <1> mov edx, eax ; new color 8325 <1> m_pix_op_sub_32_0: 8326 0000EBA3 AD <1> lodsd 8327 0000EBA4 3B05[A29D0100] <1> cmp eax, [maskcolor] 8328 0000EBAA 740F <1> je short m_pix_op_sub_32_1 ; exclude 8329 0000EBAC 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8330 0000EBB3 2917 <1> sub [edi], edx 8331 0000EBB5 7304 <1> jnb short m_pix_op_sub_32_1 8332 0000EBB7 31C0 <1> xor eax, eax 8333 0000EBB9 8907 <1> mov [edi], eax ; 0 8334 <1> m_pix_op_sub_32_1: 8335 0000EBBB 83C704 <1> add edi, 4 ; +4 8336 0000EBBE E2E3 <1> loop m_pix_op_sub_32_0 8337 0000EBC0 C3 <1> retn 8338 <1> 8339 <1> m_pix_op_sub_w: 8340 <1> ; 06/02/2021 8341 <1> ; SUBTRACT COLOR (MASKED, window) 8342 <1> ; 8343 <1> ; jump from pix_op_sub_w 8344 <1> ; 8345 <1> ; INPUT: 8346 <1> ; ecx = bytes per row (to be applied) 8347 <1> ; edx = screen width in bytes 8348 <1> ; ebx = row count 8349 <1> ; eax = color 8350 <1> ; 8351 <1> ; [maskcolor] = mask color (to be excluded) 8352 <1> ; 8353 <1> ; OUTPUT: 8354 <1> ; [u.r0] will be > 0 if succesful 8355 <1> 8356 <1> ; window 8357 <1> ;mov edi, [v_str] ; LFB start address 8358 <1> ;mov esi, edi 8359 <1> 8360 0000EBC1 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8361 0000EBC8 7707 <1> ja short m_pix_op_sub_w_1 8362 <1> 8363 <1> ; 256 colors (8bpp) 8364 0000EBCA BD[27EB0000] <1> mov ebp, m_pix_op_sub_8 8365 0000EBCF EB1E <1> jmp short m_pix_op_sub_w_4 8366 <1> 8367 <1> m_pix_op_sub_w_1: 8368 0000EBD1 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8369 0000EBD8 7710 <1> ja short m_pix_op_sub_w_3 ; 32bpp 8370 0000EBDA 7207 <1> jb short m_pix_op_sub_w_2 ; 16bpp 8371 <1> 8372 <1> ; 24 bit true colors 8373 0000EBDC BD[4EEB0000] <1> mov ebp, m_pix_op_sub_24 8374 0000EBE1 EB0C <1> jmp short m_pix_op_sub_w_4 8375 <1> 8376 <1> ; 65536 colors (16bpp) 8377 <1> m_pix_op_sub_w_2: 8378 0000EBE3 BD[7DEB0000] <1> mov ebp, m_pix_op_sub_16 8379 0000EBE8 EB05 <1> jmp short m_pix_op_sub_w_4 8380 <1> 8381 <1> ; 32 bit true colors 8382 <1> m_pix_op_sub_w_3: 8383 0000EBEA BD[A1EB0000] <1> mov ebp, m_pix_op_sub_32 8384 <1> m_pix_op_sub_w_4: 8385 0000EBEF E927FEFFFF <1> jmp m_pix_op_sub_w_x 8386 <1> 8387 <1> m_pix_op_mix: 8388 <1> ; 25/02/2021 8389 <1> ; 06/02/2021 8390 <1> ; MIX COLOR (MASKED, full screen) 8391 <1> ; 8392 <1> ; jump from pix_op_mix 8393 <1> ; 8394 <1> ; INPUT: 8395 <1> ; eax = color (AL, AX, EAX) 8396 <1> ; ecx = [v_siz] ; display page pixel count 8397 <1> ; esi = edi = [v_mem] ; LFB start address 8398 <1> ; 8399 <1> ; [maskcolor] = mask color (to be excluded) 8400 <1> ; 8401 <1> ; OUTPUT: 8402 <1> ; [u.r0] will be > 0 if succesful 8403 <1> 8404 <1> ; Full screen 8405 <1> m_pix_op_mix_0: 8406 0000EBF4 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8407 0000EBFB 771B <1> ja short m_pix_op_mix_1 8408 <1> ; 256 colors (8bpp) 8409 <1> ;jmp short m_pix_op_mix_8 8410 <1> m_pix_op_mix_8: 8411 <1> ; 8 bit colors (256 colors) 8412 0000EBFD 88C2 <1> mov dl, al ; new (mixing) color 8413 <1> m_pix_op_mix_8_0: 8414 0000EBFF AC <1> lodsb 8415 0000EC00 3A05[A29D0100] <1> cmp al, [maskcolor] 8416 0000EC06 740C <1> je short m_pix_op_mix_8_1 ; exclude 8417 0000EC08 00D0 <1> add al, dl ; 25/02/2021 8418 0000EC0A D0D8 <1> rcr al, 1 8419 0000EC0C 8807 <1> mov [edi], al 8420 0000EC0E FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8421 <1> m_pix_op_mix_8_1: 8422 0000EC14 47 <1> inc edi 8423 0000EC15 E2E8 <1> loop m_pix_op_mix_8_0 8424 0000EC17 C3 <1> retn 8425 <1> m_pix_op_mix_1: 8426 0000EC18 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8427 0000EC1F 7752 <1> ja short m_pix_op_mix_3 ; 32bpp 8428 0000EC21 722D <1> jb short m_pix_op_mix_2 ; 16bpp 8429 <1> ; 24 bit true colors 8430 <1> ;jmp short m_pix_op_mix_24 8431 <1> m_pix_op_mix_24: 8432 <1> ; 24 bit true colors 8433 0000EC23 89C2 <1> mov edx, eax ; new color 8434 <1> ;and edx, 0FFFFFFh 8435 <1> m_pix_op_mix_24_0: 8436 0000EC25 66AD <1> lodsw 8437 0000EC27 C1E010 <1> shl eax, 16 8438 0000EC2A AC <1> lodsb 8439 0000EC2B C1C010 <1> rol eax, 16 8440 0000EC2E 3B05[A29D0100] <1> cmp eax, [maskcolor] 8441 0000EC34 7414 <1> je short m_pix_op_mix_24_1 ; exclude 8442 0000EC36 01D0 <1> add eax, edx 8443 0000EC38 D1E8 <1> shr eax, 1 8444 0000EC3A 668907 <1> mov [edi], ax 8445 0000EC3D C1E810 <1> shr eax, 16 8446 0000EC40 884702 <1> mov [edi+2], al 8447 0000EC43 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8448 <1> m_pix_op_mix_24_1: 8449 0000EC4A 83C703 <1> add edi, 3 ; +3 8450 0000EC4D E2D6 <1> loop m_pix_op_mix_24_0 8451 0000EC4F C3 <1> retn 8452 <1> ; 65536 colors (16bpp) 8453 <1> m_pix_op_mix_2: 8454 <1> ;jmp short m_pix_op_mix_16 8455 <1> m_pix_op_mix_16: 8456 <1> ; 16 bit colors (65536 colors) 8457 0000EC50 89C2 <1> mov edx, eax ; new color 8458 <1> ;and edx, 0FFFFh 8459 <1> m_pix_op_mix_16_0: 8460 0000EC52 66AD <1> lodsw 8461 0000EC54 663B05[A29D0100] <1> cmp ax, [maskcolor] 8462 0000EC5B 7410 <1> je short m_pix_op_mix_16_1 ; exclude 8463 0000EC5D 6601D0 <1> add ax, dx 8464 0000EC60 66D1D8 <1> rcr ax, 1 8465 0000EC63 668907 <1> mov [edi], ax 8466 0000EC66 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8467 <1> m_pix_op_mix_16_1: 8468 0000EC6D 83C702 <1> add edi, 2 ; +2 8469 0000EC70 E2E0 <1> loop m_pix_op_mix_16_0 8470 0000EC72 C3 <1> retn 8471 <1> m_pix_op_mix_3: 8472 <1> ; 32 bit true colors 8473 <1> ;jmp short m_pix_op_mix_32 8474 <1> m_pix_op_mix_32: 8475 <1> ; 32 bit true colors 8476 0000EC73 89C2 <1> mov edx, eax ; new color 8477 <1> m_pix_op_mix_32_0: 8478 0000EC75 AD <1> lodsd 8479 0000EC76 3B05[A29D0100] <1> cmp eax, [maskcolor] 8480 0000EC7C 740D <1> je short m_pix_op_mix_32_1 ; exclude 8481 0000EC7E 01D0 <1> add eax, edx 8482 <1> ; 02/03/2021 8483 0000EC80 D1D8 <1> rcr eax, 1 8484 0000EC82 8907 <1> mov [edi], eax 8485 0000EC84 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8486 <1> m_pix_op_mix_32_1: 8487 0000EC8B 83C704 <1> add edi, 4 ; +4 8488 0000EC8E E2E5 <1> loop m_pix_op_mix_32_0 8489 0000EC90 C3 <1> retn 8490 <1> 8491 <1> m_pix_op_mix_w: 8492 <1> ; 06/02/2021 8493 <1> ; MIX COLOR (MASKED, window) 8494 <1> ; 8495 <1> ; jump from pix_op_mix_w 8496 <1> ; 8497 <1> ; INPUT: 8498 <1> ; ecx = bytes per row (to be applied) 8499 <1> ; edx = screen width in bytes 8500 <1> ; ebx = row count 8501 <1> ; eax = color 8502 <1> ; 8503 <1> ; [maskcolor] = mask color (to be excluded) 8504 <1> ; 8505 <1> ; OUTPUT: 8506 <1> ; [u.r0] will be > 0 if succesful 8507 <1> 8508 <1> ; window 8509 <1> ;mov edi, [v_str] ; LFB start address 8510 <1> ;mov esi, edi 8511 <1> 8512 0000EC91 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8513 0000EC98 7707 <1> ja short m_pix_op_mix_w_1 8514 <1> 8515 <1> ; 256 colors (8bpp) 8516 0000EC9A BD[FDEB0000] <1> mov ebp, m_pix_op_mix_8 8517 0000EC9F EB1E <1> jmp short m_pix_op_mix_w_4 8518 <1> 8519 <1> m_pix_op_mix_w_1: 8520 0000ECA1 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8521 0000ECA8 7710 <1> ja short m_pix_op_mix_w_3 ; 32bpp 8522 0000ECAA 7207 <1> jb short m_pix_op_mix_w_2 ; 16bpp 8523 <1> 8524 <1> ; 24 bit true colors 8525 0000ECAC BD[23EC0000] <1> mov ebp, m_pix_op_mix_24 8526 0000ECB1 EB0C <1> jmp short m_pix_op_mix_w_4 8527 <1> 8528 <1> ; 65536 colors (16bpp) 8529 <1> m_pix_op_mix_w_2: 8530 0000ECB3 BD[50EC0000] <1> mov ebp, m_pix_op_mix_16 8531 0000ECB8 EB05 <1> jmp short m_pix_op_mix_w_4 8532 <1> 8533 <1> ; 32 bit true colors 8534 <1> m_pix_op_mix_w_3: 8535 0000ECBA BD[73EC0000] <1> mov ebp, m_pix_op_mix_32 8536 <1> m_pix_op_mix_w_4: 8537 0000ECBF E957FDFFFF <1> jmp m_pix_op_mix_w_x 8538 <1> 8539 <1> m_pix_op_and: 8540 <1> ; 06/02/2021 8541 <1> ; AND COLOR (MASKED, full screen) 8542 <1> ; 8543 <1> ; jump from pix_op_and 8544 <1> ; 8545 <1> ; INPUT: 8546 <1> ; eax = color (AL, AX, EAX) 8547 <1> ; ecx = [v_siz] ; display page pixel count 8548 <1> ; esi = edi = [v_mem] ; LFB start address 8549 <1> ; 8550 <1> ; [maskcolor] = mask color (to be excluded) 8551 <1> ; 8552 <1> ; OUTPUT: 8553 <1> ; [u.r0] will be > 0 if succesful 8554 <1> 8555 <1> ; Full screen 8556 <1> m_pix_op_and_0: 8557 0000ECC4 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8558 0000ECCB 7717 <1> ja short m_pix_op_and_1 8559 <1> ; 256 colors (8bpp) 8560 <1> ;jmp short m_pix_op_and_8 8561 <1> m_pix_op_and_8: 8562 <1> ; 8 bit colors (256 colors) 8563 0000ECCD 88C2 <1> mov dl, al ; new color 8564 <1> m_pix_op_and_8_0: 8565 0000ECCF AC <1> lodsb 8566 0000ECD0 3A05[A29D0100] <1> cmp al, [maskcolor] 8567 0000ECD6 7408 <1> je short m_pix_op_and_8_1 ; exclude 8568 0000ECD8 2017 <1> and [edi], dl 8569 0000ECDA FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8570 <1> m_pix_op_and_8_1: 8571 0000ECE0 47 <1> inc edi 8572 0000ECE1 E2EC <1> loop m_pix_op_and_8_0 8573 0000ECE3 C3 <1> retn 8574 <1> m_pix_op_and_1: 8575 0000ECE4 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8576 0000ECEB 774A <1> ja short m_pix_op_and_3 ; 32bpp 8577 0000ECED 722B <1> jb short m_pix_op_and_2 ; 16bpp 8578 <1> ; 24 bit true colors 8579 <1> ;jmp short m_pix_op_and_24 8580 <1> m_pix_op_and_24: 8581 <1> ; 24 bit true colors 8582 0000ECEF 89C2 <1> mov edx, eax ; new color 8583 <1> ;and edx, 0FFFFFFh 8584 <1> m_pix_op_and_24_0: 8585 0000ECF1 66AD <1> lodsw 8586 0000ECF3 C1E010 <1> shl eax, 16 8587 0000ECF6 AC <1> lodsb 8588 0000ECF7 C1C010 <1> rol eax, 16 8589 0000ECFA 3B05[A29D0100] <1> cmp eax, [maskcolor] 8590 0000ED00 7412 <1> je short m_pix_op_and_24_1 ; exclude 8591 0000ED02 21D0 <1> and eax, edx 8592 0000ED04 668907 <1> mov [edi], ax 8593 0000ED07 C1E810 <1> shr eax, 16 8594 0000ED0A 884702 <1> mov [edi+2], al 8595 0000ED0D 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8596 <1> m_pix_op_and_24_1: 8597 0000ED14 83C703 <1> add edi, 3 ; +3 8598 0000ED17 E2D8 <1> loop m_pix_op_and_24_0 8599 0000ED19 C3 <1> retn 8600 <1> ; 65536 colors (16bpp) 8601 <1> m_pix_op_and_2: 8602 <1> ;jmp short m_pix_op_and_16 8603 <1> m_pix_op_and_16: 8604 <1> ; 16 bit colors (65536 colors) 8605 0000ED1A 89C2 <1> mov edx, eax ; new color 8606 <1> ;and edx, 0FFFFh 8607 <1> m_pix_op_and_16_0: 8608 0000ED1C 66AD <1> lodsw 8609 0000ED1E 663B05[A29D0100] <1> cmp ax, [maskcolor] 8610 0000ED25 740A <1> je short m_pix_op_and_16_1 ; exclude 8611 0000ED27 662117 <1> and [edi], dx 8612 0000ED2A 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8613 <1> m_pix_op_and_16_1: 8614 0000ED31 83C702 <1> add edi, 2 ; +2 8615 0000ED34 E2E6 <1> loop m_pix_op_and_16_0 8616 0000ED36 C3 <1> retn 8617 <1> m_pix_op_and_3: 8618 <1> ; 32 bit true colors 8619 <1> ;jmp short m_pix_op_and_32 8620 <1> m_pix_op_and_32: 8621 <1> ; 32 bit true colors 8622 0000ED37 89C2 <1> mov edx, eax ; new color 8623 <1> m_pix_op_and_32_0: 8624 0000ED39 AD <1> lodsd 8625 0000ED3A 3B05[A29D0100] <1> cmp eax, [maskcolor] 8626 0000ED40 7409 <1> je short m_pix_op_and_32_1 ; exclude 8627 0000ED42 2117 <1> and [edi], edx ; 25/02/2021 8628 0000ED44 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8629 <1> m_pix_op_and_32_1: 8630 0000ED4B 83C704 <1> add edi, 4 ; +4 8631 0000ED4E E2E9 <1> loop m_pix_op_and_32_0 8632 0000ED50 C3 <1> retn 8633 <1> 8634 <1> m_pix_op_and_w: 8635 <1> ; 06/02/2021 8636 <1> ; AND COLOR (MASKED, window) 8637 <1> ; 8638 <1> ; jump from pix_op_and_w 8639 <1> ; 8640 <1> ; INPUT: 8641 <1> ; ecx = bytes per row (to be applied) 8642 <1> ; edx = screen width in bytes 8643 <1> ; ebx = row count 8644 <1> ; eax = color 8645 <1> ; 8646 <1> ; [maskcolor] = mask color (to be excluded) 8647 <1> ; 8648 <1> ; OUTPUT: 8649 <1> ; [u.r0] will be > 0 if succesful 8650 <1> 8651 <1> ; window 8652 <1> ;mov edi, [v_str] ; LFB start address 8653 <1> ;mov esi, edi 8654 <1> 8655 0000ED51 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8656 0000ED58 7707 <1> ja short m_pix_op_and_w_1 8657 <1> 8658 <1> ; 256 colors (8bpp) 8659 0000ED5A BD[CDEC0000] <1> mov ebp, m_pix_op_and_8 8660 0000ED5F EB1E <1> jmp short m_pix_op_and_w_4 8661 <1> 8662 <1> m_pix_op_and_w_1: 8663 0000ED61 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8664 0000ED68 7710 <1> ja short m_pix_op_and_w_3 ; 32bpp 8665 0000ED6A 7207 <1> jb short m_pix_op_and_w_2 ; 16bpp 8666 <1> 8667 <1> ; 24 bit true colors 8668 0000ED6C BD[EFEC0000] <1> mov ebp, m_pix_op_and_24 8669 0000ED71 EB0C <1> jmp short m_pix_op_and_w_4 8670 <1> 8671 <1> ; 65536 colors (16bpp) 8672 <1> m_pix_op_and_w_2: 8673 0000ED73 BD[1AED0000] <1> mov ebp, m_pix_op_and_16 8674 0000ED78 EB05 <1> jmp short m_pix_op_and_w_4 8675 <1> 8676 <1> ; 32 bit true colors 8677 <1> m_pix_op_and_w_3: 8678 0000ED7A BD[37ED0000] <1> mov ebp, m_pix_op_and_32 8679 <1> m_pix_op_and_w_4: 8680 0000ED7F E997FCFFFF <1> jmp m_pix_op_and_w_x 8681 <1> 8682 <1> m_pix_op_or: 8683 <1> ; 06/02/2021 8684 <1> ; OR COLOR (MASKED, full screen) 8685 <1> ; 8686 <1> ; jump from pix_op_orc 8687 <1> ; 8688 <1> ; INPUT: 8689 <1> ; eax = color (AL, AX, EAX) 8690 <1> ; ecx = [v_siz] ; display page pixel count 8691 <1> ; esi = edi = [v_mem] ; LFB start address 8692 <1> ; 8693 <1> ; [maskcolor] = mask color (to be excluded) 8694 <1> ; 8695 <1> ; OUTPUT: 8696 <1> ; [u.r0] will be > 0 if succesful 8697 <1> 8698 <1> ; Full screen 8699 <1> m_pix_op_or_0: 8700 0000ED84 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8701 0000ED8B 7717 <1> ja short m_pix_op_or_1 8702 <1> ; 256 colors (8bpp) 8703 <1> ;jmp short m_pix_op_or_8 8704 <1> m_pix_op_or_8: 8705 <1> ; 8 bit colors (256 colors) 8706 0000ED8D 88C2 <1> mov dl, al ; new color 8707 <1> m_pix_op_or_8_0: 8708 0000ED8F AC <1> lodsb 8709 0000ED90 3A05[A29D0100] <1> cmp al, [maskcolor] 8710 0000ED96 7408 <1> je short m_pix_op_or_8_1 ; exclude 8711 0000ED98 0817 <1> or [edi], dl 8712 0000ED9A FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8713 <1> m_pix_op_or_8_1: 8714 0000EDA0 47 <1> inc edi 8715 0000EDA1 E2EC <1> loop m_pix_op_or_8_0 8716 0000EDA3 C3 <1> retn 8717 <1> m_pix_op_or_1: 8718 0000EDA4 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8719 0000EDAB 774A <1> ja short m_pix_op_or_3 ; 32bpp 8720 0000EDAD 722B <1> jb short m_pix_op_or_2 ; 16bpp 8721 <1> ; 24 bit true colors 8722 <1> ;jmp short m_pix_op_or_24 8723 <1> m_pix_op_or_24: 8724 <1> ; 24 bit true colors 8725 0000EDAF 89C2 <1> mov edx, eax ; new color 8726 <1> ;and edx, 0FFFFFFh 8727 <1> m_pix_op_or_24_0: 8728 0000EDB1 66AD <1> lodsw 8729 0000EDB3 C1E010 <1> shl eax, 16 8730 0000EDB6 AC <1> lodsb 8731 0000EDB7 C1C010 <1> rol eax, 16 8732 0000EDBA 3B05[A29D0100] <1> cmp eax, [maskcolor] 8733 0000EDC0 7412 <1> je short m_pix_op_or_24_1 ; exclude 8734 0000EDC2 09D0 <1> or eax, edx 8735 0000EDC4 668907 <1> mov [edi], ax 8736 0000EDC7 C1E810 <1> shr eax, 16 8737 0000EDCA 884702 <1> mov [edi+2], al 8738 0000EDCD 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8739 <1> m_pix_op_or_24_1: 8740 0000EDD4 83C703 <1> add edi, 3 ; +3 8741 0000EDD7 E2D8 <1> loop m_pix_op_or_24_0 8742 0000EDD9 C3 <1> retn 8743 <1> ; 65536 colors (16bpp) 8744 <1> m_pix_op_or_2: 8745 <1> ;jmp short m_pix_op_or_16 8746 <1> m_pix_op_or_16: 8747 <1> ; 16 bit colors (65536 colors) 8748 0000EDDA 89C2 <1> mov edx, eax ; new color 8749 <1> ;and edx, 0FFFFh 8750 <1> m_pix_op_or_16_0: 8751 0000EDDC 66AD <1> lodsw 8752 0000EDDE 663B05[A29D0100] <1> cmp ax, [maskcolor] 8753 0000EDE5 740A <1> je short m_pix_op_or_16_1 ; exclude 8754 0000EDE7 660917 <1> or [edi], dx 8755 0000EDEA 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8756 <1> m_pix_op_or_16_1: 8757 0000EDF1 83C702 <1> add edi, 2 ; +2 8758 0000EDF4 E2E6 <1> loop m_pix_op_or_16_0 8759 0000EDF6 C3 <1> retn 8760 <1> m_pix_op_or_3: 8761 <1> ; 32 bit true colors 8762 <1> ;jmp short m_pix_op_or_32 8763 <1> m_pix_op_or_32: 8764 <1> ; 32 bit true colors 8765 0000EDF7 89C2 <1> mov edx, eax ; new color 8766 <1> m_pix_op_or_32_0: 8767 0000EDF9 AD <1> lodsd 8768 0000EDFA 3B05[A29D0100] <1> cmp eax, [maskcolor] 8769 0000EE00 7409 <1> je short m_pix_op_or_32_1 ; exclude 8770 0000EE02 0917 <1> or [edi], edx ; 25/02/2021 8771 0000EE04 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8772 <1> m_pix_op_or_32_1: 8773 0000EE0B 83C704 <1> add edi, 4 ; +4 8774 0000EE0E E2E9 <1> loop m_pix_op_or_32_0 8775 0000EE10 C3 <1> retn 8776 <1> 8777 <1> m_pix_op_or_w: 8778 <1> ; 06/02/2021 8779 <1> ; MIX COLOR (MASKED, window) 8780 <1> ; 8781 <1> ; jump from pix_op_or_w 8782 <1> ; 8783 <1> ; INPUT: 8784 <1> ; ecx = bytes per row (to be applied) 8785 <1> ; edx = screen width in bytes 8786 <1> ; ebx = row count 8787 <1> ; eax = color 8788 <1> ; 8789 <1> ; [maskcolor] = mask color (to be excluded) 8790 <1> ; 8791 <1> ; OUTPUT: 8792 <1> ; [u.r0] will be > 0 if succesful 8793 <1> 8794 <1> ; window 8795 <1> ;mov edi, [v_str] ; LFB start address 8796 <1> ;mov esi, edi 8797 <1> 8798 0000EE11 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8799 0000EE18 7707 <1> ja short m_pix_op_or_w_1 8800 <1> 8801 <1> ; 256 colors (8bpp) 8802 0000EE1A BD[8DED0000] <1> mov ebp, m_pix_op_or_8 8803 0000EE1F EB1E <1> jmp short m_pix_op_or_w_4 8804 <1> 8805 <1> m_pix_op_or_w_1: 8806 0000EE21 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8807 0000EE28 7710 <1> ja short m_pix_op_or_w_3 ; 32bpp 8808 0000EE2A 7207 <1> jb short m_pix_op_or_w_2 ; 16bpp 8809 <1> 8810 <1> ; 24 bit true colors 8811 0000EE2C BD[AFED0000] <1> mov ebp, m_pix_op_or_24 8812 0000EE31 EB0C <1> jmp short m_pix_op_or_w_4 8813 <1> 8814 <1> ; 65536 colors (16bpp) 8815 <1> m_pix_op_or_w_2: 8816 0000EE33 BD[DAED0000] <1> mov ebp, m_pix_op_or_16 8817 0000EE38 EB05 <1> jmp short m_pix_op_or_w_4 8818 <1> 8819 <1> ; 32 bit true colors 8820 <1> m_pix_op_or_w_3: 8821 0000EE3A BD[F7ED0000] <1> mov ebp, m_pix_op_or_32 8822 <1> m_pix_op_or_w_4: 8823 0000EE3F E9D7FBFFFF <1> jmp m_pix_op_orc_w_x 8824 <1> 8825 <1> m_pix_op_xor: 8826 <1> ; 06/02/2021 8827 <1> ; XOR COLOR (MASKED, full screen) 8828 <1> ; 8829 <1> ; jump from pix_op_xor 8830 <1> ; 8831 <1> ; INPUT: 8832 <1> ; eax = color (AL, AX, EAX) 8833 <1> ; ecx = [v_siz] ; display page pixel count 8834 <1> ; esi = edi = [v_mem] ; LFB start address 8835 <1> ; 8836 <1> ; [maskcolor] = mask color (to be excluded) 8837 <1> ; 8838 <1> ; OUTPUT: 8839 <1> ; [u.r0] will be > 0 if succesful 8840 <1> 8841 <1> ; Full screen 8842 <1> m_pix_op_xor_0: 8843 0000EE44 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8844 0000EE4B 7717 <1> ja short m_pix_op_xor_1 8845 <1> ; 256 colors (8bpp) 8846 <1> ;jmp short m_pix_op_xor_8 8847 <1> m_pix_op_xor_8: 8848 <1> ; 8 bit colors (256 colors) 8849 0000EE4D 88C2 <1> mov dl, al ; new color 8850 <1> m_pix_op_xor_8_0: 8851 0000EE4F AC <1> lodsb 8852 0000EE50 3A05[A29D0100] <1> cmp al, [maskcolor] 8853 0000EE56 7408 <1> je short m_pix_op_xor_8_1 ; exclude 8854 0000EE58 3017 <1> xor [edi], dl 8855 0000EE5A FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8856 <1> m_pix_op_xor_8_1: 8857 0000EE60 47 <1> inc edi 8858 0000EE61 E2EC <1> loop m_pix_op_xor_8_0 8859 0000EE63 C3 <1> retn 8860 <1> m_pix_op_xor_1: 8861 0000EE64 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8862 0000EE6B 774A <1> ja short m_pix_op_xor_3 ; 32bpp 8863 0000EE6D 722B <1> jb short m_pix_op_xor_2 ; 16bpp 8864 <1> ; 24 bit true colors 8865 <1> ;jmp short m_pix_op_xor_24 8866 <1> m_pix_op_xor_24: 8867 <1> ; 24 bit true colors 8868 0000EE6F 89C2 <1> mov edx, eax ; new color 8869 <1> ;and edx, 0FFFFFFh 8870 <1> m_pix_op_xor_24_0: 8871 0000EE71 66AD <1> lodsw 8872 0000EE73 C1E010 <1> shl eax, 16 8873 0000EE76 AC <1> lodsb 8874 0000EE77 C1C010 <1> rol eax, 16 8875 0000EE7A 3B05[A29D0100] <1> cmp eax, [maskcolor] 8876 0000EE80 7412 <1> je short m_pix_op_xor_24_1 ; exclude 8877 0000EE82 31D0 <1> xor eax, edx 8878 0000EE84 668907 <1> mov [edi], ax 8879 0000EE87 C1E810 <1> shr eax, 16 8880 0000EE8A 884702 <1> mov [edi+2], al 8881 0000EE8D 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 8882 <1> m_pix_op_xor_24_1: 8883 0000EE94 83C703 <1> add edi, 3 ; +3 8884 0000EE97 E2D8 <1> loop m_pix_op_xor_24_0 8885 0000EE99 C3 <1> retn 8886 <1> ; 65536 colors (16bpp) 8887 <1> m_pix_op_xor_2: 8888 <1> ;jmp short m_pix_op_xor_16 8889 <1> m_pix_op_xor_16: 8890 <1> ; 16 bit colors (65536 colors) 8891 0000EE9A 89C2 <1> mov edx, eax ; new color 8892 <1> ;and edx, 0FFFFh 8893 <1> m_pix_op_xor_16_0: 8894 0000EE9C 66AD <1> lodsw 8895 0000EE9E 663B05[A29D0100] <1> cmp ax, [maskcolor] 8896 0000EEA5 740A <1> je short m_pix_op_xor_16_1 ; exclude 8897 0000EEA7 663117 <1> xor [edi], dx 8898 0000EEAA 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 8899 <1> m_pix_op_xor_16_1: 8900 0000EEB1 83C702 <1> add edi, 2 ; +2 8901 0000EEB4 E2E6 <1> loop m_pix_op_xor_16_0 8902 0000EEB6 C3 <1> retn 8903 <1> m_pix_op_xor_3: 8904 <1> ; 32 bit true colors 8905 <1> ;jmp short m_pix_op_xor_32 8906 <1> m_pix_op_xor_32: 8907 <1> ; 32 bit true colors 8908 0000EEB7 89C2 <1> mov edx, eax ; new color 8909 <1> m_pix_op_xor_32_0: 8910 0000EEB9 AD <1> lodsd 8911 0000EEBA 3B05[A29D0100] <1> cmp eax, [maskcolor] 8912 0000EEC0 7409 <1> je short m_pix_op_xor_32_1 ; exclude 8913 0000EEC2 3117 <1> xor [edi], edx ; 25/02/2021 8914 0000EEC4 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 8915 <1> m_pix_op_xor_32_1: 8916 0000EECB 83C704 <1> add edi, 4 ; +4 8917 0000EECE E2E9 <1> loop m_pix_op_xor_32_0 8918 0000EED0 C3 <1> retn 8919 <1> 8920 <1> m_pix_op_xor_w: 8921 <1> ; 06/02/2021 8922 <1> ; XOR COLOR (MASKED, window) 8923 <1> ; 8924 <1> ; jump from pix_op_xor_w 8925 <1> ; 8926 <1> ; INPUT: 8927 <1> ; ecx = bytes per row (to be applied) 8928 <1> ; edx = screen width in bytes 8929 <1> ; ebx = row count 8930 <1> ; eax = color 8931 <1> ; 8932 <1> ; [maskcolor] = mask color (to be excluded) 8933 <1> ; 8934 <1> ; OUTPUT: 8935 <1> ; [u.r0] will be > 0 if succesful 8936 <1> 8937 <1> ; window 8938 <1> ;mov edi, [v_str] ; LFB start address 8939 <1> ;mov esi, edi 8940 <1> 8941 0000EED1 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8942 0000EED8 7707 <1> ja short m_pix_op_xor_w_1 8943 <1> 8944 <1> ; 256 colors (8bpp) 8945 0000EEDA BD[4DEE0000] <1> mov ebp, m_pix_op_xor_8 8946 0000EEDF EB1E <1> jmp short m_pix_op_xor_w_4 8947 <1> 8948 <1> m_pix_op_xor_w_1: 8949 0000EEE1 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 8950 0000EEE8 7710 <1> ja short m_pix_op_xor_w_3 ; 32bpp 8951 0000EEEA 7207 <1> jb short m_pix_op_xor_w_2 ; 16bpp 8952 <1> 8953 <1> ; 24 bit true colors 8954 0000EEEC BD[6FEE0000] <1> mov ebp, m_pix_op_xor_24 8955 0000EEF1 EB0C <1> jmp short m_pix_op_xor_w_4 8956 <1> 8957 <1> ; 65536 colors (16bpp) 8958 <1> m_pix_op_xor_w_2: 8959 0000EEF3 BD[9AEE0000] <1> mov ebp, m_pix_op_xor_16 8960 0000EEF8 EB05 <1> jmp short m_pix_op_xor_w_4 8961 <1> 8962 <1> ; 32 bit true colors 8963 <1> m_pix_op_xor_w_3: 8964 0000EEFA BD[B7EE0000] <1> mov ebp, m_pix_op_xor_32 8965 <1> m_pix_op_xor_w_4: 8966 0000EEFF E917FBFFFF <1> jmp m_pix_op_xor_w_x 8967 <1> 8968 <1> m_pix_op_not: 8969 <1> ; 06/02/2021 8970 <1> ; NOT COLOR (MASKED, full screen) 8971 <1> ; 8972 <1> ; jump from pix_op_not 8973 <1> ; 8974 <1> ; INPUT: 8975 <1> ; ecx = [v_siz] ; display page pixel count 8976 <1> ; esi = edi = [v_mem] ; LFB start address 8977 <1> ; 8978 <1> ; [maskcolor] = mask color (to be excluded) 8979 <1> ; 8980 <1> ; OUTPUT: 8981 <1> ; [u.r0] will be > 0 if succesful 8982 <1> 8983 <1> ; Full screen 8984 <1> m_pix_op_not_0: 8985 0000EF04 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 8986 0000EF0B 7715 <1> ja short m_pix_op_not_1 8987 <1> ; 256 colors (8bpp) 8988 <1> ;jmp short m_pix_op_not_8 8989 <1> m_pix_op_not_8: 8990 <1> ; 8 bit colors (256 colors) 8991 0000EF0D AC <1> lodsb 8992 0000EF0E 3A05[A29D0100] <1> cmp al, [maskcolor] 8993 0000EF14 7408 <1> je short m_pix_op_not_8_1 ; exclude 8994 0000EF16 F617 <1> not byte [edi] 8995 0000EF18 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 8996 <1> m_pix_op_not_8_1: 8997 0000EF1E 47 <1> inc edi 8998 0000EF1F E2EC <1> loop m_pix_op_not_8 8999 0000EF21 C3 <1> retn 9000 <1> m_pix_op_not_1: 9001 0000EF22 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9002 0000EF29 7746 <1> ja short m_pix_op_not_3 ; 32bpp 9003 0000EF2B 7229 <1> jb short m_pix_op_not_2 ; 16bpp 9004 <1> ; 24 bit true colors 9005 <1> ;jmp short m_pix_op_not_24 9006 <1> m_pix_op_not_24: 9007 <1> ; 24 bit true colors 9008 0000EF2D 66AD <1> lodsw 9009 0000EF2F C1E010 <1> shl eax, 16 9010 0000EF32 AC <1> lodsb 9011 0000EF33 C1C010 <1> rol eax, 16 9012 0000EF36 3B05[A29D0100] <1> cmp eax, [maskcolor] 9013 0000EF3C 7412 <1> je short m_pix_op_not_24_1 ; exclude 9014 0000EF3E F7D0 <1> not eax 9015 0000EF40 668907 <1> mov [edi], ax 9016 0000EF43 C1E810 <1> shr eax, 16 9017 0000EF46 884702 <1> mov [edi+2], al 9018 0000EF49 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 9019 <1> m_pix_op_not_24_1: 9020 0000EF50 83C703 <1> add edi, 3 ; +3 9021 0000EF53 E2D8 <1> loop m_pix_op_not_24 9022 0000EF55 C3 <1> retn 9023 <1> ; 65536 colors (16bpp) 9024 <1> m_pix_op_not_2: 9025 <1> ;jmp short m_pix_op_not_16 9026 <1> m_pix_op_not_16: 9027 <1> ; 16 bit colors (65536 colors) 9028 0000EF56 66AD <1> lodsw 9029 0000EF58 663B05[A29D0100] <1> cmp ax, [maskcolor] 9030 0000EF5F 740A <1> je short m_pix_op_not_16_1 ; exclude 9031 0000EF61 66F717 <1> not word [edi] 9032 0000EF64 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 9033 <1> m_pix_op_not_16_1: 9034 0000EF6B 83C702 <1> add edi, 2 ; +2 9035 0000EF6E E2E6 <1> loop m_pix_op_not_16 9036 0000EF70 C3 <1> retn 9037 <1> m_pix_op_not_3: 9038 <1> ; 32 bit true colors 9039 <1> ;jmp short m_pix_op_not_32 9040 <1> m_pix_op_not_32: 9041 <1> ; 32 bit true colors 9042 0000EF71 AD <1> lodsd 9043 0000EF72 3B05[A29D0100] <1> cmp eax, [maskcolor] 9044 0000EF78 7409 <1> je short m_pix_op_not_32_1 ; exclude 9045 0000EF7A F717 <1> not dword [edi] 9046 0000EF7C 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 9047 <1> m_pix_op_not_32_1: 9048 0000EF83 83C704 <1> add edi, 4 ; +4 9049 0000EF86 E2E9 <1> loop m_pix_op_not_32 9050 0000EF88 C3 <1> retn 9051 <1> 9052 <1> m_pix_op_not_w: 9053 <1> ; 06/02/2021 9054 <1> ; NOT COLOR (MASKED, window) 9055 <1> ; 9056 <1> ; jump from pix_op_not_w 9057 <1> ; 9058 <1> ; INPUT: 9059 <1> ; ecx = bytes per row (to be applied) 9060 <1> ; edx = screen width in bytes 9061 <1> ; ebx = row count 9062 <1> ; 9063 <1> ; [maskcolor] = mask color (to be excluded) 9064 <1> ; 9065 <1> ; OUTPUT: 9066 <1> ; [u.r0] will be > 0 if succesful 9067 <1> 9068 <1> ; window 9069 <1> ;mov edi, [v_str] ; LFB start address 9070 <1> ;mov esi, edi 9071 <1> 9072 0000EF89 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9073 0000EF90 7707 <1> ja short m_pix_op_not_w_1 9074 <1> 9075 <1> ; 256 colors (8bpp) 9076 0000EF92 BD[0DEF0000] <1> mov ebp, m_pix_op_not_8 9077 0000EF97 EB1E <1> jmp short m_pix_op_not_w_4 9078 <1> 9079 <1> m_pix_op_not_w_1: 9080 0000EF99 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9081 0000EFA0 7710 <1> ja short m_pix_op_not_w_3 ; 32bpp 9082 0000EFA2 7207 <1> jb short m_pix_op_not_w_2 ; 16bpp 9083 <1> 9084 <1> ; 24 bit true colors 9085 0000EFA4 BD[2DEF0000] <1> mov ebp, m_pix_op_not_24 9086 0000EFA9 EB0C <1> jmp short m_pix_op_not_w_4 9087 <1> 9088 <1> ; 65536 colors (16bpp) 9089 <1> m_pix_op_not_w_2: 9090 0000EFAB BD[56EF0000] <1> mov ebp, m_pix_op_not_16 9091 0000EFB0 EB05 <1> jmp short m_pix_op_not_w_4 9092 <1> 9093 <1> ; 32 bit true colors 9094 <1> m_pix_op_not_w_3: 9095 0000EFB2 BD[71EF0000] <1> mov ebp, m_pix_op_not_32 9096 <1> m_pix_op_not_w_4: 9097 0000EFB7 E95FFAFFFF <1> jmp m_pix_op_not_w_x 9098 <1> 9099 <1> m_pix_op_neg: 9100 <1> ; 06/02/2021 9101 <1> ; NEGATIVE COLOR (MASKED, full screen) 9102 <1> ; 9103 <1> ; jump from pix_op_neg 9104 <1> ; 9105 <1> ; INPUT: 9106 <1> ; ecx = [v_siz] ; display page pixel count 9107 <1> ; esi = edi = [v_mem] ; LFB start address 9108 <1> ; 9109 <1> ; [maskcolor] = mask color (to be excluded) 9110 <1> ; 9111 <1> ; OUTPUT: 9112 <1> ; [u.r0] will be > 0 if succesful 9113 <1> 9114 <1> ; Full screen 9115 <1> m_pix_op_neg_0: 9116 0000EFBC 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9117 0000EFC3 7715 <1> ja short m_pix_op_neg_1 9118 <1> ; 256 colors (8bpp) 9119 <1> ;jmp short m_pix_op_neg_8 9120 <1> m_pix_op_neg_8: 9121 <1> ; 8 bit colors (256 colors) 9122 0000EFC5 AC <1> lodsb 9123 0000EFC6 3A05[A29D0100] <1> cmp al, [maskcolor] 9124 0000EFCC 7408 <1> je short m_pix_op_neg_8_1 ; exclude 9125 0000EFCE F61F <1> neg byte [edi] 9126 0000EFD0 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 9127 <1> m_pix_op_neg_8_1: 9128 0000EFD6 47 <1> inc edi 9129 0000EFD7 E2EC <1> loop m_pix_op_neg_8 9130 0000EFD9 C3 <1> retn 9131 <1> m_pix_op_neg_1: 9132 0000EFDA 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9133 0000EFE1 7746 <1> ja short m_pix_op_neg_3 ; 32bpp 9134 0000EFE3 7229 <1> jb short m_pix_op_neg_2 ; 16bpp 9135 <1> ; 24 bit true colors 9136 <1> ;jmp short m_pix_op_neg_24 9137 <1> m_pix_op_neg_24: 9138 <1> ; 24 bit true colors 9139 0000EFE5 66AD <1> lodsw 9140 0000EFE7 C1E010 <1> shl eax, 16 9141 0000EFEA AC <1> lodsb 9142 0000EFEB C1C010 <1> rol eax, 16 9143 0000EFEE 3B05[A29D0100] <1> cmp eax, [maskcolor] 9144 0000EFF4 7412 <1> je short m_pix_op_neg_24_1 ; exclude 9145 0000EFF6 F7D8 <1> neg eax 9146 0000EFF8 668907 <1> mov [edi], ax 9147 0000EFFB C1E810 <1> shr eax, 16 9148 0000EFFE 884702 <1> mov [edi+2], al 9149 0000F001 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 9150 <1> m_pix_op_neg_24_1: 9151 0000F008 83C703 <1> add edi, 3 ; +3 9152 0000F00B E2D8 <1> loop m_pix_op_neg_24 9153 0000F00D C3 <1> retn 9154 <1> ; 65536 colors (16bpp) 9155 <1> m_pix_op_neg_2: 9156 <1> ;jmp short m_pix_op_neg_16 9157 <1> m_pix_op_neg_16: 9158 <1> ; 16 bit colors (65536 colors) 9159 0000F00E 66AD <1> lodsw 9160 0000F010 663B05[A29D0100] <1> cmp ax, [maskcolor] 9161 0000F017 740A <1> je short m_pix_op_neg_16_1 ; exclude 9162 0000F019 66F71F <1> neg word [edi] 9163 0000F01C 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 9164 <1> m_pix_op_neg_16_1: 9165 0000F023 83C702 <1> add edi, 2 ; +2 9166 0000F026 E2E6 <1> loop m_pix_op_neg_16 9167 0000F028 C3 <1> retn 9168 <1> m_pix_op_neg_3: 9169 <1> ; 32 bit true colors 9170 <1> ;jmp short m_pix_op_neg_32 9171 <1> m_pix_op_neg_32: 9172 <1> ; 32 bit true colors 9173 0000F029 AD <1> lodsd 9174 0000F02A 3B05[A29D0100] <1> cmp eax, [maskcolor] 9175 0000F030 7409 <1> je short m_pix_op_neg_32_1 ; exclude 9176 0000F032 F71F <1> neg dword [edi] 9177 0000F034 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 9178 <1> m_pix_op_neg_32_1: 9179 0000F03B 83C704 <1> add edi, 4 ; +4 9180 0000F03E E2E9 <1> loop m_pix_op_neg_32 9181 0000F040 C3 <1> retn 9182 <1> 9183 <1> m_pix_op_neg_w: 9184 <1> ; 06/02/2021 9185 <1> ; NEGATIVE COLOR (MASKED, window) 9186 <1> ; 9187 <1> ; jump from pix_op_neg_w 9188 <1> ; 9189 <1> ; INPUT: 9190 <1> ; ecx = bytes per row (to be applied) 9191 <1> ; edx = screen width in bytes 9192 <1> ; ebx = row count 9193 <1> ; 9194 <1> ; [maskcolor] = mask color (to be excluded) 9195 <1> ; 9196 <1> ; OUTPUT: 9197 <1> ; [u.r0] will be > 0 if succesful 9198 <1> 9199 <1> ; window 9200 <1> ;mov edi, [v_str] ; LFB start address 9201 <1> ;mov esi, edi 9202 <1> 9203 0000F041 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9204 0000F048 7707 <1> ja short m_pix_op_neg_w_1 9205 <1> 9206 <1> ; 256 colors (8bpp) 9207 0000F04A BD[C5EF0000] <1> mov ebp, m_pix_op_neg_8 9208 0000F04F EB1E <1> jmp short m_pix_op_neg_w_4 9209 <1> 9210 <1> m_pix_op_neg_w_1: 9211 0000F051 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9212 0000F058 7710 <1> ja short m_pix_op_neg_w_3 ; 32bpp 9213 0000F05A 7207 <1> jb short m_pix_op_neg_w_2 ; 16bpp 9214 <1> 9215 <1> ; 24 bit true colors 9216 0000F05C BD[E5EF0000] <1> mov ebp, m_pix_op_neg_24 9217 0000F061 EB0C <1> jmp short m_pix_op_neg_w_4 9218 <1> 9219 <1> ; 65536 colors (16bpp) 9220 <1> m_pix_op_neg_w_2: 9221 0000F063 BD[0EF00000] <1> mov ebp, m_pix_op_neg_16 9222 0000F068 EB05 <1> jmp short m_pix_op_neg_w_4 9223 <1> 9224 <1> ; 32 bit true colors 9225 <1> m_pix_op_neg_w_3: 9226 0000F06A BD[29F00000] <1> mov ebp, m_pix_op_neg_32 9227 <1> m_pix_op_neg_w_4: 9228 0000F06F E9A7F9FFFF <1> jmp m_pix_op_neg_w_x 9229 <1> 9230 <1> m_pix_op_inc: 9231 <1> ; 06/02/2021 9232 <1> ; INCREASE COLOR (MASKED, full screen) 9233 <1> ; 9234 <1> ; jump from pix_op_inc 9235 <1> ; 9236 <1> ; INPUT: 9237 <1> ; ecx = [v_siz] ; display page pixel count 9238 <1> ; esi = edi = [v_mem] ; LFB start address 9239 <1> ; 9240 <1> ; [maskcolor] = mask color (to be excluded) 9241 <1> ; 9242 <1> ; OUTPUT: 9243 <1> ; [u.r0] will be > 0 if succesful 9244 <1> 9245 <1> ; Full screen 9246 <1> m_pix_op_inc_0: 9247 0000F074 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9248 0000F07B 7719 <1> ja short m_pix_op_inc_1 9249 <1> ; 256 colors (8bpp) 9250 <1> ;jmp short m_pix_op_inc_8 9251 <1> m_pix_op_inc_8: 9252 <1> ; 8 bit colors (256 colors) 9253 0000F07D AC <1> lodsb 9254 0000F07E 3A05[A29D0100] <1> cmp al, [maskcolor] 9255 0000F084 740C <1> je short m_pix_op_inc_8_1 ; exclude 9256 0000F086 FE07 <1> inc byte [edi] 9257 0000F088 7502 <1> jnz short m_pix_op_inc_8_0 9258 0000F08A FE0F <1> dec byte [edi] 9259 <1> m_pix_op_inc_8_0: 9260 0000F08C FF05[6C8E0100] <1> inc dword [u.r0] ; +1 9261 <1> m_pix_op_inc_8_1: 9262 0000F092 47 <1> inc edi 9263 0000F093 E2E8 <1> loop m_pix_op_inc_8 9264 0000F095 C3 <1> retn 9265 <1> m_pix_op_inc_1: 9266 0000F096 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9267 0000F09D 7752 <1> ja short m_pix_op_inc_3 ; 32bpp 9268 0000F09F 7230 <1> jb short m_pix_op_inc_2 ; 16bpp 9269 <1> ; 24 bit true colors 9270 <1> ;jmp short m_pix_op_inc_24 9271 <1> m_pix_op_inc_24: 9272 <1> ; 24 bit true colors 9273 0000F0A1 66AD <1> lodsw 9274 0000F0A3 C1E010 <1> shl eax, 16 9275 0000F0A6 AC <1> lodsb 9276 0000F0A7 C1C010 <1> rol eax, 16 9277 0000F0AA 3B05[A29D0100] <1> cmp eax, [maskcolor] 9278 0000F0B0 7419 <1> je short m_pix_op_inc_24_1 ; exclude 9279 0000F0B2 40 <1> inc eax 9280 0000F0B3 3DFFFFFF00 <1> cmp eax, 0FFFFFFh 9281 0000F0B8 7601 <1> jna short m_pix_op_inc_24_0 9282 0000F0BA 48 <1> dec eax 9283 <1> m_pix_op_inc_24_0: 9284 0000F0BB 668907 <1> mov [edi], ax 9285 0000F0BE C1E810 <1> shr eax, 16 9286 0000F0C1 884702 <1> mov [edi+2], al 9287 0000F0C4 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 9288 <1> m_pix_op_inc_24_1: 9289 0000F0CB 83C703 <1> add edi, 3 ; +3 9290 0000F0CE E2D1 <1> loop m_pix_op_inc_24 9291 0000F0D0 C3 <1> retn 9292 <1> ; 65536 colors (16bpp) 9293 <1> m_pix_op_inc_2: 9294 <1> ;jmp short m_pix_op_inc_16 9295 <1> m_pix_op_inc_16: 9296 <1> ; 16 bit colors (65536 colors) 9297 0000F0D1 66AD <1> lodsw 9298 0000F0D3 663B05[A29D0100] <1> cmp ax, [maskcolor] 9299 0000F0DA 740F <1> je short m_pix_op_inc_16_1 ; exclude 9300 0000F0DC 66FF07 <1> inc word [edi] 9301 0000F0DF 7503 <1> jnz short m_pix_op_inc_16_0 9302 0000F0E1 66FF0F <1> dec word [edi] 9303 <1> m_pix_op_inc_16_0: 9304 0000F0E4 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 9305 <1> m_pix_op_inc_16_1: 9306 0000F0EB 83C702 <1> add edi, 2 ; +2 9307 0000F0EE E2E1 <1> loop m_pix_op_inc_16 9308 0000F0F0 C3 <1> retn 9309 <1> m_pix_op_inc_3: 9310 <1> ; 32 bit true colors 9311 <1> ;jmp short m_pix_op_inc_32 9312 <1> m_pix_op_inc_32: 9313 <1> ; 32 bit true colors 9314 0000F0F1 AD <1> lodsd 9315 0000F0F2 3B05[A29D0100] <1> cmp eax, [maskcolor] 9316 0000F0F8 740D <1> je short m_pix_op_inc_32_1 ; exclude 9317 0000F0FA FF07 <1> inc dword [edi] 9318 0000F0FC 7502 <1> jnz short m_pix_op_inc_32_0 9319 0000F0FE FF0F <1> dec dword [edi] 9320 <1> m_pix_op_inc_32_0: 9321 0000F100 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 9322 <1> m_pix_op_inc_32_1: 9323 0000F107 83C704 <1> add edi, 4 ; +4 9324 0000F10A E2E5 <1> loop m_pix_op_inc_32 9325 0000F10C C3 <1> retn 9326 <1> 9327 <1> m_pix_op_inc_w: 9328 <1> ; 06/02/2021 9329 <1> ; INCREASE COLOR (MASKED, window) 9330 <1> ; 9331 <1> ; jump from pix_op_inc_w 9332 <1> ; 9333 <1> ; INPUT: 9334 <1> ; ecx = bytes per row (to be applied) 9335 <1> ; edx = screen width in bytes 9336 <1> ; ebx = row count 9337 <1> ; 9338 <1> ; [maskcolor] = mask color (to be excluded) 9339 <1> ; 9340 <1> ; OUTPUT: 9341 <1> ; [u.r0] will be > 0 if succesful 9342 <1> 9343 <1> ; window 9344 <1> ;mov edi, [v_str] ; LFB start address 9345 <1> ;mov esi, edi 9346 <1> 9347 0000F10D 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9348 0000F114 7707 <1> ja short m_pix_op_inc_w_1 9349 <1> 9350 <1> ; 256 colors (8bpp) 9351 0000F116 BD[7DF00000] <1> mov ebp, m_pix_op_inc_8 9352 0000F11B EB1E <1> jmp short m_pix_op_inc_w_4 9353 <1> 9354 <1> m_pix_op_inc_w_1: 9355 0000F11D 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9356 0000F124 7710 <1> ja short m_pix_op_inc_w_3 ; 32bpp 9357 0000F126 7207 <1> jb short m_pix_op_inc_w_2 ; 16bpp 9358 <1> 9359 <1> ; 24 bit true colors 9360 0000F128 BD[A1F00000] <1> mov ebp, m_pix_op_inc_24 9361 0000F12D EB0C <1> jmp short m_pix_op_inc_w_4 9362 <1> 9363 <1> ; 65536 colors (16bpp) 9364 <1> m_pix_op_inc_w_2: 9365 0000F12F BD[D1F00000] <1> mov ebp, m_pix_op_inc_16 9366 0000F134 EB05 <1> jmp short m_pix_op_inc_w_4 9367 <1> 9368 <1> ; 32 bit true colors 9369 <1> m_pix_op_inc_w_3: 9370 0000F136 BD[F1F00000] <1> mov ebp, m_pix_op_inc_32 9371 <1> m_pix_op_inc_w_4: 9372 0000F13B E9DBF8FFFF <1> jmp m_pix_op_inc_w_x 9373 <1> 9374 <1> m_pix_op_dec: 9375 <1> ; 06/02/2021 9376 <1> ; DECREASE COLOR (MASKED, full screen) 9377 <1> ; 9378 <1> ; jump from pix_op_dec 9379 <1> ; 9380 <1> ; INPUT: 9381 <1> ; ecx = [v_siz] ; display page pixel count 9382 <1> ; esi = edi = [v_mem] ; LFB start address 9383 <1> ; 9384 <1> ; [maskcolor] = mask color (to be excluded) 9385 <1> ; 9386 <1> ; OUTPUT: 9387 <1> ; [u.r0] will be > 0 if succesful 9388 <1> 9389 <1> ; Full screen 9390 <1> m_pix_op_dec_0: 9391 0000F140 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9392 0000F147 7719 <1> ja short m_pix_op_dec_1 9393 <1> ; 256 colors (8bpp) 9394 <1> ;jmp short m_pix_op_dec_8 9395 <1> m_pix_op_dec_8: 9396 <1> ; 8 bit colors (256 colors) 9397 0000F149 AC <1> lodsb 9398 0000F14A 3A05[A29D0100] <1> cmp al, [maskcolor] 9399 0000F150 740C <1> je short m_pix_op_dec_8_1 ; exclude 9400 0000F152 FE0F <1> dec byte [edi] 9401 0000F154 7902 <1> jns short m_pix_op_dec_8_0 9402 0000F156 FE07 <1> inc byte [edi] 9403 <1> m_pix_op_dec_8_0: 9404 0000F158 FF05[6C8E0100] <1> inc dword [u.r0] ; +1 9405 <1> m_pix_op_dec_8_1: 9406 0000F15E 47 <1> inc edi 9407 0000F15F E2E8 <1> loop m_pix_op_dec_8 9408 0000F161 C3 <1> retn 9409 <1> m_pix_op_dec_1: 9410 0000F162 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9411 0000F169 774D <1> ja short m_pix_op_dec_3 ; 32bpp 9412 0000F16B 722B <1> jb short m_pix_op_dec_2 ; 16bpp 9413 <1> ; 24 bit true colors 9414 <1> ;jmp short m_pix_op_dec_24 9415 <1> m_pix_op_dec_24: 9416 <1> ; 24 bit true colors 9417 0000F16D 66AD <1> lodsw 9418 0000F16F C1E010 <1> shl eax, 16 9419 0000F172 AC <1> lodsb 9420 0000F173 C1C010 <1> rol eax, 16 9421 0000F176 3B05[A29D0100] <1> cmp eax, [maskcolor] 9422 0000F17C 7414 <1> je short m_pix_op_dec_24_1 ; exclude 9423 0000F17E 48 <1> dec eax 9424 0000F17F 7901 <1> jns short m_pix_op_dec_24_0 9425 0000F181 40 <1> inc eax 9426 <1> m_pix_op_dec_24_0: 9427 0000F182 668907 <1> mov [edi], ax 9428 0000F185 C1E810 <1> shr eax, 16 9429 0000F188 884702 <1> mov [edi+2], al 9430 0000F18B 8305[6C8E0100]03 <1> add dword [u.r0], 3 ; +3 9431 <1> m_pix_op_dec_24_1: 9432 0000F192 83C703 <1> add edi, 3 ; +3 9433 0000F195 E2D6 <1> loop m_pix_op_dec_24 9434 0000F197 C3 <1> retn 9435 <1> ; 65536 colors (16bpp) 9436 <1> m_pix_op_dec_2: 9437 <1> ;jmp short m_pix_op_dec_16 9438 <1> m_pix_op_dec_16: 9439 <1> ; 16 bit colors (65536 colors) 9440 0000F198 66AD <1> lodsw 9441 0000F19A 663B05[A29D0100] <1> cmp ax, [maskcolor] 9442 0000F1A1 740F <1> je short m_pix_op_dec_16_1 ; exclude 9443 0000F1A3 66FF0F <1> dec word [edi] 9444 0000F1A6 7903 <1> jns short m_pix_op_dec_16_0 9445 0000F1A8 66FF07 <1> inc word [edi] 9446 <1> m_pix_op_dec_16_0: 9447 0000F1AB 8305[6C8E0100]02 <1> add dword [u.r0], 2 ; +2 9448 <1> m_pix_op_dec_16_1: 9449 0000F1B2 83C702 <1> add edi, 2 ; +2 9450 0000F1B5 E2E1 <1> loop m_pix_op_dec_16 9451 0000F1B7 C3 <1> retn 9452 <1> m_pix_op_dec_3: 9453 <1> ; 32 bit true colors 9454 <1> ;jmp short m_pix_op_dec_32 9455 <1> m_pix_op_dec_32: 9456 <1> ; 32 bit true colors 9457 0000F1B8 AD <1> lodsd 9458 0000F1B9 3B05[A29D0100] <1> cmp eax, [maskcolor] 9459 0000F1BF 740D <1> je short m_pix_op_dec_32_1 ; exclude 9460 0000F1C1 FF0F <1> dec dword [edi] 9461 0000F1C3 7902 <1> jns short m_pix_op_dec_32_0 9462 0000F1C5 FF07 <1> inc dword [edi] 9463 <1> m_pix_op_dec_32_0: 9464 0000F1C7 8305[6C8E0100]04 <1> add dword [u.r0], 4 ; +4 9465 <1> m_pix_op_dec_32_1: 9466 0000F1CE 83C704 <1> add edi, 4 ; +4 9467 0000F1D1 E2E5 <1> loop m_pix_op_dec_32 9468 0000F1D3 C3 <1> retn 9469 <1> 9470 <1> m_pix_op_dec_w: 9471 <1> ; 06/02/2021 9472 <1> ; DECREASE COLOR (MASKED, window) 9473 <1> ; 9474 <1> ; jump from pix_op_dec_w 9475 <1> ; 9476 <1> ; INPUT: 9477 <1> ; ecx = bytes per row (to be applied) 9478 <1> ; edx = screen width in bytes 9479 <1> ; ebx = row count 9480 <1> ; 9481 <1> ; [maskcolor] = mask color (to be excluded) 9482 <1> ; 9483 <1> ; OUTPUT: 9484 <1> ; [u.r0] will be > 0 if succesful 9485 <1> 9486 <1> ; window 9487 <1> ;mov edi, [v_str] ; LFB start address 9488 <1> ;mov esi, edi 9489 <1> 9490 0000F1D4 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9491 0000F1DB 7707 <1> ja short m_pix_op_dec_w_1 9492 <1> 9493 <1> ; 256 colors (8bpp) 9494 0000F1DD BD[49F10000] <1> mov ebp, m_pix_op_dec_8 9495 0000F1E2 EB1E <1> jmp short m_pix_op_dec_w_4 9496 <1> 9497 <1> m_pix_op_dec_w_1: 9498 0000F1E4 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9499 0000F1EB 7710 <1> ja short m_pix_op_dec_w_3 ; 32bpp 9500 0000F1ED 7207 <1> jb short m_pix_op_dec_w_2 ; 16bpp 9501 <1> 9502 <1> ; 24 bit true colors 9503 0000F1EF BD[6DF10000] <1> mov ebp, m_pix_op_dec_24 9504 0000F1F4 EB0C <1> jmp short m_pix_op_dec_w_4 9505 <1> 9506 <1> ; 65536 colors (16bpp) 9507 <1> m_pix_op_dec_w_2: 9508 0000F1F6 BD[98F10000] <1> mov ebp, m_pix_op_dec_16 9509 0000F1FB EB05 <1> jmp short m_pix_op_dec_w_4 9510 <1> 9511 <1> ; 32 bit true colors 9512 <1> m_pix_op_dec_w_3: 9513 0000F1FD BD[B8F10000] <1> mov ebp, m_pix_op_dec_32 9514 <1> m_pix_op_dec_w_4: 9515 0000F202 E914F8FFFF <1> jmp m_pix_op_dec_w_x 9516 <1> 9517 <1> sysvideo_39: 9518 <1> ; 15/02/2021 9519 <1> ; 07/02/2021, 08/02/2021 9520 <1> ; 03/01/2021, 04/01/2021 9521 <1> ; 23/11/2020 9522 <1> ; BH = 3 9523 <1> ; PIXEL READ/WRITE 9524 <1> 9525 <1> ; 07/02/2021 9526 <1> ; 04/01/2021 (TRDOS 386 v2.0.3) 9527 0000F207 80FB03 <1> cmp bl, 3 9528 0000F20A 761A <1> jna short sysvideo_39_1 9529 <1> ; 07/02/2021 9530 0000F20C 80FB06 <1> cmp bl, 6 9531 0000F20F 7705 <1> ja short sysvideo_39_0 9532 0000F211 E91A010000 <1> jmp sysvideo_39_31 9533 <1> sysvideo_39_0: 9534 <1> ; error 9535 0000F216 B3FF <1> mov bl, 0FFh 9536 0000F218 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 9537 0000F21E 895D10 <1> mov [ebp+16], ebx ; EBX 9538 0000F221 E968D8FFFF <1> jmp sysret 9539 <1> sysvideo_39_1: 9540 0000F226 803D[2E680000]FF <1> cmp byte [CRT_MODE], 0FFh 9541 0000F22D 7312 <1> jnb short sysvideo_39_2 ; SVGA (VESA VBE) video mode 9542 <1> 9543 <1> ; Std VGA or CGA mode 9544 0000F22F 81C200000A00 <1> add edx, 0A0000h 9545 0000F235 72DF <1> jc short sysvideo_39_0 9546 0000F237 81FAFFFF0A00 <1> cmp edx, 0AFFFFh 9547 0000F23D 77D7 <1> ja short sysvideo_39_0 9548 0000F23F EB1E <1> jmp short sysvideo_39_3 ; 8bpp 9549 <1> 9550 <1> sysvideo_39_2: 9551 <1> ; use current vbe (svga) video mode 9552 <1> 9553 <1> ; get LFB address 9554 0000F241 A1[349D0100] <1> mov eax, [LFB_ADDR] ; [LFB_Info+LFBINFO.LFB_addr] 9555 0000F246 09C0 <1> or eax, eax 9556 0000F248 74CC <1> jz short sysvideo_39_0 9557 0000F24A 3B15[389D0100] <1> cmp edx, [LFB_SIZE] 9558 0000F250 73C4 <1> jnb short sysvideo_39_0 9559 <1> 9560 0000F252 01C2 <1> add edx, eax 9561 <1> ;jc short sysvideo_39_0 9562 <1> 9563 <1> ; Pixel read/write in VESA VBE (2/3) video mode 9564 <1> ; Video memory at Linear Frame Buffer base address 9565 <1> 9566 0000F254 8A3D[409D0100] <1> mov bh, [LFB_Info+LFBINFO.bpp] 9567 <1> 9568 0000F25A 80FF08 <1> cmp bh, 8 ; 8bpp 9569 0000F25D 775D <1> ja short sysvideo_39_17 9570 <1> 9571 <1> ; 8 bits per pixel 9572 <1> sysvideo_39_3: 9573 0000F25F 80FB01 <1> cmp bl, 1 ; 1 = write pixel 9574 0000F262 7406 <1> je short sysvideo_39_5 9575 0000F264 7712 <1> ja short sysvideo_39_8 9576 <1> sysvideo_39_4: 9577 <1> ; read pixel (8bpp) 9578 0000F266 8A02 <1> mov al, [edx] 9579 <1> ;mov [u.r0], al 9580 <1> ;jmp sysret 9581 0000F268 EB04 <1> jmp short sysvideo_39_7 9582 <1> sysvideo_39_5: 9583 <1> ; write pixel (8bpp) 9584 0000F26A 88C8 <1> mov al, cl 9585 <1> sysvideo_39_6: 9586 0000F26C 8802 <1> mov [edx], al 9587 <1> sysvideo_39_7: 9588 0000F26E A2[6C8E0100] <1> mov [u.r0], al 9589 0000F273 E916D8FFFF <1> jmp sysret 9590 <1> sysvideo_39_8: 9591 0000F278 80FB03 <1> cmp bl, 3 ; mix 9592 0000F27B 7208 <1> jb short sysvideo_39_9 9593 <1> ; mix pixel colors (8bpp) 9594 0000F27D 8A02 <1> mov al, [edx] 9595 0000F27F 00C8 <1> add al, cl 9596 0000F281 D0D8 <1> rcr al, 1 9597 0000F283 EBE7 <1> jmp short sysvideo_39_6 9598 <1> sysvideo_39_9: 9599 <1> ; swap pixel colors (8bpp) 9600 0000F285 88C8 <1> mov al, cl 9601 0000F287 8602 <1> xchg [edx], al 9602 0000F289 EBE3 <1> jmp short sysvideo_39_7 9603 <1> 9604 <1> ; 16 bits per pixel 9605 <1> sysvideo_39_10: 9606 0000F28B 80FB01 <1> cmp bl, 1 ; 1 = write pixel 9607 0000F28E 7406 <1> je short sysvideo_39_12 9608 0000F290 7714 <1> ja short sysvideo_39_15 9609 <1> sysvideo_39_11: 9610 <1> ; read pixel (16bpp) 9611 0000F292 8B02 <1> mov eax, [edx] 9612 <1> ;mov [u.r0], ax 9613 <1> ;jmp sysret 9614 0000F294 EB05 <1> jmp short sysvideo_39_14 9615 <1> sysvideo_39_12: 9616 <1> ; write pixel (16bpp) 9617 0000F296 89C8 <1> mov eax, ecx 9618 <1> sysvideo_39_13: 9619 0000F298 668902 <1> mov [edx], ax 9620 <1> sysvideo_39_14: 9621 0000F29B 66A3[6C8E0100] <1> mov [u.r0], ax 9622 0000F2A1 E9E8D7FFFF <1> jmp sysret 9623 <1> sysvideo_39_15: 9624 0000F2A6 80FB03 <1> cmp bl, 3 ; mix 9625 0000F2A9 720A <1> jb short sysvideo_39_16 9626 <1> ; mix pixel colors (16bpp) 9627 0000F2AB 8B02 <1> mov eax, [edx] 9628 0000F2AD 6601C8 <1> add ax, cx 9629 0000F2B0 66D1D8 <1> rcr ax, 1 9630 0000F2B3 EBE3 <1> jmp short sysvideo_39_13 9631 <1> sysvideo_39_16: 9632 <1> ; swap pixel colors (16bpp) 9633 0000F2B5 89C8 <1> mov eax, ecx 9634 0000F2B7 668702 <1> xchg [edx], ax 9635 0000F2BA EBDF <1> jmp short sysvideo_39_14 9636 <1> sysvideo_39_17: 9637 0000F2BC 80FF18 <1> cmp bh, 24 9638 0000F2BF 7743 <1> ja short sysvideo_39_24 9639 0000F2C1 72C8 <1> jb short sysvideo_39_10 9640 <1> 9641 <1> ; 24 bits per pixel 9642 0000F2C3 81E1FFFFFF00 <1> and ecx, 0FFFFFFh 9643 0000F2C9 80FB01 <1> cmp bl, 1 ; 1 = write pixel 9644 0000F2CC 7406 <1> je short sysvideo_39_19 9645 0000F2CE 7712 <1> ja short sysvideo_39_22 9646 <1> sysvideo_39_18: 9647 <1> ; read pixel (24bpp) 9648 0000F2D0 8B02 <1> mov eax, [edx] 9649 <1> ;and eax, 0FFFFFFh 9650 <1> ;mov [u.r0], eax 9651 <1> ;jmp sysret 9652 0000F2D2 EB04 <1> jmp short sysvideo_39_21 9653 <1> sysvideo_39_19: 9654 <1> ; write pixel (24bpp) 9655 0000F2D4 89C8 <1> mov eax, ecx 9656 <1> sysvideo_39_20: 9657 <1> ;and eax, 0FFFFFFh 9658 0000F2D6 8902 <1> mov [edx], eax 9659 <1> sysvideo_39_21: 9660 0000F2D8 A3[6C8E0100] <1> mov [u.r0], eax 9661 0000F2DD E9ACD7FFFF <1> jmp sysret 9662 <1> sysvideo_39_22: 9663 0000F2E2 80FB03 <1> cmp bl, 3 ; mix 9664 0000F2E5 720D <1> jb short sysvideo_39_23 9665 <1> ; mix pixel colors (24bpp) 9666 0000F2E7 8B02 <1> mov eax, [edx] 9667 0000F2E9 25FFFFFF00 <1> and eax, 0FFFFFFh 9668 <1> ;and ecx, 0FFFFFFh 9669 0000F2EE 01C8 <1> add eax, ecx 9670 0000F2F0 D1D8 <1> rcr eax, 1 9671 0000F2F2 EBE2 <1> jmp short sysvideo_39_20 9672 <1> sysvideo_39_23: 9673 <1> ; swap pixel colors (24bpp) 9674 0000F2F4 89C8 <1> mov eax, ecx 9675 <1> ;and eax, 0FFFFFFh 9676 0000F2F6 668702 <1> xchg [edx], ax 9677 0000F2F9 C1C810 <1> ror eax, 16 9678 0000F2FC 884202 <1> mov [edx+2], al 9679 0000F2FF C1C010 <1> rol eax, 16 9680 0000F302 EBD4 <1> jmp short sysvideo_39_21 9681 <1> 9682 <1> ; 32 bits per pixel 9683 <1> sysvideo_39_24: 9684 0000F304 80FB01 <1> cmp bl, 1 ; 1 = write pixel 9685 0000F307 7406 <1> je short sysvideo_39_26 9686 0000F309 7712 <1> ja short sysvideo_39_29 9687 <1> sysvideo_39_25: 9688 <1> ; read pixel (32bpp) 9689 0000F30B 8B02 <1> mov eax, [edx] 9690 <1> ;mov [u.r0], eax 9691 <1> ;jmp sysret 9692 0000F30D EB04 <1> jmp short sysvideo_39_28 9693 <1> sysvideo_39_26: 9694 <1> ; write pixel (32bpp) 9695 0000F30F 89C8 <1> mov eax, ecx 9696 <1> sysvideo_39_27: 9697 0000F311 8902 <1> mov [edx], eax 9698 <1> sysvideo_39_28: 9699 0000F313 A3[6C8E0100] <1> mov [u.r0], eax 9700 0000F318 E971D7FFFF <1> jmp sysret 9701 <1> sysvideo_39_29: 9702 0000F31D 80FB03 <1> cmp bl, 3 ; mix 9703 0000F320 7208 <1> jb short sysvideo_39_30 9704 <1> ; mix pixel colors (32bpp) 9705 0000F322 8B02 <1> mov eax, [edx] 9706 0000F324 01C8 <1> add eax, ecx 9707 0000F326 D1D8 <1> rcr eax, 1 9708 0000F328 EBE7 <1> jmp short sysvideo_39_27 9709 <1> sysvideo_39_30: 9710 <1> ; swap pixel colors (32bpp) 9711 0000F32A 89C8 <1> mov eax, ecx 9712 0000F32C 8702 <1> xchg [edx], eax 9713 0000F32E EBE3 <1> jmp short sysvideo_39_28 9714 <1> 9715 <1> sysvideo_39_31: 9716 <1> ; 06/03/2021 9717 <1> ; 08/02/2021 9718 <1> ; 07/02/2021 9719 <1> ; BL = 4 -> read pixels from user defined positions 9720 <1> ; BL = 5 -> write single color pixels to user defined pos. 9721 <1> ; BL = 6 -> write multi color pixels to user defined pos. 9722 <1> ; ECX = color (CL, CX, ECX) 9723 <1> ; EDX = number of pixels 9724 <1> ; ESI = user buffer contains dword pixel positions 9725 <1> ; (and dword colors for BL input = 6) 9726 <1> ; EDI = user's pixel color buff (destination) for BL = 4 9727 <1> 9728 0000F330 890D[A29D0100] <1> mov [maskcolor], ecx 9729 0000F336 89D5 <1> mov ebp, edx ; number of pixels 9730 0000F338 803D[2E680000]FF <1> cmp byte [CRT_MODE], 0FFh ; SVGA flag 9731 0000F33F 7317 <1> jnb short sysvideo_39_33 ; SVGA (VESA VBE mode) 9732 <1> ; Standard VGA mode 9733 0000F341 B900000100 <1> mov ecx, 65536 ; Video page size (maximum) 9734 0000F346 39CA <1> cmp edx, ecx 9735 0000F348 7709 <1> ja short sysvideo_39_32 ; abnormal value ! 9736 0000F34A B800000A00 <1> mov eax, 0A0000h ; Video page start address 9737 0000F34F B708 <1> mov bh, 8 ; 8 bits per pixel (256 colors) 9738 0000F351 EB35 <1> jmp short sysvideo_39_34 9739 <1> sysvideo_39_32: 9740 <1> ; nonsense! (edx has abnormal value) 9741 0000F353 E936D7FFFF <1> jmp sysret 9742 <1> sysvideo_39_33: 9743 <1> ; 06/03/2021 9744 0000F358 8A3D[409D0100] <1> mov bh, [LFB_Info+LFBINFO.bpp] 9745 0000F35E 80FF08 <1> cmp bh, 8 9746 0000F361 7412 <1> je short sysvideo_39_81 ; 8bpp 9747 0000F363 89D0 <1> mov eax, edx 9748 0000F365 80FF10 <1> cmp bh, 16 9749 0000F368 7409 <1> je short sysvideo_39_80 ; 16bpp 9750 0000F36A D1E2 <1> shl edx, 1 9751 0000F36C 80FF20 <1> cmp bh, 32 9752 0000F36F 7502 <1> jne short sysvideo_39_80 ; 24bpp 9753 0000F371 D1E0 <1> shl eax, 1 9754 <1> sysvideo_39_80: 9755 0000F373 01C2 <1> add edx, eax 9756 <1> ; edx = number of bytes 9757 <1> sysvideo_39_81: 9758 <1> ; get LFB address 9759 0000F375 A1[349D0100] <1> mov eax, [LFB_ADDR] ; [LFB_Info+LFBINFO.LFB_addr] 9760 0000F37A 09C0 <1> or eax, eax 9761 0000F37C 74D5 <1> jz short sysvideo_39_32 ; LFB is not ready ! 9762 0000F37E 8B0D[389D0100] <1> mov ecx, [LFB_SIZE] 9763 0000F384 39CA <1> cmp edx, ecx 9764 0000F386 77CB <1> ja short sysvideo_39_32 ; abnormal value ! 9765 <1> 9766 <1> ; 02/03/2021 9767 <1> ; 08/02/2021 9768 <1> ;mov ebp, edx ; pixel count 9769 <1> ;shl ebp, 2 ; byte count (pixel pos: 4 bytes) 9770 <1> 9771 <1> ; 06/03/2021 9772 <1> ; bits per pixel (pixel color size) 9773 <1> ;mov bh, [LFB_Info+LFBINFO.bpp] 9774 <1> sysvideo_39_34: 9775 0000F388 C1E502 <1> shl ebp, 2 ; 15/02/2021 (byte count) 9776 0000F38B A3[929D0100] <1> mov [v_mem], eax ; Save video page start address 9777 0000F390 88DE <1> mov dh, bl ; sub function 9778 <1> ; 06/03/2021 9779 0000F392 883D[919D0100] <1> mov [v_bpp], bh ; bits per pixel (color size) 9780 <1> ;mov ebx, [LFB_SIZE] 9781 0000F398 89CB <1> mov ebx, ecx ; [LFB_SIZE] 9782 <1> 9783 0000F39A B900080000 <1> mov ecx, 2048 9784 0000F39F 39CD <1> cmp ebp, ecx 9785 0000F3A1 7302 <1> jnb short sysvideo_39_35 9786 0000F3A3 89E9 <1> mov ecx, ebp ; fix to requested byte count 9787 <1> sysvideo_39_35: 9788 0000F3A5 80FE04 <1> cmp dh, 4 ; 08/02/2021 9789 <1> ;cmp bl, 4 ; read pixels from user defined positions 9790 0000F3A8 7605 <1> jna short sysvideo_39_36 9791 0000F3AA E9B2000000 <1> jmp sysvideo_39_52 9792 <1> ; 08/02/2021 9793 <1> ;mov [buffer8], edi ; user's destination buff addr 9794 <1> sysvideo_39_36: 9795 <1> ; 08/02/2021 9796 <1> ; read pixel positions 9797 <1> ; as defined in user's source buffer 9798 0000F3AF 893D[AA9D0100] <1> mov [buffer8], edi ; user's destination buff addr 9799 0000F3B5 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK ; kernel buffer for 9800 <1> ; 2028 byte data 9801 <1> ; esi = user's source buffer for pixel positions 9802 <1> ; ecx = byte count 9803 0000F3BA E8A6170000 <1> call transfer_from_user_buffer 9804 0000F3BF 7292 <1> jc short sysvideo_39_32 ; error 9805 <1> ; ecx = transfer count (bytes) 9806 <1> 9807 0000F3C1 57 <1> push edi ; * 9808 0000F3C2 56 <1> push esi ; ** 9809 0000F3C3 51 <1> push ecx ; *** 9810 <1> 9811 0000F3C4 89FE <1> mov esi, edi ; kernel buffer 9812 0000F3C6 8B15[929D0100] <1> mov edx, [v_mem] ; video memory 9813 0000F3CC C1E902 <1> shr ecx, 2 ; pixel count (within buffer capacity) 9814 <1> 9815 0000F3CF 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9816 0000F3D6 7753 <1> ja short sysvideo_39_49 9817 <1> sysvideo_39_37: 9818 <1> ; 8bpp 9819 0000F3D8 AD <1> lodsd 9820 0000F3D9 39D8 <1> cmp eax, ebx ; < [LFB_SIZE] 9821 0000F3DB 7309 <1> jnb short sysvideo_39_39 9822 0000F3DD 0FB60402 <1> movzx eax, byte [edx+eax] 9823 <1> sysvideo_39_38: 9824 0000F3E1 AB <1> stosd 9825 0000F3E2 E2F4 <1> loop sysvideo_39_37 9826 0000F3E4 EB49 <1> jmp short sysvideo_39_50 9827 <1> sysvideo_39_39: 9828 <1> ; write black color for improper positions 9829 0000F3E6 31C0 <1> xor eax, eax 9830 0000F3E8 EBF7 <1> jmp short sysvideo_39_38 9831 <1> sysvideo_39_40: 9832 0000F3EA 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9833 0000F3F1 772A <1> ja short sysvideo_39_47 ; 32bpp 9834 0000F3F3 7216 <1> jb short sysvideo_39_44 ; 16bpp 9835 <1> sysvideo_39_41: 9836 <1> ; 24bpp 9837 0000F3F5 AD <1> lodsd 9838 0000F3F6 39D8 <1> cmp eax, ebx ; < [LFB_SIZE] 9839 0000F3F8 730D <1> jnb short sysvideo_39_43 9840 0000F3FA 8B0402 <1> mov eax, [edx+eax] 9841 0000F3FD 25FFFFFF00 <1> and eax, 0FFFFFFh 9842 <1> sysvideo_39_42: 9843 0000F402 AB <1> stosd 9844 0000F403 E2F0 <1> loop sysvideo_39_41 9845 0000F405 EB28 <1> jmp short sysvideo_39_50 9846 <1> sysvideo_39_43: 9847 <1> ; write black color for improper positions 9848 0000F407 31C0 <1> xor eax, eax 9849 0000F409 EBF7 <1> jmp short sysvideo_39_42 9850 <1> sysvideo_39_44: 9851 <1> ; 16bpp 9852 0000F40B AD <1> lodsd 9853 0000F40C 39D8 <1> cmp eax, ebx ; < [LFB_SIZE] 9854 0000F40E 7309 <1> jnb short sysvideo_39_46 9855 0000F410 0FB70402 <1> movzx eax, word [edx+eax] 9856 <1> sysvideo_39_45: 9857 0000F414 AB <1> stosd 9858 0000F415 E2F4 <1> loop sysvideo_39_44 9859 0000F417 EB16 <1> jmp short sysvideo_39_50 9860 <1> sysvideo_39_46: 9861 <1> ; write black color for improper positions 9862 0000F419 31C0 <1> xor eax, eax 9863 0000F41B EBF7 <1> jmp short sysvideo_39_45 9864 <1> sysvideo_39_47: 9865 <1> ; 32bpp 9866 0000F41D AD <1> lodsd 9867 0000F41E 39D8 <1> cmp eax, ebx ; < [LFB_SIZE] 9868 0000F420 7309 <1> jnb short sysvideo_39_49 9869 0000F422 0FB70402 <1> movzx eax, word [edx+eax] 9870 <1> sysvideo_39_48: 9871 0000F426 AB <1> stosd 9872 0000F427 E2F4 <1> loop sysvideo_39_47 9873 0000F429 EB04 <1> jmp short sysvideo_39_50 9874 <1> sysvideo_39_49: 9875 <1> ; write black color for improper positions 9876 0000F42B 31C0 <1> xor eax, eax 9877 0000F42D EBF7 <1> jmp short sysvideo_39_48 9878 <1> sysvideo_39_50: 9879 0000F42F 59 <1> pop ecx ; transfer count in bytes 9880 0000F430 5E <1> pop esi ; ** ; kernel buffer 9881 <1> ;mov esi, VBE3SAVERESTOREBLOCK ; kernel buffer for 9882 <1> ; 2048 byte data 9883 0000F431 8B3D[AA9D0100] <1> mov edi, [buffer8] 9884 <1> ; edi = user's destination buffer for pixel colors 9885 <1> ; ecx = byte count 9886 0000F437 E8DF160000 <1> call transfer_to_user_buffer 9887 0000F43C 5E <1> pop esi ; * 9888 0000F43D 7266 <1> jc short sysvideo_39_56 ; error 9889 <1> ; ecx = transfer count (bytes) 9890 0000F43F 89C8 <1> mov eax, ecx 9891 0000F441 C1E802 <1> shr eax, 2 9892 0000F444 0105[6C8E0100] <1> add [u.r0], eax ; transfer count (in pixels) 9893 <1> 9894 0000F44A 29CD <1> sub ebp, ecx 9895 0000F44C 7657 <1> jna short sysvideo_39_56 ; completed/finished 9896 0000F44E 01CE <1> add esi, ecx ; next position in source buffer 9897 <1> ;add [buffer8], ecx ; next pos in destination buff 9898 0000F450 01CF <1> add edi, ecx 9899 0000F452 66B90008 <1> mov cx, 2048 ; new count, limit: kernel buff size 9900 0000F456 39CD <1> cmp ebp, ecx ; remain >= limit ? 9901 0000F458 7302 <1> jnb short sysvideo_39_51 ; yes 9902 0000F45A 89E9 <1> mov ecx, ebp ; fix byte count to remain bytes 9903 <1> sysvideo_39_51: 9904 0000F45C E94EFFFFFF <1> jmp sysvideo_39_36 9905 <1> 9906 <1> sysvideo_39_52: 9907 0000F461 80FE05 <1> cmp dh, 5 ; 08/02/2021 9908 <1> ;cmp bl, 5 ; write pixels to user defined positions 9909 0000F464 7605 <1> jna short sysvideo_39_53 9910 0000F466 E9A1000000 <1> jmp sysvideo_39_66 9911 <1> sysvideo_39_53: 9912 <1> ; single color pixel writing 9913 0000F46B BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK ; kernel buffer for 9914 <1> ; 2028 byte data 9915 <1> ; esi = user's source buffer for pixel positions 9916 <1> ; ecx = byte count 9917 0000F470 E8F0160000 <1> call transfer_from_user_buffer 9918 0000F475 722E <1> jc short sysvideo_39_56 ; error 9919 <1> ; ecx = transfer count (bytes) 9920 <1> 9921 <1> ; write pixels by using (user) defined positions 9922 <1> ; ecx = byte count (1,2,3,4 times pixel count) 9923 <1> ; edi = system buffer address 9924 <1> 9925 0000F477 56 <1> push esi ; * 9926 0000F478 51 <1> push ecx ; ** 9927 <1> 9928 0000F479 89FE <1> mov esi, edi 9929 0000F47B 8B3D[929D0100] <1> mov edi, [v_mem] 9930 <1> 9931 <1> ; 08/02/2021 9932 0000F481 C1E902 <1> shr ecx, 2 ; pixel count 9933 0000F484 8B15[A29D0100] <1> mov edx, [maskcolor] 9934 <1> ;mov ebx, [v_siz] 9935 <1> 9936 0000F48A 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 9937 0000F491 7717 <1> ja short sysvideo_39_57 9938 <1> sysvideo_39_54: 9939 <1> ; 8bpp 9940 0000F493 AD <1> lodsd 9941 0000F494 39D8 <1> cmp eax, ebx ; < [v_siz] 9942 0000F496 7309 <1> jnb short sysvideo_39_55 9943 0000F498 881407 <1> mov [edi+eax], dl 9944 <1> ; 06/03/2021 9945 0000F49B FF05[6C8E0100] <1> inc dword [u.r0] 9946 <1> sysvideo_39_55: 9947 0000F4A1 E2F0 <1> loop sysvideo_39_54 9948 0000F4A3 EB50 <1> jmp short sysvideo_39_64 9949 <1> sysvideo_39_56: 9950 0000F4A5 E9E4D5FFFF <1> jmp sysret 9951 <1> sysvideo_39_57: 9952 0000F4AA 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 9953 0000F4B1 7732 <1> ja short sysvideo_39_62 ; 32bpp 9954 0000F4B3 721D <1> jb short sysvideo_39_60 ; 16bpp 9955 <1> sysvideo_39_58: 9956 <1> ; 24bpp 9957 0000F4B5 AD <1> lodsd 9958 0000F4B6 39D8 <1> cmp eax, ebx ; < [v_siz] 9959 0000F4B8 7314 <1> jnb short sysvideo_39_59 9960 0000F4BA 881407 <1> mov [edi+eax], dl 9961 0000F4BD 40 <1> inc eax 9962 0000F4BE C1CA08 <1> ror edx, 8 9963 0000F4C1 66891407 <1> mov [edi+eax], dx 9964 0000F4C5 C1C208 <1> rol edx, 8 9965 0000F4C8 FF05[6C8E0100] <1> inc dword [u.r0] 9966 <1> sysvideo_39_59: 9967 0000F4CE E2E5 <1> loop sysvideo_39_58 9968 0000F4D0 EB23 <1> jmp short sysvideo_39_64 9969 <1> sysvideo_39_60: 9970 <1> ; 16bpp 9971 0000F4D2 AD <1> lodsd 9972 0000F4D3 39D8 <1> cmp eax, ebx ; < [v_siz] 9973 0000F4D5 730A <1> jnb short sysvideo_39_61 9974 0000F4D7 66891407 <1> mov [edi+eax], dx 9975 0000F4DB FF05[6C8E0100] <1> inc dword [u.r0] 9976 <1> sysvideo_39_61: 9977 0000F4E1 E2EF <1> loop sysvideo_39_60 9978 0000F4E3 EB10 <1> jmp short sysvideo_39_64 9979 <1> sysvideo_39_62: 9980 <1> ; 32bpp 9981 0000F4E5 AD <1> lodsd 9982 0000F4E6 39D8 <1> cmp eax, ebx ; < [v_siz] 9983 0000F4E8 7309 <1> jnb short sysvideo_39_63 9984 0000F4EA 891407 <1> mov [edi+eax], edx 9985 0000F4ED FF05[6C8E0100] <1> inc dword [u.r0] 9986 <1> sysvideo_39_63: 9987 0000F4F3 E2F0 <1> loop sysvideo_39_62 9988 <1> sysvideo_39_64: 9989 0000F4F5 59 <1> pop ecx ; ** 9990 0000F4F6 5E <1> pop esi ; * 9991 0000F4F7 29CD <1> sub ebp, ecx 9992 0000F4F9 76AA <1> jna short sysvideo_39_56 9993 0000F4FB 01CE <1> add esi, ecx 9994 0000F4FD 66B90008 <1> mov cx, 2048 9995 0000F501 39CD <1> cmp ebp, ecx 9996 0000F503 7302 <1> jnb short sysvideo_39_65 9997 0000F505 89E9 <1> mov ecx, ebp 9998 <1> sysvideo_39_65: 9999 0000F507 E95FFFFFFF <1> jmp sysvideo_39_53 10000 <1> 10001 <1> sysvideo_39_66: 10002 <1> ; 15/02/2021 10003 0000F50C D1E5 <1> shl ebp, 1 ; 8 bytes per pixel (position&color) 10004 <1> sysvideo_39_67: 10005 0000F50E 66B90008 <1> mov cx, 2048 10006 0000F512 39CD <1> cmp ebp, ecx 10007 0000F514 7302 <1> jnb short sysvideo_39_68 10008 0000F516 89E9 <1> mov ecx, ebp 10009 <1> sysvideo_39_68: 10010 <1> ; multi colors pixel writing 10011 0000F518 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK ; kernel buffer for 10012 <1> ; 2048 byte data 10013 <1> ; esi = user's source buffer for pixel positions 10014 <1> ; ecx = byte count 10015 0000F51D E843160000 <1> call transfer_from_user_buffer 10016 0000F522 7281 <1> jc short sysvideo_39_56 ; error 10017 <1> ; ecx = transfer count 10018 <1> 10019 <1> ; write pixels & colors as defined in user buffer 10020 <1> ; ecx = byte count (2,4,6,8 times pixel count) 10021 <1> ; edi = system buffer address 10022 <1> 10023 0000F524 56 <1> push esi ; ** 10024 0000F525 51 <1> push ecx ; * 10025 <1> 10026 0000F526 89FE <1> mov esi, edi 10027 0000F528 8B3D[929D0100] <1> mov edi, [v_mem] 10028 <1> 10029 <1> ; 08/02/2021 10030 0000F52E C1E903 <1> shr ecx, 3 ; pixel count 10031 <1> 10032 <1> ;mov ebx, [v_siz] 10033 <1> 10034 0000F531 803D[919D0100]08 <1> cmp byte [v_bpp], 8 ; 8bpp 10035 0000F538 7715 <1> ja short sysvideo_39_71 10036 <1> sysvideo_39_69: 10037 <1> ; 8bpp 10038 0000F53A AD <1> lodsd ; position 10039 0000F53B 89C2 <1> mov edx, eax 10040 0000F53D AD <1> lodsd ; color 10041 0000F53E 39DA <1> cmp edx, ebx ; < [v_siz] 10042 0000F540 7309 <1> jnb short sysvideo_39_70 10043 0000F542 880417 <1> mov [edi+edx], al 10044 <1> ; 06/03/2021 10045 0000F545 FF05[6C8E0100] <1> inc dword [u.r0] 10046 <1> sysvideo_39_70: 10047 0000F54B E2ED <1> loop sysvideo_39_69 10048 0000F54D EB51 <1> jmp short sysvideo_39_78 10049 <1> sysvideo_39_71: 10050 0000F54F 803D[919D0100]18 <1> cmp byte [v_bpp], 24 ; 24bpp 10051 0000F556 7735 <1> ja short sysvideo_39_76 ; 32bpp 10052 0000F558 721D <1> jb short sysvideo_39_74 ; 16bpp 10053 <1> sysvideo_39_72: 10054 <1> ; 24bpp 10055 0000F55A AD <1> lodsd ; position 10056 0000F55B 89C2 <1> mov edx, eax 10057 0000F55D AD <1> lodsd ; color 10058 0000F55E 39DA <1> cmp edx, ebx ; < [v_siz] 10059 0000F560 7311 <1> jnb short sysvideo_39_73 10060 0000F562 880417 <1> mov [edi+edx], al 10061 0000F565 42 <1> inc edx 10062 0000F566 C1E808 <1> shr eax, 8 10063 0000F569 66890417 <1> mov [edi+edx], ax 10064 0000F56D FF05[6C8E0100] <1> inc dword [u.r0] 10065 <1> sysvideo_39_73: 10066 0000F573 E2E5 <1> loop sysvideo_39_72 10067 0000F575 EB29 <1> jmp short sysvideo_39_78 10068 <1> sysvideo_39_74: 10069 <1> ; 16bpp 10070 0000F577 AD <1> lodsd ; position 10071 0000F578 89C2 <1> mov edx, eax 10072 0000F57A AD <1> lodsd ; color 10073 0000F57B 39DA <1> cmp edx, ebx ; < [v_siz] 10074 0000F57D 730A <1> jnb short sysvideo_39_75 10075 0000F57F 66890417 <1> mov [edi+edx], ax 10076 0000F583 FF05[6C8E0100] <1> inc dword [u.r0] 10077 <1> sysvideo_39_75: 10078 0000F589 E2EC <1> loop sysvideo_39_74 10079 0000F58B EB13 <1> jmp short sysvideo_39_78 10080 <1> sysvideo_39_76: 10081 <1> ; 32bpp 10082 0000F58D AD <1> lodsd ; position 10083 0000F58E 89C2 <1> mov edx, eax 10084 0000F590 AD <1> lodsd ; color 10085 0000F591 39DA <1> cmp edx, ebx ; < [v_siz] 10086 0000F593 7309 <1> jnb short sysvideo_39_77 10087 0000F595 890417 <1> mov [edi+edx], eax 10088 0000F598 FF05[6C8E0100] <1> inc dword [u.r0] 10089 <1> sysvideo_39_77: 10090 0000F59E E2ED <1> loop sysvideo_39_76 10091 <1> sysvideo_39_78: 10092 0000F5A0 59 <1> pop ecx ; * 10093 0000F5A1 5E <1> pop esi ; ** 10094 <1> 10095 0000F5A2 29CD <1> sub ebp, ecx 10096 0000F5A4 762A <1> jna short sysvideo_39_79 10097 0000F5A6 01CE <1> add esi, ecx 10098 0000F5A8 E961FFFFFF <1> jmp sysvideo_39_67 10099 <1> ;sysvideo_39_79: 10100 <1> ; jmp sysret 10101 <1> 10102 <1> sysvideo_16: 10103 <1> ; 11/08/2022 10104 <1> ; 23/07/2022 10105 <1> ; 06/03/2021 10106 <1> ; 23/11/2020 10107 0000F5AD 80FF04 <1> cmp bh, 4 10108 <1> ;jb sysvideo_39 ; bh = 3, pixel r/w 10109 <1> ;ja short sysvideo_17 10110 <1> ; 23/07/2022 10111 0000F5B0 7407 <1> je short sysvideo_16_0 10112 0000F5B2 7721 <1> ja short sysvideo_17 10113 0000F5B4 E94EFCFFFF <1> jmp sysvideo_39 10114 <1> sysvideo_16_0: 10115 <1> ; BH = 4 10116 <1> ; Direct User Access for CGA video memory. 10117 <1> ; Setup user's page tables for direct access to 0B8000h. 10118 <1> ; 10119 <1> ; Permission checks are not implemented yet ! 10120 <1> ; (11/07/2016) 10121 <1> 10122 0000F5B9 B800800B00 <1> mov eax, 0B8000h 10123 <1> ;mov ecx, 8 ; 8 pages (8*4K=32K) 10124 <1> ; 11/08/2022 10125 0000F5BE 31C9 <1> xor ecx, ecx 10126 0000F5C0 B108 <1> mov cl, 8 10127 0000F5C2 89C3 <1> mov ebx, eax ; 12/05/2017 ; virtual = physical 10128 0000F5C4 E8066AFFFF <1> call direct_memory_access 10129 <1> ;jc sysret 10130 0000F5C9 7205 <1> jc short sysvideo_39_79 ; 06/03/2021 10131 <1> ; eax = 0B8000h if there is not an error 10132 0000F5CB A3[6C8E0100] <1> mov [u.r0], eax 10133 <1> sysvideo_39_79: ; 08/01/2021 10134 0000F5D0 E9B9D4FFFF <1> jmp sysret 10135 <1> 10136 <1> sysvideo_17: 10137 <1> ; 23/07/2022 10138 <1> ; 23/12/2020 10139 <1> ; 11/12/2020 10140 <1> ; 10/12/2020 10141 <1> ; 23/11/2020 10142 0000F5D5 80FF06 <1> cmp bh, 6 10143 0000F5D8 7424 <1> je short sysvideo_17_0 ; 23/07/2022 10144 0000F5DA 7205 <1> jb short sysvideo_18 ; 23/07/2022 10145 0000F5DC E95E010000 <1> jmp sysvideo_20 ; ja 10146 <1> 10147 <1> ; 23/07/2022 10148 <1> sysvideo_18: 10149 <1> ; BH = 5 10150 <1> ; Direct User Access for VGA video memory. 10151 <1> ; Setup user's page tables for direct access to 0A0000h. 10152 <1> ; 10153 <1> ; Permission checks are not implemented yet ! 10154 <1> ; (11/07/2016) 10155 <1> 10156 0000F5E1 B800000A00 <1> mov eax, 0A0000h 10157 0000F5E6 B910000000 <1> mov ecx, 16 ; 16 pages (16*4K=64K) 10158 0000F5EB 89C3 <1> mov ebx, eax ; 12/05/2017 ; virtual = physical 10159 0000F5ED E8DD69FFFF <1> call direct_memory_access 10160 <1> ;jc sysret 10161 <1> ; 23/07/2022 10162 0000F5F2 7205 <1> jc short sysvideo_18_0 10163 <1> ; eax = 0A0000h if there is not an error 10164 0000F5F4 A3[6C8E0100] <1> mov [u.r0], eax 10165 <1> sysvideo_18_0: 10166 0000F5F9 E990D4FFFF <1> jmp sysret 10167 <1> 10168 <1> sysvideo_17_0: 10169 <1> ; BH = 6 10170 <1> ; Direct User Access to Linear Frame Buffer. 10171 <1> ; Setup user's page tables for direct access to LFB. 10172 <1> ; 10173 <1> ; Permission checks are not implemented yet ! 10174 <1> ; (10/12/2020) 10175 <1> 10176 0000F5FE 80FBFF <1> cmp bl, 0FFh ; current video mode 10177 0000F601 722C <1> jb short sysvideo_17_2 ; for desired video mode 10178 <1> 10179 0000F603 381D[2E680000] <1> cmp [CRT_MODE], bl ; VESA VBE video mode ? 10180 0000F609 750E <1> jne short sysvideo_17_1 10181 0000F60B 668B0D[269D0100] <1> mov cx, [video_mode] 10182 0000F612 6681E1FF01 <1> and cx, 1FFh 10183 0000F617 EB29 <1> jmp short sysvideo_17_3 10184 <1> sysvideo_17_1: 10185 <1> ; 11/12/2020 10186 0000F619 88DF <1> mov bh, bl ; 0FFh 10187 0000F61B 8A1D[2E680000] <1> mov bl, [CRT_MODE] ; VGA/CGA video mode 10188 0000F621 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 10189 <1> ; 23/12/2020 10190 0000F627 895D10 <1> mov [ebp+16], ebx ; return to user with EBX value 10191 0000F62A E95FD4FFFF <1> jmp sysret ; return to user with EAX = 0 10192 <1> sysvideo_17_2: 10193 <1> ; bl = VESA video mode - 100h 10194 0000F62F B701 <1> mov bh, 1 ; bx = 1XXh 10195 0000F631 53 <1> push ebx ; requested vesa video mode 10196 0000F632 E88044FFFF <1> call vbe_biosfn_return_current_mode 10197 0000F637 59 <1> pop ecx ; requested vesa video mode 10198 0000F638 6681E3FF01 <1> and bx, 1FFh 10199 0000F63D 6639D9 <1> cmp cx, bx 10200 0000F640 7564 <1> jne short sysvideo_17_8 10201 <1> sysvideo_17_3: 10202 0000F642 663B0D[329D0100] <1> cmp cx, [LFB_Info+LFBINFO.mode] 10203 0000F649 755B <1> jne short sysvideo_17_8 10204 <1> sysvideo_17_4: 10205 <1> ; 11/12/2020 10206 0000F64B A1[349D0100] <1> mov eax, [LFB_Info+LFBINFO.LFB_addr] 10207 <1> ; 21/12/2020 10208 0000F650 09C0 <1> or eax, eax 10209 0000F652 744D <1> jz short sysvideo_17_7 10210 <1> ; 10211 0000F654 8B0D[389D0100] <1> mov ecx, [LFB_Info+LFBINFO.LFB_size] ; buff size 10212 0000F65A 89C3 <1> mov ebx, eax ; user's address = physical address 10213 <1> ;push ebx 10214 0000F65C 51 <1> push ecx 10215 <1> ; 21/12/2020 10216 0000F65D 81C1FF0F0000 <1> add ecx, 4095 ; PAGESIZE - 1 10217 <1> ; 14/12/2020 10218 0000F663 C1E90C <1> shr ecx, 12 ; convert bytes to pages 10219 0000F666 E86469FFFF <1> call direct_memory_access 10220 0000F66B 5A <1> pop edx ; linear frame buffer size in bytes 10221 <1> ;pop eax ; linear frame buffer address (physical) 10222 0000F66C 7233 <1> jc short sysvideo_17_7 ; [u.r0] = eax = 0 10223 <1> sysvideo_17_5: 10224 0000F66E 668B0D[3E9D0100] <1> mov cx, [LFB_Info+LFBINFO.Y_res] ; screen height 10225 0000F675 C1E110 <1> shl ecx, 16 10226 0000F678 668B0D[3C9D0100] <1> mov cx, [LFB_Info+LFBINFO.X_res] ; screen width 10227 0000F67F 31DB <1> xor ebx, ebx 10228 0000F681 8A1D[409D0100] <1> mov bl, [LFB_Info+LFBINFO.bpp] ; bits per pixel 10229 0000F687 8A3D[329D0100] <1> mov bh, [LFB_Info+LFBINFO.mode] ; XX part of 1XXh 10230 <1> sysvideo_26_4: ; 23/12/2020 10231 0000F68D 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 10232 0000F693 895514 <1> mov [ebp+20], edx ; return to user with EDX value 10233 0000F696 895D10 <1> mov [ebp+16], ebx ; EBX 10234 0000F699 894D18 <1> mov [ebp+24], ecx ; ECX 10235 <1> sysvideo_17_6: 10236 0000F69C A3[6C8E0100] <1> mov [u.r0], eax ; LFB address 10237 <1> sysvideo_17_7: 10238 0000F6A1 E9E8D3FFFF <1> jmp sysret 10239 <1> sysvideo_17_8: 10240 <1> ; cx = mode 10241 <1> ; 21/12/2020 10242 0000F6A6 80CD40 <1> or ch, 40h ; Linear frame buffer flag 10243 0000F6A9 E82C42FFFF <1> call _vbe_biosfn_return_mode_info 10244 0000F6AE 72F1 <1> jc short sysvideo_17_7 10245 0000F6B0 EB99 <1> jmp short sysvideo_17_4 10246 <1> 10247 <1> sysvideo_19: 10248 <1> ; 23/07/2022 10249 <1> ; 22/01/2021 10250 <1> ; 12/12/2020 10251 <1> ; 11/12/2020 10252 <1> ; 23/11/2020 10253 <1> ; BH = 7 10254 <1> ; Get (Super/Extended VGA) mode 10255 <1> ; and Linear Frame Buffer info. 10256 <1> 10257 <1> ; 22/01/2021 10258 0000F6B2 B3FF <1> mov bl, 0FFh 10259 <1> ; 11/12/2020 10260 <1> ;cmp byte [CRT_MODE], 0FFh ; (extended mode?) 10261 <1> ; 22/01/2021 10262 0000F6B4 381D[2E680000] <1> cmp [CRT_MODE], bl ; 0FFh 10263 <1> ;jb short sysvideo_17_1 ; not a VESA VBE mode 10264 <1> ; 23/07/2022 10265 <1> ; 12/12/2020 10266 0000F6BA 7305 <1> jnb short sysvideo_19_0 10267 <1> ; 23/07/2022 10268 0000F6BC E958FFFFFF <1> jmp sysvideo_17_1 10269 <1> 10270 <1> sysvideo_19_0: 10271 0000F6C1 E8F143FFFF <1> call vbe_biosfn_return_current_mode 10272 0000F6C6 6681E3FF01 <1> and bx, 1FFh 10273 0000F6CB 663B1D[329D0100] <1> cmp bx, [LFB_Info+LFBINFO.mode] 10274 0000F6D2 750D <1> jne short sysvideo_19_2 10275 <1> sysvideo_19_1: 10276 0000F6D4 A1[349D0100] <1> mov eax, [LFB_Info+LFBINFO.LFB_addr] 10277 0000F6D9 8B15[389D0100] <1> mov edx, [LFB_Info+LFBINFO.LFB_size] 10278 0000F6DF EB8D <1> jmp sysvideo_17_5 10279 <1> sysvideo_19_2: 10280 0000F6E1 E8F441FFFF <1> call _vbe_biosfn_return_mode_info 10281 0000F6E6 73EC <1> jnc short sysvideo_19_1 10282 0000F6E8 E9A1D3FFFF <1> jmp sysret 10283 <1> 10284 <1> sysvideo_20_1: 10285 <1> ; cx = vesa video mode 10286 0000F6ED 6689C8 <1> mov ax, cx 10287 0000F6F0 663D0001 <1> cmp ax, 100h 10288 0000F6F4 725C <1> jb short sysvideo_20_0 ; VGA/CGA mode 10289 0000F6F6 663DFF01 <1> cmp ax, 1FFh 10290 <1> ;ja short sysvideo_20_4 ; not valid 10291 0000F6FA 773E <1> ja short sysvideo_20_3 10292 0000F6FC 50 <1> push eax 10293 0000F6FD 6689C3 <1> mov bx, ax 10294 0000F700 66B8024F <1> mov ax, 4F02h 10295 <1> 10296 <1> ; simulate _int10h (int 31h) for func 4F02h 10297 <1> ;pushfd 10298 <1> ;push cs 10299 <1> ;push sysvideo_20_1_retn 10300 <1> ;push es ; * 10301 <1> ;push ds ; ** ; SAVE WORK AND PARAMETER REGISTERS 10302 <1> ;jmp VBE_func 10303 <1> ;sysvideo_20_1_retn: 10304 <1> 10305 0000F704 E81120FFFF <1> call _int10h ; simulate int 10h (int 31h) 10306 <1> 10307 0000F709 6683F84F <1> cmp ax, 004Fh 10308 0000F70D 58 <1> pop eax 10309 0000F70E 752A <1> jne short sysvideo_20_3 ; error 10310 <1> ;pop eax 10311 0000F710 40 <1> inc eax 10312 0000F711 A3[6C8E0100] <1> mov [u.r0], eax ; video mode + 1 10313 0000F716 09D2 <1> or edx, edx ; is LFBINFO requested by user ? 10314 <1> ;jz short sysvideo_20_4 10315 0000F718 7420 <1> jz short sysvideo_20_3 ; no 10316 <1> 10317 <1> ; 11/12/2020 10318 <1> ; Check LFBINFO table/structure 10319 <1> ; (it is set by vbe2 'vbe_biosfn_set_mode' 10320 <1> ; but if vbe3 vbios pmi is in use, 10321 <1> ; it will not set LFBINFO table) 10322 <1> 10323 0000F71A 52 <1> push edx 10324 0000F71B 48 <1> dec eax ; video mode 10325 0000F71C BE[329D0100] <1> mov esi, LFB_Info 10326 0000F721 663B06 <1> cmp ax, [esi+LFBINFO.mode] 10327 0000F724 7407 <1> je short sysvideo_20_2 10328 <1> 10329 0000F726 E8AF41FFFF <1> call _vbe_biosfn_return_mode_info 10330 <1> ;jnc short sysvideo_20_2 10331 0000F72B 723B <1> jc short sysvideo_20_4 ; edx = 0 10332 <1> 10333 <1> ;; clear LFBINFO table for invalidating 10334 <1> ;mov ecx, LFBINFO.size ; 16 10335 <1> ;mov edi, esi ; LFB_Info table address 10336 <1> ;xor eax, eax 10337 <1> ;rep stosb 10338 <1> 10339 <1> sysvideo_20_2: 10340 <1> ;pop ecx 10341 <1> ;mov edi, ecx ; user buffer 10342 0000F72D 5F <1> pop edi 10343 0000F72E B910000000 <1> mov ecx, LFBINFO.size ; 16 10344 0000F733 E8E3130000 <1> call transfer_to_user_buffer ; fast transfer 10345 0000F738 722F <1> jc short sysvideo_20_5 10346 <1> 10347 <1> ;jmp sysret 10348 <1> sysvideo_20_3: 10349 <1> ;pop eax ; [u.r0] = 0 10350 <1> ;sysvideo_20_4: 10351 0000F73A E94FD3FFFF <1> jmp sysret 10352 <1> 10353 <1> ; 23/07/2022 10354 <1> sysvideo_20: 10355 <1> ; 11/12/2020 10356 <1> ; 23/11/2020 10357 0000F73F 80FF08 <1> cmp bh, 8 10358 <1> ; 08/08/2022 10359 <1> ;jb short sysvideo_19 ; video mode & lfb info 10360 0000F742 7407 <1> je short sysvideo_20_6 10361 <1> ; 23/07/2022 10362 0000F744 7733 <1> ja short sysvideo_21 ; 12/12/2020 10363 <1> ; 08/08/2022 - jb 10364 0000F746 E967FFFFFF <1> jmp sysvideo_19 10365 <1> sysvideo_20_6: 10366 <1> ; BH = 8 10367 <1> ; Set (Super/Extended VGA) mode & return LFB info 10368 <1> 10369 <1> ; 11/12/2020 10370 0000F74B 80FBFF <1> cmp bl, 0FFh ; CGA/VGA mode ? 10371 0000F74E 739D <1> jnb short sysvideo_20_1 10372 <1> 10373 <1> ;xor ah, ah 10374 0000F750 88D8 <1> mov al, bl 10375 <1> sysvideo_20_0: 10376 0000F752 E8C31FFFFF <1> call _int10h ; uses vbe3 pmi32 option 10377 0000F757 83F8FF <1> cmp eax, 0FFFFFFFFh ; -1 10378 0000F75A 74DE <1> je short sysvideo_20_3 ; error 10379 <1> 10380 <1> ; 11/12/2020 10381 <1> ; alternative (it does not use vbe3 pmi32) 10382 <1> ;push eax 10383 <1> ;call _set_mode 10384 <1> ;pop eax 10385 <1> ;jc short sysvideo_20_3 10386 <1> 10387 <1> ;inc eax 10388 0000F75C FEC0 <1> inc al 10389 <1> ;mov [u.r0], ax ; video mode + 1 10390 0000F75E A2[6C8E0100] <1> mov [u.r0], al 10391 0000F763 E926D3FFFF <1> jmp sysret 10392 <1> 10393 <1> sysvideo_20_4: 10394 0000F768 5A <1> pop edx 10395 <1> sysvideo_20_5: 10396 0000F769 31D2 <1> xor edx, edx ; 0 10397 <1> ; edx = 0 -> invalid LFBINFO data 10398 0000F76B 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 10399 0000F771 895514 <1> mov [ebp+20], edx ; return to user with EDX value 10400 0000F774 E915D3FFFF <1> jmp sysret 10401 <1> 10402 <1> sysvideo_21: 10403 <1> ; 23/07/2022 10404 <1> ; 04/01/2021 10405 <1> ; 03/12/2020 10406 0000F779 80FF0A <1> cmp bh, 10 10407 <1> ;jb sysvideo_22 ; VESA VBE3 pmi parms 10408 <1> ; 23/07/2022 10409 0000F77C 723F <1> jb short sysvideo_21_19 10410 <1> ; 23/12/2020 10411 <1> ;je sysvideo_26 ; Video memory mapping 10412 <1> ; 23/07/2022 10413 0000F77E 7442 <1> je short sysvideo_21_20 10414 <1> 10415 <1> ; 04/01/2020 10416 0000F780 80FF0B <1> cmp bh, 11 10417 <1> ;ja sysvideo_27 10418 <1> ; 23/07/2022 10419 0000F783 7742 <1> ja short sysvideo_21_21 10420 <1> 10421 <1> ; BH = 11 10422 <1> ; set/read DAC color registers (for 8bpp) 10423 <1> 10424 0000F785 80FB04 <1> cmp bl, 4 10425 <1> ;jnb sysvideo_21_7 ; BMP file type palette 10426 <1> ; handling 10427 <1> ; 23/07/2022 10428 <1> ;jnb short sysvideo_21_7 10429 <1> ; 08/08/2022 10430 0000F788 7205 <1> jb short sysvideo_21_18 10431 0000F78A E989000000 <1> jmp sysvideo_21_7 10432 <1> sysvideo_21_18: 10433 0000F78F F6C301 <1> test bl, 1 10434 0000F792 7563 <1> jnz short sysvideo_21_4 ; set/write DAC colors 10435 <1> 10436 <1> ; Read DAC color register or all DAC color registers 10437 0000F794 F6C302 <1> test bl, 2 ; read single DAC color register 10438 0000F797 7433 <1> jz short sysvideo_21_2 ; read all DAC color regs 10439 <1> 10440 <1> ; read single DAC color register 10441 <1> ; CL = DAC color register (index) 10442 <1> 10443 0000F799 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 10444 0000F79D 88C8 <1> mov al, cl ; DAC color register 10445 0000F79F 31C9 <1> xor ecx, ecx ; (this may not be necessary) 10446 0000F7A1 EE <1> out dx, al 10447 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10448 0000F7A2 B2C9 <1> mov dl, 0C9h 10449 0000F7A4 EC <1> in al, dx 10450 0000F7A5 88C4 <1> mov ah, al ; red 10451 0000F7A7 EC <1> in al, dx 10452 0000F7A8 88C1 <1> mov cl, al ; green 10453 0000F7AA EC <1> in al, dx 10454 0000F7AB 88C5 <1> mov ch, al ; blue 10455 0000F7AD C1E108 <1> shl ecx, 8 10456 0000F7B0 88E1 <1> mov cl, ah ; red 10457 <1> ; CL = Red, CH = Green, byte 3 = Blue, byte 4 = 0 10458 <1> sysvideo_21_0: 10459 0000F7B2 890D[6C8E0100] <1> mov [u.r0], ecx 10460 <1> sysvideo_21_1: 10461 0000F7B8 E9D1D2FFFF <1> jmp sysret 10462 <1> sysvideo_21_19: 10463 <1> ; 23/07/2022 10464 0000F7BD E97A010000 <1> jmp sysvideo_22 10465 <1> sysvideo_21_20: 10466 <1> ; 23/07/2022 10467 0000F7C2 E930020000 <1> jmp sysvideo_26 10468 <1> sysvideo_21_21: 10469 <1> ; 23/07/2022 10470 0000F7C7 E9B6020000 <1> jmp sysvideo_27 10471 <1> sysvideo_21_2: 10472 <1> ; read all DAC color registers 10473 0000F7CC 89CB <1> mov ebx, ecx ; user's buffer address 10474 0000F7CE BF00600900 <1> mov edi, VBE3STACKADDR 10475 0000F7D3 89FE <1> mov esi, edi 10476 <1> ;mov ecx, 768 ; 256*3 10477 <1> ; 08/08/2022 10478 0000F7D5 29C9 <1> sub ecx, ecx 10479 0000F7D7 B503 <1> mov ch, 3 10480 <1> ; ecx = 768 = 300h 10481 <1> ;push ecx 10482 0000F7D9 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 10483 0000F7DD 28C0 <1> sub al, al ; 0 10484 0000F7DF EE <1> out dx, al 10485 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10486 0000F7E0 B2C9 <1> mov dl, 0C9h 10487 <1> sysvideo_21_3: 10488 0000F7E2 EC <1> in al, dx 10489 0000F7E3 AA <1> stosb 10490 0000F7E4 EC <1> in al, dx 10491 0000F7E5 AA <1> stosb 10492 0000F7E6 EC <1> in al, dx 10493 0000F7E7 AA <1> stosb 10494 0000F7E8 E2F8 <1> loop sysvideo_21_3 10495 <1> ;pop ecx 10496 <1> ; 18/08/2022 10497 0000F7EA B503 <1> mov ch, 3 10498 <1> ; ecx = 768 = 300h 10499 <1> 10500 0000F7EC 89DF <1> mov edi, ebx ; user's buffer address 10501 <1> ;mov esi, VBE3STACKADDR 10502 <1> ;mov ecx, 256*3 = 768 10503 0000F7EE E828130000 <1> call transfer_to_user_buffer 10504 0000F7F3 72C3 <1> jc short sysvideo_21_1 10505 <1> ;mov [u.r0], ecx ; actual transfer count 10506 0000F7F5 EBBB <1> jmp short sysvideo_21_0 10507 <1> 10508 <1> sysvideo_21_4: 10509 <1> ; Set/Write DAC color register or all registers 10510 0000F7F7 F6C302 <1> test bl, 2 ; write/set single DAC color register 10511 0000F7FA 7456 <1> jz short sysvideo_21_5 ; set all DAC color regs 10512 <1> 10513 <1> ; set single DAC color register 10514 <1> ; CL = DAC color register (index) 10515 <1> ; (byte 1 = Red, byte 2 = Green, byte 3 = Blue) 10516 <1> 10517 0000F7FC 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 10518 0000F800 89C8 <1> mov eax, ecx ; DAC color register (index) 10519 0000F802 C1E910 <1> shr ecx, 16 ; CL = green, AH = Red 10520 0000F805 EE <1> out dx, al 10521 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10522 0000F806 FEC2 <1> inc dl 10523 0000F808 88E0 <1> mov al, ah ; Red 10524 0000F80A EE <1> out dx, al 10525 0000F80B 88C8 <1> mov al, cl ; Green 10526 0000F80D EE <1> out dx, al 10527 0000F80E 88E8 <1> mov al, ch ; Blue 10528 0000F810 EE <1> out dx, al 10529 <1> ;rol ecx, 8 10530 0000F811 C1E108 <1> shl ecx, 8 ; 21/02/2021 10531 0000F814 88E1 <1> mov cl, ah ; Red 10532 <1> ; ecx = 00BBGGRRh 10533 0000F816 EB9A <1> jmp short sysvideo_21_0 10534 <1> 10535 <1> ; 23/07/2022 10536 <1> sysvideo_21_7: 10537 <1> ; BMP file type palette handling 10538 <1> 10539 0000F818 F6C301 <1> test bl, 1 10540 <1> ;jnz short sysvideo_21_12 ; set/write DAC colors 10541 <1> ; 08/08/2022 10542 0000F81B 7405 <1> jz short sysvideo_21_16 10543 0000F81D E9A3000000 <1> jmp sysvideo_21_12 10544 <1> 10545 <1> sysvideo_21_16: 10546 <1> ; Read DAC color register or all DAC color registers 10547 0000F822 F6C302 <1> test bl, 2 ; read single DAC color register 10548 0000F825 7460 <1> jz short sysvideo_21_10 ; read all DAC color regs 10549 <1> 10550 <1> ; read single DAC color register 10551 <1> ; CL = DAC color register (index) 10552 <1> 10553 0000F827 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 10554 0000F82B 88C8 <1> mov al, cl ; DAC color register 10555 0000F82D 31C9 <1> xor ecx, ecx 10556 0000F82F EE <1> out dx, al 10557 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10558 0000F830 B2C9 <1> mov dl, 0C9h 10559 0000F832 EC <1> in al, dx 10560 0000F833 C0E002 <1> shl al, 2 10561 0000F836 88C5 <1> mov ch, al ; red 10562 0000F838 EC <1> in al, dx 10563 0000F839 C0E002 <1> shl al, 2 10564 0000F83C 88C1 <1> mov cl, al ; green 10565 0000F83E EC <1> in al, dx 10566 0000F83F C0E002 <1> shl al, 2 10567 <1> ; 21/02/2021 10568 0000F842 C1E108 <1> shl ecx, 8 10569 0000F845 88C1 <1> mov cl, al ; blue 10570 <1> ; CL = Blue, CH = Green, byte 3 = Red, byte 4 = 0 10571 <1> sysvideo_21_8: 10572 0000F847 890D[6C8E0100] <1> mov [u.r0], ecx 10573 <1> sysvideo_21_9: 10574 0000F84D E93CD2FFFF <1> jmp sysret 10575 <1> 10576 <1> sysvideo_21_5: 10577 <1> ; write/set all DAC color registers 10578 0000F852 89CE <1> mov esi, ecx ; user's buffer address 10579 0000F854 BF00600900 <1> mov edi, VBE3STACKADDR 10580 0000F859 89FB <1> mov ebx, edi 10581 0000F85B B900030000 <1> mov ecx, 768 ; 256*3 10582 0000F860 E800130000 <1> call transfer_from_user_buffer 10583 <1> ;jc short sysvideo_21_1 10584 <1> ; 08/08/2022 10585 0000F865 7305 <1> jnc short sysvideo_21_17 10586 0000F867 E94CFFFFFF <1> jmp sysvideo_21_1 10587 <1> sysvideo_21_17: 10588 0000F86C 890D[6C8E0100] <1> mov [u.r0], ecx ; actual transfer count 10589 <1> 10590 0000F872 89DE <1> mov esi, ebx ; VBE3STACKADDR 10591 0000F874 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 10592 0000F878 28C0 <1> sub al, al ; 0 10593 0000F87A EE <1> out dx, al 10594 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10595 0000F87B FEC2 <1> inc dl 10596 <1> sysvideo_21_6: 10597 0000F87D AC <1> lodsb 10598 0000F87E EE <1> out dx, al 10599 0000F87F AC <1> lodsb 10600 0000F880 EE <1> out dx, al 10601 0000F881 AC <1> lodsb 10602 0000F882 EE <1> out dx, al 10603 0000F883 E2F8 <1> loop sysvideo_21_6 10604 0000F885 EBC6 <1> jmp short sysvideo_21_9 10605 <1> 10606 <1> sysvideo_21_10: 10607 <1> ; read all DAC color registers 10608 0000F887 89CD <1> mov ebp, ecx ; user's buffer address 10609 0000F889 BF00600900 <1> mov edi, VBE3STACKADDR 10610 0000F88E 89FE <1> mov esi, edi 10611 0000F890 B900040000 <1> mov ecx, 1024 ; 256*4 10612 0000F895 51 <1> push ecx 10613 0000F896 66BAC703 <1> mov dx, 3C7h ; VGAREG_DAC_READ_ADDRESS 10614 0000F89A 28C0 <1> sub al, al ; 0 10615 0000F89C EE <1> out dx, al 10616 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10617 0000F89D B2C9 <1> mov dl, 0C9h 10618 <1> sysvideo_21_11: 10619 0000F89F 31DB <1> xor ebx, ebx 10620 0000F8A1 EC <1> in al, dx ; Red 10621 0000F8A2 C0E002 <1> shl al, 2 10622 0000F8A5 88C7 <1> mov bh, al 10623 0000F8A7 EC <1> in al, dx ; Green 10624 0000F8A8 C0E002 <1> shl al, 2 10625 0000F8AB 88C3 <1> mov bl, al 10626 0000F8AD EC <1> in al, dx ; Blue 10627 0000F8AE C0E002 <1> shl al, 2 10628 0000F8B1 C1E308 <1> shl ebx, 8 10629 0000F8B4 89D8 <1> mov eax, ebx ; 00RRGGBBh 10630 0000F8B6 AB <1> stosd 10631 0000F8B7 E2E6 <1> loop sysvideo_21_11 10632 0000F8B9 59 <1> pop ecx 10633 <1> 10634 0000F8BA 89EF <1> mov edi, ebp ; user's buffer address 10635 <1> ;mov esi, VBE3STACKADDR 10636 <1> ;mov ecx, 1024 = 4*256 10637 0000F8BC E85A120000 <1> call transfer_to_user_buffer 10638 0000F8C1 728A <1> jc short sysvideo_21_9 10639 <1> ;mov [u.r0], ecx ; actual transfer count 10640 0000F8C3 EB82 <1> jmp short sysvideo_21_8 10641 <1> 10642 <1> sysvideo_21_12: 10643 <1> ; Set/Write DAC color register or all registers 10644 0000F8C5 F6C302 <1> test bl, 2 ; write/set single DAC color register 10645 0000F8C8 742A <1> jz short sysvideo_21_13 ; set all DAC color regs 10646 <1> 10647 <1> ; set single DAC color register 10648 <1> ; CL = DAC color register (index) 10649 <1> ; (byte 1 = Blue, byte 2 = Green, byte 3 = Red) 10650 <1> 10651 0000F8CA 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 10652 0000F8CE 88C8 <1> mov al, cl ; DAC color register (index) 10653 0000F8D0 88EC <1> mov ah, ch ; Blue 10654 0000F8D2 C1E910 <1> shr ecx, 16 10655 0000F8D5 EE <1> out dx, al 10656 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10657 0000F8D6 FEC2 <1> inc dl 10658 0000F8D8 88E8 <1> mov al, ch ; Red 10659 0000F8DA C0E802 <1> shr al, 2 10660 0000F8DD EE <1> out dx, al 10661 0000F8DE 88C8 <1> mov al, cl ; Green 10662 0000F8E0 C0E802 <1> shr al, 2 10663 0000F8E3 EE <1> out dx, al 10664 0000F8E4 88E0 <1> mov al, ah ; Blue 10665 0000F8E6 C0E802 <1> shr al, 2 10666 0000F8E9 EE <1> out dx, al 10667 <1> ;rol ecx, 8 10668 0000F8EA C1E108 <1> shl ecx, 8 ; 21/02/2021 10669 0000F8ED 88E1 <1> mov cl, ah 10670 0000F8EF E953FFFFFF <1> jmp sysvideo_21_8 ; 08/08/2022 10671 <1> 10672 <1> sysvideo_21_13: 10673 <1> ; write/set all DAC color registers 10674 0000F8F4 89CE <1> mov esi, ecx ; user's buffer address 10675 0000F8F6 BF00600900 <1> mov edi, VBE3STACKADDR 10676 0000F8FB 89FB <1> mov ebx, edi 10677 0000F8FD B900040000 <1> mov ecx, 1024 ; 256*4 10678 0000F902 E85E120000 <1> call transfer_from_user_buffer 10679 0000F907 722E <1> jc short sysvideo_21_15 10680 0000F909 890D[6C8E0100] <1> mov [u.r0], ecx ; actual transfer count 10681 <1> 10682 0000F90F 89DE <1> mov esi, ebx ; VBE3STACKADDR 10683 0000F911 66BAC803 <1> mov dx, 3C8h ; VGAREG_DAC_WRITE_ADDRESS 10684 0000F915 28C0 <1> sub al, al ; 0 10685 0000F917 EE <1> out dx, al 10686 <1> ;mov dx, 3C9h ; VGAREG_DAC_DATA 10687 0000F918 FEC2 <1> inc dl 10688 <1> sysvideo_21_14: 10689 0000F91A AD <1> lodsd 10690 <1> ; byte 0 = Blue, byte 1 = Green, byte 2 = Red 10691 <1> ; 21/02/2021 10692 0000F91B 89C3 <1> mov ebx, eax ; BL = Blue, BH = Green 10693 0000F91D C1CB08 <1> ror ebx, 8 ; BL = Green, BH = Red 10694 0000F920 88F8 <1> mov al, bh 10695 0000F922 C0E802 <1> shr al, 2 10696 0000F925 EE <1> out dx, al ; Red 10697 0000F926 88D8 <1> mov al, bl 10698 0000F928 C0E802 <1> shr al, 2 10699 0000F92B EE <1> out dx, al ; Green 10700 0000F92C C1C308 <1> rol ebx, 8 ; BL = Blue 10701 0000F92F 88D8 <1> mov al, bl 10702 0000F931 C0E802 <1> shr al, 2 10703 0000F934 EE <1> out dx, al ; Blue 10704 0000F935 E2E3 <1> loop sysvideo_21_14 10705 <1> sysvideo_21_15: 10706 0000F937 E952D1FFFF <1> jmp sysret 10707 <1> 10708 <1> sysvideo_22: 10709 <1> ; 28/02/2021 10710 <1> ; 22/01/2021 10711 <1> ; 17/01/2021 10712 <1> ; 04/12/2020 10713 <1> ; 03/12/2020 10714 <1> ; BH = 9 10715 <1> ; Set/Get VESA VBE3 protected mode interface params 10716 <1> 10717 <1> ; 22/01/2021 10718 <1> ;cmp byte [vbe3], 3 10719 <1> ;jne short sysvideo_25 ; not applicable if 10720 <1> ; vbe3 compatible video bios 10721 <1> ; is not detected by kernel 10722 0000F93C 80FB02 <1> cmp bl, 2 10723 <1> ;ja short sysvideo_25 ; bl > 2 not implemented 10724 <1> ; 17/01/2021 10725 0000F93F 7716 <1> ja short sysvideo_22_0 ; srvs flag sub function 10726 <1> ;jb short sysvideo_23 10727 <1> 10728 <1> ; 21/01/2021 10729 0000F941 803D[7C090000]03 <1> cmp byte [vbe3], 3 10730 <1> ;jne short sysvideo_25 ; not applicable if 10731 <1> ; vbe3 compatible video bios 10732 <1> ; is not detected by kernel 10733 0000F948 75ED <1> jne short sysvideo_21_15 ; 28/02/2021 10734 <1> 10735 0000F94A 80FB01 <1> cmp bl, 1 10736 0000F94D 7673 <1> jna short sysvideo_23 10737 <1> 10738 0000F94F 8A1D[249D0100] <1> mov bl, [pmi32] ; Video bios 32 bit PMI functions 10739 0000F955 EB78 <1> jmp short sysvideo_24 10740 <1> 10741 <1> sysvideo_22_0: 10742 <1> ; 17/01/2021 10743 <1> ; save/restore video state user permission 10744 0000F957 80FB05 <1> cmp bl, 5 10745 0000F95A 771E <1> ja short sysvideo_22_2 10746 0000F95C 7208 <1> jb short sysvideo_22_1 10747 <1> ; get srvs flag value/status 10748 0000F95E 8A1D[889D0100] <1> mov bl, [srvsf] ; 0 = disabled, 1 = enabled 10749 0000F964 EB2C <1> jmp short sysvideo_22_3 10750 <1> 10751 <1> sysvideo_22_1: 10752 <1> ; permission (root and multi tasking) check 10753 0000F966 E836000000 <1> call sysvideo_22_4 10754 0000F96B 736A <1> jnc short sysvideo_25 ; not permitted ! 10755 <1> ; cf = 1 10756 0000F96D 80EB03 <1> sub bl, 3 ; disable = 0, enable = 1 10757 <1> ; 22/01/2021 10758 0000F970 881D[889D0100] <1> mov [srvsf], bl 10759 0000F976 FEC3 <1> inc bl ; 1 = disabled, 2 = enabled 10760 0000F978 EB18 <1> jmp short sysvideo_22_3 10761 <1> 10762 <1> sysvideo_22_2: 10763 0000F97A 80FB06 <1> cmp bl, 6 10764 <1> ;ja short sysvideo_25 ; invalid/unimplemented 10765 <1> ; 28/02/2021 10766 0000F97D 7733 <1> ja short sysvideo_22_6 10767 <1> ; get VESA VBE number/status 10768 0000F97F 8A25[7C090000] <1> mov ah, [vbe3] ; vbe3 = 3, vbe2 = 2, others = 0 10769 0000F985 A0[7D090000] <1> mov al, [vbe2bios] ; bochs/qemu/vbox emulator status 10770 0000F98A 66A3[6C8E0100] <1> mov [u.r0], ax 10771 0000F990 EB45 <1> jmp short sysvideo_25 10772 <1> 10773 <1> sysvideo_22_3: 10774 <1> ; 22/01/2021 10775 0000F992 8A3D[899D0100] <1> mov bh, [srvso] ; state options (> 80h -> svga) 10776 0000F998 66891D[6C8E0100] <1> mov [u.r0], bx ; function result is return value 10777 0000F99F EB36 <1> jmp short sysvideo_25 10778 <1> 10779 <1> sysvideo_22_4: 10780 <1> ; 17/01/2021 - permission will be given by root only 10781 0000F9A1 803D[46830100]00 <1> cmp byte [multi_tasking], 0 ; in single user mode 10782 0000F9A8 7707 <1> ja short sysvideo_22_5 10783 <1> ; 19/01/2021 10784 0000F9AA 803D[BE8E0100]01 <1> cmp byte [u.uid], 1 ; ([u.uid] = 0 -> root) 10785 <1> sysvideo_22_5: 10786 <1> ; [multi_tasking] = 0 & [u.uid] = 0 -> CF = 1 10787 <1> ; otherwise -> CF = 0 10788 0000F9B1 C3 <1> retn 10789 <1> 10790 <1> sysvideo_22_6: 10791 <1> ; 28/02/2021 10792 0000F9B2 80FB09 <1> cmp bl, 9 10793 0000F9B5 7720 <1> ja short sysvideo_25 ; invalid/unimplemented 10794 0000F9B7 7436 <1> je short sysvideo_22_9 10795 0000F9B9 80FB08 <1> cmp bl, 8 10796 0000F9BC 721E <1> jb short sysvideo_22_7 10797 <1> 10798 <1> ; BL = 8 10799 <1> ; Set default true color bpp to 24 10800 <1> 10801 0000F9BE B318 <1> mov bl, 24 10802 <1> ;mov [truecolor], al ; 24bpp (RRGGBBh) 10803 <1> ;mov [u.r0], al 10804 <1> ;jmp short sysvideo_25 10805 0000F9C0 EB25 <1> jmp short sysvideo_22_8 10806 <1> 10807 <1> sysvideo_23: 10808 <1> ; 17/01/2021 10809 <1> ; permission (root and multi tasking) check 10810 0000F9C2 E8DAFFFFFF <1> call sysvideo_22_4 10811 0000F9C7 730E <1> jnc short sysvideo_25 ; not permitted ! 10812 <1> 10813 0000F9C9 881D[249D0100] <1> mov [pmi32], bl ; 1 = enabled, 0 = disabled 10814 <1> sysvideo_24: 10815 0000F9CF FEC3 <1> inc bl 10816 <1> sysvideo_22_10: ; 28/02/2021 10817 0000F9D1 881D[6C8E0100] <1> mov [u.r0], bl ; function result is return value 10818 <1> sysvideo_25: 10819 0000F9D7 E9B2D0FFFF <1> jmp sysret 10820 <1> 10821 <1> sysvideo_22_7: 10822 <1> ; BL = 7 10823 <1> ; Set default true color bpp to 32 10824 <1> ; (it will set if [VBE3]=3) 10825 <1> 10826 <1> ; Note: This sub function is used to set 24bpp 10827 <1> ; VESA VBE video modes to 32bpp.. because, 10828 <1> ; old hardware uses 24 bpp but new video hardware 10829 <1> ; uses 32bpp for same VESA VBE truecolor modes. 10830 <1> ; (For example: VBE mode 112h is 640*480, 24bpp but 10831 <1> ; new hardware uses/apply it as 640*480, 32bpp.) 10832 <1> ; So, TRDOS 386 v2.0.3 kernel will check [truecolor] 10833 <1> ; status is 32 bpp or not and it will change 24bpp 10834 <1> ; to 32bpp if default [truecolor] value is 32, for 10835 <1> ; same video mode number. 10836 <1> 10837 0000F9DC 803D[7C090000]03 <1> cmp byte [vbe3], 3 10838 0000F9E3 75F2 <1> jne short sysvideo_25 ; Only applicable 10839 <1> ; for VBE3 video hardware! 10840 0000F9E5 B320 <1> mov bl, 32 10841 <1> sysvideo_22_8: 10842 0000F9E7 881D[73730100] <1> mov [truecolor], bl ; 32bpp (00RRGGBBh) 10843 <1> ;mov [u.r0], bl 10844 <1> ;jmp short sysvideo_25 10845 0000F9ED EBE2 <1> jmp short sysvideo_22_10 10846 <1> 10847 <1> sysvideo_22_9: 10848 <1> ; BL = 9 10849 <1> ; Return default true color bpp 10850 0000F9EF 8A1D[73730100] <1> mov bl, [truecolor] 10851 0000F9F5 EBDA <1> jmp short sysvideo_22_10 10852 <1> ;sysvideo_22_10: 10853 <1> ;mov [u.r0], bl 10854 <1> ;jmp sysret 10855 <1> 10856 <1> sysvideo_26: 10857 <1> ; 23/12/2020 10858 <1> ; BH = 10 10859 <1> ; Map video memory to user's buffer 10860 <1> ; (multiuser/owner r/w permisions are ignored 10861 <1> ; for current TRDOS 386 version !) 10862 <1> 10863 0000F9F7 6681E100F0 <1> and cx, ~4095 ; clear low 12 bits 10864 0000F9FC 09C9 <1> or ecx, ecx ; start address of user's buffer 10865 0000F9FE 74D7 <1> jz short sysvideo_25 ; error ! 10866 <1> 10867 0000FA00 80FB01 <1> cmp bl, 1 ; VGA memory mapping ? 10868 0000FA03 740E <1> je short sysvideo_26_1 10869 0000FA05 7718 <1> ja short sysvideo_26_2 10870 <1> sysvideo_26_0: 10871 <1> ; BL = 0 : CGA memory (0B8000h) map (32K) 10872 0000FA07 B800800B00 <1> mov eax, 0B8000h 10873 0000FA0C BB00800000 <1> mov ebx, 32768 10874 0000FA11 EB37 <1> jmp short sysvideo_26_3 10875 <1> sysvideo_26_1: 10876 <1> ; BL = 1 : VGA memory (0A0000h) map (64K) 10877 0000FA13 B800000A00 <1> mov eax, 0A0000h 10878 0000FA18 BB00000100 <1> mov ebx, 65536 10879 0000FA1D EB2B <1> jmp short sysvideo_26_3 10880 <1> sysvideo_26_2: 10881 <1> ; BL = 2 : SVGA memory (LFB) map to user's buffer 10882 0000FA1F 803D[7C090000]02 <1> cmp byte [vbe3], 2 ; VESA VBE 2/3 vbios ready ? 10883 0000FA26 72AF <1> jb short sysvideo_25 ; no, error ! 10884 0000FA28 6681E200F0 <1> and dx, ~4095 ; clear low 12 bits 10885 0000FA2D 09D2 <1> or edx, edx ; buffer size in bytes 10886 0000FA2F 74A6 <1> jz short sysvideo_25 ; error 10887 0000FA31 89D3 <1> mov ebx, edx 10888 0000FA33 A1[349D0100] <1> mov eax, [LFB_ADDR] ; [LFB_Info+LFBINFO.LFB_addr] 10889 0000FA38 21C0 <1> and eax, eax 10890 0000FA3A 7425 <1> jz short sysvideo_26_5 10891 <1> ; (LFB parms are not set yet) 10892 0000FA3C 3B1D[389D0100] <1> cmp ebx, [LFB_SIZE] ; [LFB_Info+LFBINFO.LFB_size] 10893 0000FA42 7606 <1> jna short sysvideo_26_3 10894 0000FA44 8B1D[389D0100] <1> mov ebx, [LFB_SIZE] 10895 <1> sysvideo_26_3: 10896 0000FA4A 52 <1> push edx 10897 0000FA4B 53 <1> push ebx ; buffer size in bytes 10898 0000FA4C 51 <1> push ecx ; user's buffer address 10899 0000FA4D 87D9 <1> xchg ebx, ecx 10900 0000FA4F C1E90C <1> shr ecx, 12 ; convert buffer size to page count 10901 0000FA52 E87865FFFF <1> call direct_memory_access 10902 0000FA57 59 <1> pop ecx ; user's buffer address 10903 0000FA58 5B <1> pop ebx ; buffer size 10904 0000FA59 5A <1> pop edx 10905 <1> ;jc short sysvideo_25 ; error ! 10906 <1> ; [u.r0] = 0 10907 <1> ; 28/02/2021 10908 0000FA5A 7235 <1> jc short sysvideo_27_0 ; error ! 10909 <1> 10910 <1> ;sysvideo_26_4: 10911 <1> ;mov ebp, [u.usp] ; ebp points to user's registers 10912 <1> ;mov [ebp+20], edx ; return to user with EDX value 10913 <1> ;mov [ebp+16], ebx ; EBX 10914 <1> ;mov [ebp+24], ecx ; ECX 10915 <1> ; eax = physical address of video memory (LFB) 10916 <1> ;mov [u.r0], eax 10917 <1> ;jmp sysret 10918 0000FA5C E92CFCFFFF <1> jmp sysvideo_26_4 10919 <1> 10920 <1> sysvideo_26_5: 10921 0000FA61 66A1[100F0000] <1> mov ax, [def_LFB_addr] ; default LFB for mode 118h 10922 <1> ; ah must be 0C0h or 0D0h or E0h 10923 <1> ; others are nonsence !? 10924 0000FA67 08E4 <1> or ah, ah 10925 <1> ;jz short sysvideo_25 ; invalid lfb addr or 10926 <1> ; it is not a vbe2 -bochs emu- 10927 <1> ; or vbe3 -real- video bios 10928 <1> ; 28/02/2021 10929 0000FA69 7426 <1> jz short sysvideo_27_0 ; invalid LFB address 10930 <1> 10931 0000FA6B 80FCF0 <1> cmp ah, 0F0h 10932 <1> ;jnb short sysvideo_25 ; nonsence !? 10933 <1> ; 28/02/2021 10934 0000FA6E 7321 <1> jnb short sysvideo_27_0 ; nonsence !? 10935 <1> 10936 0000FA70 C1E010 <1> shl eax, 16 10937 <1> ;jz short sysvideo_25 ; eax = 0 10938 <1> 10939 0000FA73 81FB00907E00 <1> cmp ebx, 1920*1080*4 ; maximum value of possible 10940 <1> ; buffer sizes 10941 0000FA79 76CF <1> jna short sysvideo_26_3 ; buffer size is proper 10942 <1> ; resize buffer to fit 4GB limit 10943 0000FA7B BB00907E00 <1> mov ebx, 1920*1080*4 10944 0000FA80 EBC8 <1> jmp short sysvideo_26_3 10945 <1> 10946 <1> sysvideo_27: 10947 <1> ; 23/07/2022 10948 <1> ; 16/02/2021 10949 <1> ; 18/01/2021 10950 0000FA82 80FF0C <1> cmp bh, 12 10951 <1> ;ja sysvideo_28 ; 19/01/2021 10952 <1> ; 23/07/2022 10953 0000FA85 7605 <1> jna short sysvideo_27_24 10954 0000FA87 E970010000 <1> jmp sysvideo_28 10955 <1> 10956 <1> sysvideo_27_24: ; 23/07/2022 10957 <1> ; BH = 12 10958 <1> ; Font sub functions. 10959 <1> ; 12/02/2021 10960 <1> ; 11/01/2021 10961 <1> ; 10/01/2021 10962 <1> ; BL = 0 : Disable system font overwrite 10963 <1> ; BL = 1 : Enable system font overwrite 10964 <1> ; BL = 2 : Read system font 8x8 10965 <1> ; BL = 3 : Read system font 8x14 10966 <1> ; BL = 4 : Read system font 8x16 10967 <1> ; BL = 5 : Read user defined font 8x8 10968 <1> ; BL = 6 : Read user defined font 8x16 10969 <1> ; BL = 7 : Write system font 8x8 10970 <1> ; BL = 8 : Write system font 8x14 10971 <1> ; BL = 9 : Write system font 8x16 10972 <1> ; BL = 10 : Write user defined font 8x8 10973 <1> ; BL = 11 : Write user defined font 8x16 10974 <1> ; 10975 <1> ; BL > 11 : invalid (not implemented) 10976 <1> ; 10977 <1> ; For BL = 1 to 11 10978 <1> ; ECX = number of characters (<= 256) 10979 <1> ; EDX = first character (ascii code in DL) 10980 <1> ; ESI = user's buffer address 10981 <1> ; 10982 <1> ; Return: EAX = character count 10983 <1> 10984 0000FA8C 80FB0B <1> cmp bl, 11 10985 0000FA8F 7605 <1> jna short sysvideo_27_1 10986 <1> sysvideo_27_0: 10987 0000FA91 E9F8CFFFFF <1> jmp sysret ; not implemented yet ! 10988 <1> sysvideo_27_1: 10989 0000FA96 66B80001 <1> mov ax, 256 10990 0000FA9A 08DB <1> or bl, bl 10991 0000FA9C 750E <1> jnz short sysvideo_27_3 10992 <1> 10993 <1> ; bl = 0 10994 <1> ; disable system font overwrite 10995 <1> 10996 0000FA9E 8025[869D0100]7F <1> and byte [ufont], 7Fh ; clear bit 7 10997 <1> sysvideo_27_2: 10998 <1> ;mov word [u.r0], 256 ; > 0 -> successful 10999 0000FAA5 A3[6C8E0100] <1> mov [u.r0], eax ; 256 11000 0000FAAA EBE5 <1> jmp short sysvideo_27_0 11001 <1> sysvideo_27_3: 11002 0000FAAC 80FB01 <1> cmp bl, 1 11003 0000FAAF 7710 <1> ja short sysvideo_27_4 11004 <1> 11005 <1> ; bl = 1 11006 <1> ; enable system font overwrite 11007 <1> ; if [multi_tasking]= 0 and [u.uid] = 0 11008 <1> 11009 <1> ;cmp byte [multi_tasking], 0 11010 <1> ; ; multi tasking enabled ? 11011 <1> ;ja short sysvideo_27_0 ; yes 11012 <1> ;; 19/01/2021 11013 <1> ;; system maintenance or single user mode 11014 <1> ;cmp byte [u.uid], 0 ; root ? 11015 <1> ;ja short sysvideo_27_0 ; no 11016 <1> 11017 <1> ; 19/01/2021 11018 <1> ; multi tasking & root check 11019 0000FAB1 E8EBFEFFFF <1> call sysvideo_22_4 11020 0000FAB6 73D9 <1> jnc short sysvideo_27_0 ; not permitted 11021 <1> 11022 <1> ; [multi_tasking]= 0 and [u.uid] = 0 11023 <1> 11024 0000FAB8 800D[869D0100]80 <1> or byte [ufont], 80h ; set bit 7 11025 <1> 11026 0000FABF EBE4 <1> jmp short sysvideo_27_2 11027 <1> 11028 <1> sysvideo_27_4: 11029 0000FAC1 09C9 <1> or ecx, ecx 11030 0000FAC3 74CC <1> jz short sysvideo_27_0 11031 0000FAC5 21D2 <1> and edx, edx 11032 0000FAC7 7410 <1> jz short sysvideo_27_4_0 11033 <1> ;mov ax, 256 11034 0000FAC9 39C1 <1> cmp ecx, eax ; 256 11035 0000FACB 77C4 <1> ja short sysvideo_27_0 11036 0000FACD 48 <1> dec eax 11037 0000FACE 39C2 <1> cmp edx, eax ; 255 11038 0000FAD0 77BF <1> ja short sysvideo_27_0 11039 0000FAD2 40 <1> inc eax 11040 0000FAD3 29D0 <1> sub eax, edx ; 256 - DX 11041 0000FAD5 39C8 <1> cmp eax, ecx 11042 0000FAD7 72B8 <1> jb short sysvideo_27_0 11043 <1> 11044 <1> sysvideo_27_4_0: 11045 0000FAD9 89F5 <1> mov ebp, esi 11046 <1> 11047 0000FADB 80FB06 <1> cmp bl, 6 11048 0000FADE 7768 <1> ja short sysvideo_27_13 11049 0000FAE0 7210 <1> jb short sysvideo_27_5 11050 <1> ; bl = 6 11051 0000FAE2 F605[869D0100]10 <1> test byte [ufont], 16 ; 8x16 user font loaded ? 11052 0000FAE9 74A6 <1> jz short sysvideo_27_0 11053 <1> ; read 8x16 user defined font 11054 0000FAEB BE00400900 <1> mov esi, VGAFONT16USER 11055 0000FAF0 EB0C <1> jmp short sysvideo_27_6 11056 <1> sysvideo_27_5: 11057 0000FAF2 80FB04 <1> cmp bl, 4 11058 0000FAF5 7239 <1> jb short sysvideo_27_11 11059 0000FAF7 7721 <1> ja short sysvideo_27_9 11060 <1> ; bl = 4 11061 <1> ; read 8x16 system font 11062 0000FAF9 BE[40630100] <1> mov esi, vgafont16 11063 <1> sysvideo_27_6: 11064 <1> ; read 8x16 font 11065 <1> ;shl dx, 4 ; * 16 11066 <1> ;shl cx, 4 ; * 16 ; 16 bytes per char 11067 <1> ; 23/07/2022 11068 0000FAFE C1E204 <1> shl edx, 4 ; * 16 11069 0000FB01 C1E104 <1> shl ecx, 4 ; * 16 11070 <1> sysvideo_27_7: 11071 0000FB04 89EF <1> mov edi, ebp 11072 <1> ;add edi, edx ; 16/02/2021 11073 0000FB06 01D6 <1> add esi, edx 11074 <1> ; ecx = byte count 11075 <1> ; esi = source (in system memory) 11076 <1> ; edi = destination (in user memory) 11077 0000FB08 E80E100000 <1> call transfer_to_user_buffer 11078 0000FB0D 7206 <1> jc short sysvideo_27_8 11079 0000FB0F 890D[6C8E0100] <1> mov [u.r0], ecx 11080 <1> sysvideo_27_8: 11081 0000FB15 E974CFFFFF <1> jmp sysret 11082 <1> sysvideo_27_9: 11083 <1> ; bl = 5 11084 0000FB1A F605[869D0100]08 <1> test byte [ufont], 8 ; 8x8 user font loaded ? 11085 0000FB21 74F2 <1> jz short sysvideo_27_8 11086 <1> ; read 8x8 user defined font 11087 0000FB23 BE00500900 <1> mov esi, VGAFONT8USER 11088 <1> sysvideo_27_10: 11089 <1> ; read 8x8 font 11090 <1> ;shl dx, 3 ; * 8 11091 <1> ;shl cx, 3 ; * 8 ; 8 bytes per char 11092 <1> ; 23/07/2022 11093 0000FB28 C1E203 <1> shl edx, 3 ; * 8 11094 0000FB2B C1E103 <1> shl ecx, 3 ; * 8 11095 0000FB2E EBD4 <1> jmp short sysvideo_27_7 11096 <1> 11097 <1> sysvideo_27_11: 11098 0000FB30 80FB03 <1> cmp bl, 3 ; 8x14 system font 11099 0000FB33 720C <1> jb short sysvideo_27_12 ; 8x8 system font 11100 <1> ; bl = 3 11101 <1> ; read 8x14 system font 11102 <1> ;mov al, 14 11103 <1> ;mul dl 11104 <1> ;mov dx, ax 11105 <1> ;push edx 11106 <1> ;mov ax, 14 11107 <1> ;mul cx 11108 <1> ;mov cx, ax 11109 <1> ;pop edx 11110 0000FB35 E8A5000000 <1> call sysvideo_27_14 11111 0000FB3A BE[40550100] <1> mov esi, vgafont14 11112 0000FB3F EBC3 <1> jmp short sysvideo_27_7 11113 <1> 11114 <1> sysvideo_27_12: 11115 <1> ; bl = 2 11116 <1> ; read 8x8 system font 11117 0000FB41 BE[404D0100] <1> mov esi, vgafont8 11118 0000FB46 EBE0 <1> jmp short sysvideo_27_10 11119 <1> 11120 <1> sysvideo_27_13: 11121 <1> ; overwrite font 11122 0000FB48 80FB0A <1> cmp bl, 10 11123 0000FB4B 776E <1> ja short sysvideo_27_22 ; 8x16 user font 11124 0000FB4D 7224 <1> jb short sysvideo_27_15 11125 <1> ; bl = 10 11126 0000FB4F BF00500900 <1> mov edi, VGAFONT8USER 11127 0000FB54 F605[869D0100]08 <1> test byte [ufont], 8 ; 8x8 user font loaded ? 11128 0000FB5B 7556 <1> jnz short sysvideo_27_21 ; yes 11129 0000FB5D 08ED <1> or ch, ch ; cx = 256 11130 <1> ;jnz short sysvideo_27_21 ; 256 chars 11131 0000FB5F 7406 <1> jz short sysvideo_27_13_0 11132 0000FB61 66B90008 <1> mov cx, 8*256 11133 0000FB65 EB35 <1> jmp short sysvideo_27_18_0 11134 <1> sysvideo_27_13_0: 11135 <1> ; copy system font to user font before overwrite 11136 0000FB67 BE[404D0100] <1> mov esi, vgafont8 11137 <1> ;push edi 11138 <1> ;push ecx 11139 <1> ;mov cl, 64 11140 <1> ;rep movsd 11141 <1> ;pop ecx 11142 <1> ;pop edi 11143 <1> ;mov esi, ebp ; user's font buffer 11144 0000FB6C E880000000 <1> call sysvideo_27_23 11145 0000FB71 EB40 <1> jmp short sysvideo_27_21 11146 <1> 11147 <1> sysvideo_27_15: 11148 <1> ; check system font overwrite permission 11149 0000FB73 F605[869D0100]80 <1> test byte [ufont], 80h 11150 0000FB7A 7499 <1> jz short sysvideo_27_8 11151 <1> 11152 0000FB7C 80FB08 <1> cmp bl, 8 11153 0000FB7F 773A <1> ja short sysvideo_27_22 ; 8x16 system font 11154 0000FB81 722B <1> jb short sysvideo_27_20 ; 8x8 system font 11155 <1> ; bl = 8 11156 <1> ; overwrite 8x14 system font 11157 <1> ;mov al, 14 11158 <1> ;mul dl 11159 <1> ;mov dx, ax 11160 <1> ;push edx 11161 <1> ;mov ax, 14 11162 <1> ;mul cx 11163 <1> ;mov cx, ax 11164 <1> ;pop edx 11165 0000FB83 E857000000 <1> call sysvideo_27_14 11166 0000FB88 BF[40550100] <1> mov edi, vgafont14 11167 0000FB8D EB0B <1> jmp short sysvideo_27_18 11168 <1> sysvideo_27_16: 11169 <1> ; bl = 9 11170 <1> ; overwrite 8x16 system font 11171 0000FB8F BF[40630100] <1> mov edi, vgafont16 11172 <1> sysvideo_27_17: 11173 <1> ; overwrite 8x16 font 11174 <1> ;shl dx, 4 ; * 16 11175 <1> ;shl cx, 4 ; * 16 ; 16 bytes per char 11176 <1> ; 23/07/2022 11177 0000FB94 C1E204 <1> shl edx, 4 ; * 16 11178 0000FB97 C1E104 <1> shl ecx, 4 ; * 16 11179 <1> sysvideo_27_18: 11180 0000FB9A 01D7 <1> add edi, edx 11181 <1> ;add esi, edx ; 16/02/2021 11182 <1> sysvideo_27_18_0: 11183 <1> ; ecx = byte count 11184 <1> ; esi = source (in user memory) 11185 <1> ; edi = destination (in system memory) 11186 0000FB9C E8C40F0000 <1> call transfer_from_user_buffer 11187 0000FBA1 7206 <1> jc short sysvideo_27_19 11188 0000FBA3 890D[6C8E0100] <1> mov [u.r0], ecx 11189 <1> sysvideo_27_19: 11190 0000FBA9 E9E0CEFFFF <1> jmp sysret 11191 <1> sysvideo_27_20: 11192 <1> ; bl = 7 11193 <1> ; overwrite 8x8 system font 11194 0000FBAE BF[404D0100] <1> mov edi, vgafont8 11195 <1> sysvideo_27_21: 11196 <1> ; overwrite 8x8 font 11197 <1> ;shl dx, 3 ; * 8 11198 <1> ;shl cx, 3 ; * 8 ; 8 bytes per char 11199 <1> ; 23/07/2022 11200 0000FBB3 C1E203 <1> shl edx, 3 ; * 8 11201 0000FBB6 C1E103 <1> shl ecx, 3 ; * 8 11202 0000FBB9 EBDF <1> jmp short sysvideo_27_18 11203 <1> sysvideo_27_22: 11204 <1> ; bl = 11 11205 <1> ; overwrite 8x16 user defined font 11206 0000FBBB BF00400900 <1> mov edi, VGAFONT16USER 11207 0000FBC0 F605[869D0100]10 <1> test byte [ufont], 16 ; 8x16 user font loaded ? 11208 0000FBC7 75CB <1> jnz short sysvideo_27_17 ; yes 11209 0000FBC9 08ED <1> or ch, ch ; cx = 256 11210 <1> ;jnz short sysvideo_27_17 ; 256 chars 11211 0000FBCB 7406 <1> jz short sysvideo_27_22_0 11212 0000FBCD 66B90010 <1> mov cx, 16*256 11213 0000FBD1 EBC9 <1> jmp short sysvideo_27_18_0 11214 <1> sysvideo_27_22_0: 11215 <1> ; copy system font to user font before overwrite 11216 0000FBD3 BE[40630100] <1> mov esi, vgafont16 11217 <1> ;push edi 11218 <1> ;push ecx 11219 <1> ;mov cl, 64 11220 <1> ;rep movsd 11221 <1> ;pop ecx 11222 <1> ;pop edi 11223 <1> ;mov esi, ebp ; user's font buffer 11224 0000FBD8 E814000000 <1> call sysvideo_27_23 11225 0000FBDD EBB5 <1> jmp short sysvideo_27_17 11226 <1> 11227 <1> sysvideo_27_14: 11228 <1> ; 16/02/2021 11229 0000FBDF 52 <1> push edx 11230 0000FBE0 66B80E00 <1> mov ax, 14 11231 0000FBE4 66F7E1 <1> mul cx 11232 0000FBE7 89C1 <1> mov ecx, eax 11233 0000FBE9 5A <1> pop edx 11234 0000FBEA B00E <1> mov al, 14 11235 0000FBEC F6E2 <1> mul dl 11236 0000FBEE 89C2 <1> mov edx, eax 11237 0000FBF0 C3 <1> retn 11238 <1> 11239 <1> ;mov al, 14 11240 <1> ;mul dl 11241 <1> ;mov dx, ax 11242 <1> ;push edx 11243 <1> ;; 12/02/2021 11244 <1> ;mov ax, 14 11245 <1> ;;mov eax, 14 11246 <1> ;;mul cx 11247 <1> ;mul ecx 11248 <1> ;;mov cx, ax 11249 <1> ;mov ecx, eax 11250 <1> ;pop edx 11251 <1> ;retn 11252 <1> 11253 <1> sysvideo_27_23: 11254 0000FBF1 57 <1> push edi 11255 0000FBF2 51 <1> push ecx 11256 0000FBF3 B140 <1> mov cl, 64 11257 0000FBF5 F3A5 <1> rep movsd 11258 0000FBF7 59 <1> pop ecx 11259 0000FBF8 5F <1> pop edi 11260 0000FBF9 89EE <1> mov esi, ebp ; user's font buffer 11261 0000FBFB C3 <1> retn 11262 <1> 11263 <1> sysvideo_28: 11264 <1> ; 23/07/2022 11265 <1> ; 24/01/2021 11266 <1> ; 23/01/2021 11267 <1> ; 18/01/2021 11268 0000FBFC 80FF0E <1> cmp bh, 14 11269 <1> ;jb sysvideo_29 11270 <1> ; 23/07/2022 11271 0000FBFF 7222 <1> jb short sysvideo_28_29 11272 <1> ;ja sysvideo_30 11273 <1> ; 23/07/2022 11274 0000FC01 7725 <1> ja short sysvideo_28_30 11275 <1> 11276 <1> ; BH = 14 11277 <1> ; Save/Restore Super VGA video state 11278 <1> 11279 <1> ; BL = options 11280 <1> ; bit 0 - Save (0) or Restore (1) 11281 <1> ; bit 1 - controller hardware state 11282 <1> ; bit 2 - BIOS data state 11283 <1> ; bit 3 - DAC state 11284 <1> ; bit 4 - (extended) Register state 11285 <1> ; bit 5 - system (0) or user (1) memory 11286 <1> ; bit 6 - verify without transfer 11287 <1> ; bit 7 - not used (must be 0) 11288 <1> 11289 <1> ; ECX = Buffer address or VideoStateID 11290 <1> 11291 0000FC03 803D[7C090000]02 <1> cmp byte [vbe3], 2 ; VESA VBE2 or VBE3 ? 11292 0000FC0A 7721 <1> ja short sysvideo_28_0 ; yes 11293 0000FC0C 7210 <1> jb short sysvideo_28_16 ; not a SVGA sys ! 11294 <1> 11295 <1> ; == VBE2 == 11296 <1> ; Check Bochs/Qemu/VirtualBox PC emulator 11297 <1> ; (vbe2 is usable only for emulator's vbios) 11298 0000FC0E 8A25[7D090000] <1> mov ah, [vbe2bios] 11299 0000FC14 80FCC0 <1> cmp ah, 0C0h 11300 0000FC17 7205 <1> jb short sysvideo_28_16 ; unknown vbios ! 11301 0000FC19 80FCC5 <1> cmp ah, 0C5h 11302 0000FC1C 760F <1> jna short sysvideo_28_0 11303 <1> ; Use kernel's vbios functions (video.s) 11304 <1> sysvideo_28_16: 11305 <1> ; unknown vbios ! 11306 0000FC1E E96BCEFFFF <1> jmp sysret 11307 <1> 11308 <1> sysvideo_28_29: 11309 <1> ; 23/07/2022 11310 0000FC23 E955010000 <1> jmp sysvideo_29 11311 <1> sysvideo_28_30: 11312 <1> ; 23/07/2022 11313 0000FC28 E935020000 <1> jmp sysvideo_30 11314 <1> 11315 <1> sysvideo_28_0: 11316 0000FC2D 80FB7F <1> cmp bl, 7Fh 11317 0000FC30 77EC <1> ja short sysvideo_28_16 ; unknown options 11318 <1> 11319 0000FC32 88DA <1> mov dl, bl 11320 0000FC34 80E21F <1> and dl, 1Fh 11321 0000FC37 D0EA <1> shr dl, 1 11322 0000FC39 74E3 <1> jz short sysvideo_28_16 ; invalid ! 11323 <1> ; DL = VBE Function 4F04h Save/Restore options 11324 <1> ; bit 0 : controller hardware state 11325 <1> ; bit 1 : BIOS data state 11326 <1> ; bit 2 : DAC state 11327 <1> ; bit 3 : (extended) Register state 11328 <1> 11329 0000FC3B F6C320 <1> test bl, 32 ; bit 5 11330 <1> ;jnz sysvideo_28_7 ; user buffer 11331 <1> ; 23/07/2022 11332 0000FC3E 7405 <1> jz short sysvideo_28_17 11333 0000FC40 E9B1000000 <1> jmp sysvideo_28_7 11334 <1> 11335 <1> sysvideo_28_17: ; 23/07/2022 11336 <1> ; source or destination is kernel/system buffer 11337 <1> 11338 0000FC45 803D[889D0100]00 <1> cmp byte [srvsf], 0 ; srs permission flag 11339 0000FC4C 76D0 <1> jna short sysvideo_28_16 ; not permitted 11340 <1> 11341 0000FC4E F6C301 <1> test bl, 1 11342 0000FC51 743A <1> jz short sysvideo_28_4 ; Save 11343 <1> 11344 <1> ; Restore 11345 0000FC53 3B0D[8A9D0100] <1> cmp ecx, [VideoStateID] 11346 0000FC59 75C3 <1> jne short sysvideo_28_16 ; not correct ID ! 11347 <1> 11348 0000FC5B 0FB6CA <1> movzx ecx, dl 11349 0000FC5E 80CA80 <1> or dl, 80h 11350 0000FC61 3A15[899D0100] <1> cmp dl, [srvso] 11351 0000FC67 75B5 <1> jne short sysvideo_28_16 ; not correct ! 11352 <1> 11353 0000FC69 88DA <1> mov dl, bl 11354 <1> 11355 <1> ; ecx = cl = options 11356 0000FC6B E80B3FFFFF <1> call vbe_srs_gbs 11357 <1> ; ebx = state buffer size (data size) 11358 <1> 11359 0000FC70 891D[6C8E0100] <1> mov [u.r0], ebx 11360 <1> 11361 0000FC76 F6C240 <1> test dl, 64 ; verify without transfer 11362 0000FC79 75A3 <1> jnz short sysvideo_28_16 ; yes 11363 <1> 11364 0000FC7B BE00580900 <1> mov esi, VBE3VIDEOSTATE 11365 0000FC80 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 11366 0000FC85 87CB <1> xchg ecx, ebx 11367 0000FC87 F3A4 <1> rep movsb 11368 <1> 11369 0000FC89 88D9 <1> mov cl, bl 11370 <1> 11371 <1> ; 23/01/2021 11372 0000FC8B EB44 <1> jmp short sysvideo_28_10 11373 <1> 11374 <1> sysvideo_28_4: 11375 0000FC8D 53 <1> push ebx 11376 <1> ; 24/01/2021 11377 0000FC8E 31DB <1> xor ebx, ebx ; 0 ; use kernel's buffer 11378 0000FC90 881D[899D0100] <1> mov [srvso], bl ; 0 ; invalidate 11379 0000FC96 891D[8A9D0100] <1> mov [VideoStateID], ebx ; 0 ; invalidate 11380 0000FC9C 0FB6CA <1> movzx ecx, dl ; options 11381 0000FC9F B201 <1> mov dl, 1 ; save state 11382 0000FCA1 E890000000 <1> call sysvideo_28_11 ; 23/01/2021 11383 <1> ; Note: VBE3 BIOS data save option will be 11384 <1> ; disabled.. ; 24/01/2021 11385 0000FCA6 89CA <1> mov edx, ecx ; state (save) options 11386 0000FCA8 5B <1> pop ebx 11387 <1> 11388 0000FCA9 6683F84F <1> cmp ax, 4Fh ; successful ? 11389 0000FCAD 7536 <1> jne short sysvideo_28_3 ; no ! 11390 <1> 11391 0000FCAF F6C340 <1> test bl, 64 ; verify without transfer 11392 0000FCB2 7536 <1> jnz short sysvideo_28_6 ; yes 11393 <1> 11394 <1> ; ecx = cl = options 11395 0000FCB4 E8C23EFFFF <1> call vbe_srs_gbs 11396 <1> ; ebx = state buffer size (data size) 11397 <1> 11398 0000FCB9 BE00760900 <1> mov esi, VBE3SAVERESTOREBLOCK 11399 0000FCBE BF00580900 <1> mov edi, VBE3VIDEOSTATE 11400 0000FCC3 89D9 <1> mov ecx, ebx 11401 0000FCC5 F3A4 <1> rep movsb 11402 <1> 11403 0000FCC7 88D1 <1> mov cl, dl 11404 0000FCC9 80C980 <1> or cl, 80h ; SVGA (VESA VBE) flag 11405 <1> ;mov [srvso], dl 11406 <1> 11407 0000FCCC E908010000 <1> jmp sysvideo_28_15 11408 <1> 11409 <1> ; 23/01/2021 11410 <1> sysvideo_28_10: 11411 <1> ; CL = VESA VBE3 Save/Restore options 11412 <1> 11413 0000FCD1 B202 <1> mov dl, 2 ; restore state 11414 <1> 11415 0000FCD3 E85C000000 <1> call sysvideo_28_1 11416 <1> 11417 0000FCD8 6683F84F <1> cmp ax, 4Fh ; successful ? 11418 0000FCDC 7407 <1> je short sysvideo_28_3 11419 <1> ;jmp short sysvideo_28_9 11420 <1> 11421 <1> sysvideo_28_9: 11422 <1> ; return zero size (error) to user 11423 0000FCDE 29C0 <1> sub eax, eax 11424 <1> sysvideo_28_5: 11425 0000FCE0 A3[6C8E0100] <1> mov [u.r0], eax 11426 <1> sysvideo_28_3: 11427 0000FCE5 E9A4CDFFFF <1> jmp sysret 11428 <1> 11429 <1> sysvideo_28_6: 11430 <1> ; use timer ticks as VideoStateID 11431 0000FCEA A1[30770100] <1> mov eax, [TIMER_LH] 11432 0000FCEF 09C0 <1> or eax, eax 11433 0000FCF1 75ED <1> jnz short sysvideo_28_5 11434 0000FCF3 40 <1> inc eax 11435 0000FCF4 EBEA <1> jmp short sysvideo_28_5 11436 <1> 11437 <1> sysvideo_28_7: 11438 <1> ; save/restore to/from user buffer 11439 <1> 11440 <1> ; 23/01/2021 11441 0000FCF6 89CE <1> mov esi, ecx ; user's vstate buffer 11442 0000FCF8 BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 11443 <1> 11444 0000FCFD 0FB6CA <1> movzx ecx, dl ; VESA VBE func 4F04h options 11445 <1> 11446 <1> ; source or destination is user buffer 11447 0000FD00 F6C301 <1> test bl, 1 11448 0000FD03 7444 <1> jz short sysvideo_28_12 ; Save 11449 <1> 11450 <1> ; Restore 11451 0000FD05 803D[889D0100]00 <1> cmp byte [srvsf], 0 ; srs permission flag 11452 0000FD0C 766A <1> jna short sysvideo_28_14 ; not permitted 11453 <1> 11454 0000FD0E 88DA <1> mov dl, bl ; 'sysvideo' options 11455 <1> 11456 <1> ; ecx = cl = options 11457 0000FD10 E8663EFFFF <1> call vbe_srs_gbs 11458 <1> ; ebx = state buffer size (data size) 11459 <1> 11460 0000FD15 891D[6C8E0100] <1> mov [u.r0], ebx ; transfer count 11461 <1> 11462 0000FD1B F6C240 <1> test dl, 64 ; verify without transfer 11463 0000FD1E 7558 <1> jnz short sysvideo_28_14 ; yes 11464 <1> 11465 0000FD20 6681FB0008 <1> cmp bx, 2048 11466 0000FD25 73B7 <1> jnb short sysvideo_28_9 ; invalid 11467 <1> 11468 0000FD27 87CB <1> xchg ecx, ebx 11469 <1> ; esi = user buffer 11470 <1> ; edi = VBE3SAVERESTOREBLOCK 11471 <1> 11472 0000FD29 E8370E0000 <1> call transfer_from_user_buffer 11473 0000FD2E 72AE <1> jc short sysvideo_28_9 ; error 11474 <1> 11475 0000FD30 89D9 <1> mov ecx, ebx ; Function 4F04h options 11476 0000FD32 EB9D <1> jmp short sysvideo_28_10 ; 23/01/2021 11477 <1> 11478 <1> sysvideo_28_1: 11479 0000FD34 31DB <1> xor ebx, ebx ; 0 ; use kernel's buffer 11480 <1> sysvideo_28_11: 11481 <1> ; 24/01/2021 11482 0000FD36 803D[7C090000]03 <1> cmp byte [vbe3], 3 11483 0000FD3D 7405 <1> je short sysvideo_28_2 11484 <1> 11485 <1> ; VESA VBE2 (BOCHS/QEMU/VBOX) video bios 11486 0000FD3F E9A03DFFFF <1> jmp _vbe_biosfn_save_restore_state 11487 <1> sysvideo_28_2: 11488 <1> ;24/01/2021 11489 <1> ;mov eax, 4F04h ; Save/Restore vstate 11490 <1> ; VESA VBE3 video bios 11491 0000FD44 E9051DFFFF <1> jmp _vbe3_pmfn_save_restore_state 11492 <1> 11493 <1> sysvideo_28_12: 11494 <1> ; Save 11495 <1> ;mov edi, VBE3SAVERESTOREBLOCK 11496 <1> 11497 <1> ;movzx ecx, dl ; options 11498 0000FD49 56 <1> push esi 11499 0000FD4A 53 <1> push ebx 11500 <1> ; 23/01/2021 11501 0000FD4B B201 <1> mov dl, 1 ; save state 11502 0000FD4D E8E2FFFFFF <1> call sysvideo_28_1 11503 0000FD52 5A <1> pop edx ; 'sysvideo' options 11504 0000FD53 5F <1> pop edi ; user's video state buffer 11505 <1> 11506 0000FD54 6683F84F <1> cmp ax, 4Fh ; successful ? 11507 0000FD58 751E <1> jne short sysvideo_28_14 ; no ! 11508 <1> 11509 <1> ; ecx = cl = options 11510 0000FD5A E81C3EFFFF <1> call vbe_srs_gbs 11511 <1> ; ebx = state buffer size (data size) 11512 <1> 11513 0000FD5F 89D9 <1> mov ecx, ebx ; transfer count 11514 <1> 11515 0000FD61 F6C240 <1> test dl, 64 ; verify without transfer 11516 0000FD64 750C <1> jnz short sysvideo_28_13 ; yes 11517 <1> 11518 <1> ;mov edi, esi 11519 0000FD66 BE00760900 <1> mov esi, VBE3SAVERESTOREBLOCK 11520 0000FD6B E8AB0D0000 <1> call transfer_to_user_buffer 11521 0000FD70 7206 <1> jc short sysvideo_28_14 11522 <1> sysvideo_28_13: 11523 0000FD72 890D[6C8E0100] <1> mov [u.r0], ecx 11524 <1> sysvideo_28_14: 11525 0000FD78 E911CDFFFF <1> jmp sysret 11526 <1> 11527 <1> sysvideo_29: 11528 <1> ; 18/01/2021 11529 <1> ; BH = 13 11530 <1> ; Save/Restore std VGA video state 11531 <1> 11532 <1> ; bl = 0..3 11533 <1> ; save to or restore from 11534 <1> ; system buffer, VBE3VIDEOSTATE 11535 <1> ; ECX = VideoStateID for restoring 11536 <1> ; bl = 4..7 11537 <1> ; save to or restore from 11538 <1> ; user buffer pointed by ECX 11539 <1> 11540 0000FD7D 80FB03 <1> cmp bl, 3 11541 0000FD80 7776 <1> ja short sysvideo_29_6 11542 <1> 11543 <1> ; source or destination is kernel/system buffer 11544 <1> 11545 0000FD82 803D[889D0100]00 <1> cmp byte [srvsf], 0 ; srs permission flag 11546 0000FD89 7668 <1> jna short sysvideo_29_5 ; not permitted 11547 <1> 11548 0000FD8B F6C301 <1> test bl, 1 11549 0000FD8E 7437 <1> jz short sysvideo_29_2 ; Save 11550 <1> 11551 <1> ; Restore 11552 0000FD90 3B0D[8A9D0100] <1> cmp ecx, [VideoStateID] 11553 0000FD96 755B <1> jne short sysvideo_29_5 ; not correct ID ! 11554 0000FD98 80FB01 <1> cmp bl, 1 11555 0000FD9B 7709 <1> ja short sysvideo_29_0 11556 <1> ; bl = 1 11557 0000FD9D BB6E000000 <1> mov ebx, 110 11558 0000FDA2 B103 <1> mov cl, 3 ; ctrl, vbios data 11559 0000FDA4 EB07 <1> jmp short sysvideo_29_1 11560 <1> sysvideo_29_0: 11561 <1> ; bl = 3 11562 0000FDA6 BB72030000 <1> mov ebx, 882 11563 0000FDAB B107 <1> mov cl, 7 ; ctrl, vbios data, dac 11564 <1> sysvideo_29_1: 11565 0000FDAD 3A0D[899D0100] <1> cmp cl, [srvso] 11566 0000FDB3 753E <1> jne short sysvideo_29_5 ; not correct ! 11567 <1> 11568 0000FDB5 BE00580900 <1> mov esi, VBE3VIDEOSTATE ; 22/01/2021 11569 0000FDBA E8503FFFFF <1> call biosfn_restore_video_state 11570 0000FDBF 891D[6C8E0100] <1> mov [u.r0], ebx ; video state size (bytes) 11571 <1> ;jmp sysret 11572 0000FDC5 EB2C <1> jmp short sysvideo_29_5 11573 <1> sysvideo_29_2: 11574 <1> ;mov esi, ecx 11575 0000FDC7 BF00580900 <1> mov edi, VBE3VIDEOSTATE 11576 <1> 11577 0000FDCC B107 <1> mov cl, 7 ; ctrl, vbios data, dac 11578 0000FDCE 08DB <1> or bl, bl 11579 0000FDD0 7502 <1> jnz short sysvideo_29_3 ; bl = 2 11580 <1> ; bl = 0 11581 0000FDD2 B103 <1> mov cl, 3 ; ctrl, vbios data 11582 <1> sysvideo_29_3: 11583 0000FDD4 E8CE3DFFFF <1> call biosfn_save_video_state 11584 <1> sysvideo_28_15: 11585 <1> ; use timer ticks as VideoStateID 11586 0000FDD9 A1[30770100] <1> mov eax, [TIMER_LH] 11587 0000FDDE 21C0 <1> and eax, eax 11588 0000FDE0 7501 <1> jnz short sysvideo_29_4 11589 0000FDE2 40 <1> inc eax 11590 <1> sysvideo_29_4: 11591 0000FDE3 880D[899D0100] <1> mov [srvso], cl 11592 0000FDE9 A3[8A9D0100] <1> mov [VideoStateID], eax 11593 0000FDEE A3[6C8E0100] <1> mov [u.r0], eax 11594 <1> sysvideo_29_5: 11595 0000FDF3 E996CCFFFF <1> jmp sysret 11596 <1> 11597 <1> sysvideo_29_6: 11598 0000FDF8 80FB07 <1> cmp bl, 7 11599 0000FDFB 77F6 <1> ja short sysvideo_29_5 ; invalid sub function 11600 <1> 11601 0000FDFD 89CE <1> mov esi, ecx 11602 0000FDFF BF00760900 <1> mov edi, VBE3SAVERESTOREBLOCK 11603 <1> 11604 <1> ; source or destination is user buffer 11605 0000FE04 F6C301 <1> test bl, 1 11606 0000FE07 7434 <1> jz short sysvideo_29_9 ; Save 11607 <1> 11608 <1> ; Restore 11609 0000FE09 803D[889D0100]00 <1> cmp byte [srvsf], 0 ; srs permission flag 11610 0000FE10 76E1 <1> jna short sysvideo_29_5 ; not permitted 11611 <1> 11612 <1> ;mov esi, ecx 11613 <1> ;mov edi, VBE3SAVERESTOREBLOCK 11614 <1> 11615 0000FE12 80FB07 <1> cmp bl, 7 11616 0000FE15 7409 <1> je short sysvideo_29_7 11617 <1> ; bl = 5 11618 0000FE17 B303 <1> mov bl, 3 11619 0000FE19 B96E000000 <1> mov ecx, 110 11620 0000FE1E EB05 <1> jmp short sysvideo_29_8 11621 <1> sysvideo_29_7: 11622 <1> ; bl = 7 11623 0000FE20 B972030000 <1> mov ecx, 882 11624 <1> sysvideo_29_8: 11625 0000FE25 E83B0D0000 <1> call transfer_from_user_buffer 11626 0000FE2A 72C7 <1> jc short sysvideo_29_5 11627 0000FE2C 890D[6C8E0100] <1> mov [u.r0], ecx 11628 0000FE32 88D9 <1> mov cl, bl ; mov cl,7 (mov cl,3) 11629 0000FE34 89FE <1> mov esi, edi ; VBE3SAVERESTOREBLOCK 11630 <1> ; cl = 3 or 7 11631 0000FE36 E8D43EFFFF <1> call biosfn_restore_video_state 11632 0000FE3B EBB6 <1> jmp sysvideo_29_5 11633 <1> ;jmp sysret 11634 <1> sysvideo_29_9: 11635 <1> ; Save 11636 <1> ;mov edi, VBE3SAVERESTOREBLOCK 11637 <1> 11638 0000FE3D 80FB06 <1> cmp bl, 6 11639 0000FE40 7409 <1> je short sysvideo_29_10 11640 <1> ; bl = 4 11641 0000FE42 BB6E000000 <1> mov ebx, 110 11642 0000FE47 B103 <1> mov cl, 3 ; ctrl, vbios data 11643 0000FE49 EB07 <1> jmp short sysvideo_29_11 11644 <1> sysvideo_29_10: 11645 <1> ; bl = 6 11646 0000FE4B BB72030000 <1> mov ebx, 882 11647 0000FE50 B107 <1> mov cl, 7 ; ctrl, vbios data, dac 11648 <1> sysvideo_29_11: 11649 0000FE52 E8503DFFFF <1> call biosfn_save_video_state 11650 <1> 11651 0000FE57 89D9 <1> mov ecx, ebx ; transfer count 11652 0000FE59 89F7 <1> mov edi, esi 11653 0000FE5B BE00760900 <1> mov esi, VBE3SAVERESTOREBLOCK 11654 <1> 11655 <1> ;call transfer_to_user_buffer 11656 <1> ;jc short sysvideo_29_5 11657 <1> ;mov [u.r0], ecx ; transfer count 11658 <1> ;;jmp sysret 11659 <1> ;jmp short sysvideo_29_5 11660 <1> 11661 0000FE60 EB1A <1> jmp short sysvideo_29_12 11662 <1> 11663 <1> sysvideo_30: 11664 0000FE62 80FF0F <1> cmp bh, 15 11665 0000FE65 7722 <1> ja short sysvideo_31 ; invalid function 11666 <1> 11667 <1> ; BH = 15 11668 <1> ; Copy VESA EDID to user's buffer 11669 <1> 11670 0000FE67 803D[1D420000]4F <1> cmp byte [edid], 4Fh 11671 0000FE6E 7519 <1> jne short sysvideo_31 ; not ready ! 11672 <1> 11673 <1> ;and ecx, ecx 11674 <1> ;jz short sysvideo_31 11675 <1> 11676 <1> ; ecx = user's buffer address 11677 0000FE70 89CF <1> mov edi, ecx 11678 0000FE72 BE[A49C0100] <1> mov esi, edid_info 11679 0000FE77 B980000000 <1> mov ecx, 128 ; 128 bytes 11680 <1> sysvideo_29_12: 11681 0000FE7C E89A0C0000 <1> call transfer_to_user_buffer 11682 0000FE81 7206 <1> jc short sysvideo_31 11683 <1> 11684 0000FE83 890D[6C8E0100] <1> mov [u.r0], ecx ; EDID size, 128 bytes 11685 <1> sysvideo_31: 11686 0000FE89 E900CCFFFF <1> jmp sysret 11687 <1> 11688 <1> sysexec: 11689 <1> ; 07/07/2025 - TRDOS 386 v2.0.10 11690 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 11691 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 11692 <1> ; 06/02/2022 - Retro UNIX 386 v1.2 11693 <1> ; 18/11/2017 11694 <1> ; 14/11/2017 11695 <1> ; 13/11/2017 11696 <1> ; 24/10/2016 - 04/01/2017 11697 <1> ; 24/04/2016 - TRDOS 386 (TRDOS v2.0) 11698 <1> ; 23/06/2015 - 23/10/2015 (Retro UNIX 386 v1) 11699 <1> ; 03/06/2013 - 06/12/2013 (Retro UNIX 8086 v1) 11700 <1> ; 11701 <1> ; 'sysexec' initiates execution of a file whose path name if 11702 <1> ; pointed to by 'name' in the sysexec call. 11703 <1> ; 'sysexec' performs the following operations: 11704 <1> ; 1. obtains i-number of file to be executed via 'namei'. 11705 <1> ; 2. obtains i-node of file to be exceuted via 'iget'. 11706 <1> ; 3. sets trap vectors to system routines. 11707 <1> ; 4. loads arguments to be passed to executing file into 11708 <1> ; highest locations of user's core 11709 <1> ; 5. puts pointers to arguments in locations immediately 11710 <1> ; following arguments. 11711 <1> ; 6. saves number of arguments in next location. 11712 <1> ; 7. initializes user's stack area so that all registers 11713 <1> ; will be zeroed and the PS is cleared and the PC set 11714 <1> ; to core when 'sysret' restores registers 11715 <1> ; and does an rti. 11716 <1> ; 8. initializes u.r0 and u.sp 11717 <1> ; 9. zeros user's core down to u.r0 11718 <1> ; 10. reads executable file from storage device into core 11719 <1> ; starting at location 'core'. 11720 <1> ; 11. sets u.break to point to end of user's code with 11721 <1> ; data area appended. 11722 <1> ; 12. calls 'sysret' which returns control at location 11723 <1> ; 'core' via 'rti' instruction. 11724 <1> ; 11725 <1> ; Calling sequence: 11726 <1> ; sysexec; namep; argp 11727 <1> ; Arguments: 11728 <1> ; namep - points to pathname of file to be executed 11729 <1> ; argp - address of table of argument pointers 11730 <1> ; argp1... argpn - table of argument pointers 11731 <1> ; argp1:<...0> ... argpn:<...0> - argument strings 11732 <1> ; Inputs: (arguments) 11733 <1> ; Outputs: - 11734 <1> ; ............................................................... 11735 <1> ; 11736 <1> ; Retro UNIX 386 v1 modification: 11737 <1> ; User application runs in it's own virtual space 11738 <1> ; which is izolated from kernel memory (and other 11739 <1> ; memory pages) via 80386 paging in ring 3 11740 <1> ; privilige mode. Virtual start address is always 0. 11741 <1> ; User's core memory starts at linear address 400000h 11742 <1> ; (the end of the 1st 4MB). 11743 <1> ; 11744 <1> ; Retro UNIX 8086 v1 modification: 11745 <1> ; user/application segment and system/kernel segment 11746 <1> ; are different and sysenter/sysret/sysrele routines 11747 <1> ; are different (user's registers are saved to 11748 <1> ; and then restored from system's stack.) 11749 <1> ; 11750 <1> ; NOTE: Retro UNIX 8086 v1 'arg2' routine gets these 11751 <1> ; arguments which were in these registers; 11752 <1> ; but, it returns by putting the 1st argument 11753 <1> ; in 'u.namep' and the 2nd argument 11754 <1> ; on top of stack. (1st argument is offset of the 11755 <1> ; file/path name in the user's program segment.) 11756 <1> 11757 <1> ;call arg2 11758 <1> ; * name - 'u.namep' points to address of file/path name 11759 <1> ; in the user's program segment ('u.segmnt') 11760 <1> ; with offset in BX register (as sysopen argument 1). 11761 <1> ; * argp - sysexec argument 2 is in CX register 11762 <1> ; which is on top of stack. 11763 <1> ; 11764 <1> ; jsr r0,arg2 / arg0 in u.namep,arg1 on top of stack 11765 <1> 11766 <1> ; 23/06/2015 (32 bit modifications) 11767 <1> 11768 <1> ;; 13/11/2017 11769 <1> ;;mov [u.namep], ebx ; argument 1 11770 <1> ; 18/10/2015 11771 0000FE8E 890D[6C8F0100] <1> mov [argv], ecx ; * ; argument 2 11772 <1> 11773 <1> ; 13/11/2017 11774 0000FE94 89DE <1> mov esi, ebx 11775 0000FE96 E83A1E0000 <1> call set_working_path_x 11776 0000FE9B 7319 <1> jnc short sysexec_0 11777 <1> 11778 <1> ;; 'bad command or file name' 11779 <1> ;mov eax, ERR_BAD_CMD_ARG ; 01h ; TRDOS 8086 11780 <1> 11781 <1> ; 'file not found !' error 11782 0000FE9D B802000000 <1> mov eax, ERR_NOT_FOUND ; 02h ; TRDOS 8086 11783 <1> sysexec_not_found_err: 11784 <1> sysexec_access_error: 11785 <1> sysexec_ext_error: 11786 0000FEA2 A3[6C8E0100] <1> mov [u.r0], eax 11787 0000FEA7 A3[D88E0100] <1> mov [u.error], eax 11788 0000FEAC E8F91E0000 <1> call reset_working_path 11789 0000FEB1 E9B8CBFFFF <1> jmp error 11790 <1> 11791 <1> sysexec_0: 11792 <1> ; 13/11/2017 11793 <1> ;mov esi, FindFile_Name 11794 0000FEB6 66B80018 <1> mov ax, 1800h ; Only files 11795 0000FEBA E8BB8AFFFF <1> call find_first_file 11796 0000FEBF 72E1 <1> jc short sysexec_not_found_err ; eax = 2 11797 <1> 11798 <1> ; check_ file attributes 11799 <1> ; (attribute bits = 00ADVSHR) ; 18h = Directory+Volume 11800 <1> ; BL = Attributes byte 11801 <1> 11802 0000FEC1 F6C306 <1> test bl, 6 ; system file or hidden file (S+H) 11803 <1> ;jz short sysexec_0ext 11804 0000FEC4 7417 <1> jz short sysexec_1 ; yes 11805 <1> 11806 <1> ; 13/11/2017 11807 <1> ; /// TRDOS386 permission check for multiuser mode /// 11808 <1> ; SYSTEM file or HIDDEN file !! 11809 <1> ; (Only super user has permission to run this file.) 11810 <1> 11811 <1> ; ([u.uid]=0 for super user or root in multiuser mode) 11812 <1> ; ([u.uid]=0 for any users in singleuser mode) 11813 0000FEC6 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; Super User ([u.uid]=0) ? 11814 <1> ;jna short sysexec_0ext 11815 0000FECD 760E <1> jna short sysexec_1 ; yes 11816 <1> 11817 <1> ; 'permission denied !' error 11818 0000FECF B80B000000 <1> mov eax, ERR_FILE_ACCESS ; 11 = ERR_PERM_DENIED 11819 0000FED4 EBCC <1> jmp short sysexec_access_error 11820 <1> 11821 <1> sysexec_not_exf: 11822 <1> ; 'not executable file !' error 11823 0000FED6 B816000000 <1> mov eax, ERR_NOT_EXECUTABLE 11824 0000FEDB EBC5 <1> jmp sysexec_ext_error 11825 <1> 11826 <1> ;sysexec_0ext: 11827 <1> sysexec_1: 11828 <1> ; 18/11/2017 11829 0000FEDD BE[58800100] <1> mov esi, FindFile_Name 11830 <1> ; 13/11/2017 11831 <1> ; check program file name extension 11832 <1> ; ('.PRG' for current TRDOS version) 11833 0000FEE2 E8F9A3FFFF <1> call check_prg_filename_ext 11834 0000FEE7 72ED <1> jc short sysexec_not_exf 11835 <1> 11836 <1> ; 18/11/2017 11837 0000FEE9 3C50 <1> cmp al, 'P' 11838 0000FEEB 75E9 <1> jne short sysexec_not_exf 11839 <1> 11840 <1> ; '.PRG' extension is OK. 11841 <1> ; Only '.PRG' files are valid program files 11842 <1> ; for current TRDOS 386 version. 11843 <1> 11844 0000FEED 8B15[84800100] <1> mov edx, [FindFile_DirEntry+DirEntry_FileSize] 11845 0000FEF3 66A1[7C800100] <1> mov ax, [FindFile_DirEntry+DirEntry_FstClusHI] 11846 0000FEF9 C1E010 <1> shl eax, 16 11847 0000FEFC 66A1[82800100] <1> mov ax, [FindFile_DirEntry+DirEntry_FstClusLO] 11848 <1> ; EAX = First Cluster number 11849 <1> ; EDX = File Size 11850 <1> 11851 0000FF02 A3[748F0100] <1> mov [ii], eax 11852 0000FF07 8915[788F0100] <1> mov [i.size], edx 11853 <1> 11854 <1> ;sysexec_1: 11855 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 11856 <1> ; 06/02/2022 - Retro UNIX 386 v1.2 11857 <1> ; 13/11/2017 - TRDOS 386 (TRDOS v2.0) 11858 <1> ; 24/06/2015 - 23/10/2015 (Retro UNIX 386 v1) 11859 <1> ; Moving arguments to the end of [u.upage] 11860 <1> ; (by regarding page borders in user's memory space) 11861 <1> ; 11862 <1> ; 10/10/2015 11863 <1> ; 21/07/2015 11864 <1> ;mov ebp, esp ; (**) 11865 <1> ; 18/10/2015 11866 <1> ;mov edi, ebp 11867 <1> ; 23/07/2022 11868 0000FF0D 89E7 <1> mov edi, esp ; (**) 11869 0000FF0F B900010000 <1> mov ecx, MAX_ARG_LEN ; 256 11870 <1> ;sub edi, MAX_ARG_LEN ; 256 11871 0000FF14 29CF <1> sub edi, ecx 11872 0000FF16 89FC <1> mov esp, edi ; *!* 11873 0000FF18 31C0 <1> xor eax, eax 11874 0000FF1A A3[988E0100] <1> mov [u.nread], eax ; 0 11875 <1> ; ([argc] must be cleared because previous 'sysexec' 11876 <1> ; may leave it with any value after an error)) 11877 <1> ;mov [argc], ax ; 0 ; 13/11/2017 11878 <1> ; 23/07/2022 11879 0000FF1F A3[688F0100] <1> mov [argc], eax ; 0 11880 0000FF24 49 <1> dec ecx ; 256 - 1 11881 0000FF25 890D[948E0100] <1> mov [u.count], ecx ; MAX_ARG_LEN - 1 ; 255 11882 <1> ;mov dword [u.count], MAX_ARG_LEN - 1 ; 255 11883 <1> sysexec_2: 11884 0000FF2B 8B35[6C8F0100] <1> mov esi, [argv] ; 18/10/2015 11885 0000FF31 E86E020000 <1> call get_argp 11886 <1> ;mov ecx, 4 11887 <1> ; 23/07/2022 11888 0000FF36 31C9 <1> xor ecx, ecx 11889 0000FF38 B104 <1> mov cl, 4 11890 <1> sysexec_3: 11891 0000FF3A 21C0 <1> and eax, eax 11892 0000FF3C 7453 <1> jz short sysexec_6 ; 23/07/2022 11893 <1> ; 18/10/2015 11894 0000FF3E 010D[6C8F0100] <1> add [argv], ecx ; 4 11895 <1> ;;inc word [argc] 11896 <1> ; 23/07/2022 11897 <1> ;inc dword [argc] 11898 0000FF44 FE05[688F0100] <1> inc byte [argc] 11899 <1> ; 11900 0000FF4A A3[908E0100] <1> mov [u.base], eax 11901 <1> ; 23/10/2015 11902 0000FF4F 66C705[D08E0100]00- <1> mov word [u.pcount], 0 11902 0000FF57 00 <1> 11903 <1> sysexec_4: 11904 0000FF58 E85F0B0000 <1> call cpass ; get a character from user's core memory 11905 0000FF5D 750B <1> jnz short sysexec_5 11906 <1> ; (max. 255 chars + null) 11907 <1> ; 18/10/2015 11908 0000FF5F 28C0 <1> sub al, al 11909 0000FF61 AA <1> stosb 11910 0000FF62 FF05[988E0100] <1> inc dword [u.nread] 11911 <1> ; 23/07/2022 11912 0000FF68 EB27 <1> jmp short sysexec_6 ; 24/04/2016 11913 <1> sysexec_5: 11914 0000FF6A AA <1> stosb 11915 0000FF6B 20C0 <1> and al, al 11916 0000FF6D 75E9 <1> jnz short sysexec_4 11917 <1> ;mov ecx, 4 11918 <1> ; 23/07/2022 11919 0000FF6F 31C9 <1> xor ecx, ecx 11920 0000FF71 B104 <1> mov cl, 4 11921 0000FF73 390D[648F0100] <1> cmp [ncount], ecx ; 4 11922 0000FF79 72B0 <1> jb short sysexec_2 11923 0000FF7B 8B35[608F0100] <1> mov esi, [nbase] 11924 0000FF81 010D[608F0100] <1> add [nbase], ecx ; 4 11925 <1> ;sub [ncount], cx 11926 <1> ; 23/07/2022 11927 0000FF87 290D[648F0100] <1> sub [ncount], ecx 11928 0000FF8D 8B06 <1> mov eax, [esi] 11929 0000FF8F EBA9 <1> jmp short sysexec_3 11930 <1> 11931 <1> sysexec_6: 11932 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 11933 <1> ; 19/11/2017 11934 <1> ; 18/11/2017 11935 <1> ; 14/11/2017 11936 <1> ; 13/11/2017 11937 0000FF91 8925[6C8F0100] <1> mov [argv], esp ; *!* ; start address of argument list 11938 <1> 11939 <1> ; 04/01/2017 11940 <1> ; 24/10/2016 11941 <1> ;;02/05/2016 11942 <1> ; 23/04/2016 (TRDOS 386) 11943 <1> ; 18/10/2015 ('sysexec_6') 11944 <1> ; 23/06/2015 11945 0000FF97 A1[C48E0100] <1> mov eax, [u.pgdir] ; physical address of page directory 11946 <1> ;cmp eax, [k_page_dir] ; TRDOS MainProg ? 11947 <1> ;je short sysexec_7 11948 <1> ; 19/11/2017 11949 0000FF9C 8B1D[C88E0100] <1> mov ebx, [u.ppgdir] ; phy addr of the parent's page dir 11950 0000FFA2 E8B359FFFF <1> call deallocate_page_dir 11951 <1> sysexec_7: 11952 0000FFA7 E8E358FFFF <1> call make_page_dir 11953 <1> ;jc panic ; allocation error 11954 <1> ; ; after a deallocation would be nonsence !? 11955 <1> ; 23/07/2022 11956 0000FFAC 7243 <1> jc short sysexec_panic 11957 <1> 11958 <1> ; 24/07/2015 11959 <1> ; map kernel pages (1st 4MB) to PDE 0 11960 <1> ; of the user's page directory 11961 <1> ; (It is needed for interrupts!) 11962 <1> ; 18/10/2015 11963 0000FFAE 8B15[B0760100] <1> mov edx, [k_page_dir] ; Kernel's page directory 11964 0000FFB4 8B02 <1> mov eax, [edx] ; physical address of 11965 <1> ; kernel's first page table (1st 4 MB) 11966 <1> ; (PDE 0 of kernel's page directory) 11967 0000FFB6 8B15[C48E0100] <1> mov edx, [u.pgdir] 11968 0000FFBC 8902 <1> mov [edx], eax ; PDE 0 (1st 4MB) 11969 <1> ; 11970 <1> ; 20/07/2015 11971 0000FFBE BB00004000 <1> mov ebx, CORE ; start address = 0 (virtual) + CORE 11972 <1> ; 18/10/2015 11973 0000FFC3 BE[588F0100] <1> mov esi, pcore ; physical start address 11974 <1> sysexec_8: 11975 0000FFC8 B907000000 <1> mov ecx, PDE_A_USER + PDE_A_WRITE + PDE_A_PRESENT 11976 0000FFCD E8DB58FFFF <1> call make_page_table 11977 <1> ;jc panic 11978 <1> ; 23/07/2022 11979 0000FFD2 721D <1> jc short sysexec_panic 11980 <1> ; 11981 <1> ;mov ecx, PTE_A_USER + PTE_A_WRITE + PTE_A_PRESENT 11982 0000FFD4 E8E258FFFF <1> call make_page ; make new page, clear and set the pte 11983 <1> ;jc panic 11984 <1> ; 23/07/2022 11985 0000FFD9 7216 <1> jc short sysexec_panic 11986 <1> ; 11987 0000FFDB 8906 <1> mov [esi], eax ; 24/06/2015 11988 <1> ; ebx = virtual address (24/07/2015) 11989 <1> ; 23/07/2022 11990 <1> ;call add_to_swap_queue 11991 <1> ; 18/10/2015 11992 0000FFDD 81FE[5C8F0100] <1> cmp esi, ecore ; user's stack (last) page ? 11993 0000FFE3 7411 <1> je short sysexec_9 ; yes 11994 0000FFE5 BE[5C8F0100] <1> mov esi, ecore ; physical address of the last page 11995 <1> ; 20/07/2015 11996 0000FFEA BB00F0FFFF <1> mov ebx, (ECORE - PAGE_SIZE) + CORE 11997 <1> ; ebx = virtual end address + segment base address - 4K 11998 0000FFEF EBD7 <1> jmp short sysexec_8 11999 <1> sysexec_panic: 12000 <1> ; 23/07/2022 12001 0000FFF1 E9236EFFFF <1> jmp panic 12002 <1> 12003 <1> sysexec_9: 12004 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 12005 <1> ; 19/11/2017 12006 <1> ; 24/04/2016 (TRDOS 386 = TRDOS v2.0) 12007 <1> ; 25/06/2015 - 26/08/2015 - 18/10/2015 12008 <1> ; move arguments from kernel stack to [ecore] 12009 <1> ; (argument list/line will be copied from kernel stack 12010 <1> ; frame to the last (stack) page of user's core memory) 12011 <1> ; 18/10/2015 12012 0000FFF6 8B3D[5C8F0100] <1> mov edi, [ecore] 12013 0000FFFC 81C700100000 <1> add edi, PAGE_SIZE 12014 <1> ; 19/11/2017 12015 <1> ;sub edi, 4 12016 <1> ;mov dword [edi], 0 12017 <1> ;mov ebx, edi 12018 <1> ; 12019 <1> ;movzx eax, word [argc] 12020 <1> ;or eax, eax 12021 <1> ;jz short sysexec_13 ; 19/11/2017 12022 <1> ;;jnz short sysexec_10 12023 <1> ;;mov ebx, edi 12024 <1> ;;sub ebx, 4 12025 <1> ;;mov [ebx], eax ; 0 12026 <1> ;;jmp short sysexec_13 12027 <1> ; 23/07/2022 12028 <1> ; [argc] < 32 12029 00010002 A1[688F0100] <1> mov eax, [argc] 12030 00010007 09C0 <1> or eax, eax 12031 00010009 7509 <1> jnz short sysexec_10 12032 0001000B 89FB <1> mov ebx, edi 12033 0001000D 83EB04 <1> sub ebx, 4 12034 00010010 8903 <1> mov [ebx], eax ; 0 12035 00010012 EB47 <1> jmp short sysexec_13 12036 <1> 12037 <1> sysexec_10: 12038 00010014 8B0D[988E0100] <1> mov ecx, [u.nread] 12039 <1> ; 13/11/2017 12040 <1> ;;mov esi, TextBuffer ; 'load_and_execute_file' 12041 <1> ;mov esi, esp ; 'sysexec' 12042 0001001A 8B35[6C8F0100] <1> mov esi, [argv] ; 24/04/2016 (TRDOS 386 = TRDOS v2.0) 12043 <1> ; 23/07/2022 12044 00010020 29CF <1> sub edi, ecx ; page end address - argument list length 12045 <1> ;sub ebx, ecx ; 19/11/2017 12046 <1> 12047 <1> ;;;; 12048 <1> ; 23/07/2022 12049 <1> ; (move edi -backward- to dword boundary) 12050 <1> ; ((this will prevent 'general protection fault' error 12051 <1> ; as result of a lodsd or dword move instruction 12052 <1> ; at the end of argument list)) 12053 00010022 83EF03 <1> sub edi, 3 12054 00010025 83E7FC <1> and edi, ~3 ; (*) 12055 <1> ;;; 12056 <1> 12057 00010028 89C2 <1> mov edx, eax 12058 0001002A FEC2 <1> inc dl ; argument count + 1 for argc value 12059 0001002C C0E202 <1> shl dl, 2 ; 4 * (argument count + 1) 12060 <1> ; edx <= 128 12061 0001002F 89FB <1> mov ebx, edi 12062 <1> ;mov edi, ebx ; 19//11/2017 12063 <1> ; 23/07/2022 (*) - edi is already dword aligned - 12064 <1> ;and bl, 0FCh ; 32 bit (dword) alignment 12065 00010031 29D3 <1> sub ebx, edx 12066 00010033 89FA <1> mov edx, edi 12067 00010035 F3A4 <1> rep movsb 12068 00010037 89D6 <1> mov esi, edx 12069 00010039 89DF <1> mov edi, ebx 12070 0001003B BA00F0BFFF <1> mov edx, ECORE - PAGE_SIZE ; virtual addr. of the last page 12071 00010040 2B15[5C8F0100] <1> sub edx, [ecore] ; difference (virtual - physical) 12072 00010046 AB <1> stosd ; eax = argument count 12073 <1> sysexec_11: 12074 00010047 89F0 <1> mov eax, esi 12075 00010049 01D0 <1> add eax, edx 12076 0001004B AB <1> stosd ; eax = virtual address 12077 <1> ; 23/07/2022 12078 0001004C FE0D[688F0100] <1> dec byte [argc] 12079 <1> ;dec dword [argc] 12080 <1> ;;dec word [argc] ; 14/11/2017 12081 00010052 7407 <1> jz short sysexec_13 12082 <1> sysexec_12: 12083 00010054 AC <1> lodsb 12084 00010055 20C0 <1> and al, al 12085 00010057 75FB <1> jnz short sysexec_12 12086 00010059 EBEC <1> jmp short sysexec_11 12087 <1> sysexec_13: 12088 <1> ; 24/10/2016 12089 <1> ; 24/04/2016 - TRDOS 386 (TRDOS v2.0) 12090 <1> ; 23/06/2015 - 19/10/2015 (Retro UNIX 386 v1, 'sysexec_13') 12091 <1> ; 12092 <1> ; moving arguments to [ecore] is OK here.. 12093 <1> ; 12094 <1> ; ebx = beginning addres of argument list pointers 12095 <1> ; in user's stack 12096 0001005B 2B1D[5C8F0100] <1> sub ebx, [ecore] 12097 00010061 81C300F0BFFF <1> add ebx, (ECORE - PAGE_SIZE) 12098 <1> ; end of core - 4096 (last page) 12099 <1> ; (virtual address) 12100 00010067 891D[6C8F0100] <1> mov [argv], ebx 12101 0001006D 891D[9C8E0100] <1> mov [u.break], ebx ; available user memory 12102 <1> ; 12103 00010073 29C0 <1> sub eax, eax 12104 00010075 C705[948E0100]2000- <1> mov dword [u.count], 32 ; Executable file header size 12104 0001007D 0000 <1> 12105 0001007F C705[808E0100]- <1> mov dword [u.fofp], u.off 12105 00010085 [8C8E0100] <1> 12106 00010089 A3[8C8E0100] <1> mov [u.off], eax ; 0 12107 0001008E A3[908E0100] <1> mov [u.base], eax ; 0, start of user's core (virtual) 12108 <1> ; 24/10/2016 12109 00010093 A0[76770100] <1> mov al, [Current_Drv] 12110 00010098 A2[518E0100] <1> mov [cdev], al 12111 <1> ; 12112 0001009D A1[748F0100] <1> mov eax, [ii] ; Fist Cluster of the Program (PRG) file 12113 <1> ; EAX = First cluster of the executable file 12114 000100A2 E8DF050000 <1> call readi 12115 <1> 12116 000100A7 8B0D[9C8E0100] <1> mov ecx, [u.break] ; top of user's stack (physical addr.) 12117 000100AD 890D[948E0100] <1> mov [u.count], ecx ; save for overrun check 12118 <1> ; 12119 000100B3 8B0D[988E0100] <1> mov ecx, [u.nread] 12120 000100B9 890D[9C8E0100] <1> mov [u.break], ecx ; virtual address (offset from start) 12121 000100BF 80F920 <1> cmp cl, 32 12122 000100C2 7540 <1> jne short sysexec_15 12123 <1> ;: 12124 <1> ; Retro UNIX 386 v1 (32 bit) executable file header format 12125 000100C4 8B35[588F0100] <1> mov esi, [pcore] ; start address of user's core memory 12126 <1> ; (phys. start addr. of the exec. file) 12127 000100CA AD <1> lodsd 12128 000100CB 663DEB1E <1> cmp ax, 1EEBh ; EBH, 1Eh -> jump to +32 12129 000100CF 7533 <1> jne short sysexec_15 12130 000100D1 AD <1> lodsd 12131 000100D2 89C1 <1> mov ecx, eax ; text (code) section size 12132 000100D4 AD <1> lodsd 12133 000100D5 01C1 <1> add ecx, eax ; + data section size (initialized data) 12134 000100D7 89CB <1> mov ebx, ecx 12135 000100D9 AD <1> lodsd 12136 000100DA 01C3 <1> add ebx, eax ; + bss section size (for overrun checking) 12137 000100DC 3B1D[948E0100] <1> cmp ebx, [u.count] 12138 000100E2 7711 <1> ja short sysexec_14 ; program overruns stack ! 12139 <1> ; 12140 <1> ; add bss section size to [u.break] 12141 000100E4 0105[9C8E0100] <1> add [u.break], eax 12142 <1> ; 12143 000100EA 83E920 <1> sub ecx, 32 ; header size (already loaded) 12144 <1> ;cmp ecx, [u.count] 12145 <1> ;jnb short sysexec_16 12146 000100ED 890D[948E0100] <1> mov [u.count], ecx ; required read count 12147 000100F3 EB29 <1> jmp short sysexec_16 12148 <1> sysexec_14: 12149 <1> ; insufficient (out of) memory 12150 000100F5 C705[D88E0100]0400- <1> mov dword [u.error], ERR_MINOR_IM ; 1 12150 000100FD 0000 <1> 12151 000100FF E96AC9FFFF <1> jmp error 12152 <1> sysexec_15: 12153 00010104 8B15[788F0100] <1> mov edx, [i.size] ; file size 12154 0001010A 29CA <1> sub edx, ecx ; file size - loaded bytes 12155 0001010C 7626 <1> jna short sysexec_17 ; no need to next read 12156 0001010E 01D1 <1> add ecx, edx ; [i.size] 12157 00010110 3B0D[948E0100] <1> cmp ecx, [u.count] ; overrun check (!) 12158 00010116 77DD <1> ja short sysexec_14 12159 00010118 8915[948E0100] <1> mov [u.count], edx 12160 <1> sysexec_16: 12161 0001011E A1[748F0100] <1> mov eax, [ii] ; first cluster 12162 00010123 E85E050000 <1> call readi 12163 00010128 8B0D[988E0100] <1> mov ecx, [u.nread] 12164 0001012E 010D[9C8E0100] <1> add [u.break], ecx 12165 <1> sysexec_17: 12166 <1> ; 07/07/2025 12167 <1> ;mov eax, [ii] ; first cluster 12168 <1> ;call iclose 12169 00010134 31C0 <1> xor eax, eax 12170 <1> 12171 <1> ; 21/08/2024 12172 <1> ;inc al 12173 <1> ;mov [u.intr], ax ; 1 (interrupt/time-out is enabled) 12174 <1> ;mov [u.quit], ax ; 1 ('crtl+brk' signal is enabled) 12175 <1> ; 23/07/2022 12176 <1> ;dec al 12177 <1> ; 21/08/2024 12178 00010136 48 <1> dec eax 12179 00010137 66A3[B88E0100] <1> mov [u.intr], ax ; -1 ; 0FFFFh ; enable CTRL+CRK 12180 0001013D 40 <1> inc eax 12181 0001013E 66A3[BA8E0100] <1> mov [u.quit], ax ; 0 ; reset CTRL+BRK flag 12182 <1> 12183 <1> ;cmp dword [u.ppgdir], 0 ; is the caller MainProg (kernel) ? 12184 00010144 3905[C88E0100] <1> cmp [u.ppgdir], eax ; 0 ; 23/07/2022 12185 0001014A 770C <1> ja short sysexec_18 ; no, the caller is user process 12186 <1> ; If the caller is kernel (MainProg), 'sysexec' will come here 12187 0001014C 8B15[B0760100] <1> mov edx, [k_page_dir] ; kernel's page directory 12188 00010152 8915[C88E0100] <1> mov [u.ppgdir], edx ; next time 'sysexec' must not come here 12189 <1> sysexec_18: 12190 <1> ; 02/05/2016 12191 <1> ; 24/04/2016 (TRDOS 386 = TRDOS v2.0) 12192 <1> ; 18/10/2015 (Retro UNIX 386 v1) 12193 <1> ; 05/08/2015 12194 <1> ; 29/07/2015 12195 <1> 12196 <1> ; ; **** arguments list test start - 19/11/2017 12197 <1> ; mov ebp, [argv] 12198 <1> ; sub ebp, ECORE - 4096 12199 <1> ; add ebp, [ecore] 12200 <1> ; 12201 <1> ; mov ebx, [ebp] 12202 <1> ; mov [argc], bx 12203 <1> ; add ebp, 4 12204 <1> ; mov byte [ccolor], 1Fh 12205 <1> ;_zx0: 12206 <1> ; cmp word [argc], 0 12207 <1> ; jna short _zx2 12208 <1> ;_zx1: 12209 <1> ; push ebp 12210 <1> ; mov esi, [ebp] 12211 <1> ; 12212 <1> ; sub esi, ECORE - 4096 12213 <1> ; add esi, [ecore] 12214 <1> ; 12215 <1> ; call print_cmsg 12216 <1> ; 12217 <1> ; dec word [argc] 12218 <1> ; jz short _zx2 12219 <1> ; 12220 <1> ; mov al, '.' 12221 <1> ; mov bl, 07h 12222 <1> ; mov bh, [u.ttyn] 12223 <1> ; call _write_tty 12224 <1> ; 12225 <1> ; pop ebp 12226 <1> ; add ebp, 4 12227 <1> ; jmp short _zx1 12228 <1> ;_zx2: 12229 <1> ; pop ebp 12230 <1> ; mov byte [ccolor], 07h 12231 <1> ; mov eax, 1 12232 <1> ; ; **** arguments list test stop 12233 <1> ; Test result is OK! (there is not a wrong thing) - 19/11/2017 12234 <1> 12235 00010158 8B2D[6C8F0100] <1> mov ebp, [argv] ; user's stack pointer must point to argument 12236 <1> ; list pointers (argument count) 12237 0001015E FA <1> cli 12238 0001015F 8B25[4C760100] <1> mov esp, [tss.esp0] ; ring 0 (kernel) stack pointer 12239 <1> ;mov esp, [u.sp] ; Restore Kernel stack 12240 <1> ; for this process 12241 <1> ;add esp, 20 ; --> EIP, CS, EFLAGS, ESP, SS 12242 <1> ;;xor eax, eax ; 0 12243 <1> ; 23/07/2022 12244 <1> ;dec al ; eax = 0 12245 <1> ; eax = 0 12246 <1> 12247 <1> ;mov edx, UDATA 12248 <1> ; 18/11/2017 12249 00010165 6A23 <1> push UDATA ; user's stack segment 12250 <1> ;push edx 12251 00010167 55 <1> push ebp ; user's stack pointer 12252 <1> ; (points to number of arguments) 12253 <1> 12254 <1> ; 04/01/2017 12255 <1> ; MainProg comes here while [sysflg]= 0FFh 12256 <1> ; (but sysexec comes here while [sysflg]= 0) 12257 00010168 C605[608E0100]00 <1> mov byte [sysflg], 0 ; 04/01/2017 12258 <1> ; (timer_int sysflg control) 12259 0001016F FB <1> sti 12260 00010170 9C <1> pushfd ; EFLAGS 12261 <1> ; Set IF for enabling interrupts in user mode 12262 <1> ;or dword [esp], 200h 12263 <1> ; 12264 <1> ;mov bx, UCODE 12265 <1> ;push bx ; user's code segment 12266 00010171 6A1B <1> push UCODE 12267 <1> ;push 0 12268 00010173 50 <1> push eax ; EIP (=0) - start address - 12269 00010174 8925[648E0100] <1> mov [u.sp], esp ; 29/07/2015 12270 <1> ; 05/08/2015 12271 <1> ; Remedy of a General Protection Fault during 'iretd' is here ! 12272 <1> ; ('push dx' would cause to general protection fault, 12273 <1> ; after 'pop ds' etc.) 12274 <1> ; 12275 <1> ;; push dx ; ds (UDATA) 12276 <1> ;; push dx ; es (UDATA) 12277 <1> ;; push dx ; fs (UDATA) 12278 <1> ;; push dx ; gs (UDATA) 12279 <1> ; 12280 <1> ; This is a trick to prevent general protection fault 12281 <1> ; during 'iretd' intruction at the end of 'sysrele' (in u1.s): 12282 0001017A 66BA2300 <1> mov dx, UDATA ; 19/11/2017 12283 0001017E 8EC2 <1> mov es, dx ; UDATA 12284 00010180 06 <1> push es ; ds (UDATA) 12285 00010181 06 <1> push es ; es (UDATA) 12286 00010182 06 <1> push es ; fs (UDATA) 12287 00010183 06 <1> push es ; gs (UDATA) 12288 00010184 66BA1000 <1> mov dx, KDATA 12289 00010188 8EC2 <1> mov es, dx 12290 <1> ; 12291 <1> ;; pushad simulation 12292 0001018A 89E5 <1> mov ebp, esp ; esp before pushad 12293 0001018C 50 <1> push eax ; eax (0) 12294 0001018D 50 <1> push eax ; ecx (0) 12295 0001018E 50 <1> push eax ; edx (0) 12296 0001018F 50 <1> push eax ; ebx (0) 12297 00010190 55 <1> push ebp ; esp before pushad 12298 00010191 50 <1> push eax ; ebp (0) 12299 00010192 50 <1> push eax ; esi (0) 12300 00010193 50 <1> push eax ; edi (0) 12301 <1> ; 12302 00010194 A3[6C8E0100] <1> mov [u.r0], eax ; eax = 0 12303 00010199 8925[688E0100] <1> mov [u.usp], esp 12304 <1> 12305 <1> ; 14/11/2017 12306 0001019F E9ECC8FFFF <1> jmp sysret0 12307 <1> 12308 <1> get_argp: 12309 <1> ; 08/08/2022 12310 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 12311 <1> ; 11/12/2021 - Retro UNIX 386 v1.2 12312 <1> ; 14/11/2017 - TRDOS 386 (TRDOS v2.0) 12313 <1> ; 18/10/2015 (nbase, ncount) 12314 <1> ; 21/07/2015 12315 <1> ; 24/06/2015 (Retro UNIX 386 v1) 12316 <1> ; Get (virtual) address of argument from user's core memory 12317 <1> ; 12318 <1> ; INPUT: 12319 <1> ; esi = virtual address of argument pointer 12320 <1> ; OUTPUT: 12321 <1> ; eax = virtual address of argument 12322 <1> ; 12323 <1> ; Modified registers: EAX, EBX, ECX, EDX, ESI 12324 <1> ; 12325 000101A4 833D[C88E0100]00 <1> cmp dword [u.ppgdir], 0 ; /etc/init ? 12326 <1> ; (the caller is kernel) 12327 <1> ;jna short get_argpk 12328 <1> ; 08/08/2022 12329 000101AB 7705 <1> ja short get_argp5 12330 000101AD E985000000 <1> jmp get_argpk 12331 <1> get_argp5: 12332 000101B2 89F3 <1> mov ebx, esi 12333 000101B4 E8575AFFFF <1> call get_physical_addr ; get physical address 12334 000101B9 7253 <1> jc short get_argp_err ; 23/07/2022 12335 000101BB A3[608F0100] <1> mov [nbase], eax ; physical address 12336 <1> ;mov [ncount], cx ; remain byte count in page (1-4096) 12337 <1> ; 23/07/2022 12338 000101C0 890D[648F0100] <1> mov [ncount], ecx 12339 <1> ;mov eax, 4 ; 21/07/2015 12340 000101C6 31C0 <1> xor eax, eax 12341 000101C8 B004 <1> mov al, 4 12342 <1> ;cmp cx, ax ; 4 12343 <1> ; 23/07/2022 12344 000101CA 39C1 <1> cmp ecx, eax ; 4 12345 000101CC 7354 <1> jnb short get_argp2 12346 000101CE 89F3 <1> mov ebx, esi 12347 000101D0 01CB <1> add ebx, ecx 12348 000101D2 E8395AFFFF <1> call get_physical_addr ; get physical address 12349 000101D7 7235 <1> jc short get_argp_err 12350 <1> ;push esi 12351 000101D9 89C6 <1> mov esi, eax 12352 <1> ;xchg cx, [ncount] 12353 <1> ; 23/07/2022 12354 000101DB 870D[648F0100] <1> xchg ecx, [ncount] 12355 000101E1 8735[608F0100] <1> xchg esi, [nbase] 12356 000101E7 B504 <1> mov ch, 4 12357 000101E9 28CD <1> sub ch, cl 12358 <1> get_argp0: 12359 000101EB AC <1> lodsb 12360 <1> ;push ax 12361 <1> ; 23/07/2022 12362 000101EC 50 <1> push eax 12363 000101ED FEC9 <1> dec cl 12364 000101EF 75FA <1> jnz short get_argp0 12365 000101F1 8B35[608F0100] <1> mov esi, [nbase] 12366 <1> ; 21/07/2015 12367 000101F7 0FB6C5 <1> movzx eax, ch 12368 000101FA 0105[608F0100] <1> add [nbase], eax 12369 <1> ;sub [ncount], ax 12370 <1> ; 23/07/2022 12371 00010200 2905[648F0100] <1> sub [ncount], eax 12372 <1> get_argp1: 12373 00010206 AC <1> lodsb 12374 00010207 FECD <1> dec ch 12375 00010209 7445 <1> jz short get_argp3 12376 <1> ;push ax 12377 <1> ; 23/07/2022 12378 0001020B 50 <1> push eax 12379 0001020C EBF8 <1> jmp short get_argp1 12380 <1> get_argp_err: 12381 0001020E A3[D88E0100] <1> mov [u.error], eax 12382 <1> ; 14/11/2017 12383 00010213 B801000000 <1> mov eax, ERR_BAD_CMD_ARG ; 01h ; TRDOS 8086 12384 00010218 A3[6C8E0100] <1> mov [u.r0], eax 12385 0001021D E94CC8FFFF <1> jmp error 12386 <1> get_argp2: 12387 <1> ; 21/07/2015 12388 <1> ;mov eax, 4 12389 00010222 8B15[608F0100] <1> mov edx, [nbase] ; 18/10/2015 12390 00010228 0105[608F0100] <1> add [nbase], eax 12391 <1> ;sub [ncount], ax 12392 <1> ; 23/07/2022 12393 0001022E 2905[648F0100] <1> sub [ncount], eax 12394 <1> ; 12395 00010234 8B02 <1> mov eax, [edx] 12396 00010236 C3 <1> retn 12397 <1> get_argpk: 12398 <1> ; Argument is in kernel's memory space 12399 00010237 66C705[648F0100]00- <1> mov word [ncount], PAGE_SIZE ; 4096 12399 0001023F 10 <1> 12400 00010240 8935[608F0100] <1> mov [nbase], esi 12401 00010246 8305[608F0100]04 <1> add dword [nbase], 4 12402 0001024D 8B06 <1> mov eax, [esi] ; virtual addr. = physical addr. 12403 0001024F C3 <1> retn 12404 <1> get_argp3: 12405 00010250 B103 <1> mov cl, 3 12406 <1> get_argp4: 12407 00010252 C1E008 <1> shl eax, 8 12408 <1> ;pop dx 12409 <1> ; 23/07/2022 12410 00010255 5A <1> pop edx 12411 00010256 88D0 <1> mov al, dl 12412 00010258 E2F8 <1> loop get_argp4 12413 <1> ;pop esi 12414 0001025A C3 <1> retn 12415 <1> 12416 <1> ; 23/07/2022 12417 <1> %if 0 12418 <1> 12419 <1> sysstat: 12420 <1> ; 13/01/2017 - TRDOS 386 (TRDOS v2.0) 12421 <1> ; temporary ! 12422 <1> mov eax, ERR_INV_FNUMBER ; 'invalid function number !' 12423 <1> mov [u.error], eax 12424 <1> mov [u.r0], eax 12425 <1> jmp error 12426 <1> 12427 <1> sysfstat: 12428 <1> ; 13/01/2017 - TRDOS 386 (TRDOS v2.0) 12429 <1> ; temporary ! 12430 <1> mov eax, ERR_INV_FNUMBER ; 'invalid function number !' 12431 <1> mov [u.error], eax 12432 <1> mov [u.r0], eax 12433 <1> jmp error 12434 <1> 12435 <1> %endif 12436 <1> 12437 <1> fclose: 12438 <1> ; 24/04/2025 - TRDOS 386 Kernel v2.0.10 12439 <1> ; 18/09/2024 - TRDOS 386 Kernel v2.0.9 12440 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 12441 <1> ; 06/10/2016 (TRDOS 386 = TRDOS v2.0) 12442 <1> ; 12443 <1> ; 18/06/2015 (Retro UNIX 386 v1 - Beginning) 12444 <1> ; (32 bit offset pointer modification) 12445 <1> ; 19/04/2013 - 12/01/2014 (Retro UNIX 8086 v1) 12446 <1> ; 12447 <1> ; Given the file descriptor (index to the u.fp list) 12448 <1> ; 'fclose' first gets the i-number of the file via 'getf'. 12449 <1> ; If i-node is active (i-number > 0) the entry in 12450 <1> ; u.fp list is cleared. If all the processes that opened 12451 <1> ; that file close it, then fsp etry is freed and the file 12452 <1> ; is closed. If not a return is taken. 12453 <1> ; If the file has been deleted while open, 'anyi' is called 12454 <1> ; to see anyone else has it open, i.e., see if it is appears 12455 <1> ; in another entry in the fsp table. Upon return from 'anyi' 12456 <1> ; a check is made to see if the file is special. 12457 <1> ; 12458 <1> ; INPUTS -> 12459 <1> ; r1 - contains the file descriptor (value=0,1,2...) 12460 <1> ; u.fp - list of entries in the fsp table 12461 <1> ; fsp - table of entries (4 words/entry) of open files. 12462 <1> ; OUTPUTS -> 12463 <1> ; r1 - contains the same file descriptor 12464 <1> ; r2 - contains i-number 12465 <1> ; 12466 <1> ; ((AX = R1)) 12467 <1> ; ((Modified registers: EDX, EBX, ECX, ESI, EDI, EBP)) 12468 <1> ; 12469 <1> ; Retro UNIX 8086 v1 modification : CF = 1 12470 <1> ; if i-number of the file is 0. (error) 12471 <1> ; 12472 <1> ; TRDOS 386 (06/10/2016) 12473 <1> ; 12474 <1> ; INPUT: 12475 <1> ; EAX = File Handle (File Descriptor, File Index) 12476 <1> ; 12477 <1> ; OUTPUT: 12478 <1> ; CF = 1 -> File not open ! 12479 <1> ; CF = 0 -> OK! 12480 <1> ; EBX = File Number (System) 12481 <1> ; [cdev] = Logical DOS Drive Number 12482 <1> ; EAX = File Handle/Number (user) 12483 <1> ; 12484 <1> ; Modified Registers: EBX 12485 <1> 12486 0001025B 50 <1> push eax ; File handle 12487 <1> 12488 0001025C E83D000000 <1> call getf 12489 <1> ;jc device_close ; eax = device number 12490 <1> ; 17/04/2021 (temporary) 12491 00010261 7302 <1> jnc short _fclose_0 12492 <1> ; 24/04/2025 (BugFix for 'sysexit') 12493 00010263 58 <1> pop eax 12494 <1> ;jmp rw2 ; file not open ! 12495 00010264 C3 <1> retn 12496 <1> _fclose_0: 12497 00010265 80BB[18840100]01 <1> cmp byte [ebx+OF_MODE], 1 ; open mode ; 0 = empty entry 12498 0001026C 7227 <1> jb short fclose_1 ; 1 = read, 2 = write 12499 <1> 12500 <1> ; 18/09/2024 (EMPTY FILE BugFix) 12501 <1> ;cmp eax, 1 ; is the first cluster number > 0 12502 <1> ;jb short fclose_1 ; no, this is empty entry 12503 <1> 12504 <1> fclose_0: 12505 0001026E FE8B[58840100] <1> dec byte [ebx+OF_OPENCOUNT] ; decrement the number of processes 12506 <1> ; that have opened the file 12507 00010274 791F <1> jns short fclose_1 ; jump if not negative (jump if bit 7 is 0) 12508 <1> ; if all processes haven't closed the file, return 12509 <1> ; 12510 <1> ; eax ; First cluster 12511 00010276 31C0 <1> xor eax, eax ; 0 12512 00010278 8883[18840100] <1> mov [ebx+OF_MODE], al ; 0 = empty entry 12513 <1> ;mov [ebx+OF_STATUS], al ; 0 = empty entry 12514 <1> ;shl bx, 2 12515 <1> ; 23/07/2022 12516 <1> ;shl bl, 2 12517 0001027E C1E302 <1> shl ebx, 2 12518 00010281 8983[78830100] <1> mov [ebx+OF_FCLUSTER], eax ; 0 12519 00010287 8983[F8860100] <1> mov [ebx+OF_CCLUSTER], eax ; 0 12520 <1> ;mov [ebx+OF_CCINDEX], eax ; 0 12521 <1> ; 23/07/2022 12522 <1> ;mov [ebx+OF_OPENCOUNT], al ; 0 12523 0001028D A3[808E0100] <1> mov [u.fofp], eax ; 0 12524 <1> ;shr bx, 2 12525 <1> ; 23/07/2022 12526 <1> ;shr bl, 2 12527 00010292 C1EB02 <1> shr ebx, 2 12528 <1> fclose_1: ; 1: 12529 00010295 58 <1> pop eax ; File handle (File Descriptor, File Index) 12530 00010296 C680[768E0100]00 <1> mov byte [eax+u.fp], 0 ; clear that entry in the u.fp list 12531 0001029D C3 <1> retn 12532 <1> 12533 <1> getf: 12534 <1> ; 03/09/2024 - TRDOS 386 v2.0.9 12535 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 12536 <1> ; 17/04/2021 - TRDOS 386 v2.0.4 12537 <1> ; (temporary modifications) 12538 <1> ; 12/10/2016 12539 <1> ; 11/10/2016 12540 <1> ; 08/10/2016 12541 <1> ; 06/10/2016 (TRDOS 386 = TRDOS v2.0) 12542 <1> ; / get the device number and the i-number of an open file 12543 <1> ; 13/05/2015 12544 <1> ; 11/05/2015 (Retro UNIX 386 v1 - Beginning) 12545 <1> ; 19/04/2013 - 18/11/2013 (Retro UNIX 8086 v1) 12546 <1> ; 12547 0001029E 89C3 <1> mov ebx, eax 12548 <1> getf1: 12549 000102A0 83FB0A <1> cmp ebx, 10 12550 000102A3 730A <1> jnb short getf2 12551 000102A5 8A9B[768E0100] <1> mov bl, [ebx+u.fp] 12552 000102AB 08DB <1> or bl, bl 12553 000102AD 7504 <1> jnz short getf3 12554 <1> getf2: 12555 <1> ; 'File not open !' error (ax=0) 12556 000102AF 29C0 <1> sub eax, eax 12557 <1> ; 03/09/2024 12558 000102B1 F9 <1> stc 12559 000102B2 C3 <1> retn 12560 <1> getf3: 12561 <1> ; 23/07/2022 12562 <1> ;test bl, 80h 12563 <1> ;jnz short getf5 ; device 12564 000102B3 FECB <1> dec bl ; 0 based 12565 000102B5 8A83[F8830100] <1> mov al, [ebx+OF_DRIVE] 12566 000102BB A2[518E0100] <1> mov [cdev], al 12567 000102C0 C0E302 <1> shl bl, 2 ; *4 (dword offset) 12568 <1> ; 23/07/2022 12569 <1> ;shl ebx, 2 12570 000102C3 8B83[F8840100] <1> mov eax, [ebx+OF_SIZE] 12571 000102C9 A3[788F0100] <1> mov [i.size], eax ; file size 12572 000102CE 8D83[78840100] <1> lea eax, [ebx+OF_POINTER] ; 12/10/2016 12573 000102D4 A3[808E0100] <1> mov [u.fofp], eax 12574 000102D9 8B83[78830100] <1> mov eax, [ebx+OF_FCLUSTER] 12575 000102DF C0EB02 <1> shr bl, 2 ; /4 (byte offset) 12576 <1> ; 23/07/2022 12577 <1> ;shr ebx, 2 12578 <1> ; 17/04/2021 12579 000102E2 F8 <1> clc 12580 <1> getf4: 12581 000102E3 C3 <1> retn 12582 <1> ;getf5: 12583 <1> ; 17/04/2021 12584 <1> ; (following code is disabled as temporary) 12585 <1> ; 12586 <1> ;; get device number 12587 <1> ;and bl, 7Fh ; 1 to 7Fh 12588 <1> ;dec bl ; 0 based (0 to 7Eh) 12589 <1> ;mov al, [ebx+DEV_DRIVER] 12590 <1> ;mov ch, [ebx+DEV_ACCESS] 12591 <1> ;mov cl, [ebx+DEV_OPENMODE] 12592 <1> ;and ch, 0FEh ; reset bit 0 ; dev_close 12593 <1> ; 12594 <1> ; 23/07/2022 12595 <1> ;stc ; cf = 1 12596 <1> ;retn 12597 <1> 12598 <1> trans_addr_nmbp: 12599 <1> ; 18/10/2015 12600 <1> ; 12/10/2015 12601 000102E4 8B2D[888E0100] <1> mov ebp, [u.namep] 12602 <1> trans_addr_nm: 12603 <1> ; Convert virtual (pathname) address to physical address 12604 <1> ; (Retro UNIX 386 v1 feature only !) 12605 <1> ; 18/10/2015 12606 <1> ; 12/10/2015 (u.pnbase & u.pncount has been removed from code) 12607 <1> ; 02/07/2015 12608 <1> ; 17/06/2015 12609 <1> ; 16/06/2015 12610 <1> ; 12611 <1> ; INPUTS: 12612 <1> ; ebp = pathname address (virtual) ; [u.namep] 12613 <1> ; [u.pgdir] = user's page directory 12614 <1> ; OUTPUT: 12615 <1> ; esi = physical address of the pathname 12616 <1> ; ecx = remain byte count in the page 12617 <1> ; 12618 <1> ; (Modified registers: EAX, EBX, ECX, EDX, ESI) 12619 <1> ; 12620 000102EA 833D[C88E0100]00 <1> cmp dword [u.ppgdir], 0 ; /etc/init ? (sysexec) 12621 000102F1 7618 <1> jna short trans_addr_nmk ; the caller is os kernel; 12622 <1> ; it is already physical address 12623 000102F3 50 <1> push eax 12624 000102F4 89EB <1> mov ebx, ebp ; [u.namep] ; pathname address (virtual) 12625 000102F6 E81559FFFF <1> call get_physical_addr ; get physical address 12626 000102FB 7204 <1> jc short tr_addr_nm_err 12627 <1> ; 18/10/2015 12628 <1> ; eax = physical address 12629 <1> ; cx = remain byte count in page (1-4096) 12630 <1> ; 12/10/2015 (cx = [u.pncount]) 12631 000102FD 89C6 <1> mov esi, eax ; 12/10/2015 (esi=[u.pnbase]) 12632 000102FF 58 <1> pop eax 12633 00010300 C3 <1> retn 12634 <1> 12635 <1> tr_addr_nm_err: 12636 00010301 A3[D88E0100] <1> mov [u.error], eax 12637 <1> ;pop eax 12638 00010306 E963C7FFFF <1> jmp error 12639 <1> 12640 <1> trans_addr_nmk: 12641 <1> ; 12/10/2015 12642 <1> ; 02/07/2015 12643 0001030B 8B35[888E0100] <1> mov esi, [u.namep] ; [u.pnbase] 12644 00010311 66B90010 <1> mov cx, PAGE_SIZE ; 4096 ; [u.pncount] 12645 00010315 C3 <1> retn 12646 <1> 12647 <1> sysbreak: 12648 <1> ; 06/09/2024 - TRDOS 386 v2.0.9 12649 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 12650 <1> ; 18/10/2015 12651 <1> ; 07/10/2015 12652 <1> ; 23/06/2015 (Retro UNIX 386 v1 - Beginning) 12653 <1> ; 20/06/2013 - 24/03/2014 (Retro UNIX 8086 v1) 12654 <1> ; 12655 <1> ; 'sysbreak' sets the programs break points. 12656 <1> ; It checks the current break point (u.break) to see if it is 12657 <1> ; between "core" and the stack (sp). If it is, it is made an 12658 <1> ; even address (if it was odd) and the area between u.break 12659 <1> ; and the stack is cleared. The new breakpoint is then put 12660 <1> ; in u.break and control is passed to 'sysret'. 12661 <1> ; 12662 <1> ; Calling sequence: 12663 <1> ; sysbreak; addr 12664 <1> ; Arguments: - 12665 <1> ; 12666 <1> ; Inputs: u.break - current breakpoint 12667 <1> ; Outputs: u.break - new breakpoint 12668 <1> ; area between old u.break and the stack (sp) is cleared. 12669 <1> ; 12670 <1> ; ............................................................... 12671 <1> ; 06/09/2024 - TRDOS 386 v2.0.9 - Major Modification - 12672 <1> ; 12673 <1> ; This system call performs "malloc" function as in C. 12674 <1> ; Input: 12675 <1> ; EBX = new u.break address (virtual, user's space) 12676 <1> ; (Note: Default/Initial u.break address is the start of the BSS 12677 <1> ; section. Or it is file size for PRG -flat image- files.) 12678 <1> ; If EBX = 0FFFFFFFFh ; -1 12679 <1> ; Return current u.break in EAX 12680 <1> ; Output: 12681 <1> ; If EBX input is -1, EAX = current u.break address (virtual) 12682 <1> ; otherwise, EAX = new u.break address 12683 <1> ; Area between the new u.break and the old u.break is cleared. 12684 <1> ; (Note: If the new break address cross overs user's esp, 12685 <1> ; this area is not cleared.) 12686 <1> ; If CF=1 at return, it means Memory Allocation Error. 12687 <1> ; (or "Insufficient Memory" error) 12688 <1> ; EAX = 0 12689 <1> ; ............................................................... 12690 <1> ; 12691 <1> ; Retro UNIX 8086 v1 modification: 12692 <1> ; The user/application program puts breakpoint address 12693 <1> ; in BX register as 'sysbreak' system call argument. 12694 <1> ; (argument transfer method 1) 12695 <1> ; 12696 <1> ; NOTE: Beginning of core is 0 in Retro UNIX 8086 v1 ! 12697 <1> ; ((!'sysbreak' is not needed in Retro UNIX 8086 v1!)) 12698 <1> ; NOTE: 12699 <1> ; 'sysbreak' clears extended part (beyond of previous 12700 <1> ; 'u.break' address) of user's memory for original unix's 12701 <1> ; 'bss' compatibility with Retro UNIX 8086 v1 (19/11/2013) 12702 <1> 12703 <1> ; mov u.break,r1 / move users break point to r1 12704 <1> ; cmp r1,$core / is it the same or lower than core? 12705 <1> ; blos 1f / yes, 1f 12706 <1> ; 23/06/2015 12707 00010316 8B2D[9C8E0100] <1> mov ebp, [u.break] ; virtual address (offset) 12708 <1> 12709 <1> ; 06/09/2024 12710 0001031C 31C0 <1> xor eax, eax 12711 0001031E A3[6C8E0100] <1> mov [u.r0], eax ; 0 ; default ('memory allocation error') 12712 00010323 48 <1> dec eax ; -1 12713 <1> 12714 <1> ; 06/09/2024 - TRDOS 386 v2.0.9 12715 <1> ; get u.break address (for 'malloc' in c compiler) 12716 <1> ; for PRG files: 12717 <1> ; default/initial u.break address is file size 12718 00010324 39C3 <1> cmp ebx, eax ; -1 ; 0FFFFFFFFh 12719 00010326 7214 <1> jb short sysbreak_@ 12720 <1> 12721 <1> sysbreak_4: 12722 00010328 89EB <1> mov ebx, ebp 12723 <1> ;(allocates a new page for user if it is not present) 12724 0001032A E8E158FFFF <1> call get_physical_addr ; get physical address 12725 0001032F 72D0 <1> jc short tr_addr_nm_err 12726 <1> 12727 00010331 892D[6C8E0100] <1> mov [u.r0], ebp ; start of bss space (to be allocated) 12728 00010337 E952C7FFFF <1> jmp sysret 12729 <1> 12730 <1> sysbreak_@: 12731 <1> ;and ebp, ebp 12732 <1> ;jz short sysbreak_3 12733 <1> ; Retro UNIX 386 v1 NOTE: u.break points to virtual address !!! 12734 <1> ; (Even break point address is not needed for Retro UNIX 386 v1) 12735 0001033C 8B15[648E0100] <1> mov edx, [u.sp] ; kernel stack at the beginning of sys call 12736 00010342 83C20C <1> add edx, 12 ; EIP -4-> CS -4-> EFLAGS -4-> ESP (user) 12737 <1> ; 07/10/2015 12738 <1> ;mov [u.break], ebx ; virtual address !!! 12739 <1> ; 12740 <1> ; 06/09/2024 12741 <1> ; ebp = old/current u.break 12742 <1> 12743 00010345 3B1A <1> cmp ebx, [edx] ; compare new break point with 12744 <1> ; with top of user's stack (virtual!) 12745 00010347 732B <1> jnb short sysbreak_3 12746 <1> ; cmp r1,sp / is it the same or higher 12747 <1> ; / than the stack? 12748 <1> ; bhis 1f / yes, 1f 12749 00010349 89DE <1> mov esi, ebx 12750 0001034B 29EE <1> sub esi, ebp ; new break point - old break point 12751 <1> ;jna short sysbreak_3 12752 <1> ; 06/09/2024 12753 0001034D 7706 <1> ja short sysbreak_1 12754 0001034F 74D7 <1> jz short sysbreak_4 12755 00010351 F7DE <1> neg esi ; convert to positive number (big-small) 12756 00010353 89DD <1> mov ebp, ebx ; move small number (address) to ebp 12757 <1> 12758 <1> sysbreak_1: 12759 <1> ; 06/09/2024 12760 00010355 53 <1> push ebx 12761 00010356 89EB <1> mov ebx, ebp 12762 00010358 E8B358FFFF <1> call get_physical_addr ; get physical address 12763 0001035D 5B <1> pop ebx 12764 0001035E 72A1 <1> jc short tr_addr_nm_err ; 23/07/2022 12765 <1> ; 18/10/2015 12766 00010360 89C7 <1> mov edi, eax 12767 00010362 29C0 <1> sub eax, eax ; 0 12768 <1> ; ECX = remain byte count in page (1-4096) 12769 00010364 39CE <1> cmp esi, ecx 12770 00010366 7302 <1> jnb short sysbreak_2 12771 00010368 89F1 <1> mov ecx, esi 12772 <1> sysbreak_2: 12773 0001036A 29CE <1> sub esi, ecx 12774 0001036C 01CD <1> add ebp, ecx 12775 0001036E F3AA <1> rep stosb 12776 00010370 09F6 <1> or esi, esi 12777 00010372 75E1 <1> jnz short sysbreak_1 12778 <1> ; bit $1,r1 / is it an odd address 12779 <1> ; beq 2f / no, its even 12780 <1> ; clrb (r1)+ / yes, make it even 12781 <1> ; 2: / clear area between the break point and the stack 12782 <1> ; cmp r1,sp / is it higher or same than the stack 12783 <1> ; bhis 1f / yes, quit 12784 <1> ; clr (r1)+ / clear word 12785 <1> ; br 2b / go back 12786 <1> ;pop ebx 12787 <1> sysbreak_3: ; 1: 12788 <1> ; 06/09/2024 12789 00010374 891D[9C8E0100] <1> mov [u.break], ebx ; virtual address !!! 12790 <1> ; jsr r0,arg; u.break / put the "address" 12791 <1> ; / in u.break (set new break point) 12792 <1> ; br sysret4 / br sysret 12793 <1> ; 06/09/2024 12794 0001037A 891D[6C8E0100] <1> mov [u.r0], ebx ; return new break point in eax 12795 00010380 E909C7FFFF <1> jmp sysret 12796 <1> 12797 <1> sysseek: ; / moves read write pointer in an fsp entry 12798 <1> ; 27/12/2025 - TRDOS 386 v2.0.10 12799 <1> ; 06/11/2016 - TRDOS 386 (TRDOS v2.0) 12800 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 12801 <1> ; 07/07/2013 - 05/08/2013 (Retro UNIX 8086 v1) 12802 <1> ; 12803 <1> ; 'sysseek' changes the r/w pointer of (3rd word of in an 12804 <1> ; fsp entry) of an open file whose file descriptor is in u.r0. 12805 <1> ; The file descriptor refers to a file open for reading or 12806 <1> ; writing. The read (or write) pointer is set as follows: 12807 <1> ; * if 'ptrname' is 0, the pointer is set to offset. 12808 <1> ; * if 'ptrname' is 1, the pointer is set to its 12809 <1> ; current location plus offset. 12810 <1> ; * if 'ptrname' is 2, the pointer is set to the 12811 <1> ; size of file plus offset. 12812 <1> ; The error bit (e-bit) is set for an undefined descriptor. 12813 <1> ; 12814 <1> ; Calling sequence: 12815 <1> ; sysseek; offset; ptrname 12816 <1> ; Arguments: 12817 <1> ; offset - number of bytes desired to move 12818 <1> ; the r/w pointer 12819 <1> ; ptrname - a switch indicated above 12820 <1> ; 12821 <1> ; Inputs: r0 - file descriptor 12822 <1> ; ; 27/12/2025 12823 <1> ; EBX = File descriptor (number) -user- 12824 <1> ; ECX = Offset (plus) 12825 <1> ; EDX = 0 -> set to offset in ECX 12826 <1> ; = 1 -> set to current offset + offset in ECX 12827 <1> ; = 2 -> set to file size + offset in ECX 12828 <1> ; Outputs: - 12829 <1> ; EAX = (new) File Offset ; 27/12/2025 12830 <1> ; ............................................................... 12831 <1> ; 12832 <1> ; Retro UNIX 8086 v1 modification: 12833 <1> ; 'sysseek' system call has three arguments; so, 12834 <1> ; * 1st argument, file descriptor is in BX (BL) register 12835 <1> ; * 2nd argument, offset is in CX register 12836 <1> ; * 3rd argument, ptrname/switch is in DX (DL) register 12837 <1> 12838 00010385 E823000000 <1> call seektell 12839 <1> ; EAX = Current R/W pointer of the file 12840 <1> ; EBX = [u.fofp] 12841 <1> ; [u.base] = offset (ECX input) 12842 <1> 12843 0001038A 0305[908E0100] <1> add eax, [u.base] 12844 00010390 8903 <1> mov [ebx], eax 12845 <1> ; 27/12/2025 12846 <1> sysseek_@: 12847 00010392 A3[6C8E0100] <1> mov [u.r0], eax ; return (new) file offset 12848 00010397 E9F2C6FFFF <1> jmp sysret 12849 <1> 12850 <1> systell: ; / get the r/w pointer 12851 <1> ; 27/12/2025 - TRDOS 386 v2.0.10 12852 <1> ; 06/11/2016 - TRDOS 386 (TRDOS v2.0) - temporary !- 12853 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 12854 <1> ; 07/07/2013 - 05/08/2013 (Retro UNIX 8086 v1) 12855 <1> ; 12856 <1> ; Retro UNIX 8086 v1 modification: 12857 <1> ; ! 'systell' does not work in original UNIX v1, 12858 <1> ; it returns with error ! 12859 <1> ; Inputs: r0 - file descriptor 12860 <1> ; ; 27/12/2025 12861 <1> ; EBX = File descriptor (number) -user- 12862 <1> ; ECX = ignored 12863 <1> ; EDX = 0 -> return current file offset 12864 <1> ; = 1 -> return current file offset 12865 <1> ; = 2 -> return file size 12866 <1> ; > 2 -> return current file offset 12867 <1> ; 12868 <1> ; Outputs: r0 - file r/w pointer 12869 <1> 12870 <1> ;xor ecx, ecx ; 0 12871 <1> ; 12872 <1> ; 27/12/2025 12873 0001039C 83FA02 <1> cmp edx, 2 12874 0001039F 7405 <1> je short systell_@ 12875 000103A1 BA01000000 <1> mov edx, 1 ; 05/08/2013 12876 <1> systell_@: 12877 <1> ;call seektell 12878 000103A6 E808000000 <1> call seektell0 ; 05/08/2013 12879 <1> ;; 06/11/2016 12880 <1> ;;mov eax, [ebx] 12881 <1> ; 27/12/2025 12882 <1> ;mov [u.r0], eax 12883 <1> ;jmp sysret 12884 000103AB EBE5 <1> jmp short sysseek_@ 12885 <1> 12886 <1> ; Original unix v1 'systell' system call: 12887 <1> ; jsr r0,seektell 12888 <1> ; br error4 12889 <1> 12890 <1> seektell: 12891 <1> ; 24/04/2025 - TRDOS 386 v2.0.10 12892 <1> ; 06/11/2016 - TRDOS 386 (TRDOS v2.0) 12893 <1> ; 03/01/2016 12894 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 12895 <1> ; 07/07/2013 - 05/08/2013 (Retro UNIX 8086 v1) 12896 <1> ; 12897 <1> ; 'seektell' puts the arguments from sysseek and systell 12898 <1> ; call in u.base and u.count. It then gets the i-number of 12899 <1> ; the file from the file descriptor in u.r0 and by calling 12900 <1> ; getf. The i-node is brought into core and then u.count 12901 <1> ; is checked to see it is a 0, 1, or 2. 12902 <1> ; If it is 0 - u.count stays the same 12903 <1> ; 1 - u.count = offset (u.fofp) 12904 <1> ; 2 - u.count = i.size (size of file) 12905 <1> ; 12906 <1> ; !! Retro UNIX 8086 v1 modification: 12907 <1> ; Argument 1, file descriptor is in BX; 12908 <1> ; Argument 2, offset is in CX; 12909 <1> ; Argument 3, ptrname/switch is in DX register. 12910 <1> ; 12911 <1> ; ((Return -> eax = base for offset (position = base+offset)) 12912 <1> ; 12913 000103AD 890D[908E0100] <1> mov [u.base], ecx ; offset 12914 <1> seektell0: 12915 000103B3 8915[948E0100] <1> mov [u.count], edx 12916 <1> ; EBX = file descriptor (file number) 12917 000103B9 E8E2FEFFFF <1> call getf1 12918 <1> ; EAX = First cluster of the file 12919 <1> ; EBX = File number (Open file number) 12920 <1> ; [u.fofp] = Pointer to File pointer 12921 <1> ; [i.size] = File size 12922 <1> 12923 000103BE 09C0 <1> or eax, eax 12924 000103C0 7505 <1> jnz short seektell1 12925 <1> 12926 <1> ; 24/04/2025 - TRDOS 386 v2.0.10 12927 <1> ;mov eax, ERR_FILE_NOT_OPEN 12928 <1> ;mov [u.r0], eax 12929 <1> ;mov dword [u.error], eax ; 'file not open !' 12930 <1> ;jmp error 12931 <1> ; 24/04/2025 12932 000103C2 E9E6CDFFFF <1> jmp seektell_err ; sysclose_err 12933 <1> 12934 <1> seektell1: 12935 000103C7 8B1D[808E0100] <1> mov ebx, [u.fofp] 12936 000103CD 803D[948E0100]01 <1> cmp byte [u.count], 1 12937 000103D4 7705 <1> ja short seektell2 12938 000103D6 7409 <1> je short seektell3 12939 000103D8 31C0 <1> xor eax, eax 12940 000103DA C3 <1> retn 12941 <1> 12942 <1> seektell2: 12943 000103DB A1[788F0100] <1> mov eax, [i.size] 12944 000103E0 C3 <1> retn 12945 <1> 12946 <1> seektell3: 12947 000103E1 8B03 <1> mov eax, [ebx] 12948 000103E3 C3 <1> retn 12949 <1> 12950 <1> sysintr: ; / set interrupt handling 12951 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 modification 12952 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 12953 <1> ; 07/07/2013 (Retro UNIX 8086 v1) 12954 <1> ; 12955 <1> ; 'sysintr' sets the interrupt handling value. It puts 12956 <1> ; argument of its call in u.intr then branches into 'sysquit' 12957 <1> ; routine. u.tty is checked if to see if a control tty exists. 12958 <1> ; If one does the interrupt character in the tty buffer is 12959 <1> ; cleared and 'sysret'is called. If one does not exits 12960 <1> ; 'sysret' is just called. 12961 <1> ; 12962 <1> ; Calling sequence: 12963 <1> ; sysintr; arg 12964 <1> ; Argument: 12965 <1> ; arg - if 0, interrupts (ASCII DELETE) are ignored. 12966 <1> ; - if 1, interrupts cause their normal result 12967 <1> ; i.e force an exit. 12968 <1> ; - if arg is a location within the program, 12969 <1> ; control is passed to that location when 12970 <1> ; an interrupt occurs. 12971 <1> ; Inputs: - 12972 <1> ; Outputs: - 12973 <1> ; ............................................................... 12974 <1> ; 12975 <1> ; Retro UNIX 8086 v1 modification: 12976 <1> ; 'sysintr' system call sets u.intr to value of BX 12977 <1> ; then branches into sysquit. 12978 <1> 12979 <1> ; 21/08/2024 - TRDOS 386 12980 <1> ; enable/disable terminate (CTRL+BREAK) interrupt 12981 <1> ; 12982 <1> ; INPUT: 12983 <1> ; bx = 0 -> disable CTRL+BREAK 12984 <1> ; -u.intr will be set to 0, u.quit will be ignored- 12985 <1> ; bx > 0 -> enable CTRL+BREAK (also default at start) 12986 <1> ; -u.intr will be set to 0FFFFh, u.quit will be used- 12987 <1> ; NOTE: u.quit is flag for CTRL+BREAK key press status 12988 <1> ; -1 = pressed -termination request-, 0 = not pressed 12989 <1> ; OUTPUT: 12990 <1> ; none 12991 <1> 12992 <1> ;;; 12993 <1> ; 21/08/2024 12994 000103E4 F7C3FFFF0000 <1> test ebx, 0FFFFh 12995 000103EA 7403 <1> jz short sysintr_@ ; 0 12996 <1> ;mov bx, 0FFFFh 12997 000103EC 31DB <1> xor ebx, ebx 12998 000103EE 4B <1> dec ebx ; -1 12999 <1> sysintr_@: 13000 <1> ;;; 13001 000103EF 66891D[B88E0100] <1> mov [u.intr], bx 13002 <1> ; jsr r0,arg; u.intr / put the argument in u.intr 13003 <1> ; br 1f / go into quit routine 13004 000103F6 E993C6FFFF <1> jmp sysret 13005 <1> 13006 <1> sysquit: 13007 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 modification 13008 <1> ; get/reset QUIT (u.quit) status 13009 <1> ; 13010 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 13011 <1> ; 07/07/2013 (Retro UNIX 8086 v1) 13012 <1> ; 13013 <1> ; 'sysquit' turns off the quit signal. it puts the argument of 13014 <1> ; the call in u.quit. u.tty is checked if to see if a control 13015 <1> ; tty exists. If one does the interrupt character in the tty 13016 <1> ; buffer is cleared and 'sysret'is called. If one does not exits 13017 <1> ; 'sysret' is just called. 13018 <1> ; 13019 <1> ; Calling sequence: 13020 <1> ; sysquit; arg 13021 <1> ; Argument: 13022 <1> ; arg - if 0, this call diables quit signals from the 13023 <1> ; typewriter (ASCII FS) 13024 <1> ; - if 1, quits are re-enabled and cause execution to 13025 <1> ; cease and a core image to be produced. 13026 <1> ; i.e force an exit. 13027 <1> ; - if arg is an addres in the program, 13028 <1> ; a quit causes control to sent to that 13029 <1> ; location. 13030 <1> ; Inputs: - 13031 <1> ; Outputs: - 13032 <1> ; ............................................................... 13033 <1> ; 13034 <1> ; Retro UNIX 8086 v1 modification: 13035 <1> ; 'sysquit' system call sets u.quit to value of BX 13036 <1> ; then branches into 'sysret'. 13037 <1> 13038 <1> ; 21/08/2024 13039 <1> ;mov [u.quit], bx 13040 <1> ;jmp sysret 13041 <1> ; jsr r0,arg; u.quit / put argument in u.quit 13042 <1> ;1: 13043 <1> ; mov u.ttyp,r1 / move pointer to control tty buffer 13044 <1> ; / to r1 13045 <1> ; beq sysret4 / return to user 13046 <1> ; clrb 6(r1) / clear the interrupt character 13047 <1> ; / in the tty buffer 13048 <1> ; br sysret4 / return to user 13049 <1> 13050 <1> ; 21/08/2024 - TRDOS 386 13051 <1> ; get/reset QUIT (u.quit) status 13052 <1> ; 13053 <1> ; INPUT: 13054 <1> ; none 13055 <1> ; OUTPUT: 13056 <1> ; eax = 0 -> no CTRL+BREAK 13057 <1> ; eax = -1 -> CTRL+BREAK status (but not applied) 13058 <1> ; -u.intr may be 0- 13059 <1> ; NOTE: u.quit will be reset to 0 13060 <1> 13061 000103FB 31C0 <1> xor eax, eax ; 0 13062 000103FD 663905[BA8E0100] <1> cmp [u.quit], ax 13063 00010404 7407 <1> jz short sysquit_@ ; already 0 13064 00010406 66A3[BA8E0100] <1> mov [u.quit], ax ; 0 ; reset 13065 0001040C 48 <1> dec eax ; -1 13066 <1> sysquit_@: 13067 0001040D A3[6C8E0100] <1> mov [u.r0], eax 13068 00010412 E977C6FFFF <1> jmp sysret 13069 <1> 13070 <1> %if 0 13071 <1> 13072 <1> anyi: 13073 <1> ; 23/07/2022 13074 <1> ; 06/10/2016 (TRDOS 386 = TRDOS v2.0) 13075 <1> ; Major Modification! 13076 <1> ; TRDOS 386 does not permit to delete a file while it is open 13077 <1> ; The role of 'anyi' procedure has beeen changed to ensure that. 13078 <1> ; 13079 <1> ; 22/06/2015 (Retro UNIX 386 v1 - Beginning) 13080 <1> ; 25/04/2013 (Retro UNIX 8086 v1) 13081 <1> ; 13082 <1> ; 'anyi' is called if a file deleted while open. 13083 <1> ; "anyi" checks to see if someone else has opened this file. 13084 <1> ; 13085 <1> ; INPUTS -> 13086 <1> ; r1 - contains an i-number 13087 <1> ; fsp - start of table containing open files 13088 <1> ; 13089 <1> ; OUTPUTS -> 13090 <1> ; "deleted" flag set in fsp entry of another occurrence of 13091 <1> ; this file and r2 points 1st word of this fsp entry. 13092 <1> ; if file not found - bit in i-node map is cleared 13093 <1> ; (i-node is freed) 13094 <1> ; all blocks related to i-node are freed 13095 <1> ; all flags in i-node are cleared 13096 <1> ; ((AX = R1)) input 13097 <1> ; 13098 <1> ; (Retro UNIX Prototype : 02/12/2012, UNIXCOPY.ASM) 13099 <1> ; ((Modified registers: EDX, ECX, EBX, ESI, EDI, EBP)) 13100 <1> ; 13101 <1> ; / r1 contains an i-number 13102 <1> 13103 <1> ; TRDOS 386 (06/10/2016) 13104 <1> ; 13105 <1> ; INPUT: 13106 <1> ; EAX = First Cluster 13107 <1> ; DL = Logical DOS Drive Number 13108 <1> ; 13109 <1> ; OUTPUT: 13110 <1> ; CF = 1 -> EBX = File Handle/Number/Index 13111 <1> ; CF = 0 -> EBX = 0 13112 <1> ; 13113 <1> ; Modified Registers: EBX 13114 <1> 13115 <1> xor ebx, ebx 13116 <1> anyi_0: 13117 <1> cmp byte [ebx+OF_MODE], 0 ; 0 = empty entry 13118 <1> ja short anyi_2 ; 1 (r), 2 (w) or 3 (r&w) 13119 <1> anyi_1: 13120 <1> inc bl 13121 <1> cmp bl, OPENFILES ; max. count of open files 13122 <1> jb short anyi_0 13123 <1> xor eax, eax 13124 <1> retn 13125 <1> anyi_2: 13126 <1> cmp dl, [ebx+OF_DRIVE] 13127 <1> jne short anyi_1 13128 <1> ;shl bx, 2 ; *4 (dword offset) 13129 <1> shl ebx, 2 ; 23/07/2022 13130 <1> cmp eax, [ebx+OF_FCLUSTER] 13131 <1> je short anyi_3 13132 <1> ;shr bx, 2 ; /4 (byte offset) 13133 <1> shr ebx, 2 ; 23/07/2022 13134 <1> jmp short anyi_1 13135 <1> anyi_3: 13136 <1> ;shr bx, 2 ; /4 (bytes offset) (index) 13137 <1> shr ebx, 2 ; 23/07/2022 13138 <1> stc 13139 <1> retn 13140 <1> 13141 <1> %endif 13142 <1> 13143 <1> ; Retro UNIX 386 v1 Kernel (v0.2) - SYS9.INC 13144 <1> ; Last Modification: 09/12/2015 13145 <1> 13146 <1> syssleep: 13147 <1> ; 28/08/2024 - TRDOS 386 v2.0.9 13148 <1> ; 24/07/2022 - TRDOS 386 v2.0.5 13149 <1> ; 29/06/2015 - (Retro UNIX 386 v1) 13150 <1> ; 11/06/2014 - (Retro UNIX 8086 v1) 13151 <1> ; 13152 <1> ; Retro UNIX 8086 v1 feature only 13153 <1> ; (INPUT -> none) 13154 <1> 13155 <1> ; Temporary - 24/07/2022 13156 00010417 891D[6C8E0100] <1> mov [u.r0], ebx 13157 <1> ; 13158 0001041D 0FB61D[BD8E0100] <1> movzx ebx, byte [u.uno] ; process number 13159 00010424 8AA3[7F8D0100] <1> mov ah, [ebx+p.ttyc-1] ; current/console tty 13160 0001042A E8B4150000 <1> call sleep 13161 <1> 13162 <1> ; 23/08/2024 - restore [u.usp] 13163 <1> ; swap changes [u.usp] to esp which points to 13164 <1> ; return of sleep 13165 0001042F 8925[688E0100] <1> mov [u.usp], esp 13166 <1> ; points to user's regs on top ofn system stack 13167 <1> 13168 <1> ; 24/07/2022 13169 00010435 FF05[6C8E0100] <1> inc dword [u.r0] ; Temporary ! 13170 0001043B E94EC6FFFF <1> jmp sysret 13171 <1> 13172 <1> _vp_clr: 13173 <1> ; Reset/Clear Video Page 13174 <1> ; 13175 <1> ; 24/07/2022 - TRDOS 386 v2.0.5 13176 <1> ; 30/06/2015 - (Retro UNIX 386 v1) 13177 <1> ; 21/05/2013 - 30/10/2013(Retro UNIX 8086 v1) (U0.ASM) 13178 <1> ; 13179 <1> ; Retro UNIX 8086 v1 feature only ! 13180 <1> ; 13181 <1> ; INPUTS -> 13182 <1> ; BH = video page number 13183 <1> ; 13184 <1> ; OUTPUT -> 13185 <1> ; none 13186 <1> ; ((Modified registers: EAX, BH, ECX, EDX, ESI, EDI)) 13187 <1> ; 13188 <1> ; 04/12/2013 13189 00010440 28C0 <1> sub al, al 13190 <1> ; al = 0 (clear video page) 13191 <1> ; bh = video page ; 13/05/2016 13192 00010442 B407 <1> mov ah, 07h 13193 <1> ; ah = 7 (attribute/color) 13194 <1> ;xor cx, cx ; 0, left upper column (cl) & row (cl) 13195 <1> ;mov dx, 184Fh ; right lower column & row (dl=24, dh=79) 13196 <1> ; 24/07/2022 13197 00010444 31C9 <1> xor ecx, ecx 13198 00010446 BA4F180000 <1> mov edx, 184Fh 13199 0001044B E8E11BFFFF <1> call _scroll_up 13200 <1> ; bh = video page 13201 <1> ;xor dx, dx ; 0 (cursor position) 13202 <1> ; 24/07/2022 13203 00010450 31D2 <1> xor edx, edx 13204 00010452 E9201FFFFF <1> jmp _set_cpos 13205 <1> 13206 <1> sysmsg: 13207 <1> ; 28/08/2024 - TRDOS 386 v2.0.9 13208 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 13209 <1> ; 07/12/2020 13210 <1> ; 05/12/2020 13211 <1> ; 13/05/2016 13212 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 13213 <1> ; 01/07/2015 - 11/11/2015 (Retro UNIX 386 v1) 13214 <1> ; Print user-application message on user's console tty 13215 <1> ; 13216 <1> ; Input -> EBX = Message address 13217 <1> ; ECX = Message length (max. 255) 13218 <1> ; DL = Color (IBM PC Rombios color attributes) 13219 <1> ; 13220 00010457 81F9FF000000 <1> cmp ecx, MAX_MSG_LEN ; 255 13221 <1> ;ja sysret ; nothing to do with big message size 13222 <1> ; 23/07/2022 13223 0001045D 7605 <1> jna short sysmsg8 13224 <1> sysmsg7: 13225 0001045F E92AC6FFFF <1> jmp sysret 13226 <1> sysmsg8: ; 23/07/2022 13227 00010464 08C9 <1> or cl, cl 13228 <1> ;jz sysret 13229 <1> ; 23/07/2022 13230 00010466 74F7 <1> jz short sysmsg7 13231 00010468 20D2 <1> and dl, dl 13232 0001046A 7502 <1> jnz short sysmsg0 13233 0001046C B207 <1> mov dl, 07h ; default color 13234 <1> ; (black background, light gray character) 13235 <1> sysmsg0: 13236 0001046E 891D[908E0100] <1> mov [u.base], ebx 13237 00010474 8815[DF760100] <1> mov [ccolor], dl ; color attributes 13238 0001047A 89E5 <1> mov ebp, esp ; save stack pointer 13239 0001047C 31DB <1> xor ebx, ebx ; 0 13240 0001047E 891D[988E0100] <1> mov [u.nread], ebx ; 0 13241 <1> ; 13242 00010484 381D[D28E0100] <1> cmp [u.kcall], bl ; 0 13243 0001048A 7770 <1> ja short sysmsgk ; Temporary (01/07/2015) 13244 <1> ; 13245 0001048C 890D[948E0100] <1> mov [u.count], ecx 13246 <1> ;inc ecx ; + 00h ; ASCIIZ 13247 <1> ; 13248 <1> ; 07/12/2020 13249 <1> ;add ecx, 3 13250 00010492 6683C103 <1> add cx, 3 13251 00010496 80E1FC <1> and cl, ~3 ; not 3 13252 <1> ; 13253 <1> ;;; 13254 <1> ; 20/08/2024 13255 <1> ; for safety, against a possibility which if ecx+1 13256 <1> ; chars (without a 0 in ecx chars) overs stack frame 13257 <1> ; (for example 255 chars without 0, safe stack frame 13258 <1> ; size is 260.) 13259 <1> ; !!! 'sysmsg' will put a 0 at ecx+1 position.!!! 13260 00010499 51 <1> push ecx 13261 <1> ;;; 13262 <1> ; 13263 0001049A 29CC <1> sub esp, ecx 13264 0001049C 89E7 <1> mov edi, esp 13265 0001049E 89E6 <1> mov esi, esp 13266 000104A0 66891D[D08E0100] <1> mov [u.pcount], bx ; reset page (phy. addr.) counter 13267 <1> ; 11/11/2015 13268 000104A7 8A25[A08E0100] <1> mov ah, [u.ttyp] ; recent open tty 13269 <1> ; 0 = none 13270 000104AD FECC <1> dec ah 13271 000104AF 790C <1> jns short sysmsg1 13272 000104B1 8A1D[BD8E0100] <1> mov bl, [u.uno] ; process number 13273 000104B7 8AA3[7F8D0100] <1> mov ah, [ebx+p.ttyc-1] ; user's (process's) console tty 13274 <1> sysmsg1: 13275 000104BD 8825[A28E0100] <1> mov [u.ttyn], ah 13276 <1> sysmsg2: 13277 000104C3 E8F4050000 <1> call cpass 13278 000104C8 7416 <1> jz short sysmsg5 13279 000104CA AA <1> stosb 13280 000104CB 20C0 <1> and al, al 13281 000104CD 75F4 <1> jnz short sysmsg2 13282 <1> sysmsg3: 13283 000104CF 80FC07 <1> cmp ah, 7 ; tty number 13284 000104D2 7711 <1> ja short sysmsg6 ; serial port 13285 000104D4 E83E000000 <1> call print_cmsg ; 05/12/2020 13286 <1> sysmsg4: 13287 000104D9 89EC <1> mov esp, ebp ; restore stack pointer 13288 000104DB E9AEC5FFFF <1> jmp sysret 13289 <1> sysmsg5: 13290 000104E0 C60700 <1> mov byte [edi], 0 13291 000104E3 EBEA <1> jmp short sysmsg3 13292 <1> sysmsg6: 13293 000104E5 8A06 <1> mov al, [esi] 13294 000104E7 E8F7140000 <1> call sndc 13295 000104EC 72EB <1> jc short sysmsg4 13296 000104EE 803E00 <1> cmp byte [esi], 0 ; 0 is stop character 13297 000104F1 76E6 <1> jna short sysmsg4 13298 000104F3 46 <1> inc esi 13299 000104F4 8A25[A28E0100] <1> mov ah, [u.ttyn] 13300 000104FA EBE9 <1> jmp short sysmsg6 13301 <1> 13302 <1> sysmsgk: ; Temporary (01/07/2015) 13303 <1> ; The message has been sent by Kernel (ASCIIZ string) 13304 <1> ; (ECX -character count- will not be considered) 13305 000104FC 8B35[908E0100] <1> mov esi, [u.base] 13306 00010502 8A25[DE760100] <1> mov ah, [ptty] ; present/current screen (video page) 13307 00010508 8825[A28E0100] <1> mov [u.ttyn], ah 13308 0001050E C605[D28E0100]00 <1> mov byte [u.kcall], 0 13309 00010515 EBB8 <1> jmp short sysmsg3 13310 <1> 13311 <1> print_cmsg: 13312 <1> ; 08/12/2020 13313 <1> ; 07/12/2020 13314 <1> ; 05/12/2020 13315 <1> ; 18/11/2017 13316 <1> ; 13/05/2016 - TRDOS 386 (TRDOS v2.0) 13317 <1> ; 01/07/2015 (Retro UNIX 386 v1) 13318 <1> ; 13319 <1> ; print message (on user's console tty) 13320 <1> ; with requested color 13321 <1> ; 13322 <1> ; INPUTS: 13323 <1> ; esi = message address 13324 <1> ; [u.ttyn] = tty number (0 to 7) 13325 <1> ; [ccolor] = color attributes (IBM PC BIOS colors) 13326 <1> ; 13327 <1> ; Modified registers: eax, ebx, ecx, edx, esi, edi 13328 <1> ; (ebp must be preserved) 13329 <1> 13330 <1> ;mov bh, ah 13331 00010517 8A3D[A28E0100] <1> mov bh, [u.ttyn] 13332 0001051D 8A1D[DF760100] <1> mov bl, [ccolor] ; * ; 05/12/2020 13333 <1> 13334 <1> ; 05/12/2020 13335 00010523 803D[249D0100]00 <1> cmp byte [pmi32], 0 ; is vbios's 32 bit pmi enabled ? 13336 0001052A 772E <1> ja short pcmsg5 ; yes 13337 <1> pcmsg1: 13338 <1> ; 08/12/2020 13339 0001052C 8A1D[DF760100] <1> mov bl, [ccolor] ; * (video.s 'u11'&'beep' change BL) 13340 <1> 13341 00010532 AC <1> lodsb 13342 00010533 20C0 <1> and al, al ; 0 13343 00010535 743A <1> jz short pcmsg2 13344 <1> pcmsg7: 13345 00010537 56 <1> push esi 13346 <1> ;mov bl, [ccolor] ; * (video.s 'u11'&'beep' change BL) 13347 <1> ; 05/12/2020 13348 <1> ;;mov bh, [u.ttyn] 13349 <1> ;call _write_tty 13350 <1> ;pop esi 13351 <1> ;jmp short pcmsg1 13352 <1> ;pcmsg2: 13353 <1> ;retn 13354 <1> 13355 <1> ; 07/12/2020 13356 00010538 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 13357 0001053F 7708 <1> ja short pcmsg4 13358 <1> pcmsg3: 13359 00010541 E8AC1DFFFF <1> call _write_tty_m3 13360 00010546 5E <1> pop esi 13361 00010547 EBE3 <1> jmp short pcmsg1 13362 <1> pcmsg4: 13363 00010549 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 13364 00010550 76EF <1> jna short pcmsg3 13365 00010552 E8642AFFFF <1> call vga_write_teletype 13366 00010557 5E <1> pop esi 13367 00010558 EBD2 <1> jmp short pcmsg1 13368 <1> pcmsg5: 13369 <1> ; 07/12/2020 13370 0001055A 803D[2E680000]07 <1> cmp byte [CRT_MODE], 7 13371 00010561 76C9 <1> jna short pcmsg1 13372 <1> 13373 <1> ; 05/12/2020 13374 <1> ; writing message by using 13375 <1> ; VESA VBE3 video bios protected mode interface 13376 <1> 13377 00010563 B40E <1> mov ah, 0Eh 13378 <1> pcmsg6: 13379 00010565 AC <1> lodsb 13380 00010566 20C0 <1> and al, al ; 0 13381 00010568 7407 <1> jz short pcmsg2 13382 <1> ; bh = video page 13383 <1> ; ah = 0Eh 13384 <1> ; al = character 13385 <1> ; bl = color 13386 0001056A E8B314FFFF <1> call int10h_32bit_pmi 13387 0001056F EBF4 <1> jmp short pcmsg6 13388 <1> pcmsg2: 13389 00010571 C3 <1> retn 13390 <1> 13391 <1> sysgeterr: 13392 <1> ; 09/12/2015 13393 <1> ; 21/09/2015 - (Retro UNIX 386 v1 feature only!) 13394 <1> ; Get last error number or page fault count 13395 <1> ; (for debugging) 13396 <1> ; 13397 <1> ; Input -> EBX = return type 13398 <1> ; 0 = last error code (which is in 'u.error') 13399 <1> ; FFFFFFFFh = page fault count for running process 13400 <1> ; FFFFFFFEh = total page fault count 13401 <1> ; 1 .. FFFFFFFDh = undefined 13402 <1> ; 13403 <1> ; Output -> EAX = last error number or page fault count 13404 <1> ; (depending on EBX input) 13405 <1> ; 13406 00010572 21DB <1> and ebx, ebx 13407 00010574 750B <1> jnz short glerr_2 13408 <1> glerr_0: 13409 00010576 A1[D88E0100] <1> mov eax, [u.error] 13410 <1> glerr_1: 13411 0001057B A3[6C8E0100] <1> mov [u.r0], eax 13412 00010580 C3 <1> retn 13413 <1> glerr_2: 13414 00010581 43 <1> inc ebx ; FFFFFFFFh -> 0, FFFFFFFEh -> FFFFFFFFh 13415 00010582 74FD <1> jz short glerr_2 ; page fault count for process 13416 00010584 43 <1> inc ebx ; FFFFFFFFh -> 0 13417 00010585 75EF <1> jnz short glerr_0 13418 00010587 A1[88900100] <1> mov eax, [PF_Count] ; total page fault count 13419 0001058C EBED <1> jmp short glerr_1 13420 <1> glerr_3: 13421 0001058E A1[DC8E0100] <1> mov eax, [u.pfcount] 13422 00010593 EBE6 <1> jmp short glerr_1 13423 <1> 13424 <1> load_and_run_file: 13425 <1> ; 10/01/2026 13426 <1> ; 07/07/2025 - TRDOS 386 Kernel v2.0.10 13427 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 13428 <1> ; 18/11/2017 13429 <1> ; 22/01/2017 13430 <1> ; 04/01/2017 - 07/01/2017 13431 <1> ; 24/10/2016 13432 <1> ; 24/04/2016 - 02/05/2016 - 03/05/2016 - 06/05/2016 13433 <1> ; 23/04/2016 (TRDOS 386 = TRDOS v2.0) 13434 <1> ; 23/10/2015 (Retro UNIX 386 v1, 'sysexec') 13435 <1> ; 23/06/2015 (Retro UNIX 386 v1 - Beginning) 13436 <1> ; 03/06/2013 - 06/12/2013 (Retro UNIX 8086 v1) 13437 <1> ; EAX = First Cluster number 13438 <1> ; EDX = File Size 13439 <1> ; ESI = Argument list address 13440 <1> ; [argc] = argument count 13441 <1> ; [u.nread] = argument list length 13442 <1> ; [esp] = return address to the caller (*) 13443 <1> ; 13444 00010595 8935[6C8F0100] <1> mov [argv], esi 13445 0001059B 8915[788F0100] <1> mov [i.size], edx 13446 000105A1 A3[748F0100] <1> mov [ii], eax 13447 <1> 13448 <1> ;sti ; 07/01/2017 13449 <1> ;mov eax, [k_page_dir] 13450 <1> ;mov [u.pgdir], eax 13451 000105A6 31C0 <1> xor eax, eax ; clc ; *** ; 04/01/2017 13452 <1> ;mov [u.r0], eax ; 0 ; 07/01/2017 13453 <1> 13454 <1> ; 06/05/2016 13455 <1> ; Set 'sysexit' return order to MainProg 13456 <1> ; 13457 000105A8 58 <1> pop eax ; * 'loc_load_and_run_file_8:' address 13458 <1> ;; 22/01/2017 13459 <1> ;;cli ; 07/01/2017 13460 000105A9 8B25[4C760100] <1> mov esp, [tss.esp0] 13461 <1> ; 13462 <1> ; 'loc_load_run_file_8' address has 13463 <1> ; 'jmp loc_file_rw_restore_retn' instruction 13464 <1> ; 'loc_file_rw_restore_retn:' will return to 13465 <1> ; [mainprog_return_addr] 13466 <1> ; just after 'call command_interpreter' 13467 <1> ; 13468 000105AF 68[986D0000] <1> push _end_of_mainprog ; we must not return to here ! 13469 000105B4 FF35[34830100] <1> push dword [mainprog_return_addr] 13470 000105BA 89E5 <1> mov ebp, esp ; ** 13471 <1> ; 13472 000105BC 9C <1> pushfd ; EFLAGS ; IRETD ; *** 13473 000105BD 6A08 <1> push KCODE ; cs ; IRETD 13474 000105BF 50 <1> push eax ; * (eip) ; IRETD 13475 000105C0 8925[648E0100] <1> mov [u.sp], esp 13476 <1> ;mov byte [u.quant], time_count 13477 000105C6 1E <1> push ds 13478 000105C7 06 <1> push es 13479 000105C8 0FA0 <1> push fs 13480 000105CA 0FA8 <1> push gs 13481 <1> ;mov eax, [u.r0] 13482 000105CC 29C0 <1> sub eax, eax 13483 000105CE 60 <1> pushad 13484 000105CF 68[8ECA0000] <1> push sysret 13485 <1> ;push sysrel1 ; 07/01/2017 13486 000105D4 8925[688E0100] <1> mov [u.usp], esp 13487 <1> ; 13488 000105DA E8F8030000 <1> call wswap ; Save MainProg (process 1) 'u' structure 13489 <1> ; and registers for return (from program) 13490 000105DF 89EC <1> mov esp, ebp ; ** 13491 <1> ;;22/01/2017 13492 <1> ;;sti ; 07/01/2017 13493 <1> ; 23/07/2022 13494 <1> ;push eax ; * 'loc_load_and_run_file_8:' address 13495 <1> ; 13496 <1> ;;; 02/05/2016 13497 <1> ;;; Create a new process (parent: MainProg) 13498 000105E1 31F6 <1> xor esi, esi 13499 <1> cnpm_1: ; search p.stat table for unused process number 13500 000105E3 46 <1> inc esi 13501 <1> ; 10/01/2026 13502 000105E4 8A86[9F8D0100] <1> mov al, [esi+p.stat-1] 13503 000105EA 3C00 <1> cmp al, 0 13504 <1> ;cmp byte [esi+p.stat-1], 0 ; SFREE 13505 <1> ; is process active, unused, dead 13506 000105EC 762C <1> jna short cnpm_2 ; it's unused so branch 13507 <1> ;;;; 13508 <1> ; 10/01/2026 - TRDOS 386 v2.0.10 (BugFix) 13509 <1> ; (if the parent proc's number = 1, the child's status = 3) 13510 000105EE 3C03 <1> cmp al, 3 ; zombie ? 13511 000105F0 751D <1> jne short cnpm_3 ; al = 1 13512 000105F2 D1E6 <1> shl esi, 1 13513 000105F4 668B86[5E8D0100] <1> mov ax, [esi+p.ppid-2] ; parent process's id 13514 000105FB D1EE <1> shr esi, 1 13515 000105FD 663B05[408D0100] <1> cmp ax, [p.pid] ; compare with process 1's process id 13516 00010604 7509 <1> jne short cnpm_3 ; not MainProg (!?) 13517 00010606 C686[9F8D0100]00 <1> mov byte [esi+p.stat-1], 0 13518 0001060D EB0B <1> jmp short cnpm_2 13519 <1> cnpm_3: 13520 <1> ;;;; 13521 0001060F 6683FE10 <1> cmp si, nproc ; all processes checked 13522 00010613 72CE <1> jb short cnpm_1 ; no, branch back 13523 <1> cnpm_panic: 13524 00010615 E9FF67FFFF <1> jmp panic 13525 <1> cnpm_2: 13526 0001061A A1[C48E0100] <1> mov eax, [u.pgdir] ; page directory of MainProg 13527 0001061F A3[C88E0100] <1> mov [u.ppgdir], eax ; parent's page directory 13528 00010624 E80152FFFF <1> call allocate_page 13529 <1> ;jc panic 13530 <1> ; 23/07/2022 13531 00010629 72EA <1> jc short cnpm_panic 13532 <1> 13533 <1> ; EAX = UPAGE (user structure page) address 13534 0001062B A3[C08E0100] <1> mov [u.upage], eax ; memory page for 'user' struct (child) 13535 00010630 89F7 <1> mov edi, esi 13536 <1> ;shl di, 2 13537 <1> ; 23/07/2022 13538 00010632 C1E702 <1> shl edi, 2 13539 00010635 8987[AC8D0100] <1> mov [edi+p.upage-4], eax ; memory page for 'user' struct 13540 0001063B E85B52FFFF <1> call clear_page ; 03/05/2016 13541 <1> ;;movzx eax, byte [p.ttyc] ; console tty (for MainProg) 13542 <1> ;sub ax, ax ; 0 13543 <1> ; 23/07/2022 13544 00010640 29C0 <1> sub eax, eax 13545 00010642 668986[7F8D0100] <1> mov [esi+p.ttyc-1], ax ; al - set child's console tty 13546 <1> ; ah - reset child's wait channel 13547 00010649 66A3[A08E0100] <1> mov [u.ttyp], ax ; 0 13548 <1> 13549 0001064F 89F2 <1> mov edx, esi 13550 00010651 8815[BD8E0100] <1> mov [u.uno], dl ; child process number 13551 00010657 FE86[9F8D0100] <1> inc byte [esi+p.stat-1] ; 1, SRUN 13552 <1> ;shl si, 1 ; multiply si by 2 to get index into p.pid table 13553 <1> ; 23/07/2022 13554 0001065D D1E6 <1> shl esi, 1 13555 0001065F 66FF05[548E0100] <1> inc word [mpid] ; increment m.pid; get a new process name 13556 <1> 13557 <1> ; 23/07/2022 13558 <1> ;mov ax, [p.pid] ; get process name of MainProg 13559 <1> ;mov ax, 1 13560 00010666 FEC0 <1> inc al ; eax = 1 13561 00010668 668986[5E8D0100] <1> mov [esi+p.ppid-2], ax ; put parent process name 13562 <1> ; in parent process slot for child 13563 0001066F A2[B68E0100] <1> mov [u.pri], al ; 1 ; normal priority 13564 <1> 13565 <1> ;dec ax ; 0 13566 <1> ;mov [u.ttyp], ax ; 0 13567 <1> 13568 00010674 66A1[548E0100] <1> mov ax, [mpid] 13569 0001067A 668986[3E8D0100] <1> mov [esi+p.pid-2], ax ; put new process name 13570 <1> ; in child process' name slot 13571 <1> ;;; 13572 <1> ; 07/07/2025 13573 <1> ;mov eax, [ii] 13574 <1> ; 23/07/2022 13575 <1> ; Retro UNIX 386 v1, 'sysexec' (u2.s) 13576 <1> ;call iopen 13577 <1> ; 06/06/2016 13578 <1> ;mov byte [u.pri], 1 ; normal priority 13579 <1> ; 13580 <1> ;jmp short sysexec_7 ; 02/05/2016 13581 <1> ; 23/07/2022 13582 00010681 E921F9FFFF <1> jmp sysexec_7 13583 <1> 13584 <1> ; ; 02/05/2016 13585 <1> ; ;inc byte [sysflg] ; 0FFh -> 0 13586 <1> ; ;mov byte [sysflg], 0 ; 04/01/2017 13587 <1> ; movzx ebx, byte [u.uno] 13588 <1> ; shl bl, 1 ; 13/11/2017 13589 <1> ; cmp word [ebx+p.ppid-2], 1 ; MainProg 13590 <1> ; ja sysret0 ; 03/05/2016 13591 <1> ; push sysret ; * 13592 <1> ; mov [u.usp], esp 13593 <1> ; call wswap ; save child process 'u' structure and 13594 <1> ; ; registers 13595 <1> ; add dword [u.usp], 4 ; 03/05/2016 13596 <1> ;sysexec_19: ; 02/05/2016 13597 <1> ; retn ; * 'sysret' ; byte [sysflg] -> 0FFh 13598 <1> 13599 <1> readi: 13600 <1> ; 09/08/2022 13601 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 13602 <1> ; 01/05/2016 13603 <1> ; 25/04/2016 - TRDOS 386 (TRDOS v2.0) 13604 <1> ; 20/05/2015 - Retro UNIX 386 v1 13605 <1> ; 11/03/2013 - 31/07/2013 (Retro UNIX 8086 v1) 13606 <1> ; 13607 <1> ; Reads from a file whose the first cluster number in EAX 13608 <1> ; 13609 <1> ; INPUTS -> 13610 <1> ; EAX - First cluster number of the file 13611 <1> ; u.count - byte count user desires 13612 <1> ; u.base - points to user buffer 13613 <1> ; u.fofp - points to dword with current file offset 13614 <1> ; i.size - file size 13615 <1> ; cdev - logical dos drive number of the file 13616 <1> ; OUTPUTS -> 13617 <1> ; u.count - cleared 13618 <1> ; u.nread - accumulates total bytes passed back 13619 <1> ; 13620 <1> ; ((EAX)) input/output 13621 <1> ; (Retro UNIX Prototype : 14/12/2012 - 01/03/2013, UNIXCOPY.ASM) 13622 <1> ; ((Modified registers: edx, ebx, ecx, esi, edi)) 13623 <1> 13624 00010686 31D2 <1> xor edx, edx ; 0 13625 00010688 8915[988E0100] <1> mov [u.nread], edx ; 0 13626 0001068E 668915[D08E0100] <1> mov [u.pcount], dx ; 19/05/2015 13627 00010695 3915[948E0100] <1> cmp [u.count], edx ; 0 13628 <1> ;ja short readi_1 13629 <1> ;retn 13630 <1> ; 09/08/2022 13631 0001069B 765E <1> jna short dskr_5 ; retn 13632 <1> ;readi_1: 13633 <1> dskr: 13634 <1> ; 01/05/2016 13635 <1> ; 25/04/2016 - TRDOS 386 (TRDOS v2.0) 13636 <1> ; 24/05/2015 - 12/10/2015 (Retro UNIX 386 v1) 13637 <1> ; 26/04/2013 - 03/08/2013 (Retro UNIX 8086 v1) 13638 <1> dskr_0: 13639 0001069D 8B15[788F0100] <1> mov edx, [i.size] 13640 000106A3 8B1D[808E0100] <1> mov ebx, [u.fofp] 13641 000106A9 2B13 <1> sub edx, [ebx] 13642 000106AB 7647 <1> jna short dskr_4 13643 <1> ; 13644 000106AD 50 <1> push eax ; 01/05/2016 13645 000106AE 3B15[948E0100] <1> cmp edx, [u.count] 13646 000106B4 7306 <1> jnb short dskr_1 13647 000106B6 8915[948E0100] <1> mov [u.count], edx 13648 <1> dskr_1: 13649 <1> ; EAX = First Cluster 13650 <1> ; [Current_Drv] = Physical drive number 13651 000106BC E83B000000 <1> call mget_r 13652 <1> ; NOTE: in 'mget_r', relevant sector will be read in buffer 13653 <1> ; if it is not already in buffer ! 13654 000106C1 BB[94900100] <1> mov ebx, readi_buffer 13655 000106C6 803D[D28E0100]00 <1> cmp byte [u.kcall], 0 ; the caller is 'namei' sign (=1) 13656 000106CD 770F <1> ja short dskr_3 ; zf=0 -> the caller is 'namei' 13657 000106CF 66833D[D08E0100]00 <1> cmp word [u.pcount], 0 13658 000106D7 7705 <1> ja short dskr_3 13659 <1> dskr_2: 13660 <1> ; [u.base] = virtual address to transfer (as destination address) 13661 000106D9 E869010000 <1> call trans_addr_w ; translate virtual address to physical (w) 13662 <1> dskr_3: 13663 <1> ; EBX (r5) = system (I/O) buffer address -physical- 13664 000106DE E8CC010000 <1> call sioreg 13665 000106E3 87F7 <1> xchg esi, edi 13666 <1> ; EDI = file (user data) offset 13667 <1> ; ESI = sector (I/O) buffer offset 13668 <1> ; ECX = byte count 13669 000106E5 F3A4 <1> rep movsb 13670 <1> ; eax = remain bytes in buffer 13671 <1> ; (check if remain bytes in the buffer > [u.pcount]) 13672 000106E7 09C0 <1> or eax, eax 13673 000106E9 75EE <1> jnz short dskr_2 ; (page end before system buffer end!) 13674 000106EB 58 <1> pop eax ; (first cluster number) 13675 000106EC 390D[948E0100] <1> cmp [u.count], ecx ; 0 13676 000106F2 77A9 <1> ja short dskr_0 13677 <1> dskr_4: 13678 000106F4 C605[D28E0100]00 <1> mov byte [u.kcall], 0 13679 <1> dskr_5: ; 23/07/2022 13680 000106FB C3 <1> retn 13681 <1> 13682 <1> mget_r: 13683 <1> ; 19/12/2025 - TRDOS 386 Kernel v2.0.10 13684 <1> ; 29/08/2023 13685 <1> ; 30/07/2022 13686 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 13687 <1> ; 24/10/2016 13688 <1> ; 22/10/2016 13689 <1> ; 12/10/2016 13690 <1> ; 29/04/2016 13691 <1> ; 25/04/2016 - TRDOS 386 (TRDOS v2.0) 13692 <1> ; 03/06/2015 (Retro UNIX 386 v1, 'mget', u.5s) 13693 <1> ; 22/03/2013 - 31/07/2013 (Retro UNIX 8086 v1) 13694 <1> ; 13695 <1> ; Get existing or (allocate) a new disk block for file 13696 <1> ; 13697 <1> ; INPUTS -> 13698 <1> ; [u.fofp] = file offset pointer 13699 <1> ; EAX = First Cluster 13700 <1> ; [cdev] = Logical dos drive number 13701 <1> ; ([u.off] = file offset) 13702 <1> ; OUTPUTS -> 13703 <1> ; EAX = logical sector number 13704 <1> ; ESI = Logical Dos Drive Description Table address 13705 <1> ; 13706 <1> ; Modified registers: EDX, EBX, ECX, ESI, EDI 13707 <1> 13708 000106FC 8B35[808E0100] <1> mov esi, [u.fofp] 13709 00010702 8B1E <1> mov ebx, [esi] ; (u.off) 13710 <1> 13711 00010704 29C9 <1> sub ecx, ecx 13712 00010706 8A2D[518E0100] <1> mov ch, [cdev] 13713 <1> 13714 0001070C BE00010900 <1> mov esi, Logical_DOSDisks 13715 00010711 01CE <1> add esi, ecx 13716 <1> 13717 00010713 380D[E4820100] <1> cmp [readi.valid], cl ; 0 13718 00010719 7642 <1> jna short mget_r_0 13719 <1> 13720 0001071B 3A2D[E5820100] <1> cmp ch, [readi.drv] 13721 00010721 753A <1> jne short mget_r_0 13722 <1> 13723 00010723 3B05[F8820100] <1> cmp eax, [readi.fclust] 13724 00010729 754E <1> jne short mget_r_3 13725 <1> 13726 0001072B 89D8 <1> mov eax, ebx ; file offset 13727 0001072D 668B0D[EC820100] <1> mov cx, [readi.bpc] 13728 00010734 41 <1> inc ecx ; <= 65536 13729 00010735 29D2 <1> sub edx, edx 13730 00010737 F7F1 <1> div ecx 13731 <1> 13732 00010739 8B3D[F4820100] <1> mov edi, [readi.c_index] ; cluster index 13733 <1> 13734 0001073F 39F8 <1> cmp eax, edi 13735 00010741 7563 <1> jne short mget_r_4 ; (*) 13736 <1> 13737 <1> ; edx = byte offset in cluster (<= 65535) 13738 00010743 668915[EE820100] <1> mov [readi.offset], dx 13739 <1> ; 23/07/2022 13740 <1> ;shr dx, 9 ; / 512 13741 0001074A C1EA09 <1> shr edx, 9 13742 0001074D 8815[E7820100] <1> mov [readi.s_index], dl ; sector index in cluster (0 to spc -1) 13743 <1> 13744 00010753 A1[F0820100] <1> mov eax, [readi.cluster] ; > 0 if [readi.valid] = 1 13745 <1> ; 19/12/2025 13746 <1> ;mov edx, [readi.fs_index] 13747 00010758 E989000000 <1> jmp mget_r_7 13748 <1> 13749 <1> mget_r_0: 13750 0001075D 882D[E5820100] <1> mov [readi.drv], ch ; physical drive number 13751 <1> ; 19/12/2025 13752 <1> %if 0 13753 <1> cmp byte [esi+LD_FATType], 0 13754 <1> ja short mget_r_1 13755 <1> ;mov cl, [esi+LD_FS_BytesPerSec+1] 13756 <1> ;shr cl, 1 ; 1 for 512 bytes, 4 for 2048 bytes 13757 <1> ; 19/12/2025 13758 <1> mov cl, 1 13759 <1> jmp short mget_r_2 13760 <1> %endif 13761 <1> mget_r_1: 13762 00010763 8A4E13 <1> mov cl, [esi+LD_BPB+BPB_SecPerClust] 13763 <1> mget_r_2: 13764 00010766 880D[E6820100] <1> mov [readi.spc], cl ; sectors per cluster 13765 <1> ; NOTE: readi bytes per sector value is always 512 ! 13766 <1> ; 23/07/2022 13767 <1> ;xor ch, ch 13768 <1> ; 29/08/2023 13769 0001076C C1E109 <1> shl ecx, 9 13770 <1> ;shl cx, 9 ; * 512 13771 <1> ;dec cx ; bytes per cluster - 1 13772 <1> ; 23/07/2022 13773 0001076F 49 <1> dec ecx 13774 00010770 66890D[EC820100] <1> mov [readi.bpc], cx 13775 <1> ;sub cx, cx 13776 <1> ; 23/07/2022 13777 00010777 29C9 <1> sub ecx, ecx 13778 <1> mget_r_3: 13779 00010779 A3[F8820100] <1> mov [readi.fclust], eax ; first cluster (or FDT address) 13780 0001077E 880D[E4820100] <1> mov [readi.valid], cl ; 0 13781 <1> ;mov [readi.s_index], cl ; 0 13782 <1> ;mov [readi.offset], cx ; 0 13783 00010784 890D[F4820100] <1> mov [readi.c_index], ecx ; 0 13784 0001078A 890D[F0820100] <1> mov [readi.cluster], ecx ; 0 13785 00010790 890D[E8820100] <1> mov [readi.sector], ecx ; 0 13786 <1> 13787 00010796 89D8 <1> mov eax, ebx ; file offset 13788 00010798 668B0D[EC820100] <1> mov cx, [readi.bpc] 13789 0001079F 41 <1> inc ecx ; <= 65536 13790 000107A0 29D2 <1> sub edx, edx 13791 000107A2 F7F1 <1> div ecx 13792 <1> ;mov edi, [readi.c_index] ; previous cluster index 13793 000107A4 29FF <1> sub edi, edi 13794 <1> mget_r_4: 13795 000107A6 A3[F4820100] <1> mov [readi.c_index], eax ; cluster index 13796 <1> ; edx = byte offset in cluster (<= 65535) 13797 000107AB 668915[EE820100] <1> mov [readi.offset], dx 13798 <1> ; 23/07/2022 13799 <1> ;shr dx, 9 ; / 512 13800 000107B2 C1EA09 <1> shr edx, 9 13801 000107B5 8815[E7820100] <1> mov [readi.s_index], dl ; sector index in cluster (0 to spc -1) 13802 <1> 13803 000107BB 89C1 <1> mov ecx, eax ; current cluster index 13804 000107BD A1[F8820100] <1> mov eax, [readi.fclust] 13805 000107C2 09C9 <1> or ecx, ecx ; cluster index 13806 000107C4 741B <1> jz short mget_r_6 13807 <1> 13808 000107C6 39CF <1> cmp edi, ecx 13809 000107C8 7710 <1> ja short mget_r_5 ; old cluster index is higher 13810 000107CA 8B15[F0820100] <1> mov edx, [readi.cluster] 13811 000107D0 21D2 <1> and edx, edx 13812 000107D2 7406 <1> jz short mget_r_5 13813 <1> ; valid 'readi' parameters (*) 13814 000107D4 89D0 <1> mov eax, edx 13815 000107D6 29F9 <1> sub ecx, edi 13816 000107D8 740C <1> jz short mget_r_7 13817 <1> mget_r_5: 13818 <1> ; EAX = Beginning cluster 13819 <1> ; EDX = Sector index in disk/file section 13820 <1> ; (Only for SINGLIX file system!) 13821 <1> ; ECX = Cluster sequence number after the beginning cluster 13822 <1> ; ESI = Logical DOS Drive Description Table address 13823 000107DA E8DAC0FFFF <1> call get_cluster_by_index 13824 000107DF 7246 <1> jc short mget_r_err 13825 <1> ; EAX = Cluster number 13826 <1> mget_r_6: 13827 000107E1 A3[F0820100] <1> mov [readi.cluster], eax ; FDT number for Singlix File System 13828 <1> mget_r_7: 13829 <1> ; 19/12/2025 13830 <1> %if 0 13831 <1> cmp byte [esi+LD_FATType], 0 13832 <1> jna short mget_r_12 13833 <1> %endif 13834 <1> ;sub eax, 2 13835 <1> ; 30/07/2022 13836 000107E6 48 <1> dec eax 13837 000107E7 48 <1> dec eax 13838 000107E8 0FB615[E6820100] <1> movzx edx, byte [readi.spc] 13839 000107EF F7E2 <1> mul edx 13840 <1> 13841 000107F1 034668 <1> add eax, [esi+LD_DATABegin] 13842 000107F4 8A15[E7820100] <1> mov dl, [readi.s_index] 13843 000107FA 01D0 <1> add eax, edx 13844 <1> mget_r_8: 13845 <1> ; eax = logical sector number 13846 000107FC 803D[E4820100]00 <1> cmp byte [readi.valid], 0 13847 00010803 7608 <1> jna short mget_r_9 13848 00010805 3B05[E8820100] <1> cmp eax, [readi.sector] 13849 0001080B 7435 <1> je short mget_r_11 ; sector is already in 'readi' buffer 13850 <1> mget_r_9: 13851 0001080D A3[E8820100] <1> mov [readi.sector], eax 13852 00010812 BB[94900100] <1> mov ebx, readi_buffer ; buffer address 13853 <1> ;mov ecx, 1 13854 <1> ; 30/07/2022 13855 00010817 31C9 <1> xor ecx, ecx 13856 00010819 FEC1 <1> inc cl 13857 <1> ; ecx = 1 13858 <1> 13859 <1> ; 29/04/2016 13860 <1> ;xor dl, dl 13861 <1> 13862 <1> ; EAX = Logical sector number 13863 <1> ; ECX = Sector count 13864 <1> ; EBX = Buffer address 13865 <1> ; (EDX = 0) 13866 <1> ; ESI = Logical DOS drive description table address 13867 <1> 13868 0001081B E8D3110000 <1> call disk_read 13869 00010820 7314 <1> jnc short mget_r_10 13870 <1> 13871 <1> ; 22/10/2016 (15h -> 17) 13872 00010822 B811000000 <1> mov eax, 17 ; Drive not ready or read error ! 13873 <1> mget_r_err: 13874 00010827 A3[D88E0100] <1> mov [u.error], eax 13875 <1> ; 12/10/2016 13876 0001082C A3[6C8E0100] <1> mov [u.r0], eax 13877 00010831 E938C2FFFF <1> jmp error 13878 <1> mget_r_10: 13879 00010836 C605[E4820100]01 <1> mov byte [readi.valid], 1 ; 24/10/2016 13880 0001083D A1[E8820100] <1> mov eax, [readi.sector] 13881 <1> mget_r_11: 13882 00010842 C3 <1> retn 13883 <1> 13884 <1> ; 19/12/2025 13885 <1> %if 0 13886 <1> mget_r_12: 13887 <1> ; EAX = FDT number 13888 <1> ; EDX = Sector index from FDT sector (0,1,2,3,4...) 13889 <1> inc eax ; the first data sector in FS disk section 13890 <1> mov [readi.fs_index], edx 13891 <1> add eax, edx 13892 <1> jmp short mget_r_8 13893 <1> %endif 13894 <1> 13895 <1> trans_addr_r: 13896 <1> ; 12/10/2016 13897 <1> ; 02/05/2016 - TRDOS 386 (TRDOS v2.0) 13898 <1> ; Translate virtual address to physical address 13899 <1> ; for reading from user's memory space 13900 <1> ; 04/06/2015 - 18/10/2015 (Retro UNIX 386 v1) 13901 <1> 13902 00010843 31D2 <1> xor edx, edx ; 0 (read access sign) 13903 00010845 EB04 <1> jmp short trans_addr_rw 13904 <1> 13905 <1> trans_addr_w: 13906 <1> ; 12/10/2016 13907 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 13908 <1> ; Translate virtual address to physical address 13909 <1> ; for writing to user's memory space 13910 <1> ; 04/06/2015 - 18/10/2015 (Retro UNIX 386 v1) 13911 <1> 13912 00010847 29D2 <1> sub edx, edx 13913 00010849 FEC2 <1> inc dl ; 1 (write access sign) 13914 <1> trans_addr_rw: 13915 0001084B 50 <1> push eax 13916 0001084C 53 <1> push ebx 13917 0001084D 52 <1> push edx ; r/w sign (in DL) 13918 <1> ; 13919 0001084E 8B1D[908E0100] <1> mov ebx, [u.base] 13920 00010854 E8B753FFFF <1> call get_physical_addr ; get physical address 13921 00010859 730F <1> jnc short passc_0 13922 0001085B A3[D88E0100] <1> mov [u.error], eax 13923 00010860 A3[6C8E0100] <1> mov [u.r0], eax ; 12/10/2016 13924 <1> ;pop edx 13925 <1> ;pop ebx 13926 <1> ;pop eax 13927 00010865 E904C2FFFF <1> jmp error 13928 <1> passc_0: 13929 0001086A F6C202 <1> test dl, PTE_A_WRITE ; writable page 13930 0001086D 5A <1> pop edx 13931 0001086E 751C <1> jnz short passc_1 13932 <1> 13933 00010870 20D2 <1> and dl, dl 13934 00010872 7418 <1> jz short passc_1 13935 <1> ; read only (duplicated) page -must be copied to a new page- 13936 <1> ; EBX = linear address 13937 00010874 51 <1> push ecx 13938 00010875 E80753FFFF <1> call copy_page 13939 0001087A 59 <1> pop ecx 13940 0001087B 721E <1> jc short passc_2 13941 0001087D 50 <1> push eax ; physical address of the new/allocated page 13942 0001087E E88D53FFFF <1> call add_to_swap_queue 13943 00010883 58 <1> pop eax 13944 00010884 81E3FF0F0000 <1> and ebx, PAGE_OFF ; 0FFFh 13945 <1> ;mov ecx, PAGE_SIZE 13946 <1> ;sub ecx, ebx 13947 0001088A 01D8 <1> add eax, ebx 13948 <1> passc_1: 13949 0001088C A3[CC8E0100] <1> mov [u.pbase], eax ; physical address 13950 00010891 66890D[D08E0100] <1> mov [u.pcount], cx ; remain byte count in page (1-4096) 13951 00010898 5B <1> pop ebx 13952 00010899 58 <1> pop eax 13953 0001089A C3 <1> retn 13954 <1> passc_2: 13955 0001089B B804000000 <1> mov eax, ERR_MINOR_IM ; "Insufficient memory !" error 13956 000108A0 A3[6C8E0100] <1> mov [u.r0], eax ; 12/10/2016 13957 000108A5 A3[D88E0100] <1> mov [u.error], eax 13958 <1> ;pop ebx 13959 <1> ;pop eax 13960 000108AA E9BFC1FFFF <1> jmp error 13961 <1> 13962 <1> sioreg: 13963 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 13964 <1> ; 19/05/2015 - 25/07/2015 (Retro UNIX 386 v1) 13965 <1> ; 12/03/2013 - 22/07/2013 (Retro UNIX 8086 v1) 13966 <1> ; INPUTS -> 13967 <1> ; EBX = system buffer (data) address (r5) 13968 <1> ; [u.fofp] = pointer to file offset pointer 13969 <1> ; [u.base] = virtual address of the user buffer 13970 <1> ; [u.pbase] = physical address of the user buffer 13971 <1> ; [u.count] = byte count 13972 <1> ; [u.pcount] = byte count within page frame 13973 <1> ; OUTPUTS -> 13974 <1> ; ESI = user data offset (r1) 13975 <1> ; EDI = system (I/O) buffer offset (r2) 13976 <1> ; ECX = byte count (r3) 13977 <1> ; EAX = remain bytes after byte count within page frame 13978 <1> ; (If EAX > 0, transfer will continue from the next page) 13979 <1> ; 13980 <1> ; ((Modified registers: EDX)) 13981 <1> 13982 000108AF 8B35[808E0100] <1> mov esi, [u.fofp] 13983 000108B5 8B3E <1> mov edi, [esi] 13984 000108B7 89F9 <1> mov ecx, edi 13985 000108B9 81C900FEFFFF <1> or ecx, 0FFFFFE00h 13986 000108BF 81E7FF010000 <1> and edi, 1FFh 13987 000108C5 01DF <1> add edi, ebx ; EBX = system buffer (data) address 13988 000108C7 F7D9 <1> neg ecx 13989 000108C9 3B0D[948E0100] <1> cmp ecx, [u.count] 13990 000108CF 7606 <1> jna short sioreg_0 13991 000108D1 8B0D[948E0100] <1> mov ecx, [u.count] 13992 <1> sioreg_0: 13993 000108D7 803D[D28E0100]00 <1> cmp byte [u.kcall], 0 13994 000108DE 7613 <1> jna short sioreg_1 13995 <1> ; the caller is 'mkdir' or 'namei' 13996 000108E0 A1[908E0100] <1> mov eax, [u.base] 13997 000108E5 A3[CC8E0100] <1> mov [u.pbase], eax ; physical address = virtual address 13998 000108EA 66890D[D08E0100] <1> mov word [u.pcount], cx ; remain bytes in buffer (1 sector) 13999 000108F1 EB0B <1> jmp short sioreg_2 14000 <1> sioreg_1: 14001 000108F3 0FB715[D08E0100] <1> movzx edx, word [u.pcount] 14002 000108FA 39D1 <1> cmp ecx, edx 14003 000108FC 772A <1> ja short sioreg_4 ; transfer count > [u.pcount] 14004 <1> sioreg_2: ; 2: 14005 000108FE 31C0 <1> xor eax, eax 14006 <1> sioreg_3: 14007 00010900 010D[988E0100] <1> add [u.nread], ecx 14008 00010906 290D[948E0100] <1> sub [u.count], ecx 14009 0001090C 010D[908E0100] <1> add [u.base], ecx 14010 00010912 010E <1> add [esi], ecx 14011 00010914 8B35[CC8E0100] <1> mov esi, [u.pbase] 14012 0001091A 66290D[D08E0100] <1> sub [u.pcount], cx 14013 00010921 010D[CC8E0100] <1> add [u.pbase], ecx 14014 00010927 C3 <1> retn 14015 <1> sioreg_4: 14016 <1> ; transfer count > [u.pcount] 14017 <1> ; (ecx > edx) 14018 00010928 89C8 <1> mov eax, ecx 14019 0001092A 29D0 <1> sub eax, edx ; remain bytes for 1 sector (block) transfer 14020 0001092C 89D1 <1> mov ecx, edx ; current transfer count = [u.pcount] 14021 0001092E EBD0 <1> jmp short sioreg_3 14022 <1> 14023 <1> tswitch: ; Retro UNIX 386 v1 14024 <1> tswap: 14025 <1> ; 16/01/2017 14026 <1> ; 21/05/2016 - TRDOS 386 (TRDOS v2.0) 14027 <1> ; 10/05/2015 - 01/09/2015 (Retro UNIX 386 v1) 14028 <1> ; 14/04/2013 - 14/02/2014 (Retro UNIX 8086 v1) 14029 <1> ; time out swap, called when a user times out. 14030 <1> ; the user is put on the low priority queue. 14031 <1> ; This is done by making a link from the last user 14032 <1> ; on the low priority queue to him via a call to 'putlu'. 14033 <1> ; then he is swapped out. 14034 <1> 14035 <1> ; TRDOS 386 (TRDOS v2.0) modification -> ** 21/05/2016 ** 14036 <1> ; * when a high priority (event) process will be stopped 14037 <1> ; (swapped out, swithched out/off), 'tswap/tswitch' will 14038 <1> ; not add it to a run queue. 14039 <1> ; /// What for: Process may be already in a run queue, 14040 <1> ; it is unspeficied state because process might be started 14041 <1> ; by a timer event which does not regard previous priority 14042 <1> ; level and run queue of the process (for fast executing!). 14043 <1> ; After the 'run for event', process will be sequenced 14044 <1> ; to run by it's actual run queue. /// 14045 <1> ; 14046 <1> ; Retro UNIX 386 v1 modification -> 14047 <1> ; swap (software task switch) is performed by changing 14048 <1> ; user's page directory (u.pgdir) instead of segment change 14049 <1> ; as in Retro UNIX 8086 v1. 14050 <1> ; 14051 <1> ; RETRO UNIX 8086 v1 modification -> 14052 <1> ; 'swap to disk' is replaced with 'change running segment' 14053 <1> ; according to 8086 cpu (x86 real mode) architecture. 14054 <1> ; pdp-11 was using 64KB uniform memory while IBM PC 14055 <1> ; compatibles was using 1MB segmented memory 14056 <1> ; in 8086/8088 times. 14057 <1> ; 14058 <1> ; INPUTS -> 14059 <1> ; u.uno - users process number 14060 <1> ; runq+4 - lowest priority queue 14061 <1> ; OUTPUTS -> 14062 <1> ; r0 - users process number 14063 <1> ; r2 - lowest priority queue address 14064 <1> ; 14065 <1> ; ((AX = R0, BX = R2)) output 14066 <1> ; ((Modified registers: EDX, EBX, ECX, ESI, EDI)) 14067 <1> ; 14068 <1> 14069 <1> NOTE: 14070 <1> ;* [u.pri] priority level is specified by run queue which is process 14071 <1> ; comes to run from. 14072 <1> ;* Initial [u.pri] is 1 ('normal/regular') for programs 14073 <1> ; (which are launched by MainProg or 'sysexec'), it is changed 14074 <1> ; to 2 ('high') by timer event, if program uses 'systimer' system call. 14075 <1> ;* Program (Process) also can change it's running priority 14076 <1> ; from 1 to 0 or up to 2 by using 'syspri' system call; but, 14077 <1> ; if program selects priority level 2 (high) for running, next time 14078 <1> ; it is reduced to 1 (normal/regular) because 'syspri' adds this 14079 <1> ; program to 'run for normal' queue while running duration is a bit 14080 <1> ; protected from swap/switch out immediate, behalf of other high 14081 <1> ; priority process in sequence. Program (with high priority) will not 14082 <1> ; be swapped/switched out (by timer event) before it's time quantum 14083 <1> ; will be elapsed, but, this will be temporary if program is not using 14084 <1> ; timer event function. 14085 <1> 14086 <1> ;For example: 14087 <1> ;If a process frequently gets a timer event, it runs at high priority 14088 <1> ;level but when it returns from running it returns to actual run queue, 14089 <1> ;not to 'run for event' queue again. 14090 <1> ;'tswap' will not change the sequence at return/stop(swap out) stage. 14091 <1> ;But if priority level not high (=2, 'run for event'), 'tswap/tswitch' 14092 <1> ;will add the stopping process to relevant run queue according to 14093 <1> ;[u.pri] priority level. 14094 <1> 14095 <1> ; 16/01/2017 14096 00010930 BB[5C8E0100] <1> mov ebx, runq+2 ; 'runq_normal' ; normal/regular priority 14097 <1> ; 21/05/2016 14098 <1> ;cmp byte [u.pri], 2 ; high priority (run for event) ? 14099 <1> ;jnb short swap 14100 <1> ; 16/01/2017 14101 <1> ; (Normal and also high/event priority processes will be added to 14102 <1> ; normal priority run queue for ensuring circular running sequence!) 14103 <1> ; (Timer interrupt or 'syspri' system call may change priority and run 14104 <1> ; queue to high/event level.) 14105 00010935 803D[B68E0100]00 <1> cmp byte [u.pri], 0 14106 0001093C 7702 <1> ja short tswap_1 ; normal priority run queue 14107 <1> ; 14108 0001093E 43 <1> inc ebx 14109 0001093F 43 <1> inc ebx ; runq+4, 'runq_background', low priority 14110 <1> tswap_1: 14111 00010940 A0[BD8E0100] <1> mov al, [u.uno] 14112 <1> ; movb u.uno,r1 / move users process number to r1 14113 <1> ; mov $runq+4,r2 14114 <1> ; / move lowest priority queue address to r2 14115 <1> ; ebx = run queue 14116 00010945 E8FD000000 <1> call putlu 14117 <1> ; jsr r0,putlu / create link from last user on Q to 14118 <1> ; / u.uno's user 14119 <1> 14120 <1> switch: ; Retro UNIX 386 v1 14121 <1> swap: 14122 <1> ; 20/08/2024 14123 <1> ; 02/01/2017 14124 <1> ; 21/05/2016 14125 <1> ; 20/05/2016 14126 <1> ; 02/05/2016 14127 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 14128 <1> ; 10/05/2015 - 02/09/2015 (Retro UNIX 386 v1) 14129 <1> ; 14/04/2013 - 08/03/2014 (Retro UNIX 8086 v1) 14130 <1> ; 14131 <1> ; 'swap' is routine that controls the swapping of processes 14132 <1> ; in and out of core. 14133 <1> ; 14134 <1> ; TRDOS 386 (TRDOS v2.0) modification -> ** 20/05/2016 ** 14135 <1> ; * 3 different priority level is applied 14136 <1> ; (just as original unix v1) 14137 <1> ; 1) high priority (event) run queue, 'runq_event' 14138 <1> ; 2) normal priority (regular) run queue, 'runq_normal' 14139 <1> ; 3) low priority (background) run queue, 'runq_backgroud' 14140 <1> ; 'swap' code will run a process which has max. priority 14141 <1> ; (for earliest event at first) 14142 <1> ; 14143 <1> ; Retro UNIX 386 v1 modification -> 14144 <1> ; swap (software task switch) is performed by changing 14145 <1> ; user's page directory (u.pgdir) instead of segment change 14146 <1> ; as in Retro UNIX 8086 v1. 14147 <1> ; 14148 <1> ; RETRO UNIX 8086 v1 modification -> 14149 <1> ; 'swap to disk' is replaced with 'change running segment' 14150 <1> ; according to 8086 cpu (x86 real mode) architecture. 14151 <1> ; pdp-11 was using 64KB uniform memory while IBM PC 14152 <1> ; compatibles was using 1MB segmented memory 14153 <1> ; in 8086/8088 times. 14154 <1> ; 14155 <1> ; INPUTS -> 14156 <1> ; runq table - contains processes to run. 14157 <1> ; p.link - contains next process in line to be run. 14158 <1> ; u.uno - process number of process in core 14159 <1> ; s.stack - swap stack used as an internal stack for swapping. 14160 <1> ; OUTPUTS -> 14161 <1> ; (original unix v1 -> present process to its disk block) 14162 <1> ; (original unix v1 -> new process into core -> 14163 <1> ; Retro Unix 8086 v1 -> segment registers changed 14164 <1> ; for new process) 14165 <1> ; u.quant = 3 (Time quantum for a process) 14166 <1> ; ((INT 1Ch count down speed -> 18.2 times per second) 14167 <1> ; RETRO UNIX 8086 v1 will use INT 1Ch (18.2 times per second) 14168 <1> ; for now, it will swap the process if there is not 14169 <1> ; a keyboard event (keystroke) (Int 15h, function 4Fh) 14170 <1> ; or will count down from 3 to 0 even if there is a 14171 <1> ; keyboard event locking due to repetitive key strokes. 14172 <1> ; u.quant will be reset to 3 for RETRO UNIX 8086 v1. 14173 <1> ; 14174 <1> ; ((Modified registers: EAX, EDX, EBX, ECX, ESI, EDI)) 14175 <1> 14176 <1> ;NOTE: 14177 <1> ;High priority queue is the first for selecting a process to run. 14178 <1> ;If there is not a process in high priority level run queue, 14179 <1> ;a process in normal priority run queue will be selected 14180 <1> ;or a proces in low priority run queue will be selected if normal 14181 <1> ;priority level run queue is empty. 14182 <1> 14183 <1> ; 21/05/2016 -(3 priority levels, 3 run queues) 14184 0001094A BE[5A8E0100] <1> mov esi, runq ; 'runq_event' ; high priority, 'run for event' 14185 0001094F C605[44830100]03 <1> mov byte [priority], 3 ; high priority + 1 14186 00010956 31DB <1> xor ebx, ebx ; 02/01/2017 14187 <1> swap_0: ; 1: / search runq table for highest priority process 14188 00010958 66AD <1> lodsw ; mov ax, [esi], add esi+2 14189 <1> ;xor ebx, ebx ; 02/05/2016 14190 0001095A 6621C0 <1> and ax, ax ; are there any processes to run in this Q entry 14191 0001095D 750E <1> jnz short swap_2 14192 <1> ; 21/05/2026 14193 <1> ; runq_normal = runq+2, runq_background = runq+4 14194 0001095F FE0D[44830100] <1> dec byte [priority] ; 3 -> 3, 2 -> 1, 1-> 0 14195 00010965 75F1 <1> jnz short swap_0 14196 <1> ;cmp esi, runq+6 ; if zero compare address to end of table 14197 <1> ;jb short swap_0 ; if not at end, go back 14198 <1> swap_1: 14199 <1> ; 02/05/2016 14200 <1> ; 29/04/2016 (TRDOS 386 = TRDOS v2.0) 14201 <1> ; No user process to run... 14202 <1> ; Run the kernel process... MainProg: Internal Command Interpreter 14203 00010967 FEC0 <1> inc al ; mov al, 1 ; process number of MainProg 14204 00010969 FEC3 <1> inc bl ; mov bl, al ; 1 14205 0001096B EB1D <1> jmp short swap_4 14206 <1> swap_2: 14207 <1> ; 21/05/2016 14208 0001096D FE0D[44830100] <1> dec byte [priority] ; priority level of present user/process 14209 <1> ; 0, 1, 2 14210 00010973 4E <1> dec esi 14211 00010974 4E <1> dec esi 14212 <1> ; 14213 00010975 88C3 <1> mov bl, al 14214 00010977 38E0 <1> cmp al, ah ; is there only 1 process in the queue to be run 14215 00010979 740A <1> je short swap_3 ; yes 14216 0001097B 8AA3[8F8D0100] <1> mov ah, [ebx+p.link-1] 14217 00010981 8826 <1> mov [esi], ah ; move next process in line into run queue 14218 00010983 EB05 <1> jmp short swap_4 14219 <1> swap_3: 14220 <1> ;xor dx, dx 14221 <1> ; 20/08/2024 14222 00010985 31D2 <1> xor edx, edx 14223 00010987 668916 <1> mov [esi], dx ; zero the entry; no processes on the Q 14224 <1> swap_4: 14225 0001098A 8A25[BD8E0100] <1> mov ah, [u.uno] 14226 00010990 38C4 <1> cmp ah, al ; is this process the same as the process in core? 14227 00010992 743B <1> je short swap_8 ; yes, don't have to swap 14228 00010994 08E4 <1> or ah, ah ; is the process # = 0 14229 00010996 740D <1> jz short swap_6 ; 'sysexit' 14230 <1> ;cmp ah, al ; is this process the same as the process in core? 14231 <1> ;je short swap_8 ; yes, don't have to swap 14232 00010998 8925[688E0100] <1> mov [u.usp], esp ; return address for 'syswait' & 'sleep' 14233 0001099E E834000000 <1> call wswap ; write out core to disk 14234 000109A3 EB1C <1> jmp short swap_7 14235 <1> swap_6: 14236 <1> ; Deallocate memory pages belong to the process 14237 <1> ; which is being terminated. 14238 <1> ; (Retro UNIX 386 v1 modification !) 14239 <1> ; 14240 000109A5 53 <1> push ebx 14241 000109A6 A1[C48E0100] <1> mov eax, [u.pgdir] ; page directory of the process 14242 000109AB 8B1D[C88E0100] <1> mov ebx, [u.ppgdir] ; page directory of the parent process 14243 000109B1 E8A44FFFFF <1> call deallocate_page_dir 14244 000109B6 A1[C08E0100] <1> mov eax, [u.upage] ; 'user' structure page of the process 14245 000109BB E82950FFFF <1> call deallocate_page 14246 000109C0 5B <1> pop ebx 14247 <1> swap_7: 14248 000109C1 C0E302 <1> shl bl, 2 ; * 4 14249 <1> ;;; 14250 000109C4 8B83[AC8D0100] <1> mov eax, [ebx+p.upage-4] ; the 'u' page of the new process 14251 000109CA E840000000 <1> call rswap ; read new process into core 14252 <1> swap_8: 14253 <1> ; Retro UNIX 8086 v1 modification ! 14254 000109CF C605[B48E0100]04 <1> mov byte [u.quant], time_count 14255 000109D6 C3 <1> retn 14256 <1> 14257 <1> wswap: ; < swap out, swap to disk > 14258 <1> ; 28/02/2017 (fnsave) 14259 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 14260 <1> ; 09/05/2015 (Retro UNIX 386 v1) 14261 <1> ; 26/05/2013 - 08/03/2014 (Retro UNIX 8086 v1) 14262 <1> ; 'wswap' writes out the process that is in core onto its 14263 <1> ; appropriate disk area. 14264 <1> ; 14265 <1> ; Retro UNIX 386 v1 modification -> 14266 <1> ; User (u) structure content and the user's register content 14267 <1> ; will be copied to the process's/user's UPAGE (a page for 14268 <1> ; saving 'u' structure and user registers for task switching). 14269 <1> ; u.usp - points to kernel stack address which contains 14270 <1> ; user's registers while entering system call. 14271 <1> ; u.sp - points to kernel stack address 14272 <1> ; to return from system call -for IRET-. 14273 <1> ; [u.usp]+32+16 = [u.sp] 14274 <1> ; [u.usp] -> edi, esi, ebp, esp (= [u.usp]+32), ebx, 14275 <1> ; edx, ecx, eax, gs, fs, es, ds, -> [u.sp]. 14276 <1> ; 14277 <1> ; Retro UNIX 8086 v1 modification -> 14278 <1> ; 'swap to disk' is replaced with 'change running segment' 14279 <1> ; according to 8086 cpu (x86 real mode) architecture. 14280 <1> ; pdp-11 was using 64KB uniform memory while IBM PC 14281 <1> ; compatibles was using 1MB segmented memory 14282 <1> ; in 8086/8088 times. 14283 <1> ; 14284 <1> ; INPUTS -> 14285 <1> ; u.break - points to end of program 14286 <1> ; u.usp - stack pointer at the moment of swap 14287 <1> ; core - beginning of process program 14288 <1> ; ecore - end of core 14289 <1> ; user - start of user parameter area 14290 <1> ; u.uno - user process number 14291 <1> ; p.dska - holds block number of process 14292 <1> ; OUTPUTS -> 14293 <1> ; swp I/O queue 14294 <1> ; p.break - negative word count of process 14295 <1> ; r1 - process disk address 14296 <1> ; r2 - negative word count 14297 <1> ; 14298 <1> ; RETRO UNIX 8086 v1 input/output: 14299 <1> ; 14300 <1> ; INPUTS -> 14301 <1> ; u.uno - process number (to be swapped out) 14302 <1> ; OUTPUTS -> 14303 <1> ; none 14304 <1> ; 14305 <1> ; ((Modified registers: ECX, ESI, EDI)) 14306 <1> ; 14307 <1> 14308 <1> ; 28/02/2017 14309 <1> ;cmp byte [multi_tasking], 0 ; Musti tasking mode ? 14310 <1> ;jna short wswp 14311 000109D7 803D[EB8E0100]00 <1> cmp byte [u.fpsave], 0 ; 28/02/2017 14312 000109DE 7606 <1> jna short wswp 14313 000109E0 DD35[EC8E0100] <1> fnsave [u.fpregs] ; save floating point registers (94 bytes) 14314 <1> wswp: 14315 000109E6 8B3D[C08E0100] <1> mov edi, [u.upage] ; process's user (u) structure page addr 14316 000109EC B93D000000 <1> mov ecx, (U_SIZE + 3) / 4 14317 000109F1 BE[648E0100] <1> mov esi, user ; active user (u) structure 14318 000109F6 F3A5 <1> rep movsd 14319 <1> ; 14320 000109F8 8B35[688E0100] <1> mov esi, [u.usp] ; esp (system stack pointer, 14321 <1> ; points to user registers) 14322 000109FE 8B0D[648E0100] <1> mov ecx, [u.sp] ; return address from the system call 14323 <1> ; (for IRET) 14324 <1> ; [u.sp] -> EIP (user) 14325 <1> ; [u.sp+4]-> CS (user) 14326 <1> ; [u.sp+8] -> EFLAGS (user) 14327 <1> ; [u.sp+12] -> ESP (user) 14328 <1> ; [u.sp+16] -> SS (user) 14329 00010A04 29F1 <1> sub ecx, esi ; required space for user registers 14330 00010A06 83C114 <1> add ecx, 20 ; +5 dwords to return from system call 14331 <1> ; (for IRET) 14332 00010A09 C1E902 <1> shr ecx, 2 14333 00010A0C F3A5 <1> rep movsd 14334 00010A0E C3 <1> retn 14335 <1> 14336 <1> rswap: ; < swap in, swap from disk > 14337 <1> ; 28/02/2017 (frstor) 14338 <1> ; 15/01/2017 14339 <1> ; 14/01/2017 14340 <1> ; 21/05/2016 14341 <1> ; 03/05/2016 14342 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 14343 <1> ; 09/05/2015 - 15/09/2015 (Retro UNIX 386 v1) 14344 <1> ; 26/05/2013 - 08/03/2014 (Retro UNIX 8086 v1) 14345 <1> ; 'rswap' reads a process whose number is in r1, 14346 <1> ; from disk into core. 14347 <1> ; 14348 <1> ; Retro UNIX 386 v1 modification -> 14349 <1> ; User (u) structure content and the user's register content 14350 <1> ; will be restored from process's/user's UPAGE (a page for 14351 <1> ; saving 'u' structure and user registers for task switching). 14352 <1> ; u.usp - points to kernel stack address which contains 14353 <1> ; user's registers while entering system call. 14354 <1> ; u.sp - points to kernel stack address 14355 <1> ; to return from system call -for IRET-. 14356 <1> ; [u.usp]+32+16 = [u.sp] 14357 <1> ; [u.usp] -> edi, esi, ebp, esp (= [u.usp]+32), ebx, 14358 <1> ; edx, ecx, eax, gs, fs, es, ds, -> [u.sp]. 14359 <1> ; 14360 <1> ; RETRO UNIX 8086 v1 modification -> 14361 <1> ; 'swap to disk' is replaced with 'change running segment' 14362 <1> ; according to 8086 cpu (x86 real mode) architecture. 14363 <1> ; pdp-11 was using 64KB uniform memory while IBM PC 14364 <1> ; compatibles was using 1MB segmented memory 14365 <1> ; in 8086/8088 times. 14366 <1> ; 14367 <1> ; INPUTS -> 14368 <1> ; r1 - process number of process to be read in 14369 <1> ; p.break - negative of word count of process 14370 <1> ; p.dska - disk address of the process 14371 <1> ; u.emt - determines handling of emt's 14372 <1> ; u.ilgins - determines handling of illegal instructions 14373 <1> ; OUTPUTS -> 14374 <1> ; 8 = (u.ilgins) 14375 <1> ; 24 = (u.emt) 14376 <1> ; swp - bit 10 is set to indicate read 14377 <1> ; (bit 15=0 when reading is done) 14378 <1> ; swp+2 - disk block address 14379 <1> ; swp+4 - negative word count 14380 <1> ; ((swp+6 - address of user structure)) 14381 <1> ; 14382 <1> ; RETRO UNIX 8086 v1 input/output: 14383 <1> ; 14384 <1> ; INPUTS -> 14385 <1> ; AL - new process number (to be swapped in) 14386 <1> ; OUTPUTS -> 14387 <1> ; none 14388 <1> ; 14389 <1> ; ((Modified registers: EAX, ECX, ESI, EDI, ESP)) 14390 <1> ; 14391 <1> ; Retro UNIX 386 v1 - modification ! 14/05/2015 14392 00010A0F 89C6 <1> mov esi, eax ; process's user (u) structure page addr 14393 00010A11 B93D000000 <1> mov ecx, (U_SIZE + 3) / 4 14394 00010A16 BF[648E0100] <1> mov edi, user ; active user (u) structure 14395 00010A1B F3A5 <1> rep movsd 14396 00010A1D 58 <1> pop eax ; 'rswap' return address 14397 <1> ; 14398 <1> ;cli 14399 00010A1E 8B3D[688E0100] <1> mov edi, [u.usp] ; esp (system stack pointer, 14400 <1> ; points to user registers) 14401 00010A24 89FC <1> mov esp, edi ; 14/01/2017 14402 00010A26 8B0D[648E0100] <1> mov ecx, [u.sp] ; return address from the system call 14403 <1> ; (for IRET) 14404 <1> ; [u.sp] -> EIP (user) 14405 <1> ; [u.sp+4]-> CS (user) 14406 <1> ; [u.sp+8] -> EFLAGS (user) 14407 <1> ; [u.sp+12] -> ESP (user) 14408 <1> ; [u.sp+16] -> SS (user) 14409 00010A2C 29F9 <1> sub ecx, edi ; required space for user registers 14410 00010A2E 83C114 <1> add ecx, 20 ; +5 dwords to return from system call 14411 <1> ; (for IRET) 14412 00010A31 C1E902 <1> shr ecx, 2 14413 00010A34 F3A5 <1> rep movsd 14414 <1> ;mov esp, [u.usp] ; 15/09/2015 14415 <1> ;sti 14416 <1> ; 28/02/2017 14417 <1> ;cmp byte [multi_tasking], 0 ; Multi tasking mode ? 14418 <1> ;jna short rswp_retn 14419 00010A36 803D[EB8E0100]00 <1> cmp byte [u.fpsave], 0 14420 00010A3D 7606 <1> jna short rswp_retn 14421 00010A3F DD25[EC8E0100] <1> frstor [u.fpregs] ; restore floating point regs (94 bytes) 14422 <1> ; 108 bytes (22/08/2024) 14423 <1> rswp_retn: 14424 00010A45 50 <1> push eax ; 'rswap' return address 14425 00010A46 C3 <1> retn 14426 <1> 14427 <1> putlu: 14428 <1> ; 20/05/2016 14429 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 14430 <1> ; 10/05/2015 - 12/09/2015 (Retro UNIX 386 v1) 14431 <1> ; 15/04/2013 - 23/02/2014 (Retro UNIX 8086 v1) 14432 <1> ; 'putlu' is called with a process number in r1 and a pointer 14433 <1> ; to lowest priority Q (runq+4) in r2. A link is created from 14434 <1> ; the last process on the queue to process in r1 by putting 14435 <1> ; the process number in r1 into the last process's link. 14436 <1> ; 14437 <1> ; INPUTS -> 14438 <1> ; r1 - user process number 14439 <1> ; r2 - points to lowest priority queue 14440 <1> ; p.dska - disk address of the process 14441 <1> ; u.emt - determines handling of emt's 14442 <1> ; u.ilgins - determines handling of illegal instructions 14443 <1> ; OUTPUTS -> 14444 <1> ; r3 - process number of last process on the queue upon 14445 <1> ; entering putlu 14446 <1> ; p.link-1 + r3 - process number in r1 14447 <1> ; r2 - points to lowest priority queue 14448 <1> ; 14449 <1> ; ((Modified registers: EDX, EBX)) 14450 <1> ; 14451 <1> ; / r1 = user process no.; r2 points to lowest priority queue 14452 <1> 14453 <1> ; EBX = r2 14454 <1> ; EAX = r1 (AL=r1b) 14455 <1> 14456 <1> ; 20/05/2016 14457 <1> ; AL = process number (1 to 16) // Retro UNIX 8086, 386 v1 // 14458 <1> ; (max. 16 processes available for current kernel version) 14459 <1> ; EBX = run queue address ; 20/05/2016 (TRDOS 386) 14460 <1> ; which is one of following addresses: 14461 <1> ; 1) 'runq_event' high priority run queue 14462 <1> ; 2) 'runq_normal' normal/regular priority run queue 14463 <1> ; 3) 'runq_background' low priority run queue 14464 <1> 14465 <1> ;mov ebx, runq 14466 00010A47 0FB613 <1> movzx edx, byte [ebx] 14467 00010A4A 43 <1> inc ebx 14468 00010A4B 20D2 <1> and dl, dl 14469 <1> ; tstb (r2)+ / is queue empty? 14470 00010A4D 740A <1> jz short putlu_1 14471 <1> ; beq 1f / yes, branch 14472 00010A4F 8A13 <1> mov dl, [ebx] ; 12/09/2015 14473 <1> ; movb (r2),r3 / no, save the "last user" process number 14474 <1> ; / in r3 14475 00010A51 8882[8F8D0100] <1> mov [edx+p.link-1], al 14476 <1> ; movb r1,p.link-1(r3) / put pointer to user on 14477 <1> ; / "last users" link 14478 00010A57 EB03 <1> jmp short putlu_2 14479 <1> ; br 2f / 14480 <1> putlu_1: ; 1: 14481 00010A59 8843FF <1> mov [ebx-1], al 14482 <1> ; movb r1,-1(r2) / user is only user; 14483 <1> ; / put process no. at beginning and at end 14484 <1> putlu_2: ; 2: 14485 00010A5C 8803 <1> mov [ebx], al 14486 <1> ; movb r1,(r2) / user process in r1 is now the last entry 14487 <1> ; / on the queue 14488 00010A5E 88C2 <1> mov dl, al 14489 00010A60 88B2[8F8D0100] <1> mov [edx+p.link-1], dh ; 0 14490 <1> ; dec r2 / restore r2 14491 00010A66 C3 <1> retn 14492 <1> ; rts r0 14493 <1> 14494 <1> sysver: 14495 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 14496 00010A67 C705[6C8E0100]0002- <1> mov dword [u.r0], 200h ; AH = major version, AL = minor version 14496 00010A6F 0000 <1> 14497 00010A71 E918C0FFFF <1> jmp sysret 14498 <1> 14499 <1> syspri: ; change running priority (of the process) 14500 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 14501 <1> ; 21/05/2016 14502 <1> ; 20/05/2026 - TRDOS 386 (TRDOS v2.0) 14503 <1> ; INPUT -> 14504 <1> ; BL = priority level 14505 <1> ; 0 = low running priority (running on background) 14506 <1> ; 1 = normal/regular priority (running as regular) 14507 <1> ; 2 = high/event priority (running for event) 14508 <1> ; >2 = invalid, it will accepted as 2 (event) 14509 <1> ; 0FFh = get/return current running priority only 14510 <1> ; OUTPUT -> 14511 <1> ; * if current [u.pri] < 2 14512 <1> ; if BL input < 0FFh -> 14513 <1> ; [u.pri] is updated as in BL input (0,1,2) 14514 <1> ; if BL input = 0FFh -> AL = [u.pri] (current) 14515 <1> ; 14516 <1> ; * if current [u.pri] = 2 14517 <1> ; if BL input < 0FFh -> cf = 1 & AL = 2 14518 <1> ; if BL input = 0FFh -> cf = 0 & AL = 2 14519 <1> ; 14520 <1> ; NOTE: 14521 <1> ; If [u.pri] = 2, it can not be changed to 1 or 0; 14522 <1> ; because, run queue of the running process is unspecified 14523 <1> ; at this stage. Process might be started by a timer event 14524 <1> ; or priority might be changed to high by previous 14525 <1> ; 'syspri' system call. In both cases, the process is in 14526 <1> ; 'runq_normal' or 'runq_background' queue. 14527 <1> ; As result of this fact, when the [u.quant] time quantum 14528 <1> ; of the process is elapsed or 'sysrele' system call is 14529 <1> ; instructed by the process, 'tswap' ('tswitch') procedure 14530 <1> ; will be called (to 'swap' or 'switch' out the procedure) 14531 <1> ; and it will not call 'putlu' to add the (stopping) 14532 <1> ; process to relevant run queue when [u.pri] = 2. 14533 <1> ; (Otherwise, it would be possible to add process to 14534 <1> ; a run queue while it is already in a run queue, wrongly.) 14535 <1> ; 14536 <1> ; If [u.pri]< 2, 'tswap/tswitch' procedure will call 14537 <1> ; 'putlu' to add process to relevant run queue 14538 <1> ; according to [u.pri] value. ('runq_normal' for 1, 14539 <1> ; 'runq_background' for 0). 14540 <1> ; 14541 <1> ; If BL input >= 2 and < 0FFh while [u.pri] < 2, 14542 <1> ; process will be added to 'runq_normal' queue and 14543 <1> ; [u.pri] will be set to 2. (in 'syspri' system call) 14544 <1> ; 14545 <1> 14546 00010A76 29C0 <1> sub eax, eax ; 0 14547 00010A78 A3[D88E0100] <1> mov [u.error], eax 14548 <1> 14549 00010A7D A0[B68E0100] <1> mov al, [u.pri] 14550 00010A82 A3[6C8E0100] <1> mov [u.r0], eax 14551 <1> 14552 00010A87 FEC3 <1> inc bl 14553 <1> ;jz sysret ; 0FFh -> 0, get priority level 14554 <1> ; 23/07/2022 14555 00010A89 742C <1> jz short syspri_2 ; jmp sysret 14556 <1> 14557 00010A8B 3C02 <1> cmp al, 2 14558 <1> ;jnb error ; CF = 1 & AL = 2 (& last error = 0) 14559 <1> ; 23/07/2022 14560 00010A8D 7205 <1> jb short syspri_0 14561 00010A8F E9DABFFFFF <1> jmp error 14562 <1> syspri_0: 14563 00010A94 FECB <1> dec bl 14564 00010A96 80FB02 <1> cmp bl, 2 14565 00010A99 7602 <1> jna short syspri_1 14566 00010A9B B302 <1> mov bl, 2 14567 <1> syspri_1: 14568 00010A9D 881D[B68E0100] <1> mov [u.pri], bl 14569 00010AA3 80FB02 <1> cmp bl, 2 14570 <1> ;jb sysret 14571 <1> ; 23/07/2022 14572 00010AA6 720F <1> jb short syspri_2 ; jmp sysret 14573 <1> 14574 <1> ; here... 14575 <1> ; Priority of current process has been changed to high 14576 <1> ; ('run for event') but current process will be added to 14577 <1> ; 'run as normal' queue. ('run for event' high priority 14578 <1> ; queue is under control of timer -& RTC- interrupt only!) 14579 <1> ; 14580 <1> ; (Otherwise, process can fall into black hole! 14581 <1> ; e.g. if it is not in waiting list and it has not got 14582 <1> ; a timer event and it is not in a run queue! 14583 <1> ; Because, when [u.pri] is 2, 'tswap/tswitch' will not 14584 <1> ; add the stopping process to a run queue.) 14585 <1> 14586 00010AA8 A0[BD8E0100] <1> mov al, [u.uno] 14587 00010AAD BB[5C8E0100] <1> mov ebx, runq_normal ; normal priority ! 14588 <1> ; [u.pri] is set to high 14589 <1> ; but 'runq_event' queue is set 14590 <1> ; only by the kernel's timer 14591 <1> ; event function (timer interrupt). 14592 00010AB2 E890FFFFFF <1> call putlu 14593 <1> syspri_2: 14594 00010AB7 E9D2BFFFFF <1> jmp sysret 14595 <1> 14596 <1> cpass: ; / get next character from user area of core and put it in AL (r1) 14597 <1> ; 30/07/2022 - TRDOS 386 Kernel v2.0.5 14598 <1> ; 02/05/2016 - TRDOS 386 (TRDOS v2.0) 14599 <1> ; 19/05/2015 - 18/10/2015 (Retro UNIX 386 v1) 14600 <1> ; 14/08/2013 - 20/09/2013 (Retro UNIX 8086 v1) 14601 <1> ; INPUTS -> 14602 <1> ; [u.base] = virtual address in user area 14603 <1> ; [u.count] = byte count (max.) 14604 <1> ; [u.pcount] = byte count in page (0 = reset) 14605 <1> ; OUTPUTS -> 14606 <1> ; AL = the character which is pointed by [u.base] 14607 <1> ; zf = 1 -> transfer count has been completed 14608 <1> ; 14609 <1> ; ((Modified registers: EAX, EDX, ECX)) 14610 <1> 14611 <1> ; 30/07/2022 14612 00010ABC 29C0 <1> sub eax, eax 14613 <1> 14614 00010ABE 3905[948E0100] <1> cmp [u.count], eax ; 0 14615 <1> ;cmp dword [u.count], 0 ; have all the characters been transferred 14616 <1> ; i.e., u.count, # of chars. left 14617 00010AC4 763D <1> jna short cpass_3 ; to be transferred = 0?) yes, branch 14618 00010AC6 FF0D[948E0100] <1> dec dword [u.count] ; no, decrement u.count 14619 <1> ; 19/05/2015 14620 <1> ;(Retro UNIX 386 v1 - translation from user's virtual address 14621 <1> ; to physical address 14622 <1> ; 30/07/2022 14623 00010ACC 663905[D08E0100] <1> cmp [u.pcount], ax ; 0 14624 <1> ;cmp word [u.pcount], 0 ; byte count in page = 0 (initial value) 14625 <1> ; 1-4095 --> use previous physical base address 14626 <1> ; in [u.pbase] 14627 00010AD3 770D <1> ja short cpass_1 14628 <1> ; 30/07/2022 14629 00010AD5 3905[C88E0100] <1> cmp [u.ppgdir], eax ; 0 14630 <1> ;cmp dword [u.ppgdir], 0 ; is the caller os kernel 14631 00010ADB 7427 <1> je short cpass_k ; (sysexec, '/etc/init') ? (MainProg) 14632 00010ADD E861FDFFFF <1> call trans_addr_r 14633 <1> cpass_1: 14634 00010AE2 66FF0D[D08E0100] <1> dec word [u.pcount] 14635 <1> cpass_2: 14636 00010AE9 8B15[CC8E0100] <1> mov edx, [u.pbase] 14637 00010AEF 8A02 <1> mov al, [edx] ; take the character pointed to 14638 <1> ; by u.base and put it in r1 14639 00010AF1 FF05[988E0100] <1> inc dword [u.nread] ; increment no. of bytes transferred 14640 00010AF7 FF05[908E0100] <1> inc dword [u.base] ; increment the buffer address to point to the 14641 <1> ; next byte 14642 00010AFD FF05[CC8E0100] <1> inc dword [u.pbase] 14643 <1> cpass_3: 14644 00010B03 C3 <1> retn 14645 <1> cpass_k: 14646 <1> ; 02/07/2015 14647 <1> ; The caller is os kernel 14648 <1> ; (get sysexec arguments from kernel's memory space) 14649 00010B04 8B1D[908E0100] <1> mov ebx, [u.base] 14650 00010B0A 66C705[D08E0100]00- <1> mov word [u.pcount], PAGE_SIZE ; 4096 14650 00010B12 10 <1> 14651 00010B13 891D[CC8E0100] <1> mov [u.pbase], ebx 14652 00010B19 EBCE <1> jmp short cpass_2 14653 <1> 14654 <1> transfer_to_user_buffer: ; fast transfer 14655 <1> ; 27/05/2016 14656 <1> ; 16/05/2016 - TRDOS 386 (TRDOS v2.0) 14657 <1> ; 14658 <1> ; INPUT -> 14659 <1> ; ESI = source address in system space 14660 <1> ; EDI = user's buffer address 14661 <1> ; ECX = transfer (byte) count 14662 <1> ; [u.pgdir] = user's page directory 14663 <1> ; OUTPUT -> 14664 <1> ; ECX = actual transfer count 14665 <1> ; cf = 1 -> error 14666 <1> ; [u.count] = remain byte count 14667 <1> ; 14668 <1> ; Modified registers: eax, ecx 14669 <1> ; 14670 <1> 14671 00010B1B 21C9 <1> and ecx, ecx 14672 00010B1D 743B <1> jz short ttub_4 14673 <1> 14674 00010B1F 890D[948E0100] <1> mov [u.count], ecx 14675 <1> 14676 00010B25 57 <1> push edi 14677 00010B26 56 <1> push esi 14678 00010B27 53 <1> push ebx 14679 00010B28 52 <1> push edx 14680 00010B29 51 <1> push ecx 14681 <1> 14682 00010B2A 89FB <1> mov ebx, edi 14683 00010B2C 81C300004000 <1> add ebx, CORE ; 27/05/2016 14684 <1> ttub_1: 14685 <1> ; ebx = virtual (linear) address 14686 <1> ; [u.pgdir] = user's page directory 14687 00010B32 E8DF50FFFF <1> call get_physical_addr_x ; get physical address 14688 00010B37 7222 <1> jc short ttub_5 14689 <1> ; eax = physical address 14690 <1> ; ecx = remain byte count in page (1-4096) 14691 00010B39 89C7 <1> mov edi, eax 14692 00010B3B A1[948E0100] <1> mov eax, [u.count] 14693 00010B40 39C1 <1> cmp ecx, eax 14694 00010B42 7602 <1> jna short ttub_2 14695 00010B44 89C1 <1> mov ecx, eax 14696 <1> ttub_2: 14697 00010B46 29C8 <1> sub eax, ecx 14698 00010B48 01CB <1> add ebx, ecx 14699 00010B4A F3A4 <1> rep movsb 14700 00010B4C A3[948E0100] <1> mov [u.count], eax 14701 00010B51 09C0 <1> or eax, eax 14702 00010B53 75DD <1> jnz short ttub_1 14703 <1> ttub_retn: 14704 <1> tfub_retn: 14705 00010B55 59 <1> pop ecx ; transfer count = actual transfer count 14706 <1> ttub_3: 14707 00010B56 5A <1> pop edx 14708 00010B57 5B <1> pop ebx 14709 00010B58 5E <1> pop esi 14710 00010B59 5F <1> pop edi 14711 <1> ttub_4: 14712 00010B5A C3 <1> retn 14713 <1> ttub_5: 14714 00010B5B 59 <1> pop ecx 14715 00010B5C 2B0D[948E0100] <1> sub ecx, [u.count] ; actual transfer count 14716 00010B62 F9 <1> stc 14717 00010B63 EBF1 <1> jmp short ttub_3 14718 <1> 14719 <1> transfer_from_user_buffer: ; fast transfer 14720 <1> ; 27/05/2016 14721 <1> ; 16/05/2016 - TRDOS 386 (TRDOS v2.0) 14722 <1> ; 14723 <1> ; INPUT -> 14724 <1> ; ESI = user's buffer address 14725 <1> ; EDI = destination address in system space 14726 <1> ; ECX = transfer (byte) count 14727 <1> ; [u.pgdir] = user's page directory 14728 <1> ; OUTPUT -> 14729 <1> ; ecx = actual transfer count 14730 <1> ; cf = 1 -> error 14731 <1> ; [u.count] = remain byte count 14732 <1> ; 14733 <1> ; Modified registers: eax, ecx 14734 <1> ; 14735 <1> 14736 00010B65 21C9 <1> and ecx, ecx 14737 <1> ;jz short tfub_4 14738 00010B67 74F1 <1> jz short ttub_4 14739 <1> 14740 00010B69 890D[948E0100] <1> mov [u.count], ecx 14741 <1> 14742 00010B6F 57 <1> push edi 14743 00010B70 56 <1> push esi 14744 00010B71 53 <1> push ebx 14745 00010B72 52 <1> push edx 14746 00010B73 51 <1> push ecx 14747 <1> 14748 00010B74 89F3 <1> mov ebx, esi 14749 00010B76 81C300004000 <1> add ebx, CORE ; 27/05/2016 14750 <1> tfub_1: 14751 <1> ; ebx = virtual (linear) address 14752 <1> ; [u.pgdir] = user's page directory 14753 00010B7C E89550FFFF <1> call get_physical_addr_x ; get physical address 14754 <1> ;jc short tfub_5 14755 00010B81 72D8 <1> jc short ttub_5 14756 <1> ; eax = physical address 14757 <1> ; ecx = remain byte count in page (1-4096) 14758 00010B83 89C6 <1> mov esi, eax 14759 00010B85 A1[948E0100] <1> mov eax, [u.count] 14760 00010B8A 39C1 <1> cmp ecx, eax 14761 00010B8C 7602 <1> jna short tfub_2 14762 00010B8E 89C1 <1> mov ecx, eax 14763 <1> tfub_2: 14764 00010B90 29C8 <1> sub eax, ecx 14765 00010B92 01CB <1> add ebx, ecx 14766 00010B94 F3A4 <1> rep movsb 14767 00010B96 A3[948E0100] <1> mov [u.count], eax 14768 00010B9B 09C0 <1> or eax, eax 14769 00010B9D 75DD <1> jnz short tfub_1 14770 <1> 14771 00010B9F EBB4 <1> jmp short tfub_retn 14772 <1> 14773 <1> ;tfub_retn: 14774 <1> ; pop ecx ; transfer count = actual transfer count 14775 <1> ;tfub_3: 14776 <1> ; pop edx 14777 <1> ; pop ebx 14778 <1> ; pop esi 14779 <1> ; pop edi 14780 <1> ;tfub_4: 14781 <1> ; retn 14782 <1> ;tfub_5: 14783 <1> ; pop ecx 14784 <1> ; sub ecx, [u.count] ; actual transfer count 14785 <1> ; stc 14786 <1> ; jmp short tfub_3 14787 <1> 14788 <1> sysfff: ; 14789 <1> ; 25/08/2024 (TRDOS 386 Kernel v2.0.9) 14790 <1> ; 08/08/2022 14791 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 14792 <1> ; 17/10/2016 14793 <1> ; 16/10/2016 14794 <1> ; 15/10/2016 TRDOS 386 (TRDOS v2.0) feature only ! 14795 <1> ; -derived from TRDOS v1.0, INT_21H.ASM- 14796 <1> ; ("loc_INT21h_find_first_file") 14797 <1> ; TRDOS 8086 (v1.0) 14798 <1> ; 07/08/2011 14799 <1> ; Find First File 14800 <1> ; INPUT: 14801 <1> ; CX= Attributes 14802 <1> ; DS:DX= Pointer to filename 14803 <1> ; MSDOS OUTPUT: 14804 <1> ; DTA: (Default address: PSP offset 80h) 14805 <1> ; Offset Descrription 14806 <1> ; 0 Reserved for use find next file 14807 <1> ; 21 Attribute of file found 14808 <1> ; 22 Time stamp of file 14809 <1> ; 24 Date stamp of file 14810 <1> ; 26 File size in bytes 14811 <1> ; 30 Filename and extension (zero terminated) 14812 <1> ; If cf = 1: 14813 <1> ; Error Codes: (in AX) 14814 <1> ; 2 - File not found 14815 <1> ; 18 - No more files 14816 <1> ; 14817 <1> ; TRDOS 386 (v2.0) 14818 <1> ; 15/10/2016 14819 <1> ; 14820 <1> ; INPUT -> 14821 <1> ; CL = File attributes 14822 <1> ; bit 0 (1) - Read only file (R) 14823 <1> ; bit 1 (1) - Hidden file (H) 14824 <1> ; bit 2 (1) - System file (R) 14825 <1> ; bit 3 (1) - Volume label/name (V) 14826 <1> ; bit 4 (1) - Subdirectory (D) 14827 <1> ; bit 5 (1) - File has been archived (A) 14828 <1> ; CH = 0 -> Return basic parameters (24 bytes) 14829 <1> ; CH > 0 -> Return FindFile structure/table (128 bytes) 14830 <1> ; EBX = Pointer to filename (ASCIIZ) -path- 14831 <1> ; EDX = File parameters buffer address 14832 <1> ; (buffer size = 24 bytes if CH input = 0) 14833 <1> ; (buffer size = 128 bytes if CH input > 0) 14834 <1> ; 14835 <1> ; OUTPUT -> 14836 <1> ; EAX = 0 if CH input > 0 14837 <1> ; EAX = First cluster number of file if CH input = 0 14838 <1> ; EDX = File parameters table/structure address 14839 <1> ; Basic Parameters: 14840 <1> ; Offset Description 14841 <1> ; ------ --------------- 14842 <1> ; 0 File Attributes 14843 <1> ; 1 Ambiguous filename chars are used sign 14844 <1> ; (0 = filename fits exactly with request) 14845 <1> ; (>0 = ambiguous filename chars are used) 14846 <1> ; 2 Time stamp of file 14847 <1> ; 4 Date stamp of file 14848 <1> ; 6 File size in bytes 14849 <1> ; 10 Short Filename (ASCIIZ, max. 13 bytes) 14850 <1> ; 23 Longname Length (1-255) if existing 14851 <1> ; 14852 <1> ; cf = 1 -> Error code in AL 14853 <1> ; 14854 <1> ; Modified Registers: EAX (at the return of system call) 14855 <1> ; 14856 <1> ; TR-DOS FindFile (FFF) Structure (128 bytes): 14857 <1> ; 09/10/2011 (DIR.ASM) - 10/02/2016 (trdoskx.s) 14858 <1> ; 14859 <1> ; Offset Parameter Size 14860 <1> ; ------ ------------------ -------- 14861 <1> ; 0 FindFile_Drv 1 byte 14862 <1> ; 1 FindFile_Directory 65 bytes 14863 <1> ; 66 FindFile_Name 13 bytes 14864 <1> ; 79 FindFile_LongNameEntryLength 1 byte 14865 <1> ;Above 80 bytes form 14866 <1> ;TR-DOS Source/Destination File FullName Format/Structure 14867 <1> ; 80 FindFile_AttributesMask 1 word 14868 <1> ; 82 FindFile_DirEntry 32 bytes (*) 14869 <1> ; 114 FindFile_DirFirstCluster 1 double word 14870 <1> ; 118 FindFile_DirCluster 1 double word 14871 <1> ; 122 FindFile_DirEntryNumber 1 word 14872 <1> ; 124 FindFile_MatchCounter 1 word 14873 <1> ; 126 FindFile_Reserved 1 word 14874 <1> ; (*) MS-DOS, FAT 12-16-32 classic directory entry (32 bytes) 14875 <1> 14876 <1> ;mov [u.namep], ebx 14877 <1> ; 16/10/2016 14878 00010BA1 8915[68830100] <1> mov [FFF_UBuffer], edx 14879 00010BA7 66890D[6D830100] <1> mov [FFF_Attrib], cx ; [FFF_RType] = ch 14880 <1> ; Attributes in CL, return data type in CH 14881 00010BAE 89DE <1> mov esi, ebx 14882 <1> ; file name is forced, change directory as temporary 14883 <1> ;mov ax, 1 14884 <1> ;mov [FFF_Valid], ah ; 0 ; reset ; 17/10/2016 14885 <1> ;call set_working_path 14886 00010BB0 E820110000 <1> call set_working_path_x ; 17/10/2016 14887 00010BB5 731D <1> jnc short sysfff_0 14888 <1> 14889 00010BB7 21C0 <1> and eax, eax ; 0 -> Bad Path! 14890 00010BB9 7505 <1> jnz short sysfff_err 14891 <1> 14892 <1> ; eax = 0 14893 00010BBB B80C000000 <1> mov eax, ERR_DIR_NOT_FOUND ; Directory not found ! 14894 <1> sysfff_err: 14895 00010BC0 A3[6C8E0100] <1> mov [u.r0], eax 14896 00010BC5 A3[D88E0100] <1> mov [u.error], eax 14897 00010BCA E8DB110000 <1> call reset_working_path 14898 00010BCF E99ABEFFFF <1> jmp error 14899 <1> 14900 <1> sysfff_0: 14901 <1> ;;; 14902 <1> ; 25/08/2024 (bugfix) 14903 <1> ;mov al, [esp] ; ??? 14904 00010BD4 A0[6D830100] <1> mov al, [FFF_Attrib] 14905 <1> ;;; 14906 00010BD9 08C0 <1> or al, al 14907 00010BDB 7412 <1> jz short sysfff_2 14908 00010BDD B410 <1> mov ah, 10h 14909 00010BDF A808 <1> test al, 08h 14910 00010BE1 7503 <1> jnz short sysfff_1 14911 00010BE3 80CC08 <1> or ah, 08h 14912 <1> sysfff_1: 14913 00010BE6 2410 <1> and al, 10h ; Directory 14914 00010BE8 7405 <1> jz short sysfff_2 14915 00010BEA 80E408 <1> and ah, 08h 14916 00010BED 30C0 <1> xor al, al ; When a directory is searched, 14917 <1> ; filename will be returned even if 14918 <1> ; it is not a directory! 14919 <1> ; Because: (in order to prevent 14920 <1> ; creating a dir with existing file name) 14921 <1> ; Dir and file names must not be same! 14922 <1> ; (return attribute must be checked) 14923 <1> sysfff_2: 14924 <1> ; AX = Attributes mask 14925 <1> ; AL = AND mask (result must be equal to AL) 14926 <1> ; AH = Negative AND mask (result must be ZERO) 14927 <1> ; ESI = FindFile_Name address 14928 <1> 14929 00010BEF E8867DFFFF <1> call find_first_file 14930 00010BF4 72CA <1> jc short sysfff_err ; eax = 2 (File not found !) 14931 <1> 14932 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 14933 <1> ; EDI = Directory Buffer Directory Entry Location 14934 <1> ; EAX = File Size 14935 <1> ; BL = Attributes of The File/Directory 14936 <1> ; BH = Long Name Yes/No Status (>0 is YES) 14937 <1> ; DX > 0 : Ambiguous filename chars are used 14938 <1> 14939 <1> sysfff_3: 14940 <1> ; 16/10/2016 14941 00010BF6 668B0D[6D830100] <1> mov cx, [FFF_Attrib] 14942 <1> ; Attribs in CL, return data type in CH 14943 <1> 14944 <1> ;or cl, cl 14945 <1> ;jz short sysfff_4 ; 0 = No filter 14946 00010BFD 80F1FF <1> xor cl, 0FFh 14947 <1> ; cl = negative attributes ; 25/08/2024 14948 00010C00 20D9 <1> and cl, bl 14949 00010C02 7409 <1> jz short sysfff_4 14950 <1> 14951 <1> ;mov eax, 2 ; 'file not found !' error 14952 <1> ;jmp short sysfff_err_1 14953 <1> 14954 <1> ; 16/10/2016 14955 00010C04 E81E7EFFFF <1> call find_next_file 14956 00010C09 72B5 <1> jc short sysfff_err ; eax = 12 (no more files !) 14957 00010C0B EBE9 <1> jmp short sysfff_3 14958 <1> 14959 <1> sysfff_4: 14960 00010C0D 20ED <1> and ch, ch ; [FFF_RType] 14961 <1> ;jz short sysfff_5 14962 <1> ; 25/08/2024 14963 00010C0F 755A <1> jnz short sysfff_7 14964 <1> 14965 <1> ;mov ecx, 128 ; ; transfer length 14966 <1> ; 30/07/2022 14967 <1> ;sub ecx, ecx 14968 <1> ;mov cl, 128 14969 <1> ;mov [FFF_Valid], cl 14970 <1> ; 25/08/2024 14971 <1> ;mov byte [FFF_Valid], 128 ; (*) 14972 <1> ;jmp short sysfff_7 ; sysfnf_11 14973 <1> 14974 <1> sysfff_5: 14975 <1> ;;mov esi, FindFile_DirEntry 14976 <1> ;mov ecx, 24 ; transfer length 14977 <1> ; 30/07/2022 14978 <1> ;sub ecx, ecx 14979 <1> ;mov cl, 24 14980 <1> ;mov [FFF_Valid], cl 14981 00010C11 C605[6C830100]18 <1> mov byte [FFF_Valid], 24 ; (*) 14982 <1> sysfnf_12: 14983 00010C18 BF[38880100] <1> mov edi, DTA ; FFF data transfer address 14984 <1> ;mov al, [esi+DirEntry_Attr] ; 11 14985 00010C1D 88D8 <1> mov al, bl ; File/Dir Attributes 14986 00010C1F 887F17 <1> mov [edi+23], bh ; Longname length (0= none) 14987 00010C22 AA <1> stosb 14988 00010C23 88D0 <1> mov al, dl ; DL is for '?' 14989 00010C25 00F0 <1> add al, dh ; DH is for '*' 14990 <1> ; AL > 0 if ambiguous file name wildcards are used 14991 00010C27 AA <1> stosb 14992 00010C28 8B4616 <1> mov eax, [esi+DirEntry_WrtTime] ; 22 14993 00010C2B AB <1> stosd ; DirEntry_WrtTime & DirEntry_WrtDate 14994 00010C2C 8B461C <1> mov eax, [esi+DirEntry_FileSize] ; 28 14995 00010C2F AB <1> stosd 14996 00010C30 668B4614 <1> mov ax, [esi+DirEntry_FstClusHI] ; 20 14997 <1> ;shl ax, 16 14998 <1> ; 23/07/2022 (BugFix) 14999 00010C34 C1E010 <1> shl eax, 16 15000 00010C37 668B461A <1> mov ax, [esi+DirEntry_FstClusLO] ; 26 15001 00010C3B A3[6C8E0100] <1> mov [u.r0], eax ; First Cluster 15002 <1> 15003 <1> ;mov esi, FindFile_DirEntry 15004 00010C40 E8A2110000 <1> call get_file_name 15005 <1> 15006 <1> ; 25/08/2024 15007 <1> ; ecx <= 7 (from 'get_file_name') 15008 <1> ;mov cl, [FFF_Valid] ; (*) 15009 00010C45 BE[38880100] <1> mov esi, DTA ; FFF data transfer address 15010 <1> 15011 <1> sysfff_6: 15012 <1> ; 25/08/2024 15013 <1> ;sub ecx, ecx 15014 00010C4A 8A0D[6C830100] <1> mov cl, [FFF_Valid] ; (*) ecx <= 128 15015 <1> 15016 00010C50 8B3D[68830100] <1> mov edi, [FFF_UBuffer] ; user's buffer address (edx) 15017 00010C56 E8C0FEFFFF <1> call transfer_to_user_buffer 15018 <1> 15019 00010C5B 890D[6C8E0100] <1> mov [u.r0], ecx ; actual transfer count 15020 00010C61 E844110000 <1> call reset_working_path 15021 00010C66 E923BEFFFF <1> jmp sysret 15022 <1> 15023 <1> sysfff_7: 15024 <1> ; 25/08/2024 15025 00010C6B C605[6C830100]80 <1> mov byte [FFF_Valid], 128 ; (*) 15026 <1> sysfnf_11: 15027 <1> ; ecx = 128 15028 <1> ; 25/08/2024 (bugfix) 15029 <1> ; 08/08/2022 15030 00010C72 BE[16800100] <1> mov esi, FindFile_Drv 15031 <1> ; 25/08/2024 15032 00010C77 29C9 <1> sub ecx, ecx ; 0 15033 00010C79 EBCF <1> jmp short sysfff_6 15034 <1> 15035 <1> sysfnf: ; 15036 <1> ; 19/12/2025 (TRDOS 386 v2.0.10) 15037 <1> ; 25/08/2024 (TRDOS 386 Kernel v2.0.9) 15038 <1> ; 29/08/2023 (TRDOS 386 Kernel v2.0.6) 15039 <1> ; 08/08/2022 15040 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 15041 <1> ; 16/10/2016 TRDOS 386 (TRDOS v2.0) feature only ! 15042 <1> ; -derived from TRDOS v1.0, INT_21H.ASM- 15043 <1> ; ("loc_INT21h_find_next_file") 15044 <1> ; TRDOS 8086 (v1.0) 15045 <1> ; 07/08/2011 15046 <1> ; Find First File 15047 <1> ; INPUT: 15048 <1> ; none 15049 <1> ; MSDOS OUTPUT: 15050 <1> ; DTA: (Default address: PSP offset 80h) 15051 <1> ; Offset Descrription 15052 <1> ; 0 Reserved for use find next file 15053 <1> ; 21 Attribute of file found 15054 <1> ; 22 Time stamp of file 15055 <1> ; 24 Date stamp of file 15056 <1> ; 26 File size in bytes 15057 <1> ; 30 Filename and extension (zero terminated) 15058 <1> ; If cf = 1: 15059 <1> ; Error Codes: (in AX) 15060 <1> ; 18 - No more files 15061 <1> ; 15062 <1> ; TRDOS 386 (v2.0) 15063 <1> ; 16/10/2016 15064 <1> ; 15065 <1> ; INPUT -> 15066 <1> ; none 15067 <1> ; OUTPUT -> 15068 <1> ; EAX = 0 if CH input of 'Find First File' > 0 15069 <1> ; EAX = First cluster number of file 15070 <1> ; if CH input of 'Find First File' = 0 15071 <1> ; EDX = File parameters table/structure address 15072 <1> ; 15073 <1> ; cf = 1 -> Error code in AL 15074 <1> ; 15075 <1> ; Modified Registers: EAX (at the return of system call) 15076 <1> 15077 <1> ; Note: If byte [FFF_Valid] = 0 15078 <1> ; 'sysfnf' will return with 'no more files' error. 15079 <1> ; If byte [FFF_Valid] = 24 15080 <1> ; 'sysfnf' will return with 24 bytes basic parameters 15081 <1> ; at the address which is in EDX. 15082 <1> ; If byte [FFF_Valid] = 128 15083 <1> ; 'sysfnf' will return with 128 bytes Find File 15084 <1> ; Structure/Table at the address which is in EDX. 15085 <1> 15086 00010C7B 803D[6C830100]00 <1> cmp byte [FFF_Valid], 0 15087 00010C82 7713 <1> ja short stsfnf_0 15088 <1> ; 'no more files !' error 15089 <1> ;mov eax, ERR_NO_MORE_FILES ; 12 15090 <1> ; 30/07/2022 15091 00010C84 29C0 <1> sub eax, eax 15092 00010C86 B00C <1> mov al, ERR_NO_MORE_FILES ; 12 15093 00010C88 A3[6C8E0100] <1> mov [u.r0], eax 15094 00010C8D A3[D88E0100] <1> mov [u.error], eax 15095 00010C92 E9D7BDFFFF <1> jmp error 15096 <1> 15097 <1> stsfnf_0: 15098 <1> ;cmp byte [FFF_Valid], 128 15099 <1> ;je short stsfnf_1 15100 <1> ;cmp byte [FFF_Valid], 24 15101 <1> ;je short stsfnf_1 15102 <1> ;mov [FFF_Valid], 24 ; Default 15103 <1> stsfnf_1: 15104 00010C97 0FB61D[76770100] <1> movzx ebx, byte [Current_Drv] 15105 00010C9E 66891D[72830100] <1> mov [SWP_DRV], bx 15106 00010CA5 8A15[16800100] <1> mov dl, [FindFile_Drv] 15107 00010CAB 38DA <1> cmp dl, bl 15108 00010CAD 7532 <1> jne short stsfnf_2 15109 00010CAF 86FB <1> xchg bh, bl 15110 00010CB1 BE00010900 <1> mov esi, Logical_DOSDisks 15111 00010CB6 01DE <1> add esi, ebx 15112 00010CB8 EB34 <1> jmp short sysfnf_3 15113 <1> 15114 <1> sysfnf_8: 15115 00010CBA E886B4FFFF <1> call load_FAT_sub_directory 15116 00010CBF 7269 <1> jc short sysfnf_err_1 ; read error (no FNF stop) 15117 <1> 15118 <1> sysfnf_9: 15119 00010CC1 E8617DFFFF <1> call find_next_file 15120 00010CC6 7257 <1> jc short sysfnf_5 15121 <1> ; 25/08/2024 15122 <1> ; esi = Directory Entry (FindFile_DirEntry) Location 15123 <1> ;; 08/08/2022 15124 <1> ;; esi = FindFile_Drv ; wrong ! ; 25/08/2024 15125 <1> 15126 00010CC8 A0[6D830100] <1> mov al, [FFF_Attrib] 15127 <1> ;or al, al 15128 <1> ;jz short sysfnf_10 ; 0 = No filter 15129 00010CCD 34FF <1> xor al, 0FFh 15130 00010CCF 20D8 <1> and al, bl 15131 00010CD1 75EE <1> jnz short sysfnf_9 ; search for next file until 15132 <1> ; an error return from 15133 <1> ; find_next_file procedure 15134 <1> sysfnf_10: 15135 <1> ;movzx ecx, byte [FFF_Valid] 15136 <1> ;cmp cl, 128 ; complete FindFile structure/table 15137 <1> ;je sysfnf_11 15138 <1> ;;cmp cl, 24 ; basic parameters 15139 <1> ;;je sysfnf_12 15140 <1> ;jmp sysfnf_12 15141 <1> ; 30/07/2022 15142 <1> ;movzx ecx, byte [FFF_Valid] 15143 <1> ; 25/08/2024 15144 <1> ;cmp cl, 128 15145 00010CD3 803D[6C830100]80 <1> cmp byte [FFF_Valid], 128 15146 <1> ;jne short sysfnf_12 15147 <1> ;jmp short sysfnf_11 (*) 15148 <1> ;; 08/08/2022 15149 <1> ;;je short sysfnf_6 ; esi = FindFile_Drv 15150 <1> ; 29/08/2023 (BugFix) 15151 <1> ;je short sysfff_6 ; esi = FindFile_Drv 15152 <1> ; 25/08/2024 (BugFix of BugFix) (*) 15153 00010CDA 7496 <1> je short sysfnf_11 ; esi <> FindFile_Drv 15154 <1> 15155 00010CDC E937FFFFFF <1> jmp sysfnf_12 15156 <1> 15157 <1> stsfnf_2: 15158 00010CE1 FE05[73830100] <1> inc byte [SWP_DRV_chg] 15159 <1> 15160 00010CE7 E8046AFFFF <1> call change_current_drive 15161 00010CEC 723C <1> jc short sysfnf_err_1 ; read error ! 15162 <1> ; (do not stop, because 15163 <1> ; we don't have a 15164 <1> ; 'no more files' 15165 <1> ; -file not found- error, 15166 <1> ; next sysfnf system call 15167 <1> ; may solve the problem, 15168 <1> ; after re-placing the disk) 15169 <1> sysfnf_3: 15170 00010CEE A1[8C800100] <1> mov eax, [FindFile_DirCluster] 15171 00010CF3 21C0 <1> and eax, eax 15172 00010CF5 7547 <1> jnz short sysfnf_6 15173 <1> 15174 00010CF7 803D[75770100]02 <1> cmp byte [Current_FATType], 2 15175 00010CFE 7723 <1> ja short sysfnf_err_0 ; invalid, we neeed to stop !? 15176 <1> 15177 <1> ; 19/12/2025 15178 <1> %if 0 15179 <1> cmp byte [Current_FATType], 1 15180 <1> jb short sysfnf_err_0 ; invalid, we neeed to stop !? 15181 <1> %endif 15182 <1> 15183 00010D00 3805[9D7E0100] <1> cmp byte [DirBuff_ValidData], al ; 0 15184 00010D06 7608 <1> jna short sysfnf_4 15185 <1> 15186 00010D08 3B05[A27E0100] <1> cmp eax, [DirBuff_Cluster] ; 0 ? 15187 00010D0E 74B1 <1> je short sysfnf_9 15188 <1> 15189 <1> ;cmp byte [Current_Dir_Level], 0 15190 <1> ;ja short sysfnf_4 15191 <1> ;jna short sysfnf_9 15192 <1> 15193 <1> sysfnf_4: 15194 00010D10 FE05[73830100] <1> inc byte [SWP_DRV_chg] 15195 00010D16 E8ACB3FFFF <1> call load_FAT_root_directory 15196 00010D1B 73A4 <1> jnc short sysfnf_9 15197 <1> ; eax = error code (17, 'drv not ready or read error') 15198 00010D1D EB0B <1> jmp short sysfnf_err_1 ; read error ! (no FNF stop) 15199 <1> ; (if you want, try again, 15200 <1> ; after re-placing the disk) 15201 <1> sysfnf_5: 15202 00010D1F 3C0C <1> cmp al, 12 ; 'no more files' error 15203 00010D21 7507 <1> jne short sysfnf_err_1 ; (no FNF stop -sysfnf will try 15204 <1> ; to read the directory again, 15205 <1> ; if the user calls sysfnf 15206 <1> ; just after this error return-) 15207 <1> ; (FNF stop -sysfnf will not try 15208 <1> ; to read the directory again-) 15209 <1> 15210 <1> sysfnf_err_0: 15211 00010D23 C605[6C830100]00 <1> mov byte [FFF_Valid], 0 ; FNF stop sign 15212 <1> sysfnf_err_1: 15213 00010D2A A3[6C8E0100] <1> mov [u.r0], eax 15214 00010D2F A3[D88E0100] <1> mov [u.error], eax 15215 00010D34 E871100000 <1> call reset_working_path 15216 00010D39 E930BDFFFF <1> jmp error 15217 <1> 15218 <1> sysfnf_6: 15219 00010D3E 803D[9D7E0100]00 <1> cmp byte [DirBuff_ValidData], 0 15220 00010D45 760D <1> jna short sysfnf_7 15221 <1> 15222 00010D47 3B05[A27E0100] <1> cmp eax, [DirBuff_Cluster] 15223 <1> ;je short sysfnf_9 15224 <1> ; 08/08/2022 15225 00010D4D 7505 <1> jne short sysfnf_7 15226 00010D4F E96DFFFFFF <1> jmp sysfnf_9 15227 <1> sysfnf_7: 15228 00010D54 FE05[73830100] <1> inc byte [SWP_DRV_chg] 15229 <1> 15230 <1> ; 19/12/2025 15231 <1> %if 0 15232 <1> cmp byte [Current_FATType], 1 15233 <1> ;jnb short sysfnf_8 15234 <1> ; 08/08/2022 15235 <1> jb short sysfnf_13 15236 <1> %endif 15237 00010D5A E95BFFFFFF <1> jmp sysfnf_8 15238 <1> 15239 <1> ; 19/12/2025 15240 <1> %if 0 15241 <1> sysfnf_13: 15242 <1> ; Singlix (TRFS) File System 15243 <1> ; (access via compatibility buffer) 15244 <1> call load_FS_sub_directory 15245 <1> ;jnc short sysfnf_9 15246 <1> ;jmp short sysfnf_err_1 ; read error (no FNF stop) 15247 <1> ; 08/08/2022 15248 <1> jc short sysfnf_err_1 15249 <1> jmp sysfnf_9 15250 <1> %endif 15251 <1> 15252 <1> writei: 15253 <1> ; 02/09/2024 15254 <1> ; 27/08/2024 - TRDOS 386 v2.0.9 15255 <1> ; 08/08/2022 15256 <1> ; 30/07/2022 15257 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 15258 <1> ; 26/10/2016 15259 <1> ; 25/10/2016 15260 <1> ; 23/10/2016 15261 <1> ; 22/10/2016 15262 <1> ; 19/10/2016 - TRDOS 386 (TRDOS v2.0) 15263 <1> ; 19/05/2015 - 20/05/2015 (Retro UNIX 386 v1) 15264 <1> ; 12/03/2013 - 31/07/2013 (Retro UNIX 8086 v1) 15265 <1> ; 15266 <1> ; Write data to file with first cluster number in EAX 15267 <1> ; 15268 <1> ; INPUTS -> 15269 <1> ; EAX - First cluster number of the file 15270 <1> ; EBX - File number (Open file index number) 15271 <1> ; u.count - byte count to be written 15272 <1> ; u.base - points to user buffer 15273 <1> ; u.fofp - points to dword with current file offset 15274 <1> ; i.size - file size 15275 <1> ; cdev - logical dos drive number of the file 15276 <1> ; OUTPUTS -> 15277 <1> ; u.count - cleared 15278 <1> ; u.nread - accumulates total bytes passed back 15279 <1> ; i.size - new file size (if file byte offset overs file size) 15280 <1> ; u.fofp - points to u.off (with new offset value) 15281 <1> ; 15282 <1> ; (Retro UNIX Prototype : 11/11/2012 - 18/11/2012, UNIXCOPY.ASM) 15283 <1> ; ((Modified registers: eax, edx, ebx, ecx, esi, edi, ebp)) 15284 <1> 15285 00010D5F 31C9 <1> xor ecx, ecx 15286 00010D61 890D[988E0100] <1> mov [u.nread], ecx ; 0 15287 00010D67 66890D[D08E0100] <1> mov [u.pcount], cx ; 19/05/2015 15288 00010D6E 390D[948E0100] <1> cmp [u.count], ecx 15289 00010D74 7701 <1> ja short writei_1 ; 08/08/2022 15290 00010D76 C3 <1> retn 15291 <1> ; 23/07/2022 15292 <1> ;jna short dskw_8 ; retn 15293 <1> writei_1: 15294 <1> ; 02/09/2024 15295 00010D77 C705[10830100]FFFF- <1> mov dword [writei.fclust], 0FFFFFFFFh ; -1 ; reset 15295 00010D7F FFFF <1> 15296 <1> dskw: 15297 00010D81 881D[20830100] <1> mov [writei.ofn], bl ; Open file number 15298 00010D87 880D[63830100] <1> mov [setfmod], cl ; 0 ; reset 'update lm date&time' sign 15299 <1> dskw_0: 15300 <1> ; 26/10/2016 15301 <1> ; 22/10/2016, 23/10/2016, 25/10/2016 15302 <1> ; 19/10/2016 - TRDOS 386 (TRDOS v2.0) 15303 <1> ; 31/05/2015 - 25/07/2015 (Retro UNIX 386 v1) 15304 <1> ; 26/04/2013 - 20/09/2013 (Retro UNIX 8086 v1) 15305 <1> ; 15306 <1> ; 01/08/2013 (mkdir_w check) 15307 00010D8D E8D0000000 <1> call mget_w 15308 <1> ; eax = sector/block number 15309 <1> 15310 00010D92 8B1D[808E0100] <1> mov ebx, [u.fofp] 15311 00010D98 8B13 <1> mov edx, [ebx] 15312 00010D9A 81E2FF010000 <1> and edx, 1FFh ; / test the lower 9 bits of the file offset 15313 00010DA0 750C <1> jnz short dskw_1 ; / if its non-zero, branch 15314 <1> ; if zero, file offset = 0, 15315 <1> ; / 512, 1024,...(i.e., start of new block) 15316 00010DA2 813D[948E0100]0002- <1> cmp dword [u.count], 512 15316 00010DAA 0000 <1> 15317 <1> ; / if zero, is there enough data to fill 15318 <1> ; / an entire block? (i.e., no. of 15319 00010DAC 7331 <1> jnb short dskw_2 ; / bytes to be written greater than 512.? 15320 <1> ; / Yes, branch. Don't have to read block 15321 <1> dskw_1: ; in as no past info. is to be saved 15322 <1> ; (the entire block will be overwritten). 15323 <1> ; 23/10/2016 15324 <1> 15325 00010DAE BB[9C920100] <1> mov ebx, writei_buffer 15326 <1> ; esi = logical dos drive description table address 15327 <1> ; eax = sector number 15328 <1> ; ebx = buffer address (in kernel's memory space) 15329 <1> ; ecx = sector count 15330 <1> ; 30/07/2022 15331 <1> ;mov ecx, 1 15332 00010DB3 31C9 <1> xor ecx, ecx 15333 00010DB5 FEC1 <1> inc cl 15334 <1> ; ecx = 1 15335 00010DB7 E8370C0000 <1> call disk_read 15336 <1> ;call dskrd ; / no, must retain old info.. 15337 <1> ; / Hence, read block 'r1' into an I/O buffer 15338 00010DBC 7321 <1> jnc short dskw_2 15339 <1> 15340 <1> ; disk read error 15341 <1> ; 30/07/2022 15342 <1> ;mov eax, 17 ; drive not ready or READ ERROR ! 15343 00010DBE 29C0 <1> sub eax, eax 15344 00010DC0 B011 <1> mov al, 17 15345 <1> dskw_err: ; jump from disk write error 15346 00010DC2 A3[6C8E0100] <1> mov [u.r0], eax 15347 00010DC7 A3[D88E0100] <1> mov [u.error], eax 15348 <1> 15349 00010DCC 803D[63830100]00 <1> cmp byte [setfmod], 0 15350 <1> ;jna error 15351 <1> ; 23/07/2022 15352 00010DD3 7605 <1> jna short writei_err 15353 <1> 15354 00010DD5 E887020000 <1> call update_file_lmdt ; update last modif. date&time of the file 15355 <1> ;mov byte [setfmod], 0 15356 <1> writei_err: 15357 00010DDA E98FBCFFFF <1> jmp error 15358 <1> 15359 <1> dskw_2: ; 3: 15360 <1> ; 23/10/2016 15361 00010DDF C605[FC820100]01 <1> mov byte [writei.valid], 1 ; writei buffer contains valid data 15362 00010DE6 56 <1> push esi ; logical dos drive description table address 15363 <1> ; EAX (r1) = block/sector number 15364 <1> ;call wslot 15365 <1> ; jsr r0,wslot / set write and inhibit bits in I/O queue, 15366 <1> ; / proc. status=0, r5 points to 1st word of data 15367 00010DE7 803D[D28E0100]00 <1> cmp byte [u.kcall], 0 15368 00010DEE 770F <1> ja short dskw_4 ; zf=0 -> the caller is 'mkdir' 15369 <1> ; 15370 00010DF0 66833D[D08E0100]00 <1> cmp word [u.pcount], 0 15371 00010DF8 7705 <1> ja short dskw_4 15372 <1> dskw_3: 15373 <1> ; [u.base] = virtual address to transfer (as source address) 15374 00010DFA E844FAFFFF <1> call trans_addr_r ; translate virtual address to physical (r) 15375 <1> dskw_4: 15376 00010DFF BB[9C920100] <1> mov ebx, writei_buffer 15377 <1> ; EBX (r5) = system (I/O) buffer address 15378 00010E04 E8A6FAFFFF <1> call sioreg 15379 <1> ; ESI = file (user data) offset 15380 <1> ; EDI = sector (I/O) buffer offset 15381 <1> ; ECX = byte count 15382 <1> ; 15383 00010E09 F3A4 <1> rep movsb 15384 <1> ; 25/07/2015 15385 <1> ; eax = remain bytes in buffer 15386 <1> ; (check if remain bytes in the buffer > [u.pcount]) 15387 00010E0B 09C0 <1> or eax, eax 15388 00010E0D 75EB <1> jnz short dskw_3 ; (page end before system buffer end!) 15389 <1> 15390 <1> ; 23/10/2016 15391 00010E0F B101 <1> mov cl, 1 15392 00010E11 5E <1> pop esi 15393 00010E12 A1[00830100] <1> mov eax, [writei.sector] 15394 <1> ; esi = logical dos drive description table address 15395 <1> ; eax = sector number 15396 <1> ; ebx = writei buffer address 15397 <1> ; ecx = sector count 15398 00010E17 E8C80B0000 <1> call disk_write ; / yes, write the block 15399 00010E1C 7313 <1> jnc short dskw_5 15400 <1> 15401 <1> ;mov eax, 18 ; drive not ready or WRITE ERROR ! 15402 <1> ; 30/08/2022 15403 00010E1E 29C0 <1> sub eax, eax 15404 00010E20 B012 <1> mov al, 18 15405 00010E22 EB9E <1> jmp short dskw_err 15406 <1> 15407 <1> dskw_7: 15408 <1> ; update last modif. date&time of the file 15409 <1> ; (also updates file size as OF_SIZE) 15410 00010E24 E838020000 <1> call update_file_lmdt 15411 <1> ;mov byte [setfmod], 0 15412 <1> 15413 <1> ; 03/08/2013 15414 00010E29 C605[D28E0100]00 <1> mov byte [u.kcall], 0 15415 <1> ; 23/10/2016 15416 <1> ;mov eax, [writei.fclust] 15417 <1> dskw_8: ; 23/07/2022 15418 00010E30 C3 <1> retn 15419 <1> 15420 <1> dskw_5: 15421 <1> ; 26/10/2016 15422 00010E31 0FB61D[20830100] <1> movzx ebx, byte [writei.ofn] ; open file number 15423 00010E38 C0E302 <1> shl bl, 2 ; *4 15424 00010E3B 8B83[78840100] <1> mov eax, [ebx+OF_POINTER] 15425 00010E41 3B83[F8840100] <1> cmp eax, [ebx+OF_SIZE] 15426 00010E47 7606 <1> jna short dskw_6 15427 00010E49 8983[F8840100] <1> mov [ebx+OF_SIZE], eax 15428 <1> dskw_6: 15429 <1> ;shr bl, 2 15430 00010E4F 833D[948E0100]00 <1> cmp dword [u.count], 0 ; / any more data to write? 15431 00010E56 76CC <1> jna short dskw_7 15432 00010E58 A1[10830100] <1> mov eax, [writei.fclust] 15433 00010E5D E92BFFFFFF <1> jmp dskw_0 ; / yes, branch 15434 <1> 15435 <1> mget_w: 15436 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 15437 <1> ; 03/09/2024 15438 <1> ; 02/09/2024 15439 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 15440 <1> ; 08/08/2022 15441 <1> ; 25/07/2022 15442 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 15443 <1> ; 02/11/2016 15444 <1> ; 01/11/2016 15445 <1> ; 23/10/2016, 31/10/2016 15446 <1> ; 22/10/2016 - TRDOS 386 (TRDOS v2.0) 15447 <1> ; 03/06/2015 (Retro UNIX 386 v1, 'mget', u.5s) 15448 <1> ; 22/03/2013 - 31/07/2013 (Retro UNIX 8086 v1) 15449 <1> ; 15450 <1> ; Get existing or (allocate) a new disk block for file 15451 <1> ; 15452 <1> ; INPUTS -> 15453 <1> ; [u.fofp] = file offset pointer 15454 <1> ; [i.size] = file size 15455 <1> ; [u.count] = byte count 15456 <1> ; EAX = First cluster 15457 <1> ; [cdev] = Logical dos drive number 15458 <1> ; [writei.ofn] = File Number 15459 <1> ; (Open file index, 0 based) 15460 <1> ; ([u.off] = file offset) 15461 <1> ; OUTPUTS -> 15462 <1> ; EAX = logical sector number 15463 <1> ; ESI = Logical Dos Drive Description Table address 15464 <1> ; 15465 <1> ; Modified registers: EDX, EBX, ECX, ESI, EDI, EBP 15466 <1> 15467 00010E62 8B35[808E0100] <1> mov esi, [u.fofp] 15468 00010E68 8B2E <1> mov ebp, [esi] ; u.off (or EBX*4+OF_POINTER) 15469 <1> 15470 00010E6A 29C9 <1> sub ecx, ecx 15471 00010E6C 8A2D[518E0100] <1> mov ch, [cdev] 15472 <1> 15473 00010E72 BE00010900 <1> mov esi, Logical_DOSDisks 15474 00010E77 01CE <1> add esi, ecx 15475 <1> 15476 <1> ; 31/10/2016 15477 00010E79 89C3 <1> mov ebx, eax ; First Cluster or FDT address 15478 <1> 15479 <1> ; 19/12/2025 15480 <1> %if 0 15481 <1> cmp byte [esi+LD_FATType], 0 15482 <1> ;jna mget_w_14 ; Singlix FS 15483 <1> ; 23/07/2022 15484 <1> ja short mget_w_20 15485 <1> jmp mget_w_14 ; Singlix FS 15486 <1> %endif 15487 <1> 15488 <1> mget_w_20: 15489 <1> ;movzx eax, word [esi+LD_BPB+BytesPerSec] 15490 <1> ; 19/12/2025 15491 00010E7B B800020000 <1> mov eax, 512 15492 00010E80 0FB65613 <1> movzx edx, byte [esi+LD_BPB+SecPerClust] 15493 00010E84 8815[FE820100] <1> mov [writei.spc], dl ; sectors per cluster 15494 00010E8A F7E2 <1> mul edx 15495 <1> ; edx = 0 15496 <1> ; eax = bytes per cluster (<= 65536) 15497 <1> 15498 <1> ; 02/11/2016 15499 00010E8C 89C1 <1> mov ecx, eax 15500 00010E8E 48 <1> dec eax 15501 00010E8F 66A3[04830100] <1> mov [writei.bpc], ax 15502 <1> 15503 00010E95 89E8 <1> mov eax, ebp 15504 00010E97 0305[948E0100] <1> add eax, [u.count] ; next file position 15505 00010E9D 3B05[788F0100] <1> cmp eax, [i.size] ; <= file size ? 15506 <1> ;jna mget_w_4 ; no 15507 <1> ; 23/07/2022 15508 00010EA3 7705 <1> ja short mget_w_21 15509 <1> ; 02/09/2024 15510 <1> ; ebx = first cluster (input) 15511 00010EA5 E925010000 <1> jmp mget_w_4 15512 <1> mget_w_21: 15513 00010EAA F7F1 <1> div ecx 15514 00010EAC A3[0C830100] <1> mov [writei.c_index], eax ; cluster index 15515 <1> ; edx = byte offset in cluster (<= 65535) 15516 <1> ;mov [writei.offset], dx 15517 <1> ;shr dx, 9 ; / 512 15518 <1> ;mov [writei.s_index], dl ; sector index in cluster (0 to spc -1) 15519 <1> 15520 00010EB1 29D2 <1> sub edx, edx ; 01/11/2016 15521 00010EB3 8915[00830100] <1> mov [writei.sector], edx ; 0 15522 00010EB9 668915[06830100] <1> mov [writei.offset], dx ; byte offset in cluster 15523 00010EC0 8815[FF820100] <1> mov [writei.s_index], dl ; sector index in cluster (0 to spc -1) 15524 <1> 15525 00010EC6 89D8 <1> mov eax, ebx ; First Cluster 15526 <1> 15527 <1> ; is this the 1st mget_w or a next mget_w call ? (by 'writei') 15528 00010EC8 3815[FC820100] <1> cmp byte [writei.valid], dl ; 0 15529 00010ECE 7624 <1> jna short mget_w_0 15530 <1> 15531 00010ED0 8815[FC820100] <1> mov byte [writei.valid], dl ; 0 ; reset ('writei' will set it) 15532 <1> 15533 00010ED6 3B05[10830100] <1> cmp eax, [writei.fclust] 15534 00010EDC 7516 <1> jne short mget_w_0 15535 <1> 15536 00010EDE 8A0D[518E0100] <1> mov cl, [cdev] 15537 00010EE4 3A0D[FD820100] <1> cmp cl, [writei.drv] 15538 00010EEA 7508 <1> jne short mget_w_0 15539 <1> ; [writei.l_clust] & [writei.l_index] are valid, 15540 <1> ; we don't need to get last cluster & last cluster index 15541 00010EEC 8B0D[1C830100] <1> mov ecx, [writei.l_index] 15542 00010EF2 EB7F <1> jmp short mget_w_2 15543 <1> mget_w_0: 15544 00010EF4 A3[10830100] <1> mov [writei.fclust], eax ; first cluster 15545 <1> ; edx = 0 15546 00010EF9 A3[08830100] <1> mov [writei.cluster], eax ; first cluster ; 01/11/2016 15547 00010EFE 8915[14830100] <1> mov [writei.fs_index], edx ; 0 ; current cluster index 15548 <1> 15549 <1> ;;; 15550 <1> ; 25/08/2024 - TRDOS 386 v2.0.9 15551 00010F04 09C0 <1> or eax, eax ; is first cluster number = 0 ? 15552 00010F06 751A <1> jnz short mget_w_27 ; no 15553 <1> 15554 <1> ; eax = 0 (*) 15555 <1> ; ((a directory entry with zero file size)) (*) 15556 <1> ; (*) ((('syswrite' may be used for writing to an empty file. 15557 <1> ; Before this modification, 'syscreat' and 'syswrite' system calls 15558 <1> ; did wrong things together... 'writetest.s' file, 24/08/2024.))) 15559 <1> 15560 00010F08 E8FFB8FFFF <1> call add_new_cluster ; (*) 2024 (v2.0.9) modification 15561 00010F0D 721A <1> jc short mget_w_errj ; eax = error code 15562 <1> ; eax = (new) first cluster 15563 <1> ; skip 'get_last_cluster' and set ecx to -1 15564 <1> ; 15565 <1> ; 02/09/2024 15566 00010F0F A3[10830100] <1> mov [writei.fclust], eax ; first cluster 15567 00010F14 A3[08830100] <1> mov [writei.cluster], eax 15568 <1> ; 03/09/2024 15569 00010F19 A3[64830100] <1> mov [setfclust], eax 15570 <1> ; 15571 00010F1E 31C9 <1> xor ecx, ecx 15572 00010F20 EB12 <1> jmp short mget_w_28 15573 <1> ;;; 15574 <1> 15575 <1> mget_w_27: 15576 <1> ; FAT file system (FAT12, FAT16, FAT32) 15577 00010F22 E8C8B7FFFF <1> call get_last_cluster 15578 <1> ;jc short mget_w_err ; eax = error code 15579 <1> ; 08/08/2022 15580 00010F27 7305 <1> jnc short mget_w_25 15581 <1> mget_w_errj: ; 25/08/2024 15582 00010F29 E992000000 <1> jmp mget_w_err 15583 <1> 15584 <1> mget_w_25: 15585 <1> ; 25/08/2024 15586 00010F2E 8B0D[44810100] <1> mov ecx, [glc_index] ; last cluster index 15587 <1> mget_w_28: ; 02/09/2024 15588 00010F34 890D[1C830100] <1> mov [writei.l_index], ecx 15589 00010F3A A3[18830100] <1> mov [writei.lclust], eax ; last cluster 15590 <1> 15591 00010F3F A0[20830100] <1> mov al, [writei.ofn] 15592 00010F44 FEC0 <1> inc al 15593 00010F46 A2[63830100] <1> mov [setfmod], al ; update lm date&time sign 15594 <1> 15595 <1> mget_w_1: 15596 00010F4B 3B0D[0C830100] <1> cmp ecx, [writei.c_index] ; last cluster index 15597 00010F51 7320 <1> jnb short mget_w_2 ; 01/11/2016 15598 <1> 15599 00010F53 A1[18830100] <1> mov eax, [writei.lclust] 15600 <1> ; EAX = Last cluster 15601 00010F58 E8AFB8FFFF <1> call add_new_cluster 15602 00010F5D 7261 <1> jc short mget_w_err ; eax = error code 15603 <1> ; edx = 0 15604 00010F5F A3[18830100] <1> mov [writei.lclust], eax ; (new) last cluster 15605 00010F64 8B0D[1C830100] <1> mov ecx, [writei.l_index] 15606 00010F6A 41 <1> inc ecx ; add 1 to last cluster index 15607 00010F6B 890D[1C830100] <1> mov [writei.l_index], ecx ; current last cluster index 15608 <1> 15609 00010F71 EBD8 <1> jmp short mget_w_1 15610 <1> 15611 <1> mget_w_2: 15612 00010F73 89E9 <1> mov ecx, ebp 15613 00010F75 030D[948E0100] <1> add ecx, [u.count] 15614 00010F7B 890D[788F0100] <1> mov [i.size], ecx ; save new file size 15615 <1> ;sub edx, edx ; 0 15616 <1> 15617 00010F81 A0[518E0100] <1> mov al, [cdev] 15618 00010F86 A2[FD820100] <1> mov [writei.drv], al ; physical drive number 15619 <1> ; edx = 0 15620 00010F8B 89E8 <1> mov eax, ebp ; file offset 15621 00010F8D 0FB70D[04830100] <1> movzx ecx, word [writei.bpc] ; bytes per cluster - 1 15622 00010F94 41 <1> inc ecx ; bytes per cluster 15623 00010F95 F7F1 <1> div ecx 15624 <1> ; edx = byte offset in cluster (<= 65535) 15625 <1> ; eax = cluster index 15626 00010F97 A3[0C830100] <1> mov [writei.c_index], eax 15627 00010F9C 668915[06830100] <1> mov [writei.offset], dx 15628 <1> ;shr dx, 9 ; / 512 15629 <1> ; 23/07/2022 15630 00010FA3 C1EA09 <1> shr edx, 9 15631 00010FA6 8815[FF820100] <1> mov [writei.s_index], dl ; sector index in cluster (0 to spc -1) 15632 <1> 15633 <1> mget_w_3: 15634 00010FAC 3B05[1C830100] <1> cmp eax, [writei.l_index] ; last cluster index 15635 00010FB2 753E <1> jne short mget_w_5 15636 <1> 15637 00010FB4 A3[14830100] <1> mov [writei.fs_index], eax ; cluster index (for next check) 15638 <1> 15639 00010FB9 A1[18830100] <1> mov eax, [writei.lclust] ; last cluster 15640 00010FBE EB74 <1> jmp short mget_w_10 15641 <1> 15642 <1> mget_w_err: 15643 00010FC0 A3[D88E0100] <1> mov [u.error], eax 15644 00010FC5 A3[6C8E0100] <1> mov [u.r0], eax 15645 00010FCA E99FBAFFFF <1> jmp error 15646 <1> 15647 <1> mget_w_4: ; 02/11/2016 15648 <1> ; eax = next file position 15649 00010FCF 2B05[948E0100] <1> sub eax, [u.count] ; current file position 15650 <1> ; edx = 0 15651 <1> ; ecx = bytes per cluster 15652 00010FD5 F7F1 <1> div ecx 15653 00010FD7 A3[0C830100] <1> mov [writei.c_index], eax ; cluster index 15654 00010FDC 668915[06830100] <1> mov [writei.offset], dx 15655 <1> ;shr dx, 9 ; / 512 15656 <1> ; 23/07/2022 15657 00010FE3 C1EA09 <1> shr edx, 9 15658 00010FE6 8815[FF820100] <1> mov [writei.s_index], dl ; sector index in cluster (0 to spc -1) 15659 <1> 15660 <1> ; 02/09/2024 15661 00010FEC 891D[10830100] <1> mov [writei.fclust], ebx 15662 <1> 15663 <1> mget_w_5: 15664 00010FF2 21C0 <1> and eax, eax ; 0 = First Cluster's index number 15665 00010FF4 750C <1> jnz short mget_w_6 15666 <1> 15667 00010FF6 A3[14830100] <1> mov [writei.fs_index], eax ; cluster index (for next check) 15668 <1> 15669 00010FFB A1[10830100] <1> mov eax, [writei.fclust] ; first cluster 15670 00011000 EB32 <1> jmp short mget_w_10 15671 <1> 15672 <1> mget_w_6: 15673 00011002 3B05[14830100] <1> cmp eax, [writei.fs_index] ; current cluster index (>0) 15674 00011008 7507 <1> jne short mget_w_7 15675 0001100A A1[08830100] <1> mov eax, [writei.cluster] ; current cluster 15676 0001100F EB34 <1> jmp short mget_w_11 15677 <1> 15678 <1> mget_w_7: 15679 00011011 89C1 <1> mov ecx, eax 15680 00011013 2B0D[14830100] <1> sub ecx, [writei.fs_index] 15681 00011019 730D <1> jnc short mget_w_8 15682 <1> ; get cluster by index from the first cluster 15683 0001101B A1[10830100] <1> mov eax, [writei.fclust] 15684 00011020 8B0D[0C830100] <1> mov ecx, [writei.c_index] 15685 00011026 EB05 <1> jmp short mget_w_9 15686 <1> 15687 <1> mget_w_8: 15688 00011028 A1[08830100] <1> mov eax, [writei.cluster] ; beginning cluster 15689 <1> ; ecx = cluster sequence number after the beginning cluster 15690 <1> ; sub edx, edx ; 0 15691 <1> 15692 <1> mget_w_9: 15693 <1> ; EAX = Beginning cluster 15694 <1> ; EDX = Sector index in disk/file section 15695 <1> ; (Only for SINGLIX file system!) 15696 <1> ; ECX = Cluster sequence number after the beginning cluster 15697 <1> ; ESI = Logical DOS Drive Description Table address 15698 0001102D E887B8FFFF <1> call get_cluster_by_index 15699 00011032 728C <1> jc short mget_w_err ; error code in EAX 15700 <1> 15701 <1> ; EAX = Cluster number 15702 <1> mget_w_10: 15703 00011034 A3[08830100] <1> mov [writei.cluster], eax ; FDT number for Singlix File System 15704 <1> 15705 <1> ; 19/12/2025 15706 <1> %if 0 15707 <1> cmp byte [esi+LD_FATType], 0 15708 <1> jna short mget_w_13 15709 <1> %endif 15710 <1> ; 01/11/2016 15711 00011039 8B15[0C830100] <1> mov edx, [writei.c_index] 15712 0001103F 8915[14830100] <1> mov [writei.fs_index], edx 15713 <1> mget_w_11: 15714 <1> ;sub eax, 2 15715 <1> ; 23/07/2022 15716 00011045 48 <1> dec eax 15717 00011046 48 <1> dec eax 15718 00011047 0FB615[FE820100] <1> movzx edx, byte [writei.spc] 15719 0001104E F7E2 <1> mul edx 15720 <1> 15721 00011050 034668 <1> add eax, [esi+LD_DATABegin] 15722 00011053 8A15[FF820100] <1> mov dl, [writei.s_index] 15723 00011059 01D0 <1> add eax, edx 15724 <1> mget_w_12: 15725 0001105B A3[00830100] <1> mov [writei.sector], eax 15726 <1> ;; buffer validation must be done in writei 15727 <1> ;;mov byte [writei.valid], 1 15728 00011060 C3 <1> retn 15729 <1> 15730 <1> ; 19/12/2025 15731 <1> %if 0 15732 <1> 15733 <1> mget_w_13: 15734 <1> ; EAX = FDT number (Current Section) 15735 <1> ; EDX = Sector index from the first section (0,1,2,3,4...) 15736 <1> sub edx, [writei.fs_index] 15737 <1> ; EDX = Sector index from current section 15738 <1> mov [writei.fs_index], edx 15739 <1> inc eax ; the first data sector in FS disk section 15740 <1> add eax, edx 15741 <1> jmp short mget_w_12 15742 <1> 15743 <1> mget_w_14: 15744 <1> ;mov cl, [esi+LD_FS_BytesPerSec+1] 15745 <1> ;shr cl, 1 ; ; 1 for 512 bytes, 4 for 2048 bytes 15746 <1> ;mov [writei.spc], cl ; sectors per cluster 15747 <1> ; 19/12/2025 15748 <1> mov byte [writei.spc], 1 15749 <1> ; NOTE: writei bytes per sector value is always 512 ! 15750 <1> mov word [writei.bpc], 512 15751 <1> 15752 <1> mov ecx, ebp 15753 <1> add ecx, [u.count] ; next file position 15754 <1> cmp ecx, [i.size] ; <= file size ? 15755 <1> ;jna mget_w_19 ; no 15756 <1> ja short mget_w_22 15757 <1> ; 23/07/2022 15758 <1> jmp mget_w_19 15759 <1> 15760 <1> mget_w_22: 15761 <1> sub edx, edx ; 0 15762 <1> mov [writei.sector], edx ; 0 15763 <1> mov [writei.offset], dx ; byte offset in cluster 15764 <1> mov [writei.s_index], dl ; sector index in cluster (0 to spc -1) 15765 <1> 15766 <1> shr ecx, 9 ; 1 cluster = 512 bytes 15767 <1> mov [writei.c_index], ecx ; section/cluster index 15768 <1> 15769 <1> mov eax, ebx ; FDT number (First FDT address) 15770 <1> 15771 <1> ; is this the 1st mget_w or a next mget_w call ? (by 'writei') 15772 <1> cmp byte [writei.valid], dl ; 0 15773 <1> jna short mget_w_15 15774 <1> 15775 <1> mov byte [writei.valid], dl ; 0 ; reset ('writei' will set it) 15776 <1> 15777 <1> cmp eax, [writei.fclust] 15778 <1> jne short mget_w_15 15779 <1> 15780 <1> mov cl, [cdev] 15781 <1> cmp cl, [writei.drv] 15782 <1> jne short mget_w_15 15783 <1> ; [writei.l_clust] & [writei.l_index] are valid, 15784 <1> ; we don't need to get last cluster & last cluster index 15785 <1> mov ecx, [writei.l_index] 15786 <1> jmp short mget_w_17 15787 <1> mget_w_15: 15788 <1> mov [writei.fclust], eax ; first section (FDT number) 15789 <1> ; edx = 0 15790 <1> mov [writei.cluster], edx ; 0 ; current section 15791 <1> mov [writei.fs_index], edx ; 0 ; curret section index 15792 <1> 15793 <1> ; eax = FDT number (section 0 header address) 15794 <1> call get_last_section 15795 <1> ;jc short mget_w_err ; eax = error code 15796 <1> ; 08/08/2022 15797 <1> jnc short mget_w_26 15798 <1> jmp mget_w_err 15799 <1> mget_w_26: 15800 <1> mov [writei.fs_index], edx ; sector index in last section 15801 <1> 15802 <1> mov [writei.lclust], eax ; last section address 15803 <1> 15804 <1> mov ecx, [glc_index] ; last section index 15805 <1> mov [writei.l_index], ecx 15806 <1> 15807 <1> mov al, [writei.ofn] 15808 <1> inc al 15809 <1> mov [setfmod], al ; update lm date&time sign 15810 <1> 15811 <1> mget_w_16: 15812 <1> ; edx = (existing) last section (sector) index 15813 <1> mov ecx, [writei.c_index] ; final section (sector) index 15814 <1> sub ecx, edx 15815 <1> jna short mget_w_19 15816 <1> ; ecx = sector count 15817 <1> mget_w_17: 15818 <1> mov eax, [writei.lclust] 15819 <1> ; ESI = Logical dos drv desc. table address 15820 <1> ; EAX = Last section 15821 <1> ; (ECX = 0 for directory) 15822 <1> ; ECX = sector count (except FDT) 15823 <1> call add_new_fs_section 15824 <1> jnc short mget_w_18 15825 <1> 15826 <1> ; If error number = 27h (insufficient disk space) 15827 <1> ; it is needed to check free consequent sectors 15828 <1> ; (1 data sector at least and +1 section header sector) 15829 <1> 15830 <1> cmp eax, 27h 15831 <1> ;jne mget_w_err ; eax = error code 15832 <1> ; 25/07/2022 15833 <1> je short mget_w_24 15834 <1> mget_w_23: 15835 <1> jmp mget_w_err 15836 <1> mget_w_24: 15837 <1> ; ecx = count of free consequent sectors 15838 <1> ; ecx must be > 1 (1 data + 1 header sector) 15839 <1> dec ecx 15840 <1> ;jz short mget_w_err 15841 <1> ;jmp short mget_w_17 15842 <1> ; 23/07/2022 15843 <1> jnz short mget_w_17 15844 <1> ;jmp mget_w_err 15845 <1> ; 25/07/2022 15846 <1> jmp short mget_w_23 15847 <1> 15848 <1> mget_w_18: 15849 <1> mov [writei.lclust], eax ; (new) last section 15850 <1> ; ecx = sector count (except section header) 15851 <1> mov edx, [writei.l_index] 15852 <1> add edx, ecx ; add sector count to index 15853 <1> mov [writei.l_index], edx 15854 <1> jmp short mget_w_16 15855 <1> 15856 <1> mget_w_19: 15857 <1> mov ecx, ebp 15858 <1> add ecx, [u.count] 15859 <1> mov [i.size], ecx ; save new file size 15860 <1> ;sub edx, edx ; 0 15861 <1> 15862 <1> mov al, [cdev] 15863 <1> mov [writei.drv], al ; physical drive number 15864 <1> ; edx = 0 15865 <1> mov eax, ebp ; file offset 15866 <1> mov edx, eax 15867 <1> ; 1 cluster = 512 bytes (for Singlix FS) 15868 <1> shr eax, 9 ; / 512 15869 <1> and edx, 1FFh 15870 <1> ; edx = byte offset in cluster/sector (<= 511) 15871 <1> ; eax = section (sector/cluster) index 15872 <1> mov [writei.c_index], eax 15873 <1> mov [writei.offset], dx 15874 <1> ;mov byte [writei.s_index], 0 ; sector index in cluster 15875 <1> jmp mget_w_3 15876 <1> 15877 <1> %endif 15878 <1> 15879 <1> update_file_lmdt: ; & update file size 15880 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 15881 <1> ; 03/09/2024 15882 <1> ; 27/08/2024 - TRDOS 386 v2.0.9 15883 <1> ; 30/07/2022 15884 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 15885 <1> ; 26/10/2016 15886 <1> ; 24/10/2016 15887 <1> ; 23/10/2016 15888 <1> ; 22/10/2016 - TRDOS 386 (TRDOS v2.0) 15889 <1> ; 15890 <1> ; Update last modification date&time of file 15891 <1> ; (call from syswrite -> writei) 15892 <1> ; ((also updates file size)) // 26/10/2016 15893 <1> ; 15894 <1> ; INPUT: 15895 <1> ; byte [setfmod] = open file number 15896 <1> ; OUTPUT: 15897 <1> ; cf = 0 -> success ! 15898 <1> ; cf = 1 -> lmdt update has been failed! 15899 <1> ; 15900 <1> ; Modified registers: eax, ebx, ecx, edx, esi, edi 15901 <1> ; 15902 <1> 15903 <1> ;cmp byte [setfmod], 0 15904 <1> ;jna short uflmdt_2 ; nothing to do 15905 <1> 15906 <1> ; 27/08/2024 15907 <1> ; if [ebx+OF_FCLUSTER] = 0 and [setfclust] > 0 15908 <1> ; [setfclust] will be copied to Directory entry's 15909 <1> ; first cluster fields (LO/HI). 15910 <1> ; (and [setfclust] will be cleared.) 15911 <1> 15912 00011061 31C0 <1> xor eax, eax 15913 <1> 15914 00011063 0FB61D[63830100] <1> movzx ebx, byte [setfmod] 15915 0001106A FECB <1> dec bl ; open file index number (0 based) 15916 <1> 15917 0001106C 8AA3[F8830100] <1> mov ah, [ebx+OF_DRIVE] 15918 00011072 BE00010900 <1> mov esi, Logical_DOSDisks 15919 00011077 01C6 <1> add esi, eax 15920 00011079 C0E302 <1> shl bl, 2 ; *4 15921 0001107C 8B8B[78830100] <1> mov ecx, [ebx+OF_FCLUSTER] ; first cluster 15922 00011082 8B93[F8850100] <1> mov edx, [ebx+OF_DIRCLUSTER] ; dir cluster 15923 <1> 15924 00011088 D0EB <1> shr bl, 1 ; /2 15925 0001108A 0FB7BB[F8870100] <1> movzx edi, word [ebx+OF_DIRENTRY] 15926 <1> 15927 <1> ; 03/09/2024 15928 00011091 80C441 <1> add ah, 'A' 15929 00011094 8A4603 <1> mov al, [esi+LD_FATType] 15930 <1> 15931 00011097 803D[9D7E0100]01 <1> cmp byte [DirBuff_ValidData], 1 15932 0001109E 727E <1> jb short uflmdt_4 15933 <1> 15934 <1> ;mov al, [DirBuff_DRV] 15935 <1> ;sub al, 'A' 15936 <1> ;cmp al, ah 15937 <1> ; 03/09/2024 15938 <1> ; 27/08/2024 15939 <1> ;add ah, 'A' 15940 <1> ;mov al, [esi+LD_FATType] 15941 000110A0 3A25[9B7E0100] <1> cmp ah, [DirBuff_DRV] 15942 000110A6 7576 <1> jne short uflmdt_4 ; different drive 15943 <1> ;mov al, [esi+LD_FATType] 15944 000110A8 3A05[9C7E0100] <1> cmp al, [DirBuff_FATType] 15945 000110AE 756E <1> jne short uflmdt_5 ; different FS type 15946 000110B0 3B15[A27E0100] <1> cmp edx, [DirBuff_Cluster] 15947 000110B6 7566 <1> jne short uflmdt_5 ; different cluster 15948 <1> 15949 <1> uflmdt_1: 15950 <1> ; Directory buffer is ready here! 15951 <1> ; OF_FCLUSTER must be compared/verified 15952 000110B8 BE00000800 <1> mov esi, Directory_Buffer 15953 <1> ;shl di, 5 ; dir entry index * 32 15954 <1> ; 23/07/2022 15955 000110BD C1E705 <1> shl edi, 5 15956 000110C0 01FE <1> add esi, edi ; offset 15957 <1> ; 15958 <1> ; 03/09/2024 15959 <1> ;test byte [esi+DirEntry_Attr], 18h ; Vol & Dir 15960 <1> ;jnz short uflmdt_2 ; not a valid file ! 15961 000110C2 668B4614 <1> mov ax, [esi+DirEntry_FstClusHI] 15962 000110C6 C1E010 <1> shl eax, 16 15963 000110C9 668B461A <1> mov ax, [esi+DirEntry_FstClusLO] 15964 <1> 15965 <1> ; 03/09/2024 (short jump) 15966 000110CD F6460B18 <1> test byte [esi+DirEntry_Attr], 18h ; Vol & Dir 15967 000110D1 7571 <1> jnz short uflmdt_2 ; not a valid file ! 15968 <1> 15969 000110D3 39C8 <1> cmp eax, ecx ; same first cluster ? 15970 <1> ;je short uflmdt_3 ; yes, it is OK !!! 15971 <1> ; 23/07/2022 15972 000110D5 756D <1> jne short uflmdt_2 15973 <1> 15974 <1> ;;; 15975 <1> ; 03/09/2024 15976 000110D7 D0E3 <1> shl bl, 1 ; *2 15977 <1> ; 27/08/2024 15978 000110D9 21C0 <1> and eax, eax 15979 000110DB 751B <1> jnz short uflmdt_3 ; not empty file 15980 000110DD 8705[64830100] <1> xchg eax, [setfclust] 15981 000110E3 09C0 <1> or eax, eax 15982 000110E5 7411 <1> jz short uflmdt_3 15983 <1> ; 03/09/2024 15984 000110E7 8983[78830100] <1> mov [ebx+OF_FCLUSTER], eax 15985 <1> ; 15986 000110ED 6689461A <1> mov [esi+DirEntry_FstClusLO], ax 15987 000110F1 C1E810 <1> shr eax, 16 15988 000110F4 66894614 <1> mov [esi+DirEntry_FstClusHI], ax 15989 <1> ;;; 15990 <1> 15991 <1> uflmdt_3: 15992 <1> ; Update directory entry 15993 <1> ; 03/09/2024 15994 <1> ; 26/10/2016 15995 <1> ;shl bl, 1 ; *2 15996 000110F8 8B83[F8840100] <1> mov eax, [ebx+OF_SIZE] ; file size 15997 000110FE 89461C <1> mov [esi+DirEntry_FileSize], eax 15998 <1> ; 15999 00011101 E8F69BFFFF <1> call convert_current_date_time 16000 <1> ; OUTPUT -> DX = Date in dos dir entry format 16001 <1> ; AX = Time in dos dir entry format 16002 00011106 66894616 <1> mov [esi+DirEntry_WrtTime], ax 16003 0001110A 66895618 <1> mov [esi+DirEntry_WrtDate], dx 16004 0001110E 66895612 <1> mov [esi+DirEntry_LastAccDate], dx 16005 00011112 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 16006 <1> ;call save_directory_buffer 16007 <1> ;retn 16008 <1> ; 23/07/2022 16009 00011119 E9739CFFFF <1> jmp save_directory_buffer 16010 <1> 16011 <1> uflmdt_4: 16012 <1> ; Directory buffer sector read&write 16013 <1> ; 23/10/2016 16014 <1> ; 27/08/2024 16015 <1> ;mov al, [esi+LD_FATType] 16016 <1> uflmdt_5: 16017 0001111E BB[A4940100] <1> mov ebx, rw_buffer ; Common r/w sector buffer addr 16018 <1> 16019 <1> ; 19/12/2025 16020 <1> %if 0 16021 <1> and al, al ; 0 = Singlix FS 16022 <1> jz short uflmdt_11 16023 <1> %endif 16024 <1> 16025 <1> ;uflmdt_12: 16026 00011123 21D2 <1> and edx, edx 16027 00011125 7527 <1> jnz short uflmdt_9 16028 <1> 16029 00011127 3C02 <1> cmp al, 2 ; 3 = FAT32 16030 00011129 7720 <1> ja short uflmdt_8 16031 <1> 16032 0001112B 89F8 <1> mov eax, edi ; directory entry index number 16033 <1> ;shr ax, 4 ; 16 entries per sector 16034 <1> ; 23/07/2022 16035 0001112D C1E804 <1> shr eax, 4 16036 00011130 034664 <1> add eax, [esi+LD_ROOTBegin] 16037 <1> ; eax = root directory sector 16038 <1> uflmdt_6: 16039 00011133 50 <1> push eax ; * ; disk sector address 16040 00011134 51 <1> push ecx ; first cluster 16041 00011135 B901000000 <1> mov ecx, 1 16042 <1> ; ecx = sector count 16043 0001113A E8B4080000 <1> call disk_read 16044 0001113F 59 <1> pop ecx 16045 00011140 7320 <1> jnc short uflmdt_10 16046 00011142 58 <1> pop eax ; * 16047 <1> uflmdt_7: 16048 00011143 C3 <1> retn 16049 <1> 16050 <1> uflmdt_2: 16051 <1> ; save directory buffer if has modified/changed sign 16052 <1> ; (It is good to save dir buff even if the searched 16053 <1> ; directory entry is not found !?) 16054 00011144 E8489CFFFF <1> call save_directory_buffer 16055 00011149 F9 <1> stc ; update failed 16056 0001114A C3 <1> retn 16057 <1> 16058 <1> ; 19/12/2025 16059 <1> %if 0 16060 <1> uflmdt_11: 16061 <1> ; 24/10/2016 16062 <1> ; Update last modification date & time of a file 16063 <1> ; on a disk with Singlix File System. 16064 <1> ; 16065 <1> ; (Method: Read the FDT -File Description Table- 16066 <1> ; sector of the file and update the lmdt data fields, 16067 <1> ; then write FDT sector to the disk. 16068 <1> ; /// It is easy but there is compatibility buffer 16069 <1> ; method also for changing directory entry data and 16070 <1> ; also there are some programming issues for Singlix 16071 <1> ; file system (TRFS), which are not completed yet!) 16072 <1> ; 16073 <1> ; Not ready yet ! (24/10/2016) 16074 <1> ; /// Temporary code for error return ! /// 16075 <1> xor eax, eax 16076 <1> stc 16077 <1> retn 16078 <1> %endif 16079 <1> 16080 <1> uflmdt_8: 16081 0001114B 8B5632 <1> mov edx, [esi+LD_BPB+FAT32_RootFClust] 16082 <1> uflmdt_9: 16083 0001114E 83FA02 <1> cmp edx, 2 16084 00011151 72F0 <1> jb short uflmdt_7 ; invalid, nothing to do 16085 <1> 16086 <1> ;sub edx, 2 16087 <1> ; 30/07/2022 16088 00011153 4A <1> dec edx 16089 00011154 4A <1> dec edx 16090 00011155 89D0 <1> mov eax, edx 16091 00011157 0FB65613 <1> movzx edx, byte [esi+LD_BPB+SecPerClust] 16092 0001115B F7E2 <1> mul edx 16093 0001115D 034668 <1> add eax, [esi+LD_DATABegin] 16094 <1> ; eax = sub directory (data) sector 16095 00011160 EBD1 <1> jmp short uflmdt_6 16096 <1> 16097 <1> uflmdt_10: 16098 <1> ; Directory sector buffer is ready here! 16099 <1> ; OF_FCLUSTER must be compared/verified 16100 <1> ; edi = dir entry index number (<= 2047) 16101 00011162 6683E70F <1> and di, 0Fh ; 16 entries per sector 16102 <1> ;shl di, 5 ; dir entry index * 32 16103 <1> ; 23/07/2022 16104 00011166 C1E705 <1> shl edi, 5 16105 00011169 81C7[A4940100] <1> add edi, rw_buffer 16106 <1> ; 16107 0001116F F6470B18 <1> test byte [edi+DirEntry_Attr], 18h ; Vol & Dir 16108 00011173 75CF <1> jnz short uflmdt_2 ; not a valid file ! 16109 00011175 668B5714 <1> mov dx, [edi+DirEntry_FstClusHI] 16110 00011179 C1E210 <1> shl edx, 16 16111 0001117C 668B571A <1> mov dx, [edi+DirEntry_FstClusLO] 16112 00011180 39CA <1> cmp edx, ecx ; same first cluster ? 16113 00011182 75C0 <1> jne short uflmdt_2 ; no !? 16114 <1> 16115 <1> ;;; 16116 <1> ; 27/08/2024 16117 00011184 21D2 <1> and edx, edx 16118 00011186 7515 <1> jnz short uflmdt_12 ; not empty file 16119 00011188 8715[64830100] <1> xchg edx, [setfclust] 16120 0001118E 09D2 <1> or edx, edx 16121 00011190 740B <1> jz short uflmdt_12 16122 00011192 6689571A <1> mov [edi+DirEntry_FstClusLO], dx 16123 00011196 C1EA10 <1> shr edx, 16 16124 00011199 66895714 <1> mov [edi+DirEntry_FstClusHI], dx 16125 <1> uflmdt_12: 16126 <1> ;;; 16127 <1> 16128 <1> ; Update directory entry 16129 0001119D E85A9BFFFF <1> call convert_current_date_time 16130 <1> ; OUTPUT -> DX = Date in dos dir entry format 16131 <1> ; AX = Time in dos dir entry format 16132 000111A2 66894716 <1> mov [edi+DirEntry_WrtTime], ax 16133 000111A6 66895718 <1> mov [edi+DirEntry_WrtDate], dx 16134 000111AA 66895712 <1> mov [edi+DirEntry_LastAccDate], dx 16135 <1> 16136 000111AE 58 <1> pop eax ; * 16137 <1> 16138 000111AF BB[A4940100] <1> mov ebx, rw_buffer ; Common r/w sector buffer addr 16139 000111B4 B901000000 <1> mov ecx, 1 16140 <1> ; esi = logical dos description table address 16141 <1> ; eax = disk sector number/address (LBA) 16142 <1> ; ecx = sector count 16143 <1> ; ebx = buffer address 16144 000111B9 E826080000 <1> call disk_write 16145 000111BE 7284 <1> jc short uflmdt_2 16146 <1> ;uflmdt_12: 16147 <1> ; save directory buffer if has modified/changed sign 16148 <1> ;call save_directory_buffer 16149 <1> ;retn 16150 <1> ; 23/07/2022 16151 000111C0 E9CC9BFFFF <1> jmp save_directory_buffer 16152 <1> 16153 <1> sysalloc: 16154 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 16155 <1> ; 14/10/2017 16156 <1> ; 20/08/2017 - 01/09/2017 16157 <1> ; 20/02/2017 - 04/03/2017 - 15/05/2017 16158 <1> ; 19/02/2017 - TRDOS 386 (TRDOS v2.0) 16159 <1> ; (TRDOS 386 feature only!) 16160 <1> ; 16161 <1> ; Allocate Contiguous Memory Block/Pages (for user) 16162 <1> ; (System call for DMA Buffer allocation etc.) 16163 <1> ; 16164 <1> ; INPUT -> 16165 <1> ; EBX = Virtual address (for user) 16166 <1> ; (Physical memory block/aperture 16167 <1> ; will be mapped to this virtual address) 16168 <1> ; ECX = Byte Count 16169 <1> ; (will be rounded up to page border) 16170 <1> ; If ECX = 0 16171 <1> ; System call will return with an error (cf=1) 16172 <1> ; but ECX will contain maximum size of 16173 <1> ; available memory aperture and physical 16174 <1> ; (beginning) address of that aperture 16175 <1> ; (which have maximum size) will be in EAX. 16176 <1> ; EDX = Upper limit of the requested physical memory 16177 <1> ; block/pages. 16178 <1> ; (The last byte address of the memory aperture 16179 <1> ; must not be equal to or above this limit.) 16180 <1> ; If EDX = 0 16181 <1> ; there is NOLIMIT ! 16182 <1> ; If EDX = 0FFFFFFFFh (-1) 16183 <1> ; ESI = Lower Limit ! 16184 <1> ; (Beginning of the block must not be 'less' 16185 <1> ; than this.) (Must be equal to or above...) 16186 <1> ; EDI = Upper Limit ! 16187 <1> ; (End of the block must be !less! than this) 16188 <1> ; (The last byte addr of the memory aperture 16189 <1> ; must not be equal to or above this limit.) 16190 <1> ; 16191 <1> ; OUTPUT -> 16192 <1> ; If CF = 0 16193 <1> ; EAX = Physical address of the allocated memory block 16194 <1> ; ECX = Allocated bytes (as rounded up to page borders) 16195 <1> ; EBX = Virtual address (as rounded up) 16196 <1> ; IF CF = 1 16197 <1> ; Requested (size of) Memory block could not be 16198 <1> ; allocated to the user! 16199 <1> ; IF CF = 1 & EAX = 0 (Insufficient memory error!) 16200 <1> ; ECX = Total number of free bytes 16201 <1> ; (not size of available contiguous bytes!) 16202 <1> ; If CF = 1 & EAX > 0 16203 <1> ; there is not a memory aperture with requested size 16204 <1> ; but total free mem is not less than requested size. 16205 <1> ; EAX = Physical addr of available memory aperture 16206 <1> ; with max size 16207 <1> ; (but it doesn't fit to the conditions!) 16208 <1> ; ECX = Size of available memory aperture in bytes. 16209 <1> ; If CF = 1 -> EAX = 0FFFFFFFFh 16210 <1> ; Conditions/Parameters are wrong ! 16211 <1> ; ECX is same with input value. 16212 <1> ; 16213 <1> ; Note: Previously allocated pages will be deallocated if 16214 <1> ; new allocation conditions are met. 16215 <1> ; 16216 <1> ; Note: u.break control may be included in future versions 16217 <1> ; 16218 <1> 16219 000111C5 31C0 <1> xor eax, eax ; 0 16220 <1> ; 14/10/2017 16221 000111C7 4A <1> dec edx ; is there a limit ? 16222 000111C8 7810 <1> js short sysalloc_1 ; 0 -> 0FFFFFFFFh -> NO LIMIT 16223 000111CA 42 <1> inc edx ; > 0 16224 <1> ; Check upper address limit 16225 <1> ;(round up to page borders) 16226 000111CB 81C1FF0F0000 <1> add ecx, PAGE_SIZE-1 ; 4095 16227 000111D1 6681E100F0 <1> and cx, ~PAGE_OFF ; not 4095 16228 000111D6 39CA <1> cmp edx, ecx ; upper limit - block size 16229 000111D8 7224 <1> jb short sysalloc_err 16230 <1> sysalloc_1: 16231 <1> ; EAX = Beginning address (physical) 16232 <1> ; EAX = 0 -> Allocate mem block from the 1st proper aperture 16233 <1> ; ECX = Number of bytes to be allocated 16234 000111DA E8664BFFFF <1> call allocate_memory_block 16235 000111DF 721D <1> jc short sysalloc_err 16236 <1> ; 01/09/2017 16237 000111E1 29C2 <1> sub edx, eax ; upper limit address - beginning address 16238 000111E3 760F <1> jna short sysalloc_3 ; begin addr not less than the limit 16239 000111E5 39CA <1> cmp edx, ecx 16240 000111E7 720B <1> jb short sysalloc_3 ; end address overs the limit 16241 <1> sysalloc_2: 16242 <1> ; EAX = Beginning (physical) addr of the allocated mem block 16243 <1> ; ECX = Num of allocated bytes (rounded up to page borders) 16244 000111E9 50 <1> push eax ; * ; 04/03/2017 16245 <1> ; Here, requested contiquous memory pages have been allocated 16246 <1> ; on Memory Allocation Table but user's page directory 16247 <1> ; and page tables have not been updated yet! 16248 000111EA 51 <1> push ecx ; ** 16249 <1> ; ebx = virtual address (will be rounded up to page border) 16250 <1> ; ecx = number of bytes to be deallocated 16251 <1> ; will be adjusted to ebx+ecx round down - ebx round up 16252 000111EB E8AD4EFFFF <1> call deallocate_user_pages 16253 000111F0 731F <1> jnc short sysalloc_4 ; EAX = Deallocated memory bytes 16254 000111F2 59 <1> pop ecx ; ** 16255 000111F3 58 <1> pop eax ; * 16256 <1> sysalloc_3: 16257 <1> ; error ! 16258 <1> ; restore Memory Allocation Table Content 16259 000111F4 E8664DFFFF <1> call deallocate_memory_block 16260 000111F9 31C0 <1> xor eax, eax ; 0 16261 000111FB 48 <1> dec eax ; 0FFFFFFFFh ; 15/05/2017 16262 000111FC EB09 <1> jmp short sysalloc_wrong 16263 <1> sysalloc_err: 16264 000111FE 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 16265 00011204 894D18 <1> mov [ebp+24], ecx ; return to user with ecx value 16266 <1> sysalloc_wrong: 16267 <1> ; eax = 0FFFFFFFFh 16268 00011207 A3[6C8E0100] <1> mov [u.r0], eax 16269 0001120C E95DB8FFFF <1> jmp error 16270 <1> sysalloc_4: 16271 00011211 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 16272 00011217 894518 <1> mov [ebp+24], eax ; return to user with ecx value 16273 0001121A 895D10 <1> mov [ebp+16], ebx ; new value of ebx (rounded up) 16274 0001121D 89C1 <1> mov ecx, eax ; byte count (from 'deallocate_user_pages') 16275 0001121F 5A <1> pop edx ; ** ; discard (another) byte count 16276 00011220 58 <1> pop eax ; * 16277 00011221 A3[6C8E0100] <1> mov [u.r0], eax ; physical address 16278 <1> 16279 00011226 51 <1> push ecx ; 20/08/2017 16280 <1> ; 16281 <1> ; Write newly allocated contiguous (physical) pages 16282 <1> ; on page dir and page tables of current user/process 16283 <1> ; as PRESENT, USER, WRITABLE 16284 <1> ; (then clear allocated pages) 16285 00011227 E8594FFFFF <1> call allocate_user_pages 16286 <1> ;jnc sysret ; OK! return to process with success... 16287 <1> 16288 <1> ; 20/08/2017 ('sysdma' modification) 16289 0001122C 59 <1> pop ecx 16290 0001122D A1[6C8E0100] <1> mov eax, [u.r0] ; physical address (of the block) 16291 <1> 16292 00011232 7219 <1> jc short sysalloc_6 16293 <1> 16294 00011234 833D[308D0100]FF <1> cmp dword [dma_addr], 0FFFFFFFFh ; -1 16295 <1> ;jb sysret 16296 <1> ; 23/07/2022 16297 0001123B 720B <1> jb short sysalloc_5 ; jmp sysret 16298 <1> 16299 0001123D A3[308D0100] <1> mov [dma_addr], eax ; save dma address for sysdma 16300 00011242 890D[348D0100] <1> mov [dma_size], ecx ; save dma buff size for sysdma 16301 <1> sysalloc_5: 16302 00011248 E941B8FFFF <1> jmp sysret 16303 <1> 16304 <1> sysalloc_6: 16305 <1> ; 16306 <1> ; unexpected error ! insufficient memory !? conflict !? 16307 <1> ; (!!?there is not a free page for a new page table?!!) 16308 <1> ; We need to terminate process with error message !!! 16309 <1> ; 16310 0001124D 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 16311 00011253 8B4D18 <1> mov ecx, [ebp+24] ; byte count 16312 <1> 16313 <1> ; 20/08/2017 16314 <1> ;mov eax, [u.r0] ; physical address (of the block) 16315 <1> 16316 <1> ; 16317 <1> ; restore Memory Allocation Table Content 16318 00011256 E8044DFFFF <1> call deallocate_memory_block 16319 <1> ; 16320 0001125B 803D[2E680000]03 <1> cmp byte [CRT_MODE], 3 ; 80x25 text mode? 16321 00011262 7407 <1> je short sysalloc_7 ; yes 16322 <1> ; Current mode is VGA (or CGA graphics) mode, 16323 <1> ; We need to return to text mode for displaying 16324 <1> ; error message just before 'sysexit'. 16325 00011264 B003 <1> mov al, 3 16326 00011266 E81A09FFFF <1> call _set_mode 16327 <1> sysalloc_7: 16328 0001126B BE[F8310100] <1> mov esi, beep_Insufficient_Memory ; error message 16329 00011270 E8455BFFFF <1> call print_msg ; print/display the message 16330 00011275 B801000000 <1> mov eax, 1 ; ax=1 is needed for 'sysexit' procedure 16331 0001127A E94DB9FFFF <1> jmp sysexit ; and terminate the process ! 16332 <1> 16333 <1> sysdalloc: 16334 <1> ; 19/02/2017 - TRDOS 386 (TRDOS v2.0) 16335 <1> ; (TRDOS 386 feature only!) 16336 <1> ; 16337 <1> ; Deallocate Memory Block/Pages (for user) 16338 <1> ; (Complementary call for sysalloc.) 16339 <1> ; 16340 <1> ; INPUT -> 16341 <1> ; EBX = Virtual address (for user) 16342 <1> ; (will be rounded up to page border) 16343 <1> ; ECX = Byte Count 16344 <1> ; (will be adjusted to page borders) 16345 <1> ; If ICX = 0 16346 <1> ; nothing to do 16347 <1> ; If EBX + ECX > User's ESP 16348 <1> ; nothing to do 16349 <1> ; 16350 <1> ; Note: u.break control may be included in future versions 16351 <1> ; 16352 <1> ; OUTPUT -> 16353 <1> ; If CF = 0 16354 <1> ; EAX = Deallocated memory bytes 16355 <1> ; EBX = Virtual address (as rounded up) 16356 <1> ; IF CF = 1 16357 <1> ; EAX = 0 16358 <1> ; 16359 <1> ; Note: Main purpose of this call is to deallocate/release 16360 <1> ; previously allocated (physically) contiguous memory 16361 <1> ; pages but beginning (virtual) address may not be 16362 <1> ; followed by physically contiguous pages. So, this 16363 <1> ; system call will deallocate user's virtually 16364 <1> ; contiguous memory pages. Also, there is not any 16365 <1> ; objections to use this system call without sysalloc 16366 <1> ; system call; only possible objection is to lost data 16367 <1> ; within user's memory space, if the beginning address 16368 <1> ; and size is not proper. 16369 <1> ; 16370 <1> ; Note: Empty page tables will not be deallocated!!! 16371 <1> ; (they will be deallocated at process termination) 16372 <1> ; 16373 <1> ; Note: When the program terminates itself or when it is 16374 <1> ; terminated by operating system kernel, all allocated 16375 <1> ; memory pages will be deallocated during termination 16376 <1> ; stage. So, 'sysdalloc' is not necessary except 16377 <1> ; forgiving memory block to other programs/processes. 16378 <1> ; 16379 0001127F 8B15[648E0100] <1> mov edx, [u.sp] 16380 00011285 8B420C <1> mov eax, [edx+12] ; user's stack pointer 16381 00011288 29C8 <1> sub eax, ecx ; esp - byte count 16382 0001128A 24FC <1> and al, 0FCh ; dword alignment 16383 0001128C 39D8 <1> cmp eax, ebx 16384 0001128E 7220 <1> jb short sysdalloc_err ; deallocation overlaps with stack 16385 <1> 16386 00011290 31C0 <1> xor eax, eax 16387 00011292 21C9 <1> and ecx, ecx 16388 00011294 7407 <1> jz short sysdalloc_2 16389 <1> 16390 00011296 E8024EFFFF <1> call deallocate_user_pages 16391 0001129B 7213 <1> jc short sysdalloc_err 16392 <1> 16393 <1> sysdalloc_2: 16394 0001129D A3[6C8E0100] <1> mov [u.r0], eax 16395 000112A2 8B2D[688E0100] <1> mov ebp, [u.usp] 16396 000112A8 895D10 <1> mov [ebp+16], ebx ; new value of ebx 16397 000112AB E9DEB7FFFF <1> jmp sysret 16398 <1> 16399 <1> sysdalloc_err: 16400 000112B0 A3[6C8E0100] <1> mov [u.r0], eax ; 0 16401 000112B5 E9B4B7FFFF <1> jmp error 16402 <1> 16403 <1> syscalbac: 16404 <1> ; SYS CALLBACK 16405 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 16406 <1> ; 03/08/2020 16407 <1> ; 16/04/2017 16408 <1> ; 14/04/2017 16409 <1> ; 13/04/2017 16410 <1> ; 28/02/2017 16411 <1> ; 26/02/2017 16412 <1> ; 24/02/2017 16413 <1> ; 21/02/2017 - TRDOS 386 (TRDOS v2.0) 16414 <1> ; (TRDOS 386 feature only!) 16415 <1> ; 16416 <1> ; Link or unlink IRQ callback service to/from user (ring 3) 16417 <1> ; 16418 <1> ; INPUT -> 16419 <1> ; BL = IRQ number (Hardware interrupt request number) 16420 <1> ; (0 t0 15 but IRQ 0,1,2,6,8,14,15 are prohibited) 16421 <1> ; IRQ numbers 3,4,5,7,9,10,11,12,13 are valid 16422 <1> ; (numbers >15 are invalid) 16423 <1> ; 16424 <1> ; BH = 0 = Unlink IRQ (in BL) from user (ring 3) service 16425 <1> ; 1 = Link IRQ by using Signal Response Byte method 16426 <1> ; 2 = Link IRQ by using Callback service method 16427 <1> ; 3 = Link IRQ by using Auto Increment S.R.B. method 16428 <1> ; >3 = invalid 16429 <1> ; 16430 <1> ; CL = Signal Return/Response Byte value 16431 <1> ; 16432 <1> ; If BH = 3, kernel will put a counter value ; 03/08/2020 16433 <1> ; (into the S.R.B. addr) 16434 <1> ; between 0 to 255. (start value = CL+1) 16435 <1> ; 16436 <1> ; NOTE: counter value, for example: even and odd numbers 16437 <1> ; may be used for -audio- DMA buffer switch 16438 <1> ; within double buffer method, etc. 16439 <1> ; 16440 <1> ; EDX = Signal return (Response) byte address 16441 <1> ; - or - 16442 <1> ; Interrupt/Callback service/routine address 16443 <1> ; 16444 <1> ; (virtual address in user's memory space) 16445 <1> ; 16446 <1> ; OUTPUT -> 16447 <1> ; CF = 0 & EAX = 0 -> Successful setting 16448 <1> ; CF = 1 & EAX > 0 -> IRQ is prohibited or locked 16449 <1> ; by another process 16450 <1> ; eax = ERR_PERM_DENIED -> prohibited or locked 16451 <1> ; eax = ERR_INV_PARAMETER -> 16452 <1> ; invalid parameter/option or bad address 16453 <1> ; 16454 <1> ; NOTE: Timer callbacks are set by using 'systimer' 16455 <1> ; system call (IRQ 0, PIT and IRQ 8, RTC) 16456 <1> ; 16457 <1> ; Direct keyboard access is performed by using 16458 <1> ; Keyboard Interrupt (INT 32h) 16459 <1> ; 16460 <1> ; It is prohibited here because: 16461 <1> ; 1) Signal Response Byte method has not advantage 16462 <1> ; against INT 32h, function AH = 1. Also, 16463 <1> ; keyboard service interrupt will return with 16464 <1> ; ascii and scan codes (AL, AH) while 16465 <1> ; SRB method has only 1 byte space for ascii code 16466 <1> ; or scan code. One byte signal response is used 16467 <1> ; for ensuring very simple and very fast 16468 <1> ; virtual to physical memory address conversion 16469 <1> ; without any memory page crossover risk. 16470 <1> ; (Otherwise double page conversion or word 16471 <1> ; alignment would be needed.) 16472 <1> ; 2) Badly written user code (callback code) 16473 <1> ; can prevent keyboard and timesharing functions 16474 <1> ; of the operating system via continuous and long 16475 <1> ; keyboard event handling by callback service. 16476 <1> ; (It can cause to lose immediate keystroke 16477 <1> ; response from hardware to user.) 16478 <1> ; 3) If user will check any keyboard events, 'getkey' 16479 <1> ; (or 'getchar') must have more priority than other 16480 <1> ; (video etc.) events because only control ability 16481 <1> ; on a procedural infinite loop is a keyboard or 16482 <1> ; mouse event. So user can use keyboard function 16483 <1> ; at the end or at the beginning of a loop. 16484 <1> ; In this case, INT 32h is used for that purpose 16485 <1> ; and timer interrupt etc. callbacks can be used 16486 <1> ; for dynamic and synchronized data refresh/transfer 16487 <1> ; while cpu is in a static loop (without polling). 16488 <1> ; Keyboard Int callback is not more useful because 16489 <1> ; already a manual check (a key is pressed or not) 16490 <1> ; can be performed (via INT 32h, AH = 1) efficiently 16491 <1> ; in a loop to prevent a locked infinitive loop. 16492 <1> ; 16493 <1> ; Disk IRQs (6,14,15) have been phohibited from ring 3 16494 <1> ; callback because, disk operations (file system services 16495 <1> ; etc.) are independent from user program, for fast disk r/w. 16496 <1> ; They are not more useful at ring 3 while they are in use 16497 <1> ; by standard diskio functions which are mandatory part of 16498 <1> ; (monolithic) OS kernel and mainprog command interpreter. 16499 <1> ; INT 33h diskio functions are enough for user level disk 16500 <1> ; r/w. 16501 <1> ; 16502 <1> ; TRDOS 386 - IRQ CALLBACK structures (parameters): 16503 <1> ; 16504 <1> ; [u.irqlock] = 1 word, IRQ flags (0-15) that indicates 16505 <1> ; which IRQs are locked by (that) user. 16506 <1> ; Lock and unlock (by user) will change 16507 <1> ; these flags or 'terminate process' (sysexit) 16508 <1> ; will clear these flags and unlock those IRQs. 16509 <1> ; 16510 <1> ; Bit 0 is for IRQ 0 and Bit 15 is for IRQ 15 16511 <1> ; 16512 <1> ; IRQ(x).owner : 1 byte, user, [u.uno], 0 = free (unlocked) 16513 <1> ; 16514 <1> ; IRQ(x).method : 1 byte for callback method & status 16515 <1> ; 0 = Signal Response Byte method 16516 <1> ; 1 = Callback service method 16517 <1> ; >1 = invalid for current 'syscalback'. 16518 <1> ; or(+) 80h = IRQ is in use by system (ring 0) 16519 <1> ; function (audio etc.) or 16520 <1> ; a device driver. 16521 <1> ; (system function will ignore the lock/owner) 16522 <1> ; 16523 <1> ; IRQ(x).srb : 1 byte, Signal Return/Response byte value 16524 <1> ; (a fixed value by user or a counter value 16525 <1> ; from 0 to 255, which is increased by every 16526 <1> ; interrupt just before putting it into 16527 <1> ; the Signal Response byte address 16528 <1> ; (This is not used in callback serv method) 16529 <1> ; 16530 <1> ; IRQ(x).addr : 1 dword 16531 <1> ; Signal Response Byte address (physical) 16532 <1> ; -or- 16533 <1> ; Callback service address (virtual) 16534 <1> ; 16535 <1> ; IRQ(x).dev : 1 byte 16536 <1> ; 0 = Default device or kernel function 16537 <1> ; -or- 16538 <1> ; 1-255 = Assigned device driver number 16539 <1> ; 16540 <1> ; (x) = 3,4,5,7,9,10,11,12,13 16541 <1> ; 16542 <1> ; 16543 <1> ; NOTE: If user's process/program calls the kernel (INT 40h) 16544 <1> ; while it is already running in a (ring 3) callback 16545 <1> ; service, kernel will force (convert) system call to 16546 <1> ; 'sysrele' (sys release). So, this feature provides 16547 <1> ; easy and simple usage of callback services without 16548 <1> ; falling into deepless ; let me 'callback you'> cycles! (User must return 16550 <1> ; from callback service by using 'sysrele' system 16551 <1> ; call, without a significant delay. Otherwise user 16552 <1> ; process/program may be late to catch the next event 16553 <1> ; within same callback purpose. 16554 <1> ; 16555 <1> 16556 000112BA 30C0 <1> xor al, al ; the caller is 'syscalbac' sign/flag 16557 000112BC E8C1150000 <1> call set_irq_callback_service 16558 <1> ; 16/04/2017 16559 000112C1 A3[6C8E0100] <1> mov [u.r0], eax 16560 <1> ;jnc sysret 16561 <1> ; 23/07/2022 16562 000112C6 7205 <1> jc short syscalbac_err 16563 000112C8 E9C1B7FFFF <1> jmp sysret 16564 <1> syscalbac_err: 16565 000112CD A3[D88E0100] <1> mov dword [u.error], eax 16566 000112D2 E997B7FFFF <1> jmp error 16567 <1> 16568 <1> sysfpstat: 16569 <1> ; 28/02/2017 - TRDOS 386 (TRDOS v2.0) 16570 <1> ; (TRDOS 386 feature only!) 16571 <1> ; 16572 <1> ; Set or reset FPU registers save/restore option (for user) 16573 <1> ; (during software task switching, wswap-rswap) 16574 <1> ; 16575 <1> ; INPUT -> 16576 <1> ; BL = 0 -> reset 16577 <1> ; BL = 1 -> set (FPU register will be saved and restored) 16578 <1> ; 16579 <1> ; OUTPUT -> 16580 <1> ; cf = 0 -> no error, FPU is ready... 16581 <1> ; (EAX = 0) 16582 <1> ; Cf = 1 -> error, 80387 FPU is not ready ! 16583 <1> ; (EAX = 0FFFFFFFFh) 16584 <1> 16585 000112D7 31C0 <1> xor eax, eax 16586 000112D9 803D[74830100]00 <1> cmp byte [fpready], 0 16587 000112E0 7613 <1> jna short sysfpstat_err 16588 <1> 16589 000112E2 80E301 <1> and bl, 1 ; use BIT 0 only ! 16590 000112E5 881D[EB8E0100] <1> mov [u.fpsave], bl 16591 000112EB A3[6C8E0100] <1> mov [u.r0], eax ; 0 16592 000112F0 E999B7FFFF <1> jmp sysret 16593 <1> 16594 <1> sysfpstat_err: 16595 000112F5 48 <1> dec eax ; 0FFFFFFFFh 16596 000112F6 A3[6C8E0100] <1> mov [u.r0], eax ; -1 16597 000112FB E96EB7FFFF <1> jmp error 16598 <1> 16599 <1> sysdelete: ; Delete (Remove, Unlink) File 16600 <1> ; 29/12/2017 (TRDOS 386 = TRDOS v2.0) 16601 <1> ; 16602 <1> ; INPUT -> 16603 <1> ; EBX = File name (ASCIIZ string) address 16604 <1> ; OUTPUT -> 16605 <1> ; cf = 0 -> eax = 0 16606 <1> ; cf = 1 -> Error code in AL 16607 <1> ; 16608 <1> ; Modified Registers: EAX (at the return of system call) 16609 <1> ; 16610 <1> 16611 00011300 89DE <1> mov esi, ebx 16612 <1> ; file name is forced, change directory as temporary 16613 <1> ;mov ax, 1 16614 <1> ;mov [FFF_Valid], ah ; 0 ; reset 16615 <1> ;call set_working_path 16616 00011302 E8CE090000 <1> call set_working_path_x 16617 00011307 731D <1> jnc short sysdelete_1 16618 <1> 16619 00011309 21C0 <1> and eax, eax ; 0 -> Bad Path! 16620 0001130B 7505 <1> jnz short sysdelete_err 16621 <1> ; eax = 0 16622 <1> sysdelete_path_err: 16623 0001130D B813000000 <1> mov eax, ERR_INV_PATH_NAME ; 'bad path name !' 16624 <1> sysdelete_err: 16625 00011312 A3[6C8E0100] <1> mov [u.r0], eax 16626 00011317 A3[D88E0100] <1> mov [u.error], eax 16627 0001131C E8890A0000 <1> call reset_working_path 16628 00011321 E948B7FFFF <1> jmp error 16629 <1> sysdelete_1: 16630 <1> ;mov esi, FindFile_Name 16631 00011326 66B80018 <1> mov ax, 1800h ; Only files 16632 0001132A E84B76FFFF <1> call find_first_file 16633 0001132F 72E1 <1> jc short sysdelete_err 16634 <1> sysdelete_2: 16635 <1> ; check file attributes 16636 <1> 16637 <1> ;test bl, 17 ; system, hidden, readonly, directory 16638 00011331 F6C307 <1> test bl, 7 ; system, hidden, readonly 16639 00011334 7407 <1> jz short sysdelete_3 16640 <1> 16641 00011336 B80B000000 <1> mov eax, ERR_FILE_ACCESS ; 11 = 'permission denied !' 16642 0001133B EBD5 <1> jmp short sysdelete_err 16643 <1> sysdelete_3: 16644 0001133D 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 16645 00011340 7407 <1> jz short sysdelete_4 16646 00011342 B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; 26 = 'invalid file name !' 16647 00011347 EBC9 <1> jmp short sysdelete_err 16648 <1> sysdelete_4: 16649 <1> ;mov bh, [LongName_EntryLength] 16650 00011349 883D[DE800100] <1> mov [DelFile_LNEL], bh ; Long name entry length (if > 0) 16651 <1> ; edi = Directory Entry Offset (DirBuff) 16652 <1> ; esi = Directory Entry (FFF Structure) 16653 0001134F E8559DFFFF <1> call remove_file 16654 00011354 72BC <1> jc short sysdelete_err 16655 <1> sysrmdir_5: 16656 00011356 31C0 <1> xor eax, eax ; 0 16657 00011358 A3[6C8E0100] <1> mov [u.r0], eax 16658 <1> ;mov [u.error], eax 16659 0001135D E8480A0000 <1> call reset_working_path 16660 00011362 E927B7FFFF <1> jmp sysret 16661 <1> 16662 <1> sysrmdir: ; Remove (Unlink) Directory 16663 <1> ; 17/07/2025 - TRDOS 386 v2.0.10 16664 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 16665 <1> ; 19/01/2021 16666 <1> ; 29/12/2017 (TRDOS 386 = TRDOS v2.0) 16667 <1> ; 16668 <1> ; INPUT -> 16669 <1> ; EBX = Pointer to directory name 16670 <1> ; OUTPUT -> 16671 <1> ; cf = 0 -> eax = 0 16672 <1> ; cf = 1 -> Error code in AL 16673 <1> ; 16674 <1> ; Modified Registers: EAX (at the return of system call) 16675 <1> ; 16676 <1> 16677 <1> ; 19/01/2021 16678 00011367 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; root (super user) ? 16679 0001136E 7614 <1> jna short sysrmdir_0 16680 <1> 16681 <1> ;mov dword [u.r0], ERR_PERM_DENIED 16682 00011370 B80B000000 <1> mov eax, ERR_PERM_DENIED ; ERR_NOT_SUPERUSER 16683 00011375 A3[6C8E0100] <1> mov [u.r0], eax 16684 0001137A A3[D88E0100] <1> mov [u.error], eax 16685 0001137F E9EAB6FFFF <1> jmp error 16686 <1> 16687 <1> sysrmdir_0: 16688 00011384 89DE <1> mov esi, ebx 16689 <1> 16690 <1> ;;;; 16691 <1> ; 17/07/2025 - TRDOS 386 v2.0.10 16692 00011386 A0[76770100] <1> mov al, [Current_Drv] 16693 0001138B A2[1C810100] <1> mov [rmdir_drv], al 16694 00011390 A1[70770100] <1> mov eax, [Current_Dir_FCluster] 16695 00011395 A3[18810100] <1> mov [rmdir_dir_fcluster], eax 16696 <1> ;;;; 16697 <1> 16698 <1> ; file name is forced, change directory as temporary 16699 <1> ;mov ax, 1 16700 <1> ;mov [FFF_Valid], ah ; 0 ; reset 16701 <1> ;call set_working_path 16702 0001139A E836090000 <1> call set_working_path_x 16703 0001139F 7308 <1> jnc short sysrmdir_1 16704 <1> 16705 000113A1 21C0 <1> and eax, eax ; 0 -> Bad Path! 16706 000113A3 7513 <1> jnz short sysrmdir_err 16707 <1> ; eax = 0 16708 <1> sysrmdir_not_found: 16709 <1> ;mov eax, ERR_DIR_NOT_FOUND ; Directory not found ! 16710 <1> ; 23/07/2022 16711 000113A5 B00C <1> mov al, ERR_DIR_NOT_FOUND 16712 000113A7 EB0F <1> jmp short sysrmdir_err 16713 <1> ;sysrmdir_err: 16714 <1> ; mov [u.r0], eax 16715 <1> ; mov [u.error], eax 16716 <1> ; call reset_working_path 16717 <1> ; jmp error 16718 <1> sysrmdir_1: 16719 <1> ;mov esi, FindFile_Name 16720 000113A9 66B81008 <1> mov ax, 0810h ; Only directories 16721 000113AD E8C875FFFF <1> call find_first_file 16722 000113B2 7318 <1> jnc short sysrmdir_2 16723 <1> 16724 <1> ; eax = 2 (File not found !) 16725 000113B4 3C02 <1> cmp al, 2 ; ERR_NOT_FOUND 16726 000113B6 74ED <1> je short sysrmdir_not_found 16727 <1> ;jmp short sysrmdir_err 16728 <1> ; 23/07/2022 16729 <1> sysrmdir_err: 16730 000113B8 A3[6C8E0100] <1> mov [u.r0], eax 16731 000113BD A3[D88E0100] <1> mov [u.error], eax 16732 <1> sysrmdir_8: ; 23/07/2022 16733 000113C2 E8E3090000 <1> call reset_working_path 16734 000113C7 E9A2B6FFFF <1> jmp error 16735 <1> sysrmdir_2: 16736 <1> ; check directory attributes 16737 <1> 16738 000113CC F6C307 <1> test bl, 7 ; system, hidden, readonly 16739 000113CF 7407 <1> jz short sysrmdir_3 16740 <1> 16741 000113D1 B80B000000 <1> mov eax, ERR_DIR_ACCESS ; 11 = 'permission denied !' 16742 000113D6 EBE0 <1> jmp short sysrmdir_err 16743 <1> sysrmdir_3: 16744 000113D8 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 16745 000113DB 7407 <1> jz short sysrmdir_4 16746 <1> ;mov eax, ERR_NOT_DIR ; 'not a valid directory !' 16747 000113DD B813000000 <1> mov eax, ERR_INV_PATH_NAME ; 'bad path name !' 16748 000113E2 EBD4 <1> jmp short sysrmdir_err 16749 <1> sysrmdir_4: 16750 <1> ;mov bh, [LongName_EntryLength] 16751 000113E4 883D[DE800100] <1> mov [DelFile_LNEL], bh ; Long name entry length (if > 0) 16752 <1> ; edi = Directory Entry Offset (DirBuff) 16753 <1> ; esi = Directory Entry (FFF Structure) 16754 000113EA E8F77BFFFF <1> call delete_sub_directory 16755 <1> ;jnc sysrmdir_5 16756 <1> ; 23/07/2022 16757 000113EF 7205 <1> jc short sysrmdir_6 16758 000113F1 E960FFFFFF <1> jmp sysrmdir_5 16759 <1> 16760 <1> ; jc short sysrmdir_6 16761 <1> ; 16762 <1> ; xor eax, eax ; 0 16763 <1> ;sysrmdir_5: 16764 <1> ; mov [u.r0], eax 16765 <1> ; ;mov [u.error], eax 16766 <1> ; call reset_working_path 16767 <1> ; jmp sysret 16768 <1> 16769 <1> sysrmdir_6: 16770 000113F6 A3[6C8E0100] <1> mov [u.r0], eax 16771 000113FB A3[D88E0100] <1> mov [u.error], eax 16772 <1> 16773 00011400 09C0 <1> or eax, eax ; EAX = 0 -> Directory not empty! 16774 00011402 7414 <1> jz short sysrmdir_9 16775 <1> 16776 <1> ; EAX > 0 -> Error code in AL (or AX or EAX) 16777 <1> 16778 00011404 833D[927E0100]01 <1> cmp dword [FAT_ClusterCounter], 1 16779 0001140B 72B5 <1> jb short sysrmdir_8 16780 <1> sysrmdir_7: 16781 <1> ; ESI = Logical DOS Drive Description Table address 16782 0001140D 66BB00FF <1> mov bx, 0FF00h ; BH = FFh -> use ESI for Drive parameters 16783 <1> ; BL = 0 -> Recalculate free cluster count 16784 00011411 E85BB1FFFF <1> call calculate_fat_freespace 16785 <1> ; 23/07/2022 16786 00011416 EBAA <1> jmp short sysrmdir_8 16787 <1> ;sysrmdir_8: 16788 <1> ; call reset_working_path 16789 <1> ; jmp error 16790 <1> 16791 <1> sysrmdir_9: 16792 00011418 A1[927E0100] <1> mov eax, [FAT_ClusterCounter] 16793 0001141D 09C0 <1> or eax, eax ; 0 ? 16794 <1> ;jz short sysrmdir_err 16795 <1> ; 23/07/2022 16796 0001141F 74A1 <1> jz short sysrmdir_8 16797 <1> 16798 <1> ; ESI = Logical DOS Drive Description Table address 16799 00011421 66BB01FF <1> mov bx, 0FF01h ; BH = FFh -> use ESI for Drive parameters 16800 <1> ; BL = 1 -> add free clusters 16801 00011425 E847B1FFFF <1> call calculate_fat_freespace 16802 0001142A 09C9 <1> or ecx, ecx 16803 0001142C 7494 <1> jz short sysrmdir_8 ; ecx = 0 -> OK 16804 <1> ; ecx > 0 -> Error (Recalculation is needed) 16805 0001142E EBDD <1> jmp short sysrmdir_7 16806 <1> 16807 <1> syschdir: ; Change Current (Working) Drive & Directory (for user) 16808 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 16809 <1> ; 16810 <1> ; INPUT -> 16811 <1> ; EBX = Directory name (ASCIIZ string) address 16812 <1> ; OUTPUT -> 16813 <1> ; cf = 0 -> eax = 0 16814 <1> ; cf = 1 -> Error code in AL 16815 <1> ; 16816 <1> ; Modified Registers: EAX (at the return of system call) 16817 <1> ; 16818 <1> ; NOTE: If drive name is not included, only the working 16819 <1> ; directory (for user, not for drive/OS) will be chanded. 16820 <1> ; If there is a drive name (as A:, B:, C:, D: etc.) 16821 <1> ; at the beginning of the ASCIIZ (directory) string, 16822 <1> ; working drive and working directory (for user) 16823 <1> ; will be changed together. 16824 <1> ; (When the program is terminated, MainProg -internal 16825 <1> ; shell- will reset working directory to the previous 16826 <1> ; -current- logical drive's current directory again.) 16827 <1> 16828 00011430 89DE <1> mov esi, ebx 16829 <1> ; file name is not forced, change directory as temporary 16830 00011432 31C0 <1> xor eax, eax 16831 <1> ;mov [FFF_Valid], ah ; 0 ; reset 16832 <1> ;call set_working_path 16833 00011434 E8A0080000 <1> call set_working_path_xx 16834 00011439 731D <1> jnc short syschdir_ok 16835 0001143B 21C0 <1> and eax, eax ; 0 -> Bad Path! 16836 0001143D 7505 <1> jnz short syschdir_err 16837 <1> ; eax = 0 16838 <1> syschdir_not_found: 16839 0001143F B80C000000 <1> mov eax, ERR_DIR_NOT_FOUND ; Directory not found ! 16840 <1> syschdir_err: 16841 00011444 A3[6C8E0100] <1> mov [u.r0], eax 16842 00011449 A3[D88E0100] <1> mov [u.error], eax 16843 0001144E E857090000 <1> call reset_working_path 16844 00011453 E916B6FFFF <1> jmp error 16845 <1> syschdir_ok: 16846 00011458 31C0 <1> xor eax, eax ; 0 16847 0001145A A3[6C8E0100] <1> mov [u.r0], eax 16848 <1> ;mov [u.error], eax 16849 0001145F E92AB6FFFF <1> jmp sysret 16850 <1> 16851 <1> 16852 <1> syschmod: ; Get & Change File (or Directory) Attributes 16853 <1> ; 26/09/2024 - TRDOS 386 v2.0.9 16854 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 16855 <1> ; 19/01/2021 16856 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 16857 <1> ; 16858 <1> ; INPUT -> 16859 <1> ; EBX = File/Directory (ASCIIZ) name address 16860 <1> ; CL = New attributes (if CL < 40h) 16861 <1> ; CL >= 40h -> Get File Attributes 16862 <1> ; OUTPUT -> 16863 <1> ; cf = 0 -> EAX = File attributes (in AL) 16864 <1> ; cf = 1 -> Error code in AL 16865 <1> ; 16866 <1> ; Modified Registers: EAX (at the return of system call) 16867 <1> ; 16868 <1> ; MSDOS File Attributes: (bit value of attrib byte) 16869 <1> ; ATTR_READ_ONLY = 01h (bit 0, 'R') 16870 <1> ; ATTR_HIDDEN = 02h (bit 1, 'H') 16871 <1> ; ATTR_SYSTEM = 04h (bit 2, 'S') 16872 <1> ; ATTR_VOLUME_ID = 08h (bit 3) 16873 <1> ; ATTR_DIRECTORY = 10h (bit 4) 16874 <1> ; ATTR_ARCHIVE = 20h (bit 5, 'A') 16875 <1> ; ATTR_LONG_NAME = ATTR_READONLY | 16876 <1> ; ATTR_HIDDEN | 16877 <1> ; ATTR_SYSTEM | 16878 <1> ; ATTR_VOLUME_ID 16879 <1> ; The upper two bits of attributes must be 0. 16880 <1> 16881 <1> ; Note: * If ATTR_DIRECTORY is set, only directory names 16882 <1> ; will be searched (and S,H,R,A attributeds of 16883 <1> ; the directory will be changed.) 16884 <1> ; * If ATTR_VOLUME_ID is set, 'syschmod' system call 16885 <1> ; will return with 'permission denied' error. 16886 <1> ; * If ATTR_DIRECTORY is not set, only file names 16887 <1> ; will be searched (and S,H,R,A attributes of the 16888 <1> ; file will be changed.) 16889 <1> ; 16890 <1> ; (Ony Super User can change S,H,R attributes.) 16891 <1> 16892 00011464 80F940 <1> cmp cl, 40h 16893 00011467 7327 <1> jnb short syschmod_0 16894 <1> 16895 00011469 F6C108 <1> test cl, 08h ; ATTR_VOLUME_ID 16896 0001146C 750E <1> jnz short syschmod_perm_err 16897 <1> 16898 <1> ; 19/01/2021 16899 0001146E 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; root (super user) ? 16900 00011475 7619 <1> jna short syschmod_0 16901 <1> 16902 <1> ; Not super user.. 16903 00011477 F6C107 <1> test cl, 07h ; S,H,R attributes 16904 0001147A 7414 <1> jz short syschmod_0 16905 <1> 16906 <1> syschmod_perm_err: 16907 <1> ;mov dword [u.r0], ERR_PERM_DENIED 16908 0001147C B80B000000 <1> mov eax, ERR_PERM_DENIED ; 'permission denied !' 16909 00011481 A3[6C8E0100] <1> mov [u.r0], eax 16910 00011486 A3[D88E0100] <1> mov [u.error], eax 16911 0001148B E9DEB5FFFF <1> jmp error 16912 <1> 16913 <1> syschmod_0: 16914 00011490 880D[30810100] <1> mov [Attributes], cl 16915 00011496 89DE <1> mov esi, ebx 16916 <1> ; file name is forced, change directory as temporary 16917 <1> ;mov ax, 1 16918 <1> ;mov [FFF_Valid], ah ; 0 ; reset 16919 <1> ;call set_working_path 16920 00011498 E838080000 <1> call set_working_path_x 16921 0001149D 7308 <1> jnc short syschmod_1 16922 0001149F 21C0 <1> and eax, eax ; 0 -> Bad Path! 16923 000114A1 751E <1> jnz short syschmod_err 16924 <1> ; eax = 0 16925 <1> syschmod_path_not_found: 16926 <1> ;mov eax, ERR_INV_PATH_NAME ; 'Bad path name !' 16927 <1> ; 23/07/2022 16928 000114A3 B013 <1> mov al, ERR_INV_PATH_NAME 16929 <1> ;syschmod_err: 16930 <1> ;mov [u.r0], eax 16931 <1> ;mov [u.error], eax 16932 <1> ;call reset_working_path 16933 <1> ;jmp error 16934 <1> ; 23/07/2022 16935 000114A5 EB1A <1> jmp short syschmod_err 16936 <1> syschmod_1: 16937 000114A7 B008 <1> mov al, 08h ; Except volume labels (& long names) 16938 000114A9 A0[30810100] <1> mov al, [Attributes] 16939 000114AE 2410 <1> and al, 10h ; 16940 <1> ;mov esi, FindFile_Name 16941 <1> ;mov ax, 1800h ; Only files 16942 <1> ;mov ax, 0810h ; Only directories 16943 000114B0 E8C574FFFF <1> call find_first_file 16944 <1> ;jnc short syschmod_2 16945 000114B5 720A <1> jc short syschmod_err 16946 <1> 16947 <1> ;; eax = 2 (File not found !) 16948 <1> ;cmp al, 2 ; ERR_NOT_FOUND 16949 <1> ;jne short syschmod_err 16950 <1> 16951 <1> ;and byte [Attributes], 10h 16952 <1> ;jz short syschmod_err 16953 <1> 16954 <1> ;; Directory not found ! 16955 <1> ;mov al, 3 ; ERR_PATH_NOT_FOUND 16956 <1> ;jmp short syschmod_err 16957 <1> 16958 <1> syschmod_2: 16959 000114B7 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 16960 000114BA 7419 <1> jz short syschmod_3 16961 000114BC B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; 'invalid file name !' 16962 <1> ;jmp short syschmod_err 16963 <1> syschmod_err: 16964 000114C1 A3[6C8E0100] <1> mov [u.r0], eax 16965 000114C6 A3[D88E0100] <1> mov [u.error], eax 16966 000114CB E8DA080000 <1> call reset_working_path 16967 000114D0 E999B5FFFF <1> jmp error 16968 <1> syschmod_3: 16969 <1> ; EDI = Directory buffer entry offset/address 16970 <1> ; BL = File (or Directory) Attributes 16971 <1> ; mov bl, [EDI+0Bh] 16972 <1> 16973 <1> ; check directory attributes 16974 000114D5 8A3D[30810100] <1> mov bh, [Attributes] ; new attributes 16975 000114DB 80FF40 <1> cmp bh, 40h ;>=40 -> get file/directory attributes 16976 000114DE 7325 <1> jnb short syschmod_6 16977 <1> 16978 <1> ; set file/directory attributes 16979 000114E0 F6C307 <1> test bl, 7 ; system, hidden, readonly 16980 000114E3 7409 <1> jz short syschmod_4 16981 <1> 16982 <1> ; 19/01/2021 16983 000114E5 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; root (super user) ? 16984 000114EC 778E <1> ja short syschmod_perm_err 16985 <1> syschmod_4: 16986 <1> ; 19/12/2025 16987 <1> %if 0 16988 <1> cmp word [edi+DirEntry_NTRes], 01A1h ; Singlix FS 16989 <1> je short syschmod_7 16990 <1> %endif 16991 000114EE 887F0B <1> mov [edi+0Bh], bh ; Attributes (New!) 16992 <1> 16993 000114F1 C605[9D7E0100]02 <1> mov byte [DirBuff_ValidData], 2 ; modified sign 16994 <1> ; to force write 16995 000114F8 E89498FFFF <1> call save_directory_buffer 16996 000114FD 72C2 <1> jc short syschmod_err 16997 <1> 16998 <1> syschmod_5: 16999 000114FF 8A1D[30810100] <1> mov bl, [Attributes] 17000 <1> syschmod_6: 17001 00011505 0FB6C3 <1> movzx eax, bl 17002 00011508 A3[6C8E0100] <1> mov [u.r0], eax 17003 <1> ;mov dword [u.error], 0 17004 0001150D E97CB5FFFF <1> jmp sysret 17005 <1> 17006 <1> ; 19/12/2025 17007 <1> %if 0 17008 <1> syschmod_7: 17009 <1> sub eax, eax 17010 <1> mov ah, [DirBuff_DRV] 17011 <1> ; 26/09/2024 (BugFix) 17012 <1> sub ah, 'A' 17013 <1> mov esi, Logical_DOSDisks 17014 <1> add esi, eax 17015 <1> cmp byte [esi+LD_FSType], 0A1h 17016 <1> jnc short syschmod_8 17017 <1> mov al, ERR_INV_DATA ; 29 = Invalid Data 17018 <1> jmp short syschmod_err 17019 <1> 17020 <1> syschmod_8: 17021 <1> ; BH = New MS-DOS File Attributes 17022 <1> mov al, bh ; File/Directory Attributes 17023 <1> xor ah, ah ; Attributes in MS-DOS format sign 17024 <1> call change_fs_file_attributes 17025 <1> ;jc syschmod_err 17026 <1> ;jmp short syschmod_5 17027 <1> ; 23/07/2022 17028 <1> jnc short syschmod_5 17029 <1> jmp syschmod_err ; 26/09/2024 17030 <1> %endif 17031 <1> 17032 <1> sysdrive: ; Get/Set Current (Working) Drive (for user) 17033 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 17034 <1> ; 17035 <1> ; INPUT -> 17036 <1> ; BL = Logical DOS Drive number (0=A: ... 2=C:) 17037 <1> ; If BL = 0FFh -> Get Current Drive 17038 <1> ; OUTPUT -> 17039 <1> ; cf = 0 -> 17040 <1> ; AL = Current Drive number 17041 <1> ; AH = The Last Logical DOS Drive no. 17042 <1> ; cf = 1 -> Error code in AL 17043 <1> ; 17044 <1> ; Modified Registers: EAX (at the return of system call) 17045 <1> ; 17046 <1> ; NOTE: If the requested logical dos drive is ready, 17047 <1> ; it's current current directory will be the user's 17048 <1> ; (program's) current directory. 17049 <1> ; (When the program is terminated, MainProg -internal 17050 <1> ; shell- will reset the previous -current- logical drive 17051 <1> ; as current drive again). 17052 <1> 17053 00011512 80FBFF <1> cmp bl, 0FFh 17054 00011515 7435 <1> je short sysdrive_ok 17055 00011517 3A1D[8D2E0100] <1> cmp bl, [Last_DOS_DiskNo] 17056 0001151D 771E <1> ja short sysdrive_err 17057 <1> 17058 <1> ; Save current drive and reset mode 17059 <1> ; for 'reset_working_path' procedure (for MainProg) 17060 0001151F 30C0 <1> xor al, al 17061 00011521 66A3[70830100] <1> mov [SWP_Mode], ax ; ah = 0 17062 00011527 A0[76770100] <1> mov al, [Current_Drv] 17063 0001152C FEC4 <1> inc ah ; mov ah, 1 17064 0001152E 66A3[72830100] <1> mov [SWP_DRV], ax 17065 <1> 17066 00011534 88DA <1> mov dl, bl 17067 00011536 E8B561FFFF <1> call change_current_drive 17068 0001153B 730F <1> jnc short sysdrive_ok 17069 <1> sysdrive_err: 17070 0001153D C705[6C8E0100]0F00- <1> mov dword [u.r0], ERR_DRV_NOT_RDY ; 'drive not ready !' 17070 00011545 0000 <1> 17071 00011547 E922B5FFFF <1> jmp error 17072 <1> sysdrive_ok: 17073 0001154C A0[76770100] <1> mov al, [Current_Drv] 17074 00011551 8A25[8D2E0100] <1> mov ah, [Last_DOS_DiskNo] 17075 00011557 A3[6C8E0100] <1> mov [u.r0], eax 17076 0001155C E92DB5FFFF <1> jmp sysret 17077 <1> 17078 <1> sysdir: ; Get Current (Working) Drive & Directory (for user) 17079 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 17080 <1> ; 17081 <1> ; INPUT -> 17082 <1> ; EBX = Current directory name buffer address 17083 <1> ; (Buffer length = 92 bytes) 17084 <1> ; OUTPUT -> 17085 <1> ; AL = Current drive (0=A: .. 2=C:) 17086 <1> ; If CF = 1 -> AL = error code 17087 <1> ; 17088 <1> ; Modified Registers: EAX (at the return of system call) 17089 <1> ; 17090 <1> ; Note: Required directory name buffer length may be 17091 <1> ; <= 92 bytes for current TRDOS 386 version. 17092 <1> ; (7*12 name chars + 7 slash + 0) 17093 <1> 17094 00011561 89E5 <1> mov ebp, esp 17095 00011563 83EC60 <1> sub esp, 96 17096 00011566 53 <1> push ebx ; User's buffer address 17097 00011567 30D2 <1> xor dl, dl ; 0 = current drive 17098 00011569 E8238EFFFF <1> call get_current_directory 17099 0001156E 72CD <1> jc short sysdrive_err ; 'drive not ready !' error 17100 00011570 89E6 <1> mov esi, esp ; System's buffer address 17101 00011572 5F <1> pop edi ; User's buffer address 17102 <1> ; ecx = transfer (byte) count (<=92) 17103 00011573 E8A3F5FFFF <1> call transfer_to_user_buffer 17104 00011578 89EC <1> mov esp, ebp 17105 0001157A 730F <1> jnc short sysdir_ok 17106 <1> sysdir_err: 17107 0001157C C705[6C8E0100]2E00- <1> mov dword [u.r0], ERR_BUFFER ; 'buffer error !' 17107 00011584 0000 <1> 17108 00011586 E9E3B4FFFF <1> jmp error 17109 <1> sysdir_ok: 17110 0001158B 8A0D[76770100] <1> mov cl, [Current_Drv] 17111 00011591 890D[6C8E0100] <1> mov [u.r0], ecx 17112 00011597 E9F2B4FFFF <1> jmp sysret 17113 <1> 17114 <1> sysldrvt: ; Get copy of Logical DOS Drive Description Table 17115 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 17116 <1> ; 17117 <1> ; INPUT -> 17118 <1> ; BL = Logical DOS drive number (zero based) 17119 <1> ; ECX = Logical DOS drv desc table buffer addr 17120 <1> ; (Buffer length = 256 bytes) 17121 <1> ; OUTPUT -> 17122 <1> ; cf = 0 -> 17123 <1> ; AL = Current Drive number 17124 <1> ; AH = The Last Logical DOS Drive no. 17125 <1> ; cf = 1 -> Error code in AL 17126 <1> ; AH = The Last Logical DOS Drive no. 17127 <1> ; 17128 <1> ; Modified Registers: EAX (at the return of system call) 17129 <1> ; 17130 <1> ; Note: Required description table buffer length is 17131 <1> ; 256 bytes for current TRDOS 386 version. 17132 <1> 17133 0001159C 89CF <1> mov edi, ecx ; Destination address (user space) 17134 0001159E 88DC <1> mov ah, bl 17135 000115A0 30C0 <1> xor al, al 17136 000115A2 BE00010900 <1> mov esi, Logical_DOSDisks 17137 000115A7 01C6 <1> add esi, eax ; Source address (system space) 17138 000115A9 B900010000 <1> mov ecx, 256 ; Byte count 17139 <1> ; Logical Dos Drv Desc Table size 17140 000115AE E868F5FFFF <1> call transfer_to_user_buffer 17141 000115B3 72C7 <1> jc short sysdir_err 17142 000115B5 8A2D[8D2E0100] <1> mov ch, [Last_DOS_DiskNo] 17143 000115BB EBCE <1> jmp short sysdir_ok 17144 <1> 17145 <1> systime: ; Get System Date&Time 17146 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 17147 <1> ; 17148 <1> ; INPUT -> BL = 17149 <1> ; 0 = Get Date&Time in Unix/Epoch format 17150 <1> ; 1 = Get Time in MSDOS format 17151 <1> ; 2 = Get Date in MSDOS format 17152 <1> ; 3 = Get Date&Time in MSDOS format 17153 <1> ; 4 & other values = 17154 <1> ; System timer ticks will be returned 17155 <1> ; in EAX and Carry Flag will be set. 17156 <1> ; (CF will not be set if BL = 4) 17157 <1> ; OUTPUT -> 17158 <1> ; For BL input = 3 17159 <1> ; EAX = Current Time (RTC) 17160 <1> ; AL = Second (DL in MSDOS) 17161 <1> ; AH = Minute (CL in MSDOS) 17162 <1> ; HW of EAX = Hour (CH in MSDOS) 17163 <1> ; EDX = Current System Date (RTC) 17164 <1> ; DL = Day (DL in MSDOS) 17165 <1> ; DH = Month (DH in MSDOS) 17166 <1> ; HW of EDX = Year (CX in MSDOS) 17167 <1> ; 17168 <1> ; For BL input = 2 17169 <1> ; EAX = Current System Date (RTC) 17170 <1> ; DL = Day (DL in MSDOS) 17171 <1> ; DH = Month (DH in MSDOS) 17172 <1> ; HW of EDX = Year (CX in MSDOS) 17173 <1> ; 17174 <1> ; For BL input = 1 17175 <1> ; EAX = Current Time (RTC) 17176 <1> ; AL = Second (DL in MSDOS) 17177 <1> ; AH = Minute (CL in MSDOS) 17178 <1> ; HW of EAX = Hour (CH in MSDOS) 17179 <1> ; 17180 <1> ; For BL input = 0 17181 <1> ; EAX = Unix (Epoch) Time Ticks/Seconds 17182 <1> ; 17183 <1> ; For BL input = 4 17184 <1> ; EAX = System timer ticks 17185 <1> ; 17186 <1> ; If CF = 1 (for other values of BL input) 17187 <1> ; EAX = System timer ticks (no error code!) 17188 <1> ; 17189 <1> ; Modified Registers: EAX, (EDX) 17190 <1> ; (at the return of system call) 17191 <1> ; 17192 <1> 17193 000115BD 20DB <1> and bl, bl 17194 000115BF 750F <1> jnz short systime_1 17195 000115C1 E81B59FFFF <1> call epoch 17196 <1> systime_0: 17197 000115C6 A3[6C8E0100] <1> mov [u.r0], eax 17198 000115CB E9BEB4FFFF <1> jmp sysret 17199 <1> systime_1: 17200 000115D0 80FB04 <1> cmp bl, 4 17201 000115D3 7211 <1> jb short systime_2 17202 000115D5 A1[30770100] <1> mov eax, [TIMER_LH] ; 18.2 Hz timer ticks 17203 <1> ; Note: [TIMER_LH] may be set 17204 <1> ; to wrong timer value due to 17205 <1> ; program functions. 17206 <1> ; (This value must not be 17207 <1> ; accepted as [TIMER_LH]/18.2 17208 <1> ; seconds since the midnight.) 17209 000115DA 76EA <1> jna short systime_0 17210 000115DC A3[6C8E0100] <1> mov [u.r0], eax 17211 000115E1 E988B4FFFF <1> jmp error ; cf = 1 & [u.r0] = eax = timer ticks 17212 <1> 17213 <1> systime_2: 17214 <1> ;push ebx 17215 000115E6 E87058FFFF <1> call get_rtc_date_time 17216 <1> ;pop ebx 17217 000115EB F6C301 <1> test bl, 1 17218 000115EE 7429 <1> jz short systime_4 17219 000115F0 30E4 <1> xor ah, ah 17220 000115F2 A0[7A730100] <1> mov al, [hour] 17221 000115F7 88C2 <1> mov dl, al 17222 000115F9 C1E010 <1> shl eax, 16 17223 000115FC A0[7E730100] <1> mov al, [second] 17224 00011601 8A25[7C730100] <1> mov ah, [minute] 17225 00011607 F6C302 <1> test bl, 2 17226 0001160A 74BA <1> jz short systime_0 17227 <1> ; Check time & date match risk 17228 <1> ; (23:59:59 may cause to wrong 17229 <1> ; date -new day with previous date-...) 17230 0001160C 80FA17 <1> cmp dl, 23 17231 0001160F 7206 <1> jb short systime_3 17232 00011611 663D3B3B <1> cmp ax, (59*256)+59 ; if hour is 23:59:59 17233 00011615 73CF <1> jnb short systime_2 ; wait for 1 second 17234 <1> systime_3: 17235 <1> ; eax = time 17236 00011617 89C6 <1> mov esi, eax 17237 <1> systime_4: 17238 00011619 66A1[74730100] <1> mov ax, [year] 17239 0001161F C1E010 <1> shl eax, 16 17240 00011622 A0[78730100] <1> mov al, [day] 17241 00011627 8A25[76730100] <1> mov ah, [month] 17242 <1> ; eax = date 17243 0001162D 80E301 <1> and bl, 1 17244 00011630 7494 <1> jz short systime_0 17245 00011632 96 <1> xchg esi, eax 17246 <1> ; eax = time, esi = date 17247 00011633 8B2D[688E0100] <1> mov ebp, [u.usp] ; EBP points to user's registers 17248 <1> ; (user) edx <-- (system) esi 17249 00011639 897514 <1> mov [ebp+20], esi ; return to user with EDX value 17250 0001163C EB88 <1> jmp short systime_0 17251 <1> 17252 <1> sysstime: ; Set System Date&Time 17253 <1> ; 31/12/2017 17254 <1> ; 30/12/2017 (TRDOS 386 = TRDOS v2.0) 17255 <1> ; 17256 <1> ; INPUT -> BL = 17257 <1> ; 0 = Set Date&Time in Unix/Epoch format 17258 <1> ; 1 = Set Time in MSDOS format 17259 <1> ; 2 = Set Date in MSDOS format 17260 <1> ; 3 = Set Date&Time in MSDOS format 17261 <1> ; 4 = Set System Timer (Ticks) 17262 <1> ; 5 = Convert/Save current time to/as 17263 <1> ; 18.2 Hz system timer ticks 17264 <1> ; 6 = Convert MSDOS Date&Time to UNIX format 17265 <1> ; without setting system date&time ; (test) 17266 <1> ; 7 = Convert UNIX Date&Time to MSDOS format 17267 <1> ; without setting system date&time ; (test) 17268 <1> ; 8-0FFh = invalid ! 17269 <1> ; ECX = Time (or Timer) value in selected format 17270 <1> ; EDX = Date value in MSDOS format if BL=2,3,6 17271 <1> ; 17272 <1> ; OUTPUT -> 17273 <1> ; If CF = 0 -> 17274 <1> ; EAX = Set value 17275 <1> ; If CF = 1 -> (invalid BL input) 17276 <1> ; EAX = Ticks count [TIMER_LH] 17277 <1> ; 17278 <1> 17279 0001163E 20DB <1> and bl, bl ; 0 17280 00011640 7511 <1> jnz short sysstime_0 17281 00011642 89C8 <1> mov eax, ecx 17282 00011644 E81D59FFFF <1> call convert_from_epoch 17283 00011649 E8BD59FFFF <1> call set_rtc_date_time 17284 0001164E E93BB4FFFF <1> jmp sysret 17285 <1> sysstime_0: 17286 00011653 80FB08 <1> cmp bl, 8 17287 00011656 722D <1> jb short sysstime_1 17288 <1> ; invalid input (>7) 17289 00011658 A1[30770100] <1> mov eax, [TIMER_LH] ; 18.2 Hz timer ticks 17290 <1> ; Note: [TIMER_LH] may be set 17291 <1> ; to wrong timer value due to 17292 <1> ; program functions. 17293 <1> ; (This value must not be 17294 <1> ; accepted as [TIMER_LH]/18.2 17295 <1> ; seconds since the midnight.) 17296 0001165D A3[6C8E0100] <1> mov [u.r0], eax 17297 00011662 E907B4FFFF <1> jmp error ; cf = 1 & [u.r0] = eax = timer ticks 17298 <1> 17299 <1> sysstime_8: 17300 <1> ; BL = 7 17301 00011667 89C8 <1> mov eax, ecx ; seconds since 1/1/1970 00:00:00 17302 00011669 E8F858FFFF <1> call convert_from_epoch 17303 0001166E 30E4 <1> xor ah, ah 17304 00011670 A0[7A730100] <1> mov al, [hour] 17305 00011675 C1E010 <1> shl eax, 16 17306 00011678 A0[7E730100] <1> mov al, [second] 17307 0001167D 8A25[7C730100] <1> mov ah, [minute] 17308 00011683 EB92 <1> jmp short systime_3 17309 <1> 17310 <1> sysstime_1: 17311 00011685 80FB04 <1> cmp bl, 4 17312 00011688 743F <1> je short sysstime_2 ; set system timer ticks 17313 0001168A 80FB05 <1> cmp bl, 5 17314 0001168D 754B <1> jne short sysstime_4 17315 <1> ; convert current time to system timer ticks (18.2Hz) 17316 0001168F E8C757FFFF <1> call get_rtc_date_time 17317 00011694 0FB60D[7A730100] <1> movzx ecx, byte [hour] 17318 0001169B B8100E0000 <1> mov eax, 60*60 ; 1 hour = 3600 seconds 17319 000116A0 F7E1 <1> mul ecx 17320 000116A2 89C3 <1> mov ebx, eax 17321 000116A4 B13C <1> mov cl, 60 ; 1 minute = 60 seconds 17322 000116A6 0FB605[7C730100] <1> movzx eax, byte [minute] 17323 000116AD F7E1 <1> mul ecx 17324 000116AF 01D8 <1> add eax, ebx 17325 000116B1 8A0D[7E730100] <1> mov cl, [second] 17326 000116B7 01C8 <1> add eax, ecx 17327 000116B9 B1B6 <1> mov cl, 182 17328 000116BB F7E1 <1> mul ecx 17329 000116BD 83C009 <1> add eax, 9 17330 000116C0 83D200 <1> adc edx, 0 17331 000116C3 B10A <1> mov cl, 10 17332 000116C5 F7F1 <1> div ecx 17333 <1> ; eax = ((182*seconds)+9)/10 17334 000116C7 89C1 <1> mov ecx, eax 17335 <1> sysstime_2: 17336 000116C9 890D[30770100] <1> mov [TIMER_LH], ecx ; 18.2 * seconds 17337 <1> sysstime_3: 17338 000116CF 890D[6C8E0100] <1> mov [u.r0], ecx 17339 000116D5 E9B4B3FFFF <1> jmp sysret 17340 <1> sysstime_4: 17341 000116DA 80FB06 <1> cmp bl, 6 17342 000116DD 7788 <1> ja short sysstime_8 17343 <1> 17344 000116DF 890D[6C8E0100] <1> mov [u.r0], ecx 17345 <1> 17346 000116E5 880D[7E730100] <1> mov [second], cl 17347 000116EB 882D[7C730100] <1> mov [minute], ch 17348 000116F1 C1E910 <1> shr ecx, 16 17349 000116F4 880D[7A730100] <1> mov [hour], cl 17350 <1> ; BL = 1,2,3,6 17351 000116FA 80FB01 <1> cmp bl, 1 17352 000116FD 762A <1> jna short sysstime_5 17353 <1> ; BL = 2,3,6 17354 000116FF 8815[78730100] <1> mov [day], dl 17355 00011705 8835[76730100] <1> mov [month], dh 17356 0001170B C1EA10 <1> shr edx, 16 17357 0001170E 668915[74730100] <1> mov [year], dx 17358 00011715 80E303 <1> and bl, 3 17359 00011718 742D <1> jz short sysstime_7 ; 6 17360 <1> ; BL = 2,3 17361 0001171A F6C301 <1> test bl, 1 17362 0001171D 7419 <1> jz short sysstime_6 ; 2 17363 <1> ; BL = 3 17364 0001171F E8E758FFFF <1> call set_rtc_date_time 17365 00011724 E965B3FFFF <1> jmp sysret 17366 <1> sysstime_5: 17367 <1> ; BL = 1 17368 00011729 E81E59FFFF <1> call set_time_bcd 17369 0001172E E8584CFFFF <1> call set_rtc_time 17370 00011733 E956B3FFFF <1> jmp sysret 17371 <1> sysstime_6: 17372 <1> ; BL = 2 17373 00011738 E8E258FFFF <1> call set_date_bcd 17374 0001173D E8AC4CFFFF <1> call set_rtc_date 17375 00011742 E947B3FFFF <1> jmp sysret 17376 <1> sysstime_7: 17377 <1> ; BL = 6 17378 <1> ; [year], [month], [day], 17379 <1> ; [hour], [minute], [second] 17380 00011747 E89A57FFFF <1> call convert_to_epoch 17381 0001174C 89C1 <1> mov ecx, eax ; seconds since 1/1/1970 00:00:00 17382 0001174E E97CFFFFFF <1> jmp sysstime_3 17383 <1> 17384 <1> sysrename: ; Rename File (or Directory) 17385 <1> ; 19/12/2025 - TRDOS 386 v2.0.10 17386 <1> ; 08/08/2022 17387 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 17388 <1> ; 19/01/2021 17389 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 17390 <1> ; 17391 <1> ; INPUT -> 17392 <1> ; EBX = File/Directory (ASCIIZ) name address 17393 <1> ; ECX = New name (in same dir, no path name) 17394 <1> ; OUTPUT -> 17395 <1> ; cf = 0 -> EAX = 0 17396 <1> ; cf = 1 -> Error code in AL 17397 <1> 17398 <1> ; 19/01/2021 17399 00011753 803D[BE8E0100]00 <1> cmp byte [u.uid], 0 ; root (super user) ? 17400 <1> ;jna short sysrename_0 17401 <1> ; 23/07/2022 17402 0001175A 7717 <1> ja short sysrename_perm_err 17403 <1> 17404 <1> ;sysrename_perm_err: 17405 <1> ; ;mov dword [u.r0], ERR_PERM_DENIED 17406 <1> ; mov eax, ERR_PERM_DENIED ; 'permission denied !' 17407 <1> ; mov [u.r0], eax 17408 <1> ; mov [u.error], eax 17409 <1> ; jmp error 17410 <1> 17411 <1> sysrename_0: 17412 0001175C 51 <1> push ecx ; new file name address (in user space) 17413 0001175D 89DE <1> mov esi, ebx 17414 <1> ; file name is forced, change directory as temporary 17415 <1> ;mov ax, 1 17416 <1> ;mov [FFF_Valid], ah ; 0 ; reset 17417 <1> ;call set_working_path 17418 0001175F E871050000 <1> call set_working_path_x 17419 00011764 7321 <1> jnc short sysrename_1 17420 00011766 21C0 <1> and eax, eax ; 0 -> Bad Path! 17421 00011768 753B <1> jnz short sysrename_err 17422 <1> ; eax = 0 17423 <1> sysrename_path_not_found: 17424 0001176A B813000000 <1> mov eax, ERR_INV_PATH_NAME ; 'Bad path name !' 17425 <1> ; 23/07/2022 17426 0001176F B013 <1> mov al, ERR_INV_PATH_NAME 17427 00011771 EB32 <1> jmp short sysrename_err 17428 <1> ;sysrename_err: 17429 <1> ; pop ecx ; new file name address (in user space) 17430 <1> ;sysrename_error: 17431 <1> ; mov [u.r0], eax 17432 <1> ; mov [u.error], eax 17433 <1> ; call reset_working_path 17434 <1> ; jmp error 17435 <1> 17436 <1> ; 23/07/2022 17437 <1> sysrename_perm_err: 17438 <1> ;mov dword [u.r0], ERR_PERM_DENIED 17439 00011773 B80B000000 <1> mov eax, ERR_PERM_DENIED ; 'permission denied !' 17440 00011778 A3[6C8E0100] <1> mov [u.r0], eax 17441 0001177D A3[D88E0100] <1> mov [u.error], eax 17442 00011782 E9E7B2FFFF <1> jmp error 17443 <1> 17444 <1> sysrename_1: 17445 00011787 B008 <1> mov al, 08h ; Except volume labels (& long names) 17446 00011789 A0[30810100] <1> mov al, [Attributes] 17447 0001178E 2410 <1> and al, 10h ; 17448 <1> ;mov esi, FindFile_Name 17449 <1> ;mov ax, 1800h ; Only files 17450 <1> ;mov ax, 0810h ; Only directories 17451 00011790 66B80008 <1> mov ax, 0800h ; Find File or Directory 17452 00011794 E8E171FFFF <1> call find_first_file 17453 <1> ;jnc short sysrename_2 17454 00011799 720A <1> jc short sysrename_err 17455 <1> sysrename_2: 17456 <1> ; ESI = Directory Entry (FindFile_DirEntry) Location 17457 <1> ; EDI = Directory Buffer Directory Entry Location 17458 <1> ; EAX = File Size 17459 <1> ; BL = Attributes of The File/Directory 17460 <1> ; BH = Long Name Yes/No Status (>0 is YES) 17461 <1> ; DX > 0 : Ambiguous filename chars are used 17462 <1> 17463 0001179B 6621D2 <1> and dx, dx ; Ambiguous filename chars used sign (DX>0) 17464 0001179E 741A <1> jz short sysrename_3 17465 000117A0 B81A000000 <1> mov eax, ERR_INV_FILE_NAME ; 'invalid file name !' 17466 <1> ;jmp short sysrename_err 17467 <1> ; 23/07/2022 17468 <1> sysrename_err: 17469 000117A5 59 <1> pop ecx ; new file name address (in user space) 17470 <1> sysrename_error: 17471 000117A6 A3[6C8E0100] <1> mov [u.r0], eax 17472 000117AB A3[D88E0100] <1> mov [u.error], eax 17473 000117B0 E8F5050000 <1> call reset_working_path 17474 000117B5 E9B4B2FFFF <1> jmp error 17475 <1> sysrename_3: 17476 <1> ; EDI = Directory buffer entry offset/address 17477 <1> ; BL = File (or Directory) Attributes 17478 <1> ; mov bl, [EDI+0Bh] 17479 <1> 17480 000117BA 5A <1> pop edx ; new file name address (in user space) 17481 <1> 17482 <1> ; check file/directory attributes 17483 000117BB F6C307 <1> test bl, 7 ; system, hidden, readonly 17484 000117BE 75B3 <1> jnz short sysrename_perm_err 17485 <1> sysrename_4: 17486 <1> ; 19/12/2025 17487 <1> ;cmp word [edi+DirEntry_NTRes], 01A1h ; Singlix FS 17488 <1> ;je short sysrename_perm_err ; -temporary!- 17489 <1> 17490 <1> ; save old file name & file info (FFF structure) 17491 000117C0 BE[16800100] <1> mov esi, FindFile_Drv 17492 000117C5 BF[60810100] <1> mov edi, SourceFile_Drv 17493 <1> ;mov ecx, 128/4 17494 <1> ; 23/07/2022 17495 000117CA 29C9 <1> sub ecx, ecx 17496 000117CC B120 <1> mov cl, 128/4 17497 000117CE F3A5 <1> rep movsd 17498 <1> 17499 000117D0 89D6 <1> mov esi, edx ; new file name address (in user space) 17500 000117D2 BF[E0810100] <1> mov edi, DestinationFile_Drv 17501 000117D7 E8A291FFFF <1> call parse_path_name 17502 000117DC 72C8 <1> jc short sysrename_error ; eax = 1 (Bad file name) 17503 <1> 17504 <1> ; same drive ? 17505 000117DE A0[16800100] <1> mov al, [FindFile_Drv] 17506 000117E3 3A05[E0810100] <1> cmp al, [DestinationFile_Drv] 17507 <1> ;jne short sysrename_perm_err ; Permission denied 17508 000117E9 7509 <1> jne short sysrename_5 ; Bad file name 17509 <1> 17510 <1> ; no path name !? (rename file in same directory) 17511 000117EB 803D[E1810100]20 <1> cmp byte [DestinationFile_Directory], 20h 17512 000117F2 7607 <1> jna short sysrename_6 17513 <1> sysrename_5: 17514 000117F4 B801000000 <1> mov eax, ERR_BAD_CMD_ARG ; 1 = Bad file name 17515 <1> ; (Bad argument) 17516 000117F9 EBAB <1> jmp short sysrename_error 17517 <1> sysrename_6: 17518 000117FB 803D[22820100]20 <1> cmp byte [DestinationFile_Name], 20h 17519 00011802 76F0 <1> jna short sysrename_5 17520 <1> 17521 00011804 BE[22820100] <1> mov esi, DestinationFile_Name 17522 00011809 E8CB74FFFF <1> call check_filename ; is it a valid msdos file name? 17523 0001180E 7296 <1> jc short sysrename_error ; 26 = ERR_INV_FILE_NAME 17524 <1> 17525 <1> ;mov esi, DestinationFile_Name 17526 00011810 66B80008 <1> mov ax, 0800h ; Find File or Directory 17527 00011814 E86171FFFF <1> call find_first_file 17528 00011819 7207 <1> jc short sysrename_7 17529 <1> 17530 0001181B B80E000000 <1> mov eax, ERR_FILE_EXISTS ; file already exists ! 17531 <1> jmp_sysrename_err: ; 08/08/2022 17532 00011820 EB84 <1> jmp sysrename_error 17533 <1> sysrename_7: 17534 <1> ; eax = 2 (File not found !) 17535 00011822 3C02 <1> cmp al, 2 ; ERR_NOT_FOUND 17536 <1> ;jne short sysrename_error 17537 <1> ; 08/08/2022 17538 00011824 75FA <1> jne short jmp_sysrename_err 17539 <1> 17540 <1> ; 31/12/2017 17541 <1> ; Following code is also part of 'rename_file' in 17542 <1> ; 'trdosk3.s' (MainProg's 'rename' command) ; 13/11/2017 17543 00011826 BE[22820100] <1> mov esi, DestinationFile_Name ; (Rename_NewName) 17544 0001182B 668B0D[DA810100] <1> mov cx, [SourceFile_DirEntryNumber] 17545 00011832 66A1[C6810100] <1> mov ax, [SourceFile_DirEntry+20] ; First Cluster, HW 17546 00011838 C1E010 <1> shl eax, 16 17547 0001183B 66A1[CC810100] <1> mov ax, [SourceFile_DirEntry+26] ; First Cluster, LW 17548 00011841 0FB61D[AF810100] <1> movzx ebx, byte [SourceFile_LongNameEntryLength] 17549 00011848 E8E098FFFF <1> call rename_directory_entry 17550 <1> ;jc short sysrename_error 17551 <1> ; 08/08/2022 17552 0001184D 72D1 <1> jc short jmp_sysrename_err 17553 <1> ;xor eax, eax 17554 0001184F A3[6C8E0100] <1> mov [u.r0], eax ; 0 17555 <1> ;mov [u.error], eax 17556 00011854 E851050000 <1> call reset_working_path 17557 00011859 E930B2FFFF <1> jmp sysret 17558 <1> 17559 <1> sysmem: ; Get Total&Free Memory amount 17560 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 17561 <1> ; 17562 <1> ; INPUT -> 17563 <1> ; none 17564 <1> ; OUTPUT -> 17565 <1> ; EAX = Total memory count (in bytes) 17566 <1> ; EBX = Virtually available memory amount (in bytes) 17567 <1> ; = 4GB - CORE (4MB) 17568 <1> ; ECX = Free memory count (in bytes) 17569 <1> ; EDX = Calculated free memory count (in bytes) 17570 <1> 17571 0001185E A1[B4760100] <1> mov eax, [memory_size] ; in pages 17572 00011863 C1E00C <1> shl eax, 12 ; in bytes 17573 00011866 A3[6C8E0100] <1> mov [u.r0], eax 17574 0001186B E8CB29FFFF <1> call calc_free_mem 17575 <1> ; edx = calculated free pages 17576 <1> ; ecx = 0 17577 00011870 8B2D[688E0100] <1> mov ebp, [u.usp] ; EBP points to user's registers 17578 00011876 C745100000C0FF <1> mov dword [ebp+16], ECORE ; EBX (for user) 17579 <1> ; 0FFC00000h ; 4GB - 4MB 17580 0001187D C1E20C <1> shl edx, 12 17581 00011880 895514 <1> mov [ebp+20], edx ; EDX (for user) 17582 00011883 8B0D[B8760100] <1> mov ecx, [free_pages] 17583 00011889 C1E10C <1> shl ecx, 12 ; free bytes 17584 0001188C 894D18 <1> mov [ebp+24], ecx ; ECX (for user) 17585 <1> ;mov [free_pages], edx 17586 0001188F E9FAB1FFFF <1> jmp sysret 17587 <1> 17588 <1> sysprompt: 17589 <1> ; Set TRDOS 386 Command Interpreter (MainProg) prompt 17590 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 17591 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 17592 <1> ; 17593 <1> ; INPUT -> 17594 <1> ; EBX = 0 -> use default prompt 17595 <1> ; EBX > 0 -> prompt string (ASCIIZ) address 17596 <1> ; (Max. 11 characters except ZERO tail) 17597 <1> ; OUTPUT -> 17598 <1> ; (EAX = 0) 17599 <1> ; CF = 0 -> Successful 17600 <1> ; CF = 1 -> Failed 17601 <1> 17602 00011894 21DB <1> and ebx, ebx 17603 00011896 750A <1> jnz short sysprompt_0 17604 <1> 17605 00011898 E8C46AFFFF <1> call default_command_prompt ; '['+'TRDOS'+']' 17606 0001189D E9ECB1FFFF <1> jmp sysret 17607 <1> 17608 <1> sysprompt_0: 17609 000118A2 31C0 <1> xor eax, eax 17610 000118A4 A3[6C8E0100] <1> mov [u.r0], eax 17611 000118A9 89DE <1> mov esi, ebx 17612 <1> ;mov ecx, 12 17613 <1> ; 30/07/2022 17614 000118AB 31C9 <1> xor ecx, ecx 17615 000118AD B10C <1> mov cl, 12 17616 000118AF 89E5 <1> mov ebp, esp 17617 000118B1 29CC <1> sub esp, ecx 17618 000118B3 49 <1> dec ecx ; 11 17619 000118B4 89E7 <1> mov edi, esp 17620 000118B6 E8AAF2FFFF <1> call transfer_from_user_buffer 17621 000118BB 7211 <1> jc short sysprompt_err 17622 000118BD 803E20 <1> cmp byte [esi], 20h 17623 000118C0 760C <1> jna short sysprompt_err 17624 000118C2 E8AC6AFFFF <1> call set_command_prompt 17625 000118C7 89EC <1> mov esp, ebp 17626 000118C9 E9C0B1FFFF <1> jmp sysret 17627 <1> sysprompt_err: 17628 <1> syspath_err: 17629 000118CE 89EC <1> mov esp, ebp 17630 000118D0 E999B1FFFF <1> jmp error 17631 <1> 17632 <1> syspath: 17633 <1> ; Get/Set Run Path 17634 <1> ; 17635 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 17636 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 17637 <1> ; 17638 <1> ; INPUT -> 17639 <1> ; EBX = 0 -> get path (to buffer address in ECX) 17640 <1> ; EBX > 0 -> set path 17641 <1> ; EBX = Path string buffer address (ASCIIZ) 17642 <1> ; (Path description except 'PATH=') 17643 <1> ; ECX = Buffer address (if EBX = 0) 17644 <1> ; (ECX will not be used if EBX > 0) 17645 <1> ; DL = Buffer size (0 = 256 byte) 17646 <1> ; 17647 <1> ; OUTPUT -> 17648 <1> ; CF = 0 -> Successful (EAX = String length) 17649 <1> ; CF = 1 -> Failed (EAX = 0) 17650 <1> ; 17651 <1> ; NOTE: 'PATH=' or 'PATH' must be excluded 17652 <1> ; (It must not be at the beginning of the string.) 17653 <1> 17654 000118D5 89E5 <1> mov ebp, esp 17655 000118D7 81EC00010000 <1> sub esp, 256 17656 000118DD 89E7 <1> mov edi, esp 17657 <1> 17658 000118DF 31C0 <1> xor eax, eax 17659 000118E1 A3[6C8E0100] <1> mov [u.r0], eax 17660 <1> 17661 000118E6 21DB <1> and ebx, ebx 17662 000118E8 752A <1> jnz short syspath_0 17663 <1> 17664 <1> ; EBX = 0 -> get run path 17665 000118EA 89CB <1> mov ebx, ecx ; buffer addr (in user's mem space) 17666 000118EC BE[632F0100] <1> mov esi, Cmd_Path ; 'PATH' address 17667 000118F1 0FB6CA <1> movzx ecx, dl 17668 <1> ;sub cl, 1 ; 0 -> 255, 1 -> 0 17669 <1> ;adc cx, 1 ; 255 -> 256, 0 -> 1 17670 <1> ; 30/07/2022 17671 000118F4 FEC9 <1> dec cl ; 0 -> 255, 1 -> 0 17672 000118F6 41 <1> inc ecx ; 255 -> 256, 0 -> 1 17673 <1> ; EDI = Output buffer 17674 <1> ; CX = Buffer length 17675 <1> ; AL = 0 -> use ASCIIZ word in [ESI] 17676 <1> ; ESI = 'PATH' address (with zero tail) 17677 000118F7 E8BB81FFFF <1> call get_environment_string 17678 000118FC 72D0 <1> jc short syspath_err 17679 000118FE 89DF <1> mov edi, ebx ; User's buffer address 17680 00011900 89E6 <1> mov esi, esp 17681 <1> ; EDI = User's buffer address 17682 <1> ; ECX = transfer (byte) count 17683 00011902 E814F2FFFF <1> call transfer_to_user_buffer 17684 00011907 72C5 <1> jc short syspath_err 17685 00011909 890D[6C8E0100] <1> mov [u.r0], ecx 17686 0001190F E97AB1FFFF <1> jmp sysret 17687 <1> 17688 <1> syspath_0: 17689 00011914 89DE <1> mov esi, ebx 17690 00011916 0FB6CA <1> movzx ecx, dl 17691 <1> ;sub cl, 1 ; 0 -> 255, 1 -> 0 17692 <1> ;adc cx, 1 ; 255 -> 256, 0 -> 1 17693 <1> ; 30/07/2022 17694 00011919 FEC9 <1> dec cl ; 0 -> 255, 1 -> 0 17695 0001191B 41 <1> inc ecx ; 255 -> 256, 0 -> 1 17696 0001191C E844F2FFFF <1> call transfer_from_user_buffer 17697 00011921 72AB <1> jc short syspath_err 17698 <1> ;(*) 'PATH=' will be added to 17699 <1> ; the head of the string 17700 00011923 83EC08 <1> sub esp, 8 ;(*) 17701 00011926 89FE <1> mov esi, edi ;(*) 17702 00011928 E86E81FFFF <1> call set_path_x ;(*) 17703 0001192D 729F <1> jc short syspath_err 17704 0001192F 8915[6C8E0100] <1> mov [u.r0], edx ; run path string length 17705 00011935 E954B1FFFF <1> jmp sysret 17706 <1> 17707 <1> sysenv: 17708 <1> ; Get/Set Environment Variables 17709 <1> ; 17710 <1> ; 30/07/2022 17711 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 17712 <1> ; 31/12/2017 (TRDOS 386 = TRDOS v2.0) 17713 <1> ; 17714 <1> ; INPUT -> 17715 <1> ; EBX = 0 -> get (all) environment variables 17716 <1> ; (Required Buffer length = 512 bytes) 17717 <1> ; EBX > 0 -> set (one) environment variable 17718 <1> ; (If there is not a '=' after 17719 <1> ; the environment variable name, it will 17720 <1> ; accepted as 'get environment variable'.) 17721 <1> ; EBX = Buffer address 17722 <1> ; ECX = Buffer address (if EBX = 0) 17723 <1> ; (ECX will not be used if EBX > 0) 17724 <1> ; (Note: Buffer size is 512 bytes.) 17725 <1> ; DL = Buffer size (0 = 256 byte) 17726 <1> ; (For one envrionment variable) 17727 <1> ; 17728 <1> ; OUTPUT -> 17729 <1> ; (EAX = 0) 17730 <1> ; CF = 0 -> Successful (EAX = String length) 17731 <1> ; CF = 1 -> Failed (EAX = 0) 17732 <1> ; 17733 <1> ; Note: Environment variable name, for example, 17734 <1> ; 'PATH=' must be included at the beginning 17735 <1> ; of the environment string. If the variable 17736 <1> ; name is as 'PATH' but it is not as 'PATH=' 17737 <1> ; the variable string (row) will be returned. 17738 <1> ; If variable name is as 'PATH=' but there is 17739 <1> ; not a following text after the variable name, 17740 <1> ; the environment variable will be reset/deleted. 17741 <1> 17742 0001193A 89E5 <1> mov ebp, esp 17743 0001193C 81EC00020000 <1> sub esp, 512 17744 00011942 89E7 <1> mov edi, esp 17745 <1> 17746 00011944 31C0 <1> xor eax, eax 17747 00011946 A3[6C8E0100] <1> mov [u.r0], eax 17748 <1> 17749 0001194B 21DB <1> and ebx, ebx 17750 0001194D 751F <1> jnz short sysenv_0 17751 <1> 17752 <1> ; EBX = 0 -> get (all) environment variables 17753 0001194F 89EC <1> mov esp, ebp 17754 00011951 BE00300900 <1> mov esi, Env_Page ; Environment page 17755 00011956 89CF <1> mov edi, ecx ; buffer addr (in user's mem space) 17756 <1> ;mov ecx, 512 17757 <1> ; 30/07/2022 17758 00011958 29C9 <1> sub ecx, ecx 17759 0001195A B502 <1> mov ch, 2 17760 <1> ; ecx = 512 17761 0001195C E8BAF1FFFF <1> call transfer_to_user_buffer 17762 <1> ;jc error 17763 <1> ; 23/07/2022 17764 00011961 725B <1> jc short sysenv_error 17765 00011963 890D[6C8E0100] <1> mov [u.r0], ecx 17766 00011969 E920B1FFFF <1> jmp sysret 17767 <1> 17768 <1> sysenv_0: 17769 0001196E 89DE <1> mov esi, ebx ; * ; user's buffer address 17770 00011970 0FB6CA <1> movzx ecx, dl 17771 <1> ;sub cl, 1 ; 0 -> 255, 1 -> 0 17772 <1> ;adc cx, 1 ; 255 -> 256, 0 -> 1 17773 <1> ; 30/07/2022 17774 00011973 FEC9 <1> dec cl ; 0 -> 255, 1 -> 0 17775 00011975 41 <1> inc ecx ; 255 -> 256, 0 -> 1 17776 00011976 E8EAF1FFFF <1> call transfer_from_user_buffer 17777 0001197B 723F <1> jc short sysenv_err 17778 0001197D 89FE <1> mov esi, edi 17779 0001197F 8A06 <1> mov al, [esi] 17780 00011981 3C20 <1> cmp al, 20h 17781 00011983 7637 <1> jna short sysenv_err 17782 00011985 3C3D <1> cmp al, '=' 17783 00011987 7433 <1> je short sysenv_err 17784 00011989 56 <1> push esi 17785 <1> sysenv_1: 17786 0001198A 46 <1> inc esi 17787 0001198B 803E3D <1> cmp byte [esi], '=' 17788 0001198E 7433 <1> je short sysenv_3 17789 00011990 803E20 <1> cmp byte [esi], 20h 17790 00011993 73F5 <1> jnb short sysenv_1 17791 00011995 C60600 <1> mov byte [esi], 0 17792 00011998 5E <1> pop esi 17793 <1> ; EDI = Output buffer 17794 <1> ; CX = Buffer length 17795 00011999 30C0 <1> xor al, al 17796 <1> ; AL = 0 -> use ASCIIZ word in [ESI] 17797 <1> ; ESI = Environment variable name address 17798 0001199B E81781FFFF <1> call get_environment_string 17799 000119A0 721A <1> jc short sysenv_err 17800 000119A2 89DF <1> mov edi, ebx ; * ; user's buffer address 17801 000119A4 89C1 <1> mov ecx, eax ; String length 17802 000119A6 89E6 <1> mov esi, esp 17803 <1> ; ESI = system buffer address 17804 <1> ; EDI = User's buffer address 17805 <1> ; ECX = transfer (byte) count 17806 000119A8 E86EF1FFFF <1> call transfer_to_user_buffer 17807 000119AD 720D <1> jc short sysenv_err 17808 000119AF 890D[6C8E0100] <1> mov [u.r0], ecx ; transfer (byte) count 17809 <1> sysenv_2: 17810 000119B5 89EC <1> mov esp, ebp 17811 000119B7 E9D2B0FFFF <1> jmp sysret 17812 <1> sysenv_err: 17813 000119BC 89EC <1> mov esp, ebp 17814 <1> sysenv_error: ; 23/07/2022 17815 000119BE E9ABB0FFFF <1> jmp error 17816 <1> sysenv_3: 17817 000119C3 46 <1> inc esi 17818 000119C4 803E20 <1> cmp byte [esi], 20h 17819 000119C7 73FA <1> jnb short sysenv_3 17820 000119C9 C60600 <1> mov byte [esi], 0 17821 000119CC 5E <1> pop esi 17822 000119CD E8A881FFFF <1> call set_environment_string 17823 000119D2 72E8 <1> jc short sysenv_err 17824 000119D4 8915[6C8E0100] <1> mov [u.r0], edx 17825 000119DA EBD9 <1> jmp short sysenv_2 17826 <1> 17827 <1> isintr: 17828 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 17829 <1> ; check terminate (CTRL+BREAK) 17830 <1> ; interrupt is enabled or disabled 17831 <1> ;test word [u.intr], 0FFFFh 17832 000119DC F605[B88E0100]FF <1> test byte [u.intr], 0FFh 17833 <1> ; zf = 1 -> terminate interrupt disabled 17834 <1> ; zf = 0 -> terminate interrupt enabled 17835 <1> 17836 <1> ; 19/12/2025 17837 <1> iget: 17838 <1> sndc: 17839 <1> sleep: 17840 000119E3 C3 <1> retn 17841 <1> 17842 <1> ; 23/07/2022 - TRDOS 386 v2.0.5 17843 <1> 17844 <1> ; 22/01/2021 17845 <1> ; temporary - 24/01/2016 17846 <1> 17847 <1> ; 19/12/2025 17848 <1> ;iget: 17849 <1> ; ;retn 17850 <1> ;;iopen: 17851 <1> ;; ;retn 17852 <1> ;;iclose: 17853 <1> ;; ;retn 17854 <1> ;sndc: 17855 <1> ; ;retn 17856 <1> ;access: 17857 <1> ; ;retn 17858 <1> ;sleep: 17859 <1> ; retn 3439 %include 'trdosk7.s' ; 24/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.6) - DISK READ&WRITE : trdosk7.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 29/08/2023 (Previous: 25/07/2022 - Kernel v2.0.5) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.11 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; DISK_IO.ASM (20/07/2011) 12 <1> ; **************************************************************************** 13 <1> ; DISK_IO.ASM (c) 2009-2011 Erdogan TAN [ 04/07/2009 ] Last Update: 20/07/2011 14 <1> 15 <1> disk_write: 16 <1> ; 25/02/2016 17 <1> ; 24/02/2016 18 <1> ; 23/02/2016 19 000119E4 807E0500 <1> cmp byte [esi+LD_LBAYes], 0 20 000119E8 7774 <1> ja short lba_write 21 <1> 22 <1> chs_write: 23 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 24 <1> ; 25/02/2016 25 <1> ; 23/02/2016 26 000119EA C605[657F0100]03 <1> mov byte [disk_rw_op], 3 ; CHS write 27 000119F1 EB0D <1> jmp short chs_rw 28 <1> 29 <1> disk_read: 30 <1> ; 25/02/2016 31 <1> ; 24/02/2016 32 <1> ; 23/02/2016 33 <1> ; 17/02/2016 34 <1> ; 14/02/2016 35 <1> ; 31/01/2016 (TRDOS 386 = TRDOS v2.0) 36 <1> ; 17/10/2010 37 <1> ; 18/04/2010 38 <1> ; 39 <1> ; INPUT -> EAX = Logical Block Address 40 <1> ; ESI = Logical Dos Disk Table Offset (DRV) 41 <1> ; ECX = Sector Count 42 <1> ; EBX = Destination Buffer 43 <1> ; OUTPUT -> 44 <1> ; cf = 0 or cf = 1 45 <1> ; (Modified registers: EAX, EBX, ECX, EDX) 46 <1> 47 000119F3 807E0500 <1> cmp byte [esi+LD_LBAYes], 0 48 000119F7 776E <1> ja short lba_read 49 <1> 50 <1> chs_read: 51 <1> ; 29/08/2023 (TRDOS 386 Kernel v2.0.6) 52 <1> ; 25/07/2022 (TRDOS 386 Kernel v2.0.5) 53 <1> ; 25/02/2016 54 <1> ; 24/02/2016 55 <1> ; 23/02/2016 56 <1> ; 31/01/2016 (TRDOS 386 = TRDOS v2.0) 57 <1> ; 20/07/2011 58 <1> ; 04/07/2009 59 <1> ; 60 <1> ; INPUT -> EAX = Logical Block Address 61 <1> ; ECX = Number of sectors to read 62 <1> ; ESI = Logical Dos Disk Table Offset (DRV) 63 <1> ; EBX = Destination Buffer 64 <1> ; OUTPUT -> 65 <1> ; cf = 0 or cf = 1 66 <1> ; (Modified registers: EAX, EBX, ECX, EDX) 67 <1> 68 <1> ; 23/02/2016 69 000119F9 C605[657F0100]02 <1> mov byte [disk_rw_op], 2 ; CHS read 70 <1> 71 <1> chs_rw: 72 <1> ;;movzx edx, word [esi+LD_BPB+SecPerTrack] 73 <1> ;movzx edx, byte [esi+LD_BPB+SecPerTrack] ; <= 63 74 <1> ;mov [disk_rw_spt], dl 75 <1> 76 <1> chs_read_next_sector: 77 00011A00 C605[667F0100]04 <1> mov byte [retry_count], 4 78 <1> 79 <1> chs_read_retry: 80 <1> ;mov [sector_count], ecx ; 23/02/2016 81 <1> 82 00011A07 50 <1> push eax ; Linear sector # 83 00011A08 51 <1> push ecx ; # of FAT/FILE/DIR sectors 84 <1> 85 00011A09 0FB74E1E <1> movzx ecx, word [esi+LD_BPB+SecPerTrack] 86 <1> ;movzx ecx, byte [disk_rw_spt] ; 23/02/2016 87 00011A0D 29D2 <1> sub edx, edx 88 00011A0F F7F1 <1> div ecx 89 <1> ; eax = track, dx (dl ) = sector (on track) 90 <1> ;sub cl, dl ; 24/02/2016 (spt - sec) 91 <1> ;push ecx ; * 92 <1> ; 25/07/2022 93 <1> ;mov cx, dx ; Sector (zero based) 94 <1> ;inc cx ; To make it 1 based 95 <1> ;push cx 96 <1> ; 29/08/2023 97 <1> ;mov ecx, edx 98 <1> ;inc ecx 99 <1> ;push ecx 100 00011A11 42 <1> inc edx 101 00011A12 52 <1> push edx ; dl = sector number (on track) 102 <1> ; 103 00011A13 668B4E20 <1> mov cx, [esi+LD_BPB+Heads] 104 <1> ;sub dx, dx 105 <1> ; 25/07/2022 106 00011A17 29D2 <1> sub edx, edx 107 00011A19 F7F1 <1> div ecx ; Convert track to head & cyl 108 <1> ; eax (ax) = cylinder, dx (dl) = head (max. FFh) 109 00011A1B 88D6 <1> mov dh, dl 110 <1> ;pop cx ; AX=Cyl, DH=Head, CX=Sector 111 <1> ; 25/07/2022 112 00011A1D 59 <1> pop ecx ; sector number (on track) 113 00011A1E 8A5602 <1> mov dl, [esi+LD_PhyDrvNo] 114 <1> 115 00011A21 88C5 <1> mov ch, al ; NOTE: max. 1023 cylinders ! 116 00011A23 C0CC02 <1> ror ah, 2 ; Rotate 2 bits right 117 00011A26 08E1 <1> or cl, ah 118 <1> 119 <1> ; 24/02/2016 120 <1> ;pop eax ; * (spt - sec) (example: 63 - 0 = 63) 121 <1> ;cmp eax, [sector_count] 122 <1> ;jb short chs_write_sectors 123 <1> ;je short chs_read_sectors 124 <1> ;; (# of sectors to read is more than remaining sectors on the track) 125 <1> ;mov al, [sector_count] 126 <1> ;chs_read_sectors: ; read or write ! 127 00011A28 B001 <1> mov al, 1 ; 25/02/2016 128 00011A2A 8A25[657F0100] <1> mov ah, [disk_rw_op] ; 02h = chs read, 03h = chs write 129 <1> ; 130 00011A30 E8DA35FFFF <1> call int13h ; BIOS Service func ( ah ) = 2 131 <1> ; Read disk sectors 132 <1> ; AL-sec num CH-track CL-sec 133 <1> ; DH-head DL-drive ES:BX-buffer 134 <1> ; CF-flag AH-stat AL-sec read 135 <1> ; If CF = 1 then (If AH > 0) 136 00011A35 8825[677F0100] <1> mov [disk_rw_err], ah 137 <1> 138 00011A3B 59 <1> pop ecx 139 00011A3C 58 <1> pop eax 140 00011A3D 7314 <1> jnc short chs_read_ok 141 <1> 142 00011A3F 803D[677F0100]09 <1> cmp byte [disk_rw_err], 09h ; DMA crossed 64K segment boundary 143 00011A46 7408 <1> je short chs_read_error_retn 144 <1> 145 00011A48 FE0D[667F0100] <1> dec byte [retry_count] 146 00011A4E 75B7 <1> jnz short chs_read_retry 147 <1> 148 <1> chs_read_error_retn: 149 00011A50 F9 <1> stc 150 <1> ;retn 151 00011A51 EB67 <1> jmp short update_drv_error_byte 152 <1> 153 <1> ;chs_write_sectors: ; read or write 154 <1> ;; (# of sectors to read is less than remaining sectors on the track) 155 <1> ;mov [sector_count], al 156 <1> ;jmp short chs_read_sectors 157 <1> 158 <1> chs_read_ok: 159 <1> ;; 23/02/2016 160 <1> ;movzx edx, byte [sector_count] ; sector count (<= spt) 161 <1> ;sub ecx, edx ; remaining sector count 162 <1> ;jna short update_drv_error_byte 163 <1> ;add eax, edx ; next disk sector 164 <1> ;shl edx, 9 ; 512 * sector count 165 <1> ;add ebx, edx ; next buffer byte address 166 <1> ;jmp chs_read_next_sector 167 <1> ; 25/02/2016 168 00011A53 40 <1> inc eax ; next sector 169 00011A54 81C300020000 <1> add ebx, 512 170 00011A5A E2A4 <1> loop chs_read_next_sector 171 00011A5C EB5C <1> jmp short update_drv_error_byte 172 <1> 173 <1> lba_write: 174 <1> ; 23/02/2016 175 00011A5E C605[657F0100]1C <1> mov byte [disk_rw_op], 1Ch ; LBA write 176 00011A65 EB07 <1> jmp short lba_rw 177 <1> 178 <1> lba_read: 179 <1> ; 14/07/2022 180 <1> ; 23/02/2016 181 <1> ; 17/02/2016 182 <1> ; 14/02/2016 183 <1> ; 13/02/2016 184 <1> ; 31/01/2016 (TRDOS 386 = TRDOS v2.0) 185 <1> ; 10/07/2015 (Retro UNIX 386 v1) 186 <1> ; 187 <1> ; INPUT -> EAX = Logical Block Address 188 <1> ; ESI = Logical Dos Disk Table Offset (DRV) 189 <1> ; ECX = Sector Count 190 <1> ; EBX = Destination Buffer 191 <1> ; OUTPUT -> 192 <1> ; cf = 0 or cf = 1 193 <1> ; (Modified registers: EAX, EBX, ECX, EDX) 194 <1> 195 <1> ; LBA read/write (with private LBA function) 196 <1> ;((Retro UNIX 386 v1 - DISK I/O code by Erdogan Tan)) 197 <1> 198 <1> ; 23/02/2016 199 00011A67 C605[657F0100]1B <1> mov byte [disk_rw_op], 1Bh ; LBA read 200 <1> 201 <1> lba_rw: 202 <1> ; 17/02/2016 203 00011A6E 57 <1> push edi 204 <1> 205 00011A6F 890D[687F0100] <1> mov [sector_count], ecx ; total sector (read) count 206 <1> 207 00011A75 8A5602 <1> mov dl, [esi+LD_PhyDrvNo] 208 <1> ; dl = physical drive number (0, 1, 80h, 81h, 82h, 83h) 209 <1> 210 <1> lba_read_next: 211 <1> ; 14/07/2022 212 00011A78 BF00010000 <1> mov edi, 256 213 00011A7D 39F9 <1> cmp ecx, edi 214 <1> ;cmp ecx, 256 215 00011A7F 7602 <1> jna short lba_read_rsc 216 <1> ;mov ecx, 256 ; 17/02/2016 217 00011A81 89F9 <1> mov ecx, edi 218 <1> lba_read_rsc: 219 00011A83 290D[687F0100] <1> sub [sector_count], ecx ; remain sectors 220 <1> 221 00011A89 89CF <1> mov edi, ecx 222 00011A8B 89C1 <1> mov ecx, eax ; sector number/address 223 <1> 224 00011A8D C605[667F0100]04 <1> mov byte [retry_count], 4 225 <1> lba_read_retry: 226 00011A94 89F8 <1> mov eax, edi 227 <1> ; 228 <1> ; ecx = sector number 229 <1> ; al = sector count (0 - 255) /// (0 = 256) 230 <1> ; dl = drive number 231 <1> ; ebx = buffer offset 232 <1> ; 233 <1> ; Function 1Bh = LBA read, 1Ch = LBA write 234 <1> ; 23/02/2016 235 00011A96 8A25[657F0100] <1> mov ah, [disk_rw_op] ; 1Bh = LBA read, 1Ch = LBA write 236 00011A9C E86E35FFFF <1> call int13h 237 <1> ; al = ? (changed) 238 <1> ; ah = error code 239 00011AA1 8825[677F0100] <1> mov [disk_rw_err], ah 240 00011AA7 7332 <1> jnc short lba_read_ok 241 00011AA9 80FC80 <1> cmp ah, 80h ; time out? 242 00011AAC 740A <1> je short lba_read_stc_retn 243 00011AAE FE0D[667F0100] <1> dec byte [retry_count] 244 00011AB4 7FDE <1> jg short lba_read_retry 245 00011AB6 7438 <1> jz short lba_read_reset 246 <1> ; sf = 1 247 <1> 248 <1> lba_read_stc_retn: 249 00011AB8 F9 <1> stc 250 <1> lba_read_retn: 251 00011AB9 5F <1> pop edi 252 <1> 253 <1> update_drv_error_byte: 254 00011ABA 9C <1> pushf 255 00011ABB 53 <1> push ebx 256 <1> ;push cx 257 00011ABC 51 <1> push ecx ; 14/07/2022 258 <1> ;or ecx, ecx 259 <1> ;jz short udrv_errb0 260 00011ABD 8A0D[677F0100] <1> mov cl, [disk_rw_err] 261 <1> udrv_errb0: 262 00011AC3 0FB65E02 <1> movzx ebx, byte [esi+LD_PhyDrvNo] 263 00011AC7 80FB02 <1> cmp bl, 2 264 00011ACA 7203 <1> jb short udrv_errb1 265 00011ACC 80EB7E <1> sub bl, 7Eh 266 <1> ;cmp bl, 5 267 <1> ;ja short udrv_errb2 268 <1> udrv_errb1: 269 00011ACF 81C3[B5660000] <1> add ebx, drv.error ; 13/02/2016 270 00011AD5 880B <1> mov [ebx], cl ; error code 271 <1> udrv_errb2: 272 <1> ;pop cx 273 00011AD7 59 <1> pop ecx ; 14/07/2022 274 00011AD8 5B <1> pop ebx 275 00011AD9 9D <1> popf 276 00011ADA C3 <1> retn 277 <1> 278 <1> lba_read_ok: 279 00011ADB 89C8 <1> mov eax, ecx ; sector number 280 00011ADD 01F8 <1> add eax, edi ; sector number (next) 281 00011ADF C1E709 <1> shl edi, 9 ; sector count * 512 282 00011AE2 01FB <1> add ebx, edi ; next buffer offset 283 <1> 284 00011AE4 8B0D[687F0100] <1> mov ecx, [sector_count] ; remaining sectors 285 00011AEA 09C9 <1> or ecx, ecx 286 00011AEC 758A <1> jnz short lba_read_next 287 00011AEE EBC9 <1> jmp short lba_read_retn 288 <1> 289 <1> lba_read_reset: 290 00011AF0 B40D <1> mov ah, 0Dh ; Alternate reset 291 00011AF2 E81835FFFF <1> call int13h 292 <1> ; al = ? (changed) 293 <1> ; ah = error code 294 00011AF7 739B <1> jnc short lba_read_retry 295 00011AF9 EBBE <1> jmp short lba_read_retn 3440 %include 'trdosk8.s' ; 24/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - MAIN PROGRAM : trdosk8.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 28/01/2025 (Previous: 29/12/2024) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 11 <1> ; u0.s (20/11/2015), u4.s (14/10/2015) 12 <1> ; **************************************************************************** 13 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 14 <1> ; TRDOS2.ASM (09/11/2011) 15 <1> ; ---------------------------------------------------------------------------- 16 <1> ; DIR.ASM (c) 2004-2011 Erdogan TAN [07/01/2004] Last Update: 09/10/2011 17 <1> 18 <1> set_run_sequence: 19 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 20 <1> ; 23/12/2016 21 <1> ; 10/06/2016 22 <1> ; 22/05/2016 23 <1> ; 20/05/2016 24 <1> ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 25 <1> ; TRDOS 386 feature only ! 26 <1> ; 27 <1> ; INPUT -> 28 <1> ; AL = process number (next process) 29 <1> ; 30 <1> ; this process must be added to run sequence 31 <1> ; 32 <1> ; [u.pri] = priority of present process 33 <1> ; 34 <1> ; DL = priority (queue) 35 <1> ; 0 = background (low) ; run on background 36 <1> ; 1 = regular (normal) ; run as regular 37 <1> ; 2 = event (high) ; run for event 38 <1> ; 39 <1> ; 1) If the requested process is already running: 40 <1> ; a) If present priority is high ([u.pri]=2) 41 <1> ; and requested priority is also high, 42 <1> ; there is nothing to do! Because it has been 43 <1> ; done already (before this attempt). 44 <1> ; b) If present priority is high ([u.pri]=2) 45 <1> ; and requested priority is not high, there is 46 <1> ; nothing to do! Because, it's current 47 <1> ; run queue is unspecified, here. (It may be in 48 <1> ; a waiting list or in a run queue; if the new 49 <1> ; priority would be used to add it to relavant 50 <1> ; run queue, this would be wrong, unnecessary 51 <1> ; and destabilizing duplication!) 52 <1> ; c) If present priority is not high ([u.pri]<2) 53 <1> ; and requested priority is high (event), 54 <1> ; process will be added to present priority's 55 <1> ; run queue and then, priority will be changed 56 <1> ; to high ([u.pri]=2). 57 <1> ; d) If present priority is not high ([u.pri]<2) 58 <1> ; and requested priority is not high, [u.pri] 59 <1> ; value will be changed. There is nothing to do 60 <1> ; in addition. (The new priority value will be 61 <1> ; used by 'tswap/tswitch' procedure at 'sysret' 62 <1> ; or 'sysrele' stage.) 63 <1> ; 64 <1> ; 2) If the requested process is not running: 65 <1> ; a) If requested priority of the requested 66 <1> ; (next) process is high (event) and priority 67 <1> ; of present process is not high, the requested 68 <1> ; process will be added to ('runq_event') high 69 <1> ; priority run queue and then present (running) 70 <1> ; process will be stopped (swapped/switched out) 71 <1> ; immediately if it is in user mode, or it's 72 <1> ; [u.quant] value will be reset to 0 and (then) 73 <1> ; it will be stopped at 'sysret' stage. 74 <1> ; b) If requested priority of the requested 75 <1> ; (next) process is high (event) and priority 76 <1> ; of present process is also high, the requested 77 <1> ; process will be added to ('runq_event') high 78 <1> ; priority run queue and present (running) 79 <1> ; process will be allowed to run until it's 80 <1> ; time quantum will be elapsed ([u.quant]=0). 81 <1> ; c) If requested priority of the requested 82 <1> ; (next) process is not high ('run for event'), 83 <1> ; there is nothing to do. Because, it's current 84 <1> ; run queue is unspecified, here. (It may be in 85 <1> ; a waiting list or in a run queue; if the new 86 <1> ; priority would be used to add it to relavant 87 <1> ; run queue, this would be wrong, unnecessary 88 <1> ; and destabilizing duplication!) 89 <1> ; 90 <1> ; OUTPUT -> 91 <1> ; none 92 <1> ; 93 <1> ; [u.pri] = priority of present process 94 <1> ; 95 <1> ; cf = 1, if the request could not be fulfilled. 96 <1> ; 97 <1> ; NOTE: 98 <1> ; * Processes in 'run as regular' queue can run 99 <1> ; if there is no process in 'run for event' queue 100 <1> ; ('run for event' processes have higher priority) 101 <1> ; * When [u.quant] time quantum of a process is 102 <1> ; elapsed, it's high priority ('run for event') 103 <1> ; status will be disabled, it can be run in sequence 104 <1> ; of it's actual run queue. 105 <1> ; * A 'run on background' process will always be 106 <1> ; sequenced in 'run on background' (low priority) 107 <1> ; queue, it can run only when other priority queues 108 <1> ; are empty. (idle time processes, e.g. printing) 109 <1> ; 110 <1> ; Modified registers: eax, ebx, edx 111 <1> ; 112 <1> 113 <1> srunseq_0: 114 00011AFB 3A05[BD8E0100] <1> cmp al, [u.uno] ; same process ? 115 00011B01 750C <1> jne short srunseq_2 ; no 116 <1> 117 00011B03 8A25[B68E0100] <1> mov ah, [u.pri] ; present/current priority 118 00011B09 80FC02 <1> cmp ah, 2 ; 'run for event' priority level 119 00011B0C 7220 <1> jb short srunseq_6 ; no 120 <1> 121 <1> srunseq_1: 122 <1> ; there is nothing to do! 123 00011B0E C3 <1> retn 124 <1> 125 <1> srunseq_2: 126 <1> ;;this not necessary ! 23/12/2016 127 <1> ;;cmp al, nproc ; number of processes = 16 128 <1> ;;jnb short srunseq_5 ; error ! invalid process number 129 <1> 130 <1> ; dl = priority 131 00011B0F 80FA02 <1> cmp dl, 2 ; event queue 132 00011B12 72FA <1> jb short srunseq_1 ; requested process is not present 133 <1> ; process and priority of requested 134 <1> ; process is not high (event), 135 <1> ; there is nothing to do! 136 <1> 137 <1> ; requested process is not present process 138 <1> ; & priority of requested process is high 139 00011B14 3A15[B68E0100] <1> cmp dl, [u.pri] ; priority of present process 140 00011B1A 7606 <1> jna short srunseq_3 ; is high, also 141 <1> ; 142 <1> ; present process will be swapped/switched out 143 00011B1C FE05[45830100] <1> inc byte [p_change] ; 1 144 <1> 145 <1> srunseq_3: 146 <1> ; add process to 'runq_event' queue for new event 147 00011B22 BB[5A8E0100] <1> mov ebx, runq_event ; high priority run queue 148 <1> 149 <1> srunseq_4: 150 <1> ; al = process number 151 <1> ; ebx = run queue 152 <1> ;call putlu 153 <1> ;retn 154 <1> ; 29/07/2022 155 00011B27 E91BEFFFFF <1> jmp putlu 156 <1> 157 <1> srunseq_5: 158 00011B2C F5 <1> cmc 159 00011B2D C3 <1> retn 160 <1> 161 <1> srunseq_6: 162 <1> ; present priority of the process is not high 163 <1> 164 00011B2E 8815[B68E0100] <1> mov [u.pri], dl ; new priority 165 <1> ; (will be used by 'tswap') 166 <1> 167 00011B34 80FA02 <1> cmp dl, 2 ; high priority ? 168 00011B37 72F3 <1> jb short srunseq_5 ; no, there is nothing to do 169 <1> ; in addition 170 <1> 171 <1> ; process must be added to relevant run queue, here! 172 <1> ; (new priority is high/event priority and process 173 <1> ; will not be added to a run queue by 'tswap') 174 <1> 175 00011B39 BB[5C8E0100] <1> mov ebx, runq_normal ; 'run as regular' queue 176 <1> 177 00011B3E 20E4 <1> and ah, ah ; previous value of [u.pri] 178 00011B40 75E5 <1> jnz short srunseq_4 179 <1> 180 00011B42 43 <1> inc ebx 181 00011B43 43 <1> inc ebx 182 <1> ; ebx = runq_background ; 'run on backgroud' queue 183 <1> 184 00011B44 EBE1 <1> jmp short srunseq_4 185 <1> clock: 186 <1> ; 21/08/2024 - TRDOS 386 v2.0.9 187 <1> ; 23/05/2016 188 <1> ; 22/05/2016 189 <1> ; 20/05/2016 190 <1> ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 191 <1> ; 14/05/2015 - 14/10/2015 (Retro UNIX 386 v1) 192 <1> ; 07/12/2013 - 10/04/2014 (Retro UNIX 8086 v1) 193 <1> 194 <1> ;;; 195 <1> ; 21/08/2024 196 <1> ;cmp word [u.quit], 0FFFFh 197 00011B46 803D[BA8E0100]FF <1> cmp byte [u.quit], 0FFh 198 00011B4D 721A <1> jb short clk_0 199 <1> ; CTRL+BRK keys pressed 200 <1> ;cmp word [u.intr], 0 201 00011B4F 803D[B88E0100]00 <1> cmp byte [u.intr], 0 202 00011B56 7611 <1> jna short clk_0 203 00011B58 C605[45830100]FF <1> mov byte [p_change], 0FFh ; -1 ; CTRL+BREAK sign 204 00011B5F F605[B48E0100]FF <1> test byte [u.quant], 0FFh ; if [u.quant] number > 0 205 00011B66 752D <1> jnz short clk_1 ; decrease [u.quant] number 206 <1> ; [u.quant] = 0 207 00011B68 C3 <1> retn 208 <1> ;;; 209 <1> clk_0: 210 00011B69 803D[B48E0100]00 <1> cmp byte [u.quant], 0 211 00011B70 7723 <1> ja short clk_1 212 <1> ; 213 00011B72 803D[BD8E0100]01 <1> cmp byte [u.uno], 1 ; /etc/init ? (for Retro UNIX 8086 & 386 v1) 214 <1> ; MainProg (Kernel's Command Interpreter) 215 <1> ; for TRDOS 386. 216 00011B79 761A <1> jna short clk_1 ; yes, do not swap out 217 <1> ; 218 00011B7B 803D[608E0100]FF <1> cmp byte [sysflg], 0FFh ; user or system space ? 219 00011B82 7517 <1> jne short clk_2 ; system space (sysflg <> 0FFh) 220 <1> ; 221 <1> ; 21/08/2024 222 <1> ;cmp word [u.intr], 0 223 <1> ;jna short clk_2 224 <1> ; 225 <1> ; 23/05/2016 226 00011B84 803D[46830100]00 <1> cmp byte [multi_tasking], 0 227 00011B8B 760E <1> jna short clk_2 228 <1> 229 <1> ; 21/08/2024 230 <1> ;inc byte [p_change] ; it is time to change running process 231 00011B8D C605[45830100]01 <1> mov byte [p_change], 1 232 00011B94 C3 <1> retn 233 <1> clk_1: 234 00011B95 FE0D[B48E0100] <1> dec byte [u.quant] 235 <1> clk_2: 236 00011B9B C3 <1> retn ; return to (hardware) timer interrupt routine 237 <1> 238 <1> ; 12/10/2017 239 <1> ; 15/01/2017 240 <1> ; 14/01/2017 241 <1> ; 07/01/2017 242 <1> ; 02/01/2017 243 <1> ; 17/08/2016 244 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 245 <1> int34h: ; #IOCTL# (I/O port access support for ring 3) 246 <1> ; 247 <1> ; 23/05/2016 248 <1> ; 20/06/2016 249 <1> ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 250 <1> ; 251 <1> ; INPUT -> 252 <1> ; AH = 0 -> read port (physical IO port) -byte- 253 <1> ; AH = 1 -> write port (physical IO port) -byte- 254 <1> ; AL = data byte 255 <1> ; AH = 2 -> read port (physical IO port) -word- 256 <1> ; AH = 3 -> write port (physical IO port) -word- 257 <1> ; BX = data word 258 <1> ; AH = 4 -> read port (physical IO port) -dword- 259 <1> ; AH = 5 -> write port (physical IO port) -dword- 260 <1> ; EBX = data dword 261 <1> ; ; 12/10/2017 262 <1> ; AH = 6 -> read port (physical IO port) twice -byte- 263 <1> ; AH = 7 -> write port (physical IO port) twice -byte- 264 <1> ; BX = data word 265 <1> ; 266 <1> ; DX = Port number (<= 0FFFFh) 267 <1> ; 268 <1> ; OUTPUT -> 269 <1> ; AL = data byte (in al, dx) 270 <1> ; AX = data word (in ax, dx) 271 <1> ; EAX = data dword (in eax, dx) 272 <1> ; 273 <1> ; (ECX = actual TRANSFER COUNT for string functions) 274 <1> ; 275 <1> ; 276 <1> ; Modified registers: EAX 277 <1> ; 278 <1> 279 <1> ;cmp ah, 5 280 <1> ;ja short int34h_5 ; invalid function ! 281 <1> 282 <1> ; 12/10/2017 283 00011B9C 80FC07 <1> cmp ah, 7 284 00011B9F 7743 <1> ja short int34h_5 ; invalid function ! 285 <1> 286 <1> ;; 15/01/2017 287 <1> ; 14/01/2017 288 <1> ; 02/01/2017 289 <1> ;;mov byte [ss:intflg], 34h ; IOCTL interrupt 290 00011BA1 FB <1> sti 291 <1> 292 <1> ;sti ; enable interrupts 293 00011BA2 80642408FE <1> and byte [esp+8], 11111110b ; clear carry bit of eflags register 294 <1> 295 00011BA7 80FC01 <1> cmp ah, 1 296 00011BAA 7205 <1> jb short int34h_0 297 00011BAC 7705 <1> ja short int34h_1 298 <1> 299 00011BAE EE <1> out dx, al 300 <1> ;iretd 301 00011BAF EB01 <1> jmp short int34h_iret 302 <1> 303 <1> int34h_0: 304 00011BB1 EC <1> in al, dx 305 <1> ;iretd 306 <1> int34h_iret: 307 <1> ;cli ; 07/01/2017 308 <1> ;; 15/01/2017 309 <1> ;;mov byte [ss:intflg], 0 ; reset 310 00011BB2 CF <1> iretd 311 <1> 312 <1> int34h_1: 313 00011BB3 F6C401 <1> test ah, 1 314 00011BB6 7516 <1> jnz short int34h_3 ; out 315 <1> 316 <1> ; in 317 00011BB8 80FC02 <1> cmp ah, 2 318 00011BBB 7707 <1> ja short int34h_2 319 <1> 320 00011BBD 6689D8 <1> mov ax, bx 321 00011BC0 66ED <1> in ax, dx 322 <1> ;iretd 323 00011BC2 EBEE <1> jmp short int34h_iret 324 <1> 325 <1> int34h_2: 326 00011BC4 80FC04 <1> cmp ah, 4 327 00011BC7 772C <1> ja short int34h_7 ; 12/10/2017 328 <1> ; ah = 4 329 00011BC9 89D8 <1> mov eax, ebx 330 00011BCB ED <1> in eax, dx 331 <1> ;iretd 332 00011BCC EBE4 <1> jmp short int34h_iret 333 <1> 334 <1> int34h_3: 335 00011BCE 80FC03 <1> cmp ah, 3 336 00011BD1 7707 <1> ja short int34h_4 337 <1> 338 00011BD3 6689D8 <1> mov ax, bx 339 00011BD6 66EF <1> out dx, ax 340 <1> ;iretd 341 00011BD8 EBD8 <1> jmp short int34h_iret 342 <1> 343 <1> int34h_4: 344 00011BDA 80FC05 <1> cmp ah, 5 345 00011BDD 770B <1> ja short int34h_6 ; 12/10/2017 346 <1> ; ah = 5 347 00011BDF 89D8 <1> mov eax, ebx 348 00011BE1 EF <1> out dx, eax 349 <1> ;iretd 350 00011BE2 EBCE <1> jmp short int34h_iret 351 <1> 352 <1> int34h_5: 353 00011BE4 804C240801 <1> or byte [esp+8], 1 ; set carry bit of eflags register 354 00011BE9 CF <1> iretd 355 <1> 356 <1> ; 12/10/2017 357 <1> int34h_6: 358 00011BEA 6689D8 <1> mov ax, bx 359 00011BED EE <1> out dx, al 360 00011BEE EB00 <1> jmp short $+2 361 00011BF0 86E0 <1> xchg ah, al 362 00011BF2 EE <1> out dx, al 363 <1> ;xchg al, ah 364 <1> ;iretd 365 00011BF3 EB06 <1> jmp short int34h_8 366 <1> int34h_7: 367 00011BF5 EC <1> in al, dx 368 00011BF6 EB00 <1> jmp short $+2 369 00011BF8 88C4 <1> mov ah, al 370 00011BFA EC <1> in al, dx 371 <1> int34h_8: 372 00011BFB 86C4 <1> xchg al, ah 373 00011BFD CF <1> iretd 374 <1> 375 <1> INT4Ah: 376 <1> ; 24/01/2016 377 <1> ; this procedure will be called by 'RTC_INT' (in 'timer.s') 378 00011BFE C3 <1> retn 379 <1> 380 <1> ; u0.s 381 <1> ; Retro UNIX 386 v1 Kernel (v0.2) - SYS0.INC 382 <1> ; Last Modification: 20/11/2015 383 <1> 384 <1> com2_int: 385 <1> ; 07/11/2015 386 <1> ; 24/10/2015 387 <1> ; 23/10/2015 388 <1> ; 14/03/2015 (Retro UNIX 386 v1 - Beginning) 389 <1> ; 28/07/2014 (Retro UNIX 8086 v1) 390 <1> ; < serial port 2 interrupt handler > 391 <1> ; 392 00011BFF 890424 <1> mov [esp], eax ; overwrite call return address 393 <1> ;push eax 394 00011C02 66B80900 <1> mov ax, 9 395 00011C06 EB07 <1> jmp short comm_int 396 <1> com1_int: 397 <1> ; 07/11/2015 398 <1> ; 24/10/2015 399 00011C08 890424 <1> mov [esp], eax ; overwrite call return address 400 <1> ; 23/10/2015 401 <1> ;push eax 402 00011C0B 66B80800 <1> mov ax, 8 403 <1> comm_int: 404 <1> ; 20/11/2015 405 <1> ; 18/11/2015 406 <1> ; 17/11/2015 407 <1> ; 16/11/2015 408 <1> ; 09/11/2015 409 <1> ; 08/11/2015 410 <1> ; 07/11/2015 411 <1> ; 06/11/2015 (serial4.asm, 'serial') 412 <1> ; 01/11/2015 413 <1> ; 26/10/2015 414 <1> ; 23/10/2015 415 00011C0F 53 <1> push ebx 416 00011C10 56 <1> push esi 417 00011C11 57 <1> push edi 418 00011C12 1E <1> push ds 419 00011C13 06 <1> push es 420 <1> ; 18/11/2015 421 00011C14 0F20DB <1> mov ebx, cr3 422 00011C17 53 <1> push ebx ; **** 423 <1> ; 424 00011C18 51 <1> push ecx ; *** 425 00011C19 52 <1> push edx ; ** 426 <1> ; 427 00011C1A BB10000000 <1> mov ebx, KDATA 428 00011C1F 8EDB <1> mov ds, bx 429 00011C21 8EC3 <1> mov es, bx 430 <1> ; 431 00011C23 8B0D[B0760100] <1> mov ecx, [k_page_dir] 432 00011C29 0F22D9 <1> mov cr3, ecx 433 <1> ; 20/11/2015 434 <1> ; Interrupt identification register 435 00011C2C 66BAFA02 <1> mov dx, 2FAh ; COM2 436 <1> ; 437 00011C30 3C08 <1> cmp al, 8 438 00011C32 7702 <1> ja short com_i0 439 <1> ; 440 <1> ; 20/11/2015 441 <1> ; 17/11/2015 442 <1> ; 16/11/2015 443 <1> ; 15/11/2015 444 <1> ; 24/10/2015 445 <1> ; 14/03/2015 (Retro UNIX 386 v1 - Beginning) 446 <1> ; 28/07/2014 (Retro UNIX 8086 v1) 447 <1> ; < serial port 1 interrupt handler > 448 <1> ; 449 00011C34 FEC6 <1> inc dh ; 3FAh ; COM1 Interrupt id. register 450 <1> com_i0: 451 <1> ;push eax ; * 452 <1> ; 07/11/2015 453 00011C36 A2[1A770100] <1> mov byte [ccomport], al 454 <1> ; 09/11/2015 455 00011C3B 0FB7D8 <1> movzx ebx, ax ; 8 or 9 456 <1> ; 17/11/2015 457 <1> ; reset request for response status 458 00011C3E 88A3[10770100] <1> mov [ebx+req_resp-8], ah ; 0 459 <1> ; 460 <1> ; 20/11/2015 461 00011C44 EC <1> in al, dx ; read interrupt id. register 462 00011C45 EB00 <1> JMP $+2 ; I/O DELAY 463 00011C47 2404 <1> and al, 4 ; received data available? 464 00011C49 7470 <1> jz short com_eoi ; (transmit. holding reg. empty) 465 <1> ; 466 <1> ; 20/11/2015 467 00011C4B 80EA02 <1> sub dl, 3FAh-3F8h ; data register (3F8h, 2F8h) 468 00011C4E EC <1> in al, dx ; read character 469 <1> ;JMP $+2 ; I/O DELAY 470 <1> ; 08/11/2015 471 <1> ; 07/11/2015 472 00011C4F 89DE <1> mov esi, ebx 473 00011C51 89DF <1> mov edi, ebx 474 00011C53 81C6[14770100] <1> add esi, rchar - 8 ; points to last received char 475 00011C59 81C7[16770100] <1> add edi, schar - 8 ; points to last sent char 476 00011C5F 8806 <1> mov [esi], al ; received char (current char) 477 <1> ; query 478 00011C61 20C0 <1> and al, al 479 00011C63 7527 <1> jnz short com_i2 480 <1> ; response 481 <1> ; 17/11/2015 482 <1> ; set request for response status 483 00011C65 FE83[10770100] <1> inc byte [ebx+req_resp-8] ; 1 484 <1> ; 485 00011C6B 6683C205 <1> add dx, 3FDh-3F8h ; (3FDh, 2FDh) 486 00011C6F EC <1> in al, dx ; read line status register 487 00011C70 EB00 <1> JMP $+2 ; I/O DELAY 488 00011C72 2420 <1> and al, 20h ; transmitter holding reg. empty? 489 00011C74 7445 <1> jz short com_eoi ; no 490 00011C76 B0FF <1> mov al, 0FFh ; response 491 00011C78 6683EA05 <1> sub dx, 3FDh-3F8h ; data port (3F8h, 2F8h) 492 00011C7C EE <1> out dx, al ; send on serial port 493 <1> ; 17/11/2015 494 00011C7D 803F00 <1> cmp byte [edi], 0 ; query ? (schar) 495 00011C80 7502 <1> jne short com_i1 ; no 496 00011C82 8807 <1> mov [edi], al ; 0FFh (responded) 497 <1> com_i1: 498 <1> ; 17/11/2015 499 <1> ; reset request for response status (again) 500 00011C84 FE8B[10770100] <1> dec byte [ebx+req_resp-8] ; 0 501 00011C8A EB2F <1> jmp short com_eoi 502 <1> com_i2: 503 <1> ; 08/11/2015 504 00011C8C 3CFF <1> cmp al, 0FFh ; (response ?) 505 00011C8E 7417 <1> je short com_i3 ; (check for response signal) 506 <1> ; 07/11/2015 507 00011C90 3C04 <1> cmp al, 04h ; EOT 508 00011C92 751C <1> jne short com_i4 509 <1> ; EOT = 04h (End of Transmit) - 'CTRL + D' 510 <1> ;(an EOT char is supposed as a ctrl+brk from the terminal) 511 <1> ; 08/11/2015 512 <1> ; ptty -> tty 0 to 7 (pseudo screens) 513 00011C94 861D[DE760100] <1> xchg bl, [ptty] ; tty number (8 or 9) 514 00011C9A E89F51FFFF <1> call ctrlbrk 515 00011C9F 861D[DE760100] <1> xchg [ptty], bl ; (restore ptty value and BL value) 516 <1> ;mov al, 04h ; EOT 517 <1> ; 08/11/2015 518 00011CA5 EB09 <1> jmp short com_i4 519 <1> com_i3: 520 <1> ; 08/11/2015 521 <1> ; If 0FFh has been received just after a query 522 <1> ; (schar, ZERO), it is a response signal. 523 <1> ; 17/11/2015 524 00011CA7 803F00 <1> cmp byte [edi], 0 ; query ? (schar) 525 00011CAA 7704 <1> ja short com_i4 ; no 526 <1> ; reset query status (schar) 527 00011CAC 8807 <1> mov [edi], al ; 0FFh 528 00011CAE FEC0 <1> inc al ; 0 529 <1> com_i4: 530 <1> ; 27/07/2014 531 <1> ; 09/07/2014 532 00011CB0 D0E3 <1> shl bl, 1 533 00011CB2 81C3[E0760100] <1> add ebx, ttychr 534 <1> ; 23/07/2014 (always overwrite) 535 <1> ;;cmp word [ebx], 0 536 <1> ;;ja short com_eoi 537 <1> ; 538 00011CB8 668903 <1> mov [ebx], ax ; Save ascii code 539 <1> ; scan code = 0 540 <1> com_eoi: 541 <1> ;mov al, 20h 542 <1> ;out 20h, al ; end of interrupt 543 <1> ; 544 <1> ; 07/11/2015 545 <1> ;pop eax ; * 546 00011CBB A0[1A770100] <1> mov al, byte [ccomport] ; current COM port 547 <1> ; al = tty number (8 or 9) 548 00011CC0 E80F000000 <1> call wakeup 549 <1> com_iret: 550 <1> ; 23/10/2015 551 00011CC5 5A <1> pop edx ; ** 552 00011CC6 59 <1> pop ecx ; *** 553 <1> ; 18/11/2015 554 <1> ;pop eax ; **** 555 <1> ;mov cr3, eax 556 <1> ;jmp iiret 557 00011CC7 E90EF1FEFF <1> jmp iiretp 558 <1> 559 <1> ;iiretp: ; 01/09/2015 560 <1> ; ; 28/08/2015 561 <1> ; pop eax ; (*) page directory 562 <1> ; mov cr3, eax 563 <1> ;iiret: 564 <1> ; ; 22/08/2014 565 <1> ; mov al, 20h ; END OF INTERRUPT COMMAND TO 8259 566 <1> ; out 20h, al ; 8259 PORT 567 <1> ; ; 568 <1> ; pop es 569 <1> ; pop ds 570 <1> ; pop edi 571 <1> ; pop esi 572 <1> ; pop ebx ; 29/08/2014 573 <1> ; pop eax 574 <1> ; iretd 575 <1> 576 <1> ; 21/11/2023 577 <1> %if 0 578 <1> 579 <1> sp_init: 580 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 581 <1> ; 07/11/2015 582 <1> ; 29/10/2015 583 <1> ; 26/10/2015 584 <1> ; 23/10/2015 585 <1> ; 29/06/2015 586 <1> ; 14/03/2015 (Retro UNIX 386 v1 - 115200 baud) 587 <1> ; 28/07/2014 (Retro UNIX 8086 v1 - 9600 baud) 588 <1> ; Initialization of Serial Port Communication Parameters 589 <1> ; (COM1 base port address = 3F8h, COM1 Interrupt = IRQ 4) 590 <1> ; (COM2 base port address = 2F8h, COM1 Interrupt = IRQ 3) 591 <1> ; 592 <1> ; ((Modified registers: EAX, ECX, EDX, EBX)) 593 <1> ; 594 <1> ; INPUT: (29/06/2015) 595 <1> ; AL = 0 for COM1 596 <1> ; 1 for COM2 597 <1> ; AH = Communication parameters 598 <1> ; 599 <1> ; (*) Communication parameters (except BAUD RATE): 600 <1> ; Bit 4 3 2 1 0 601 <1> ; -PARITY-- STOP BIT -WORD LENGTH- 602 <1> ; this one --> 00 = none 0 = 1 bit 11 = 8 bits 603 <1> ; 01 = odd 1 = 2 bits 10 = 7 bits 604 <1> ; 11 = even 605 <1> ; Baud rate setting bits: (29/06/2015) 606 <1> ; Retro UNIX 386 v1 feature only ! 607 <1> ; Bit 7 6 5 | Baud rate 608 <1> ; ------------------------ 609 <1> ; value 0 0 0 | Default (Divisor = 1) 610 <1> ; 0 0 1 | 9600 (12) 611 <1> ; 0 1 0 | 19200 (6) 612 <1> ; 0 1 1 | 38400 (3) 613 <1> ; 1 0 0 | 14400 (8) 614 <1> ; 1 0 1 | 28800 (4) 615 <1> ; 1 1 0 | 57600 (2) 616 <1> ; 1 1 1 | 115200 (1) 617 <1> 618 <1> ; References: 619 <1> ; (1) IBM PC-XT Model 286 BIOS Source Code 620 <1> ; RS232.ASM --- 10/06/1985 COMMUNICATIONS BIOS (RS232) 621 <1> ; (2) Award BIOS 1999 - ATORGS.ASM 622 <1> ; (3) http://wiki.osdev.org/Serial_Ports 623 <1> ; 624 <1> ; Set communication parameters for COM1 (= 03h) 625 <1> ; 626 <1> mov ebx, com1p ; COM1 parameters 627 <1> mov dx, 3F8h ; COM1 628 <1> ; 29/10/2015 629 <1> mov cx, 301h ; divisor = 1 (115200 baud) 630 <1> call sp_i3 ; call A4 631 <1> test al, 80h 632 <1> jz short sp_i0 ; OK.. 633 <1> ; Error ! 634 <1> ;mov dx, 3F8h 635 <1> sub dl, 5 ; 3FDh -> 3F8h 636 <1> mov cx, 30Eh ; divisor = 12 (9600 baud) 637 <1> call sp_i3 ; call A4 638 <1> test al, 80h 639 <1> jnz short sp_i1 640 <1> sp_i0: 641 <1> ; (Note: Serial port interrupts will be disabled here...) 642 <1> ; (INT 14h initialization code disables interrupts.) 643 <1> ; 644 <1> mov byte [ebx], 0E3h ; 11100011b 645 <1> call sp_i5 ; 29/06/2015 646 <1> sp_i1: 647 <1> inc ebx 648 <1> mov dx, 2F8h ; COM2 649 <1> ; 29/10/2015 650 <1> mov cx, 301h ; divisor = 1 (115200 baud) 651 <1> call sp_i3 ; call A4 652 <1> test al, 80h 653 <1> jz short sp_i2 ; OK.. 654 <1> ; Error ! 655 <1> ;mov dx, 2F8h 656 <1> sub dl, 5 ; 2FDh -> 2F8h 657 <1> mov cx, 30Eh ; divisor = 12 (9600 baud) 658 <1> call sp_i3 ; call A4 659 <1> test al, 80h 660 <1> jnz short sp_i7 661 <1> sp_i2: 662 <1> mov byte [ebx], 0E3h ; 11100011b 663 <1> sp_i6: 664 <1> ;; COM2 - enabling IRQ 3 665 <1> ; 29/07/2022 666 <1> ; 07/11/2015 667 <1> ; 26/10/2015 668 <1> pushf 669 <1> cli 670 <1> ; 671 <1> mov dx, 2FCh ; modem control register 672 <1> in al, dx ; read register 673 <1> JMP $+2 ; I/O DELAY 674 <1> or al, 8 ; enable bit 3 (OUT2) 675 <1> out dx, al ; write back to register 676 <1> JMP $+2 ; I/O DELAY 677 <1> ;mov dx, 2F9h ; interrupt enable register 678 <1> ; 29/07/2022 679 <1> mov dl, 0F9h 680 <1> in al, dx ; read register 681 <1> JMP $+2 ; I/O DELAY 682 <1> ;or al, 1 ; receiver data interrupt enable and 683 <1> or al, 3 ; transmitter empty interrupt enable 684 <1> out dx, al ; write back to register 685 <1> JMP $+2 ; I/O DELAY 686 <1> in al, 21h ; read interrupt mask register 687 <1> JMP $+2 ; I/O DELAY 688 <1> and al, 0F7h ; enable IRQ 3 (COM2) 689 <1> out 21h, al ; write back to register 690 <1> ; 691 <1> ; 23/10/2015 692 <1> mov eax, com2_int 693 <1> mov [com2_irq3], eax 694 <1> ; 26/10/2015 695 <1> popf 696 <1> sp_i7: 697 <1> retn 698 <1> 699 <1> sp_i3: 700 <1> ;A4: ;----- INITIALIZE THE COMMUNICATIONS PORT 701 <1> ; 28/10/2015 702 <1> inc dl ; 3F9h (2F9h) ; 3F9h, COM1 Interrupt enable register 703 <1> mov al, 0 704 <1> out dx, al ; disable serial port interrupt 705 <1> JMP $+2 ; I/O DELAY 706 <1> add dl, 2 ; 3FBh (2FBh) ; COM1 Line control register (3FBh) 707 <1> mov al, 80h 708 <1> out dx, al ; SET DLAB=1 ; divisor latch access bit 709 <1> ;----- SET BAUD RATE DIVISOR 710 <1> ; 26/10/2015 711 <1> sub dl, 3 ; 3F8h (2F8h) ; register for least significant byte 712 <1> ; of the divisor value 713 <1> mov al, cl ; 1 714 <1> out dx, al ; 1 = 115200 baud (Retro UNIX 386 v1) 715 <1> ; 2 = 57600 baud 716 <1> ; 3 = 38400 baud 717 <1> ; 6 = 19200 baud 718 <1> ; 12 = 9600 baud (Retro UNIX 8086 v1) 719 <1> JMP $+2 ; I/O DELAY 720 <1> sub al, al 721 <1> inc dl ; 3F9h (2F9h) ; register for most significant byte 722 <1> ; of the divisor value 723 <1> out dx, al ; 0 724 <1> JMP $+2 ; I/O DELAY 725 <1> ; 726 <1> mov al, ch ; 3 ; 8 data bits, 1 stop bit, no parity 727 <1> ;and al, 1Fh ; Bits 0,1,2,3,4 728 <1> add dl, 2 ; 3FBh (2FBh) ; Line control register 729 <1> out dx, al 730 <1> JMP $+2 ; I/O DELAY 731 <1> ; 29/10/2015 732 <1> dec dl ; 3FAh (2FAh) ; FIFO Control register (16550/16750) 733 <1> xor al, al ; 0 734 <1> out dx, al ; Disable FIFOs (reset to 8250 mode) 735 <1> JMP $+2 736 <1> sp_i4: 737 <1> ;A18: ;----- COMM PORT STATUS ROUTINE 738 <1> ; 29/06/2015 (line status after modem status) 739 <1> add dl, 4 ; 3FEh (2FEh) ; Modem status register 740 <1> sp_i4s: 741 <1> in al, dx ; GET MODEM CONTROL STATUS 742 <1> JMP $+2 ; I/O DELAY 743 <1> mov ah, al ; PUT IN (AH) FOR RETURN 744 <1> dec dl ; 3FDh (2FDh) ; POINT TO LINE STATUS REGISTER 745 <1> ; dx = 3FDh for COM1, 2FDh for COM2 746 <1> in al, dx ; GET LINE CONTROL STATUS 747 <1> ; AL = Line status, AH = Modem status 748 <1> retn 749 <1> 750 <1> sp_status: 751 <1> ; 29/06/2015 752 <1> ; 27/06/2015 (Retro UNIX 386 v1) 753 <1> ; Get serial port status 754 <1> mov dx, 3FEh ; Modem status register (COM1) 755 <1> sub dh, al ; dh = 2 for COM2 (al = 1) 756 <1> ; dx = 2FEh for COM2 757 <1> jmp short sp_i4s 758 <1> 759 <1> sp_setp: ; Set serial port communication parameters 760 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 761 <1> ; 07/11/2015 762 <1> ; 29/10/2015 763 <1> ; 29/06/2015 764 <1> ; Retro UNIX 386 v1 feature only ! 765 <1> ; 766 <1> ; INPUT: 767 <1> ; AL = 0 for COM1 768 <1> ; 1 for COM2 769 <1> ; AH = Communication parameters (*) 770 <1> ; OUTPUT: 771 <1> ; CL = Line status 772 <1> ; CH = Modem status 773 <1> ; If cf = 1 -> Error code in [u.error] 774 <1> ; 'invalid parameter !' 775 <1> ; or 776 <1> ; 'device not ready !' error 777 <1> ; 778 <1> ; (*) Communication parameters (except BAUD RATE): 779 <1> ; Bit 4 3 2 1 0 780 <1> ; -PARITY-- STOP BIT -WORD LENGTH- 781 <1> ; this one --> 00 = none 0 = 1 bit 11 = 8 bits 782 <1> ; 01 = odd 1 = 2 bits 10 = 7 bits 783 <1> ; 11 = even 784 <1> ; Baud rate setting bits: (29/06/2015) 785 <1> ; Retro UNIX 386 v1 feature only ! 786 <1> ; Bit 7 6 5 | Baud rate 787 <1> ; ------------------------ 788 <1> ; value 0 0 0 | Default (Divisor = 1) 789 <1> ; 0 0 1 | 9600 (12) 790 <1> ; 0 1 0 | 19200 (6) 791 <1> ; 0 1 1 | 38400 (3) 792 <1> ; 1 0 0 | 14400 (8) 793 <1> ; 1 0 1 | 28800 (4) 794 <1> ; 1 1 0 | 57600 (2) 795 <1> ; 1 1 1 | 115200 (1) 796 <1> ; 797 <1> ; (COM1 base port address = 3F8h, COM1 Interrupt = IRQ 4) 798 <1> ; (COM2 base port address = 2F8h, COM1 Interrupt = IRQ 3) 799 <1> ; 800 <1> ; ((Modified registers: EAX, ECX, EDX, EBX)) 801 <1> ; 802 <1> mov dx, 3F8h 803 <1> mov ebx, com1p ; COM1 control byte offset 804 <1> cmp al, 1 805 <1> ja short sp_invp_err 806 <1> jb short sp_setp1 ; COM1 (AL = 0) 807 <1> dec dh ; 2F8h 808 <1> inc ebx ; COM2 control byte offset 809 <1> sp_setp1: 810 <1> ; 29/10/2015 811 <1> mov [ebx], ah 812 <1> movzx ecx, ah 813 <1> shr cl, 5 ; -> baud rate index 814 <1> and ah, 1Fh ; communication parameters except baud rate 815 <1> mov al, [ecx+b_div_tbl] 816 <1> mov cx, ax 817 <1> call sp_i3 818 <1> mov cx, ax ; CL = Line status, CH = Modem status 819 <1> test al, 80h 820 <1> jz short sp_setp2 821 <1> mov byte [ebx], 0E3h ; Reset to initial value (11100011b) 822 <1> stp_dnr_err: 823 <1> mov dword [u.error], ERR_DEV_NOT_RDY ; 'device not ready !' 824 <1> ; CL = Line status, CH = Modem status 825 <1> stc 826 <1> retn 827 <1> sp_setp2: 828 <1> cmp dh, 2 ; COM2 (2F?h) 829 <1> ;jna sp_i6 830 <1> ; COM1 (3F?h) 831 <1> ; 29/07/2022 832 <1> ja short sp_i5 833 <1> jmp sp_i6 834 <1> sp_i5: 835 <1> ; 29/07/2022 836 <1> ; 07/11/2015 837 <1> ; 26/10/2015 838 <1> ; 29/06/2015 839 <1> ; 840 <1> ;; COM1 - enabling IRQ 4 841 <1> pushf 842 <1> cli 843 <1> mov dx, 3FCh ; modem control register 844 <1> in al, dx ; read register 845 <1> JMP $+2 ; I/O DELAY 846 <1> or al, 8 ; enable bit 3 (OUT2) 847 <1> out dx, al ; write back to register 848 <1> JMP $+2 ; I/O DELAY 849 <1> ;mov dx, 3F9h ; interrupt enable register 850 <1> ; 29/07/2022 851 <1> mov dl, 0F9h 852 <1> in al, dx ; read register 853 <1> JMP $+2 ; I/O DELAY 854 <1> ;or al, 1 ; receiver data interrupt enable and 855 <1> or al, 3 ; transmitter empty interrupt enable 856 <1> out dx, al ; write back to register 857 <1> JMP $+2 ; I/O DELAY 858 <1> in al, 21h ; read interrupt mask register 859 <1> JMP $+2 ; I/O DELAY 860 <1> and al, 0EFh ; enable IRQ 4 (COM1) 861 <1> out 21h, al ; write back to register 862 <1> ; 863 <1> ; 23/10/2015 864 <1> mov eax, com1_int 865 <1> mov [com1_irq4], eax 866 <1> ; 26/10/2015 867 <1> popf 868 <1> retn 869 <1> 870 <1> sp_invp_err: 871 <1> mov dword [u.error], ERR_INV_PARAMETER ; 'invalid parameter !' 872 <1> xor ecx, ecx 873 <1> dec ecx ; 0FFFFh 874 <1> stc 875 <1> retn 876 <1> 877 <1> ; 29/10/2015 878 <1> b_div_tbl: ; Baud rate divisor table (115200/divisor) 879 <1> db 1, 12, 6, 3, 8, 4, 1 880 <1> 881 <1> %endif 882 <1> 883 <1> ; 23/10/2015 884 <1> com1_irq4: 885 00011CCC [D41C0100] <1> dd dummy_retn 886 <1> com2_irq3: 887 00011CD0 [D41C0100] <1> dd dummy_retn 888 <1> 889 <1> ; 21/11/2023 890 <1> dummy_retn: 891 <1> ;retn 892 <1> wakeup: 893 <1> ; 24/01/2016 894 00011CD4 C3 <1> retn 895 <1> 896 <1> set_working_path_x: 897 <1> ; 17/10/2016 (TRDOS 386 - FFF & FNF) 898 <1> ;mov ax, 1 899 <1> ; File name is needed/forced (AL=1) 900 <1> ; Change directory as temporary (AH=0) 901 <1> ; 29/07/2022 902 00011CD5 31C0 <1> xor eax, eax 903 00011CD7 FEC0 <1> inc al 904 <1> ; eax = 1 905 <1> set_working_path_xx: ; 30/12/2017 (syschdir) 906 <1> ; This is needed for preventing wrong Find Next File 907 <1> ; system call after sysopen, syscreate, sysmkdir etc. 908 <1> ; Find Next File must immediate follow Find First File) 909 <1> 910 00011CD9 8825[6C830100] <1> mov [FFF_Valid], ah ; 0 ; reset ; 17/10/2016 911 <1> 912 <1> set_working_path: 913 <1> ; 08/08/2022 914 <1> ; 29/07/2022 - TRDOS 386 Kernel v2.0.5 915 <1> ; 16/10/2016 916 <1> ; 12/10/2016 917 <1> ; 10/10/2016 918 <1> ; 05/10/2016 - TRDOS 386 (TRDOS v2.0) 919 <1> ; 920 <1> ; TRDOS v1.0 (DIR.ASM, "proc_set_working_path") 921 <1> ; 27/01/2011 - 08/02/2011 922 <1> ; Set/Changes current drive, directory and file 923 <1> ; depending on command tail 924 <1> ; (procedure is derivated from CMD_INTR.ASM 925 <1> ; file or dir locating code of internal commands) 926 <1> ; (This procedure is prepared for INT 21H file/dir 927 <1> ; functions and also to get compact code for 928 <1> ; internal mainprog -command interpreter- commands) 929 <1> ; 930 <1> ; INPUT: DS:SI -> Command tail (ASCIIZ string) 931 <1> ; AL = 0 -> any, AL > 0 -> file name is forced 932 <1> ; AH = CD -> Change directory permanently 933 <1> ; AH <> CD -> Change directory as temporary 934 <1> ; 935 <1> ; OUTPUT: ES=DS, FindFile structure has been set 936 <1> ; RUN_CDRV points previous current drive 937 <1> ; DS:SI = FindFile structure address 938 <1> ; (DS=CS) 939 <1> ; AX, BX, CX, DX, DI will be changed 940 <1> ; cf = 1 -> Error code in AX (AL) 941 <1> ; stc & AX = 0 -> Bad command or path name 942 <1> ; ----------------------------------------------- 943 <1> ; 944 <1> ; TRDOS 386 (05/10/2016) 945 <1> ; INPUT: 946 <1> ; ESI = File/Directory Path (ASCIIZ string) 947 <1> ; address in user's memory space 948 <1> ; AL = 0 -> any 949 <1> ; AL > 0 -> file name is forced 950 <1> ; AH = CD -> change directory as permanent 951 <1> ; AH <> CD -> change directory as temporary 952 <1> ; 953 <1> ; OUTPUT: 954 <1> ; FindFile structure has been set 955 <1> ; RUN_CDRV points previous current drive 956 <1> ; ESI = FindFile_Name address ; 12/10/2016 957 <1> ; 958 <1> ; cf = 1 -> Error code in EAX (AL) 959 <1> ; stc & EAX = 0 -> Bad command or path name 960 <1> ; 961 <1> ; Modified registers: EAX, EBX, ECX, EDX, ESI, EDI 962 <1> 963 00011CDF 66A3[70830100] <1> mov [SWP_Mode], ax 964 00011CE5 A0[76770100] <1> mov al, [Current_Drv] 965 00011CEA 30E4 <1> xor ah, ah 966 00011CEC 66A3[72830100] <1> mov [SWP_DRV], ax 967 <1> 968 <1> ; TRDOS 386 ring 3 (user's page directory) 969 <1> ; to ring 0 (kernel's page directory) 970 <1> ; transfer modifications (05/10/2016). 971 <1> 972 00011CF2 55 <1> push ebp 973 00011CF3 89E5 <1> mov ebp, esp 974 <1> 975 <1> ;mov ecx, 128 ; maximum path length = 128 bytes 976 <1> ; 29/07/2022 977 00011CF5 31C9 <1> xor ecx, ecx 978 00011CF7 B180 <1> mov cl, 128 979 00011CF9 29CC <1> sub esp, ecx ; reserve 128 bytes (buffer) on stack 980 00011CFB 89E7 <1> mov edi, esp ; destination address (kernel space) 981 <1> ; esi = source address (virtual, in user's memory space) 982 00011CFD E863EEFFFF <1> call transfer_from_user_buffer 983 00011D02 720D <1> jc short loc_swp_xor_retn 984 <1> 985 00011D04 89E6 <1> mov esi, esp ; temporary buffer (the path) on stack 986 <1> loc_swp_fchar: 987 00011D06 8A06 <1> mov al, [esi] 988 00011D08 3C20 <1> cmp al, 20h 989 00011D0A 7711 <1> ja short loc_swp_parse_path_name 990 <1> ;je short loc_swp_fchar_next 991 <1> ; 29/07/2022 992 00011D0C 7203 <1> jb short loc_swp_xor_retn 993 <1> 994 <1> loc_swp_fchar_next: 995 00011D0E 46 <1> inc esi 996 00011D0F EBF5 <1> jmp short loc_swp_fchar 997 <1> 998 <1> loc_swp_xor_retn: 999 00011D11 31C0 <1> xor eax, eax 1000 00011D13 F9 <1> stc 1001 <1> loc_swp_retn: 1002 00011D14 89EC <1> mov esp, ebp 1003 00011D16 5D <1> pop ebp 1004 <1> 1005 <1> ;mov esi, FindFile_Drv 1006 00011D17 BE[58800100] <1> mov esi, FindFile_Name ; 12/10/2016 1007 00011D1C C3 <1> retn 1008 <1> 1009 <1> ;loc_swp_fchar_next: 1010 <1> ; inc esi 1011 <1> ; jmp short loc_swp_fchar 1012 <1> 1013 <1> loc_swp_parse_path_name: 1014 00011D1D BF[16800100] <1> mov edi, FindFile_Drv 1015 00011D22 E8578CFFFF <1> call parse_path_name 1016 00011D27 72EB <1> jc short loc_swp_retn 1017 <1> 1018 <1> loc_swp_checkfile_name: 1019 00011D29 803D[70830100]00 <1> cmp byte [SWP_Mode], 0 1020 00011D30 761E <1> jna short loc_swp_drv 1021 <1> 1022 <1> ; 10/10/2016 (valid file name checking) 1023 00011D32 BE[58800100] <1> mov esi, FindFile_Name 1024 00011D37 803E20 <1> cmp byte [esi], 20h 1025 00011D3A 76D5 <1> jna short loc_swp_xor_retn 1026 <1> 1027 <1> ; 16/10/2016 1028 00011D3C C605[6F830100]00 <1> mov byte [SWP_inv_fname], 0 ; reset 1029 <1> ; esi = file name address (ASCIIZ) 1030 00011D43 E8916FFFFF <1> call check_filename 1031 00011D48 7306 <1> jnc short loc_swp_drv 1032 <1> 1033 00011D4A FE05[6F830100] <1> inc byte [SWP_inv_fname] ; set 1034 <1> loc_swp_drv: 1035 00011D50 8A35[76770100] <1> mov dh, [Current_Drv] 1036 <1> ;mov [RUN_CDRV], dh 1037 <1> 1038 00011D56 8A15[16800100] <1> mov dl, [FindFile_Drv] 1039 <1> ;cmp dl, dh 1040 00011D5C 3A15[76770100] <1> cmp dl, [Current_Drv] 1041 00011D62 740D <1> je short loc_swp_change_directory 1042 <1> 1043 00011D64 FE05[73830100] <1> inc byte [SWP_DRV_chg] 1044 00011D6A E88159FFFF <1> call change_current_drive 1045 00011D6F 72A3 <1> jc short loc_swp_retn ; eax = error code 1046 <1> ; eax = 0 1047 <1> 1048 <1> loc_swp_change_directory: 1049 00011D71 803D[17800100]21 <1> cmp byte [FindFile_Directory], 21h 1050 00011D78 F5 <1> cmc 1051 00011D79 7399 <1> jnc short loc_swp_retn 1052 <1> 1053 00011D7B FE05[73830100] <1> inc byte [SWP_DRV_chg] 1054 00011D81 FE05[8E2E0100] <1> inc byte [Restore_CDIR] 1055 00011D87 BE[17800100] <1> mov esi, FindFile_Directory 1056 00011D8C 8A25[71830100] <1> mov ah, [SWP_Mode+1] 1057 00011D92 E85486FFFF <1> call change_current_directory 1058 <1> ;jc short loc_swp_retn ; eax = error code 1059 <1> ; 08/08/2022 1060 00011D97 7305 <1> jnc short loc_swp_change_prompt_dir_string 1061 00011D99 E976FFFFFF <1> jmp loc_swp_retn 1062 <1> 1063 <1> loc_swp_change_prompt_dir_string: 1064 <1> ; esi = PATH_Array 1065 <1> ; eax = Current Directory First Cluster 1066 <1> ; edi = Logical DOS Drive Description Table 1067 00011D9E E87685FFFF <1> call change_prompt_dir_str 1068 00011DA3 29C0 <1> sub eax, eax ; 0 1069 00011DA5 E96AFFFFFF <1> jmp loc_swp_retn 1070 <1> 1071 <1> reset_working_path: 1072 <1> ; 06/10/2016 - TRDOS 386 (TRDOS v2.0) 1073 <1> ; 1074 <1> ; TRDOS v1.0 (DIR.ASM, "proc_reset_working_path") 1075 <1> ; 05/02/2011 - 08/02/2011 1076 <1> ; 1077 <1> ; Restores current drive and directory 1078 <1> ; 1079 <1> ; INPUT: none 1080 <1> ; OUTPUT: DL = SWP_DRV, EAX = 0 -> OK 1081 <1> ; 1082 <1> ; AX = 0 -> ESI = Logical Dos Drv Desc. Table 1083 <1> ; 1084 <1> ; EAX, EBX, ECX, EDX, ESI, EDI will be changed 1085 <1> ; 1086 <1> 1087 <1> 1088 00011DAA 31C0 <1> xor eax, eax 1089 00011DAC 48 <1> dec eax 1090 <1> 1091 00011DAD 668B15[72830100] <1> mov dx, [SWP_DRV] 1092 00011DB4 08F6 <1> or dh, dh 1093 00011DB6 742E <1> jz short loc_rwp_return 1094 <1> 1095 00011DB8 3A15[76770100] <1> cmp dl, [Current_Drv] 1096 00011DBE 7407 <1> je short loc_rwp_restore_cdir 1097 <1> loc_rwp_restore_cdrv: 1098 00011DC0 E82B59FFFF <1> call change_current_drive 1099 00011DC5 EB10 <1> jmp short loc_rwp_restore_ok 1100 <1> loc_rwp_restore_cdir: 1101 00011DC7 31DB <1> xor ebx, ebx 1102 00011DC9 88D7 <1> mov bh, dl 1103 00011DCB BE00010900 <1> mov esi, Logical_DOSDisks 1104 00011DD0 01DE <1> add esi, ebx 1105 <1> 1106 00011DD2 E8CA59FFFF <1> call restore_current_directory 1107 <1> 1108 <1> loc_rwp_restore_ok: 1109 00011DD7 668B15[72830100] <1> mov dx, [SWP_DRV] 1110 00011DDE 31C0 <1> xor eax, eax 1111 00011DE0 66A3[73830100] <1> mov [SWP_DRV_chg], ax 1112 <1> loc_rwp_return: 1113 00011DE6 C3 <1> retn 1114 <1> 1115 <1> get_file_name: 1116 <1> ; 25/08/2024 (TRDOS 386 Kernel v2.0.9) 1117 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1118 <1> ; 15/10/2016 - TRDOS 386 (TRDOS v2.0) 1119 <1> ; Convert file name 1120 <1> ; from directory entry format 1121 <1> ; to (8.3) dot file name format 1122 <1> ; 1123 <1> ; TRDOS v1.0 (DIR.ASM, "get_file_name") 1124 <1> ; 2005 - 09/10/2011 1125 <1> ; INPUT: 1126 <1> ; DS:SI -> Directory Entry Format File Name 1127 <1> ; ES:DI -> DOS Dot File Name Address 1128 <1> ; OUTPUT: 1129 <1> ; DS:SI -> DOS Dot File Name Address 1130 <1> ; ES:DI -> Directory Entry Format File Name 1131 <1> ; 1132 <1> ; TRDOS 386 (15/10/2016) 1133 <1> ; INPUT: 1134 <1> ; ESI = File name addr in dir entry format 1135 <1> ; EDI = Dot file name address (destination) 1136 <1> ; OUTPUT: 1137 <1> ; File name is converted and moved 1138 <1> ; to destination (as 8.3 dot filename) 1139 <1> ; 1140 <1> ; Modified registers: EAX, ECX 1141 <1> 1142 <1> ; 2005 (TRDOS 8086) - 2016 (TRDOS 386) 1143 <1> 1144 00011DE7 57 <1> push edi 1145 00011DE8 56 <1> push esi 1146 00011DE9 AC <1> lodsb 1147 <1> ; 25/08/2024 1148 00011DEA 31C9 <1> xor ecx, ecx ; 0 1149 00011DEC 3C20 <1> cmp al, 20h 1150 00011DEE 7626 <1> jna short pass_gfn_ext 1151 <1> ; 25/08/2024 1152 <1> ;push esi 1153 00011DF0 AA <1> stosb 1154 <1> ; 25/08/2024 1155 <1> ; 29/07/2022 1156 <1> ;xor ecx, ecx 1157 <1> ; ecx <= 128 ; 25/08/2024 1158 00011DF1 B107 <1> mov cl, 7 1159 <1> ; 25/08/2024 1160 00011DF3 01CE <1> add esi, ecx ; add esi, 7 1161 00011DF5 56 <1> push esi ; (*) 1162 <1> loc_gfn_next_char: 1163 00011DF6 AC <1> lodsb 1164 00011DF7 3C20 <1> cmp al, 20h 1165 00011DF9 7603 <1> jna short pass_gfn_fn 1166 00011DFB AA <1> stosb 1167 00011DFC E2F8 <1> loop loc_gfn_next_char 1168 <1> pass_gfn_fn: 1169 <1> ;pop esi 1170 <1> ;add esi, 7 1171 <1> ; 25/08/2024 1172 00011DFE 5E <1> pop esi ; (*) 1173 <1> 1174 00011DFF AC <1> lodsb 1175 00011E00 3C20 <1> cmp al, 20h 1176 00011E02 7612 <1> jna short pass_gfn_ext 1177 00011E04 B42E <1> mov ah, '.' 1178 00011E06 86E0 <1> xchg ah, al 1179 00011E08 66AB <1> stosw 1180 00011E0A AC <1> lodsb 1181 00011E0B 3C20 <1> cmp al, 20h 1182 00011E0D 7607 <1> jna short pass_gfn_ext 1183 00011E0F AA <1> stosb 1184 00011E10 AC <1> lodsb 1185 00011E11 3C20 <1> cmp al, 20h 1186 00011E13 7601 <1> jna short pass_gfn_ext 1187 00011E15 AA <1> stosb 1188 <1> pass_gfn_ext: 1189 00011E16 30C0 <1> xor al, al 1190 00011E18 AA <1> stosb 1191 00011E19 5E <1> pop esi 1192 00011E1A 5F <1> pop edi 1193 <1> ; 25/08/2024 1194 <1> ; ecx <= 7 1195 00011E1B C3 <1> retn 1196 <1> 1197 <1> set_hardware_int_vector: 1198 <1> ; 18/03/2017 1199 <1> ; 03/03/2017 1200 <1> ; 28/02/2017 - TRDOS 386 (TRDOS v2.0) 1201 <1> ; 1202 <1> ; SET/RESET HARDWARE INTERRUPT GATE 1203 <1> ; 1204 <1> ; Changes interrupt gate descriptor table 1205 <1> ; (without changing default interrupt list) 1206 <1> ; 1207 <1> ; INPUT: 1208 <1> ; AL = IRQ number (0 to 15) 1209 <1> ; AH > 0 -> set 1210 <1> ; AH = 0 -> reset 1211 <1> ; 1212 <1> ; Modified registers: eax, ebx, edx, edi 1213 <1> ; 1214 <1> 1215 00011E1C C0E002 <1> shl al, 2 ; IRQ number * 4 1216 00011E1F 0FB6D8 <1> movzx ebx, al 1217 <1> 1218 00011E22 08E4 <1> or ah, ah 1219 00011E24 7508 <1> jnz short shintv_1 ; set (for user call service) 1220 <1> 1221 <1> ; 18/03/2017 1222 00011E26 81C3[78360100] <1> add ebx, IRQ_list ; reset to default interrupt list 1223 00011E2C EB06 <1> jmp short shintv_2 1224 <1> shintv_1: 1225 00011E2E 81C3[551E0100] <1> add ebx, IRQ_u_list 1226 <1> shintv_2: 1227 00011E34 8B13 <1> mov edx, [ebx] ; IRQ handler address 1228 <1> 1229 <1> ; 03/03/2017 1230 00011E36 D0E0 <1> shl al, 1 ; IRQ number * 8 1231 <1> ; 18/03/2017 1232 00011E38 0FB6F8 <1> movzx edi, al 1233 00011E3B 81C7[C8740100] <1> add edi, idt + (8*32) ; IRQ 0 offset = idt + 256 1234 <1> 1235 00011E41 89D0 <1> mov eax, edx ; IRQ handler address 1236 00011E43 BB00000800 <1> mov ebx, 80000h 1237 <1> 1238 <1> ;mov edx, eax 1239 00011E48 66BA008E <1> mov dx, 8E00h 1240 00011E4C 6689C3 <1> mov bx, ax 1241 00011E4F 89D8 <1> mov eax, ebx ; /* selector = 0x0008 = cs */ 1242 <1> ; /* interrupt gate - dpl=0, present */ 1243 00011E51 AB <1> stosd ; selector & offset bits 0-15 1244 00011E52 8917 <1> mov [edi], edx ; attributes & offset bits 16-23 1245 <1> 1246 00011E54 C3 <1> retn 1247 <1> IRQ_u_list: 1248 <1> ; 28/02/2017 1249 00011E55 [7E090000] <1> dd timer_int 1250 00011E59 [E3100000] <1> dd kb_int 1251 00011E5D [6A0B0000] <1> dd irq2 1252 00011E61 [951E0100] <1> dd IRQ_service3 1253 00011E65 [9F1E0100] <1> dd IRQ_service4 1254 00011E69 [A91E0100] <1> dd IRQ_service5 1255 00011E6D [A44E0000] <1> dd fdc_int 1256 00011E71 [B31E0100] <1> dd IRQ_service7 1257 00011E75 [F20A0000] <1> dd rtc_int 1258 00011E79 [BD1E0100] <1> dd IRQ_service9 1259 00011E7D [C71E0100] <1> dd IRQ_service10 1260 00011E81 [D11E0100] <1> dd IRQ_service11 1261 00011E85 [DB1E0100] <1> dd IRQ_service12 1262 00011E89 [E51E0100] <1> dd IRQ_service13 1263 00011E8D [E3570000] <1> dd hdc1_int 1264 00011E91 [06580000] <1> dd hdc2_int 1265 <1> 1266 <1> ; 03/03/2017 1267 <1> ; 27/02/2017 1268 <1> IRQ_service3: 1269 00011E95 36C605[E0880100]03 <1> mov byte [ss:IRQnum], 3 1270 00011E9D EB4E <1> jmp short IRQ_service 1271 <1> IRQ_service4: 1272 00011E9F 36C605[E0880100]04 <1> mov byte [ss:IRQnum], 4 1273 00011EA7 EB44 <1> jmp short IRQ_service 1274 <1> IRQ_service5: 1275 00011EA9 36C605[E0880100]05 <1> mov byte [ss:IRQnum], 5 1276 00011EB1 EB3A <1> jmp short IRQ_service 1277 <1> IRQ_service7: 1278 00011EB3 36C605[E0880100]07 <1> mov byte [ss:IRQnum], 7 1279 00011EBB EB30 <1> jmp short IRQ_service 1280 <1> IRQ_service9: 1281 00011EBD 36C605[E0880100]09 <1> mov byte [ss:IRQnum], 9 1282 00011EC5 EB26 <1> jmp short IRQ_service 1283 <1> IRQ_service10: 1284 00011EC7 36C605[E0880100]0A <1> mov byte [ss:IRQnum], 10 1285 00011ECF EB1C <1> jmp short IRQ_service 1286 <1> IRQ_service11: 1287 00011ED1 36C605[E0880100]0B <1> mov byte [ss:IRQnum], 11 1288 00011ED9 EB12 <1> jmp short IRQ_service 1289 <1> IRQ_service12: 1290 00011EDB 36C605[E0880100]0C <1> mov byte [ss:IRQnum], 12 1291 00011EE3 EB08 <1> jmp short IRQ_service 1292 <1> IRQ_service13: 1293 00011EE5 36C605[E0880100]0D <1> mov byte [ss:IRQnum], 13 1294 <1> ;jmp short IRQ_service 1295 <1> IRQ_service: 1296 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1297 <1> ; 13/06/2017 1298 <1> ; 11/06/2017 1299 <1> ; 10/06/2017 1300 <1> ; 01/03/2017, 04/03/2017 1301 <1> ; 27/02/2017, 28/02/2017 1302 00011EED 1E <1> push ds 1303 00011EEE 06 <1> push es 1304 00011EEF 0FA0 <1> push fs 1305 00011EF1 0FA8 <1> push gs 1306 <1> 1307 00011EF3 60 <1> pushad ; eax,ecx,edx,ebx,esp,ebp,esi,edi 1308 00011EF4 66B91000 <1> mov cx, KDATA 1309 00011EF8 8ED9 <1> mov ds, cx 1310 00011EFA 8EC1 <1> mov es, cx 1311 00011EFC 8EE1 <1> mov fs, cx 1312 00011EFE 8EE9 <1> mov gs, cx 1313 <1> 1314 00011F00 0F20D8 <1> mov eax, cr3 1315 00011F03 A3[DC880100] <1> mov [IRQ_cr3], eax 1316 <1> 1317 00011F08 A1[B0760100] <1> mov eax, [k_page_dir] 1318 00011F0D 0F22D8 <1> mov cr3, eax 1319 <1> 1320 00011F10 A0[E0880100] <1> mov al, [IRQnum] 1321 <1> 1322 <1> ;mov cl, [sysflg] 1323 <1> ;mov [u.r_mode], cl ; system (0) or user mode (FFh) 1324 <1> IRQsrv_0: 1325 00011F15 0FB6D8 <1> movzx ebx, al 1326 00011F18 8A9B[B0350100] <1> mov bl, [ebx+IRQenum] ; IRQ (available) index number + 1 1327 <1> ; 01/03/2017 1328 00011F1E FECB <1> dec bl ; IRQ index number, 0 to 8 1329 <1> ;js IRQsrv_5 ; not available to use here!? 1330 <1> ; 29/07/2022 1331 00011F20 785E <1> js short IRQsrv_j5 ; (jump to IRQsrv_5) 1332 <1> ; 1333 00011F22 80BB[A6880100]80 <1> cmp byte [ebx+IRQ.method], 80h ; using by a dev or kernel? 1334 00011F29 7205 <1> jb short IRQsrv_1 ; no 1335 <1> 1336 <1> ; If the IRQ service is already owned by TRDOS 386 kernel 1337 <1> ; or a Device driver 1338 <1> ; we need to call 'dev_IRQ_service' 1339 <1> 1340 <1> ; IRQ number in AL 1341 00011F2B E80E010000 <1> call dev_IRQ_service ; IRQ service for device drivers 1342 <1> ; IRQ number in AL 1343 <1> IRQsrv_1: 1344 <1> ; check user callback service status 1345 <1> ; AL = IRQ number 1346 <1> ; EBX = IRQ (Available) Index number 1347 <1> 1348 00011F30 A2[E78E0100] <1> mov [u.irqwait], al ; set waiting IRQ flag 1349 <1> 1350 00011F35 8A83[94880100] <1> mov al, [ebx+IRQ.owner] 1351 00011F3B 20C0 <1> and al, al 1352 <1> ;jz IRQsrv_5 ; it is not owned by a user/proc 1353 <1> ; 29/07/2022 1354 00011F3D 7441 <1> jz short IRQsrv_j5 ; (jump to IRQsrv_5) 1355 <1> 1356 <1> ; 03/03/2017 1357 00011F3F 89DA <1> mov edx, ebx 1358 00011F41 C0E202 <1> shl dl, 2 1359 00011F44 8B92[B8880100] <1> mov edx, [edx+IRQ.addr] ; S.R.B. or Callback service addr 1360 <1> 1361 00011F4A 8AA3[A6880100] <1> mov ah, [ebx+IRQ.method] 1362 00011F50 F6C401 <1> test ah, 1 1363 00011F53 7530 <1> jnz short IRQsrv_4 ; Callback service method 1364 <1> 1365 <1> ; Signal Response Byte method 1366 <1> ;mov edx, [edx+IRQ.addr] ; Signal Response Byte address 1367 <1> ; ; (Physical address, non-swappable) 1368 00011F55 80E402 <1> and ah, 2 ; bit 1, (S.R.B.) counter (auto increment) method 1369 00011F58 8AA3[AF880100] <1> mov ah, [ebx+IRQ.srb] ; Signal Response Byte value 1370 00011F5E 7408 <1> jz short IRQsrv_2 ; fixed S.R.B. value 1371 <1> ; counter method (auto increment) 1372 00011F60 FEC4 <1> inc ah 1373 00011F62 88A3[AF880100] <1> mov [ebx+IRQ.srb], ah ; next (count) number 1374 <1> IRQsrv_2: 1375 00011F68 8822 <1> mov [edx], ah ; put S.R.B. val to the user's S.R.B. addr 1376 00011F6A C605[E78E0100]00 <1> mov byte [u.irqwait], 0 ; clear waiting IRQ flag 1377 <1> 1378 00011F71 3A05[BD8E0100] <1> cmp al, [u.uno] 1379 <1> ;je IRQsrv_5 ; the owner is current user/process 1380 <1> ; 29/07/2022 1381 00011F77 7407 <1> je short IRQsrv_j5 ; (jump to IRQsrv_5) 1382 <1> IRQsrv_3: 1383 <1> ; the owner is not current user/process 1384 <1> ; AL = process number 1385 00011F79 B202 <1> mov dl, 2 ; priority, 2 = event (high) 1386 00011F7B E87BFBFFFF <1> call set_run_sequence 1387 <1> 1388 <1> ; [u.irqwait] = waiting IRQ number for callback service 1389 <1> IRQsrv_j5: ; 29/07/2022 1390 00011F80 E998000000 <1> jmp IRQsrv_5 1391 <1> IRQsrv_4: 1392 00011F85 3A05[BD8E0100] <1> cmp al, [u.uno] ; is the owner is current user/process? 1393 00011F8B 75EC <1> jne short IRQsrv_3 ; no ! 1394 <1> 1395 <1> ; Check if an IRQ callback service already in progress 1396 00011F8D 803D[E88E0100]00 <1> cmp byte [u.r_lock], 0 1397 <1> ;ja IRQsrv_5 ; nothing to do ! 1398 <1> ; (we need to complete prev callback) 1399 <1> ; 29/07/2022 1400 00011F94 77EA <1> ja short IRQsrv_j5 ; (jump to IRQsrv_5) 1401 <1> 1402 00011F96 803D[E48E0100]00 <1> cmp byte [u.t_lock], 0 1403 00011F9D 777E <1> ja short IRQsrv_5 ; nothing to do ! 1404 <1> ; (we need to complete timer callback) 1405 <1> 1406 <1> ; 04/03/2017 1407 00011F9F C605[E78E0100]00 <1> mov byte [u.irqwait], 0 ; reset/clear waiting IRQ flag 1408 <1> 1409 00011FA6 FE05[E88E0100] <1> inc byte [u.r_lock] ; 'IRQ callback service in progress' flag 1410 <1> 1411 00011FAC 8A0D[608E0100] <1> mov cl, [sysflg] ; (system call) mode flag (kernel/user) 1412 00011FB2 880D[E98E0100] <1> mov [u.r_mode], cl ; system mode (0) or user mode (FFh) 1413 <1> 1414 <1> ; 1415 00011FB8 8B2D[4C760100] <1> mov ebp, [tss.esp0] ; kernel stack address (for ring 0) 1416 00011FBE 83ED14 <1> sub ebp, 20 ; eip, cs, eflags, esp, ss 1417 00011FC1 892D[648E0100] <1> mov [u.sp], ebp 1418 00011FC7 8925[688E0100] <1> mov [u.usp], esp 1419 <1> 1420 <1> ;or word [ebp+8], 200h ; 22/01/2017, force enabling interrupts 1421 <1> 1422 00011FCD 8B44241C <1> mov eax, [esp+28] ; pushed eax 1423 00011FD1 A3[6C8E0100] <1> mov [u.r0], eax 1424 <1> 1425 00011FD6 E8FCE9FFFF <1> call wswap ; save user's registers & status 1426 <1> 1427 <1> ; software int is in ring 0 but IRQ handler must return to ring 3 1428 <1> ; so, ring 3 return address and stack registers 1429 <1> ; (eip, cs, eflags, esp, ss) 1430 <1> ; must be copied to IRQ handler return 1431 <1> ; eip will be replaced by callback service routine address 1432 <1> 1433 00011FDB C605[608E0100]FF <1> mov byte [sysflg], 0FFh ; user mode 1434 <1> 1435 <1> ; system mode (system call) 1436 <1> ;mov ebp, [u.sp] ; EIP (u), CS (UCODE), EFLAGS (u), 1437 <1> ; ESP (u), SS (UDATA) 1438 <1> 1439 00011FE2 8B4510 <1> mov eax, [ebp+16] ; SS (UDATA) 1440 00011FE5 89E6 <1> mov esi, esp 1441 00011FE7 50 <1> push eax 1442 00011FE8 50 <1> push eax 1443 00011FE9 89E7 <1> mov edi, esp 1444 00011FEB 893D[688E0100] <1> mov [u.usp], edi 1445 00011FF1 B908000000 <1> mov ecx, ((ESPACE/4) - 4) ; except DS, ES, FS, GS 1446 00011FF6 F3A5 <1> rep movsd 1447 00011FF8 B104 <1> mov cl, 4 1448 00011FFA F3AB <1> rep stosd 1449 00011FFC 893D[648E0100] <1> mov [u.sp], edi 1450 00012002 89EE <1> mov esi, ebp 1451 00012004 B105 <1> mov cl, 5 ; EIP (u), CS (UCODE), EFLAGS (u), ESP (u), SS (UDATA) 1452 00012006 F3A5 <1> rep movsd 1453 <1> ; 1454 <1> 1455 00012008 8B0D[C48E0100] <1> mov ecx, [u.pgdir] 1456 0001200E 890D[DC880100] <1> mov [IRQ_cr3], ecx 1457 <1> 1458 <1> set_IRQ_callback_addr: 1459 <1> ; 1460 <1> ; This routine sets return address 1461 <1> ; to start of user's interrupt 1462 <1> ; service (callback) address 1463 <1> ; 1464 <1> ; INPUT: 1465 <1> ; EDX = callback routine/service address 1466 <1> ; (virtual, not physical address!) 1467 <1> ; [u.sp] = kernel stack, points to 1468 <1> ; user's EIP,CS,EFLAGS,ESP,SS 1469 <1> ; registers. 1470 <1> ; OUTPUT: 1471 <1> ; EIP (user) = callback (service) address 1472 <1> ; CS (user) = UCODE 1473 <1> ; EFLAGS (user) = flags before callback 1474 <1> ; ESP (user) = ESP-4 (user, before callback) 1475 <1> ; [ESP](user) = EIP (user) before callback 1476 <1> ; 1477 <1> ; Note: If CPU was in user mode while entering 1478 <1> ; the timer interrupt service routine, 1479 <1> ; 'IRET' will get return to callback routine 1480 <1> ; immediately. If CPU was in system/kernel mode 1481 <1> ; 'iret' will get return to system call and 1482 <1> ; then, callback routine will be return address 1483 <1> ; from system call. (User's callback/service code 1484 <1> ; will be able to return to normal return address 1485 <1> ; via a 'sysrele' system call at the end.) 1486 <1> ; 1487 <1> ; Note: User's IRQ callback service code must be ended 1488 <1> ; with a 'sysrele' system call ! 1489 <1> ; 1490 <1> ; For example: 1491 <1> ; 1492 <1> ; audio_IRQ_callback: 1493 <1> ; ... 1494 <1> ; 1495 <1> ; ... 1496 <1> ; mov eax, 39 ; 'sysrele' 1497 <1> ; int 40h ; TRDOS 386 system call (interrupt) 1498 <1> ; 1499 <1> 1500 <1> ;mov edx, [edx+IRQ.addr] ; Callback service address 1501 <1> ; ; (Virtual address) 1502 <1> 1503 00012014 8B2D[648E0100] <1> mov ebp, [u.sp]; kernel's stack, points to EIP (user) 1504 0001201A 895500 <1> mov [ebp], edx 1505 <1> IRQsrv_5: 1506 <1> ; EOI & return 1507 <1> ; 01/08/2020 1508 <1> ; 11/06/2017 1509 <1> ; 10/06/2017 1510 <1> ;mov al, [IRQnum] 1511 0001201D B020 <1> mov al, 20h ; 01/08/2020 1512 0001201F FA <1> cli 1513 <1> ;cmp al, 7 1514 00012020 803D[E0880100]07 <1> cmp byte [IRQnum], 7 ; 01/08/2020 1515 00012027 7602 <1> jna short IRQsrv_6 1516 <1> ; 1517 <1> ;;mov al, EOI ; end of interrupt 1518 <1> ;mov al, 20h ; 01/08/2020 1519 <1> ;cli ; disable interrupts till stack cleared 1520 <1> ;out INTB00, al ; For controll2 #2 1521 00012029 E6A0 <1> out 0A0h, al 1522 <1> IRQsrv_6: 1523 <1> ;mov byte [IRQnum], 0 ; reset 1524 <1> ;;mov al, EOI ; end of interrupt 1525 <1> ;mov al, 20h ; 01/08/2020 1526 <1> ;cli ; disable interrupts till stack cleared 1527 <1> ;out INTA00, al ; end of interrupt to 8259 - 1 1528 0001202B E620 <1> out 20h, al 1529 <1> IRQsrv_7: 1530 <1> ;; 13/06/2017 1531 <1> ;or word [ebp+8], 200h ; force enabling interrupts 1532 <1> ; 1533 0001202D 8B0D[DC880100] <1> mov ecx, [IRQ_cr3] ; previous content of cr3 register 1534 00012033 0F22D9 <1> mov cr3, ecx ; restore cr3 register content 1535 <1> ; 1536 00012036 61 <1> popad ; edi,esi,ebp,(icrement esp by 4),ebx,edx,ecx,eax 1537 <1> ; 1538 00012037 0FA9 <1> pop gs 1539 00012039 0FA1 <1> pop fs 1540 0001203B 07 <1> pop es 1541 0001203C 1F <1> pop ds 1542 <1> ; 1543 0001203D CF <1> iretd ; return from interrupt 1544 <1> 1545 <1> ; 17/04/2021 1546 <1> ; ('get_device_number' procedure is disabled as temporary) 1547 <1> 1548 <1> ;get_device_number: 1549 <1> ; ; 08/10/2016 1550 <1> ; ; 07/10/2016 - TRDOS 386 (TRDOS v2.0) 1551 <1> ; ; 1552 <1> ; ; This procedure compares name of requested 1553 <1> ; ; device with kernel device names and 1554 <1> ; ; installable device names. If names match, 1555 <1> ; ; the relevant device index (entry) number 1556 <1> ; ; will be returned the caller (sysopen) 1557 <1> ; ; for the requested device. 1558 <1> ; ; 1559 <1> ; ; NOTE: Installable device drivers must 1560 <1> ; ; be loaded before using 'sysopen' 1561 <1> ; ; (opendev) system call. 1562 <1> ; ; 1563 <1> ; ; INPUT: 1564 <1> ; ; ESI = device name address (ASCIIZ) 1565 <1> ; ; (in kernel's memory space) 1566 <1> ; ; max name length = 8 without '/dev/') 1567 <1> ; ; Device name will be capitalized 1568 <1> ; ; and if there is, '/dev/' will be 1569 <1> ; ; removed from name before comparising) 1570 <1> ; ; 1571 <1> ; ; OUTPUT: 1572 <1> ; ; cf = 0 -> 1573 <1> ; ; EAX (AL) = device entry/index number 1574 <1> ; ; cf = 1 -> device not found (installed) 1575 <1> ; ; or invalid device name 1576 <1> ; ; (AL=0) 1577 <1> ; ; device_name = device name address (asciiz) 1578 <1> ; ; 1579 <1> ; ; Modified registers: EAX, EBX, ESI, EDI 1580 <1> ; 1581 <1> ; mov edi, device_name 1582 <1> ; call lodsb_capitalize 1583 <1> ; mov ah, al 1584 <1> ; cmp al, '/' 1585 <1> ; jne short gdn_1 1586 <1> ; mov edi, device_name 1587 <1> ; call lodsb_capitalize 1588 <1> ;gdn_0: 1589 <1> ; and al, al ; 0 ? 1590 <1> ; jz short gdn_err ; null name after '/' 1591 <1> ;gdn_1: 1592 <1> ; cmp al, 'D' 1593 <1> ; jne short gdn_2 1594 <1> ; call lodsb_capitalize 1595 <1> ; cmp al, 'E' 1596 <1> ; jne short gdn_2 1597 <1> ; call lodsb_capitalize 1598 <1> ; cmp al, 'V' 1599 <1> ; jne short gdn_2 1600 <1> ; lodsb 1601 <1> ; cmp al, '/' 1602 <1> ; je short gdn_4 1603 <1> ;gdn_2: 1604 <1> ; cmp ah, '/' 1605 <1> ; jne short gdn_5 1606 <1> ;gdn_err: 1607 <1> ; ; invalid device name or device not found 1608 <1> ; xor eax, eax ; 0 1609 <1> ; stc 1610 <1> ; retn 1611 <1> ;gdn_3: 1612 <1> ; cmp al, '/' 1613 <1> ; jne short gdn_5 1614 <1> ;gdn_4: 1615 <1> ; mov edi, device_name 1616 <1> ; jmp short gdn_6 1617 <1> ;gdn_5: 1618 <1> ; cmp al, 0 1619 <1> ; je short gdn_7 1620 <1> ;gdn_6: 1621 <1> ; call lodsb_capitalize 1622 <1> ; cmp edi, device_name + 8 1623 <1> ; jb short gdn_3 1624 <1> ; cmp al, 0 1625 <1> ; jne short gdn_err 1626 <1> ; cmp edi, device_name + 1 1627 <1> ; jna short gdn_err ; null name after '/' 1628 <1> ;gdn_7: 1629 <1> ; stosb 1630 <1> ; ; zero padding ("NAME",0,0,0,0) 1631 <1> ; cmp edi, device_name + 8 1632 <1> ; jb short gdn_7 1633 <1> ;gdn_8: 1634 <1> ; ; search for kernel device names 1635 <1> ; mov esi, device_name 1636 <1> ; mov edi, KDEV_NAME 1637 <1> ; xor eax, eax 1638 <1> ;gdn_9: 1639 <1> ; cmpsd 1640 <1> ; jne short gdn_10 1641 <1> ; cmpsd 1642 <1> ; jne short gdn_11 1643 <1> ; jmp short gdn_17 ; match 1644 <1> ;gdn_10: 1645 <1> ; cmpsd ; add esi, 4 & add edi, 4 1646 <1> ;gdn_11: 1647 <1> ; mov esi, device_name 1648 <1> ; inc al 1649 <1> ; cmp al, NumOfKernelDevNames 1650 <1> ; jb short gdn_9 1651 <1> ;gdn_12: 1652 <1> ; ; search for installable device names 1653 <1> ; ; esi = offset device_name 1654 <1> ; mov edi, IDEV_NAME 1655 <1> ; sub al, al ; 0 1656 <1> ;gdn_13: 1657 <1> ; cmpsd 1658 <1> ; jne short gdn_14 1659 <1> ; cmpsd 1660 <1> ; jne short gdn_15 1661 <1> ; jmp short gdn_19 ; match 1662 <1> ;gdn_14: 1663 <1> ; cmpsd ; add esi, 4 & add edi, 4 1664 <1> ;gdn_15: 1665 <1> ; mov esi, device_name 1666 <1> ; inc al 1667 <1> ; cmp al, NumOfInstallableDevices 1668 <1> ; jb short gdn_13 1669 <1> ; 1670 <1> ;gdn_16: ; error: invalid device name (not found) ! 1671 <1> ; xor al, al 1672 <1> ; stc 1673 <1> ; retn 1674 <1> ; 1675 <1> ;gdn_17: ; name match (with one of kernel device names) 1676 <1> ; ; 1677 <1> ; ; convert KDEV_NAME index to 1678 <1> ; ; KDEV_NUMBER index 1679 <1> ; ; (different names are used for same devices) 1680 <1> ; ; (example: "COM1" & "TTY8" = device number 18) 1681 <1> ; mov ebx, eax ; < 256 1682 <1> ; mov al, [KDEV_NUMBER+ebx] 1683 <1> ; 1684 <1> ; ; check if empty dev entry in the list 1685 <1> ; cmp byte [DEV_OPENMODE+eax], 0 1686 <1> ; ja short gdn_18 ; it must be already set 1687 <1> ; 1688 <1> ; ; (re)set device name and access flags 1689 <1> ; ; (remain open work will be easy after that) 1690 <1> ; ; (NOTE: here, data will be copied to bss section) 1691 <1> ; mov bl, al 1692 <1> ; sub edi, 8 ; kernel device name address (data) 1693 <1> ; shl bx, 2 1694 <1> ; mov [DEV_NAME_PTR+ebx], edi ; (all) device names 1695 <1> ; mov bl, [KDEV_ACCESS+eax] ; kernel dev list (data) 1696 <1> ; mov [DEV_ACCESS+eax], bl ; (all) device list (bss) 1697 <1> ;gdn_18: 1698 <1> ; inc al ; 1 to NumOfKernelDevNames (<=7Fh) 1699 <1> ; ; eax = device index/entry number 1700 <1> ; retn 1701 <1> ; 1702 <1> ;gdn_19: ; name match (with one of installable device names) 1703 <1> ; ; 1704 <1> ; ; al = 0 to NumOfInstallableDevices - 1 (<=7Fh) 1705 <1> ; 1706 <1> ; mov ebx, eax 1707 <1> ; add bl, NumOfKernelDevices ; < NUMOFDEVICES 1708 <1> ; 1709 <1> ; ; check if empty dev entry in the list 1710 <1> ; cmp byte [DEV_OPENMODE+ebx], 0 1711 <1> ; ja short gdn_20 ; it must be already set 1712 <1> ; 1713 <1> ; ; (re)set device name and access flags 1714 <1> ; ; (remain open work will be easy after that) 1715 <1> ; sub edi, 8 ; installable device name address 1716 <1> ; shl bx, 2 ;*4 1717 <1> ; mov [DEV_NAME_PTR+ebx], edi ; (all) device names 1718 <1> ; shr bx, 2 1719 <1> ; mov al, [IDEV_FLAGS+eax] ; installable dev list 1720 <1> ; mov [DEV_ACCESS+ebx], al ; (all) device list 1721 <1> ;gdn_20: 1722 <1> ; mov al, bl 1723 <1> ; ; eax = device index/entry number ; < NUMOFDEVICES 1724 <1> ; retn 1725 <1> 1726 <1> ;lodsb_capitalize: 1727 <1> ; ; 07/10/2016 - TRDOS 386 (TRDOS v2.0) 1728 <1> ; ; INPUT -> [esi] = character 1729 <1> ; ; edi = destination 1730 <1> ; ; OUTPUT -> AL contains capitalized character 1731 <1> ; ; esi = esi+1 1732 <1> ; ; edi = edi+1 1733 <1> ; ; 1734 <1> ; lodsb 1735 <1> ; cmp al, 61h 1736 <1> ; jb short lodsb_cap_retn 1737 <1> ; cmp al, 7Ah 1738 <1> ; ja short lodsb_cap_retn 1739 <1> ; and al, 0DFh 1740 <1> ;lodsb_cap_retn: 1741 <1> ; stosb 1742 <1> ; retn 1743 <1> 1744 <1> ; 17/04/2021 1745 <1> ; ('device_open' procedure is disabled as temporary) 1746 <1> 1747 <1> ;device_open: 1748 <1> ; ; 08/10/2016 - TRDOS 386 (TRDOS v2.0) 1749 <1> ; ; Complete device opening work for sysopen (device) 1750 <1> ; ; 1751 <1> ; ; INPUT -> 1752 <1> ; ; EAX = Device Number (AL) 1753 <1> ; ; CL = Open mode (1 = read, 2 = write) 1754 <1> ; ; CH = Device access byte (bit 0 = 0) 1755 <1> ; ; OUTPUT -> 1756 <1> ; ; EAX = Device Number 1757 <1> ; ; CF = 0 -> device has been opened 1758 <1> ; ; CF = 1 -> device could not be opened 1759 <1> ; ; 1760 <1> ; ; Modified registers: ebx, (edx, ecx, esi, edi, ebp) 1761 <1> ; ; 1762 <1> ; 1763 <1> ; mov ebx, eax 1764 <1> ; shl bx, 2 ; *4 1765 <1> ; 1766 <1> ; test ch, 80h ; bit 7, installable device driver flag 1767 <1> ; jz short d_open_2 ; Kernel device 1768 <1> ; ; installable device 1769 <1> ;d_open_1: 1770 <1> ; jmp dword [ebx+IDEV_OADDR-4] 1771 <1> ;d_open_2: 1772 <1> ; jmp dword [ebx+KDEV_OADDR-4] 1773 <1> 1774 <1> ; 17/04/2021 1775 <1> ; ('device_close' procedure is disabled as temporary) 1776 <1> 1777 <1> ;device_close: 1778 <1> ; ; 08/10/2016 - TRDOS 386 (TRDOS v2.0) 1779 <1> ; ; Complete device closing work for sysclose (device) 1780 <1> ; ; 1781 <1> ; ; INPUT -> 1782 <1> ; ; EAX = Device Number (AL) 1783 <1> ; ; CL = Open mode (1 = read, 2 = write) 1784 <1> ; ; CH = Device access byte (bit 0 = 0) 1785 <1> ; ; OUTPUT -> 1786 <1> ; ; EAX = Device Number 1787 <1> ; ; CF = 0 -> device has been closed 1788 <1> ; ; CF = 1 -> device could not be closed 1789 <1> ; ; 1790 <1> ; ; Modified registers: ebx, (edx, ecx, esi, edi, ebp) 1791 <1> ; ; 1792 <1> ; 1793 <1> ; mov ebx, eax 1794 <1> ; shl bx, 2 ; *4 1795 <1> ; 1796 <1> ; test ch, 80h ; bit 7, installable device driver flag 1797 <1> ; jz short d_close_2 ; Kernel device 1798 <1> ; ; installable device 1799 <1> ;d_close_1: 1800 <1> ; jmp dword [ebx+IDEV_CADDR-4] 1801 <1> ;d_close_2: 1802 <1> ; jmp dword [ebx+KDEV_CADDR-4] 1803 <1> 1804 <1> ;rnull: 1805 <1> ; ; 07/10/2016 - TRDOS 386 (TRDOS v2.0) 1806 <1> ; ; read null (read from null device) 1807 <1> ; retn 1808 <1> 1809 <1> ;wnull: 1810 <1> ; ; 07/10/2016 - TRDOS 386 (TRDOS v2.0) 1811 <1> ; ; write null (write to null device) 1812 <1> ; retn 1813 <1> 1814 <1> dev_IRQ_service: 1815 <1> ; 12/05/2017 1816 <1> ; 13/04/2017 1817 <1> ; 27/02/2017 - TRDOS 386 (TRDOS v2.0) 1818 <1> ; INPUT -> 1819 <1> ; AL = IRQ Number (0 to 15) 1820 <1> ; 1821 0001203E 53 <1> push ebx 1822 0001203F 0FB6D8 <1> movzx ebx, al 1823 00012042 C0E302 <1> shl bl, 2 ; * 4 1824 00012045 8B9B[54880100] <1> mov ebx, [ebx+DEV_INT_HNDLR] 1825 0001204B 21DB <1> and ebx, ebx 1826 0001204D 7404 <1> jz short dIRQ_s_retn 1827 0001204F 50 <1> push eax 1828 <1> 1829 00012050 FFD3 <1> call ebx 1830 <1> 1831 00012052 58 <1> pop eax 1832 <1> dIRQ_s_retn: 1833 00012053 5B <1> pop ebx 1834 00012054 C3 <1> retn 1835 <1> 1836 <1> set_dev_IRQ_service: 1837 <1> ; 09/08/2022 1838 <1> ; 29/07/2022 (TRDOS 386 Kernel v2.0.5) 1839 <1> ; 13/04/2017 - TRDOS 386 (TRDOS v2.0) 1840 <1> ; 1841 <1> ; Set Device Interrupt Service 1842 <1> ; 1843 <1> ; INPUT -> 1844 <1> ; AL = IRQ Number 1845 <1> ; EBX = Hardware Interrupt Service Address 1846 <1> ; 1847 <1> ; Note: There is not a validation check here 1848 <1> ; because this procedure is called by 1849 <1> ; TRDOS 386 kernel ! 1850 <1> ; (Even if a device driver does not exist 1851 <1> ; this setting may be used by sysaudio 1852 <1> ; and other system calls for hardware 1853 <1> ; components which use IRQ method for I/O.) 1854 <1> ; 1855 <1> ;push esi 1856 00012055 0FB6F0 <1> movzx esi, al 1857 <1> ;shl si, 2 ; * 4 1858 <1> ; 09/08/2022 1859 00012058 C1E602 <1> shl esi, 2 ; * 4 1860 0001205B 899E[54880100] <1> mov [esi+DEV_INT_HNDLR], ebx 1861 <1> ;pop esi 1862 00012061 C3 <1> retn 1863 <1> 1864 <1> sysaudio: ; AUDIO FUNCTIONS 1865 <1> ; 28/01/2025 1866 <1> ; 27/01/2025 1867 <1> ; 15/01/2025 1868 <1> ; 12/01/2025 1869 <1> ; 11/01/2025 (TRDOS 386 v2.0.10) 1870 <1> ; 29/12/2024 1871 <1> ; 19/12/2024 1872 <1> ; 23/08/2024 (TRDOS 386 v2.0.9) 1873 <1> ; 05/06/2024 1874 <1> ; 04/06/2024 1875 <1> ; 23/05/2024 (TRDOS 386 v2.0.8) 1876 <1> ; 19/11/2023 (TRDOS 386 v2.0.7) 1877 <1> ; 29/07/2022 (TRDOS 386 v2.0.5) 1878 <1> ; 12/02/2021 (TRDOS 386 v2.0.3) 1879 <1> ; 28/07/2020 1880 <1> ; 27/07/2020 1881 <1> ; 10/10/2017 1882 <1> ; 22/06/2017 1883 <1> ; 28/05/2017, 04/06/2017, 05/06/2017, 10/06/2017 1884 <1> ; 01/05/2017, 12/05/2017, 15/05/2017, 20/05/2017 1885 <1> ; 21/04/2017, 22/04/2017, 23/04/2017, 24/04/2017 1886 <1> ; 10/04/2017, 13/04/2017, 14/04/2017, 16/04/2017 1887 <1> ; 03/04/2017 (VIA VT8237R) 1888 <1> ; 01/04/2016 (trdosk6.s -> tdosk8.s) 1889 <1> ; 16/05/2016 - TRDOS 386 (TRDOS v2.0) 1890 <1> ; 1891 <1> ; Inputs: 1892 <1> ; 1893 <1> ; BH = 0 -> Beep (PC Speaker) 1894 <1> ; BL = Duration Counter (1 for 1/64 second) 1895 <1> ; CX = Frequency Divisor (1193180/Frequency) 1896 <1> ; (1331 for 886 Hz) 1897 <1> ; 1898 <1> ; 01/04/2017 1899 <1> ; 1900 <1> ; BH = 1 -> DETECT (& ENABLE) AUDIO DEVICE 1901 <1> ; BL = 0 : PC SPEAKER 1902 <1> ; 1 : SOUND BLASTER 16 1903 <1> ; 2 : INTEL AC'97 1904 <1> ; 3 : VIA VT8237R (VT8233) 1905 <1> ; 4 : INTEL HDA 1906 <1> ; 5-FEh : unknown/invalid 1907 <1> ; ; 04/06/2017 1908 <1> ; FFh : Get current audio device id 1909 <1> ; 1910 <1> ; BH = 2 -> ALLOCATE AUDIO BUFFER (for user) 1911 <1> ; ECX = Audio Buffer Size (must be equal to 1912 <1> ; the half of DMA buffer size) 1913 <1> ; EDX = Virtual Address of the buffer 1914 <1> ; (This is not DMA buffer!) 1915 <1> ; 1916 <1> ; BH = 3 -> INITIALIZE AUDIO DEVICE 1917 <1> ; BL = 0,2 -> for Signal Response Byte 1918 <1> ; CL = Signal Response Byte Value (fixed) 1919 <1> ; if BL = 0 1920 <1> ; auto increment of S.R.B. value 1921 <1> ; if BL = 2 1922 <1> ; EDX = Signal Response (Return) Byte Address 1923 <1> ; 1924 <1> ; BL = 1 for CallBack Method 1925 <1> ; EDX = CallBack Service Address (Virtual) 1926 <1> ; 1927 <1> ; BL > 2 -> invalid function 1928 <1> ; 1929 <1> ; (Audio buffer must be allocated before 1930 <1> ; initialization.) 1931 <1> ; 1932 <1> ; BH = 4 -> START TO PLAY 1933 <1> ; BL = Mode 1934 <1> ; Bit 0 = mono/stereo (1 = stereo) 1935 <1> ; Bit 1 = 8 bit / 16 bit (1 = 16 bit) 1936 <1> ; CX = Sampling Rate (Hz) 1937 <1> ; 1938 <1> ; BH = 5 -> PAUSE 1939 <1> ; BL = Any 1940 <1> ; 1941 <1> ; BH = 6 -> CONTINUE TO PLAY 1942 <1> ; BL = Any 1943 <1> ; 1944 <1> ; BH = 7 -> STOP 1945 <1> ; BL = Any 1946 <1> ; 1947 <1> ; BH = 8 -> RESET 1948 <1> ; BL = Any 1949 <1> ; 1950 <1> ; BH = 9 -> CANCEL (CALLBACK or S.R.B. SERVICE) 1951 <1> ; BL = Any 1952 <1> ; 1953 <1> ; BH = 10 -> DEALLOCATE AUDIO BUFFER (for user) 1954 <1> ; BL = Any 1955 <1> ; 1956 <1> ; BH = 11 -> SET VOLUME LEVEL 1957 <1> ; BL: (Bit 0 to 6) 1958 <1> ; 0 = Master (Playback, Lineout) volume 1959 <1> ; 1 = PCM out volume ; 23/05/2024 1960 <1> ; CL = Left Channel Volume (0 to 31 max) 1961 <1> ; CH = Right Channel Volume (0 to 31 max) 1962 <1> ; 1963 <1> ; Note: If BL >= 80h (Bit 7 of BL is set), 1964 <1> ; volume level will be set for next playing 1965 <1> ; (actual volume level will not be changed 1966 <1> ; immediately) 1967 <1> ; 1968 <1> ; BH = 12 -> DISABLE AUDIO DEVICE 1969 <1> ; (reset audio device and unlink dma buffer) 1970 <1> ; BL = Any 1971 <1> ; 1972 <1> ; 12/05/2017 1973 <1> ; BH = 13 -> MAP DMA BUFFER TO USER 1974 <1> ; (for direct access to system's dma buffer) 1975 <1> ; 1976 <1> ; ECX = map size in bytes 1977 <1> ; (will be rounded up to page borders) 1978 <1> ; EDX = Virtual Address of the buffer 1979 <1> ; (Will be rounded up to page borders) 1980 <1> ; 1981 <1> ; 05/06/2017 1982 <1> ; 04/06/2017 1983 <1> ; BH = 14 -> GET AUDIO DEVICE INFO 1984 <1> ; BL: 0 = Audio Controller Info 1985 <1> ; ; 19/11/2023 1986 <1> ; BL: 1 = Audio (AC'97) Codec Info 1987 <1> ; BL > 1 = Invalid for now! 1988 <1> ; 1989 <1> ; 22/06/2017 1990 <1> ; BH = 15 -> GET CURRENT SOUND DATA (for graphics) 1991 <1> ; BL: 0 -> PCM OUT data 1992 <1> ; > 0 -> Invalid for now! 1993 <1> ; ECX = 0 -> Get DMA Buffer Pointer 1994 <1> ; EDX = Not Used 1995 <1> ; ECX > 0 -> Byte count for buffer (EDX) 1996 <1> ; EDX = Buffer Address (Virtual) 1997 <1> ; 1998 <1> ; 10/10/2017 1999 <1> ; BH = 16 -> UPDATE DMA BUFFER DATA 2000 <1> ; (by using the Audio Buffer content) 2001 <1> ; BL = 0 : Update dma half buffer in sequence 2002 <1> ; (automatic destination) 2003 <1> ; 1 : Update 1st half of the dma buffer 2004 <1> ; 2 : Update 2nd half of the dma buffer 2005 <1> ; 3-FEh: Invalid! 2006 <1> ; FFh = Get current flag value 2007 <1> ; (Half buffer number -1) 2008 <1> ; 2009 <1> ; 24/05/2024 2010 <1> ; BH = 17 -> GET VOLUME LEVEL 2011 <1> ; BL: 0 = Master (Playback, Lineout) volume 2012 <1> ; 1 = PCM out volume 2013 <1> ; 2014 <1> ; Outputs: 2015 <1> ; 2016 <1> ; For BH = 0 -> Beep 2017 <1> ; None 2018 <1> ; 2019 <1> ; 01/04/2017 2020 <1> ; 2021 <1> ; For BH = 1 -> DETECT (& ENABLE) AUDIO DEVICE 2022 <1> ; AH = 0 : PC SPEAKER 2023 <1> ; 1 : SOUND BLASTER 16 2024 <1> ; 2 : INTEL AC'97 2025 <1> ; 3 : VIA VT8237R (VT8233) 2026 <1> ; 4 : INTEL HDA 2027 <1> ; 5-FFh : unknown/invalid 2028 <1> ; AL = mode status 2029 <1> ; bit 0 = mono /stereo (1 = stereo) 2030 <1> ; bit 1 = 8 bit / 16 bit (1 = 16 bit) 2031 <1> ; 04/06/2017 2032 <1> ; EBX = PCI DEVICE/VENDOR ID (if >0) 2033 <1> ; (BX = VENDOR ID) 2034 <1> ; (if CF = 1 -> Error code in EAX) 2035 <1> ; 2036 <1> ; For BH = 2 -> ALLOCATE AUDIO BUFFER (for user) 2037 <1> ; EAX = Physical Address of the buffer 2038 <1> ; (if CF = 1 -> Error code in EAX) 2039 <1> ; 2040 <1> ; For BH = 3 -> INITIALIZE AUDIO DEVICE 2041 <1> ; (if CF = 1 -> Error code in EAX) 2042 <1> ; 2043 <1> ; For BH = 4 -> START TO PLAY 2044 <1> ; none (if CF = 1 -> Error code in EAX) 2045 <1> ; 2046 <1> ; For BH = 5 -> PAUSE 2047 <1> ; none (if CF = 1 -> Error code in EAX) 2048 <1> ; 2049 <1> ; For BH = 6 -> CONTINUE TO PLAY 2050 <1> ; none (if CF = 1 -> Error code in EAX) 2051 <1> ; 2052 <1> ; For BH = 7 -> STOP 2053 <1> ; none (if CF = 1 -> Error code in EAX) 2054 <1> ; 2055 <1> ; For BH = 8 -> RESET 2056 <1> ; none (if CF = 1 -> Error code in EAX) 2057 <1> ; 2058 <1> ; For BH = 9 -> CANCEL (CALLBACK or S.R.B. SERVICE) 2059 <1> ; none (if CF = 1 -> Error code in EAX) 2060 <1> ; 2061 <1> ; For BH = 10 -> DEALLOCATE AUDIO BUFFER (for user) 2062 <1> ; none (if CF = 1 -> Error code in EAX) 2063 <1> ; 2064 <1> ; For BH = 11 -> SET VOLUME LEVEL 2065 <1> ; none (if CF = 1 -> Error code in EAX) 2066 <1> ; 2067 <1> ; For BH = 12 -> DISABLE AUDIO DEVICE 2068 <1> ; none (if CF = 1 -> Error code in EAX) 2069 <1> ; 2070 <1> ; 12/05/2017 2071 <1> ; For BH = 13 -> MAP DMA BUFFER TO USER 2072 <1> ; EAX = Physical Address of the buffer 2073 <1> ; (if CF = 1 -> Error code in EAX) 2074 <1> ; 2075 <1> ; 04/06/2017 2076 <1> ; For BH = 14 -> GET AUDIO DEVICE INFO 2077 <1> ; (for BL = 0) ; 05/06/2017 2078 <1> ; EAX = IRQ Number in AL 2079 <1> ; Audio Device Number in AH 2080 <1> ; EBX = DEV/VENDOR ID 2081 <1> ; (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV) 2082 <1> ; ECX = BUS/DEV/FN 2083 <1> ; (00000000BBBBBBBBDDDDDFFF00000000) 2084 <1> ; EDX = NABMBAR/NAMBAR (for AC97) 2085 <1> ; (Low word, DX = NAMBAR address) 2086 <1> ; EDX = Base IO Addr (DX) for SB16 & VT8233 2087 <1> ; (if CF = 1 -> Error code in EAX) 2088 <1> ; (ERR_DEV_NOT_RDY = 15) 2089 <1> ; (for BL = 1) -for AC97- ; 19/11/2023 2090 <1> ; EAX = Extended Audio ID (MX28) in AX 2091 <1> ; AX bit 0 - VRA bit 2092 <1> ; HW of EAX = PCM output sample rate (HZ) 2093 <1> ; EBX = VENDOR ID 1 (BX), VENDOR ID 2 (HW) 2094 <1> ; (if CF = 1 -> Error code in EAX) 2095 <1> ; (ERR_DEV_NOT_RDY = 15) 2096 <1> ; Note: EAX & EBX = 0 (for SB16,VIA,HDA) 2097 <1> ; 2098 <1> ; 22/06/2017 2099 <1> ; For BH = 15 -> GET CURRENT SOUND DATA 2100 <1> ; (for graphics) 2101 <1> ; (for BL = 0) 2102 <1> ; If ECX input is 0 2103 <1> ; EAX = DMA Buffer Current Position (Offset) 2104 <1> ; If ECX input > 0 2105 <1> ; EAX = Actual transfer count 2106 <1> ; (Sound samples will be copied from 2107 <1> ; Current DMA Buffer Position to EDX 2108 <1> ; virtual address as EAX bytes.) 2109 <1> ; ((If CF = 1 -> Error code in EAX)) 2110 <1> ; 2111 <1> ; 10/10/2017 2112 <1> ; For BH = 16 -> UPDATE DMA BUFFER DATA 2113 <1> ; EAX = 0, if the updated (or current) 2114 <1> ; half buffer is DMA half buffer 1 2115 <1> ; EAX = 1, if the updated (or current) 2116 <1> ; half buffer is DMA half buffer 2 2117 <1> ; (If CF = 1 -> Error code in EAX) 2118 <1> ; 2119 <1> ; 24/05/2024 2120 <1> ; For BH = 17 -> GET VOLUME LEVEL 2121 <1> ; IF BL input is 0 2122 <1> ; Master (Playback, Lineout) volume 2123 <1> ; If BL input is 1 2124 <1> ; PCM out volume 2125 <1> ; If BL input > 1 2126 <1> ; Invalid for now ; 24/05/2024 2127 <1> ; 2128 <1> ; CL = Left Channel Volume (0 to 31 max) 2129 <1> ; CH = Right Channel Volume (0 to 31 max) 2130 <1> ; 2131 <1> 2132 00012062 80FF12 <1> cmp bh, AUDIO1L/4 2133 00012065 0F8323AAFFFF <1> jnb sysret 2134 <1> 2135 0001206B C0E702 <1> shl bh, 2 ; *4 2136 0001206E 0FB6F7 <1> movzx esi, bh 2137 <1> 2138 <1> ; 22/04/2017 2139 00012071 31C0 <1> xor eax, eax 2140 00012073 A3[6C8E0100] <1> mov [u.r0], eax ; 0 2141 <1> 2142 00012078 FF96[83200100] <1> call dword [esi+AUDIO1] 2143 <1> ;jc error 2144 0001207E E90BAAFFFF <1> jmp sysret 2145 <1> 2146 00012083 [C1230000] <1> AUDIO1: dd _beep ; 12/02/2021 2147 <1> ;dd beep ; FUNCTION = 0 (bl = Duration Counter 2148 <1> ; cx = Frequency Divisor 2149 00012087 [CB200100] <1> dd soundc_detect 2150 0001208B [60210100] <1> dd sound_alloc 2151 0001208F [23220100] <1> dd soundc_init 2152 00012093 [07240100] <1> dd sound_play 2153 00012097 [94240100] <1> dd sound_pause 2154 0001209B [BE240100] <1> dd sound_continue 2155 0001209F [E8240100] <1> dd sound_stop 2156 000120A3 [13250100] <1> dd soundc_reset 2157 000120A7 [46250100] <1> dd soundc_cancel 2158 000120AB [6C250100] <1> dd sound_dalloc 2159 000120AF [97250100] <1> dd sound_volume 2160 000120B3 [D7250100] <1> dd soundc_disable 2161 000120B7 [55260100] <1> dd sound_dma_map 2162 000120BB [C3260100] <1> dd soundc_info 2163 000120BF [47270100] <1> dd sound_data 2164 000120C3 [E9270100] <1> dd sound_update 2165 000120C7 [6B280100] <1> dd sound_getvol ; 24/05/2024 2166 <1> %if 0 2167 <1> dd sound_dmaclear ; 29/12/2024 2168 <1> %endif 2169 <1> 2170 <1> AUDIO1L EQU $ - AUDIO1 2171 <1> 2172 <1> soundc_detect: 2173 <1> ; FUNCTION = 1 2174 <1> ; bl = Audio device type number 2175 <1> ; (0 = pc speaker, 1 = sound blaster 16, 2 = intel ac97 2176 <1> ; 3 = via vt823x, 4 = intel HDA, 0FFh = any) 2177 <1> 2178 <1> ; 04/06/2017 2179 <1> ;mov ah, [audio_device] 2180 <1> ; 11/01/2025 2181 000120CB A0[E5880100] <1> mov al, [audio_device] 2182 000120D0 80FBFF <1> cmp bl, 0FFh ; get current audio device id 2183 000120D3 7408 <1> je short sysaudio0 2184 <1> 2185 <1> ;and ah, ah 2186 <1> ; 11/01/2025 2187 000120D5 20C0 <1> and al, al 2188 000120D7 741F <1> jz short soundc_get_dev 2189 <1> 2190 <1> ;cmp ah, bl 2191 <1> ; 11/01/2025 2192 000120D9 38D8 <1> cmp al, bl 2193 000120DB 7568 <1> jne short soundc_dev_err 2194 <1> 2195 <1> sysaudio0: 2196 <1> ;mov al, [audio_mode] 2197 <1> ; 11/01/2025 2198 000120DD 8A25[1D890100] <1> mov ah, [audio_mode] 2199 <1> sysaudio1: 2200 000120E3 A3[6C8E0100] <1> mov [u.r0], eax 2201 000120E8 8B1D[F0880100] <1> mov ebx, [audio_vendor] ; (DEVICE/VENDOR ID) 2202 000120EE 8B2D[688E0100] <1> mov ebp, [u.usp] 2203 000120F4 895D10 <1> mov [ebp+16], ebx ; ebx 2204 000120F7 C3 <1> retn 2205 <1> 2206 <1> soundc_get_dev: 2207 <1> ; 28/05/2017 2208 <1> ; 03/04/2017, 24/04/2017 2209 000120F8 C605[E4880100]00 <1> mov byte [audio_pci], 0 2210 000120FF 80FB03 <1> cmp bl, 3 ; VIA VT8233 (VT8237R) Audio Controller & AC97 Codec 2211 <1> ;jne short soundc_get_dev_sb 2212 <1> ; 28/05/2017 2213 00012102 7220 <1> jb short soundc_get_dev_sb 2214 00012104 773F <1> ja short soundc_dev_err ; temporary (28/05/2017) 2215 <1> ; 2216 00012106 E892180000 <1> call DetectVT8233 2217 0001210B 7238 <1> jc short soundc_dev_err 2218 <1> ; eax = 0 2219 <1> 2220 <1> ;mov ebx, [audio_vendor] 2221 <1> ; ebx = DEVICE/VENDOR ID 2222 <1> ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 2223 <1> 2224 0001210D B003 <1> mov al, 3 ; VIA VT8237R (VT3233) Audio Controller 2225 0001210F 88C4 <1> mov ah, al 2226 <1> 2227 <1> soundc_get_pci_dev_ok: ; 28/05/2017 2228 00012111 FE05[E4880100] <1> inc byte [audio_pci] ; = 1 2229 <1> soundc_get_dev_ok: 2230 <1> 2231 <1> soundc_get_dev_sb16_ok: 2232 00012117 A2[E5880100] <1> mov [audio_device], al 2233 0001211C 8825[1D890100] <1> mov [audio_mode], ah ; stereo (bit0), 16 bit (bit1) capability 2234 00012122 EBBF <1> jmp short sysaudio1 2235 <1> 2236 <1> soundc_get_dev_sb: 2237 <1> ; 24/04/2017 2238 00012124 80FB01 <1> cmp bl, 1 ; Sound Blaster 16 2239 00012127 750E <1> jne short soundc_get_dev_ich ; 28/05/2017 2240 <1> ; 2241 00012129 E8431D0000 <1> call DetectSB 2242 0001212E 7215 <1> jc short soundc_dev_err 2243 00012130 B801030000 <1> mov eax, 0301h ; Sound Blaster 16 2244 00012135 EBE0 <1> jmp short soundc_get_dev_sb16_ok 2245 <1> 2246 <1> soundc_get_dev_ich: 2247 <1> ; 28/05/2017 2248 <1> ;cmp bl, 2 ; Intel AC'97 Audio Controller (ICH) 2249 <1> ;jne short soundc_dev_err ; Temporary (28/05/2017) 2250 <1> ; ; (Here will be modified just after 2251 <1> ; ; new sound card code will be ready!) 2252 00012137 E84C180000 <1> call DetectICH 2253 0001213C 7207 <1> jc short soundc_dev_err 2254 <1> ; 2255 0001213E B802030000 <1> mov eax, 0302h ; AC'97 (ICH) 2256 00012143 EBCC <1> jmp short soundc_get_pci_dev_ok 2257 <1> 2258 <1> soundc_dev_err: 2259 00012145 B80F000000 <1> mov eax, ERR_DEV_NOT_RDY ; Device not ready ! 2260 <1> ; 29/07/2022 2261 <1> ;sub eax, eax 2262 <1> ;mov al, ERR_DEV_NOT_RDY 2263 0001214A EB05 <1> jmp short sysaudio_err 2264 <1> 2265 <1> soundc_respond_err: 2266 <1> ; ERR_TIME_OUT ; 'time out !' error 2267 0001214C B819000000 <1> mov eax, ERR_DEV_NOT_RESP ; 'device not responding !' error 2268 <1> ; 29/07/2022 2269 <1> ;sub eax, eax 2270 <1> ;mov al, ERR_DEV_NOT_RESP 2271 <1> sysaudio_err: 2272 00012151 A3[6C8E0100] <1> mov [u.r0], eax 2273 00012156 A3[D88E0100] <1> mov [u.error], eax 2274 0001215B E90EA9FFFF <1> jmp error 2275 <1> 2276 <1> sound_alloc: 2277 <1> ; FUNCTION = 2 2278 <1> ; ecx = audio buffer size (in bytes) 2279 <1> ; edx = audio buffer address (virtual) 2280 <1> ; 28/01/2025 2281 <1> ; 27/01/2025 (BugFix) 2282 <1> ; 15/01/2025 2283 <1> ; 12/01/2025 2284 <1> ; 25/11/2023 2285 <1> ; 27/07/2020 2286 <1> ; 28/05/2027 2287 <1> ; 01/05/2017, 15/05/2017 2288 <1> ; 21/04/2017, 24/04/2017 2289 00012160 803D[E4880100]00 <1> cmp byte [audio_pci], 0 2290 00012167 770F <1> ja short snd_alloc_0 2291 <1> ; Max. 64KB DMA buffer !!! 2292 00012169 81F900800000 <1> cmp ecx, 32768 2293 0001216F 760F <1> jna short snd_alloc_6 2294 <1> ; 25/11/2023 2295 <1> sound_buff_error: 2296 00012171 B82E000000 <1> mov eax, ERR_BUFFER ; Buffer error ! 2297 <1> ; 29/07/2022 2298 <1> ;sub eax, eax 2299 <1> ;mov al, ERR_BUFFER 2300 00012176 EBD9 <1> jmp short sysaudio_err 2301 <1> snd_alloc_0: 2302 <1> ; 25/11/2023 2303 <1> ; Max 128KB DMA buffer size (2 half buffers) 2304 00012178 81F900000100 <1> cmp ecx, 65536 2305 0001217E 77F1 <1> ja short sound_buff_error 2306 <1> snd_alloc_6: 2307 <1> ; 15/05/2017 2308 <1> ;cmp ecx, 4096 ; PAGE_SIZE 2309 <1> ;jb short sound_buff_error 2310 <1> ; 15/01/2025 2311 00012180 81F940010000 <1> cmp ecx, 320 2312 00012186 72E9 <1> jb short sound_buff_error 2313 <1> ; 2314 <1> ; 28/01/2025 2315 <1> ; 12/01/2025 2316 <1> ;mov ebx, edx ; (new) virtual address of audio_buffer 2317 <1> ; 2318 00012188 A1[F8880100] <1> mov eax, [audio_buffer] ; audio buffer address (current) 2319 0001218D 09C0 <1> or eax, eax 2320 <1> ;jz short snd_alloc_2 2321 <1> ; 12/01/2025 2322 0001218F 743E <1> jz short snd_alloc_1 ; first time 2323 <1> ; audio buffer exists ! 2324 00012191 8A1D[BD8E0100] <1> mov bl, [u.uno] 2325 00012197 3A1D[11890100] <1> cmp bl, [audio_user] 2326 <1> ;jne sndc_owner_error ; not owner ! 2327 <1> ; 25/11/2023 2328 <1> ;je short snd_alloc_7 2329 <1> ; 12/01/2025 2330 0001219D 7405 <1> je short snd_alloc_2 2331 0001219F E9F3000000 <1> jmp sndc_owner_error ; not owner ! 2332 <1> 2333 <1> ; 12/01/2025 - TRDOS 386 v2.0.10 2334 <1> ; Important modification: 2335 <1> ;; Always deallocate user's audio_buffer address with 2336 <1> ;; buffer size and then allocate a new one 2337 <1> ;; (address range may be used before) 2338 <1> snd_alloc_2: 2339 <1> ;mov ecx, [audio_buff_size] 2340 <1> ; 28/01/2025 2341 000121A4 870D[00890100] <1> xchg ecx, [audio_buff_size] ; * 2342 000121AA 89C3 <1> mov ebx, eax ; audio buffer address (current) 2343 <1> ;snd_alloc_7: 2344 <1> ; 12/01/2025 2345 <1> ;cmp eax, edx ; same virtual buffer address ? 2346 <1> ;jne short snd_alloc_1 2347 <1> ;cmp ecx, [audio_buff_size] 2348 <1> ;je short snd_alloc_3 ; Nothing to do ! 2349 <1> ; ; Buffer has been set already! 2350 <1> ;snd_alloc_1: 2351 <1> ; 28/01/2025 2352 <1> ;push ecx 2353 000121AC 52 <1> push edx 2354 <1> ; 12/01/2025 2355 <1> ;mov ebx, eax ; audio buffer address (current) 2356 <1> ;mov ecx, [audio_buff_size] 2357 <1> ; ebx = audio buffer address (virtual) 2358 <1> ; ecx = audio buffer size in bytes 2359 000121AD E8EB3EFFFF <1> call deallocate_user_pages 2360 000121B2 5A <1> pop edx 2361 <1> ;pop ecx 2362 <1> ; 28/01/2025 2363 000121B3 8B0D[00890100] <1> mov ecx, [audio_buff_size] ; * ; requested size 2364 000121B9 31C0 <1> xor eax, eax ; 0 2365 000121BB A3[F8880100] <1> mov [audio_buffer], eax ; 0 2366 000121C0 A3[FC880100] <1> mov [audio_p_buffer], eax ; 0 2367 000121C5 A3[00890100] <1> mov [audio_buff_size], eax 2368 000121CA A2[11890100] <1> mov [audio_user], al ; 0 2369 <1> 2370 <1> ; 27/01/2025 (BugFix) 2371 <1> snd_alloc_1: 2372 <1> ; 12/01/2025 2373 <1> ;snd_alloc_2: 2374 000121CF 89D3 <1> mov ebx, edx 2375 <1> ; 01/05/2017 2376 <1> ;mov edx, ~PAGE_OFF ; truncating page offsets 2377 <1> ; ; for aligning to page borders 2378 <1> ;;and eax, edx 2379 <1> ;and ebx, edx 2380 <1> ; 26/11/2023 2381 <1> ;and ecx, edx 2382 000121D1 81E300F0FFFF <1> and ebx, ~PAGE_OFF 2383 000121D7 89CA <1> mov edx, ecx 2384 <1> ; 15/05/2017 2385 <1> ; EAX = Beginning address (physical) 2386 <1> ; EAX = 0 -> Allocate mem block from the 1st proper aperture 2387 <1> ; ECX = Number of bytes to be allocated 2388 000121D9 E8673BFFFF <1> call allocate_memory_block 2389 000121DE 7291 <1> jc short sound_buff_error 2390 <1> 2391 <1> ; EAX = Physical address of the allocated memory block 2392 <1> ; ECX = Allocated bytes (as rounded up to page border) 2393 <1> ; EBX = Virtual address (as truncated to page border) 2394 000121E0 52 <1> push edx ; 26/11/2023 2395 000121E1 50 <1> push eax 2396 000121E2 53 <1> push ebx 2397 000121E3 51 <1> push ecx 2398 000121E4 E89C3FFFFF <1> call allocate_user_pages 2399 000121E9 59 <1> pop ecx 2400 000121EA 5B <1> pop ebx 2401 000121EB 58 <1> pop eax 2402 000121EC 5A <1> pop edx ; 26/11/2023 2403 000121ED 722A <1> jc short snd_alloc_4 ; insufficient memory, buff error 2404 <1> ; eax = physical address of the user's audio buffer 2405 <1> ; ebx = virtual address of the user's audio buffer 2406 <1> ; 26/11/2023 2407 <1> ; ecx = allocated buffer size (in bytes) 2408 <1> ; -rounded up to page boundary- 2409 <1> ; edx = requested buffer size (in bytes) 2410 000121EF A3[FC880100] <1> mov [audio_p_buffer], eax 2411 000121F4 891D[F8880100] <1> mov [audio_buffer], ebx 2412 <1> ; 26/11/2023 2413 <1> ;mov ecx, edx 2414 <1> ;; 25/11/2023 2415 <1> ;cmp ecx, 65536 2416 <1> ;jb short snd_alloc_5 2417 <1> ;dec ecx 2418 <1> ;; ecx = 65535 2419 <1> ;; (DMA half buffer's sample count must be < 65536) 2420 <1> ;snd_alloc_5: 2421 <1> ;mov [audio_buff_size], ecx 2422 <1> ; 26/11/2023 2423 000121FA 8915[00890100] <1> mov [audio_buff_size], edx 2424 <1> ; 2425 00012200 8A15[BD8E0100] <1> mov dl, [u.uno] 2426 00012206 8815[11890100] <1> mov [audio_user], dl 2427 0001220C A3[6C8E0100] <1> mov [u.r0], eax 2428 <1> snd_alloc_3: 2429 <1> ; 27/07/2020 2430 00012211 C605[10890100]00 <1> mov byte [audio_flag], 0 ; clear dma half buffer flag 2431 <1> ; 2432 00012218 C3 <1> retn 2433 <1> snd_alloc_4: 2434 <1> ; 15/05/2017 2435 <1> ; EAX = Beginning address (physical) 2436 <1> ; ECX = Number of bytes to be deallocated 2437 00012219 E8413DFFFF <1> call deallocate_memory_block 2438 0001221E E94EFFFFFF <1> jmp sound_buff_error ; insufficient memory, buff error 2439 <1> 2440 <1> soundc_init: 2441 <1> ; FUNCTION = 3 2442 <1> ; bl = method (0= s.r.b., 1= callback, 2= auto incr s.r.b.) 2443 <1> ; cl = signal response byte (initial or fixed) value 2444 <1> ; edx = signal response byte or callback address 2445 <1> 2446 <1> ; 11/01/2025 2447 <1> ; 05/06/2024 2448 <1> ; 04/06/2024 2449 <1> ; 02/12/2023, 04/12/2022 2450 <1> ; 29/07/2022, 07/08/2022 2451 <1> ; 27/07/2020 2452 <1> ; 12/05/2017, 20/05/2017, 28/05/2027 2453 <1> ; 22/04/2017, 23/04/2017, 24/04/2017 2454 <1> ; 13/04/2017, 14/04/2017, 16/04/2017, 21/04/2017 2455 <1> ; 03/04/2017, 10/04/2017 2456 <1> 2457 00012223 A0[E5880100] <1> mov al, [audio_device] 2458 00012228 20C0 <1> and al, al 2459 0001222A 754A <1> jnz short sndc_init6 2460 <1> ; 2461 0001222C C605[E4880100]00 <1> mov byte [audio_pci], 0 2462 00012233 52 <1> push edx 2463 00012234 53 <1> push ebx 2464 00012235 51 <1> push ecx 2465 00012236 E8361C0000 <1> call DetectSB 2466 0001223B 7213 <1> jc short sndc_init8 2467 0001223D 66B80103 <1> mov ax, 0301h ; Sound Blaster 16 2468 00012241 EB1E <1> jmp short sndc_init7 2469 <1> 2470 <1> sndc_init11: 2471 <1> ; 28/05/2017 2472 00012243 E840170000 <1> call DetectICH ; Detect AC'97 (ICH) Audio Controller 2473 00012248 7217 <1> jc short sndc_init7 2474 0001224A 66B80203 <1> mov ax, 0302h ; Intel AC'97 Audio Device 2475 0001224E EB0B <1> jmp short sndc_init12 ; (PCI device) 2476 <1> 2477 <1> sndc_init8: 2478 00012250 E848170000 <1> call DetectVT8233 2479 <1> ;jc short sndc_init7 2480 <1> ; 29/07/2022 2481 00012255 72EC <1> jc short sndc_init11 ; 28/05/2017 2482 <1> 2483 <1> ; eax = 0 2484 00012257 B003 <1> mov al, 3 ; VIA VT8237R (VT8233) Audio Controller 2485 00012259 88C4 <1> mov ah, al 2486 <1> 2487 <1> sndc_init12: 2488 0001225B FE05[E4880100] <1> inc byte [audio_pci] ; = 1 2489 <1> sndc_init7: 2490 00012261 59 <1> pop ecx 2491 00012262 5B <1> pop ebx 2492 00012263 5A <1> pop edx 2493 <1> ;jc soundc_dev_err 2494 <1> ; 29/07/2022 2495 00012264 7305 <1> jnc short sndc_init14 2496 00012266 E9DAFEFFFF <1> jmp soundc_dev_err 2497 <1> sndc_init14: 2498 0001226B A2[E5880100] <1> mov [audio_device], al 2499 00012270 8825[1D890100] <1> mov [audio_mode], ah ; stereo (bit0), 16 bit (bit1) capability 2500 <1> 2501 <1> sndc_init6: 2502 00012276 833D[F8880100]00 <1> cmp dword [audio_buffer], 0 2503 <1> ;jna sound_buff_error 2504 <1> ; 29/07/2022 2505 0001227D 7705 <1> ja short sndc_init19 2506 0001227F E9EDFEFFFF <1> jmp sound_buff_error ; 07/08/2022 2507 <1> sndc_init19: 2508 00012284 A0[BD8E0100] <1> mov al, [u.uno] 2509 00012289 8A25[11890100] <1> mov ah, [audio_user] 2510 0001228F 08E4 <1> or ah, ah 2511 00012291 7418 <1> jz short sndc_init0 2512 00012293 38E0 <1> cmp al, ah 2513 00012295 7419 <1> je short sndc_init1 2514 <1> 2515 <1> sndc_owner_error: 2516 00012297 B80B000000 <1> mov eax, ERR_NOT_OWNER ; 'permission denied !' error 2517 <1> ; 29/07/2022 2518 <1> ;sub eax, eax 2519 <1> ;mov al, ERR_NOT_OWNER 2520 <1> sndc_perm_error: 2521 0001229C A3[6C8E0100] <1> mov [u.r0], eax 2522 000122A1 A3[D88E0100] <1> mov [u.error], eax 2523 000122A6 E9C3A7FFFF <1> jmp error 2524 <1> sndc_init0: 2525 000122AB A2[11890100] <1> mov [audio_user], al 2526 <1> sndc_init1: 2527 000122B0 8915[14890100] <1> mov [audio_cb_addr], edx 2528 000122B6 881D[12890100] <1> mov [audio_cb_mode], bl 2529 000122BC 880D[13890100] <1> mov [audio_srb], cl 2530 <1> 2531 <1> ; 27/07/2020 2532 <1> ;mov byte [audio_flag], 0 ; clear dma half buffer flag 2533 <1> 2534 <1> ; 24/04/2017 2535 000122C2 803D[E5880100]03 <1> cmp byte [audio_device], 3 ; VT8233 (VT8237R) 2536 000122C9 7435 <1> je short sndc_init9 2537 <1> ;ja short soundc_respond_err ; temporary (28/05/2017) 2538 000122CB 803D[E5880100]01 <1> cmp byte [audio_device], 1 ; SB 16 2539 000122D2 7510 <1> jne short sndc_init13 2540 000122D4 BB[83400100] <1> mov ebx, sb16_int_handler 2541 <1> ; Note: 'SbInit' is at 'Start to Play' stage 2542 <1> ; 20/05/2017 2543 000122D9 66C705[20890100]08- <1> mov word [audio_master_volume], 0808h ; 2/8 2543 000122E1 08 <1> 2544 000122E2 EB34 <1> jmp short sndc_init10 2545 <1> sndc_init13: 2546 <1> ; 28/05/2017 2547 000122E4 803D[E5880100]02 <1> cmp byte [audio_device], 2 ; AC 97 (ICH) 2548 <1> ;jne soundc_respond_err ; temporary (28/05/2017) 2549 <1> ; 29/07/2022 2550 000122EB 7405 <1> je short sndc_init16 2551 <1> sndc_init15: 2552 000122ED E95AFEFFFF <1> jmp soundc_respond_err 2553 <1> sndc_init16: 2554 000122F2 E8D41E0000 <1> call ac97_codec_config 2555 <1> ;jc soundc_respond_err ; codec error ! 2556 <1> ; 29/07/2022 2557 000122F7 72F4 <1> jc short sndc_init15 2558 <1> 2559 000122F9 BB[65440100] <1> mov ebx, ac97_int_handler 2560 000122FE EB18 <1> jmp short sndc_init10 2561 <1> 2562 <1> sndc_init9: 2563 <1> ;call reset_codec 2564 <1> ;; eax = 1 2565 <1> ;call codec_io_w16 ; w32 2566 00012300 E8EC170000 <1> call init_codec ; 28/05/2017 2567 <1> ;jc soundc_respond_err ; codec error ! 2568 <1> ; 29/07/2022 2569 00012305 72E6 <1> jc short sndc_init15 2570 <1> 2571 00012307 E8FA190000 <1> call channel_reset 2572 <1> 2573 <1> ; setup the Codec (actually mixer registers) 2574 0001230C E823190000 <1> call codec_config ; unmute codec, set rates. 2575 <1> ;jc soundc_respond_err ; codec error ! 2576 <1> ; 29/07/2022 2577 00012311 72DA <1> jc short sndc_init15 2578 <1> 2579 00012313 BB[9A3C0100] <1> mov ebx, vt8233_int_handler 2580 <1> sndc_init10: 2581 <1> ; 13/04/2017 2582 00012318 A0[E6880100] <1> mov al, [audio_intr] ; IRQ number 2583 0001231D E833FDFFFF <1> call set_dev_IRQ_service 2584 <1> 2585 <1> ; SETUP (audio) INTERRUPT CALLBACK SERVICE 2586 00012322 8A1D[E6880100] <1> mov bl, [audio_intr] ; IRQ number 2587 00012328 8A3D[12890100] <1> mov bh, [audio_cb_mode] 2588 0001232E FEC7 <1> inc bh ; 1 = Signal Response Byte method (fixed value) 2589 <1> ; 2 = Callback service method 2590 <1> ; 3 = Auto Increment S.R.B. method 2591 00012330 8A0D[13890100] <1> mov cl, [audio_srb] 2592 00012336 8B15[14890100] <1> mov edx, [audio_cb_addr] 2593 0001233C A0[11890100] <1> mov al, [audio_user] 2594 <1> ; 14/04/2017 2595 00012341 E83C050000 <1> call set_irq_callback_service 2596 <1> ; 16/04/2017 2597 00012346 A3[6C8E0100] <1> mov [u.r0], eax 2598 <1> ;jnc sysret 2599 0001234B 7316 <1> jnc short sndc_init2 ; 21/04/2017 2600 <1> ; 2601 0001234D A3[D88E0100] <1> mov dword [u.error], eax 2602 <1> 2603 00012352 A0[E6880100] <1> mov al, [audio_intr] ; IRQ number 2604 00012357 31DB <1> xor ebx, ebx ; reset IRQ handler address 2605 00012359 E8F7FCFFFF <1> call set_dev_IRQ_service 2606 <1> 2607 0001235E E90BA7FFFF <1> jmp error 2608 <1> 2609 <1> sndc_init2: 2610 <1> ; 21/04/2017 2611 00012363 8B0D[00890100] <1> mov ecx, [audio_buff_size] ; audio buffer size 2612 <1> ; 05/06/2024 2613 <1> ;shl ecx, 1 ; *2 2614 <1> 2615 <1> ; 05/06/2024 2616 00012369 A0[E5880100] <1> mov al, [audio_device] 2617 0001236E 3C01 <1> cmp al, 1 ; SB16 2618 00012370 760A <1> jna short sndc_init22 2619 00012372 80E1FE <1> and cl, ~1 ; truncated for word alignment 2620 00012375 3C03 <1> cmp al, 3 ; VT8233 2621 00012377 7303 <1> jnb short sndc_init22 2622 <1> ; al = 2 ; AC'97 2623 00012379 80E1F8 <1> and cl, ~7 ; truncated for 8 byte (8x) alignment 2624 <1> sndc_init22: 2625 <1> ; 05/06/2024 2626 0001237C 890D[0C890100] <1> mov [dma_hbuff_size], ecx ; DMA half buffer size 2627 00012382 D1E1 <1> shl ecx, 1 ; add ecx, ecx ; * 2 2628 <1> 2629 <1> ;;; 2630 <1> ; 04/06/2024 2631 00012384 81C1FF0F0000 <1> add ecx, 4095 ; PAGE_SIZE - 1 2632 0001238A 6681E100F0 <1> and cx, ~4095 ; ~PAGE_OFF 2633 <1> ; ecx = page border aligned DMA buffer size (required) (*) 2634 <1> ;;; 2635 <1> 2636 0001238F A1[04890100] <1> mov eax, [audio_dma_buff] 2637 00012394 21C0 <1> and eax, eax 2638 00012396 741C <1> jz short sndc_init3 ; no need to compare dma buff size 2639 <1> 2640 00012398 8B15[08890100] <1> mov edx, [audio_dmabuff_size] ; dma buffer size 2641 0001239E 39D1 <1> cmp ecx, edx 2642 000123A0 742B <1> je short sndc_init5 2643 <1> 2644 <1> ; 04/12/2023 2645 000123A2 3D00000500 <1> cmp eax, sb16_dma_buffer ; reserved buffer ? 2646 000123A7 7409 <1> je short sndc_init20 ; it isn't an allocated mem buff 2647 <1> 2648 000123A9 87CA <1> xchg ecx, edx 2649 <1> ; 26/11/2023 2650 <1> ; round up (always -rounded up- page count is allocated) 2651 <1> ; ((so deallocation must be done for the rounded up value)) 2652 <1> ;add ecx, PAGE_SIZE - 1 ; 4095 2653 <1> ;call deallocate_memory_block 2654 <1> ; 04/06/2024 2655 <1> ;call deallocate_memory_block_x 2656 <1> ; ; deallocate ((ecx+4095)>>12) pages 2657 000123AB E8AF3BFFFF <1> call deallocate_memory_block 2658 <1> 2659 000123B0 87D1 <1> xchg edx, ecx 2660 <1> sndc_init20: 2661 000123B2 31C0 <1> xor eax, eax 2662 <1> sndc_init3: 2663 <1> ; 05/06/2024 2664 000123B4 890D[08890100] <1> mov [audio_dmabuff_size], ecx ; (*) 2665 <1> ; 12/05/2017 2666 000123BA 803D[E5880100]01 <1> cmp byte [audio_device], 1 ; SB 16 2667 000123C1 750B <1> jne short sndc_init4 2668 000123C3 C705[04890100]0000- <1> mov dword [audio_dma_buff], sb16_dma_buffer 2668 000123CB 0500 <1> 2669 <1> ; 05/06/2024 2670 <1> ;mov dword [audio_dmabuff_size], 65536 2671 <1> ;xor eax, eax 2672 <1> ;mov [u.r0], eax ; 0 = no error, successful 2673 <1> sndc_init5: ; 29/07/2022 2674 000123CD C3 <1> retn 2675 <1> 2676 <1> sndc_init4: 2677 <1> ; 02/12/2023 - TRDOS 386 v2.0.7 2678 000123CE 81F900000100 <1> cmp ecx, 65536 2679 000123D4 7707 <1> ja short sndc_init21 2680 000123D6 B800000500 <1> mov eax, sb16_dma_buffer ; use already reserved buffer 2681 000123DB EB0C <1> jmp short sndc_init17 2682 <1> 2683 <1> sndc_init21: 2684 <1> ; EAX = Beginning address (physical) 2685 <1> ; EAX = 0 -> Allocate mem block from the 1st proper aperture 2686 <1> ; ECX = Number of bytes to be allocated (>0) 2687 000123DD E86339FFFF <1> call allocate_memory_block 2688 <1> ;jc sound_buff_error 2689 <1> ; 29/07/2022 2690 000123E2 7305 <1> jnc short sndc_init17 2691 000123E4 E988FDFFFF <1> jmp sound_buff_error 2692 <1> 2693 <1> sndc_init17: ; 29/07/2022 2694 <1> ; set dma buffer address and size parameters 2695 000123E9 A3[04890100] <1> mov [audio_dma_buff], eax ; dma buffer address 2696 <1> ; 05/06/2024 2697 <1> ;mov [audio_dmabuff_size], ecx ; dma buffer size 2698 <1> 2699 <1> ;;; 2700 <1> ; 05/06/2024 2701 000123EE 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] ; DMA half (1-2) buffer size 2702 <1> ; 04/06/2024 2703 <1> ;mov ecx, [audio_buff_size] ; audio buffer size in bytes 2704 <1> ;;; 2705 <1> 2706 <1> ; ; EAX = Beginning (physical) addr of the allocated mem block 2707 <1> ; ; ECX = Num of allocated bytes (rounded up to page borders) 2708 <1> ; cmp byte [audio_pci], 0 ; AC97 audio controller ? 2709 <1> ; ja short sndc_init4 2710 <1> ; 2711 <1> ; ; Sound Blaster 16 uses classic DMA 2712 <1> ; mov edx, eax 2713 <1> ; add edx, ecx 2714 <1> ; cmp edx, 1000000h ; 1st 16 MB 2715 <1> ; jna short sndc_init4 2716 <1> ; 2717 <1> ; ; error ! 2718 <1> ; ; restore Memory Allocation Table Content 2719 <1> ; ; EAX = Beginning address (physical) 2720 <1> ; ; ECX = Number of bytes to be deallocated 2721 <1> ; call deallocate_memory_block 2722 <1> ; ; reset dma buffer address and size parameters 2723 <1> ; xor eax, eax ; 0 2724 <1> ; mov [audio_dma_buff], eax ; 0 2725 <1> ; mov [audio_dmabuff_size], ecx ; 0 2726 <1> ; jmp sound_buff_error 2727 <1> ; 2728 <1> ;sndc_init4: 2729 000123F4 803D[E5880100]03 <1> cmp byte [audio_device], 3 2730 <1> ;jne short sndc_init5 2731 <1> ; 29/07/2022 2732 000123FB 7505 <1> jne short sndc_init18 ; 28/05/2017 2733 <1> 2734 <1> ; 29/07/2022 2735 <1> ; call set_vt8233_bdl 2736 <1> ;sndc_init5: 2737 <1> ; ;sub eax, eax ; 0 2738 <1> ; ;mov [u.r0], eax ; 0 = no error, successful 2739 <1> ; retn 2740 <1> 2741 <1> ; 05/06/2024 2742 <1> ;;; 2743 <1> ; 04/06/2024 (use truncated buffer size for BDL setup) 2744 <1> ; NOTE: Round up adds spurious bytes (noise) to the DMA buff; 2745 <1> ; so, round down the size is better than the round up. 2746 <1> ; ((BDL/SGD feature needs word aligned buffer address)) 2747 <1> ; 2748 <1> ;mov ecx, [audio_buff_size] ; audio buffer size in bytes 2749 <1> ;and cl, ~1 2750 <1> ; 05/06/2024 2751 <1> ;mov [dma_hbuff_size], ecx 2752 <1> ; ecx = DMA half buffer size as word aligned 2753 <1> ; (in fact, half buffer is one of the two DMA buffers) 2754 <1> ;;; 2755 <1> 2756 000123FD E93E190000 <1> jmp set_vt8233_bdl 2757 <1> 2758 <1> sndc_init18: 2759 <1> ;call set_ac97_bdl 2760 <1> ;;jmp short sndc_init5 2761 <1> ;retn 2762 <1> 2763 <1> ; 05/06/2024 2764 <1> ;;; 2765 <1> ;;; 2766 <1> ; 04/06/2024 (use truncated buffer size for BDL setup) 2767 <1> ; NOTE: Round up adds spurious bytes (noise) to the DMA buff; 2768 <1> ; so, round down the size is better than the round up. 2769 <1> ; ((BDL feature needs 8 byte aligned buffer address)) 2770 <1> ; 2771 <1> ;mov ecx, [audio_buff_size] ; audio buffer size in bytes 2772 <1> ;and cl, ~7 2773 <1> ; 05/06/2024 2774 <1> ;mov [dma_hbuff_size], ecx 2775 <1> ; ecx = DMA half buffer size as truncated for 8 byte alignment 2776 <1> ; (in fact, half buffer is one of the two DMA buffers) 2777 <1> ;;; 2778 <1> 2779 <1> ; 29/07/2022 2780 00012402 E96A1F0000 <1> jmp set_ac97_bdl 2781 <1> 2782 <1> sound_play: 2783 <1> ; FUNCTION = 4 2784 <1> ; bl = Mode 2785 <1> ; bit 0 = mono/stereo (1 = stereo) 2786 <1> ; bit 1 = 8 bit / 16 bit (1 = 16 bit) 2787 <1> ; cx = Sampling Rate (Hz) 2788 <1> 2789 <1> ; 13/06/2017 2790 <1> ; Note: Even if Mode bits are not 11b, 2791 <1> ; AC'97 Audio Controller (&Codec) 2792 <1> ; will play audio samples as 16 bit, stereo 2793 <1> ; samples. 2794 <1> ; (Program must fill the audio buffer 2795 <1> ; as required; 8 bit samples must be converted 2796 <1> ; to 16 bit samples and mono samples must be 2797 <1> ; converted to stereo samples...) 2798 <1> 2799 <1> ; 19/12/2024 (BugFix) 2800 <1> ; 05/06/2024 2801 <1> ; 04/06/2024 2802 <1> ; 30/07/2022 2803 <1> ; 28/07/2020 2804 <1> ; 27/07/2020 2805 <1> ; 28/05/2017 2806 <1> ; 15/05/2017, 20/05/2017 2807 <1> ; 21/04/2017, 24/04/2017 2808 <1> ; ... device check at first 2809 00012407 A0[E5880100] <1> mov al, [audio_device] 2810 0001240C 08C0 <1> or al, al ; 0 ; pc speaker or invalid 2811 <1> ;jz beeper_gfx ; 'video.s' ; temporary 2812 <1> ; 30/07/022 2813 0001240E 7505 <1> jnz short snd_play_7 2814 00012410 E9BDFFFEFF <1> jmp beeper_gfx 2815 <1> 2816 <1> snd_play_7: 2817 <1> ; cmp al, 3 ; VIA VT 8237R (vt8233) 2818 <1> ; je short snd_play_1 2819 <1> ; cmp al, 1 ; SB 16 2820 <1> ; jne soundc_dev_err ; temporary ! 2821 <1> ;snd_play_0: 2822 <1> ; ... buffer & (buffer) owner check at second 2823 00012415 833D[F8880100]00 <1> cmp dword [audio_buffer], 0 2824 <1> ;jna sound_buff_error 2825 <1> ; 30/07/2022 2826 0001241C 763C <1> jna short snd_play_4 ; jmp sound_buff_error 2827 0001241E A0[BD8E0100] <1> mov al, [u.uno] 2828 00012423 3A05[11890100] <1> cmp al, [audio_user] 2829 <1> ;jne sndc_owner_error 2830 <1> ; 30/07/2022 2831 00012429 7405 <1> je short snd_play_3 2832 0001242B E967FEFFFF <1> jmp sndc_owner_error 2833 <1> snd_play_3: 2834 00012430 66890D[1A890100] <1> mov [audio_freq], cx ; sample frequency (Hertz) 2835 00012437 88D8 <1> mov al, bl 2836 00012439 2401 <1> and al, 1 ; mono/stereo (1= stereo) 2837 0001243B FEC0 <1> inc al ; channels 2838 0001243D A2[19890100] <1> mov [audio_stmo], al ; sound channels (1 or 2) 2839 00012442 B008 <1> mov al, 8 2840 00012444 F6C302 <1> test bl, 2 ; bits per sample (1= 16 bit) 2841 00012447 7402 <1> jz short snd_play_bps 2842 00012449 D0E0 <1> shl al, 1 2843 <1> snd_play_bps: 2844 0001244B A2[18890100] <1> mov [audio_bps], al 2845 <1> 2846 <1> ; Transfer ring 3 (user's) audio buffer content to dma buffer 2847 00012450 8B3D[04890100] <1> mov edi, [audio_dma_buff] ; dma buffer (ring 0) 2848 00012456 09FF <1> or edi, edi 2849 <1> ;jz sound_buff_error 2850 <1> ; 30/07/2022 2851 00012458 7505 <1> jnz short snd_play_5 2852 <1> snd_play_4: 2853 0001245A E912FDFFFF <1> jmp sound_buff_error 2854 <1> snd_play_5: 2855 <1> ; 27/07/2020 2856 0001245F 8B35[FC880100] <1> mov esi, [audio_p_buffer] ; physical address (ring 3) 2857 <1> ;mov ecx, [audio_buff_size] ; 15/05/2017 2858 <1> 2859 <1> ; 04/06/2024 2860 <1> %if 0 2861 <1> mov ecx, [audio_dmabuff_size] ; 27/07/2020 2862 <1> ;or ecx, ecx 2863 <1> ;jz sound_buff_error 2864 <1> ; 28/07/2020 2865 <1> shr ecx, 1 ; dma half buffer size 2866 <1> %else 2867 <1> ; 05/06/2024 2868 00012465 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] ; DMA half buffer size 2869 <1> 2870 <1> ; 04/06/2024 2871 <1> ;mov ecx, [audio_buff_size] 2872 <1> ; 19/12/2024 (BugFix) 2873 0001246B A0[E5880100] <1> mov al, [audio_device] 2874 <1> ; 2875 <1> ;cmp al, 1 ; Sound Blaster 16 2876 <1> ;je short snd_play_8 2877 <1> ;and cl, ~1 2878 <1> ;cmp al, 3 ; VT8233 (VT8237R) 2879 <1> ;je short snd_play_8 2880 <1> ; AC'97 2881 <1> ;and cl, ~7 2882 <1> snd_play_8: 2883 <1> %endif 2884 <1> 2885 00012470 8035[10890100]01 <1> xor byte [audio_flag], 1 ; 0 -> 1, 1 -> 0 2886 00012477 7502 <1> jnz short snd_play_0 ; [audio_flag] = 1 2887 <1> ; fill dma half buffer 1 2888 <1> ; [audio_flag] = 0 2889 <1> 2890 <1> ; fill dma half buffer 2 2891 00012479 01CF <1> add edi, ecx 2892 <1> 2893 <1> snd_play_0: 2894 <1> ; 05/06/2024 2895 <1> ;;rep movsb 2896 <1> ;shr ecx, 2 ; convert byte count to dword count 2897 <1> ;rep movsd ; 2898 0001247B F3A4 <1> rep movsb ; SB16, AC97, VT8233 2899 <1> 2900 <1> ; here, if [audio_flag] = 0, interrupt handler will update 2901 <1> ; dma half buffer 2 2902 <1> ; (user's audio buffer data will be 2903 <1> ; copied into dma half buffer 2) 2904 <1> ;; 20/05/2017 2905 <1> ;mov byte [audio_flag], 1 ; next half (on next time) 2906 <1> 2907 <1> ; 24/04/2017 2908 <1> ;mov al, [audio_device] 2909 <1> ; 04/06/2024 2910 <1> ; al = [audio_device] 2911 <1> 2912 0001247D 3C03 <1> cmp al, 3 ; VT8233 (VT8237R) 2913 0001247F 7409 <1> je short snd_play_1 2914 00012481 3C01 <1> cmp al, 1 ; Sound Blaster 16 2915 00012483 750A <1> jne short snd_play_2 ; 28/05/2017 2916 <1> 2917 <1> ; 30/07/2022 2918 <1> ; call SbInit_play 2919 <1> ; ;jc soundc_respond_err 2920 <1> ; ;retn 2921 <1> ; ; 30/07/2022 2922 <1> ; jnc short snd_play_6 ; retn 2923 <1> ; jmp soundc_respond_err 2924 <1> 2925 <1> ; 30/07/2022 2926 00012485 E9A71A0000 <1> jmp SbInit_play ; sb16_start_play 2927 <1> 2928 <1> snd_play_1: 2929 <1> ;call vt8233_start_play 2930 <1> ;retn 2931 <1> ; 30/07/2022 2932 0001248A E9E5180000 <1> jmp vt8233_start_play 2933 <1> 2934 <1> snd_play_2: 2935 <1> ; 28/05/2017 2936 <1> ;cmp al, 2 ; AC'97 2937 <1> ;jne short snd_play_3 2938 <1> 2939 <1> ;call ac97_start_play 2940 <1> ;retn 2941 <1> ; 30/07/2022 2942 0001248F E90E1F0000 <1> jmp ac97_start_play 2943 <1> 2944 <1> ;snd_play_3: 2945 <1> ; ;call hda_start_play 2946 <1> ; retn 2947 <1> ; 30/07/2022 2948 <1> ;jmp hda_start_play 2949 <1> 2950 <1> ; 04/06/2024 2951 <1> ;snd_play_6: 2952 <1> ; ; 30/07/2022 2953 <1> ; retn 2954 <1> 2955 <1> sound_pause: 2956 <1> ; FUNCTION = 5 2957 <1> ; Pause 2958 <1> ; 28/05/2017 2959 <1> ; 24/04/2017 2960 <1> ; 22/04/2017 2961 00012494 E82B030000 <1> call snd_dev_check 2962 00012499 7277 <1> jc short snd_nothing ; temporary. 2963 0001249B E831030000 <1> call snd_buf_check 2964 000124A0 7270 <1> jc short snd_nothing ; temporary. 2965 000124A2 A0[E5880100] <1> mov al, [audio_device] 2966 000124A7 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 2967 000124A9 7409 <1> je short snd_pause_1 2968 000124AB 3C01 <1> cmp al, 1 ; Sound Blaster 16 2969 000124AD 750A <1> jne short snd_pause_2 ; 28/05/2017 2970 000124AF E9501C0000 <1> jmp sb16_pause 2971 <1> snd_pause_1: 2972 000124B4 E970190000 <1> jmp vt8233_pause 2973 <1> snd_pause_2: 2974 <1> ; 28/05/2017 2975 <1> ;cmp al, 2 ; AC'97 2976 <1> ;jne short snd_nothing ; temporary. 2977 000124B9 E9E01F0000 <1> jmp ac97_pause 2978 <1> 2979 <1> sound_continue: 2980 <1> ; FUNCTION = 6 2981 <1> ; Continue to play 2982 <1> ; 28/05/2017 2983 <1> ; 22/04/2017 2984 000124BE E801030000 <1> call snd_dev_check 2985 000124C3 724D <1> jc short snd_nothing ; temporary. 2986 000124C5 E807030000 <1> call snd_buf_check 2987 000124CA 7246 <1> jc short snd_nothing ; temporary. 2988 000124CC A0[E5880100] <1> mov al, [audio_device] 2989 000124D1 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 2990 000124D3 7409 <1> je short snd_cont_1 2991 000124D5 3C01 <1> cmp al, 1 ; Sound Blaster 16 2992 000124D7 750A <1> jne short snd_cont_2 ; 28/05/2017 2993 000124D9 E9481C0000 <1> jmp sb16_continue 2994 <1> snd_cont_1: 2995 000124DE E9F8180000 <1> jmp vt8233_play 2996 <1> snd_cont_2: 2997 <1> ; 28/05/2017 2998 <1> ;cmp al, 2 ; AC'97 2999 <1> ;;jne short snd_nothing ; temporary. 3000 <1> ; 30/07/2022 3001 <1> ;jne short snd_cont_3 3002 000124E3 E9F71E0000 <1> jmp ac97_play 3003 <1> ;snd_cont_3: 3004 <1> ;jmp hda_play 3005 <1> 3006 <1> sound_stop: 3007 <1> ; FUNCTION = 7 3008 <1> ; Stop playing 3009 <1> ; 30/07/2022 3010 <1> ; 28/05/2017 3011 <1> ; 24/05/2017 3012 <1> ; 21/04/2017, 22/04/2017, 24/04/2017 3013 000124E8 E8D7020000 <1> call snd_dev_check 3014 000124ED 7223 <1> jc short snd_nothing ; temporary. 3015 <1> ;call snd_buf_check 3016 000124EF E8E6020000 <1> call snd_user_check ; 24/05/2017 3017 000124F4 721C <1> jc short snd_nothing ; temporary. 3018 <1> 3019 000124F6 A0[E5880100] <1> mov al, [audio_device] 3020 000124FB 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 3021 <1> ;je vt8233_stop 3022 <1> ;; 28/05/2017 3023 <1> ;;ja short snd_nothing 3024 <1> ; 30/07/2022 3025 000124FD 7505 <1> jne short snd_stop_1 3026 000124FF E933180000 <1> jmp vt8233_stop 3027 <1> snd_stop_1: 3028 00012504 3C01 <1> cmp al, 1 ; Sound Blaster 16 3029 <1> ;je sb16_stop 3030 <1> ; 30/07/2022 3031 00012506 7505 <1> jne short snd_stop_2 3032 00012508 E93B1C0000 <1> jmp sb16_stop 3033 <1> snd_stop_2: 3034 <1> ;cmp al, 2 3035 <1> ;;je short ac97_stop 3036 <1> ; 30/07/2022 3037 <1> ;jne short snd_stop_3 3038 0001250D E9831F0000 <1> jmp ac97_stop ; temporary. 3039 <1> ;snd_stop_3: 3040 <1> ;jmp hda_stop 3041 <1> 3042 <1> sndc_cancel_ok: 3043 <1> ; 30/07/2022 3044 <1> sndc_reset_ok: 3045 <1> ; 30/07/2022 3046 <1> snd_nothing: 3047 <1> ; 21/04/2017 3048 00012512 C3 <1> retn 3049 <1> 3050 <1> soundc_reset: 3051 <1> ; FUNCTION = 8 3052 <1> ; Reset Audio Controller 3053 <1> ; 30/07/2022 3054 <1> ; 28/05/2017 3055 <1> ; 22/04/2017 3056 00012513 E8AC020000 <1> call snd_dev_check 3057 00012518 72F8 <1> jc short snd_nothing ; temporary. 3058 0001251A E8B2020000 <1> call snd_buf_check 3059 0001251F 72F1 <1> jc short snd_nothing ; temporary. 3060 <1> 3061 00012521 A0[E5880100] <1> mov al, [audio_device] 3062 <1> ; 30/07/2022 3063 00012526 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 3064 00012528 7207 <1> jb short sndc_reset_1 3065 <1> ;je vt8233_reset 3066 0001252A 77E6 <1> ja short snd_nothing ; temporary. 3067 <1> ;;ja hda_reset 3068 <1> ;ja short sndc_reset_3 3069 <1> ; 30/07/2022 3070 0001252C E904190000 <1> jmp vt8233_reset 3071 <1> sndc_reset_1: 3072 00012531 3C01 <1> cmp al, 1 ; Sound Blaster 16 3073 <1> ;jne ac97_reset 3074 <1> ; 30/07/2022 3075 00012533 750C <1> jne short sndc_reset_2 3076 00012535 E85F1C0000 <1> call sb16_reset 3077 <1> ;jc soundc_respond_err 3078 <1> ;retn 3079 <1> ; 30/07/2022 3080 0001253A 73D6 <1> jnc short sndc_reset_ok 3081 0001253C E90BFCFFFF <1> jmp soundc_respond_err 3082 <1> sndc_reset_2: 3083 <1> ; 30/07/2022 3084 <1> ;cmp al, 2 3085 <1> ;ja short sndc_reset_3 3086 00012541 E914200000 <1> jmp ac97_reset 3087 <1> ;sndc_reset_3: 3088 <1> ;jmp hda_reset 3089 <1> 3090 <1> soundc_cancel: 3091 <1> ; FUNCTION = 9 3092 <1> ; Cancel audio callback service 3093 <1> ; 30/07/2022 3094 <1> ; 22/04/2017 3095 00012546 A0[11890100] <1> mov al, [audio_user] 3096 0001254B 3A05[BD8E0100] <1> cmp al, [u.uno] 3097 00012551 75BF <1> jne short snd_nothing 3098 <1> ; RESET (audio) INTERRUPT CALLBACK SERVICE 3099 00012553 8A1D[E6880100] <1> mov bl, [audio_intr] ; IRQ number 3100 00012559 A0[BD8E0100] <1> mov al, [u.uno] 3101 0001255E 28FF <1> sub bh, bh ; 0 ; unlink IRQ from user service 3102 00012560 E81D030000 <1> call set_irq_callback_service 3103 <1> ;jc sndc_perm_error ; 'permission denied' error 3104 <1> ;retn 3105 <1> ; 30/07/2022 3106 00012565 73AB <1> jnc short sndc_cancel_ok 3107 00012567 E930FDFFFF <1> jmp sndc_perm_error 3108 <1> 3109 <1> sound_dalloc: 3110 <1> ; FUNCTION = 10 3111 <1> ; Deallocate (ring 3) audio buffer 3112 <1> ; 22/04/2017 3113 0001256C A0[11890100] <1> mov al, [audio_user] 3114 00012571 3A05[BD8E0100] <1> cmp al, [u.uno] 3115 00012577 7599 <1> jne short snd_nothing 3116 00012579 8B1D[F8880100] <1> mov ebx, [audio_buffer] 3117 <1> ;or ebx, ebx 3118 <1> ;jz short snd_nothing 3119 0001257F 8B0D[00890100] <1> mov ecx, [audio_buff_size] 3120 00012585 E8133BFFFF <1> call deallocate_user_pages 3121 0001258A 31C0 <1> xor eax, eax 3122 0001258C A3[F8880100] <1> mov [audio_buffer], eax ; 0 3123 00012591 A2[11890100] <1> mov [audio_user], al ; 0 3124 <1> ;sndc_cancel_ok: 3125 00012596 C3 <1> retn 3126 <1> 3127 <1> sound_volume: 3128 <1> ; FUNCTION = 11 3129 <1> ; Set sound volume level 3130 <1> ; 23/05/2024 3131 <1> ; 30/07/2022 3132 <1> ; 28/05/2017 3133 <1> ; 20/05/2017 3134 <1> ; 22/04/2017, 24/04/2017 3135 <1> ; bl = component 3136 <1> ; 0 = master/playback/lineout volume 3137 <1> ; 1 = PCM out volume ; 23/05/2024 3138 <1> ; cl = left channel volume level (0 to 31) 3139 <1> ; ch = right channel volume level (0 to 31) 3140 <1> 3141 00012597 80FB80 <1> cmp bl, 80h 3142 0001259A 720A <1> jb short snd_vol_1 3143 <1> ;ja snd_nothing ; temporary. 3144 <1> ; 30/07/2022 3145 0001259C 7707 <1> ja short snd_vol_0 3146 <1> ; Set volume level for next play (BL>= 80h) 3147 0001259E 66890D[20890100] <1> mov [audio_master_volume], cx 3148 <1> snd_vol_0: 3149 000125A5 C3 <1> retn 3150 <1> snd_vol_1: 3151 <1> ; set volume level immediate (BL< 80h) 3152 <1> ;cmp bl, 0 3153 <1> ;;ja snd_nothing ; temporary. 3154 <1> ; 30/07/2022 3155 <1> ;ja short snd_vol_0 3156 <1> ; 23/05/2024 3157 000125A6 80FB01 <1> cmp bl, 1 3158 000125A9 77FA <1> ja short snd_vol_0 ; temporary 3159 <1> 3160 000125AB E814020000 <1> call snd_dev_check 3161 <1> ;jc snd_nothing ; temporary. 3162 <1> ; 30/07/2022 3163 000125B0 72F3 <1> jc short snd_vol_0 3164 000125B2 E81A020000 <1> call snd_buf_check 3165 <1> ;jc snd_nothing ; temporary. 3166 <1> ; 30/07/2022 3167 000125B7 72EC <1> jc short snd_vol_0 3168 <1> 3169 000125B9 A0[E5880100] <1> mov al, [audio_device] 3170 000125BE 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 3171 <1> ;je vt8233_volume 3172 <1> ; 30/07/2022 3173 000125C0 7207 <1> jb short snd_vol_2 3174 <1> ; 28/05/2017 3175 <1> ;ja snd_nothing ; temporary. 3176 <1> ; 30/07/2022 3177 000125C2 77E1 <1> ja short snd_vol_0 3178 <1> ;ja hda_volume 3179 <1> ; 30/07/2022 3180 000125C4 E985180000 <1> jmp vt8233_volume 3181 <1> snd_vol_2: 3182 <1> ; Sound Blaster 16 3183 000125C9 3C01 <1> cmp al, 1 ; SB 16 3184 <1> ;je sb16_volume 3185 <1> ; 30/07/2022 3186 000125CB 7705 <1> ja short snd_vol_3 3187 000125CD E9011B0000 <1> jmp sb16_volume 3188 <1> snd_vol_3: 3189 <1> ; 30/07/2022 3190 <1> ;cmp al, 2 3191 <1> ;ja short snd_vol_4 3192 000125D2 E9541E0000 <1> jmp ac97_volume 3193 <1> ;snd_vol_4: 3194 <1> ;jmp hda_volume 3195 <1> 3196 <1> soundc_disable: 3197 <1> ; FUNCTION = 12 3198 <1> ; Disable audio device (and unlink DMA memory) 3199 <1> ; 23/08/2024 3200 <1> ; 04/06/2024 3201 <1> ; 30/07/2022 3202 <1> ; 28/05/2017 3203 <1> ; 24/05/2017 3204 <1> ; 22/04/2017 3205 000125D7 E8E8010000 <1> call snd_dev_check 3206 <1> ;jc soundc_dev_err ; temporary. 3207 <1> ; 30/07/2022 3208 000125DC 7305 <1> jnc short snd_disable_4 3209 000125DE E962FBFFFF <1> jmp soundc_dev_err 3210 <1> snd_disable_4: 3211 <1> ;call snd_buf_check 3212 <1> ;;jc sndc_owner_error ; temporary. 3213 <1> ; 30/07/2022 3214 <1> ;jnc short snd_disable_5 3215 <1> ;jmp sndc_owner_error 3216 <1> ;snd_disable_5: 3217 000125E3 A0[E5880100] <1> mov al, [audio_device] 3218 000125E8 3C03 <1> cmp al, 3 ; VIA VT 8237R (vt8233) 3219 000125EA 7414 <1> je short snd_disable_1 3220 <1> ;ja snd_nothing ; temporary. 3221 <1> ; 30/07/2022 3222 000125EC 7766 <1> ja short snd_disable_3 ; retn 3223 000125EE 3C01 <1> cmp al, 1 ; Sound Blaster 16 3224 000125F0 7507 <1> jne short snd_disable_0 3225 000125F2 E8511B0000 <1> call sb16_stop 3226 000125F7 EB0C <1> jmp short snd_disable_2 3227 <1> snd_disable_0: 3228 000125F9 E8971E0000 <1> call ac97_stop 3229 000125FE EB05 <1> jmp short snd_disable_2 3230 <1> snd_disable_1: 3231 00012600 E832170000 <1> call vt8233_stop 3232 <1> snd_disable_2: 3233 00012605 A0[E6880100] <1> mov al, [audio_intr] 3234 <1> 3235 <1> ; 15/01/2025 3236 0001260A 20C0 <1> and al, al 3237 0001260C 740E <1> jz short snd_disable_5 3238 <1> 3239 0001260E 29DB <1> sub ebx, ebx ; 0 = reset 3240 00012610 E840FAFFFF <1> call set_dev_IRQ_service 3241 <1> 3242 <1> ;mov al, [audio_intr] 3243 00012615 28E4 <1> sub ah, ah ; 0 = reset 3244 00012617 E800F8FFFF <1> call set_hardware_int_vector 3245 <1> 3246 <1> snd_disable_5: ; 15/01/2025 3247 0001261C 31C0 <1> xor eax, eax 3248 0001261E A2[E5880100] <1> mov byte [audio_device], al 3249 00012623 A2[E6880100] <1> mov byte [audio_intr], al 3250 00012628 8705[04890100] <1> xchg eax, [audio_dma_buff] 3251 <1> 3252 <1> ; 15/01/2025 3253 0001262E 09C0 <1> or eax, eax 3254 00012630 7422 <1> jz short snd_disable_3 3255 <1> 3256 <1> ; 24/05/2017 3257 <1> ;or eax, eax 3258 <1> ;jz short snd_disable_3 3259 <1> ;cmp eax, sb16_dma_buffer ; default DMA buffer 3260 <1> ;je short snd_disable_3 3261 00012632 803D[E4880100]00 <1> cmp byte [audio_pci], 0 ; AC97 audio controller ? 3262 00012639 7619 <1> jna short snd_disable_3 3263 0001263B C605[E4880100]00 <1> mov byte [audio_pci], 0 3264 <1> 3265 <1> ; 23/08/2024 - bugfix 3266 00012642 3D00000500 <1> cmp eax, sb16_dma_buffer ; reserved buffer ? 3267 00012647 740B <1> je short snd_disable_3 ; it isn't an allocated mem buff 3268 <1> 3269 <1> ;sub ecx, ecx 3270 <1> ;xchg ecx, [audio_dmabuff_size] 3271 00012649 8B0D[08890100] <1> mov ecx, [audio_dmabuff_size] 3272 <1> ; 26/11/2023 3273 <1> ; round up (always -rounded up- page count is allocated) 3274 <1> ; ((so deallocation must be done for the rounded up value)) 3275 <1> ;add ecx, PAGE_SIZE - 1 ; 4095 3276 <1> ;call deallocate_memory_block 3277 <1> ; 04/06/2024 3278 <1> ;call deallocate_memory_block_x 3279 <1> ; deallocate ((ecx+4095)>>12) pages 3280 0001264F E80B39FFFF <1> call deallocate_memory_block 3281 <1> snd_disable_3: 3282 00012654 C3 <1> retn 3283 <1> 3284 <1> sound_dma_map: 3285 <1> ; FUNCTION = 13 3286 <1> ; Map audio dma buff addr to user's buffer addr 3287 <1> ; 30/07/2022 3288 <1> ; 12/05/2017 3289 00012655 21C9 <1> and ecx, ecx 3290 <1> ;jz sound_buff_error 3291 <1> ; 30/07/2022 3292 00012657 7505 <1> jnz short snd_dma_map_3 3293 00012659 E913FBFFFF <1> jmp sound_buff_error 3294 <1> snd_dma_map_3: 3295 0001265E 803D[E5880100]01 <1> cmp byte [audio_device], 1 3296 00012665 722A <1> jb short snd_dma_map_1 3297 <1> snd_dma_map_0: 3298 00012667 A1[04890100] <1> mov eax, [audio_dma_buff] 3299 0001266C 21C0 <1> and eax, eax 3300 0001266E 7421 <1> jz short snd_dma_map_1 3301 <1> ; 3302 00012670 8A1D[11890100] <1> mov bl, [audio_user] 3303 00012676 08DB <1> or bl, bl 3304 00012678 7417 <1> jz short snd_dma_map_1 3305 0001267A 3A1D[BD8E0100] <1> cmp bl, [u.uno] 3306 <1> ;jne sndc_owner_error 3307 <1> ; 30/07/2022 3308 00012680 7405 <1> je short snd_dma_map_4 3309 00012682 E910FCFFFF <1> jmp sndc_owner_error 3310 <1> snd_dma_map_4: 3311 00012687 8B1D[08890100] <1> mov ebx, [audio_dmabuff_size] 3312 0001268D 21DB <1> and ebx, ebx 3313 0001268F 750A <1> jnz short snd_dma_map_2 3314 <1> snd_dma_map_1: 3315 00012691 B800000500 <1> mov eax, sb16_dma_buffer 3316 00012696 BB00000100 <1> mov ebx, 65536 3317 <1> snd_dma_map_2: 3318 0001269B 81C1FF0F0000 <1> add ecx, PAGE_SIZE-1 ; 4095 3319 000126A1 6681E100F0 <1> and cx, ~PAGE_OFF ; not 4095 3320 000126A6 39D9 <1> cmp ecx, ebx 3321 <1> ;ja sound_buff_error 3322 <1> ; 30/07/2022 3323 000126A8 7605 <1> jna short snd_dma_map_6 3324 <1> snd_dma_map_5: 3325 000126AA E9C2FAFFFF <1> jmp sound_buff_error 3326 <1> snd_dma_map_6: 3327 000126AF 50 <1> push eax 3328 000126B0 89D3 <1> mov ebx, edx 3329 000126B2 C1E90C <1> shr ecx, 12 ; byte count to page count 3330 <1> ; eax = physical address of (audio) dma buffer 3331 <1> ; ebx = virtual address of (audio) dma buffer (user's pgdir) 3332 <1> ; ecx = page count (>0) 3333 000126B5 E81539FFFF <1> call direct_memory_access 3334 000126BA 58 <1> pop eax 3335 <1> ;jc sound_buff_error 3336 <1> ; 30/07/2022 3337 000126BB 72ED <1> jc short snd_dma_map_5 3338 000126BD A3[6C8E0100] <1> mov [u.r0], eax 3339 000126C2 C3 <1> retn 3340 <1> 3341 <1> soundc_info: 3342 <1> ; FUNCTION = 14 3343 <1> ; Get Audio Controller Info 3344 <1> ; 19/11/2023 3345 <1> ; 30/07/2022 3346 <1> ; 10/06/2017 3347 <1> ; 05/06/2017 3348 <1> 3349 <1> ;and bl, bl ; 0 3350 <1> ;jz short sndc_info_0 3351 <1> 3352 <1> ; 19/11/2023 3353 000126C3 80FB01 <1> cmp bl, 1 3354 000126C6 7609 <1> jna short sndc_info_0 3355 <1> 3356 <1> ; invalid parameter ! 3357 <1> ; 30/07/2022 3358 <1> ;mov eax, ERR_INV_PARAMETER ; 23 3359 <1> ;sndc_inf_error: 3360 <1> ; mov [u.r0], eax 3361 <1> ; mov [u.error], eax 3362 <1> ; jmp error 3363 <1> ; 30/07/2022 3364 000126C8 29C0 <1> sub eax, eax 3365 000126CA B017 <1> mov al, ERR_INV_PARAMETER ; 23 3366 000126CC E980FAFFFF <1> jmp sysaudio_err 3367 <1> 3368 <1> sndc_info_0: 3369 000126D1 E8EE000000 <1> call snd_dev_check 3370 <1> ;jc soundc_dev_err 3371 <1> ; 30/07/2022 3372 000126D6 7305 <1> jnc short sndc_info_3 3373 <1> snd_data_dev_err: 3374 000126D8 E968FAFFFF <1> jmp soundc_dev_err 3375 <1> sndc_info_3: 3376 <1> ; 19/11/2023 3377 <1> ;cmp bl, 1 3378 <1> ;je short sndc_info_4 3379 000126DD 20DB <1> and bl, bl 3380 000126DF 7546 <1> jnz short sndc_info_4 3381 <1> 3382 000126E1 8B1D[F0880100] <1> mov ebx, [audio_vendor] 3383 000126E7 8B0D[EC880100] <1> mov ecx, [audio_dev_id] 3384 <1> ;mov al, [audio_device] 3385 000126ED 3C02 <1> cmp al, 2 ; AC'97 (ICH) 3386 000126EF 7513 <1> jne short sndc_info_1 3387 <1> ; Intel AC97 (ICH) Audio Controller (=2) 3388 000126F1 668B15[EA880100] <1> mov dx, [NABMBAR] 3389 000126F8 C1E210 <1> shl edx, 16 3390 000126FB 668B15[E8880100] <1> mov dx, [NAMBAR] 3391 00012702 EB07 <1> jmp short sndc_info_2 3392 <1> sndc_info_1: 3393 <1> ; 05/06/2017 3394 <1> ; Note: Intel HDA code (here) is not ready yet! 3395 <1> ; !!! SB16 or VT8233 (VT8237R) !!! 3396 00012704 0FB715[EA880100] <1> movzx edx, word [audio_io_base] 3397 <1> sndc_info_2: 3398 0001270B 88C4 <1> mov ah, al ; [audio_device] 3399 0001270D A0[E6880100] <1> mov al, [audio_intr] 3400 <1> 3401 <1> ; EAX = IRQ Number in AL 3402 <1> ; Audio Device Number in AH 3403 <1> ; EBX = DEV/VENDOR ID 3404 <1> ; (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV) 3405 <1> ; ECX = BUS/DEV/FN 3406 <1> ; (00000000BBBBBBBBDDDDDFFF00000000) 3407 <1> ; EDX = NABMBAR/NAMBAR (for AC97) 3408 <1> ; (Low word, DX = NAMBAR address) 3409 <1> ; EDX = Base IO Addr (DX) for SB16 & VT8233 3410 <1> 3411 <1> ; 10/06/2017 3412 00012712 A3[6C8E0100] <1> mov [u.r0], eax 3413 00012717 8B2D[688E0100] <1> mov ebp, [u.usp] 3414 0001271D 895D10 <1> mov [ebp+16], ebx ; ebx 3415 00012720 895514 <1> mov [ebp+20], edx ; edx 3416 00012723 894D18 <1> mov [ebp+24], ecx ; ecx 3417 <1> 3418 00012726 C3 <1> retn 3419 <1> 3420 <1> sndc_info_4: 3421 <1> ; 19/11/2023 3422 00012727 3C02 <1> cmp al, 2 ; Intel AC97 (ICH) Audio Controller 3423 00012729 7413 <1> je short sndc_info_7 3424 <1> sndc_info_5: 3425 <1> ; return ZERO if it is not AC97 audio controller codec 3426 0001272B 31C0 <1> xor eax, eax ; 0 3427 0001272D 31DB <1> xor ebx, ebx ; 0 3428 <1> sndc_info_6: 3429 0001272F A3[6C8E0100] <1> mov [u.r0], eax 3430 00012734 8B2D[688E0100] <1> mov ebp, [u.usp] 3431 0001273A 895D10 <1> mov [ebp+16], ebx ; ebx 3432 0001273D C3 <1> retn 3433 <1> sndc_info_7: 3434 0001273E E8F01F0000 <1> call ac97_codec_info 3435 00012743 72E6 <1> jc short sndc_info_5 3436 <1> 3437 <1> ; 26/11/2023 - temporary 3438 <1> ;and al, 0FEh ; clear VRA support bit for test 3439 <1> 3440 00012745 EBE8 <1> jmp short sndc_info_6 3441 <1> 3442 <1> sound_data: 3443 <1> ; FUNCTION = 15 3444 <1> ; Get Current Sound data for graphics 3445 <1> ; 30/07/2022 3446 <1> ; 22/06/2017 3447 <1> ; 3448 00012747 E878000000 <1> call snd_dev_check 3449 <1> ;jc soundc_dev_err ; Device not ready ! 3450 <1> ; 30/07/2022 3451 0001274C 728A <1> jc short snd_data_dev_err 3452 <1> 3453 0001274E 80FB00 <1> cmp bl, 0 3454 00012751 760A <1> jna short sound_data_0 3455 <1> 3456 <1> ; Only PCM OUT buffer data is valid for now! 3457 00012753 B817000000 <1> mov eax, ERR_INV_PARAMETER ; 23 3458 00012758 E9F4F9FFFF <1> jmp sysaudio_err 3459 <1> 3460 <1> sound_data_0: 3461 0001275D A1[04890100] <1> mov eax, [audio_dma_buff] 3462 00012762 09C0 <1> or eax, eax 3463 <1> ;jz sound_buff_error 3464 <1> ; 30/07/2022 3465 00012764 741A <1> jz short sound_data_5 3466 <1> 3467 00012766 803D[E5880100]04 <1> cmp byte [audio_device], 4 ; Intel HDA 3468 0001276D 744C <1> je short sound_data_4 ; temporary ! (22/06/2017) 3469 <1> 3470 0001276F 21C9 <1> and ecx, ecx 3471 <1> ;jnz short sound_data_1 ; sample transfer 3472 <1> 3473 <1> ; Return only DMA Buffer pointer/offset... 3474 <1> ; (If DMA Buffer has been mapped to user's 3475 <1> ; memory space; program can get graphics 3476 <1> ; data by using only this pointer value.) 3477 <1> 3478 <1> ;call get_dma_buffer_offset 3479 <1> ;; eax = DMA buffer offset 3480 <1> ;; (!not half buffer offset!) 3481 <1> ;mov [u.r0], eax 3482 <1> ;retn 3483 <1> 3484 <1> ;jz get_dma_buffer_offset 3485 <1> ; 30/07/2022 3486 00012771 7505 <1> jnz short sound_data_1 3487 00012773 E95C1F0000 <1> jmp get_dma_buffer_offset 3488 <1> 3489 <1> sound_data_1: 3490 <1> ;mov eax, [audio_dmabuff_size] 3491 <1> ;shr eax, 1 ; half buffer size 3492 <1> ;cmp ecx, eax 3493 <1> ;ja short sound_buff_error 3494 <1> 3495 00012778 3B0D[08890100] <1> cmp ecx, [audio_dmabuff_size] 3496 <1> ;ja sound_buff_error 3497 <1> ; 30/07/2022 3498 0001277E 7605 <1> jna short sound_data_6 3499 <1> sound_data_5: 3500 00012780 E9ECF9FFFF <1> jmp sound_buff_error 3501 <1> sound_data_6: 3502 00012785 89D0 <1> mov eax, edx 3503 00012787 25FF0F0000 <1> and eax, PAGE_OFF ; 4095 (0FFFh) 3504 0001278C 81F900100000 <1> cmp ecx, 4096 3505 00012792 7604 <1> jna short sound_data_2 3506 <1> ;mov ecx, 4096 ; max. 1 page 3507 <1> ; 30/07/2022 3508 00012794 31C9 <1> xor ecx, ecx 3509 00012796 B510 <1> mov ch, 16 3510 <1> ; ecx = 4096 3511 <1> sound_data_2: 3512 00012798 01C8 <1> add eax, ecx 3513 0001279A 3D00100000 <1> cmp eax, 4096 3514 0001279F 7606 <1> jna short sound_data_3 3515 000127A1 6625FF0F <1> and ax, PAGE_OFF ; 4095 (0FFFh) 3516 000127A5 29C1 <1> sub ecx, eax 3517 <1> ; here, ECX has been adjusted to fit 3518 <1> ; in page border.. (<= 4096, >0) 3519 <1> sound_data_3: 3520 000127A7 51 <1> push ecx 3521 000127A8 52 <1> push edx 3522 000127A9 89D3 <1> mov ebx, edx 3523 000127AB E86034FFFF <1> call get_physical_addr 3524 000127B0 5A <1> pop edx 3525 000127B1 59 <1> pop ecx 3526 <1> ;jc sound_buff_error 3527 <1> ; 30/07/2022 3528 000127B2 72CC <1> jc short sound_data_5 3529 <1> 3530 <1> ; eax = physical address of user's buffer 3531 000127B4 89C3 <1> mov ebx, eax 3532 <1> ; ecx = byte (transfer) count 3533 <1> ;call get_current_sound_data 3534 <1> ;retn 3535 000127B6 E96E1E0000 <1> jmp get_current_sound_data 3536 <1> 3537 <1> sound_data_4: 3538 <1> ; Intel HDA code is not ready yet ! 3539 <1> ; 22/06/2017 3540 000127BB 31C0 <1> xor eax, eax 3541 000127BD 48 <1> dec eax 3542 000127BE A3[6C8E0100] <1> mov [u.r0], eax ; 0FFFFFFFFh 3543 000127C3 C3 <1> retn 3544 <1> 3545 <1> snd_dev_check: 3546 <1> ; 10/06/2017 3547 <1> ; 05/06/2017 3548 <1> ; 24/05/2017 3549 <1> ; 22/04/2017 3550 <1> ; 21/04/2017 3551 <1> ; ... device check at first 3552 000127C4 A0[E5880100] <1> mov al, [audio_device] 3553 000127C9 3C01 <1> cmp al, 1 ; SB 16 3554 000127CB 7203 <1> jb short snd_dev_chk_retn ; error ! 3555 <1> ;cmp al, 4 ; Intel HDA 3556 <1> ;ja short snd_dbchk_stc ; invalid ! 3557 <1> ; 10/06/2017 3558 000127CD 3C05 <1> cmp al, 5 3559 000127CF F5 <1> cmc 3560 <1> snd_dev_chk_retn: 3561 000127D0 C3 <1> retn 3562 <1> 3563 <1> snd_buf_check: 3564 <1> ; 10/06/2017 3565 <1> ; 22/04/2017 3566 <1> ; 21/04/2017 3567 <1> ; ... buffer & (buffer) owner check at second 3568 000127D1 833D[F8880100]00 <1> cmp dword [audio_buffer], 0 3569 000127D8 760D <1> jna short snd_dbchk_stc 3570 <1> snd_user_check: 3571 000127DA A0[BD8E0100] <1> mov al, [u.uno] 3572 000127DF 3A05[11890100] <1> cmp al, [audio_user] 3573 <1> ;jne short snd_dbchk_stc 3574 <1> ;retn 3575 000127E5 74E9 <1> je short snd_dev_chk_retn 3576 <1> 3577 <1> snd_dbchk_stc: 3578 000127E7 F9 <1> stc 3579 000127E8 C3 <1> retn 3580 <1> 3581 <1> sound_update: 3582 <1> ; FUNCTION = 16 3583 <1> ; bl = 3584 <1> ; 0 = automatic (sequental) update (with flag switch!) 3585 <1> ; 1 = update dma half buffer 1 (without flag switch!) 3586 <1> ; 2 = update dma half buffer 2 (without flag switch!) 3587 <1> ; FFh = get current flag value 3588 <1> ; 0 = dma half buffer 1 (will be played next) 3589 <1> ; 1 = dma half buffer 2 (will be played next) 3590 <1> ; 3591 <1> ; 29/12/2024 3592 <1> ; Note: Requested half buffer is updated and 3593 <1> ; flag is set to other value for other half buffer 3594 <1> ; 3595 <1> ; For example: 3596 <1> ; * if BL input is 1, half buffer 1 is loaded and 3597 <1> ; flag is switched to 1 -half buff 2 is in order- 3598 <1> ; (next time half buffer 2 is updated automaticly) 3599 <1> ; * if BL input is 2, half buffer 2 is updated/loaded 3600 <1> ; and flag is switched to 0 3601 <1> ; 3602 <1> ; Return value for BL input = 0,1,2 3603 <1> ; Current flag value (just after switched) 3604 <1> ; -flag will have same value- 3605 <1> ; If BL input is 1, return value will be 1 (1 xor 0) 3606 <1> ; IF BL input is 2, return value will be 0 (1 xor 1) 3607 <1> 3608 <1> ; 28/12/2024 3609 <1> ; 05/06/2024 3610 <1> ; 30/07/2022 3611 <1> ; 10/10/2017 3612 <1> ; ... device check at first 3613 000127E9 A0[E5880100] <1> mov al, [audio_device] 3614 000127EE 08C0 <1> or al, al ; 0 ; pc speaker or invalid 3615 <1> ;jz soundc_dev_err 3616 <1> ; 30/07/2022 3617 000127F0 7505 <1> jnz short snd_update_4 3618 000127F2 E94EF9FFFF <1> jmp soundc_dev_err 3619 <1> snd_update_4: 3620 <1> ; ... buffer & (buffer) owner check at second 3621 000127F7 833D[F8880100]00 <1> cmp dword [audio_buffer], 0 3622 <1> ;jna sound_buff_error 3623 <1> ; 30/07/2022 3624 000127FE 761C <1> jna short snd_update_6 ; jmp sound_buff_error 3625 00012800 A0[BD8E0100] <1> mov al, [u.uno] 3626 00012805 3A05[11890100] <1> cmp al, [audio_user] 3627 <1> ;jne sndc_owner_error 3628 <1> ; 30/07/2022 3629 0001280B 7405 <1> je short snd_update_5 3630 0001280D E985FAFFFF <1> jmp sndc_owner_error 3631 <1> snd_update_5: 3632 <1> ; Transfer ring 3 (user's) audio buffer content to dma buffer 3633 00012812 8B3D[04890100] <1> mov edi, [audio_dma_buff] ; dma buffer (ring 0) 3634 00012818 09FF <1> or edi, edi 3635 <1> ;jz sound_buff_error 3636 <1> ; 30/07/2022 3637 0001281A 7505 <1> jnz short snd_update_7 3638 <1> snd_update_6: 3639 0001281C E950F9FFFF <1> jmp sound_buff_error 3640 <1> snd_update_7: 3641 00012821 8B35[FC880100] <1> mov esi, [audio_p_buffer] ; physical address (ring 3) 3642 <1> ; 05/06/2024 3643 <1> ;mov ecx, [audio_buff_size] 3644 <1> ; 3645 <1> ;;; 3646 <1> ; 04/06/2024 3647 <1> ;mov al, [audio_device] 3648 <1> ;cmp al, 1 3649 <1> ;je short snd_update_8 ; SB16 3650 <1> ;and cl, ~1 ; word alignment 3651 <1> ;cmp al, 3 3652 <1> ;je short snd_update_8 ; VIA VT8233 3653 <1> ;; al = 2 ; AC97 3654 <1> ;and cl, ~7 ; 8 byte alignment 3655 <1> ;snd_update_8: 3656 <1> ;;; 3657 <1> 3658 <1> ; 05/06/2024 3659 00012827 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] ; DMA half buffer size 3660 <1> 3661 <1> ;movzx eax, byte [audio_flag] 3662 0001282D A0[10890100] <1> mov al, [audio_flag] 3663 00012832 FEC3 <1> inc bl 3664 00012834 742F <1> jz short snd_update_3 ; bl = 0FFh 3665 00012836 FECB <1> dec bl 3666 00012838 7417 <1> jz short snd_update_0 ; bl = 0 3667 <1> 3668 <1> ; 28/12/2024 3669 0001283A 80FB02 <1> cmp bl, 2 3670 0001283D 7609 <1> jna short snd_update_8 3671 <1> ;cmp bl, 2 3672 <1> ;je short snd_update_1 ; dma half buffer 2 3673 <1> ;jb short snd_update_2 ; dma half buffer 1 3674 <1> ; 28/12/2024 3675 <1> ;jz short snd_update_2 3676 <1> 3677 <1> ; invalid parameter ! 3678 <1> ; 30/07/2022 3679 <1> ;mov eax, ERR_INV_PARAMETER ; 23 3680 <1> ; mov [u.r0], eax 3681 <1> ; mov [u.error], eax 3682 <1> ; jmp error 3683 <1> 3684 <1> snd_update_err: 3685 <1> ; 30/07/2022 3686 0001283F 29C0 <1> sub eax, eax 3687 00012841 B017 <1> mov al, ERR_INV_PARAMETER ; 23 3688 00012843 E909F9FFFF <1> jmp sysaudio_err 3689 <1> 3690 <1> ; 29/12/2024 3691 <1> snd_update_8: 3692 00012848 88D8 <1> mov al, bl ; 1 or 2 3693 0001284A FEC8 <1> dec al 3694 0001284C A2[10890100] <1> mov [audio_flag], al ; 0 or 1 3695 <1> snd_update_0: 3696 00012851 8035[10890100]01 <1> xor byte [audio_flag], 1 ; update flag !!! 3697 <1> snd_update_9: 3698 00012858 3C01 <1> cmp al, 1 3699 0001285A 7202 <1> jb short snd_update_2 ; dma half buffer 1 3700 <1> snd_update_1: 3701 <1> ; dma half buffer 2 3702 0001285C 01CF <1> add edi, ecx 3703 <1> snd_update_2: 3704 <1> ;rep movsb 3705 <1> ; 05/06/2024 3706 <1> ;shr ecx, 2 3707 <1> ;rep movsd 3708 0001285E F3A4 <1> rep movsb ; SB16, AC97, VT8233 3709 <1> ; 29/12/2024 3710 00012860 A0[10890100] <1> mov al, [audio_flag] 3711 <1> snd_update_3: 3712 00012865 A3[6C8E0100] <1> mov [u.r0], eax 3713 <1> 3714 0001286A C3 <1> retn 3715 <1> 3716 <1> sound_getvol: 3717 <1> ; FUNCTION = 17 3718 <1> ; Get sound volume level 3719 <1> ; 24/05/2024 3720 <1> ; bl = component 3721 <1> ; 0 = master/playback/lineout volume 3722 <1> ; 1 = PCM out volume 3723 <1> ; Return: 3724 <1> ; cl = left channel volume level (0 to 31) 3725 <1> ; ch = right channel volume level (0 to 31) 3726 <1> 3727 0001286B 80FB01 <1> cmp bl, 1 3728 0001286E 7709 <1> ja short snd_gvol_0 ; temporary ; 24/05/2024 3729 00012870 7408 <1> je short snd_gvol_1 3730 00012872 668B0D[20890100] <1> mov cx, [audio_master_volume] 3731 <1> snd_gvol_0: 3732 00012879 C3 <1> retn 3733 <1> snd_gvol_1: 3734 0001287A 668B0D[22890100] <1> mov cx, [audio_pcmo_volume] 3735 00012881 C3 <1> retn 3736 <1> 3737 <1> %if 0 3738 <1> 3739 <1> sound_dmaclear: 3740 <1> ; FUNCTION = 18 3741 <1> ; Clear DMA buffer 3742 <1> ; (may be useful for non-VRA AC97 hardware) 3743 <1> ; bl = cleaning byte value 3744 <1> ; 0 or 80h (not a necessary value, 0 is most proper) 3745 <1> ; 3746 <1> ; Return value 3747 <1> ; eax = DMA half buffer size (DMA buff size / 2) 3748 <1> ; If eax = 0 3749 <1> ; there is not an active DMA buffer for user) 3750 <1> ; 3751 <1> ; 28/12/2024 3752 <1> mov edi, [audio_dma_buff] 3753 <1> and edi, edi 3754 <1> jz short snd_dma_clear_ok 3755 <1> mov ecx, [audio_dmabuff_size] 3756 <1> or ecx, ecx 3757 <1> jz short snd_dma_clear_ok 3758 <1> ; security (is necessary for multitasking) 3759 <1> mov cl, [audio_user] 3760 <1> or cl, cl 3761 <1> jz short snd_dma_clear_ok 3762 <1> cmp cl, [u.uno] 3763 <1> jne short snd_dma_clear_ok 3764 <1> mov ecx, [dma_hbuff_size] 3765 <1> and ecx, ecx 3766 <1> jz short snd_dma_clear_ok 3767 <1> 3768 <1> mov [u.r0], ecx 3769 <1> shl ecx, 1 ; full buffer size in bytes 3770 <1> mov al, bl 3771 <1> rep stosb 3772 <1> 3773 <1> snd_dma_clear_ok: 3774 <1> retn 3775 <1> 3776 <1> %endif 3777 <1> 3778 <1> set_irq_callback_service: 3779 <1> ; 23/11/2023 3780 <1> ; 20/11/2023 (TRDOS 386 Kernel v2.0.7) 3781 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 3782 <1> ; 03/08/2020 3783 <1> ; 10/06/2017 3784 <1> ; 12/05/2017 3785 <1> ; 24/04/2017 3786 <1> ; 22/04/2017 3787 <1> ; caller: 'syscalbac' or 'sysaudio' or ... 3788 <1> ; 13/04/2017, 14/04/2017, 17/04/2017 3789 <1> ; 24/02/2017, 26/02/2017, 28/02/2017 3790 <1> ; 21/02/2017 - TRDOS 386 (TRDOS v2.0) 3791 <1> ; 3792 <1> ; Link or unlink IRQ callback service to/from user (ring 3) 3793 <1> ; 3794 <1> ; INPUT -> 3795 <1> ; If AL = 0, the caller is 'syscalbac'; 3796 <1> ; otherwise, the caller is 'sysaudio' or ... 3797 <1> ; (AL = user number) 3798 <1> ; 3799 <1> ; BL = IRQ number (Hardware interrupt request number) 3800 <1> ; (0 to 15 but IRQ 0,1,2,6,8,14,15 are prohibited) 3801 <1> ; IRQ numbers 3,4,5,7,9,10,11,12,13 are valid 3802 <1> ; (numbers >15 are invalid) 3803 <1> ; 3804 <1> ; BH = 0 = Unlink IRQ (in BL) from user (ring 3) service 3805 <1> ; 1 = Link IRQ by using Signal Response Byte method 3806 <1> ; 2 = Link IRQ by using Callback service method 3807 <1> ; 3 = Link IRQ by using Auto Increment S.R.B. method 3808 <1> ; >3 = invalid 3809 <1> ; (syscallback version will return to user) 3810 <1> ; 3811 <1> ; CL = Signal Return/Response Byte value 3812 <1> ; 3813 <1> ; If BH = 3, kernel will put a counter value ; 03/08/2020 3814 <1> ; (into the S.R.B. addr) 3815 <1> ; between 0 to 255. (start value = CL+1) 3816 <1> ; 3817 <1> ; NOTE: counter value, for example: even and odd numbers 3818 <1> ; may be used for -audio- DMA buffer switch 3819 <1> ; within double buffer method, etc. 3820 <1> ; 3821 <1> ; EDX = Signal return (Response) byte address 3822 <1> ; - or - 3823 <1> ; Interrupt/Callback service/routine address 3824 <1> ; 3825 <1> ; (virtual address in user's memory space) 3826 <1> ; 3827 <1> ; OUTPUT -> 3828 <1> ; CF = 0 & EAX = 0 -> Successful setting 3829 <1> ; CF = 1 & EAX > 0 -> IRQ is prohibited or locked 3830 <1> ; by another process 3831 <1> ; eax = ERR_PERM_DENIED -> prohibited or locked 3832 <1> ; eax = ERR_INV_PARAMETER -> 3833 <1> ; invalid parameter/option or bad address 3834 <1> ; 3835 <1> ; TRDOS 386 - IRQ CALLBACK structures (parameters): 3836 <1> ; 3837 <1> ; [u.irqlock] : 1 word, IRQ flags (0-15) that indicates 3838 <1> ; which IRQs are locked by (that) user. 3839 <1> ; Lock and unlock (by user) will change 3840 <1> ; these flags or 'terminate process' (sysexit) 3841 <1> ; will clear these flags and unlock those IRQs. 3842 <1> ; 3843 <1> ; Bit 0 is for IRQ 0 and Bit 15 is for IRQ 15 3844 <1> ; 3845 <1> ; IRQ(x).owner : 1 byte, user, [u.uno], 0 = free (unlocked) 3846 <1> ; 3847 <1> ; IRQ(x).method : 1 byte for callback method & status 3848 <1> ; 0 = Signal Response Byte method 3849 <1> ; 1 = Callback service method 3850 <1> ; >1 = invalid for current 'syscalback'. 3851 <1> ; or(+) 80h = IRQ is in use by system (ring 0) 3852 <1> ; function (audio etc.) or 3853 <1> ; a device driver. 3854 <1> ; (system function will ignore the lock/owner) 3855 <1> ; 3856 <1> ; IRQ(x).srb : 1 byte, Signal Return/Response byte value 3857 <1> ; (a fixed value by user or a counter value 3858 <1> ; from 0 to 255, which is increased by every 3859 <1> ; interrupt just before putting it into 3860 <1> ; the Signal Response byte address) 3861 <1> ; (This is not used in callback serv method) 3862 <1> ; 3863 <1> ; IRQ(x).addr : 1 dword 3864 <1> ; Signal Response Byte address (physical) 3865 <1> ; -or- 3866 <1> ; Callback service address (virtual) 3867 <1> ; 3868 <1> ; IRQ(x).dev : 1 byte 3869 <1> ; 0 = Default device or kernel function 3870 <1> ; -or- 3871 <1> ; 1-255 = Assigned device driver number 3872 <1> ; 3873 <1> ; (x) = 3,4,5,7,9,10,11,12,13 3874 <1> ; 3875 <1> 3876 00012882 80FB0F <1> cmp bl, 15 3877 00012885 7727 <1> ja short scbs_2 3878 <1> 3879 00012887 80FF03 <1> cmp bh, 3 3880 0001288A 7722 <1> ja short scbs_2 ; invalid parameter 3881 <1> 3882 0001288C 0FB6FB <1> movzx edi, bl ; save IRQ number 3883 <1> 3884 <1> ; IRQ 0,1,2,6,8,14,15 are prohibited 3885 <1> ;IRQenum: ; 'trdosk9.s' 3886 <1> ; db 0,0,0,1,2,3,0,4,0,5,6,7,8,9,0,0 3887 <1> 3888 0001288F 0FB6B7[B0350100] <1> movzx esi, byte [edi+IRQenum] ; IRQ availability 3889 <1> ; enumeration/index 3890 <1> ; 20/11/2023 3891 00012896 4E <1> dec esi 3892 <1> ;dec si 3893 00012897 780F <1> js short scbs_1 ; 0 -> 0FFFFh 3894 <1> 3895 <1> ; ESI = IRQ callback parameters index number (0 to 8) 3896 <1> 3897 00012899 08FF <1> or bh, bh 3898 0001289B 7417 <1> jz short scbs_4 ; unlink the IRQ (in BL) 3899 <1> 3900 0001289D FECF <1> dec bh 3901 <1> ; bh = method (0 = signal response byte, 1 = callback) 3902 <1> ; (2 = auto increment of signal response byte) 3903 <1> 3904 0001289F 80BE[94880100]00 <1> cmp byte [esi+IRQ.owner], 0 ; locked ? 3905 000128A6 7635 <1> jna short scbs_6 ; no... OK... 3906 <1> 3907 <1> scbs_1: 3908 <1> ; permission denied (prohibited IRQ) 3909 <1> ;mov eax, ERR_PERM_DENIED 3910 <1> ; 30/07/2022 3911 000128A8 29C0 <1> sub eax, eax 3912 000128AA B00B <1> mov al, ERR_PERM_DENIED 3913 000128AC F9 <1> stc 3914 000128AD C3 <1> retn 3915 <1> scbs_2: 3916 <1> ;stc 3917 <1> scbs_3: 3918 <1> ;mov eax, ERR_INV_PARAMETER 3919 <1> ; 30/07/2022 3920 000128AE 29C0 <1> sub eax, eax 3921 000128B0 B017 <1> mov al, ERR_INV_PARAMETER 3922 000128B2 F9 <1> stc 3923 000128B3 C3 <1> retn 3924 <1> 3925 <1> scbs_4: ; unlink the requested IRQ (if it belongs to current user) 3926 <1> ; 10/06/2017 3927 <1> ; 22/04/2017 3928 <1> ; 14/04/2017 3929 <1> ; If AL = 0 -> The caller is 'syscalbac' 3930 000128B4 8AA6[94880100] <1> mov ah, [esi+IRQ.owner] 3931 000128BA 3A25[BD8E0100] <1> cmp ah, [u.uno] 3932 000128C0 75E6 <1> jne short scbs_1 3933 <1> 3934 000128C2 FE0D[E68E0100] <1> dec byte [u.irqc] ; decrease IRQ count (in use) 3935 <1> 3936 <1> ;sub ah, ah 3937 <1> ;mov [esi+IRQ.owner], ah ; 0 ; free !!! 3938 <1> ;and byte [esi+IRQ.method], 80h 3939 <1> ;mov [esi+IRQ.srb], ah ; 0 3940 <1> ;mov [esi+IRQ.dev], ah ; 0 3941 <1> ;mov dword [esi+IRQ.addr], 0 3942 <1> ;mov dword [u.r0], 0 3943 <1> 3944 <1> ;mov byte [esi+IRQ.owner], 0 3945 <1> 3946 <1> ; 22/04/2017 3947 000128C8 29C0 <1> sub eax, eax 3948 000128CA 8886[94880100] <1> mov [esi+IRQ.owner], al ; 0 3949 <1> ; 10/06/2017 3950 000128D0 8686[A6880100] <1> xchg al, [esi+IRQ.method] 3951 000128D6 2480 <1> and al, 80h 3952 000128D8 745D <1> jz short scbs_12 3953 <1> ; Audio device must be disabled -later- ! ([IRQ.medhod] = 80h) 3954 <1> 3955 <1> ; cmp byte [esi+IRQ.method], 80h ; device drv or kernel extension ? 3956 <1> ; jb short scbs_12 ; bh = 0 reset to default IRQ handler 3957 <1> ; 3958 <1> ; and al, al 3959 <1> ; jz short scbs_5 ; the caller is 'syscalbac' 3960 <1> ; ; The caller is 'sysaudio' or ... 3961 000128DA 30C0 <1> xor al, al 3962 <1> ; mov [esi+IRQ.method], al ; 0 ; reset kernel extension flag 3963 <1> ;scbs_5: 3964 <1> ; sub ah, ah 3965 <1> ;mov [u.r0], eax ; 0 3966 000128DC C3 <1> retn 3967 <1> 3968 <1> scbs_6: 3969 <1> ; 14/04/2017 3970 000128DD 20C0 <1> and al, al 3971 000128DF 7405 <1> jz short scbs_7 ; the caller is 'syscalbac' 3972 <1> ; AL = user number ([u.uno] or [audio.user] or ...) 3973 <1> ; The caller is 'sysaudio' or ... 3974 <1> ; 3975 <1> ; bh = method (0 = signal response byte, 1 = callback) 3976 <1> ; (2 = auto increment of signal response byte) 3977 <1> 3978 000128E1 80CF80 <1> or bh, 80h ; Kernel extension flag ! 3979 000128E4 EB0A <1> jmp short scbs_8 3980 <1> scbs_7: 3981 000128E6 8A86[A6880100] <1> mov al, [esi+IRQ.method] ; >= 80h = kernel is using this IRQ 3982 000128EC 2480 <1> and al, 80h ; use only bit 7 (kernel function flag) 3983 000128EE 08C7 <1> or bh, al ; method 3984 <1> ; 0 = signal response byte, 1 = callback 3985 <1> ; 2 = auto increment of s.r.b. 3986 <1> scbs_8: 3987 000128F0 A0[BD8E0100] <1> mov al, [u.uno] ; user (process) number (1 to 16) 3988 000128F5 8886[94880100] <1> mov [esi+IRQ.owner], al ; lock the IRQ for user 3989 000128FB 88BE[A6880100] <1> mov [esi+IRQ.method], bh 3990 <1> 3991 <1> ; test bh, 1 3992 <1> ; jnz short scbs_9 ; Callback method, CX will not be used 3993 <1> ; 3994 <1> ; test bh, 2 ; use auto increment (counter) method 3995 <1> ; jz short scbs_10 ; (count can be used for buffer switch) 3996 <1> ;scbs_9: 3997 <1> ; xor ecx, ecx ; 0 3998 <1> 3999 <1> scbs_10: 4000 <1> ;mov [esi+IRQ.method], bh 4001 00012901 888E[AF880100] <1> mov [esi+IRQ.srb], cl 4002 00012907 C686[9D880100]00 <1> mov byte [esi+IRQ.dev], 0 ; device number is always 0 4003 <1> ; for this system call 4004 <1> ;test bh, 1 4005 0001290E 80E701 <1> and bh, 1 ; 17/04/2017 4006 00012911 7513 <1> jnz short scbs_11 ; callback method, use virtual address 4007 <1> 4008 00012913 53 <1> push ebx ; IRQ number (in BL) 4009 00012914 89D3 <1> mov ebx, edx 4010 <1> ; ebx = virtual address 4011 <1> ; [u.pgdir] = page directory's physical address 4012 00012916 FE05[52880100] <1> inc byte [no_page_swap] ; 1 4013 <1> ; Do not add this page to swap queue 4014 <1> ; and remove it from swap queue if it is 4015 <1> ; on the queue. 4016 0001291C E8EF32FFFF <1> call get_physical_addr 4017 00012921 5B <1> pop ebx 4018 00012922 728A <1> jc short scbs_3 ; invalid address ! 4019 <1> ; eax = physical address of the virtual address in user's space 4020 00012924 89C2 <1> mov edx, eax 4021 <1> scbs_11: 4022 <1> ;shl si, 2 ; byte (index) to dword (offset) 4023 <1> ; 23/11/2023 4024 00012926 C1E602 <1> shl esi, 2 4025 00012929 8996[B8880100] <1> mov [esi+IRQ.addr], edx 4026 <1> 4027 0001292F FE05[E68E0100] <1> inc byte [u.irqc] ; increase IRQ (in use) count 4028 <1> 4029 00012935 FEC7 <1> inc bh ; 17/04/2017 4030 <1> ; bh > 0 -> set to requested IRQ handler (IRQ_u_list) 4031 <1> scbs_12: 4032 00012937 88D8 <1> mov al, bl ; IRQ number 4033 00012939 88FC <1> mov ah, bh ; 0 = reset, >0 = set 4034 0001293B E8DCF4FFFF <1> call set_hardware_int_vector 4035 <1> 4036 00012940 31C0 <1> xor eax, eax 4037 <1> ;mov [u.r0], eax ; 0 4038 <1> 4039 00012942 C3 <1> retn ; return with success (cf=0, eax=0) 4040 <1> 4041 <1> sysdma: ; DMA FUNCTIONS 4042 <1> ; 08/08/2022 4043 <1> ; 30/07/2022 - TRDOS 386 Kernel v2.0.5 4044 <1> ; 02/09/2017 4045 <1> ; 28/08/2017 4046 <1> ; 20/08/2017 - TRDOS 386 (TRDOS v2.0) 4047 <1> ; 4048 <1> ; Inputs: 4049 <1> ; BH = 0 -> Allocate DMA buffer 4050 <1> ; BL = 0 -> Use the system's default DMA 4051 <1> ; (SB16) Buffer 4052 <1> ; Buffer Size (max.) = 65536 bytes 4053 <1> ; BL > 0 -> Allocate (a new) DMA buffer 4054 <1> ; ECX = DMA Buffer Size in bytes (<=128KB) 4055 <1> ; EDX = Virtual Address of DMA buffer 4056 <1> ; 4057 <1> ; BH = 1 -> Initialize (Start) DMA service 4058 <1> ; BL, bit 0 to 3 = Channel Number (0 to 7) 4059 <1> ; BL, bit 7 = Auto Initialized Mode 4060 <1> ; (If bit 7 is set) 4061 <1> ; bit 6 = Record (read) mode (0= playback) 4062 <1> ; ECX = byte count (0 = use dma buffer size) 4063 <1> ; EDX = physical buffer address 4064 <1> ; (0 = use dma buffer -start- address) 4065 <1> ; 4066 <1> ; BH = 2 -> Get Current DMA Buffer Offset 4067 <1> ; BL = DMA channel number 4068 <1> ; 4069 <1> ; BH = 3 -> Get Current DMA count down value 4070 <1> ; BL = DMA channel number (0 tO 7) 4071 <1> ; 4072 <1> ; BH = 4 -> Get Current DMA channel (in progress) 4073 <1> ; 4074 <1> ; BH = 5 -> Get System's Default DMA Buffer Address 4075 <1> ; 4076 <1> ; BH = 6 -> Get Current DMA Buffer Address 4077 <1> ; 4078 <1> ; BH = 7 -> Stop DMA service 4079 <1> ; 4080 <1> ; Outputs: 4081 <1> ; 4082 <1> ; For BH = 0 ; Allocate DMA buffer 4083 <1> ; EAX = Physical address of DMA buffer 4084 <1> ; ECX = Allocated buffer size in bytes 4085 <1> ; - page count * 4096 - 4086 <1> ; (may be bigger than requested) 4087 <1> ; If BL input > 0, 4088 <1> ; 'sysalloc:' system call will be used with 4089 <1> ; EBX (for 'sysalloc') = EDX (for 'sysdma') 4090 <1> ; ECX is same, byte count (buffer size) 4091 <1> ; EDX = 1024*1024*16 ; 16 MB upper limit 4092 <1> ; If BL input = 0, 4093 <1> ; Default DMA buffer (SB16 buffer) will be 4094 <1> ; checked and if it is free, it's address 4095 <1> ; will be returned in EAX and it's size 4096 <1> ; will be returned in ECX (as 65536) 4097 <1> ; 4098 <1> ; If CF = 1, error code is in EAX 4099 <1> ; EAX = -1 ; DMA buffer allocation error! 4100 <1> ; EAX = 11 ; 'Permission Denied' error ! 4101 <1> ; 4102 <1> ; Note: 'sysalloc' error return method 4103 <1> ; will be applied if BL input > 0 ! 4104 <1> ; 4105 <1> ; For BH = 1 ; Initialize (Start) DMA 4106 <1> ; EAX = 0 (Successful) 4107 <1> ; If CF = 1, error code is in EAX 4108 <1> ; 4109 <1> ; For BH = 2 ; Get Current DMA Buffer Offset 4110 <1> ; EAX = DMA Buffer Offset (in bytes) 4111 <1> ; ; 4112 <1> ; AX = DMA buffer offset 4113 <1> ; EAX bits 16 to 23 = Page register value 4114 <1> ; 4115 <1> ; For BH = 3 ; Get Current DMA count down value 4116 <1> ; EAX = Count down value (remain bytes) 4117 <1> ; 4118 <1> ; For BH = 4 ; Get Current DMA channel (in progress) 4119 <1> ; EAX = DMA channel number (0 to 7) 4120 <1> ; AH = 0 if the owner is the caller process 4121 <1> ; AH > 0 if the dma channel is in use by 4122 <1> ; another user/process 4123 <1> ; EAX = -1 (0FFFFFFFFh) 4124 <1> ; if DMA service is not in use 4125 <1> ; (stopped or not initialized/started) 4126 <1> ; 4127 <1> ; For BH = 5 ; Get System's Default DMA Buff Addr 4128 <1> ; EAX = Default DMA Buffer Address (Physical) 4129 <1> ; = offset 'sb16_dma_buffer:' 4130 <1> ; ECX = Buffer size 4131 <1> ; = 65536 4132 <1> ; 4133 <1> ; For BH = 6 ; Get Current DMA Buffer Address 4134 <1> ; EAX = Current DMA buffer address (Physical) 4135 <1> ; ECX = Current DMA buffer size (setting value) 4136 <1> ; Note: These values are for current dma channel 4137 <1> ; settings for the user/process 4138 <1> ; ** For now (for current TRDOS 386 version) 4139 <1> ; only one user/process can use only one 4140 <1> ; dma channel & one dma buffer at same time 4141 <1> ; (no multi tasking on DMA service) !!! ** 4142 <1> ; (Once, current DMA user must stop it's own DMA 4143 <1> ; DMA service, than another user/program 4144 <1> ; can use DMA service with same dma channel 4145 <1> ; or with another DMA channel.) 4146 <1> ; 4147 <1> ; For BH = 7 ; Stop DMA service (for current user 4148 <1> ; and current DMA channel) 4149 <1> ; EAX = 0 ; successful 4150 <1> ; CF = 1 & EAX > 0 (= -1) -> Error 4151 <1> 4152 00012943 80FF07 <1> cmp bh, 7 4153 00012946 7612 <1> jna short sysdma_0 4154 <1> 4155 <1> sysdma_err: 4156 00012948 31C0 <1> xor eax, eax 4157 0001294A 48 <1> dec eax ; -1 4158 <1> sysdma_perm_err: 4159 0001294B A3[6C8E0100] <1> mov [u.r0], eax 4160 00012950 A3[D88E0100] <1> mov [u.error], eax ; DMA service error ! 4161 00012955 E914A1FFFF <1> jmp error 4162 <1> 4163 <1> sysdma_0: 4164 0001295A 08FF <1> or bh, bh 4165 0001295C 7537 <1> jnz short sysdma_1 ; 30/07/2022 4166 <1> 4167 0001295E 20DB <1> and bl, bl 4168 00012960 7416 <1> jz short sysdma_01 4169 <1> 4170 <1> ; redirect system call to 'sysalloc' 4171 00012962 89D3 <1> mov ebx, edx ; virtual address of DMA buffer 4172 <1> ;ecx = Buffer size in bytes 4173 <1> ; DMA buffer address <= 16MB upper limit 4174 00012964 BA00000001 <1> mov edx, 1024*1024*16 ; 16MB limit for DMA buff 4175 <1> 4176 00012969 C705[308D0100]FFFF- <1> mov dword [dma_addr], 0FFFFFFFFh ; -1 4176 00012971 FFFF <1> 4177 <1> 4178 00012973 E94DE8FFFF <1> jmp sysalloc 4179 <1> 4180 <1> sysdma_01: 4181 00012978 B800000500 <1> mov eax, sb16_dma_buffer 4182 <1> 4183 0001297D 803D[E5880100]01 <1> cmp byte [audio_device], 1 4184 00012984 724A <1> jb short sysdma_03 4185 <1> 4186 00012986 3B05[04890100] <1> cmp eax, [audio_dma_buff] 4187 0001298C 7527 <1> jne short sysdma_02 4188 <1> 4189 <1> sysdma_0_err: 4190 0001298E B80B000000 <1> mov eax, ERR_PERM_DENIED 4191 00012993 EBB6 <1> jmp short sysdma_perm_err 4192 <1> 4193 <1> ; 30/07/2022 4194 <1> sysdma_1: 4195 00012995 80FF01 <1> cmp bh, 1 4196 <1> ;ja sysdma_5 4197 <1> ; 30/07/2022 4198 00012998 7605 <1> jna short sysdma_10 4199 0001299A E90C010000 <1> jmp sysdma_5 4200 <1> 4201 <1> sysdma_10: 4202 0001299F F6C340 <1> test bl, 40h ; record (read) mode -BL, bit 6- 4203 <1> ;jnz sysdma_err ; not ready yet! 4204 <1> ; 30/07/2022 4205 000129A2 757C <1> jnz short sysdma_06 ; jmp sysdma_err 4206 <1> 4207 000129A4 A1[308D0100] <1> mov eax, [dma_addr] ; physical address of dma buffer 4208 000129A9 21C0 <1> and eax, eax 4209 <1> ;jz sysdma_err 4210 <1> ; 30/07/2022 4211 000129AB 7473 <1> jz short sysdma_06 ; jmp sysdma_err 4212 <1> 4213 000129AD 09D2 <1> or edx, edx 4214 000129AF 7574 <1> jnz short sysdma_11 4215 <1> 4216 000129B1 89C2 <1> mov edx, eax 4217 000129B3 EB74 <1> jmp short sysdma_12 4218 <1> 4219 <1> sysdma_02: 4220 <1> ; Only one user is permitted for audio/dma functions 4221 <1> 4222 000129B5 833D[04890100]00 <1> cmp dword [audio_dma_buff], 0 4223 000129BC 7612 <1> jna short sysdma_03 4224 <1> 4225 000129BE 8A1D[11890100] <1> mov bl, [audio_user] 4226 000129C4 08DB <1> or bl, bl 4227 000129C6 7408 <1> jz short sysdma_03 4228 <1> 4229 000129C8 3A1D[BD8E0100] <1> cmp bl, [u.uno] 4230 000129CE 75BE <1> jne short sysdma_0_err 4231 <1> 4232 <1> sysdma_03: 4233 000129D0 8A1D[2D8D0100] <1> mov bl, [dma_user] 4234 000129D6 20DB <1> and bl, bl 4235 000129D8 750E <1> jnz short sysdma_04 4236 <1> 4237 000129DA 8A1D[BD8E0100] <1> mov bl, [u.uno] 4238 000129E0 881D[2D8D0100] <1> mov [dma_user], bl 4239 <1> 4240 000129E6 EB15 <1> jmp short sysdma_05 4241 <1> 4242 <1> sysdma_04: 4243 000129E8 8B35[308D0100] <1> mov esi, [dma_addr] 4244 000129EE 21F6 <1> and esi, esi 4245 000129F0 740B <1> jz short sysdma_05 4246 <1> 4247 000129F2 46 <1> inc esi ; -1 -> 0 4248 000129F3 7408 <1> jz short sysdma_05 4249 <1> 4250 000129F5 3A1D[BD8E0100] <1> cmp bl, [u.uno] 4251 000129FB 7591 <1> jne short sysdma_0_err 4252 <1> 4253 <1> sysdma_05: 4254 <1> ; edx = virtual address (user's buffer address) 4255 <1> ; 4256 000129FD 81F900000100 <1> cmp ecx, 65536 ; byte count (buffer size) 4257 <1> ;ja sysdma_err 4258 <1> ; 30/07/2022 4259 00012A03 771B <1> ja short sysdma_06 ; jmp sysdma_err 4260 <1> ; 4261 00012A05 81C1FF0F0000 <1> add ecx, PAGE_SIZE-1 ; 4095 4262 00012A0B 6681E100F0 <1> and cx, ~PAGE_OFF ; not 4095 4263 <1> ;cmp ecx, 65536 4264 <1> ;ja sysdma_err 4265 00012A10 51 <1> push ecx ; buffer size (allocated pages * 4096) 4266 00012A11 50 <1> push eax ; offset sb16_dma_buffer 4267 00012A12 89D3 <1> mov ebx, edx 4268 00012A14 C1E90C <1> shr ecx, 12 ; byte count to page count 4269 <1> ; eax = physical address of (audio) dma buffer 4270 <1> ; ebx = virtual address of (audio) dma buffer (user's pgdir) 4271 <1> ; ecx = page count (>0) 4272 00012A17 E8B335FFFF <1> call direct_memory_access 4273 00012A1C 58 <1> pop eax 4274 00012A1D 59 <1> pop ecx 4275 <1> ;jc sysdma_err 4276 <1> ; 30/07/2022 4277 00012A1E 7315 <1> jnc short sysdma_07 4278 <1> sysdma_06: 4279 00012A20 E923FFFFFF <1> jmp sysdma_err 4280 <1> 4281 <1> sysdma_11: 4282 00012A25 39C2 <1> cmp edx, eax 4283 <1> ;jb sysdma_err 4284 <1> ; 30/07/2022 4285 00012A27 72F7 <1> jb short sysdma_06 ; jmp sysdma_err 4286 <1> sysdma_12: 4287 00012A29 21C9 <1> and ecx, ecx 4288 00012A2B 7515 <1> jnz short sysdma_13 4289 <1> 4290 00012A2D 8B0D[348D0100] <1> mov ecx, [dma_size] 4291 00012A33 EB15 <1> jmp short sysdma_14 4292 <1> 4293 <1> sysdma_07: 4294 00012A35 A3[308D0100] <1> mov [dma_addr], eax 4295 00012A3A 890D[348D0100] <1> mov [dma_size], ecx ; dma buffer size (in bytes) 4296 <1> 4297 <1> ;mov [u.r0], eax ; DMA Buffer Address (Physical) 4298 <1> 4299 <1> ;mov ebp, [u.usp] ; ebp points to user's registers 4300 <1> ;mov [ebp+24], ecx ; return to user with ecx value 4301 <1> 4302 <1> ;jmp sysret 4303 <1> 4304 <1> ; 28/08/2017 4305 00012A40 EB7A <1> jmp sysdma_51 4306 <1> 4307 <1> sysdma_13: 4308 00012A42 3B0D[348D0100] <1> cmp ecx, [dma_size] 4309 <1> ;ja sysdma_err 4310 <1> ; 30/07/2022 4311 00012A48 77D6 <1> ja short sysdma_06 ; jmp sysdma_err 4312 <1> sysdma_14: 4313 00012A4A 89C6 <1> mov esi, eax 4314 00012A4C 0335[348D0100] <1> add esi, [dma_size] 4315 <1> 4316 00012A52 89D0 <1> mov eax, edx 4317 00012A54 01C8 <1> add eax, ecx 4318 <1> ;jc sysdma_err ; 02/09/2017 4319 <1> ; 30/07/2022 4320 00012A56 72C8 <1> jc short sysdma_06 ; jmp sysdma_err 4321 <1> 4322 00012A58 39F0 <1> cmp eax, esi 4323 <1> ;ja sysdma_err 4324 <1> ; 30/07/2022 4325 00012A5A 77C4 <1> ja short sysdma_06 ; jmp sysdma_err 4326 <1> 4327 00012A5C 8B3D[04890100] <1> mov edi, [audio_dma_buff] 4328 00012A62 8B35[308D0100] <1> mov esi, [dma_addr] 4329 <1> 4330 00012A68 09FF <1> or edi, edi 4331 00012A6A 7425 <1> jz short sysdma_16 4332 <1> 4333 00012A6C 803D[E5880100]01 <1> cmp byte [audio_device], 1 4334 00012A73 7209 <1> jb short sysdma_15 4335 <1> 4336 <1> ; Sound Blaster 16 4337 00012A75 39FE <1> cmp esi, edi 4338 <1> ;je sysdma_0_err ; permmission denied ! 4339 <1> ; 30/07/2022 4340 00012A77 7505 <1> jne short sysdma_15 4341 00012A79 E910FFFFFF <1> jmp sysdma_0_err 4342 <1> sysdma_15: 4343 00012A7E C605[2F8D0100]48 <1> mov byte [dma_mode], 48h ; single mode playback 4344 <1> 4345 00012A85 F6C380 <1> test bl, 80h ; DMA mode - BL, bit 7, auto init - 4346 00012A88 7407 <1> jz short sysdma_16 4347 <1> ; Auto initialized playback (write) mode 4348 00012A8A 8005[2F8D0100]10 <1> add byte [dma_mode], 10h ; = 58h 4349 <1> sysdma_16: 4350 00012A91 80E307 <1> and bl, 07h 4351 00012A94 881D[2E8D0100] <1> mov [dma_channel], bl 4352 00012A9A 8915[388D0100] <1> mov [dma_start], edx 4353 00012AA0 890D[3C8D0100] <1> mov [dma_count], ecx 4354 <1> 4355 <1> ; 28/08/2017 4356 <1> ;call dma_init 4357 <1> ;jmp sysret 4358 00012AA6 E945010000 <1> jmp dma_init 4359 <1> 4360 <1> sysdma_5: 4361 00012AAB 80FF05 <1> cmp bh, 5 4362 00012AAE 726D <1> jb short sysdma_3 4363 00012AB0 7759 <1> ja short sysdma_6 4364 <1> 4365 <1> ; Get the system's default dma buffer addr and size 4366 00012AB2 B800000500 <1> mov eax, sb16_dma_buffer 4367 00012AB7 B900000100 <1> mov ecx, 65536 ; Buffer size in bytes 4368 <1> 4369 <1> sysdma_51: 4370 <1> ; 0 = there is not a dma buffer (in use or available) 4371 00012ABC A3[6C8E0100] <1> mov [u.r0], eax 4372 <1> 4373 00012AC1 8B2D[688E0100] <1> mov ebp, [u.usp] ; ebp points to user's registers 4374 00012AC7 894D18 <1> mov [ebp+24], ecx ; return to user with ecx value 4375 <1> 4376 00012ACA E9BF9FFFFF <1> jmp sysret 4377 <1> 4378 <1> sysdma_2: 4379 <1> ; Get current dma buffer offset (& page) 4380 <1> ; 28/08/2017 4381 00012ACF 0FB635[2E8D0100] <1> movzx esi, byte [dma_channel] 4382 00012AD6 0FB696[E8350100] <1> movzx edx, byte [dma_flip+esi] 4383 00012ADD EE <1> out dx, al ; flip-flop clear 4384 00012ADE 8A96[C0350100] <1> mov dl, [dma_adr+esi] 4385 00012AE4 EC <1> in al, dx ; get dma position 4386 00012AE5 0FB6D8 <1> movzx ebx, al 4387 00012AE8 EC <1> in al, dx 4388 00012AE9 88C7 <1> mov bh, al 4389 <1> 4390 00012AEB 6683FE04 <1> cmp si, 4 ; channel number ? 4391 00012AEF 7202 <1> jb short sysdma_21 ; 8 bit dma channel 4392 <1> 4393 00012AF1 D1E3 <1> shl ebx, 1 ; word offset to byte offset 4394 <1> 4395 <1> sysdma_21: 4396 00012AF3 891D[6C8E0100] <1> mov [u.r0], ebx 4397 <1> 4398 00012AF9 8A96[D0350100] <1> mov dl, [dma_page+esi] 4399 00012AFF EC <1> in al, dx ; get dma page 4400 <1> 4401 <1> ;add [u.ro+2], al 4402 00012B00 0805[6E8E0100] <1> or [u.r0+2], al 4403 <1> 4404 00012B06 E9839FFFFF <1> jmp sysret 4405 <1> 4406 <1> sysdma_6: 4407 00012B0B 80FF06 <1> cmp bh, 6 4408 00012B0E 775C <1> ja short sysdma_7 4409 <1> 4410 <1> ; 28/08/2017 4411 <1> ; Get current DMA buffer addr and size 4412 00012B10 A1[308D0100] <1> mov eax, [dma_addr] ; dma buffer address 4413 00012B15 8B0D[348D0100] <1> mov ecx, [dma_size] ; dma buffer size (in bytes) 4414 <1> 4415 00012B1B EB9F <1> jmp short sysdma_51 4416 <1> 4417 <1> sysdma_3: 4418 00012B1D 80FF03 <1> cmp bh, 3 4419 00012B20 72AD <1> jb short sysdma_2 4420 00012B22 772F <1> ja short sysdma_4 4421 <1> 4422 <1> ; Get current dma count down value (remain bytes) 4423 <1> ; 28/08/2017 4424 00012B24 0FB635[2E8D0100] <1> movzx esi, byte [dma_channel] 4425 00012B2B 0FB696[E8350100] <1> movzx edx, byte [dma_flip+esi] 4426 00012B32 EE <1> out dx, al ; flip-flop clear 4427 00012B33 8A96[C8350100] <1> mov dl, [dma_cnt+esi] ; dma count register addr 4428 00012B39 EC <1> in al, dx 4429 00012B3A 0FB6D8 <1> movzx ebx, al 4430 00012B3D EC <1> in al, dx 4431 00012B3E 88C7 <1> mov bh, al 4432 <1> 4433 00012B40 6683FE04 <1> cmp si, 4 ; channel number ? 4434 00012B44 7202 <1> jb short sysdma_31 ; 8 bit dma channel 4435 <1> 4436 00012B46 D1E3 <1> shl ebx, 1 ; word count to byte count 4437 <1> 4438 <1> sysdma_31: 4439 00012B48 891D[6C8E0100] <1> mov [u.r0], ebx 4440 <1> 4441 00012B4E E93B9FFFFF <1> jmp sysret 4442 <1> 4443 <1> sysdma_4: 4444 <1> ; Get current DMA channel number 4445 <1> ; 28/08/2017 4446 00012B53 8A25[2D8D0100] <1> mov ah, [dma_user] 4447 00012B59 20E4 <1> and ah, ah 4448 00012B5B 7539 <1> jnz short sysdma_42 4449 <1> 4450 <1> sysdma_41: 4451 <1> ; Not a valid dma channel (in use) 4452 00012B5D C705[6C8E0100]FFFF- <1> mov dword [u.r0], -1 ; 0FFFFFFFFh 4452 00012B65 FFFF <1> 4453 00012B67 E9229FFFFF <1> jmp sysret 4454 <1> 4455 <1> sysdma_7: 4456 <1> ; DMA service STOP 4457 00012B6C A0[BD8E0100] <1> mov al, [u.uno] 4458 00012B71 3A05[2D8D0100] <1> cmp al, [dma_user] 4459 00012B77 7543 <1> jne short sysdma_72 4460 <1> 4461 00012B79 28C0 <1> sub al, al ; 0 4462 <1> 4463 00012B7B A2[2D8D0100] <1> mov [dma_user], al ; clear user 4464 <1> 4465 00012B80 8605[2F8D0100] <1> xchg al, [dma_mode] 4466 00012B86 20C0 <1> and al, al 4467 <1> ;jz short sysdma_err 4468 00012B88 754E <1> jnz short sysdma_73 4469 <1> 4470 <1> sysdma_71: 4471 00012B8A 31C0 <1> xor eax, eax 4472 00012B8C A3[6C8E0100] <1> mov [u.r0], eax; 0 4473 00012B91 E9F89EFFFF <1> jmp sysret 4474 <1> 4475 <1> sysdma_42: 4476 00012B96 8B35[308D0100] <1> mov esi, [dma_addr] 4477 00012B9C 21F6 <1> and esi, esi 4478 00012B9E 74BD <1> jz short sysdma_41 4479 <1> 4480 00012BA0 46 <1> inc esi ; -1 -> 0 4481 00012BA1 74BA <1> jz short sysdma_41 4482 <1> 4483 00012BA3 A0[2E8D0100] <1> mov al, [dma_channel] 4484 <1> 4485 00012BA8 3A25[BD8E0100] <1> cmp ah, [u.uno] 4486 00012BAE 7502 <1> jne short sysdma_43 4487 <1> 4488 00012BB0 30E4 <1> xor ah, ah ; DMA channel in use by current user 4489 <1> 4490 <1> sysdma_43: 4491 00012BB2 A3[6C8E0100] <1> mov [u.r0], eax ; AL = dma channel number 4492 <1> ; AH > 0 if the the channel 4493 <1> ; in use by another user/process 4494 00012BB7 E9D29EFFFF <1> jmp sysret 4495 <1> 4496 <1> sysdma_72: 4497 <1> ; 28/08/2017 4498 00012BBC 803D[2D8D0100]00 <1> cmp byte [dma_user], 0 4499 00012BC3 76C5 <1> jna short sysdma_71 ; Nothing to do ! 4500 <1> 4501 00012BC5 833D[308D0100]00 <1> cmp dword [dma_addr], 0 4502 <1> ;ja sysdma_0_err 4503 <1> ; 30/07/2022 4504 00012BCC 7605 <1> jna short sysdma_74 4505 00012BCE E9BBFDFFFF <1> jmp sysdma_0_err 4506 <1> 4507 <1> sysdma_74: 4508 00012BD3 A2[2D8D0100] <1> mov [dma_user], al ; reset to current user 4509 <1> 4510 <1> sysdma_73: 4511 <1> ; 28/08/2017 4512 00012BD8 0FB635[2E8D0100] <1> movzx esi, byte [dma_channel] 4513 00012BDF 0FB696[D8350100] <1> movzx edx, byte [dma_mask+esi] 4514 00012BE6 A0[2E8D0100] <1> mov al, [dma_channel] 4515 00012BEB 0C04 <1> or al, 4 4516 00012BED EE <1> out dx, al 4517 <1> 4518 00012BEE EB9A <1> jmp short sysdma_71 4519 <1> 4520 <1> dma_init: 4521 <1> ; 30/07/2022 (TRDOS 386 Kernel v2.0.5) 4522 <1> ; 28/08/2017 4523 <1> ; 20/08/2017 4524 <1> ; DMA initialization 4525 <1> ; 14/08/2017 4526 <1> ; 03/08/2017, 06/08/2017, 08/08/2017 4527 <1> ; 02/07/2017, 13/07/2017, 16/07/2017, 30/07/2017 4528 <1> ; (Derived from 'DMA_INIT' procedure in SB16MOD.ASM) 4529 <1> ; Modified for TRDOS 386 DMA buffer allocation & initialization ! 4530 <1> 4531 00012BF0 8B1D[388D0100] <1> mov ebx, [dma_start] 4532 00012BF6 8B0D[3C8D0100] <1> mov ecx, [dma_count] 4533 <1> 4534 00012BFC 0FB635[2E8D0100] <1> movzx esi, byte [dma_channel] 4535 <1> 4536 00012C03 6683FE04 <1> cmp si, 4 4537 00012C07 7204 <1> jb short gdmi1 4538 <1> ; 08/08/2017 4539 <1> ;shr cx, 1 ; word count 4540 <1> ; 30/07/2022 4541 00012C09 D1E9 <1> shr ecx, 1 4542 00012C0B D1EB <1> shr ebx, 1 ; convert byte offset to word offset 4543 <1> gdmi1: 4544 <1> ;mov [dma_poff], bx ; 08/08/2017 4545 <1> ;dec cx ; dma size = block size - 1 4546 <1> ; 30/07/2022 4547 00012C0D 49 <1> dec ecx 4548 <1> 4549 00012C0E 0FB696[D8350100] <1> movzx edx, byte [dma_mask+esi] ; 30/07/2017 4550 00012C15 A0[2E8D0100] <1> mov al, [dma_channel] 4551 00012C1A 0C04 <1> or al, 4 4552 00012C1C EE <1> out dx, al ; dma channel mask 4553 <1> 4554 00012C1D 30C0 <1> xor al, al ; 0 ; any value ! 08/08/2017 4555 00012C1F 8A96[E8350100] <1> mov dl, [dma_flip+esi] 4556 00012C25 EE <1> out dx, al ; flip-flop clear 4557 <1> 4558 00012C26 8A96[E0350100] <1> mov dl, [dma_mod+esi] 4559 00012C2C A0[2E8D0100] <1> mov al, [dma_channel] ; 13/07/2017 4560 00012C31 2403 <1> and al, 3 4561 <1> ; 08/08/2017 4562 00012C33 0A05[2F8D0100] <1> or al, [dma_mode] ; 58h ; dma mode for SB16 4563 00012C39 EE <1> out dx, al 4564 <1> 4565 00012C3A 8A96[C0350100] <1> mov dl, [dma_adr+esi] 4566 00012C40 88D8 <1> mov al, bl 4567 00012C42 EE <1> out dx, al ; offset low 4568 <1> 4569 00012C43 88F8 <1> mov al, bh 4570 00012C45 EE <1> out dx, al ; offset high 4571 <1> 4572 00012C46 8A96[C8350100] <1> mov dl, [dma_cnt+esi] 4573 00012C4C 88C8 <1> mov al, cl 4574 00012C4E EE <1> out dx, al ; size low 4575 <1> 4576 00012C4F 88E8 <1> mov al, ch 4577 00012C51 EE <1> out dx, al ; size high 4578 <1> 4579 00012C52 8A96[D0350100] <1> mov dl, [dma_page+esi] 4580 <1> ; 14/08/2017 4581 00012C58 6683FE04 <1> cmp si, 4 4582 00012C5C 7305 <1> jnb short gdmi2 4583 00012C5E C1EB10 <1> shr ebx, 16 4584 00012C61 EB06 <1> jmp short gdmi3 4585 <1> gdmi2: 4586 <1> ; 09/08/2017 4587 00012C63 C1EB0F <1> shr ebx, 15 ; complete 16 bit shift 4588 00012C66 80E3FE <1> and bl, 0FEh ; clear bit 0 (not necessary) 4589 <1> gdmi3: 4590 00012C69 88D8 <1> mov al, bl 4591 00012C6B EE <1> out dx, al ; page 4592 <1> 4593 00012C6C 8A96[D8350100] <1> mov dl, [dma_mask+esi] 4594 00012C72 A0[2E8D0100] <1> mov al, [dma_channel] ; 13/07/2017 4595 00012C77 2403 <1> and al, 3 4596 00012C79 EE <1> out dx, al ; dma channel unmask 4597 <1> 4598 <1> ;retn 4599 <1> ; 28/08/2017 4600 00012C7A E90F9EFFFF <1> jmp sysret 4601 <1> 4602 <1> sysstdio: ; STDIN/STDOUT/STDERR functions 4603 <1> ; 18/09/2024 4604 <1> ; 07/09/2024 4605 <1> ; (STDAUX/STDPRN functions, pre-definions) 4606 <1> ; (!these functions are not ready!) 4607 <1> ; 24/08/2024 4608 <1> ; 23/08/2024 4609 <1> ; 20/08/2024 - TRDOS 386 Kernel v2.0.9 4610 <1> ; 4611 <1> ; Inputs: 4612 <1> ; BL = 0 -> read a character on stdin (wait) 4613 <1> ; BL = 1 -> read a character on stdin (no wait) 4614 <1> ; BL = 2 -> write a character onto stdout (redirection) 4615 <1> ; BL = 3 -> write a character onto stderr (no redirection) 4616 <1> ; BL = 4 -> redirect stdin to file (if cl > 0) 4617 <1> ; BL = 5 -> redirect stdout to file (if cl > 0) 4618 <1> ; BL = 6 -> read character (ascii and scancode) on stdin 4619 <1> ; -no redirection, wait- 4620 <1> ; BL = 7 -> read character (ascii and scancode) on stdin 4621 <1> ; -no redirection, no wait- 4622 <1> ; BL = 8 -> write character and color onto stdout 4623 <1> ; -no redirection- 4624 <1> ; BL = 9 -> ungetchar (put back the ascii code in u.getc) 4625 <1> ; 4626 <1> ; For BL=2,3,8,9 4627 <1> ; CL = character (ascii) code 4628 <1> ; For BL=8 4629 <1> ; CH = color (Attribute) -CGA- 4630 <1> ; For BL=4,5 4631 <1> ; CL = file descriptor number + 1 4632 <1> ; (File must be open and that number is 'u.fp' index) 4633 <1> ; 4634 <1> ; 07/09/2024 (these subfunctions will not be handled 4635 <1> ; by kernel v2.0.9 for now) 4636 <1> ; -I am writing them here for C compiler compatibility, 4637 <1> ; for now. Ref: SCC STDIO.H- 4638 <1> ; BL = 10 -> get STDAUX status 4639 <1> ; BL = 11 -> get/select STDAUX (COM) port 4640 <1> ; (clears redirection) 4641 <1> ; BL = 12 -> redirect STDAUX 4642 <1> ; BL = 13 -> STDAUX IOCTL (control functions) 4643 <1> ; BL = 14 -> read byte/character from STDAUX 4644 <1> ; BL = 15 -> write byte/character to STDAUX 4645 <1> ; BL = 16 -> get STDPRN status (LPT printer only) 4646 <1> ; BL = 17 -> redirect STDPRN 4647 <1> ; BL = 18 -> STDPRN IOCTL (init/control functions) 4648 <1> ; BL = 19 -> write byte/character to STDPRN 4649 <1> ; 4650 <1> ; For BL = 11 4651 <1> ; If CL = 0 -> get STDAUX (COM) port number 4652 <1> ; CL = 1 -> COM1 4653 <1> ; CL = 2 -> COM2 4654 <1> ; CL > 4 -> invalid 4655 <1> ; For BL = 12 4656 <1> ; If ECX = 0 -> clear redirection 4657 <1> ; If CH & 7Fh = 0 -> redirect INPUT 4658 <1> ; CH & 7Fh > 0 -> redirect OUTPUT 4659 <1> ; If CH & 80h = 80h 4660 <1> ; CL = file handle (descriptor index) 4661 <1> ; If CH & 80h = 0 4662 <1> ; CL = console (pseudo) tty number, 4663 <1> ; 1 to 8 for tty0 to tty7. 4664 <1> ; For BL = 13 4665 <1> ; If CL = 0 -> get control byte 4666 <1> ; If CL > 1 -> set control byte (in CL) 4667 <1> ; bit 0 = 1 4668 <1> ; bit 1 = data bits (set=8, clear=7) 4669 <1> ; bit 2 = stop bit (set=2, clear=1) 4670 <1> ; bit 3 = parity bit (set=yes, clear=no) 4671 <1> ; bit 4 = parity bit (set=even, clear=odd) 4672 <1> ; bit 5-6-7 = data rate 4673 <1> ; 000 = 9600 4674 <1> ; 001 = 19200 4675 <1> ; 010 = 38400 4676 <1> ; 011 = 57600 4677 <1> ; 100 = 115200 4678 <1> ; For BL = 15, 19 4679 <1> ; CL = byte/character to r/w 4680 <1> ; For BL = 17 4681 <1> ; If ECX = 0 -> clear redirection 4682 <1> ; If CH & 80h = 80h 4683 <1> ; CL = file handle (descriptor index) 4684 <1> ; If CH & 80h = 0 4685 <1> ; CL = console (pseudo) tty number, 4686 <1> ; 1 to 8 for tty0 to tty7. 4687 <1> ; For BL = 18 4688 <1> ; If CL = 0 -> initialize printer (command=0) 4689 <1> ; CL > 0 -> configuration/command byte 4690 <1> ; (reserved, not used) 4691 <1> ; 4692 <1> ; Outputs: 4693 <1> ; 4694 <1> ; For BL=0,1,2,3,6,7,8,9 4695 <1> ; AL = character (ascii) code 4696 <1> ; For BL=6,7 4697 <1> ; AH = scan code 4698 <1> ; For BL=4,5 4699 <1> ; AL = file descriptor (CL input - 1) 4700 <1> ; 4701 <1> ; If CF=1 4702 <1> ; AL (EAX) = error code 4703 <1> ; If EAX = 0 -> EOF ; 18/09/2024 4704 <1> ; 4705 <1> ; 07/09/2024 4706 <1> ; For BL = 10 to 19 4707 <1> ; IF CF = 1, EAX/AL = error code 4708 <1> ; .. If CF = 0 ... 4709 <1> ; For BL = 10 & 16 4710 <1> ; AL (EAX) = status 4711 <1> ; For BL = 11 4712 <1> ; EAX/AL = COM (serial) port (1 to 4) 4713 <1> ; For BL = 12, 15, 17, 18, 19 4714 <1> ; EAX/AL = 0 4715 <1> ; For BL = 13 4716 <1> ; If CL input = 0 4717 <1> ; EAX/AL = current ctrl/cfg byte 4718 <1> ; If CL input > 0 4719 <1> ; EAX/AL = ctrl/cfg byte 4720 <1> ; For BL = 14 4721 <1> ; EAX/AL = byte/character 4722 <1> ; 4723 <1> 4724 00012C7F 80FB0A <1> cmp bl, (end_of_stdiofuncs-stdiofuncs)>>2 4725 00012C82 7214 <1> jb short sysstdio_0 4726 <1> 4727 <1> ; invalid parameter (invalid sub function number) 4728 00012C84 B817000000 <1> mov eax, ERR_INV_PARAMETER 4729 <1> sysstdio_err: 4730 00012C89 A3[6C8E0100] <1> mov [u.r0], eax 4731 00012C8E A3[D88E0100] <1> mov [u.error], eax 4732 00012C93 E9D69DFFFF <1> jmp error 4733 <1> 4734 <1> sysstdio_0: 4735 00012C98 31C0 <1> xor eax, eax ; 0 4736 00012C9A A3[D88E0100] <1> mov [u.error], eax ; clear previous error code 4737 00012C9F A3[6C8E0100] <1> mov [u.r0], eax ; clear previous return code 4738 <1> 4739 00012CA4 0FB6F3 <1> movzx esi, bl 4740 00012CA7 C1E602 <1> shl esi, 2 4741 00012CAA FFA6[B02C0100] <1> jmp dword [esi+stdiofuncs] 4742 <1> 4743 <1> stdiofuncs: 4744 00012CB0 [3A2D0100] <1> dd readstdinw 4745 00012CB4 [3A2D0100] <1> dd readstdinnw 4746 00012CB8 [512E0100] <1> dd writestdout 4747 00012CBC [082E0100] <1> dd writestderr 4748 00012CC0 [D82C0100] <1> dd redirstdin 4749 00012CC4 [162D0100] <1> dd redirstdout 4750 <1> stdinacsc: 4751 00012CC8 [262E0100] <1> dd readstdin2w 4752 00012CCC [262E0100] <1> dd readstdin2nw 4753 <1> stdoutcc: 4754 00012CD0 [5C2E0100] <1> dd writestdoutcc 4755 00012CD4 [732E0100] <1> dd ungetchar 4756 <1> end_of_stdiofuncs: 4757 <1> 4758 <1> redirstdin: 4759 <1> ; CL = file handle (descriptor/index) + 1 4760 00012CD8 08C9 <1> or cl, cl 4761 00012CDA 7508 <1> jnz short redirstdin_0 4762 00012CDC 880D[D48E0100] <1> mov [u.stdin], cl ; 0 ; reset STDIN to keyboard 4763 00012CE2 EB24 <1> jmp short redirstdin_3 4764 <1> redirstdin_0: 4765 00012CE4 88C8 <1> mov al, cl 4766 00012CE6 E8B3D5FFFF <1> call getf 4767 <1> ; eax = first cluster 4768 <1> ; ebx = system (not user) open file index 4769 00012CEB 80BB[18840100]01 <1> cmp byte [ebx+OF_MODE], 1 ; open for read 4770 00012CF2 7407 <1> je short redirstdin_1 4771 <1> redir_acc_denied: 4772 00012CF4 B805000000 <1> mov eax, ERR_ACCESS_DENIED 4773 00012CF9 EB8E <1> jmp short sysstdio_err 4774 <1> redirstdin_1: 4775 00012CFB 880D[D48E0100] <1> mov [u.stdin], cl 4776 <1> redirstdout_2: 4777 00012D01 49 <1> dec ecx 4778 00012D02 880D[6C8E0100] <1> mov [u.r0], cl ; return file descriptor 4779 <1> redirstdin_3: 4780 <1> redirstdout_3: 4781 00012D08 66C705[D68E0100]00- <1> mov word [u.ungetc], 0 4781 00012D10 00 <1> 4782 <1> ; reset u.ungetc and u.getc 4783 00012D11 E9789DFFFF <1> jmp sysret 4784 <1> 4785 <1> redirstdout: 4786 <1> ; CL = file handle (descriptor/index) + 1 4787 00012D16 08C9 <1> or cl, cl 4788 00012D18 7508 <1> jnz short redirstdout_0 4789 00012D1A 880D[D58E0100] <1> mov [u.stdout], cl ; 0 ; reset STDOUT to keyboard 4790 00012D20 EBE6 <1> jmp short redirstdout_3 4791 <1> redirstdout_0: 4792 00012D22 88C8 <1> mov al, cl 4793 00012D24 E875D5FFFF <1> call getf 4794 <1> ; eax = first cluster 4795 <1> ; ebx = system (not user) open file index 4796 00012D29 80BB[18840100]02 <1> cmp byte [ebx+OF_MODE], 2 ; open for write 4797 00012D30 75C2 <1> jne short redir_acc_denied 4798 <1> redirstdout_1: 4799 00012D32 880D[D58E0100] <1> mov [u.stdout], cl 4800 00012D38 EBC7 <1> jmp short redirstdout_2 4801 <1> 4802 <1> readstdinw: 4803 <1> readstdinnw: 4804 <1> ; read a character on stdin (wait) 4805 <1> ;sub eax, eax 4806 00012D3A 3805[D68E0100] <1> cmp byte [u.ungetc], al ; 0 4807 00012D40 761E <1> jna short readstdinw_0 4808 <1> ; read the character in u.getc buffer (put by ungetchar) 4809 00012D42 A2[D68E0100] <1> mov [u.ungetc], al ; 0 4810 00012D47 8605[D78E0100] <1> xchg al, [u.getc] 4811 <1> readstdinw_retn: 4812 00012D4D A2[6C8E0100] <1> mov [u.r0], al 4813 00012D52 E9379DFFFF <1> jmp sysret 4814 <1> 4815 <1> readstdinw_3: 4816 <1> ; 23/08/2024 4817 00012D57 B410 <1> mov ah, 10h 4818 00012D59 E8B4E1FEFF <1> call int16h 4819 00012D5E EBED <1> jmp short readstdinw_retn 4820 <1> 4821 <1> readstdinw_0: 4822 00012D60 A0[D48E0100] <1> mov al, [u.stdin] 4823 00012D65 08C0 <1> or al, al 4824 00012D67 745F <1> jz short readstdinw_1 4825 <1> 4826 <1> readstdinf: 4827 <1> ; 24/08/2024 4828 00012D69 48 <1> dec eax 4829 <1> 4830 <1> ; file 4831 00012D6A 89C3 <1> mov ebx, eax ; File handle (descriptor/index) 4832 <1> ; 18/09/2024 4833 00012D6C B9[8B2E0100] <1> mov ecx, charbuf ; buffer address 4834 00012D71 BA01000000 <1> mov edx, 1 ; 1 character only 4835 <1> 4836 <1> ; 18/09/2024 4837 <1> ;;; 4838 00012D76 E825D5FFFF <1> call getf1 4839 00012D7B 722B <1> jc short redirect_fno_err 4840 <1> 4841 <1> readstdinf_@: 4842 <1> ; eax = first cluster 4843 <1> ; ebx = file descriptor (system, open files) 4844 <1> 4845 00012D7D E882A4FFFF <1> call rw1 4846 00012D82 7229 <1> jc short redirection_err 4847 <1> 4848 00012D84 FE05[D28E0100] <1> inc byte [u.kcall] 4849 <1> ;mov byte [u.kcall], 1 ; >0 means system buffer 4850 <1> ; (buff addr is not virtual) 4851 00012D8A E8F7D8FFFF <1> call readi 4852 <1> 4853 <1> redirected_rw_OK: 4854 00012D8F 31C0 <1> xor eax, eax 4855 00012D91 3905[988E0100] <1> cmp [u.nread], eax ; 0 4856 00012D97 7623 <1> jna short readstdinf_EOF 4857 <1> 4858 00012D99 A0[8B2E0100] <1> mov al, [charbuf] 4859 <1> ;redirected_w_not_OK: 4860 00012D9E A3[6C8E0100] <1> mov [u.r0], eax 4861 00012DA3 E9E69CFFFF <1> jmp sysret 4862 <1> 4863 <1> redirect_fno_err: 4864 00012DA8 B80A000000 <1> mov eax, ERR_FILE_NOT_OPEN ; file not open ! 4865 <1> redirection_err: 4866 00012DAD A3[D88E0100] <1> mov [u.error], eax 4867 <1> readstdinf_EOF_@: 4868 00012DB2 A3[6C8E0100] <1> mov [u.r0], eax ; error code ; 0 = EOF 4869 00012DB7 E9B29CFFFF <1> jmp error 4870 <1> 4871 <1> readstdinf_EOF: 4872 <1> ; 'end of file !' error 4873 00012DBC C705[D88E0100]1000- <1> mov dword [u.error], ERR_FILE_EOF ; 16 4873 00012DC4 0000 <1> 4874 00012DC6 EBEA <1> jmp short readstdinf_EOF_@ 4875 <1> ;;; 4876 <1> 4877 <1> readstdinw_1: 4878 <1> ; 18/09/2024 4879 00012DC8 20DB <1> and bl, bl 4880 00012DCA 748B <1> jz short readstdinw_3 ; wait (int16h, 10h) 4881 <1> ; no wait (int16h, 11h) 4882 00012DCC B411 <1> mov ah,11h ; EXTENDED ASCII STATUS 4883 00012DCE E83FE1FEFF <1> call int16h 4884 <1> ; ah = scan code, al = ascii code 4885 <1> ;jnz short readstdinw_retn 4886 <1> ; 23/08/2024 4887 00012DD3 7582 <1> jnz short readstdinw_3 4888 <1> readstdinw_2: 4889 <1> 4890 <1> ; 23/08/2024 4891 <1> ; ; if zf=1 at here 4892 <1> ; ; it means 'no code available' for function 11h 4893 <1> ; and bl, bl ; 0 ? 4894 <1> ; jz short short readstdinw_retn ; function 10h 4895 <1> ; ; function 11h 4896 <1> ; ; [u.r0] = 0 = eax return 4897 <1> readstdin2w@_retn: 4898 00012DD5 E9B49CFFFF <1> jmp sysret 4899 <1> 4900 <1> writestdoutf: 4901 <1> ; 24/08/2024 4902 00012DDA 48 <1> dec eax 4903 <1> 4904 <1> ; file 4905 00012DDB 89C3 <1> mov ebx, eax ; File handle (descriptor/index) 4906 <1> ; 18/09/2024 4907 00012DDD 880D[8B2E0100] <1> mov byte [charbuf], cl 4908 00012DE3 B9[8B2E0100] <1> mov ecx, charbuf 4909 00012DE8 BA01000000 <1> mov edx, 1 ; 1 character only 4910 <1> 4911 <1> ; 18/09/2024 4912 <1> ;;; 4913 00012DED E8AED4FFFF <1> call getf1 4914 00012DF2 72B4 <1> jc short redirect_fno_err 4915 <1> 4916 <1> writestdoutf_@: 4917 <1> ; eax = first cluster 4918 <1> ; ebx = file descriptor (system, open files) 4919 <1> 4920 00012DF4 E80BA4FFFF <1> call rw1 4921 00012DF9 72B2 <1> jc short redirection_err 4922 <1> 4923 00012DFB FE05[D28E0100] <1> inc byte [u.kcall] 4924 <1> ;mov byte [u.kcall], 1 ; >0 means system buffer 4925 <1> ; (buff addr is not virtual) 4926 00012E01 E859DFFFFF <1> call writei 4927 <1> 4928 <1> ;xor eax, eax 4929 <1> ;cmp [u.nread], eax ; 0 4930 <1> ;jna short redirected_w_not_OK 4931 00012E06 EB87 <1> jmp short redirected_rw_OK 4932 <1> ;;; 4933 <1> 4934 <1> writestderr: ; skip redirection 4935 <1> ; STDERR = STDOUT (as file redirection disabled) 4936 00012E08 88C8 <1> mov al, cl ; character 4937 00012E0A A2[6C8E0100] <1> mov [u.r0], al 4938 00012E0F B40E <1> mov ah, 0Eh ; write a character (as tty write) 4939 00012E11 BB07000000 <1> mov ebx, 07h ; video page 0 (and color/attrib 07h) 4940 <1> ; 23/08/2024 4941 00012E16 8A3D[DE760100] <1> mov bh, [ptty] ; ACTIVE_PAGE 4942 00012E1C E8F9E8FEFF <1> call _int10h 4943 00012E21 E9689CFFFF <1> jmp sysret 4944 <1> 4945 <1> readstdin2w: 4946 <1> readstdin2nw: 4947 00012E26 66C705[D68E0100]00- <1> mov word [u.ungetc], 0 4947 00012E2E 00 <1> 4948 <1> ; reset u.ungetc and u.getc 4949 00012E2F B410 <1> mov ah, 10h ; Keyboard, EXTENDED READ 4950 <1> ;cmp bl, 6 4951 00012E31 80FB06 <1> cmp bl, (stdinacsc-stdiofuncs)>>2 4952 00012E34 740B <1> je short readstdin2w_1 ; wait (int16h, 10h) 4953 <1> ; no wait (int16h, 11h) 4954 00012E36 FEC4 <1> inc ah ; function 11h ; EXTENDED ASCII STATUS 4955 <1> 4956 <1> ; 24/08/2024 4957 00012E38 E8D5E0FEFF <1> call int16h 4958 <1> ; ah = scan code, al = ascii code 4959 <1> ;jnz short readstdin2w_retn 4960 <1> ; 23/08/2024 4961 00012E3D 7496 <1> jz short readstdin2w@_retn 4962 <1> ;readstdin2w_1: 4963 <1> 4964 <1> ; 23/08/2024 4965 <1> ; ; if zf=1 at here 4966 <1> ; ; it means 'no code available' for function 11h 4967 <1> ; ;cmp bl, 6 4968 <1> ; cmp bl, (stdinacsc-stdiofuncs)>>2 4969 <1> ; ;je short readstdin2w_retn ; function 10h 4970 <1> ; ; function 11h 4971 <1> ; ; [u.r0] = 0 = eax return 4972 <1> ; ;jmp sysret 4973 <1> ; jne short readstdin2w@_retn 4974 <1> 4975 <1> ; 23/08/2024 4976 00012E3F B410 <1> mov ah, 10h 4977 <1> readstdin2w_1: ; 18/09/2024 4978 00012E41 E8CCE0FEFF <1> call int16h 4979 <1> 4980 <1> readstdin2w_retn: 4981 00012E46 66A3[6C8E0100] <1> mov [u.r0], ax 4982 00012E4C E93D9CFFFF <1> jmp sysret 4983 <1> 4984 <1> writestdout: 4985 <1> ; 18/09/2024 4986 00012E51 A0[D58E0100] <1> mov al, [u.stdout] 4987 00012E56 20C0 <1> and al, al 4988 00012E58 7580 <1> jnz short writestdoutf ; 18/09/2024 4989 <1> 4990 <1> writestdout_1: 4991 <1> ;mov byte [ccolor], 07h ; default color (CGA) 4992 <1> ; (black background, light gray character) 4993 <1> ; 18/09/2024 4994 00012E5A B507 <1> mov ch, 07h 4995 <1> writestdoutcc: 4996 00012E5C BE[6C8E0100] <1> mov esi, u.r0 ; buffer 4997 <1> ; 18/09/2024 4998 00012E61 880E <1> mov [esi], cl ; character 4999 <1> ;;cmp bl, 8 ; write char and color 5000 <1> ;cmp bl, (stdoutcc-stdiofuncs)>>2 5001 <1> ;jne short writestdout_2 5002 00012E63 882D[DF760100] <1> mov byte [ccolor], ch ; color/attribute (CGA) 5003 <1> writestdout_2: 5004 00012E69 E8A9D6FFFF <1> call print_cmsg 5005 <1> ; 18/09/2024 5006 <1> ;mov byte [ccolor], 07h ; set default color again 5007 <1> 5008 <1> ; [u.r0] = written character (AL) 5009 00012E6E E91B9CFFFF <1> jmp sysret 5010 <1> 5011 <1> ungetchar: 5012 <1> ; put a character back in u.getc STDIN buffer 5013 00012E73 C605[D68E0100]01 <1> mov byte [u.ungetc], 1 5014 00012E7A 880D[D78E0100] <1> mov [u.getc], cl 5015 00012E80 880D[6C8E0100] <1> mov [u.r0],cl 5016 00012E86 E9039CFFFF <1> jmp sysret 5017 <1> 5018 <1> ; 18/09/2024 5019 00012E8B 00 <1> charbuf: db 0 5020 <1> 5021 <1> otty: 5022 <1> sret: 5023 <1> ocvt: 5024 <1> ctty: 5025 <1> cret: 5026 <1> ccvt: 5027 <1> rtty: 5028 <1> wtty: 5029 <1> rmem: 5030 <1> wmem: 5031 <1> rfd: 5032 <1> rhd: 5033 <1> wfd: 5034 <1> whd: 5035 <1> rlpt: 5036 <1> wlpt: 5037 <1> rcvt: 5038 <1> xmtt: 5039 00012E8C C3 <1> retn 3441 %include 'trdosk9.s' ; 04/01/2016 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - INITIALIZED DATA : trdosk9.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 10/02/2026 (Previous: 29/12/2024 - Kernel v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 04/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; ---------------------------------------------------------------------------- 9 <1> ; Assembler: NASM version 2.15 (trdos386.s) 10 <1> ; ---------------------------------------------------------------------------- 11 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 12 <1> ; TRDOS2.ASM (09/11/2011) 13 <1> ; **************************************************************************** 14 <1> ; DRV_INIT.ASM [26/09/2009] Last Update: 07/08/2011 15 <1> ; MAINPROG.ASM [17/01/2004] Last Update: 09/11/2011 16 <1> ; CMD_INTR.ASM [29/01/2005] Last Update: 09/11/2011 17 <1> ; FILE.ASM [29/10/2009] Last Update: 09/10/2011 18 <1> 19 <1> ; 12/02/2016 20 <1> Last_DOS_DiskNo: 21 00012E8D 01 <1> db 1 ; A: = 0 & B: = 1 22 <1> 23 <1> Restore_CDIR: 24 00012E8E FF <1> db 0FFh ; Initial value -> any number except 0 25 <1> 26 <1> msg_CRLF_temp: 27 00012E8F 070D0A00 <1> db 07h, 0Dh, 0Ah, 0 28 <1> 29 <1> Magic_Bytes: 30 00012E93 04 <1> db 4 31 00012E94 01 <1> db 1 32 <1> mainprog_Version: 33 00012E95 07 <1> db 7 34 00012E96 5B5452444F535D204D- <1> db "[TRDOS] Main Program v2.0.10 (10/02/2026)" 34 00012E9F 61696E2050726F6772- <1> 34 00012EA8 616D2076322E302E31- <1> 34 00012EB1 30202831302F30322F- <1> 34 00012EBA 3230323629 <1> 35 00012EBF 0D0A <1> db 0Dh, 0Ah 36 00012EC1 286329204572646F67- <1> db "(c) Erdogan Tan 2005-2026" 36 00012ECA 616E2054616E203230- <1> 36 00012ED3 30352D32303236 <1> 37 00012EDA 0D0A00 <1> db 0Dh, 0Ah, 0 38 <1> 39 <1> MainProgCfgFile: ; 14/04/2016 40 00012EDD 4D41494E50524F472E- <1> db "MAINPROG.CFG", 0 40 00012EE6 43464700 <1> 41 <1> 42 <1> TRDOSPromptLabel: 43 00012EEA 5452444F53 <1> db "TRDOS" 44 00012EEF 00 <1> db 0 45 00012EF0 00 <1> times 5 db 0 46 00012EF5 00 <1> db 0 47 <1> 48 <1> ; INTERNAL COMMANDS 49 <1> Command_List: 50 00012EF6 44495200 <1> Cmd_Dir: db "DIR", 0 51 00012EFA 434400 <1> Cmd_Cd: db "CD", 0 52 00012EFD 433A00 <1> Cmd_Drive: db "C:", 0 53 00012F00 56455200 <1> Cmd_Ver: db "VER", 0 54 00012F04 4558495400 <1> Cmd_Exit: db "EXIT", 0 55 00012F09 50524F4D505400 <1> Cmd_Prompt: db "PROMPT", 0 56 00012F10 564F4C554D4500 <1> Cmd_Volume: db "VOLUME", 0 57 00012F17 4C4F4E474E414D4500 <1> Cmd_LongName: db "LONGNAME", 0 58 00012F20 4441544500 <1> Cmd_Date: db "DATE", 0 59 00012F25 54494D4500 <1> Cmd_Time: db "TIME", 0 60 00012F2A 52554E00 <1> Cmd_Run: db "RUN", 0 61 00012F2E 53455400 <1> Cmd_Set: db "SET", 0 62 00012F32 434C5300 <1> Cmd_Cls: db "CLS", 0 63 00012F36 53484F5700 <1> Cmd_Show: db "SHOW", 0 64 00012F3B 44454C00 <1> Cmd_Del: db "DEL", 0 65 00012F3F 41545452494200 <1> Cmd_Attrib: db "ATTRIB", 0 66 00012F46 52454E414D4500 <1> Cmd_Rename: db "RENAME", 0 67 00012F4D 524D44495200 <1> Cmd_Rmdir: db "RMDIR", 0 68 00012F53 4D4B44495200 <1> Cmd_Mkdir: db "MKDIR", 0 69 00012F59 434F505900 <1> Cmd_Copy: db "COPY", 0 70 00012F5E 4D4F564500 <1> Cmd_Move: db "MOVE", 0 71 00012F63 5041544800 <1> Cmd_Path: db "PATH", 0 72 00012F68 4D454D00 <1> Cmd_Mem: db "MEM", 0 73 00012F6C 00 <1> db 0 74 00012F6D 46494E4400 <1> Cmd_Find: db "FIND", 0 75 00012F72 4543484F00 <1> Cmd_Echo: db "ECHO", 0 76 00012F77 2A00 <1> Cmd_Remark: db "*", 0 77 00012F79 3F00 <1> Cmd_Help: db "?", 0 78 00012F7B 44455649434500 <1> Cmd_Device: db "DEVICE", 0 79 00012F82 4445564C49535400 <1> Cmd_DevList: db "DEVLIST", 0 80 00012F8A 434844495200 <1> Cmd_Chdir: db "CHDIR", 0 81 00012F90 4245455000 <1> Cmd_Beep: db "BEEP", 0 82 <1> 83 00012F95 00 <1> db 0 84 <1> 85 <1> ; 15/02/2016 (FILE.ASM, 09/10/2011) 86 <1> invalid_fname_chars: 87 00012F96 222728292A2B2C2F <1> db 22h, 27h, 28h, 29h, 2Ah, 2Bh, 2Ch, 2Fh 88 00012F9E 3A3B3C3D3E3F40 <1> db 3Ah, 3Bh, 3Ch, 3Dh, 3Eh, 3Fh, 40h 89 00012FA5 5B5C5D5E60 <1> db 5Bh, 5Ch, 5Dh, 5Eh, 60h 90 <1> sizeInvFnChars equ ($ - invalid_fname_chars) 91 <1> ; 92 <1> 93 <1> Msg_Enter_Date: 94 00012FAA 456E746572206E6577- <1> db 'Enter new date (dd-mm-yy): ' 94 00012FB3 206461746520286464- <1> 94 00012FBC 2D6D6D2D7979293A20 <1> 95 00012FC5 00 <1> db 0 96 <1> Msg_Show_Date: 97 00012FC6 43757272656E742064- <1> db 'Current date is ' 97 00012FCF 61746520697320 <1> 98 00012FD6 30 <1> Day: db '0' 99 00012FD7 30 <1> db '0' 100 00012FD8 2F <1> db '/' 101 00012FD9 30 <1> Month: db '0' 102 00012FDA 30 <1> db '0' 103 00012FDB 2F <1> db '/' 104 00012FDC 30 <1> Century: db '0' 105 00012FDD 30 <1> db '0' 106 00012FDE 30 <1> Year: db '0' 107 00012FDF 30 <1> db '0' 108 00012FE0 0D0A00 <1> db 0Dh, 0Ah, 0 109 <1> 110 <1> Msg_Enter_Time: 111 00012FE3 456E746572206E6577- <1> db 'Enter new time: ' 111 00012FEC 2074696D653A20 <1> 112 00012FF3 00 <1> db 0 113 <1> Msg_Show_Time: 114 00012FF4 43757272656E742074- <1> db 'Current time is ' 114 00012FFD 696D6520697320 <1> 115 00013004 30 <1> Hour: db '0' 116 00013005 30 <1> db '0' 117 00013006 3A <1> db ':' 118 00013007 30 <1> Minute: db '0' 119 00013008 30 <1> db '0' 120 00013009 3A <1> db ':' 121 0001300A 30 <1> Second: db '0' 122 0001300B 30 <1> db '0' 123 0001300C 0D0A00 <1> db 0Dh, 0Ah, 0 124 <1> 125 <1> ;VolSize_Unit1: dd 0 126 <1> ;VolSize_Unit2: dd 0 127 <1> 128 <1> VolSize_KiloBytes: 129 0001300F 206B696C6F62797465- <1> db " kilobytes", 0Dh, 0Ah, 0 129 00013018 730D0A00 <1> 130 <1> VolSize_Bytes: 131 0001301C 2062797465730D0A00 <1> db " bytes", 0Dh, 0Ah, 0 132 <1> Volume_in_drive: 133 00013025 0D0A <1> db 0Dh, 0Ah 134 <1> Vol_FS_Name: 135 00013027 54522046533120 <1> db "TR FS1 " 136 0001302E 566F6C756D6520696E- <1> db "Volume in drive " 136 00013037 20647269766520 <1> 137 0001303E 30 <1> Vol_Drv_Name: db 30h 138 0001303F 3A <1> db ":" 139 00013040 20697320 <1> db " is " 140 00013044 0D0A00 <1> db 0Dh, 0Ah, 0 141 <1> Dir_Drive_Str: 142 00013047 54522D444F53204472- <1> db "TR-DOS Drive " 142 00013050 69766520 <1> 143 <1> Dir_Drive_Name: 144 00013054 303A <1> db "0:" 145 00013056 0D0A <1> db 0Dh, 0Ah 146 <1> Vol_Str_Header: 147 00013058 566F6C756D65204E61- <1> db "Volume Name: " 147 00013061 6D653A20 <1> 148 <1> Vol_Name: 149 00013065 00 <1> times 64 db 0 150 000130A5 00 <1> db 0 151 <1> Vol_Serial_Header: 152 000130A6 0D0A <1> db 0Dh, 0Ah 153 000130A8 566F6C756D65205365- <1> db "Volume Serial No: " 153 000130B1 7269616C204E6F3A20 <1> 154 <1> Vol_Serial1: 155 000130BA 30303030 <1> db "0000" 156 000130BE 2D <1> db "-" 157 <1> Vol_Serial2: 158 000130BF 30303030 <1> db "0000" 159 000130C3 0D0A00 <1> db 0Dh, 0Ah, 0 160 <1> 161 <1> ;Vol_Tot_Sec_Str_Start: 162 <1> ; dd 0 163 <1> Vol_Total_Sector_Header: 164 000130C6 0D0A <1> db 0Dh, 0Ah 165 000130C8 566F6C756D65205369- <1> db "Volume Size : ", 0 165 000130D1 7A65203A2000 <1> 166 <1> ;Vol_Tot_Sec_Str: 167 <1> ; db "0000000000" 168 <1> ;Vol_Tot_Sec_Str_End: 169 <1> ; db 0 170 <1> ;Vol_Free_Sectors_Str_Start: 171 <1> ; dd 0 172 <1> Vol_Free_Sectors_Header: 173 000130D7 467265652053706163- <1> db "Free Space : ", 0 173 000130E0 6520203A2000 <1> 174 <1> ;Vol_Free_Sectors_Str: 175 <1> ; db "0000000000" 176 <1> ;Vol_Free_Sectors_Str_End: 177 <1> ; db 0 178 <1> 179 <1> Dir_Str_Header: 180 000130E6 4469726563746F7279- <1> db "Directory: " 180 000130EF 3A20 <1> 181 000130F1 2F <1> Dir_Str_Root: db "/" 182 000130F2 00 <1> Dir_Str: times 64 db 0 183 00013132 00000000 <1> dd 0 184 00013136 00 <1> db 0 185 <1> 186 <1> Msg_Bad_Command: 187 00013137 42616420636F6D6D61- <1> db "Bad command or file name!" 187 00013140 6E64206F722066696C- <1> 187 00013149 65206E616D6521 <1> 188 00013150 0D0A00 <1> db 0Dh, 0Ah, 0 189 <1> 190 <1> msgl_drv_not_ready: 191 00013153 070D0A <1> db 07h, 0Dh, 0Ah 192 <1> 193 <1> ; CMD_INTR.ASM - 09/11/2011 - Messages 194 <1> 195 <1> Msg_Not_Ready_Read_Err: 196 00013156 4472697665206E6F74- <1> db "Drive not ready or read error!" 196 0001315F 207265616479206F72- <1> 196 00013168 207265616420657272- <1> 196 00013171 6F7221 <1> 197 00013174 0D0A00 <1> db 0Dh, 0Ah, 0 198 <1> 199 <1> Msg_Not_Ready_Write_Err: 200 00013177 4472697665206E6F74- <1> db "Drive not ready or write error!" 200 00013180 207265616479206F72- <1> 200 00013189 207772697465206572- <1> 200 00013192 726F7221 <1> 201 00013196 0D0A00 <1> db 0Dh, 0Ah, 0 202 <1> 203 <1> Msg_Dir_Not_Found: 204 00013199 4469726563746F7279- <1> db "Directory not found!" 204 000131A2 206E6F7420666F756E- <1> 204 000131AB 6421 <1> 205 000131AD 0D0A00 <1> db 0Dh, 0Ah, 0 206 <1> 207 <1> Msg_File_Not_Found: 208 000131B0 46696C65206E6F7420- <1> db "File not found!" 208 000131B9 666F756E6421 <1> 209 000131BF 0D0A00 <1> db 0Dh, 0Ah, 0 210 <1> 211 <1> Msg_File_Directory_Not_Found: 212 000131C2 46696C65206F722064- <1> db "File or directory not found!" 212 000131CB 69726563746F727920- <1> 212 000131D4 6E6F7420666F756E64- <1> 212 000131DD 21 <1> 213 000131DE 0D0A00 <1> db 0Dh, 0Ah, 0 214 <1> 215 <1> Msg_LongName_Not_Found: 216 000131E1 4C6F6E67206E616D65- <1> db "Long name not found!" 216 000131EA 206E6F7420666F756E- <1> 216 000131F3 6421 <1> 217 000131F5 0D0A00 <1> db 0Dh, 0Ah, 0 218 <1> 219 <1> beep_Insufficient_Memory: ; 20/02/2017 220 000131F8 0D0A <1> db 0Dh, 0Ah 221 000131FA 07 <1> db 07h 222 <1> Msg_Insufficient_Memory: 223 000131FB 496E73756666696369- <1> db "Insufficient memory!" 223 00013204 656E74206D656D6F72- <1> 223 0001320D 7921 <1> 224 0001320F 0D0A00 <1> db 0Dh, 0Ah, 0 225 <1> 226 <1> Msg_Error_Code: 227 00013212 436F6D6D616E642066- <1> db 'Command failed! Error code : ' 227 0001321B 61696C656421204572- <1> 227 00013224 726F7220636F646520- <1> 227 0001322D 3A20 <1> 228 0001322F 303068 <1> error_code_hex: db '00h' 229 00013232 0D0A00 <1> db 0Dh, 0Ah, 0 230 <1> 231 <1> ; 19/12/2025 232 <1> ;align 2 233 <1> 234 <1> ; 10/02/2016 235 <1> ; DIR.ASM - 09/10/2011 236 <1> 237 00013235 3C4449523E20202020- <1> Type_Dir: db ' ' ; 10 bytes 237 0001323E 20 <1> 238 <1> 239 <1> File_Name: 240 0001323F 20 <1> times 12 db 20h 241 0001324B 20 <1> db 20h 242 <1> Dir_Or_FileSize: 243 0001324C 20 <1> times 10 db 20h 244 00013256 20 <1> db 20h 245 <1> File_Attribute: 246 00013257 20202020 <1> dd 20202020h 247 0001325B 20 <1> db 20h 248 <1> File_Day: 249 0001325C 3030 <1> db '0','0' 250 0001325E 2F <1> db '/' 251 <1> File_Month: 252 0001325F 3030 <1> db '0','0' 253 00013261 2F <1> db '/' 254 <1> File_Year: 255 00013262 30303030 <1> db '0','0','0','0' 256 00013266 20 <1> db 20h 257 <1> File_Hour: 258 00013267 3030 <1> db '0','0' 259 00013269 3A <1> db ':' 260 <1> File_Minute: 261 0001326A 3030 <1> db '0','0' 262 0001326C 00 <1> db 0 263 <1> 264 <1> Decimal_File_Count_Header: 265 0001326D 0D0A <1> db 0Dh, 0Ah 266 <1> Decimal_File_Count: 267 0001326F 00 <1> times 6 db 0 268 <1> 269 00013275 2066696C6528732920- <1> str_files: db " file(s) & " 269 0001327E 2620 <1> 270 <1> Decimal_Dir_Count: 271 00013280 00 <1> times 6 db 0 272 <1> str_dirs: 273 00013286 206469726563746F72- <1> db " directory(s) " 273 0001328F 7928732920 <1> 274 00013294 0D0A00 <1> db 0Dh, 0Ah, 0 275 <1> 276 00013297 206279746528732920- <1> str_bytes: db " byte(s) in file(s)" 276 000132A0 696E2066696C652873- <1> 276 000132A9 29 <1> 277 000132AA 0D0A00 <1> db 0Dh, 0Ah, 0 278 <1> 279 <1> ; CMD_INTR.ASM - 09/11/2011 280 <1> ; 07/10/2010 281 <1> Msg_invalid_name_chars: 282 000132AD 496E76616C69642066- <1> db "Invalid file or directory name characters!" 282 000132B6 696C65206F72206469- <1> 282 000132BF 726563746F7279206E- <1> 282 000132C8 616D65206368617261- <1> 282 000132D1 637465727321 <1> 283 000132D7 0D0A00 <1> db 0Dh, 0Ah, 0 284 <1> ; 21/02/2016 285 000132DA 46696C65206F722064- <1> Msg_Name_Exists: db "File or directory name exists!" 285 000132E3 69726563746F727920- <1> 285 000132EC 6E616D652065786973- <1> 285 000132F5 747321 <1> 286 000132F8 0D0A00 <1> db 0Dh, 0Ah, 0 287 <1> Msg_DoYouWantMkdir: 288 000132FB 446F20796F75207761- <1> db "Do you want to make directory ", 0 288 00013304 6E7420746F206D616B- <1> 288 0001330D 65206469726563746F- <1> 288 00013316 72792000 <1> 289 0001331A 2028592F4E29203F20- <1> Msg_YesNo: db " (Y/N) ? ", 0 289 00013323 00 <1> 290 00013324 000D0A00 <1> Y_N_nextline: db 0, 0Dh, 0Ah, 0 291 00013328 4F4B2E0D0A00 <1> Msg_OK: db "OK.", 0Dh, 0Ah, 0 292 <1> 293 <1> ; 27/02/2016 294 <1> Msg_DoYouWantRmDir: 295 0001332E 446F20796F75207761- <1> db "Do you want to delete directory ", 0 295 00013337 6E7420746F2064656C- <1> 295 00013340 657465206469726563- <1> 295 00013349 746F72792000 <1> 296 <1> Msg_Dir_Not_Empty: 297 0001334F 4469726563746F7279- <1> db "Directory not empty!" 297 00013358 206E6F7420656D7074- <1> 297 00013361 7921 <1> 298 00013363 0D0A00 <1> db 0Dh, 0Ah, 0 299 <1> 300 <1> Msg_DoYouWantDelete: 301 00013366 446F20796F75207761- <1> db "Do you want to delete file ",0 301 0001336F 6E7420746F2064656C- <1> 301 00013378 6574652066696C6520- <1> 301 00013381 00 <1> 302 <1> 303 00013382 44656C657465642E2E- <1> Msg_Deleted: db "Deleted...", 0Dh, 0Ah, 0 303 0001338B 2E0D0A00 <1> 304 <1> 305 <1> Msg_Permission_Denied: 306 0001338F 07 <1> db 7 307 00013390 5065726D697373696F- <1> db "Permission denied!", 0Dh, 0Ah, 0 307 00013399 6E2064656E69656421- <1> 307 000133A2 0D0A00 <1> 308 <1> 309 <1> ; 04/03/2016 310 000133A5 4E657720 <1> Msg_New: db "New " 311 000133A9 00 <1> db 0 312 <1> Str_Attributes: 313 000133AA 417474726962757465- <1> db "Attributes : " 313 000133B3 73203A20 <1> 314 000133B7 4E4F524D414C <1> Attr_Chars: db "NORMAL" 315 000133BD 00 <1> db 0 316 <1> 317 <1> ; 06/03/2016 318 <1> ; CMD_INTR.ASM - 16/11/2010 319 <1> Msg_DoYouWantRename: 320 000133BE 446F20796F75207761- <1> db "Do you want to rename ", 0 320 000133C7 6E7420746F2072656E- <1> 320 000133D0 616D652000 <1> 321 000133D5 66696C652000 <1> Rename_File: db "file ", 0 322 000133DB 6469726563746F7279- <1> Rename_Directory: db "directory ", 0 322 000133E4 2000 <1> 323 000133E6 00 <1> Rename_OldName: times 13 db 0 324 000133F3 20617320 <1> Msg_File_rename_as: db " as " 325 000133F7 00 <1> Rename_NewName: times 13 db 0 326 <1> 327 <1> ; 08/03/2016 328 <1> ; CMD_INTR.ASM - 01/08/2010 - 23/04/2011 329 <1> msg_not_same_drv: 330 00013404 4E6F742073616D6520- <1> db "Not same drive!" 330 0001340D 647269766521 <1> 331 00013413 0D0A00 <1> db 0Dh, 0Ah, 0 332 <1> 333 <1> Msg_DoYouWantMoveFile: 334 00013416 446F20796F75207761- <1> db "Do you want to move file", 0 334 0001341F 6E7420746F206D6F76- <1> 334 00013428 652066696C6500 <1> 335 <1> 336 <1> msg_insufficient_disk_space: 337 0001342F 496E73756666696369- <1> db "Insufficient disk space!" 337 00013438 656E74206469736B20- <1> 337 00013441 737061636521 <1> 338 00013447 0D0A00 <1> db 0Dh, 0Ah, 0 339 <1> 340 <1> ; 01/08/2010 341 <1> msg_source_file: 342 0001344A 0D0A536F7572636520- <1> db 0Dh, 0Ah, "Source file name : " 342 00013453 66696C65206E616D65- <1> 342 0001345C 2020202020203A2020- <1> 342 00013465 20 <1> 343 <1> msg_source_file_drv: 344 00013466 203A00 <1> db " :", 0 345 <1> msg_destination_file: 346 00013469 0D0A44657374696E61- <1> db 0Dh, 0Ah, "Destination file name : " 346 00013472 74696F6E2066696C65- <1> 346 0001347B 206E616D65203A2020- <1> 346 00013484 20 <1> 347 <1> msg_destination_file_drv: 348 00013485 203A00 <1> db " :", 0 349 <1> msg_copy_nextline: 350 00013488 0D0A00 <1> db 0Dh, 0Ah, 0 351 <1> 352 <1> ; 15/03/2016 353 <1> ; CMD_INTR.ASM 354 <1> 355 <1> Msg_DoYouWantOverWriteFile: 356 0001348B 446F20796F75207761- <1> db "Do you want to overwrite file ",0 356 00013494 6E7420746F206F7665- <1> 356 0001349D 727772697465206669- <1> 356 000134A6 6C652000 <1> 357 <1> 358 <1> Msg_DoYouWantCopyFile: 359 000134AA 446F20796F75207761- <1> db "Do you want to copy file",0 359 000134B3 6E7420746F20636F70- <1> 359 000134BC 792066696C6500 <1> 360 <1> 361 <1> Msg_read_file_error_before_EOF: 362 000134C3 46696C652072656164- <1> db "File reading error! (before EOF)" 362 000134CC 696E67206572726F72- <1> 362 000134D5 2120286265666F7265- <1> 362 000134DE 20454F4629 <1> 363 000134E3 0A0A00 <1> db 0Ah, 0Ah, 0 364 <1> 365 <1> ; 18/03/2016 366 <1> ; TRDOS 386 (v2.0) mainprog copy procedure 367 <1> msg_reading: 368 000134E6 52656164696E672E2E- <1> db "Reading... ", 0 368 000134EF 2E2000 <1> 369 <1> msg_writing: 370 000134F2 57726974696E672E2E- <1> db "Writing... ", 0 370 000134FB 2E2000 <1> 371 <1> percentagestr: 372 000134FE 2020202500 <1> db " %", 0 ; " 0%" .. "100%" 373 <1> ; 11/04/2016 374 <1> Msg_No_Set_Space: 375 00013503 496E73756666696369- <1> db "Insufficient environment space!" 375 0001350C 656E7420656E766972- <1> 375 00013515 6F6E6D656E74207370- <1> 375 0001351E 61636521 <1> 376 00013522 0D0A00 <1> db 0Dh, 0Ah, 0 377 <1> ; 18/04/2016 378 <1> isc_msg: 379 00013525 0D0A <1> db 0Dh, 0Ah 380 00013527 494E56414C49442053- <1> db "INVALID SYSTEM CALL", 0 380 00013530 595354454D2043414C- <1> 380 00013539 4C00 <1> 381 <1> usi_msg: 382 0001353B 0D0A <1> db 0Dh, 0Ah 383 0001353D 554E444546494E4544- <1> db "UNDEFINED SOFTWARE INTERRUPT", 0 383 00013546 20534F465457415245- <1> 383 0001354F 20494E544552525550- <1> 383 00013558 5400 <1> 384 <1> ifc_msg: 385 0001355A 0D0A <1> db 0Dh, 0Ah 386 0001355C 494E56414C49442046- <1> db "INVALID FUNCTION CALL" 386 00013565 554E4354494F4E2043- <1> 386 0001356E 414C4C <1> 387 <1> inv_msg_for_trdos_v2: 388 00013571 20 <1> db 20h 389 00013572 666F72205452444F53- <1> db "for TRDOS v2!" 389 0001357B 20763221 <1> 390 0001357F 07 <1> db 07h 391 00013580 0D0A <1> db 0Dh, 0Ah 392 00013582 0D0A <1> db 0Dh, 0Ah 393 00013584 494E5420 <1> db "INT " 394 00013588 303068 <1> int_num_str: db "00h" 395 0001358B 0D0A <1> db 0Dh, 0Ah 396 0001358D 454158203A20 <1> db "EAX : " 397 00013593 303030303030303068- <1> eax_str: db "00000000h", 0Dh, 0Ah 397 0001359C 0D0A <1> 398 0001359E 454950203A20 <1> db "EIP : " 399 000135A4 303030303030303068- <1> eip_str: db "00000000h", 0Dh, 0Ah, 0 399 000135AD 0D0A00 <1> 400 <1> 401 <1> ; 17/04/2021 402 <1> ; ('KDEV' device parameters are disabled as temporary) 403 <1> 404 <1> ; 07/10/2016 405 <1> ; Device names & parameters (for kernel devices) 406 <1> 407 <1> align 2 408 <1> ;KDEV_NAME: 409 <1> ; db 'TTY',0,0,0,0,0 ; 1 410 <1> ; db 'MEM',0,0,0,0,0 ; 2 411 <1> ; db 'FD0',0,0,0,0,0 ; 3 412 <1> ; db 'FD1',0,0,0,0,0 ; 4 413 <1> ; db 'HD0',0,0,0,0,0 ; 5 414 <1> ; db 'HD1',0,0,0,0,0 ; 6 415 <1> ; db 'HD2',0,0,0,0,0 ; 7 416 <1> ; db 'HD3',0,0,0,0,0 ; 8 417 <1> ; db 'LPT',0,0,0,0,0 ; 9 418 <1> ; db 'TTY0',0,0,0,0 ; 10 419 <1> ; db 'TTY1',0,0,0,0 ; 11 420 <1> ; db 'TTY2',0,0,0,0 ; 12 421 <1> ; db 'TTY3',0,0,0,0 ; 13 422 <1> ; db 'TTY4',0,0,0,0 ; 14 423 <1> ; db 'TTY5',0,0,0,0 ; 15 424 <1> ; db 'TTY6',0,0,0,0 ; 16 425 <1> ; db 'TTY7',0,0,0,0 ; 17 426 <1> ; db 'TTY8',0,0,0,0 ; 18 427 <1> ; db 'TTY9',0,0,0,0 ; 19 428 <1> ; db 'COM1',0,0,0,0 ; 18 429 <1> ; db 'COM2',0,0,0,0 ; 19 430 <1> ; ;db 'CONSOLE',0 ; 1 431 <1> ; ;db 'PRINTER',0 ; 9 432 <1> ; ;db 'CDROM' ; 20 433 <1> ; ;db 'CDROM0' ; 20 434 <1> ; ;db 'CDROM1' ; 21 435 <1> ; ;db 'DVD' ; 22 436 <1> ; ;db 'DVD0' ; 22 437 <1> ; ;db 'DVD1' ; 23 438 <1> ; ;db 'USB' ; 24 439 <1> ; ;db 'USB0' ; 24 440 <1> ; ;db 'USB1' ; 25 441 <1> ; ;db 'USB2' ; 26 442 <1> ; ;db 'USB3' ; 27 443 <1> ; ;db 'KEYBOARD' ; 1 444 <1> ; ;db 'MOUSE' ; 28 445 <1> ; ;db 'SOUND' ; 29 446 <1> ; ;db 'VGA',0,0,0,0 ; 30 447 <1> ; ;db 'CGA',0,0,0,0 ; 31 448 <1> ; ;db 'AUDIO',0,0,0 ; 29 449 <1> ; ;db 'VIDEO',0,0,0 ; 32 450 <1> ; ;db 'MUSIC',0,0,0 ; 33 451 <1> ; ;db 'ETHERNET' ; 34 452 <1> ; ;db 'SD0',0,0,0,0,0 ; 35 453 <1> ; ;db 'SD1',0,0,0,0,0 ; 36 454 <1> ; ;db 'SD2',0,0,0,0,0 ; 37 455 <1> ; ;db 'SD3',0,0,0,0,0 ; 38 456 <1> ; ;db 'SATA0' ; 35 457 <1> ; ;db 'SATA1' ; 36 458 <1> ; ;db 'SATA2' ; 37 459 <1> ; ;db 'SATA3' ; 38 460 <1> ; ;db 'PATA0',0,0,0 ; 5 461 <1> ; ;db 'PATA1',0,0,0 ; 6 462 <1> ; ;db 'PATA2',0,0,0 ; 7 463 <1> ; ;db 'PATA3',0,0,0 ; 8 464 <1> ; ;db 'WIRELESS' ; 39 465 <1> ; ;db 'HDMI',0,0,0,0 ; 40 466 <1> ; db 'NULL',0,0,0,0 ; 0 467 <1> 468 <1> ;NumOfKernelDevNames equ ($-KDEV_NAME) / 8 ; 20 (07/10/2016) 469 <1> 470 <1> ;KDEV_NUMBER: 471 <1> ; db 1,2,3,4,5,6,7,8,9 472 <1> ; db 10,11,12,13,14,15,16,17,18,19 473 <1> ; db 18,19,0 474 <1> 475 <1> ;NumOfKernelDevices equ $ - KDEV_NUMBER 476 <1> 477 <1> ;KDEV_OADDR: 478 <1> ; dd otty ;tty ; 1 479 <1> ; dd sret ;mem ; 2 480 <1> ; dd sret ;fd0 ; 3 481 <1> ; dd sret ;fd1 ; 4 482 <1> ; dd sret ;hd0 ; 5 483 <1> ; dd sret ;hd1 ; 6 484 <1> ; dd sret ;hd2 ; 7 485 <1> ; dd sret ;hd3 ; 8 486 <1> ; dd sret ;lpt ; 9 487 <1> ; dd ocvt ;tty0 ; 10 488 <1> ; dd ocvt ;tty1 ; 11 489 <1> ; dd ocvt ;tty2 ; 12 490 <1> ; dd ocvt ;tty3 ; 13 491 <1> ; dd ocvt ;tty4 ; 14 492 <1> ; dd ocvt ;tty5 ; 15 493 <1> ; dd ocvt ;tty6 ; 16 494 <1> ; dd ocvt ;tty7 ; 17 495 <1> ; dd ocvt ;tty8 ; 18 496 <1> ; dd ocvt ;tty9 ; 19 497 <1> ; ;dd ocvt ;com1 ; 18 498 <1> ; ;dd ocvt ;com2 ; 19 499 <1> ; dd sret ;null ; 20 500 <1> ;KDEV_CADDR: 501 <1> ; dd ctty ;tty ; 1 502 <1> ; dd cret ;mem ; 2 503 <1> ; dd cret ;fd0 ; 3 504 <1> ; dd cret ;fd1 ; 4 505 <1> ; dd cret ;hd0 ; 5 506 <1> ; dd cret ;hd1 ; 6 507 <1> ; dd cret ;hd2 ; 7 508 <1> ; dd cret ;hd3 ; 8 509 <1> ; dd cret ;lpt ; 9 510 <1> ; dd ocvt ;tty0 ; 10 511 <1> ; dd ccvt ;tty1 ; 11 512 <1> ; dd ccvt ;tty2 ; 12 513 <1> ; dd ccvt ;tty3 ; 13 514 <1> ; dd ccvt ;tty4 ; 14 515 <1> ; dd ccvt ;tty5 ; 15 516 <1> ; dd ccvt ;tty6 ; 16 517 <1> ; dd ccvt ;tty7 ; 17 518 <1> ; dd ccvt ;tty8 ; 18 519 <1> ; dd ccvt ;tty9 ; 19 520 <1> ; ;dd ccvt ;com1 ; 18 521 <1> ; ;dd ccvt ;com2 ; 19 522 <1> ; dd cret ;null ; 20 523 <1> ; 524 <1> ;KDEV_RADDR: 525 <1> ; dd rtty ;tty ; 1 526 <1> ; dd rmem ;mem ; 2 527 <1> ; dd rfd ;fd0 ; 3 528 <1> ; dd rfd ;fd1 ; 4 529 <1> ; dd rhd ;hd0 ; 5 530 <1> ; dd rhd ;hd1 ; 6 531 <1> ; dd rhd ;hd2 ; 7 532 <1> ; dd rhd ;hd3 ; 8 533 <1> ; dd rlpt ;lpt ; 9 534 <1> ; dd rcvt ;tty0 ; 10 535 <1> ; dd rcvt ;tty1 ; 11 536 <1> ; dd rcvt ;tty2 ; 12 537 <1> ; dd rcvt ;tty3 ; 13 538 <1> ; dd rcvt ;tty4 ; 14 539 <1> ; dd rcvt ;tty5 ; 15 540 <1> ; dd rcvt ;tty6 ; 16 541 <1> ; dd rcvt ;tty7 ; 17 542 <1> ; dd rcvt ;tty8 ; 18 543 <1> ; dd rcvt ;tty9 ; 19 544 <1> ; ;dd rcvt ;com1 ; 18 545 <1> ; ;dd rcvt ;com2 ; 19 546 <1> ; dd rnull ;null ; 20 547 <1> ;KDEV_WADDR: 548 <1> ; dd wtty ;tty ; 1 549 <1> ; dd wmem ;mem ; 2 550 <1> ; dd wfd ;fd0 ; 3 551 <1> ; dd wfd ;fd1 ; 4 552 <1> ; dd whd ;hd0 ; 5 553 <1> ; dd whd ;hd1 ; 6 554 <1> ; dd whd ;hd2 ; 7 555 <1> ; dd whd ;hd3 ; 8 556 <1> ; dd wlpt ;lpt ; 9 557 <1> ; dd xmtt ;tty0 ; 10 558 <1> ; dd xmtt ;tty1 ; 11 559 <1> ; dd xmtt ;tty2 ; 12 560 <1> ; dd xmtt ;tty3 ; 13 561 <1> ; dd xmtt ;tty4 ; 14 562 <1> ; dd xmtt ;tty5 ; 15 563 <1> ; dd xmtt ;tty6 ; 16 564 <1> ; dd xmtt ;tty7 ; 17 565 <1> ; dd xmtt ;tty8 ; 18 566 <1> ; dd xmtt ;tty9 ; 19 567 <1> ; ;dd xmtt ;com1 ; 18 568 <1> ; ;dd xmtt ;com2 ; 19 569 <1> ; dd wnull ;null ; 20 570 <1> 571 <1> ; DEV_ACCESS bits: 572 <1> ; bit 0 = accessable by normal users 573 <1> ; bit 1 = read access permission 574 <1> ; bit 2 = write access permission 575 <1> ; bit 3 = IOCTL permission to users 576 <1> ; bit 4 = block device if it is set 577 <1> ; bit 5 = 16 bit or 1024 byte data 578 <1> ; bit 6 = 32 bit or 2048 byte data 579 <1> ; bit 7 = installable device driver 580 <1> 581 <1> ;KDEV_ACCESS: ; 08/10/2016 582 <1> ; db 00000111b ; tty, 1 583 <1> ; db 00000111b ; mem, 2 584 <1> ; db 10001111b ; fd0, 3 585 <1> ; db 10001111b ; fd1, 4 586 <1> ; db 10001111b ; hd0, 5 587 <1> ; db 10001111b ; hd1, 6 588 <1> ; db 10001111b ; hd2, 7 589 <1> ; db 10001111b ; hd3, 8 590 <1> ; db 00000111b ; lpt, 9 591 <1> ; db 00000111b ; tty0, 10 592 <1> ; db 00000111b ; tty1, 11 593 <1> ; db 00000111b ; tty2, 12 594 <1> ; db 00000111b ; tty3, 13 595 <1> ; db 00000111b ; tty4, 14 596 <1> ; db 00000111b ; tty5, 15 597 <1> ; db 00000111b ; tty6, 16 598 <1> ; db 00000111b ; tty7, 17 599 <1> ; db 00000111b ; tty8, 18 600 <1> ; db 00000111b ; tty9, 19 601 <1> ; ;db 00000111b ; com1, 18 602 <1> ; ;db 00000111b ; com2, 19 603 <1> ; db 00000000b ; null, 0 604 <1> 605 <1> ; 07/10/2016 606 <1> ;NumOfInstallableDevices equ 8 607 <1> ;NUMIDEV equ NumOfInstallableDevices ; 8 608 <1> ;NUMOFDEVICES equ NumOfKernelDevices + NumOfInstallableDevices 609 <1> 610 <1> ; 26/02/2017 611 <1> ; IRQ Callback (& Signal Response Byte) service availibity 612 <1> ; 'syscalbac' 613 <1> ; *************************************************** 614 <1> ; IRQ 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 615 <1> ; --- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 616 <1> ; --- 00 00 00 01 02 03 00 04 00 05 06 07 08 09 00 00 617 <1> ; *************************************************** 618 <1> IRQenum: 619 000135B0 000000010203000400- <1> db 0,0,0,1,2,3,0,4,0,5,6,7,8,9,0,0 619 000135B9 05060708090000 <1> 620 <1> 621 <1> ; 28/08/2017 622 <1> ; 20/08/2017 623 <1> ; DMA Registers (for 'sysdma') 624 <1> ; 02/07/2017 (sb16mod.s) 625 000135C0 00020406C0C4C8CC <1> dma_adr: db 0,2,4,6,0C0h,0C4h,0C8h,0CCh 626 000135C8 01030507C2C6CACE <1> dma_cnt: db 1,3,5,7,0C2h,0C6h,0CAh,0CEh 627 000135D0 878381828F8B898A <1> dma_page: db 87h,83h,81h,82h,8Fh,8Bh,89h,8Ah ; 03/08/2017 628 000135D8 0A0A0A0AD4D4D4D4 <1> dma_mask: db 0Ah,0Ah,0Ah,0Ah,0D4h,0D4h,0D4h,0D4h 629 000135E0 0B0B0B0BD6D6D6D6 <1> dma_mod: db 0Bh,0Bh,0Bh,0Bh,0D6h,0D6h,0D6h,0D6h 630 000135E8 0C0C0C0CD8D8D8D8 <1> dma_flip: db 0Ch,0Ch,0Ch,0Ch,0D8h,0D8h,0D8h,0D8h 3442 3443 ; 27/08/2014 3444 scr_row: 3445 000135F0 E0810B00 dd 0B8000h + 0A0h + 0A0h + 0A0h ; Row 3 3446 scr_col: 3447 000135F4 00000000 dd 0 3448 3449 Align 4 3450 ; 15/04/2016 3451 ; TRDOS 386 (TRDOS v2.0) 3452 3453 ; 21/08/2014 3454 ilist: 3455 ;times 32 dd cpu_except ; INT 0 to INT 1Fh 3456 ; 3457 ; Exception list 3458 ; 25/08/2014 3459 000135F8 [140C0000] dd exc0 ; 0h, Divide-by-zero Error 3460 000135FC [1B0C0000] dd exc1 3461 00013600 [220C0000] dd exc2 3462 00013604 [290C0000] dd exc3 3463 00013608 [2D0C0000] dd exc4 3464 0001360C [310C0000] dd exc5 3465 00013610 [350C0000] dd exc6 ; 06h, Invalid Opcode 3466 00013614 [390C0000] dd exc7 3467 00013618 [3D0C0000] dd exc8 3468 0001361C [410C0000] dd exc9 3469 00013620 [450C0000] dd exc10 3470 00013624 [490C0000] dd exc11 3471 00013628 [4D0C0000] dd exc12 3472 0001362C [510C0000] dd exc13 ; 0Dh, General Protection Fault 3473 00013630 [550C0000] dd exc14 ; 0Eh, Page Fault 3474 00013634 [590C0000] dd exc15 3475 00013638 [5D0C0000] dd exc16 3476 0001363C [610C0000] dd exc17 3477 00013640 [650C0000] dd exc18 3478 00013644 [690C0000] dd exc19 3479 00013648 [6D0C0000] dd exc20 3480 0001364C [710C0000] dd exc21 3481 00013650 [750C0000] dd exc22 3482 00013654 [790C0000] dd exc23 3483 00013658 [7D0C0000] dd exc24 3484 0001365C [810C0000] dd exc25 3485 00013660 [850C0000] dd exc26 3486 00013664 [890C0000] dd exc27 3487 00013668 [8D0C0000] dd exc28 3488 0001366C [910C0000] dd exc29 3489 00013670 [950C0000] dd exc30 3490 00013674 [990C0000] dd exc31 3491 IRQ_list: ; 28/02/2017 ('syscalbac') 3492 ; Interrupt list 3493 00013678 [7E090000] dd timer_int ; INT 20h 3494 ;dd irq0 3495 0001367C [E3100000] dd kb_int ; 24/01/2016 3496 ;dd irq1 3497 00013680 [6A0B0000] dd irq2 3498 ; COM2 int 3499 00013684 [6E0B0000] dd irq3 3500 ; COM1 int 3501 00013688 [790B0000] dd irq4 3502 0001368C [840B0000] dd irq5 3503 ;DISKETTE_INT: ;06/02/2015 3504 00013690 [A44E0000] dd fdc_int ; 16/02/2015, IRQ 6 handler 3505 ;dd irq6 3506 ; Default IRQ 7 handler against spurious IRQs (from master PIC) 3507 ; 25/02/2015 (source: http://wiki.osdev.org/8259_PIC) 3508 00013694 [F00E0000] dd default_irq7 ; 25/02/2015 3509 ;dd irq7 3510 ; Real Time Clock Interrupt 3511 00013698 [F20A0000] dd rtc_int ; 23/02/2015, IRQ 8 handler 3512 ;dd irq8 ; INT 28h 3513 0001369C [940B0000] dd irq9 3514 000136A0 [980B0000] dd irq10 3515 000136A4 [9C0B0000] dd irq11 3516 000136A8 [A00B0000] dd irq12 3517 000136AC [A40B0000] dd irq13 3518 ;HDISK_INT1: ;06/02/2015 3519 000136B0 [E3570000] dd hdc1_int ; 21/02/2015, IRQ 14 handler 3520 ;dd irq14 3521 ;HDISK_INT2: ;06/02/2015 3522 000136B4 [06580000] dd hdc2_int ; 21/02/2015, IRQ 15 handler 3523 ;dd irq15 ; INT 2Fh 3524 ; 14/08/2015 3525 ;dd sysent ; INT 30h (system calls) 3526 3527 ; 15/04/2016 3528 ; TRDOS 386(TRDOS v2.0) Software Interrupts 3529 3530 000136B8 [15370100] dd int30h ; Reserved for 3531 ; !!! Retro UNIX (RUNIX) !!! 3532 ; !!! SINGLIX !!! System Calls 3533 000136BC [72170000] dd int31h ; Video BIOS (IBM PC/AT, Int 10h) 3534 000136C0 [3F0F0000] dd int32h ; Keyboard Functions (IBM PC/AT, Int 16h) 3535 000136C4 [464F0000] dd int33h ; DISK I/O (IBM PC/AT, Int 13h) 3536 000136C8 [9C1B0100] dd int34h ; #IOCTL# (I/O port access support for ring 3) 3537 000136CC [F1620000] dd int35h ; Time/Date Functions (IBM PC/AT, Int 1Ah) 3538 000136D0 [A40D0000] dd ignore_int ; INT 36h : Timer Functions 3539 000136D4 [A40D0000] dd ignore_int ; INT 37h 3540 000136D8 [A40D0000] dd ignore_int ; INT 38h 3541 000136DC [A40D0000] dd ignore_int ; INT 39h 3542 000136E0 [A40D0000] dd ignore_int ; INT 3Ah 3543 000136E4 [A40D0000] dd ignore_int ; INT 3Bh 3544 000136E8 [A40D0000] dd ignore_int ; INT 3Ch 3545 000136EC [A40D0000] dd ignore_int ; INT 3Dh 3546 000136F0 [A40D0000] dd ignore_int ; INT 3Eh 3547 000136F4 [A40D0000] dd ignore_int ; INT 3Fh 3548 000136F8 [D6C80000] dd sysent ; INT 40h : !!! TRDOS 386 System Calls !!! 3549 ;dd ignore_int 3550 000136FC 00000000 dd 0 3551 3552 ; 20/08/2014 3553 ; /* This is the default interrupt "handler" :-) */ 3554 ; Linux v0.12 (head.s) 3555 int_msg: 3556 00013700 556E6B6E6F776E2069- db "Unknown interrupt ! ", 0 3556 00013709 6E7465727275707420- 3556 00013712 212000 3557 3558 ; 15/04/2016 3559 ; TRDOS 386 (TRDOS v2.0) 3560 3561 ; 29/04/2016 3562 int30h: 3563 trdos_isc_routine: 3564 ; 02/05/2016 3565 ; 01/05/2016 3566 ; 29/04/2016 3567 ; 18/04/2016 3568 ; 15/04/2016 (TRDOS 386 = TRDOS v2.0) 3569 ; 17/04/2011 (TRDOS v1.0, 'IFC.ASM') 3570 ; 03/02/2011 ('trdos_ifc_routine') 3571 ; 3572 00013715 8B1C24 mov ebx, [esp] ; EIP (next) 3573 00013718 83EB02 sub ebx, 2 ; EIP (CD ##h) 3574 3575 0001371B 89C1 mov ecx, eax 3576 0001371D 8A4301 mov al, [ebx+1] ; CDh ##h 3577 3578 00013720 66BA1000 mov dx, KDATA 3579 00013724 8EDA mov ds, dx 3580 00013726 8EC2 mov es, dx 3581 3582 00013728 FC cld 3583 00013729 8B15[B0760100] mov edx, [k_page_dir] 3584 0001372F 0F22DA mov cr3, edx 3585 3586 00013732 E8880AFFFF call bytetohex 3587 00013737 66A3[88350100] mov [int_num_str], ax 3588 3589 0001373D 89D8 mov eax, ebx ; EIP 3590 0001373F E8BB0AFFFF call dwordtohex 3591 00013744 8915[A4350100] mov [eip_str], edx 3592 0001374A A3[A8350100] mov [eip_str+4], eax 3593 3594 0001374F 89C8 mov eax, ecx 3595 00013751 E8A90AFFFF call dwordtohex 3596 00013756 8915[93350100] mov [eax_str], edx 3597 0001375C A3[97350100] mov [eax_str+4], eax 3598 3599 00013761 43 inc ebx 3600 00013762 8A03 mov al, [ebx] ; Interrupt number 3601 3602 trdos_isc_handler: 3603 00013764 80FE30 cmp dh, 30h ; Retro UNIX, SINGLIX System calls 3604 00013767 7507 jne short trdos_usi_handler 3605 00013769 BE[25350100] mov esi, isc_msg 3606 0001376E EB05 jmp short loc_write_inv_system_call_msg 3607 3608 trdos_usi_handler: 3609 00013770 BE[3B350100] mov esi, usi_msg 3610 3611 loc_write_inv_system_call_msg: 3612 00013775 E84036FFFF call print_msg 3613 ; 29/04/2016 3614 0001377A BE[71350100] mov esi, inv_msg_for_trdos_v2 3615 0001377F E83636FFFF call print_msg 3616 3617 loc_ifc_terminate_process: 3618 ; u.uno = process number 3619 ; 29/04/2016 3620 3621 ; 02/05/2016 3622 00013784 FE05[608E0100] inc byte [sysflg] ; 0FFh -> 0 3623 3624 0001378A B801000000 mov eax, 1 3625 0001378F E93894FFFF jmp sysexit 3626 3627 ; 07/03/2015 3628 ; Temporary Code 3629 display_disks: 3630 00013794 803D[8C660000]00 cmp byte [fd0_type], 0 3631 0001379B 7605 jna short ddsks1 3632 0001379D E87D000000 call pdskm 3633 ddsks1: 3634 000137A2 803D[8D660000]00 cmp byte [fd1_type], 0 3635 000137A9 760C jna short ddsks2 3636 000137AB C605[EF380100]31 mov byte [dskx], '1' 3637 000137B2 E868000000 call pdskm 3638 ddsks2: 3639 000137B7 803D[8E660000]00 cmp byte [hd0_type], 0 3640 000137BE 7654 jna short ddsk6 3641 000137C0 66C705[ED380100]68- mov word [dsktype], 'hd' 3641 000137C8 64 3642 000137C9 C605[EF380100]30 mov byte [dskx], '0' 3643 000137D0 E84A000000 call pdskm 3644 ddsks3: 3645 000137D5 803D[8F660000]00 cmp byte [hd1_type], 0 3646 000137DC 7636 jna short ddsk6 3647 000137DE C605[EF380100]31 mov byte [dskx], '1' 3648 000137E5 E835000000 call pdskm 3649 ddsks4: 3650 000137EA 803D[90660000]00 cmp byte [hd2_type], 0 3651 000137F1 7621 jna short ddsk6 3652 000137F3 C605[EF380100]32 mov byte [dskx], '2' 3653 000137FA E820000000 call pdskm 3654 ddsks5: 3655 000137FF 803D[91660000]00 cmp byte [hd3_type], 0 3656 00013806 760C jna short ddsk6 3657 00013808 C605[EF380100]33 mov byte [dskx], '3' 3658 0001380F E80B000000 call pdskm 3659 ddsk6: 3660 00013814 BE[17390100] mov esi, nextline 3661 00013819 E806000000 call pdskml 3662 pdskm_ok: 3663 0001381E C3 retn 3664 pdskm: 3665 0001381F BE[EB380100] mov esi, dsk_ready_msg 3666 pdskml: 3667 00013824 AC lodsb 3668 00013825 08C0 or al, al 3669 00013827 74F5 jz short pdskm_ok 3670 00013829 56 push esi 3671 ; 13/05/2016 3672 0001382A BB07000000 mov ebx, 7 ; Black background, 3673 ; light gray forecolor 3674 ; Video page 0 (bh=0) 3675 0001382F E8ABEAFEFF call _write_tty 3676 00013834 5E pop esi 3677 00013835 EBED jmp short pdskml 3678 3679 00013837 90 Align 2 3680 ; 21/08/2014 3681 exc_msg: 3682 00013838 435055206578636570- db "CPU exception ! " 3682 00013841 74696F6E202120 3683 excnstr: ; 25/08/2014 3684 00013848 3F3F68202045495020- db "??h", " EIP : " 3684 00013851 3A20 3685 EIPstr: ; 29/08/2014 3686 00013853 00 times 12 db 0 3687 3688 ; 23/02/2015 3689 ; 25/08/2014 3690 ;scounter: 3691 ; db 5 3692 ; db 19 3693 3694 ; 06/11/2014 3695 ; Memory Information message 3696 ; 14/08/2015 3697 msg_memory_info: 3698 0001385F 07 db 07h 3699 00013860 0D0A db 0Dh, 0Ah 3700 ;db "MEMORY ALLOCATION INFO", 0Dh, 0Ah, 0Dh, 0Ah 3701 00013862 546F74616C206D656D- db "Total memory : " 3701 0001386B 6F7279203A20 3702 mem_total_b_str: ; 10 digits 3703 00013871 303030303030303030- db "0000000000 bytes", 0Dh, 0Ah 3703 0001387A 302062797465730D0A 3704 00013883 202020202020202020- db " ", 20h, 20h, 20h 3704 0001388C 202020202020202020 3705 mem_total_p_str: ; 7 digits 3706 00013895 303030303030302070- db "0000000 pages", 0Dh, 0Ah 3706 0001389E 616765730D0A 3707 000138A4 0D0A db 0Dh, 0Ah 3708 000138A6 46726565206D656D6F- db "Free memory : " 3708 000138AF 727920203A20 3709 free_mem_b_str: ; 10 digits 3710 000138B5 3F3F3F3F3F3F3F3F3F- db "?????????? bytes", 0Dh, 0Ah 3710 000138BE 3F2062797465730D0A 3711 000138C7 202020202020202020- db " ", 20h, 20h, 20h 3711 000138D0 202020202020202020 3712 free_mem_p_str: ; 7 digits 3713 000138D9 3F3F3F3F3F3F3F2070- db "??????? pages", 0Dh, 0Ah 3713 000138E2 616765730D0A 3714 000138E8 0D0A00 db 0Dh, 0Ah, 0 3715 3716 dsk_ready_msg: 3717 000138EB 0D0A db 0Dh, 0Ah 3718 dsktype: 3719 000138ED 6664 db 'fd' 3720 dskx: 3721 000138EF 30 db '0' 3722 000138F0 20 db 20h 3723 000138F1 697320524541445920- db 'is READY ...' 3723 000138FA 2E2E2E 3724 000138FD 00 db 0 3725 3726 setup_error_msg: 3727 000138FE 0D0A db 0Dh, 0Ah 3728 00013900 4469736B2053657475- db 'Disk Setup Error !' 3728 00013909 70204572726F722021 3729 00013912 0D0A00 db 0Dh, 0Ah,0 3730 3731 next2line: ; 08/02/2016 3732 00013915 0D0A db 0Dh, 0Ah 3733 nextline: 3734 00013917 0D0A00 db 0Dh, 0Ah, 0 3735 3736 ; temporary 3737 ; 19/12/2020 3738 msg_lfb_addr: 3739 ;db 0Dh, 0Ah 3740 0001391A 4C696E656172206672- db "Linear frame buffer at " 3740 00013923 616D65206275666665- 3740 0001392C 7220617420 3741 lfb_addr_str: ; 8 (hex) digits 3742 00013931 303030303030303068- db "00000000h", 0Dh, 0Ah 3742 0001393A 0D0A 3743 0001393C 0D0A00 db 0Dh, 0Ah, 0 3744 3745 ; KERNEL - SYSINIT Messages 3746 ; 24/08/2015 3747 ; 13/04/2015 - (Retro UNIX 386 v1 Beginning) 3748 ; 14/07/2013 3749 ;kernel_init_err_msg: 3750 ; db 0Dh, 0Ah 3751 ; db 07h 3752 ; db 'Kernel initialization ERROR !' 3753 ; db 0Dh, 0Ah, 0 3754 3755 ;welcome_msg: 3756 ; db 0Dh, 0Ah 3757 ; db 07h 3758 ; db 'Welcome to TRDOS 386 Operating System !' 3759 ; db 0Dh, 0Ah 3760 ; db 'by Erdogan Tan - 31/12/2017 (v2.0.0)' 3761 ; db 0Dh, 0Ah, 0 3762 3763 panic_msg: 3764 0001393F 0D0A07 db 0Dh, 0Ah, 07h 3765 00013942 4552524F523A204B65- db 'ERROR: Kernel Panic !' 3765 0001394B 726E656C2050616E69- 3765 00013954 632021 3766 00013957 0D0A00 db 0Dh, 0Ah, 0 3767 3768 ;msgl_drv_not_ready: 3769 ; db 07h, 0Dh, 0Ah 3770 ; db 'Drive not ready or read error !' 3771 ; db 0Dh, 0Ah, 0 3772 3773 starting_msg: 3774 ;;;;;;;;db "Turkish Rational DOS v2.0 [18/04/2021] ...", 0 3775 ;;;;;;;db "Turkish Rational DOS v2.0 [11/08/2022] ...", 0 3776 ;;;;;;db "Turkish Rational DOS v2.0 [30/08/2023] ...", 0 3777 ;;;;;db "Turkish Rational DOS v2.0 [07/12/2023] ...", 0 3778 ;;;;db "Turkish Rational DOS v2.0 [23/06/2024] ...", 0 3779 ;;;db "Turkish Rational DOS v2.0 [29/12/2024] ...", 0 3780 ;;db "Turkish Rational DOS v2.0 [28/01/2025] ...", 0 3781 ;db "Turkish Rational DOS v2.0 [28/12/2025] ...", 0 3782 0001395A 5475726B6973682052- db "Turkish Rational DOS v2.0 [10/02/2026] ...", 0 3782 00013963 6174696F6E616C2044- 3782 0001396C 4F532076322E30205B- 3782 00013975 31302F30322F323032- 3782 0001397E 365D202E2E2E00 3783 3784 NextLine: 3785 00013985 0D0A00 db 0Dh, 0Ah, 0 3786 3787 %include 'audio.s' ; 03/04/2017 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.10 - audio.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 28/01/2025 (Previous: 06/06/2024 - Kernel v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 03/04/2017 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; **************************************************************************** 10 <1> 11 <1> ; AUDIO CONTROLLER & CODEC DEFINITIONS & CODE FOR TRDOS 386 12 <1> 13 <1> ;============================================================================= 14 <1> ; EQUATES 15 <1> ;============================================================================= 16 <1> 17 <1> ; PCI EQUATES 18 <1> 19 <1> BIT0 EQU 1 20 <1> BIT1 EQU 2 21 <1> BIT2 EQU 4 22 <1> BIT3 EQU 8 23 <1> BIT4 EQU 10h 24 <1> BIT5 EQU 20h 25 <1> BIT6 EQU 40h 26 <1> BIT7 EQU 80h 27 <1> BIT8 EQU 100h 28 <1> BIT9 EQU 200h 29 <1> BIT10 EQU 400h 30 <1> BIT11 EQU 800h 31 <1> BIT12 EQU 1000h 32 <1> BIT13 EQU 2000h 33 <1> BIT14 EQU 4000h 34 <1> BIT15 EQU 8000h 35 <1> BIT16 EQU 10000h 36 <1> BIT17 EQU 20000h 37 <1> BIT18 EQU 40000h 38 <1> BIT19 EQU 80000h 39 <1> BIT20 EQU 100000h 40 <1> BIT21 EQU 200000h 41 <1> BIT22 EQU 400000h 42 <1> BIT23 EQU 800000h 43 <1> BIT24 EQU 1000000h 44 <1> BIT25 EQU 2000000h 45 <1> BIT26 EQU 4000000h 46 <1> BIT27 EQU 8000000h 47 <1> BIT28 EQU 10000000h 48 <1> BIT29 EQU 20000000h 49 <1> BIT30 EQU 40000000h 50 <1> BIT31 EQU 80000000h 51 <1> NOT_BIT31 EQU 7FFFFFFFh 52 <1> 53 <1> ; PCI equates 54 <1> ; PCI function address (PFA) 55 <1> ; bit 31 = 1 56 <1> ; bit 23:16 = bus number (0-255) 57 <1> ; bit 15:11 = device number (0-31) 58 <1> ; bit 10:8 = function number (0-7) 59 <1> ; bit 7:0 = register number (0-255) 60 <1> 61 <1> IO_ADDR_MASK EQU 0FFFEh ; mask off bit 0 for reading BARs 62 <1> PCI_INDEX_PORT EQU 0CF8h 63 <1> PCI_DATA_PORT EQU 0CFCh 64 <1> PCI32 EQU BIT31 ; bitflag to signal 32bit access 65 <1> PCI16 EQU BIT30 ; bitflag for 16bit access 66 <1> NOT_PCI32_PCI16 EQU 03FFFFFFFh ; NOT BIT31+BIT30 ; 19/03/2017 67 <1> 68 <1> PCI_FN0 EQU 0 << 8 69 <1> PCI_FN1 EQU 1 << 8 70 <1> PCI_FN2 EQU 2 << 8 71 <1> PCI_FN3 EQU 3 << 8 72 <1> PCI_FN4 EQU 4 << 8 73 <1> PCI_FN5 EQU 5 << 8 74 <1> PCI_FN6 EQU 6 << 8 75 <1> PCI_FN7 EQU 7 << 8 76 <1> 77 <1> PCI_CMD_REG EQU 04h ; reg 04, command reg 78 <1> IO_ENA EQU BIT0 ; i/o decode enable 79 <1> MEM_ENA EQU BIT1 ; memory decode enable 80 <1> BM_ENA EQU BIT2 ; bus master enable 81 <1> 82 <1> ; VIA VT8233 EQUATES 83 <1> 84 <1> VIA_VID equ 1106h ; VIA's PCI vendor ID 85 <1> VT8233_DID equ 3059h ; VT8233 (VT8235) device ID 86 <1> 87 <1> PCI_IO_BASE equ 10h 88 <1> AC97_INT_LINE equ 3Ch 89 <1> VIA_ACLINK_CTRL equ 41h 90 <1> VIA_ACLINK_STAT equ 40h 91 <1> VIA_ACLINK_C00_READY equ 01h ; primary codec ready 92 <1> 93 <1> VIA_REG_AC97 equ 80h ; dword 94 <1> 95 <1> VIA_ACLINK_CTRL_ENABLE equ 80h ; 0: disable, 1: enable 96 <1> VIA_ACLINK_CTRL_RESET equ 40h ; 0: assert, 1: de-assert 97 <1> VIA_ACLINK_CTRL_SYNC equ 20h ; 0: release SYNC, 1: force SYNC hi 98 <1> VIA_ACLINK_CTRL_VRA equ 08h ; 0: disable VRA, 1: enable VRA 99 <1> VIA_ACLINK_CTRL_PCM equ 04h ; 0: disable PCM, 1: enable PCM 100 <1> ; 3D Audio Channel slots 3/4 101 <1> VIA_ACLINK_CTRL_INIT equ (VIA_ACLINK_CTRL_ENABLE + VIA_ACLINK_CTRL_RESET + VIA_ACLINK_CTRL_PCM + VIA_ACLINK_CTRL_VRA) 105 <1> 106 <1> CODEC_AUX_VOL equ 04h 107 <1> VIA_REG_AC97_BUSY equ 01000000h ;(1<<24) 108 <1> VIA_REG_AC97_CMD_SHIFT equ 10h ; 16 109 <1> VIA_REG_AC97_PRIMARY_VALID equ 02000000h ;(1<<25) 110 <1> VIA_REG_AC97_READ equ 00800000h ;(1<<23) 111 <1> VIA_REG_AC97_CODEC_ID_SHIFT equ 1Eh ; 30 112 <1> VIA_REG_AC97_CODEC_ID_PRIMARY equ 0 113 <1> VIA_REG_AC97_DATA_SHIFT equ 0 114 <1> VIADEV_PLAYBACK equ 0 115 <1> VIA_REG_OFFSET_STATUS equ 0 ;; byte - channel status 116 <1> VIA_REG_OFFSET_CONTROL equ 01h ;; byte - channel control 117 <1> VIA_REG_CTRL_START equ 80h ;; WO 118 <1> VIA_REG_CTRL_TERMINATE equ 40h ;; WO 119 <1> VIA_REG_CTRL_PAUSE equ 08h ;; RW 120 <1> VIA_REG_CTRL_RESET equ 01h ;; RW - probably reset? undocumented 121 <1> VIA_REG_OFFSET_STOP_IDX equ 08h ;; dword - stop index, channel type, sample rate 122 <1> VIA8233_REG_TYPE_16BIT equ 200000h ;; RW 123 <1> VIA8233_REG_TYPE_STEREO equ 100000h ;; RW 124 <1> VIA_REG_OFFSET_CURR_INDEX equ 0Fh ;; byte - channel current index (for via8233 only) 125 <1> VIA_REG_OFFSET_TABLE_PTR equ 04h ;; dword - channel table pointer 126 <1> VIA_REG_OFFSET_CURR_PTR equ 04h ;; dword - channel current pointer 127 <1> VIA_REG_OFS_PLAYBACK_VOLUME_L equ 02h ;; byte 128 <1> VIA_REG_OFS_PLAYBACK_VOLUME_R equ 03h ;; byte 129 <1> VIA_REG_CTRL_AUTOSTART equ 20h 130 <1> VIA_REG_CTRL_INT_EOL equ 02h 131 <1> VIA_REG_CTRL_INT_FLAG equ 01h 132 <1> VIA_REG_CTRL_INT equ (VIA_REG_CTRL_INT_FLAG + VIA_REG_CTRL_INT_EOL + VIA_REG_CTRL_AUTOSTART) 135 <1> 136 <1> VIA_REG_STAT_STOP_IDX equ 10h ;; RO ; 27/07/2020 137 <1> ; current index = stop index 138 <1> VIA_REG_STAT_STOPPED equ 04h ;; RWC 139 <1> VIA_REG_STAT_EOL equ 02h ;; RWC 140 <1> VIA_REG_STAT_FLAG equ 01h ;; RWC 141 <1> VIA_REG_STAT_ACTIVE equ 80h ;; RO 142 <1> ; 28/11/2016 143 <1> VIA_REG_STAT_LAST equ 40h ;; RO 144 <1> VIA_REG_STAT_TRIGGER_QUEUED equ 08h ;; RO 145 <1> VIA_REG_CTRL_INT_STOP equ 04h ; Interrupt on Current Index = Stop Index 146 <1> ; and End of Block 147 <1> 148 <1> VIA_REG_OFFSET_CURR_COUNT equ 0Ch ;; dword - channel current count, index 149 <1> 150 <1> PORTB EQU 061h 151 <1> REFRESH_STATUS EQU 010h ; Refresh signal status 152 <1> 153 <1> ; AC97 Codec registers. 154 <1> 155 <1> ; 22/07/2020 156 <1> ; REALTEK ALC655 and ADI SOUNDMAX AD1980 CODEC MIXER REGISTERS 157 <1> 158 <1> ; each codec/mixer register is 16bits 159 <1> 160 <1> CODEC_RESET_REG equ 00h ; reset codec 161 <1> CODEC_MASTER_VOL_REG equ 02h ; master volume 162 <1> CODEC_HP_VOL_REG equ 04h ; headphone volume ; AD1980 163 <1> CODEC_MASTER_MONO_VOL_REG equ 06h ; master mono volume (mono-out) 164 <1> ;CODEC_MASTER_TONE_REG equ 08h ; master tone (R+L) ; (not used) 165 <1> CODEC_PCBEEP_VOL_REG equ 0Ah ; PC beep volume ; ALC655 166 <1> CODEC_PHONE_VOL_REG equ 0Ch ; phone volume 167 <1> CODEC_MIC_VOL_REG equ 0Eh ; mic volume 168 <1> CODEC_LINE_IN_VOL_REG equ 10h ; line in volume 169 <1> CODEC_CD_VOL_REG equ 12h ; CD volume 170 <1> ;CODEC_VID_VOL_REG equ 14h ; video volume ; (not used) 171 <1> CODEC_AUX_VOL_REG equ 16h ; aux volume 172 <1> CODEC_PCM_OUT_REG equ 18h ; PCM out volume 173 <1> CODEC_RECORD_SELECT_REG equ 1Ah ; record select 174 <1> CODEC_RECORD_VOL_REG equ 1Ch ; record volume (record gain) 175 <1> ;CODEC_RECORD_MIC_VOL_REG equ 1Eh ; record mic volume ; (not used) 176 <1> CODEC_GP_REG equ 20h ; general purpose 177 <1> ;CODEC_3D_CONTROL_REG equ 22h ; 3D control 178 <1> ;;CODEC_AUDIO_INT_PAGING_REG equ 24h ; audio int & paging ; (not used) 179 <1> CODEC_POWER_CTRL_REG equ 26h ; power down control 180 <1> CODEC_EXT_AUDIO_REG equ 28h ; extended audio ID 181 <1> CODEC_EXT_AUDIO_CTRL_REG equ 2Ah ; extended audio status/control 182 <1> CODEC_PCM_FRONT_DACRATE_REG equ 2Ch ; PCM front sample rate 183 <1> CODEC_PCM_SURND_DACRATE_REG equ 2Eh ; PCM surround sample rate 184 <1> CODEC_PCM_LFE_DACRATE_REG equ 30h ; PCM Center/LFE sample rate 185 <1> CODEC_LR_ADCRATE_REG equ 32h ; PCM input sample rate 186 <1> CODEC_MIC_ADCRATE_REG equ 34h ; mic in sample rate ; AD1980 187 <1> CODEC_PCM_LFE_VOL_REG equ 36h ; PCM Center/LFE volume 188 <1> CODEC_PCM_SURND_VOL_REG equ 38h ; PCM surround volume 189 <1> ;CODEC_SPDIF_CTRL_REG equ 3Ah ; S/PDIF control 190 <1> ; 22/07/2020 191 <1> CODEC_MISC_CRTL_BITS_REG equ 76h ; misc control bits ; AD1980 192 <1> ; 193 <1> CODEC_VENDOR_ID1 equ 7Ch ; REALTEK: 414Ch, ADI: 4144h 194 <1> CODEC_VENDOR_ID2 equ 7Eh ; REALTEK: 4760h, ADI: 5370h 195 <1> 196 <1> ; VT8233 SGD bits (21/04/2017) 197 <1> FLAG EQU BIT30 198 <1> EOL EQU BIT31 199 <1> 200 <1> ; INTEL ICH EQUATES 201 <1> ; 28/05/2017 202 <1> INTEL_VID equ 8086h ; Intel's PCI vendor ID 203 <1> ; 20/11/2023 204 <1> ; (playwav2.com, ac97.inc, Erdogan Tan, 11/11/2023) 205 <1> ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004) 206 <1> SIS_VID equ 1039h 207 <1> NVIDIA_VID equ 10DEh ; Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source c. 208 <1> AMD_VID equ 1022h 209 <1> ; 210 <1> ICH_DID equ 2415h ; ICH (82801AA) device ID 211 <1> ; 20/11/2023 212 <1> ; (playwav2.com, ac97.inc, Erdogan Tan, 11/11/2023) 213 <1> ; 17/02/2017 (Erdogan Tan, ref: ALSA Device IDs, ALSA project) 214 <1> ICH0_DID equ 2425h ; ICH0 215 <1> ICH2_DID equ 2445h ; ICH2 216 <1> ICH3_DID equ 2485h ; ICH3 217 <1> ICH4_DID equ 24C5h ; ICH4 218 <1> ICH5_DID equ 24D5h ; ICH5 219 <1> ICH6_DID equ 266Eh ; ICH6 220 <1> ESB6300_DID equ 25A6h ; 6300ESB 221 <1> ESB631X_DID equ 2698h ; 631XESB 222 <1> ICH7_DID equ 27DEh ; ICH7 223 <1> ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004) 224 <1> MX82440_DID equ 7195h 225 <1> SI7012_DID equ 7012h 226 <1> NFORCE_DID equ 01B1h 227 <1> NFORCE2_DID equ 006Ah 228 <1> AMD8111_DID equ 746Dh 229 <1> AMD768_DID equ 7445h 230 <1> ; 03/11/2023 - Erdogan Tan - Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source code 231 <1> CK804_DID equ 0059h ; NFORCE4 232 <1> MCP04_DID equ 003Ah 233 <1> CK8_DID equ 008Ah 234 <1> NFORCE3_DID equ 00DAh 235 <1> CK8S_DID equ 00EAh 236 <1> 237 <1> NAMBAR_REG equ 10h ; native audio mixer Base Address Register 238 <1> NABMBAR_REG equ 14h ; native audio bus mastering Base Addr Reg 239 <1> 240 <1> PI_CR_REG equ 0Bh ; PCM in Control Register 241 <1> PO_CR_REG equ 1Bh ; PCM out Control Register 242 <1> MC_CR_REG equ 2Bh ; MIC in Control Register 243 <1> 244 <1> PI_SR_REG equ 6 ; PCM in Status register 245 <1> PO_SR_REG equ 16h ; PCM out Status register 246 <1> MC_SR_REG equ 26h ; MIC in Status register 247 <1> 248 <1> IOCE equ BIT4 ; interrupt on complete enable. 249 <1> FEIFE equ BIT3 ; set if you want an interrupt to fire 250 <1> LVBIE equ BIT2 ; last valid buffer interrupt enable. 251 <1> RR equ BIT1 ; reset registers. Nukes all regs 252 <1> ; except bits 4:2 of this register. 253 <1> ; Only set this bit if BIT 0 is 0 254 <1> RPBM equ BIT0 ; Run/Pause 255 <1> ; set this bit to start the codec! 256 <1> 257 <1> PI_BDBAR_REG equ 0 ; PCM in buffer descriptor BAR 258 <1> PO_BDBAR_REG equ 10h ; PCM out buffer descriptor BAR 259 <1> MC_BDBAR_REG equ 20h ; MIC in buffer descriptor BAR 260 <1> 261 <1> PI_CIV_REG equ 4 ; PCM in current Index value (RO) 262 <1> PO_CIV_REG equ 14h ; PCM out current Index value (RO) 263 <1> MC_CIV_REG equ 24h ; MIC in current Index value (RO) 264 <1> 265 <1> PI_LVI_REG equ 5 ; PCM in Last Valid Index 266 <1> PO_LVI_REG equ 15h ; PCM out Last Valid Index 267 <1> MC_LVI_REG equ 25h ; MIC in Last Valid Index 268 <1> 269 <1> IOC equ BIT31 ; Fire an interrupt whenever this 270 <1> ; buffer is complete. 271 <1> BUP equ BIT30 ; Buffer Underrun Policy. 272 <1> 273 <1> GLOB_CNT_REG equ 2Ch ; Global Control Register 274 <1> GLOB_STS_REG equ 30h ; Global Status register (RO) 275 <1> 276 <1> CTRL_ST_CREADY equ BIT8+BIT9+BIT28 ; Primary Codec Ready 277 <1> 278 <1> CODEC_REG_POWERDOWN equ 26h 279 <1> CODEC_REG_ST equ 26h 280 <1> 281 <1> ; 22/06/2017 282 <1> PO_PICB_REG equ 18h ; PCM Out Position In Current Buffer Register 283 <1> 284 <1> ; 19/11/2023 285 <1> AC97_EA_VRA equ BIT0 286 <1> ; 24/11/2023 287 <1> BCIS equ BIT3 ; Buffer Completion Interrupt Status 288 <1> 289 <1> ;============================================================================= 290 <1> ; CODE 291 <1> ;============================================================================= 292 <1> 293 <1> ; CODE for INTEL ICH AC'97 AUDIO CONTROLLER 294 <1> 295 <1> DetectICH: 296 <1> ; 22/11/2023 297 <1> ; 19/11/2023 298 <1> ; 01/11/2023 - TRDOS 386 Kernel v2.0.7 299 <1> ;; 10/06/2017 300 <1> ;; 05/06/2017 301 <1> ;; 29/05/2017 302 <1> ;; 28/05/2017 303 <1> ;mov eax, (ICH_DID << 16) + INTEL_VID 304 <1> ;call pciFindDevice 305 <1> ;jnc short d_ac97_1 306 <1> ; 307 <1> ;; 01/11/2023 308 <1> ;mov eax, (NFORCE_DID << 16) + NFORCE_VID 309 <1> ;call pciFindDevice 310 <1> ;jnc short d_ac97_1 311 <1> 312 <1> ; 19/11/2023 313 00013988 BE[AB470100] <1> mov esi, valid_ids ; address of Valid ICH (AC97) Device IDs 314 0001398D B915000000 <1> mov ecx, valid_id_count 315 <1> pfd_1: 316 00013992 AD <1> lodsd 317 00013993 E857000000 <1> call pciFindDevice 318 00013998 730F <1> jnc short d_ac97_1 319 0001399A E2F6 <1> loop pfd_1 320 <1> ;stc 321 <1> 322 <1> d_ac97_0: 323 <1> ; couldn't find the audio device! 324 0001399C C3 <1> retn 325 <1> 326 <1> ; CODE for VIA VT8233 AUDIO CONTROLLER 327 <1> 328 <1> DetectVT8233: 329 <1> ; 22/11/2023 330 <1> ; 02/11/2023 331 <1> ; 01/11/2023 - TRDOS 386 Kernel v2.0.7 332 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 333 <1> ; 10/06/2017 334 <1> ; 05/06/2017 335 <1> ; 29/05/2017 336 <1> ; 03/04/2017 337 0001399D B806115930 <1> mov eax, (VT8233_DID << 16) + VIA_VID 338 000139A2 E848000000 <1> call pciFindDevice 339 <1> ; jnc short d_vt8233_0 340 <1> ; couldn't find the audio device! 341 <1> ; retn 342 000139A7 72F3 <1> jc short d_ac97_0 ; 28/05/2017 343 <1> d_vt8233_0: 344 <1> ; 24/03/2017 ('player.asm') 345 <1> ; 12/11/2016 346 <1> ; Erdogan Tan - 8/11/2016 347 <1> ; References: Kolibrios - vt823x.asm (2016) 348 <1> ; VIA VT8235 V-Link South Bridge (VT8235-VIA.PDF)(2002) 349 <1> ; lowlevel.eu - AC97 (2016) 350 <1> ; .wav player for DOS by Jeff Leyda (2002) -this file- 351 <1> ; Linux kernel - via82xx.c (2016) 352 <1> d_ac97_1: 353 <1> ; eax = BUS/DEV/FN 354 <1> ; 00000000BBBBBBBBDDDDDFFF00000000 355 <1> ; edx = DEV/VENDOR 356 <1> ; DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV 357 <1> 358 000139A9 A3[EC880100] <1> mov [audio_dev_id], eax 359 000139AE 8915[F0880100] <1> mov [audio_vendor], edx 360 <1> 361 <1> ; 22/11/2023 362 <1> ;; init controller 363 <1> ;mov al, PCI_CMD_REG ; command register (04h) 364 <1> ;call pciRegRead32 365 <1> ; 366 <1> ;; eax = BUS/DEV/FN/REG 367 <1> ;; edx = STATUS/COMMAND 368 <1> ;; SSSSSSSSSSSSSSSSCCCCCCCCCCCCCCCC 369 <1> ;mov [audio_stats_cmd], edx 370 <1> 371 000139B4 B010 <1> mov al, PCI_IO_BASE ; IO base address register (10h) 372 <1> ;mov al, NAMBAR_REG ; Native Audio Mixer BAR (10h) 373 000139B6 E8BF000000 <1> call pciRegRead32 374 <1> 375 <1> ;cmp word [audio_vendor], INTEL_VID ; 8086h ; AC'97 ? 376 <1> ;;jne short d_vt8233_1 377 <1> ;; 01/11/2023 378 <1> ;je short d_ac97_3 379 <1> ;cmp word [audio_vendor], NFORCE_VID ; 10DEh ; AC'97 380 <1> ;jne short d_vt8233_1 381 <1> ; 02/11/2023 382 000139BB 66813D[F0880100]06- <1> cmp word [audio_vendor], VIA_VID ; 1106h ; VT8233-VT8237R 382 000139C3 11 <1> 383 000139C4 7411 <1> je short d_vt8233_1 384 <1> d_ac97_3: 385 <1> ;and dx, 0FFFEh ; Audio Codec IO_ADDR_MASK 386 <1> ; 06/08/2022 387 000139C6 80E2FE <1> and dl, 0FEh 388 000139C9 668915[E8880100] <1> mov [NAMBAR], dx 389 <1> 390 000139D0 B014 <1> mov al, NABMBAR_REG ; Native Audio Bus Mastering BAR (14h) 391 000139D2 E8A3000000 <1> call pciRegRead32 392 <1> 393 <1> ;;and dx, 0FFC0h ; Audio Controller IO_ADDR_MASK 394 <1> ;; 06/08/2022 395 <1> ;and dl, 0C0h 396 <1> ;mov [NABMBAR], dx 397 <1> ;;mov [audio_io_base], dx 398 <1> ; 399 <1> ;jmp short d_ac97_2 400 <1> ; 02/11/2023 401 <1> ; NABMBAR = audio_io_base 402 <1> 403 <1> d_vt8233_1: 404 <1> ;and dx, 0FFC0h ; Audio Controller IO_ADDR_MASK 405 <1> ; 06/08/2022 406 000139D7 80E2C0 <1> and dl, 0C0h 407 000139DA 668915[EA880100] <1> mov [audio_io_base], dx 408 <1> 409 <1> d_ac97_2: 410 <1> ; 10/06/2017 411 000139E1 B03C <1> mov al, AC97_INT_LINE ; Interrupt Line Register (3Ch) 412 <1> ;call pciRegRead32 413 000139E3 E87F000000 <1> call pciRegRead8 414 <1> 415 <1> ;;and edx, 0FFh 416 <1> ; 06/08/2022 417 <1> ;and dx, 0FFh 418 <1> 419 000139E8 8815[E6880100] <1> mov [audio_intr], dl 420 <1> 421 000139EE C3 <1> retn 422 <1> 423 <1> ; (Note: Interrupts are already enabled by TRDOS 386 kernel!) 424 <1> ;mov cx, dx 425 <1> ; 426 <1> ;in al, 0A1h ; irq 8-15 427 <1> ;mov ah, al 428 <1> ;in al, 21h ; irq 0-7 429 <1> ;btr ax, dx ; unmask ; 17/03/2017 430 <1> ;;bts ax, dx ; MASK interrupt ; 10/06/2017 431 <1> ;out 21h, al ; irq <= 7 432 <1> ;mov al, ah 433 <1> ;out 0A1h, al ; irq > 7 434 <1> ; 435 <1> 436 <1> ; 10/06/2017 437 <1> ; === Intel ICH I/O Controller Hub Datasheet, Section 8.1.16 === 438 <1> ; PRQ[n]_ROUT Register (61h, PRQB) Bit 7: 439 <1> ; Interrupt Routing Enable (IRQEN). 440 <1> ; 0 = The corresponding PIRQ is routed to one of the ISA-compatible 441 <1> ; interrupts specified in bits[3:0]. 442 <1> ; 1 = The PIRQ is not routed to the 8259. 443 <1> ; Note: If the PIRQ is intended to cause an interrupt to the ICH’s 444 <1> ; integrated I/O APIC, then this bit should be set to 0 and 445 <1> ; the APIC_EN bit should be set to 1. 446 <1> ; The IRQEN must be set to 0 and the PIRQ routed to 447 <1> ; an 8259 interrupt via the IRQ Routing filed (bits[3:0). 448 <1> ; The corresponding 8259 interrupt must be masked via the 449 <1> ; appropriated bit in the 8259’s OCW1 (Interrupt Mask) 450 <1> ; register. The IOAPIC must then be enabled by setting 451 <1> ; the APIC_EN bit in the GEN_CNTL register. 452 <1> 453 <1> ;mov eax, 0F861h ; D31:F0 454 <1> ; ; AL=61h : PIRQ[B] Routing Control Reg, LPC interface 455 <1> ;;mov dl, [audio_intr] 456 <1> ;call pciRegWrite8 457 <1> ;;mov al, 0D0h ; General Control Register (GEN_CTL) 458 <1> ;;call pciRegRead32 459 <1> ;;or edx, 100h ; Bit 8, APIC_EN (Enable I/O APIC) 460 <1> ;;call pciRegWrite32 461 <1> ;;and edx, ~100h 462 <1> ;;call pciRegWrite32 ; Bit 8, APIC_EN (Disable I/O APIC) 463 <1> ; 464 <1> 465 <1> ;mov dx, 4D1h ; 8259 ELCR2 466 <1> ;in al, dx 467 <1> ;mov ah, al 468 <1> ;;mov dx, 4D0h ; 8259 ELCR1 469 <1> ;dec dl 470 <1> ;in al, dx 471 <1> ;bts ax, cx 472 <1> ;;mov dx, 4D0h 473 <1> ;out dx, al ; set level-triggered mode 474 <1> ;mov al, ah ; 29/05/2017 475 <1> ;;mov dx, 4D1h 476 <1> ;inc dl 477 <1> ;out dx, al ; set level-triggered mode 478 <1> 479 <1> ;xor eax, eax ; 0 480 <1> 481 <1> ;retn 482 <1> 483 <1> ; CODE for PCI 484 <1> 485 <1> pciFindDevice: 486 <1> ; 19/11/2023 487 <1> ; 03/04/2017 ('pci.asm', 20/03/2017) 488 <1> ; 489 <1> ; scan through PCI space looking for a device+vendor ID 490 <1> ; 491 <1> ; Entry: EAX=Device+Vendor ID 492 <1> ; 493 <1> ; Exit: EAX=PCI address if device found 494 <1> ; EDX=Device+Vendor ID 495 <1> ; CY clear if found, set if not found. EAX invalid if CY set. 496 <1> ; 497 <1> ; Destroys: ebx, edi ; 19/11/2023 498 <1> 499 <1> ;push ecx 500 <1> ;push eax ; * ; 19/11/2023 501 <1> ;push esi 502 <1> ;push edi 503 <1> ; 504 <1> ;mov esi, eax ; save off vend+device ID 505 <1> ; 19/11/2023 506 000139EF 89C3 <1> mov ebx, eax 507 <1> ;mov edi, (80000000h - 100h) ; start with bus 0, dev 0 func 0 508 000139F1 BF00000080 <1> mov edi, 80000000h 509 <1> nextPCIdevice: 510 <1> ;add edi, 100h 511 <1> ;cmp edi, 80FFF800h ; scanned all devices? 512 <1> ;stc 513 <1> ;je short PCIScanExit ; not found 514 <1> 515 000139F6 89F8 <1> mov eax, edi ; read PCI registers 516 000139F8 E87D000000 <1> call pciRegRead32 517 <1> ; 19/11/2023 518 000139FD 39DA <1> cmp edx, ebx 519 <1> ;cmp edx, esi ; found device? 520 <1> ;jne short nextPCIdevice 521 <1> ;;clc 522 000139FF 7412 <1> je short PCIScanExit ; found 523 <1> ; 19/11/2023 524 00013A01 81FF00F8FF80 <1> cmp edi, 80FFF800h 525 00013A07 7308 <1> jnb short pfd_nf ; not found 526 00013A09 81C700010000 <1> add edi, 100h 527 00013A0F EBE5 <1> jmp short nextPCIdevice 528 <1> pfd_nf: 529 00013A11 F9 <1> stc 530 00013A12 C3 <1> retn 531 <1> PCIScanExit: 532 <1> ;pushf 533 00013A13 B8FFFFFF7F <1> mov eax, NOT_BIT31 ; 19/03/2017 534 00013A18 21F8 <1> and eax, edi ; return only bus/dev/fn # 535 <1> ;popf 536 <1> ; 537 <1> ;pop edi 538 <1> ;pop esi 539 <1> ;pop edx ; * ; 19/11/2023 540 <1> ;pop ecx 541 <1> ; 542 00013A1A C3 <1> retn 543 <1> 544 <1> ; 26/11/2023 545 <1> %if 1 546 <1> 547 <1> pciRegRead: 548 <1> ; 03/04/2017 ('pci.asm', 20/03/2017) 549 <1> ; 550 <1> ; 8/16/32bit PCI reader 551 <1> ; 552 <1> ; Entry: EAX=PCI Bus/Device/fn/register number 553 <1> ; BIT30 set if 32 bit access requested 554 <1> ; BIT29 set if 16 bit access requested 555 <1> ; otherwise defaults to 8 bit read 556 <1> ; 557 <1> ; Exit: DL,DX,EDX register data depending on requested read size 558 <1> ; 559 <1> ; Note1: this routine is meant to be called via pciRegRead8, 560 <1> ; pciRegread16 or pciRegRead32, listed below. 561 <1> ; 562 <1> ; Note2: don't attempt to read 32 bits of data from a non dword 563 <1> ; aligned reg number. Likewise, don't do 16 bit reads from 564 <1> ; non word aligned reg # 565 <1> 566 00013A1B 53 <1> push ebx 567 00013A1C 51 <1> push ecx 568 00013A1D 89C3 <1> mov ebx, eax ; save eax, dh 569 00013A1F 88F1 <1> mov cl, dh 570 <1> 571 00013A21 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; clear out data size request 572 00013A26 0D00000080 <1> or eax, BIT31 ; make a PCI access request 573 00013A2B 24FC <1> and al, ~3 ; NOT 3 ; force index to be dword 574 <1> 575 00013A2D 66BAF80C <1> mov dx, PCI_INDEX_PORT 576 00013A31 EF <1> out dx, eax ; write PCI selector 577 <1> 578 00013A32 66BAFC0C <1> mov dx, PCI_DATA_PORT 579 00013A36 88D8 <1> mov al, bl 580 00013A38 2403 <1> and al, 3 ; figure out which port to 581 00013A3A 00C2 <1> add dl, al ; read to 582 <1> 583 00013A3C F7C3000000C0 <1> test ebx, PCI32+PCI16 584 00013A42 7507 <1> jnz short _pregr0 585 00013A44 EC <1> in al, dx ; return 8 bits of data 586 00013A45 88C2 <1> mov dl, al 587 00013A47 88CE <1> mov dh, cl ; restore dh for 8 bit read 588 00013A49 EB12 <1> jmp short _pregr2 589 <1> _pregr0: 590 00013A4B F7C300000080 <1> test ebx, PCI32 591 00013A51 7507 <1> jnz short _pregr1 592 00013A53 66ED <1> in ax, dx 593 00013A55 6689C2 <1> mov dx, ax ; return 16 bits of data 594 00013A58 EB03 <1> jmp short _pregr2 595 <1> _pregr1: 596 00013A5A ED <1> in eax, dx ; return 32 bits of data 597 00013A5B 89C2 <1> mov edx, eax 598 <1> _pregr2: 599 00013A5D 89D8 <1> mov eax, ebx ; restore eax 600 00013A5F 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; clear out data size request 601 00013A64 59 <1> pop ecx 602 00013A65 5B <1> pop ebx 603 00013A66 C3 <1> retn 604 <1> 605 <1> pciRegRead8: 606 00013A67 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 8 bit read size 607 00013A6C EBAD <1> jmp short pciRegRead ; call generic PCI access 608 <1> 609 <1> pciRegRead16: 610 00013A6E 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 16 bit read size 611 00013A73 0D00000040 <1> or eax, PCI16 ; call generic PCI access 612 00013A78 EBA1 <1> jmp short pciRegRead 613 <1> 614 <1> pciRegRead32: 615 00013A7A 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 32 bit read size 616 00013A7F 0D00000080 <1> or eax, PCI32 ; call generic PCI access 617 00013A84 EB95 <1> jmp pciRegRead 618 <1> 619 <1> pciRegWrite: 620 <1> ; 03/04/2017 ('pci.asm', 29/11/2016) 621 <1> ; 622 <1> ; 8/16/32bit PCI writer 623 <1> ; 624 <1> ; Entry: EAX=PCI Bus/Device/fn/register number 625 <1> ; BIT31 set if 32 bit access requested 626 <1> ; BIT30 set if 16 bit access requested 627 <1> ; otherwise defaults to 8bit read 628 <1> ; DL/DX/EDX data to write depending on size 629 <1> ; 630 <1> ; Note1: this routine is meant to be called via pciRegWrite8, 631 <1> ; pciRegWrite16 or pciRegWrite32 as detailed below. 632 <1> ; 633 <1> ; Note2: don't attempt to write 32bits of data from a non dword 634 <1> ; aligned reg number. Likewise, don't do 16 bit writes from 635 <1> ; non word aligned reg # 636 <1> 637 00013A86 53 <1> push ebx 638 00013A87 51 <1> push ecx 639 00013A88 89C3 <1> mov ebx, eax ; save eax, edx 640 00013A8A 89D1 <1> mov ecx, edx 641 00013A8C 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; clear out data size request 642 00013A91 0D00000080 <1> or eax, BIT31 ; make a PCI access request 643 00013A96 24FC <1> and al, ~3 ; NOT 3 ; force index to be dword 644 <1> 645 00013A98 66BAF80C <1> mov dx, PCI_INDEX_PORT 646 00013A9C EF <1> out dx, eax ; write PCI selector 647 <1> 648 00013A9D 66BAFC0C <1> mov dx, PCI_DATA_PORT 649 00013AA1 88D8 <1> mov al, bl 650 00013AA3 2403 <1> and al, 3 ; figure out which port to 651 00013AA5 00C2 <1> add dl, al ; write to 652 <1> 653 00013AA7 F7C3000000C0 <1> test ebx, PCI32+PCI16 654 00013AAD 7505 <1> jnz short _pregw0 655 00013AAF 88C8 <1> mov al, cl ; put data into al 656 00013AB1 EE <1> out dx, al 657 00013AB2 EB12 <1> jmp short _pregw2 658 <1> _pregw0: 659 00013AB4 F7C300000080 <1> test ebx, PCI32 660 00013ABA 7507 <1> jnz short _pregw1 661 00013ABC 6689C8 <1> mov ax, cx ; put data into ax 662 00013ABF 66EF <1> out dx, ax 663 00013AC1 EB03 <1> jmp short _pregw2 664 <1> _pregw1: 665 00013AC3 89C8 <1> mov eax, ecx ; put data into eax 666 00013AC5 EF <1> out dx, eax 667 <1> _pregw2: 668 00013AC6 89D8 <1> mov eax, ebx ; restore eax 669 00013AC8 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; clear out data size request 670 00013ACD 89CA <1> mov edx, ecx ; restore dx 671 00013ACF 59 <1> pop ecx 672 00013AD0 5B <1> pop ebx 673 00013AD1 C3 <1> retn 674 <1> 675 <1> pciRegWrite8: 676 00013AD2 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 8 bit write size 677 00013AD7 EBAD <1> jmp short pciRegWrite ; call generic PCI access 678 <1> 679 <1> pciRegWrite16: 680 00013AD9 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 16 bit write size 681 00013ADE 0D00000040 <1> or eax, PCI16 ; call generic PCI access 682 00013AE3 EBA1 <1> jmp short pciRegWrite 683 <1> 684 <1> pciRegWrite32: 685 00013AE5 25FFFFFF3F <1> and eax, NOT_PCI32_PCI16 ; set up 32 bit write size 686 00013AEA 0D00000080 <1> or eax, PCI32 ; call generic PCI access 687 00013AEF EB95 <1> jmp pciRegWrite 688 <1> 689 <1> %endif 690 <1> 691 <1> ; 26/11/2023 - temporary 692 <1> %if 0 693 <1> 694 <1> ; PLAYWAV3.COM, ac97_vra.asm, 19/11/2023, Erdogan Tan 695 <1> 696 <1> ;=============================================================== 697 <1> ; 8/16/32bit PCI reader 698 <1> ; 699 <1> ; Entry: EAX=PCI Bus/Device/fn/register number 700 <1> ; BIT30 set if 32 bit access requested 701 <1> ; BIT29 set if 16 bit access requested 702 <1> ; otherwise defaults to 8 bit read 703 <1> ; 704 <1> ; Exit: DL,DX,EDX register data depending on requested read size 705 <1> ; 706 <1> ; Note: this routine is meant to be called via pciRegRead8, pciRegread16, 707 <1> ; or pciRegRead32, listed below. 708 <1> ; 709 <1> ; Note2: don't attempt to read 32bits of data from a non dword aligned reg 710 <1> ; number. Likewise, don't do 16bit reads from non word aligned reg # 711 <1> ; 712 <1> pciRegRead: 713 <1> push ebx 714 <1> push ecx 715 <1> mov ebx, eax ; save eax, dh 716 <1> mov cl, dh 717 <1> and eax, (~PCI32)+PCI16 ; clear out data size request 718 <1> or eax, BIT31 ; make a PCI access request 719 <1> and al, ~3 ; NOT 3 ; force index to be dword 720 <1> 721 <1> mov dx, PCI_INDEX_PORT 722 <1> out dx, eax ; write PCI selector 723 <1> 724 <1> mov dx, PCI_DATA_PORT 725 <1> mov al, bl 726 <1> and al, 3 ; figure out which port to 727 <1> add dl, al ; read to 728 <1> 729 <1> in eax, dx ; do 32bit read 730 <1> test ebx, PCI32 731 <1> jz short _pregr1 732 <1> 733 <1> mov edx, eax ; return 32bits of data 734 <1> _pregr1: 735 <1> mov dx, ax ; return 16bits of data 736 <1> test ebx, PCI32+PCI16 737 <1> jnz short _pregr2 738 <1> mov dh, cl ; restore dh for 8 bit read 739 <1> _pregr2: 740 <1> mov eax, ebx ; restore eax 741 <1> and eax, (~PCI32)+PCI16 ; clear out data size request 742 <1> pop ecx 743 <1> pop ebx 744 <1> retn 745 <1> 746 <1> pciRegRead8: 747 <1> and eax, (~PCI16)+PCI32 ; set up 8 bit read size 748 <1> jmp short pciRegRead ; call generic PCI access 749 <1> 750 <1> pciRegRead16: 751 <1> and eax, (~PCI16)+PCI32 ; set up 16 bit read size 752 <1> or eax, PCI16 ; call generic PCI access 753 <1> jmp short pciRegRead 754 <1> 755 <1> pciRegRead32: 756 <1> and eax, (~PCI16)+PCI32 ; set up 32 bit read size 757 <1> or eax, PCI32 ; call generic PCI access 758 <1> jmp short pciRegRead 759 <1> 760 <1> ;=============================================================== 761 <1> ; 8/16/32bit PCI writer 762 <1> ; 763 <1> ; Entry: EAX=PCI Bus/Device/fn/register number 764 <1> ; BIT31 set if 32 bit access requested 765 <1> ; BIT30 set if 16 bit access requested 766 <1> ; otherwise defaults to 8bit read 767 <1> ; DL/DX/EDX data to write depending on size 768 <1> ; 769 <1> ; 770 <1> ; note: this routine is meant to be called via pciRegWrite8, pciRegWrite16, 771 <1> ; or pciRegWrite32 as detailed below. 772 <1> ; 773 <1> ; Note2: don't attempt to write 32bits of data from a non dword aligned reg 774 <1> ; number. Likewise, don't do 16bit writes from non word aligned reg # 775 <1> ; 776 <1> pciRegWrite: 777 <1> push ebx 778 <1> push ecx 779 <1> mov ebx, eax ; save eax, dx 780 <1> mov cx, dx 781 <1> or eax, BIT31 ; make a PCI access request 782 <1> and eax, ~PCI16 ; NOT PCI16 ; clear out data size request 783 <1> and al, ~3 ; NOT 3 ; force index to be dword 784 <1> 785 <1> mov dx, PCI_INDEX_PORT 786 <1> out dx, eax ; write PCI selector 787 <1> 788 <1> mov dx, PCI_DATA_PORT 789 <1> mov al, bl 790 <1> and al, 3 ; figure out which port to 791 <1> add dl, al ; write to 792 <1> 793 <1> mov eax, edx ; put data into eax 794 <1> mov ax, cx 795 <1> 796 <1> out dx, al 797 <1> test ebx, PCI16+PCI32 ; only 8bit access? bail 798 <1> jz short _pregw1 799 <1> 800 <1> out dx, ax ; write 16 bit value 801 <1> test ebx, PCI16 ; 16bit requested? bail 802 <1> jnz short _pregw1 803 <1> 804 <1> out dx, eax ; write full 32bit 805 <1> _pregw1: 806 <1> mov eax, ebx ; restore eax 807 <1> and eax, (~PCI32)+PCI16 ; clear out data size request 808 <1> mov dx, cx ; restore dx 809 <1> pop ecx 810 <1> pop ebx 811 <1> ret 812 <1> 813 <1> pciRegWrite8: 814 <1> and eax, (~PCI16)+PCI32 ; set up 8 bit write size 815 <1> jmp short pciRegWrite ; call generic PCI access 816 <1> 817 <1> pciRegWrite16: 818 <1> and eax, (~PCI16)+PCI32 ; set up 16 bit write size 819 <1> or eax, PCI16 ; call generic PCI access 820 <1> jmp short pciRegWrite 821 <1> 822 <1> pciRegWrite32: 823 <1> and eax, (~PCI16)+PCI32 ; set up 32 bit write size 824 <1> or eax, PCI32 ; call generic PCI access 825 <1> jmp short pciRegWrite 826 <1> 827 <1> ;=============================================================== 828 <1> 829 <1> %endif 830 <1> 831 <1> init_codec: 832 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 833 <1> ; 05/06/2017 834 <1> ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 835 <1> ; 836 00013AF1 A1[EC880100] <1> mov eax, [audio_dev_id] 837 00013AF6 B041 <1> mov al, VIA_ACLINK_CTRL 838 00013AF8 E86AFFFFFF <1> call pciRegRead8 839 <1> ; ? 840 00013AFD B040 <1> mov al, VIA_ACLINK_STAT 841 00013AFF E863FFFFFF <1> call pciRegRead8 842 00013B04 F6C201 <1> test dl, VIA_ACLINK_C00_READY 843 00013B07 7508 <1> jnz short _codec_ready_1 844 00013B09 E80D000000 <1> call reset_codec 845 00013B0E 7305 <1> jnc short _codec_ready_2 ; eax = 1 846 00013B10 C3 <1> retn 847 <1> _codec_ready_1: 848 <1> ;mov eax, 1 849 <1> ; 06/08/2022 850 00013B11 29C0 <1> sub eax, eax 851 00013B13 FEC0 <1> inc al 852 <1> ; eax = 1 853 <1> _codec_ready_2: 854 00013B15 E880000000 <1> call codec_io_w16 855 <1> detect_codec: 856 00013B1A C3 <1> retn 857 <1> 858 <1> reset_codec: 859 <1> ; 16/04/2017 860 <1> ; 23/03/2017 861 <1> ; ('codec.asm') 862 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 863 00013B1B A1[EC880100] <1> mov eax, [audio_dev_id] 864 00013B20 B041 <1> mov al, VIA_ACLINK_CTRL 865 00013B22 B2E0 <1> mov dl, VIA_ACLINK_CTRL_ENABLE + VIA_ACLINK_CTRL_RESET + VIA_ACLINK_CTRL_SYNC 866 00013B24 E8A9FFFFFF <1> call pciRegWrite8 867 <1> 868 00013B29 E843000000 <1> call delay_100ms ; wait 100 ms 869 <1> _rc_cold: 870 00013B2E E811000000 <1> call cold_reset 871 00013B33 7301 <1> jnc short _reset_codec_ok 872 <1> 873 <1> ; 16/04/2017 874 <1> ;xor eax, eax ; timeout error 875 <1> ;stc 876 00013B35 C3 <1> retn 877 <1> 878 <1> _reset_codec_ok: 879 <1> ; 01/09/2020 880 <1> ; 15/08/2020 881 <1> ; 27/07/2020 882 <1> ; also reset codec by using index control register 0 of AD1980 or ALC655 883 <1> ; (to fix line out -2 channels audio playing- problem on AD1980 codec) 884 <1> 885 00013B36 29C0 <1> sub eax, eax 886 <1> ; 02/11/2023 887 <1> ;mov edx, CODEC_RESET_REG ; 00h ; Reset register 888 00013B38 31D2 <1> xor edx, edx ; 00h ; Reset register 889 00013B3A E8BE000000 <1> call codec_write 890 <1> 891 <1> ;sub eax, eax 892 <1> ; 01/09/2020 893 <1> ; 15/08/2020 894 <1> ; AD1980 BugFix 895 <1> ; (set HPSEL -headphone amp to be driven from mixer- and 896 <1> ; CLDIS -center and LFE disable- bits) 897 <1> ;mov eax, 0C00h ; HPSEL = bit 10, CLDIS = bit 11 ; 01/09/2020 898 <1> ;mov edx, CODEC_MISC_CRTL_BITS_REG ; 76h ; Misc Ctrl Bits ; AD1980 899 <1> ;call codec_write 900 <1> 901 00013B3F 31C0 <1> xor eax, eax 902 <1> ;mov al, VIA_ACLINK_C00_READY ; 1 903 00013B41 FEC0 <1> inc al 904 00013B43 C3 <1> retn 905 <1> 906 <1> cold_reset: 907 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 908 <1> ; 16/04/2017 909 <1> ; 23/03/2017 910 <1> ; ('codec.asm') 911 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 912 <1> ;mov eax, [audio_dev_id] 913 <1> ;mov al, VIA_ACLINK_CTRL 914 00013B44 30D2 <1> xor dl, dl ; 0 915 00013B46 E887FFFFFF <1> call pciRegWrite8 916 <1> 917 00013B4B E821000000 <1> call delay_100ms ; wait 100 ms 918 <1> 919 <1> ;; ACLink on, deassert ACLink reset, VSR, SGD data out 920 <1> ;; note - FM data out has trouble with non VRA codecs !! 921 <1> 922 <1> ;mov eax, [audio_dev_id] 923 <1> ;mov al, VIA_ACLINK_CTRL 924 00013B50 B2CC <1> mov dl, VIA_ACLINK_CTRL_INIT 925 00013B52 E87BFFFFFF <1> call pciRegWrite8 926 <1> 927 <1> ;mov ecx, 16 ; total 2s 928 <1> ; 06/08/2022 929 <1> ;sub ecx, ecx 930 <1> ; 22/11/2023 931 <1> ; ecx = 0 (from 'delay_100ms') 932 00013B57 B110 <1> mov cl, 16 933 <1> _crst_wait: 934 <1> ;mov eax, [audio_dev_id] 935 00013B59 B040 <1> mov al, VIA_ACLINK_STAT 936 00013B5B E807FFFFFF <1> call pciRegRead8 937 <1> 938 00013B60 F6C201 <1> test dl, VIA_ACLINK_C00_READY 939 00013B63 750B <1> jnz short _crst_ok 940 <1> 941 00013B65 51 <1> push ecx 942 00013B66 E806000000 <1> call delay_100ms 943 00013B6B 59 <1> pop ecx 944 <1> 945 00013B6C 49 <1> dec ecx 946 00013B6D 75EA <1> jnz short _crst_wait 947 <1> 948 <1> _crst_fail: 949 00013B6F F9 <1> stc 950 <1> _crst_ok: 951 00013B70 C3 <1> retn 952 <1> 953 <1> delay_100ms: 954 <1> ; 29/05/2017 955 <1> ; 24/03/2017 ('codec.asm') 956 <1> ; wait 100 ms 957 00013B71 B990010000 <1> mov ecx, 400 ; 400*0.25ms 958 <1> _delay_x_ms: 959 00013B76 E803000000 <1> call delay1_4ms 960 00013B7B E2F9 <1> loop _delay_x_ms 961 00013B7D C3 <1> retn 962 <1> 963 <1> ; delay1_4ms - Delay for 1/4 millisecond. 964 <1> ; 1ms = 1000us 965 <1> ; Entry: 966 <1> ; None 967 <1> ; Exit: 968 <1> ; None 969 <1> ; 970 <1> ; Modified: 971 <1> ; None 972 <1> 973 <1> ; 29/05/2017 974 <1> ; 23/04/2017 975 <1> ; 05/03/2017 (TRDOS 386) 976 <1> ; ('UTILS.ASM') 977 <1> delay1_4ms: 978 00013B7E 50 <1> push eax 979 00013B7F 51 <1> push ecx 980 00013B80 B110 <1> mov cl, 16 ; close enough. 981 <1> 982 00013B82 E461 <1> in al, PORTB ; 61h 983 <1> 984 00013B84 2410 <1> and al, REFRESH_STATUS ; 10h 985 00013B86 88C5 <1> mov ch, al ; Start toggle state 986 <1> _d4ms1: 987 00013B88 E461 <1> in al, PORTB ; Read system control port 988 <1> 989 00013B8A 2410 <1> and al, REFRESH_STATUS ; Refresh toggles 15.085 microseconds 990 00013B8C 38C5 <1> cmp ch, al 991 00013B8E 74F8 <1> je short _d4ms1 ; Wait for state change 992 <1> 993 00013B90 88C5 <1> mov ch, al ; Update with new state 994 00013B92 FEC9 <1> dec cl 995 00013B94 75F2 <1> jnz short _d4ms1 996 <1> 997 00013B96 F8 <1> clc ; 29/05/2017 998 <1> 999 00013B97 59 <1> pop ecx 1000 00013B98 58 <1> pop eax 1001 00013B99 C3 <1> retn 1002 <1> 1003 <1> ; 10/04/2017 (TRDOS 386) 1004 <1> ; 12/11/2016 1005 <1> 1006 <1> codec_io_w16: ;w32 1007 <1> ; ('codec.asm') 1008 00013B9A 668B15[EA880100] <1> mov dx, [audio_io_base] 1009 00013BA1 6681C28000 <1> add dx, VIA_REG_AC97 1010 00013BA6 EF <1> out dx, eax 1011 00013BA7 C3 <1> retn 1012 <1> 1013 <1> codec_io_r16: ;r32 1014 <1> ; ('codec.asm') 1015 00013BA8 668B15[EA880100] <1> mov dx, [audio_io_base] 1016 00013BAF 6681C28000 <1> add dx, VIA_REG_AC97 1017 00013BB4 ED <1> in eax, dx 1018 00013BB5 C3 <1> retn 1019 <1> 1020 <1> ctrl_io_w8: 1021 <1> ; ('codec.asm') 1022 00013BB6 660315[EA880100] <1> add dx, [audio_io_base] 1023 00013BBD EE <1> out dx, al 1024 00013BBE C3 <1> retn 1025 <1> 1026 <1> ctrl_io_r8: 1027 <1> ; ('codec.asm') 1028 00013BBF 660315[EA880100] <1> add dx, [audio_io_base] 1029 00013BC6 EC <1> in al, dx 1030 00013BC7 C3 <1> retn 1031 <1> 1032 <1> ctrl_io_w32: 1033 <1> ; ('codec.asm') 1034 00013BC8 660315[EA880100] <1> add dx, [audio_io_base] 1035 00013BCF EF <1> out dx, eax 1036 00013BD0 C3 <1> retn 1037 <1> 1038 <1> ctrl_io_r32: 1039 <1> ; ('codec.asm') 1040 00013BD1 660315[EA880100] <1> add dx, [audio_io_base] 1041 00013BD8 ED <1> in eax, dx 1042 <1> _cr_not_rdy: ; 06/08/2022 1043 00013BD9 C3 <1> retn 1044 <1> 1045 <1> codec_read: 1046 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1047 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 1048 <1> ; Use only primary codec. 1049 <1> ; eax = register 1050 00013BDA C1E010 <1> shl eax, VIA_REG_AC97_CMD_SHIFT 1051 00013BDD 0D00008002 <1> or eax, VIA_REG_AC97_PRIMARY_VALID + VIA_REG_AC97_READ 1052 <1> 1053 00013BE2 E8B3FFFFFF <1> call codec_io_w16 1054 <1> 1055 <1> ; codec_valid 1056 00013BE7 E825000000 <1> call codec_check_ready 1057 <1> ;jnc short _cr_ok 1058 <1> ;retn 1059 <1> ; 06/08/2022 1060 00013BEC 72EB <1> jc short _cr_not_rdy 1061 <1> ; ecx <= 20 1062 <1> _cr_ok: 1063 <1> ; wait 25 ms 1064 <1> ;mov ecx, 80 ; (100*0.25 ms) 1065 <1> ; 06/08/2022 1066 <1> ;xor ecx, ecx 1067 00013BEE B150 <1> mov cl, 80 1068 <1> ; ecx = 80 1069 <1> _cr_wloop: 1070 00013BF0 E889FFFFFF <1> call delay1_4ms 1071 00013BF5 E2F9 <1> loop _cr_wloop 1072 <1> 1073 00013BF7 E8ACFFFFFF <1> call codec_io_r16 1074 <1> ; 06/08/2022 1075 <1> ;and eax, 0FFFFh 1076 00013BFC C3 <1> retn 1077 <1> 1078 <1> codec_write: 1079 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1080 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 1081 <1> ; Use only primary codec. 1082 <1> 1083 <1> ; eax = data (volume) 1084 <1> ; edx = register (mixer register) 1085 <1> 1086 00013BFD C1E210 <1> shl edx, VIA_REG_AC97_CMD_SHIFT 1087 <1> 1088 <1> ; 02/11/2023 (shl eax, 0) 1089 <1> ;shl eax, VIA_REG_AC97_DATA_SHIFT ; shl eax, 0 1090 00013C00 09C2 <1> or edx, eax 1091 <1> 1092 00013C02 B800000000 <1> mov eax, VIA_REG_AC97_CODEC_ID_PRIMARY 1093 00013C07 C1E01E <1> shl eax, VIA_REG_AC97_CODEC_ID_SHIFT 1094 00013C0A 09D0 <1> or eax, edx 1095 <1> 1096 00013C0C E889FFFFFF <1> call codec_io_w16 1097 <1> ;mov [codec.regs+esi], ax 1098 <1> 1099 <1> ;call codec_check_ready 1100 <1> ;retn 1101 <1> ;jmp short _codec_check_ready 1102 <1> 1103 <1> codec_check_ready: 1104 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1105 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 1106 <1> 1107 <1> _codec_check_ready: 1108 <1> ;mov ecx, 20 ; total 2s 1109 <1> ; 06/08/2022 1110 00013C11 29C9 <1> sub ecx, ecx 1111 <1> ;mov cl, 20 1112 <1> ; 02/11/2023 1113 00013C13 B10A <1> mov cl, 10 ; wait 1s 1114 <1> _ccr_wait: 1115 00013C15 51 <1> push ecx 1116 <1> 1117 00013C16 E88DFFFFFF <1> call codec_io_r16 1118 00013C1B A900000001 <1> test eax, VIA_REG_AC97_BUSY 1119 00013C20 740B <1> jz short _ccr_ok 1120 <1> 1121 00013C22 E84AFFFFFF <1> call delay_100ms 1122 <1> 1123 00013C27 59 <1> pop ecx 1124 <1> 1125 00013C28 49 <1> dec ecx 1126 00013C29 75EA <1> jnz short _ccr_wait 1127 <1> 1128 00013C2B F9 <1> stc 1129 00013C2C C3 <1> retn 1130 <1> 1131 <1> _ccr_ok: 1132 00013C2D 59 <1> pop ecx 1133 00013C2E 25FFFF0000 <1> and eax, 0FFFFh 1134 00013C33 C3 <1> retn 1135 <1> 1136 <1> codec_config: 1137 <1> ; 02/11/2023 - TRDOS 386 Kernel v2.0.7 1138 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1139 <1> ; 10/06/2017 1140 <1> ; 29/05/2017 1141 <1> ; 24/04/2017 1142 <1> ; 21/04/2017 1143 <1> ; 16/04/2017 (TRDOS 386 Kernel) 1144 <1> ; 15/11/2016 ('codec.asm', 'player.com') 1145 <1> ; 14/11/2016 1146 <1> ; 12/11/2016 - Erdogan Tan 1147 <1> ; (Ref: KolibriOS, 'setup_codec', codec.inc) 1148 <1> 1149 00013C34 B802020000 <1> mov eax, 0202h 1150 00013C39 66A3[20890100] <1> mov [audio_master_volume], ax 1151 <1> 1152 <1> ;mov ax, 1F1Fh ; 31,31 1153 <1> ; 02/11/2023 1154 00013C3F 66B80B0B <1> mov ax, 0B0Bh 1155 <1> ;mov edx, CODEC_MASTER_VOL_REG ; 02h ; Line Out 1156 <1> ; 06/08/2022 1157 00013C43 29D2 <1> sub edx, edx 1158 00013C45 B202 <1> mov dl, CODEC_MASTER_VOL_REG ; 02h ; Line Out 1159 00013C47 E8B1FFFFFF <1> call codec_write 1160 <1> ;jc short cconfig_error 1161 <1> 1162 <1> ;mov eax, 0202h 1163 00013C4C 66B80202 <1> mov ax, 0202h 1164 <1> ;mov edx, CODEC_PCM_OUT_REG ; 18h ; Wave Output (Stereo) 1165 <1> ; 06/08/2022 1166 00013C50 29D2 <1> sub edx, edx 1167 00013C52 B218 <1> mov dl, CODEC_PCM_OUT_REG ; 18h ; Wave Output (Stereo) 1168 00013C54 E8A4FFFFFF <1> call codec_write 1169 <1> ;jc short cconfig_error 1170 <1> 1171 <1> ;mov eax, 0202h 1172 00013C59 66B80202 <1> mov ax, 0202h 1173 <1> ;mov edx, CODEC_AUX_VOL ; 04h ; CODEC_HP_VOL_REG ; HeadPhone 1174 <1> ; 06/08/2022 1175 00013C5D 29D2 <1> sub edx, edx 1176 00013C5F B204 <1> mov dl, CODEC_AUX_VOL ; 04h ; CODEC_HP_VOL_REG ; HeadPhone 1177 00013C61 E897FFFFFF <1> call codec_write 1178 <1> ;jc short cconfig_error 1179 <1> 1180 <1> ;mov eax, 08h 1181 <1> ;mov ax, 08h 1182 00013C66 66B80880 <1> mov ax, 8008h ; Mute 1183 <1> ;mov edx, 0Ch ; AC97_PHONE_VOL ; TAD Input (Mono) 1184 <1> ; 06/08/2022 1185 00013C6A 29D2 <1> sub edx, edx 1186 00013C6C B20C <1> mov dl, 0Ch ; AC97_PHONE_VOL ; TAD Input (Mono) 1187 00013C6E E88AFFFFFF <1> call codec_write 1188 <1> ;jc short cconfig_error 1189 <1> 1190 <1> ;mov eax, 0808h 1191 00013C73 66B80808 <1> mov ax, 0808h 1192 <1> ;mov edx, CODEC_LINE_IN_VOL_REG ; 10h ; Line Input (Stereo) 1193 <1> ; 06/08/2022 1194 00013C77 29D2 <1> sub edx, edx 1195 00013C79 B210 <1> mov dl, CODEC_LINE_IN_VOL_REG ; 10h ; Line Input (Stereo) 1196 00013C7B E87DFFFFFF <1> call codec_write 1197 <1> ;jc short cconfig_error 1198 <1> 1199 <1> ;mov eax, 0808h 1200 00013C80 66B80808 <1> mov ax, 0808h 1201 <1> ;mov edx, CODEC_CD_VOL_REG ; 12h ; CR Input (Stereo) 1202 <1> ; 06/08/2022 1203 00013C84 29D2 <1> sub edx, edx ; 02/11/2023 1204 00013C86 B212 <1> mov dl, CODEC_CD_VOL_REG ; 12h ; CR Input (Stereo) 1205 00013C88 E870FFFFFF <1> call codec_write 1206 <1> ;jc short cconfig_error 1207 <1> 1208 <1> ;mov eax, 0808h 1209 00013C8D 66B80808 <1> mov ax, 0808h 1210 <1> ;mov edx, CODEC_AUX_VOL_REG ; 16h ; Aux Input (Stereo) 1211 <1> ; 06/08/2022 1212 00013C91 29D2 <1> sub edx, edx 1213 00013C93 B216 <1> mov dl, CODEC_AUX_VOL_REG ; 16h ; Aux Input (Stereo) 1214 <1> ;call codec_write 1215 <1> ;;jc short cconfig_error 1216 00013C95 E963FFFFFF <1> jmp codec_write ; 10/06/2017 1217 <1> 1218 <1> ; ; Extended Audio Status (2Ah) 1219 <1> ; mov eax, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1220 <1> ; call codec_read 1221 <1> ; and eax, 0FFFFh - 2 ; clear DRA (BIT1) 1222 <1> ; ;or eax, 1 ; set VRA (BIT0) 1223 <1> ; or eax, 5 ; VRA (BIT0) & S/PDIF (BIT2) ; 14/11/2016 1224 <1> ; mov edx, CODEC_EXT_AUDIO_CTRL_REG 1225 <1> ; call codec_write 1226 <1> ; ;jc short cconfig_error 1227 <1> ; 1228 <1> ;set_sample_rate: 1229 <1> ; ;movzx eax, word [audio_freq] 1230 <1> ; mov ax, [audio_freq] 1231 <1> ; mov edx, CODEC_PCM_FRONT_DACRATE_REG ; 2Ch ; PCM Front DAC Rate 1232 <1> ; ;call codec_write 1233 <1> ; ;retn 1234 <1> ; jmp codec_write 1235 <1> 1236 <1> ;cconfig_error: 1237 <1> ; retn 1238 <1> 1239 <1> vt8233_int_handler: 1240 <1> ; 05/06/2024 1241 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 1242 <1> ; 27/07/2020 1243 <1> ; 22/07/2020 1244 <1> ; Interrupt Handler for VIA VT8237R Audio Controller 1245 <1> ; Note: called by 'dev_IRQ_service' 1246 <1> ; 14/10/2017 1247 <1> ; 09/10/2017, 10/10/2017, 12/10/2017 1248 <1> ; 13/06/2017 1249 <1> ; 21/04/2017 (TRDOS 386 kernel, 'audio.s') 1250 <1> ; 24/03/2017 - 'PLAYER.COM' ('player.asm') 1251 <1> 1252 <1> ;push eax ; * must be saved ! 1253 <1> ;push edx 1254 <1> ;push ecx 1255 <1> ;push ebx ; * must be saved ! 1256 <1> ;push esi 1257 <1> ;push edi 1258 <1> 1259 <1> ;cmp byte [audio_busy], 1 1260 <1> ;jnb short _ih0 ; 09/10/2017 1261 <1> 1262 <1> ;mov byte [audio_flag_eol], 0 1263 <1> 1264 00013C9A 66BA0000 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_STATUS 1265 00013C9E E81CFFFFFF <1> call ctrl_io_r8 1266 <1> 1267 00013CA3 A880 <1> test al, VIA_REG_STAT_ACTIVE 1268 00013CA5 7417 <1> jz short _ih0 ; 09/10/2017 1269 <1> 1270 00013CA7 2407 <1> and al, VIA_REG_STAT_EOL + VIA_REG_STAT_FLAG + VIA_REG_STAT_STOPPED 1271 00013CA9 A2[1F890100] <1> mov [audio_flag_eol], al 1272 00013CAE 740E <1> jz short _ih0 ; 09/10/2017 1273 <1> 1274 <1> ; 09/10/2017 1275 <1> ;mov byte [audio_busy], 1 1276 <1> 1277 00013CB0 803D[1E890100]01 <1> cmp byte [audio_play_cmd], 1 1278 00013CB7 7315 <1> jnb short _ih1 ; 10/10/2017 1279 <1> 1280 00013CB9 E848000000 <1> call channel_reset 1281 <1> _ih0: 1282 <1> ; 09/10/2017 1283 00013CBE A0[1F890100] <1> mov al, [audio_flag_eol] ;; ack ;; 1284 00013CC3 66BA0000 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_STATUS 1285 00013CC7 E8EAFEFFFF <1> call ctrl_io_w8 1286 00013CCC EB37 <1> jmp short _ih4 1287 <1> _ih1: 1288 <1> vt8233_tuneLoop: 1289 00013CCE A0[1F890100] <1> mov al, [audio_flag_eol] ;; ack ;; 1290 00013CD3 66BA0000 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_STATUS 1291 00013CD7 E8DAFEFFFF <1> call ctrl_io_w8 1292 <1> 1293 <1> ; 22/07/2020 1294 <1> ;; 12/10/2017 1295 <1> ;mov byte [audio_flag], 0 ; Reset 1296 <1> 1297 <1> ; 10/10/2017 1298 <1> ; 09/10/2017 1299 <1> ;test byte [audio_flag_eol], VIA_REG_STAT_FLAG 1300 <1> ;jz short _ih2 ; EOL 1301 <1> 1302 <1> ; 22/07/2020 1303 <1> ; 14/10/2017 1304 <1> ;test byte [audio_flag_eol], VIA_REG_STAT_EOL 1305 <1> ;jnz short _ih2 ; EOL 1306 <1> ; ; (Half Buffer 2 has been completed 1307 <1> ; ; and Half Buffer 1 will be played.) 1308 <1> 1309 <1> ; FLAG 1310 <1> ; (Half Buffer 1 has been completed 1311 <1> ; and Half Buffer 2 will be played.) 1312 <1> 1313 <1> ; 14/10/2017 1314 <1> ;; (Continue to play.) 1315 <1> ;mov al, VIA_REG_CTRL_INT 1316 <1> ;or al, VIA_REG_CTRL_START 1317 <1> ;mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_CONTROL 1318 <1> ;call ctrl_io_w8 1319 <1> ; 12/10/2017 1320 <1> ;mov byte [audio_flag], 1 1321 <1> 1322 <1> ; 22/07/2020 1323 <1> ;inc byte [audio_flag] ; = 1 1324 <1> _ih2: 1325 <1> ; 10/10/2017 1326 00013CDC 8B3D[04890100] <1> mov edi, [audio_dma_buff] 1327 <1> 1328 <1> ; 05/06/2024 1329 <1> ; 04/06/2024 1330 <1> ;;mov ecx, [audio_dmabuff_size] 1331 <1> ;;shr ecx, 1 ; dma buff size / 2 = half buffer size 1332 <1> ;mov ecx, [audio_buff_size] 1333 <1> ;and cl, ~1 ; word aligned 1334 <1> ; 05/06/2024 1335 00013CE2 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] ; half buffer size 1336 <1> 1337 <1> ; 22/07/2020 1338 <1> ; 12/10/2017 1339 <1> ;cmp byte [audio_flag], 0 1340 <1> ;ja short _ih3 ; Playing Half Buffer 2 (Current: FLAG) 1341 <1> 1342 <1> ; 27/07/2020 1343 <1> ; 22/07/2020 1344 00013CE8 F605[10890100]01 <1> test byte [audio_flag], 1 ; Current flag value 1345 00013CEF 7402 <1> jz short _ih3 ; Half Buffer 1 must be filled 1346 <1> 1347 <1> ; Half Buffer 2 must be filled 1348 00013CF1 01CF <1> add edi, ecx 1349 <1> _ih3: 1350 <1> ; Update half buffer 2 while playing half buffer 1 1351 <1> ; Update half buffer 1 while playing half buffer 2 1352 <1> 1353 00013CF3 8B35[FC880100] <1> mov esi, [audio_p_buffer] ; phy addr of audio buff 1354 <1> ; 05/06/2024 1355 <1> ;shr ecx, 2 ; half buff size / 4 1356 <1> ;rep movsd 1357 00013CF9 D1E9 <1> shr ecx, 1 ; word aligned buffer 1358 00013CFB 66F3A5 <1> rep movsw 1359 <1> 1360 <1> ; switch flag value ; 1361 00013CFE 8035[10890100]01 <1> xor byte [audio_flag], 1 1362 <1> ; 12/10/2017 1363 <1> ; [audio_flag] = 0 : Playing dma half buffer 2 1364 <1> ; Next buffer (to update) is dma half buff 1 1365 <1> ; = 1 : Playing dma half buffer 1 1366 <1> ; Next buffer (to update) is dma half buff 2 1367 <1> _ih4: 1368 <1> ; 28/05/2017 1369 <1> ;mov byte [audio_busy], 0 ; 09/10/2017 1370 <1> ; 1371 <1> ;pop edi 1372 <1> ;pop esi 1373 <1> ;pop ebx ; * must be restored ! 1374 <1> ;pop ecx 1375 <1> ;pop edx 1376 <1> ;pop eax ; * must be restored ! 1377 <1> 1378 00013D05 C3 <1> retn 1379 <1> 1380 <1> channel_reset: 1381 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1382 <1> ; 24/06/2017 1383 <1> ; 29/05/2017 1384 <1> ; 23/03/2017 1385 <1> ; 14/11/2016 - Erdogan Tan 1386 <1> ; 12/11/2016 - Erdogan Tan (Ref: KolibriOS, vt823x.asm) 1387 <1> ;mov edx, VIA_REG_OFFSET_CONTROL 1388 <1> ; 06/08/2022 1389 00013D06 29D2 <1> sub edx, edx 1390 00013D08 B201 <1> mov dl, VIA_REG_OFFSET_CONTROL 1391 <1> ;mov eax, VIA_REG_CTRL_PAUSE + VIA_REG_CTRL_TERMINATE + VIA_REG_CTRL_RESET 1392 00013D0A B848000000 <1> mov eax, VIA_REG_CTRL_PAUSE + VIA_REG_CTRL_TERMINATE ; 24/06/2017 1393 00013D0F E8A2FEFFFF <1> call ctrl_io_w8 1394 <1> 1395 <1> ;mov edx, VIA_REG_OFFSET_CONTROL 1396 <1> ;call ctrl_io_r8 1397 <1> 1398 <1> ; wait for 50 ms 1399 <1> ;mov ecx, 160 ; (200*0.25 ms) ; 29/05/2017 1400 <1> ; 06/08/2022 1401 00013D14 31C9 <1> xor ecx, ecx 1402 00013D16 B1A0 <1> mov cl, 160 1403 <1> _ch_rst_wait: 1404 00013D18 E861FEFFFF <1> call delay1_4ms 1405 00013D1D 49 <1> dec ecx 1406 00013D1E 75F8 <1> jnz short _ch_rst_wait 1407 <1> 1408 <1> ; disable interrupts 1409 <1> ;mov edx, VIA_REG_OFFSET_CONTROL 1410 <1> ; 06/08/2022 1411 00013D20 29D2 <1> sub edx, edx 1412 00013D22 B201 <1> mov dl, VIA_REG_OFFSET_CONTROL 1413 00013D24 31C0 <1> xor eax, eax 1414 00013D26 E88BFEFFFF <1> call ctrl_io_w8 1415 <1> 1416 <1> ; clear interrupts 1417 <1> ;mov edx, VIA_REG_OFFSET_STATUS 1418 <1> ; 06/08/2022 1419 00013D2B 29D2 <1> sub edx, edx 1420 <1> ;mov dl, VIA_REG_OFFSET_STATUS ; 0 1421 <1> ; edx = 0 1422 <1> ;mov eax, 3 1423 <1> ; 06/08/2022 1424 00013D2D 29C0 <1> sub eax, eax 1425 00013D2F B003 <1> mov al, 3 1426 <1> ; eax = 3 1427 00013D31 E880FEFFFF <1> call ctrl_io_w8 1428 <1> 1429 <1> ;mov edx, VIA_REG_OFFSET_CURR_PTR 1430 <1> ;xor eax, eax 1431 <1> ;call ctrl_io_w32 1432 <1> 1433 00013D36 C3 <1> retn 1434 <1> 1435 <1> vt8233_stop: ; 22/04/2017 1436 00013D37 C605[1E890100]00 <1> mov byte [audio_play_cmd], 0 ; stop ! 1437 <1> _tlp2: 1438 <1> ; 24/06/2017 1439 <1> ; finished with song, stop everything 1440 <1> ;mov al, VIA_REG_CTRL_INT 1441 <1> ;or al, VIA_REG_CTRL_TERMINATE 1442 <1> ;mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_CONTROL 1443 <1> ;call ctrl_io_w8 1444 <1> 1445 <1> ;call channel_reset 1446 <1> ;retn 1447 <1> 1448 00013D3E EBC6 <1> jmp short channel_reset 1449 <1> 1450 <1> set_vt8233_bdl: ; Set VT8237R Buffer Descriptor List 1451 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 1452 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1453 <1> ; 22/07/2020 - TRDOS 386 v2.0.2 1454 <1> ; 28/05/2017 1455 <1> ; 21/04/2017 (TRDOS 386 kernel, 'audio.s') 1456 <1> ; 24/03/2017 - 'PLAYER.COM' ('via_wav.asm' - 29/11/2016) 1457 <1> 1458 <1> ; eax = dma buffer address = [audio_DMA_buff] 1459 <1> ; ecx = dma buffer buffer size = [audio_dmabuff_size] 1460 <1> 1461 <1> ; 04/06/2024 1462 <1> ; ecx = DMA half buffer size (same as audio buffer size) 1463 <1> 1464 <1> ;shr ecx, 1 ; dma half buffer size 1465 00013D40 89CE <1> mov esi, ecx 1466 <1> 1467 00013D42 BF[28890100] <1> mov edi, audio_bdl_buff ; get BDL address 1468 <1> ;mov ecx, 32 / 2 ; make 32 entries in BDL 1469 <1> ; 06/08/2022 1470 00013D47 29C9 <1> sub ecx, ecx 1471 00013D49 B110 <1> mov cl, 16 1472 <1> 1473 00013D4B EB05 <1> jmp short s_vt8233_bdl1 1474 <1> 1475 <1> s_vt8233_bdl0: 1476 <1> ; set buffer descriptor 0 to start of data file in memory 1477 <1> 1478 00013D4D A1[04890100] <1> mov eax, [audio_dma_buff] ; Physical address of DMA buffer 1479 <1> 1480 <1> s_vt8233_bdl1: 1481 00013D52 AB <1> stosd ; store dmabuffer1 address 1482 <1> 1483 00013D53 89C2 <1> mov edx, eax 1484 <1> 1485 <1> ; VIA VT8235.PDF: (Page 110) (Erdogan Tan, 29/11/2016) 1486 <1> ; 1487 <1> ; Audio SGD Table Format 1488 <1> ; ------------------------------- 1489 <1> ; 63 62 61-56 55-32 31-0 1490 <1> ; -- -- -------- ----- ---- 1491 <1> ; EOL FLAG -reserved- Base Base 1492 <1> ; Count Address 1493 <1> ; [23:0] [31:0] 1494 <1> ; EOL: End Of Link. 1495 <1> ; 1 indicates this block is the last of the link. 1496 <1> ; If the channel “Interrupt on EOL” bit is set, then 1497 <1> ; an interrupt is generated at the end of the transfer. 1498 <1> ; 1499 <1> ; FLAG: Block Flag. If set, transfer pauses at the end of this 1500 <1> ; block. If the channel “Interrupt on FLAG” bit is set, 1501 <1> ; then an interrupt is generated at the end of this block. 1502 <1> 1503 00013D55 89F0 <1> mov eax, esi ; DMA half buffer size 1504 <1> 1505 <1> ; 04/06/2024 - Erdogan Tan 1506 <1> ; NOTE: I have changed DMA half buffer size to 1507 <1> ; (word aligned) audio buffer size for smooth audio playing 1508 <1> ; (it was page border aligned before June 4, 2024) 1509 <1> ; 1510 <1> ; For example: 1511 <1> ; For 65416 bytes audio buffer (22kHz, 16bit samples) 1512 <1> ; (user's audio buff virtual addr is mapped to physical) 1513 <1> ; ((kernel's and user's audio buff pages are same)) 1514 <1> ; 1) Memory allocation (of it) is 65536 bytes 1515 <1> ; 2) DMA half buffer size is 65416 bytes 1516 <1> ; (it would be 65536 bytes before this modification) 1517 <1> ; ((additional 140 bytes would cause to a noise)) 1518 <1> ; 3) Total DMA buffer size is 131072 bytes 1519 <1> ; (the last 240 bytes will not be used for playing) 1520 <1> 1521 00013D57 01C2 <1> add edx, eax 1522 00013D59 0D00000040 <1> or eax, FLAG 1523 <1> ;or eax, EOL 1524 00013D5E AB <1> stosd 1525 <1> 1526 <1> ; 2nd buffer: 1527 <1> 1528 00013D5F 89D0 <1> mov eax, edx ; Physical address of the 2nd half of DMA buffer 1529 00013D61 AB <1> stosd ; store dmabuffer2 address 1530 <1> 1531 <1> ; set length to [audio_dmabuff_size]/2 1532 <1> ; Set control (bits 31:16) to BUP, bits 15:0=number of samples 1533 <1> ; 1534 00013D62 89F0 <1> mov eax, esi ; DMA half buffer size 1535 <1> ; 22/07/2020 1536 <1> ;or eax, EOL 1537 00013D64 0D00000040 <1> or eax, FLAG 1538 00013D69 AB <1> stosd 1539 <1> 1540 00013D6A E2E1 <1> loop s_vt8233_bdl0 1541 <1> 1542 <1> ; 22/07/2020 1543 00013D6C 814FFC00000080 <1> or dword [edi-4], EOL 1544 <1> 1545 00013D73 C3 <1> retn 1546 <1> 1547 <1> vt8233_start_play: 1548 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1549 <1> ; 01/09/2020 1550 <1> ; 22/07/2020 1551 <1> ; start to play audio data via VT8233 audio controller 1552 <1> ; 13/06/2017 1553 <1> ; 10/06/2017 1554 <1> ; 24/04/2017 1555 <1> ; 21/04/2017 (TRDOS 386 kernel, 'audio.s') 1556 <1> ; 24/03/2017 - 'PLAYER.COM' ('via_wav.asm' - 29/11/2016) 1557 <1> ; write buffer descriptor list address 1558 <1> 1559 <1> ; Extended Audio Status (2Ah) 1560 00013D74 B82A000000 <1> mov eax, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 1561 00013D79 E85CFEFFFF <1> call codec_read 1562 00013D7E 25FDFF0000 <1> and eax, 0FFFFh - 2 ; clear DRA (BIT1) 1563 <1> ;or eax, 1 ; set VRA (BIT0) 1564 <1> ;or eax, 5 ; VRA (BIT0) & S/PDIF (BIT2) ; 14/11/2016 1565 00013D83 0C05 <1> or al, 5 1566 <1> ; 01/09/2020 1567 <1> ;or eax, 3805h ; AD1980 (PRK, PRJ, PRI = 1 .. only front DAC) 1568 <1> ; 01/09/2020 1569 <1> ;mov edx, CODEC_EXT_AUDIO_CTRL_REG 1570 <1> ;cmp word [audio_freq], 0BB80h ; 48 kHz 1571 <1> ;jne short set_extd_audio_status_1 1572 <1> ;and al, 0FEh ; disable VRA bit (set sample rate to 48000 Hz) 1573 <1> ;jmp short set_extd_audio_status_2 1574 <1> ;set_extd_audio_status_1: 1575 00013D85 BA2A000000 <1> mov edx, CODEC_EXT_AUDIO_CTRL_REG 1576 00013D8A E86EFEFFFF <1> call codec_write 1577 <1> ;jc short cconfig_error 1578 <1> 1579 <1> set_sample_rate: 1580 <1> ;movzx eax, word [audio_freq] 1581 00013D8F 66A1[1A890100] <1> mov ax, [audio_freq] 1582 00013D95 BA2C000000 <1> mov edx, CODEC_PCM_FRONT_DACRATE_REG ; 2Ch ; PCM Front DAC Rate 1583 <1> ;set_extd_audio_status_2: 1584 00013D9A E85EFEFFFF <1> call codec_write 1585 <1> 1586 <1> ; 01/09/2020 1587 <1> ; set AD1980 MCB register (Index 76h) to 0C00h 1588 <1> ; (CLDIS, HPSEL) 1589 <1> ;mov ax, 0C00h 1590 <1> ;mov edx, CODEC_MISC_CRTL_BITS_REG ; 76h 1591 <1> ; ; Miscellaneous Control Bit Register 1592 <1> ;call codec_write 1593 <1> ; 1594 <1> 1595 00013D9F B8[28890100] <1> mov eax, audio_bdl_buff 1596 <1> 1597 <1> ; 12/11/2016 - Erdogan Tan 1598 <1> ; (Ref: KolibriOS, vt823x.asm, 'create_primary_buff') 1599 <1> ;mov edx, VIADEV_PLAYBACK + VIA_REG_OFFSET_TABLE_PTR 1600 <1> ; 06/08/2022 1601 00013DA4 29D2 <1> sub edx, edx 1602 <1> ;mov dl, VIADEV_PLAYBACK + VIA_REG_OFFSET_TABLE_PTR 1603 <1> ; edx = 0 1604 00013DA6 E81DFEFFFF <1> call ctrl_io_w32 1605 <1> 1606 <1> ;call codec_check_ready 1607 <1> 1608 00013DAB 66BA0200 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFS_PLAYBACK_VOLUME_L 1609 <1> ;mov eax, 2 ; 31 1610 00013DAF B01F <1> mov al, 31 1611 00013DB1 2A05[20890100] <1> sub al, [audio_master_volume_l] 1612 00013DB7 E8FAFDFFFF <1> call ctrl_io_w8 1613 <1> 1614 <1> ;call codec_check_ready 1615 <1> 1616 00013DBC 66BA0300 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFS_PLAYBACK_VOLUME_R 1617 <1> ;mov ax, 2 ; 31 1618 00013DC0 B01F <1> mov al, 31 1619 00013DC2 2A05[21890100] <1> sub al, [audio_master_volume_r] 1620 00013DC8 E8E9FDFFFF <1> call ctrl_io_w8 1621 <1> 1622 <1> ;call codec_check_ready 1623 <1> ; 1624 <1> ; 1625 <1> ; All set. Let's play some music. 1626 <1> ; 1627 <1> ; 1628 <1> ;mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_STOP_IDX 1629 <1> ;mov ax, VIA8233_REG_TYPE_16BIT or VIA8233_REG_TYPE_STEREO or 0xfffff or 0xff000000 1630 <1> ;call ctrl_io_w32 1631 <1> 1632 <1> ;call codec_check_ready 1633 <1> 1634 <1> ; 08/12/2016 1635 <1> ; 07/10/2016 1636 <1> ;;mov al, 1 1637 <1> ;mov al, 31 1638 <1> ; 22/07/2020 1639 00013DCD B0FF <1> mov al, 0FFh 1640 00013DCF E813000000 <1> call set_VT8233_LastValidIndex 1641 <1> 1642 00013DD4 C605[1E890100]01 <1> mov byte [audio_play_cmd], 1 ; play command (do not stop) ! 1643 <1> 1644 <1> ; 22/07/2020 1645 <1> ;mov byte [audio_flag], 0 ; clear half buffer flag 1646 <1> 1647 <1> vt8233_play: ; continue to play 1648 <1> ; 22/04/2017 1649 <1> ;mov al, VIA_REG_CTRL_INT 1650 <1> ;or al, VIA_REG_CTRL_START 1651 <1> ;;mov al, VIA_REG_CTRL_AUTOSTART + VIA_REG_CTRL_START 1652 <1> ; 22/07/2020 1653 00013DDB B0A1 <1> mov al, VIA_REG_CTRL_AUTOSTART + VIA_REG_CTRL_START + VIA_REG_CTRL_INT_FLAG 1654 <1> 1655 00013DDD 66BA0100 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_CONTROL 1656 00013DE1 E8D0FDFFFF <1> call ctrl_io_w8 1657 <1> ;call codec_check_ready 1658 <1> ;retn 1659 <1> ;jmp codec_check_ready 1660 00013DE6 C3 <1> retn 1661 <1> 1662 <1> ;input AL = index # to stop on 1663 <1> set_VT8233_LastValidIndex: 1664 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1665 <1> ; 23/07/2020 1666 <1> ; 10/06/2017 1667 <1> ; 21/04/2017 (TRDOS 386 kernel, 'audio.s') 1668 <1> ; 24/03/2017 - 'PLAYER.COM' ('via_wav.asm' - 29/11/2016) 1669 <1> ; 19/11/2016 1670 <1> ; 14/11/2016 - Erdogan Tan (Ref: VIA VT8235.PDF, Page 110) 1671 <1> ; 12/11/2016 - Erdogan Tan 1672 <1> ; (Ref: KolibriOS, vt823x.asm, 'create_primary_buff') 1673 <1> ;push edx 1674 <1> ;push ax 1675 00013DE7 50 <1> push eax ; 23/07/2020 1676 <1> ;push ecx 1677 00013DE8 0FB705[1A890100] <1> movzx eax, word [audio_freq] ; Hertz 1678 00013DEF BA00001000 <1> mov edx, 100000h ; 2^20 = 1048576 1679 00013DF4 F7E2 <1> mul edx 1680 00013DF6 B980BB0000 <1> mov ecx, 48000 1681 00013DFB F7F1 <1> div ecx 1682 <1> ;and eax, 0FFFFFh 1683 <1> ;pop ecx 1684 <1> ;pop dx 1685 00013DFD 5A <1> pop edx ; 23/07/2020 1686 00013DFE C1E218 <1> shl edx, 24 ; STOP Index Setting: Bit 24 to 31 1687 00013E01 09D0 <1> or eax, edx 1688 <1> ; 19/11/2016 1689 00013E03 803D[18890100]10 <1> cmp byte [audio_bps], 16 1690 00013E0A 7505 <1> jne short sLVI_1 1691 00013E0C 0D00002000 <1> or eax, VIA8233_REG_TYPE_16BIT 1692 <1> sLVI_1: 1693 00013E11 803D[19890100]02 <1> cmp byte [audio_stmo], 2 1694 00013E18 7505 <1> jne short sLVI_2 1695 00013E1A 0D00001000 <1> or eax, VIA8233_REG_TYPE_STEREO 1696 <1> sLVI_2: 1697 <1> ;mov edx, VIADEV_PLAYBACK + VIA_REG_OFFSET_STOP_IDX 1698 <1> ; 06/08/2022 1699 00013E1F 29D2 <1> sub edx, edx 1700 00013E21 B208 <1> mov dl, VIADEV_PLAYBACK + VIA_REG_OFFSET_STOP_IDX 1701 00013E23 E8A0FDFFFF <1> call ctrl_io_w32 1702 <1> ;call codec_check_ready 1703 <1> ;pop edx 1704 00013E28 C3 <1> retn 1705 <1> 1706 <1> vt8233_pause: ; pause 1707 <1> ; 10/06/2017 1708 <1> ; 22/04/2017 1709 <1> ;mov al, VIA_REG_CTRL_INT 1710 <1> ;or al, VIA_REG_CTRL_PAUSE 1711 <1> ; 23/07/2020 1712 00013E29 B029 <1> mov al, VIA_REG_CTRL_PAUSE+VIA_REG_CTRL_INT_FLAG+VIA_REG_CTRL_AUTOSTART 1713 <1> 1714 00013E2B 66BA0100 <1> mov dx, VIADEV_PLAYBACK + VIA_REG_OFFSET_CONTROL 1715 00013E2F E882FDFFFF <1> call ctrl_io_w8 1716 <1> ;call codec_check_ready 1717 <1> ;retn 1718 <1> ;jmp codec_check_ready 1719 00013E34 C3 <1> retn 1720 <1> 1721 <1> vt8233_reset: 1722 <1> ; 22/04/2017 1723 <1> ; reset VT8237R (vt8233) Audio Controller 1724 <1> ;cmp byte [audio_play_cmd], 1 1725 <1> ;jna short vt8233_rst_0 1726 00013E35 C605[1E890100]00 <1> mov byte [audio_play_cmd], 0 ; stop ! 1727 <1> vt8233_rst_0: 1728 00013E3C E8DAFCFFFF <1> call reset_codec 1729 00013E41 720A <1> jc short vt8233_rst_1 ; codec error ! 1730 <1> ; eax = 1 1731 00013E43 E852FDFFFF <1> call codec_io_w16 ; w32 1732 00013E48 E8B9FEFFFF <1> call channel_reset 1733 <1> vt8233_rst_1: 1734 <1> vt8233_vol_1: ; 06/08/2022 1735 00013E4D C3 <1> retn 1736 <1> 1737 <1> vt8233_volume: 1738 <1> ; set VT8237R (vt8233) sound volume level 1739 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1740 <1> ; 24/04/2017 1741 <1> ; 22/04/2017 1742 <1> ; bl = component (0 = master/playback/lineout volume) 1743 <1> ; cl = left channel volume level (0 to 31) 1744 <1> ; ch = right channel volume level (0 to 31) 1745 <1> 1746 00013E4E 08DB <1> or bl, bl 1747 00013E50 75FB <1> jnz short vt8233_vol_1 ; temporary ! 1748 00013E52 66B81F1F <1> mov ax, 1F1Fh ; 31,31 1749 00013E56 38C1 <1> cmp cl, al 1750 00013E58 77F3 <1> ja short vt8233_vol_1 ; temporary ! 1751 00013E5A 38E5 <1> cmp ch, ah 1752 00013E5C 77EF <1> ja short vt8233_vol_1 ; temporary ! 1753 00013E5E 66890D[20890100] <1> mov [audio_master_volume], cx 1754 00013E65 6629C8 <1> sub ax, cx 1755 <1> ;mov edx, CODEC_MASTER_VOL_REG ; 02h ; Line Out 1756 <1> ; 06/08/2022 1757 00013E68 29D2 <1> sub edx, edx 1758 00013E6A B202 <1> mov dl, CODEC_MASTER_VOL_REG ; 02h ; Line Out 1759 <1> ; 06/08/2022 1760 00013E6C E98CFDFFFF <1> jmp codec_write 1761 <1> ;call codec_write 1762 <1> ;vt8233_vol_1: 1763 <1> ;retn 1764 <1> 1765 <1> ; CODE for SOUND BLASTER 16 1766 <1> 1767 <1> DetectSB: 1768 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 1769 <1> ; 24/04/2017 1770 <1> ;pushad 1771 <1> ScanPort: 1772 <1> ; 06/08/2022 1773 00013E71 66BB1002 <1> mov bx, 0210h ; start scanning ports 1774 <1> ; 210h, 220h, .. 260h 1775 <1> ; 06/08/2022 1776 00013E75 31C9 <1> xor ecx, ecx 1777 00013E77 88FE <1> mov dh, bh 1778 <1> ResetDSP: 1779 <1> ;mov dx, bx ; try to reset the DSP. 1780 <1> ;add dx, 06h 1781 <1> ; 06/08/2022 1782 00013E79 88DA <1> mov dl, bl 1783 00013E7B 80C206 <1> add dl, 06h 1784 <1> 1785 00013E7E B001 <1> mov al, 1 1786 00013E80 EE <1> out dx, al 1787 <1> 1788 00013E81 EC <1> in al, dx 1789 00013E82 EC <1> in al, dx 1790 00013E83 EC <1> in al, dx 1791 00013E84 EC <1> in al, dx 1792 <1> 1793 00013E85 30C0 <1> xor al, al 1794 00013E87 EE <1> out dx, al 1795 <1> 1796 <1> ;add dx, 08h 1797 <1> ; 06/08/2022 1798 00013E88 80C208 <1> add dl, 08h 1799 <1> ;mov cx, 100 1800 00013E8B B164 <1> mov cl, 100 1801 <1> WaitID: 1802 00013E8D EC <1> in al, dx 1803 00013E8E 08C0 <1> or al, al 1804 00013E90 7804 <1> js short GetID 1805 00013E92 E2F9 <1> loop WaitID 1806 00013E94 EB0D <1> jmp short NextPort 1807 <1> GetID: 1808 <1> ;sub dx, 04h 1809 <1> ; 06/08/2022 1810 00013E96 80EA04 <1> sub dl, 04h 1811 00013E99 EC <1> in al, dx 1812 00013E9A 3CAA <1> cmp al, 0AAh 1813 00013E9C 740F <1> je short Found 1814 <1> ;add dx, 04h 1815 <1> ; 06/08/2022 1816 00013E9E 80C204 <1> add dl, 04h 1817 00013EA1 E2EA <1> loop WaitID 1818 <1> NextPort: 1819 <1> ;add bx, 10h ; if not response, 1820 <1> ; 06/08/2022 1821 00013EA3 80C310 <1> add bl, 10h 1822 <1> ;cmp bx, 260h ; try the next port. 1823 00013EA6 80FB60 <1> cmp bl, 60h 1824 00013EA9 76CE <1> jbe short ResetDSP 1825 00013EAB F9 <1> stc 1826 00013EAC C3 <1> retn 1827 <1> Found: 1828 00013EAD 66891D[EA880100] <1> mov [audio_io_base], bx ; SB Port Address Found! 1829 <1> ScanIRQ: 1830 <1> SetIrqs: 1831 00013EB4 28C0 <1> sub al, al ; 0 1832 00013EB6 A2[E0880100] <1> mov [IRQnum], al ; reset 1833 00013EBB A2[E6880100] <1> mov [audio_intr], al ; reset 1834 <1> 1835 <1> ; ah > 0 -> set IRQ vector 1836 <1> ; al = IRQ number 1837 <1> ;mov ax, 103h ; IRQ 3 1838 <1> ;call set_hardware_int_vector 1839 <1> ;mov ax, 104h ; IRQ 4 1840 <1> ;call set_hardware_int_vector 1841 00013EC0 66B80501 <1> mov ax, 105h ; IRQ 5 1842 00013EC4 E853DFFFFF <1> call set_hardware_int_vector 1843 00013EC9 66B80701 <1> mov ax, 107h ; IRQ 7 1844 00013ECD E84ADFFFFF <1> call set_hardware_int_vector 1845 <1> 1846 00013ED2 668B15[EA880100] <1> mov dx, [audio_io_base] ; tells to the SB to 1847 <1> ;add dx, 0Ch ; generate a IRQ! 1848 <1> ; 06/08/2022 1849 00013ED9 80C20C <1> add dl, 0Ch 1850 <1> WaitSb: 1851 00013EDC EC <1> in al, dx 1852 00013EDD 08C0 <1> or al, al 1853 00013EDF 78FB <1> js short WaitSb 1854 00013EE1 B0F2 <1> mov al, 0F2h 1855 00013EE3 EE <1> out dx, al 1856 <1> 1857 00013EE4 31C9 <1> xor ecx, ecx ; wait until IRQ level 1858 <1> WaitIRQ: 1859 00013EE6 A0[E0880100] <1> mov al, [IRQnum] 1860 00013EEB 3C00 <1> cmp al, 0 ; is changed or timeout. 1861 00013EED 7706 <1> ja short IrqOk 1862 00013EEF 6649 <1> dec cx 1863 00013EF1 75F3 <1> jnz short WaitIRQ 1864 00013EF3 EB14 <1> jmp short RestoreIrqs 1865 <1> IrqOk: 1866 00013EF5 A2[E6880100] <1> mov [audio_intr], al ; set 1867 00013EFA 668B15[EA880100] <1> mov dx, [audio_io_base] 1868 <1> ;add dx, 0Eh 1869 <1> ; 06/08/2022 1870 00013F01 80C20E <1> add dl, 0Eh 1871 00013F04 EC <1> in al, dx ; SB acknowledge. 1872 00013F05 B020 <1> mov al, 20h 1873 00013F07 E620 <1> out 20h, al ; Hardware acknowledge. 1874 <1> 1875 <1> RestoreIrqs: 1876 <1> ; ah = 0 -> reset IRQ vector 1877 <1> ; al = IRQ number 1878 <1> ;mov ax, 3 ; IRQ 3 1879 <1> ;call set_hardware_int_vector 1880 <1> ;mov ax, 4 ; IRQ 4 1881 <1> ;call set_hardware_int_vector 1882 00013F09 66B80500 <1> mov ax, 5 ; IRQ 5 1883 00013F0D E80ADFFFFF <1> call set_hardware_int_vector 1884 00013F12 66B80700 <1> mov ax, 7 ; IRQ 7 1885 00013F16 E801DFFFFF <1> call set_hardware_int_vector 1886 <1> 1887 00013F1B 31D2 <1> xor edx, edx 1888 00013F1D 8915[EC880100] <1> mov [audio_dev_id], edx ; 0 1889 00013F23 8915[F0880100] <1> mov [audio_vendor], edx ; 0 1890 <1> ; 22/11/2023 1891 <1> ;mov [audio_stats_cmd], edx ; 0 1892 <1> 1893 <1> ;popad 1894 <1> 1895 00013F29 803D[E6880100]01 <1> cmp byte [audio_intr], 1 ; IRQ level was changed? 1896 <1> 1897 00013F30 C3 <1> retn 1898 <1> 1899 <1> %macro SbOut 1 1900 <1> %%Wait: 1901 <1> in al, dx 1902 <1> or al, al 1903 <1> js short %%Wait 1904 <1> mov al, %1 1905 <1> out dx, al 1906 <1> %endmacro 1907 <1> 1908 <1> SbInit_play: 1909 <1> ; 28/01/2025 - TRDOS 386 Kernel v2.0.10 1910 <1> ; 06/08/2022 - TRDOS 386 Kernel v2.0.5 1911 <1> ; 22/10/2017 1912 <1> ; 20/10/2017 1913 <1> ; 06/10/2017 1914 <1> ; 13/07/2017 - 09/08/2017 1915 <1> ; 24/04/2017 - 15/05/2017 - 24/06/2017 1916 <1> ;pushad 1917 <1> SetBuffer: 1918 <1> ;mov byte [DmaFlag], 0 1919 <1> 1920 00013F31 8B1D[04890100] <1> mov ebx, [audio_dma_buff] ; physical addr of DMA buff 1921 00013F37 89DF <1> mov edi, ebx 1922 <1> ;mov ecx, [audio_dmabuff_size] 1923 <1> ; 28/01/2025 (BugFix) 1924 00013F39 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] 1925 <1> ;shl ecx, 1 ; * 2 ; *!* 1926 <1> 1927 00013F3F 803D[18890100]10 <1> cmp byte [audio_bps], 16 1928 00013F46 752F <1> jne short sbInit_0 ; set 8 bit DMA buffer 1929 <1> 1930 <1> ; 09/08/2017 1931 <1> ; convert byte count to word count 1932 <1> ; 28/01/2025 1933 <1> ;shr ecx, 1 ; *!* 1934 <1> 1935 00013F48 49 <1> dec ecx ; word count - 1 1936 <1> ; convert byte offset to word offset 1937 00013F49 D1EB <1> shr ebx, 1 1938 <1> 1939 <1> ; 16 bit DMA buffer setting (DMA channel 5) 1940 00013F4B B005 <1> mov al, 05h ; set mask bit for channel 5 (4+1) 1941 00013F4D E6D4 <1> out 0D4h, al 1942 <1> 1943 00013F4F 30C0 <1> xor al, al ; stops all DMA processes on selected channel 1944 00013F51 E6D8 <1> out 0D8h, al ; clear selected channel register 1945 <1> 1946 00013F53 88D8 <1> mov al, bl ; byte 0 of DMA buffer offset in words (physical) 1947 00013F55 E6C4 <1> out 0C4h, al ; DMA channel 5 port number 1948 <1> 1949 00013F57 88F8 <1> mov al, bh ; byte 1 of DMA buffer offset in words (physical) 1950 00013F59 E6C4 <1> out 0C4h, al 1951 <1> 1952 <1> ; 09/08/2017 1953 00013F5B C1EB0F <1> shr ebx, 15 ; complete 16 bit shift 1954 00013F5E 80E3FE <1> and bl, 0FEh ; clear bit 0 (not necessary, it will be ignored) 1955 <1> 1956 00013F61 88D8 <1> mov al, bl ; byte 2 of DMA buffer address (physical) 1957 00013F63 E68B <1> out 8Bh, al ; page register port addr for channel 5 ; 13/07/2017 1958 <1> 1959 00013F65 88C8 <1> mov al, cl ; low byte of DMA count - 1 1960 00013F67 E6C6 <1> out 0C6h, al ; count register port addr for channel 1 1961 <1> 1962 00013F69 88E8 <1> mov al, ch ; high byte of DMA count - 1 1963 00013F6B E6C6 <1> out 0C6h, al 1964 <1> 1965 <1> ; channel 5, read, autoinitialized, single mode 1966 <1> ;mov al, 49h 1967 00013F6D B059 <1> mov al, 59h ; 06/10/2017 1968 00013F6F E6D6 <1> out 0D6h, al ; DMA mode register port address 1969 <1> 1970 00013F71 B001 <1> mov al, 01h ; clear mask bit for channel 1 1971 00013F73 E6D4 <1> out 0D4h, al ; DMA mask register port address 1972 <1> 1973 00013F75 EB2A <1> jmp short ClearBuffer 1974 <1> 1975 <1> sbInit_0: 1976 <1> ; 28/01/2025 1977 00013F77 D1E1 <1> shl ecx, 1 ; half buffer size * 2 ; *!* 1978 <1> 1979 00013F79 49 <1> dec ecx ; 09/08/2017 1980 <1> 1981 <1> ; 8 bit DMA buffer setting (DMA channel 1) 1982 00013F7A B005 <1> mov al, 05h ; set mask bit for channel 1 (4+1) 1983 00013F7C E60A <1> out 0Ah, al ; DMA mask register 1984 <1> 1985 00013F7E 30C0 <1> xor al, al ; stops all DMA processes on selected channel 1986 00013F80 E60C <1> out 0Ch, al ; clear selected channel register 1987 <1> 1988 00013F82 88D8 <1> mov al, bl ; byte 0 of DMA buffer address (physical) 1989 00013F84 E602 <1> out 02h, al ; DMA channel 1 port number 1990 <1> 1991 00013F86 88F8 <1> mov al, bh ; byte 1 of DMA buffer address (physical) 1992 00013F88 E602 <1> out 02h, al 1993 <1> 1994 00013F8A C1EB10 <1> shr ebx, 16 1995 <1> 1996 00013F8D 88D8 <1> mov al, bl ; byte 2 of DMA buffer address (physical) 1997 00013F8F E683 <1> out 83h, al ; page register port addr for channel 1 1998 <1> 1999 00013F91 88C8 <1> mov al, cl ; low byte of DMA count - 1 2000 00013F93 E603 <1> out 03h, al ; count register port addr for channel 1 2001 <1> 2002 00013F95 88E8 <1> mov al, ch ; high byte of DMA count - 1 2003 00013F97 E603 <1> out 03h, al 2004 <1> 2005 <1> ; channel 1, read, autoinitialized, single mode 2006 <1> ;mov al, 49h 2007 00013F99 B059 <1> mov al, 59h ; 06/10/2017 2008 00013F9B E60B <1> out 0Bh, al ; DMA mode register port address 2009 <1> 2010 00013F9D B001 <1> mov al, 01h ; clear mask bit for channel 1 2011 00013F9F E60A <1> out 0Ah, al ; DMA mask register port address 2012 <1> 2013 <1> ClearBuffer: 2014 <1> ;;mov edi, [audio_dma_buff] 2015 <1> ;;mov ecx, [audio_dmabuff_size] 2016 <1> ;inc ecx 2017 <1> ;mov al, 80h 2018 <1> ;;cld 2019 <1> ;rep stosb 2020 <1> SetIrq: 2021 <1> ;mov ebx, SbIrqhandler 2022 <1> ;mov al, [audio_intr] ; IRQ number 2023 <1> ;call set_dev_IRQ_service 2024 <1> ;; SETUP (audio) INTERRUPT CALLBACK SERVICE 2025 <1> ;mov bl, [audio_intr] ; IRQ number 2026 <1> ;mov bh, [audio_cb_mode] 2027 <1> ;inc bh ; 1 = Signal Response Byte method (fixed value) 2028 <1> ; ; 2 = Callback service method 2029 <1> ; ; 3 = Auto Increment S.R.B. method 2030 <1> ;mov cl, [audio_srb] 2031 <1> ;mov edx, [audio_cb_addr] 2032 <1> ;mov al, [audio_user] 2033 <1> ;call set_irq_callback_service 2034 <1> ResetDsp: 2035 00013FA1 668B15[EA880100] <1> mov dx, [audio_io_base] 2036 <1> ;add dx, 06h 2037 <1> ; 06/08/2022 2038 00013FA8 80C206 <1> add dl, 06h 2039 00013FAB B001 <1> mov al, 1 2040 00013FAD EE <1> out dx, al 2041 <1> 2042 00013FAE EC <1> in al, dx 2043 00013FAF EC <1> in al, dx 2044 00013FB0 EC <1> in al, dx 2045 00013FB1 EC <1> in al, dx 2046 <1> 2047 00013FB2 30C0 <1> xor al, al 2048 00013FB4 EE <1> out dx, al 2049 <1> 2050 <1> ;mov cx, 100 2051 <1> ; 06/08/2022 2052 00013FB5 29C9 <1> sub ecx, ecx 2053 00013FB7 B164 <1> mov cl, 100 2054 00013FB9 28E4 <1> sub ah, ah ; 0 2055 <1> WaitId: 2056 00013FBB 668B15[EA880100] <1> mov dx, [audio_io_base] 2057 <1> ;add dx, 0Eh 2058 <1> ; 06/08/2022 2059 00013FC2 80C20E <1> add dl, 0Eh 2060 00013FC5 EC <1> in al, dx 2061 00013FC6 08C0 <1> or al, al 2062 00013FC8 7807 <1> js short sb_GetId 2063 00013FCA E2EF <1> loop WaitId 2064 00013FCC E9B1000000 <1> jmp sb_Exit 2065 <1> sb_GetId: 2066 00013FD1 668B15[EA880100] <1> mov dx, [audio_io_base] 2067 <1> ;add dx, 0Ah 2068 <1> ; 06/08/2022 2069 00013FD8 80C20A <1> add dl, 0Ah 2070 00013FDB EC <1> in al, dx 2071 00013FDC 3CAA <1> cmp al, 0AAh 2072 00013FDE 7407 <1> je short SbOk 2073 00013FE0 E2D9 <1> loop WaitId 2074 00013FE2 E99B000000 <1> jmp sb_Exit 2075 <1> SbOk: 2076 00013FE7 668B15[EA880100] <1> mov dx, [audio_io_base] 2077 <1> ;add dx, 0Ch 2078 <1> ; 06/08/2022 2079 00013FEE 80C20C <1> add dl, 0Ch 2080 <1> SbOut 0D1h ; Turn on speaker 1900 <2> %%Wait: 1901 00013FF1 EC <2> in al, dx 1902 00013FF2 08C0 <2> or al, al 1903 00013FF4 78FB <2> js short %%Wait 1904 00013FF6 B0D1 <2> mov al, %1 1905 00013FF8 EE <2> out dx, al 2081 <1> SbOut 41h ; 8h bit or 16 bit transfer 1900 <2> %%Wait: 1901 00013FF9 EC <2> in al, dx 1902 00013FFA 08C0 <2> or al, al 1903 00013FFC 78FB <2> js short %%Wait 1904 00013FFE B041 <2> mov al, %1 1905 00014000 EE <2> out dx, al 2082 00014001 668B1D[1A890100] <1> mov bx, [audio_freq] ; sampling rate (Hz) 2083 <1> SbOut bh ; sampling rate high byte 1900 <2> %%Wait: 1901 00014008 EC <2> in al, dx 1902 00014009 08C0 <2> or al, al 1903 0001400B 78FB <2> js short %%Wait 1904 0001400D 88F8 <2> mov al, %1 1905 0001400F EE <2> out dx, al 2084 <1> SbOut bl ; sampling rate low byte 1900 <2> %%Wait: 1901 00014010 EC <2> in al, dx 1902 00014011 08C0 <2> or al, al 1903 00014013 78FB <2> js short %%Wait 1904 00014015 88D8 <2> mov al, %1 1905 00014017 EE <2> out dx, al 2085 <1> 2086 <1> ; 22/05/2017 2087 00014018 E8BD000000 <1> call sb16_volume_initial ; 15/05/2017 2088 <1> ; 20/05/2017 2089 <1> ;call sb16_volume 2090 <1> 2091 <1> StartDma: 2092 <1> ; autoinitialized mode 2093 0001401D 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit samples 2094 00014024 7411 <1> je short sb_play_1 2095 <1> ; 8 bit samples 2096 00014026 66BBC600 <1> mov bx, 0C6h ; 8 bit output (0C6h) 2097 0001402A 803D[19890100]02 <1> cmp byte [audio_stmo], 2 ; 1 = mono, 2 = stereo 2098 00014031 7214 <1> jb short sb_play_2 2099 00014033 B720 <1> mov bh, 20h ; 8 bit stereo (20h) 2100 00014035 EB10 <1> jmp short sb_play_2 2101 <1> sb_play_1: 2102 <1> ; 16 bit samples 2103 00014037 66BBB610 <1> mov bx, 10B6h ; 16 bit output (0B6h) 2104 0001403B 803D[19890100]02 <1> cmp byte [audio_stmo], 2 ; 1 = mono, 2 = stereo 2105 00014042 7203 <1> jb short sb_play_2 2106 00014044 80C720 <1> add bh, 20h ; 16 bit stereo (30h) 2107 <1> sb_play_2: 2108 <1> ; PCM output (8/16 bit mono autoinitialized transfer) 2109 <1> SbOut bl ; bCommand 1900 <2> %%Wait: 1901 00014047 EC <2> in al, dx 1902 00014048 08C0 <2> or al, al 1903 0001404A 78FB <2> js short %%Wait 1904 0001404C 88D8 <2> mov al, %1 1905 0001404E EE <2> out dx, al 2110 <1> SbOut bh ; bMode 1900 <2> %%Wait: 1901 0001404F EC <2> in al, dx 1902 00014050 08C0 <2> or al, al 1903 00014052 78FB <2> js short %%Wait 1904 00014054 88F8 <2> mov al, %1 1905 00014056 EE <2> out dx, al 2111 00014057 8B1D[08890100] <1> mov ebx, [audio_dmabuff_size] ; 15/05/2017 2112 0001405D D1EB <1> shr ebx, 1 ; half buffer size 2113 <1> ; 20/10/2017 2114 0001405F 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit DMA 2115 00014066 7502 <1> jne short sb_play_3 2116 00014068 D1EB <1> shr ebx, 1 ; byte count to word count 2117 <1> sb_play_3: 2118 <1> ;dec bx ; wBlkSize is one less than the actual size 2119 <1> ; 06/08/2022 2120 0001406A 4B <1> dec ebx 2121 <1> SbOut bl 1900 <2> %%Wait: 1901 0001406B EC <2> in al, dx 1902 0001406C 08C0 <2> or al, al 1903 0001406E 78FB <2> js short %%Wait 1904 00014070 88D8 <2> mov al, %1 1905 00014072 EE <2> out dx, al 2122 <1> SbOut bh 1900 <2> %%Wait: 1901 00014073 EC <2> in al, dx 1902 00014074 08C0 <2> or al, al 1903 00014076 78FB <2> js short %%Wait 1904 00014078 88F8 <2> mov al, %1 1905 0001407A EE <2> out dx, al 2123 <1> 2124 0001407B C605[1E890100]01 <1> mov byte [audio_play_cmd], 1 ; playing ! 2125 <1> 2126 <1> ;; Set Voice and master volumes 2127 <1> ;mov dx, [audio_io_base] 2128 <1> ;add dl, 4 ; Mixer chip Register Address Port 2129 <1> ;SbOut 30h ; select Master Volume Register (L) 2130 <1> ;inc dl ; Mixer chip Register Data Port 2131 <1> ;SbOut 0F8h ; Max. volume value is 31 (31*8) 2132 <1> ;dec dl 2133 <1> ;SbOut 31h ; select Master Volume Register (R) 2134 <1> ;inc dl 2135 <1> ;SbOut 0F8h ; Max. volume value is 31 (31*8) 2136 <1> ;dec dl 2137 <1> ;SbOut 32h ; select Voice Volume Register (L) 2138 <1> ;inc dl 2139 <1> ;SbOut 0F8h ; Max. volume value is 31 (31*8) 2140 <1> ;dec dl 2141 <1> ;SbOut 33h ; select Voice Volume Register (R) 2142 <1> ;inc dl 2143 <1> ;SbOut 0F8h ; Max. volume value is 31 (31*8) 2144 <1> ;; 2145 <1> ;dec dl 2146 <1> ;SbOut 44h ; select Treble Register (L) 2147 <1> ;inc dl 2148 <1> ;SbOut 0F0h ; Max. Treble value is 15 (15*16) 2149 <1> ;dec dl 2150 <1> ;SbOut 45h ; select Treble Register (R) 2151 <1> ;inc dl 2152 <1> ;SbOut 0F0h ; Max. Treble value is 15 (15*16) 2153 <1> ;dec dl 2154 <1> ;SbOut 46h ; select Bass Register (L) 2155 <1> ;inc dl 2156 <1> ;SbOut 0F0h ; Max. Bass value is 15 (15*16) 2157 <1> ;dec dl 2158 <1> ;SbOut 47h ; select Bass Register (R) 2159 <1> ;inc dl 2160 <1> ;SbOut 0F0h ; Max. Bass value is 15 (15*16) 2161 <1> 2162 <1> sb_Exit: 2163 <1> ;popad 2164 00014082 C3 <1> retn 2165 <1> 2166 <1> sb16_int_handler: 2167 <1> ; Interrupt Handler for Sound Blaster 16 Audio Card 2168 <1> ; Note: called by 'dev_IRQ_service' 2169 <1> ; 28/01/2025 2170 <1> ; TRDOS 386 Kernel v2.0.10 2171 <1> ; 20/10/2017 2172 <1> ; 12/10/2017 2173 <1> ; 10/10/2017 2174 <1> ; 12/05/2017, 09/10/2017 2175 <1> ; 24/04/2017 (TRDOS 386 kernel, 'audio.s') 2176 <1> ; 10/03/2017 - 'PLAYWAV.PRG' ('playwav.s') 2177 <1> 2178 <1> ;push eax ; * must be saved ! 2179 <1> ;push ebx ; * must be saved ! 2180 <1> ;push ecx 2181 <1> ;push edx 2182 <1> ;push esi 2183 <1> ;push edi 2184 <1> 2185 00014083 668B15[EA880100] <1> mov dx, [audio_io_base] 2186 <1> ; 20/10/2017 2187 0001408A 80C20F <1> add dl, 0Fh ; 2xFh (DSP 16 bit intr ack) 2188 0001408D 803D[18890100]10 <1> cmp byte [audio_bps], 16 2189 00014094 7402 <1> je short sb_irq_16bit_ack 2190 <1> sb_irq_8bit_ack: 2191 00014096 FECA <1> dec dl ; 2xEh (DSP 8 bit intr ack) 2192 <1> sb_irq_16bit_ack: 2193 00014098 EC <1> in al, dx 2194 <1> 2195 <1> ;cmp byte [audio_busy], 0 2196 <1> ;ja short sb_irq_h3 2197 <1> 2198 <1> ;mov byte [audio_busy], 1 2199 <1> 2200 00014099 803D[1E890100]01 <1> cmp byte [audio_play_cmd], 1 2201 000140A0 7307 <1> jnb short sb_irq_h1 2202 <1> sb_irq_h0: 2203 000140A2 E8A1000000 <1> call sb16_stop 2204 000140A7 EB29 <1> jmp short sb_irq_h3 2205 <1> sb_irq_h1: 2206 <1> ;call sb16_tuneloop 2207 <1> ; 09/10/2017 2208 <1> sb16_tuneloop: 2209 000140A9 8B3D[04890100] <1> mov edi, [audio_dma_buff] 2210 <1> ;mov ecx, [audio_dmabuff_size] 2211 <1> ;shr ecx, 1 ; dma buff size / 2 = half buffer size 2212 <1> ; 28/01/2025 (BugFix) 2213 000140AF 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] 2214 <1> 2215 <1> ; 22/05/2017 2216 000140B5 F605[10890100]01 <1> test byte [audio_flag], 1 ; Current flag value 2217 000140BC 7402 <1> jz short sb_tlp1 ; EOL (Half Buffer 1 must be filled) 2218 <1> ; FLAG (Half Buffer 2 must be filled) 2219 000140BE 01CF <1> add edi, ecx 2220 <1> ; 15/05/2017 2221 <1> sb_tlp1: 2222 000140C0 8B35[FC880100] <1> mov esi, [audio_p_buffer] ; phy addr of audio buff 2223 <1> ;rep movsb 2224 000140C6 C1E902 <1> shr ecx, 2 ; half buff size / 4 2225 000140C9 F3A5 <1> rep movsd 2226 <1> ;retn 2227 <1> 2228 <1> ; 10/10/2017 2229 <1> ; switch flag value 2230 000140CB 8035[10890100]01 <1> xor byte [audio_flag], 1 2231 <1> 2232 <1> ; 12/10/2017 2233 <1> ; [audio_flag] = 0 : Playing dma half buffer 2 (odd intr count) 2234 <1> ; Next buffer (to update) is dma half buff 1 2235 <1> ; = 1 : Playing dma half buffer 1 (even intr count) 2236 <1> ; Next buffer (to update) is dma half buff 2 2237 <1> 2238 <1> sb_irq_h3: 2239 <1> ;mov byte [audio_busy], 0 2240 <1> 2241 <1> ;pop edi 2242 <1> ;pop esi 2243 <1> ;pop edx 2244 <1> ;pop ecx 2245 <1> ;pop ebx ; * must be restored ! 2246 <1> ;pop eax ; * must be restored ! 2247 <1> 2248 000140D2 C3 <1> retn 2249 <1> 2250 <1> sb16_volume: 2251 <1> ; 06/08/2022 (TRDOS 386 v2.0.5) 2252 <1> ; 22/10/2017 2253 <1> ; mov [audio_master_volume_l], cl 2254 <1> ; mov [audio_master_volume_h], ch 2255 000140D3 66890D[20890100] <1> mov [audio_master_volume], cx 2256 <1> sb16_volume_initial: 2257 <1> ;push dx ; DX (port address) must be saved 2258 <1> ; 06/08/2022 2259 000140DA 52 <1> push edx 2260 000140DB 668B15[EA880100] <1> mov dx, [audio_io_base] 2261 <1> ;add dx, 4 ; Mixer chip address port 2262 <1> ; 06/08/2022 2263 000140E2 80C204 <1> add dl, 4 2264 000140E5 B022 <1> mov al, 22h ; master volume 2265 000140E7 EE <1> out dx, al 2266 <1> ;inc dx 2267 <1> ; 06/08/2022 2268 000140E8 42 <1> inc edx 2269 000140E9 8A25[20890100] <1> mov ah, [audio_master_volume_l] 2270 000140EF C0EC02 <1> shr ah, 2 ; 32 -> 8 level 2271 000140F2 C0E405 <1> shl ah, 5 ; bit 5 to 7 2272 000140F5 A0[21890100] <1> mov al, [audio_master_volume_r] 2273 000140FA C0E802 <1> shr al, 2 ; 32 -> 8 level 2274 <1> ;and al, 0Fh 2275 000140FD D0E0 <1> shl al, 1 ; bit 1 to 3 2276 000140FF 08E0 <1> or al, ah 2277 00014101 EE <1> out dx, al 2278 <1> ;pop dx ; DX (port address) must be restored 2279 <1> ; 06/08/2022 2280 00014102 5A <1> pop edx 2281 00014103 C3 <1> retn 2282 <1> 2283 <1> sb16_pause: 2284 <1> ; 06/08/2022 (TRDOS 386 v2.0.5) 2285 00014104 668B15[EA880100] <1> mov dx, [audio_io_base] 2286 <1> ;add dx, 0Ch ; Command & Data Port 2287 <1> ; 06/08/2022 2288 0001410B 80C20C <1> add dl, 0Ch 2289 0001410E 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit samples 2290 00014115 7404 <1> je short sb_pause_1 2291 <1> ; 8 bit samples 2292 00014117 B3D0 <1> mov bl, 0D0h ; 8 bit DMA mode 2293 00014119 EB02 <1> jmp short sb_pause_2 2294 <1> sb_pause_1: 2295 <1> ; 16 bit samples 2296 0001411B B3D5 <1> mov bl, 0D5h ; 16 bit DMA mode 2297 <1> sb_pause_2: 2298 <1> SbOut bl ; bCommand 1900 <2> %%Wait: 1901 0001411D EC <2> in al, dx 1902 0001411E 08C0 <2> or al, al 1903 00014120 78FB <2> js short %%Wait 1904 00014122 88D8 <2> mov al, %1 1905 00014124 EE <2> out dx, al 2299 <1> sb_pause_3: 2300 00014125 C3 <1> retn 2301 <1> 2302 <1> sb16_continue: 2303 <1> ; 06/08/2022 (TRDOS 386 v2.0.5) 2304 00014126 668B15[EA880100] <1> mov dx, [audio_io_base] 2305 <1> ;add dx, 0Ch ; Command & Data Port 2306 <1> ; 06/08/2022 2307 0001412D 80C20C <1> add dl, 0Ch 2308 00014130 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit samples 2309 00014137 7404 <1> je short sb_cont_1 2310 <1> ; 8 bit samples 2311 00014139 B3D4 <1> mov bl, 0D4h ; 8 bit DMA mode 2312 0001413B EB02 <1> jmp short sb_cont_2 2313 <1> sb_cont_1: 2314 <1> ; 16 bit samples 2315 0001413D B3D6 <1> mov bl, 0D6h ; 16 bit DMA mode 2316 <1> sb_cont_2: 2317 <1> SbOut bl ; bCommand 1900 <2> %%Wait: 1901 0001413F EC <2> in al, dx 1902 00014140 08C0 <2> or al, al 1903 00014142 78FB <2> js short %%Wait 1904 00014144 88D8 <2> mov al, %1 1905 00014146 EE <2> out dx, al 2318 <1> sb_cont_3: 2319 00014147 C3 <1> retn 2320 <1> 2321 <1> sb16_stop: 2322 <1> ; 06/08/2022 (TRDOS 386 v2.0.5) 2323 <1> ; 24/04/2017 2324 00014148 803D[1E890100]00 <1> cmp byte [audio_play_cmd], 0 2325 0001414F 7647 <1> jna short sb16_stop_4 2326 <1> 2327 <1> ; 22/05/2017 2328 00014151 668B15[EA880100] <1> mov dx, [audio_io_base] 2329 <1> ;add dx, 0Ch 2330 <1> ; 06/08/2022 2331 00014158 80C20C <1> add dl, 0Ch 2332 <1> 2333 0001415B B3D9 <1> mov bl, 0D9h ; exit auto-initialize 16 bit transfer 2334 <1> ; stop autoinitialized DMA transfer mode 2335 0001415D 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit samples 2336 00014164 7402 <1> je short sb16_stop_1 2337 <1> ;mov bl, 0DAh ; exit auto-initialize 8 bit transfer 2338 00014166 FEC3 <1> inc bl 2339 <1> sb16_stop_1: 2340 <1> SbOut bl ; exit auto-initialize transfer command 1900 <2> %%Wait: 1901 00014168 EC <2> in al, dx 1902 00014169 08C0 <2> or al, al 1903 0001416B 78FB <2> js short %%Wait 1904 0001416D 88D8 <2> mov al, %1 1905 0001416F EE <2> out dx, al 2341 <1> 2342 00014170 30C0 <1> xor al, al ; stops all DMA processes on selected channel 2343 <1> 2344 00014172 803D[18890100]10 <1> cmp byte [audio_bps], 16 ; 16 bit samples 2345 00014179 7404 <1> je short sb16_stop_2 2346 0001417B E60C <1> out 0Ch, al ; clear selected channel register 2347 0001417D EB02 <1> jmp short sb16_stop_3 2348 <1> 2349 <1> sb16_stop_2: 2350 0001417F E6D8 <1> out 0D8h, al ; clear selected channel register 2351 <1> 2352 <1> sb16_stop_3: 2353 00014181 C605[1E890100]00 <1> mov byte [audio_play_cmd], 0 ; stop ! 2354 <1> SbDone: 2355 <1> ;mov dx, [audio_io_base] 2356 <1> ;add dx, 0Ch 2357 <1> SbOut 0D0h 1900 <2> %%Wait: 1901 00014188 EC <2> in al, dx 1902 00014189 08C0 <2> or al, al 1903 0001418B 78FB <2> js short %%Wait 1904 0001418D B0D0 <2> mov al, %1 1905 0001418F EE <2> out dx, al 2358 <1> SbOut 0D3h 1900 <2> %%Wait: 1901 00014190 EC <2> in al, dx 1902 00014191 08C0 <2> or al, al 1903 00014193 78FB <2> js short %%Wait 1904 00014195 B0D3 <2> mov al, %1 1905 00014197 EE <2> out dx, al 2359 <1> sb16_stop_4: 2360 00014198 C3 <1> retn 2361 <1> 2362 <1> sb16_reset: 2363 <1> ; 06/08/2022 (TRDOS 386 v2.0.5) 2364 <1> ; 24/04/2017 2365 00014199 668B15[EA880100] <1> mov dx, [audio_io_base] ; try to reset the DSP. 2366 <1> ;add dx, 06h 2367 <1> ; 06/08/2022 2368 000141A0 80C206 <1> add dl, 06h 2369 000141A3 B001 <1> mov al, 1 2370 000141A5 EE <1> out dx, al 2371 <1> 2372 000141A6 EC <1> in al, dx 2373 000141A7 EC <1> in al, dx 2374 000141A8 EC <1> in al, dx 2375 000141A9 EC <1> in al, dx 2376 <1> 2377 000141AA 30C0 <1> xor al, al 2378 000141AC EE <1> out dx, al 2379 <1> 2380 <1> ;add dx, 08h 2381 <1> ; 06/08/2022 2382 000141AD 80C208 <1> add dl, 08h 2383 <1> ;mov cx, 100 2384 000141B0 29C9 <1> sub ecx, ecx 2385 000141B2 B164 <1> mov cl, 100 2386 <1> sbrstWaitID: 2387 000141B4 EC <1> in al, dx 2388 000141B5 08C0 <1> or al, al 2389 000141B7 7804 <1> js short sbrstGetID 2390 000141B9 E2F9 <1> loop sbrstWaitID 2391 000141BB F9 <1> stc 2392 000141BC C3 <1> retn 2393 <1> sbrstGetID: 2394 <1> ;sub dx, 04h 2395 <1> ; 06/08/2022 2396 000141BD 80EA04 <1> sub dl, 04h 2397 000141C0 EC <1> in al, dx 2398 000141C1 3CAA <1> cmp al, 0AAh 2399 000141C3 7405 <1> je short sb_rst_retn 2400 <1> ;add dx, 04h 2401 <1> ; 06/08/2022 2402 000141C5 80C204 <1> add dl, 04h 2403 000141C8 E2EA <1> loop sbrstWaitID 2404 <1> sb_rst_retn: 2405 000141CA C3 <1> retn 2406 <1> 2407 <1> ac97_codec_config: 2408 <1> ; 06/06/2024 2409 <1> ; 04/06/2024 2410 <1> ; 03/06/2024 2411 <1> ; 02/06/2024 2412 <1> ; 01/06/2024 (TRDOS 386 v2.0.8) 2413 <1> ; 26/11/2023 2414 <1> ; 21/11/2023 2415 <1> ; 20/11/2023 2416 <1> ; 19/11/2023 (TRDOS 386 v2.0.7) 2417 <1> ; 10/06/2017 2418 <1> ; 05/06/2017 2419 <1> ; 29/05/2017 2420 <1> ; 28/05/2017 (TRDOS 386, 'audio.s') 2421 <1> ; 07/11/2016 (Erdogan Tan) 2422 <1> ; Derived from 'codecConfig' procedure in 'CODEC.ASM' 2423 <1> ; .wav player for DOS by Jeff Leyda (02/09/2002) 2424 <1> 2425 <1> ;; 'PLAYER.ASM' 2426 <1> ;; get ICH base address regs for mixer and bus master 2427 <1> 2428 <1> init_ac97_controller: ; 10/06/2017 2429 000141CB A1[EC880100] <1> mov eax, [audio_dev_id] 2430 <1> ;mov al, NAMBAR_REG 2431 <1> ;;call pciRegRead16 ; read PCI registers 10-11 2432 <1> ;call pciRegRead32 2433 <1> ;and dx, IO_ADDR_MASK ; mask off BIT0 2434 <1> ;;and edx, IO_ADDR_MASK 2435 <1> 2436 <1> ;mov [NAMBAR], dx ; save audio mixer base addr 2437 <1> 2438 <1> ;mov al, NABMBAR_REG 2439 <1> ;;call pciRegRead16 2440 <1> ;call pciRegRead32 2441 <1> ;and dx, 0FFC0h ; IO_ADDR_MASK 2442 <1> ;;and edx, 0FFC0h 2443 <1> 2444 <1> ;mov [NABMBAR], dx ; save bus master base addr 2445 <1> 2446 <1> ;mov eax, [audio_dev_id] 2447 000141D0 B004 <1> mov al, PCI_CMD_REG 2448 <1> ;call pciRegRead8 ; read PCI command register 2449 000141D2 E897F8FFFF <1> call pciRegRead16 2450 000141D7 80CA05 <1> or dl, IO_ENA+BM_ENA ; enable IO and bus master 2451 <1> ;call pciRegWrite8 2452 000141DA E8FAF8FFFF <1> call pciRegWrite16 2453 <1> 2454 <1> ; 'CODEC.ASM' 2455 <1> 2456 <1> ; enable codec, unmute stuff, set output rate 2457 <1> ; ; entry: [audio_freq] = desired sample rate 2458 <1> 2459 <1> ; mov dx, [NAMBAR] 2460 <1> ; add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2461 <1> ; in ax, dx 2462 <1> ; or ax, 1 2463 <1> ; out dx, ax ; Enable variable rate audio 2464 <1> 2465 <1> ; ;call delay1_4ms 2466 <1> ; ;call delay1_4ms 2467 <1> ; ;call delay1_4ms 2468 <1> ; ;call delay1_4ms 2469 <1> 2470 <1> ; mov ax, [audio_freq] ; sample rate 2471 <1> 2472 <1> ; mov dx, [NAMBAR] 2473 <1> ; add dx, CODEC_PCM_FRONT_DACRATE_REG ; 2Ch 2474 <1> ; out dx, ax ; out sample rate 2475 <1> 2476 <1> ; ;call delay1_4ms 2477 <1> ; ;call delay1_4ms 2478 <1> ; ;call delay1_4ms 2479 <1> ; ;call delay1_4ms 2480 <1> 2481 <1> ;mov dx, [NAMBAR] ; mixer base address 2482 <1> ;add dx, CODEC_RESET_REG ; reset register 2483 <1> ;mov ax, 42 2484 <1> ;out dx, ax ; reset 2485 <1> 2486 <1> ;mov dx, [NABMBAR] ; bus master base address 2487 <1> ;add dx, GLOB_STS_REG 2488 <1> ;mov ax, 2 2489 <1> ;out dx, ax 2490 <1> 2491 <1> ; 01/06/2024 2492 <1> ; 16/05/2024 2493 <1> ; 02/12/2023 2494 <1> ;call delay_100ms ; 29/05/2017 2495 <1> 2496 <1> ; 02/12/2023 2497 <1> ;call delay1_4ms 2498 <1> ;call delay1_4ms 2499 <1> ;call delay1_4ms 2500 <1> ;call delay1_4ms 2501 <1> 2502 <1> init_ac97_codec: 2503 <1> ; 26/11/2023 2504 <1> ; 19/11/2023 2505 <1> ; (playwav3.com, ac97_vra.asm, Erdogan Tan, 19/11/2023) 2506 <1> ; 10/06/2017 2507 <1> ; 29/05/2017 2508 <1> ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 2509 <1> 2510 <1> ;; 23/11/2023 - temporary 2511 <1> ;push ebx 2512 <1> ;mov ebx, 0B8000h 2513 <1> ;mov al, '?' 2514 <1> ;mov ah, 4Eh 2515 <1> ;mov [ebx], ax 2516 <1> ;pop ebx 2517 <1> 2518 <1> ; 01/06/2024 2519 000141DF C605[2C8D0100]01 <1> mov byte [reset], 1 2520 <1> 2521 <1> ; 19/11/2023 2522 000141E6 BD28000000 <1> mov ebp, 40 ; 21/11/2023 2523 <1> _initc_1: 2524 <1> ; 26/05/2024 2525 000141EB 66BA3000 <1> mov dx, GLOB_STS_REG ; 30h 2526 000141EF 660315[EA880100] <1> add dx, [NABMBAR] 2527 000141F6 ED <1> in eax, dx 2528 <1> 2529 <1> ; 01/06/2024 2530 <1> ; 02/12/2023 2531 <1> ;call delay1_4ms 2532 <1> 2533 000141F7 83F8FF <1> cmp eax, 0FFFFFFFFh ; -1 2534 000141FA 750A <1> jne short _initc_3 2535 <1> _initc_2: 2536 000141FC 4D <1> dec ebp ; 21/11/2023 2537 000141FD 7425 <1> jz short _ac97_codec_ready 2538 <1> 2539 000141FF E86DF9FFFF <1> call delay_100ms 2540 00014204 EBE5 <1> jmp short _initc_1 2541 <1> _initc_3: 2542 00014206 A900030010 <1> test eax, CTRL_ST_CREADY 2543 0001420B 7517 <1> jnz short _ac97_codec_ready 2544 <1> 2545 <1> ; 01/06/2024 2546 0001420D 803D[2C8D0100]00 <1> cmp byte [reset], 0 2547 00014214 76E6 <1> jna short _initc_2 2548 <1> 2549 00014216 E849030000 <1> call reset_ac97_codec 2550 <1> ;jc short _initc_2 2551 <1> ; 01/06/2024 2552 0001421B C605[2C8D0100]00 <1> mov byte [reset], 0 2553 <1> ; 26/11/2023 2554 00014222 EBD8 <1> jmp short _initc_2 2555 <1> 2556 <1> _ac97_codec_ready: 2557 00014224 668B15[E8880100] <1> mov dx, [NAMBAR] 2558 <1> ;add dx, 0 ; ac_reg_0 ; reset register 2559 0001422B 66EF <1> out dx, ax 2560 <1> 2561 <1> ; 06/06/2024 2562 <1> ; 01/06/2024 2563 <1> ;;; 2564 <1> ;call delay1_4ms 2565 <1> ;call delay1_4ms 2566 <1> ;call delay1_4ms 2567 <1> ;call delay1_4ms 2568 <1> ;;; 2569 <1> 2570 <1> ; 01/06/2024 2571 <1> ; 26/05/2024 2572 <1> ; 19/11/2023 2573 <1> ;call delay_100ms 2574 <1> ; 24/11/2023 - temporary 2575 <1> ;call delay_100ms 2576 <1> ;call delay_100ms 2577 <1> ;call delay_100ms 2578 <1> 2579 <1> ; 01/06/2024 2580 <1> ;;; 2581 0001422D 09ED <1> or ebp, ebp ; 21/11/2023 2582 0001422F 753E <1> jnz short _ac97_codec_init_ok 2583 <1> ;;; 2584 <1> 2585 00014231 31C0 <1> xor eax, eax ; 0 2586 00014233 668B15[E8880100] <1> mov dx, [NAMBAR] 2587 0001423A 6683C226 <1> add dx, CODEC_REG_POWERDOWN 2588 0001423E 66EF <1> out dx, ax 2589 <1> 2590 <1> ; 10/06/2017 2591 <1> ; 29/05/2017 2592 <1> ; wait for 1 second 2593 <1> ; 01/06/2024 2594 <1> ; 16/05/2024 2595 00014240 B9E8030000 <1> mov ecx, 1000 ; 1000*0.25ms 2596 <1> ; 20/11/2023 2597 <1> ;mov ecx, 10 2598 <1> ; 23/05/2024 2599 <1> ;mov cl, 10 2600 <1> ; 24/11/2023 - temporary 2601 <1> ;mov cl, 40 2602 <1> ; ecx = 40 ; 23/05/2024 2603 <1> _ac97_codec_rloop: 2604 <1> ; 01/06/2024 2605 00014245 E834F9FFFF <1> call delay1_4ms 2606 <1> ; 06/06/2024 2607 0001424A E82FF9FFFF <1> call delay1_4ms 2608 0001424F E82AF9FFFF <1> call delay1_4ms 2609 00014254 E825F9FFFF <1> call delay1_4ms 2610 <1> ; 01/06/2024 2611 <1> ; 19/11/2023 2612 <1> ; 22/11/2023 2613 <1> ;push ecx 2614 <1> ;call delay_100ms 2615 <1> ;pop ecx 2616 <1> 2617 <1> ; 01/06/2024 2618 <1> ;;; 2619 00014259 668B15[E8880100] <1> mov dx, [NAMBAR] 2620 00014260 6683C226 <1> add dx, CODEC_REG_POWERDOWN 2621 <1> ;;; 2622 00014264 66ED <1> in ax, dx 2623 <1> 2624 <1> ; 06/06/2024 2625 <1> ;call delay1_4ms 2626 <1> 2627 <1> ;and ax, 0Fh 2628 <1> ; 21/11/2023 2629 00014266 240F <1> and al, 0Fh 2630 00014268 3C0F <1> cmp al, 0Fh 2631 0001426A 7403 <1> je short _ac97_codec_init_ok 2632 <1> ; 24/11/2023 - temporary 2633 <1> ;je short _ac97_codec_init_ok_ 2634 <1> _ac97_codec_yloop: 2635 0001426C E2D7 <1> loop _ac97_codec_rloop 2636 <1> ; 22/11/2023 2637 <1> ; cf = 1 2638 <1> init_ac97_codec_err1: 2639 <1> ;stc 2640 <1> init_ac97_codec_err2: 2641 0001426E C3 <1> retn 2642 <1> 2643 <1> ;_ac97_codec_init_ok_: 2644 <1> ;mov dx, GLOB_STS_REG ; 30h 2645 <1> ;add dx, [NABMBAR] 2646 <1> ;in eax, dx 2647 <1> ;test eax, CTRL_ST_CREADY 2648 <1> ;jnz short _ac97_codec_init_ok 2649 <1> ;stc 2650 <1> ;retn 2651 <1> 2652 <1> _ac97_codec_init_ok: 2653 <1> ; 06/06/2024 (temporary) 2654 <1> ; (this may not be needed) 2655 <1> ;;; 2656 <1> ; 24/05/2024 2657 <1> ; 26/11/2023 2658 <1> ; 23/11/2023 2659 0001426F 31C0 <1> xor eax, eax 2660 <1> ; 21/11/2023 - temporary 2661 <1> ; 19/11/2023 2662 00014271 B002 <1> mov al, 2 ; force set 16-bit 2-channel PCM 2663 00014273 66BA2C00 <1> mov dx, GLOB_CNT_REG ; 2Ch 2664 00014277 660315[EA880100] <1> add dx, [NABMBAR] 2665 0001427E EF <1> out dx, eax 2666 <1> ; 2667 0001427F E8FAF8FFFF <1> call delay1_4ms 2668 <1> ;;; 2669 <1> 2670 <1> ; 23/11/2023 - temporary 2671 <1> ;call delay_100ms 2672 <1> ; 06/06/2024 2673 <1> ;call delay1_4ms 2674 <1> 2675 <1> ; 10/06/2017 2676 00014284 E884020000 <1> call reset_ac97_controller 2677 <1> 2678 <1> ; 21/11/2023 2679 <1> ;call delay1_4ms 2680 <1> 2681 <1> ; 01/06/2024 2682 <1> ; 24/05/2024 2683 <1> ; 23/05/2024 2684 <1> ; 21/11/2023 - temporary 2685 00014289 E8E3F8FFFF <1> call delay_100ms ; 06/06/2024 2686 <1> 2687 <1> ; call setup_ac97_codec 2688 <1> ; 2689 <1> ;detect_ac97_codec: 2690 <1> ; retn 2691 <1> 2692 <1> setup_ac97_codec: 2693 <1> ; 06/06/2024 - TRDOS 386 v2.0.8 2694 <1> ;;; 2695 0001428E 668B15[E8880100] <1> mov dx, [NAMBAR] 2696 00014295 6683C22A <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2697 00014299 66ED <1> in ax, dx 2698 <1> 2699 <1> ;and al, ~BIT1 ; Clear DRA 2700 0001429B 24FC <1> and al, ~(BIT1+BIT0) ; Clear DRA+VRA 2701 <1> ;or al, BIT0 ; Set VRA 2702 <1> 2703 0001429D 668B15[E8880100] <1> mov dx, [NAMBAR] 2704 000142A4 6683C22A <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2705 000142A8 66EF <1> out dx, ax 2706 <1> ;;; 2707 <1> 2708 <1> ; 24/11/2023 2709 <1> ; 19/11/2023 - TRDOS 386 v2.0.7 2710 000142AA C605[1C890100]01 <1> mov byte [VRA], 1 2711 <1> 2712 <1> ; 25/11/2023 - temporary 2713 <1> ;jmp short vra_not_supported 2714 <1> 2715 <1> ; 23/05/2024 2716 <1> ; 18/05/2024 2717 <1> ;call delay1_4ms ; 06/06/2024 2718 <1> ;call delay_100ms 2719 <1> 2720 <1> ; 06/06/2024 2721 <1> ; 01/06/2024 2722 <1> %if 0 2723 <1> ; 24/05/2024 2724 <1> ; 23/05/2024 2725 <1> mov dx, [NAMBAR] 2726 <1> add dx, CODEC_EXT_AUDIO_REG ; 28h 2727 <1> in ax, dx 2728 <1> 2729 <1> ; 18/05/2024 2730 <1> ; 02/12/2023 2731 <1> call delay1_4ms 2732 <1> ; 17/05/2024 2733 <1> ;call delay_100ms 2734 <1> ; 2735 <1> test al, 1 ; BIT0 ; Variable Rate Audio bit 2736 <1> jz short vra_not_supported 2737 <1> 2738 <1> mov dx, [NAMBAR] 2739 <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2740 <1> in ax, dx 2741 <1> 2742 <1> ; 06/06/2024 2743 <1> ; 23/05/2024 2744 <1> ; 02/12/2023 2745 <1> ;call delay1_4ms 2746 <1> ;call delay_100ms ; 18/05/2024 2747 <1> ; 24/05/2024 2748 <1> ;call delay1_4ms 2749 <1> ;call delay1_4ms 2750 <1> ;call delay1_4ms 2751 <1> 2752 <1> ;and al, ~BIT1 ; Clear DRA 2753 <1> ;;; 2754 <1> ; 01/06/2024 2755 <1> and al, ~(BIT1+BIT0) ; Clear DRA+VRA 2756 <1> ;;; 2757 <1> ; 04/06/2024 2758 <1> ;mov dx, [NAMBAR] 2759 <1> ;add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2760 <1> ;;; 2761 <1> out dx, ax 2762 <1> %endif 2763 <1> 2764 <1> ; 04/06/2024 2765 000142B1 E8C8F8FFFF <1> call delay1_4ms 2766 <1> 2767 <1> ; 01/06/2024 2768 <1> ; check VRA 2769 000142B6 668B15[E8880100] <1> mov dx, [NAMBAR] 2770 000142BD 6683C228 <1> add dx, CODEC_EXT_AUDIO_REG ; 28h 2771 000142C1 66ED <1> in ax, dx 2772 <1> 2773 <1> ; 06/06/2024 2774 <1> ;call delay1_4ms 2775 <1> 2776 000142C3 A801 <1> test al, 1 ; BIT0 ; Variable Rate Audio bit 2777 000142C5 746F <1> jz short vra_not_supported 2778 <1> 2779 000142C7 6640 <1> inc ax ; 0FFh -> 0 2780 000142C9 753D <1> jnz short not_alc ; skip ALC850 (and ALC655) checking 2781 <1> ; ax = -1 -> 0 2782 <1> 2783 <1> ;;;; 2784 <1> ; 06/06/2024 (temporary!?) 2785 <1> ; check ALC850 2786 <1> ; (which does not support VRA but it may not be detected) 2787 <1> ; 2788 000142CB E8AEF8FFFF <1> call delay1_4ms 2789 <1> ; 2790 000142D0 668B15[E8880100] <1> mov dx, [NAMBAR] 2791 000142D7 6683C27C <1> add dx, CODEC_VENDOR_ID1 ; 7Ch 2792 000142DB 66ED <1> in ax, dx 2793 000142DD C1E010 <1> shl eax, 16 ; * 2794 <1> ;cmp ax, 414Ch ; VENDOR_ID - 'AL' 2795 <1> ;jne short not_alc 2796 000142E0 668B15[E8880100] <1> mov dx, [NAMBAR] 2797 000142E7 6683C27E <1> add dx, CODEC_VENDOR_ID2 ; 7Eh 2798 000142EB 66ED <1> in ax, dx 2799 <1> ;inc edx 2800 <1> ;inc edx 2801 <1> ;in ax, dx ; VENDOR ID2 2802 <1> 2803 000142ED 40 <1> inc eax ; 0FFFFFFFFh -> 0 ; 0 -> 1 2804 000142EE 7446 <1> jz short vra_not_supported 2805 000142F0 48 <1> dec eax ; 1 -> 0 2806 000142F1 7443 <1> jz short vra_not_supported 2807 <1> 2808 000142F3 C1C810 <1> ror eax, 16 2809 000142F6 663D4C41 <1> cmp ax, 414Ch ; VENDOR_ID - 'AL' 2810 000142FA 750C <1> jne short not_alc 2811 000142FC C1C010 <1> rol eax, 16 2812 <1> 2813 <1> ; ALC850 2814 000142FF 80FC47 <1> cmp ah, 47h ; 'G' 2815 00014302 7504 <1> jne short not_alc 2816 00014304 3C90 <1> cmp al, 90h 2817 <1> ;cmp ax, 4790h ; VENDOR ID - 'G' ; bit 8-15 2818 <1> ; CHIP ID - 1001b ; bit 4-7 2819 <1> ; Version Number - 0 ; bit 0-3 2820 <1> ;jne short not_alc850 ; not_alc 2821 00014306 742E <1> je short vra_not_supported 2822 <1> ; 2823 <1> ; 06/06/2024 2824 <1> %if 0 2825 <1> not_alc850: 2826 <1> ; ALC655 2827 <1> cmp al, 60h 2828 <1> ;cmp ax, 4760h ; VENDOR ID - 'G' ; bit 8-15 2829 <1> ; CHIP ID - 0110b ; bit 4-7 2830 <1> ; Version Number - 0 ; bit 0-3 2831 <1> ;jne short not_alc655 2832 <1> je short vra_not_supported 2833 <1> ; 2834 <1> not_alc655: 2835 <1> %endif 2836 <1> not_alc: 2837 <1> ; 06/06/2024 2838 <1> 2839 00014308 668B15[E8880100] <1> mov dx, [NAMBAR] 2840 0001430F 6683C22A <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2841 00014313 66ED <1> in ax, dx 2842 <1> 2843 <1> ;and al, ~BIT1 ; Clear DRA 2844 <1> 2845 00014315 0C01 <1> or al, AC97_EA_VRA ; 1 ; 04/11/2023 2846 <1> 2847 <1> ; 06/06/2024 2848 <1> ; 04/06/2024 2849 <1> ;mov dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2850 <1> ;add dx, [NAMBAR] 2851 <1> 2852 00014317 66EF <1> out dx, ax ; Enable variable rate audio 2853 <1> 2854 <1> ; 01/06/2024 2855 00014319 B90A000000 <1> mov ecx, 10 2856 <1> ; 21/11/2023 2857 <1> ;mov cl, 10 2858 <1> check_vra: 2859 <1> ; 01/06/2024 2860 <1> ;call delay_100ms 2861 0001431E E85BF8FFFF <1> call delay1_4ms 2862 <1> 2863 <1> ;;; 2864 <1> ; 04/06/2024 2865 00014323 668B15[E8880100] <1> mov dx, [NAMBAR] 2866 0001432A 6683C22A <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 2867 <1> ;;; 2868 <1> 2869 0001432E 66ED <1> in ax, dx 2870 <1> 2871 <1> ; 24/05/2024 2872 <1> ; 18/05/2024 2873 <1> ; 02/12/2023 2874 <1> ;call delay1_4ms 2875 <1> 2876 <1> ;test al, AC97_EA_VRA ; 1 2877 <1> ; 04/06/2024 2878 00014330 2401 <1> and al, AC97_EA_VRA ; 1 2879 00014332 7508 <1> jnz short vra_ok 2880 <1> 2881 00014334 E2E8 <1> loop check_vra 2882 <1> 2883 <1> vra_not_supported: ; 24/11/2023 2884 <1> ; VRA is not usable 2885 <1> ;mov byte [VRA], 0 2886 00014336 FE0D[1C890100] <1> dec byte [VRA] 2887 <1> 2888 <1> ; 03/06/2024 2889 <1> %if 0 2890 <1> ; 02/06/2024 2891 <1> jmp short set_volume 2892 <1> 2893 <1> ; 02/06/2024 2894 <1> set_sampling_rate: 2895 <1> mov dx, [NAMBAR] 2896 <1> add dx, CODEC_PCM_FRONT_DACRATE_REG 2897 <1> out dx, ax 2898 <1> retn 2899 <1> 2900 <1> ; 02/06/2024 2901 <1> get_sampling_rate: 2902 <1> mov dx, CODEC_PCM_FRONT_DACRATE_REG 2903 <1> add dx, [NAMBAR] 2904 <1> in ax, dx 2905 <1> retn 2906 <1> %endif 2907 <1> 2908 <1> vra_ok: 2909 <1> 2910 <1> ; 03/06/2024 2911 <1> %if 0 2912 <1> ; 02/06/2024 2913 <1> ; a second test for verifying VRA status 2914 <1> ; (may be needed for ALC850 codec and CK804 controller) 2915 <1> 2916 <1> call get_sampling_rate 2917 <1> or ax, ax 2918 <1> jz short vra_not_supported 2919 <1> cmp ax, 48000 2920 <1> jne short set_volume 2921 <1> mov ax, 24000 2922 <1> call set_sampling_rate 2923 <1> call get_sampling_rate 2924 <1> cmp ax, 48000 2925 <1> je short vra_not_supported 2926 <1> mov ax, 48000 2927 <1> call set_sampling_rate 2928 <1> ;call get_sampling_rate 2929 <1> %endif 2930 <1> 2931 <1> ; 02/06/2024 2932 <1> set_volume: 2933 <1> ; 24/05/2024 2934 <1> ; 18/05/2024 - TRDOS 386 v2.0.8 2935 <1> ; 20/11/2023 2936 <1> ; 19/11/2023 - TRDOS 386 v2.0.7 2937 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 2938 <1> ; 22/07/2020 2939 <1> ; 10/06/2017 2940 <1> ; 29/05/2017 2941 <1> 2942 <1> ;mov eax, 0202h 2943 <1> ; 21/11/2023 2944 <1> ;mov eax, 0B0Bh 2945 <1> ; 23/11/2023 2946 0001433C B81D1D0000 <1> mov eax, 1D1Dh 2947 00014341 66A3[20890100] <1> mov [audio_master_volume], ax 2948 <1> ; 24/05/2024 2949 00014347 66A3[22890100] <1> mov [audio_pcmo_volume], ax 2950 <1> ;mov ax, 1F1Fh ; 31, 31 2951 <1> 2952 <1> ; 21/11/2023 2953 <1> ;push eax 2954 <1> 2955 <1> ; 20/11/2023 2956 <1> ;mov ax, 0B0Bh 2957 <1> ; 23/11/2023 2958 0001434D 66B80202 <1> mov ax, 0202h 2959 <1> 2960 00014351 668B15[E8880100] <1> mov dx, [NAMBAR] 2961 00014358 6683C202 <1> add dx, CODEC_MASTER_VOL_REG ;02h 2962 <1> ;xor ax, ax ; volume attenuation = 0 (max. volume) 2963 <1> ; 06/08/2022 2964 <1> ;xor eax, eax 2965 <1> ; 19/11/2023 2966 0001435C 66EF <1> out dx, ax 2967 <1> 2968 <1> ; 01/06/2024 2969 <1> ; 23/05/2024 2970 <1> ; 16/05/2024 2971 <1> ; 20/11/2023 2972 0001435E E81BF8FFFF <1> call delay1_4ms 2973 <1> ;call delay1_4ms 2974 <1> ;call delay1_4ms 2975 <1> ;call delay1_4ms 2976 <1> ; 21/11/2023 temporary 2977 <1> ;call delay_100ms ; 18/05/2024 2978 <1> 2979 <1> ; 21/11/2023 2980 <1> ;pop eax 2981 <1> 2982 <1> ; 23/11/2023 2983 <1> ; 21/11/2023 2984 <1> ;mov ax, 0202h 2985 <1> 2986 00014363 668B15[E8880100] <1> mov dx, [NAMBAR] 2987 0001436A 6683C218 <1> add dx, CODEC_PCM_OUT_REG ;18h 2988 <1> ;xor ax, ax 2989 0001436E 66EF <1> out dx, ax 2990 <1> 2991 <1> ; 01/06/2024 2992 <1> ; 23/05/2024 2993 <1> ; 16/05/2024 2994 <1> ; 20/11/2023 2995 <1> ;call delay1_4ms 2996 <1> ;call delay1_4ms 2997 <1> ;call delay1_4ms 2998 <1> ;call delay1_4ms 2999 <1> ; 21/11/2023 - temporary 3000 <1> ;call delay_100ms ; 18/05/2024 3001 <1> 3002 <1> ; 23/11/2023 3003 <1> %if 0 3004 <1> mov dx, [NAMBAR] 3005 <1> add dx, CODEC_MASTER_MONO_VOL_REG ;06h 3006 <1> ;xor ax, ax 3007 <1> out dx, ax 3008 <1> 3009 <1> ;call delay1_4ms 3010 <1> ;call delay1_4ms 3011 <1> ;call delay1_4ms 3012 <1> ;call delay1_4ms 3013 <1> 3014 <1> mov dx, [NAMBAR] 3015 <1> add dx, CODEC_PCBEEP_VOL_REG ;0Ah 3016 <1> ;xor ax, ax 3017 <1> out dx, ax 3018 <1> 3019 <1> ;call delay1_4ms 3020 <1> ;call delay1_4ms 3021 <1> ;call delay1_4ms 3022 <1> ;call delay1_4ms 3023 <1> 3024 <1> mov ax, 8008h ; Mute 3025 <1> mov dx, [NAMBAR] 3026 <1> ; 22/07/2020 3027 <1> add dx, CODEC_PHONE_VOL_REG ;0Ch 3028 <1> ; AC97_PHONE_VOL ; TAD Input (Mono) 3029 <1> out dx, ax 3030 <1> 3031 <1> ;call delay1_4ms 3032 <1> ;call delay1_4ms 3033 <1> ;call delay1_4ms 3034 <1> ;call delay1_4ms 3035 <1> 3036 <1> mov ax, 0808h 3037 <1> mov dx, [NAMBAR] 3038 <1> add dx, CODEC_LINE_IN_VOL_REG ;10h ; Line Input (Stereo) 3039 <1> out dx, ax 3040 <1> 3041 <1> ;call delay1_4ms 3042 <1> ;call delay1_4ms 3043 <1> ;call delay1_4ms 3044 <1> ;call delay1_4ms 3045 <1> 3046 <1> ;mov ax, 0808h 3047 <1> mov dx, [NAMBAR] 3048 <1> add dx, CODEC_CD_VOL_REG ;12h ; CR Input (Stereo) 3049 <1> out dx, ax 3050 <1> 3051 <1> ;call delay1_4ms 3052 <1> ;call delay1_4ms 3053 <1> ;call delay1_4ms 3054 <1> ;call delay1_4ms 3055 <1> 3056 <1> ;mov ax, 0808h 3057 <1> mov dx, [NAMBAR] 3058 <1> add dx, CODEC_AUX_VOL_REG ;16h ; Aux Input (Stereo) 3059 <1> out dx, ax 3060 <1> 3061 <1> ;call delay1_4ms 3062 <1> ;call delay1_4ms 3063 <1> ;call delay1_4ms 3064 <1> ;call delay1_4ms 3065 <1> 3066 <1> ; 21/11/2023 - temporary 3067 <1> ;call delay_100ms 3068 <1> %endif 3069 <1> ; 16/05/2024 3070 <1> ;clc 3071 <1> 3072 <1> set_volume_ok: 3073 <1> 3074 <1> ;detect_ac97_codec: 3075 00014370 C3 <1> retn 3076 <1> 3077 <1> set_ac97_bdl: ; Set AC97 (ICH) Buffer Descriptor List 3078 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 3079 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3080 <1> ; 17/06/2017 3081 <1> ; 11/06/2017 3082 <1> ; 28/05/2017 3083 <1> ; eax = dma buffer address = [audio_DMA_buff] 3084 <1> ;; ecx = dma buffer buffer size = [audio_dmabuff_size] 3085 <1> 3086 <1> ; 04/06/2024 3087 <1> ; ecx = DMA half buffer size as truncated for 8 byte alignment 3088 <1> 3089 <1> ;shr ecx, 1 ; dma half buffer size 3090 00014371 89CE <1> mov esi, ecx 3091 <1> 3092 00014373 BF[28890100] <1> mov edi, audio_bdl_buff ; get BDL address 3093 <1> ;mov ecx, 32 / 2 ; make 32 entries in BDL 3094 <1> ; 06/08/2022 3095 00014378 29C9 <1> sub ecx, ecx 3096 0001437A B110 <1> mov cl, 16 3097 <1> 3098 0001437C EB05 <1> jmp short s_ac97_bdl1 3099 <1> 3100 <1> s_ac97_bdl0: 3101 <1> ; set buffer descriptor 0 to start of data file in memory 3102 <1> 3103 0001437E A1[04890100] <1> mov eax, [audio_dma_buff] ; Physical address of DMA buffer 3104 <1> 3105 <1> s_ac97_bdl1: 3106 00014383 AB <1> stosd ; store dmabuffer1 address 3107 <1> 3108 00014384 89C2 <1> mov edx, eax 3109 <1> 3110 <1> ; 3111 <1> ; Buffer Descriptors List 3112 <1> ; As stated earlier, each buffer descriptor list is a set of (up to) 32 3113 <1> ; descriptors, each 8 bytes in length. Bytes 0-3 of a descriptor entry point 3114 <1> ; to a chunk of memory to either play from or record to. Bytes 4-7 of an 3115 <1> ; entry describe various control things detailed below. 3116 <1> ; 3117 <1> ; Buffer pointers must always be aligned on a Dword boundry. 3118 <1> ; 3119 <1> 3120 <1> ;IOC equ BIT31 ; Fire an interrupt whenever this 3121 <1> ; buffer is complete. 3122 <1> 3123 <1> ;BUP equ BIT30 ; Buffer Underrun Policy. 3124 <1> ; if this buffer is the last buffer 3125 <1> ; in a playback, fill the remaining 3126 <1> ; samples with 0 (silence) or not. 3127 <1> ; It's a good idea to set this to 1 3128 <1> ; for the last buffer in playback, 3129 <1> ; otherwise you're likely to get a lot 3130 <1> ; of noise at the end of the sound. 3131 <1> 3132 <1> ; 3133 <1> ; Bits 15:0 contain the length of the buffer, in number of samples, which 3134 <1> ; are 16 bits each, coupled in left and right pairs, or 32bits each. 3135 <1> ; Luckily for us, that's the same format as .wav files. 3136 <1> ; 3137 <1> ; A value of FFFF is 65536 samples. Running at 44.1Khz, that's just about 3138 <1> ; 1.5 seconds of sample time. FFFF * 32bits is 1FFFFh bytes or 128k of data. 3139 <1> ; 3140 <1> ; A value of 0 in these bits means play no samples. 3141 <1> ; 3142 <1> 3143 00014386 89F0 <1> mov eax, esi ; DMA half buffer size 3144 <1> 3145 <1> ; 04/06/2024 - Erdogan Tan 3146 <1> ; NOTE: I have changed DMA half buffer size to truncated 3147 <1> ; (8 byte aligned) audio buffer size for smooth audio playing 3148 <1> ; (it was page border aligned before June 4, 2024) 3149 <1> ; 3150 <1> ; For example: 3151 <1> ; For 65416 bytes audio buffer (22kHz, 16bit samples) 3152 <1> ; (user's audio buff virtual addr is mapped to physical) 3153 <1> ; ((kernel's and user's audio buff pages are same)) 3154 <1> ; 1) Memory allocation (of it) is 65536 bytes 3155 <1> ; 2) DMA half buffer size is 65416 bytes 3156 <1> ; (it would be 65536 bytes before this modification) 3157 <1> ; ((additional 140 bytes would cause to a noise)) 3158 <1> ; 3) Total DMA buffer size is 131072 bytes 3159 <1> ; (the last 240 bytes will not be used for playing) 3160 <1> ; 3161 <1> ; (buffer will be truncated if the size is not a multiple of 8) 3162 <1> 3163 00014388 01C2 <1> add edx, eax 3164 0001438A D1E8 <1> shr eax, 1 ; count of 16 bit samples 3165 <1> ; 19/11/2023 3166 0001438C 0D000000C0 <1> or eax, IOC+BUP 3167 <1> ;or eax, IOC ; 11/06/2017 3168 00014391 AB <1> stosd 3169 <1> 3170 <1> ; 2nd buffer: 3171 <1> 3172 00014392 89D0 <1> mov eax, edx ; Physical address of the 2nd half of DMA buffer 3173 00014394 AB <1> stosd ; store dmabuffer2 address 3174 <1> 3175 <1> ; set length to [audio_dmabuff_size]/2 3176 <1> ; Set control (bits 31:16) to BUP, bits 15:0=number of samples 3177 <1> ; 3178 00014395 89F0 <1> mov eax, esi ; DMA half buffer size 3179 00014397 D1E8 <1> shr eax, 1 ; count of 16 bit samples 3180 <1> ; 19/11/2023 3181 00014399 0D000000C0 <1> or eax, IOC+BUP 3182 <1> ;or eax, IOC ; 11/06/2017 3183 0001439E AB <1> stosd 3184 <1> 3185 0001439F E2DD <1> loop s_ac97_bdl0 3186 <1> 3187 000143A1 C3 <1> retn 3188 <1> 3189 <1> ac97_start_play: 3190 <1> ; 26/05/2024 - TRDOS 386 v2.0.8 3191 <1> ; 26/11/2023 3192 <1> ; 20/11/2023 3193 <1> ; 19/11/2023 - TRDOS 386 v2.0.7 3194 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3195 <1> ; 28/05/2017 3196 <1> ; Derived from 'playWav' procedure in 'ICHWAV.ASM' 3197 <1> ; .wav player for DOS by Jeff Leyda (02/09/2002) 3198 <1> 3199 <1> ; set output rate 3200 <1> ; entry: [audio_freq] = desired sample rate 3201 <1> 3202 <1> ; 21/11/2023 - temporary 3203 <1> ;call ac97_codec_config 3204 <1> 3205 <1> ; 20/11/2023 3206 <1> %if 0 3207 <1> AC97_EA_VRA equ 0001h ; 04/11/2023 3208 <1> 3209 <1> mov dx, [NAMBAR] 3210 <1> add dx, CODEC_EXT_AUDIO_CTRL_REG ; 2Ah 3211 <1> in ax, dx 3212 <1> 3213 <1> ; 23/05/2024 3214 <1> call delay1_4ms 3215 <1> 3216 <1> and al, ~BIT1 ; Clear DRA 3217 <1> or al, AC97_EA_VRA ; 1 ; 04/11/2023 3218 <1> out dx, ax ; Enable variable rate audio 3219 <1> 3220 <1> ;call delay1_4ms 3221 <1> ;call delay1_4ms 3222 <1> ;call delay1_4ms 3223 <1> ;call delay1_4ms 3224 <1> 3225 <1> ; 23/05/2024 3226 <1> call delay_100ms 3227 <1> %endif 3228 <1> 3229 <1> ; 26/11/2023 3230 <1> ; 24/11/2023 - temporary 3231 <1> ;mov ax, 48000 3232 <1> 3233 <1> ; 20/11/2023 3234 000143A2 803D[1C890100]01 <1> cmp byte [VRA], 1 3235 000143A9 7213 <1> jb short skip_set_rate 3236 <1> 3237 000143AB 66A1[1A890100] <1> mov ax, [audio_freq] ; sample rate 3238 <1> 3239 <1> ;skip_set_rate: ; 24/11/2023 3240 000143B1 668B15[E8880100] <1> mov dx, [NAMBAR] 3241 000143B8 6683C22C <1> add dx, CODEC_PCM_FRONT_DACRATE_REG ; 2Ch 3242 000143BC 66EF <1> out dx, ax ; out sample rate 3243 <1> 3244 <1> ; 01/06/2024 3245 <1> ; 27/11/2023 3246 <1> ;call delay1_4ms 3247 <1> ;call delay1_4ms 3248 <1> ;call delay1_4ms 3249 <1> ;call delay1_4ms 3250 <1> ; 27/11/2023 - temporary 3251 <1> ;call delay_100ms 3252 <1> 3253 <1> ; 26/11/2023 3254 <1> skip_set_rate: ; 20/11/2023 3255 <1> 3256 <1> ;; 23/11/2023 - temporary 3257 <1> ;push ebx 3258 <1> ;mov ebx, 0B8000h 3259 <1> ;mov al, 'x' 3260 <1> ;mov ah, 4Eh 3261 <1> ;mov [ebx], ax 3262 <1> ;pop ebx 3263 <1> ; 3264 <1> ; register reset the DMA engine. This may cause a pop noise on the output 3265 <1> ; lines when the device is reset. Prolly a better idea to mute output, then 3266 <1> ; reset. 3267 <1> ; 3268 <1> ;; 21/11/2023 - temporary 3269 <1> ;; 20/11/2023 3270 <1> ;mov dx, [NABMBAR] 3271 <1> ;add dx, PO_CR_REG ; set pointer to Cntl reg 3272 <1> ;mov al, RR ; set reset 3273 <1> ;out dx, al ; self clearing bit 3274 <1> 3275 <1> ; 23/11/2023 - temporary 3276 <1> ;call delay_100ms 3277 <1> 3278 <1> ; mov edi, audio_bdl_buff 3279 <1> ; mov edx, [audio_dmabuff_size] 3280 <1> ; shr edx, 1 3281 <1> ; mov ecx, 32/2 3282 <1> ;ac97_set_bdl_buffer: 3283 <1> ; ; 1st half of DMA buffer 3284 <1> ; mov eax, [audio_dma_buff] 3285 <1> ; push eax 3286 <1> ; stosd 3287 <1> ; mov eax, edx ; dma buffer size / 2 3288 <1> ; or eax, IOC+BUP 3289 <1> ; stosd 3290 <1> ; pop eax 3291 <1> ; ; 2nd half of DMA buffer 3292 <1> ; add eax, edx 3293 <1> ; stosd 3294 <1> ; mov eax, edx ; dma buffer size / 2 3295 <1> ; or eax, IOC+BUP 3296 <1> ; stosd 3297 <1> ; loop ac97_set_bdl_buffer 3298 <1> 3299 <1> ; tell the DMA engine where to find our list of Buffer Descriptors. 3300 <1> ; this 32bit value is a flat mode memory offset (ie no segment:offset) 3301 <1> ; 3302 <1> ; write NABMBAR+10h with offset of buffer descriptor list 3303 <1> ; 3304 000143BE B8[28890100] <1> mov eax, audio_bdl_buff 3305 000143C3 668B15[EA880100] <1> mov dx, [NABMBAR] 3306 000143CA 6683C210 <1> add dx, PO_BDBAR_REG 3307 000143CE EF <1> out dx, eax 3308 <1> 3309 <1> ; 01/06/2024 3310 <1> ; 24/05/2024 3311 <1> ; 23/11/2023 - temporary 3312 <1> ;call delay_100ms 3313 <1> ; 23/05/2024 3314 <1> ;call delay1_4ms 3315 <1> ; 3316 <1> ; All set. Let's play some music. 3317 <1> ; 3318 <1> ;mov eax, 31 3319 <1> ; 06/08/2022 3320 000143CF 29C0 <1> sub eax, eax 3321 000143D1 B01F <1> mov al, 31 3322 000143D3 E846000000 <1> call set_ac97_LastValidIndex 3323 <1> 3324 <1> ; 01/06/2024 3325 <1> ; 24/05/2024 3326 <1> ; 23/11/2023 - temporary 3327 <1> ;call delay_100ms 3328 <1> ; 23/05/2024 3329 <1> ;call delay1_4ms 3330 <1> ; 27/05/2024 3331 <1> ;call delay1_4ms 3332 <1> ;call delay1_4ms 3333 <1> ;call delay1_4ms 3334 <1> 3335 000143D8 C605[1E890100]01 <1> mov byte [audio_play_cmd], 1 ; play command (do not stop) ! 3336 <1> 3337 <1> ac97_play: ; continue to play (after pause) 3338 <1> ; 27/05/2024 3339 <1> ;;; 3340 <1> ; 19/05/2024 - temporary 3341 <1> ; 24/11/2023 - temporary 3342 <1> ;mov ax, 0202h 3343 <1> ; 23/05/2024 3344 000143DF 66B81F1F <1> mov ax, 1F1Fh 3345 000143E3 662B05[20890100] <1> sub ax, [audio_master_volume] 3346 <1> 3347 000143EA 668B15[E8880100] <1> mov dx, [NAMBAR] 3348 000143F1 6683C202 <1> add dx, CODEC_MASTER_VOL_REG ; 02h ; Line Out 3349 000143F5 66EF <1> out dx, ax 3350 <1> 3351 <1> ; 01/06/2024 3352 <1> ; 19/05/2024 - temporary 3353 <1> ;call delay_100ms 3354 <1> ; 23/05/2024 3355 <1> ;call delay1_4ms 3356 <1> ; 24/05/2024 3357 <1> ;call delay1_4ms 3358 <1> ;call delay1_4ms 3359 <1> ;call delay1_4ms 3360 <1> 3361 <1> ;mov ax, 0202h 3362 <1> ; 23/05/2024 3363 <1> ;mov ax, 1F1Fh 3364 <1> ;sub ax, [audio_master_volume] 3365 <1> 3366 <1> ; 27/05/2024 3367 000143F7 66B81F1F <1> mov ax, 1F1Fh 3368 000143FB 662B05[22890100] <1> sub ax, [audio_pcmo_volume] 3369 <1> 3370 00014402 668B15[E8880100] <1> mov dx, [NAMBAR] 3371 00014409 6683C218 <1> add dx, CODEC_PCM_OUT_REG ; 18h ; PCM Out 3372 0001440D 66EF <1> out dx, ax 3373 <1> 3374 <1> ; 01/06/2024 3375 <1> ; 24/05/2024 3376 <1> ; 23/05/2024 3377 <1> ;call delay1_4ms 3378 <1> ;call delay1_4ms 3379 <1> ;call delay1_4ms 3380 <1> ;call delay1_4ms 3381 <1> ; 24/05/2024 3382 <1> ;call delay_100ms 3383 <1> ;;; 3384 <1> 3385 <1> ; 11/06/2017 3386 <1> ; 29/05/2017 3387 <1> ; 28/05/2017 3388 0001440F 668B15[EA880100] <1> mov dx, [NABMBAR] 3389 00014416 6683C21B <1> add dx, PO_CR_REG ; PCM out control register 3390 <1> ; 26/11/2023 3391 0001441A B011 <1> mov al, IOCE+RPBM ; 29/05/2017 3392 <1> ; 24/11/2023 3393 <1> ;mov al, 1Dh ; (Ref: KolibriOS, intelac97.asm, 'play:') 3394 0001441C EE <1> out dx, al ; set start! 3395 <1> 3396 <1> ;mov byte [audio_play_cmd], 1 ; play command (do not stop) ! 3397 <1> 3398 0001441D C3 <1> retn 3399 <1> 3400 <1> ;input AL = index # to stop on 3401 <1> set_ac97_LastValidIndex: 3402 <1> ; 28/05/2017 3403 <1> ; Derived from 'setLastValidIndex' procedure in 'ICHWAV.ASM' 3404 <1> ; .wav player for DOS by Jeff Leyda (02/09/2002) 3405 0001441E 668B15[EA880100] <1> mov dx, [NABMBAR] 3406 00014425 6683C215 <1> add dx, PO_LVI_REG 3407 00014429 EE <1> out dx, al 3408 <1> ;mov [audio_lvi], al ; for ac97_int_handler 3409 0001442A C3 <1> retn 3410 <1> 3411 <1> ac97_volume: 3412 <1> ; 23/05/2024 3413 <1> ; 28/05/2017 3414 <1> ; bl = component (0 = master/playback/lineout volume) 3415 <1> ; (1 = PCM Out volume) ; 23/05/2024 3416 <1> ; cl = left channel volume level (0 to 31) 3417 <1> ; ch = right channel volume level (0 to 31) 3418 <1> 3419 <1> ; 24/05/2024 3420 0001442B 80FB01 <1> cmp bl, 1 3421 0001442E 7727 <1> ja short ac97_vol_2 ; temporary ! 3422 <1> 3423 00014430 66B81F1F <1> mov ax, 1F1Fh ; 31,31 3424 00014434 38C1 <1> cmp cl, al 3425 00014436 771F <1> ja short ac97_vol_2 3426 00014438 38E5 <1> cmp ch, ah 3427 0001443A 771B <1> ja short ac97_vol_2 3428 <1> 3429 0001443C 08DB <1> or bl, bl 3430 0001443E 7518 <1> jnz short ac97_vol_1 3431 <1> 3432 <1> ; 23/05/2024 3433 00014440 66BA0200 <1> mov dx, CODEC_MASTER_VOL_REG ; 02h ; Line Out 3434 <1> ; 24/05/2024 3435 00014444 66890D[20890100] <1> mov [audio_master_volume], cx 3436 <1> ac97_vol_0: 3437 0001444B 6629C8 <1> sub ax, cx 3438 <1> ;mov dx, [NAMBAR] 3439 <1> ;add dx, CODEC_MASTER_VOL_REG 3440 <1> ; 23/05/2024 3441 0001444E 660315[E8880100] <1> add dx, [NAMBAR] 3442 00014455 66EF <1> out dx, ax 3443 <1> ; 23/05/2024 3444 <1> ac97_vol_2: 3445 <1> ; 21/11/2023 3446 <1> ;_ac97_ih5: ; 06/08/2022 3447 00014457 C3 <1> retn 3448 <1> 3449 <1> ac97_vol_1: 3450 <1> ; 24/05/2024 3451 <1> ; 23/05/2024 3452 <1> ;cmp bl, 1 3453 <1> ;ja short ac97_vol_2 ; temporary ! 3454 <1> ; BL = 1 3455 <1> ; PCM OUT Volume 3456 00014458 66BA1800 <1> mov dx, CODEC_PCM_OUT_REG ; 18h ; PCM out 3457 <1> ; 24/05/2024 3458 0001445C 66890D[22890100] <1> mov [audio_pcmo_volume], cx 3459 00014463 EBE6 <1> jmp short ac97_vol_0 3460 <1> 3461 <1> ac97_int_handler: 3462 <1> ; 04/06/2024 3463 <1> ; 03/06/2024 3464 <1> ; 02/06/2024 - TRDOS 386 v2.0.8 3465 <1> ; 27/11/2023 3466 <1> ; 24/11/2023 3467 <1> ; 21/11/2023 3468 <1> ; 20/11/2023 - TRDOS 386 v2.0.7 3469 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3470 <1> ; 12/10/2017 3471 <1> ; 10/10/2017 3472 <1> ; 09/10/2017 3473 <1> ; 13/06/2017, 13/06/2017 3474 <1> ; 10/06/2017, 11/06/2017 3475 <1> ; Interrupt Handler for AC97 (ICH) Audio Controller 3476 <1> ; Note: called by 'dev_IRQ_service' 3477 <1> ; 28/05/2017 3478 <1> 3479 <1> ;push eax ; * must be saved ! 3480 <1> ;push edx 3481 <1> ;push ecx 3482 <1> ;push ebx ; * must be saved ! 3483 <1> ;push esi 3484 <1> ;push edi 3485 <1> 3486 <1> ; 02/06/2024 3487 <1> %if 0 3488 <1> 3489 <1> ;cmp byte [audio_busy], 1 3490 <1> ;jnb _ac97_ih2 ; busy ! 3491 <1> 3492 <1> ; 24/11/2023 3493 <1> ;mov dx, [NABMBAR] 3494 <1> ;mov dx, PO_SR_REG 3495 <1> ;in ax, dx 3496 <1> ;test al, BCIS ; bit 3, 8 3497 <1> ;jz short _ac97_ih5 3498 <1> 3499 <1> ; 24/11/2023 3500 <1> mov dx, GLOB_STS_REG 3501 <1> add dx, [NABMBAR] 3502 <1> in eax, dx 3503 <1> 3504 <1> cmp eax, 0FFFFFFFFh ; -1 3505 <1> ;je _ac97_ih3 ; exit 3506 <1> ; 06/08/2022 3507 <1> je short _ac97_ih5 3508 <1> 3509 <1> ;test eax, 40h ; PCM Out Interrupt 3510 <1> ; 06/08/2022 3511 <1> test al, 40h 3512 <1> jnz short _ac97_ih0 3513 <1> 3514 <1> ; 24/11/2023 3515 <1> test eax, eax 3516 <1> ;jz _ac97_ih3 ; exit 3517 <1> ; 06/08/2022 3518 <1> jz short _ac97_ih5 3519 <1> 3520 <1> ;mov dx, GLOB_STS_REG 3521 <1> ;add dx, [NABMBAR] 3522 <1> out dx, eax 3523 <1> 3524 <1> ;jmp _ac97_ih3 ; exit 3525 <1> 3526 <1> ; 06/08/2022 3527 <1> retn 3528 <1> ; 21/11/2023 3529 <1> ;jmp short _ac97_ih5 3530 <1> 3531 <1> _ac97_ih0: 3532 <1> ; 24/11/2023 3533 <1> ;push eax 3534 <1> ; 09/10/2017 3535 <1> cmp byte [audio_play_cmd], 1 3536 <1> ;jb short _ac97_ih4 ; stop command ! 3537 <1> ; 24/11/2023 3538 <1> jnb short _ac97_ih4 3539 <1> 3540 <1> ;mov dx, GLOB_STS_REG 3541 <1> ;add dx, [NABMBAR] 3542 <1> out dx, eax 3543 <1> ;jmp short _ac97_stop 3544 <1> 3545 <1> ; 24/11/2023 3546 <1> ac97_stop: 3547 <1> ; 28/05/2017 3548 <1> mov byte [audio_play_cmd], 0 ; stop ! 3549 <1> 3550 <1> %else 3551 <1> ; 02/06/2024 3552 <1> _ac97_ih0: 3553 00014465 803D[1E890100]01 <1> cmp byte [audio_play_cmd], 1 3554 0001446C 7334 <1> jnb short _ac97_ih4 3555 <1> %endif 3556 <1> 3557 <1> _ac97_stop: ; 09/10/2017 3558 <1> ; 29/05/2017 3559 <1> ;mov dx, [NABMBAR] 3560 <1> ;add dx, PO_CR_REG 3561 <1> ;mov al, 0 3562 <1> ;out dx, al 3563 <1> 3564 <1> ; 11/06/2017 3565 0001446E 30C0 <1> xor al, al ; 0 3566 00014470 E813000000 <1> call ac97_po_cmd 3567 <1> 3568 <1> ; (Ref: KolibriOS, intelac97.asm, 'stop:') 3569 <1> ; Clear FIFOE, BCIS, LVBCI (Ref: Intel ICH hub manual) 3570 00014475 66B81C00 <1> mov ax, 1Ch 3571 00014479 668B15[EA880100] <1> mov dx, [NABMBAR] 3572 00014480 6683C216 <1> add dx, PO_SR_REG 3573 00014484 66EF <1> out dx, ax 3574 <1> 3575 <1> ;retn 3576 <1> 3577 <1> ; 11/06/2017 3578 00014486 B002 <1> mov al, RR 3579 <1> ac97_po_cmd: 3580 <1> ;11/06/2017 3581 <1> ; 29/05/2017 3582 00014488 668B15[EA880100] <1> mov dx, [NABMBAR] 3583 0001448F 6683C21B <1> add dx, PO_CR_REG ; PCM out control register 3584 00014493 EE <1> out dx, al 3585 00014494 C3 <1> retn 3586 <1> 3587 <1> ; 02/06/2024 3588 <1> %if 1 3589 <1> ; 24/11/2023 3590 <1> ac97_stop: 3591 <1> ; 28/05/2017 3592 00014495 C605[1E890100]00 <1> mov byte [audio_play_cmd], 0 ; stop ! 3593 0001449C EBD0 <1> jmp short _ac97_stop 3594 <1> %endif 3595 <1> 3596 <1> ac97_pause: 3597 <1> ; 11/06/2017 3598 <1> ; 29/05/2017 3599 0001449E B010 <1> mov al, IOCE 3600 000144A0 EBE6 <1> jmp short ac97_po_cmd 3601 <1> 3602 <1> _ac97_ih4: 3603 <1> ;mov byte [audio_busy], 1 3604 <1> 3605 <1> ; 02/06/2024 3606 <1> %if 1 3607 <1> ; 24/11/2023 (TRDOS386 'audio.s') 3608 000144A2 668B15[EA880100] <1> mov dx, [NABMBAR] 3609 000144A9 6683C216 <1> add dx, PO_SR_REG 3610 000144AD 66ED <1> in ax, dx 3611 <1> 3612 000144AF A808 <1> test al, BCIS ; bit 3, 8 3613 000144B1 744C <1> jz short _ac97_ih2 ; 02/06/2024 3614 <1> 3615 <1> ; 02/06/2024 3616 000144B3 50 <1> push eax ; * 3617 <1> %else 3618 <1> ; 27/05/2024 3619 <1> ; 24/11/2023 3620 <1> push eax 3621 <1> 3622 <1> mov ax, 1Ch ; FIFOE(=16)+BCIS(=8)+LVBCI(=4) 3623 <1> mov dx, PO_SR_REG 3624 <1> add dx, [NABMBAR] 3625 <1> out dx, ax 3626 <1> 3627 <1> mov dx, PO_CIV_REG 3628 <1> add dx, [NABMBAR] 3629 <1> in al, dx 3630 <1> 3631 <1> ;cmp al, [audio_civ] ; [audio_flag] 3632 <1> ;je short _ac97_ih2 3633 <1> 3634 <1> ; 21/11/2023 3635 <1> ;mov [audio_civ], al 3636 <1> ; 20/11/2023 3637 <1> mov ah, al 3638 <1> dec al 3639 <1> ;inc al ; 11/06/2017 3640 <1> and al, 1Fh 3641 <1> %endif 3642 <1> ; 02/06/2024 3643 000144B4 66BA1400 <1> mov dx, PO_CIV_REG 3644 000144B8 660315[EA880100] <1> add dx, [NABMBAR] 3645 <1> ;in ax, dx 3646 <1> ; 03/06/2024 3647 000144BF EC <1> in al, dx 3648 <1> ; al = CVI, ah = LVI 3649 <1> ;xchg ah, al 3650 <1> ; ; al = LVI, ah = CVI 3651 <1> ;cmp al, ah 3652 <1> ;jne short _ac97_ih5 3653 <1> ; 03/06/2024 3654 000144C0 88C4 <1> mov ah, al 3655 <1> 3656 000144C2 FEC8 <1> dec al 3657 000144C4 241F <1> and al, 1Fh 3658 <1> 3659 <1> ;mov dx, PO_LVI_REG 3660 <1> ;add dx, [NABMBAR] 3661 000144C6 6642 <1> inc dx ; 02/06/2024 3662 000144C8 EE <1> out dx, al 3663 <1> 3664 <1> ; 12/10/2017 3665 <1> ;mov al, [audio_civ] 3666 <1> ;inc al 3667 <1> ;and al, 1 3668 <1> ;mov [audio_flag], al 3669 <1> ; 27/11/2023 3670 <1> ; 20/11/2023 3671 <1> ;inc ah 3672 <1> _ac97_ih5: ; 02/06/2024 3673 000144C9 80E401 <1> and ah, 1 3674 000144CC 8825[10890100] <1> mov [audio_flag], ah 3675 <1> 3676 <1> ;; [audio_flag] : 0 = Buffer 1, 1 = Buffer 2 3677 <1> ; 3678 <1> ; 21/11/2023 3679 <1> ;call ac97_tuneloop 3680 <1> 3681 <1> ; 24/11/2023 3682 <1> ac97_tuneloop: 3683 <1> ; 09/10/2017 3684 000144D2 8B3D[04890100] <1> mov edi, [audio_dma_buff] 3685 <1> ; 04/06/2024 3686 <1> ;mov ecx, [audio_dmabuff_size] 3687 <1> ;shr ecx, 1 ; dma buff size / 2 = half buffer size 3688 000144D8 8B0D[00890100] <1> mov ecx, [audio_buff_size] 3689 000144DE 80E1F8 <1> and cl, ~7 ; 8 byte aligned 3690 <1> 3691 <1> ; 12/10/2017 3692 000144E1 803D[10890100]00 <1> cmp byte [audio_flag], 0 3693 000144E8 7702 <1> ja short _ac97_ih1 ; Playing Half Buffer 2 (Current: FLAG) 3694 <1> ; Playing Half Buffer 1 (Current: EOL) 3695 000144EA 01CF <1> add edi, ecx 3696 <1> _ac97_ih1: 3697 <1> ; Update half buffer 2 while playing half buffer 1 (next: FLAG) 3698 <1> ; Update half buffer 1 while playing half buffer 2 (next: EOL) 3699 <1> 3700 000144EC 8B35[FC880100] <1> mov esi, [audio_p_buffer] ; phy addr of audio buff 3701 000144F2 C1E902 <1> shr ecx, 2 ; half buff size / 4 3702 000144F5 F3A5 <1> rep movsd 3703 <1> 3704 <1> ; 10/10/2017 3705 <1> ; switch flag value 3706 000144F7 8035[10890100]01 <1> xor byte [audio_flag], 1 3707 <1> 3708 <1> ; 02/06/2024 3709 <1> %if 1 3710 <1> ; 02/06/2024 3711 000144FE 58 <1> pop eax ; * 3712 <1> _ac97_ih2: 3713 <1> ;mov ax, 1Ch ; FIFOE(=16)+BCIS(=8)+LVBCI(=4) 3714 000144FF 66BA1600 <1> mov dx, PO_SR_REG 3715 00014503 660315[EA880100] <1> add dx, [NABMBAR] 3716 0001450A 66EF <1> out dx, ax 3717 <1> %else 3718 <1> ; 27/11/2023 3719 <1> ; 21/11/2023 - temporary 3720 <1> ;push ebx 3721 <1> ;mov ebx, 0B8002h 3722 <1> ;mov al, [audio_flag] 3723 <1> ;add al, '1' 3724 <1> ;mov ah, 0Fh 3725 <1> ;mov [ebx], ax 3726 <1> ;pop ebx 3727 <1> 3728 <1> ; 12/10/2017 3729 <1> ; [audio_flag] = 0 : Playing dma half buffer 2 (even index value) 3730 <1> ; Next buffer (to update) is dma half buff 1 3731 <1> ; = 1 : Playing dma half buffer 1 (odd index value) 3732 <1> ; Next buffer (to update) is dma half buff 2 3733 <1> ; 24/11/2023 3734 <1> ;retn 3735 <1> 3736 <1> ; 3737 <1> ; 24/11/2023 3738 <1> pop eax 3739 <1> ; 24/11/2023 3740 <1> ; 20/11/2023 3741 <1> ;and eax, 40h 3742 <1> mov dx, [NABMBAR] 3743 <1> add dx, GLOB_STS_REG 3744 <1> out dx, eax 3745 <1> 3746 <1> ;; 13/06/2017 3747 <1> ;mov al, 11h ; IOCE + RPBM 3748 <1> ;mov dx, PO_CR_REG 3749 <1> ;add dx, [NABMBAR] 3750 <1> ;out dx, al 3751 <1> 3752 <1> ; 24/11/2023 3753 <1> ;mov dx, [NABMBAR] 3754 <1> ;add dx, PO_SR_REG ; set pointer to Status reg 3755 <1> ;mov ax, 1Ch 3756 <1> ;out dx, ax 3757 <1> 3758 <1> ; 24/11/2023 3759 <1> _ac97_ih2: 3760 <1> ;mov byte [audio_busy], 0 3761 <1> %endif 3762 <1> 3763 <1> _ac97_ih3: 3764 <1> ;pop edi 3765 <1> ;pop esi 3766 <1> ;pop ebx ; * must be restored ! 3767 <1> ;pop ecx 3768 <1> ;pop edx 3769 <1> ;pop eax ; * must be restored ! 3770 <1> 3771 0001450C C3 <1> retn 3772 <1> 3773 <1> reset_ac97_controller: 3774 <1> ; 06/06/2024 3775 <1> ; 01/06/2024 3776 <1> ; 27/05/2024 3777 <1> ; 16/05/2024 3778 <1> ; 10/06/2017 3779 <1> ; 29/05/2017 3780 <1> ; 28/05/2017 3781 <1> ; reset AC97 audio controller registers 3782 0001450D 31C0 <1> xor eax, eax 3783 0001450F 66BA0B00 <1> mov dx, PI_CR_REG 3784 00014513 660315[EA880100] <1> add dx, [NABMBAR] 3785 0001451A EE <1> out dx, al 3786 <1> 3787 <1> ; 16/05/2024 3788 <1> ;call delay1_4ms 3789 <1> 3790 0001451B 66BA1B00 <1> mov dx, PO_CR_REG 3791 0001451F 660315[EA880100] <1> add dx, [NABMBAR] 3792 00014526 EE <1> out dx, al 3793 <1> 3794 <1> ; 16/05/2024 3795 <1> ;call delay1_4ms 3796 <1> 3797 00014527 66BA2B00 <1> mov dx, MC_CR_REG 3798 0001452B 660315[EA880100] <1> add dx, [NABMBAR] 3799 00014532 EE <1> out dx, al 3800 <1> 3801 <1> ; 16/05/2024 3802 <1> ;call delay1_4ms 3803 <1> 3804 00014533 B002 <1> mov al, RR 3805 00014535 66BA0B00 <1> mov dx, PI_CR_REG 3806 00014539 660315[EA880100] <1> add dx, [NABMBAR] 3807 00014540 EE <1> out dx, al 3808 <1> 3809 <1> ; 16/05/2024 3810 <1> ;call delay1_4ms 3811 <1> 3812 00014541 66BA1B00 <1> mov dx, PO_CR_REG 3813 00014545 660315[EA880100] <1> add dx, [NABMBAR] 3814 0001454C EE <1> out dx, al 3815 <1> 3816 <1> ; 16/05/2024 3817 <1> ;call delay1_4ms 3818 <1> 3819 0001454D 66BA2B00 <1> mov dx, MC_CR_REG 3820 00014551 660315[EA880100] <1> add dx, [NABMBAR] 3821 00014558 EE <1> out dx, al 3822 <1> 3823 <1> ; 27/05/2024 3824 <1> ; 16/05/2024 3825 <1> ;call delay1_4ms 3826 <1> 3827 00014559 C3 <1> retn 3828 <1> 3829 <1> ac97_reset: 3830 <1> ; 27/05/2024 - TRDOS 386 v2.0.8 3831 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3832 <1> ; 10/06/2017 3833 <1> ; 29/05/2017 3834 <1> ; 28/05/2017 3835 0001455A E8AEFFFFFF <1> call reset_ac97_controller 3836 <1> ; 29/05/2017 3837 <1> ;jmp reset_ac97_codec 3838 <1> ; 27/05/2024 3839 0001455F E80DF6FFFF <1> call delay_100ms 3840 <1> reset_ac97_codec: 3841 <1> ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 3842 00014564 66BA2C00 <1> mov dx, GLOB_CNT_REG ; 2Ch 3843 00014568 660315[EA880100] <1> add dx, [NABMBAR] 3844 0001456F ED <1> in eax, dx 3845 <1> 3846 <1> ;test eax, 2 3847 <1> ; 06/08/2022 3848 00014570 A802 <1> test al, 2 3849 00014572 7407 <1> jz short _r_ac97codec_cold 3850 <1> 3851 00014574 E80F000000 <1> call warm_ac97codec_reset 3852 00014579 7308 <1> jnc short _r_ac97codec_ok 3853 <1> _r_ac97codec_cold: 3854 0001457B E83B000000 <1> call cold_ac97codec_reset 3855 00014580 7301 <1> jnc short _r_ac97codec_ok 3856 <1> 3857 <1> ; 16/04/2017 3858 <1> ;xor eax, eax ; timeout error 3859 <1> ;stc 3860 00014582 C3 <1> retn 3861 <1> 3862 <1> _r_ac97codec_ok: 3863 00014583 31C0 <1> xor eax, eax 3864 <1> ;mov al, VIA_ACLINK_C00_READY ; 1 3865 00014585 FEC0 <1> inc al 3866 00014587 C3 <1> retn 3867 <1> 3868 <1> warm_ac97codec_reset: 3869 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3870 <1> ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 3871 <1> ;mov eax, 6 3872 <1> ; 06/08/2022 3873 00014588 29C0 <1> sub eax, eax 3874 0001458A B006 <1> mov al, 6 3875 0001458C 66BA2C00 <1> mov dx, GLOB_CNT_REG ; 2Ch 3876 00014590 660315[EA880100] <1> add dx, [NABMBAR] 3877 00014597 EF <1> out dx, eax 3878 <1> 3879 <1> ;mov ecx, 10 ; total 1s 3880 <1> ; 06/08/2022 3881 00014598 31C9 <1> xor ecx, ecx 3882 0001459A B10A <1> mov cl, 10 3883 <1> _warm_ac97c_rst_wait: 3884 0001459C 51 <1> push ecx 3885 0001459D E8CFF5FFFF <1> call delay_100ms 3886 000145A2 59 <1> pop ecx 3887 <1> 3888 000145A3 66BA3000 <1> mov dx, GLOB_STS_REG ; 30h 3889 000145A7 660315[EA880100] <1> add dx, [NABMBAR] 3890 000145AE ED <1> in eax, dx 3891 <1> 3892 000145AF A900030010 <1> test eax, CTRL_ST_CREADY 3893 000145B4 7504 <1> jnz short _warm_ac97c_rst_ok 3894 <1> 3895 000145B6 49 <1> dec ecx 3896 000145B7 75E3 <1> jnz short _warm_ac97c_rst_wait 3897 <1> 3898 <1> _warm_ac97c_rst_fail: 3899 000145B9 F9 <1> stc 3900 <1> _warm_ac97c_rst_ok: 3901 000145BA C3 <1> retn 3902 <1> 3903 <1> cold_ac97codec_reset: 3904 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3905 <1> ; 28/05/2017 - Erdogan Tan (Ref: KolibriOS, intelac97.asm) 3906 <1> ;mov eax, 2 3907 <1> ; 06/08/2022 3908 000145BB 31C0 <1> xor eax, eax 3909 000145BD B002 <1> mov al, 2 3910 000145BF 66BA2C00 <1> mov dx, GLOB_CNT_REG ; 2Ch 3911 000145C3 660315[EA880100] <1> add dx, [NABMBAR] 3912 000145CA EF <1> out dx, eax 3913 <1> 3914 000145CB E8A1F5FFFF <1> call delay_100ms ; wait 100 ms 3915 000145D0 E89CF5FFFF <1> call delay_100ms ; wait 100 ms 3916 000145D5 E897F5FFFF <1> call delay_100ms ; wait 100 ms 3917 000145DA E892F5FFFF <1> call delay_100ms ; wait 100 ms 3918 <1> 3919 <1> ;mov ecx, 16 ; total 20*100 ms = 2s 3920 <1> ; 06/08/2022 3921 000145DF 31C9 <1> xor ecx, ecx 3922 000145E1 B110 <1> mov cl, 16 3923 <1> _cold_ac97c_rst_wait: 3924 000145E3 66BA3000 <1> mov dx, GLOB_STS_REG ; 30h 3925 000145E7 660315[EA880100] <1> add dx, [NABMBAR] 3926 000145EE ED <1> in eax, dx 3927 <1> 3928 000145EF A900030010 <1> test eax, CTRL_ST_CREADY 3929 000145F4 750B <1> jnz short _cold_ac97c_rst_ok 3930 <1> 3931 000145F6 51 <1> push ecx 3932 000145F7 E875F5FFFF <1> call delay_100ms 3933 000145FC 59 <1> pop ecx 3934 <1> 3935 000145FD 49 <1> dec ecx 3936 000145FE 75E3 <1> jnz short _cold_ac97c_rst_wait 3937 <1> 3938 <1> _cold_ac97c_rst_fail: 3939 00014600 F9 <1> stc 3940 <1> _cold_ac97c_rst_ok: 3941 00014601 C3 <1> retn 3942 <1> 3943 <1> sb16_current_sound_data: 3944 <1> ; 05/06/2024 3945 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 3946 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 3947 <1> ; 20/08/2017 3948 <1> ; 24/06/2017 3949 <1> ; 22/06/2017 3950 <1> ; get current sound (PCM out) data for graphics 3951 <1> ; (for Sound Blaster 16) 3952 <1> ; ebx = Physical address (on page boundary) 3953 <1> ; ecx = Byte count 3954 <1> ; [audio_buff_size] 3955 <1> 3956 <1> ;;mov edi, [audio_buff_size] 3957 <1> ;mov edi, [audio_dmabuff_size] 3958 <1> ;mov esi, [audio_dma_buff] 3959 <1> 3960 00014602 39CF <1> cmp edi, ecx 3961 00014604 7302 <1> jnb short sb16_gcd_0 3962 00014606 89F9 <1> mov ecx, edi 3963 <1> sb16_gcd_0: 3964 <1> ; 06/08/2022 3965 00014608 31C0 <1> xor eax, eax 3966 <1> ; 20/08/2017 3967 0001460A 803D[18890100]10 <1> cmp byte [audio_bps], 16 3968 00014611 750C <1> jne short sb16_gcd_1 ; 8 bit DMA channel 3969 00014613 E4C6 <1> in al, 0C6h ; DMA channel 5 count register 3970 <1> ;mov dl, al 3971 <1> ; 06/08/2022 3972 00014615 88C4 <1> mov ah, al 3973 00014617 E4C6 <1> in al, 0C6h 3974 <1> ;mov dh, al 3975 <1> ;movzx eax, dx 3976 <1> ; 06/08/2022 3977 00014619 86E0 <1> xchg ah, al 3978 0001461B D1E0 <1> shl eax, 1 ; word count -> byte count 3979 0001461D EB4C <1> jmp short sb16_gcd_2 3980 <1> sb16_gcd_1: 3981 0001461F E403 <1> in al, 03h ; DMA channel 1 count register 3982 <1> ;mov dl, al 3983 <1> ; 06/08/2022 3984 00014621 88C4 <1> mov ah, al 3985 00014623 E403 <1> in al, 03h 3986 <1> ;mov dh, al 3987 <1> ;movzx eax, dx 3988 <1> ; 06/08/2022 3989 00014625 86E0 <1> xchg ah, al 3990 00014627 EB42 <1> jmp short sb16_gcd_2 3991 <1> ;sb16_gcd_2: 3992 <1> ; cmp eax, ecx 3993 <1> ; jnb short sb16_gcd_3 3994 <1> ; ; remain count < graphics bytes 3995 <1> ; mov eax, ecx ; fix remain count to data size 3996 <1> ;sb16_gcd_3: 3997 <1> ; sub edi, eax 3998 <1> ; jna short sb16_gcd_4 3999 <1> ; add esi, edi ; dma buffer offset 4000 <1> ;sb16_gcd_4: 4001 <1> ; mov edi, ebx ; buffer address (for graphics) 4002 <1> ; mov [u.r0], ecx 4003 <1> ; rep movsb 4004 <1> ; retn 4005 <1> 4006 <1> get_current_sound_data: 4007 <1> ; 05/06/2024 4008 <1> ; 04/06/2024 4009 <1> ; 24/06/2017 4010 <1> ; 22/06/2017 4011 <1> ; get current sound (PCM out) data for graphics 4012 <1> ; 4013 <1> ; ebx = Physical address (on page boundary) 4014 <1> ; ecx = Byte count 4015 <1> ; [audio_buff_size] 4016 <1> 4017 <1> ;mov edi, [audio_buff_size] 4018 <1> ;;; 4019 <1> ; 04/06/2024 4020 <1> ;mov edi, [audio_dmabuff_size] 4021 <1> ; 05/06/2024 4022 <1> ;mov edi, [audio_buff_size] 4023 00014629 8B3D[0C890100] <1> mov edi, [dma_hbuff_size] 4024 <1> ;;; 4025 0001462F 8B35[04890100] <1> mov esi, [audio_dma_buff] 4026 <1> 4027 <1> ;;; 4028 <1> ; 04/06/2024 4029 <1> ;cmp byte [audio_device], 2 4030 <1> ;jb short sb16_current_sound_data ; = 1 4031 <1> ;shr edi, 1 4032 <1> 4033 <1> ; 04/06/2024 4034 00014635 803D[E5880100]01 <1> cmp byte [audio_device], 1 4035 0001463C 7704 <1> ja short gcd_1 4036 0001463E D1E7 <1> shl edi, 1 ; [audio_dmabuff_size] = 2 * edi 4037 <1> ; 05/06/2024 4038 <1> ; edi = [dma_hbuff_size] * 2 4039 00014640 EBC0 <1> jmp short sb16_current_sound_data 4040 <1> gcd_1: 4041 <1> ;;; 4042 <1> 4043 <1> ; 04/06/2024 4044 <1> %if 0 4045 <1> cmp edi, ecx 4046 <1> jnb short gcd_0 4047 <1> mov ecx, edi 4048 <1> gcd_0: 4049 <1> %endif 4050 00014642 803D[E5880100]03 <1> cmp byte [audio_device], 3 4051 00014649 7237 <1> jb short ac97_current_sound_data ; = 2 4052 <1> ; = 3 4053 <1> vt8233_current_sound_data: 4054 <1> ; 05/06/2024 4055 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 4056 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 4057 <1> ; 22/06/2017 4058 <1> ; 21/06/2017 4059 <1> ; get current sound (PCM out) data for graphics 4060 <1> ; (for VT 8233, VT 8237R) 4061 <1> ; ebx = Physical address (on page boundary) 4062 <1> ; ecx = Byte count 4063 <1> ; [audio_buff_size] 4064 <1> 4065 <1> ;;mov edi, [audio_buff_size] 4066 <1> ;mov edi, [audio_dmabuff_size] 4067 <1> ;mov esi, [audio_dma_buff] 4068 <1> ;shr edi, 1 4069 <1> ;cmp edi, ecx 4070 <1> ;jnb short vt8233_gcd_1 4071 <1> ;mov ecx, edi 4072 <1> 4073 <1> ;;; 4074 <1> ; 04/06/2024 4075 <1> ; edi = [audio_buff_size] 4076 <1> ; 05/06/2024 4077 <1> ;and di, ~1 ; word alignment 4078 <1> ; edi = [dma_hbuff_size] 4079 0001464B 39CF <1> cmp edi, ecx 4080 0001464D 7302 <1> jnb short vt8233_gcd_1 4081 0001464F 89F9 <1> mov ecx, edi 4082 <1> ;;; 4083 <1> 4084 <1> vt8233_gcd_1: 4085 <1> ;mov edx, VIA_REG_OFFSET_CURR_COUNT 4086 <1> ; 06/08/2022 4087 00014651 31D2 <1> xor edx, edx 4088 00014653 B20C <1> mov dl, VIA_REG_OFFSET_CURR_COUNT 4089 00014655 E877F5FFFF <1> call ctrl_io_r32 4090 0001465A 89C2 <1> mov edx, eax ; remain count (bits 23-0), 4091 <1> ; SGD index (bits 31-24) 4092 0001465C 81E200000001 <1> and edx, 1000000h ; SGD index (0 = 1st half) 4093 00014662 7402 <1> jz short vt8233_gcd_2 4094 <1> ; the second half of DMA buffer 4095 00014664 01FE <1> add esi, edi 4096 <1> vt8233_gcd_2: 4097 00014666 25FFFFFF00 <1> and eax, 0FFFFFFh ; bits 23-0 4098 <1> ac97_gcd_2: 4099 <1> sb16_gcd_2: 4100 0001466B 39C8 <1> cmp eax, ecx 4101 0001466D 7302 <1> jnb short vt8233_gcd_3 4102 <1> ; remain count < graphics bytes 4103 0001466F 89C8 <1> mov eax, ecx ; fix remain count to data size 4104 <1> vt8233_gcd_3: 4105 00014671 29C7 <1> sub edi, eax 4106 00014673 7602 <1> jna short vt8233_gcd_4 4107 00014675 01FE <1> add esi, edi ; dma buffer offset 4108 <1> vt8233_gcd_4: 4109 00014677 89DF <1> mov edi, ebx ; buffer address (for graphics) 4110 00014679 890D[6C8E0100] <1> mov [u.r0], ecx 4111 0001467F F3A4 <1> rep movsb 4112 <1> vt8233_gcd_5: 4113 00014681 C3 <1> retn 4114 <1> 4115 <1> ac97_current_sound_data: 4116 <1> ; 05/06/2024 4117 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 4118 <1> ; 23/06/2017 4119 <1> ; 22/06/2017 4120 <1> ; get current sound (PCM out) data for graphics 4121 <1> ; (for AC'97, ICH) 4122 <1> ; ebx = Physical address (on page boundary) 4123 <1> ; ecx = Byte count 4124 <1> ; [audio_buff_size] 4125 <1> 4126 <1> ;;mov edi, [audio_buff_size] 4127 <1> ;mov edi, [audio_dmabuff_size] 4128 <1> ;mov esi, [audio_dma_buff] 4129 <1> ;shr edi, 1 4130 <1> ;cmp edi, ecx 4131 <1> ;jnb short ac97_gcd_0 4132 <1> ;mov ecx, edi 4133 <1> 4134 <1> ;;; 4135 <1> ; 04/06/2024 4136 <1> ; edi = [audio_buff_size] 4137 <1> ; 05/06/2024 4138 <1> ;and di, ~7 ; 8 byte alignment 4139 <1> ; edi = [dma_hbuff_size] 4140 00014682 39CF <1> cmp edi, ecx 4141 00014684 7302 <1> jnb short ac97_gcd_0 4142 00014686 89F9 <1> mov ecx, edi 4143 <1> ;;; 4144 <1> 4145 <1> ac97_gcd_0: 4146 00014688 66BA1400 <1> mov dx, PO_CIV_REG ; Position In Current Buff Reg 4147 0001468C 660315[EA880100] <1> add dx, [NABMBAR] 4148 00014693 EC <1> in al, dx ; current index value 4149 00014694 A801 <1> test al, 1 4150 00014696 7402 <1> jz short ac97_gcd_1 4151 00014698 01FE <1> add esi, edi 4152 <1> ac97_gcd_1: 4153 0001469A 31C0 <1> xor eax, eax 4154 0001469C 66BA1800 <1> mov dx, PO_PICB_REG ; Position In Current Buff Reg 4155 000146A0 660315[EA880100] <1> add dx, [NABMBAR] 4156 <1> ;in ax, dx ; remain dwords 4157 <1> ;shl eax, 2 ; remain bytes ; 23/06/2017 4158 <1> ;;; 4159 <1> ; 04/06/2024 4160 000146A7 66ED <1> in ax, dx ; remain words 4161 000146A9 D1E0 <1> shl eax, 1 ; remain bytes 4162 <1> ;;; 4163 000146AB EBBE <1> jmp short ac97_gcd_2 4164 <1> ; cmp eax, ecx 4165 <1> ; jnb short ac97_gcd_2 4166 <1> ; ; remain count < graphics bytes 4167 <1> ; mov eax, ecx ; fix remain count to data size 4168 <1> ;ac97_gcd_2: 4169 <1> ; sub edi, eax 4170 <1> ; jna short ac97_gcd_3 4171 <1> ; add esi, edi ; dma buffer offset 4172 <1> ;ac97_gcd_3: 4173 <1> ; mov edi, ebx ; buffer address (for graphics) 4174 <1> ; mov [u.r0], ecx 4175 <1> ; rep movsb 4176 <1> ; retn 4177 <1> 4178 <1> sb16_get_dma_buff_off: 4179 <1> ; 05/06/2024 4180 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 4181 <1> ; 28/10/2017 4182 <1> ; 24/06/2017 4183 <1> ; 22/06/2017 4184 <1> ; get current (PCM OUT DMA buffer) pointer 4185 <1> ; (for Sound Blaster 16) 4186 <1> 4187 <1> ;mov ecx, [audio_dmabuff_size] 4188 <1> ;xor ebx, ebx 4189 <1> ;shr ecx, 1 4190 <1> 4191 <1> ;;; 4192 <1> ; 04/06/2024 4193 <1> ; ecx = audio buffer size 4194 <1> ; 05/06/2024 4195 <1> ; ecx = DMA half buffer size 4196 000146AD D1E1 <1> shl ecx, 1 ; * 2 4197 <1> ; ecx = DMA buffer size 4198 <1> ;;; 4199 <1> 4200 <1> sb16_gdmabo_0: 4201 <1> ; 28/10/2017 4202 000146AF 803D[18890100]10 <1> cmp byte [audio_bps], 16 4203 000146B6 750F <1> jne short sb16_gdmabo_1 ; 8 bit DMA channel 4204 <1> ; 16 bit DMA channel 4205 000146B8 E4C6 <1> in al, 0C6h ; DMA channel 5 count register 4206 000146BA 88C2 <1> mov dl, al 4207 000146BC E4C6 <1> in al, 0C6h 4208 000146BE 88C6 <1> mov dh, al 4209 000146C0 0FB7C2 <1> movzx eax, dx 4210 000146C3 D1E0 <1> shl eax, 1 ; word count -> byte count 4211 000146C5 EB3A <1> jmp short sb16_gdmabo_2 4212 <1> sb16_gdmabo_1: 4213 000146C7 E403 <1> in al, 03h ; DMA channel 1 count register 4214 000146C9 88C2 <1> mov dl, al 4215 000146CB E403 <1> in al, 03h 4216 000146CD 88C6 <1> mov dh, al 4217 000146CF 0FB7C2 <1> movzx eax, dx 4218 000146D2 EB2D <1> jmp short sb16_gdmabo_2 4219 <1> 4220 <1> get_dma_buffer_offset: 4221 <1> ; 05/06/2024 4222 <1> ; 04/06/2024 4223 <1> ; 24/06/2017 4224 <1> ; 22/06/2017 4225 <1> ; get current sound (PCM out) data for graphics 4226 <1> ; 4227 <1> ; ebx = Physical address (on page boundary) 4228 <1> ; ecx = Byte count 4229 <1> ; [audio_buff_size] 4230 <1> 4231 <1> ;mov ecx, [audio_dmabuff_size] 4232 <1> ;;; 4233 <1> ; 04/06/2024 4234 <1> ;mov ecx, [audio_buff_size] 4235 <1> ; 05/06/2024 4236 000146D4 8B0D[0C890100] <1> mov ecx, [dma_hbuff_size] 4237 <1> ;;; 4238 000146DA 31DB <1> xor ebx, ebx 4239 <1> gdmabo_0: 4240 000146DC 803D[E5880100]02 <1> cmp byte [audio_device], 2 4241 000146E3 72C8 <1> jb short sb16_get_dma_buff_off 4242 000146E5 7427 <1> je short ac97_get_dma_buff_off 4243 <1> 4244 <1> vt8233_get_dma_buff_off: 4245 <1> ; 05/06/2024 4246 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 4247 <1> ; 06/08/2022 - TRDOS 386 v2.0.5 4248 <1> ; 24/06/2017 4249 <1> ; 22/06/2017 4250 <1> ; get current (PCM OUT DMA buffer) pointer 4251 <1> ; (for VT 8233, VT 8237R) 4252 <1> 4253 <1> ;mov ecx, [audio_dmabuff_size] 4254 <1> ;xor ebx, ebx 4255 <1> ;;; 4256 <1> ; 04/06/2024 4257 <1> ;shr ecx, 1 4258 <1> ; 05/06/2024 4259 <1> ;and cl, ~1 4260 <1> ; ecx = DMA Half Buffer Size (word aligned) 4261 <1> ;;; 4262 <1> vt8233_gdmabo_0: 4263 <1> ;mov edx, VIA_REG_OFFSET_CURR_COUNT 4264 <1> ; 06/08/2022 4265 000146E7 31D2 <1> xor edx, edx 4266 000146E9 B20C <1> mov dl, VIA_REG_OFFSET_CURR_COUNT 4267 000146EB E8E1F4FFFF <1> call ctrl_io_r32 4268 000146F0 89C2 <1> mov edx, eax ; remain count (bits 23-0), 4269 <1> ; SGD index (bits 31-24) 4270 000146F2 81E200000001 <1> and edx, 1000000h ; SGD index (0 = 1st half) 4271 000146F8 7402 <1> jz short vt8233_gdmabo_1 4272 <1> ; the second half of DMA buffer 4273 000146FA 89CB <1> mov ebx, ecx 4274 <1> vt8233_gdmabo_1: 4275 000146FC 25FFFFFF00 <1> and eax, 0FFFFFFh ; bits 23-0 4276 <1> sb16_gdmabo_2: 4277 <1> ac97_gdmabo_2: 4278 00014701 29C1 <1> sub ecx, eax 4279 00014703 7602 <1> jna short vt8233_gdmabo_2 4280 00014705 01CB <1> add ebx, ecx ; dma buffer offset 4281 <1> vt8233_gdmabo_2: 4282 00014707 891D[6C8E0100] <1> mov [u.r0], ebx 4283 0001470D C3 <1> retn 4284 <1> 4285 <1> ac97_get_dma_buff_off: 4286 <1> ; 06/06/2024 4287 <1> ; 05/06/2024 4288 <1> ; 04/06/2024 - TRDOS 386 v2.0.8 4289 <1> ; 24/06/2017 4290 <1> ; 22/06/2017 4291 <1> ; get current (PCM OUT DMA buffer) pointer 4292 <1> ; (for AC'97, ICH) 4293 <1> ; ebx = Physical address (on page boundary) 4294 <1> ; ecx = Byte count 4295 <1> ; [audio_buff_size] 4296 <1> 4297 <1> ;mov ecx, [audio_dmabuff_size] 4298 <1> ;xor ebx, ebx 4299 <1> ;;; 4300 <1> ; 04/06/2024 4301 <1> ;shr ecx, 1 4302 <1> ; 05/06/2024 4303 <1> ;and cl, ~7 ; (truncate bytes if out of 8x) 4304 <1> ; ecx = DMA Half Buffer Size (8 byte aligned) 4305 <1> ;;; 4306 <1> ac97_gdmabo_0: 4307 0001470E 66BA1400 <1> mov dx, PO_CIV_REG ; Position In Current Buff Reg 4308 00014712 660315[EA880100] <1> add dx, [NABMBAR] 4309 00014719 EC <1> in al, dx ; current index value 4310 0001471A A801 <1> test al, 1 4311 0001471C 7402 <1> jz short ac97_gdmabo_1 4312 0001471E 89CB <1> mov ebx, ecx 4313 <1> ac97_gdmabo_1: 4314 00014720 31C0 <1> xor eax, eax 4315 00014722 66BA1800 <1> mov dx, PO_PICB_REG ; Position In Current Buff Reg 4316 00014726 660315[EA880100] <1> add dx, [NABMBAR] 4317 0001472D 66ED <1> in ax, dx ; remain words (samples) 4318 <1> ;;; 4319 <1> ; 06/06/2024 4320 <1> ; audio samples are counted as words 4321 <1> ; 04/06/2024 (BugFix) 4322 0001472F D1E0 <1> shl eax, 1 ; remain bytes 4323 <1> ;;; 4324 00014731 EBCE <1> jmp short ac97_gdmabo_2 4325 <1> 4326 <1> ac97_codec_info: 4327 <1> ; 06/06/2024 4328 <1> ; 05/06/2024 - TRDOS 386 v2.0.8 4329 <1> ; 19/11/2023 4330 <1> ; ENTRY: none 4331 <1> ; RETURN: 4332 <1> ; eax = Extended Audio ID (MX28) in ax 4333 <1> ; ax bit 0 - VRA bit 4334 <1> ; hw of eax = PCM output sample rate (48000) 4335 <1> ; ebx = VENDOR ID 1, VENDOR ID 2 (bx) 4336 <1> ; cf = 1 -> error 4337 <1> 4338 <1> ; 06/06/2024 4339 <1> ;;; 4340 00014733 66BA3000 <1> mov dx, GLOB_STS_REG ; 30h 4341 00014737 660315[EA880100] <1> add dx, [NABMBAR] 4342 0001473E ED <1> in eax, dx 4343 <1> 4344 <1> ;cmp eax, 0FFFFFFFFh ; -1 4345 0001473F 40 <1> inc eax 4346 00014740 7408 <1> jz short ac97_c_inf_err 4347 00014742 48 <1> dec eax 4348 <1> 4349 00014743 2500030010 <1> and eax, CTRL_ST_CREADY 4350 00014748 7502 <1> jnz short ac97_c_inf_1 4351 <1> 4352 <1> ac97_c_inf_err: 4353 0001474A F9 <1> stc 4354 0001474B C3 <1> retn 4355 <1> ;;; 4356 <1> 4357 <1> ac97_c_inf_1: 4358 0001474C 668B15[E8880100] <1> mov dx, [NAMBAR] 4359 00014753 6683C22C <1> add dx, CODEC_PCM_FRONT_DACRATE_REG 4360 00014757 66ED <1> in ax, dx ; PCM Output Sample Rate 4361 <1> ; 48000 Hz 4362 00014759 C1E010 <1> shl eax, 16 4363 0001475C E810F4FFFF <1> call delay_100ms 4364 00014761 668B15[E8880100] <1> mov dx, [NAMBAR] 4365 00014768 6683C228 <1> add dx, CODEC_EXT_AUDIO_REG ; 28h 4366 0001476C 66ED <1> in ax, dx 4367 0001476E 50 <1> push eax 4368 0001476F E8FDF3FFFF <1> call delay_100ms 4369 00014774 668B15[E8880100] <1> mov dx, [NAMBAR] 4370 0001477B 6683C27C <1> add dx, CODEC_VENDOR_ID1 4371 0001477F 66ED <1> in ax, dx 4372 00014781 C1E010 <1> shl eax, 16 4373 00014784 668B15[E8880100] <1> mov dx, [NAMBAR] 4374 0001478B 6683C27E <1> add dx, CODEC_VENDOR_ID2 4375 0001478F 66ED <1> in ax, dx 4376 00014791 89C3 <1> mov ebx, eax 4377 00014793 58 <1> pop eax 4378 <1> ;;;; 4379 <1> ; 06/06/2024 (temporary!?) 4380 <1> ; (ALC850 & ALC655 BugFix) 4381 00014794 83FBFF <1> cmp ebx, 0FFFFFFFFh ; -1 4382 00014797 74B1 <1> je short ac97_c_inf_err ; invalid 4383 00014799 09DB <1> or ebx, ebx 4384 0001479B 74AD <1> jz short ac97_c_inf_err ; invalid 4385 0001479D 81FB90474C41 <1> cmp ebx, 414C4790h ; ALC850 4386 <1> ;je short ac97_c_inf_2 4387 <1> ;cmp ebx, 414C4760h ; ALC655 4388 000147A3 7505 <1> jne short ac97_c_inf_3 4389 <1> ;mov eax, 0BB8009C6h ; AC655 default (Read only) 4390 <1> ;retn 4391 <1> ac97_c_inf_2: 4392 <1> ; ref: ALC850 & ALC655 data sheet 4393 000147A5 B8C40980BB <1> mov eax, 0BB8009C4h ; AC850 default (Read only) 4394 <1> ac97_c_inf_3: 4395 <1> ;;;; 4396 000147AA C3 <1> retn 4397 <1> 4398 <1> ; 19/11/2023 4399 <1> ; Valid ICH device IDs 4400 <1> 4401 <1> valid_ids: 4402 000147AB 86801524 <1> dd (ICH_DID << 16) + INTEL_VID ; 8086h:2415h 4403 000147AF 86802524 <1> dd (ICH0_DID << 16) + INTEL_VID ; 8086h:2425h 4404 000147B3 86804524 <1> dd (ICH2_DID << 16) + INTEL_VID ; 8086h:2445h 4405 000147B7 86808524 <1> dd (ICH3_DID << 16) + INTEL_VID ; 8086h:2485h 4406 000147BB 8680C524 <1> dd (ICH4_DID << 16) + INTEL_VID ; 8086h:24C5h 4407 000147BF 8680D524 <1> dd (ICH5_DID << 16) + INTEL_VID ; 8086h:24D5h 4408 000147C3 86806E26 <1> dd (ICH6_DID << 16) + INTEL_VID ; 8086h:266Eh 4409 000147C7 8680A625 <1> dd (ESB6300_DID << 16) + INTEL_VID ; 8086h:25A6h 4410 000147CB 86809826 <1> dd (ESB631X_DID << 16) + INTEL_VID ; 8086h:2698h 4411 000147CF 8680DE27 <1> dd (ICH7_DID << 16) + INTEL_VID ; 8086h:27DEh 4412 000147D3 86809571 <1> dd (MX82440_DID << 16) + INTEL_VID ; 8086h:7195h 4413 000147D7 39101270 <1> dd (SI7012_DID << 16) + SIS_VID ; 1039h:7012h 4414 000147DB DE10B101 <1> dd (NFORCE_DID << 16) + NVIDIA_VID ; 10DEh:01B1h 4415 000147DF DE106A00 <1> dd (NFORCE2_DID << 16) + NVIDIA_VID ; 10DEh:006Ah 4416 000147E3 22106D74 <1> dd (AMD8111_DID << 16) + AMD_VID ; 1022h:746Dh 4417 000147E7 22104574 <1> dd (AMD768_DID << 16) + AMD_VID ; 1022h:7445h 4418 000147EB DE105900 <1> dd (CK804_DID << 16) + NVIDIA_VID ; 10DEh:0059h 4419 000147EF DE103A00 <1> dd (MCP04_DID << 16) + NVIDIA_VID ; 10DEh:003Ah 4420 000147F3 DE108A00 <1> dd (CK8_DID << 16) + NVIDIA_VID ; 1022h:008Ah 4421 000147F7 DE10DA00 <1> dd (NFORCE3_DID << 16) + NVIDIA_VID ; 10DEh:00DAh 4422 000147FB DE10EA00 <1> dd (CK8S_DID << 16) + NVIDIA_VID ; 10DEh:00EAh 4423 <1> 4424 <1> valid_id_count: equ ($ - valid_ids)>>2 ; 19/11/2023 3788 3789 000147FF 90 align 4 3790 3791 %include 'vgadata.s' ; 04/07/2016 1 <1> ; **************************************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.3 - vgadata.s (palette and font data) 3 <1> ; ----------------------------------------------------------------------------- 4 <1> ; Last Update: 01/01/2021 5 <1> ; ----------------------------------------------------------------------------- 6 <1> ; Beginning: 16/01/2016 7 <1> ; ----------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ----------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Plex86/Bochs VGABios' source code, vgabios-0.7a (2011) 14 <1> ; by the LGPL VGABios Developers Team (2001-2008), 'vgatables.h' 15 <1> ; 16 <1> ; Oracle VirtualBox 5.0.24 VGABios Source Code 17 <1> ; ('vgabios.c', 'vgatables.h', 'vgafonts.h', 'vgarom.asm') 18 <1> ; 19 <1> ; Palette and font data in assembly language format: 20 <1> ; 'VBoxVgaBiosAlternative.asm' 21 <1> 22 <1> ; **************************************************************************************************** 23 <1> 24 <1> ; 25/11/2020 (TRDOS 386 v2.0.3) 25 <1> ; ('vgatables.h' - 30/12/2019 - vruppert) 26 <1> 27 <1> ; 04/07/2016 28 <1> ; COLOR DATA 29 <1> 30 <1> palette0: ; (63+1)*3 31 00014800 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 31 00014809 00000000000000 <1> 32 00014810 00000000000000002A- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 32 00014819 2A2A2A2A2A2A2A <1> 33 00014820 2A2A2A2A2A2A2A2A2A- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 33 00014829 2A2A2A2A2A2A2A <1> 34 00014830 2A2A2A2A2A2A2A2A2A- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 34 00014839 2A2A2A2A2A2A2A <1> 35 00014840 2A2A2A2A2A2A2A2A3F- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh 35 00014849 3F3F3F3F3F3F3F <1> 36 00014850 3F3F3F3F3F3F3F3F3F- <1> db 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh 36 00014859 3F3F3F3F3F3F3F <1> 37 00014860 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 37 00014869 00000000000000 <1> 38 00014870 00000000000000002A- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 38 00014879 2A2A2A2A2A2A2A <1> 39 00014880 2A2A2A2A2A2A2A2A2A- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 39 00014889 2A2A2A2A2A2A2A <1> 40 00014890 2A2A2A2A2A2A2A2A2A- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah 40 00014899 2A2A2A2A2A2A2A <1> 41 000148A0 2A2A2A2A2A2A2A2A3F- <1> db 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh 41 000148A9 3F3F3F3F3F3F3F <1> 42 000148B0 3F3F3F3F3F3F3F3F3F- <1> db 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh 42 000148B9 3F3F3F3F3F3F3F <1> 43 <1> palette1: ; (63+1)*3 44 000148C0 00000000002A002A00- <1> db 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah 44 000148C9 002A2A2A00002A <1> 45 000148D0 002A2A15002A2A2A00- <1> db 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah 45 000148D9 000000002A002A <1> 46 000148E0 00002A2A2A00002A00- <1> db 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah, 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah 46 000148E9 2A2A15002A2A2A <1> 47 000148F0 15151515153F153F15- <1> db 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh, 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh 47 000148F9 153F3F3F15153F <1> 48 00014900 153F3F3F153F3F3F15- <1> db 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh 48 00014909 151515153F153F <1> 49 00014910 15153F3F3F15153F15- <1> db 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh 49 00014919 3F3F3F153F3F3F <1> 50 00014920 00000000002A002A00- <1> db 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah 50 00014929 002A2A2A00002A <1> 51 00014930 002A2A15002A2A2A00- <1> db 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah 51 00014939 000000002A002A <1> 52 00014940 00002A2A2A00002A00- <1> db 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah, 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah 52 00014949 2A2A15002A2A2A <1> 53 00014950 15151515153F153F15- <1> db 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh, 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh 53 00014959 153F3F3F15153F <1> 54 00014960 153F3F3F153F3F3F15- <1> db 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh 54 00014969 151515153F153F <1> 55 00014970 15153F3F3F15153F15- <1> db 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh 55 00014979 3F3F3F153F3F3F <1> 56 <1> palette2: ; (63+1)*3 57 00014980 00000000002A002A00- <1> db 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah 57 00014989 002A2A2A00002A <1> 58 00014990 002A2A2A002A2A2A00- <1> db 000h, 02ah, 02ah, 02ah, 000h, 02ah, 02ah, 02ah, 000h, 000h, 015h, 000h, 000h, 03fh, 000h, 02ah 58 00014999 001500003F002A <1> 59 000149A0 15002A3F2A00152A00- <1> db 015h, 000h, 02ah, 03fh, 02ah, 000h, 015h, 02ah, 000h, 03fh, 02ah, 02ah, 015h, 02ah, 02ah, 03fh 59 000149A9 3F2A2A152A2A3F <1> 60 000149B0 00150000152A003F00- <1> db 000h, 015h, 000h, 000h, 015h, 02ah, 000h, 03fh, 000h, 000h, 03fh, 02ah, 02ah, 015h, 000h, 02ah 60 000149B9 003F2A2A15002A <1> 61 000149C0 152A2A3F002A3F2A00- <1> db 015h, 02ah, 02ah, 03fh, 000h, 02ah, 03fh, 02ah, 000h, 015h, 015h, 000h, 015h, 03fh, 000h, 03fh 61 000149C9 151500153F003F <1> 62 000149D0 15003F3F2A15152A15- <1> db 015h, 000h, 03fh, 03fh, 02ah, 015h, 015h, 02ah, 015h, 03fh, 02ah, 03fh, 015h, 02ah, 03fh, 03fh 62 000149D9 3F2A3F152A3F3F <1> 63 000149E0 15000015002A152A00- <1> db 015h, 000h, 000h, 015h, 000h, 02ah, 015h, 02ah, 000h, 015h, 02ah, 02ah, 03fh, 000h, 000h, 03fh 63 000149E9 152A2A3F00003F <1> 64 000149F0 002A3F2A003F2A2A15- <1> db 000h, 02ah, 03fh, 02ah, 000h, 03fh, 02ah, 02ah, 015h, 000h, 015h, 015h, 000h, 03fh, 015h, 02ah 64 000149F9 001515003F152A <1> 65 00014A00 15152A3F3F00153F00- <1> db 015h, 015h, 02ah, 03fh, 03fh, 000h, 015h, 03fh, 000h, 03fh, 03fh, 02ah, 015h, 03fh, 02ah, 03fh 65 00014A09 3F3F2A153F2A3F <1> 66 00014A10 15150015152A153F00- <1> db 015h, 015h, 000h, 015h, 015h, 02ah, 015h, 03fh, 000h, 015h, 03fh, 02ah, 03fh, 015h, 000h, 03fh 66 00014A19 153F2A3F15003F <1> 67 00014A20 152A3F3F003F3F2A15- <1> db 015h, 02ah, 03fh, 03fh, 000h, 03fh, 03fh, 02ah, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh 67 00014A29 151515153F153F <1> 68 00014A30 15153F3F3F15153F15- <1> db 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh 68 00014A39 3F3F3F153F3F3F <1> 69 <1> palette3: ; 256*3 70 00014A40 00000000002A002A00- <1> db 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah 70 00014A49 002A2A2A00002A <1> 71 00014A50 002A2A15002A2A2A15- <1> db 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh 71 00014A59 151515153F153F <1> 72 00014A60 15153F3F3F15153F15- <1> db 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh 72 00014A69 3F3F3F153F3F3F <1> 73 00014A70 000000050505080808- <1> db 000h, 000h, 000h, 005h, 005h, 005h, 008h, 008h, 008h, 00bh, 00bh, 00bh, 00eh, 00eh, 00eh, 011h 73 00014A79 0B0B0B0E0E0E11 <1> 74 00014A80 11111414141818181C- <1> db 011h, 011h, 014h, 014h, 014h, 018h, 018h, 018h, 01ch, 01ch, 01ch, 020h, 020h, 020h, 024h, 024h 74 00014A89 1C1C2020202424 <1> 75 00014A90 242828282D2D2D3232- <1> db 024h, 028h, 028h, 028h, 02dh, 02dh, 02dh, 032h, 032h, 032h, 038h, 038h, 038h, 03fh, 03fh, 03fh 75 00014A99 323838383F3F3F <1> 76 00014AA0 00003F10003F1F003F- <1> db 000h, 000h, 03fh, 010h, 000h, 03fh, 01fh, 000h, 03fh, 02fh, 000h, 03fh, 03fh, 000h, 03fh, 03fh 76 00014AA9 2F003F3F003F3F <1> 77 00014AB0 002F3F001F3F00103F- <1> db 000h, 02fh, 03fh, 000h, 01fh, 03fh, 000h, 010h, 03fh, 000h, 000h, 03fh, 010h, 000h, 03fh, 01fh 77 00014AB9 00003F10003F1F <1> 78 00014AC0 003F2F003F3F002F3F- <1> db 000h, 03fh, 02fh, 000h, 03fh, 03fh, 000h, 02fh, 03fh, 000h, 01fh, 03fh, 000h, 010h, 03fh, 000h 78 00014AC9 001F3F00103F00 <1> 79 00014AD0 003F00003F10003F1F- <1> db 000h, 03fh, 000h, 000h, 03fh, 010h, 000h, 03fh, 01fh, 000h, 03fh, 02fh, 000h, 03fh, 03fh, 000h 79 00014AD9 003F2F003F3F00 <1> 80 00014AE0 2F3F001F3F00103F1F- <1> db 02fh, 03fh, 000h, 01fh, 03fh, 000h, 010h, 03fh, 01fh, 01fh, 03fh, 027h, 01fh, 03fh, 02fh, 01fh 80 00014AE9 1F3F271F3F2F1F <1> 81 00014AF0 3F371F3F3F1F3F3F1F- <1> db 03fh, 037h, 01fh, 03fh, 03fh, 01fh, 03fh, 03fh, 01fh, 037h, 03fh, 01fh, 02fh, 03fh, 01fh, 027h 81 00014AF9 373F1F2F3F1F27 <1> 82 00014B00 3F1F1F3F271F3F2F1F- <1> db 03fh, 01fh, 01fh, 03fh, 027h, 01fh, 03fh, 02fh, 01fh, 03fh, 037h, 01fh, 03fh, 03fh, 01fh, 037h 82 00014B09 3F371F3F3F1F37 <1> 83 00014B10 3F1F2F3F1F273F1F1F- <1> db 03fh, 01fh, 02fh, 03fh, 01fh, 027h, 03fh, 01fh, 01fh, 03fh, 01fh, 01fh, 03fh, 027h, 01fh, 03fh 83 00014B19 3F1F1F3F271F3F <1> 84 00014B20 2F1F3F371F3F3F1F37- <1> db 02fh, 01fh, 03fh, 037h, 01fh, 03fh, 03fh, 01fh, 037h, 03fh, 01fh, 02fh, 03fh, 01fh, 027h, 03fh 84 00014B29 3F1F2F3F1F273F <1> 85 00014B30 2D2D3F312D3F362D3F- <1> db 02dh, 02dh, 03fh, 031h, 02dh, 03fh, 036h, 02dh, 03fh, 03ah, 02dh, 03fh, 03fh, 02dh, 03fh, 03fh 85 00014B39 3A2D3F3F2D3F3F <1> 86 00014B40 2D3A3F2D363F2D313F- <1> db 02dh, 03ah, 03fh, 02dh, 036h, 03fh, 02dh, 031h, 03fh, 02dh, 02dh, 03fh, 031h, 02dh, 03fh, 036h 86 00014B49 2D2D3F312D3F36 <1> 87 00014B50 2D3F3A2D3F3F2D3A3F- <1> db 02dh, 03fh, 03ah, 02dh, 03fh, 03fh, 02dh, 03ah, 03fh, 02dh, 036h, 03fh, 02dh, 031h, 03fh, 02dh 87 00014B59 2D363F2D313F2D <1> 88 00014B60 2D3F2D2D3F312D3F36- <1> db 02dh, 03fh, 02dh, 02dh, 03fh, 031h, 02dh, 03fh, 036h, 02dh, 03fh, 03ah, 02dh, 03fh, 03fh, 02dh 88 00014B69 2D3F3A2D3F3F2D <1> 89 00014B70 3A3F2D363F2D313F00- <1> db 03ah, 03fh, 02dh, 036h, 03fh, 02dh, 031h, 03fh, 000h, 000h, 01ch, 007h, 000h, 01ch, 00eh, 000h 89 00014B79 001C07001C0E00 <1> 90 00014B80 1C15001C1C001C1C00- <1> db 01ch, 015h, 000h, 01ch, 01ch, 000h, 01ch, 01ch, 000h, 015h, 01ch, 000h, 00eh, 01ch, 000h, 007h 90 00014B89 151C000E1C0007 <1> 91 00014B90 1C00001C07001C0E00- <1> db 01ch, 000h, 000h, 01ch, 007h, 000h, 01ch, 00eh, 000h, 01ch, 015h, 000h, 01ch, 01ch, 000h, 015h 91 00014B99 1C15001C1C0015 <1> 92 00014BA0 1C000E1C00071C0000- <1> db 01ch, 000h, 00eh, 01ch, 000h, 007h, 01ch, 000h, 000h, 01ch, 000h, 000h, 01ch, 007h, 000h, 01ch 92 00014BA9 1C00001C07001C <1> 93 00014BB0 0E001C15001C1C0015- <1> db 00eh, 000h, 01ch, 015h, 000h, 01ch, 01ch, 000h, 015h, 01ch, 000h, 00eh, 01ch, 000h, 007h, 01ch 93 00014BB9 1C000E1C00071C <1> 94 00014BC0 0E0E1C110E1C150E1C- <1> db 00eh, 00eh, 01ch, 011h, 00eh, 01ch, 015h, 00eh, 01ch, 018h, 00eh, 01ch, 01ch, 00eh, 01ch, 01ch 94 00014BC9 180E1C1C0E1C1C <1> 95 00014BD0 0E181C0E151C0E111C- <1> db 00eh, 018h, 01ch, 00eh, 015h, 01ch, 00eh, 011h, 01ch, 00eh, 00eh, 01ch, 011h, 00eh, 01ch, 015h 95 00014BD9 0E0E1C110E1C15 <1> 96 00014BE0 0E1C180E1C1C0E181C- <1> db 00eh, 01ch, 018h, 00eh, 01ch, 01ch, 00eh, 018h, 01ch, 00eh, 015h, 01ch, 00eh, 011h, 01ch, 00eh 96 00014BE9 0E151C0E111C0E <1> 97 00014BF0 0E1C0E0E1C110E1C15- <1> db 00eh, 01ch, 00eh, 00eh, 01ch, 011h, 00eh, 01ch, 015h, 00eh, 01ch, 018h, 00eh, 01ch, 01ch, 00eh 97 00014BF9 0E1C180E1C1C0E <1> 98 00014C00 181C0E151C0E111C14- <1> db 018h, 01ch, 00eh, 015h, 01ch, 00eh, 011h, 01ch, 014h, 014h, 01ch, 016h, 014h, 01ch, 018h, 014h 98 00014C09 141C16141C1814 <1> 99 00014C10 1C1A141C1C141C1C14- <1> db 01ch, 01ah, 014h, 01ch, 01ch, 014h, 01ch, 01ch, 014h, 01ah, 01ch, 014h, 018h, 01ch, 014h, 016h 99 00014C19 1A1C14181C1416 <1> 100 00014C20 1C14141C16141C1814- <1> db 01ch, 014h, 014h, 01ch, 016h, 014h, 01ch, 018h, 014h, 01ch, 01ah, 014h, 01ch, 01ch, 014h, 01ah 100 00014C29 1C1A141C1C141A <1> 101 00014C30 1C14181C14161C1414- <1> db 01ch, 014h, 018h, 01ch, 014h, 016h, 01ch, 014h, 014h, 01ch, 014h, 014h, 01ch, 016h, 014h, 01ch 101 00014C39 1C14141C16141C <1> 102 00014C40 18141C1A141C1C141A- <1> db 018h, 014h, 01ch, 01ah, 014h, 01ch, 01ch, 014h, 01ah, 01ch, 014h, 018h, 01ch, 014h, 016h, 01ch 102 00014C49 1C14181C14161C <1> 103 00014C50 000010040010080010- <1> db 000h, 000h, 010h, 004h, 000h, 010h, 008h, 000h, 010h, 00ch, 000h, 010h, 010h, 000h, 010h, 010h 103 00014C59 0C001010001010 <1> 104 00014C60 000C10000810000410- <1> db 000h, 00ch, 010h, 000h, 008h, 010h, 000h, 004h, 010h, 000h, 000h, 010h, 004h, 000h, 010h, 008h 104 00014C69 00001004001008 <1> 105 00014C70 00100C001010000C10- <1> db 000h, 010h, 00ch, 000h, 010h, 010h, 000h, 00ch, 010h, 000h, 008h, 010h, 000h, 004h, 010h, 000h 105 00014C79 00081000041000 <1> 106 00014C80 001000001004001008- <1> db 000h, 010h, 000h, 000h, 010h, 004h, 000h, 010h, 008h, 000h, 010h, 00ch, 000h, 010h, 010h, 000h 106 00014C89 00100C00101000 <1> 107 00014C90 0C1000081000041008- <1> db 00ch, 010h, 000h, 008h, 010h, 000h, 004h, 010h, 008h, 008h, 010h, 00ah, 008h, 010h, 00ch, 008h 107 00014C99 08100A08100C08 <1> 108 00014CA0 100E08101008101008- <1> db 010h, 00eh, 008h, 010h, 010h, 008h, 010h, 010h, 008h, 00eh, 010h, 008h, 00ch, 010h, 008h, 00ah 108 00014CA9 0E10080C10080A <1> 109 00014CB0 100808100A08100C08- <1> db 010h, 008h, 008h, 010h, 00ah, 008h, 010h, 00ch, 008h, 010h, 00eh, 008h, 010h, 010h, 008h, 00eh 109 00014CB9 100E081010080E <1> 110 00014CC0 10080C10080A100808- <1> db 010h, 008h, 00ch, 010h, 008h, 00ah, 010h, 008h, 008h, 010h, 008h, 008h, 010h, 00ah, 008h, 010h 110 00014CC9 100808100A0810 <1> 111 00014CD0 0C08100E081010080E- <1> db 00ch, 008h, 010h, 00eh, 008h, 010h, 010h, 008h, 00eh, 010h, 008h, 00ch, 010h, 008h, 00ah, 010h 111 00014CD9 10080C10080A10 <1> 112 00014CE0 0B0B100C0B100D0B10- <1> db 00bh, 00bh, 010h, 00ch, 00bh, 010h, 00dh, 00bh, 010h, 00fh, 00bh, 010h, 010h, 00bh, 010h, 010h 112 00014CE9 0F0B10100B1010 <1> 113 00014CF0 0B0F100B0D100B0C10- <1> db 00bh, 00fh, 010h, 00bh, 00dh, 010h, 00bh, 00ch, 010h, 00bh, 00bh, 010h, 00ch, 00bh, 010h, 00dh 113 00014CF9 0B0B100C0B100D <1> 114 00014D00 0B100F0B10100B0F10- <1> db 00bh, 010h, 00fh, 00bh, 010h, 010h, 00bh, 00fh, 010h, 00bh, 00dh, 010h, 00bh, 00ch, 010h, 00bh 114 00014D09 0B0D100B0C100B <1> 115 00014D10 0B100B0B100C0B100D- <1> db 00bh, 010h, 00bh, 00bh, 010h, 00ch, 00bh, 010h, 00dh, 00bh, 010h, 00fh, 00bh, 010h, 010h, 00bh 115 00014D19 0B100F0B10100B <1> 116 00014D20 0F100B0D100B0C1000- <1> db 00fh, 010h, 00bh, 00dh, 010h, 00bh, 00ch, 010h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 116 00014D29 00000000000000 <1> 117 00014D30 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 117 00014D39 00000000000000 <1> 118 <1> 119 <1> 120 <1> ; 04/07/2016 121 <1> ; FONT DATA 122 <1> 123 <1> CRT_CHAR_GEN: 124 <1> vgafont8: 125 00014D40 00000000000000007E- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07eh, 081h, 0a5h, 081h, 0bdh, 099h, 081h, 07eh 125 00014D49 81A581BD99817E <1> 126 00014D50 7EFFDBFFC3E7FF7E6C- <1> db 07eh, 0ffh, 0dbh, 0ffh, 0c3h, 0e7h, 0ffh, 07eh, 06ch, 0feh, 0feh, 0feh, 07ch, 038h, 010h, 000h 126 00014D59 FEFEFE7C381000 <1> 127 00014D60 10387CFE7C38100038- <1> db 010h, 038h, 07ch, 0feh, 07ch, 038h, 010h, 000h, 038h, 07ch, 038h, 0feh, 0feh, 07ch, 038h, 07ch 127 00014D69 7C38FEFE7C387C <1> 128 00014D70 1010387CFE7C387C00- <1> db 010h, 010h, 038h, 07ch, 0feh, 07ch, 038h, 07ch, 000h, 000h, 018h, 03ch, 03ch, 018h, 000h, 000h 128 00014D79 00183C3C180000 <1> 129 00014D80 FFFFE7C3C3E7FFFF00- <1> db 0ffh, 0ffh, 0e7h, 0c3h, 0c3h, 0e7h, 0ffh, 0ffh, 000h, 03ch, 066h, 042h, 042h, 066h, 03ch, 000h 129 00014D89 3C664242663C00 <1> 130 00014D90 FFC399BDBD99C3FF0F- <1> db 0ffh, 0c3h, 099h, 0bdh, 0bdh, 099h, 0c3h, 0ffh, 00fh, 007h, 00fh, 07dh, 0cch, 0cch, 0cch, 078h 130 00014D99 070F7DCCCCCC78 <1> 131 00014DA0 3C6666663C187E183F- <1> db 03ch, 066h, 066h, 066h, 03ch, 018h, 07eh, 018h, 03fh, 033h, 03fh, 030h, 030h, 070h, 0f0h, 0e0h 131 00014DA9 333F303070F0E0 <1> 132 00014DB0 7F637F636367E6C099- <1> db 07fh, 063h, 07fh, 063h, 063h, 067h, 0e6h, 0c0h, 099h, 05ah, 03ch, 0e7h, 0e7h, 03ch, 05ah, 099h 132 00014DB9 5A3CE7E73C5A99 <1> 133 00014DC0 80E0F8FEF8E0800002- <1> db 080h, 0e0h, 0f8h, 0feh, 0f8h, 0e0h, 080h, 000h, 002h, 00eh, 03eh, 0feh, 03eh, 00eh, 002h, 000h 133 00014DC9 0E3EFE3E0E0200 <1> 134 00014DD0 183C7E18187E3C1866- <1> db 018h, 03ch, 07eh, 018h, 018h, 07eh, 03ch, 018h, 066h, 066h, 066h, 066h, 066h, 000h, 066h, 000h 134 00014DD9 66666666006600 <1> 135 00014DE0 7FDBDB7B1B1B1B003E- <1> db 07fh, 0dbh, 0dbh, 07bh, 01bh, 01bh, 01bh, 000h, 03eh, 063h, 038h, 06ch, 06ch, 038h, 0cch, 078h 135 00014DE9 63386C6C38CC78 <1> 136 00014DF0 000000007E7E7E0018- <1> db 000h, 000h, 000h, 000h, 07eh, 07eh, 07eh, 000h, 018h, 03ch, 07eh, 018h, 07eh, 03ch, 018h, 0ffh 136 00014DF9 3C7E187E3C18FF <1> 137 00014E00 183C7E181818180018- <1> db 018h, 03ch, 07eh, 018h, 018h, 018h, 018h, 000h, 018h, 018h, 018h, 018h, 07eh, 03ch, 018h, 000h 137 00014E09 1818187E3C1800 <1> 138 00014E10 00180CFE0C18000000- <1> db 000h, 018h, 00ch, 0feh, 00ch, 018h, 000h, 000h, 000h, 030h, 060h, 0feh, 060h, 030h, 000h, 000h 138 00014E19 3060FE60300000 <1> 139 00014E20 0000C0C0C0FE000000- <1> db 000h, 000h, 0c0h, 0c0h, 0c0h, 0feh, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h 139 00014E29 2466FF66240000 <1> 140 00014E30 00183C7EFFFF000000- <1> db 000h, 018h, 03ch, 07eh, 0ffh, 0ffh, 000h, 000h, 000h, 0ffh, 0ffh, 07eh, 03ch, 018h, 000h, 000h 140 00014E39 FFFF7E3C180000 <1> 141 00014E40 000000000000000030- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 030h, 078h, 078h, 030h, 030h, 000h, 030h, 000h 141 00014E49 78783030003000 <1> 142 00014E50 6C6C6C00000000006C- <1> db 06ch, 06ch, 06ch, 000h, 000h, 000h, 000h, 000h, 06ch, 06ch, 0feh, 06ch, 0feh, 06ch, 06ch, 000h 142 00014E59 6CFE6CFE6C6C00 <1> 143 00014E60 307CC0780CF8300000- <1> db 030h, 07ch, 0c0h, 078h, 00ch, 0f8h, 030h, 000h, 000h, 0c6h, 0cch, 018h, 030h, 066h, 0c6h, 000h 143 00014E69 C6CC183066C600 <1> 144 00014E70 386C3876DCCC760060- <1> db 038h, 06ch, 038h, 076h, 0dch, 0cch, 076h, 000h, 060h, 060h, 0c0h, 000h, 000h, 000h, 000h, 000h 144 00014E79 60C00000000000 <1> 145 00014E80 183060606030180060- <1> db 018h, 030h, 060h, 060h, 060h, 030h, 018h, 000h, 060h, 030h, 018h, 018h, 018h, 030h, 060h, 000h 145 00014E89 30181818306000 <1> 146 00014E90 00663CFF3C66000000- <1> db 000h, 066h, 03ch, 0ffh, 03ch, 066h, 000h, 000h, 000h, 030h, 030h, 0fch, 030h, 030h, 000h, 000h 146 00014E99 3030FC30300000 <1> 147 00014EA0 000000000030306000- <1> db 000h, 000h, 000h, 000h, 000h, 030h, 030h, 060h, 000h, 000h, 000h, 0fch, 000h, 000h, 000h, 000h 147 00014EA9 0000FC00000000 <1> 148 00014EB0 000000000030300006- <1> db 000h, 000h, 000h, 000h, 000h, 030h, 030h, 000h, 006h, 00ch, 018h, 030h, 060h, 0c0h, 080h, 000h 148 00014EB9 0C183060C08000 <1> 149 00014EC0 7CC6CEDEF6E67C0030- <1> db 07ch, 0c6h, 0ceh, 0deh, 0f6h, 0e6h, 07ch, 000h, 030h, 070h, 030h, 030h, 030h, 030h, 0fch, 000h 149 00014EC9 7030303030FC00 <1> 150 00014ED0 78CC0C3860CCFC0078- <1> db 078h, 0cch, 00ch, 038h, 060h, 0cch, 0fch, 000h, 078h, 0cch, 00ch, 038h, 00ch, 0cch, 078h, 000h 150 00014ED9 CC0C380CCC7800 <1> 151 00014EE0 1C3C6CCCFE0C1E00FC- <1> db 01ch, 03ch, 06ch, 0cch, 0feh, 00ch, 01eh, 000h, 0fch, 0c0h, 0f8h, 00ch, 00ch, 0cch, 078h, 000h 151 00014EE9 C0F80C0CCC7800 <1> 152 00014EF0 3860C0F8CCCC7800FC- <1> db 038h, 060h, 0c0h, 0f8h, 0cch, 0cch, 078h, 000h, 0fch, 0cch, 00ch, 018h, 030h, 030h, 030h, 000h 152 00014EF9 CC0C1830303000 <1> 153 00014F00 78CCCC78CCCC780078- <1> db 078h, 0cch, 0cch, 078h, 0cch, 0cch, 078h, 000h, 078h, 0cch, 0cch, 07ch, 00ch, 018h, 070h, 000h 153 00014F09 CCCC7C0C187000 <1> 154 00014F10 003030000030300000- <1> db 000h, 030h, 030h, 000h, 000h, 030h, 030h, 000h, 000h, 030h, 030h, 000h, 000h, 030h, 030h, 060h 154 00014F19 30300000303060 <1> 155 00014F20 183060C06030180000- <1> db 018h, 030h, 060h, 0c0h, 060h, 030h, 018h, 000h, 000h, 000h, 0fch, 000h, 000h, 0fch, 000h, 000h 155 00014F29 00FC0000FC0000 <1> 156 00014F30 6030180C1830600078- <1> db 060h, 030h, 018h, 00ch, 018h, 030h, 060h, 000h, 078h, 0cch, 00ch, 018h, 030h, 000h, 030h, 000h 156 00014F39 CC0C1830003000 <1> 157 00014F40 7CC6DEDEDEC0780030- <1> db 07ch, 0c6h, 0deh, 0deh, 0deh, 0c0h, 078h, 000h, 030h, 078h, 0cch, 0cch, 0fch, 0cch, 0cch, 000h 157 00014F49 78CCCCFCCCCC00 <1> 158 00014F50 FC66667C6666FC003C- <1> db 0fch, 066h, 066h, 07ch, 066h, 066h, 0fch, 000h, 03ch, 066h, 0c0h, 0c0h, 0c0h, 066h, 03ch, 000h 158 00014F59 66C0C0C0663C00 <1> 159 00014F60 F86C6666666CF800FE- <1> db 0f8h, 06ch, 066h, 066h, 066h, 06ch, 0f8h, 000h, 0feh, 062h, 068h, 078h, 068h, 062h, 0feh, 000h 159 00014F69 6268786862FE00 <1> 160 00014F70 FE6268786860F0003C- <1> db 0feh, 062h, 068h, 078h, 068h, 060h, 0f0h, 000h, 03ch, 066h, 0c0h, 0c0h, 0ceh, 066h, 03eh, 000h 160 00014F79 66C0C0CE663E00 <1> 161 00014F80 CCCCCCFCCCCCCC0078- <1> db 0cch, 0cch, 0cch, 0fch, 0cch, 0cch, 0cch, 000h, 078h, 030h, 030h, 030h, 030h, 030h, 078h, 000h 161 00014F89 30303030307800 <1> 162 00014F90 1E0C0C0CCCCC7800E6- <1> db 01eh, 00ch, 00ch, 00ch, 0cch, 0cch, 078h, 000h, 0e6h, 066h, 06ch, 078h, 06ch, 066h, 0e6h, 000h 162 00014F99 666C786C66E600 <1> 163 00014FA0 F06060606266FE00C6- <1> db 0f0h, 060h, 060h, 060h, 062h, 066h, 0feh, 000h, 0c6h, 0eeh, 0feh, 0feh, 0d6h, 0c6h, 0c6h, 000h 163 00014FA9 EEFEFED6C6C600 <1> 164 00014FB0 C6E6F6DECEC6C60038- <1> db 0c6h, 0e6h, 0f6h, 0deh, 0ceh, 0c6h, 0c6h, 000h, 038h, 06ch, 0c6h, 0c6h, 0c6h, 06ch, 038h, 000h 164 00014FB9 6CC6C6C66C3800 <1> 165 00014FC0 FC66667C6060F00078- <1> db 0fch, 066h, 066h, 07ch, 060h, 060h, 0f0h, 000h, 078h, 0cch, 0cch, 0cch, 0dch, 078h, 01ch, 000h 165 00014FC9 CCCCCCDC781C00 <1> 166 00014FD0 FC66667C6C66E60078- <1> db 0fch, 066h, 066h, 07ch, 06ch, 066h, 0e6h, 000h, 078h, 0cch, 0e0h, 070h, 01ch, 0cch, 078h, 000h 166 00014FD9 CCE0701CCC7800 <1> 167 00014FE0 FCB4303030307800CC- <1> db 0fch, 0b4h, 030h, 030h, 030h, 030h, 078h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 0fch, 000h 167 00014FE9 CCCCCCCCCCFC00 <1> 168 00014FF0 CCCCCCCCCC783000C6- <1> db 0cch, 0cch, 0cch, 0cch, 0cch, 078h, 030h, 000h, 0c6h, 0c6h, 0c6h, 0d6h, 0feh, 0eeh, 0c6h, 000h 168 00014FF9 C6C6D6FEEEC600 <1> 169 00015000 C6C66C38386CC600CC- <1> db 0c6h, 0c6h, 06ch, 038h, 038h, 06ch, 0c6h, 000h, 0cch, 0cch, 0cch, 078h, 030h, 030h, 078h, 000h 169 00015009 CCCC7830307800 <1> 170 00015010 FEC68C183266FE0078- <1> db 0feh, 0c6h, 08ch, 018h, 032h, 066h, 0feh, 000h, 078h, 060h, 060h, 060h, 060h, 060h, 078h, 000h 170 00015019 60606060607800 <1> 171 00015020 C06030180C06020078- <1> db 0c0h, 060h, 030h, 018h, 00ch, 006h, 002h, 000h, 078h, 018h, 018h, 018h, 018h, 018h, 078h, 000h 171 00015029 18181818187800 <1> 172 00015030 10386CC60000000000- <1> db 010h, 038h, 06ch, 0c6h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh 172 00015039 000000000000FF <1> 173 00015040 303018000000000000- <1> db 030h, 030h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 078h, 00ch, 07ch, 0cch, 076h, 000h 173 00015049 00780C7CCC7600 <1> 174 00015050 E060607C6666DC0000- <1> db 0e0h, 060h, 060h, 07ch, 066h, 066h, 0dch, 000h, 000h, 000h, 078h, 0cch, 0c0h, 0cch, 078h, 000h 174 00015059 0078CCC0CC7800 <1> 175 00015060 1C0C0C7CCCCC760000- <1> db 01ch, 00ch, 00ch, 07ch, 0cch, 0cch, 076h, 000h, 000h, 000h, 078h, 0cch, 0fch, 0c0h, 078h, 000h 175 00015069 0078CCFCC07800 <1> 176 00015070 386C60F06060F00000- <1> db 038h, 06ch, 060h, 0f0h, 060h, 060h, 0f0h, 000h, 000h, 000h, 076h, 0cch, 0cch, 07ch, 00ch, 0f8h 176 00015079 0076CCCC7C0CF8 <1> 177 00015080 E0606C766666E60030- <1> db 0e0h, 060h, 06ch, 076h, 066h, 066h, 0e6h, 000h, 030h, 000h, 070h, 030h, 030h, 030h, 078h, 000h 177 00015089 00703030307800 <1> 178 00015090 0C000C0C0CCCCC78E0- <1> db 00ch, 000h, 00ch, 00ch, 00ch, 0cch, 0cch, 078h, 0e0h, 060h, 066h, 06ch, 078h, 06ch, 0e6h, 000h 178 00015099 60666C786CE600 <1> 179 000150A0 703030303030780000- <1> db 070h, 030h, 030h, 030h, 030h, 030h, 078h, 000h, 000h, 000h, 0cch, 0feh, 0feh, 0d6h, 0c6h, 000h 179 000150A9 00CCFEFED6C600 <1> 180 000150B0 0000F8CCCCCCCC0000- <1> db 000h, 000h, 0f8h, 0cch, 0cch, 0cch, 0cch, 000h, 000h, 000h, 078h, 0cch, 0cch, 0cch, 078h, 000h 180 000150B9 0078CCCCCC7800 <1> 181 000150C0 0000DC66667C60F000- <1> db 000h, 000h, 0dch, 066h, 066h, 07ch, 060h, 0f0h, 000h, 000h, 076h, 0cch, 0cch, 07ch, 00ch, 01eh 181 000150C9 0076CCCC7C0C1E <1> 182 000150D0 0000DC766660F00000- <1> db 000h, 000h, 0dch, 076h, 066h, 060h, 0f0h, 000h, 000h, 000h, 07ch, 0c0h, 078h, 00ch, 0f8h, 000h 182 000150D9 007CC0780CF800 <1> 183 000150E0 10307C303034180000- <1> db 010h, 030h, 07ch, 030h, 030h, 034h, 018h, 000h, 000h, 000h, 0cch, 0cch, 0cch, 0cch, 076h, 000h 183 000150E9 00CCCCCCCC7600 <1> 184 000150F0 0000CCCCCC78300000- <1> db 000h, 000h, 0cch, 0cch, 0cch, 078h, 030h, 000h, 000h, 000h, 0c6h, 0d6h, 0feh, 0feh, 06ch, 000h 184 000150F9 00C6D6FEFE6C00 <1> 185 00015100 0000C66C386CC60000- <1> db 000h, 000h, 0c6h, 06ch, 038h, 06ch, 0c6h, 000h, 000h, 000h, 0cch, 0cch, 0cch, 07ch, 00ch, 0f8h 185 00015109 00CCCCCC7C0CF8 <1> 186 00015110 0000FC983064FC001C- <1> db 000h, 000h, 0fch, 098h, 030h, 064h, 0fch, 000h, 01ch, 030h, 030h, 0e0h, 030h, 030h, 01ch, 000h 186 00015119 3030E030301C00 <1> 187 00015120 1818180018181800E0- <1> db 018h, 018h, 018h, 000h, 018h, 018h, 018h, 000h, 0e0h, 030h, 030h, 01ch, 030h, 030h, 0e0h, 000h 187 00015129 30301C3030E000 <1> 188 00015130 76DC00000000000000- <1> db 076h, 0dch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 000h 188 00015139 10386CC6C6FE00 <1> 189 00015140 78CCC0CC78180C7800- <1> db 078h, 0cch, 0c0h, 0cch, 078h, 018h, 00ch, 078h, 000h, 0cch, 000h, 0cch, 0cch, 0cch, 07eh, 000h 189 00015149 CC00CCCCCC7E00 <1> 190 00015150 1C0078CCFCC078007E- <1> db 01ch, 000h, 078h, 0cch, 0fch, 0c0h, 078h, 000h, 07eh, 0c3h, 03ch, 006h, 03eh, 066h, 03fh, 000h 190 00015159 C33C063E663F00 <1> 191 00015160 CC00780C7CCC7E00E0- <1> db 0cch, 000h, 078h, 00ch, 07ch, 0cch, 07eh, 000h, 0e0h, 000h, 078h, 00ch, 07ch, 0cch, 07eh, 000h 191 00015169 00780C7CCC7E00 <1> 192 00015170 3030780C7CCC7E0000- <1> db 030h, 030h, 078h, 00ch, 07ch, 0cch, 07eh, 000h, 000h, 000h, 078h, 0c0h, 0c0h, 078h, 00ch, 038h 192 00015179 0078C0C0780C38 <1> 193 00015180 7EC33C667E603C00CC- <1> db 07eh, 0c3h, 03ch, 066h, 07eh, 060h, 03ch, 000h, 0cch, 000h, 078h, 0cch, 0fch, 0c0h, 078h, 000h 193 00015189 0078CCFCC07800 <1> 194 00015190 E00078CCFCC07800CC- <1> db 0e0h, 000h, 078h, 0cch, 0fch, 0c0h, 078h, 000h, 0cch, 000h, 070h, 030h, 030h, 030h, 078h, 000h 194 00015199 00703030307800 <1> 195 000151A0 7CC6381818183C00E0- <1> db 07ch, 0c6h, 038h, 018h, 018h, 018h, 03ch, 000h, 0e0h, 000h, 070h, 030h, 030h, 030h, 078h, 000h 195 000151A9 00703030307800 <1> 196 000151B0 C6386CC6FEC6C60030- <1> db 0c6h, 038h, 06ch, 0c6h, 0feh, 0c6h, 0c6h, 000h, 030h, 030h, 000h, 078h, 0cch, 0fch, 0cch, 000h 196 000151B9 300078CCFCCC00 <1> 197 000151C0 1C00FC607860FC0000- <1> db 01ch, 000h, 0fch, 060h, 078h, 060h, 0fch, 000h, 000h, 000h, 07fh, 00ch, 07fh, 0cch, 07fh, 000h 197 000151C9 007F0C7FCC7F00 <1> 198 000151D0 3E6CCCFECCCCCE0078- <1> db 03eh, 06ch, 0cch, 0feh, 0cch, 0cch, 0ceh, 000h, 078h, 0cch, 000h, 078h, 0cch, 0cch, 078h, 000h 198 000151D9 CC0078CCCC7800 <1> 199 000151E0 00CC0078CCCC780000- <1> db 000h, 0cch, 000h, 078h, 0cch, 0cch, 078h, 000h, 000h, 0e0h, 000h, 078h, 0cch, 0cch, 078h, 000h 199 000151E9 E00078CCCC7800 <1> 200 000151F0 78CC00CCCCCC7E0000- <1> db 078h, 0cch, 000h, 0cch, 0cch, 0cch, 07eh, 000h, 000h, 0e0h, 000h, 0cch, 0cch, 0cch, 07eh, 000h 200 000151F9 E000CCCCCC7E00 <1> 201 00015200 00CC00CCCC7C0CF8C3- <1> db 000h, 0cch, 000h, 0cch, 0cch, 07ch, 00ch, 0f8h, 0c3h, 018h, 03ch, 066h, 066h, 03ch, 018h, 000h 201 00015209 183C66663C1800 <1> 202 00015210 CC00CCCCCCCC780018- <1> db 0cch, 000h, 0cch, 0cch, 0cch, 0cch, 078h, 000h, 018h, 018h, 07eh, 0c0h, 0c0h, 07eh, 018h, 018h 202 00015219 187EC0C07E1818 <1> 203 00015220 386C64F060E6FC00CC- <1> db 038h, 06ch, 064h, 0f0h, 060h, 0e6h, 0fch, 000h, 0cch, 0cch, 078h, 0fch, 030h, 0fch, 030h, 030h 203 00015229 CC78FC30FC3030 <1> 204 00015230 F8CCCCFAC6CFC6C70E- <1> db 0f8h, 0cch, 0cch, 0fah, 0c6h, 0cfh, 0c6h, 0c7h, 00eh, 01bh, 018h, 03ch, 018h, 018h, 0d8h, 070h 204 00015239 1B183C1818D870 <1> 205 00015240 1C00780C7CCC7E0038- <1> db 01ch, 000h, 078h, 00ch, 07ch, 0cch, 07eh, 000h, 038h, 000h, 070h, 030h, 030h, 030h, 078h, 000h 205 00015249 00703030307800 <1> 206 00015250 001C0078CCCC780000- <1> db 000h, 01ch, 000h, 078h, 0cch, 0cch, 078h, 000h, 000h, 01ch, 000h, 0cch, 0cch, 0cch, 07eh, 000h 206 00015259 1C00CCCCCC7E00 <1> 207 00015260 00F800F8CCCCCC00FC- <1> db 000h, 0f8h, 000h, 0f8h, 0cch, 0cch, 0cch, 000h, 0fch, 000h, 0cch, 0ech, 0fch, 0dch, 0cch, 000h 207 00015269 00CCECFCDCCC00 <1> 208 00015270 3C6C6C3E007E000038- <1> db 03ch, 06ch, 06ch, 03eh, 000h, 07eh, 000h, 000h, 038h, 06ch, 06ch, 038h, 000h, 07ch, 000h, 000h 208 00015279 6C6C38007C0000 <1> 209 00015280 30003060C0CC780000- <1> db 030h, 000h, 030h, 060h, 0c0h, 0cch, 078h, 000h, 000h, 000h, 000h, 0fch, 0c0h, 0c0h, 000h, 000h 209 00015289 0000FCC0C00000 <1> 210 00015290 000000FC0C0C0000C3- <1> db 000h, 000h, 000h, 0fch, 00ch, 00ch, 000h, 000h, 0c3h, 0c6h, 0cch, 0deh, 033h, 066h, 0cch, 00fh 210 00015299 C6CCDE3366CC0F <1> 211 000152A0 C3C6CCDB376FCF0318- <1> db 0c3h, 0c6h, 0cch, 0dbh, 037h, 06fh, 0cfh, 003h, 018h, 018h, 000h, 018h, 018h, 018h, 018h, 000h 211 000152A9 18001818181800 <1> 212 000152B0 003366CC6633000000- <1> db 000h, 033h, 066h, 0cch, 066h, 033h, 000h, 000h, 000h, 0cch, 066h, 033h, 066h, 0cch, 000h, 000h 212 000152B9 CC663366CC0000 <1> 213 000152C0 228822882288228855- <1> db 022h, 088h, 022h, 088h, 022h, 088h, 022h, 088h, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah 213 000152C9 AA55AA55AA55AA <1> 214 000152D0 DB77DBEEDB77DBEE18- <1> db 0dbh, 077h, 0dbh, 0eeh, 0dbh, 077h, 0dbh, 0eeh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 214 000152D9 18181818181818 <1> 215 000152E0 18181818F818181818- <1> db 018h, 018h, 018h, 018h, 0f8h, 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 0f8h, 018h, 018h, 018h 215 000152E9 18F818F8181818 <1> 216 000152F0 36363636F636363600- <1> db 036h, 036h, 036h, 036h, 0f6h, 036h, 036h, 036h, 000h, 000h, 000h, 000h, 0feh, 036h, 036h, 036h 216 000152F9 000000FE363636 <1> 217 00015300 0000F818F818181836- <1> db 000h, 000h, 0f8h, 018h, 0f8h, 018h, 018h, 018h, 036h, 036h, 0f6h, 006h, 0f6h, 036h, 036h, 036h 217 00015309 36F606F6363636 <1> 218 00015310 363636363636363600- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h, 0feh, 006h, 0f6h, 036h, 036h, 036h 218 00015319 00FE06F6363636 <1> 219 00015320 3636F606FE00000036- <1> db 036h, 036h, 0f6h, 006h, 0feh, 000h, 000h, 000h, 036h, 036h, 036h, 036h, 0feh, 000h, 000h, 000h 219 00015329 363636FE000000 <1> 220 00015330 1818F818F800000000- <1> db 018h, 018h, 0f8h, 018h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0f8h, 018h, 018h, 018h 220 00015339 000000F8181818 <1> 221 00015340 181818181F00000018- <1> db 018h, 018h, 018h, 018h, 01fh, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 0ffh, 000h, 000h, 000h 221 00015349 181818FF000000 <1> 222 00015350 00000000FF18181818- <1> db 000h, 000h, 000h, 000h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 018h, 018h 222 00015359 1818181F181818 <1> 223 00015360 00000000FF00000018- <1> db 000h, 000h, 000h, 000h, 0ffh, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h 223 00015369 181818FF181818 <1> 224 00015370 18181F181F18181836- <1> db 018h, 018h, 01fh, 018h, 01fh, 018h, 018h, 018h, 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h 224 00015379 36363637363636 <1> 225 00015380 363637303F00000000- <1> db 036h, 036h, 037h, 030h, 03fh, 000h, 000h, 000h, 000h, 000h, 03fh, 030h, 037h, 036h, 036h, 036h 225 00015389 003F3037363636 <1> 226 00015390 3636F700FF00000000- <1> db 036h, 036h, 0f7h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0f7h, 036h, 036h, 036h 226 00015399 00FF00F7363636 <1> 227 000153A0 363637303736363600- <1> db 036h, 036h, 037h, 030h, 037h, 036h, 036h, 036h, 000h, 000h, 0ffh, 000h, 0ffh, 000h, 000h, 000h 227 000153A9 00FF00FF000000 <1> 228 000153B0 3636F700F736363618- <1> db 036h, 036h, 0f7h, 000h, 0f7h, 036h, 036h, 036h, 018h, 018h, 0ffh, 000h, 0ffh, 000h, 000h, 000h 228 000153B9 18FF00FF000000 <1> 229 000153C0 36363636FF00000000- <1> db 036h, 036h, 036h, 036h, 0ffh, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0ffh, 018h, 018h, 018h 229 000153C9 00FF00FF181818 <1> 230 000153D0 00000000FF36363636- <1> db 000h, 000h, 000h, 000h, 0ffh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 03fh, 000h, 000h, 000h 230 000153D9 3636363F000000 <1> 231 000153E0 18181F181F00000000- <1> db 018h, 018h, 01fh, 018h, 01fh, 000h, 000h, 000h, 000h, 000h, 01fh, 018h, 01fh, 018h, 018h, 018h 231 000153E9 001F181F181818 <1> 232 000153F0 000000003F36363636- <1> db 000h, 000h, 000h, 000h, 03fh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0ffh, 036h, 036h, 036h 232 000153F9 363636FF363636 <1> 233 00015400 1818FF18FF18181818- <1> db 018h, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0f8h, 000h, 000h, 000h 233 00015409 181818F8000000 <1> 234 00015410 000000001F181818FF- <1> db 000h, 000h, 000h, 000h, 01fh, 018h, 018h, 018h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 234 00015419 FFFFFFFFFFFFFF <1> 235 00015420 00000000FFFFFFFFF0- <1> db 000h, 000h, 000h, 000h, 0ffh, 0ffh, 0ffh, 0ffh, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h 235 00015429 F0F0F0F0F0F0F0 <1> 236 00015430 0F0F0F0F0F0F0F0FFF- <1> db 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h, 000h, 000h 236 00015439 FFFFFF00000000 <1> 237 00015440 000076DCC8DC760000- <1> db 000h, 000h, 076h, 0dch, 0c8h, 0dch, 076h, 000h, 000h, 078h, 0cch, 0f8h, 0cch, 0f8h, 0c0h, 0c0h 237 00015449 78CCF8CCF8C0C0 <1> 238 00015450 00FCCCC0C0C0C00000- <1> db 000h, 0fch, 0cch, 0c0h, 0c0h, 0c0h, 0c0h, 000h, 000h, 0feh, 06ch, 06ch, 06ch, 06ch, 06ch, 000h 238 00015459 FE6C6C6C6C6C00 <1> 239 00015460 FCCC603060CCFC0000- <1> db 0fch, 0cch, 060h, 030h, 060h, 0cch, 0fch, 000h, 000h, 000h, 07eh, 0d8h, 0d8h, 0d8h, 070h, 000h 239 00015469 007ED8D8D87000 <1> 240 00015470 00666666667C60C000- <1> db 000h, 066h, 066h, 066h, 066h, 07ch, 060h, 0c0h, 000h, 076h, 0dch, 018h, 018h, 018h, 018h, 000h 240 00015479 76DC1818181800 <1> 241 00015480 FC3078CCCC7830FC38- <1> db 0fch, 030h, 078h, 0cch, 0cch, 078h, 030h, 0fch, 038h, 06ch, 0c6h, 0feh, 0c6h, 06ch, 038h, 000h 241 00015489 6CC6FEC66C3800 <1> 242 00015490 386CC6C66C6CEE001C- <1> db 038h, 06ch, 0c6h, 0c6h, 06ch, 06ch, 0eeh, 000h, 01ch, 030h, 018h, 07ch, 0cch, 0cch, 078h, 000h 242 00015499 30187CCCCC7800 <1> 243 000154A0 00007EDBDB7E000006- <1> db 000h, 000h, 07eh, 0dbh, 0dbh, 07eh, 000h, 000h, 006h, 00ch, 07eh, 0dbh, 0dbh, 07eh, 060h, 0c0h 243 000154A9 0C7EDBDB7E60C0 <1> 244 000154B0 3860C0F8C060380078- <1> db 038h, 060h, 0c0h, 0f8h, 0c0h, 060h, 038h, 000h, 078h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 000h 244 000154B9 CCCCCCCCCCCC00 <1> 245 000154C0 00FC00FC00FC000030- <1> db 000h, 0fch, 000h, 0fch, 000h, 0fch, 000h, 000h, 030h, 030h, 0fch, 030h, 030h, 000h, 0fch, 000h 245 000154C9 30FC303000FC00 <1> 246 000154D0 603018306000FC0018- <1> db 060h, 030h, 018h, 030h, 060h, 000h, 0fch, 000h, 018h, 030h, 060h, 030h, 018h, 000h, 0fch, 000h 246 000154D9 3060301800FC00 <1> 247 000154E0 0E1B1B181818181818- <1> db 00eh, 01bh, 01bh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0d8h, 0d8h, 070h 247 000154E9 18181818D8D870 <1> 248 000154F0 303000FC0030300000- <1> db 030h, 030h, 000h, 0fch, 000h, 030h, 030h, 000h, 000h, 076h, 0dch, 000h, 076h, 0dch, 000h, 000h 248 000154F9 76DC0076DC0000 <1> 249 00015500 386C6C380000000000- <1> db 038h, 06ch, 06ch, 038h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h 249 00015509 00001818000000 <1> 250 00015510 00000000180000000F- <1> db 000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h, 00fh, 00ch, 00ch, 00ch, 0ech, 06ch, 03ch, 01ch 250 00015519 0C0C0CEC6C3C1C <1> 251 00015520 786C6C6C6C00000070- <1> db 078h, 06ch, 06ch, 06ch, 06ch, 000h, 000h, 000h, 070h, 018h, 030h, 060h, 078h, 000h, 000h, 000h 251 00015529 18306078000000 <1> 252 00015530 00003C3C3C3C000000- <1> db 000h, 000h, 03ch, 03ch, 03ch, 03ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 252 00015539 00000000000000 <1> 253 <1> vgafont14: 254 00015540 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 254 00015549 00000000000000 <1> 255 00015550 7E81A58181BD99817E- <1> db 07eh, 081h, 0a5h, 081h, 081h, 0bdh, 099h, 081h, 07eh, 000h, 000h, 000h, 000h, 000h, 07eh, 0ffh 255 00015559 00000000007EFF <1> 256 00015560 DBFFFFC3E7FF7E0000- <1> db 0dbh, 0ffh, 0ffh, 0c3h, 0e7h, 0ffh, 07eh, 000h, 000h, 000h, 000h, 000h, 000h, 06ch, 0feh, 0feh 256 00015569 000000006CFEFE <1> 257 00015570 FEFE7C381000000000- <1> db 0feh, 0feh, 07ch, 038h, 010h, 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 07ch, 0feh, 07ch 257 00015579 000010387CFE7C <1> 258 00015580 381000000000000018- <1> db 038h, 010h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 03ch, 03ch, 0e7h, 0e7h, 0e7h, 018h, 018h 258 00015589 3C3CE7E7E71818 <1> 259 00015590 3C0000000000183C7E- <1> db 03ch, 000h, 000h, 000h, 000h, 000h, 018h, 03ch, 07eh, 0ffh, 0ffh, 07eh, 018h, 018h, 03ch, 000h 259 00015599 FFFF7E18183C00 <1> 260 000155A0 00000000000000183C- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 03ch, 03ch, 018h, 000h, 000h, 000h, 000h, 000h 260 000155A9 3C180000000000 <1> 261 000155B0 FFFFFFFFFFE7C3C3E7- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0e7h, 0c3h, 0c3h, 0e7h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h 261 000155B9 FFFFFFFFFF0000 <1> 262 000155C0 00003C664242663C00- <1> db 000h, 000h, 03ch, 066h, 042h, 042h, 066h, 03ch, 000h, 000h, 000h, 000h, 0ffh, 0ffh, 0ffh, 0ffh 262 000155C9 000000FFFFFFFF <1> 263 000155D0 C399BDBD99C3FFFFFF- <1> db 0c3h, 099h, 0bdh, 0bdh, 099h, 0c3h, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h, 01eh, 00eh, 01ah, 032h 263 000155D9 FF00001E0E1A32 <1> 264 000155E0 78CCCCCC7800000000- <1> db 078h, 0cch, 0cch, 0cch, 078h, 000h, 000h, 000h, 000h, 000h, 03ch, 066h, 066h, 066h, 03ch, 018h 264 000155E9 003C6666663C18 <1> 265 000155F0 7E181800000000003F- <1> db 07eh, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 03fh, 033h, 03fh, 030h, 030h, 030h, 070h, 0f0h 265 000155F9 333F30303070F0 <1> 266 00015600 E000000000007F637F- <1> db 0e0h, 000h, 000h, 000h, 000h, 000h, 07fh, 063h, 07fh, 063h, 063h, 063h, 067h, 0e7h, 0e6h, 0c0h 266 00015609 63636367E7E6C0 <1> 267 00015610 000000001818DB3CE7- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 0dbh, 03ch, 0e7h, 03ch, 0dbh, 018h, 018h, 000h, 000h, 000h 267 00015619 3CDB1818000000 <1> 268 00015620 000080C0E0F8FEF8E0- <1> db 000h, 000h, 080h, 0c0h, 0e0h, 0f8h, 0feh, 0f8h, 0e0h, 0c0h, 080h, 000h, 000h, 000h, 000h, 000h 268 00015629 C0800000000000 <1> 269 00015630 02060E3EFE3E0E0602- <1> db 002h, 006h, 00eh, 03eh, 0feh, 03eh, 00eh, 006h, 002h, 000h, 000h, 000h, 000h, 000h, 018h, 03ch 269 00015639 0000000000183C <1> 270 00015640 7E1818187E3C180000- <1> db 07eh, 018h, 018h, 018h, 07eh, 03ch, 018h, 000h, 000h, 000h, 000h, 000h, 066h, 066h, 066h, 066h 270 00015649 00000066666666 <1> 271 00015650 666600666600000000- <1> db 066h, 066h, 000h, 066h, 066h, 000h, 000h, 000h, 000h, 000h, 07fh, 0dbh, 0dbh, 0dbh, 07bh, 01bh 271 00015659 007FDBDBDB7B1B <1> 272 00015660 1B1B1B000000007CC6- <1> db 01bh, 01bh, 01bh, 000h, 000h, 000h, 000h, 07ch, 0c6h, 060h, 038h, 06ch, 0c6h, 0c6h, 06ch, 038h 272 00015669 60386CC6C66C38 <1> 273 00015670 0CC67C000000000000- <1> db 00ch, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 0feh, 0feh, 000h 273 00015679 000000FEFEFE00 <1> 274 00015680 00000000183C7E1818- <1> db 000h, 000h, 000h, 000h, 018h, 03ch, 07eh, 018h, 018h, 018h, 07eh, 03ch, 018h, 07eh, 000h, 000h 274 00015689 187E3C187E0000 <1> 275 00015690 0000183C7E18181818- <1> db 000h, 000h, 018h, 03ch, 07eh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 000h 275 00015699 18180000000000 <1> 276 000156A0 1818181818187E3C18- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 07eh, 03ch, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 276 000156A9 00000000000000 <1> 277 000156B0 180CFE0C1800000000- <1> db 018h, 00ch, 0feh, 00ch, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 030h, 060h 277 000156B9 00000000003060 <1> 278 000156C0 FE6030000000000000- <1> db 0feh, 060h, 030h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0c0h, 0c0h, 0c0h 278 000156C9 00000000C0C0C0 <1> 279 000156D0 FE0000000000000000- <1> db 0feh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 028h, 06ch, 0feh, 06ch, 028h, 000h 279 000156D9 00286CFE6C2800 <1> 280 000156E0 000000000000001038- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 038h, 07ch, 07ch, 0feh, 0feh, 000h, 000h 280 000156E9 387C7CFEFE0000 <1> 281 000156F0 0000000000FEFE7C7C- <1> db 000h, 000h, 000h, 000h, 000h, 0feh, 0feh, 07ch, 07ch, 038h, 038h, 010h, 000h, 000h, 000h, 000h 281 000156F9 38381000000000 <1> 282 00015700 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 282 00015709 00000000000000 <1> 283 00015710 183C3C3C1818001818- <1> db 018h, 03ch, 03ch, 03ch, 018h, 018h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 066h, 066h, 066h 283 00015719 00000000666666 <1> 284 00015720 240000000000000000- <1> db 024h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 06ch, 06ch, 0feh, 06ch 284 00015729 0000006C6CFE6C <1> 285 00015730 6C6CFE6C6C00000018- <1> db 06ch, 06ch, 0feh, 06ch, 06ch, 000h, 000h, 000h, 018h, 018h, 07ch, 0c6h, 0c2h, 0c0h, 07ch, 006h 285 00015739 187CC6C2C07C06 <1> 286 00015740 86C67C181800000000- <1> db 086h, 0c6h, 07ch, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 0c2h, 0c6h, 00ch, 018h, 030h, 066h 286 00015749 00C2C60C183066 <1> 287 00015750 C60000000000386C6C- <1> db 0c6h, 000h, 000h, 000h, 000h, 000h, 038h, 06ch, 06ch, 038h, 076h, 0dch, 0cch, 0cch, 076h, 000h 287 00015759 3876DCCCCC7600 <1> 288 00015760 000000303030600000- <1> db 000h, 000h, 000h, 030h, 030h, 030h, 060h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 288 00015769 00000000000000 <1> 289 00015770 00000C183030303030- <1> db 000h, 000h, 00ch, 018h, 030h, 030h, 030h, 030h, 030h, 018h, 00ch, 000h, 000h, 000h, 000h, 000h 289 00015779 180C0000000000 <1> 290 00015780 30180C0C0C0C0C1830- <1> db 030h, 018h, 00ch, 00ch, 00ch, 00ch, 00ch, 018h, 030h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 290 00015789 00000000000000 <1> 291 00015790 663CFF3C6600000000- <1> db 066h, 03ch, 0ffh, 03ch, 066h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h 291 00015799 00000000001818 <1> 292 000157A0 7E1818000000000000- <1> db 07eh, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 292 000157A9 00000000000000 <1> 293 000157B0 181818300000000000- <1> db 018h, 018h, 018h, 030h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 000h, 000h, 000h 293 000157B9 000000FE000000 <1> 294 000157C0 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h 294 000157C9 00000000181800 <1> 295 000157D0 0000000002060C1830- <1> db 000h, 000h, 000h, 000h, 002h, 006h, 00ch, 018h, 030h, 060h, 0c0h, 080h, 000h, 000h, 000h, 000h 295 000157D9 60C08000000000 <1> 296 000157E0 00007CC6CEDEF6E6C6- <1> db 000h, 000h, 07ch, 0c6h, 0ceh, 0deh, 0f6h, 0e6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h 296 000157E9 C67C0000000000 <1> 297 000157F0 18387818181818187E- <1> db 018h, 038h, 078h, 018h, 018h, 018h, 018h, 018h, 07eh, 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h 297 000157F9 00000000007CC6 <1> 298 00015800 060C183060C6FE0000- <1> db 006h, 00ch, 018h, 030h, 060h, 0c6h, 0feh, 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 006h, 006h 298 00015809 0000007CC60606 <1> 299 00015810 3C0606C67C00000000- <1> db 03ch, 006h, 006h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 00ch, 01ch, 03ch, 06ch, 0cch, 0feh 299 00015819 000C1C3C6CCCFE <1> 300 00015820 0C0C1E0000000000FE- <1> db 00ch, 00ch, 01eh, 000h, 000h, 000h, 000h, 000h, 0feh, 0c0h, 0c0h, 0c0h, 0fch, 006h, 006h, 0c6h 300 00015829 C0C0C0FC0606C6 <1> 301 00015830 7C00000000003860C0- <1> db 07ch, 000h, 000h, 000h, 000h, 000h, 038h, 060h, 0c0h, 0c0h, 0fch, 0c6h, 0c6h, 0c6h, 07ch, 000h 301 00015839 C0FCC6C6C67C00 <1> 302 00015840 00000000FEC6060C18- <1> db 000h, 000h, 000h, 000h, 0feh, 0c6h, 006h, 00ch, 018h, 030h, 030h, 030h, 030h, 000h, 000h, 000h 302 00015849 30303030000000 <1> 303 00015850 00007CC6C6C67CC6C6- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 07ch, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h 303 00015859 C67C0000000000 <1> 304 00015860 7CC6C6C67E06060C78- <1> db 07ch, 0c6h, 0c6h, 0c6h, 07eh, 006h, 006h, 00ch, 078h, 000h, 000h, 000h, 000h, 000h, 000h, 018h 304 00015869 00000000000018 <1> 305 00015870 180000001818000000- <1> db 018h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h 305 00015879 00000000181800 <1> 306 00015880 000018183000000000- <1> db 000h, 000h, 018h, 018h, 030h, 000h, 000h, 000h, 000h, 000h, 006h, 00ch, 018h, 030h, 060h, 030h 306 00015889 00060C18306030 <1> 307 00015890 180C06000000000000- <1> db 018h, 00ch, 006h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07eh, 000h, 000h, 07eh, 000h 307 00015899 00007E00007E00 <1> 308 000158A0 000000000000603018- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 060h, 030h, 018h, 00ch, 006h, 00ch, 018h, 030h, 060h, 000h 308 000158A9 0C060C18306000 <1> 309 000158B0 000000007CC6C60C18- <1> db 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 00ch, 018h, 018h, 000h, 018h, 018h, 000h, 000h, 000h 309 000158B9 18001818000000 <1> 310 000158C0 00007CC6C6DEDEDEDC- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0deh, 0deh, 0deh, 0dch, 0c0h, 07ch, 000h, 000h, 000h, 000h, 000h 310 000158C9 C07C0000000000 <1> 311 000158D0 10386CC6C6FEC6C6C6- <1> db 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h, 000h, 0fch, 066h 311 000158D9 0000000000FC66 <1> 312 000158E0 66667C666666FC0000- <1> db 066h, 066h, 07ch, 066h, 066h, 066h, 0fch, 000h, 000h, 000h, 000h, 000h, 03ch, 066h, 0c2h, 0c0h 312 000158E9 0000003C66C2C0 <1> 313 000158F0 C0C0C2663C00000000- <1> db 0c0h, 0c0h, 0c2h, 066h, 03ch, 000h, 000h, 000h, 000h, 000h, 0f8h, 06ch, 066h, 066h, 066h, 066h 313 000158F9 00F86C66666666 <1> 314 00015900 666CF80000000000FE- <1> db 066h, 06ch, 0f8h, 000h, 000h, 000h, 000h, 000h, 0feh, 066h, 062h, 068h, 078h, 068h, 062h, 066h 314 00015909 66626878686266 <1> 315 00015910 FE0000000000FE6662- <1> db 0feh, 000h, 000h, 000h, 000h, 000h, 0feh, 066h, 062h, 068h, 078h, 068h, 060h, 060h, 0f0h, 000h 315 00015919 6878686060F000 <1> 316 00015920 000000003C66C2C0C0- <1> db 000h, 000h, 000h, 000h, 03ch, 066h, 0c2h, 0c0h, 0c0h, 0deh, 0c6h, 066h, 03ah, 000h, 000h, 000h 316 00015929 DEC6663A000000 <1> 317 00015930 0000C6C6C6C6FEC6C6- <1> db 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h, 000h 317 00015939 C6C60000000000 <1> 318 00015940 3C181818181818183C- <1> db 03ch, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 000h, 01eh, 00ch 318 00015949 00000000001E0C <1> 319 00015950 0C0C0C0CCCCC780000- <1> db 00ch, 00ch, 00ch, 00ch, 0cch, 0cch, 078h, 000h, 000h, 000h, 000h, 000h, 0e6h, 066h, 06ch, 06ch 319 00015959 000000E6666C6C <1> 320 00015960 786C6C66E600000000- <1> db 078h, 06ch, 06ch, 066h, 0e6h, 000h, 000h, 000h, 000h, 000h, 0f0h, 060h, 060h, 060h, 060h, 060h 320 00015969 00F06060606060 <1> 321 00015970 6266FE0000000000C6- <1> db 062h, 066h, 0feh, 000h, 000h, 000h, 000h, 000h, 0c6h, 0eeh, 0feh, 0feh, 0d6h, 0c6h, 0c6h, 0c6h 321 00015979 EEFEFED6C6C6C6 <1> 322 00015980 C60000000000C6E6F6- <1> db 0c6h, 000h, 000h, 000h, 000h, 000h, 0c6h, 0e6h, 0f6h, 0feh, 0deh, 0ceh, 0c6h, 0c6h, 0c6h, 000h 322 00015989 FEDECEC6C6C600 <1> 323 00015990 00000000386CC6C6C6- <1> db 000h, 000h, 000h, 000h, 038h, 06ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 06ch, 038h, 000h, 000h, 000h 323 00015999 C6C66C38000000 <1> 324 000159A0 0000FC6666667C6060- <1> db 000h, 000h, 0fch, 066h, 066h, 066h, 07ch, 060h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h, 000h 324 000159A9 60F00000000000 <1> 325 000159B0 7CC6C6C6C6D6DE7C0C- <1> db 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0d6h, 0deh, 07ch, 00ch, 00eh, 000h, 000h, 000h, 000h, 0fch, 066h 325 000159B9 0E00000000FC66 <1> 326 000159C0 66667C6C6666E60000- <1> db 066h, 066h, 07ch, 06ch, 066h, 066h, 0e6h, 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 060h 326 000159C9 0000007CC6C660 <1> 327 000159D0 380CC6C67C00000000- <1> db 038h, 00ch, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 07eh, 07eh, 05ah, 018h, 018h, 018h 327 000159D9 007E7E5A181818 <1> 328 000159E0 18183C0000000000C6- <1> db 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h 328 000159E9 C6C6C6C6C6C6C6 <1> 329 000159F0 7C0000000000C6C6C6- <1> db 07ch, 000h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 06ch, 038h, 010h, 000h 329 000159F9 C6C6C66C381000 <1> 330 00015A00 00000000C6C6C6C6D6- <1> db 000h, 000h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0d6h, 0d6h, 0feh, 07ch, 06ch, 000h, 000h, 000h 330 00015A09 D6FE7C6C000000 <1> 331 00015A10 0000C6C66C3838386C- <1> db 000h, 000h, 0c6h, 0c6h, 06ch, 038h, 038h, 038h, 06ch, 0c6h, 0c6h, 000h, 000h, 000h, 000h, 000h 331 00015A19 C6C60000000000 <1> 332 00015A20 666666663C1818183C- <1> db 066h, 066h, 066h, 066h, 03ch, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 000h, 0feh, 0c6h 332 00015A29 0000000000FEC6 <1> 333 00015A30 8C183060C2C6FE0000- <1> db 08ch, 018h, 030h, 060h, 0c2h, 0c6h, 0feh, 000h, 000h, 000h, 000h, 000h, 03ch, 030h, 030h, 030h 333 00015A39 0000003C303030 <1> 334 00015A40 303030303C00000000- <1> db 030h, 030h, 030h, 030h, 03ch, 000h, 000h, 000h, 000h, 000h, 080h, 0c0h, 0e0h, 070h, 038h, 01ch 334 00015A49 0080C0E070381C <1> 335 00015A50 0E060200000000003C- <1> db 00eh, 006h, 002h, 000h, 000h, 000h, 000h, 000h, 03ch, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch 335 00015A59 0C0C0C0C0C0C0C <1> 336 00015A60 3C00000010386CC600- <1> db 03ch, 000h, 000h, 000h, 010h, 038h, 06ch, 0c6h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 336 00015A69 00000000000000 <1> 337 00015A70 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h 337 00015A79 0000000000FF00 <1> 338 00015A80 303018000000000000- <1> db 030h, 030h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 338 00015A89 00000000000000 <1> 339 00015A90 000000780C7CCCCC76- <1> db 000h, 000h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 000h, 0e0h, 060h 339 00015A99 0000000000E060 <1> 340 00015AA0 60786C6666667C0000- <1> db 060h, 078h, 06ch, 066h, 066h, 066h, 07ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch 340 00015AA9 0000000000007C <1> 341 00015AB0 C6C0C0C67C00000000- <1> db 0c6h, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 01ch, 00ch, 00ch, 03ch, 06ch, 0cch 341 00015AB9 001C0C0C3C6CCC <1> 342 00015AC0 CCCC76000000000000- <1> db 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c6h 342 00015AC9 00007CC6FEC0C6 <1> 343 00015AD0 7C0000000000386C64- <1> db 07ch, 000h, 000h, 000h, 000h, 000h, 038h, 06ch, 064h, 060h, 0f0h, 060h, 060h, 060h, 0f0h, 000h 343 00015AD9 60F0606060F000 <1> 344 00015AE0 0000000000000076CC- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 076h, 0cch, 0cch, 0cch, 07ch, 00ch, 0cch, 078h, 000h 344 00015AE9 CCCC7C0CCC7800 <1> 345 00015AF0 0000E060606C766666- <1> db 000h, 000h, 0e0h, 060h, 060h, 06ch, 076h, 066h, 066h, 066h, 0e6h, 000h, 000h, 000h, 000h, 000h 345 00015AF9 66E60000000000 <1> 346 00015B00 18180038181818183C- <1> db 018h, 018h, 000h, 038h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 000h, 006h, 006h 346 00015B09 00000000000606 <1> 347 00015B10 000E0606060666663C- <1> db 000h, 00eh, 006h, 006h, 006h, 006h, 066h, 066h, 03ch, 000h, 000h, 000h, 0e0h, 060h, 060h, 066h 347 00015B19 000000E0606066 <1> 348 00015B20 6C786C66E600000000- <1> db 06ch, 078h, 06ch, 066h, 0e6h, 000h, 000h, 000h, 000h, 000h, 038h, 018h, 018h, 018h, 018h, 018h 348 00015B29 00381818181818 <1> 349 00015B30 18183C000000000000- <1> db 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ech, 0feh, 0d6h, 0d6h, 0d6h 349 00015B39 0000ECFED6D6D6 <1> 350 00015B40 C60000000000000000- <1> db 0c6h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0dch, 066h, 066h, 066h, 066h, 066h, 000h 350 00015B49 DC666666666600 <1> 351 00015B50 000000000000007CC6- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h 351 00015B59 C6C6C67C000000 <1> 352 00015B60 0000000000DC666666- <1> db 000h, 000h, 000h, 000h, 000h, 0dch, 066h, 066h, 066h, 07ch, 060h, 060h, 0f0h, 000h, 000h, 000h 352 00015B69 7C6060F0000000 <1> 353 00015B70 00000076CCCCCC7C0C- <1> db 000h, 000h, 000h, 076h, 0cch, 0cch, 0cch, 07ch, 00ch, 00ch, 01eh, 000h, 000h, 000h, 000h, 000h 353 00015B79 0C1E0000000000 <1> 354 00015B80 00DC76666060F00000- <1> db 000h, 0dch, 076h, 066h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch 354 00015B89 0000000000007C <1> 355 00015B90 C6701CC67C00000000- <1> db 0c6h, 070h, 01ch, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 010h, 030h, 030h, 0fch, 030h, 030h 355 00015B99 00103030FC3030 <1> 356 00015BA0 30361C000000000000- <1> db 030h, 036h, 01ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch 356 00015BA9 0000CCCCCCCCCC <1> 357 00015BB0 760000000000000000- <1> db 076h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 066h, 066h, 066h, 066h, 03ch, 018h, 000h 357 00015BB9 666666663C1800 <1> 358 00015BC0 00000000000000C6C6- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 0d6h, 0d6h, 0feh, 06ch, 000h, 000h, 000h 358 00015BC9 D6D6FE6C000000 <1> 359 00015BD0 0000000000C66C3838- <1> db 000h, 000h, 000h, 000h, 000h, 0c6h, 06ch, 038h, 038h, 06ch, 0c6h, 000h, 000h, 000h, 000h, 000h 359 00015BD9 6CC60000000000 <1> 360 00015BE0 000000C6C6C6C67E06- <1> db 000h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 07eh, 006h, 00ch, 0f8h, 000h, 000h, 000h, 000h, 000h 360 00015BE9 0CF80000000000 <1> 361 00015BF0 00FECC183066FE0000- <1> db 000h, 0feh, 0cch, 018h, 030h, 066h, 0feh, 000h, 000h, 000h, 000h, 000h, 00eh, 018h, 018h, 018h 361 00015BF9 0000000E181818 <1> 362 00015C00 701818180E00000000- <1> db 070h, 018h, 018h, 018h, 00eh, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 000h, 018h 362 00015C09 00181818180018 <1> 363 00015C10 181818000000000070- <1> db 018h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 070h, 018h, 018h, 018h, 00eh, 018h, 018h, 018h 363 00015C19 1818180E181818 <1> 364 00015C20 70000000000076DC00- <1> db 070h, 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 364 00015C29 00000000000000 <1> 365 00015C30 00000000000010386C- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 000h, 000h, 000h, 000h 365 00015C39 C6C6FE00000000 <1> 366 00015C40 00003C66C2C0C0C266- <1> db 000h, 000h, 03ch, 066h, 0c2h, 0c0h, 0c0h, 0c2h, 066h, 03ch, 00ch, 006h, 07ch, 000h, 000h, 000h 366 00015C49 3C0C067C000000 <1> 367 00015C50 CCCC00CCCCCCCCCC76- <1> db 0cch, 0cch, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 00ch, 018h, 030h 367 00015C59 000000000C1830 <1> 368 00015C60 007CC6FEC0C67C0000- <1> db 000h, 07ch, 0c6h, 0feh, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 000h, 078h 368 00015C69 000010386C0078 <1> 369 00015C70 0C7CCCCC7600000000- <1> db 00ch, 07ch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 000h, 0cch, 0cch, 000h, 078h, 00ch, 07ch 369 00015C79 00CCCC00780C7C <1> 370 00015C80 CCCC76000000006030- <1> db 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 060h, 030h, 018h, 000h, 078h, 00ch, 07ch, 0cch, 0cch 370 00015C89 1800780C7CCCCC <1> 371 00015C90 7600000000386C3800- <1> db 076h, 000h, 000h, 000h, 000h, 038h, 06ch, 038h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 076h, 000h 371 00015C99 780C7CCCCC7600 <1> 372 00015CA0 0000000000003C6660- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 03ch, 066h, 060h, 066h, 03ch, 00ch, 006h, 03ch, 000h, 000h 372 00015CA9 663C0C063C0000 <1> 373 00015CB0 0010386C007CC6FEC0- <1> db 000h, 010h, 038h, 06ch, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h 373 00015CB9 C67C0000000000 <1> 374 00015CC0 CCCC007CC6FEC0C67C- <1> db 0cch, 0cch, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 060h, 030h, 018h 374 00015CC9 00000000603018 <1> 375 00015CD0 007CC6FEC0C67C0000- <1> db 000h, 07ch, 0c6h, 0feh, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 066h, 066h, 000h, 038h 375 00015CD9 00000066660038 <1> 376 00015CE0 181818183C00000000- <1> db 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 018h, 03ch, 066h, 000h, 038h, 018h, 018h 376 00015CE9 183C6600381818 <1> 377 00015CF0 18183C000000006030- <1> db 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 060h, 030h, 018h, 000h, 038h, 018h, 018h, 018h, 018h 377 00015CF9 18003818181818 <1> 378 00015D00 3C00000000C6C61038- <1> db 03ch, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 000h 378 00015D09 6CC6C6FEC6C600 <1> 379 00015D10 0000386C3800386CC6- <1> db 000h, 000h, 038h, 06ch, 038h, 000h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 000h, 000h, 000h 379 00015D19 C6FEC6C6000000 <1> 380 00015D20 18306000FE66607C60- <1> db 018h, 030h, 060h, 000h, 0feh, 066h, 060h, 07ch, 060h, 066h, 0feh, 000h, 000h, 000h, 000h, 000h 380 00015D29 66FE0000000000 <1> 381 00015D30 0000CC76367ED8D86E- <1> db 000h, 000h, 0cch, 076h, 036h, 07eh, 0d8h, 0d8h, 06eh, 000h, 000h, 000h, 000h, 000h, 03eh, 06ch 381 00015D39 00000000003E6C <1> 382 00015D40 CCCCFECCCCCCCE0000- <1> db 0cch, 0cch, 0feh, 0cch, 0cch, 0cch, 0ceh, 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 000h, 07ch 382 00015D49 000010386C007C <1> 383 00015D50 C6C6C6C67C00000000- <1> db 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 000h, 07ch, 0c6h, 0c6h 383 00015D59 00C6C6007CC6C6 <1> 384 00015D60 C6C67C000000006030- <1> db 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 060h, 030h, 018h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h 384 00015D69 18007CC6C6C6C6 <1> 385 00015D70 7C000000003078CC00- <1> db 07ch, 000h, 000h, 000h, 000h, 030h, 078h, 0cch, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h 385 00015D79 CCCCCCCCCC7600 <1> 386 00015D80 00000060301800CCCC- <1> db 000h, 000h, 000h, 060h, 030h, 018h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h 386 00015D89 CCCCCC76000000 <1> 387 00015D90 0000C6C600C6C6C6C6- <1> db 000h, 000h, 0c6h, 0c6h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 07eh, 006h, 00ch, 078h, 000h, 000h, 0c6h 387 00015D99 7E060C780000C6 <1> 388 00015DA0 C6386CC6C6C6C66C38- <1> db 0c6h, 038h, 06ch, 0c6h, 0c6h, 0c6h, 0c6h, 06ch, 038h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 000h 388 00015DA9 00000000C6C600 <1> 389 00015DB0 C6C6C6C6C6C67C0000- <1> db 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 018h, 018h, 03ch, 066h, 060h 389 00015DB9 000018183C6660 <1> 390 00015DC0 60663C181800000000- <1> db 060h, 066h, 03ch, 018h, 018h, 000h, 000h, 000h, 000h, 038h, 06ch, 064h, 060h, 0f0h, 060h, 060h 390 00015DC9 386C6460F06060 <1> 391 00015DD0 60E6FC000000000066- <1> db 060h, 0e6h, 0fch, 000h, 000h, 000h, 000h, 000h, 066h, 066h, 03ch, 018h, 07eh, 018h, 07eh, 018h 391 00015DD9 663C187E187E18 <1> 392 00015DE0 1800000000F8CCCCF8- <1> db 018h, 000h, 000h, 000h, 000h, 0f8h, 0cch, 0cch, 0f8h, 0c4h, 0cch, 0deh, 0cch, 0cch, 0c6h, 000h 392 00015DE9 C4CCDECCCCC600 <1> 393 00015DF0 0000000E1B1818187E- <1> db 000h, 000h, 000h, 00eh, 01bh, 018h, 018h, 018h, 07eh, 018h, 018h, 018h, 018h, 0d8h, 070h, 000h 393 00015DF9 18181818D87000 <1> 394 00015E00 0018306000780C7CCC- <1> db 000h, 018h, 030h, 060h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 00ch 394 00015E09 CC76000000000C <1> 395 00015E10 18300038181818183C- <1> db 018h, 030h, 000h, 038h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 018h, 030h, 060h 395 00015E19 00000000183060 <1> 396 00015E20 007CC6C6C6C67C0000- <1> db 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 018h, 030h, 060h, 000h, 0cch 396 00015E29 000018306000CC <1> 397 00015E30 CCCCCCCC7600000000- <1> db 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 000h, 0dch, 066h, 066h 397 00015E39 0076DC00DC6666 <1> 398 00015E40 66666600000076DC00- <1> db 066h, 066h, 066h, 000h, 000h, 000h, 076h, 0dch, 000h, 0c6h, 0e6h, 0f6h, 0feh, 0deh, 0ceh, 0c6h 398 00015E49 C6E6F6FEDECEC6 <1> 399 00015E50 C6000000003C6C6C3E- <1> db 0c6h, 000h, 000h, 000h, 000h, 03ch, 06ch, 06ch, 03eh, 000h, 07eh, 000h, 000h, 000h, 000h, 000h 399 00015E59 007E0000000000 <1> 400 00015E60 000000386C6C38007C- <1> db 000h, 000h, 000h, 038h, 06ch, 06ch, 038h, 000h, 07ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h 400 00015E69 00000000000000 <1> 401 00015E70 0000303000303060C6- <1> db 000h, 000h, 030h, 030h, 000h, 030h, 030h, 060h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h, 000h 401 00015E79 C67C0000000000 <1> 402 00015E80 00000000FEC0C0C000- <1> db 000h, 000h, 000h, 000h, 0feh, 0c0h, 0c0h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 402 00015E89 00000000000000 <1> 403 00015E90 0000FE060606000000- <1> db 000h, 000h, 0feh, 006h, 006h, 006h, 000h, 000h, 000h, 000h, 000h, 0c0h, 0c0h, 0c6h, 0cch, 0d8h 403 00015E99 0000C0C0C6CCD8 <1> 404 00015EA0 3060DC860C183E0000- <1> db 030h, 060h, 0dch, 086h, 00ch, 018h, 03eh, 000h, 000h, 0c0h, 0c0h, 0c6h, 0cch, 0d8h, 030h, 066h 404 00015EA9 C0C0C6CCD83066 <1> 405 00015EB0 CE9E3E060600000018- <1> db 0ceh, 09eh, 03eh, 006h, 006h, 000h, 000h, 000h, 018h, 018h, 000h, 018h, 018h, 03ch, 03ch, 03ch 405 00015EB9 180018183C3C3C <1> 406 00015EC0 180000000000000036- <1> db 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 036h, 06ch, 0d8h, 06ch, 036h, 000h, 000h, 000h 406 00015EC9 6CD86C36000000 <1> 407 00015ED0 000000000000D86C36- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 0d8h, 06ch, 036h, 06ch, 0d8h, 000h, 000h, 000h, 000h, 000h 407 00015ED9 6CD80000000000 <1> 408 00015EE0 114411441144114411- <1> db 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 055h, 0aah 408 00015EE9 441144114455AA <1> 409 00015EF0 55AA55AA55AA55AA55- <1> db 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 0ddh, 077h, 0ddh, 077h 409 00015EF9 AA55AADD77DD77 <1> 410 00015F00 DD77DD77DD77DD77DD- <1> db 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 018h, 018h, 018h, 018h, 018h, 018h 410 00015F09 77181818181818 <1> 411 00015F10 181818181818181818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0f8h 411 00015F19 181818181818F8 <1> 412 00015F20 181818181818181818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 0f8h, 018h, 018h 412 00015F29 1818F818F81818 <1> 413 00015F30 181818183636363636- <1> db 018h, 018h, 018h, 018h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0f6h, 036h, 036h, 036h, 036h 413 00015F39 3636F636363636 <1> 414 00015F40 363600000000000000- <1> db 036h, 036h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 036h, 036h, 036h, 036h, 036h, 036h 414 00015F49 FE363636363636 <1> 415 00015F50 0000000000F818F818- <1> db 000h, 000h, 000h, 000h, 000h, 0f8h, 018h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h, 036h, 036h 415 00015F59 18181818183636 <1> 416 00015F60 363636F606F6363636- <1> db 036h, 036h, 036h, 0f6h, 006h, 0f6h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 416 00015F69 36363636363636 <1> 417 00015F70 363636363636363636- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h, 000h, 000h, 000h, 0feh 417 00015F79 360000000000FE <1> 418 00015F80 06F636363636363636- <1> db 006h, 0f6h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0f6h, 006h, 0feh 418 00015F89 36363636F606FE <1> 419 00015F90 000000000000363636- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0feh, 000h, 000h 419 00015F99 36363636FE0000 <1> 420 00015FA0 000000001818181818- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 0f8h, 000h, 000h, 000h, 000h 420 00015FA9 F818F800000000 <1> 421 00015FB0 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h 421 00015FB9 F8181818181818 <1> 422 00015FC0 181818181818181F00- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01fh, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h 422 00015FC9 00000000001818 <1> 423 00015FD0 1818181818FF000000- <1> db 018h, 018h, 018h, 018h, 018h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 423 00015FD9 00000000000000 <1> 424 00015FE0 000000FF1818181818- <1> db 000h, 000h, 000h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 424 00015FE9 18181818181818 <1> 425 00015FF0 181F18181818181800- <1> db 018h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh 425 00015FF9 000000000000FF <1> 426 00016000 000000000000181818- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0ffh, 018h, 018h 426 00016009 18181818FF1818 <1> 427 00016010 181818181818181818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 01fh, 018h, 018h, 018h, 018h 427 00016019 1F181F18181818 <1> 428 00016020 181836363636363636- <1> db 018h, 018h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h, 036h, 036h, 036h 428 00016029 37363636363636 <1> 429 00016030 363636363637303F00- <1> db 036h, 036h, 036h, 036h, 036h, 037h, 030h, 03fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 429 00016039 00000000000000 <1> 430 00016040 0000003F3037363636- <1> db 000h, 000h, 000h, 03fh, 030h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 430 00016049 36363636363636 <1> 431 00016050 36F700FF0000000000- <1> db 036h, 0f7h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh 431 00016059 000000000000FF <1> 432 00016060 00F736363636363636- <1> db 000h, 0f7h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 037h, 030h, 037h 432 00016069 36363636373037 <1> 433 00016070 363636363636000000- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0ffh, 000h, 000h 433 00016079 0000FF00FF0000 <1> 434 00016080 000000003636363636- <1> db 000h, 000h, 000h, 000h, 036h, 036h, 036h, 036h, 036h, 0f7h, 000h, 0f7h, 036h, 036h, 036h, 036h 434 00016089 F700F736363636 <1> 435 00016090 36361818181818FF00- <1> db 036h, 036h, 018h, 018h, 018h, 018h, 018h, 0ffh, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h 435 00016099 FF000000000000 <1> 436 000160A0 36363636363636FF00- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 436 000160A9 00000000000000 <1> 437 000160B0 000000FF00FF181818- <1> db 000h, 000h, 000h, 0ffh, 000h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h 437 000160B9 18181800000000 <1> 438 000160C0 000000FF3636363636- <1> db 000h, 000h, 000h, 0ffh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 438 000160C9 36363636363636 <1> 439 000160D0 363F00000000000018- <1> db 036h, 03fh, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 01fh 439 000160D9 181818181F181F <1> 440 000160E0 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 01fh, 018h, 01fh, 018h, 018h 440 000160E9 00001F181F1818 <1> 441 000160F0 181818180000000000- <1> db 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 03fh, 036h, 036h, 036h, 036h 441 000160F9 00003F36363636 <1> 442 00016100 363636363636363636- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0ffh, 036h, 036h, 036h, 036h, 036h, 036h 442 00016109 FF363636363636 <1> 443 00016110 1818181818FF18FF18- <1> db 018h, 018h, 018h, 018h, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 443 00016119 18181818181818 <1> 444 00016120 1818181818F8000000- <1> db 018h, 018h, 018h, 018h, 018h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 444 00016129 00000000000000 <1> 445 00016130 0000001F1818181818- <1> db 000h, 000h, 000h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 445 00016139 18FFFFFFFFFFFF <1> 446 00016140 FFFFFFFFFFFFFFFF00- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh 446 00016149 000000000000FF <1> 447 00016150 FFFFFFFFFFFFF0F0F0- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h 447 00016159 F0F0F0F0F0F0F0 <1> 448 00016160 F0F0F0F00F0F0F0F0F- <1> db 0f0h, 0f0h, 0f0h, 0f0h, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh 448 00016169 0F0F0F0F0F0F0F <1> 449 00016170 0F0FFFFFFFFFFFFFFF- <1> db 00fh, 00fh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h 449 00016179 00000000000000 <1> 450 00016180 000000000076DCD8D8- <1> db 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 0d8h, 0d8h, 0dch, 076h, 000h, 000h, 000h, 000h, 000h 450 00016189 DC760000000000 <1> 451 00016190 00007CC6FCC6C6FCC0- <1> db 000h, 000h, 07ch, 0c6h, 0fch, 0c6h, 0c6h, 0fch, 0c0h, 0c0h, 040h, 000h, 000h, 000h, 0feh, 0c6h 451 00016199 C040000000FEC6 <1> 452 000161A0 C6C0C0C0C0C0C00000- <1> db 0c6h, 0c0h, 0c0h, 0c0h, 0c0h, 0c0h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 06ch 452 000161A9 0000000000FE6C <1> 453 000161B0 6C6C6C6C6C00000000- <1> db 06ch, 06ch, 06ch, 06ch, 06ch, 000h, 000h, 000h, 000h, 000h, 0feh, 0c6h, 060h, 030h, 018h, 030h 453 000161B9 00FEC660301830 <1> 454 000161C0 60C6FE000000000000- <1> db 060h, 0c6h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07eh, 0d8h, 0d8h, 0d8h, 0d8h 454 000161C9 00007ED8D8D8D8 <1> 455 000161D0 700000000000000066- <1> db 070h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 066h, 066h, 066h, 066h, 07ch, 060h, 060h, 0c0h 455 000161D9 6666667C6060C0 <1> 456 000161E0 00000000000076DC18- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h 456 000161E9 18181818000000 <1> 457 000161F0 00007E183C6666663C- <1> db 000h, 000h, 07eh, 018h, 03ch, 066h, 066h, 066h, 03ch, 018h, 07eh, 000h, 000h, 000h, 000h, 000h 457 000161F9 187E0000000000 <1> 458 00016200 386CC6C6FEC6C66C38- <1> db 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 06ch, 038h, 000h, 000h, 000h, 000h, 000h, 038h, 06ch 458 00016209 0000000000386C <1> 459 00016210 C6C6C66C6C6CEE0000- <1> db 0c6h, 0c6h, 0c6h, 06ch, 06ch, 06ch, 0eeh, 000h, 000h, 000h, 000h, 000h, 01eh, 030h, 018h, 00ch 459 00016219 0000001E30180C <1> 460 00016220 3E6666663C00000000- <1> db 03eh, 066h, 066h, 066h, 03ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07eh, 0dbh, 0dbh 460 00016229 000000007EDBDB <1> 461 00016230 7E0000000000000003- <1> db 07eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 003h, 006h, 07eh, 0dbh, 0dbh, 0f3h, 07eh, 060h 461 00016239 067EDBDBF37E60 <1> 462 00016240 C000000000001C3060- <1> db 0c0h, 000h, 000h, 000h, 000h, 000h, 01ch, 030h, 060h, 060h, 07ch, 060h, 060h, 030h, 01ch, 000h 462 00016249 607C6060301C00 <1> 463 00016250 00000000007CC6C6C6- <1> db 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h 463 00016259 C6C6C6C6000000 <1> 464 00016260 000000FE0000FE0000- <1> db 000h, 000h, 000h, 0feh, 000h, 000h, 0feh, 000h, 000h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h 464 00016269 FE000000000000 <1> 465 00016270 0018187E18180000FF- <1> db 000h, 018h, 018h, 07eh, 018h, 018h, 000h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 030h, 018h 465 00016279 00000000003018 <1> 466 00016280 0C060C1830007E0000- <1> db 00ch, 006h, 00ch, 018h, 030h, 000h, 07eh, 000h, 000h, 000h, 000h, 000h, 00ch, 018h, 030h, 060h 466 00016289 0000000C183060 <1> 467 00016290 30180C007E00000000- <1> db 030h, 018h, 00ch, 000h, 07eh, 000h, 000h, 000h, 000h, 000h, 00eh, 01bh, 01bh, 018h, 018h, 018h 467 00016299 000E1B1B181818 <1> 468 000162A0 181818181818181818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0d8h, 0d8h 468 000162A9 1818181818D8D8 <1> 469 000162B0 700000000000001818- <1> db 070h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 07eh, 000h, 018h, 018h, 000h, 000h 469 000162B9 007E0018180000 <1> 470 000162C0 00000000000076DC00- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 000h, 076h, 0dch, 000h, 000h, 000h, 000h, 000h 470 000162C9 76DC0000000000 <1> 471 000162D0 00386C6C3800000000- <1> db 000h, 038h, 06ch, 06ch, 038h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 471 000162D9 00000000000000 <1> 472 000162E0 000000001818000000- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 472 000162E9 00000000000000 <1> 473 000162F0 000000180000000000- <1> db 000h, 000h, 000h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 00fh, 00ch, 00ch, 00ch, 00ch 473 000162F9 00000F0C0C0C0C <1> 474 00016300 0CEC6C3C1C00000000- <1> db 00ch, 0ech, 06ch, 03ch, 01ch, 000h, 000h, 000h, 000h, 0d8h, 06ch, 06ch, 06ch, 06ch, 06ch, 000h 474 00016309 D86C6C6C6C6C00 <1> 475 00016310 0000000000000070D8- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 070h, 0d8h, 030h, 060h, 0c8h, 0f8h, 000h, 000h, 000h 475 00016319 3060C8F8000000 <1> 476 00016320 00000000000000007C- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 000h, 000h 476 00016329 7C7C7C7C7C0000 <1> 477 00016330 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 477 00016339 00000000000000 <1> 478 <1> vgafont16: 479 00016340 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 479 00016349 00000000000000 <1> 480 00016350 00007E81A58181BD99- <1> db 000h, 000h, 07eh, 081h, 0a5h, 081h, 081h, 0bdh, 099h, 081h, 081h, 07eh, 000h, 000h, 000h, 000h 480 00016359 81817E00000000 <1> 481 00016360 00007EFFDBFFFFC3E7- <1> db 000h, 000h, 07eh, 0ffh, 0dbh, 0ffh, 0ffh, 0c3h, 0e7h, 0ffh, 0ffh, 07eh, 000h, 000h, 000h, 000h 481 00016369 FFFF7E00000000 <1> 482 00016370 000000006CFEFEFEFE- <1> db 000h, 000h, 000h, 000h, 06ch, 0feh, 0feh, 0feh, 0feh, 07ch, 038h, 010h, 000h, 000h, 000h, 000h 482 00016379 7C381000000000 <1> 483 00016380 0000000010387CFE7C- <1> db 000h, 000h, 000h, 000h, 010h, 038h, 07ch, 0feh, 07ch, 038h, 010h, 000h, 000h, 000h, 000h, 000h 483 00016389 38100000000000 <1> 484 00016390 000000183C3CE7E7E7- <1> db 000h, 000h, 000h, 018h, 03ch, 03ch, 0e7h, 0e7h, 0e7h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 484 00016399 18183C00000000 <1> 485 000163A0 000000183C7EFFFF7E- <1> db 000h, 000h, 000h, 018h, 03ch, 07eh, 0ffh, 0ffh, 07eh, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 485 000163A9 18183C00000000 <1> 486 000163B0 000000000000183C3C- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 018h, 03ch, 03ch, 018h, 000h, 000h, 000h, 000h, 000h, 000h 486 000163B9 18000000000000 <1> 487 000163C0 FFFFFFFFFFFFE7C3C3- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0e7h, 0c3h, 0c3h, 0e7h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 487 000163C9 E7FFFFFFFFFFFF <1> 488 000163D0 00000000003C664242- <1> db 000h, 000h, 000h, 000h, 000h, 03ch, 066h, 042h, 042h, 066h, 03ch, 000h, 000h, 000h, 000h, 000h 488 000163D9 663C0000000000 <1> 489 000163E0 FFFFFFFFFFC399BDBD- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0c3h, 099h, 0bdh, 0bdh, 099h, 0c3h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 489 000163E9 99C3FFFFFFFFFF <1> 490 000163F0 00001E0E1A3278CCCC- <1> db 000h, 000h, 01eh, 00eh, 01ah, 032h, 078h, 0cch, 0cch, 0cch, 0cch, 078h, 000h, 000h, 000h, 000h 490 000163F9 CCCC7800000000 <1> 491 00016400 00003C666666663C18- <1> db 000h, 000h, 03ch, 066h, 066h, 066h, 066h, 03ch, 018h, 07eh, 018h, 018h, 000h, 000h, 000h, 000h 491 00016409 7E181800000000 <1> 492 00016410 00003F333F30303030- <1> db 000h, 000h, 03fh, 033h, 03fh, 030h, 030h, 030h, 030h, 070h, 0f0h, 0e0h, 000h, 000h, 000h, 000h 492 00016419 70F0E000000000 <1> 493 00016420 00007F637F63636363- <1> db 000h, 000h, 07fh, 063h, 07fh, 063h, 063h, 063h, 063h, 067h, 0e7h, 0e6h, 0c0h, 000h, 000h, 000h 493 00016429 67E7E6C0000000 <1> 494 00016430 0000001818DB3CE73C- <1> db 000h, 000h, 000h, 018h, 018h, 0dbh, 03ch, 0e7h, 03ch, 0dbh, 018h, 018h, 000h, 000h, 000h, 000h 494 00016439 DB181800000000 <1> 495 00016440 0080C0E0F0F8FEF8F0- <1> db 000h, 080h, 0c0h, 0e0h, 0f0h, 0f8h, 0feh, 0f8h, 0f0h, 0e0h, 0c0h, 080h, 000h, 000h, 000h, 000h 495 00016449 E0C08000000000 <1> 496 00016450 0002060E1E3EFE3E1E- <1> db 000h, 002h, 006h, 00eh, 01eh, 03eh, 0feh, 03eh, 01eh, 00eh, 006h, 002h, 000h, 000h, 000h, 000h 496 00016459 0E060200000000 <1> 497 00016460 0000183C7E1818187E- <1> db 000h, 000h, 018h, 03ch, 07eh, 018h, 018h, 018h, 07eh, 03ch, 018h, 000h, 000h, 000h, 000h, 000h 497 00016469 3C180000000000 <1> 498 00016470 000066666666666666- <1> db 000h, 000h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 000h, 066h, 066h, 000h, 000h, 000h, 000h 498 00016479 00666600000000 <1> 499 00016480 00007FDBDBDB7B1B1B- <1> db 000h, 000h, 07fh, 0dbh, 0dbh, 0dbh, 07bh, 01bh, 01bh, 01bh, 01bh, 01bh, 000h, 000h, 000h, 000h 499 00016489 1B1B1B00000000 <1> 500 00016490 007CC660386CC6C66C- <1> db 000h, 07ch, 0c6h, 060h, 038h, 06ch, 0c6h, 0c6h, 06ch, 038h, 00ch, 0c6h, 07ch, 000h, 000h, 000h 500 00016499 380CC67C000000 <1> 501 000164A0 0000000000000000FE- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 0feh, 0feh, 0feh, 000h, 000h, 000h, 000h 501 000164A9 FEFEFE00000000 <1> 502 000164B0 0000183C7E1818187E- <1> db 000h, 000h, 018h, 03ch, 07eh, 018h, 018h, 018h, 07eh, 03ch, 018h, 07eh, 000h, 000h, 000h, 000h 502 000164B9 3C187E00000000 <1> 503 000164C0 0000183C7E18181818- <1> db 000h, 000h, 018h, 03ch, 07eh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h 503 000164C9 18181800000000 <1> 504 000164D0 000018181818181818- <1> db 000h, 000h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 07eh, 03ch, 018h, 000h, 000h, 000h, 000h 504 000164D9 7E3C1800000000 <1> 505 000164E0 0000000000180CFE0C- <1> db 000h, 000h, 000h, 000h, 000h, 018h, 00ch, 0feh, 00ch, 018h, 000h, 000h, 000h, 000h, 000h, 000h 505 000164E9 18000000000000 <1> 506 000164F0 00000000003060FE60- <1> db 000h, 000h, 000h, 000h, 000h, 030h, 060h, 0feh, 060h, 030h, 000h, 000h, 000h, 000h, 000h, 000h 506 000164F9 30000000000000 <1> 507 00016500 000000000000C0C0C0- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 0c0h, 0c0h, 0c0h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h 507 00016509 FE000000000000 <1> 508 00016510 00000000002466FF66- <1> db 000h, 000h, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h, 000h, 000h, 000h, 000h 508 00016519 24000000000000 <1> 509 00016520 000000001038387C7C- <1> db 000h, 000h, 000h, 000h, 010h, 038h, 038h, 07ch, 07ch, 0feh, 0feh, 000h, 000h, 000h, 000h, 000h 509 00016529 FEFE0000000000 <1> 510 00016530 00000000FEFE7C7C38- <1> db 000h, 000h, 000h, 000h, 0feh, 0feh, 07ch, 07ch, 038h, 038h, 010h, 000h, 000h, 000h, 000h, 000h 510 00016539 38100000000000 <1> 511 00016540 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 511 00016549 00000000000000 <1> 512 00016550 0000183C3C3C181818- <1> db 000h, 000h, 018h, 03ch, 03ch, 03ch, 018h, 018h, 018h, 000h, 018h, 018h, 000h, 000h, 000h, 000h 512 00016559 00181800000000 <1> 513 00016560 006666662400000000- <1> db 000h, 066h, 066h, 066h, 024h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 513 00016569 00000000000000 <1> 514 00016570 0000006C6CFE6C6C6C- <1> db 000h, 000h, 000h, 06ch, 06ch, 0feh, 06ch, 06ch, 06ch, 0feh, 06ch, 06ch, 000h, 000h, 000h, 000h 514 00016579 FE6C6C00000000 <1> 515 00016580 18187CC6C2C07C0606- <1> db 018h, 018h, 07ch, 0c6h, 0c2h, 0c0h, 07ch, 006h, 006h, 086h, 0c6h, 07ch, 018h, 018h, 000h, 000h 515 00016589 86C67C18180000 <1> 516 00016590 00000000C2C60C1830- <1> db 000h, 000h, 000h, 000h, 0c2h, 0c6h, 00ch, 018h, 030h, 060h, 0c6h, 086h, 000h, 000h, 000h, 000h 516 00016599 60C68600000000 <1> 517 000165A0 0000386C6C3876DCCC- <1> db 000h, 000h, 038h, 06ch, 06ch, 038h, 076h, 0dch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 517 000165A9 CCCC7600000000 <1> 518 000165B0 003030306000000000- <1> db 000h, 030h, 030h, 030h, 060h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 518 000165B9 00000000000000 <1> 519 000165C0 00000C183030303030- <1> db 000h, 000h, 00ch, 018h, 030h, 030h, 030h, 030h, 030h, 030h, 018h, 00ch, 000h, 000h, 000h, 000h 519 000165C9 30180C00000000 <1> 520 000165D0 000030180C0C0C0C0C- <1> db 000h, 000h, 030h, 018h, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch, 018h, 030h, 000h, 000h, 000h, 000h 520 000165D9 0C183000000000 <1> 521 000165E0 0000000000663CFF3C- <1> db 000h, 000h, 000h, 000h, 000h, 066h, 03ch, 0ffh, 03ch, 066h, 000h, 000h, 000h, 000h, 000h, 000h 521 000165E9 66000000000000 <1> 522 000165F0 000000000018187E18- <1> db 000h, 000h, 000h, 000h, 000h, 018h, 018h, 07eh, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h 522 000165F9 18000000000000 <1> 523 00016600 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 018h, 030h, 000h, 000h, 000h 523 00016609 18181830000000 <1> 524 00016610 00000000000000FE00- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 524 00016619 00000000000000 <1> 525 00016620 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h 525 00016629 00181800000000 <1> 526 00016630 0000000002060C1830- <1> db 000h, 000h, 000h, 000h, 002h, 006h, 00ch, 018h, 030h, 060h, 0c0h, 080h, 000h, 000h, 000h, 000h 526 00016639 60C08000000000 <1> 527 00016640 00003C66C3C3DBDBC3- <1> db 000h, 000h, 03ch, 066h, 0c3h, 0c3h, 0dbh, 0dbh, 0c3h, 0c3h, 066h, 03ch, 000h, 000h, 000h, 000h 527 00016649 C3663C00000000 <1> 528 00016650 000018387818181818- <1> db 000h, 000h, 018h, 038h, 078h, 018h, 018h, 018h, 018h, 018h, 018h, 07eh, 000h, 000h, 000h, 000h 528 00016659 18187E00000000 <1> 529 00016660 00007CC6060C183060- <1> db 000h, 000h, 07ch, 0c6h, 006h, 00ch, 018h, 030h, 060h, 0c0h, 0c6h, 0feh, 000h, 000h, 000h, 000h 529 00016669 C0C6FE00000000 <1> 530 00016670 00007CC606063C0606- <1> db 000h, 000h, 07ch, 0c6h, 006h, 006h, 03ch, 006h, 006h, 006h, 0c6h, 07ch, 000h, 000h, 000h, 000h 530 00016679 06C67C00000000 <1> 531 00016680 00000C1C3C6CCCFE0C- <1> db 000h, 000h, 00ch, 01ch, 03ch, 06ch, 0cch, 0feh, 00ch, 00ch, 00ch, 01eh, 000h, 000h, 000h, 000h 531 00016689 0C0C1E00000000 <1> 532 00016690 0000FEC0C0C0FC0606- <1> db 000h, 000h, 0feh, 0c0h, 0c0h, 0c0h, 0fch, 006h, 006h, 006h, 0c6h, 07ch, 000h, 000h, 000h, 000h 532 00016699 06C67C00000000 <1> 533 000166A0 00003860C0C0FCC6C6- <1> db 000h, 000h, 038h, 060h, 0c0h, 0c0h, 0fch, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 533 000166A9 C6C67C00000000 <1> 534 000166B0 0000FEC606060C1830- <1> db 000h, 000h, 0feh, 0c6h, 006h, 006h, 00ch, 018h, 030h, 030h, 030h, 030h, 000h, 000h, 000h, 000h 534 000166B9 30303000000000 <1> 535 000166C0 00007CC6C6C67CC6C6- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 535 000166C9 C6C67C00000000 <1> 536 000166D0 00007CC6C6C67E0606- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 07eh, 006h, 006h, 006h, 00ch, 078h, 000h, 000h, 000h, 000h 536 000166D9 060C7800000000 <1> 537 000166E0 000000001818000000- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h 537 000166E9 18180000000000 <1> 538 000166F0 000000001818000000- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 018h, 018h, 030h, 000h, 000h, 000h, 000h 538 000166F9 18183000000000 <1> 539 00016700 000000060C18306030- <1> db 000h, 000h, 000h, 006h, 00ch, 018h, 030h, 060h, 030h, 018h, 00ch, 006h, 000h, 000h, 000h, 000h 539 00016709 180C0600000000 <1> 540 00016710 00000000007E00007E- <1> db 000h, 000h, 000h, 000h, 000h, 07eh, 000h, 000h, 07eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h 540 00016719 00000000000000 <1> 541 00016720 0000006030180C060C- <1> db 000h, 000h, 000h, 060h, 030h, 018h, 00ch, 006h, 00ch, 018h, 030h, 060h, 000h, 000h, 000h, 000h 541 00016729 18306000000000 <1> 542 00016730 00007CC6C60C181818- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 00ch, 018h, 018h, 018h, 000h, 018h, 018h, 000h, 000h, 000h, 000h 542 00016739 00181800000000 <1> 543 00016740 0000007CC6C6DEDEDE- <1> db 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 0deh, 0deh, 0deh, 0dch, 0c0h, 07ch, 000h, 000h, 000h, 000h 543 00016749 DCC07C00000000 <1> 544 00016750 000010386CC6C6FEC6- <1> db 000h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 544 00016759 C6C6C600000000 <1> 545 00016760 0000FC6666667C6666- <1> db 000h, 000h, 0fch, 066h, 066h, 066h, 07ch, 066h, 066h, 066h, 066h, 0fch, 000h, 000h, 000h, 000h 545 00016769 6666FC00000000 <1> 546 00016770 00003C66C2C0C0C0C0- <1> db 000h, 000h, 03ch, 066h, 0c2h, 0c0h, 0c0h, 0c0h, 0c0h, 0c2h, 066h, 03ch, 000h, 000h, 000h, 000h 546 00016779 C2663C00000000 <1> 547 00016780 0000F86C6666666666- <1> db 000h, 000h, 0f8h, 06ch, 066h, 066h, 066h, 066h, 066h, 066h, 06ch, 0f8h, 000h, 000h, 000h, 000h 547 00016789 666CF800000000 <1> 548 00016790 0000FE666268786860- <1> db 000h, 000h, 0feh, 066h, 062h, 068h, 078h, 068h, 060h, 062h, 066h, 0feh, 000h, 000h, 000h, 000h 548 00016799 6266FE00000000 <1> 549 000167A0 0000FE666268786860- <1> db 000h, 000h, 0feh, 066h, 062h, 068h, 078h, 068h, 060h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h 549 000167A9 6060F000000000 <1> 550 000167B0 00003C66C2C0C0DEC6- <1> db 000h, 000h, 03ch, 066h, 0c2h, 0c0h, 0c0h, 0deh, 0c6h, 0c6h, 066h, 03ah, 000h, 000h, 000h, 000h 550 000167B9 C6663A00000000 <1> 551 000167C0 0000C6C6C6C6FEC6C6- <1> db 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 551 000167C9 C6C6C600000000 <1> 552 000167D0 00003C181818181818- <1> db 000h, 000h, 03ch, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 552 000167D9 18183C00000000 <1> 553 000167E0 00001E0C0C0C0C0CCC- <1> db 000h, 000h, 01eh, 00ch, 00ch, 00ch, 00ch, 00ch, 0cch, 0cch, 0cch, 078h, 000h, 000h, 000h, 000h 553 000167E9 CCCC7800000000 <1> 554 000167F0 0000E666666C78786C- <1> db 000h, 000h, 0e6h, 066h, 066h, 06ch, 078h, 078h, 06ch, 066h, 066h, 0e6h, 000h, 000h, 000h, 000h 554 000167F9 6666E600000000 <1> 555 00016800 0000F0606060606060- <1> db 000h, 000h, 0f0h, 060h, 060h, 060h, 060h, 060h, 060h, 062h, 066h, 0feh, 000h, 000h, 000h, 000h 555 00016809 6266FE00000000 <1> 556 00016810 0000C3E7FFFFDBC3C3- <1> db 000h, 000h, 0c3h, 0e7h, 0ffh, 0ffh, 0dbh, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 000h, 000h, 000h, 000h 556 00016819 C3C3C300000000 <1> 557 00016820 0000C6E6F6FEDECEC6- <1> db 000h, 000h, 0c6h, 0e6h, 0f6h, 0feh, 0deh, 0ceh, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 557 00016829 C6C6C600000000 <1> 558 00016830 00007CC6C6C6C6C6C6- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 558 00016839 C6C67C00000000 <1> 559 00016840 0000FC6666667C6060- <1> db 000h, 000h, 0fch, 066h, 066h, 066h, 07ch, 060h, 060h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h 559 00016849 6060F000000000 <1> 560 00016850 00007CC6C6C6C6C6C6- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0d6h, 0deh, 07ch, 00ch, 00eh, 000h, 000h 560 00016859 D6DE7C0C0E0000 <1> 561 00016860 0000FC6666667C6C66- <1> db 000h, 000h, 0fch, 066h, 066h, 066h, 07ch, 06ch, 066h, 066h, 066h, 0e6h, 000h, 000h, 000h, 000h 561 00016869 6666E600000000 <1> 562 00016870 00007CC6C660380C06- <1> db 000h, 000h, 07ch, 0c6h, 0c6h, 060h, 038h, 00ch, 006h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 562 00016879 C6C67C00000000 <1> 563 00016880 0000FFDB9918181818- <1> db 000h, 000h, 0ffh, 0dbh, 099h, 018h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 563 00016889 18183C00000000 <1> 564 00016890 0000C6C6C6C6C6C6C6- <1> db 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 564 00016899 C6C67C00000000 <1> 565 000168A0 0000C3C3C3C3C3C3C3- <1> db 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h, 000h, 000h, 000h, 000h 565 000168A9 663C1800000000 <1> 566 000168B0 0000C3C3C3C3C3DBDB- <1> db 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0dbh, 0dbh, 0ffh, 066h, 066h, 000h, 000h, 000h, 000h 566 000168B9 FF666600000000 <1> 567 000168C0 0000C3C3663C18183C- <1> db 000h, 000h, 0c3h, 0c3h, 066h, 03ch, 018h, 018h, 03ch, 066h, 0c3h, 0c3h, 000h, 000h, 000h, 000h 567 000168C9 66C3C300000000 <1> 568 000168D0 0000C3C3C3663C1818- <1> db 000h, 000h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 568 000168D9 18183C00000000 <1> 569 000168E0 0000FFC3860C183060- <1> db 000h, 000h, 0ffh, 0c3h, 086h, 00ch, 018h, 030h, 060h, 0c1h, 0c3h, 0ffh, 000h, 000h, 000h, 000h 569 000168E9 C1C3FF00000000 <1> 570 000168F0 00003C303030303030- <1> db 000h, 000h, 03ch, 030h, 030h, 030h, 030h, 030h, 030h, 030h, 030h, 03ch, 000h, 000h, 000h, 000h 570 000168F9 30303C00000000 <1> 571 00016900 00000080C0E070381C- <1> db 000h, 000h, 000h, 080h, 0c0h, 0e0h, 070h, 038h, 01ch, 00eh, 006h, 002h, 000h, 000h, 000h, 000h 571 00016909 0E060200000000 <1> 572 00016910 00003C0C0C0C0C0C0C- <1> db 000h, 000h, 03ch, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch, 00ch, 03ch, 000h, 000h, 000h, 000h 572 00016919 0C0C3C00000000 <1> 573 00016920 10386CC60000000000- <1> db 010h, 038h, 06ch, 0c6h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 573 00016929 00000000000000 <1> 574 00016930 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 000h 574 00016939 00000000FF0000 <1> 575 00016940 303018000000000000- <1> db 030h, 030h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 575 00016949 00000000000000 <1> 576 00016950 0000000000780C7CCC- <1> db 000h, 000h, 000h, 000h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 576 00016959 CCCC7600000000 <1> 577 00016960 0000E06060786C6666- <1> db 000h, 000h, 0e0h, 060h, 060h, 078h, 06ch, 066h, 066h, 066h, 066h, 07ch, 000h, 000h, 000h, 000h 577 00016969 66667C00000000 <1> 578 00016970 00000000007CC6C0C0- <1> db 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c0h, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 578 00016979 C0C67C00000000 <1> 579 00016980 00001C0C0C3C6CCCCC- <1> db 000h, 000h, 01ch, 00ch, 00ch, 03ch, 06ch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 579 00016989 CCCC7600000000 <1> 580 00016990 00000000007CC6FEC0- <1> db 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 580 00016999 C0C67C00000000 <1> 581 000169A0 0000386C6460F06060- <1> db 000h, 000h, 038h, 06ch, 064h, 060h, 0f0h, 060h, 060h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h 581 000169A9 6060F000000000 <1> 582 000169B0 000000000076CCCCCC- <1> db 000h, 000h, 000h, 000h, 000h, 076h, 0cch, 0cch, 0cch, 0cch, 0cch, 07ch, 00ch, 0cch, 078h, 000h 582 000169B9 CCCC7C0CCC7800 <1> 583 000169C0 0000E060606C766666- <1> db 000h, 000h, 0e0h, 060h, 060h, 06ch, 076h, 066h, 066h, 066h, 066h, 0e6h, 000h, 000h, 000h, 000h 583 000169C9 6666E600000000 <1> 584 000169D0 000018180038181818- <1> db 000h, 000h, 018h, 018h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 584 000169D9 18183C00000000 <1> 585 000169E0 00000606000E060606- <1> db 000h, 000h, 006h, 006h, 000h, 00eh, 006h, 006h, 006h, 006h, 006h, 006h, 066h, 066h, 03ch, 000h 585 000169E9 06060666663C00 <1> 586 000169F0 0000E06060666C7878- <1> db 000h, 000h, 0e0h, 060h, 060h, 066h, 06ch, 078h, 078h, 06ch, 066h, 0e6h, 000h, 000h, 000h, 000h 586 000169F9 6C66E600000000 <1> 587 00016A00 000038181818181818- <1> db 000h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 587 00016A09 18183C00000000 <1> 588 00016A10 0000000000E6FFDBDB- <1> db 000h, 000h, 000h, 000h, 000h, 0e6h, 0ffh, 0dbh, 0dbh, 0dbh, 0dbh, 0dbh, 000h, 000h, 000h, 000h 588 00016A19 DBDBDB00000000 <1> 589 00016A20 0000000000DC666666- <1> db 000h, 000h, 000h, 000h, 000h, 0dch, 066h, 066h, 066h, 066h, 066h, 066h, 000h, 000h, 000h, 000h 589 00016A29 66666600000000 <1> 590 00016A30 00000000007CC6C6C6- <1> db 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 590 00016A39 C6C67C00000000 <1> 591 00016A40 0000000000DC666666- <1> db 000h, 000h, 000h, 000h, 000h, 0dch, 066h, 066h, 066h, 066h, 066h, 07ch, 060h, 060h, 0f0h, 000h 591 00016A49 66667C6060F000 <1> 592 00016A50 000000000076CCCCCC- <1> db 000h, 000h, 000h, 000h, 000h, 076h, 0cch, 0cch, 0cch, 0cch, 0cch, 07ch, 00ch, 00ch, 01eh, 000h 592 00016A59 CCCC7C0C0C1E00 <1> 593 00016A60 0000000000DC766660- <1> db 000h, 000h, 000h, 000h, 000h, 0dch, 076h, 066h, 060h, 060h, 060h, 0f0h, 000h, 000h, 000h, 000h 593 00016A69 6060F000000000 <1> 594 00016A70 00000000007CC66038- <1> db 000h, 000h, 000h, 000h, 000h, 07ch, 0c6h, 060h, 038h, 00ch, 0c6h, 07ch, 000h, 000h, 000h, 000h 594 00016A79 0CC67C00000000 <1> 595 00016A80 0000103030FC303030- <1> db 000h, 000h, 010h, 030h, 030h, 0fch, 030h, 030h, 030h, 030h, 036h, 01ch, 000h, 000h, 000h, 000h 595 00016A89 30361C00000000 <1> 596 00016A90 0000000000CCCCCCCC- <1> db 000h, 000h, 000h, 000h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 596 00016A99 CCCC7600000000 <1> 597 00016AA0 0000000000C3C3C3C3- <1> db 000h, 000h, 000h, 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h, 000h, 000h, 000h, 000h 597 00016AA9 663C1800000000 <1> 598 00016AB0 0000000000C3C3C3DB- <1> db 000h, 000h, 000h, 000h, 000h, 0c3h, 0c3h, 0c3h, 0dbh, 0dbh, 0ffh, 066h, 000h, 000h, 000h, 000h 598 00016AB9 DBFF6600000000 <1> 599 00016AC0 0000000000C3663C18- <1> db 000h, 000h, 000h, 000h, 000h, 0c3h, 066h, 03ch, 018h, 03ch, 066h, 0c3h, 000h, 000h, 000h, 000h 599 00016AC9 3C66C300000000 <1> 600 00016AD0 0000000000C6C6C6C6- <1> db 000h, 000h, 000h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07eh, 006h, 00ch, 0f8h, 000h 600 00016AD9 C6C67E060CF800 <1> 601 00016AE0 0000000000FECC1830- <1> db 000h, 000h, 000h, 000h, 000h, 0feh, 0cch, 018h, 030h, 060h, 0c6h, 0feh, 000h, 000h, 000h, 000h 601 00016AE9 60C6FE00000000 <1> 602 00016AF0 00000E181818701818- <1> db 000h, 000h, 00eh, 018h, 018h, 018h, 070h, 018h, 018h, 018h, 018h, 00eh, 000h, 000h, 000h, 000h 602 00016AF9 18180E00000000 <1> 603 00016B00 000018181818001818- <1> db 000h, 000h, 018h, 018h, 018h, 018h, 000h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h 603 00016B09 18181800000000 <1> 604 00016B10 0000701818180E1818- <1> db 000h, 000h, 070h, 018h, 018h, 018h, 00eh, 018h, 018h, 018h, 018h, 070h, 000h, 000h, 000h, 000h 604 00016B19 18187000000000 <1> 605 00016B20 000076DC0000000000- <1> db 000h, 000h, 076h, 0dch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 605 00016B29 00000000000000 <1> 606 00016B30 0000000010386CC6C6- <1> db 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0c6h, 0feh, 000h, 000h, 000h, 000h, 000h 606 00016B39 C6FE0000000000 <1> 607 00016B40 00003C66C2C0C0C0C2- <1> db 000h, 000h, 03ch, 066h, 0c2h, 0c0h, 0c0h, 0c0h, 0c2h, 066h, 03ch, 00ch, 006h, 07ch, 000h, 000h 607 00016B49 663C0C067C0000 <1> 608 00016B50 0000CC0000CCCCCCCC- <1> db 000h, 000h, 0cch, 000h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 608 00016B59 CCCC7600000000 <1> 609 00016B60 000C1830007CC6FEC0- <1> db 000h, 00ch, 018h, 030h, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 609 00016B69 C0C67C00000000 <1> 610 00016B70 0010386C00780C7CCC- <1> db 000h, 010h, 038h, 06ch, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 610 00016B79 CCCC7600000000 <1> 611 00016B80 0000CC0000780C7CCC- <1> db 000h, 000h, 0cch, 000h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 611 00016B89 CCCC7600000000 <1> 612 00016B90 0060301800780C7CCC- <1> db 000h, 060h, 030h, 018h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 612 00016B99 CCCC7600000000 <1> 613 00016BA0 00386C3800780C7CCC- <1> db 000h, 038h, 06ch, 038h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 613 00016BA9 CCCC7600000000 <1> 614 00016BB0 000000003C66606066- <1> db 000h, 000h, 000h, 000h, 03ch, 066h, 060h, 060h, 066h, 03ch, 00ch, 006h, 03ch, 000h, 000h, 000h 614 00016BB9 3C0C063C000000 <1> 615 00016BC0 0010386C007CC6FEC0- <1> db 000h, 010h, 038h, 06ch, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 615 00016BC9 C0C67C00000000 <1> 616 00016BD0 0000C600007CC6FEC0- <1> db 000h, 000h, 0c6h, 000h, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 616 00016BD9 C0C67C00000000 <1> 617 00016BE0 00603018007CC6FEC0- <1> db 000h, 060h, 030h, 018h, 000h, 07ch, 0c6h, 0feh, 0c0h, 0c0h, 0c6h, 07ch, 000h, 000h, 000h, 000h 617 00016BE9 C0C67C00000000 <1> 618 00016BF0 000066000038181818- <1> db 000h, 000h, 066h, 000h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 618 00016BF9 18183C00000000 <1> 619 00016C00 00183C660038181818- <1> db 000h, 018h, 03ch, 066h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 619 00016C09 18183C00000000 <1> 620 00016C10 006030180038181818- <1> db 000h, 060h, 030h, 018h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 620 00016C19 18183C00000000 <1> 621 00016C20 00C60010386CC6C6FE- <1> db 000h, 0c6h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 621 00016C29 C6C6C600000000 <1> 622 00016C30 386C3800386CC6C6FE- <1> db 038h, 06ch, 038h, 000h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 622 00016C39 C6C6C600000000 <1> 623 00016C40 18306000FE66607C60- <1> db 018h, 030h, 060h, 000h, 0feh, 066h, 060h, 07ch, 060h, 060h, 066h, 0feh, 000h, 000h, 000h, 000h 623 00016C49 6066FE00000000 <1> 624 00016C50 00000000006E3B1B7E- <1> db 000h, 000h, 000h, 000h, 000h, 06eh, 03bh, 01bh, 07eh, 0d8h, 0dch, 077h, 000h, 000h, 000h, 000h 624 00016C59 D8DC7700000000 <1> 625 00016C60 00003E6CCCCCFECCCC- <1> db 000h, 000h, 03eh, 06ch, 0cch, 0cch, 0feh, 0cch, 0cch, 0cch, 0cch, 0ceh, 000h, 000h, 000h, 000h 625 00016C69 CCCCCE00000000 <1> 626 00016C70 0010386C007CC6C6C6- <1> db 000h, 010h, 038h, 06ch, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 626 00016C79 C6C67C00000000 <1> 627 00016C80 0000C600007CC6C6C6- <1> db 000h, 000h, 0c6h, 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 627 00016C89 C6C67C00000000 <1> 628 00016C90 00603018007CC6C6C6- <1> db 000h, 060h, 030h, 018h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 628 00016C99 C6C67C00000000 <1> 629 00016CA0 003078CC00CCCCCCCC- <1> db 000h, 030h, 078h, 0cch, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 629 00016CA9 CCCC7600000000 <1> 630 00016CB0 0060301800CCCCCCCC- <1> db 000h, 060h, 030h, 018h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 630 00016CB9 CCCC7600000000 <1> 631 00016CC0 0000C60000C6C6C6C6- <1> db 000h, 000h, 0c6h, 000h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07eh, 006h, 00ch, 078h, 000h 631 00016CC9 C6C67E060C7800 <1> 632 00016CD0 00C6007CC6C6C6C6C6- <1> db 000h, 0c6h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 632 00016CD9 C6C67C00000000 <1> 633 00016CE0 00C600C6C6C6C6C6C6- <1> db 000h, 0c6h, 000h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 633 00016CE9 C6C67C00000000 <1> 634 00016CF0 0018187EC3C0C0C0C3- <1> db 000h, 018h, 018h, 07eh, 0c3h, 0c0h, 0c0h, 0c0h, 0c3h, 07eh, 018h, 018h, 000h, 000h, 000h, 000h 634 00016CF9 7E181800000000 <1> 635 00016D00 00386C6460F0606060- <1> db 000h, 038h, 06ch, 064h, 060h, 0f0h, 060h, 060h, 060h, 060h, 0e6h, 0fch, 000h, 000h, 000h, 000h 635 00016D09 60E6FC00000000 <1> 636 00016D10 0000C3663C18FF18FF- <1> db 000h, 000h, 0c3h, 066h, 03ch, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 018h, 000h, 000h, 000h, 000h 636 00016D19 18181800000000 <1> 637 00016D20 00FC66667C62666F66- <1> db 000h, 0fch, 066h, 066h, 07ch, 062h, 066h, 06fh, 066h, 066h, 066h, 0f3h, 000h, 000h, 000h, 000h 637 00016D29 6666F300000000 <1> 638 00016D30 000E1B1818187E1818- <1> db 000h, 00eh, 01bh, 018h, 018h, 018h, 07eh, 018h, 018h, 018h, 018h, 018h, 0d8h, 070h, 000h, 000h 638 00016D39 181818D8700000 <1> 639 00016D40 0018306000780C7CCC- <1> db 000h, 018h, 030h, 060h, 000h, 078h, 00ch, 07ch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 639 00016D49 CCCC7600000000 <1> 640 00016D50 000C18300038181818- <1> db 000h, 00ch, 018h, 030h, 000h, 038h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h 640 00016D59 18183C00000000 <1> 641 00016D60 00183060007CC6C6C6- <1> db 000h, 018h, 030h, 060h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 641 00016D69 C6C67C00000000 <1> 642 00016D70 0018306000CCCCCCCC- <1> db 000h, 018h, 030h, 060h, 000h, 0cch, 0cch, 0cch, 0cch, 0cch, 0cch, 076h, 000h, 000h, 000h, 000h 642 00016D79 CCCC7600000000 <1> 643 00016D80 000076DC00DC666666- <1> db 000h, 000h, 076h, 0dch, 000h, 0dch, 066h, 066h, 066h, 066h, 066h, 066h, 000h, 000h, 000h, 000h 643 00016D89 66666600000000 <1> 644 00016D90 76DC00C6E6F6FEDECE- <1> db 076h, 0dch, 000h, 0c6h, 0e6h, 0f6h, 0feh, 0deh, 0ceh, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 644 00016D99 C6C6C600000000 <1> 645 00016DA0 003C6C6C3E007E0000- <1> db 000h, 03ch, 06ch, 06ch, 03eh, 000h, 07eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 645 00016DA9 00000000000000 <1> 646 00016DB0 00386C6C38007C0000- <1> db 000h, 038h, 06ch, 06ch, 038h, 000h, 07ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 646 00016DB9 00000000000000 <1> 647 00016DC0 0000303000303060C0- <1> db 000h, 000h, 030h, 030h, 000h, 030h, 030h, 060h, 0c0h, 0c6h, 0c6h, 07ch, 000h, 000h, 000h, 000h 647 00016DC9 C6C67C00000000 <1> 648 00016DD0 000000000000FEC0C0- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 0c0h, 0c0h, 0c0h, 0c0h, 000h, 000h, 000h, 000h, 000h 648 00016DD9 C0C00000000000 <1> 649 00016DE0 000000000000FE0606- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 006h, 006h, 006h, 006h, 000h, 000h, 000h, 000h, 000h 649 00016DE9 06060000000000 <1> 650 00016DF0 00C0C0C2C6CC183060- <1> db 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 060h, 0ceh, 09bh, 006h, 00ch, 01fh, 000h, 000h 650 00016DF9 CE9B060C1F0000 <1> 651 00016E00 00C0C0C2C6CC183066- <1> db 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 066h, 0ceh, 096h, 03eh, 006h, 006h, 000h, 000h 651 00016E09 CE963E06060000 <1> 652 00016E10 00001818001818183C- <1> db 000h, 000h, 018h, 018h, 000h, 018h, 018h, 018h, 03ch, 03ch, 03ch, 018h, 000h, 000h, 000h, 000h 652 00016E19 3C3C1800000000 <1> 653 00016E20 0000000000366CD86C- <1> db 000h, 000h, 000h, 000h, 000h, 036h, 06ch, 0d8h, 06ch, 036h, 000h, 000h, 000h, 000h, 000h, 000h 653 00016E29 36000000000000 <1> 654 00016E30 0000000000D86C366C- <1> db 000h, 000h, 000h, 000h, 000h, 0d8h, 06ch, 036h, 06ch, 0d8h, 000h, 000h, 000h, 000h, 000h, 000h 654 00016E39 D8000000000000 <1> 655 00016E40 114411441144114411- <1> db 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h 655 00016E49 44114411441144 <1> 656 00016E50 55AA55AA55AA55AA55- <1> db 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah, 055h, 0aah 656 00016E59 AA55AA55AA55AA <1> 657 00016E60 DD77DD77DD77DD77DD- <1> db 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h, 0ddh, 077h 657 00016E69 77DD77DD77DD77 <1> 658 00016E70 181818181818181818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 658 00016E79 18181818181818 <1> 659 00016E80 18181818181818F818- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 659 00016E89 18181818181818 <1> 660 00016E90 1818181818F818F818- <1> db 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 660 00016E99 18181818181818 <1> 661 00016EA0 36363636363636F636- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0f6h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 661 00016EA9 36363636363636 <1> 662 00016EB0 00000000000000FE36- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0feh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 662 00016EB9 36363636363636 <1> 663 00016EC0 0000000000F818F818- <1> db 000h, 000h, 000h, 000h, 000h, 0f8h, 018h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 663 00016EC9 18181818181818 <1> 664 00016ED0 3636363636F606F636- <1> db 036h, 036h, 036h, 036h, 036h, 0f6h, 006h, 0f6h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 664 00016ED9 36363636363636 <1> 665 00016EE0 363636363636363636- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 665 00016EE9 36363636363636 <1> 666 00016EF0 0000000000FE06F636- <1> db 000h, 000h, 000h, 000h, 000h, 0feh, 006h, 0f6h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 666 00016EF9 36363636363636 <1> 667 00016F00 3636363636F606FE00- <1> db 036h, 036h, 036h, 036h, 036h, 0f6h, 006h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 667 00016F09 00000000000000 <1> 668 00016F10 36363636363636FE00- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0feh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 668 00016F19 00000000000000 <1> 669 00016F20 1818181818F818F800- <1> db 018h, 018h, 018h, 018h, 018h, 0f8h, 018h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 669 00016F29 00000000000000 <1> 670 00016F30 00000000000000F818- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0f8h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 670 00016F39 18181818181818 <1> 671 00016F40 181818181818181F00- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 671 00016F49 00000000000000 <1> 672 00016F50 18181818181818FF00- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 672 00016F59 00000000000000 <1> 673 00016F60 00000000000000FF18- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 673 00016F69 18181818181818 <1> 674 00016F70 181818181818181F18- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 674 00016F79 18181818181818 <1> 675 00016F80 00000000000000FF00- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 675 00016F89 00000000000000 <1> 676 00016F90 18181818181818FF18- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 676 00016F99 18181818181818 <1> 677 00016FA0 18181818181F181F18- <1> db 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 677 00016FA9 18181818181818 <1> 678 00016FB0 363636363636363736- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 678 00016FB9 36363636363636 <1> 679 00016FC0 363636363637303F00- <1> db 036h, 036h, 036h, 036h, 036h, 037h, 030h, 03fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 679 00016FC9 00000000000000 <1> 680 00016FD0 00000000003F303736- <1> db 000h, 000h, 000h, 000h, 000h, 03fh, 030h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 680 00016FD9 36363636363636 <1> 681 00016FE0 3636363636F700FF00- <1> db 036h, 036h, 036h, 036h, 036h, 0f7h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 681 00016FE9 00000000000000 <1> 682 00016FF0 0000000000FF00F736- <1> db 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0f7h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 682 00016FF9 36363636363636 <1> 683 00017000 363636363637303736- <1> db 036h, 036h, 036h, 036h, 036h, 037h, 030h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 683 00017009 36363636363636 <1> 684 00017010 0000000000FF00FF00- <1> db 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 684 00017019 00000000000000 <1> 685 00017020 3636363636F700F736- <1> db 036h, 036h, 036h, 036h, 036h, 0f7h, 000h, 0f7h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 685 00017029 36363636363636 <1> 686 00017030 1818181818FF00FF00- <1> db 018h, 018h, 018h, 018h, 018h, 0ffh, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 686 00017039 00000000000000 <1> 687 00017040 36363636363636FF00- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 687 00017049 00000000000000 <1> 688 00017050 0000000000FF00FF18- <1> db 000h, 000h, 000h, 000h, 000h, 0ffh, 000h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 688 00017059 18181818181818 <1> 689 00017060 00000000000000FF36- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 689 00017069 36363636363636 <1> 690 00017070 363636363636363F00- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 03fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 690 00017079 00000000000000 <1> 691 00017080 18181818181F181F00- <1> db 018h, 018h, 018h, 018h, 018h, 01fh, 018h, 01fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 691 00017089 00000000000000 <1> 692 00017090 00000000001F181F18- <1> db 000h, 000h, 000h, 000h, 000h, 01fh, 018h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 692 00017099 18181818181818 <1> 693 000170A0 000000000000003F36- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 03fh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 693 000170A9 36363636363636 <1> 694 000170B0 36363636363636FF36- <1> db 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0ffh, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h 694 000170B9 36363636363636 <1> 695 000170C0 1818181818FF18FF18- <1> db 018h, 018h, 018h, 018h, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 695 000170C9 18181818181818 <1> 696 000170D0 18181818181818F800- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 696 000170D9 00000000000000 <1> 697 000170E0 000000000000001F18- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 01fh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 697 000170E9 18181818181818 <1> 698 000170F0 FFFFFFFFFFFFFFFFFF- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 698 000170F9 FFFFFFFFFFFFFF <1> 699 00017100 00000000000000FFFF- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh 699 00017109 FFFFFFFFFFFFFF <1> 700 00017110 F0F0F0F0F0F0F0F0F0- <1> db 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h, 0f0h 700 00017119 F0F0F0F0F0F0F0 <1> 701 00017120 0F0F0F0F0F0F0F0F0F- <1> db 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh, 00fh 701 00017129 0F0F0F0F0F0F0F <1> 702 00017130 FFFFFFFFFFFFFF0000- <1> db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 702 00017139 00000000000000 <1> 703 00017140 000000000076DCD8D8- <1> db 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 0d8h, 0d8h, 0d8h, 0dch, 076h, 000h, 000h, 000h, 000h 703 00017149 D8DC7600000000 <1> 704 00017150 000078CCCCCCD8CCC6- <1> db 000h, 000h, 078h, 0cch, 0cch, 0cch, 0d8h, 0cch, 0c6h, 0c6h, 0c6h, 0cch, 000h, 000h, 000h, 000h 704 00017159 C6C6CC00000000 <1> 705 00017160 0000FEC6C6C0C0C0C0- <1> db 000h, 000h, 0feh, 0c6h, 0c6h, 0c0h, 0c0h, 0c0h, 0c0h, 0c0h, 0c0h, 0c0h, 000h, 000h, 000h, 000h 705 00017169 C0C0C000000000 <1> 706 00017170 00000000FE6C6C6C6C- <1> db 000h, 000h, 000h, 000h, 0feh, 06ch, 06ch, 06ch, 06ch, 06ch, 06ch, 06ch, 000h, 000h, 000h, 000h 706 00017179 6C6C6C00000000 <1> 707 00017180 000000FEC660301830- <1> db 000h, 000h, 000h, 0feh, 0c6h, 060h, 030h, 018h, 030h, 060h, 0c6h, 0feh, 000h, 000h, 000h, 000h 707 00017189 60C6FE00000000 <1> 708 00017190 00000000007ED8D8D8- <1> db 000h, 000h, 000h, 000h, 000h, 07eh, 0d8h, 0d8h, 0d8h, 0d8h, 0d8h, 070h, 000h, 000h, 000h, 000h 708 00017199 D8D87000000000 <1> 709 000171A0 000000006666666666- <1> db 000h, 000h, 000h, 000h, 066h, 066h, 066h, 066h, 066h, 07ch, 060h, 060h, 0c0h, 000h, 000h, 000h 709 000171A9 7C6060C0000000 <1> 710 000171B0 0000000076DC181818- <1> db 000h, 000h, 000h, 000h, 076h, 0dch, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h 710 000171B9 18181800000000 <1> 711 000171C0 0000007E183C666666- <1> db 000h, 000h, 000h, 07eh, 018h, 03ch, 066h, 066h, 066h, 03ch, 018h, 07eh, 000h, 000h, 000h, 000h 711 000171C9 3C187E00000000 <1> 712 000171D0 000000386CC6C6FEC6- <1> db 000h, 000h, 000h, 038h, 06ch, 0c6h, 0c6h, 0feh, 0c6h, 0c6h, 06ch, 038h, 000h, 000h, 000h, 000h 712 000171D9 C66C3800000000 <1> 713 000171E0 0000386CC6C6C66C6C- <1> db 000h, 000h, 038h, 06ch, 0c6h, 0c6h, 0c6h, 06ch, 06ch, 06ch, 06ch, 0eeh, 000h, 000h, 000h, 000h 713 000171E9 6C6CEE00000000 <1> 714 000171F0 00001E30180C3E6666- <1> db 000h, 000h, 01eh, 030h, 018h, 00ch, 03eh, 066h, 066h, 066h, 066h, 03ch, 000h, 000h, 000h, 000h 714 000171F9 66663C00000000 <1> 715 00017200 00000000007EDBDBDB- <1> db 000h, 000h, 000h, 000h, 000h, 07eh, 0dbh, 0dbh, 0dbh, 07eh, 000h, 000h, 000h, 000h, 000h, 000h 715 00017209 7E000000000000 <1> 716 00017210 00000003067EDBDBF3- <1> db 000h, 000h, 000h, 003h, 006h, 07eh, 0dbh, 0dbh, 0f3h, 07eh, 060h, 0c0h, 000h, 000h, 000h, 000h 716 00017219 7E60C000000000 <1> 717 00017220 00001C3060607C6060- <1> db 000h, 000h, 01ch, 030h, 060h, 060h, 07ch, 060h, 060h, 060h, 030h, 01ch, 000h, 000h, 000h, 000h 717 00017229 60301C00000000 <1> 718 00017230 0000007CC6C6C6C6C6- <1> db 000h, 000h, 000h, 07ch, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 0c6h, 000h, 000h, 000h, 000h 718 00017239 C6C6C600000000 <1> 719 00017240 00000000FE0000FE00- <1> db 000h, 000h, 000h, 000h, 0feh, 000h, 000h, 0feh, 000h, 000h, 0feh, 000h, 000h, 000h, 000h, 000h 719 00017249 00FE0000000000 <1> 720 00017250 0000000018187E1818- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 07eh, 018h, 018h, 000h, 000h, 0ffh, 000h, 000h, 000h, 000h 720 00017259 0000FF00000000 <1> 721 00017260 00000030180C060C18- <1> db 000h, 000h, 000h, 030h, 018h, 00ch, 006h, 00ch, 018h, 030h, 000h, 07eh, 000h, 000h, 000h, 000h 721 00017269 30007E00000000 <1> 722 00017270 0000000C1830603018- <1> db 000h, 000h, 000h, 00ch, 018h, 030h, 060h, 030h, 018h, 00ch, 000h, 07eh, 000h, 000h, 000h, 000h 722 00017279 0C007E00000000 <1> 723 00017280 00000E1B1B18181818- <1> db 000h, 000h, 00eh, 01bh, 01bh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h 723 00017289 18181818181818 <1> 724 00017290 1818181818181818D8- <1> db 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0d8h, 0d8h, 0d8h, 070h, 000h, 000h, 000h, 000h 724 00017299 D8D87000000000 <1> 725 000172A0 000000001818007E00- <1> db 000h, 000h, 000h, 000h, 018h, 018h, 000h, 07eh, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h 725 000172A9 18180000000000 <1> 726 000172B0 000000000076DC0076- <1> db 000h, 000h, 000h, 000h, 000h, 076h, 0dch, 000h, 076h, 0dch, 000h, 000h, 000h, 000h, 000h, 000h 726 000172B9 DC000000000000 <1> 727 000172C0 00386C6C3800000000- <1> db 000h, 038h, 06ch, 06ch, 038h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 727 000172C9 00000000000000 <1> 728 000172D0 000000000000001818- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 728 000172D9 00000000000000 <1> 729 000172E0 000000000000000018- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 729 000172E9 00000000000000 <1> 730 000172F0 000F0C0C0C0C0CEC6C- <1> db 000h, 00fh, 00ch, 00ch, 00ch, 00ch, 00ch, 0ech, 06ch, 06ch, 03ch, 01ch, 000h, 000h, 000h, 000h 730 000172F9 6C3C1C00000000 <1> 731 00017300 00D86C6C6C6C6C0000- <1> db 000h, 0d8h, 06ch, 06ch, 06ch, 06ch, 06ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 731 00017309 00000000000000 <1> 732 00017310 0070D83060C8F80000- <1> db 000h, 070h, 0d8h, 030h, 060h, 0c8h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 732 00017319 00000000000000 <1> 733 00017320 000000007C7C7C7C7C- <1> db 000h, 000h, 000h, 000h, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 000h, 000h, 000h, 000h, 000h 733 00017329 7C7C0000000000 <1> 734 00017330 000000000000000000- <1> db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h 734 00017339 00000000000000 <1> 735 <1> 736 <1> ; 01/01/2021 (TRDOS 386 v2.0.3) 737 <1> 738 <1> %if 0 739 <1> 740 <1> vgafont14alt: 741 <1> db 01dh, 000h, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h, 000h, 000h, 000h, 022h 742 <1> db 000h, 063h, 063h, 063h, 022h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 02bh, 000h 743 <1> db 000h, 000h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 02dh, 000h, 000h 744 <1> db 000h, 000h, 000h, 000h, 0ffh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 04dh, 000h, 000h, 0c3h 745 <1> db 0e7h, 0ffh, 0dbh, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 000h, 000h, 000h, 054h, 000h, 000h, 0ffh, 0dbh 746 <1> db 099h, 018h, 018h, 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 056h, 000h, 000h, 0c3h, 0c3h, 0c3h 747 <1> db 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h, 000h, 000h, 000h, 057h, 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h 748 <1> db 0dbh, 0dbh, 0ffh, 066h, 066h, 000h, 000h, 000h, 058h, 000h, 000h, 0c3h, 0c3h, 066h, 03ch, 018h 749 <1> db 03ch, 066h, 0c3h, 0c3h, 000h, 000h, 000h, 059h, 000h, 000h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h 750 <1> db 018h, 018h, 03ch, 000h, 000h, 000h, 05ah, 000h, 000h, 0ffh, 0c3h, 086h, 00ch, 018h, 030h, 061h 751 <1> db 0c3h, 0ffh, 000h, 000h, 000h, 06dh, 000h, 000h, 000h, 000h, 000h, 0e6h, 0ffh, 0dbh, 0dbh, 0dbh 752 <1> db 0dbh, 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h, 000h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h 753 <1> db 000h, 000h, 000h, 077h, 000h, 000h, 000h, 000h, 000h, 0c3h, 0c3h, 0dbh, 0dbh, 0ffh, 066h, 000h 754 <1> db 000h, 000h, 091h, 000h, 000h, 000h, 000h, 06eh, 03bh, 01bh, 07eh, 0d8h, 0dch, 077h, 000h, 000h 755 <1> db 000h, 09bh, 000h, 018h, 018h, 07eh, 0c3h, 0c0h, 0c0h, 0c3h, 07eh, 018h, 018h, 000h, 000h, 000h 756 <1> db 09dh, 000h, 000h, 0c3h, 066h, 03ch, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 000h, 000h, 000h, 09eh 757 <1> db 000h, 0fch, 066h, 066h, 07ch, 062h, 066h, 06fh, 066h, 066h, 0f3h, 000h, 000h, 000h, 0f1h, 000h 758 <1> db 000h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h, 000h, 0ffh, 000h, 000h, 000h, 0f6h, 000h, 000h 759 <1> db 018h, 018h, 000h, 000h, 0ffh, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h 760 <1> vgafont16alt: 761 <1> db 01dh, 000h, 000h, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h, 000h, 000h, 000h 762 <1> db 000h, 030h, 000h, 000h, 03ch, 066h, 0c3h, 0c3h, 0dbh, 0dbh, 0c3h, 0c3h, 066h, 03ch, 000h, 000h 763 <1> db 000h, 000h, 04dh, 000h, 000h, 0c3h, 0e7h, 0ffh, 0ffh, 0dbh, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 000h 764 <1> db 000h, 000h, 000h, 054h, 000h, 000h, 0ffh, 0dbh, 099h, 018h, 018h, 018h, 018h, 018h, 018h, 03ch 765 <1> db 000h, 000h, 000h, 000h, 056h, 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 066h, 03ch 766 <1> db 018h, 000h, 000h, 000h, 000h, 057h, 000h, 000h, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 0dbh, 0dbh, 0ffh 767 <1> db 066h, 066h, 000h, 000h, 000h, 000h, 058h, 000h, 000h, 0c3h, 0c3h, 066h, 03ch, 018h, 018h, 03ch 768 <1> db 066h, 0c3h, 0c3h, 000h, 000h, 000h, 000h, 059h, 000h, 000h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h 769 <1> db 018h, 018h, 018h, 03ch, 000h, 000h, 000h, 000h, 05ah, 000h, 000h, 0ffh, 0c3h, 086h, 00ch, 018h 770 <1> db 030h, 060h, 0c1h, 0c3h, 0ffh, 000h, 000h, 000h, 000h, 06dh, 000h, 000h, 000h, 000h, 000h, 0e6h 771 <1> db 0ffh, 0dbh, 0dbh, 0dbh, 0dbh, 0dbh, 000h, 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h, 000h 772 <1> db 0c3h, 0c3h, 0c3h, 0c3h, 066h, 03ch, 018h, 000h, 000h, 000h, 000h, 077h, 000h, 000h, 000h, 000h 773 <1> db 000h, 0c3h, 0c3h, 0c3h, 0dbh, 0dbh, 0ffh, 066h, 000h, 000h, 000h, 000h, 078h, 000h, 000h, 000h 774 <1> db 000h, 000h, 0c3h, 066h, 03ch, 018h, 03ch, 066h, 0c3h, 000h, 000h, 000h, 000h, 091h, 000h, 000h 775 <1> db 000h, 000h, 000h, 06eh, 03bh, 01bh, 07eh, 0d8h, 0dch, 077h, 000h, 000h, 000h, 000h, 09bh, 000h 776 <1> db 018h, 018h, 07eh, 0c3h, 0c0h, 0c0h, 0c0h, 0c3h, 07eh, 018h, 018h, 000h, 000h, 000h, 000h, 09dh 777 <1> db 000h, 000h, 0c3h, 066h, 03ch, 018h, 0ffh, 018h, 0ffh, 018h, 018h, 018h, 000h, 000h, 000h, 000h 778 <1> db 09eh, 000h, 0fch, 066h, 066h, 07ch, 062h, 066h, 06fh, 066h, 066h, 066h, 0f3h, 000h, 000h, 000h 779 <1> db 000h, 0abh, 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 060h, 0ceh, 09bh, 006h, 00ch, 01fh 780 <1> db 000h, 000h, 0ach, 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 066h, 0ceh, 096h, 03eh, 006h 781 <1> db 006h, 000h, 000h, 000h 782 <1> 783 <1> %endif 3792 3793 ; 20/11/2020 3794 vbe2_bochs_vbios: 3795 ; db "BOCHS/QEMU" 3796 00017340 424F4348532F51454D- db "BOCHS/QEMU/VIRTUALBOX" ; 26/11/2020 3796 00017349 552F5649525455414C- 3796 00017352 424F58 3797 ;vbe_vnumber equ vbe2_bochs_vbios + 28 ; "3" or "2" 3798 ; 26/11/2020 3799 vbe_vnumber equ vbe2_bochs_vbios + 30 ; "3" or "2" 3800 ; 15/11/2020 3801 vesa_vbe3_bios_msg: 3802 ;db " VESA VBE version 3 Video BIOS ..." 3803 00017355 205645534120564245- db " VESA VBE3 Video BIOS ..." ; 26/11/2020 3803 0001735E 3320566964656F2042- 3803 00017367 494F53202E2E2E 3804 0001736E 0D0A0D0A00 db 0Dh, 0Ah, 0Dh, 0Ah, 0 3805 3806 ; 28/02/2021 3807 00017373 18 truecolor: db 24 3808 3809 align 2 3810 3811 ; EPOCH Variables 3812 ; 13/04/2015 - Retro UNIX 386 v1 Beginning 3813 ; 09/04/2013 epoch variables 3814 ; Retro UNIX 8086 v1 Prototype: UNIXCOPY.ASM, 10/03/2013 3815 ; 3816 00017374 B207 year: dw 1970 3817 00017376 0100 month: dw 1 3818 00017378 0100 day: dw 1 3819 0001737A 0000 hour: dw 0 3820 0001737C 0000 minute: dw 0 3821 0001737E 0000 second: dw 0 3822 3823 DMonth: 3824 00017380 0000 dw 0 3825 00017382 1F00 dw 31 3826 00017384 3B00 dw 59 3827 00017386 5A00 dw 90 3828 00017388 7800 dw 120 3829 0001738A 9700 dw 151 3830 0001738C B500 dw 181 3831 0001738E D400 dw 212 3832 00017390 F300 dw 243 3833 00017392 1101 dw 273 3834 00017394 3001 dw 304 3835 00017396 4E01 dw 334 3836 3837 ; 15/11/2020 3838 00017398 00 db 0 3839 kernel_version_msg: ; 17/04/2021 3840 ;;;;;;db "TRDOS (386) Kernel v2.0.4 by Erdogan Tan" 3841 ;;;;;db "TRDOS (386) Kernel v2.0.5 by Erdogan Tan" ; 11/08/2022 3842 ;;;;db "TRDOS (386) Kernel v2.0.6 by Erdogan Tan" ; 29/08/2023 3843 ;;;db "TRDOS (386) Kernel v2.0.7 by Erdogan Tan" ; 20/10/2023 3844 ;;db "TRDOS (386) Kernel v2.0.8 by Erdogan Tan" ; 16/05/2024 3845 ;db "TRDOS (386) Kernel v2.0.9 by Erdogan Tan" ; 20/08/2024 3846 00017399 5452444F5320283338- db "TRDOS (386) Kernel v2.0.10 by Erdogan Tan" ; 11/01/2025 3846 000173A2 3629204B65726E656C- 3846 000173AB 2076322E302E313020- 3846 000173B4 6279204572646F6761- 3846 000173BD 6E2054616E 3847 000173C2 00 db 0 3848 3849 ; 20/02/2017 3850 KERNELFSIZE equ $ ; 04/07/2016 3851 3852 bss_start: 3853 3854 ABSOLUTE bss_start 3855 3856 000173C3 ?????????? alignb 8 ; 25/12/2016 3857 3858 ; 15/04/2016 3859 ; TRDOS 386 (TRDOS v2.0) 3860 ; 80 interrupts 3861 ; 11/03/2015 3862 ; Interrupt Descriptor Table (20/08/2014) 3863 idt: 3864 ;resb 64*8 ; INT 0 to INT 3Fh 3865 ; 15/04/2016 3866 000173C8 resb 80*8 ; INT 0 to INT 4Fh 3867 3868 idt_end: 3869 3870 ;alignb 4 3871 3872 task_state_segment: 3873 ; 24/03/2015 3874 00017648 ???? tss.link: resw 1 3875 0001764A ???? resw 1 3876 ; tss offset 4 3877 0001764C ???????? tss.esp0: resd 1 3878 00017650 ???? tss.ss0: resw 1 3879 00017652 ???? resw 1 3880 00017654 ???????? tss.esp1: resd 1 3881 00017658 ???? tss.ss1: resw 1 3882 0001765A ???? resw 1 3883 0001765C ???????? tss.esp2: resd 1 3884 00017660 ???? tss.ss2: resw 1 3885 00017662 ???? resw 1 3886 ; tss offset 28 3887 00017664 ???????? tss.CR3: resd 1 3888 00017668 ???????? tss.eip: resd 1 3889 0001766C ???????? tss.eflags: resd 1 3890 ; tss offset 40 3891 00017670 ???????? tss.eax: resd 1 3892 00017674 ???????? tss.ecx: resd 1 3893 00017678 ???????? tss.edx: resd 1 3894 0001767C ???????? tss.ebx: resd 1 3895 00017680 ???????? tss.esp: resd 1 3896 00017684 ???????? tss.ebp: resd 1 3897 00017688 ???????? tss.esi: resd 1 3898 0001768C ???????? tss.edi: resd 1 3899 ; tss offset 72 3900 00017690 ???? tss.ES: resw 1 3901 00017692 ???? resw 1 3902 00017694 ???? tss.CS: resw 1 3903 00017696 ???? resw 1 3904 00017698 ???? tss.SS: resw 1 3905 0001769A ???? resw 1 3906 0001769C ???? tss.DS: resw 1 3907 0001769E ???? resw 1 3908 000176A0 ???? tss.FS: resw 1 3909 000176A2 ???? resw 1 3910 000176A4 ???? tss.GS: resw 1 3911 000176A6 ???? resw 1 3912 000176A8 ???? tss.LDTR: resw 1 3913 000176AA ???? resw 1 3914 ; tss offset 100 3915 000176AC ???? resw 1 3916 000176AE ???? tss.IOPB: resw 1 3917 ; tss offset 104 3918 tss_end: 3919 3920 000176B0 ???????? k_page_dir: resd 1 ; Kernel's (System) Page Directory address 3921 ; (Physical address = Virtual address) 3922 000176B4 ???????? memory_size: resd 1 ; memory size in pages 3923 000176B8 ???????? free_pages: resd 1 ; number of free pages 3924 000176BC ???????? next_page: resd 1 ; offset value in M.A.T. for 3925 ; first free page search 3926 000176C0 ???????? last_page: resd 1 ; offset value in M.A.T. which 3927 ; next free page search will be 3928 ; stopped after it. (end of M.A.T.) 3929 000176C4 ???????? first_page: resd 1 ; offset value in M.A.T. which 3930 ; first free page search 3931 ; will be started on it. (for user) 3932 000176C8 ???????? mat_size: resd 1 ; Memory Allocation Table size in pages 3933 3934 ; 20/11/2020 3935 ;vbe2bios: resw 1 ; VBE2 video bios ID (bochs/qemu) 3936 ; ; (0B0C4h or 0B0C5h for bochs/plex86 vgabios) 3937 3938 ; 02/09/2014 (Retro UNIX 386 v1) 3939 ; 04/12/2013 (Retro UNIX 8086 v1) 3940 000176CC ???? CRT_START: resw 1 ; starting address in regen buffer 3941 ; NOTE: active page only 3942 000176CE CURSOR_POSN: resw 8 ; cursor positions for video pages 3943 ACTIVE_PAGE: 3944 000176DE ?? ptty: resb 1 ; current tty 3945 ; 01/07/2015 - 29/01/2016 3946 000176DF ?? ccolor: resb 1 ; current color attribute 3947 ; 26/10/2015 3948 ; 07/09/2014 3949 000176E0 ttychr: resw ntty+2 ; Character buffer (multiscreen) 3950 3951 ; 18/05/2015 (03/06/2013 - Retro UNIX 8086 v1 feature only!) 3952 000176F4 ???????? p_time: resd 1 ; present time (for systime & sysmdate) 3953 3954 ; 18/05/2015 (16/08/2013 - Retro UNIX 8086 v1 feature only !) 3955 ; (open mode locks for pseudo TTYs) 3956 ; [ major tty locks (return error in any conflicts) ] 3957 000176F8 ttyl: resw ntty+2 ; opening locks for TTYs. 3958 3959 ; 15/04/2015 (Retro UNIX 386 v1) 3960 ; 22/09/2013 (Retro UNIX 8086 v1) 3961 0001770C wlist: resb ntty+2 ; wait channel list (0 to 9 for TTYs) 3962 ; 15/04/2015 (Retro UNIX 386 v1) 3963 ;; 12/07/2014 -> sp_init set comm. parameters as 0E3h 3964 ;; 0 means serial port is not available 3965 ;;comprm: ; 25/06/2014 3966 00017716 ?? com1p: resb 1 ;;0E3h 3967 00017717 ?? com2p: resb 1 ;;0E3h 3968 3969 ; 17/11/2015 3970 ; request for response (from the terminal) 3971 00017718 ???? req_resp: resw 1 3972 ; 07/11/2015 3973 0001771A ?? ccomport: resb 1 ; current COM (serial) port 3974 ; (0= COM1, 1= COM2) 3975 ; 09/11/2015 3976 0001771B ?? comqr: resb 1 ; 'query or response' sign (u9.s, 'sndc') 3977 ; 07/11/2015 3978 0001771C ???? rchar: resw 1 ; last received char for COM 1 and COM 2 3979 0001771E ???? schar: resw 1 ; last sent char for COM 1 and COM 2 3980 3981 ; 22/08/2014 (RTC) 3982 ; (Packed BCD) 3983 00017720 ?? time_seconds: resb 1 3984 00017721 ?? time_minutes: resb 1 3985 00017722 ?? time_hours: resb 1 3986 00017723 ?? date_wday: resb 1 3987 00017724 ?? date_day: resb 1 3988 00017725 ?? date_month: resb 1 3989 00017726 ?? date_year: resb 1 3990 00017727 ?? date_century: resb 1 3991 3992 ; 24/01/2016 3993 00017728 ???????? RTC_LH: resd 1 3994 0001772C ?? RTC_WAIT_FLAG: resb 1 3995 0001772D ?? USER_FLAG: resb 1 3996 ; 19/05/2016 3997 ;RTC_second: 3998 0001772E ?? RTC_2Hz: resb 1 ; from 2Hz interrupt to 1Hz timer event function 3999 4000 %include 'diskbss.s' ; UNINITIALIZED DISK (BIOS) DATA 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel) - v2.0.5 - diskbss.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 06/08/2022 (Previous: 24/01/2016) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Turkish Rational DOS 11 <1> ; Operating System Project v2.0 by ERDOGAN TAN (Beginning: 04/01/2016) 12 <1> ; 13 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 14 <1> ; diskbss.inc (10/07/2015) 15 <1> ; 16 <1> ; Derived from 'IBM PC-XT-286' BIOS source code (1986) 17 <1> ; **************************************************************************** 18 <1> 19 <1> ; Retro UNIX 386 v1 Kernel - DISKBSS.INC 20 <1> ; Last Modification: 10/07/2015 21 <1> ; (Unitialized Disk Parameters Data section for 'DISKIO.INC') 22 <1> 23 0001772F ?? <1> alignb 2 24 <1> 25 <1> ;---------------------------------------- 26 <1> ; TIMER DATA AREA : 27 <1> ;---------------------------------------- 28 <1> 29 <1> TIMER_LH: ; 16/02/2015 30 00017730 ???? <1> TIMER_LOW: resw 1 ; LOW WORD OF TIMER COUNT 31 00017732 ???? <1> TIMER_HIGH: resw 1 ; HIGH WORD OF TIMER COUNT 32 00017734 ?? <1> TIMER_OFL: resb 1 ; TIMER HAS ROLLED OVER SINCE LAST READ 33 <1> 34 <1> ;---------------------------------------- 35 <1> ; DISKETTE DATA AREAS : 36 <1> ;---------------------------------------- 37 <1> 38 00017735 ?? <1> SEEK_STATUS: resb 1 39 00017736 ?? <1> MOTOR_STATUS: resb 1 40 00017737 ?? <1> MOTOR_COUNT: resb 1 41 00017738 ?? <1> DSKETTE_STATUS: resb 1 42 00017739 ?????????????? <1> NEC_STATUS: resb 7 43 <1> 44 <1> ;---------------------------------------- 45 <1> ; ADDITIONAL MEDIA DATA : 46 <1> ;---------------------------------------- 47 <1> 48 00017740 ?? <1> LASTRATE: resb 1 49 00017741 ?? <1> HF_STATUS: resb 1 50 <1> ; 06/08/2022 51 <1> ;HF_ERROR: resb 1 52 00017742 ?? <1> HF_INT_FLAG: resb 1 53 <1> ; 06/08/2022 54 <1> ;HF_CNTRL: resb 1 55 <1> ;DSK_STATE: resb 4 56 <1> ; 06/08/2022 57 00017743 ???? <1> DSK_STATE: resb 2 58 00017745 ???? <1> DSK_TRK: resb 2 59 <1> 60 <1> ;---------------------------------------- 61 <1> ; FIXED DISK DATA AREAS : 62 <1> ;---------------------------------------- 63 <1> 64 00017747 ?? <1> DISK_STATUS1: resb 1 ; FIXED DISK STATUS 65 00017748 ?? <1> HF_NUM: resb 1 ; COUNT OF FIXED DISK DRIVES 66 00017749 ?? <1> CONTROL_BYTE: resb 1 ; HEAD CONTROL BYTE 67 <1> ;@PORT_OFF resb 1 ; RESERVED (PORT OFFSET) 68 <1> ;port1_off resb 1 ; Hard disk controller 1 - port offset 69 <1> ;port2_off resb 1 ; Hard disk controller 2 - port offset 70 <1> 71 0001774A ???? <1> alignb 4 72 <1> 73 <1> ;HF_TBL_VEC: resd 1 ; Primary master disk param. tbl. pointer 74 <1> ;HF1_TBL_VEC: resd 1 ; Primary slave disk param. tbl. pointer 75 <1> HF_TBL_VEC: ; 22/12/2014 76 0001774C ???????? <1> HDPM_TBL_VEC: resd 1 ; Primary master disk param. tbl. pointer 77 00017750 ???????? <1> HDPS_TBL_VEC: resd 1 ; Primary slave disk param. tbl. pointer 78 00017754 ???????? <1> HDSM_TBL_VEC: resd 1 ; Secondary master disk param. tbl. pointer 79 00017758 ???????? <1> HDSS_TBL_VEC: resd 1 ; Secondary slave disk param. tbl. pointer 80 <1> 81 <1> ; 03/01/2015 82 0001775C ?? <1> LBAMode: resb 1 83 <1> 84 <1> ; ***************************************************************************** 4001 4002 ;;; Real Mode Data (10/07/2015 - BSS) 4003 4004 ;alignb 2 4005 4006 ; 10/01/2016 4007 %include 'trdoskx.s' ; UNINITIALIZED KERNEL (Logical Drive & FS) DATA 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.10) - UNINITIALIZED DATA : trdoskx.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 10/02/2026 (Previous: 01/09/2024 - Kernel v2.0.9) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 04/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.11 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from TRDOS Operating System v1.0 (8086) source code by Erdogan Tan 11 <1> ; TRDOS2.ASM (09/11/2011) 12 <1> ; **************************************************************************** 13 <1> ; DRV_INIT.ASM [26/09/2009] Last Update: 07/08/2011 14 <1> ; MAINPROG.ASM [17/01/2004] Last Update: 09/11/2011 15 <1> ; DIR.ASM [17/01/2004] Last Update: 09/10/2011 16 <1> ; CMD_INTR.ASM [29/01/2005] Last update: 09/11/2011 17 <1> ; DRV_FAT.ASM [07/07/2009] Last update: 21/08/2011 18 <1> 19 0001775D ?????? <1> alignb 4 20 <1> 21 <1> ; 10/02/2026 - TRDOS 386 v2.0.10 22 00017760 ???????? <1> cr3prev: resd 1 ; for saving and restoring previous (user's) cr3 23 <1> ; (page directory address) -video.s- 24 <1> 25 <1> ; MAINPROG.ASM 26 00017764 ???????? <1> MainProgCfg_FileSize: resd 1 ; 14/04/2016 27 00017768 ???????? <1> MainProgCfg_LineOffset: resd 1 ; 14/04/2016 28 <1> 29 0001776C ???????? <1> Current_VolSerial: resd 1 30 <1> 31 00017770 ???????? <1> Current_Dir_FCluster: resd 1 32 <1> 33 00017774 ?? <1> Current_Dir_Level: resb 1 34 00017775 ?? <1> Current_FATType: resb 1 35 00017776 ?? <1> Current_Drv: resb 1 36 00017777 ?? <1> Current_Dir_Drv: resb 1 ; '?' 37 00017778 ?? <1> resb 1 ; ':' 38 00017779 ?? <1> Current_Dir_Root: resb 1 ; '/' 39 0001777A <1> Current_Directory: resb 90 40 000177D4 ?? <1> End_Of_Current_Dir_Str: resb 1 41 000177D5 ?? <1> Current_Dir_StrLen: resb 1 42 <1> 43 000177D6 ?? <1> CursorColumn: resb 1 44 000177D7 ?? <1> CmdArgStart: resb 1 45 <1> 46 <1> ; 03/02/2016 47 000177D8 <1> Remark: resb 78 48 <1> 49 00017826 <1> CommandBuffer: resb 80 50 <1> 51 <1> ;TextBuffer: ;resb 256 52 <1> ; 04/07/2025 53 00017876 <1> TextBuffer: resb 128 54 000178F6 <1> RunPathBuffer: resb 128 55 <1> 56 <1> MasterBootBuff: 57 00017976 <1> MasterBootCode: resb 1BEh 58 00017B34 <1> PartitionTable: resb 64 59 00017B74 ???? <1> MBIDCode: resw 1 60 <1> 61 <1> PTable_Buffer: 62 00017B76 <1> PTable_hd0: resb 64 63 00017BB6 <1> PTable_hd1: resb 64 64 00017BF6 <1> PTable_hd2: resb 64 65 00017C36 <1> PTable_hd3: resb 64 66 <1> ; 15/07/2020 67 <1> ;PTable_ep0: resb 64 68 <1> ;PTable_ep1: resb 64 69 <1> ;PTable_ep2: resb 64 70 <1> ;PTable_ep3: resb 64 71 <1> 72 <1> ; 22/05/2024 73 00017C76 ???????? <1> HD_LBA_yes: resd 1 74 <1> ; 13/08/2020 75 00017C7A ?? <1> scount: resb 1 ; 16/05/2016 (diskio.s, 'int33h:') 76 <1> ; 22/05/2024 77 <1> ;resb 1 78 <1> ;resb 1 79 <1> ;resb 1 80 <1> ;HD_LBA_yes: resb 1 81 00017C7B ?? <1> PP_Counter: resb 1 82 00017C7C ?? <1> EP_Counter: resb 1 83 <1> ; 13/08/2020 84 00017C7D ?? <1> LD_Counter: resb 1 85 <1> 86 <1> ; 30/08/2020 87 00017C7E ???????? <1> MBR_EP_StartSector: resd 1 88 <1> ; Extd partition start sector as in MBR 89 00017C82 ???????? <1> EP_StartSector: resd 1 ; next extd partition start sector 90 <1> ; 15/07/2020 91 <1> ;resd 1 92 <1> ;resd 1 93 <1> 94 <1> ; 20/07/2020 95 00017C86 <1> DOSBootSectorBuff: resb 512 96 <1> ; 15/07/2020 97 <1> ;DOSBootSectorBuff: resb 446 ; 1BEh 98 <1> ;MiniPartitionTable: resb 64 ; 40h 99 <1> ;MiniPartitionMagic: resw 1 ; 02h 100 <1> 101 <1> FAT_BuffDescriptor: 102 00017E86 ???????? <1> FAT_CurrentCluster: resd 1 103 00017E8A ?? <1> FAT_BuffValidData: resb 1 104 00017E8B ?? <1> FAT_BuffDrvName: resb 1 105 00017E8C ???? <1> FAT_BuffOffset: resw 1 106 00017E8E ???????? <1> FAT_BuffSector: resd 1 107 <1> 108 00017E92 ???????? <1> FAT_ClusterCounter: resd 1 109 00017E96 ???????? <1> LastCluster: resd 1 110 <1> 111 <1> ; 16/05/2016 112 <1> ;; 18/03/2016 (TRDOS v2.0) 113 <1> ;ClusterBuffer_Valid: resb 1 114 <1> 115 <1> ; 29/07/2022 116 <1> ;resb 1 117 <1> ; 02/12/2023 118 00017E9A ?? <1> P_TIMER: resb 1 ; diskette change check (2 seconds) 119 <1> 120 <1> Dir_BuffDescriptor: 121 00017E9B ?? <1> DirBuff_DRV: resb 1 122 00017E9C ?? <1> DirBuff_FATType: resb 1 123 00017E9D ?? <1> DirBuff_ValidData: resb 1 124 00017E9E ???? <1> DirBuff_CurrentEntry: resw 1 125 00017EA0 ???? <1> DirBuff_LastEntry: resw 1 126 00017EA2 ???????? <1> DirBuff_Cluster: resd 1 127 00017EA6 ???? <1> DirBuffer_Size: resw 1 128 <1> ;DirBuff_EntryCounter: resw 1 129 <1> 130 <1> ; 01/02/2016 131 <1> ; these are on (real mode) segment 8000h and later 132 <1> ; FAT_Buffer: resb 1536 ; 3 sectors 133 <1> ; Dir_Buffer: resb 512*32 134 <1> ; Logical_DOSDisks: resb 6656 ; 26 * 256 bytes 135 <1> 136 <1> ; 18/01/2016 137 <1> 138 00017EA8 ???????? <1> FreeClusterCount: resd 1 139 <1> 140 00017EAC ???????? <1> VolSize_Unit1: resd 1 141 00017EB0 ???????? <1> VolSize_Unit2: resd 1 142 <1> 143 00017EB4 ???????? <1> Vol_Tot_Sec_Str_Start: resd 1 144 00017EB8 <1> Vol_Tot_Sec_Str: resb 10 145 00017EC2 ?? <1> Vol_Tot_Sec_Str_End: resb 1 146 00017EC3 ?? <1> resb 1 147 00017EC4 ???????? <1> Vol_Free_Sectors_Str_Start: resd 1 148 00017EC8 <1> Vol_Free_Sectors_Str: resb 10 149 00017ED2 ?? <1> Vol_Free_Sectors_Str_End: resb 1 150 <1> 151 <1> ; 10/02/2016 152 00017ED3 ?? <1> RUN_CDRV: resb 1 ; CMD_INTR.ASM ; 09/11/2011 153 <1> 154 <1> ; 24/01/2016 155 00017ED4 <1> PATH_Array: resb 128 ; DIR.ASM ; 09/10/2011 156 <1> ; 06/02/2016 157 00017F54 ???????? <1> CCD_DriveDT: resd 1 ; DIR.ASM ; (word) 158 00017F58 ?? <1> CCD_Level: resb 1 ; DIR.ASM 159 00017F59 ?? <1> Last_Dir_Level: resb 1 ; DIR.ASM 160 <1> ; 161 00017F5A ???? <1> CDLF_AttributesMask: resw 1 ; DIR.ASM 162 00017F5C ???????? <1> CDLF_FNAddress: resd 1 ; DIR.ASM (word) 163 00017F60 ???? <1> CDLF_DEType: resw 1 ; DIR.ASM 164 <1> ; 165 00017F62 ?? <1> CD_COMMAND: resb 1 ; DIR.ASM 166 <1> 167 00017F63 ?? <1> alignb 4 168 <1> 169 <1> ; 29/01/2016 170 00017F64 ?? <1> Program_Exit: resb 1 ; CMD_INTR.ASM ; 09/11/2011 171 <1> 172 <1> ;alignb 4 173 <1> ; 23/02/2016 174 00017F65 ?? <1> disk_rw_op: resb 1 ; 0 = disk read, 1 = disk write 175 <1> ;disk_rw_spt: resb 1 ; sectors per track (<= 63) /// (<256) 176 <1> ; 31/01/2016 177 00017F66 ?? <1> retry_count: resb 1 ; DISK_IO.ASM ; 20/07/2011 (CHS_RetryCount) 178 00017F67 ?? <1> disk_rw_err: resb 1 ; DISK_IO.ASM ; (Disk_IO_err_code) 179 00017F68 ???????? <1> sector_count: resd 1 ; DISK_IO.ASM ; (Disk_RW_SectorCount) 180 <1> 181 <1> ; 06/02/2016 (long name) 182 00017F6C ???? <1> FDE_AttrMask: resw 1 ; DIR.ASM 183 00017F6E ???? <1> AmbiguousFileName: resw 1 ; DIR.ASM 184 00017F70 ?? <1> PreviousAttr: resb 1 ; DIR.ASM 185 <1> ; 186 00017F71 ?? <1> LongNameFound: resb 1 ; DIR.ASM 187 00017F72 ?? <1> LFN_EntryLength: resb 1 ; DIR.ASM 188 00017F73 ?? <1> LFN_CheckSum: resb 1 ; DIR.ASM 189 00017F74 <1> LongFileName: resb 132 ; DIR.ASM 190 <1> 191 <1> ;PATH_Array_Ptr: resw 1 ; DIR.ASM 192 00017FF8 ?? <1> PATH_CDLevel: resb 1 ; DIR.ASM 193 00017FF9 ?? <1> PATH_Level: resb 1 ; DIR.ASM 194 <1> 195 <1> ; 07/02/2016 196 00017FFA <1> Dir_File_Name: resb 13 ; DIR.ASM ; 09/10/2011 197 <1> 198 <1> ; 10/02/2016 199 00018007 <1> Dir_Entry_Name: resb 13 ; DIR.ASM 200 <1> 201 <1> alignb 2 202 <1> 203 00018014 ???? <1> AttributesMask: resw 1 ; CMD_INTR.ASM ; 09/11/2011 204 <1> 205 <1> ; 10/02/2016 (128 bytes -> 126 bytes) 206 <1> ; 08/02/2016 207 <1> ;FFF Structure (128 bytes) ; DIR.ASM ; 09/10/2011 208 00018016 ?? <1> FindFile_Drv: resb 1 209 00018017 <1> FindFile_Directory: resb 65 210 00018058 <1> FindFile_Name: resb 13 211 <1> FindFile_LongNameEntryLength: 212 00018065 ?? <1> FindFile_LongNameYes: resb 1 ; Sign for longname procedures 213 <1> ;Above 80 bytes form 214 <1> ;TR-DOS Source/Destination File FullName Format/Structure 215 00018066 ???? <1> FindFile_AttributesMask: resw 1 216 00018068 <1> FindFile_DirEntry: resb 32 217 00018088 ???????? <1> FindFile_DirFirstCluster: resd 1 218 0001808C ???????? <1> FindFile_DirCluster: resd 1 219 00018090 ???? <1> FindFile_DirEntryNumber: resw 1 220 00018092 ???? <1> FindFile_MatchCounter: resw 1 221 00018094 ???? <1> FindFile_Reserved: resw 1 ; 06/03/2016 222 <1> 223 00018096 ???????? <1> First_Path_Pos: resd 1 ; DIR.ASM ; 09/10/2011 224 0001809A ???????? <1> Last_Slash_Pos: resd 1 ; DIR.ASM 225 <1> 226 <1> ; 10/02/2016 227 0001809E ???? <1> File_Count: resw 1 ; DIR.ASM ; 09/10/2011 228 000180A0 ???? <1> Dir_Count: resw 1 229 000180A2 ???????? <1> Total_FSize: resd 1 230 000180A6 ???????? <1> TFS_Dec_Begin: resd 1 231 000180AA <1> resb 10 232 000180B4 ?? <1> TFS_Dec_End: resb 1 233 <1> 234 000180B5 ?? <1> PrintDir_RowCounter: resb 1 235 <1> 236 000180B6 ???? <1> alignb 4 237 <1> ; 15/02/2015 ('show' command variables) 238 000180B8 ???????? <1> Show_FDT: resd 1 239 000180BC ???????? <1> Show_LDDDT: resd 1 240 000180C0 ???????? <1> Show_Cluster: resd 1 241 000180C4 ???????? <1> Show_FileSize: resd 1 242 000180C8 ???????? <1> Show_FilePointer: resd 1 243 000180CC ???? <1> Show_ClusterPointer: resw 1 244 000180CE ???? <1> Show_ClusterSize: resw 1 245 000180D0 ?? <1> Show_RowCount: resb 1 246 <1> 247 000180D1 ?????? <1> alignb 4 248 <1> ; 21/02/2016 249 000180D4 ???????? <1> DelFile_FNPointer: resd 1 ; ; CMD_INTR.ASM (word) ; 09/11/2011 250 <1> ; 27/02/2016 251 <1> ; DIR.ASM (09/10/2011) 252 000180D8 ???????? <1> DelFile_FCluster: resd 1 253 000180DC ???? <1> DelFile_EntryCounter: resw 1 254 000180DE ?? <1> DelFile_LNEL: resb 1 255 <1> ; 17/07/2025 256 <1> ;resb 1 257 <1> ; 22/02/2016 258 000180DF ?? <1> UPDLMDT_CDirLevel: resb 1 259 000180E0 ???????? <1> UPDLMDT_CDirFCluster: resd 1 260 <1> 261 <1> ; DIR.ASM 262 000180E4 ???????? <1> mkdir_DirName_Offset: resd 1 263 000180E8 ???????? <1> mkdir_FFCluster: resd 1 264 000180EC ???????? <1> mkdir_LastDirCluster: resd 1 265 000180F0 ???????? <1> mkdir_FreeSectors: resd 1 266 000180F4 ???? <1> mkdir_attrib: resw 1 267 000180F6 ?? <1> mkdir_SecPerClust: resb 1 268 000180F7 ?? <1> mkdir_add_new_cluster: resb 1 269 000180F8 <1> mkdir_Name: resb 13 270 00018105 ???? <1> resw 1 ; 01/03/2016 271 <1> ; 27/02/2016 272 00018107 ?? <1> RmDir_MultiClusters: resb 1 273 00018108 ???????? <1> RmDir_DirEntryOffset: resd 1 ; 01/03/2016 (word -> dword) 274 0001810C ???????? <1> RmDir_ParentDirCluster: resd 1 275 00018110 ???????? <1> RmDir_DirLastCluster: resd 1 276 00018114 ???????? <1> RmDir_PreviousCluster: resd 1 277 <1> 278 <1> ; 17/07/2025 - TRDOS 386 v2.0.10 279 00018118 ???????? <1> rmdir_dir_fcluster: resd 1 280 0001811C ?? <1> rmdir_drv: resb 1 281 <1> 282 0001811D ?????? <1> alignb 4 283 <1> ; DRV_FAT.ASM ; 21/08/2011 284 00018120 ???????? <1> gffc_next_free_cluster: resd 1 285 00018124 ???????? <1> gffc_first_free_cluster: resd 1 286 00018128 ???????? <1> gffc_last_free_cluster: resd 1 287 <1> 288 <1> ;29/04/2016 289 <1> Cluster_Index: ; resd 1 290 <1> ; 22/02/2016 291 0001812C ???????? <1> ClusterValue: resd 1 292 <1> ; 04/03/2016 293 00018130 ?? <1> Attributes: resb 1 294 <1> ;;CFS_error: resb 1 ;; 01/03/2016 295 00018131 ?? <1> resb 1 296 00018132 ?? <1> CFS_OPType: resb 1 297 00018133 ?? <1> CFS_Drv: resb 1 298 00018134 ???????? <1> CFS_CC: resd 1 299 00018138 ???????? <1> CFS_FAT32FSINFOSEC: resd 1 300 0001813C ???????? <1> CFS_FAT32FC: resd 1 301 <1> 302 <1> ; 27/02/2016 303 <1> ;alignb 4 304 00018140 ???????? <1> glc_prevcluster: resd 1 ; DRV_FAT.ASM (21/08/2011) 305 <1> ; 22/10/2016 306 00018144 ???????? <1> glc_index: resd 1 ; Last Cluster Index (22/10/2016) 307 <1> 308 <1> ; DIR.ASM 309 00018148 ???? <1> DLN_EntryNumber: resw 1 310 0001814A ?? <1> DLN_40h: resb 1 311 <1> ; 28/02/2016 312 0001814B ?? <1> TCC_FATErr: resb 1 ; DRV_FAT.ASM 313 <1> 314 <1> alignb 4 315 <1> ; DIR.ASM (09/10/2011) 316 0001814C ???? <1> LCDE_EntryIndex: resw 1 ; LCDE_EntryOffset 317 0001814E ???? <1> LCDE_ClusterSN: resw 1 318 00018150 ???????? <1> LCDE_Cluster: resd 1 319 00018154 ???????? <1> LCDE_ByteOffset: resd 1 320 <1> 321 <1> ;alignb4 322 <1> ; 06/03/2016 (word -> dword) 323 <1> ; CMD_INTR.ASM (01/08/2010) 324 00018158 ???????? <1> SourceFilePath: resd 1 325 0001815C ???????? <1> DestinationFilePath: resd 1 326 <1> 327 <1> ;alignb 4 328 <1> ; 06/03/2016 329 <1> ; FILE.ASM (09/10/2011) 330 <1> ;Source File Structure (same with 'Find File' Structure) 331 00018160 ?? <1> SourceFile_Drv: resb 1 332 00018161 <1> SourceFile_Directory: resb 65 333 000181A2 <1> SourceFile_Name: resb 13 334 <1> SourceFile_LongNameEntryLength: 335 000181AF ?? <1> SourceFile_LongNameYes: resb 1 ; Sign for longname procedures 336 <1> ;Above 80 bytes 337 <1> ;is TR-DOS Source File FullName Format/Structure 338 000181B0 ???? <1> SourceFile_AttributesMask: resw 1 339 000181B2 <1> SourceFile_DirEntry: resb 32 340 000181D2 ???????? <1> SourceFile_DirFirstCluster: resd 1 341 000181D6 ???????? <1> SourceFile_DirCluster: resd 1 342 000181DA ???? <1> SourceFile_DirEntryNumber: resw 1 343 000181DC ???? <1> SourceFile_MatchCounter: resw 1 344 <1> ; 16/03/2016 345 000181DE ?? <1> SourceFile_SecPerClust: resb 1 346 000181DF ?? <1> SourceFile_Reserved: resb 1 347 <1> ; Above is 128 bytes 348 <1> 349 <1> ;Destination File Structure (same with 'Find File' Structure) 350 000181E0 ?? <1> DestinationFile_Drv: resb 1 351 000181E1 <1> DestinationFile_Directory: resb 65 352 00018222 <1> DestinationFile_Name: resb 13 353 <1> DestinationFile_LongNameEntryLength: 354 0001822F ?? <1> DestinationFile_LongNameYes: resb 1 ; Sign for longname procedures 355 <1> ;Above 80 bytes 356 <1> ;is TR-DOS Destination File FullName Format/Structure 357 00018230 ???? <1> DestinationFile_AttributesMask: resw 1 358 00018232 <1> DestinationFile_DirEntry: resb 32 359 00018252 ???????? <1> DestinationFile_DirFirstCluster: resd 1 360 00018256 ???????? <1> DestinationFile_DirCluster: resd 1 361 0001825A ???? <1> DestinationFile_DirEntryNumber: resw 1 362 0001825C ???? <1> DestinationFile_MatchCounter: resw 1 363 <1> ; 16/03/2016 364 0001825E ?? <1> DestinationFile_SecPerClust: resb 1 365 0001825F ?? <1> DestinationFile_Reserved: resb 1 366 <1> ; Above is 128 bytes 367 <1> 368 <1> ; 24/04/2016 369 00018260 ???? <1> resw 1 370 <1> 371 <1> ; 10/03/2016 372 <1> ; FILE.ASM 373 00018262 ?? <1> move_cmd_phase: resb 1 374 00018263 ?? <1> msftdf_sf_df_drv: resb 1 375 00018264 ???????? <1> msftdf_drv_offset: resd 1 376 <1> 377 <1> ; 11/03/2016 378 <1> ; DRV_FAT.ASM (21/08/2011) 379 00018268 ???????? <1> FAT_anc_LCluster: resd 1 380 0001826C ???????? <1> FAT_anc_FFCluster: resd 1 381 <1> 382 <1> ;alignb 4 383 <1> 384 <1> ; 14/03/2016 385 <1> ; TRDOS 386 = TRDOS v2.0 feature only ! 386 <1> ; 'allocate_memory_block' in 'memory.s' 387 00018270 ???????? <1> mem_ipg_count: resd 1 ; page count (for contiguous allocation) 388 00018274 ???????? <1> mem_pg_count: resd 1 ; page count (for count down) 389 00018278 ???????? <1> mem_aperture: resd 1 ; contiguous free pages (current) 390 0001827C ???????? <1> mem_max_aperture: resd 1 ; maximum value of contiguous free pages 391 00018280 ???????? <1> mem_pg_pos: resd 1 ; mem. position (page #) of current aperture 392 00018284 ???????? <1> mem_max_pg_pos: resd 1 ; mem. position (page #) of max. aperture 393 <1> 394 <1> ; 15/03/2016 395 <1> ; FILE.ASM ('copy_source_file_to_destination_file') 396 00018288 ?? <1> copy_cmd_phase: resb 1 397 00018289 ?? <1> csftdf_rw_err: resb 1 398 0001828A ?? <1> DestinationFileFound: resb 1 399 0001828B ?? <1> csftdf_cdrv: resb 1 400 0001828C ???????? <1> csftdf_filesize: resd 1 401 <1> ; TRDOS386 (TRDOS v2.0) 402 <1> MainProgCfg_mem_addr: ; 19/12/2025 403 00018290 ???????? <1> csftdf_sf_mem_addr: resd 1 404 <1> MainProgCfg_mem_bsize: ; 19/12/2025 405 00018294 ???????? <1> csftdf_sf_mem_bsize: resd 1 406 <1> ; 407 <1> MainProgCfg_cluster: ; 19/12/2025 408 00018298 ???????? <1> csftdf_sf_cluster: resd 1 ; 16/03/2016 409 0001829C ???????? <1> csftdf_df_cluster: resd 1 410 <1> MainProgCfg_r_size: ; 19/12/2025 411 <1> ; 16/03/2016 412 000182A0 ???????? <1> csftdf_r_size: resd 1 413 000182A4 ???????? <1> csftdf_w_size: resd 1 414 <1> MainProgCfg_rbytes: ; 19/12/2025 415 000182A8 ???????? <1> csftdf_sf_rbytes: resd 1 416 000182AC ???????? <1> csftdf_df_wbytes: resd 1 417 000182B0 ?? <1> csftdf_percentage: resb 1 418 <1> ; 17/03/2016 419 000182B1 ?? <1> csftdf_videopage: resb 1 420 000182B2 ???? <1> csftdf_cursorpos: resw 1 421 000182B4 ???????? <1> csftdf_sf_drv_dt: resd 1 422 000182B8 ???????? <1> csftdf_df_drv_dt: resd 1 423 <1> ; 01/09/2024 424 <1> ; 29/08/2024 425 <1> ;csftdf_df_dclust: resd 1 426 <1> ;csftdf_df_dindex: resd 1 427 <1> 428 <1> ; 21/03/2016 429 <1> ; 20/03/2016 430 <1> ; FILE.ASM 431 000182BC ???????? <1> createfile_Name_Offset: resd 1 432 000182C0 ???????? <1> createfile_FreeSectors: resd 1 433 000182C4 ???????? <1> createfile_size: resd 1 434 000182C8 ???????? <1> createfile_FFCluster: resd 1 ; 11/03/2016 435 000182CC ???????? <1> createfile_LastDirCluster: resd 1 436 000182D0 ???????? <1> createfile_Cluster: resd 1 437 000182D4 ???????? <1> createfile_PCluster: resd 1 438 000182D8 ?? <1> createfile_attrib: resb 1 439 000182D9 ?? <1> createfile_SecPerClust: resb 1 440 000182DA ???? <1> createfile_DirIndex: resw 1 441 000182DC ???????? <1> createfile_CCount: resd 1 442 <1> ; 19/12/2025 443 <1> ;createfile_BytesPerSec: resw 1 ; 23/03/2016 444 000182E0 ?? <1> createfile_wfc: resb 1 445 000182E1 ?? <1> createfile_UpdatePDir: resb 1 ; 31/03/2016 446 <1> 447 <1> ;alignb 4 448 <1> 449 <1> ; 11/04/2016 450 000182E2 ???? <1> env_var_length: resw 1 451 <1> 452 <1> alignb 4 453 <1> 454 <1> ; 25/04/2016 455 000182E4 ?? <1> readi.valid: resb 1 ; valid data (>0 = valid for readi) 456 000182E5 ?? <1> readi.drv: resb 1 ; drive number (0, 1,2,3,4..) 457 000182E6 ?? <1> readi.spc: resb 1 ; sectors per cluster for 'readi' drive 458 000182E7 ?? <1> readi.s_index: resb 1 ; sector index in current cluster (buffer) 459 000182E8 ???????? <1> readi.sector: resd 1 ; current disk sector 460 000182EC ???? <1> readi.bpc: resw 1 ; bytes per cluster - 1 461 000182EE ???? <1> readi.offset: resw 1 ; byte offset in cluster buffer 462 000182F0 ???????? <1> readi.cluster: resd 1 ; current cluster number 463 000182F4 ???????? <1> readi.c_index: resd 1 ; cluster index of the current cluster (0,1,2,3..) 464 000182F8 ???????? <1> readi.fclust: resd 1 ; first cluster of the current cluster 465 <1> ; 19/12/2025 466 <1> ;readi.fs_index: resd 1 ; sector index in disk/file section (for Singlix FS) 467 <1> ;readi.buffer: resd 1 ; readi sector buffer address 468 <1> 469 <1> ;alignb 4 470 <1> 471 000182FC ?? <1> writei.valid: resb 1 ; valid data (>0 = valid for writei) 472 000182FD ?? <1> writei.drv: resb 1 ; drive number (0, 1,2,3,4..) 473 000182FE ?? <1> writei.spc: resb 1 ; sectors per cluster for 'writei' drive 474 000182FF ?? <1> writei.s_index: resb 1 ; sector index in current cluster (buffer) 475 00018300 ???????? <1> writei.sector: resd 1 ; current disk sector 476 00018304 ???? <1> writei.bpc: resw 1 ; bytes per cluster - 1 477 00018306 ???? <1> writei.offset: resw 1 ; byte offset in cluster buffer 478 00018308 ???????? <1> writei.cluster: resd 1 ; current cluster number 479 0001830C ???????? <1> writei.c_index: resd 1 ; cluster index of the current cluster (0,1,2,3..) 480 00018310 ???????? <1> writei.fclust: resd 1 ; first cluster of the current cluster 481 00018314 ???????? <1> writei.fs_index: resd 1 ; sector index in disk/file section (for Singlix FS) 482 <1> ;writei.buffer: resd 1 ; writei sector buffer address 483 00018318 ???????? <1> writei.lclust: resd 1 ; writei last cluster (mget_w) ; 23/10/2016 484 0001831C ???????? <1> writei.l_index: resd 1 ; writei last cluster index (mget_w) ; 23/10/2016 485 00018320 ?? <1> writei.ofn: resb 1 ; open file number (to be written) ; 23/10/2016 486 <1> 487 00018321 ?????? <1> alignb 4 488 <1> 489 <1> ; 29/04/2016 490 00018324 ???????? <1> Run_CDirFC: resd 1 491 <1> ;Run_Auto_Path: resb 1 492 <1> ; 03/07/2025 493 <1> Run_Path_Length: 494 00018328 ???????? <1> resd 1 495 0001832C ???????? <1> Run_Auto_Path: resd 1 496 <1> Run_Manual_Path: 497 00018330 ?? <1> resb 1 ; 0 -> auto path sequence needed 498 00018331 ?? <1> EXE_ID: resb 1 499 00018332 ?? <1> EXE_dot: resb 1 500 00018333 ?? <1> resb 1 ; 03/07/2025 501 <1> 502 <1> ; 06/05/2016 503 00018334 ???????? <1> mainprog_return_addr: resd 1 504 00018338 ???????? <1> last_error: resd 1 ; this will be used to return error code to MainProg 505 <1> ; 'lasterror' keyword will be used later to get the 506 <1> ; last error code/number/status. 507 <1> ; 12/05/2016 508 0001833C ???????? <1> video_eax: resd 1 ; eax return value of video function 509 <1> 510 <1> ; 01/06/2016 511 00018340 ???????? <1> user_buffer: resd 1 ; 'diskio.s' (INT 33h, Function 08h, floppy disk type) 512 <1> 513 <1> ; 21/05/2016 - TRDOS 386 ('swap/switch', 'rswap', [u.pri]) 514 00018344 ?? <1> priority: resb 1 ; running priority level of process (0,1,2) 515 <1> ; (run queue which is process comes from) 516 <1> ; 22/05/2016 - TRDOS 386 ('set_run_sequence', 'rtc_int', 'u_timer') 517 00018345 ?? <1> p_change: resb 1 ; process change status (for timer events) 518 <1> ; 23/05/2016 - TRDOS 386 ('clock') 519 00018346 ?? <1> multi_tasking: resb 1 ; Multi Tasking status (0 = disabled, >0 = enabled) 520 <1> ; (EBX will return with user buffer addr or disk type) 521 <1> ; 07/06/2016 522 00018347 ?? <1> timer_events: resb 1 ; number of (active) timer events, <= 16 523 <1> 524 <1> ; 24/06/2016 525 00018348 ?? <1> w_str_cmd: resb 1 ; WRITE_STRING command (0,1,2,3) ; video.s 526 00018349 ?? <1> p_crt_mode: resb 1 ; previous video mode (=3 or 0), backup mark/sign 527 <1> ; 26/06/2016 528 0001834A ?? <1> p_crt_page: resb 1 ; previous active page (for 'set_mode') 529 <1> ; 04/07/2016 530 0001834B ?? <1> noclearmem: resb 1 ; if set, 'SET MODE' (INT 31h) function (AH = 4) 531 <1> ; will not clear the video memory 532 <1> ; (usable for graphics modes only) 533 <1> alignb 2 534 0001834C ???? <1> CRT_LEN: resw 1 ; length of regen buffer in bytes 535 0001834E <1> cursor_pposn: resw 8 ; cursor positions backup 536 <1> 537 <1> ; 10/07/2016 ('VGA_FONT_SETUP', INT 43H address for x86 real mode bios) 538 0001835E ???????? <1> VGA_INT43H: resd 1 ; 0 = default (not configured by user) 539 <1> ; 0FFFFFFFFh = user defined fonts 540 <1> ; address: 541 <1> ; vgafont8 542 <1> ; vgafont16 543 <1> ; vgafont14 544 <1> 545 <1> ; 25/07/2016 546 00018362 ?? <1> VGA_MTYPE: resb 1 ; 0=CTEXT,1=MTEXT,2=CGA,3=PLANAR1,4=PLANAR4,5=LINEAR 547 <1> 548 <1> ; 23/10/2016 549 00018363 ?? <1> setfmod: resb 1 ; update last modification date&time sign (if >0) 550 <1> ; (it is Open File Number + 1, if > 0) 551 <1> ; 27/08/2024 552 00018364 ?? <1> setfclust: resb 1 ; first cluster of file 553 <1> ; (is used by update lmdt proc) 554 00018365 ?????? <1> alignb 4 555 <1> 556 <1> ; 16/10/2016 557 00018368 ???????? <1> FFF_UBuffer: resd 1 ; User's buffer address for FFF & FNF system calls 558 <1> ; 15/10/2016 559 0001836C ?? <1> FFF_Valid: resb 1 ; Find First File Structure validation byte 560 <1> ; 0 = invalid (Find Next File can't use FFF struct) 561 <1> ; >0 = valid, return type for FFF and Find Next File 562 <1> ; 24 = basic parameters, 24 bytes 563 <1> ; 128 = entire FFF structure/table, 128 bytes 564 <1> ; 16/10/2016 (FFF_Attrib: resw 1) 565 0001836D ?? <1> FFF_Attrib: resb 1 ; Find First File attributes for Find Next File (LB) 566 0001836E ?? <1> FFF_RType: resb 1 ; FFF return type (0 = Basic, >0 = complete) (HB) 567 <1> ; 16/10/2016 - 05/10/2016 (Set Working Path) 568 0001836F ?? <1> SWP_inv_fname: resb 1 ; Set Working Path - Invalid File Name 569 00018370 ???? <1> SWP_Mode: resw 1 ; Set Working Path - Mode 570 00018372 ?? <1> SWP_DRV: resb 1 ; Set Working Path - Drive 571 00018373 ?? <1> SWP_DRV_chg: resb 1 ; Set Working Path - Drive Change 572 <1> 573 <1> ; 27/02/2017 574 00018374 ?? <1> fpready: resb 1 ; '80387 fpu is ready' flag 575 <1> 576 <1> ; 17/04/2021 577 <1> ; (DEVICE parameters is disabled as temporary) 578 <1> 579 <1> ; 08/10/2016 580 <1> ;device_name: resb 9 ; capitalized (and zero padded) device name 581 <1> ; (example: "TTY0",0,0,0,0,0") 582 <1> 583 00018375 ?????? <1> alignb 4 584 <1> 585 <1> ; 08/10/2016 586 <1> ; 07/10/2016 587 <1> ; Table of kernel devices (which do not use installable device drivers) 588 <1> ; has been coded into KERNEL (trdosk9.s) 589 <1> ; 07/10/2016 590 <1> ; 8 installable device drivers available to install (NUMIDEV) 591 <1> ;IDEV_PGDIR: resd NUMIDEV 592 <1> ; Page directories of installable device drivers 593 <1> ; 594 <1> ; Note: Virtual start address is always 400000h 595 <1> ; (end of the 1st 4MB). [org 400000h] 596 <1> ; Segments: KCODE, KDATA 597 <1> ; Method: call 400000h (after changing page dir) 598 <1> ; Query code located at the start (400000h). 599 <1> ; Query code returns with 600 <1> ; eax = device type and driver version 601 <1> ; AL = Device Type minor 602 <1> ; AH = Device Type major 603 <1> ; Byte 16-23 : Version minor 604 <1> ; Byte 24-31 : Version major - 1 605 <1> ; (0:0 -> 1.0) 606 <1> ; ebx = initialization code address 607 <1> ; ecx = configuration table address 608 <1> ; edx = description table address 609 <1> ; esi = device (default) name address (ASCIIZ) 610 <1> ; (name has "/DEV/" prefix) 611 <1> ; edi = dispatch table address 612 <1> ; (for calling kernel-device functions) 613 <1> ; ebp = address table address 614 <1> ; Initialization code returns with 615 <1> ; eax = open code address 616 <1> ; ecx = close code address 617 <1> ; ebx = read code address 618 <1> ; edx = write code address 619 <1> ; esi = IOCTL code address 620 <1> ; edi = dispatch table address 621 <1> ; ebp = address table address 622 <1> ; Address Table: 623 <1> ; Offset 0 : open code address 624 <1> ; Offset 4 : read code address 625 <1> ; Offset 8 : write code address 626 <1> ; Offset 12 : close code address 627 <1> ; Offset 16 : IOCTL code address 628 <1> ; Offset 20 : initialization code address 629 <1> ; Offset 24 : description table address 630 <1> ; Offset 28 : configuration table address 631 <1> ; Offset 32 : device name address 632 <1> ; Offset 36 : dispatch table address 633 <1> ; (for calling kernel-device functions) 634 <1> 635 <1> ;IDEV_NAME: resb 8*NUMIDEV 636 <1> ; 8 byte names of installable device drivers 637 <1> 638 <1> ;IDEV_TYPE: resb NUMIDEV ; Driver type of installable device drivers 639 <1> ;IDEV_FLAGS: resb NUMIDEV ; Device access parameters for installable 640 <1> ; device drivers (These values are set while 641 <1> ; the device driver is being loaded.) 642 <1> ;IDEV_OADDR: resd NUMIDEV ; open function addr for installable dev driver 643 <1> ;IDEV_CADDR: resd NUMIDEV ; close function addr for installable dev driver 644 <1> ;IDEV_RADDR: resd NUMIDEV ; read function addr for installable dev driver 645 <1> ;IDEV_WADDR: resd NUMIDEV ; write function addr for installable dev driver 646 <1> 647 <1> ; 08/10/2016 648 <1> ; 07/10/2016 649 <1> ; Device Open and Access parameters 650 <1> ;DEV_ACCESS: resb NUMOFDEVICES ; bit 0 = accessable by normal users 651 <1> ; bit 1 = read access permission 652 <1> ; bit 2 = write access permission 653 <1> ; bit 3 = IOCTL permission to users 654 <1> ; bit 4 = block device if it is set 655 <1> ; bit 5 = 16 bit or 1024 byte data 656 <1> ; bit 6 = 32 bit or 2048 byte data 657 <1> ; bit 7 = installable device driver 658 <1> ;DEV_R_OWNER: resb NUMOFDEVICES ; Reading owner no (u.uid) of devices 659 <1> ;DEV_R_OPENCOUNT: resb NUMOFDEVICES ; Reading open count 660 <1> ;DEV_W_OWNER: resb NUMOFDEVICES ; Writing owner no (u.uid) of devices 661 <1> ;DEV_W_OPENCOUNT: resb NUMOFDEVICES ; Writing open count 662 <1> ;DEV_DRIVER: resb NUMOFDEVICES ; device driver number (1 to 7Fh) 663 <1> ; *if bit 7 is set (80 to FFh) 664 <1> ; *if it is installable device driver 665 <1> ; *index (0 to 7Fh) 666 <1> ; otherwise it is kernel device index 667 <1> ;DEV_OPENMODE: resb NUMOFDEVICES ; 1 = read mode 668 <1> ; 2 = write mode 669 <1> ; 3 = read & write 670 <1> ; 0 = not open (free) 671 <1> ;DEV_NAME_PTR: resd NUMOFDEVICES ; pointers to name addresses of drivers 672 <1> ; Address base: KDEV_NAME+ 673 <1> ; or IDEV_NAME+ 674 <1> ;DEV_R_POINTER: resd NUMOFDEVICES ; reading pointer, writing pointer 675 <1> ;DEV_W_POINTER: resd NUMOFDEVICES ; sector number if block device 676 <1> ; character offset if char device 677 <1> alignb 4 678 <1> 679 <1> ; 06/10/2016 680 <1> ; Open File Parameters 681 00018378 <1> OF_FCLUSTER: resd OPENFILES ; First clusters of open files 682 000183F8 <1> OF_DRIVE: resb OPENFILES ; Logical DOS drive numbers of open files 683 00018418 <1> OF_MODE: resb OPENFILES ; Open mode (1 = read, 2 = write, 3 = r&w) 684 00018438 <1> OF_STATUS: resb OPENFILES ; (bit 0 = read, bit 1 = write) 685 00018458 <1> OF_OPENCOUNT: resb OPENFILES ; Open counts of open files 686 00018478 <1> OF_POINTER: resd OPENFILES ; File seek/read/write pointer 687 000184F8 <1> OF_SIZE: resd OPENFILES ; File sizes of open files (in bytes) 688 00018578 <1> OF_DIRFCLUSTER: resd OPENFILES ; Directory First Clusters of open files 689 000185F8 <1> OF_DIRCLUSTER: resd OPENFILES ; Directory (Entry) Clusters of open files 690 00018678 <1> OF_VOLUMEID: resd OPENFILES ; Vol ID for removable drives of open files 691 000186F8 <1> OF_CCLUSTER: resd OPENFILES ; Current clusters of open files 692 00018778 <1> OF_CCINDEX: resd OPENFILES ; Cluster index numbers of current clusters 693 <1> ; 24/10/2016 694 000187F8 <1> OF_DIRENTRY: resw OPENFILES ; Directory entry index no. in dir cluster 695 <1> ; Sector index = entry index / 16 696 <1> ;alignb 2 697 <1> 698 <1> DTA: ;resd 24 ; Find First File data transfer area 699 00018838 <1> resb 24 ; 29/07/2022 700 <1> 701 <1> ; 19/12/2016 702 00018850 ?? <1> tcallback: resb 1 ; Timer callback method flag for 'systimer' 703 00018851 ?? <1> trtc: resb 1 ; Timer interrupt type flag for 'systimer' 704 <1> ; 20/02/2017 705 00018852 ?? <1> no_page_swap: resb 1 ; Swap lock for Signal Response Byte pages 706 <1> ;;15/01/2017 707 <1> ; 02/01/2017 708 <1> ;;intflg: resb 1 ; software interrupt in progress signal 709 <1> ; (for timer interrupt) 710 00018853 ?? <1> alignb 4 711 <1> ; 13/04/2017 712 <1> ;DEV_INTR: resb NUMOFDEVICES ; Device Interrupt (IRQ) number + 1 713 <1> ; (0= not available, 1= IRQ 0, 16= IRQ 15) 714 00018854 <1> DEV_INT_HNDLR: resd 16 ; Device Interrupt Handler addr, if > 0 715 <1> 716 <1> ;alignb 4 717 <1> 718 <1> ; 26/02/2017 ; IRQ Callback parameters ('syscalbac') 719 <1> ;Index: ; 0 to 8 720 <1> ; 0 = IRQ3, 1 = IRQ4, 2 = IRQ5, 3 = IRQ7 721 <1> ; 4 = IRQ9, 5 = IRQ10, 6 = IRQ11, 7 = IRQ12, 8 = IRQ13 722 00018894 <1> IRQ.owner: resb 9 ; owner, 0 = free, >0 = [u.uno] 723 0001889D <1> IRQ.dev: resb 9 ; 0 = default/kernel, >0 = device number 724 000188A6 <1> IRQ.method: resb 9 ; 0 = Signal Response Byte, 1 = Callback 725 000188AF <1> IRQ.srb: resb 9 ; Signal Response/Return Byte value 726 000188B8 <1> IRQ.addr: resd 9 ; Rignal Response Byte address (physical) 727 <1> ; or Callback service address (virtual) 728 <1> ; 28/02/2017 729 000188DC ???????? <1> IRQ_cr3: resd 1 ; for saving cr3 register in IRQ handler 730 000188E0 ?? <1> IRQnum: resb 1 ; IRQ number for IRQ handler (trdosk8.s) 731 <1> 732 <1> ; 10/04/2017 733 <1> ; 03/04/2017 734 <1> ; UNINITIALIZED AUDIO DATA 735 000188E1 ?????? <1> alignb 4 736 000188E4 ?? <1> audio_pci: resb 1 737 000188E5 ?? <1> audio_device: resb 1 738 <1> ;audio_mode: resb 1 739 000188E6 ?? <1> audio_intr: resb 1 740 000188E7 ?? <1> audio_busy: resb 1 ; Busy flag for audio irq ; 21/04/2017 741 <1> ;audio_reserved: resb 1 742 <1> ; 20/11/2023 743 000188E8 ???? <1> NAMBAR: resw 1 ; Native Audio Mixer Base Address 744 <1> NABMBAR: ; 02/10/2023 (NABMBAR = audio_io_base) 745 000188EA ???? <1> audio_io_base: resw 1 ; Base I/O address of audio device 746 000188EC ???????? <1> audio_dev_id: resd 1 ; BUS/DEV/FN ; 00000000BBBBBBBBDDDDDFFF00000000 747 000188F0 ???????? <1> audio_vendor: resd 1 748 000188F4 ???????? <1> audio_stats_cmd: resd 1 749 <1> ; 750 000188F8 ???????? <1> audio_buffer: resd 1 ; virtual address of user's audio buffer 751 000188FC ???????? <1> audio_p_buffer: resd 1 ; Physical address of user's audio buffer 752 00018900 ???????? <1> audio_buff_size: resd 1 ; user's audio buffer size (half buffer size) 753 00018904 ???????? <1> audio_dma_buff: resd 1 ; dma buffer address 754 00018908 ???????? <1> audio_dmabuff_size: resd 1 ; dma buffer size (2 * half buffer size) 755 <1> ; 05/06/2024 756 0001890C ???????? <1> dma_hbuff_size: resd 1 ; dma half buffer size 757 <1> ; 758 00018910 ?? <1> audio_flag: resb 1 ; dma buffer flag (1st half = 0, 2nd half = 1) 759 00018911 ?? <1> audio_user: resb 1 ; user number of the owner 760 00018912 ?? <1> audio_cb_mode: resb 1 ; 0 = signal response byte method 761 <1> ; 1 = callback method 762 <1> ; 2 = s.r.b. method with auto increment 763 00018913 ?? <1> audio_srb: resb 1 ; signal response byte value 764 00018914 ???????? <1> audio_cb_addr: resd 1 ; callback service address or s.r.b. address 765 <1> ; (s.r.b. addr is physical, cbs addr is virtual) 766 <1> 767 00018918 ?? <1> audio_bps: resb 1 ; selected mode: 8 bit, 16 bit 768 00018919 ?? <1> audio_stmo: resb 1 ; selected mode: mono /stereo 769 0001891A ???? <1> audio_freq: resw 1 ; sampling rate 770 <1> ; 20/11/2023 771 0001891C ?? <1> VRA: resb 1 772 0001891D ?? <1> audio_mode: resb 1 773 <1> 774 <1> ; 21/04/2017 775 0001891E ?? <1> audio_play_cmd: resb 1 ; Play/Stop command (1 = play, 0 = stop) 776 <1> ; 21/11/2023 777 <1> ;audio_civ: ; 28/05/2017 ; Current Buffer Index (AC'97) 778 <1> ; 23/05/2024 779 <1> LVI: ; AC'97 Last Valid Buffer Index 780 0001891F ?? <1> audio_flag_eol: resb 1 ; End of Link status (vt8233, EOL/FLAG) 781 <1> 782 <1> audio_master_volume: 783 00018920 ?? <1> audio_master_volume_l: resb 1 ; sound volume (lineout) left channel 784 00018921 ?? <1> audio_master_volume_r: resb 1 ; sound volume (lineout) right channel 785 <1> 786 <1> ; 24/05/2024 787 <1> audio_pcmo_volume: 788 00018922 ?? <1> audio_pcmo_volume_l: resb 1 ; PCM out volume left channel 789 00018923 ?? <1> audio_pcmo_volume_r: resb 1 ; PCM out volume right channel 790 <1> 791 <1> ; 02/06/2024 792 <1> ;alignb 4 793 <1> 794 <1> ; 20/11/2023 795 <1> ; 28/05/2017 796 <1> ; AC'97 Audio Controller Base Adress Registers 797 <1> ;NAMBAR: resw 1 ; Native Audio Mixer Base Address 798 <1> ;NABMBAR: resw 1 ; Native Audio Bus Mastering Base Address 799 <1> 800 <1> ; 02/06/2024 801 00018924 ???????? <1> alignb 8 802 <1> 803 <1> ; 21/04/2017 804 00018928 <1> audio_bdl_buff: resd 32*8 ; VT8233 (AC97) BDL Buffer Size 805 <1> ; 12/05/2017 806 00018D28 ???????? <1> base_addr: resd 1 ; 'direct_memory_access' (memory.s) 807 <1> 808 <1> ; 01/06/2024 809 00018D2C ?? <1> reset: resb 1 ; AC97 init 810 <1> 811 <1> ; 28/08/2017 812 <1> ; 20/08/2017 813 <1> ;resb 1 ; 814 00018D2D ?? <1> dma_user: resb 1 ; user number for sysdma 815 00018D2E ?? <1> dma_channel: resb 1 ; dma channel for sysdma 816 00018D2F ?? <1> dma_mode: resb 1 ; dma mode for sysdma 817 00018D30 ???????? <1> dma_addr: resd 1 ; dma buffer physical addr for sysdma 818 00018D34 ???????? <1> dma_size: resd 1 ; dma buffer size (in bytes) for sysdma 819 00018D38 ???????? <1> dma_start: resd 1 ; dma start address for sysdma 820 00018D3C ???????? <1> dma_count: resd 1 ; dma count (in bytes) for sysdma 821 <1> 822 <1> ; 04/12/2023 823 <1> %if 0 824 <1> 825 <1> alignb 65536 826 <1> ; 09/08/2017 827 <1> ; 12/05/2017 828 <1> sb16_dma_buffer: resb 65536 ; DMA buffer for sb16 audio playing. 829 <1> 830 <1> %endif 4008 ; 24/01/2016 4009 %include 'ubss.s' ; UNINITIALIZED KERNEL (USER) DATA 1 <1> ; **************************************************************************** 2 <1> ; TRDOS386.ASM (TRDOS 386 Kernel - v2.0.9) - UNINITIALIZED USER DATA : ubss.s 3 <1> ; ---------------------------------------------------------------------------- 4 <1> ; Last Update: 19/08/2024 (Previous: 07/08/2022) 5 <1> ; ---------------------------------------------------------------------------- 6 <1> ; Beginning: 24/01/2016 7 <1> ; ---------------------------------------------------------------------------- 8 <1> ; Assembler: NASM version 2.15 (trdos386.s) 9 <1> ; ---------------------------------------------------------------------------- 10 <1> ; Derived from 'Retro UNIX 386 Kernel - v0.2.1.0' source code by Erdogan Tan 11 <1> ; ux.s (04/12/2015) 12 <1> ; **************************************************************************** 13 <1> 14 <1> ; Retro UNIX 386 v1 Kernel - ux.s 15 <1> ; Last Modification: 04/12/2015 16 <1> ; 17 <1> ; ///////// RETRO UNIX 386 V1 SYSTEM DEFINITIONS /////////////// 18 <1> ; (Modified from 19 <1> ; Retro UNIX 8086 v1 system definitions in 'UNIX.ASM', 01/09/2014) 20 <1> ; ((UNIX.ASM (RETRO UNIX 8086 V1 Kernel), 11/03/2013 - 01/09/2014)) 21 <1> ; ---------------------------------------------------------------------------- 22 <1> ; Derived from UNIX Operating System (v1.0 for PDP-11) 23 <1> ; (Original) Source Code by Ken Thompson (1971-1972) 24 <1> ; 25 <1> ; 26 <1> ; (Section E10 (17/3/1972) - ux.s) 27 <1> ; **************************************************************************** 28 <1> ; Ref: Retro UNIX 386 v1.2 Kernel (v0.2.2.3) - ux.s - 15/07/2022 29 <1> 30 <1> alignb 2 31 <1> 32 <1> %if 0 33 <1> 34 <1> inode: 35 <1> ;; 11/03/2013. 36 <1> ;;Derived from UNIX v1 source code 'inode' structure (ux). 37 <1> ;;i. 38 <1> ; 39 <1> ;i.flgs: resw 1 40 <1> ;i.nlks: resb 1 41 <1> ;i.uid: resb 1 42 <1> ;i.size: resw 1 ; size 43 <1> ;i.dskp: resw 8 ; 16 bytes 44 <1> ;i.ctim: resd 1 45 <1> ;i.mtim: resd 1 46 <1> ;i.rsvd: resw 1 ; Reserved (ZERO/Undefined word for UNIX v1) 47 <1> 48 <1> ; 26/01/2020 49 <1> ; Retro UNIX 386 v2.0 - Modified UNIX v7 inode model 50 <1> ; (15/09/2029 .. 18/12/2019) 51 <1> 52 <1> i.flgs: resw 1 ; /* mode and type of file */ 53 <1> i.nlks: resw 1 ; /* number of links to file */ 54 <1> i.uid: resw 1 ; /* owner's user id */ - 0 to 65535 - 55 <1> i.gid: resb 1 ; /* owner's group id */ - o to 255 - 56 <1> i.size_h: resb 1 ; /* number of bytes in file */ ; byte 5 57 <1> i.size: resd 1 ; size ; /* number of bytes in file */ 58 <1> i.dskp: resd 10 ; 40 bytes ; /* disk block addresses */ 59 <1> i.atim: resd 1 ; /* time last accessed */ 60 <1> i.mtim: resd 1 ; /* time last modified */ 61 <1> i.ctim: resd 1 ; /* time created */ 62 <1> 63 <1> I_SIZE equ $ - inode 64 <1> 65 <1> %endif 66 <1> 67 <1> process: 68 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 69 <1> ; 27/02/2022 70 <1> ; 12/01/2022 - Retro UNIX 386 v1.2 71 <1> ; 19/12/2016 72 <1> ; 21/05/2016 73 <1> ; 19/05/2016 - TRDOS 386 (TRDOS v2.0) 74 <1> ; 06/05/2015 - Retro UNIX 386 v1 75 <1> ; 11/03/2013 - 05/02/2014 (Retro UNIX 8086 v1) 76 <1> ;Derived from UNIX v1 source code 'proc' structure (ux). 77 <1> ;p. 78 <1> 79 00018D40 <1> p.pid: resw nproc 80 00018D60 <1> p.ppid: resw nproc 81 <1> ;p.break: resw nproc ; 12/01/2022 (p.break is not used) 82 00018D80 <1> p.ttyc: resb nproc ; console tty in Retro UNIX 8086 v1. 83 <1> ; 27/02/2022 (p.waitc is not used) 84 <1> ;p.waitc: resb nproc ; waiting channel in Retro UNIX 8086 v1. 85 00018D90 <1> p.link: resb nproc 86 00018DA0 <1> p.stat: resb nproc 87 <1> 88 <1> ; 06/05/2015 (Retro UNIX 386 v1 feature only !) 89 00018DB0 <1> p.upage: resd nproc ; Physical address of the process's 90 <1> ; 'user' structure 91 <1> ; 21/05/2016 92 <1> ; 19/05/2016 (TRDOS 386 feature only!) 93 00018DF0 <1> p.timer: resb nproc ; number of timer events of the processs 94 <1> 95 <1> ; 19/12/2016 96 00018E00 <1> p.tcb: resd nproc ; timer callback service address (if > 0) 97 <1> 98 <1> ; 18/08/2024 (TRDOS 386 v2.0.9) 99 00018E40 <1> p.exitc: resb nproc ; exit code of the child 100 <1> 101 <1> P_SIZE equ $ - process 102 <1> 103 <1> ; fsp table (original UNIX v1) 104 <1> ; 105 <1> ;Entry 106 <1> ; 15 0 107 <1> ; 1 |---|---------------------------------------| 108 <1> ; |r/w| i-number of open file | 109 <1> ; |---|---------------------------------------| 110 <1> ; | device number | 111 <1> ; |-------------------------------------------| 112 <1> ; (*) | offset pointer, i.e., r/w pointer to file | 113 <1> ; |-------------------------------------------| 114 <1> ; | flag that says | number of processes | 115 <1> ; | file deleted | that have file open | 116 <1> ; |-------------------------------------------| 117 <1> ; 2 | | 118 <1> ; |-------------------------------------------| 119 <1> ; | | 120 <1> ; |-------------------------------------------| 121 <1> ; | | 122 <1> ; |-------------------------------------------| 123 <1> ; | | 124 <1> ; |-------------------------------------------| 125 <1> ; 3 | | 126 <1> ; | | 127 <1> ; 128 <1> ; (*) Retro UNIX 386 v1 modification: 32 bit offset pointer 129 <1> 130 <1> ; 27/03/2020 - Retro UNIX 386 v2 - FSP (OPEN FILES) TABLE 131 <1> 132 <1> ;Entry 133 <1> ; 15 7 0 134 <1> ; 1 |-------------------------------------------| 135 <1> ; | i-number of open file | 136 <1> ; |-------------------------------------------| 137 <1> ; | high word of 32 bit i-number | 138 <1> ; |-------------------------------------------| 139 <1> ; | open mode & status | device number | 140 <1> ; |-------------------------------------------| 141 <1> ; | reserved byte | open count | 142 <1> ; |-------------------------------------------| 143 <1> ; | offset pointer, i.e., r/w pointer to file | 144 <1> ; |-------------------------------------------| 145 <1> ; | 64 bit file offset pointer (bit 16-31) | 146 <1> ; |-------------------------------------------| 147 <1> ; | 64 bit file offset pointer (bit 32-47) | 148 <1> ; |-------------------------------------------| 149 <1> ; | 64 bit file offset pointer (bit 48-63) | 150 <1> ; |-------------------------------------------| 151 <1> ; 2 | | 152 <1> ; |-------------------------------------------| 153 <1> ; | | 154 <1> ; |-------------------------------------------| 155 <1> ; | | 156 <1> ; |-------------------------------------------| 157 <1> ; | | 158 <1> ; |-------------------------------------------| 159 <1> ; | | 160 <1> 161 <1> %if 0 162 <1> 163 <1> ; (Retro UNIX 386 v1.2 - ux.s - 15/07/2022) 164 <1> ; 22/11/2021 165 <1> ; 21/07/2021 - Retro UNIX 386 v2 open file structure revision 166 <1> 167 <1> struc file ; open files (fsp) structure ; (*) 168 <1> .inode: resw 1 ; inode number of open file (32 bit) 169 <1> .i32: resw 1 ; higher word of inode number (reserved) 170 <1> .drive: resb 1 ; logical drive (disk) number 171 <1> .flags: resb 1 ; open mode and status 172 <1> .count: resb 1 ; number of processes that have file open 173 <1> ;.rsvd: resb 1 ; reserved byte (for next versions) 174 <1> .mnt: resb 1 ; mnttab index+1 (0 = not mounted) 175 <1> .offset: resd 1 ; file offset/pointer (64 bit) 176 <1> .o64: resd 1 ; higher 32 bit of file offset 177 <1> .size: ; = 16 178 <1> endstruc 179 <1> 180 <1> %endif 181 <1> 182 <1> ; 23/07/2022 183 <1> ;fsp: resb nfiles * 16 ; (*) 184 <1> 185 00018E50 ?? <1> idev: resb 1 186 00018E51 ?? <1> cdev: resb 1 187 <1> 188 <1> ; 15/04/2015 189 <1> ;fsp: resb nfiles * 10 ; 11/05/2015 (8 -> 10) 190 <1> ;idev: resw 1 ; device number is 1 byte in Retro UNIX 8086 v1 ! 191 <1> ;cdev: resw 1 ; device number is 1 byte in Retro UNIX 8086 v1 ! 192 <1> 193 <1> ; 18/05/2015 194 <1> ; 26/04/2013 device/drive parameters (Retro UNIX 8086 v1 feature only!) 195 <1> ; 'UNIX' device numbers (as in 'cdev' and 'u.cdrv') 196 <1> ; 0 -> root device (which has Retro UNIX 8086 v1 file system) 197 <1> ; 1 -> mounted device (which has Retro UNIX 8086 v1 file system) 198 <1> ; 'Retro UNIX 8086 v1' device numbers: (for disk I/O procedures) 199 <1> ; 0 -> fd0 (physical drive, floppy disk 1), physical drive number = 0 200 <1> ; 1 -> fd1 (physical drive, floppy disk 2), physical drive number = 1 201 <1> ; 2 -> hd0 (physical drive, hard disk 1), physical drive number = 80h 202 <1> ; 3 -> hd1 (physical drive, hard disk 2), physical drive number = 81h 203 <1> ; 4 -> hd2 (physical drive, hard disk 3), physical drive number = 82h 204 <1> ; 5 -> hd3 (physical drive, hard disk 4), physical drive number = 83h 205 <1> 206 00018E52 ?? <1> rdev: resb 1 ; root device number ; Retro UNIX 8086 v1 feature only! 207 <1> ; as above, for physical drives numbers in following table 208 00018E53 ?? <1> mdev: resb 1 ; mounted device number ; Retro UNIX 8086 v1 feature only! 209 <1> 210 <1> ; 23/07/2022 211 <1> ;; 15/04/2015 212 <1> ;active: resb 1 213 <1> ; resb 1 ; 09/06/2015 214 <1> 215 <1> ; 23/07/2022 216 <1> ;mnti: resw 1 217 <1> ; 07/08/2022 218 00018E54 ???? <1> mpid: resw 1 219 <1> ;rootdir: resw 1 220 00018E56 ???????? <1> rootdir: resd 1 221 <1> 222 <1> ; 21/05/2016 - TRDOS 386 (TRDOS v2.0) - priority levels, 3 run queues 223 <1> runq: 224 00018E5A ???? <1> runq_event: resw 1 ; high priority, 'run for event' ; 2 225 00018E5C ???? <1> runq_normal: resw 1 ; normal/regular priority, 'run as reqular' ; 1 226 00018E5E ???? <1> runq_background: resw 1 ; low priority, 'run on background' ; 0 227 <1> ; 228 <1> ; 23/07/2022 229 <1> ;imod: resb 1 230 <1> ;smod: resb 1 231 <1> ;mmod: resb 1 232 00018E60 ?? <1> sysflg: resb 1 233 00018E61 ?? <1> resb 1 234 <1> 235 00018E62 ???? <1> alignb 4 236 <1> 237 <1> user: 238 <1> ; 23/07/2022 - TRDOS 386 Kernel v2.0.5 239 <1> ; 04/12/2021 - Retro UNIX 386 v1.2 240 <1> ; 13/01/2017 241 <1> ; 19/12/2016 242 <1> ; 21/05/2016 - TRDOS 386 (TRDOS v2.0) 243 <1> ; [u.pri] usage method modification 244 <1> ; 04/12/2015 245 <1> ; 18/10/2015 246 <1> ; 12/10/2015 247 <1> ; 21/09/2015 248 <1> ; 24/07/2015 249 <1> ; 16/06/2015 250 <1> ; 09/06/2015 251 <1> ; 11/05/2015 252 <1> ; 16/04/2015 (Retro UNIX 386 v1 - 32 bit modifications) 253 <1> ; 10/10/2013 254 <1> ; 11/03/2013. 255 <1> ;Derived from UNIX v1 source code 'user' structure (ux). 256 <1> ;u. 257 <1> 258 00018E64 ???????? <1> u.sp: resd 1 ; esp (kernel stack at the beginning of 'sysent') 259 00018E68 ???????? <1> u.usp: resd 1 ; esp (kernel stack points to user's registers) 260 00018E6C ???????? <1> u.r0: resd 1 ; eax 261 00018E70 ???? <1> u.cdir: resw 1 262 00018E72 ???? <1> resw 1 ; 23/07/2022 263 00018E74 ?? <1> u.cdrv: resb 1 ; 23/07/2022 264 00018E75 ?? <1> resb 1 265 00018E76 <1> u.fp: resb 10 266 <1> ;u.fp: resb OPENFILES ; 23/07/202 267 <1> u.fsp: ; 23/07/2022 268 00018E80 ???????? <1> u.fofp: resd 1 269 00018E84 ???????? <1> u.dirp: resd 1 270 00018E88 ???????? <1> u.namep: resd 1 271 00018E8C ???????? <1> u.off: resd 1 272 <1> ; resd 1 ; 23/07/2022 (64 bit fptr) 273 00018E90 ???????? <1> u.base: resd 1 274 00018E94 ???????? <1> u.count: resd 1 275 00018E98 ???????? <1> u.nread: resd 1 276 00018E9C ???????? <1> u.break: resd 1 ; break 277 <1> ; 10/01/2017 (TRDOS 386, relocation and dword alignment) 278 <1> ; tty number (rtty, rcvt, wtty) 279 00018EA0 ???? <1> u.ttyp: resw 1 280 00018EA2 ?? <1> u.ttyn: resb 1 ; 28/07/2013 - Retro Unix 8086 v1 feature only ! 281 00018EA3 ?? <1> u.mode: resb 1 ; 23/07/2022 282 <1> ;u.resb: resb 1 ; 10/01/2017 (TRDOS 386, temporary) 283 00018EA4 <1> u.dirbuf: resb 16 ; 04/12/2015 (10 -> 16) 284 <1> ;u.pri: resw 1 ; 14/02/2014 285 00018EB4 ?? <1> u.quant: resb 1 ; Retro UNIX 8086 v1 Feature only ! (uquant) 286 00018EB5 ?? <1> resb 1 ; 23/07/2022 287 00018EB6 ?? <1> u.pri: resb 1 ; Modification: 21/05/2016 (priority levels: 0, 1, 2) 288 00018EB7 ?? <1> resb 1 ; 23/07/2022 289 00018EB8 ???? <1> u.intr: resw 1 290 00018EBA ???? <1> u.quit: resw 1 291 <1> ;u.emt: resw 1 ; 10/10/2013 292 <1> ;u.ilgins: resw 1 ; 10/01/2017 293 <1> ;u.cdrv: resw 1 ; cdev 294 00018EBC ?? <1> u.bsys: resb 1 295 00018EBD ?? <1> u.uno: resb 1 296 <1> ; 23/07/2022 297 <1> ;u.uid: resw 1 ; uid ; 27/03/2021 - Retro UNIX 386 v2 298 <1> ;u.ruid: resw 1 ; 16 bit uid 299 <1> ;u.gid: resb 1 ; gid ; 27/03/2021 - Retro UNIX 386 v2 300 <1> ;u.rgid: resb 1 301 <1> ; 23/07/2022 302 <1> ;u.procp: resd 1 ; /* pointer to proc structure */ 303 00018EBE ?? <1> u.uid: resb 1 ; uid 304 00018EBF ?? <1> u.ruid: resb 1 305 00018EC0 ???????? <1> u.upage: resd 1 ; 16/04/2015 - Retro Unix 386 v1 feature only ! 306 00018EC4 ???????? <1> u.pgdir: resd 1 ; 09/03/2015 (page dir addr of process) 307 00018EC8 ???????? <1> u.ppgdir: resd 1 ; 06/05/2015 (page dir addr of the parent process) 308 00018ECC ???????? <1> u.pbase: resd 1 ; 20/05/2015 (physical base/transfer address) 309 00018ED0 ???? <1> u.pcount: resw 1 ; 20/05/2015 (byte -transfer- count for page) 310 <1> ;u.pncount: resw 1 311 <1> ; 16/06/2015 (byte -transfer- count for page, 'namei', 'mkdir') 312 <1> ;u.pnbase: resd 1 313 <1> ; 16/06/2015 (physical base/transfer address, 'namei', 'mkdir') 314 <1> ; 09/06/2015 315 00018ED2 ?? <1> u.kcall: resb 1 ; The caller is 'namei' (dskr) or 'mkdir' (dskw) sign 316 00018ED3 ?? <1> u.brwdev: resb 1 ; Block device number for direct I/O (bread & bwrite) 317 <1> ; 24/07/2015 - 24/06/2015 318 <1> ;u.args: resd 1 ; arguments list (line) offset from start of [u.upage] 319 <1> ; (arg list/line is from offset [u.args] to 4096 in [u.upage]) 320 <1> ; ([u.args] points to argument count -argc- address offset) 321 <1> ; 24/06/2015 322 <1> ;u.core: resd 1 ; physical start address of user's memory space (for sys exec) 323 <1> ;u.ecore: resd 1 ; physical end address of user's memory space (for sys exec) 324 <1> ;;; 325 <1> ; 19/08/2024 ; TRDOS 386 v2.0.9 ; STDIN/STDOUT/STDERR 326 00018ED4 ?? <1> u.stdin: resb 1 ; 0 is tty-r or > 0 is file (redirection) 327 00018ED5 ?? <1> u.stdout: resb 1 ; 0 is tty-w or > 0 is file (redirection) 328 00018ED6 ?? <1> u.ungetc: resb 1 ; u.getc is valid if u.ungetc > 0 329 00018ED7 ?? <1> u.getc: resb 1 ; last char read on stdin 330 <1> ;;; 331 <1> ; last error number 332 00018ED8 ???????? <1> u.error: resd 1 ; 28/07/2013 - 09/03/2015 333 <1> ; Retro UNIX 8086/386 v1 feature only! 334 <1> ; 21/09/2015 (debugging - page fault analyze) 335 00018EDC ???????? <1> u.pfcount: resd 1 ; page fault count for (this) process (for sys geterr) 336 <1> ; 19/12/2016 (TRDOS 386) 337 00018EE0 ???????? <1> u.tcb: resd 1 ; Timer callback address/flag which will be used by timer int 338 <1> ; 13/01/2017 (TRDOS 386) 339 00018EE4 ?? <1> u.t_lock: resb 1 ; Timer interrupt (callback) lock (unlocked by 'sysrele') 340 00018EE5 ?? <1> u.t_mode: resb 1 ; running mode during timer interrupt (0= system, 0FFh= user) 341 <1> ; 26/02/2017 (TRDOS 386) 342 00018EE6 ?? <1> u.irqc: resb 1 ; Count of IRQ callback services (IRQs in use) 343 <1> ; 28/02/2017 (TRDOS 386) 344 00018EE7 ?? <1> u.irqwait: resb 1 ; IRQ waiting for callback service flag (IRQ number, If > 0) 345 00018EE8 ?? <1> u.r_lock: resb 1 ; 'IRQ callback service is in progress' flag (IRQ lock) 346 00018EE9 ?? <1> u.r_mode: resb 1 ; running mode during hadware interrupt 347 <1> ; 23/07/2022 348 00018EEA ?? <1> u.exit: resb 1 ; exit code 349 <1> ; 27/02/2017 (TRDOS 386) 350 00018EEB ?? <1> u.fpsave: resb 1 ; TRDOS 386, 'save/restore FPU registers' flag 351 <1> alignb 4 352 <1> ; !! wrong sizing in TRDOS 386 v2.0.4 (in 'ubss.s', 28/02/2017) !! 353 <1> ;u.fpregs: resb 94 ; 94 byte area for saving and restoring FPU registers 354 <1> ; 23/07/2022 355 00018EEC <1> u.fpregs: resb 108 ; 108 byte area for saving and restoring FPU registers 356 <1> 357 <1> alignb 4 358 <1> 359 <1> U_SIZE equ $ - user 360 <1> 361 <1> ; 18/10/2015 - Retro UNIX 386 v1 (local variables for 'namei' and 'sysexec') 362 00018F58 ???????? <1> pcore: resd 1 ; physical start address of user's memory space (for sys exec) 363 00018F5C ???????? <1> ecore: resd 1 ; physical address of user's stack/last page (for sys exec) 364 00018F60 ???????? <1> nbase: resd 1 ; physical base address for 'namei' & 'sysexec' 365 <1> ; 23/07/202 - TRDOS 386 Kernel v2.0.5 366 <1> ;ncount: resw 1 367 00018F64 ???????? <1> ncount: resd 1 ; remain byte count in page for 'namei' & 'sysexec' 368 <1> ;argc: resw 1 369 00018F68 ???????? <1> argc: resd 1 ; argument count for 'sysexec' 370 00018F6C ???????? <1> argv: resd 1 ; argument list (recent) address for 'sysexec' 371 <1> 372 <1> ; 03/06/2015 - Retro UNIX 386 v1 Beginning 373 <1> ; 07/04/2013 - 31/07/2013 - Retro UNIX 8086 v1 374 00018F70 ?? <1> rw: resb 1 ;; Read/Write sign (iget) 375 <1> ; 23/07/2022 376 00018F71 ?????? <1> resb 3 377 <1> 378 <1> alignb 4 379 <1> 380 <1> ; 24/04/2016 381 00018F74 ???????? <1> ii: resd 1 ; first cluster of the program file 382 00018F78 ???????? <1> i.size: resd 1 ; size of the program file 4010 4011 alignb 4 4012 4013 ; 23/05/2016 (TRDOS 386) 4014 ; 14/10/2015 (Retro UNIX 386 v1, 'unix386.s') 4015 00018F7C ???????? cr3reg: resd 1 ; cr3 register content at the beginning of the timer 4016 ; (or RTC) interrupt handler. 4017 4018 ; 10/12/2016 (callback) 4019 ; 10/06/2016 4020 ; 19/05/2016 4021 ; 18/05/2016 - TRDOS 386 feature only ! 4022 00018F80 timer_set: resd 16*4 ; 256 bytes memory space for 16 timer events 4023 ; Timer Event Structure: (max. 16 timer events, 16*16 bytes) 4024 ; Owner: resb 1 ; 0 = free 4025 ; ;>0 = process number (u.uno) 4026 ; Callback: resb 1 ; 0 = response byte address (phy) 4027 ; 1 = callback address (virtual) 4028 ; Interrupt: resb 1 ; 0 = Timer interrupt (or none) 4029 ; ; 1 = Real Time Clock interrupt 4030 ; Response: resb 1 ; 0 to 255, signal return value 4031 ; Count Limit: resd 1 ; count of ticks (total/set) 4032 ; Current Count: resd 1 ; count of ticks (current) 4033 ; Response Addr: resd 1 ; response byte (pointer) address 4034 ; ; (or callback -user service- address) 4035 4036 4037 ; 17/04/2021 4038 ; (memory page swap parameters are disabled as temporary) 4039 ; 4040 ; Memory (swap) Data (11/03/2015) 4041 ; 09/03/2015 4042 ;swpq_count: resw 1 ; count of pages on the swap queue 4043 ;swp_drv: resd 1 ; logical drive description table address of the swap drive/disk 4044 ;swpd_size: resd 1 ; size of swap drive/disk (volume) in sectors (512 bytes). 4045 ;swpd_free: resd 1 ; free page blocks (4096 bytes) on swap disk/drive (logical) 4046 ;swpd_next: resd 1 ; next free page block 4047 ;swpd_last: resd 1 ; last swap page block 4048 4049 alignb 4 4050 4051 ; 10/07/2015 4052 ; 28/08/2014 4053 00019080 ???????? error_code: resd 1 4054 ; 29/08/2014 4055 00019084 ???????? FaultOffset: resd 1 4056 ; 21/09/2015 4057 00019088 ???????? PF_Count: resd 1 ; total page fault count 4058 ; (for debugging - page fault analyze) 4059 ; 'page_fault_handler' (memory.inc) 4060 ; 'sysgeterr' (u9.s) 4061 4062 ; 29/04/2016 (TRDOS 386 = TRDOS v2.0) 4063 ; 22/08/2015 (Retro UNIX 386 v1) 4064 buffer: 4065 0001908C ???????????????? resb 8 4066 readi_buffer: 4067 00019094 resb 512 4068 00019294 ???????????????? resb 8 4069 writei_buffer: 4070 0001929C resb 512 4071 ; 24/10/2016 4072 0001949C ???????????????? resb 8 4073 rw_buffer: 4074 000194A4 resb 2048 ; general purposed, r/w sector buffer 4075 4076 %if 1 4077 ; 17/01/2021 4078 00019CA4 edid_info: resb 128 ; VESA EDID (monitor capabilities) info 4079 ; 28/11/2020 4080 00019D24 ?? pmi32: resb 1 ; (>0) use VESA VBE3 protected mode calls 4081 00019D25 ?? vbe_mode_x: resb 1 ; VESA VBE3 video bios mode set options 4082 00019D26 ???? video_mode: resw 1 ; VESA VBE3 video mode (with option flags) 4083 ; 30/11/2020 4084 00019D28 ???????? vbe3bios_addr: resd 1 ; new (writable mem) address of VBE3 bios 4085 ; 02/12/2020 4086 00019D2C ???????? pmid_addr: resd 1 ; PMInfoBlock ('PMID') linear address 4087 ; 14/01/2021 4088 ; 06/12/2020 ; VESA VBE 3 video state 4089 ;vbe3stbufsize: resw 1 ; video regs/dac/bios state buffer size 4090 ; ; block size in bytes 4091 ; 16/01/2021 4092 00019D30 ???? vbe3stbsflags: resw 1 ; video regs/dac/bios state buffer size 4093 ; ; pointer flags for buffer state options 4094 %endif 4095 4096 %if 1 4097 ; 10/12/2020 4098 LFB_Info: 4099 00019D32 resb 16 ; Linear Frame Buffer info block 4100 4101 ;24/11/2020 - TRDOS 386 v2.0.3 4102 ; BOCHS/PLEX86 VESA VBE3 MODE INFO extension to TRDOS 386 v2 kernel 4103 MODE_INFO_LIST: 4104 00019D42 resb 68 ; mode + 66 byte VESA vbe3 mode info (4F01h) 4105 %endif 4106 4107 ; 05/01/2021 4108 00019D86 ?? ufont: resb 1 ; (VGA graphics) user font flags 4109 ; bit 7 - permission flag for int 31h 4110 ; bit 4 - 8x16 user font ready/loaded flag 4111 ; bit 3 - 8x8 user font ready/loaded flag 4112 ; bit 1 - select 8x16 user font (sysvideo) 4113 ; bit 0 - select 8x8 user font (sysvideo) 4114 00019D87 ?? resb 1 ; 19/01/2021 4115 ; 17/01/2021 4116 00019D88 ?? srvsf: resb 1 ; 'save restore video state' permission flag 4117 ; 18/01/2021 4118 00019D89 ?? srvso: resb 1 ; video state buffer save/restore option 4119 00019D8A ???????? VideoStateID: resd 1 ; used to verify state saved by same prog 4120 ; 29/01/2021 4121 00019D8E ???? v_width: resw 1 ; screen (display page) width 4122 00019D90 ?? v_ops: resb 1 ; 'sysvideo' graphics data transfer option 4123 00019D91 ?? v_bpp: resb 1 ; bits per pixels ('sysvideo') 4124 00019D92 ???????? v_mem: resd 1 ; video memory ('sysvideo') 4125 00019D96 ???????? v_siz: resd 1 ; video page size ('sysvideo') 4126 00019D9A ???????? v_str: resd 1 ; window start adress ('sysvideo') 4127 00019D9E ???????? v_end: resd 1 ; window end (end+1) adress ('sysvideo') 4128 ; 31/01/2021 4129 ; 01/01/2021 4130 ;maskbuff: ;resd 1 ; user's bitmask buffer addr ('sysvideo') 4131 00019DA2 ???????? maskcolor: resd 1 ; VGA/SVGA pixel mask color ('sysvideo') 4132 ; 27/02/2021 4133 00019DA6 ???????? pixcount: resd 1 ; pixel count ('sysvideo' window ops) 4134 ; 02/02/2021 4135 00019DAA ???????????????? buffer8: resd 2 ; 8 bytes small buffer for 'sysvideo' 4136 4137 bss_end: 4138 4139 ; 27/12/2013 4140 _end: ; end of kernel code