1 ;-------------------------------------------------------------------- 2 ; 3 ; e3.asm v2.7.0 Copyright (C) 2000-2006 Albrecht Kleine 4 ; 5 ; This program is free software; you can redistribute it and/or modify 6 ; it under the terms of the GNU General Public License as published by 7 ; the Free Software Foundation; either version 2 of the License, or 8 ; (at your option) any later version. 9 ; 10 ; This program is distributed in the hope that it will be useful, 11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 ; GNU General Public License for more details. 14 ; 15 ; You should have received a copy of the GNU General Public License 16 ; along with this program; if not, write to the Free Software 17 ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 ; 19 ;---------------------------------------------------------------------- 20 ; 21 %include "e3.h" 22 <1> ;-------------------------------------------------------------------------- 23 <1> ; e3.asm v2.7.0 Copyright (C) 2000-06 Albrecht Kleine 24 <1> ; 25 <1> ; see GNU copyright details in e3.asm 26 <1> ;-------------------------------------------------------------------------- 27 <1> 28 <1> %define WS 1 29 <1> %define EM 2 30 <1> %define PI 4 31 <1> %define VI 8 32 <1> %define NE 16 33 <1> %define DEFAULT_MODE WS ;<---- select one of WS, EM, NE, PI, VI 34 <1> %define MAKE_BACKUP 35 <1> %define LESSWRITEOPS 36 <1> ;------- 37 <1> %define UTF8 ;for UTF8 console or xterm e.g. @ Suse 9.1 38 <1> %define UTF8RTS ;runtime detection of UTF8 console display 39 <1> ;------- 40 <1> %define BEEP_IN_VI ;undef if you hate beeping computers 41 <1> %define USE_MATH ;undef if you don't use the numerics 42 <1> %define USE_PIPE ;undef if you don't use piping through sed/ex 43 <1> %define USE_BUILTINHELP ;undef if you really don't need help (saves some space) 44 <1> %define USE_UNDO ;undef if there is low memory 45 <1> ;;;%define USE_EXT_MOVE ;smart move mode for Home,End,BOF,EOF keys 46 <1> ; 47 <1> ;------- 48 <1> ; 49 <1> ; D O N O T C H A N G E B E L O W L I N E 50 <1> ;---------------------------------------------------------------------- 51 <1> %ifndef LINUX 52 <1> %undef UTF8 53 <1> %endif 54 <1> 55 <1> %ifndef UTF8 56 <1> %undef UTF8RTS 57 <1> %endif 58 <1> 59 <1> %ifdef NETBSD 60 <1> %define FREEBSD 61 <1> %endif 62 <1> %ifdef OPENBSD 63 <1> %define FREEBSD 64 <1> %endif 65 <1> ; 66 <1> ;beware of SYS_... constants > 255! (see NetBSD) 67 <1> ; 68 <1> %ifdef BEOS 69 <1> ;posix/termios.h ;termios eq termio 70 <1> %define TERMIOS_SET 8001h ;TCSETA 71 <1> %define TERMIOS_GET 8000h ;TCGETA 72 <1> %define TERMIOS_WSIZE 800Ch ;TIOCGWINSZ 73 <1> %define NCCS 11 74 <1> %define VMIN 4 75 <1> %define speed_t1 resb 76 <1> %undef USE_PIPE 77 <1> %define SYS_exit 63 78 <1> %define SYS_read 2 79 <1> %define SYS_write 3 80 <1> %define SYS_open 0 81 <1> %define SYS_close 1 82 <1> %define SYS_unlink 39 83 <1> %define SYS_lseek 5 84 <1> %define SYS_rename 38 85 <1> %define SYS_ioctl 4 86 <1> 87 <1> MAXERRNO equ 30 88 <1> ERRNOMEM equ 12 89 <1> ERRNOIO equ 5 90 <1> 91 <1> %macro errortext 0 92 <1> db "Op not permitted",10 ;1 93 <1> db "No such file|directory",10 ;2 94 <1> db 10 ;3 95 <1> db 10 ;4 96 <1> db "Input/output",10 ;5 97 <1> db "No such device",10 ;6 98 <1> db 10 ;7 99 <1> db 10 ;8 100 <1> db "Bad file descriptor",10 ;9 101 <1> db "No child processes",10 ;10 102 <1> db 10 ;11 103 <1> db "Memory exhausted",10 ;12 104 <1> db "Permission denied",10 ;13 105 <1> db 10 ;14 106 <1> db 10 ;15 107 <1> db "Device|resource busy",10 ;16 108 <1> db "File exists",10 ;17 109 <1> db 10 ;18 110 <1> db "No such device",10 ;19 111 <1> db 10 ;20 112 <1> db "Is a directory",10 ;21 113 <1> db "Invalid argument",10 ;22 114 <1> db "Too many open files",10 ;23 115 <1> db "Too many open files",10 ;24 116 <1> db "Inappropriate ioctl",10 ;25 117 <1> db "Text file busy",10 ;26 118 <1> db "File too large",10 ;27 119 <1> db "No space on device",10 ;28 120 <1> db "Illegal seek",10 ;29 121 <1> db "R/O file system",10 ;30 122 <1> %endmacro 123 <1> 124 <1> %else 125 <1> %ifdef QNX 126 <1> ;termios.h 127 <1> ;sys/ioctl.h 128 <1> %define TERMIOS_SET 804c7414h ;TIOCSETA 129 <1> %define TERMIOS_GET 404c7413h ;TIOCGETA 130 <1> %define TERMIOS_WSIZE 40087468h ;TIOCGWINSZ 131 <1> ; rw 132 <1> ; size 133 <1> ; 't' 134 <1> ; nr. 135 <1> %define NCCS 40 136 <1> %define VMIN 6 137 <1> %define speed_t2 resd 138 <1> ;------- 139 <1> ;the QNX version is linked against libc 140 <1> %define LIBC 141 <1> extern open,read,write,close,lseek,rename,_exit,ioctl,fstat,fchown,select,unlink 142 <1> extern errno 143 <1> %undef USE_PIPE 144 <1> %define SYS_fstat ;dummy 145 <1> struc stat_struc 146 <1> .st_ino: resd 2 147 <1> .st_size: resd 2 148 <1> .st_dev: resd 1 149 <1> .st_rdev: resd 1 150 <1> .st_uid: resd 1;24 151 <1> .st_gid: resd 1;28 152 <1> .st_ctime: resd 1; 153 <1> .st_atime: resd 1; 154 <1> .st_mtime: resd 1;40 155 <1> .st_mode: resd 1;44 156 <1> .st_dummy: resd 20 ;who cares? 157 <1> endstruc 158 <1> MAXERRNO equ 30 159 <1> ERRNOMEM equ 12 160 <1> ERRNOIO equ 5 161 <1> 162 <1> %macro errortext 0 163 <1> db "Op not permitted",10 ;1 164 <1> db "No such file|directory",10 ;2 165 <1> db 10 ;3 166 <1> db 10 ;4 167 <1> db "Input/output",10 ;5 168 <1> db "No such device",10 ;6 169 <1> db 10 ;7 170 <1> db 10 ;8 171 <1> db "Bad file descriptor",10 ;9 172 <1> db "No child processes",10 ;10 173 <1> db 10 ;11 174 <1> db "Memory exhausted",10 ;12 175 <1> db "Permission denied",10 ;13 176 <1> db 10 ;14 177 <1> db 10 ;15 178 <1> db "Device|resource busy",10 ;16 179 <1> db "File exists",10 ;17 180 <1> db 10 ;18 181 <1> db "No such device",10 ;19 182 <1> db 10 ;20 183 <1> db "Is a directory",10 ;21 184 <1> db "Invalid argument",10 ;22 185 <1> db "Too many open files",10 ;23 186 <1> db "Too many open files",10 ;24 187 <1> db "Inappropriate ioctl",10 ;25 188 <1> db "Text file busy",10 ;26 189 <1> db "File too large",10 ;27 190 <1> db "No space on device",10 ;28 191 <1> db "Illegal seek",10 ;29 192 <1> db "R/O file system",10 ;30 193 <1> %endmacro 194 <1> 195 <1> %else 196 <1> %ifdef ATHEOS ;--------------------- A T H E O S ----------------------- 197 <1> ;posix/termbits.h 198 <1> %define TERMIOS_SET 5406h 199 <1> %define TERMIOS_GET 5405h 200 <1> %define TERMIOS_WSIZE 5413h 201 <1> %define NCCS 19 202 <1> %define VMIN 6 203 <1> ;posix/stat.h 204 <1> struc stat_struc 205 <1> .st_dev: resd 1 206 <1> .st_ino: resd 2 207 <1> .st_mode: resd 1 208 <1> .st_nlink: resd 1 209 <1> .st_uid: resd 1 210 <1> .st_gid: resd 1 211 <1> .st_rdev: resd 1 212 <1> .st_size: resd 2 213 <1> .st_blksize: resd 1 214 <1> .st_blocks: resd 2 215 <1> .st_atime: resd 1 216 <1> .__unused1: resd 1 217 <1> .st_mtime: resd 1 218 <1> .__unused2: resd 1 219 <1> .st_ctime: resd 1 220 <1> .__unused3: resd 1 221 <1> .__unused4: resd 1 222 <1> .__unused5: resd 1 223 <1> endstruc 224 <1> %undef USE_PIPE 225 <1> 226 <1> %define SYS_exit 6 227 <1> %define SYS_read 3 228 <1> %define SYS_write 4 229 <1> %define SYS_open 1 230 <1> %define SYS_close 2 231 <1> %define SYS_unlink 20 232 <1> %define SYS_lseek 13 233 <1> %define SYS_kill 92 234 <1> %define SYS_rename 7 235 <1> %define SYS_ioctl 116 236 <1> %define SYS_sigaction 93 237 <1> %define SYS_fchown 86 238 <1> %define SYS_fstat 11 239 <1> %define SYS_select 42 240 <1> 241 <1> SIGCONT equ 18 242 <1> SIGSTOP equ 19 243 <1> 244 <1> 245 <1> MAXERRNO equ 30 246 <1> ERRNOMEM equ 12 247 <1> ERRNOIO equ 5 248 <1> 249 <1> %macro errortext 0 250 <1> db "Op not permitted",10 ;1 251 <1> db "No such file|directory",10 ;2 252 <1> db 10 ;3 253 <1> db 10 ;4 254 <1> db "Input/output",10 ;5 255 <1> db "No such device",10 ;6 256 <1> db 10 ;7 257 <1> db 10 ;8 258 <1> db "Bad file descriptor",10 ;9 259 <1> db "No child processes",10 ;10 260 <1> db 10 ;11 261 <1> db "Memory exhausted",10 ;12 262 <1> db "Permission denied",10 ;13 263 <1> db 10 ;14 264 <1> db 10 ;15 265 <1> db "Device|resource busy",10 ;16 266 <1> db "File exists",10 ;17 267 <1> db 10 ;18 268 <1> db "No such device",10 ;19 269 <1> db 10 ;20 270 <1> db "Is a directory",10 ;21 271 <1> db "Invalid argument",10 ;22 272 <1> db "Too many open files",10 ;23 273 <1> db "Too many open files",10 ;24 274 <1> db "Inappropriate ioctl",10 ;25 275 <1> db "Text file busy",10 ;26 276 <1> db "File too large",10 ;27 277 <1> db "No space on device",10 ;28 278 <1> db "Illegal seek",10 ;29 279 <1> db "R/O file system",10 ;30 280 <1> %endmacro 281 <1> %else 282 <1> %ifdef LINUX ;----------------------- L I N U X ----------------------- 283 <1> ;asm/termbits.h 284 <1> ;asm/ioctls.h 285 <1> %define TERMIOS_SET 5402h ;TCSETS 286 <1> %define TERMIOS_GET 5401h ;TCGETS 287 <1> %define TERMIOS_WSIZE 5413h ;TIOCGWINSZ 288 <1> %define NCCS 19 289 <1> %define VMIN 6 290 <1> ;------- 291 <1> %ifndef AMD64 292 <1> ;asm/stat.h 293 <1> %define UIDGID_WORD 294 <1> struc stat_struc 295 <1> .st_dev: resd 1 296 <1> .st_ino: resd 1 ;unsigned long st_ino; 297 <1> .st_mode: resw 1 ;unsigned short st_mode; 298 <1> .st_nlink: resw 1 299 <1> .st_uid: resw 1 300 <1> .st_gid: resw 1 301 <1> .st_rdev: resd 1 302 <1> .st_size: resd 1 303 <1> .st_blksize: resd 1 304 <1> .st_blocks: resd 1 305 <1> .st_atime: resd 1 306 <1> .__unused1: resd 1 307 <1> .st_mtime: resd 1 308 <1> .__unused2: resd 1 309 <1> .st_ctime: resd 1 310 <1> .__unused3: resd 1 311 <1> .__unused4: resd 1 312 <1> .__unused5: resd 1 313 <1> endstruc 314 <1> 315 <1> %define SYS_exit 1 316 <1> %define SYS_fork 2 317 <1> %define SYS_read 3 318 <1> %define SYS_write 4 319 <1> %define SYS_open 5 320 <1> %define SYS_close 6 321 <1> %define SYS_unlink 10 322 <1> %define SYS_execve 11 323 <1> %define SYS_lseek 19 324 <1> %define SYS_utime 30 325 <1> %define SYS_kill 37 326 <1> %define SYS_rename 38 327 <1> %define SYS_pipe 42 328 <1> %define SYS_brk 45 329 <1> %define SYS_ioctl 54 330 <1> %define SYS_dup2 63 331 <1> %define SYS_sigaction 67 332 <1> %define SYS_rt_sigaction 174 333 <1> %define SYS_readlink 85 334 <1> %define SYS_fchmod 94 335 <1> %define SYS_fchown 95 336 <1> %define SYS_fstat 108 337 <1> %define SYS_wait4 114 338 <1> %define SYS_select 142 339 <1> %ifndef ARMCPU 340 <1> %define time_t resd 341 <1> %endif 342 <1> %else ;;--------- AMD64 343 <1> struc stat_struc 344 <1> .st_dev: resq 1 345 <1> .st_ino: resq 1 346 <1> .st_nlink: resq 1 347 <1> .st_mode: resd 1 348 <1> .st_uid: resd 1 349 <1> .st_gid: resd 1 350 <1> .__unused0: resd 1 351 <1> .st_rdev: resq 1 352 <1> .st_size: resq 1 353 <1> .st_blksize: resq 1 354 <1> .st_blocks: resq 1 355 <1> .st_atime: resq 1 356 <1> .__unused1: resq 1 357 <1> .st_mtime: resq 1 358 <1> .__unused2: resq 1 359 <1> .st_ctime: resq 1 360 <1> .__unused3: resq 1 361 <1> .__unused4: resq 1 362 <1> .__unused5: resq 1 363 <1> endstruc 364 <1> %define SYS_exit 60 365 <1> %define SYS_fork 57 366 <1> %define SYS_read 0 367 <1> %define SYS_write 1 368 <1> %define SYS_open 2 369 <1> %define SYS_close 3 370 <1> %define SYS_unlink 87 371 <1> %define SYS_execve 59 372 <1> %define SYS_lseek 8 373 <1> %define SYS_utime 132 ;30 374 <1> %define SYS_kill 62 375 <1> %define SYS_rename 82 376 <1> %define SYS_pipe 22 377 <1> %define SYS_brk 12 378 <1> %define SYS_ioctl 16 379 <1> %define SYS_dup2 33 380 <1> %define SYS_rt_sigaction 13 381 <1> %define SYS_rt_sigreturn 15 382 <1> %define SYS_readlink 89 383 <1> %define SYS_fchmod 91 384 <1> %define SYS_fchown 93 385 <1> %define SYS_fstat 5 386 <1> %define SYS_wait4 61 387 <1> %define SYS_select 23 ;142 388 <1> 389 <1> %define time_t resq 390 <1> %endif 391 <1> 392 <1> %ifndef ARMCPU 393 <1> struc utimbuf_struc 394 <1> .actime: time_t 1 395 <1> .modtime:time_t 1 396 <1> endstruc 397 <1> %else 398 <1> struc utimbuf_struc 399 <1> .actime: resd 1 400 <1> .modtime:resd 1 401 <1> endstruc 402 <1> %endif 403 <1> %ifdef CRIPLED_ELF 404 <1> %define USE_SPECIAL_HEADER ;special ELF header etc 405 <1> %endif 406 <1> 407 <1> ;------- 408 <1> %ifdef UTF8 409 <1> %define NEW_CURSOR_MGNT ;switch cursor depending of 'INSERT'-mode 410 <1> %undef CURSORMGNT ;switch cursor depending of 'INSERT'-mode 411 <1> ;no more support of CURSORMGNT for UTF-8 thus replaced by: 412 <1> ;8.Juni 2004: see /usr/src/linux/Documentation/VGA-softcursor.txt 413 <1> %else 414 <1> %define CURSORMGNT 415 <1> ;trad style 416 <1> %ifdef AMD64 417 <1> %undef CURSORMGNT ;work around January 2006 418 <1> %endif 419 <1> %endif 420 <1> ;-------- 421 <1> 422 <1> SIGCONT equ 18 423 <1> SIGSTOP equ 19 424 <1> 425 <1> %define CAPTURE_STDERR 426 <1> %ifdef EX 427 <1> %define USE_EX_NO_SED 428 <1> %define EX_PATH '/usr/bin/ex' ;(ex is usually a symlink to vi) [ old was /bin/ex ] 429 <1> %else 430 <1> %undef USE_EX_NO_SED 431 <1> %ifndef PERLPIPE 432 <1> %define SEDPATH '/bin/sed' ;DEFAULT 433 <1> %else 434 <1> %define SEDPATH '/usr/bin/perl' 435 <1> %endif 436 <1> %endif 437 <1> 438 <1> MAXERRNO equ 32 439 <1> ERRNOMEM equ 12 440 <1> ERRNOIO equ 5 441 <1> ERRNOEXEC equ 31 442 <1> %macro errortext 0 443 <1> db "Op not permitted",10 ;1 444 <1> db "No such file|directory",10 ;2 445 <1> db 10 ;3 446 <1> db 10 ;4 447 <1> db "Input/output",10 ;5 448 <1> db "No such device",10 ;6 449 <1> db 10 ;7 450 <1> db 10 ;8 451 <1> db "Bad file descriptor",10 ;9 452 <1> db "No child processes",10 ;10 453 <1> db 10 ;11 454 <1> db "Memory exhausted",10 ;12 455 <1> db "Permission denied",10 ;13 456 <1> db 10 ;14 457 <1> db 10 ;15 458 <1> db "Device|resource busy",10 ;16 459 <1> db "File exists",10 ;17 460 <1> db 10 ;18 461 <1> db "No such device",10 ;19 462 <1> db 10 ;20 463 <1> db "Is a directory",10 ;21 464 <1> db "Invalid argument",10 ;22 465 <1> db "Too many open files",10 ;23 466 <1> db "Too many open files",10 ;24 467 <1> db "Inappropriate ioctl",10 ;25 468 <1> db "Text file busy",10 ;26 469 <1> db "File too large",10 ;27 470 <1> db "No space on device",10 ;28 471 <1> db "Illegal seek",10 ;29 472 <1> db "R/O file system",10 ;30 473 <1> db "Can't exec " ;31 474 <1> %ifdef USE_EX_NO_SED 475 <1> db EX_PATH,10 476 <1> %else 477 <1> db SEDPATH,10 478 <1> %endif 479 <1> db "Broken pipe",10 ;32 480 <1> %endmacro 481 <1> %ifdef LIBC 482 <1> extern open,read,write,close,lseek,rename,_exit,ioctl,fstat,fchown,select,unlink,fchmod 483 <1> extern _errno 484 <1> %undef SYS_readlink 485 <1> %undef SYS_brk 486 <1> %undef SYS_kill 487 <1> %undef SYS_sigaction 488 <1> %undef SYS_rt_sigaction 489 <1> %undef USE_PIPE 490 <1> %endif 491 <1> %ifdef ARMCPU 492 <1> %undef USE_MATH 493 <1> %undef USE_UNDO 494 <1> %undef USE_PIPE 495 <1> %endif 496 <1> %else 497 <1> %ifdef FREEBSD ;----------------------- FREE B S D ----------------------- 498 <1> ;sys/termios.h 499 <1> %define TERMIOS_SET 802c7414h ;TIOCSETA 500 <1> %define TERMIOS_GET 402c7413h ;TIOCGETA 501 <1> %define TERMIOS_WSIZE 40087468h 502 <1> ; rw 503 <1> ; size 504 <1> ; 't' 505 <1> ; nr. 506 <1> %define NCCS 20 507 <1> %define VMIN 16 508 <1> %define speed_t3 resd 509 <1> %define ICRNL 0x100 510 <1> %define IXON 0x200 511 <1> %define ICANON 0x100 512 <1> %define ISIG 0x80 513 <1> %define ECHO 0x8 514 <1> %define TSize word ;due oversized ICANON 515 <1> ;------ 516 <1> 517 <1> struc stat_struc 518 00000000 <1> .st_dev: resd 1 519 00000004 <1> .st_ino: resd 1 520 <1> %ifdef OPENBSD 521 <1> .st_mode: resw 1 ;for syscall 279 522 <1> .st_nlink: resw 1 ;ditto 523 <1> %else 524 00000008 <1> .st_mode: resd 1 525 0000000C <1> .st_nlink: resd 1 526 <1> %endif 527 00000010 <1> .st_uid: resd 1 528 00000014 <1> .st_gid: resd 1 529 00000018 <1> .st_rdev: resd 1 530 0000001C <1> .st_atime: resd 1 531 00000020 <1> .st_atimes: resd 1 532 00000024 <1> .st_mtime: resd 1 533 00000028 <1> .st_mtimes: resd 1 534 0000002C <1> .st_ctime: resd 1 535 00000030 <1> .st_ctimes: resd 1 536 00000034 <1> .st_size: resd 2 537 0000003C <1> .st_blocks: resd 2 538 00000044 <1> .st_blksize: resd 1 539 00000048 <1> .st_flags: resd 1 540 0000004C <1> .st_gen: resd 1 541 00000050 <1> .st_spare: resd 5 542 <1> endstruc 543 <1> 544 <1> %define SYS_exit 1 545 <1> %define SYS_fork 2 546 <1> %define SYS_read 3 547 <1> %define SYS_write 4 548 <1> %define SYS_open 5 549 <1> %define SYS_close 6 550 <1> %define SYS_unlink 10 551 <1> %define SYS_execve 59 552 <1> %define SYS_lseek 199 ;old was 19 553 <1> %define SYS_utime 138 554 <1> %define SYS_kill 37 555 <1> %define SYS_rename 128 556 <1> %define SYS_pipe 42 557 <1> %define SYS_ioctl 54 558 <1> %define SYS_dup2 90 559 <1> %define SYS_sigaction 342 ;also 342 *** take care if >255 cause only register al used 560 <1> %define SYS_readlink 58 561 <1> %define SYS_fchown 123 562 <1> %define SYS_fchmod 124 563 <1> %define SYS_fstat 279 ;old was 189 564 <1> %define SYS_wait4 7 565 <1> %define SYS_select 93 566 <1> 567 <1> %ifdef OPENBSD 568 <1> %undef SYS_kill 569 <1> %undef SYS_sigaction 570 <1> %undef SYS_fstat 571 <1> %define SYS_fstat 189 ;could not test 292 572 <1> %endif 573 <1> 574 <1> %ifdef NETBSD 575 <1> %undef SYS_kill ;both 576 <1> %undef SYS_sigaction ;currently only for old COMPAT layer working 577 <1> %endif 578 <1> 579 <1> 580 <1> %define time_t resd 581 <1> 582 <1> struc utimbuf_struc 583 00000000 <1> .actime: time_t 2 584 00000008 <1> .modtime:time_t 2 585 <1> endstruc 586 <1> 587 <1> %undef CAPTURE_STDERR 588 <1> %ifdef EX 589 <1> %define USE_EX_NO_SED 590 <1> %define EX_PATH '/usr/bin/ex' ;(ex is usually a symlink to vi) [ old was /bin/ex ] 591 <1> %else 592 <1> %undef USE_EX_NO_SED 593 <1> %ifndef PERLPIPE 594 <1> %define SEDPATH '/usr/bin/sed' ;DEFAULT 595 <1> %else 596 <1> %define SEDPATH '/usr/bin/perl' 597 <1> %endif 598 <1> %endif 599 <1> 600 <1> MAXERRNO equ 32 601 <1> ERRNOMEM equ 12 602 <1> ERRNOIO equ 5 603 <1> ERRNOEXEC equ 31 604 <1> ERRNOREGFILE equ 21 605 <1> %macro errortext 0 606 <1> db "Op not permitted",10 ;1 607 <1> db "No such file|directory",10 ;2 608 <1> db 10 ;3 609 <1> db 10 ;4 610 <1> db "Input/output",10 ;5 611 <1> db "No such device",10 ;6 612 <1> db 10 ;7 613 <1> db 10 ;8 614 <1> db "Bad file descriptor",10 ;9 615 <1> db "No child processes",10 ;10 616 <1> db 10 ;11 617 <1> db "Memory exhausted",10 ;12 618 <1> db "Permission denied",10 ;13 619 <1> db 10 ;14 620 <1> db 10 ;15 621 <1> db "Device busy",10 ;16 622 <1> db "File exists",10 ;17 623 <1> db 10 ;18 624 <1> db "No such device",10 ;19 625 <1> db 10 ;20 626 <1> db "Is a directory",10 ;21 627 <1> db "Invalid argument",10 ;22 628 <1> db "Too many open files",10 ;23 629 <1> db "Too many open files",10 ;24 630 <1> db "Inappropriate ioctl",10 ;25 631 <1> db "Text file busy",10 ;26 632 <1> db "File too large",10 ;27 633 <1> db "No space on device",10 ;28 634 <1> db "Illegal seek",10 ;29 635 <1> db "R/O file system",10 ;30 636 <1> db "Can't exec " ;31 637 <1> %ifdef USE_EX_NO_SED 638 <1> db EX_PATH,10 639 <1> %else 640 <1> db SEDPATH,10 641 <1> %endif 642 <1> db "Broken pipe",10 ;32 643 <1> %endmacro 644 <1> %ifdef LIBC 645 <1> extern open,read,write,close,lseek,rename,_exit,ioctl,fstat,fchown,select,unlink,fchmod 646 <1> extern errno 647 <1> %undef SYS_readlink 648 <1> %undef SYS_brk 649 <1> %undef SYS_kill 650 <1> %undef SYS_sigaction 651 <1> %undef USE_PIPE 652 <1> %endif 653 <1> 654 <1> %else 655 <1> %ifdef W32 ;----------------------- W I N 32 ----------------------- 656 <1> %define W32LF ;<-- controls linefeed style 657 <1> 658 <1> STD_INPUT_HANDLE equ -10 659 <1> STD_OUTPUT_HANDLE equ -11 660 <1> ENABLE_WINDOW_INPUT equ 8 661 <1> FILE_ATTRIBUTE_NORMAL equ 128 662 <1> OPEN_EXISTING equ 3 663 <1> CREATE_ALWAYS equ 2 664 <1> GENERIC_READ equ $80000000 665 <1> GENERIC_WRITE equ $40000000 666 <1> INVALID_HANDLE_VALUE equ -1 667 <1> FOREGROUND_BLUE equ 1 668 <1> FOREGROUND_GREEN equ 2 669 <1> FOREGROUND_RED equ 4 670 <1> FOREGROUND_INTENSITY equ 8 671 <1> DARKWHITE equ (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED) 672 <1> WHITE equ (DARKWHITE|FOREGROUND_INTENSITY) 673 <1> BACKGROUND_BLUE equ 16 674 <1> YELLOW_BLUE equ FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY|BACKGROUND_BLUE 675 <1> YELLOW_BLUE_TWICE equ YELLOW_BLUE| (YELLOW_BLUE<<16) 676 <1> LEFT_ALT_PRESSED equ 2 677 <1> CTRL_PRESSED equ 12 678 <1> VK_SPACE equ 0x0020 679 <1> VK_PRIOR equ 0x0021 680 <1> VK_DELETE equ 0x002E 681 <1> CF_OEMTEXT equ 7 682 <1> 683 <1> extern MessageBoxA,MessageBeep,ExitProcess 684 <1> extern GetStdHandle,GetCommandLineA,GetLastError,SetConsoleTextAttribute 685 <1> extern SetConsoleMode,GetConsoleScreenBufferInfo,SetConsoleCursorPosition 686 <1> extern WriteFile,ReadFile,CreateFileA,CloseHandle,SetFilePointer,MoveFileA,DeleteFileA 687 <1> extern FillConsoleOutputAttribute,WaitForSingleObject,ReadConsoleA,ReadConsoleInputA 688 <1> extern FlushConsoleInputBuffer,WriteConsoleOutputCharacterA,WriteConsoleOutputAttribute 689 <1> extern HeapCreate,HeapAlloc,HeapFree,HeapDestroy,OpenClipboard,EmptyClipboard 690 <1> extern SetClipboardData,GetClipboardData,IsClipboardFormatAvailable,CloseClipboard 691 <1> %define W32_EXTENDED_IO 692 <1> %undef USE_PIPE 693 <1> 694 <1> MAXERRNO equ 32 695 <1> ERRNOMEM equ 8 696 <1> ERRNOIO equ 7 697 <1> 698 <1> %macro errortext 0 699 <1> db "invalid function",10 ;1 700 <1> db "file not found",10 ;2 701 <1> db "path not found",10 ;3 702 <1> db "too many open files",10 ;4 703 <1> db "access denied",10 ;5 704 <1> db "invalid handle",10 ;6 705 <1> db "I/O error",10 ;7 706 <1> db "not enough memory",10 ;8 707 <1> db 10 ;9 708 <1> db 10 ;10 709 <1> db 10 ;11 710 <1> db 10 ;12 711 <1> db 10 ;13 712 <1> db 10 ;14 713 <1> db 10 ;15 714 <1> db 10 ;16 715 <1> db 10 ;17 716 <1> db 10 ;18 717 <1> db 10 ;19 718 <1> db 10 ;20 719 <1> db 10 ;21 720 <1> db 10 ;22 721 <1> db 10 ;23 722 <1> db 10 ;24 723 <1> db 10 ;25 724 <1> db 10 ;26 725 <1> db 10 ;27 726 <1> db 10 ;28 727 <1> db 10 ;29 728 <1> db 10 ;30 729 <1> db 10 ;31 730 <1> db "sharing violation",10 ;32 731 <1> %endmacro 732 <1> 733 <1> %else ;----------------------- END OS ----------------------- 734 <1> %error no OS defined 735 <1> %endif 736 <1> %endif 737 <1> %endif 738 <1> %endif 739 <1> %endif 740 <1> %endif 741 <1> 742 <1> 743 <1> %ifdef TERMIOS_SET 744 <1> %ifdef ARMCPU 745 <1> struc termios_struc 746 <1> .c_iflag: resd 1 747 <1> .c_oflag: resd 1 748 <1> .c_cflag: resd 1 749 <1> .c_lflag: resd 1 750 <1> .c_line: resb 1 751 <1> .c_cc: resb NCCS 752 <1> endstruc 753 <1> %else 754 <1> %define tcflag_t resd 755 <1> %define cc_t resb 756 <1> struc termios_struc 757 00000000 <1> .c_iflag: tcflag_t 1 758 00000004 <1> .c_oflag: tcflag_t 1 759 00000008 <1> .c_cflag: tcflag_t 1 760 0000000C <1> .c_lflag: tcflag_t 1 761 00000010 <1> .c_line: cc_t 1 762 <1> %ifdef speed_t1 763 <1> c_ixxxxx: speed_t1 1 764 <1> c_oxxxxx: speed_t1 1 765 <1> %endif 766 00000011 <1> .c_cc: cc_t NCCS 767 <1> %ifdef speed_t2 768 <1> res: resd 3 769 <1> c_ixxxxx: speed_t2 1 770 <1> c_oxxxxx: speed_t2 1 771 <1> %endif 772 <1> %ifdef speed_t3 773 00000025 <1> c_ispeed speed_t3 1 774 00000029 <1> c_ospeed speed_t3 1 775 <1> %endif 776 <1> endstruc 777 <1> %endif 778 <1> struc winsize_struc 779 00000000 <1> .ws_row:resw 1 780 00000002 <1> .ws_col:resw 1 781 00000004 <1> .ws_xpixel:resw 1 782 00000006 <1> .ws_ypixel:resw 1 783 <1> endstruc 784 <1> 785 <1> %ifndef IXON ;all except *BSD 786 <1> %define ICRNL 0000400q 787 <1> %define IXON 0002000q 788 <1> %define ICANON 0000002q 789 <1> %define ISIG 0000001q 790 <1> %define ECHO 0000010q 791 <1> %define TSize byte 792 <1> %endif 793 <1> %endif 794 <1> 795 <1> ;------- 796 <1> %ifndef LINUX 797 <1> %undef CRIPLED_ELF 798 <1> %undef UTF8 799 <1> %endif 800 <1> ;-------- 801 <1> ; 802 <1> stdtxtlen equ 10 ;do not move this to EOF: code size would increase 803 <1> 804 <1> %ifdef FREEBSD 805 <1> SIGCONT equ 19 806 <1> SIGSTOP equ 17 807 <1> O_WRONLY_CREAT_TRUNC equ 601h ;see fcntl.h 808 <1> %else 809 <1> %ifdef QNX 810 <1> O_WRONLY_CREAT_TRUNC equ 1401q 811 <1> %else 812 <1> O_WRONLY_CREAT_TRUNC equ 1101q 813 <1> %endif 814 <1> %endif 815 <1> 816 <1> O_RDONLY equ 0 817 <1> PERMS equ 644q 818 <1> stdin equ 0 819 <1> stdout equ 1 820 <1> optslen equ 124 821 <1> TAB equ 8 822 <1> TABCHAR equ 09h 823 <1> SPACECHAR equ ' ' 824 <1> CHANGED equ '*' 825 <1> UNCHANGED equ SPACECHAR 826 <1> LINEFEED equ 0ah 827 <1> NEWLINE equ LINEFEED 828 <1> RETURN equ 0dh 829 <1> SEDBLOCK equ 4096 830 <1> 831 <1> 832 <1> 833 <1> 834 <1> ;-------------------------------------------------------------------------- 835 <1> %ifdef CRIPLED_ELF 836 <1> ; 837 <1> ; building e3 via "nasm -f bin ...." using an idea from 838 <1> ;"A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux" 839 <1> ; 840 <1> %macro ELFheader 0 841 <1> ehdr: db 0x7F, "ELF", 1, 1, 1, 0 ;Elf32_Ehdr starts here 842 <1> dd 0,0 843 <1> dw 2 ;e_type 844 <1> dw 3 ;e_machine 845 <1> dd 1 ;e_version 846 <1> dd _start ;e_entry 847 <1> dd phdr1- $$ ;e_phoff 848 <1> dd 0 ;e_shoff 849 <1> dd 0 ;e_flags 850 <1> dw ehdrsize ;e_ehsize 851 <1> dw phdrsize ;e_phentsize 852 <1> dw 2 ;e_phnum 853 <1> phdr1: ;Elf32_Phdr starts here 854 <1> dd 1 ;both p_type and e_shentsize,e_shnum 855 <1> dw 0 ;both p_offset and e_shstrndx 856 <1> ehdrsize equ $ - ehdr 857 <1> dw 0 858 <1> dd $$ ;p_vaddr 859 <1> dd $$ ;p_paddr 860 <1> dd filesize ;p_filesz 861 <1> dd filesize ;p_memsz 862 <1> dd 5 ;p_flags i.e. READ/EXECUTE 863 <1> dd 0; 0x1000 ;p_align 864 <1> phdrsize equ $ - phdr1 865 <1> phdr2: ;another Elf32_Phdr starts here 866 <1> dd 1 ;p_type 867 <1> dd filesize 868 <1> dd $$+filesize 869 <1> dd $$+filesize 870 <1> dd 0 ;p_filesz 871 <1> dd bsssize ;p_memsz 872 <1> dd 6 ;p_flags i.e. READ/WRITE 873 <1> dd 0; 0x1000 ;p_align 874 <1> %endmacro 875 <1> %endif 876 <1> ;------- 877 <1> %ifndef ARMCPU 878 <1> %macro ORGheader 0 879 <1> %ifdef USE_SPECIAL_HEADER 880 <1> %ifdef TINLINK 881 <1> org 0x800004A ;see file contrib/README.tinlink624 882 <1> %else 883 <1> org 0x8048000 884 <1> ELFheader 885 <1> %endif 886 <1> %else 887 <1> ;nothing 888 <1> %endif 889 <1> %endmacro 890 <1> %endif 891 <1> ;------- 892 <1> %ifdef DYN ;DYN == "libc dynamic linked" 893 <1> %define _start main ;call it "main", libc startup code expects this name 894 <1> %endif 895 <1> 896 <1> ;------- 897 <1> %ifdef AMD64 898 <1> %macro PUSH_ALL 0 899 <1> push rax 900 <1> push rbx 901 <1> push rcx 902 <1> push rdx 903 <1> push rsi 904 <1> push rdi 905 <1> push rbp 906 <1> %endmacro 907 <1> %macro POP_ALL 0 908 <1> pop rbp 909 <1> pop rdi 910 <1> pop rsi 911 <1> pop rdx 912 <1> pop rcx 913 <1> pop rbx 914 <1> pop rax 915 <1> %endmacro 916 <1> %else 917 <1> %macro PUSH_ALL 0 918 <1> pusha 919 <1> %endmacro 920 <1> %macro POP_ALL 0 921 <1> popa 922 <1> %endmacro 923 <1> %endif 924 <1> ;-------------------------------------------------------------------------- 925 ; 926 section .text 927 bits 32 928 ORGheader 929 <1> %ifdef USE_SPECIAL_HEADER 930 <1> %ifdef TINLINK 931 <1> org 0x800004A 932 <1> %else 933 <1> org 0x8048000 934 <1> ELFheader 935 <1> %endif 936 <1> %else 937 <1> 938 <1> %endif 939 global _start 940 ; 941 ; start with OUTER editor loop 942 ; 943 00000000 E82A1A0000 _start: call SetTermStruc 944 %ifdef SELFTEST 945 mov eax,mode 946 mov byte [eax],WS ;store current editor mode: WS only.. 947 mov esi,pipein ;...because the test file expects WS "syntax" 948 %else 949 %ifdef W32 950 push byte 0 951 push dword 8192 ;initial size (to be extended) 952 push byte 0 953 call HeapCreate 954 mov [heap],eax 955 ;------ 956 mov eax,mode 957 mov byte [eax],DEFAULT_MODE ;store default editor mode 958 call GetCommandLineA ;eax points to either D:\PATH\E3.EXE args1 args2 args3... 959 xchg eax,esi ; or "d:\path\e3.exe" 960 ;-- for debug only -- ; or e3.exe "args" 961 ;PUSH_ALL 962 ;push dword 0 ;single OK button 963 ;push dword esi 964 ;push dword esi 965 ;push dword 0 966 ;call MessageBoxA ;show cmd line 967 ;POP_ALL 968 ;-------------------- 969 cld 970 xor ebx,ebx 971 cmp byte [esi],'"' ;due above mentined 2 different cmd line ways 972 jnz prog 973 dec ebx ;ebx -1 due pending '"' 974 prog: lodsb 975 or al,al 976 jz prog9 977 cmp al,SPACECHAR ;TODO chk TABs 978 ja prog 979 inc esi 980 prog9: dec esi 981 prog0: push esi 982 lea esi,[esi+ebx-4-5] ;-4 due suffix ".exe" 983 call SetEditMode 984 jz prog1 985 mov byte [eax],DEFAULT_MODE ;store current editor mode 986 prog1: pop esi 987 xor edx,edx ;no args 988 prog2: lodsb 989 or al,al 990 jz prog3 991 cmp al,SPACECHAR 992 jbe prog2 993 dec esi 994 jmp short prog5 995 prog3: mov esi,edx 996 prog5: 997 %else 998 %ifdef BEOS ;----------------------------------------------------------- 999 pop eax 1000 pop ebx ;args counter (1....x) 1001 pop esi 1002 mov esi,[esi] ;points to our_name0[args]0env..... 1003 cld 1004 prog: lodsb 1005 or al,al 1006 jne prog 1007 mov edx,esi ;store arg ptr 1008 lea esi,[esi-5] 1009 call SetEditMode 1010 jz prog1 1011 mov byte [eax],DEFAULT_MODE ;store current editor mode 1012 prog1: xor esi,esi ;init for 'no args' 1013 dec ebx 1014 jz noarg 1015 mov esi,edx 1016 noarg: 1017 %else 1018 %ifdef DYN ;------------------------------------------------------------ 1019 ; This is to be called from dynamic linked libc startup code 1020 ; just like you would expect: int main(int argc,char**argv) 1021 ; (for experimental purpose only) 1022 ; 1023 xor esi,esi ;init to "no args" 1024 mov ecx,[esp+4] ;"int argc" 1025 cmp ecx,1 1026 je NoArg 1027 mov esi,[esp+8] ;"char**argv" 1028 mov esi,[esi] 1029 cld 1030 Argl: lodsb 1031 or al,al 1032 jne Argl 1033 NoArg: mov eax,mode 1034 mov byte [eax],DEFAULT_MODE ;store current editor mode (WS only) 1035 %undef CURSORMGNT 1036 %else ;-------------- i.e. Linux, FreeBSD, QNX, Ath ------------------ 1037 %ifdef SYS_rt_sigaction 1038 call SetSigHandler 1039 %else 1040 %ifdef SYS_sigaction 1041 00000005 E82C1B0000 call SetSigHandler 1042 %endif 1043 %endif 1044 ;------- 1045 %ifdef ATHEOS 1046 pop edx 1047 pop edx 1048 pop edx 1049 %endif 1050 0000000A 5A pop edx ;Linux: arguments # 1051 0000000B 5E pop esi ;Linux: argv[0] 1052 0000000C FC cld 1053 0000000D AC prog: lodsb 1054 0000000E 08C0 or al,al 1055 00000010 75FB jne prog ;get program name 1056 %ifdef AMD64 1057 lea rsi,[rsi-5] 1058 %else 1059 00000012 8D76FB lea esi,[esi-5] 1060 %endif 1061 00000015 E8C0190000 call SetEditMode 1062 0000001A 7403 jz prog1 1063 0000001C C60001 mov byte [eax],DEFAULT_MODE ;store current editor mode 1064 prog1: 1065 ;------- 1066 0000001F 5E pop esi ;Linux: esi points to first arg (filename) 1067 %ifdef NEW_CURSOR_MGNT 1068 call SetCursorBlock 1069 %endif 1070 %endif 1071 %endif 1072 %endif 1073 %endif 1074 ;------- 1075 %ifdef CURSORMGNT 1076 or esi,esi 1077 jz moreenv 1078 morearg:pop ecx ;arguments until NULL 1079 or ecx,ecx 1080 jnz morearg 1081 ;------- 1082 moreenv:pop ecx 1083 jecxz ReStart 1084 %ifndef ARMCPU 1085 cmp dword[ecx],'TERM' ;a short test for "TERM=linux" 1086 jnz moreenv 1087 cmp dword[ecx+5],'linu' 1088 %else 1089 cmp byte[ecx],'T' 1090 jnz moreenv 1091 cmp byte[ecx+1],'E' 1092 jnz moreenv 1093 cmp byte[ecx+2],'R' 1094 jnz moreenv 1095 cmp byte[ecx+3],'M' 1096 jnz moreenv 1097 cmp byte[ecx+5],'l' 1098 jnz ReStart 1099 cmp byte[ecx+6],'i' 1100 jnz ReStart 1101 cmp byte[ecx+7],'n' 1102 jnz ReStart 1103 cmp byte[ecx+8],'u' 1104 %endif 1105 jnz ReStart 1106 add byte[revvoff],boldlen ;special inverse cursor on linux terminals 1107 %endif 1108 %ifdef UTF8RTS 1109 mov ecx,getPos ;second argument: pointer to message to write 1110 push byte gPlen ;third argument: message length 1111 pop edx 1112 call WriteFile0 1113 mov ecx,screenbuffer ;pointer to buf 1114 push byte 10 1115 pop edx 1116 call ReadFile0 ;get cursor pos 1117 mov al,[ecx+eax-2] ;al == '2' @ UTF8 terminal, else al == '3' 1118 sub al,'3' 1119 mov byte [isUTF8],al 1120 %endif 1121 ;------- 1122 00000020 E83A140000 ReStart:call NewFile 1123 00000025 7248 jc E3exit 1124 00000027 E8351C0000 MainCharLoop:call ChkCursPos 1125 0000002C E8080A0000 call IsViMode 1126 00000031 751C jnz MCL 1127 00000033 8B0D[2A2F0100] mov ecx,[blockbegin] 1128 00000039 E314 jecxz MCL 1129 0000003B 57 push edi 1130 0000003C 89CF mov edi,ecx ;for vi only: keep Begin/End-line marker together 1131 0000003E E8AA090000 call KeyEnd 1132 ; <------prev line------------> 1133 ; BegM......marker line........EndM 1134 ; <-------next line-----------> 1135 00000043 893D[2E2F0100] mov [blockende],edi ;set WS's "blockende" to one after EOL for VI marker 1136 00000049 5F pop edi 1137 0000004A E8D2060000 call ShowBl1 ;i.e. "mov byte [showblock],1" 1138 ;------- 1139 0000004F E8F5090000 MCL: call DispNewScreen 1140 00000054 E802160000 call RestoreStatusLine 1141 00000059 E839000000 call HandleChar 1142 %ifdef W32LF 1143 cmp byte [edi],RETURN ;never stay at character 0dh 1144 jnz MCL2 1145 inc edi ;(rather stay at following 0ah) 1146 MCL2: 1147 %endif 1148 0000005E BB[322F0100] mov ebx,endeedit 1149 00000063 803B00 cmp byte [ebx],0 1150 00000066 74BF je MainCharLoop 1151 00000068 31F6 xor esi,esi ;just like if no arg is present 1152 0000006A 803B02 cmp byte [ebx],2 1153 0000006D 74B1 je ReStart ;^KD repeat edit using another file 1154 0000006F E811110000 E3exit: call KursorStatusLine 1155 %ifdef W32 1156 push dword w32result ;reset all to standard colors 1157 push byte 0 1158 mov eax,[lines] 1159 inc eax 1160 mov ebx,[columns] 1161 mul bl 1162 push eax 1163 push byte DARKWHITE ;equ 7 1164 push dword [hout] 1165 call FillConsoleOutputAttribute 1166 %endif 1167 00000074 B9[2A3D0100] mov ecx,text ;enter next line on terminal NEWLINE is @ byte [text] 1168 00000079 E8EF190000 call WriteFile00 1169 %ifdef NEW_CURSOR_MGNT 1170 call SetCursorNormal 1171 %endif 1172 ;------- 1173 0000007E BB[ED200000] mov ebx,tempfile2 ;undo info (if exist) 1174 00000083 E89C1A0000 call Unlink 1175 %ifdef W32 1176 push dword [heap] 1177 call HeapDestroy 1178 push byte 0 ;return code 1179 call ExitProcess ;Ready&Exit 1180 %else 1181 00000088 B914742C80 mov ecx,TERMIOS_SET 1182 0000008D E8C7190000 call IOctlTerminal0 ;restore termios settings 1183 00000092 E9051A0000 jmp Exit 1184 %endif 1185 ;---------------------------------------------------------------------- 1186 ; 1187 ; MAIN function for processing keys 1188 ; 1189 00000097 E8630D0000 HandleChar:call ReadChar 1190 0000009C 80FCFF cmp ah,0xFF ;normal chars get 0xFF in ah 1191 0000009F 0F8509010000 jne near ExtAscii ;go handling Cursor-Keys 1192 000000A5 BE[DE380100] mov esi,mode 1193 000000AA F60606 test byte [esi], EM | PI 1194 000000AD 741A jz NO_EM01 1195 000000AF 3C0B cmp al,11 1196 000000B1 7407 je IsCtrlK 1197 000000B3 C605[B6380100]00 mov byte [EmaCtrlK],0 1198 000000BA 3C13 IsCtrlK:cmp al,13h ;^S 1199 000000BC 740B je IsCtrlS 1200 000000BE 3C12 cmp al,12h ;^R 1201 000000C0 7407 je IsCtrlS 1202 000000C2 C605[B7380100]00 mov byte [EmaCtrlS],0 1203 IsCtrlS: 1204 000000C9 803E08 NO_EM01:cmp byte [esi],VI 1205 000000CC 7426 jz ISVI1 1206 000000CE 3C20 cmp al,32 ;in WS,EM,PI,NE: handle control chars 1207 000000D0 733A jae NormChar 1208 000000D2 88C3 mov bl,al 1209 000000D4 80C355 add bl,jumps1 1210 000000D7 803E01 cmp byte [esi],WS 1211 000000DA 7413 je CJump 1212 000000DC 80C320 add bl,32 1213 000000DF 803E02 cmp byte [esi],EM 1214 000000E2 740B je CJump 1215 000000E4 80C320 add bl,32 1216 000000E7 803E04 cmp byte [esi],PI 1217 000000EA 7403 je CJump 1218 000000EC 80C320 add bl,32 1219 000000EF E9C8000000 CJump: jmp CompJump2 1220 ISVI1: ;in VI: most control is done in command mode... 1221 000000F4 3C07 cmp al,7 ;... so maintaining another table for ... 1222 000000F6 0F8454020000 je near KeyDel ;... and is useless 1223 000000FC 3C08 cmp al,8 1224 000000FE 0F8445020000 je near KeyDell 1225 00000104 3C0D cmp al,RETURN 1226 00000106 0F84F6000000 je near KeyRet 1227 ;------- 1228 0000010C F605[DE380100]06 NormChar:test byte [mode], EM | PI 1229 00000113 7405 jz NOEM0 1230 00000115 E80F060000 call ShowBl0 ;i.e. "mov byte [showblock],0" 1231 NOEM0: 1232 %ifdef UTF8 1233 %ifdef UTF8RTSx_wont ;won't overwrite more than one single ASCII byte at once... 1234 cmp byte [isUTF8],0 ;...with a 2- or 3-byte UTF-8 character entered from keyboard. 1235 je noUTF_A ;So @ non-UTF8 consoles byte 2,3,... are always inserted. 1236 %endif 1237 mov bl,al 1238 and bl,0C0h 1239 cmp bl,080h ;byte 2,3,4.. always insert 1240 je NormCh2 1241 noUTF_A: 1242 %endif 1243 0000011A E82C0F0000 call CheckMode 1244 %ifdef USE_UNDO 1245 0000011F 7407 jz NormCh2 1246 00000121 E8A61E0000 call DataForUndoOverwrite 1247 00000126 EB09 jmp short OverWriteChar 1248 %else 1249 jnz OverWriteChar 1250 %endif 1251 00000128 50 NormCh2:push eax 1252 %ifdef W32LF 1253 call CheckEof 1254 jz noEOL 1255 cmp word [edi-1],RETURN|(NEWLINE<<8) 1256 jnz noEOL 1257 dec edi ;move back to 0Dh 1258 noEOL: 1259 %endif 1260 00000129 E824110000 call Insert1Byte 1261 0000012E 58 pop eax 1262 0000012F 7209 jc InsWriteEnd ;error: text buffer full 1263 00000131 FC OverWriteChar:cld 1264 00000132 AA stosb 1265 %ifdef UTF8 1266 %ifdef UTF8RTSx_wont ;won't produce incomplete UTF8 characters: .... 1267 cmp byte [isUTF8],0 ;...so one single ASCII will overwrite a complete... 1268 je noUTF_B ;...UTF8 byte sequence at once. 1269 %endif 1270 xor eax,eax 1271 dec eax 1272 OWCloopUTF8:inc eax 1273 mov bl,byte [edi+eax] 1274 and bl,0C0h 1275 cmp bl,080h ;delete byte 2,3,4,.... 1276 je OWCloopUTF8 1277 call DeleteByte 1278 noUTF_B: 1279 %endif 1280 00000133 C605[1E2F0100]2A SetChg: mov byte [changed],CHANGED 1281 0000013A C3 InsWriteEnd:ret 1282 ;------- 1283 0000013B E8CC0D0000 KeyVICmdr:call ReadOneChar ;repl one char (except newline) 1284 00000140 803F0A cmp byte [edi],NEWLINE 1285 00000143 74F5 je InsWriteEnd 1286 00000145 3C0D cmp al,RETURN 1287 00000147 7502 jnz KeyVICmdr1 1288 00000149 B00A mov al,NEWLINE 1289 KeyVICmdr1: 1290 %ifdef USE_UNDO 1291 0000014B E87C1E0000 call DataForUndoOverwrite 1292 %endif 1293 00000150 8807 KeyVICmdr2:mov byte [edi],al 1294 00000152 EBDF jmp short SetChg 1295 ;------- 1296 00000154 BE[80210000] KeyEmaCtrlQ:mov esi,asknumber 1297 00000159 E8CB170000 call GetOctalToInteger 1298 0000015E 76DA jbe InsWriteEnd 1299 00000160 91 xchg eax,ecx ;using decimal input for ASCII value 1300 00000161 3D00010000 cmp eax,256 1301 00000166 72C0 jb NormCh2 1302 00000168 C3 ret 1303 ;------- 1304 ; 1305 ; helper for HandleChar 1306 ; 1307 00000169 BB[43220000] CtrlKMenu:mov ebx,Ktable 1308 0000016E B04B mov al,'K' 1309 00000170 EB20 jmp short Menu 1310 00000172 BB[5E220000] CtrlQMenu:mov ebx,Qtable 1311 00000177 EB0E jmp short PicoQM 1312 00000179 BB[94220000] PicoJMenu:mov ebx,PicoJtable 1313 0000017E B04A mov al,'J' 1314 00000180 EB10 jmp short Menu 1315 00000182 BB[AF220000] PicoQMenu:mov ebx,PicoQtable 1316 00000187 B051 PicoQM: mov al,'Q' 1317 00000189 EB07 jmp short Menu 1318 0000018B BB[79220000] CtrlXMenu:mov ebx,Xtable 1319 00000190 B058 mov al,'X' 1320 00000192 B95E202020 Menu: mov ecx,2020205eh 1321 00000197 88C5 mov ch,al 1322 ;------- 1323 00000199 E8890A0000 MakeScanCode:call WriteTwo ;ebx expects xlat-table 1324 0000019E 53 push ebx 1325 0000019F E8680C0000 call GetChar 1326 000001A4 5B pop ebx 1327 000001A5 241F and al,01fh 1328 000001A7 3C1B cmp al,Ktable_size 1329 000001A9 738F jnb InsWriteEnd ;if no valid scancode 1330 000001AB D7 xlatb 1331 000001AC 88C4 mov ah,al ;=pseudo "scancode" 1332 ;------- cont 1333 000001AE 88E3 ExtAscii:mov bl,ah ;don't use al (carries char e.g. TAB) 1334 000001B0 80FB55 cmp bl,jumps1 1335 000001B3 7385 jae InsWriteEnd 1336 000001B5 31C0 xor eax,eax 1337 000001B7 A3[B6380100] mov [EmaCtrl],eax 1338 000001BC B700 CompJump2:mov bh,0 1339 %ifdef YASM 1340 and ebx,0ffh 1341 %else 1342 000001BE 678D1F lea ebx,[bx] ;1 byte shorter than 'and ebx,0ffh' 1343 %endif 1344 000001C1 0FB79C1B[CA220000] movzx ebx,word [2*ebx+jumptab1] ;2*ebx is due 2 byte per entry 1345 %ifdef YASM 1346 %ifdef AMD64 1347 add rbx,0x400000b0 1348 %else 1349 add ebx,0x08048080 ;most ugly work around ever written 1350 %endif 1351 %else 1352 000001C9 81C3[00000000] add ebx,_start ;offset inside code 1353 %endif 1354 ;------- 1355 000001CF FFD3 call ebx ;the general code jump dispatcher 1356 ;------- 1357 000001D1 803D[5A2F0100]01 cmp byte [numeriere],1 ;after return from functions... 1358 000001D8 7523 jnz BZNret ;...decide whether count current line number 1359 000001DA 57 push edi 1360 000001DB BE[2B3D0100] mov esi,sot 1361 000001E0 87F7 xchg esi,edi 1362 000001E2 31D2 xor edx,edx 1363 000001E4 42 BZNLoop:inc edx ;edx=linenr counter 1364 000001E5 E8740D0000 call LookForward 1365 000001EA 47 inc edi ;point to start of next line 1366 000001EB 39F7 cmp edi,esi 1367 000001ED 76F5 jbe BZNLoop 1368 000001EF 8915[3E2F0100] mov [linenr],edx 1369 000001F5 5F pop edi 1370 000001F6 C605[5A2F0100]00 mov byte [numeriere],0 1371 000001FD C3 BZNret: ret 1372 ;---------------------------------------------------------------------- 1373 ; 1374 ; processing special keys: cursor, ins, del 1375 ; 1376 000001FE 31C0 KeyRetNoInd:xor eax,eax 1377 00000200 EB28 jmp short KeyRetNInd 1378 KeyRet: 1379 ;;; %define NO_AUTO_INDENT ;for Izzy 1380 %ifndef NO_AUTO_INDENT 1381 %ifdef SELFTEST 1382 xor eax,eax 1383 %else 1384 00000202 E8440E0000 call CheckMode 1385 00000207 7542 jnz OvrRet 1386 00000209 E88A0E0000 call CountToLineBegin ;set esi / returns eax 1387 0000020E 46 inc esi 1388 0000020F 46 inc esi 1389 00000210 09C0 or eax,eax 1390 00000212 7416 jz KeyRetNInd 1391 00000214 89C3 mov ebx,eax 1392 00000216 31C0 xor eax,eax 1393 00000218 48 dec eax 1394 00000219 40 KeyRetSrch:inc eax ;search non (SPACE or TABCHAR) 1395 0000021A 39D8 cmp eax,ebx 1396 0000021C 730C jae KeyRetNInd 1397 0000021E 803C0620 cmp byte [esi+eax],SPACECHAR 1398 00000222 74F5 je KeyRetSrch 1399 00000224 803C0609 cmp byte [esi+eax],TABCHAR 1400 00000228 74EF je KeyRetSrch 1401 %endif 1402 %else 1403 xor eax,eax 1404 %endif 1405 0000022A 56 KeyRetNInd:push esi 1406 0000022B 50 push eax ;eax is 0 or =indented chars 1407 0000022C E8FB0E0000 call GoDown 1408 00000231 58 pop eax 1409 00000232 50 push eax 1410 %ifdef W32LF 1411 inc eax ;1 extra for RETURN 1412 call CheckEof 1413 jz noEOL2 1414 cmp word [edi-1],RETURN|(NEWLINE<<8) 1415 jnz noEOL2 1416 dec edi ;move back to 0Dh 1417 noEOL2: 1418 %endif 1419 00000233 E81C100000 call InsertByte0 ;1 extra for NEWLINE 1420 00000238 59 pop ecx ;# blanks 1421 00000239 5E pop esi ;where to copy 1422 0000023A 720E jc SimpleRet 1423 0000023C FF05[3E2F0100] inc dword [linenr] 1424 00000242 FC cld 1425 %ifdef W32LF 1426 mov ax,RETURN|(NEWLINE<<8) ;insert 0d0ah combination 1427 stosw 1428 %else 1429 00000243 B00A mov al,NEWLINE 1430 00000245 AA stosb 1431 %endif 1432 00000246 E302 jecxz SimpleRet 1433 00000248 F3A4 rep movsb ;copy upper line i.e. SPACES,TABS into next 1434 0000024A C3 SimpleRet:ret 1435 0000024B 31C0 OvrRet: xor eax,eax 1436 0000024D A3[562F0100] mov [ch2linebeg],eax 1437 00000252 EB05 jmp short DownRet 1438 ;------- 1439 00000254 E8120E0000 KeyDown:call CountColToLineBeginVis 1440 00000259 E8CE0E0000 DownRet:call GoDown 1441 0000025E E84C0D0000 call LookLineDown 1442 00000263 EB4B jmp short JmpSC 1443 ;------- 1444 00000265 E8BE0E0000 KeyUp: call GoUp 1445 0000026A E8FC0D0000 call CountColToLineBeginVis 1446 0000026F E8300D0000 call LookLineUp 1447 00000274 EB3A jmp short JmpSC 1448 ;------- 1449 00000276 E8F00D0000 KeyHalfPgUp:call CountColToLineBeginVis 1450 0000027B E85E0D0000 call LookHalfPgUp 1451 00000280 EB3A jmp short SetColumn 1452 ;------- 1453 00000282 E8E40D0000 KeyHalfPgDn:call CountColToLineBeginVis 1454 00000287 E85D0D0000 call LookHalfPgDn 1455 0000028C EB2E jmp short SetColumn 1456 ;------- 1457 0000028E E8D80D0000 KeyScrollUp:call CountColToLineBeginVis 1458 00000293 E8410D0000 call LookScrUp 1459 00000298 EB22 jmp short SetColumn 1460 0000029A E8CC0D0000 KeyScrollDn:call CountColToLineBeginVis 1461 0000029F E8300D0000 call LookScrDn 1462 000002A4 EB16 jmp short SetColumn 1463 ;------- 1464 000002A6 E8C00D0000 KeyPgUp:call CountColToLineBeginVis 1465 000002AB E80A0D0000 call LookPageUp 1466 000002B0 EB0A JmpSC: jmp short SetColumn 1467 ;------- 1468 000002B2 E8B40D0000 KeyPgDn:call CountColToLineBeginVis 1469 000002B7 E8380D0000 call LookPgDown ;1st char last line 1470 000002BC 8B0D[562F0100] SetColumn:mov ecx,[ch2linebeg] ;=maximal columns 1471 000002C2 31D2 xor edx,edx ;counts visible columns i.e. expand TABs 1472 000002C4 4F dec edi 1473 000002C5 47 SCloop: inc edi 1474 %ifdef UTF8 1475 %ifdef UTF8RTS 1476 cmp byte [isUTF8],0 ;if the tty can't handle UTF8.. 1477 je noUTF_C ;..each byte is one column 1478 %endif 1479 mov bl,byte [edi] 1480 and bl,0C0h 1481 cmp bl,080h ;do not count byte 2,3,4,.. for columns in UTF8 chars 1482 jz SCloop 1483 noUTF_C: 1484 %endif 1485 000002C6 39CA cmp edx,ecx ;from CountColToLineBeginVis 1486 000002C8 7318 jae SCret 1487 000002CA 803F0A cmp byte [edi],NEWLINE ;don't go beyond line earlier line end 1488 000002CD 7413 jz SCret 1489 000002CF 803F09 cmp byte [edi],TABCHAR 1490 000002D2 7403 jz SCtab 1491 000002D4 42 inc edx ;count columns 1492 000002D5 EBEE jmp short SCloop 1493 000002D7 E88B160000 SCtab: call SpacesForTab 1494 000002DC 00E2 add dl,ah 1495 000002DE 39CA cmp edx,ecx ;this tab to far away right? 1496 000002E0 76E3 jna SCloop ;no 1497 000002E2 C3 SCret: ret 1498 ;---------------------------------------------------------------------- 1499 ; 1500 ; a helper for d'a and y'a vi commands 1501 ; have to differ whether cursor is below or above the marked line 1502 ; (at all this line based concept does not fit very well into e3) 1503 ; expects: 1504 ; ecx valid begin of marked line 1505 ; edi cursor 1506 000002E3 39CF VIsetMarker:cmp edi,ecx 1507 000002E5 771A ja Marker_above_cursor 1508 ; X........cursor line....... 1509 ; ........................... 1510 ; .........marker line....... 1511 ; Y 1512 000002E7 8B0D[2E2F0100] mov ecx,[blockende] 1513 000002ED 41 inc ecx 1514 000002EE 39E9 cmp ecx,ebp 1515 000002F0 7201 jb Mbel 1516 000002F2 49 dec ecx 1517 000002F3 890D[B2380100] Mbel: mov dword [EmaMark],ecx ;i.e. store point Y 1518 ;------- cont 1519 000002F9 E89A0D0000 KeyHome:call CountToLineBegin ;i.e. goto point X 1520 000002FE 29C7 sub edi,eax 1521 00000300 C3 ret 1522 ;------- 1523 Marker_above_cursor: 1524 ; Y.......marker line ....... 1525 ; ........................... 1526 ; ........cursor line........ 1527 ; X ; 1528 00000301 890D[B2380100] mov dword [EmaMark],ecx ;i.e. store point Y 1529 00000307 E8E1060000 call KeyEnd 1530 0000030C 47 inc edi ;i.e. goto point X 1531 0000030D 39EF cmp edi,ebp 1532 0000030F 7201 jb Mret 1533 00000311 4F dec edi 1534 00000312 C3 Mret: ret 1535 ;---------------------------------------------------------------------- 1536 00000313 F615[6A2F0100] KeyIns: not byte [insstat] 1537 00000319 31C0 xor eax,eax 1538 0000031B E819070000 call IsViMode 1539 00000320 7513 jnz KeyIns2 1540 00000322 40 inc eax 1541 00000323 3805[BE380100] cmp byte [VICmdMode],al 1542 00000329 750A jne KeyIns2 1543 0000032B A2[6A2F0100] mov byte [insstat],al 1544 00000330 E875060000 call KeyVImode0 1545 00000335 E807070000 KeyIns2:call IsEmMode 1546 0000033A 7505 jnz KeyIns3 1547 0000033C A2[422F0100] mov byte [showblock],al 1548 KeyIns3: 1549 %ifdef NEW_CURSOR_MGNT 1550 cmp byte [insstat],1 1551 jne near SetCursorNormal 1552 jmp SetCursorBlock 1553 %endif 1554 00000341 C3 ret 1555 ;------- 1556 00000342 E8A6060000 KeyVICmdJ:call KeyEnd 1557 00000347 EB07 jmp short KeyDel 1558 ;------- 1559 00000349 E87E060000 KeyDell:call KeyLeft 1560 0000034E 7425 jz KeyDell2 1561 00000350 39EF KeyDel: cmp edi,ebp 1562 00000352 73ED jnb KeyIns3 1563 00000354 31C0 xor eax,eax ;delete one @ cursor 1564 00000356 40 KDloopUTF8:inc eax 1565 %ifdef UTF8 1566 %ifdef UTF8RTSx_wont ;won't produce incomplete UTF8 characters: .... 1567 cmp byte [isUTF8],0 ;...so pressing DEL single will delete a complete.. 1568 je noUTF_D ...UTF8 byte sequence at once. 1569 %endif 1570 mov bl,byte [edi+eax] 1571 and bl,0C0h 1572 cmp bl,080h 1573 je KDloopUTF8 ;delete one more at UTF-8 byte 2,3,4,.... 1574 noUTF_D: 1575 %endif 1576 %ifdef W32LF 1577 cmp byte [edi-1],RETURN 1578 jnz KD2 1579 dec edi ;delete one more 1580 inc eax 1581 KD2: 1582 %endif 1583 ;------- 1584 00000357 E8DD060000 call IsViMode 1585 0000035C 0F85C60E0000 jne near DeleteByte 1586 00000362 89FE mov esi,edi ;make vi's x and X pasteable 1587 00000364 C605[C6380100]01 mov byte [VInolinebased],1 1588 0000036B E828100000 call KeyEmaAltW2 1589 00000370 E9B30E0000 jmp DeleteByte 1590 ;------- 1591 00000375 81FF[2B3D0100] KeyDell2:cmp edi,sot ;delete newline char 1592 0000037B 76C4 jbe KeyIns3 1593 0000037D FF0D[3E2F0100] dec dword [linenr] 1594 00000383 4F dec edi 1595 00000384 E9B6020000 jmp KeyCtrlT1 1596 ;------- 1597 KeyEmaCtrlT: 1598 %ifdef UTF8 1599 ret ;FIXME!! 1600 %else 1601 00000389 81FF[2B3D0100] cmp edi,sot ;xchg 2 chars 1602 0000038F 7633 jbe KeyRightEnd 1603 00000391 803F0A cmp byte [edi],NEWLINE 1604 00000394 7501 jnz KECT 1605 00000396 4F dec edi 1606 KECT: 1607 %ifdef USE_UNDO 1608 00000397 E8401C0000 call DataForUndoXchange 1609 %endif 1610 0000039C 8A07 mov al,byte [edi] 1611 0000039E 8647FF xchg al,byte [edi-1] 1612 000003A1 E8AAFDFFFF call KeyVICmdr2 ;mov byte [edi],al / mov byte [changed],CHANGED 1613 %endif 1614 ;------- 1615 KeyRight: 1616 %ifdef UTF8 1617 %ifdef UTF8RTSx_wont ;try to keep UTF8 bytes together.. 1618 cmp byte [isUTF8],0 ;...also if the console can not display the UTF8 character 1619 je noUTF_E 1620 %endif 1621 inc edi 1622 mov al,byte [edi] ;check for UTF byte 2,3,4,.. 1623 and al,0c0h 1624 cmp al,080h 1625 je KeyRight 1626 dec edi ;due inc edi above 1627 noUTF_E: 1628 %endif 1629 000003A6 803F0A cmp byte [edi],NEWLINE 1630 000003A9 7518 jnz KeyRNoMargin 1631 000003AB E8C20B0000 call CheckEof 1632 000003B0 7312 jae KeyRightEnd 1633 000003B2 E882060000 call IsViMode 1634 000003B7 740B je KeyRightEnd ;no more line wrap around in vi mode 1635 000003B9 E8C20B0000 call CheckENum ;Sun Feb 20 2005 1636 000003BE E8690D0000 call GoDown 1637 000003C3 47 KeyRNoMargin:inc edi 1638 000003C4 C3 KeyRightEnd:ret 1639 ;------- 1640 000003C5 81FF[2B3D0100] KeyCLeft3:cmp edi,sot 1641 000003CB 7618 jbe KeyCLEnd 1642 000003CD E8AE0B0000 call CheckENum ;Sun Feb 20 2005 1643 000003D2 4F dec edi 1644 000003D3 807FFF0A KeyCtrlQW:cmp byte [edi-1],NEWLINE 1645 000003D7 74EC jz KeyCLeft3 1646 000003D9 4F dec edi 1647 000003DA 803F2F cmp byte [edi],2fh 1648 000003DD 76F4 jbe KeyCtrlQW 1649 000003DF 807FFF2F cmp byte [edi-1],2fh 1650 000003E3 77EE ja KeyCtrlQW 1651 000003E5 C3 KeyCLEnd:ret 1652 ;------- 1653 000003E6 E8870B0000 KeyCRight3:call CheckEof 1654 000003EB 7328 jae KeyCREnd 1655 000003ED E88E0B0000 call CheckENum ;Sun Feb 20 2005 1656 000003F2 EB07 jmp short KQZ1 1657 000003F4 B02F KeyCtrlQZ:mov al,2fh 1658 000003F6 803F0A cmp byte [edi],NEWLINE 1659 000003F9 74EB jz KeyCRight3 1660 000003FB 47 KQZ1: inc edi 1661 000003FC E840060000 call IsEmMode 1662 00000401 7409 jz ISEM2 1663 00000403 3807 cmp byte [edi],al ;ws stops at word begin 1664 00000405 76ED jbe KeyCtrlQZ 1665 00000407 3847FF cmp byte [edi-1],al 1666 0000040A EB07 jmp short ISEM22 1667 0000040C 3847FF ISEM2: cmp byte [edi-1],al ;em stops after end 1668 0000040F 76E3 jbe KeyCtrlQZ 1669 00000411 3807 cmp byte [edi],al 1670 00000413 77DF ISEM22: ja KeyCtrlQZ 1671 00000415 C3 KeyCREnd:ret 1672 ;------- 1673 00000416 E8570B0000 KeyVIcmde3:call CheckEof ;end of word (vi only) 1674 0000041B 73F8 jae KeyCREnd 1675 0000041D 47 inc edi 1676 0000041E 803F0A KeyVIcmde:cmp byte [edi],NEWLINE 1677 00000421 74F3 jz KeyVIcmde3 1678 00000423 47 inc edi 1679 00000424 803F2F cmp byte [edi],2fh 1680 00000427 76F5 jbe KeyVIcmde 1681 00000429 807F012F cmp byte [edi+1],2fh 1682 0000042D 77EF ja KeyVIcmde 1683 0000042F C3 ret 1684 ;------- 1685 00000430 E81D0E0000 KeyEmaCtrlO:call Insert1Byte 1686 00000435 728D jc KeyRightEnd 1687 00000437 B00A mov al,NEWLINE 1688 00000439 8807 mov byte [edi],al 1689 0000043B C3 ret 1690 ;---------------------------------------------------------------------- 1691 ; 1692 ; processing special keys from the WS's Ctrl-Q menu 1693 ; 1694 0000043C E8470B0000 KeyCtrlQE:call LookPgBegin ;goto top left on screen 1695 00000441 E82F0D0000 call KursorFirstLine 1696 00000446 EB20 jmp short KCtKV1 1697 ;------- 1698 00000448 E8470B0000 KeyCtrlQX:call LookPgEnd ;1st goto last line on screen 1699 0000044D E89B050000 call KeyEnd ;2nd goto line end 1700 00000452 E8220D0000 call KursorLastLine 1701 00000457 EB0F jmp short KCtKV1 1702 ;------- 1703 00000459 803D[262F0100]00 KeyCtrlQV:cmp byte [bereitsges],0 ;goto last ^QA,^QF pos 1704 00000460 74B3 jz KeyCREnd 1705 00000462 8B3D[222F0100] mov edi,[oldQFpos] 1706 00000468 E9E1000000 KCtKV1: jmp CQFNum 1707 ;------- 1708 0000046D 6AFF KeyVIbsearch:push byte -1 1709 0000046F EB02 jmp short KVIf 1710 00000471 6A01 KeyVIfsearch:push byte 1 1711 00000473 C605[522F0100]FF KVIf: mov byte[grossklein],0ffh 1712 0000047A EB64 jmp short KeyECtS1 1713 ;------- 1714 0000047C 893D[CA380100] PicoCtrlTpico:mov [PicoSearch],edi ;store begin of search (because wrap around EOF) 1715 00000482 6A01 KeyEmaAltPer:push byte 1 ;s&repl 1716 00000484 8F05[4E2F0100] pop dword[vorwarts] 1717 0000048A C605[522F0100]DF mov byte[grossklein],0dfh 1718 ;------- 1719 00000491 C605[262F0100]02 KeyCtrlQA:mov byte [bereitsges],2 1720 00000498 E88A130000 call AskForReplace 1721 0000049D 7209 jc SimpleRet9 1722 0000049F 57 CQACtrlL:push edi 1723 000004A0 E830140000 call FindText 1724 000004A5 7302 jnc CQACL2 1725 000004A7 5F pop edi 1726 000004A8 C3 SimpleRet9:ret 1727 000004A9 A1[462F0100] CQACL2: mov eax,[suchlaenge] 1728 000004AE E8750D0000 call DeleteByte 1729 000004B3 A1[4A2F0100] mov eax,[repllaenge] 1730 000004B8 E8980D0000 call InsertByte 1731 000004BD BE[DA320100] mov esi,replacetext 1732 000004C2 E84B0E0000 call MoveBlock 1733 000004C7 EB7E jmp short CQFFound 1734 ;------- 1735 000004C9 803D[262F0100]02 KeyPiCtrlJT:cmp byte [bereitsges],2 1736 000004D0 74CD jz CQACtrlL 1737 000004D2 C3 ret 1738 ;------- 1739 000004D3 6AFF KeyEmaCtrlR:push byte -1 1740 000004D5 EB02 jmp short KECS 1741 ;------- 1742 000004D7 6A01 KeyEmaCtrlS:push byte 1 1743 000004D9 C605[522F0100]DF KECS: mov byte[grossklein],0dfh 1744 000004E0 8F05[4E2F0100] KeyECtS1:pop dword[vorwarts] 1745 000004E6 893D[B2380100] mov [EmaMark],edi 1746 000004EC E838020000 call ShowBl0 ;i.e. "mov byte [showblock],0" 1747 ;------- cont 1748 000004F1 E84B050000 KeyCtrlQF:call IsEmMode 1749 000004F6 7509 jnz NO_EM04 1750 000004F8 803D[B7380100]01 cmp byte [EmaCtrlS],1 1751 000004FF 7454 jz KeyCtrlL 1752 00000501 FF35[DA330100] NO_EM04:push dword [suchtext] ;store begin of old find_text 1753 00000507 C605[262F0100]01 mov byte [bereitsges],1 1754 0000050E E836130000 call AskForFind 1755 00000513 5B pop ebx 1756 00000514 9C pushf 1757 00000515 F605[DE380100]0C test byte [mode], VI | PI 1758 0000051C 7417 jz NO_VIPI01 1759 0000051E 9D popf 1760 0000051F 09C0 or eax,eax ;jmp if user entered a new find_text 1761 00000521 750A jnz QFpico 1762 00000523 08DB or bl,bl ;jmp if no old find text available 1763 00000525 742D jz CtrlQFEnd 1764 00000527 881D[DA330100] mov byte [suchtext],bl ;restore last find_text 1765 0000052D 893D[CA380100] QFpico: mov [PicoSearch],edi ;store begin of search (because wrap around EOF) 1766 00000533 EB03 jmp short CQFCtrlL 1767 ;------- 1768 00000535 9D NO_VIPI01:popf 1769 00000536 721C jc CtrlQFEnd 1770 00000538 57 CQFCtrlL:push edi 1771 00000539 E897130000 call FindText 1772 0000053E C605[B7380100]01 mov byte [EmaCtrlS],1 1773 00000545 720C jc CtrlQFNotFound 1774 00000547 893D[222F0100] CQFFound:mov [oldQFpos],edi 1775 0000054D 5E pop esi ;dummy 1776 0000054E E92D0A0000 CQFNum: jmp CheckENum ;i.e. "mov byte [numeriere],1 ret" 1777 00000553 5F CtrlQFNotFound:pop edi 1778 00000554 C3 CtrlQFEnd:ret 1779 ;------- 1780 00000555 A1[262F0100] KeyCtrlL:mov eax,[bereitsges] ;2^QA 1^QF 0else 1781 0000055A 48 dec eax 1782 0000055B 74DB jz CQFCtrlL 1783 0000055D F605[DE380100]15 test byte[mode],WS | NE | PI 1784 00000564 7407 jz SimpleRet4 1785 00000566 48 dec eax 1786 00000567 0F8432FFFFFF jz near CQACtrlL 1787 0000056D C3 SimpleRet4:ret 1788 ;------- 1789 0000056E E899090000 KeyVIcmd1:call ReadOneChar 1790 00000573 3C47 cmp al,'G' 1791 00000575 7410 je KeyCtrlQR 1792 00000577 C3 ret 1793 00000578 E30D ViSpecial:jecxz KeyCtrlQR 1794 0000057A EB42 jmp short KCQI 1795 0000057C 892D[B2380100] KeyNedCtrlA:mov [EmaMark],ebp 1796 00000582 E89A010000 call ShowBl1 ;i.e. "mov byte [showblock],1" but shorter 1797 00000587 BF[2B3D0100] KeyCtrlQR:mov edi,sot 1798 0000058C EBC0 jmp short CQFNum 1799 ;------- 1800 0000058E 8B0D[3A2F0100] KeyCtrlQP:mov ecx,[veryold] 1801 00000594 39E9 cmp ecx,ebp 1802 00000596 77D5 ja SimpleRet4 1803 00000598 89CF mov edi,ecx 1804 0000059A EBB2 JmpCQFN3:jmp short CQFNum 1805 ;------- 1806 0000059C 97 KeyCtrlQB:xchg eax,edi 1807 0000059D 8B3D[2A2F0100] mov edi,[blockbegin] 1808 000005A3 09FF CtrlQB2:or edi,edi ;exit if no marker set 1809 000005A5 75A7 jnz CQFNum 1810 000005A7 97 xchg edi,eax 1811 000005A8 C3 ret 1812 ;------- 1813 000005A9 97 KeyCtrlQK:xchg eax,edi 1814 000005AA 8B3D[2E2F0100] mov edi,[blockende] 1815 000005B0 EBF1 jmp short CtrlQB2 1816 ;------- 1817 000005B2 BE[6E210000] KeyCtrlQI:mov esi,asklineno 1818 000005B7 E871130000 call GetAsciiToInteger 1819 000005BC 7696 jbe CtrlQFEnd ;CY or ZR set 1820 000005BE BF[2B3D0100] KCQI: mov edi,sot 1821 000005C3 E83A0A0000 call LookPD2 1822 000005C8 EBD0 JmpCQFN:jmp short JmpCQFN3 1823 ;------- 1824 000005CA E8FD030000 KeyCtrlQDel:call KeyLeft ;delete all left of cursor 1825 000005CF E8C40A0000 call CountToLineBegin 1826 000005D4 29C7 sub edi,eax 1827 000005D6 EB37 jmp short KCY 1828 ;------- 1829 000005D8 C605[C6380100]01 KeyVICmdD:mov byte [VInolinebased],1 1830 000005DF E87F0A0000 KeyCtrlQY:call CountToLineEnd 1831 %ifdef W32LF 1832 or eax,eax 1833 jz KCQY 1834 cmp byte [edi+eax-1],0dh 1835 jnz KCQY 1836 dec eax ;keep RETURN 0dh char if exist 1837 KCQY: 1838 %endif 1839 000005E4 E850040000 call IsViMode 1840 000005E9 7557 jnz CtrlTEnd1 1841 000005EB E852000000 call CtrlTEnd1 1842 000005F0 E9D7030000 jmp KeyLeft 1843 ;------- 1844 000005F5 E8A80A0000 KeyCmddw:call CountToWordBeginVIstyle 1845 000005FA EB3E jmp short NO_EM05 1846 ;------- 1847 000005FC E8F8FCFFFF KeyCtrlY:call KeyHome ;edi at begin 1848 00000601 E85D0A0000 call CountToLineEnd 1849 00000606 803D[DE380100]01 cmp byte[mode],WS 1850 0000060D 7507 jnz NO_WS01 1851 0000060F E8E60B0000 KCY: call DeleteByteCheckMarker 1852 00000614 EB29 jmp short KeyCtrlT1 1853 00000616 F605[DE380100]0C NO_WS01:test byte [mode], VI | PI 1854 0000061D 740A jz KeyCtrlT 1855 0000061F 8D0C07 lea ecx,[edi+eax] 1856 00000622 39E9 cmp ecx,ebp 1857 00000624 741C jz CtrlTEnd1 ;do not delete pending LINEFEED (0Ah) 1858 00000626 40 inc eax 1859 00000627 EB19 jmp short CtrlTEnd1 1860 ;------- 1861 00000629 E87B0A0000 KeyCtrlT:call CountToWordBegin 1862 0000062E E80E040000 call IsEmMode 1863 00000633 7505 jnz NO_EM05 1864 00000635 E8290A0000 KeyEmaCtrlK:call CountToLineEnd 1865 0000063A 803F0A NO_EM05:cmp byte [edi],NEWLINE 1866 0000063D 7503 jnz CtrlTEnd1 1867 0000063F 31C0 KeyCtrlT1:xor eax,eax 1868 00000641 40 inc eax ;1 for LINEFEED (0ah) 1869 %ifdef W32LF 1870 cmp byte[edi-1],RETURN 1871 jnz KCT2 1872 dec edi ;0dh is expected "left" of 0ah 1873 inc eax ;1 for RETURN (0dh) 1874 KCT2: 1875 %endif 1876 00000642 E82B090000 CtrlTEnd1:call CheckEof 1877 00000647 7477 jz SimpleRet3 1878 00000649 803D[DE380100]01 cmp byte[mode],WS 1879 00000650 0F84A40B0000 jz near DeleteByteCheckMarker 1880 00000656 89FE mov esi,edi 1881 00000658 E83B0D0000 call KeyEmaAltW2 1882 0000065D EB35 jmp short DelBjmp 1883 ;------- 1884 0000065F 8B0D[422F0100] KeyEmaCtrlW:mov ecx,[showblock] 1885 00000665 803D[DE380100]04 cmp byte[mode],PI 1886 0000066C 750C jne NOPI1 1887 KECW: 1888 %ifndef YASM 1889 0000066E E38C jecxz KeyCtrlY 1890 %else 1891 or ecx,ecx 1892 jz near KeyCtrlY 1893 %endif 1894 00000670 8B0D[B2380100] mov ecx,[EmaMark] 1895 00000676 E3F6 jecxz KECW 1896 00000678 EB0A jmp short NOPI2 1897 0000067A E344 NOPI1: jecxz SimpleRet3 1898 0000067C 8B0D[B2380100] mov ecx,[EmaMark] 1899 00000682 E33C jecxz SimpleRet3 1900 00000684 E84F0D0000 NOPI2: call KeyEmaAltW 1901 00000689 8B3D[AE380100] mov edi,[EmaKiSrc] 1902 0000068F A1[AA380100] mov eax,[EmaKiSize] 1903 00000694 E98F0B0000 DelBjmp:jmp DeleteByte 1904 ;---------------------------------------------------------------------- 1905 ; 1906 ; processing special Keys from WS's Ctrl-K menu 1907 ; 1908 00000699 E872090000 KeyCtrlKY:call CheckBlock 1909 0000069E 7220 jc SimpleRet3 ;no block: no action 1910 000006A0 A1[2E2F0100] mov eax,[blockende] 1911 000006A5 89F7 mov edi,esi ;esi is blockbegin (side effect in CheckBlock) 1912 000006A7 29F0 sub eax,esi ;block length 1913 000006A9 E87A0B0000 call DeleteByte ;out ecx:=0 1914 000006AE 91 xchg eax,ecx 1915 000006AF E853110000 call InitSV2 ;block no longer valid 1916 000006B4 E90FFFFFFF JmpCQFN2:jmp JmpCQFN 1917 ;------- 1918 000006B9 8035[422F0100]01 KeyCtrlKH:xor byte [showblock],1 ;flip flop 1919 000006C0 C3 SimpleRet3:ret 1920 KeyCtrlKK: ;UTF-8 :no special handling needed, because block end... 1921 000006C1 893D[2E2F0100] mov [blockende],edi ;... points to first byte _after_ block 1922 000006C7 EB58 jmp short ShowBl1 1923 ;------- 1924 000006C9 E8220C0000 KeyCtrlKC:call CopyBlock 1925 000006CE 7258 jc SimpleRet2 1926 000006D0 893D[2A2F0100] CtrlKC2:mov [blockbegin],edi 1927 000006D6 01F8 add eax,edi 1928 000006D8 E92F110000 jmp InitSV3 ;mov [blockende],eax - ret 1929 ;------- 1930 000006DD 8B0D[B2380100] KeyCtrlXX:mov ecx,[EmaMark] 1931 000006E3 E3DB jecxz SimpleRet3 1932 000006E5 E873000000 call KeyEmaMark 1933 000006EA 89CF mov edi,ecx 1934 000006EC E8730A0000 call KeyEmaCtrlL 1935 000006F1 EBC1 KeyCXX: jmp short JmpCQFN2 1936 ;------- 1937 000006F3 E8F80B0000 KeyCtrlKV:call CopyBlock 1938 000006F8 722E jc SimpleRet2 1939 000006FA 57 push edi 1940 000006FB 3B3D[2A2F0100] cmp edi,[blockbegin] 1941 00000701 9C pushf 1942 00000702 8B3D[2A2F0100] mov edi,[blockbegin] 1943 00000708 E81B0B0000 call DeleteByte 1944 0000070D F7D8 neg eax ;(for optimizing eax is negated there) 1945 0000070F 9D popf 1946 00000710 5F pop edi 1947 00000711 72BD jb CtrlKC2 1948 00000713 893D[2E2F0100] mov [blockende],edi 1949 00000719 29C7 sub edi,eax 1950 0000071B 893D[2A2F0100] KeyCtrlKB:mov [blockbegin],edi ;UTF-8: no special handling needed, because block begin... 1951 00000721 C605[422F0100]01 ShowBl1:mov byte [showblock],1 ;...points to _first_ byte in block 1952 00000728 C3 SimpleRet2:ret 1953 00000729 C605[422F0100]00 ShowBl0:mov byte [showblock],0 1954 00000730 C3 ret 1955 ;------- 1956 00000731 E8D6070000 KeyVICmdm:call ReadOneChar 1957 00000736 3C61 cmp al,'a' ;ma (marker a) 1958 00000738 75EE jne SimpleRet2 1959 0000073A 57 push edi 1960 0000073B E8B9FBFFFF call KeyHome ;setting WS's "blockbegin" to BOL 1961 00000740 893D[2A2F0100] mov [blockbegin],edi 1962 00000746 5F pop edi 1963 00000747 C3 ret 1964 ;------- 1965 00000748 E8BF070000 KeyVICmdJmpM:call ReadOneChar 1966 0000074D 3C61 cmp al,'a' 1967 0000074F 75D7 jne SimpleRet2 1968 00000751 8B0D[2A2F0100] mov ecx,[blockbegin] ;like WStar's Ctrl-QB [also Sun Oct 7 17:01:37 2001] 1969 00000757 E3CF jecxz SimpleRet2 1970 00000759 89CF mov edi,ecx 1971 0000075B EB94 jmp short KeyCXX 1972 ;------- 1973 0000075D 893D[B2380100] KeyEmaMark:mov [EmaMark],edi 1974 00000763 EBBC jmp short ShowBl1 1975 ;------- 1976 00000765 E8610E0000 KeyCtrlKR:call ReadBlock 1977 0000076A 722C jc CtrlKREnd 1978 0000076C E8AAFFFFFF call KeyCtrlKB 1979 00000771 01F9 add ecx,edi 1980 00000773 890D[2E2F0100] mov [blockende],ecx 1981 00000779 F605[DE380100]12 test byte [mode],EM | NE 1982 00000780 740B jz NO_EM03 1983 00000782 890D[B2380100] mov [EmaMark],ecx 1984 00000788 E89CFFFFFF call ShowBl0 ;i.e. "mov byte [showblock],0" 1985 0000078D 803D[DE380100]04 NO_EM03:cmp byte [mode],PI 1986 00000794 7502 jnz CtrlKREnd 1987 00000796 89CF mov edi,ecx ;in PI: cursor at end of read file 1988 00000798 E9F2090000 CtrlKREnd:jmp RestKursPos 1989 ;------- 1990 0000079D E86E080000 KeyCtrlKW:call CheckBlock 1991 000007A2 7263 jc CtrlKSEnd ;no action 1992 000007A4 E8FA0D0000 call SaveBlock 1993 000007A9 EBED jmp short CtrlKREnd 1994 ;------- 1995 000007AB 803D[1E2F0100]20 KeyEmaCtrlXF:cmp byte [changed],UNCHANGED 1996 000007B2 741A jz KECF 1997 000007B4 BE[53210000] mov esi,asksave2 1998 000007B9 E8930E0000 call DE1 1999 000007BE E8CC090000 call RestKursPos 2000 000007C3 E8E1110000 call CheckUserAbort 2001 000007C8 743D jz CtrlKSEnd 2002 000007CA 24DF and al,0dfh 2003 000007CC 3C4E cmp al,'N' ;N for request NOT SAVE changes 2004 000007CE 743F KECF: jz KCKD2 2005 000007D0 EB36 jmp short KeyCtrlKD 2006 ;------- 2007 000007D2 E8890F0000 KeyEmaCtrlXW:call GetBlockName 2008 000007D7 722E jc CtrlKSEnd 2009 000007D9 BE[DA310100] mov esi,blockpath 2010 000007DE FC XW1: cld 2011 PUSH_ALL 2012 000007DF 60 <1> pusha 2013 000007E0 BF[DA2F0100] mov edi,filepath 2014 000007E5 AC XW0: lodsb 2015 000007E6 AA stosb ;copy to blockpath to filepath 2016 000007E7 08C0 or al,al 2017 000007E9 75FA jne XW0 2018 000007EB AA stosb 2019 POP_ALL 2020 000007EC 61 <1> popa 2021 000007ED E841F9FFFF KeyCtrlKS0:call SetChg ;i.e. "mov byte [changed],CHANGED" to save it really 2022 ;------- 2023 000007F2 E8F70C0000 KeyCtrlKS:call SaveFile 2024 000007F7 9C pushf ;(called by ^kd) 2025 000007F8 E892090000 call RestKursPos 2026 000007FD 9D popf 2027 000007FE 7207 jc CtrlKSEnd 2028 00000800 C605[1E2F0100]20 Unchg: mov byte [changed],UNCHANGED 2029 00000807 C3 CtrlKSEnd:ret 2030 ;------- 2031 00000808 E8E5FFFFFF KeyCtrlKD:call KeyCtrlKS 2032 0000080D 7243 jc KeyKXend 2033 0000080F C605[322F0100]02 KCKD2: mov byte [endeedit],2 2034 00000816 C3 ret 2035 ;------- 2036 00000817 803D[1E2F0100]20 KeyCtrlKQ:cmp byte [changed],UNCHANGED 2037 0000081E 742C jz KCKXend 2038 00000820 BE[49210000] mov esi,asksave 2039 00000825 E8270E0000 call DE1 2040 0000082A E860090000 call RestKursPos 2041 0000082F E875110000 call CheckUserAbort 2042 00000834 74D1 jz CtrlKSEnd 2043 00000836 24DF and al,0dfh 2044 00000838 3C4E cmp al,'N' ;N for request NOT SAVE changes 2045 0000083A 7410 jz KCKXend 2046 0000083C 3C4C cmp al,'L' ;L for SAVE and LOAD a new file 2047 0000083E 7505 jnz KeyCtrlKX 2048 00000840 E807000000 call KCKXend 2049 00000845 E8A8FFFFFF KeyCtrlKX:call KeyCtrlKS 2050 0000084A 72BB jc CtrlKSEnd 2051 0000084C FE05[322F0100] KCKXend:inc byte [endeedit] 2052 00000852 C3 KeyKXend:ret 2053 ;---------------------------------------------------------------------- 2054 ; 2055 ; some minimal limited vi specials in command mode 2056 ; 2057 00000853 8D7102 KeyVICmdW:lea esi,[ecx+2] 2058 00000856 803E20 cmp byte [esi],SPACECHAR 2059 00000859 7783 ja XW1 2060 0000085B C3 ret 2061 ;------- 2062 0000085C 8B01 VINoLineCmd:mov eax,[ecx] 2063 0000085E 663D7721 cmp ax,'w!' ;save 2064 00000862 7489 je KeyCtrlKS0 2065 00000864 6683F877 cmp ax,'w' ;save 2066 00000868 7488 je KeyCtrlKS 2067 0000086A 6683F878 cmp ax,'x' ;save and exit 2068 0000086E 74D5 je KeyCtrlKX 2069 00000870 6683F824 cmp ax,'$' ;No line number, but EOF 2070 00000874 7507 jne KVI_KX0 2071 ;------- 2072 00000876 89EF KeyCtrlQC:mov edi,ebp 2073 00000878 E9D1FCFFFF jmp CQFNum 2074 ;------- 2075 0000087D 663D7771 KVI_KX0:cmp ax,'wq' 2076 00000881 74C2 KVI_KX: je KeyCtrlKX 2077 00000883 663D7720 cmp ax,'w ' ;save as ... and continue 2078 00000887 74CA je KeyVICmdW 2079 00000889 6683F871 cmp ax,'q' 2080 0000088D 7488 je KeyCtrlKQ 2081 0000088F 663D7121 cmp ax,'q!' 2082 00000893 74B7 je KCKXend 2083 00000895 663D6520 cmp ax,'e ' ;edit another .. 2084 00000899 0F84B10B0000 je near KeyVICmdE 2085 0000089F 6683F868 cmp ax,'h' 2086 000008A3 0F8429080000 je near KeyHelp 2087 %ifdef UTF8RTS 2088 cmp ax,'u' 2089 je near KeyUTF8switch 2090 %endif 2091 %ifndef USE_PIPE 2092 ret 2093 %else 2094 000008A9 E9AA120000 jmp KeyVICmdtemp 2095 %endif 2096 ;------- 2097 000008AE E859060000 KeyVICmdZ:call ReadOneChar 2098 000008B3 3C5A cmp al,'Z' 2099 000008B5 74CA je KVI_KX 2100 000008B7 C3 ret 2101 ;------- 2102 000008B8 E83CFAFFFF KeyVI1Char:call KeyHome 2103 000008BD 803F20 cmp byte [edi],SPACECHAR 2104 000008C0 7711 ja KFC2 2105 000008C2 803F0A KFC1: cmp byte [edi],NEWLINE 2106 000008C5 740C jz KFC2 2107 000008C7 47 inc edi 2108 000008C8 803F20 cmp byte [edi],SPACECHAR 2109 000008CB 76F5 jbe KFC1 2110 000008CD 807FFF20 cmp byte [edi-1],SPACECHAR 2111 000008D1 77EF ja KFC1 2112 000008D3 C3 KFC2: ret 2113 ;------- 2114 000008D4 E820FAFFFF KeyVICmdS:call KeyHome 2115 000008D9 E857FDFFFF call KeyEmaCtrlK ;not quite ok in 'P'/'p' commands 2116 000008DE C605[C6380100]01 mov byte [VInolinebased],1 2117 000008E5 EB4B jmp short KeyVICmdI 2118 000008E7 E820060000 KeyVICmdd:call ReadOneChar 2119 000008EC 3C77 cmp al,'w' ;word (greetings to ma_ko) 2120 000008EE C605[C6380100]01 mov byte [VInolinebased],1 2121 000008F5 0F84FAFCFFFF je near KeyCmddw 2122 000008FB 3C64 cmp al,'d' ;"delete" 2123 000008FD C605[C6380100]00 mov byte [VInolinebased],0 2124 00000904 0F84F2FCFFFF je near KeyCtrlY 2125 0000090A 3C27 cmp al,"'" ;only line based mode supported 2126 0000090C 75C5 jne KFC2 2127 0000090E E8F9050000 call ReadOneChar 2128 00000913 3C61 cmp al,'a' ;" d'a " (only marker "a" supported) 2129 00000915 75BC jne KFC2 2130 00000917 8B0D[2A2F0100] mov ecx,[blockbegin] ;don't go further if no mark set 2131 0000091D E3B4 jecxz KFC2 2132 0000091F E8BFF9FFFF call VIsetMarker ;an helper for adjusting begin/end marker line 2133 00000924 E836FDFFFF callKECW:call KeyEmaCtrlW 2134 00000929 31C0 xor eax,eax 2135 0000092B A3[2A2F0100] mov [blockbegin],eax ;after delete mark is no more set 2136 00000930 EB3A jmp short JmpCQFn 2137 ;------- 2138 00000932 E881FFFFFF KeyVICmdI:call KeyVI1Char 2139 00000937 EB71 jmp short KeyVImode0 2140 ;------- 2141 00000939 8B0D[AA380100] KeyVICmdp:mov ecx,[EmaKiSize] ;check this before call KeyEmaCtrlY 2142 jmpKFC2: 2143 %ifdef YASM 2144 or ecx,ecx 2145 jz KFC2 2146 %else 2147 0000093F E392 jecxz KFC2 2148 %endif 2149 00000941 803D[C6380100]01 cmp byte [VInolinebased],1 2150 00000948 7472 jz KeyVICmdpnLB 2151 0000094A E8FCF8FFFF call OvrRet ;ugly 2152 0000094F 8B0D[AA380100] KeyVICmdP:mov ecx,[EmaKiSize] ;check this before call KeyEmaCtrlY 2153 00000955 E3E8 jecxz jmpKFC2 2154 00000957 803D[C6380100]01 cmp byte [VInolinebased],1 2155 0000095E 7461 jz KeyVICmdPnLB 2156 00000960 E894F9FFFF call KeyHome 2157 00000965 57 KeyVICP2:push edi 2158 00000966 E8F9090000 call KeyEmaCtrlY 2159 0000096B 5F pop edi 2160 0000096C E9DDFBFFFF JmpCQFn:jmp CQFNum 2161 ;------- 2162 00000971 C605[6A2F0100]FE KeyVICmdR:mov byte [insstat],254 ;i.e "not 1" 2163 00000978 EB30 jmp short KeyVImode0 2164 0000097A E87AF9FFFF KeyVICmdO:call KeyHome 2165 0000097F E87EF8FFFF call KeyRet 2166 00000984 E8DCF8FFFF call KeyUp 2167 00000989 EB1F jmp short KeyVImode0 2168 0000098B E85D000000 KeyVICmdo:call KeyEnd 2169 00000990 E86DF8FFFF call KeyRet 2170 00000995 EB13 jmp short KeyVImode0 2171 00000997 E851000000 KeyVICmdA:call KeyEnd 2172 0000099C EB0C jmp short KeyVImode0 2173 0000099E E803FAFFFF KeyVIcmda:call KeyRight 2174 000009A3 C605[6A2F0100]01 KeyVIcmdi:mov byte [insstat],1 2175 000009AA 6A00 KeyVImode0:push byte 0 2176 000009AC EB49 jmp short KVim1 2177 000009AE E882FCFFFF KeyVICmdC:call KeyEmaCtrlK 2178 000009B3 C605[C6380100]01 mov byte [VInolinebased],1 2179 000009BA EBEE jmp short KeyVImode0 2180 ;------- 2181 000009BC E8E5F9FFFF KeyVICmdpnLB:call KeyRight ;not_Line_Based mode 2182 000009C1 E89FFFFFFF KeyVICmdPnLB:call KeyVICP2 2183 000009C6 033D[AA380100] add edi,[EmaKiSize] ;Wed Apr 10 18:11:42 MEST 2002 2184 ;------- cont 2185 KeyLeft: 2186 %ifdef UTF8 2187 %ifdef UTF8RTSx_wont ;see KeyRight comment 2188 cmp byte [isUTF8],0 2189 je noUTF_F 2190 %endif 2191 dec edi 2192 mov al,byte [edi] ;check for UTF byte 2,3,4,.. 2193 and al,0c0h 2194 cmp al,080h 2195 je KeyLeft 2196 inc edi 2197 noUTF_F: 2198 %endif 2199 000009CC 807FFF0A cmp byte [edi-1],NEWLINE 2200 000009D0 7519 jnz KeyLNoMargin 2201 000009D2 81FF[2B3D0100] cmp edi,sot ;i.e. CheckBof 2202 000009D8 7412 je KeyLeftEnd 2203 000009DA E85A000000 call IsViMode 2204 000009DF 740B je KeyLeftEnd ;no more line wrap around in vi mode 2205 000009E1 E89A050000 call CheckENum ;Sun Feb 20 2005 2206 000009E6 E83D070000 call GoUp 2207 000009EB 4F KeyLNoMargin:dec edi 2208 %ifdef W32LF 2209 cmp byte [edi],RETURN ;do not stay at 0dh 2210 jnz KeyLeftEnd 2211 dec edi 2212 %endif 2213 000009EC C3 KeyLeftEnd:ret 2214 ;------- 2215 000009ED E871060000 KeyEnd: call CountToLineEnd 2216 000009F2 01C7 add edi,eax ;points to a LINEFEED (0ah) char 2217 000009F4 C3 ret 2218 ;------- 2219 000009F5 6A01 KeyVImode1:push byte 1 2220 000009F7 58 KVim1: pop eax 2221 000009F8 A2[BE380100] mov byte [VICmdMode],al 2222 000009FD C3 ret 2223 ;------- 2224 000009FE E8AD020000 KeyVIex:call InputStringWithMessage0 2225 00000A03 9C pushf 2226 00000A04 E886070000 call RestKursPos 2227 00000A09 9D popf 2228 00000A0A 723C jc Kviex 2229 00000A0C BE[DA350100] mov esi,optbuffer 2230 00000A11 31D2 xor edx,edx 2231 00000A13 89C1 mov ecx,eax ;do not use xchg here 2232 00000A15 E331 jecxz Kviex 2233 ;------- 2234 00000A17 56 push esi ;save optbuffer 2235 00000A18 FC cld 2236 00000A19 AC CheckDig:lodsb ;check for line number entered 2237 00000A1A 3C30 cmp al,'0' 2238 00000A1C 7301 jnb CD1 2239 00000A1E 42 inc edx 2240 00000A1F 3C3A CD1: cmp al,':' 2241 00000A21 7201 jb CD2 2242 00000A23 42 inc edx 2243 00000A24 E2F3 CD2: loop CheckDig 2244 00000A26 59 pop ecx ;rest optbuffer 2245 ;------- 2246 00000A27 09D2 or edx,edx 2247 00000A29 0F852DFEFFFF jnz near VINoLineCmd 2248 00000A2F E8F90E0000 call GetAsciiToInteger 2249 00000A34 E93FFBFFFF jmp ViSpecial ;due short jumps there 2250 ;------- 2251 00000A39 803D[DE380100]08 IsViMode:cmp byte [mode],VI 2252 00000A40 C3 ret 2253 00000A41 803D[DE380100]02 IsEmMode:cmp byte [mode],EM 2254 00000A48 C3 Kviex: ret 2255 ;--------------------------------------------------------------------- 2256 ; 2257 ; the general PAGE DISPLAY function: called after any pressed key 2258 ; 2259 ; side effect: sets 'columne' for RestoreStatusLine function (displays column) 2260 ; variable kurspos: for placing the cursor at new position 2261 ; register bh counts lines 2262 ; register bl counts columns visible on screen (w/o left scrolled) 2263 ; register edx counts columns in text lines 2264 ; register ecx screen line counter and helper for rep stos 2265 ; register esi text index 2266 ; register edi screen line buffer index 2267 ; 2268 00000A49 F605[DE380100]16 DispNewScreen:test byte [mode], EM | PI | NE 2269 00000A50 7422 jz NoEmBlock 2270 00000A52 8B0D[422F0100] mov ecx,[showblock] ;transfering Emacs's mark/point into.... 2271 00000A58 E31A jecxz NoEmBlock ;....WS's block display system 2272 00000A5A 8B0D[B2380100] mov ecx,[EmaMark] 2273 00000A60 E312 jecxz NoEmBlock 2274 00000A62 89F8 mov eax,edi 2275 00000A64 39C1 cmp ecx,eax 2276 00000A66 7201 jb EmBlock 2277 00000A68 91 xchg eax,ecx 2278 00000A69 890D[2A2F0100] EmBlock:mov [blockbegin],ecx 2279 00000A6F A3[2E2F0100] mov [blockende ],eax 2280 ;------- 2281 00000A74 E87E010000 NoEmBlock:call GetEditScreenSize ;check changed tty size 2282 00000A79 31C0 xor eax,eax 2283 00000A7B A2[622F0100] mov byte[isbold],al 2284 00000A80 A2[662F0100] mov byte[inverse],al 2285 00000A85 A3[0A2F0100] mov [zloffst],eax 2286 00000A8A A3[062F0100] mov [columne],eax 2287 00000A8F 893D[0E2F0100] mov [fileptr],edi ;for seeking current cursor pos 2288 00000A95 57 push edi ;&&**## 2289 00000A96 E8D0050000 call CountColToLineBeginVis ;i.e. expanding TABs 2290 00000A9B 8B1D[022F0100] mov ebx,[columns] 2291 00000AA1 8D5BFC lea ebx,[ebx-4] ;03 Jun 2001 2292 00000AA4 39D8 cmp eax,ebx 2293 00000AA6 7208 jb short DispShortLine 2294 00000AA8 29D8 sub eax,ebx 2295 00000AAA 40 inc eax 2296 00000AAB A3[0A2F0100] mov [zloffst],eax 2297 00000AB0 E8D3040000 DispShortLine:call LookPgBegin ;go on 1st char upper left on screen 2298 00000AB5 89FE mov esi,edi ;esi for reading chars from text 2299 00000AB7 8B0D[FE2E0100] mov ecx,[lines] 2300 %ifndef YASM 2301 00000ABD E389 jecxz Kviex 2302 %else 2303 or ecx,ecx 2304 jz near Kviex 2305 %endif 2306 00000ABF FC cld 2307 00000AC0 B7FF mov bh,-1 ;first line 2308 00000AC2 FEC7 DispNewLine:inc bh ;new line 2309 00000AC4 BF[72370100] mov edi,screenline ;line display buffer 2310 00000AC9 31D2 xor edx,edx ;reset char counter 2311 00000ACB B300 mov bl,0 ;reset screen column to 0 2312 %ifdef LESSWRITEOPS 2313 00000ACD E8F6000000 call SetColor2 ;set initial character color per each line 2314 %endif 2315 DispCharLoop: 2316 00000AD2 3B35[0E2F0100] cmp esi,[fileptr] ;display char @ cursor postion ? 2317 00000AD8 751C jnz DispCharL1 2318 00000ADA 803D[1A2F0100]00 cmp byte[tabcnt],0 2319 00000AE1 7513 jnz DispCharL1 2320 00000AE3 891D[122F0100] mov [kurspos],ebx 2321 00000AE9 A1[0A2F0100] mov eax,[zloffst] ;chars scrolled left hidden 2322 00000AEE 00D8 add al,bl 2323 00000AF0 0105[062F0100] add [columne],eax 2324 %ifdef CURSORMGNT 2325 stc 2326 call SetInverseStatus 2327 jnc DispEndLine 2328 %endif 2329 00000AF6 E8A2000000 DispCharL1:call SetColor ;set color if neccessary 2330 ;------- 2331 00000AFB 39EE DispEndLine:cmp esi,ebp 2332 00000AFD 7757 ja FillLine ;we have passed EOF, so now fill rest of screen 2333 00000AFF 803D[1A2F0100]00 cmp byte[tabcnt],0 2334 00000B06 7408 jz ELZ 2335 00000B08 FE0D[1A2F0100] dec byte[tabcnt] 2336 00000B0E EB19 jmp short ELZ2 2337 00000B10 39EE ELZ: cmp esi,ebp 2338 00000B12 7503 jnz ELZ6 2339 00000B14 46 inc esi ;set esi>ebp will later trigger "ja FillLine" 2340 00000B15 EB12 jmp short ELZ2 2341 00000B17 AC ELZ6: lodsb 2342 00000B18 3C09 cmp al,TABCHAR 2343 00000B1A 750F jnz ELZ3 2344 00000B1C E8460E0000 call SpacesForTab ;ah = space_up_to_next_tab location 2345 00000B21 FECC dec ah ;count out the tab char itself 2346 00000B23 8825[1A2F0100] mov byte[tabcnt],ah 2347 00000B29 B020 ELZ2: mov al,SPACECHAR 2348 00000B2B 3C0A ELZ3: cmp al,NEWLINE 2349 00000B2D 7427 jz FillLine 2350 %ifdef W32LF 2351 cmp al,RETURN 2352 jz ELZ5 ;keep 0dh "invisible" 2353 %endif 2354 00000B2F 3C20 cmp al,SPACECHAR 2355 00000B31 7302 jae ELZ9 ;simply ignore chars like carriage_return etc. 2356 00000B33 B02E ELZ99: mov al,'.' 2357 ELZ9: 2358 %ifndef W32 2359 00000B35 3C7F cmp al,7fh 2360 00000B37 7204 jb ELZ7 2361 00000B39 74F8 je ELZ99 2362 %ifndef UTF8 2363 00000B3B B02E mov al,'.' 2364 %else 2365 %ifdef UTF8RTS 2366 cmp byte [isUTF8],0 2367 jne YXCVB 2368 mov al,'.' 2369 YXCVB: 2370 %endif 2371 %endif 2372 ELZ7: 2373 %endif 2374 00000B3D 3A1D[022F0100] cmp bl,byte [columns] ;screen width 2375 00000B43 73B6 jae DispEndLine ;continue reading line until end 2376 ;------- 2377 %ifdef UTF8 2378 mov ah,0 2379 %ifdef UTF8RTS 2380 cmp byte [isUTF8],0 2381 je CountByte 2382 %endif 2383 push eax 2384 and al,0c0h 2385 cmp al,080h 2386 pop eax 2387 jz UByte234 ;MSB 10...... =do not count 2388 jb CountByte ;MSB 01...... 00...... count valid 7bit ASCII 2389 push eax 2390 mov al,byte [esi] ;check next byte for vaild UTF8 follower byte 2391 and al,0C0h 2392 cmp al,80h ;is UTF8 byte 2,3,4,.. ? 2393 pop eax 2394 jnz UByte234 ;no do not count wrong UTF8 starter byte 2395 CountByte:inc edx 2396 inc ah ;1 2397 UByte234:cmp edx,[zloffst] 2398 jbe ELZ5 ;loaded new char (but won't display) 2399 stosB 2400 add bl,ah ;i.e. add 0 or 1 to curser column position counter 2401 %else 2402 00000B45 42 inc edx 2403 00000B46 3B15[0A2F0100] cmp edx,[zloffst] 2404 00000B4C 7603 jbe ELZ5 ;loaded new char (but won't display) 2405 00000B4E AA stosB 2406 00000B4F FEC3 inc bl 2407 %endif 2408 ;------- 2409 %ifdef CURSORMGNT 2410 clc 2411 call SetInverseStatus 2412 %endif 2413 00000B51 E97CFFFFFF ELZ5: jmp DispCharLoop 2414 ;------- 2415 00000B56 51 FillLine:push ecx ;continue rest of line 2416 00000B57 8B0D[022F0100] mov ecx,[columns] ;width 2417 00000B5D 28D9 sub cl,bl 2418 00000B5F B020 mov al,SPACECHAR ;fill with blanks 2419 00000B61 E30F jecxz FillLine2 2420 00000B63 803D[662F0100]01 cmp byte[inverse],1 ;special cursor attribute? 2421 00000B6A 7504 jnz FillLine1 2422 00000B6C AA stosB ;only 1st char with special attribute 2423 %ifdef CURSORMGNT 2424 clc 2425 call SetInverseStatus 2426 %endif 2427 00000B6D 49 dec ecx ;one char less 2428 00000B6E 7402 jz FillLine2 2429 FillLine1: 2430 00000B70 F3AA rep stosB ;store the rest blanks 2431 00000B72 59 FillLine2:pop ecx 2432 00000B73 C60700 mov byte[edi],0 2433 00000B76 E8B4000000 call ScreenLineShow 2434 00000B7B 49 dec ecx 2435 00000B7C 0F8540FFFFFF jnz near DispNewLine 2436 00000B82 5F pop edi ;&&**## ;OLD: mov edi,[fileptr] ;=restore text pointer 2437 00000B83 E907060000 jmp RestKursPos 2438 ;---------------------------------------------------------------------- 2439 ; three helper subroutines called by DispNewScreen 2440 ; dealing ESC sequences for character attributes 2441 ; 2442 %ifdef CURSORMGNT 2443 SetInverseStatus: 2444 push ecx ;returns zero flag 2445 push esi 2446 jnc SIS1 2447 cmp byte [insstat],1 2448 stc 2449 jnz SIS4 2450 mov byte[inverse],1 2451 mov esi,reversevideoX 2452 add esi,[revvoff] ;switch between esc seq for linux or Xterm 2453 jmp short SIS2 2454 SIS1: cmp byte[inverse],1 2455 jnz SIS3 2456 mov byte[inverse],0 2457 ;-------continued... 2458 %endif 2459 ;------ 2460 ; next presented in 2 versions: one for Win32, one for Terminals 2461 ; 2462 %ifdef W32 ;------------- this can't be done via ESC seq ---------------- 2463 SIS6: mov byte[isbold],0 2464 SIS5: mov eax,DARKWHITE 2465 SIS2: mov ecx,edi 2466 sub ecx,screenline 2467 mov edx,ecx ;current pos in columne 2468 shl ecx,1 2469 mov edi,attribline 2470 add edi,ecx 2471 mov ecx,[columns] 2472 sub ecx,edx ;only current pos up to line end 2473 rep stosw 2474 SIS3: clc 2475 SIS4: POP_ALL 2476 ret 2477 SetColor: ;expects cy flag:bold / nc:normal 2478 PUSH_ALL 2479 call IsShowBlock 2480 jnc SCEsc1 2481 cmp byte [isbold],1 ;never set bold if it is already bold 2482 jz SIS4 2483 mov byte [isbold],1 2484 SCEsc2: mov eax,WHITE 2485 jmp short SIS2 2486 SCEsc1: cmp byte [isbold],0 ;ditto 2487 jz SIS4 2488 jmp short SIS6 2489 ;------- 2490 SetColor2:PUSH_ALL 2491 call IsShowBlock 2492 jnc SIS5 2493 jmp short SCEsc2 2494 %else ;---------------------- TERMINAL part ----------------------------- 2495 00000B88 C605[622F0100]00 SIS6: mov byte[isbold],0 2496 00000B8F BE[7F240000] SIS5: mov esi,bold0 2497 00000B94 6A04 SIS2: push byte boldlen 2498 00000B96 59 pop ecx 2499 00000B97 F3A4 rep movsb 2500 00000B99 F8 SIS3: clc 2501 00000B9A 5E SIS4: pop esi 2502 00000B9B 59 pop ecx 2503 00000B9C C3 ret 2504 ;------- 2505 00000B9D 51 SetColor:push ecx ;expects cy flag:bold / nc:normal 2506 00000B9E 56 push esi 2507 00000B9F E82F000000 call IsShowBlock 2508 00000BA4 7317 jnc SCEsc1 2509 00000BA6 803D[622F0100]01 cmp byte [isbold],1 ;never set bold if it is already bold 2510 00000BAD 74EB jz SIS4 2511 00000BAF C605[622F0100]01 mov byte [isbold],1 2512 00000BB6 BE[8D240000] SCEsc2: mov esi,bold1 2513 00000BBB EBD7 jmp short SIS2 2514 00000BBD 803D[622F0100]00 SCEsc1: cmp byte [isbold],0 ;ditto 2515 00000BC4 74D4 jz SIS4 2516 00000BC6 EBC0 jmp short SIS6 2517 ;------- 2518 %ifdef LESSWRITEOPS 2519 SetColor2: 2520 00000BC8 51 push ecx 2521 00000BC9 56 push esi 2522 00000BCA E804000000 call IsShowBlock 2523 00000BCF 73BE jnc SIS5 2524 00000BD1 EBE3 jmp short SCEsc2 2525 %endif 2526 %endif ;----------------- end of double part ----------------------------- 2527 ; 2528 ;------- 2529 ; a little helper for SetColor* functions 2530 ; 2531 00000BD3 803D[422F0100]00 IsShowBlock:cmp byte [showblock],0 2532 00000BDA 7419 je SBlock 2533 00000BDC 833D[2A2F0100]00 cmp dword [blockbegin],0 2534 00000BE3 7410 je SBlock 2535 00000BE5 3935[2A2F0100] cmp [blockbegin],esi 2536 00000BEB 7708 ja SBlock 2537 00000BED 3B35[2E2F0100] cmp esi,[blockende] 2538 00000BF3 7201 jb SB_ret 2539 00000BF5 F8 SBlock: clc 2540 00000BF6 C3 SB_ret: ret 2541 ;------- 2542 ; this helper for DispNewScreen checks screen size before writing on screen 2543 ; FIXME: adjusting edit screen resize works with xterm, but not with SVGATextMode 2544 ; 2545 GetEditScreenSize: 2546 %ifdef W32 2547 push dword csbi 2548 push dword [hout] 2549 call GetConsoleScreenBufferInfo 2550 or eax,eax 2551 mov eax,[csbi] 2552 jnz noerr 2553 mov eax,0x00190050 ;i.e. (80<<16)+24 (assume 80x25) 2554 noerr: mov byte [columns],al 2555 shr eax,16 2556 dec eax 2557 mov byte [lines],al ;columns > 255 are ignored... 2558 ret 2559 %else 2560 00000BF7 B968740840 mov ecx,TERMIOS_WSIZE 2561 00000BFC BA[DA2E0000] mov edx,winsize 2562 00000C01 E8580E0000 call IOctlTerminal 2563 00000C06 8B02 mov eax,[edx] ;each 16 bit lines,columns 2564 00000C08 3DFFFF0000 cmp eax,0x0000FFFF ;some give no columns info..? 2565 00000C0D 7204 jb iserr 2566 00000C0F 09C0 or eax,eax 2567 00000C11 7505 jnz noerr 2568 00000C13 B818005000 iserr: mov eax,0x00500018 ;i.e. (80<<16)+24 (assume 80x24) 2569 00000C18 48 noerr: dec eax ;without status line ('dec al' are 2 byte!) 2570 00000C19 A2[FE2E0100] mov byte [lines],al 2571 00000C1E C1E810 shr eax,16 2572 00000C21 A2[022F0100] mov byte [columns],al ;columns > 255 are ignored... 2573 00000C26 C3 ret 2574 %endif 2575 ;---------------------------------------------------------------------- 2576 ; 2577 ; LOWER LEVEL screen acces function (main +2 helpers) 2578 ; this function does write the line buffer to screen i.e. terminal 2579 ; 2580 ; at first 2 special entry points: 2581 00000C27 890D[72370100] WriteTwo:mov [screenline],ecx 2582 StatusLineShow: 2583 %ifdef W32 2584 push edi 2585 mov ecx,[columns] 2586 shr ecx,1 2587 mov eax,YELLOW_BLUE_TWICE 2588 mov edi,attribline 2589 rep stosd 2590 pop edi 2591 mov edx,[kurspos2] 2592 call sys_writeKP ;set cursor pos before reading chars 2593 %endif 2594 00000C2D 31C9 xor ecx,ecx ;0 for bottom line 2595 ;------- 2596 ScreenLineShow:PUSH_ALL ;expecting in ecx screen line counted from 0 2597 <1> ScreenLineShow: 2598 00000C2F 60 <1> pusha 2599 %ifdef LESSWRITEOPS 2600 %ifdef W32 ;screen attrib caching 2601 mov eax,[columns] 2602 mul ecx ;setting edx to 0 2603 mov ebx,edx ;flag 2604 lea edi,[eax+attribbuffer] 2605 cld 2606 mov esi,attribline 2607 Xsl3: lodsw 2608 cmp edi,attribbuffer_end ;never read/write beyond buffer 2609 jnb Xsl5 2610 cmp ax,[edi] 2611 jz Xsl4 2612 mov [edi],ax 2613 Xsl5: inc ebx ;set flag whether line need redrawing 2614 Xsl4: inc edi 2615 inc edi 2616 or al,al 2617 jnz Xsl3 2618 %else 2619 00000C30 31DB xor ebx,ebx ;flag 2620 %endif 2621 ;------- 2622 00000C32 A1[022F0100] mov eax,[columns] 2623 00000C37 8D4020 lea eax,[eax+32] ;estimated max ESC sequences extra bytes (i.e. boldlen*X) (BTW add eax,32 islonger) 2624 00000C3A F7E1 mul ecx ;setting edx to 0 2625 00000C3C 8DB8[00000000] lea edi,[eax+screenbuffer] 2626 %else 2627 xor edx,edx ;counter 2628 %endif 2629 00000C42 FC cld 2630 00000C43 BE[72370100] mov esi,screenline 2631 00000C48 AC sl3: lodsb 2632 00000C49 42 inc edx ;count message length to write 2633 %ifdef LESSWRITEOPS 2634 00000C4A 81FF[802E0000] cmp edi,screenbuffer_end ;never read/write beyond buffer 2635 00000C50 7306 jnb sl5 2636 00000C52 3A07 cmp al,[edi] 2637 00000C54 7403 jz sl4 2638 00000C56 8807 mov [edi],al 2639 00000C58 43 sl5: inc ebx ;set flag whether line need redrawing 2640 00000C59 47 sl4: inc edi 2641 %endif 2642 00000C5A 08C0 or al,al 2643 00000C5C 75EA jnz sl3 2644 00000C5E 4A dec edx ;one too much 2645 %ifdef LESSWRITEOPS 2646 00000C5F 09DB or ebx,ebx ;redraw ? 2647 00000C61 743C jz NoWrite 2648 %endif 2649 00000C63 52 push edx 2650 00000C64 31D2 xor edx,edx 2651 00000C66 8A35[FE2E0100] mov dh,byte [lines] 2652 00000C6C 28CE sub dh,cl 2653 %ifdef W32_EXTENDED_IO 2654 pop ebx ;len 2655 shl edx,8 2656 and edx,00ff0000h ;only line# (column is always 0) 2657 push edx ;cursor data 2658 ;------- 2659 push dword w32result 2660 push edx ;cursor 2661 push ebx ;length 2662 push dword screenline 2663 push dword [hout] 2664 call WriteConsoleOutputCharacterA 2665 ;------- 2666 pop edx 2667 push dword w32result 2668 push edx ;cursor 2669 push ebx ;length 2670 push dword attribline 2671 push dword [hout] 2672 call WriteConsoleOutputAttribute 2673 %else 2674 ;this works on both Terminal and W32, ... 2675 ;...but is suboptimal and slow on W32 2676 00000C6E E828050000 call sys_writeKP ;set cursor pos before writing the line 2677 00000C73 5A pop edx 2678 00000C74 51 push ecx 2679 00000C75 B8[83240000] mov eax,screencolors1 ;set bold yellow on blue 2680 00000C7A E822000000 call sys_writeSLColors ;special for status line (ecx==0) 2681 00000C7F B9[72370100] mov ecx,screenline ;second argument: pointer to message to write 2682 00000C84 E8E70D0000 call WriteFile0 2683 ;------- 2684 00000C89 59 pop ecx 2685 00000C8A B8[75240000] mov eax,screencolors0 ;reset to b/w 2686 00000C8F E80D000000 call sys_writeSLColors ;special for status line (ecx==0) 2687 00000C94 8B15[162F0100] mov edx,[kurspos2] 2688 00000C9A E8FC040000 call sys_writeKP ;restore old cursor pos 2689 %endif 2690 NoWrite:POP_ALL 2691 <1> NoWrite: 2692 00000C9F 61 <1> popa 2693 00000CA0 C3 ret 2694 ;------- 2695 ; a helper for ScreenLineShow 2696 ; 2697 sys_writeSLColors: 2698 %ifndef W32 2699 00000CA1 E301 jecxz syswSL ;do nothing if not in status line 2700 00000CA3 C3 ret 2701 syswSL: PUSH_ALL 2702 <1> syswSL: 2703 00000CA4 60 <1> pusha 2704 00000CA5 91 xchg eax,ecx ;parameter points to ESC-xxx color string 2705 00000CA6 6A0E push byte scolorslen 2706 00000CA8 5A pop edx 2707 00000CA9 E8C20D0000 call WriteFile0 2708 POP_ALL 2709 00000CAE 61 <1> popa 2710 %endif 2711 00000CAF C3 ret 2712 ;---------------------------------------------------------------------- 2713 ; 2714 ; getting line INPUT from terminal / UNDER CONSTRUCTION 2715 ; 2716 ; expecting pointer to message text in esi 2717 ; 2718 00000CB0 BE[8A210000] InputStringWithMessage0:mov esi,extext 2719 00000CB5 E86E0A0000 InputStringWithMessage:call WriteMess9MakeLine 2720 00000CBA B9[DA350100] mov ecx,optbuffer 2721 00000CBF 6A7C push byte optslen 2722 00000CC1 5A pop edx 2723 00000CC2 EB0F jmp short InputString 2724 ;------- 2725 00000CC4 B9[DA330100] InputString00:mov ecx,suchtext 2726 00000CC9 E85A0A0000 InputString0:call WriteMess9MakeLine 2727 00000CCE BAFF000000 mov edx,maxfilenamelen 2728 ; expecting input line buffer in ecx 2729 ; expecting max count byte in edx 2730 ; return length in eax, CY for empty string (or user abort) 2731 ; 2732 00000CD3 51 InputString:push ecx 2733 00000CD4 57 push edi 2734 00000CD5 6A02 push byte 2 2735 00000CD7 58 pop eax 2736 00000CD8 8705[BE380100] xchg eax, [VICmdMode] 2737 00000CDE 50 push eax ;LONGER: push dword [VICmdMode], mov byte [VICmdMode],2 2738 00000CDF FF35[162F0100] push dword [kurspos2] 2739 00000CE5 8B1D[022F0100] mov ebx,[columns] 2740 %ifndef LINUX 2741 00000CEB 4B dec ebx ;*BSD do not use lower right screen place... 2742 %endif ;...due some unwanted vertical scrolling 2743 00000CEC 8D5BF6 lea ebx,[ebx-stdtxtlen] 2744 00000CEF 39DA cmp edx,ebx ;TODO should enable some scrolling: 2745 00000CF1 7202 jb IS8 ;not yet ready, so truncate at end of line 2746 00000CF3 89DA mov edx,ebx ;edx == max chars 2747 00000CF5 31DB IS8: xor ebx,ebx ;ebx == chars in buffer 2748 00000CF7 89CF mov edi,ecx ;edi == pointer on current char 2749 ;------- ;ecx == pointer to begin of readline text 2750 ; 2751 00000CF9 53 IS0: push ebx ;local loop starts here 2752 00000CFA 52 push edx 2753 00000CFB 51 push ecx 2754 PUSH_ALL 2755 00000CFC 60 <1> pusha 2756 00000CFD 89CE mov esi,ecx 2757 00000CFF 8D3D[7C370100] lea edi,[screenline+stdtxtlen] 2758 00000D05 89D9 mov ecx,ebx 2759 00000D07 FC cld 2760 00000D08 F3A4 rep movsb ;copy line buffer into screen display buffer 2761 00000D0A 89D1 mov ecx,edx 2762 00000D0C 29D9 sub ecx,ebx 2763 00000D0E B020 mov al,32 ;fill up with blanks 2764 00000D10 F3AA rep stosb 2765 POP_ALL 2766 00000D12 61 <1> popa 2767 ;------- 2768 00000D13 89FB mov ebx,edi ;next lines for setting cursor position 2769 00000D15 29CB sub ebx,ecx 2770 00000D17 80C30A add bl,stdtxtlen ;offset+column 2771 %ifdef UTF8 2772 %ifdef UTF8RTS 2773 cmp byte [isUTF8],0 2774 je noUTF_I 2775 %endif 2776 mov esi,ecx 2777 ISloopUTF8:lodsb 2778 and al,0C0h 2779 cmp al,080h 2780 jne ISdncUTF8 2781 dec bl ;do not count byte 2,3,4,.... 2782 ISdncUTF8:cmp esi,edi 2783 jb ISloopUTF8 2784 noUTF_I: 2785 %endif 2786 00000D1A 8A3D[FE2E0100] mov bh,byte[lines] ;line# 2787 00000D20 891D[162F0100] mov [kurspos2],ebx 2788 ;------- 2789 %ifdef LESSWRITEOPS 2790 00000D26 C605[00000000]00 mov byte [screenbuffer],0 ;switching off usage of buffer v0.7 2791 %endif 2792 00000D2D E8FBFEFFFF call StatusLineShow ;show input 2793 00000D32 E8D5000000 call GetChar ;read next 2794 00000D37 59 pop ecx 2795 00000D38 5A pop edx 2796 00000D39 5B pop ebx 2797 00000D3A FC cld 2798 ;------- 2799 00000D3B E8F9FCFFFF call IsViMode 2800 00000D40 7504 jnz NO_VI01 2801 00000D42 3C00 cmp al,0 2802 00000D44 7407 je ISA 2803 00000D46 E85E0C0000 NO_VI01:call CheckUserAbort 2804 00000D4B 7507 jne IS9 2805 00000D4D 31DB ISA: xor ebx,ebx ;length 0 triggers CY flag 2806 00000D4F E994000000 IS1j: jmp IS1 2807 00000D54 3C0D IS9: cmp al,RETURN 2808 00000D56 74F7 je IS1j 2809 00000D58 3C08 cmp al,8 ;^H (translated DEL) 2810 00000D5A 7507 jne IS2 2811 DNHloopUTF8: 2812 00000D5C 39CF cmp edi,ecx ;@left border? 2813 00000D5E 7499 je IS0 2814 ;------- 2815 00000D60 4F dec edi ;go 1 left 2816 %ifdef UTF8 2817 %ifdef UTF8RTSx_wont ;Keep UTF8 bytes together even in deleting 2818 cmp byte [isUTF8],0 2819 je noUTF_J 2820 %endif 2821 mov al,byte [edi] ;check for UTF byte 2,3,4,.. 2822 and al,0c0h 2823 cmp al,080h 2824 je DNHloopUTF8 2825 noUTF_J: 2826 jmp Delete1 2827 %else 2828 00000D61 EB44 jmp short Delete1 ;and continue at delete key 2829 %endif 2830 ;------- 2831 00000D63 3C00 IS2: cmp al,0 ;marker of cursor keys etc. 2832 00000D65 7554 jne NoSpecialKey 2833 00000D67 80FC05 cmp ah,5 ;end 2834 00000D6A 7505 jne NotEnd 2835 00000D6C 8D3C19 lea edi,[ecx+ebx] 2836 IS0j: 2837 %ifdef UTF8 2838 jmp IS0 2839 %else 2840 00000D6F EB88 jmp short IS0 2841 %endif 2842 00000D71 80FC00 NotEnd: cmp ah,0 ;home 2843 00000D74 7504 jne NotHome 2844 00000D76 89CF mov edi,ecx 2845 00000D78 EBF5 jmp short IS0j 2846 00000D7A 80FC03 NotHome cmp ah,3 ;left <- 2847 00000D7D 7507 jne NotLeft 2848 NHloopUTF8: 2849 00000D7F 39CF cmp edi,ecx 2850 00000D81 74EC je IS0j 2851 00000D83 4F dec edi 2852 %ifdef UTF8 2853 %ifdef UTF8RTSx_wont ;see KeyLeft comment 2854 cmp byte [isUTF8],0 2855 je noUTF_K 2856 %endif 2857 mov al,byte [edi] 2858 and al,0c0h 2859 cmp al,080h 2860 je NHloopUTF8 2861 noUTF_K: 2862 %endif 2863 00000D84 EBE9 jmp short IS0j 2864 00000D86 80FC04 NotLeft:cmp ah,4 ;right -> 2865 00000D89 750A jne NotRight 2866 00000D8B 8D3419 lea esi,[ecx+ebx] 2867 NLloopUTF8: 2868 00000D8E 39F7 cmp edi,esi 2869 00000D90 74DD je IS0j 2870 00000D92 47 inc edi 2871 %ifdef UTF8 2872 %ifdef UTF8RTSx_wont ;see KeyRight comment 2873 cmp byte [isUTF8],0 2874 je near IS0 2875 %endif 2876 mov al,byte [edi] 2877 and al,0c0h 2878 cmp al,080h 2879 je NLloopUTF8 2880 noUTF_L: 2881 %endif 2882 00000D93 EBDA IS0jj: jmp short IS0j 2883 00000D95 80FC08 NotRight:cmp ah,8 ;Insert 2884 00000D98 7508 jne NotIns 2885 00000D9A F615[6A2F0100] not byte [insstat] 2886 %ifdef NEW_CURSOR_MGNT 2887 cmp byte [insstat],1 2888 jne short NCM 2889 call SetCursorBlock 2890 jmp short IS0j 2891 NCM: call SetCursorNormal 2892 %endif 2893 00000DA0 EBCD jmp short IS0j 2894 00000DA2 80FC09 NotIns: cmp ah,9 ;Del 2895 00000DA5 7514 jne NoSpecialKey 2896 00000DA7 8D3419 Delete1:lea esi,[ecx+ebx] ;do not delete at last character position 2897 00000DAA 39F7 cmp edi,esi ;...or in empty buffer... 2898 00000DAC 74E5 je IS0jj 2899 %ifdef UTF8 2900 push ecx 2901 push edi 2902 push esi 2903 mov ecx,ebx ;TODO: check this 2904 lea esi,[edi+1] 2905 dec ebx ;decrease char count in buffer 2906 DeloopUTF8: 2907 %ifdef UTF8RTSx_wont ;Keep UTF8 bytes together even in deleting 2908 cmp byte [isUTF8],0 2909 je noUTF_M 2910 %endif 2911 mov al,byte [esi] 2912 and al,0C0h 2913 cmp al,080h 2914 jne DeUTF8 2915 inc esi ;delete one more at UTF-8 byte 2,3,4,.... 2916 dec ebx ;decrease char count in buffer 2917 jmp short DeloopUTF8 2918 noUTF_M: 2919 DeUTF8: cld 2920 rep movsb ;move all in buffer 1 char to left 2921 pop esi 2922 pop edi 2923 pop ecx 2924 %else 2925 PUSH_ALL 2926 00000DAE 60 <1> pusha 2927 00000DAF 89D9 mov ecx,ebx ;TODO: check this 2928 00000DB1 8D7701 lea esi,[edi+1] 2929 00000DB4 FC cld 2930 00000DB5 F3A4 rep movsb ;move all in buffer 1 char to left 2931 POP_ALL 2932 00000DB7 61 <1> popa 2933 00000DB8 4B dec ebx ;decrease char count in buffer 2934 %endif 2935 00000DB9 EBD8 jmp short IS0jj 2936 ;------- 2937 NoSpecialKey: 2938 00000DBB 3C20 cmp al,SPACECHAR 2939 00000DBD 72D4 jb short IS0jj 2940 2941 %ifdef UTF8 2942 %ifdef UTF8RTSx_wont ;Keep UTF8 bytes together 2943 cmp byte [isUTF8],0 2944 je noUTF_N 2945 %endif 2946 push ebx 2947 mov bl,al 2948 and bl,0C0h 2949 cmp bl,080h ;byte 2,3,4.. always insert 2950 pop ebx 2951 je INSrt 2952 noUTF_N: 2953 %endif 2954 00000DBF 803D[6A2F0100]01 cmp byte [insstat],1 2955 00000DC6 7407 jz INSrt 2956 00000DC8 8D3419 lea esi,[ecx+ebx] 2957 00000DCB 39F7 cmp edi,esi 2958 00000DCD 7513 jnz NO_INSERT 2959 INSrt: PUSH_ALL 2960 <1> INSrt: 2961 00000DCF 60 <1> pusha 2962 00000DD0 89F8 mov eax,edi 2963 00000DD2 8D7C1101 lea edi,[ecx+edx+1] ;end of buffer space 2964 00000DD6 8D77FF lea esi,[edi-1] 2965 00000DD9 89F9 mov ecx,edi 2966 00000DDB 29C1 sub ecx,eax 2967 00000DDD FD std 2968 00000DDE F3A4 rep movsb ;move all in buffer 1 char to right 2969 POP_ALL 2970 00000DE0 61 <1> popa 2971 00000DE1 43 inc ebx 2972 00000DE2 FC NO_INSERT:cld 2973 00000DE3 AA stosb 2974 %ifdef UTF8 2975 %ifdef UTF8RTSx_wont ;Keep UTF8 bytes together 2976 cmp byte [isUTF8],0 2977 je noUTF_O 2978 %endif 2979 mov esi,edi 2980 dec esi 2981 NI_loopUTF8:inc esi 2982 mov al,byte [esi] 2983 and al,0C0h 2984 cmp al,080h ;delete byte 2,3,4,.... 2985 je NI_loopUTF8 2986 ;------- 2987 cmp esi,edi 2988 je NI_UTF8rdy 2989 PUSH_ALL 2990 mov ecx,ebx ;TODO: check this 2991 cld 2992 rep movsb ;move all in buffer 1 char to left 2993 POP_ALL 2994 noUTF_O: 2995 NI_UTF8rdy: 2996 %endif 2997 00000DE4 39D3 cmp ebx,edx 2998 00000DE6 7287 jb IS0j 2999 ;------- 3000 00000DE8 31C0 IS1: xor eax,eax 3001 00000DEA 880419 mov byte [ecx+ebx],al ;make asciz string 3002 00000DED 8F05[162F0100] pop dword [kurspos2] 3003 00000DF3 8F05[BE380100] pop dword [VICmdMode] ;restore original vi mode 3004 00000DF9 5F pop edi 3005 00000DFA 59 pop ecx 3006 00000DFB 93 xchg eax,ebx 3007 00000DFC 3C01 cmp al,1 ;set cy flag if empty string (len always <256) 3008 00000DFE C3 ISready:ret ;eax length (but is < 255) 3009 ;---------- 3010 ; 3011 ; GetChar (main function for kbd input) 3012 ; 3013 00000DFF 89F8 ReadChar:mov eax,edi 3014 00000E01 8705[362F0100] xchg eax,[old] ;for ^QP 3015 00000E07 A3[3A2F0100] mov [veryold],eax 3016 00000E0C E8FB000000 GetChar:call ReadOneChar ;ah=0xFF for usual keys 3017 %ifdef W32 3018 cmp ah,0FEh ;cursor key 3019 jnz GC33 3020 shl eax,8 3021 ret 3022 GC33: cmp ah,0FDh ;ALT key 3023 jnz GC34 3024 and al,5fh ;toupper 3025 jmp short NOVI7 3026 GC34: 3027 %endif 3028 00000E11 3C7F cmp al,7Fh 3029 00000E13 7502 jne short RC_No7F ;special case: remap DEL to Ctrl-H 3030 %ifndef FREEBSD 3031 mov al,8 3032 %else 3033 00000E15 B007 mov al,7 3034 %endif 3035 RC_No7F: 3036 ;------- 3037 %define DoNo 10 3038 ;------- 3039 ; 3040 ; vi needs special handling of the ESC key 3041 ; 3042 00000E17 E81DFCFFFF call IsViMode 3043 00000E1C 740B jz short ISVI7 3044 00000E1E 3C1B cmp al,27 ;ESC ? 3045 00000E20 75DC jnz ISready 3046 00000E22 E8E5000000 call ReadOneChar ;dont care whether '[' or 'O' (should be [ for vt220 family O for vt100 family) 3047 00000E27 EB5B jmp short NOVI7 3048 ;------- 3049 00000E29 803D[BE380100]01 ISVI7: cmp byte [VICmdMode],1 3050 00000E30 7525 jne NoCMDmode 3051 00000E32 3C1B cmp al,27 3052 00000E34 7412 je ESCpressed 3053 00000E36 3C7B cmp al,VIsize 3054 00000E38 0F8799000000 ja near Other 3055 00000E3E BB[C8210000] mov ebx,VIcmdTable ;process command mode keys...... 3056 00000E43 E9BA000000 jmp RCready_0 ;....and ready 3057 ;------- 3058 00000E48 E8BF000000 ESCpressed:call ReadOneChar 3059 00000E4D 3C5B cmp al,'[' ;decide: it's a cursor key? 3060 00000E4F 0F8482000000 je near Other ;yes, contine 3061 00000E55 EB1B jmp short NoCursorKey ;no push back char into buffer and exit 3062 00000E57 3C1B NoCMDmode:cmp al,27 ;ESC ? 3063 00000E59 75A3 jnz ISready 3064 00000E5B E895FBFFFF call KeyVImode1 ;ESC pressed in EDIT Mode 3065 %ifdef BEOS 3066 call RestoreStatusLine 3067 %else 3068 %ifdef SYS_select 3069 PUSH_ALL 3070 00000E60 60 <1> pusha 3071 00000E61 E8760C0000 call Select ;differ between ESC and ESC_cursor_keys 3072 POP_ALL 3073 00000E66 61 <1> popa 3074 00000E67 7412 jz isSingleEscape 3075 %endif 3076 %endif 3077 00000E69 E89E000000 call ReadOneChar 3078 00000E6E 3C5B cmp al,'[' ;starting sequence of cursor key found? 3079 00000E70 740D je IsCursorKey ;pressed ESC, but do _NOT_ switch init cmd mode 3080 00000E72 A2[C2380100] NoCursorKey:mov byte [VIbufch],al ;push char back into read buffer due it's not a cursor key 3081 00000E77 B00A mov al,DoNo ;do nothing 3082 00000E79 EB2F jmp short JmpRCready 3083 00000E7B B003 isSingleEscape:mov al,3 ;3 is keyLeft (i.e. entry #3 jumptab1) 3084 00000E7D EB2B jmp short JmpRCready ;keyLeft is what a real vi user expects here ;) 3085 ;------- 3086 00000E7F E826FBFFFF IsCursorKey:call KeyVImode0 ;reset mode to 'no_command' and continue 3087 ;------- 3088 00000E84 803D[DE380100]10 NOVI7: cmp byte [mode],NE ;ALT keys are currently used for nedit mode... 3089 00000E8B 7510 jnz NONE7 3090 00000E8D 3C69 cmp al,'i' 3091 00000E8F 7504 jnz NOi 3092 00000E91 B010 mov al,0x10 3093 00000E93 EB15 jmp short JmpRCready 3094 00000E95 3C49 NOi: cmp al,'I' 3095 00000E97 7504 jnz NONE7 3096 00000E99 B010 mov al,0x10 3097 00000E9B EB0D jmp short JmpRCready 3098 00000E9D E89FFBFFFF NONE7: call IsEmMode 3099 00000EA2 7529 jnz NOEM7 ;ALT keys are currently used for Emacs mode... 3100 00000EA4 3C25 cmp al,'%' ;...except altH for online Help 3101 00000EA6 7504 jne NoAltPer 3102 00000EA8 B028 mov al,0x28 3103 00000EAA EB57 JmpRCready:jmp short RCready_1 3104 00000EAC 3C3C NoAltPer:cmp al,'<' 3105 00000EAE 7504 jne NoAltLt 3106 00000EB0 B00E mov al,0x0e 3107 00000EB2 EB4F jmp short RCready_1 3108 00000EB4 3C3E NoAltLt:cmp al,'>' 3109 00000EB6 7504 jne NoAltGt 3110 00000EB8 B00F mov al,0x0f 3111 00000EBA EB47 jmp short RCready_1 3112 00000EBC 245F NoAltGt:and al,0x5F ;to upper case 3113 00000EBE 2C42 sub al,'B' ;1at in table 3114 00000EC0 7815 js Other 3115 00000EC2 3C17 cmp al,ATsize 3116 00000EC4 7711 ja Other 3117 00000EC6 BB[B1210000] mov ebx,EmaAltTable 3118 00000ECB EB35 jmp short RCready_0 3119 00000ECD 245F NOEM7: and al,0x5F 3120 00000ECF 3C48 cmp al,'H' 3121 00000ED1 7504 jnz Other 3122 00000ED3 B03D mov al,0x3D 3123 00000ED5 EB2C jmp short RCready_1 3124 ;------- 3125 Other: 3126 %ifdef W32 3127 ret 3128 %else 3129 00000ED7 E830000000 call ReadOneChar 3130 00000EDC 3C38 cmp al,'8' 3131 00000EDE 770D ja NoNumber 3132 00000EE0 50 push eax ;0,1,2....8 (i.e. 9 keys) 3133 00000EE1 E826000000 call ReadOneChar 3134 00000EE6 93 xchg eax,ebx 3135 00000EE7 58 pop eax 3136 00000EE8 80FB7E cmp bl,'~' ;if it's a number we expect following a '~' 3137 00000EEB 751A jne GetCharJmp 3138 00000EED 2C30 NoNumber:sub al,'0' 3139 00000EEF 3C09 cmp al,9 3140 00000EF1 720A jb IsNumber 3141 %ifdef QNX 3142 sub al,('@'-'0'-9) ;scantable starts with ESC[@ 3143 %else 3144 00000EF3 2C08 sub al,('A'-'0'-9) 3145 %endif 3146 00000EF5 3C09 cmp al,9 3147 00000EF7 720E jb GetCharJmp 3148 00000EF9 3C15 cmp al,STsize 3149 00000EFB 770A ja GetCharJmp 3150 00000EFD BB[9C210000] IsNumber:mov ebx,ScanTable 3151 %endif 3152 00000F02 D7 RCready_0:xlatb 3153 00000F03 C1E008 RCready_1:shl eax,8 ;shift into ah (ah always != 0xFF) 3154 00000F06 C3 ret 3155 00000F07 E900FFFFFF GetCharJmp:jmp near GetChar 3156 ;------- 3157 ; called by ReadChar/GetChar 3158 ; 3159 00000F0C E828FBFFFF ReadOneChar:call IsViMode 3160 00000F11 750C jnz NOVI4 3161 00000F13 31C0 xor eax,eax 3162 00000F15 8705[C2380100] xchg eax,[VIbufch] ;preread char in buf? 3163 00000F1B 09C0 or eax,eax 3164 00000F1D 750F jne RoneC 3165 00000F1F B9[5E2F0100] NOVI4: mov ecx,read_b ;pointer to buf 3166 00000F24 31D2 xor edx,edx 3167 00000F26 42 inc edx ;mov edx,1 (length) 3168 00000F27 E83B0B0000 call ReadFile0 3169 %ifdef SELFTEST ;for NON_INTERACTIVE mode exit on EOF! 3170 jnz Cont 3171 jmp KeyCtrlKX 3172 Cont: 3173 %endif 3174 00000F2C 8B01 mov eax,[ecx] ;[read_b] 3175 %ifdef W32_EXTENDED_IO 3176 ret 3177 %endif 3178 00000F2E B4FF RoneC: mov ah,0xFF 3179 00000F30 C3 ret 3180 ;---------------------------------------------------------------------- 3181 ; 3182 ; L O O K functions 3183 ; search special text locations and set register edi to 3184 ; 3185 LookBackward: ;set EDI to 1 before LINEFEED (0Ah) i.e., 2 before start of next line 3186 00000F31 51 push ecx 3187 00000F32 53 push ebx 3188 00000F33 31DB xor ebx,ebx 3189 00000F35 807FFF0A cmp byte[edi-1],NEWLINE ;at BOL ? 3190 00000F39 741D jz LBa3 3191 00000F3B 803F0A cmp byte[edi],NEWLINE ;at EOL ? 3192 00000F3E 7502 jnz LBa1 3193 00000F40 4F dec edi ;at EOL ? start search 1 char earlier 3194 00000F41 43 inc ebx ;increase counter 3195 ;------- 3196 00000F42 B99F860100 LBa1: mov ecx,99999 3197 00000F47 B00A mov al,NEWLINE 3198 00000F49 FD std 3199 00000F4A F2AE repne scasb 3200 00000F4C 8D839D860100 lea eax,[ebx+99997] ;mov eax,99997 / add eax,ebx 3201 00000F52 29C8 sub eax,ecx 3202 00000F54 5B LBa5: pop ebx 3203 00000F55 59 pop ecx 3204 00000F56 EB20 jmp short CheckBof 3205 ;------- 3206 00000F58 31C0 LBa3: xor eax,eax 3207 00000F5A 4F dec edi 3208 00000F5B 4F dec edi 3209 00000F5C EBF6 jmp short LBa5 3210 ;------- 3211 LookForward: 3212 00000F5E 51 push ecx ;don't touch edx (if called by BZNLoop only) 3213 00000F5F B99F860100 mov ecx,99999 3214 00000F64 B00A mov al,NEWLINE 3215 00000F66 FC cld 3216 00000F67 F2AE repne scasb 3217 00000F69 B89E860100 mov eax,99998 3218 00000F6E 29C8 sub eax,ecx 3219 00000F70 59 pop ecx 3220 00000F71 4F dec edi 3221 00000F72 39EF CheckEof:cmp edi,ebp ;ptr is eof-ptr? 3222 00000F74 7511 jnz CheckEnd ;Z flag if eof 3223 00000F76 EB08 jmp short CheckENum 3224 00000F78 81FF[2A3D0100] CheckBof:cmp edi, sot-1 3225 00000F7E 7707 ja CheckEnd 3226 00000F80 C605[5A2F0100]01 CheckENum:mov byte [numeriere],1 ;if bof 3227 00000F87 C3 CheckEnd:ret 3228 ;------- 3229 00000F88 8B15[162F0100] LookPgBegin:mov edx,[kurspos2] ;called by DispNewScreen to get sync with 1st char on screen 3230 00000F8E 0FB6CE movzx ecx,dh ;called by KeyCtrlQE (go upper left) OLD: xor ecx,ecx mov cl,dh 3231 00000F91 41 inc ecx ;'inc cl' are 2 Bytes 3232 00000F92 EB34 jmp short LookPU2 3233 ;------- 3234 00000F94 8B15[162F0100] LookPgEnd:mov edx,[kurspos2] ;goes 1st char last line on screen 3235 00000F9A 8B0D[FE2E0100] mov ecx,[lines] 3236 00000FA0 28F1 sub cl,dh 3237 00000FA2 EB5E jmp short LookPD2 3238 ;------- 3239 00000FA4 6A02 LookLineUp:push byte 2 ;2 lines: THIS line and line BEFORE 3240 00000FA6 59 pop ecx 3241 00000FA7 FF0D[3E2F0100] dec dword [linenr] 3242 00000FAD EB19 jmp short LookPU2 3243 ;------- 3244 00000FAF 6A02 LookLineDown:push byte 2 ;2 lines: THIS and NEXT line 3245 00000FB1 59 pop ecx 3246 00000FB2 FF05[3E2F0100] inc dword [linenr] 3247 00000FB8 EB48 jmp short LookPD2 3248 ;------- 3249 00000FBA 8B0D[FE2E0100] LookPageUp:mov ecx,[lines] 3250 00000FC0 49 dec ecx ;PgUp,PgDown one line less 3251 00000FC1 290D[3E2F0100] LookPU1:sub [linenr],ecx 3252 00000FC7 41 inc ecx 3253 00000FC8 E864FFFFFF LookPU2:call LookBackward 3254 00000FCD 47 inc edi ;inc keeps CY flag! 3255 00000FCE 7202 jb LookPUEnd ;if BOF 3256 00000FD0 E2F6 loop LookPU2 ;after loop edi points to char left of LINEFEED (0ah) 3257 00000FD2 47 LookPUEnd:inc edi ;now points to 1st char on screen or line 3258 00000FD3 C3 ret 3259 ;------- 3260 00000FD4 31C9 LookScrDn:xor ecx,ecx 3261 00000FD6 41 inc ecx 3262 00000FD7 EB22 jmp short LookPD1 3263 00000FD9 31C9 LookScrUp:xor ecx,ecx 3264 00000FDB 41 inc ecx 3265 00000FDC EBE3 jmp short LookPU1 3266 00000FDE 8B0D[FE2E0100] LookHalfPgUp:mov ecx,[lines] ;vi special 3267 00000FE4 49 dec ecx 3268 00000FE5 D1E9 shr ecx,1 3269 00000FE7 EBD8 jmp short LookPU1 3270 00000FE9 8B0D[FE2E0100] LookHalfPgDn:mov ecx,[lines] 3271 00000FEF 49 dec ecx 3272 00000FF0 D1E9 shr ecx,1 3273 00000FF2 EB07 jmp short LookPD1 3274 ;------- 3275 00000FF4 8B0D[FE2E0100] LookPgDown:mov ecx,[lines] 3276 00000FFA 49 dec ecx ;PgUp,PgDown one line less 3277 00000FFB 010D[3E2F0100] LookPD1:add [linenr],ecx 3278 00001001 41 inc ecx 3279 00001002 E857FFFFFF LookPD2:call LookForward 3280 00001007 7404 jz LookPDEnd ;(jmp if EOF) 3281 00001009 47 inc edi ;1st char next line 3282 0000100A E2F6 loop LookPD2 3283 0000100C 4F dec edi ;last char last line 3284 0000100D 29C7 LookPDEnd:sub edi,eax ;1st char last line 3285 0000100F C3 ret 3286 ;---------------------------------------------------------------------- 3287 ; 3288 ; some more CHECK functions 3289 ; 3290 00001010 803D[422F0100]01 CheckBlock:cmp byte [showblock],1 ;returns CY if error else ok: NC 3291 00001017 7222 jc CheckBlockEnd 3292 00001019 8B35[2E2F0100] mov esi,[blockende] 3293 0000101F 81FE[2B3D0100] cmp esi, sot 3294 00001025 7214 jb CheckBlockEnd 3295 00001027 8B35[2A2F0100] mov esi,[blockbegin] ;side effect esi points to block begin 3296 0000102D 81FE[2B3D0100] cmp esi, sot 3297 00001033 7206 jb CheckBlockEnd 3298 00001035 3935[2E2F0100] cmp [blockende],esi ;^KK > ^KB ..OK if above! 3299 0000103B C3 CheckBlockEnd:ret 3300 ;------- 3301 0000103C 393D[2A2F0100] CheckImBlock:cmp [blockbegin],edi ;^KB mark > edi ? 3302 00001042 7706 ja CImBlockEnd ;OK 3303 00001044 3B3D[2E2F0100] cmp edi,[blockende] ;edi > ^KK 3304 0000104A C3 CImBlockEnd:ret ;output:cy error / nc ok inside block 3305 ;------- 3306 0000104B 803F0A CheckMode:cmp byte [edi],NEWLINE ;checks for INSERT status 3307 0000104E 7407 jz ChModeEnd 3308 00001050 803D[6A2F0100]01 cmp byte [insstat],1 3309 00001057 C3 ChModeEnd:ret ;Z flag for ins-mode 3310 ;------- 3311 ; a special case called by DeleteByteCheckMarker 3312 ; 3313 CheckMarker: ;edx is blockbegin (^KB) 3314 ;ebx is deleate area end --- edi delete area start 3315 00001058 39D7 cmp edi,edx ;delete area start < ^KB marker ? 3316 0000105A 7706 ja CMEnd ;no 3317 0000105C 39D3 cmp ebx,edx ;yes, but delete area end > ^KB ? 3318 0000105E 7202 jb CMEnd ;no 3319 00001060 89FA mov edx,edi ;yes so block start (^KB) to delete area start 3320 00001062 C3 CMEnd: ret 3321 ;---------------------------------------------------------------------- 3322 ; 3323 ; C O U N T functions 3324 ; to return number of chars up to some place 3325 ; (all of them are wrappers of Look....functions anyway) 3326 ; 3327 00001063 57 CountToLineEnd:push edi 3328 00001064 E8F5FEFFFF call LookForward 3329 00001069 5F pop edi 3330 0000106A C3 ret ;eax=chars up to line end 3331 ;------- 3332 CountColToLineBeginVis: ;counts columns represented by chars in EAX 3333 0000106B E828000000 call CountToLineBegin ;i.e. EXPAND any TAB chars found 3334 00001070 56 push esi 3335 00001071 31D2 xor edx,edx 3336 00001073 89FE mov esi,edi ;startpoint 3337 00001075 29C6 sub esi,eax ;to bol 3338 00001077 4E dec esi 3339 00001078 46 CCV1: inc esi 3340 00001079 39FE cmp esi,edi 3341 0000107B 7311 jae CCVend 3342 %ifdef UTF8 3343 %ifdef UTF8RTS 3344 cmp byte [isUTF8],0 3345 je noUTF_P 3346 %endif 3347 mov bl,byte [esi] 3348 and bl,0C0h 3349 cmp bl,080h ;do not count byte 2,3,4,.. in UTF8 chars 3350 jz CCV1 3351 noUTF_P: 3352 %endif 3353 0000107D 803E09 cmp byte [esi],TABCHAR 3354 00001080 7403 jz CCVTab 3355 00001082 42 inc edx ;count visible chars 3356 00001083 EBF3 jmp short CCV1 3357 00001085 E8DD080000 CCVTab: call SpacesForTab ;return space_up_to_next_tab in ah 3358 0000108A 00E2 add dl,ah ;FIXME: now using 8 bits only 3359 0000108C EBEA jmp short CCV1 3360 0000108E 8915[562F0100] CCVend: mov [ch2linebeg],edx ;ch2linebeg: interface to Key... functions 3361 00001094 89D0 mov eax,edx ;eax: interface to DispNewScreen 3362 00001096 5E pop esi 3363 %ifdef W32LF 3364 cmp byte[edi-1],RETURN 3365 jnz CCV2 3366 dec byte [ch2linebeg] ;don't count in RETURN char 3367 CCV2: 3368 %endif 3369 00001097 C3 ret 3370 ;------- 3371 00001098 57 CountToLineBegin:push edi ;output eax=chars up there 3372 00001099 E893FEFFFF call LookBackward 3373 0000109E 89FE mov esi,edi ;side effect: set edi to 1st char in line 3374 000010A0 5F pop edi 3375 000010A1 C3 ret 3376 ;------- 3377 CountToWordBeginVIstyle: ;output eax=chars up there 3378 000010A2 89FE mov esi,edi 3379 000010A4 803E20 cmp byte [esi],SPACECHAR 3380 000010A7 771C ja CtWviStyle 3381 CountToWordBegin: ;output eax=chars up there 3382 000010A9 89FE mov esi,edi 3383 000010AB 39EE CountNLoop:cmp esi,ebp 3384 000010AD 7411 jz CTWend 3385 000010AF 46 inc esi 3386 %ifdef W32LF 3387 cmp byte [esi],RETURN 3388 %else 3389 000010B0 803E0A cmp byte [esi],NEWLINE 3390 %endif 3391 000010B3 740B jz CTWend 3392 000010B5 803E20 cmp byte [esi],SPACECHAR ;below SPACE includes tab chars 3393 000010B8 76F1 jbe CountNLoop 3394 000010BA 807EFF2F cmp byte [esi-1],2fh 3395 000010BE 77EB ja CountNLoop 3396 000010C0 89F0 CTWend: mov eax,esi 3397 000010C2 29F8 sub eax,edi ;maybe =0 3398 000010C4 C3 Goret: ret 3399 ;------- 3400 000010C5 46 CtWviStyle:inc esi 3401 %ifdef W32LF 3402 cmp byte [esi],RETURN 3403 %else 3404 000010C6 803E0A cmp byte [esi],NEWLINE 3405 %endif 3406 000010C9 74F5 jz CTWend 3407 000010CB 803E2F cmp byte [esi],2fh 3408 000010CE 77F5 ja CtWviStyle 3409 000010D0 EBD9 jmp short CountNLoop 3410 ;---------------------------------------------------------------------- 3411 ; 3412 ; Online Help: show the message followed by common text 3413 ; 3414 KeyHelp: 3415 %ifdef USE_BUILTINHELP 3416 000010D2 FF35[122F0100] push dword [kurspos] 3417 PUSH_ALL 3418 000010D8 60 <1> pusha 3419 000010D9 31C0 xor eax,eax 3420 000010DB 8705[422F0100] xchg eax,[showblock] ;hide an blockmarker 3421 000010E1 50 push eax 3422 000010E2 FC cld 3423 000010E3 BE[2B3D0100] mov esi,sot ;save "buffercopysize" of text 3424 000010E8 BF[EE380100] mov edi,buffercopy 3425 000010ED B900040000 mov ecx,buffercopysize 3426 000010F2 57 push edi 3427 000010F3 51 push ecx 3428 000010F4 56 push esi 3429 ;------- 3430 000010F5 F3A4 rep movsb 3431 000010F7 E87B080000 call GetHelpText 3432 000010FC 5F pop edi 3433 000010FD 57 push edi ;i.e. mov edi,sot 3434 ;------- 3435 000010FE 57 push edi 3436 000010FF F3A4 rep movsb ;overwrite saved text with help message 3437 00001101 BE[F0240000] mov esi,helpfoot 3438 00001106 6A19 push byte helpfootsize 3439 00001108 59 pop ecx 3440 00001109 F3A4 rep movsb 3441 0000110B 89FD mov ebp,edi ;set END_OF_HELP_TEXT pointer 3442 0000110D 5F pop edi 3443 0000110E E836F9FFFF call DispNewScreen 3444 00001113 E8F4FDFFFF call ReadOneChar ;wait for a pressed char 3445 ;------- 3446 00001118 5F pop edi 3447 00001119 59 pop ecx 3448 0000111A 5E pop esi ;former edi 3449 0000111B FC cld 3450 0000111C F3A4 rep movsb ;restore textbuffer with saved patr 3451 0000111E 8F05[422F0100] pop dword [showblock] 3452 POP_ALL 3453 00001124 61 <1> popa 3454 00001125 5A pop edx ;cursor pos 3455 00001126 EB6D jmp short SetKursPos 3456 %else 3457 ret 3458 %endif 3459 ;--------------------------------------------------------------------- 3460 ; 3461 ; some CURSOR control functions 3462 ; 3463 00001128 31C0 GoUp: xor eax,eax 3464 0000112A EB08 jmp short UpDown 3465 0000112C A0[FE2E0100] GoDown: mov al,byte [lines] 3466 00001131 48 dec eax ;'dec al' are 2 byte! 3467 00001132 B4FF mov ah,-1 3468 00001134 8B15[162F0100] UpDown: mov edx,[kurspos2] ;former was call getkurspos 3469 0000113A 38F0 cmp al,dh 3470 0000113C 7486 jz Goret 3471 0000113E 18E6 sbb dh,ah ;ONLY here we change curent line of cursor 3472 00001140 EB53 jmp short SetKursPos 3473 ;------- 3474 ; set cursor to some desired places 3475 ; 3476 00001142 E8C5FDFFFF KeyVICmdz:call ReadOneChar 3477 00001147 3C2E cmp al,'.' 3478 00001149 7419 je KeyEmaCtrlL 3479 0000114B C3 ret 3480 ;------- 3481 0000114C E837FEFFFF KeyVI_M:call LookPgBegin 3482 00001151 E893FEFFFF call LookHalfPgDn 3483 00001156 F605[FE2E0100]01 test byte[lines],1 3484 0000115D 7505 jnz KeyEmaCtrlL 3485 0000115F E84BFEFFFF call LookLineDown 3486 ;------- cont 3487 00001164 E82FFFFFFF KeyEmaCtrlL:call CountToLineBegin 3488 00001169 8A35[FE2E0100] mov dh,byte [lines] ;move cursor to center line (and later redisplay) 3489 0000116F D0EE shr dh,1 3490 00001171 88C2 mov dl,al 3491 00001173 EB20 jmp short SetKursPos 3492 00001175 31D2 KursorFirstLine:xor edx,edx 3493 00001177 EB1C jmp short SetKursPos 3494 00001179 8A35[FE2E0100] KursorLastLine:mov dh,byte [lines] 3495 0000117F FECE dec dh 3496 00001181 B200 mov dl,0 3497 00001183 EB10 jmp short SetKursPos 3498 00001185 8A35[FE2E0100] KursorStatusLine:mov dh,byte [lines] 3499 0000118B B20A mov dl,stdtxtlen 3500 0000118D EB06 jmp short SetKursPos 3501 0000118F 8B15[122F0100] RestKursPos:mov edx,[kurspos] 3502 00001195 8915[162F0100] SetKursPos:mov [kurspos2],edx ;saves reading cursor pos (0,0) 3503 sys_writeKP:PUSH_ALL 3504 <1> sys_writeKP: 3505 0000119B 60 <1> pusha 3506 %ifdef W32 3507 shl edx,8 ;linux cursorpos in dh/dl - w32 in edx 2*16bit 3508 mov dl,dh 3509 and edx,0x00FF00FF 3510 push dword edx ;xxxxyyyy x=line y=column 3511 push dword [hout] 3512 call SetConsoleCursorPosition 3513 %else 3514 0000119C E80F000000 call make_KPstr 3515 000011A1 B9[E22E0000] mov ecx,setkp ;second argument: pointer to message to write 3516 000011A6 6A0A push byte setkplen ;third argument: message length 3517 000011A8 5A pop edx 3518 000011A9 E8C2080000 call WriteFile0 3519 %endif 3520 POP_ALL 3521 000011AE 61 <1> popa 3522 000011AF C3 ret 3523 ;------- 3524 ; make ESC sequence appropriate to most important terminals 3525 ; 3526 %ifndef W32 3527 ; ;expecting cursor pos in dh/dl (0,0) 3528 000011B0 FC make_KPstr:cld 3529 000011B1 BF[E22E0000] mov edi,setkp ;build cursor control esc string db 27,'[000;000H' 3530 000011B6 B01B mov al,1Bh 3531 000011B8 AA stosb ;init memory 3532 %ifndef ARMCPU 3533 000011B9 B85B303030 mov eax,'[000' 3534 000011BE AB stosd 3535 000011BF B03B mov al,';' ;i.e. load eax with ';000' 3536 000011C1 AB stosd 3537 %else 3538 mov al,'[' 3539 stosb 3540 mov al,'0' 3541 stosb 3542 stosb 3543 stosb 3544 mov al,';' 3545 stosb 3546 mov al,'0' 3547 stosb 3548 stosb 3549 stosb 3550 %endif 3551 000011C2 B048 mov al,'H' 3552 000011C4 AA stosb ;now we have written 10 chars 3553 000011C5 8D7FFA lea edi,[edi-6] ;old was "mov edi,setkp+1+3" now using 1+3 == 10-6 3554 000011C8 0FB6C6 movzx eax,dh ;DH=line 3555 000011CB 40 inc eax ;now counted from 1 3556 000011CC 52 push edx 3557 000011CD E80A000000 call IntegerToAscii ;make number string 3558 000011D2 5A pop edx 3559 000011D3 BF[EA2E0000] mov edi,setkp+1+3+4 ;column end 3560 000011D8 0FB6C2 movzx eax,dl ;DL=col 3561 000011DB 40 inc eax ;now counted from 1 3562 %endif 3563 ;-------continued... 3564 ; a general helper 3565 ; expects integer# in eax 3566 IntegerToAscii: 3567 000011DC 09C0 or eax,eax 3568 000011DE 7903 jns ItoA1 3569 ;int 3 ;Assertation 3570 000011E0 31C0 xor eax,eax ;this should never be 3571 000011E2 40 inc eax 3572 000011E3 6A0A ItoA1: push byte 10 3573 000011E5 59 pop ecx 3574 000011E6 FD std 3575 000011E7 93 xchg eax,ebx ;ebx helper (xchg eax,.. is only 1 byte!) 3576 000011E8 93 Connum1:xchg eax,ebx 3577 000011E9 99 cdq 3578 000011EA F7F1 div ecx 3579 000011EC 93 xchg eax,ebx ;save quotient (new low word) 3580 000011ED 88D0 mov al,dl 3581 000011EF 240F and al,0fh 3582 000011F1 0430 add al,'0' 3583 000011F3 AA stosb 3584 000011F4 09DB or ebx,ebx 3585 000011F6 75F0 jne Connum1 3586 000011F8 FC cld 3587 000011F9 C3 ITAret: ret 3588 ;---------------------------------------------------------------------- 3589 ; 3590 ; functions for INSERTING, COPYING and DELETING chars in text 3591 ; 3592 DeleteByteCheckMarker: ;edi points to begin 3593 000011FA F605[DE380100]09 test byte [mode], WS | VI ;see above note at "jz NOWS8" 3594 00001201 7425 jz DeleteByte 3595 00001203 8D1C07 lea ebx,[edi+eax] ;ebx points to end 3596 00001206 8B15[2A2F0100] mov edx,[blockbegin] 3597 0000120C E847FEFFFF call CheckMarker 3598 00001211 8915[2A2F0100] mov [blockbegin],edx 3599 00001217 8B15[2E2F0100] mov edx,[blockende] 3600 0000121D E836FEFFFF call CheckMarker 3601 00001222 8915[2E2F0100] mov [blockende],edx 3602 00001228 09C0 DeleteByte:or eax,eax ;input in eax 3603 0000122A 74CD jz ITAret 3604 %ifdef USE_UNDO 3605 0000122C E81A0D0000 call DataForUndoDelete 3606 %endif 3607 00001231 57 push edi 3608 00001232 89E9 mov ecx,ebp ;end 3609 00001234 29F9 sub ecx,edi 3610 00001236 8D3407 lea esi,[edi+eax] ;current + x chars 3611 00001239 29C1 sub ecx,eax 3612 0000123B 803D[DE380100]01 cmp byte [mode],WS 3613 00001242 7406 jz No_WS8 3614 00001244 030D[AA380100] add ecx,[EmaKiSize] 3615 0000124A 41 No_WS8: inc ecx 3616 0000124B FC cld 3617 0000124C F3A4 rep movsb 3618 0000124E F7D8 neg eax ;"neg eax" is for continuing @InsertByte 3619 00001250 EB58 jmp short Ins0 ;pending "pop edi" 3620 ;------- 3621 00001252 31C0 Insert1Byte:xor eax,eax 3622 00001254 40 InsertByte0:inc eax 3623 ; 3624 ; do NOT destroy eax 3625 ; 3626 00001255 09C0 InsertByte:or eax,eax ;input: eax = # of bytes edi = ptr where 3627 00001257 74A0 jz ITAret 3628 00001259 8B0D[D62F0100] mov ecx,[maxlen] ;max_len+offset-eofptr=freespace(ecx) 3629 0000125F 81C1[2B3D0100] add ecx,sot 3630 00001265 29E9 sub ecx,ebp 3631 00001267 8B15[AA380100] mov edx,[EmaKiSize] 3632 0000126D 29D1 sub ecx,edx ;sub size of kill buffer from free space 3633 0000126F 39C1 cmp ecx,eax ;cmp freespace - newbytes ;>= 0 ok/ NC <0 bad / CY 3634 00001271 7314 jnc SpaceAva 3635 00001273 6A0C push byte ERRNOMEM 3636 00001275 8F05[6E2F0100] pop dword [ErrNr] ;(mov dword[ErrNr],.. has 2 byte extra) 3637 0000127B E898030000 call OSerror 3638 00001280 E80AFFFFFF call RestKursPos 3639 00001285 F9 stc 3640 00001286 C3 ret 3641 00001287 57 SpaceAva:push edi 3642 %ifdef USE_UNDO 3643 00001288 E85D0D0000 call DataForUndoInsert 3644 %endif 3645 0000128D 89EE mov esi,ebp ;end of text movsb-source 3646 0000128F 8D4D01 lea ecx,[ebp+1] 3647 00001292 29F9 sub ecx,edi ;space count: distance between eof and current position 3648 00001294 8D7C0500 lea edi,[ebp+eax] ;movsb-destination 3649 00001298 803D[DE380100]01 cmp byte [mode],WS 3650 0000129F 7406 jz ISWS8 3651 000012A1 01D1 add ecx,edx ;add size of kill buffer to distance 3652 000012A3 01D7 add edi,edx 3653 000012A5 01D6 add esi,edx 3654 000012A7 FD ISWS8: std 3655 000012A8 F3A4 rep movsB 3656 000012AA 5F Ins0: pop edi ;here is the jmp destination from DeleteByte 3657 ;------- 3658 000012AB E883EEFFFF call SetChg ;i.e. mov byte [changed],CHANGED 3659 000012B0 01C5 add ebp,eax 3660 000012B2 F605[DE380100]09 test byte [mode], WS | VI ;for vi mode it would be enough to handle blockbegin 3661 000012B9 741C jz NOWS8 ;..because blockende is set at end of marker line.. 3662 000012BB 3B3D[2E2F0100] cmp edi,[blockende] ;..at HandleVImarker procedure 3663 000012C1 7306 jae Ins1 3664 000012C3 0105[2E2F0100] add [blockende],eax 3665 000012C9 3B3D[2A2F0100] Ins1: cmp edi,[blockbegin] 3666 000012CF 731D jae Ins2 3667 000012D1 0105[2A2F0100] add [blockbegin],eax 3668 NOWS8: 3669 000012D7 F605[DE380100]06 test byte [mode], EM | PI 3670 000012DE 740E jz NO_EM02 3671 000012E0 3B3D[B2380100] cmp edi,[EmaMark] 3672 000012E6 7306 jae Ins2 3673 000012E8 0105[B2380100] add [EmaMark],eax 3674 NO_EM02: 3675 000012EE F8 Ins2: clc 3676 000012EF C3 ret ;output:nc=ok/cy=bad /ecx=0/ eax inserted / -eax deleted 3677 ;------- 3678 000012F0 E81BFDFFFF CopyBlock:call CheckBlock ;copy block, called by ^KC, ^KV 3679 000012F5 7223 jc MoveBlEnd 3680 000012F7 E840FDFFFF call CheckImBlock 3681 000012FC 721C jc MoveBlEnd 3682 000012FE A1[2E2F0100] mov eax,[blockende] 3683 00001303 29F0 sub eax,esi ;block len 3684 00001305 E84BFFFFFF call InsertByte 3685 0000130A 720E jc MoveBlEnd 3686 0000130C 8B35[2A2F0100] mov esi,[blockbegin] 3687 ;------- 3688 00001312 57 MoveBlock:push edi ;input : esi=^KB edi=current 3689 00001313 89C1 mov ecx,eax ;don't use xchg here 3690 00001315 FC cld 3691 00001316 F3A4 rep movsb 3692 00001318 5F pop edi 3693 00001319 F8 clc ;nocarry->ok 3694 0000131A C3 MoveBlEnd:ret ;return eax=size 3695 ;---------------------------------------------------------------------- 3696 0000131B 57 KeyVICmdyy:push edi 3697 0000131C E8D8EFFFFF call KeyHome 3698 00001321 893D[B2380100] mov [EmaMark],edi 3699 00001327 E8C1F6FFFF call KeyEnd 3700 0000132C 47 inc edi ;add a line delimiter 3701 0000132D E8A6000000 call KeyEmaAltW 3702 00001332 5F pop edi 3703 00001333 C3 KviRet: ret 3704 ;------- 3705 00001334 E8D3FBFFFF KeyVICmdy:call ReadOneChar 3706 00001339 3C79 cmp al,'y' 3707 0000133B 74DE je KeyVICmdyy 3708 0000133D 3C27 cmp al,"'" 3709 0000133F 75D9 jne MoveBlEnd 3710 00001341 E8C6FBFFFF call ReadOneChar 3711 00001346 3C61 cmp al,'a' ;" y'a " only marker "a" supported 3712 00001348 75D0 jne MoveBlEnd 3713 0000134A 8B0D[2A2F0100] mov ecx,[blockbegin] ;don't go further if no mark set 3714 00001350 E3C8 jecxz MoveBlEnd 3715 00001352 E88CEFFFFF call VIsetMarker 3716 00001357 E87C000000 call KeyEmaAltW 3717 0000135C 8B3D[2A2F0100] mov edi,[blockbegin] 3718 %ifdef W32 3719 jmp ISVI9 3720 %else 3721 00001362 EB2F jmp short ISVI9 3722 %endif 3723 ; 3724 ; some of the EM specials 3725 ; 3726 KeyEmaCtrlY: 3727 %ifdef W32 3728 cmp byte[mode],NE ;Nedit ^V 3729 jnz KECY 3730 PUSH_ALL 3731 push byte 0 3732 call OpenClipboard 3733 or eax,eax 3734 jz KECY3 3735 push byte CF_OEMTEXT 3736 call IsClipboardFormatAvailable 3737 or eax,eax 3738 jz KECY0 3739 push byte CF_OEMTEXT 3740 call GetClipboardData 3741 or eax,eax 3742 jz KECY0 3743 mov edi,ebp 3744 inc edi ;one after eof 3745 mov ecx,[maxlen] 3746 add ecx,sot ;the last possible byte 3747 xor ebx,ebx 3748 dec ebx ;init counter -1 3749 xchg esi,eax 3750 cld 3751 Kloop: lodsb 3752 inc ebx 3753 cmp edi,ecx 3754 jnb KECY2 3755 stosb 3756 or al,al 3757 jnz Kloop 3758 KECY2: mov [EmaKiSize],ebx 3759 KECY0: call CloseClipboard 3760 KECY3: POP_ALL 3761 KECY: 3762 %endif 3763 00001364 8B0D[AA380100] mov ecx,[EmaKiSize] 3764 %ifdef YASM 3765 or ecx,ecx 3766 jmp KeawRet 3767 %else 3768 0000136A E36B jecxz KeawRet 3769 %endif 3770 0000136C 91 xchg eax,ecx ;OLD mov eax,ecx 1 byte longer 3771 0000136D 50 push eax 3772 0000136E E8E2FEFFFF call InsertByte 3773 00001373 59 pop ecx 3774 00001374 7261 jc KeawRet ;no_space_error is handled in InsertByte 3775 00001376 89EE mov esi,ebp 3776 00001378 46 inc esi 3777 00001379 893D[B2380100] mov [EmaMark],edi 3778 0000137F FC cld 3779 00001380 F3A4 rep movsb 3780 00001382 E8A2F3FFFF call ShowBl0 ;i.e. "mov byte [showblock],0" 3781 00001387 E8ADF6FFFF call IsViMode 3782 0000138C 7405 jz ISVI9 3783 0000138E E8D1FDFFFF call KeyEmaCtrlL 3784 00001393 E9B6F1FFFF ISVI9: jmp CQFNum 3785 ;------- 3786 KeyEmaAltW2:PUSH_ALL 3787 <1> KeyEmaAltW2: 3788 00001398 60 <1> pusha 3789 00001399 89EF mov edi,ebp 3790 0000139B 47 inc edi 3791 0000139C E898F6FFFF call IsViMode 3792 000013A1 7417 jz KEW 3793 ;------- 3794 000013A3 803D[B6380100]01 cmp byte [EmaCtrlK],1 3795 000013AA 750E jnz KEW 3796 000013AC 033D[AA380100] add edi,[EmaKiSize] 3797 000013B2 0105[AA380100] add [EmaKiSize],eax 3798 000013B8 EB0B jmp short KE2 3799 000013BA A3[AA380100] KEW: mov [EmaKiSize],eax 3800 000013BF 8935[AE380100] mov [EmaKiSrc],esi 3801 000013C5 89C1 KE2: mov ecx,eax 3802 000013C7 FC cld 3803 000013C8 F3A4 rep movsb 3804 000013CA E85AF3FFFF call ShowBl0 ;i.e. "mov byte [showblock],0" 3805 000013CF C605[B6380100]01 Keaw2: mov byte [EmaCtrlK],1 3806 POP_ALL 3807 000013D6 61 <1> popa 3808 000013D7 C3 KeawRet:ret 3809 ;------- 3810 000013D8 C605[C6380100]00 KeyEmaAltW:mov byte [VInolinebased],0 3811 PUSH_ALL 3812 000013DF 60 <1> pusha 3813 000013E0 8B0D[422F0100] mov ecx,[showblock] 3814 000013E6 E3E7 jecxz Keaw2 3815 000013E8 8B0D[B2380100] mov ecx,[EmaMark] 3816 000013EE E3DF jecxz Keaw2 3817 000013F0 89F8 mov eax,edi 3818 000013F2 39C1 cmp ecx,eax 3819 000013F4 7201 jb KEAW 3820 000013F6 91 xchg eax,ecx 3821 000013F7 29C8 KEAW: sub eax,ecx ;eax end / ecx beg 3822 000013F9 89CE mov esi,ecx 3823 000013FB 89EF mov edi,ebp 3824 000013FD 47 inc edi 3825 000013FE A3[AA380100] mov [EmaKiSize],eax 3826 00001403 8935[AE380100] mov [EmaKiSrc],esi 3827 00001409 91 xchg eax,ecx ;OLD mov ecx,eax 1 byte longer 3828 0000140A FC cld 3829 0000140B F3A4 rep movsb 3830 0000140D E827F6FFFF call IsViMode 3831 00001412 7405 jz KEAW3 3832 00001414 E810F3FFFF call ShowBl0 ;i.e. "mov byte [showblock],0" 3833 KEAW3: 3834 %ifdef W32 3835 cmp byte[mode],NE ;Nedit ^C 3836 jnz KEAW4 3837 push dword [EmaKiSize] 3838 push byte 0 3839 push dword [heap] 3840 call HeapAlloc 3841 or eax,eax 3842 jz KEAW4 3843 mov esi,[EmaKiSrc] 3844 mov edi,eax 3845 mov ecx,[EmaKiSize] 3846 cld 3847 rep movsb 3848 mov byte[edi],0 ;ASCIIZ 3849 ;------- 3850 push dword [heap] 3851 push byte 0 3852 push eax ;push for later usage in HeapFree 3853 push eax ;push clip handle for SetClipboardData 3854 push byte 0 3855 call OpenClipboard 3856 or eax,eax 3857 jz KEAW8 3858 call EmptyClipboard 3859 push byte CF_OEMTEXT 3860 call SetClipboardData 3861 call CloseClipboard 3862 KEAW8: call HeapFree 3863 KEAW4: 3864 %endif 3865 POP_ALL 3866 00001419 61 <1> popa 3867 0000141A C3 KeaWRet:ret 3868 ;---------------------------------------------------------------------- 3869 ; 3870 ; functions reading/writing text or blocks from/into files 3871 ; 3872 0000141B BE[A1240000] NFnoarg:mov esi,helptext ;initial part of help 3873 00001420 BF[2B3D0100] mov edi,sot 3874 00001425 6A4F push byte helptextsize 3875 00001427 59 pop ecx 3876 00001428 57 push edi 3877 00001429 F3A4 rep movsb 3878 ;------- 3879 0000142B E847050000 call GetHelpText ;second part of help 3880 00001430 8DA9[7A3D0100] lea ebp,[ecx+sot+helptextsize] ;set END_OF_HELP_TEXT pointer 3881 00001436 F3A4 rep movsb 3882 00001438 5F pop edi 3883 00001439 E80BF6FFFF call DispNewScreen 3884 ;------- 3885 0000143E BE[24210000] mov esi, filename 3886 00001443 B9[DA2F0100] mov ecx, filepath 3887 00001448 E87CF8FFFF call InputString0 3888 0000144D 732A jnc GetFile ;empty string not allowed here 3889 0000144F C3 ret 3890 ;------- 3891 00001450 8D7102 KeyVICmdE:lea esi,[ecx+2] 3892 00001453 803E20 cmp byte [esi],SPACECHAR 3893 00001456 74C2 je KeaWRet 3894 PUSH_ALL ;save before load new 3895 00001458 60 <1> pusha 3896 00001459 E890000000 call SaveFile 3897 POP_ALL 3898 0000145E 61 <1> popa 3899 ;-------continue 3900 0000145F FC NewFile:cld 3901 00001460 E814030000 call InitVars 3902 %ifdef AMD64 3903 or rsi,rsi 3904 jz NFnoarg 3905 cmp byte [rsi],0 3906 %else 3907 00001465 09F6 or esi,esi 3908 00001467 74B2 jz NFnoarg 3909 00001469 803E00 cmp byte [esi],0 3910 %endif 3911 0000146C 74AD jz NFnoarg 3912 0000146E BF[DA2F0100] mov edi,filepath 3913 NF1: 3914 %ifdef W32 3915 lodsb 3916 cmp al,'"' 3917 jz NF1 3918 stosb 3919 cmp al,SPACECHAR ;truncate after blanks 3920 jnz NF3 3921 NF4: mov byte [edi-1],0 3922 jmp short GetFile 3923 NF3: cmp al,TABCHAR 3924 jz NF4 3925 %else 3926 00001473 AC lodsb 3927 00001474 AA stosb 3928 %endif 3929 00001475 08C0 NF2: or al,al 3930 00001477 75FA jnz NF1 3931 ;------- cont 3932 GetFile: 3933 %ifdef BEOS 3934 xor ebx,ebx 3935 mov edx,ebx 3936 dec ebx ;edx==0,ebx==-1 3937 mov ecx,filepath 3938 %else 3939 00001479 BB[DA2F0100] mov ebx,filepath 3940 %endif 3941 0000147E E8F4050000 call OpenFile0 3942 00001483 BF[2B3D0100] mov edi,sot 3943 00001488 89FD mov ebp,edi 3944 0000148A 785C js NewFileEnd 3945 %ifdef SYS_brk 3946 call Seek 3947 PUSH_ALL 3948 lea ebx,[eax+eax+max] ;twice filesize plus reserve = space for inserts 3949 mov [maxlen],ebx 3950 add ebx,text 3951 call SysBrk 3952 POP_ALL 3953 js OSejmp1 ;OSerror 3954 %else 3955 0000148C 89C3 mov ebx,eax ;for FreeBSD memory is hard coded by maxlen 3956 %endif 3957 ;------- 3958 %ifdef SYS_fstat ;not for W32,BEOS 3959 0000148E E8F6050000 call Fstat 3960 00001493 784B js OSejmp1 ;OSerror 3961 00001495 A1[06370100] mov eax,[fstatbuf+stat_struc.st_mode] 3962 %ifdef FREEBSD 3963 0000149A 89C1 mov ecx,eax 3964 0000149C 81E100F00000 and ecx,0F000h ;see /usr/include/sys/stat.h 3965 000014A2 81F900800000 cmp ecx,8000h ;not for special files 3966 000014A8 740D jz regFile 3967 000014AA 6A15 push byte ERRNOREGFILE 3968 000014AC 8F05[6E2F0100] pop dword [ErrNr] 3969 000014B2 E961010000 jmp OSerror 3970 regFile: 3971 %endif 3972 000014B7 25FF010000 and eax,777q 3973 000014BC A3[FA360100] mov [perms],eax 3974 %ifdef SYS_utime 3975 000014C1 A1[22370100] mov eax,[fstatbuf+stat_struc.st_mtime] 3976 000014C6 A3[6A370100] mov [accesstime+utimbuf_struc.modtime],eax 3977 %endif 3978 %endif ;end of code not for W32,BEOS 3979 ;------- 3980 000014CB 8B15[D62F0100] OldFile1:mov edx,[maxlen] ;i.e. either 'max' or filesize twice 3981 000014D1 89F9 mov ecx,edi ;sot 3982 000014D3 E891050000 call Read_File 3983 000014D8 92 xchg edx,eax ;mov edx,eax bytes read 3984 000014D9 7877 js OSejmp0 ;OSerror 3985 000014DB E89D050000 call CloseFile 3986 000014E0 7870 OSejmp1:js OSejmp0 ;OSerror 3987 000014E2 8DAA[2B3D0100] lea ebp,[edx+sot] ;eof_ptr=filesize+start_of_text 3988 000014E8 C645000A NewFileEnd:mov byte [ebp],NEWLINE ;eof-marker 3989 000014EC F8 clc 3990 000014ED C3 NFEnd2: ret 3991 ;------- 3992 ; save file (called by ^KS,^KX) 3993 ; 3994 000014EE 803D[1E2F0100]20 SaveFile:cmp byte [changed],UNCHANGED 3995 000014F5 74F6 jz NFEnd2 ;no changes: nothing to save 3996 000014F7 BE[40210000] mov esi, filesave 3997 000014FC E82C020000 call WriteMess9 3998 ;------- 3999 00001501 BE[DA2F0100] mov esi,filepath 4000 00001506 57 push edi 4001 00001507 BF[DA300100] mov edi,bakpath 4002 0000150C 89F3 mov ebx,esi 4003 0000150E 89F9 mov ecx,edi 4004 00001510 FC cld 4005 00001511 AC SF0: lodsb 4006 00001512 AA stosb ;copy to BAK file path 4007 00001513 08C0 or al,al 4008 00001515 75FA jne SF0 4009 00001517 4F dec edi 4010 00001518 6A7E push byte '~' ;add BAK file extension 4011 0000151A 58 pop eax 4012 %ifdef ARMCPU 4013 stosb 4014 shr eax,8 4015 stosb 4016 shr eax,8 4017 stosb 4018 shr eax,8 4019 stosb 4020 %else 4021 0000151B AB stosd ;not stosb because ascii-ZERO 4022 %endif 4023 0000151C 5F pop edi 4024 %ifdef BEOS 4025 push edi 4026 mov ebx,0xFFFFFFFF 4027 mov edx,ebx 4028 mov ecx,filepath 4029 mov edi,bakpath 4030 %endif 4031 %ifdef MAKE_BACKUP 4032 0000151D 81392F746D70 cmp dword [ecx],'/tmp' 4033 00001523 741D je no_ren 4034 %ifdef SYS_readlink 4035 PUSH_ALL 4036 00001525 60 <1> pusha 4037 00001526 B9[56360100] mov ecx,linkbuffer ;we are only interested whether symlink or not 4038 0000152B 6A04 push byte linkbuffersize ;=4 byte dummy buffer 4039 0000152D 5A pop edx 4040 0000152E E84E050000 call ReadLink 4041 POP_ALL 4042 00001533 61 <1> popa 4043 00001534 7907 jns CopyBAK ;no error means it's a symlink... 4044 00001536 E85D050000 call RenameFile ;...but plain files are easy to rename (ecx is filepath) 4045 0000153B EB05 jmp short no_ren ;...simlilar behave 'xemacs' and 'jed' 4046 0000153D E833070000 CopyBAK:call CopyToBackup ;we can't simply rename the link 4047 %else 4048 call RenameFile ;ecx is filepath 4049 %endif 4050 no_ren: ;...continue here... 4051 %endif 4052 %ifdef BEOS 4053 pop edi 4054 %endif 4055 ;------- 4056 %ifdef W32 4057 mov ecx,CREATE_ALWAYS 4058 mov ebx,filepath 4059 mov edx,GENERIC_WRITE 4060 %else 4061 %ifdef BEOS 4062 mov ebx,0xFFFFFFFF 4063 mov ecx,filepath 4064 mov edx,0x777 4065 %else 4066 00001542 B901060000 mov ecx,O_WRONLY_CREAT_TRUNC 4067 00001547 8B15[FA360100] mov edx,[perms] 4068 %endif 4069 %endif 4070 0000154D E827050000 call OpenFile 4071 00001552 7839 OSejmp0:js OSejmp9 ;OSerror 4072 00001554 93 xchg ebx,eax ;file descriptor (xchg is only 1 byte) 4073 ;------- 4074 %ifdef SYS_fchown 4075 00001555 8B0D[FA360100] mov ecx,[perms] 4076 0000155B E825050000 call Fchmod 4077 %endif 4078 %ifdef SYS_fstat 4079 00001560 8B0D[0E370100] mov ecx,[fstatbuf+stat_struc.st_uid] 4080 %ifdef UIDGID_WORD ;Linux special 4081 mov edx,ecx 4082 shr edx,16 4083 movzx ecx,cx ;OLD and ecx,0xffff 4084 %else 4085 00001566 8B15[12370100] mov edx,[fstatbuf+stat_struc.st_gid] 4086 %endif 4087 0000156C E823050000 call ChownFile 4088 %endif 4089 ;------- 4090 00001571 B9[2B3D0100] mov ecx,sot ;ecx=bof 4091 00001576 89EA mov edx,ebp ;eof 4092 00001578 29CA SaveFile2:sub edx,ecx ;edx=fileesize= eof-bof 4093 0000157A E8BAF4FFFF call IsViMode 4094 0000157F 7507 jnz NoAddNL 4095 00001581 807DFF0A cmp byte [ebp-1],NEWLINE 4096 00001585 7401 jz NoAddNL 4097 00001587 42 inc edx ;append NewLine char for VI mode 4098 00001588 E8E6040000 NoAddNL:call Write_File ;ebx=file descriptor 4099 0000158D 7851 OSejmp9:js OSejmp ;OSerror 4100 0000158F 6A05 push byte ERRNOIO 4101 00001591 8F05[6E2F0100] pop dword[ErrNr] ;just in case of.... 4102 00001597 39D0 cmp eax,edx ;all written? 4103 %ifdef BEOS 4104 jnz near OSerror 4105 %else 4106 00001599 757D jnz OSerror 4107 %endif 4108 0000159B E8DD040000 call CloseFile 4109 000015A0 783E js OSejmp ;OSerror 4110 000015A2 C3 SaveFile3:ret 4111 ;------- 4112 ; save block (called by ^KW) 4113 ; 4114 000015A3 E8B8010000 SaveBlock:call GetBlockName 4115 000015A8 7226 jc jcDE2 4116 SaveBl2: 4117 %ifdef W32 4118 mov ebx,blockpath 4119 SaveBl3:mov ecx,CREATE_ALWAYS 4120 mov edx,GENERIC_WRITE 4121 %else 4122 %ifdef BEOS 4123 mov ebx,blockpath 4124 SaveBl3:mov ecx,0xFFFFFFFF 4125 xchg ebx,ecx 4126 mov edx,0x241 ;was 0x777 upto Dec 01 4127 %else 4128 000015AA BB[DA310100] mov ebx,blockpath 4129 000015AF B901060000 SaveBl3:mov ecx,O_WRONLY_CREAT_TRUNC 4130 000015B4 BAA4010000 mov edx,PERMS 4131 %endif 4132 %endif 4133 000015B9 E8BB040000 call OpenFile 4134 000015BE 7820 js OSejmp ;OSerror 4135 000015C0 89F1 mov ecx,esi ;= block begin 4136 000015C2 8B15[2E2F0100] mov edx,[blockende] 4137 000015C8 93 xchg ebx,eax ;file descriptor (xchg is only 1 byte) 4138 000015C9 EBAD jmp short SaveFile2 4139 ;------- 4140 ; read a block into buffer (by ^KR) 4141 ; 4142 000015CB E890010000 ReadBlock:call GetBlockName 4143 000015D0 0F8285000000 jcDE2: jc near DE2 4144 ReadBlock2: 4145 %ifdef BEOS 4146 xor ebx,ebx 4147 mov edx,ebx 4148 dec ebx ;edx==0,ebx==-1 4149 mov ecx,blockpath 4150 %else 4151 000015D6 BB[DA310100] mov ebx,blockpath 4152 %endif 4153 000015DB E897040000 call OpenFile0 4154 000015E0 7836 OSejmp: js OSerror 4155 000015E2 E82B020000 call Seek 4156 000015E7 782F js OSerror 4157 000015E9 50 push eax ;eax=fileesize 4158 000015EA E866FCFFFF call InsertByte 4159 000015EF 5A pop edx ;file size 4160 000015F0 72B0 jc SaveFile3 ;ret if cy InsertByte told an error message itself 4161 000015F2 89F9 mov ecx,edi ;^offset akt ptr 4162 000015F4 E870040000 call Read_File 4163 000015F9 7816 js preOSerror ;to delete inserted bytes (# in EDX) 4164 000015FB 89C1 mov ecx,eax ;bytes read 4165 000015FD E87B040000 call CloseFile 4166 00001602 7814 js OSerror 4167 00001604 6A05 push byte ERRNOIO 4168 00001606 8F05[6E2F0100] pop dword[ErrNr] ;just in case of.... 4169 0000160C 39CA cmp edx,ecx ;all read? 4170 0000160E 7508 jnz OSerror 4171 00001610 C3 ret 4172 ;------- 4173 00001611 89D0 preOSerror:mov eax,edx ;count bytes 4174 00001613 E810FCFFFF call DeleteByte ;delete space reserved for insertation 4175 00001618 57 OSerror:push edi 4176 00001619 BF[7A2F0100] mov edi,error+8 ;where to store ASCII value of ErrNr 4177 0000161E A1[6E2F0100] mov eax,[ErrNr] 4178 00001623 50 push eax 4179 00001624 E8B3FBFFFF call IntegerToAscii 4180 00001629 59 pop ecx ;for getting error text via LookPD2 4181 0000162A 83F920 cmp ecx,MAXERRNO 4182 0000162D 771C ja DE0 4183 0000162F BF[0E300000] mov edi,errmsgs 4184 00001634 E8C9F9FFFF call LookPD2 ;look message # (ecx) in line number # 4185 00001639 89FE mov esi,edi 4186 0000163B BF[7B2F0100] mov edi,error+9 4187 00001640 66B8203A mov ax,' :' 4188 %ifdef ARMCPU 4189 stosb ;error+9 is not aligned 4190 %else 4191 00001644 66AB stosw 4192 %endif 4193 00001646 6A50 push byte 80 ;max strlen / compare errlen equ 100 4194 00001648 59 pop ecx 4195 00001649 F3A4 rep movsb 4196 0000164B BE[722F0100] DE0: mov esi,error 4197 00001650 5F pop edi 4198 00001651 E8D7000000 DE1: call WriteMess9 4199 00001656 E8B1F8FFFF call ReadOneChar ;was GetChar 4200 DE2: ;continued... 4201 ;---------------------------------------------------------------------- 4202 ; 4203 ; more STATUS LINE maintaining subroutines 4204 ; 4205 RestoreStatusLine:PUSH_ALL ;important e.g. for asksave 4206 <1> RestoreStatusLine: 4207 0000165B 60 <1> pusha 4208 0000165C E8E6000000 call InitStatusLine 4209 00001661 BE[DE380100] mov esi,mode 4210 00001666 8B0D[022F0100] mov ecx,[columns] ;width 4211 0000166C 80F920 cmp cl,stdtxtlen+15+5+2 ;this window is too small 4212 %ifdef ARMCPU 4213 and ecx,0xFFFFFFFC ;get aligned 4214 %endif 4215 0000166F 0F82AB000000 jb near RSno_lineNr 4216 00001675 A0[1E2F0100] mov al,byte[changed] 4217 0000167A A2[73370100] mov byte[screenline+1],al ;changed status 4218 ;------- 4219 %ifndef LINUX 4220 0000167F 8D81[65370100] lea eax,[ecx-13+screenline] ;FreeBSD or Beos ... 4221 %else 4222 lea eax,[ecx-12+screenline] 4223 %endif 4224 00001685 66C740087669 mov word[eax+8],'vi' ;vi does show mode info only. 4225 0000168B 803E08 cmp byte [esi],VI ;vi doesn't get altH text because altH won't work... 4226 0000168E 7510 jnz RSL0 ;...caused by different handling due single ESC keys 4227 00001690 803D[BE380100]01 cmp byte [VICmdMode],1 4228 00001697 7536 jnz NOVI0 4229 00001699 BB434D4420 mov ebx,'CMD ' 4230 0000169E EB42 jmp short RSL1 4231 000016A0 C700616C7448 RSL0: mov dword [eax],'altH' 4232 000016A6 C740043D68656C mov dword [eax+4],'=hel' ;'p' is stored with editor mode name 4233 000016AD BB[91240000] mov ebx,editmode 4234 000016B2 8B13 mov edx,[ebx] 4235 000016B4 803E04 cmp byte [esi],PI 4236 000016B7 7503 jnz No_PI1 4237 000016B9 8B5304 mov edx,[ebx+4] 4238 000016BC 803E02 No_PI1: cmp byte [esi],EM 4239 000016BF 7503 jnz No_Em1 4240 000016C1 8B5308 mov edx,[ebx+8] 4241 000016C4 803E10 No_Em1: cmp byte [esi],NE 4242 000016C7 7503 jnz No_Ne1 4243 000016C9 8B530C mov edx,[ebx+12] 4244 000016CC 895008 No_Ne1: mov [eax+8],edx 4245 ;------- 4246 000016CF B820494E53 NOVI0: mov eax,' INS' ;Insert 4247 000016D4 803D[6A2F0100]01 cmp byte [insstat],1 4248 000016DB 7405 jz RSL1 4249 000016DD B8204F5652 mov eax,' OVR' ;Overwrite 4250 000016E2 A3[76370100] RSL1: mov [screenline+4],eax ;mode status 4251 %ifdef UTF8RTS 4252 cmp byte [isUTF8],0 4253 jnz RSL1a 4254 mov al,'7' ;"7bit_non_utf8" status 4255 RSL1a: mov byte [screenline],al 4256 %endif 4257 000016E7 BF[7C370100] mov edi,screenline+stdtxtlen 4258 000016EC 8D49E2 lea ecx,[ecx-(stdtxtlen+15+5)] ;space for other than filename 4259 000016EF BE[DA2F0100] mov esi,filepath ;lea ... is shorter than sub ecx,stdtxtlen+15+5 4260 000016F4 AC RSL2: lodsb 4261 000016F5 08C0 or al,al 4262 000016F7 7403 jz RSL4 4263 000016F9 AA stosb 4264 000016FA E2F8 loop RSL2 4265 000016FC BF[63370100] RSL4: mov edi,screenline-15 4266 00001701 033D[022F0100] add edi,[columns] 4267 00001707 A1[062F0100] mov eax,[columne] 4268 0000170C 40 inc eax ;start with 1 4269 0000170D E8CAFAFFFF call IntegerToAscii 4270 00001712 C6073A mov byte [edi],':' ;delimiter ROW:COL 4271 00001715 4F dec edi 4272 00001716 A1[3E2F0100] mov eax,[linenr] 4273 0000171B E8BCFAFFFF call IntegerToAscii 4274 00001720 E808F5FFFF RSno_lineNr:call StatusLineShow ;now write all at once 4275 POP_ALL 4276 00001725 61 <1> popa 4277 00001726 F9 stc ;error status only important if called via OSError 4278 00001727 C3 ret 4279 ;------- 4280 ; 4281 ; write an answer prompt into status line 4282 ; (with and without re-initialisation) 4283 ; expecting esi points to ASCIIZ or 0A terminated string 4284 ; 4285 00001728 E81A000000 WriteMess9MakeLine:call InitStatusLine 4286 WriteMess9:PUSH_ALL 4287 <1> WriteMess9: 4288 0000172D 60 <1> pusha 4289 0000172E BF[72370100] mov edi,screenline 4290 00001733 FC cld 4291 00001734 AC WriteMLoop:lodsb 4292 00001735 3C0A cmp al,LINEFEED ;for error messages 4293 00001737 7603 jbe WriteMEnd 4294 00001739 AA stosb 4295 0000173A EBF8 jmp short WriteMLoop 4296 0000173C E8ECF4FFFF WriteMEnd:call StatusLineShow 4297 POP_ALL 4298 00001741 61 <1> popa 4299 00001742 E93EFAFFFF jmp KursorStatusLine 4300 ;------- 4301 ; a helper for other status line functions: 4302 ; simply init an empty line 4303 ; 4304 InitStatusLine:PUSH_ALL ;simply init an empty line 4305 <1> InitStatusLine: 4306 00001747 60 <1> pusha 4307 00001748 BF[72370100] mov edi,screenline 4308 0000174D B020 mov al,SPACECHAR 4309 0000174F 8B0D[022F0100] mov ecx,[columns] 4310 %ifndef LINUX 4311 00001755 49 dec ecx ;? FreeBSD 4312 00001756 7806 js ISL ;should never be = -1 4313 %endif 4314 00001758 FC cld 4315 00001759 F3AA rep stosb 4316 0000175B B000 mov al,0 ;prepare ASCIIZ string 4317 0000175D AA stosb 4318 ISL: POP_ALL 4319 <1> ISL: 4320 0000175E 61 <1> popa 4321 0000175F C3 ret 4322 ;------- 4323 ; read a file name for block operations 4324 ; 4325 GetBlockName:PUSH_ALL 4326 <1> GetBlockName: 4327 00001760 60 <1> pusha 4328 00001761 BE[2E210000] mov esi,block 4329 00001766 B9[DA310100] mov ecx,blockpath 4330 0000176B E859F5FFFF call InputString0 ;cy if empty string 4331 00001770 9C pushf 4332 00001771 E819FAFFFF call RestKursPos 4333 00001776 9D popf 4334 POP_ALL 4335 00001777 61 <1> popa 4336 00001778 C3 ret 4337 ;------- 4338 ; helper for NewFile 4339 ; 4340 00001779 C605[2A3D0100]0A InitVars:mov byte [text],NEWLINE ;don't touch esi! 4341 00001780 E87BF0FFFF call Unchg ;i.e. "mov byte [changed],UNCHANGED" 4342 00001785 E853000000 call InitSomeVars ;set eax=0 4343 0000178A C705[362F0100]- mov dword[old],sot 4344 00001790 [2B3D0100] 4345 00001794 40 inc eax ;set eax=1 4346 00001795 A2[BE380100] mov byte [VICmdMode],al 4347 0000179A A3[3E2F0100] mov dword [linenr],eax 4348 0000179F A2[6A2F0100] mov byte [insstat],al 4349 000017A4 C705[D62F0100]0040- mov dword [maxlen],max 4350 000017AC 9C00 4351 000017AE C705[722F0100]4552- mov dword [error],'ERRO' 4352 000017B6 524F 4353 000017B8 C705[762F0100]5220- mov dword [error+4],'R ' 4354 000017C0 2020 4355 000017C2 C705[FA360100]A401- mov dword [perms],PERMS 4356 000017CA 0000 4357 %ifdef SYS_fstat 4358 000017CC 48 dec eax 4359 000017CD 48 dec eax ;eax == -1 i.e. no changes in fchown 4360 %ifdef UIDGID_WORD ;Linux special 4361 mov [fstatbuf+stat_struc.st_uid],eax ;both: giduid 4362 %else 4363 000017CE A3[12370100] mov [fstatbuf+stat_struc.st_gid],eax 4364 000017D3 A3[0E370100] mov [fstatbuf+stat_struc.st_uid],eax 4365 %endif 4366 %endif 4367 000017D8 E944EFFFFF jmp ShowBl1 ;i.e. mov byte [showblock],1 4368 ;------- 4369 InitSomeVars: 4370 000017DD 31C0 xor eax,eax 4371 %ifdef USE_UNDO 4372 000017DF A3[FE2E0000] mov [undobuffer],eax ;i.e. invalid pointer 4373 000017E4 C705[FA2E0000]- mov dword[undoptr],undobuffer+4 ;init to first frame 4374 000017EA [022F0000] 4375 %endif 4376 000017EE A3[B2380100] mov [EmaMark],eax 4377 000017F3 A3[222F0100] mov dword [oldQFpos],eax 4378 000017F8 A2[262F0100] mov byte[bereitsges],al 4379 000017FD A2[322F0100] mov [endeedit],al 4380 00001802 A3[AA380100] InitSV1:mov [EmaKiSize],eax ;do not allow side effects 4381 00001807 A3[2A2F0100] InitSV2:mov [blockbegin],eax ;i.e. NO block valid now 4382 0000180C A3[2E2F0100] InitSV3:mov [blockende],eax 4383 00001811 C3 ret 4384 ;------- 4385 00001812 93 Seek: xchg ebx,eax ;mov file_descriptor to ebx (xchg is 1 byte only) 4386 00001813 6A02 push byte 2 ;FILE_END 4387 00001815 5A pop edx 4388 00001816 E887020000 call SeekFile ;end 4389 0000181B 7809 js SeekRet 4390 0000181D 31D2 xor edx,edx ;FILE_BEGIN 4391 0000181F 50 push eax 4392 00001820 E87D020000 call SeekFile ;home 4393 00001825 58 pop eax 4394 00001826 C3 SeekRet:ret 4395 ;---------------------------------------------------------------------- 4396 ; 4397 ; FIND/REPLACE related stuff 4398 ; 4399 00001827 BE[5C210000] AskForReplace:mov esi,askreplace1 4400 0000182C E893F4FFFF call InputString00 4401 00001831 7240 jc AskFor_Ex 4402 00001833 A3[462F0100] mov [suchlaenge],eax 4403 00001838 BE[65210000] mov esi,askreplace2 4404 0000183D B9[DA320100] mov ecx,replacetext 4405 00001842 E882F4FFFF call InputString0 4406 00001847 EB0C jmp short GetOptions ;cy flag is allowed here 18.6.00 4407 00001849 BE[77210000] AskForFind:mov esi,askfind 4408 0000184E E871F4FFFF call InputString00 4409 00001853 721E jc AskFor_Ex 4410 00001855 A3[4A2F0100] GetOptions:mov [repllaenge],eax 4411 0000185A F605[DE380100]11 test byte [mode],WS|NE 4412 00001861 740F jz GetOpt2 4413 00001863 BE[1B210000] mov esi,optiontext 4414 00001868 E848F4FFFF call InputStringWithMessage ;empty string is allowd for std options... 4415 0000186D E812000000 call ParseOptions ;...(set in ParseOptions) 4416 00001872 F8 GetOpt2:clc 4417 00001873 7307 AskFor_Ex:jnc AFE2 4418 00001875 C605[262F0100]00 mov byte [bereitsges],0 4419 0000187C 9C AFE2: pushf 4420 0000187D E80DF9FFFF call RestKursPos 4421 00001882 9D popf 4422 00001883 C3 ret 4423 ;------- 4424 ; check string for 2 possible options: C,c,B,b (case sensitive & backward) 4425 ; 4426 00001884 56 ParseOptions:push esi 4427 00001885 FC cld 4428 00001886 BE[DA350100] mov esi,optbuffer 4429 0000188B 6A01 push byte 1 4430 0000188D 8F05[4E2F0100] pop dword[vorwarts] ;mov dword[vorwarts],1 is longer 4431 00001893 C605[522F0100]DF mov byte[grossklein],0dfh 4432 0000189A AC Scan1: lodsb 4433 0000189B 245F and al,5fh ;upper case 4434 0000189D 3C43 cmp al,'C' 4435 0000189F 7507 jnz notCopt 4436 000018A1 8035[522F0100]20 xor byte[grossklein],20h ;result 0dfh, 2*C is like not C option 4437 000018A8 3C42 notCopt:cmp al,'B' 4438 000018AA 7506 jnz notBopt 4439 000018AC F71D[4E2F0100] neg dword[vorwarts] ;similar 2*B is backward twice i.e. forward 4440 000018B2 08C0 notBopt:or al,al 4441 000018B4 75E4 jnz Scan1 4442 000018B6 5E pop esi 4443 000018B7 C3 ret 4444 ;------- 4445 ; the find subroutine itself 4446 ; 4447 000018B8 89FB find2: mov ebx,edi 4448 000018BA AC find3: lodsb 4449 000018BB 08C0 or al,al ;=end? 4450 000018BD 7466 jz found 4451 000018BF 3C41 cmp al,41h 4452 000018C1 7202 jb find7 4453 000018C3 20E8 and al,ch 4454 000018C5 47 find7: inc edi 4455 000018C6 8A0F mov cl,byte [edi] 4456 000018C8 80F941 cmp cl,41h 4457 000018CB 7202 jb find10 4458 000018CD 20E9 and cl,ch 4459 000018CF 38C8 find10: cmp al,cl 4460 000018D1 74E7 jz find3 4461 000018D3 89DF mov edi,ebx 4462 000018D5 8A2D[522F0100] FindText:mov ch,[grossklein] ;ff or df 4463 000018DB BE[DA330100] mov esi,suchtext 4464 000018E0 FC cld 4465 000018E1 AC lodsb 4466 000018E2 3C41 cmp al,41h 4467 000018E4 7202 jb find1 4468 000018E6 20E8 and al,ch ;FIXME: check UTF-8 stuff !! 4469 ;------- 4470 000018E8 033D[4E2F0100] find1: add edi,[vorwarts] ;+1 or -1 (increase or decrease pointer) 4471 000018EE 8A0F mov cl,byte [edi] 4472 000018F0 80F941 cmp cl,41h 4473 000018F3 7202 jb find6 4474 000018F5 20E9 and cl,ch 4475 000018F7 38C8 find6: cmp al,cl 4476 000018F9 74BD je find2 4477 000018FB 803D[DE380100]04 cmp byte[mode],PI ;is it Pico? (always searching forward) 4478 00001902 7513 jnz find_WS ;no, continue 4479 00001904 3B3D[CA380100] cmp edi,[PicoSearch] ;yes, but did we search from BOF up to here? 4480 0000190A 7417 je notfound ;yes, so we did not found the text 4481 0000190C 39EF cmp edi,ebp ;no, but did we touch EOF? 4482 0000190E 72D8 jb find1 ;no, continue from here 4483 00001910 BF[2A3D0100] mov edi,sot-1 ;yes, let's continue at BOF 4484 00001915 EBD1 jmp short find1 ;loop 4485 00001917 39EF find_WS:cmp edi,ebp 4486 00001919 7708 ja notfound 4487 0000191B 81FF[2B3D0100] find9: cmp edi,sot ;this is needed for WStar backward option searching 4488 00001921 73C5 jnb find1 4489 00001923 F9 notfound:stc 4490 00001924 C3 ret 4491 00001925 89DF found: mov edi,ebx 4492 00001927 F8 clc ;edi points after location 4493 00001928 C3 ret 4494 ;---------------------------------------------------------------------- 4495 ; 4496 ; some GENERAL helper functions 4497 ; 4498 ; 4499 ; Get.....ToInteger reads integer value from keyboard (only > 0) 4500 ; 4501 00001929 6A07 GetOctalToInteger:push byte 7 ;octal base-1 4502 0000192B EB02 jmp short GATI2 4503 0000192D 6A09 GetAsciiToInteger:push byte 9 ;decimal base-1 4504 0000192F E805F1FFFF GATI2: call IsViMode 4505 00001934 740A jz ISVI8 4506 00001936 E87AF3FFFF call InputStringWithMessage ;eax = al = length 4507 0000193B E833FFFFFF call AskFor_Ex ;repair status line & set cursor pos / preserve flags 4508 00001940 6A00 ISVI8: push byte 0 4509 00001942 5E pop esi ;preserve flags 4510 00001943 5B pop ebx ;bl == base-1 4511 00001944 87CE xchg ecx,esi 4512 00001946 721E jc AIexit2 4513 00001948 FC cld 4514 00001949 AC AIload: lodsb ;eax bit 8..31 are 0 4515 0000194A 2C30 sub al,'0' 4516 0000194C 7816 js AIexit 4517 0000194E 38D8 cmp al,bl 4518 00001950 7712 ja AIexit 4519 00001952 80FB07 cmp bl,7 ;if base==8 4520 00001955 7408 je GATI3 4521 00001957 8D0C89 lea ecx,[ecx+4*ecx] 4522 0000195A 8D0C48 lea ecx,[2*ecx+eax] ;mul 10 plus digit 4523 0000195D EBEA jmp short AIload 4524 0000195F 8D0CC8 GATI3: lea ecx,[8*ecx+eax] ;mul 8 plus digit 4525 00001962 EBE5 jmp short AIload 4526 %ifdef ARMCPU 4527 AIexit: cmp ecx,0 ;ret ecx 4528 %else 4529 00001964 09C9 AIexit: or ecx,ecx ;ret ecx 4530 %endif 4531 00001966 C3 AIexit2:ret ;CY or ZR if error 4532 ;------- 4533 ; 4534 ; SpacesForTab expects current column in edx 4535 ; returns # spaces up to next tabulated location in AH 4536 ; 4537 00001967 51 SpacesForTab:push ecx 4538 00001968 89D0 mov eax,edx 4539 0000196A B108 mov cl,TAB 4540 0000196C 30E4 xor ah,ah 4541 0000196E F6F1 div cl 4542 00001970 F6DC neg ah ;ah = modulo division 4543 00001972 80C408 add ah,TAB ;TAB - pos % TAB 4544 00001975 59 pop ecx 4545 00001976 C3 ret 4546 ;------- 4547 ; 4548 ; GetHelpText returns ecx==size of help text / esi==help text for current edit mode 4549 ; 4550 GetHelpText: 4551 00001977 BE[952E0000] mov esi,help_ne ;start with last text block... 4552 0000197C B963020000 mov ecx,help_ws_size 4553 %ifdef USE_BUILTINHELP 4554 00001981 B8[DE380100] mov eax,mode 4555 00001986 803810 cmp byte [eax],NE 4556 00001989 7506 jnz NoNe1 4557 0000198B B979010000 mov ecx,help_ne_size 4558 00001990 C3 ret 4559 00001991 29CE NoNe1: sub esi,ecx ;...and sub block by block until we've found it 4560 00001993 803808 cmp byte [eax],VI 4561 00001996 7410 jz GHT 4562 00001998 29CE sub esi,ecx 4563 0000199A 803802 cmp byte [eax],EM 4564 0000199D 7409 jz GHT 4565 0000199F 29CE sub esi,ecx 4566 000019A1 803804 cmp byte [eax],PI 4567 000019A4 7402 jz GHT 4568 000019A6 29CE sub esi,ecx 4569 %endif 4570 000019A8 C3 GHT: ret 4571 ;------- 4572 ; 4573 ; Check whether user discarded his input 4574 ; 4575 000019A9 BE[DE380100] CheckUserAbort:mov esi,mode 4576 000019AE 803E01 cmp byte[esi],WS 4577 000019B1 7408 jz CUAWS 4578 000019B3 803E02 cmp byte[esi],EM 4579 000019B6 7406 jz CUAEM 4580 000019B8 3C03 cmp al,3 ;^C abort 4581 000019BA C3 ret 4582 000019BB 3C15 CUAWS: cmp al,15h ;^U abort 4583 000019BD C3 ret 4584 000019BE 3C07 CUAEM: cmp al,7 ;^G abort 4585 000019C0 C3 ret 4586 ;------- 4587 KeyEditMode: 4588 000019C1 BE[93210000] mov esi,modetxt 4589 000019C6 E8EAF2FFFF call InputStringWithMessage ;empty string is allowd for std options... 4590 000019CB E8BFF7FFFF call RestKursPos 4591 000019D0 BE[DA350100] mov esi,optbuffer 4592 000019D5 E803FEFFFF call InitSomeVars 4593 ;------- 4594 000019DA B8[DE380100] SetEditMode:mov eax,mode ;returns Z flag if the mode was changed / NZ else 4595 %ifndef ARMCPU 4596 %ifdef AMD64 4597 mov ecx,dword [rsi] 4598 %else 4599 000019DF 8B0E mov ecx,dword [esi] 4600 %endif 4601 %else ;one never knows how aligned esi will be 4602 mov cl,byte [esi+3] 4603 shl ecx,8 4604 mov cl,byte [esi+2] 4605 shl ecx,8 4606 mov cl,byte [esi+1] 4607 shl ecx,8 4608 mov cl,byte [esi] 4609 %endif 4610 %ifdef W32 4611 or ecx,020202020h ;convert to lower case 4612 %endif 4613 000019E1 81F965336E65 cmp ecx,'e3ne' 4614 000019E7 7504 jnz NoNe 4615 000019E9 C60010 mov byte [eax],NE 4616 000019EC C3 ret 4617 000019ED 81F96533656D NoNe: cmp ecx,'e3em' 4618 000019F3 7504 jnz NoEm 4619 000019F5 C60002 mov byte [eax],EM 4620 000019F8 C3 ret 4621 000019F9 81F965337069 NoEm: cmp ecx,'e3pi' 4622 000019FF 7504 jnz NoPi 4623 00001A01 C60004 mov byte [eax],PI 4624 00001A04 C3 ret 4625 00001A05 81F965337669 NoPi: cmp ecx,'e3vi' 4626 00001A0B 7504 jnz NoVi 4627 00001A0D C60008 mov byte [eax],VI 4628 00001A10 C3 ret 4629 00001A11 81F965337773 NoVi: cmp ecx,'e3ws' 4630 00001A17 7503 jnz modeOK 4631 00001A19 C60001 mov byte [eax],WS 4632 00001A1C C3 modeOK: ret 4633 ;----------------------------------------------------------------------- 4634 ; 4635 ; Oleg's suggestion / Sat Mar 16 17:58:06 4636 ; 4637 %ifdef USE_EXT_MOVE 4638 KeyHome2:cmp byte[edi-1],NEWLINE 4639 jz KCQPjmp 4640 jmp KeyHome 4641 ;------- 4642 KeyEnd2:cmp byte[edi],NEWLINE 4643 jz KCQPjmp 4644 jmp KeyEnd 4645 ;------- 4646 KeyCtrlQR2:cmp edi,sot 4647 jz KCQPjmp 4648 jmp KeyCtrlQR 4649 ;------- 4650 KeyCtrlQC2:cmp edi,ebp 4651 KCQPjmp:jz near KeyCtrlQP 4652 jmp KeyCtrlQC 4653 %endif 4654 ;----------------------------------------------------------------------- 4655 %ifdef SYS_kill 4656 00001A1D E86DF7FFFF SigHandler:call RestKursPos 4657 00001A22 BF[00000000] mov edi,screenbuffer ;make buffer invalid with something 4658 00001A27 B9A00B0000 mov ecx,screenbuffer_dwords ;this will force a complete screen redraw 4659 00001A2C FC cld 4660 00001A2D F3AB rep stosd 4661 %endif 4662 ;------- cont 4663 SetTermStruc: 4664 %ifdef W32 4665 push dword STD_INPUT_HANDLE 4666 call GetStdHandle 4667 mov [hin],eax 4668 push dword STD_OUTPUT_HANDLE 4669 call GetStdHandle 4670 mov [hout],eax 4671 push byte ENABLE_WINDOW_INPUT ;equ 8 4672 push dword [hin] 4673 call SetConsoleMode ;Do not use "jmp SetConsoleMode" here 4674 ret 4675 %else 4676 00001A2F B913742C40 mov ecx,TERMIOS_GET 4677 00001A34 E820000000 call IOctlTerminal0 4678 00001A39 89D6 mov esi,edx 4679 00001A3B BF[802E0000] mov edi,termios 4680 00001A40 89FA mov edx,edi 4681 00001A42 6A2D push byte termios_struc_size ;prepare a copy of original settings 4682 00001A44 59 pop ecx 4683 00001A45 FC cld 4684 00001A46 F3A4 rep movsb 4685 ;------- 4686 %ifdef LINUX 4687 mov byte [edx+termios_struc.c_cc+VMIN],1 ;set min=1 ->needed for gnome-terminal 4688 %endif 4689 %ifdef ARMCPU 4690 and byte [edx+termios_struc.c_lflag+0],(~ICANON & ~ISIG & ~ECHO) ;icanon off, isig (^C) off, echo off 4691 %else 4692 00001A48 6681620C77FE and TSize [edx+termios_struc.c_lflag+0],(~ICANON & ~ISIG & ~ECHO) ;icanon off, isig (^C) off, echo off 4693 %endif 4694 00001A4E 806201FC and byte [edx+termios_struc.c_iflag+1],(~(IXON>>8) & ~(ICRNL>>8)) ;ixon off, icrnl off 4695 00001A52 B914742C80 mov ecx,TERMIOS_SET 4696 00001A57 EB05 jmp short IOctlTerminal ;edx is termios pointer 4697 %endif 4698 ;---------------------------------------------------------------------- 4699 %ifdef NEW_CURSOR_MGNT 4700 SetCursorNormal:PUSH_ALL 4701 mov ecx,normcurs 4702 push byte normcurslen 4703 jmp short SCB 4704 SetCursorBlock:PUSH_ALL 4705 mov ecx,blockcurs ;second argument: pointer to message to write 4706 push byte blockcurslen ;third argument: message length 4707 SCB: pop edx 4708 call WriteFile0 4709 POP_ALL 4710 ret 4711 %endif 4712 ;---------------------------------------------------------------------- 4713 ; 4714 ; INTERFACE to OS kernel 4715 ; we differ between Linux, and and ... 4716 ; 4717 %ifndef W32 4718 00001A59 BA[AD2E0000] IOctlTerminal0:mov edx,termios_orig 4719 00001A5E BB00000000 IOctlTerminal:mov ebx,stdin ;expects EDX termios or winsize structure ptr 4720 %ifdef LIBC 4721 push edx 4722 push ecx 4723 push ebx 4724 call ioctl 4725 mov ebx,[_errno] 4726 mov [ErrNr],ebx 4727 pop ebx 4728 pop ecx 4729 pop edx 4730 or eax,eax 4731 ret 4732 %else 4733 00001A63 B036 mov al,SYS_ioctl 4734 00001A65 EB58 jmp short IntCall ;ECX TCSETS,TCGETS,TIOCGWINSZ 4735 %endif 4736 %endif 4737 ;------ 4738 ReadFile0: 4739 %ifdef W32 4740 ;all API: 4741 ;- direction flag is cleared before and after call 4742 ;- preserves ebx,esi,edi,ebp 4743 PUSH_ALL 4744 push dword 0xFFFFFFFF 4745 push dword [hin] 4746 call WaitForSingleObject 4747 POP_ALL 4748 %ifdef W32_EXTENDED_IO 4749 push ecx ;destr 4750 push edx ;destr 4751 push dword w32result 4752 push byte 1 4753 push ecx 4754 push dword [hin] 4755 call ReadConsoleInputA 4756 pop edx 4757 pop ecx 4758 ;------- 4759 mov ebx,dword [ecx] 4760 cmp bl,1 ;is it a key_event? 4761 jnz ReadFile0 ;no, read new 4762 mov ebx,dword [ecx+4] 4763 cmp ebx,1 ;is it a keydown event? 4764 jnz ReadFile0 ;no, read new 4765 ;PUSH_ALL 4766 ;push dword [hin] 4767 ;call FlushConsoleInputBuffer 4768 ;POP_ALL 4769 ;------- 4770 mov ebx,dword [ecx+8] ;virtual key code 4771 shr ebx,16 4772 ;------- 4773 cmp ebx,dword VK_SPACE 4774 jnz Normal0 4775 test dword [ecx+16],CTRL_PRESSED 4776 jz Normal0 4777 mov dword[ecx],0FF00h ;return ascii 00 for EMACS ^SPACE key 4778 ret 4779 Normal0:cmp ebx,dword VK_DELETE 4780 ja Normal1 4781 cmp ebx,dword VK_PRIOR 4782 jb Normal1 4783 ;------- 4784 sub bl,VK_PRIOR ;found a cursor key 4785 mov al,bl 4786 mov ebx,ScanTable 4787 xlatb ;translate to terminal value... 4788 cmp al,DoNo ;...in results 0..9 4789 ReadF0: jz ReadFile0 4790 mov ah,0xFE ;marker for a pre-processed cursor key 4791 mov [ecx],eax 4792 ret 4793 ;------- 4794 Normal1:mov ebx,dword [ecx+12] ;get ascii char value 4795 shr ebx,16 4796 or bl,bl 4797 jz ReadF0 ;no useful ascii char pressed 4798 mov bh,0xFF 4799 and dword [ecx+16],LEFT_ALT_PRESSED ;controlkeystate: left ALT key pressed 4800 jz Normal2 4801 mov bh,0xFD ;marker for a pre-processed ALT key 4802 Normal2:mov dword[ecx],ebx 4803 ret 4804 %else ;this way simple input via ReadFile 4805 mov ebx,[hin] 4806 %endif 4807 %else 4808 00001A67 31DB xor ebx,ebx ;mov ebx,stdin ;file desc 4809 %endif 4810 Read_File: 4811 %ifdef W32 4812 push ecx ;destr 4813 push edx ;destr 4814 push byte 0 4815 push dword w32result 4816 push edx ;length 4817 push ecx ;buffer 4818 push ebx ;handle 4819 call ReadFile 4820 pop edx 4821 pop ecx 4822 ;------- 4823 or eax,eax 4824 jnz ReadFileOkay 4825 call GetLastError 4826 mov [ErrNr],eax 4827 neg eax 4828 ret 4829 ReadFileOkay: 4830 mov eax,[w32result] 4831 or eax,eax ;clear sign flag 4832 ret 4833 %else 4834 %ifdef BEOS 4835 push byte SYS_read ;4+X? stack places 4836 jmp short WFile 4837 %else 4838 %ifdef LIBC 4839 push edx 4840 push ecx 4841 push ebx 4842 call read 4843 mov ebx,[_errno] 4844 mov [ErrNr],ebx 4845 pop ebx 4846 pop ecx 4847 pop edx 4848 or eax,eax 4849 ret 4850 %else 4851 00001A69 B003 mov al,SYS_read ;system call number (sys_read) ;return read byte EAX 4852 00001A6B EB52 jmp short IntCall ;ebx file / ecx buffer / edx count byte 4853 %endif 4854 %endif 4855 %endif 4856 ;------- 4857 00001A6D 31D2 WriteFile00:xor edx,edx 4858 00001A6F 42 inc edx ;mov edx,1 write 1 byte 4859 WriteFile0: 4860 %ifdef W32 4861 mov ebx,[hout] 4862 %else 4863 00001A70 31DB xor ebx,ebx ;mov ebx,stdout ;file desc 4864 00001A72 43 inc ebx ;ditto 4865 %endif 4866 Write_File: 4867 %ifdef W32 4868 push edx ;destr 4869 push byte 0 4870 push dword w32result 4871 push edx 4872 push ecx ;buffer 4873 push ebx ;handle 4874 call WriteFile 4875 pop edx 4876 or eax,eax 4877 jnz WriteFileOkay 4878 call GetLastError 4879 mov [ErrNr],eax 4880 neg eax 4881 ret 4882 WriteFileOkay: 4883 mov eax,[w32result] 4884 or eax,eax ;clr sign flag 4885 ret 4886 %else 4887 %ifdef BEOS 4888 push byte SYS_write 4889 WFile: pop eax 4890 call IntRdWr 4891 nop 4892 nop 4893 nop 4894 nop 4895 ret 4896 %else 4897 %ifdef LIBC 4898 push edx 4899 push ecx 4900 push ebx 4901 call write 4902 mov ebx,[_errno] 4903 mov [ErrNr],ebx 4904 pop ebx 4905 pop ecx 4906 pop edx 4907 or eax,eax 4908 ret 4909 %else 4910 00001A73 B004 mov al,SYS_write 4911 00001A75 EB48 jmp short IntCall 4912 %endif 4913 %endif 4914 %endif 4915 ;------- 4916 OpenFile0: 4917 %ifndef BEOS 4918 %ifdef W32 4919 mov ecx,OPEN_EXISTING 4920 mov edx,GENERIC_READ 4921 %else 4922 00001A77 31C9 xor ecx,ecx ;i.e O_RDONLY 4923 %endif 4924 %endif 4925 OpenFile: 4926 %ifdef W32 4927 push byte 0 4928 push dword FILE_ATTRIBUTE_NORMAL 4929 push ecx ;"CREATE_ALWAYS" or "OPEN_EXISTING" 4930 push byte 0 4931 push byte 0 4932 push edx ;"GENERIC_WRITE" or "GENERIC_READ" 4933 push ebx ;filename 4934 call CreateFileA 4935 cmp eax,INVALID_HANDLE_VALUE 4936 jnz OpenFileOkay 4937 call GetLastError 4938 mov [ErrNr],eax 4939 neg eax 4940 OpenFileOkay:ret 4941 %else 4942 %ifdef BEOS 4943 mov al,SYS_open ;5 stack places 4944 push edi 4945 mov edi,0x1A4 4946 call IntCall 4947 pop edi 4948 ret 4949 %else 4950 %ifdef LIBC 4951 push edx 4952 push ecx 4953 push ebx 4954 call open 4955 mov ebx,[_errno] 4956 mov [ErrNr],ebx 4957 pop ebx 4958 pop ecx 4959 pop edx 4960 or eax,eax 4961 ret 4962 %else 4963 00001A79 B005 mov al,SYS_open 4964 00001A7B EB42 jmp short IntCall ;ecx mode / ebx path / edx permissions (if create) 4965 %endif 4966 %endif 4967 %endif 4968 ;------- 4969 CloseFile: 4970 %ifdef W32 4971 push edx ;destr 4972 push ecx ;destr 4973 push ebx ;handle 4974 call CloseHandle 4975 pop ecx 4976 pop edx 4977 ret 4978 %else 4979 %ifdef LIBC 4980 push edx ;destr 4981 push ecx ;destr 4982 push ebx 4983 call close 4984 mov ebx,[_errno] 4985 mov [ErrNr],ebx 4986 pop ebx 4987 pop ecx 4988 pop edx 4989 or eax,eax 4990 ret 4991 %else 4992 00001A7D B006 mov al,SYS_close 4993 00001A7F EB3E jmp short IntCall ;ebx is file desc 4994 %endif 4995 %endif 4996 ;------- 4997 %ifdef SYS_readlink 4998 00001A81 B03A ReadLink:mov al,SYS_readlink 4999 00001A83 EB3A jmp short IntCall 5000 %endif 5001 ;------- 5002 %ifdef SYS_fchmod 5003 Fchmod: 5004 %ifdef LIBC 5005 push ecx 5006 push ebx 5007 call fchmod 5008 mov ebx,[_errno] 5009 mov [ErrNr],ebx 5010 pop ebx 5011 pop ecx 5012 or eax,eax 5013 ret 5014 %else 5015 00001A85 B07C mov al,SYS_fchmod 5016 00001A87 EB36 jmp short IntCall 5017 %endif 5018 %endif 5019 ;------- 5020 %ifdef SYS_fstat 5021 00001A89 B9[FE360100] Fstat: mov ecx,fstatbuf 5022 %ifdef LIBC 5023 push ecx 5024 push ebx 5025 call fstat 5026 mov ebx,[_errno] 5027 mov [ErrNr],ebx 5028 pop ebx 5029 pop ecx 5030 or eax,eax 5031 ret 5032 %else 5033 %ifdef FREEBSD ;includes NET-BSD 5034 00001A8E 66B81701 mov ax,SYS_fstat 5035 00001A92 EB2D jmp short IntCall2 5036 %else 5037 mov al,SYS_fstat 5038 jmp short IntCall 5039 %endif 5040 %endif 5041 ;------- 5042 ChownFile: 5043 %ifdef LIBC 5044 push edx 5045 push ecx 5046 push ebx 5047 call fchown 5048 mov ebx,[_errno] 5049 mov [ErrNr],ebx 5050 pop ebx 5051 pop ecx 5052 pop edx 5053 or eax,eax 5054 ret 5055 %else 5056 00001A94 B07B mov al,SYS_fchown 5057 00001A96 EB27 jmp short IntCall 5058 %endif 5059 %endif ;endifdef SYS_fstat 5060 ;------- 5061 RenameFile: 5062 %ifdef W32 5063 push ebx ;destr 5064 push ecx ;destr 5065 push ecx ;for MoveFile 5066 push ecx 5067 call DeleteFileA 5068 push ebx 5069 call MoveFileA 5070 pop ecx 5071 pop ebx 5072 or eax,eax 5073 jnz RenameFileOkay 5074 call GetLastError 5075 mov [ErrNr],eax 5076 neg eax 5077 ret 5078 RenameFileOkay: 5079 xor eax,eax 5080 ret 5081 %else 5082 %ifdef LIBC 5083 push ecx 5084 push ebx 5085 call rename 5086 mov ebx,[_errno] 5087 mov [ErrNr],ebx 5088 pop ebx 5089 pop ecx 5090 or eax,eax 5091 ret 5092 %else 5093 00001A98 B080 mov al,SYS_rename 5094 00001A9A EB23 jmp short IntCall 5095 %endif 5096 %endif 5097 ;------- 5098 %ifdef SYS_brk 5099 SysBrk: mov al,SYS_brk 5100 jmp short IntCall ;ebx addr 5101 %endif 5102 ;------- 5103 %ifndef W32 5104 00001A9C 31DB Exit: xor ebx,ebx 5105 Exit2: 5106 %ifdef LIBC 5107 push ebx 5108 call _exit 5109 %else 5110 00001A9E B001 mov al,SYS_exit 5111 00001AA0 EB1D jmp short IntCall 5112 %endif 5113 %endif 5114 ;------- 5115 00001AA2 31C9 SeekFile:xor ecx,ecx ;ecx offset / ebx file / edx method 5116 %ifdef W32 5117 push edx 5118 push byte 0 5119 push ecx 5120 push ebx 5121 call SetFilePointer 5122 cmp eax,0xFFFFFFFF 5123 jnz SeekFileOkay 5124 call GetLastError 5125 mov [ErrNr],eax 5126 neg eax 5127 SeekFileOkay:ret 5128 %else 5129 %ifdef FREEBSD ;31 October 2005: 64 bit offset initial for *BSD 5130 00001AA4 57 push edi ;ebx=fh/ecx=dummy/edx,esi=offset/edi=where 5131 00001AA5 56 push esi 5132 00001AA6 31F6 xor esi,esi 5133 00001AA8 31FF xor edi,edi 5134 00001AAA 87D7 xchg edx,edi 5135 00001AAC B0C7 mov al,SYS_lseek 5136 00001AAE E80C000000 call IntCall 5137 00001AB3 F7D8 neg eax 5138 00001AB5 A3[6E2F0100] mov [ErrNr],eax 5139 00001ABA F7D8 neg eax ;set flags also 5140 00001ABC 5E pop esi 5141 00001ABD 5F pop edi 5142 00001ABE C3 ret 5143 %else 5144 %ifdef BEOS 5145 mov al,SYS_lseek ;4 stack places (using 64 bit for ptr) 5146 push edi 5147 push edx 5148 mov edi,edx 5149 xor edx,edx 5150 call IntCall 5151 pop edx 5152 pop edi 5153 ret 5154 %else 5155 %ifdef LIBC 5156 push edx 5157 %ifdef OPENBSD 5158 push byte 0 5159 %endif 5160 push ecx 5161 push ebx 5162 call lseek 5163 mov ebx,[_errno] 5164 mov [ErrNr],ebx 5165 pop ebx 5166 pop ecx 5167 %ifdef OPENBSD 5168 pop edx 5169 %endif 5170 pop edx 5171 or eax,eax 5172 ret 5173 %else 5174 mov al,SYS_lseek ;oldseek =32bit 5175 %endif 5176 %endif 5177 %endif 5178 %endif 5179 ;------- 5180 %ifndef LIBC 5181 %ifndef W32 5182 00001ABF B400 IntCall:mov ah,0 5183 00001AC1 98 IntCall2:cwde 5184 %ifdef BEOS 5185 push edi 5186 push byte 0 5187 push edi 5188 push edx 5189 push ecx 5190 push ebx 5191 push dword be_ret 5192 int 25h 5193 be_ret: pop ebx 5194 pop ebx 5195 pop ecx 5196 pop edx 5197 pop edi 5198 pop edi 5199 mov [ErrNr],eax 5200 and dword [ErrNr],7Fh 5201 or eax,eax ;set flags also 5202 pop edi 5203 %else 5204 %ifdef ATHEOS 5205 int 80h 5206 cmp eax,0xFFFFF001 5207 jae Fru 5208 or eax,eax 5209 ret 5210 Fru: neg eax 5211 mov [ErrNr],eax 5212 and dword [ErrNr],7Fh 5213 neg eax ;set flags also 5214 ret 5215 %else 5216 %ifdef LINUX 5217 %ifdef AMD64 5218 push rbx 5219 push rcx 5220 push rsi 5221 push rdi 5222 xchg rbx,rdi 5223 xchg rcx,rsi 5224 xchg rbx,r8 5225 mov r10,rcx ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5226 syscall 5227 pop rdi 5228 pop rsi 5229 pop rcx 5230 pop rbx 5231 %else 5232 int 80h 5233 %endif 5234 %else 5235 00001AC2 57 push edi 5236 00001AC3 56 push esi 5237 00001AC4 52 push edx 5238 00001AC5 51 push ecx 5239 00001AC6 53 push ebx 5240 %ifdef NETBSD 5241 push dword nbsdint 5242 %else 5243 00001AC7 50 push eax 5244 %endif 5245 00001AC8 CD80 int 80h 5246 nbsdint: 5247 00001ACA 5B pop ebx 5248 00001ACB 5B pop ebx 5249 00001ACC 59 pop ecx 5250 00001ACD 5A pop edx 5251 00001ACE 5E pop esi 5252 00001ACF 5F pop edi 5253 00001AD0 7202 jc err 5254 %endif 5255 00001AD2 F7D8 AfterInt:neg eax 5256 00001AD4 A3[6E2F0100] err: mov [ErrNr],eax 5257 00001AD9 F7D8 neg eax ;set flags also 5258 %endif 5259 %endif 5260 00001ADB C3 ret 5261 %endif 5262 %endif 5263 ;------- 5264 %ifdef BEOS 5265 IntRdWr:push edx ;used for Read & Write 5266 push ecx 5267 push ebx 5268 push dword be_ret2 5269 int 25h 5270 be_ret2:pop ebx 5271 pop ebx 5272 pop ecx 5273 pop edx 5274 mov [ErrNr],eax 5275 pop eax 5276 lea eax,[eax+4] ;add eax,4 5277 push eax 5278 mov eax,[ErrNr] 5279 and dword [ErrNr],7Fh 5280 or eax,eax ;set flags 5281 ret 5282 %endif 5283 ;-------------------------------------------------------------------------- 5284 %ifdef SYS_select 5285 %ifdef LIBC 5286 Select: push dword timevalsec 5287 xor ebx,ebx 5288 push ebx 5289 push ebx 5290 mov ecx,readfds 5291 push ecx 5292 inc ebx 5293 mov byte [ecx],bl 5294 push ebx 5295 call select 5296 push ebx 5297 mov ebx,[_errno] 5298 mov [ErrNr],ebx 5299 pop ebx 5300 add esp,20 5301 or eax,eax 5302 ret 5303 %else 5304 00001ADC 31DB Select: xor ebx,ebx 5305 00001ADE 43 inc ebx 5306 00001ADF B9[E2380100] mov ecx,readfds 5307 00001AE4 8819 mov byte [ecx],bl 5308 00001AE6 31D2 xor edx,edx 5309 00001AE8 31F6 xor esi,esi 5310 00001AEA BF[E6380100] mov edi,timevalsec ;points to [0 sec / 0 usec] 5311 00001AEF B05D mov al,SYS_select 5312 00001AF1 EBCC jmp short IntCall 5313 %endif 5314 %endif 5315 ;----------------------------------------------------------------------- 5316 %ifdef SYS_readlink 5317 00001AF3 B08A Utime: mov al,SYS_utime 5318 00001AF5 EBC8 jmp short IntCall 5319 %endif 5320 ;------- 5321 %ifdef USE_PIPE 5322 00001AF7 B002 Fork: mov al,SYS_fork 5323 00001AF9 EBC4 jmp short IntCall 5324 ;------- 5325 Pipe: 5326 %ifdef FREEBSD 5327 00001AFB B82A000000 mov eax,SYS_pipe 5328 00001B00 57 push edi 5329 00001B01 56 push esi 5330 00001B02 51 push ecx 5331 00001B03 53 push ebx 5332 00001B04 CD80 int 80h 5333 00001B06 5B pop ebx 5334 00001B07 59 pop ecx 5335 00001B08 5E pop esi 5336 00001B09 5F pop edi 5337 00001B0A 8903 mov [ebx],eax 5338 00001B0C 895304 mov [ebx+4],edx 5339 00001B0F EBC1 jmp short AfterInt 5340 %else 5341 mov al,SYS_pipe 5342 jmp short IntCall 5343 %endif 5344 ;------- 5345 00001B11 B05A Dup2: mov al,SYS_dup2 5346 00001B13 EBAA jmp short IntCall 5347 ;------- 5348 00001B15 B03B Execve: mov al,SYS_execve 5349 00001B17 EBA6 jmp short IntCall 5350 ;------- 5351 00001B19 B007 Wait4: mov al,SYS_wait4 ;set ecx to buffer! 5352 %ifdef AMD64 5353 xor rbx,rbx 5354 dec rbx 5355 %else 5356 00001B1B 31DB xor ebx,ebx 5357 00001B1D 4B dec ebx 5358 %endif 5359 00001B1E 31D2 xor edx,edx 5360 00001B20 31F6 xor esi,esi 5361 00001B22 EB9B jmp short IntCall 5362 ;------- 5363 %endif 5364 Unlink: 5365 %ifdef W32 5366 push edx 5367 push ecx 5368 push ebx 5369 call DeleteFileA 5370 pop ebx 5371 pop ecx 5372 pop edx 5373 ret 5374 %else 5375 %ifdef LIBC 5376 push edx 5377 push ecx 5378 push ebx 5379 call unlink 5380 mov ebx,[_errno] 5381 mov [ErrNr],ebx 5382 pop ebx 5383 pop ecx 5384 pop edx 5385 or eax,eax 5386 ret 5387 %else 5388 %ifdef BEOS 5389 mov ecx,ebx 5390 %endif 5391 00001B24 B00A mov al,SYS_unlink 5392 00001B26 EB97 jmp short IntCall ;ebx is file desc 5393 %endif 5394 %endif 5395 ;---------------------------------------------------------------------- 5396 %ifdef SYS_kill 5397 00001B28 E858F6FFFF KeySuspend:call KursorStatusLine ;simply looks better so 5398 00001B2D 6A11 push byte SIGSTOP 5399 00001B2F 59 pop ecx 5400 00001B30 31DB xor ebx,ebx 5401 00001B32 B025 Kill: mov al,SYS_kill 5402 00001B34 EB89 ICjmp: jmp short IntCall 5403 ;------- 5404 SetSigHandler: 5405 00001B36 6A13 push byte SIGCONT 5406 00001B38 5B pop ebx 5407 00001B39 B9[5A360100] mov ecx,sigaction 5408 %ifdef AMD64 5409 mov rdx,qword SigHandler 5410 mov qword [rcx],rdx 5411 mov qword [rcx+8],4000000h ;flags @ 8 5412 mov rdx,qword SigRestorer 5413 mov qword [rcx+16],rdx ;restorer @ 16 5414 xor edx,edx 5415 mov esi,8 5416 mov al,SYS_rt_sigaction 5417 jmp short ICjmp 5418 ;------- 5419 SigRestorer:mov eax,SYS_rt_sigreturn 5420 syscall ;thanks to Andi Kleen for info 5421 %else 5422 00001B3E C701[1D1A0000] mov [ecx],dword SigHandler 5423 00001B44 31D2 xor edx,edx 5424 %ifdef SIGREST32 ;just like on AMD-64 would be: 5425 mov dword [ecx+8],4000000h 5426 mov [ecx+12],dword SigRestorer32 5427 %endif 5428 00001B46 B056 Sigaction:mov al,SYS_sigaction 5429 00001B48 EBEA jmp short ICjmp 5430 ;------- 5431 %ifdef SIGREST32 5432 SigRestorer32:pop eax 5433 mov eax,119 ;sigreturn 5434 int 80h ;syscall 5435 %endif 5436 %endif 5437 %endif 5438 ;----------------------------------------------------------------------- 5439 ; 5440 ; pipe buffer through child process 5441 ; 5442 %ifdef USE_PIPE 5443 00001B4A E861F1FFFF KeyCtrlKP:call InputStringWithMessage0 ;WS, Emacs's, Pico's access to sed|ex pipe 5444 00001B4F 9C pushf 5445 00001B50 E83AF6FFFF call RestKursPos 5446 00001B55 9D popf 5447 00001B56 721E jc ExExEx 5448 00001B58 E823F4FFFF KeyVICmdtemp:call CheckENum ;i.e. mov byte [numeriere],1 5449 PUSH_ALL 5450 00001B5D 60 <1> pusha 5451 00001B5E BB[F2200000] mov ebx,tempfile 5452 00001B63 BE[2B3D0100] mov esi,sot 5453 00001B68 892D[2E2F0100] mov [blockende],ebp 5454 00001B6E E83CFAFFFF call SaveBl3 5455 POP_ALL 5456 00001B73 61 <1> popa 5457 00001B74 7301 jnc SaveOK 5458 00001B76 C3 ExExEx: ret ;cannot save buffer to tmp file... 5459 SaveOK: ;...this is handled inside SaveBlock, so just return 5460 %ifdef USE_UNDO 5461 00001B77 31C0 xor eax,eax 5462 00001B79 48 dec eax 5463 00001B7A E8CC030000 call DataForUndoDelete 5464 %endif 5465 %ifdef CAPTURE_STDERR 5466 mov ebx,sedpipeC0 5467 call Pipe 5468 js OSerrJmp0 5469 %endif 5470 00001B7F BB[CE380100] mov ebx,sedpipeB0 5471 00001B84 E872FFFFFF call Pipe 5472 00001B89 7818 js OSerrJmp0 5473 00001B8B E867FFFFFF call Fork 5474 00001B90 7811 js OSerrJmp0 5475 00001B92 09C0 or eax,eax 5476 00001B94 0F848D000000 jz near ForkChild 5477 ;------- 5478 %ifdef USE_EX_NO_SED 5479 ; 5480 ; This is the UNDEFAULT way using "ex -s" (silent ex). 5481 ; We save the buffer into a tempfile and 5482 ; WRITE the COMMAND (followed by 'wq' command) 5483 ; into a pipe to ex's STDIN. 5484 ; Then we truncate the current edit buffer 5485 ; and read the tempfile just like a WS block. 5486 ; 5487 ; "Anything you want, you got it" 5488 ; "Anything you need, you got it" 5489 ; "Anything at all, you got it, Baby ...." (Jeff Lynne/Roy Orbison/Tom Petty 1989) 5490 ; 5491 mov ebx,[ebx] ;i.e. sedpipeB0 5492 call CloseFile ;unused pipe direction READ 5493 OSerrJmp0:js OSerrJmp1 5494 mov ebx,[sedpipeB1] 5495 ;------- 5496 xor edx,edx 5497 mov ecx,optbuffer 5498 mov esi,ecx 5499 cld 5500 dec edx 5501 Bufloop:inc edx 5502 lodsb 5503 or al,al 5504 jnz Bufloop ;count ex cmd length 5505 call Write_File ;write to ex program 5506 ;------- 5507 mov ecx,wq_suffix 5508 mov edx,wq_suffix_len 5509 call Write_File ;write "wq" string to ex program 5510 call CloseFile 5511 OSerrJmp1:js OSerrJmp 5512 mov ecx,optbuffer ;for return status 5513 push ecx ;new in e3 2.6.1 (needed in Linux 2.6.8-24.10) 5514 push edi 5515 call Wait4 5516 pop edi 5517 pop ecx 5518 js OSerrJmp 5519 mov ecx,[ecx] ;getting return status 5520 shr ecx,8 5521 and ecx,0xFF 5522 mov [ErrNr],ecx 5523 jnz OSerrJmp 5524 ;------- 5525 mov ebx,tempfile 5526 push ebp 5527 push edi 5528 mov edi,sot ;truncate old file 5529 mov ebp,sot 5530 mov al,LINEFEED 5531 xchg byte [ebp],al ;EOF marker 5532 push eax 5533 call ReadBlock2 5534 pop eax 5535 pop edi 5536 jc preEx_Ex 5537 pop ebx ;dummy (not restore ebp) 5538 ;------- 5539 mov ebx,tempfile 5540 call Unlink 5541 jns ChkCursPos ;if no Error 5542 ;------- 5543 OSerrJmp:call ChkCursPos ;Error in Wait,Close,... 5544 jmp near OSerror ;TODO: unlink helper file if exists 5545 preEx_Ex:pop ebp ;Error in ReadBlock 5546 mov byte[sot],al ;restore pre op values if Read Error 5547 ;continue ChkCursPos 5548 ; 5549 %else ;------------------ DEFAULT WAY ------------------- 5550 ; 5551 ; This is the DEFAULT way using stream editor "sed -e". 5552 ; The default way is quite opposite: we save the buffer 5553 ; into a tempfile, then call sed with the operational command 5554 ; given on sed's command line and at last we READ the DATA 5555 ; from sed's output via a STDIN READ pipe. 5556 ; 5557 00001B9A 53 push ebx 5558 00001B9B 8B5B04 mov ebx,[ebx+4] ;i.e. sedpipeB1 5559 00001B9E E8DAFEFFFF call CloseFile ;unused pipe direction 5560 %ifdef CAPTURE_STDERR 5561 mov ebx,[sedpipeC1] 5562 call CloseFile ;unused pipe direction 5563 %endif 5564 00001BA3 7849 OSerrJmp0:js OSerrJmp1 5565 00001BA5 5B pop ebx 5566 00001BA6 8B35[D62F0100] mov esi,[maxlen] 5567 00001BAC 8B1B mov ebx,[ebx] ;pipe read channel 5568 00001BAE B9[2B2D0100] mov ecx,sot-SEDBLOCK 5569 00001BB3 01CE add esi,ecx 5570 00001BB5 55 push ebp 5571 00001BB6 BD[2B3D0100] mov ebp,sot 5572 00001BBB 31C0 xor eax,eax 5573 00001BBD E840FCFFFF call InitSV1 ;forbid any side efects 5574 00001BC2 BA00100000 ReadPipe:mov edx,SEDBLOCK 5575 00001BC7 01D1 add ecx,edx 5576 00001BC9 E89BFEFFFF call Read_File 5577 00001BCE 01C5 add ebp,eax ;compute eof 5578 00001BD0 39F5 cmp ebp,esi 5579 00001BD2 7310 jae ReadOK ;sorry, truncating. FIXME: add a message 5580 00001BD4 39D0 cmp eax,edx 5581 00001BD6 74EA jz ReadPipe 5582 00001BD8 81FD[2B3D0100] cmp ebp,sot ;if nothing comes back, keep buffer as is 5583 00001BDE 7504 jnz ReadOK 5584 00001BE0 5A pop edx 5585 00001BE1 89D5 mov ebp,edx 5586 00001BE3 56 push esi ;keep stack balanced 5587 00001BE4 C645000A ReadOK: mov byte [ebp],NEWLINE ;EOF marker 5588 00001BE8 5E pop esi ;dummy 5589 00001BE9 E88FFEFFFF call CloseFile 5590 00001BEE 782D OSerrJmp1:js OSerrJmp 5591 %ifdef CAPTURE_STDERR 5592 mov ebx,[sedpipeC0] 5593 %ifdef BEEP_IN_VI 5594 mov ecx,buffercopy 5595 xor edx,edx 5596 inc edx 5597 call Read_File 5598 or eax,eax 5599 je NoStdErrMsg 5600 call VIBeepForD 5601 %endif 5602 NoStdErrMsg:call CloseFile ;stderr pipe 5603 %endif 5604 00001BF0 E83EE5FFFF call SetChg ;i.e. mov byte [changed],CHANGED (assumption only) 5605 00001BF5 B9[DA350100] mov ecx,optbuffer ;for return status 5606 00001BFA 51 push ecx ;new in e3 2.6.1 (needed in Linux 2.6.8-24.10) 5607 00001BFB 57 push edi 5608 00001BFC E818FFFFFF call Wait4 5609 00001C01 5F pop edi 5610 00001C02 59 pop ecx ;ditto new in e3 2.6.1 5611 00001C03 7818 js OSerrJmp 5612 00001C05 BB[F2200000] mov ebx,tempfile 5613 00001C0A E815FFFFFF call Unlink 5614 00001C0F 780C js OSerrJmp 5615 00001C11 0FB64901 movzx ecx,byte[ecx+1] ;old shr ecx,8 / and ecx,0xFF 5616 00001C15 890D[6E2F0100] mov [ErrNr],ecx 5617 00001C1B E344 jecxz ChkCursPos 5618 00001C1D E83F000000 OSerrJmp:call ChkCursPos ;TODO: unlink helper file if exists 5619 00001C22 E9F1F9FFFF jmp near OSerror 5620 %endif 5621 ;---------------------------------------------------------------------- 5622 00001C27 8B1B ForkChild:mov ebx,[ebx] ;i.e. sedpipeB0 5623 00001C29 31C9 xor ecx,ecx 5624 %ifdef USE_EX_NO_SED 5625 call Dup2 ;capturing STDIN 5626 js FCError 5627 mov ebx,[sedpipeB1] 5628 call CloseFile ;unused pipe direction STDOUT 5629 js FCError 5630 mov ebx,expath 5631 mov ecx,exargs 5632 %else 5633 00001C2B E84DFEFFFF call CloseFile ;unused pipe direction STDIN 5634 00001C30 7827 js FCError 5635 00001C32 8B1D[D2380100] mov ebx,[sedpipeB1] 5636 00001C38 41 inc ecx 5637 00001C39 E8D3FEFFFF call Dup2 ;capturing STDOUT 5638 00001C3E 7819 js FCError 5639 %ifdef CAPTURE_STDERR 5640 mov ebx,[sedpipeC0] 5641 call CloseFile ;unused pipe direction 5642 inc ecx 5643 mov ebx,[sedpipeC1] 5644 call Dup2 ;capturing STDERR 5645 js FCError 5646 %endif 5647 00001C40 BB[0B210000] mov ebx,sedpath 5648 00001C45 B9[F7200000] mov ecx,sedargs 5649 %endif 5650 00001C4A 31D2 xor edx,edx ;no env 5651 00001C4C E8C4FEFFFF call Execve 5652 00001C51 6A1F push byte ERRNOEXEC 5653 00001C53 5B pop ebx ;set error 5654 00001C54 E945FEFFFF FCex: jmp near Exit2 ;in case of error 5655 00001C59 8B1D[6E2F0100] FCError:mov ebx,[ErrNr] 5656 00001C5F EBF3 jmp short FCex 5657 %endif ;USE_PIPE 5658 ;---------------------------------------------------------------------- 5659 ; 5660 ; care about cursor pos 5661 ; 5662 ChkCursPos: 5663 %ifdef UTF8 5664 inc edi 5665 CCloopUTF8:dec edi 5666 %ifdef UTF8RTS 5667 cmp byte [isUTF8],0 5668 je noUTF_Z 5669 %endif 5670 mov al,byte [edi] 5671 and al,0C0h 5672 cmp al,080h 5673 je CCloopUTF8 5674 noUTF_Z: 5675 %endif 5676 00001C61 39EF cmp edi,ebp ;never let run cursor outside buffer 5677 00001C63 7602 jbe CCP 5678 00001C65 89EF mov edi,ebp 5679 00001C67 81FF[2B3D0100] CCP: cmp edi,sot 5680 00001C6D 7305 jae CCP2 5681 00001C6F BF[2B3D0100] mov edi,sot 5682 00001C74 C3 CCP2: ret 5683 ;---------------------------------------------------------------------- 5684 ; 5685 ; copy file to a real backup file (for sym linked files only) 5686 ; 5687 ; expecting ebx==filepath 5688 ; ecx==bakpath 5689 ; 5690 %ifdef SYS_readlink 5691 CopyToBackup:PUSH_ALL 5692 <1> CopyToBackup: 5693 00001C75 60 <1> pusha 5694 00001C76 51 push ecx ;backup file path later needed for Utime call 5695 00001C77 51 push ecx 5696 00001C78 E8FAFDFFFF call OpenFile0 5697 00001C7D 96 xchg esi,eax ;save handle to copy of original file 5698 00001C7E B901060000 mov ecx,O_WRONLY_CREAT_TRUNC 5699 00001C83 8B15[FA360100] mov edx,[perms] 5700 00001C89 5B pop ebx ;handle to backupfile 5701 00001C8A E8EAFDFFFF call OpenFile 5702 00001C8F 93 xchg ebx,eax 5703 00001C90 8B0D[0E370100] mov ecx,[fstatbuf+stat_struc.st_uid] 5704 %ifdef UIDGID_WORD ;Linux special 5705 mov edx,ecx 5706 shr edx,16 5707 movzx ecx,cx ;OLD and ecx,0xffff 5708 %else 5709 00001C96 8B15[12370100] mov edx,[fstatbuf+stat_struc.st_gid] 5710 %endif 5711 00001C9C E8F3FDFFFF call ChownFile 5712 ;------- 5713 00001CA1 31FF xor edi,edi ;init eof indicator 5714 00001CA3 53 copylop:push ebx 5715 00001CA4 89F3 mov ebx,esi ;saved orig file handle 5716 00001CA6 B9[00000000] mov ecx,screenbuffer ;used as copy buffer 5717 00001CAB BA00100000 mov edx,4096 5718 00001CB0 E8B4FDFFFF call Read_File 5719 00001CB5 5B pop ebx ;backup file handle 5720 ;js... 5721 00001CB6 39D0 cmp eax,edx 5722 00001CB8 7401 jz notready 5723 00001CBA 47 inc edi ;eof found 5724 00001CBB B9[00000000] notready:mov ecx,screenbuffer 5725 00001CC0 89C2 mov edx,eax ;write read count of byte 5726 00001CC2 E8ACFDFFFF call Write_File 5727 ;js... 5728 00001CC7 09FF or edi,edi ;eof ? 5729 00001CC9 74D8 jz copylop 5730 ;------- 5731 00001CCB E8ADFDFFFF call CloseFile ;ready: close backup file 5732 00001CD0 89F3 mov ebx,esi 5733 00001CD2 E8A6FDFFFF call CloseFile ;close original file 5734 00001CD7 5B pop ebx ;original file path 5735 00001CD8 B9[62370100] mov ecx,accesstime ;i.e. a data structure of 2* 32 bit 5736 00001CDD E811FEFFFF call Utime ;set change time 5737 POP_ALL 5738 00001CE2 61 <1> popa 5739 00001CE3 C3 ret 5740 %endif 5741 ;---------------------------------------------------------------------- 5742 ; recursive descent parser for very SIMPLE math calc within the text: 5743 ; 1234+56*78= 5744 ; place cursor ^<--here and press ^KN ^QC ^XN # ^K 5745 ; (for one of WS PI EM VI NE modes) 5746 ; this should insert the result of 5602 into text. 5747 ; 5748 ; Use values +-0, 0.000001 ,... up to 999999999999.999999 5749 ; and + - * / 5750 ; and ( ) 5751 ; and r (for using the last result in next calculation) 5752 ; and p =3.141593 5753 ; 5754 KeyCtrlKN: 5755 %ifdef USE_MATH 5756 00001CE4 FC cld ;preserve ebp,edi! 5757 00001CE5 DBE3 fninit 5758 00001CE7 89FE mov esi,edi 5759 00001CE9 8925[F63C0100] mov [stackptr],esp 5760 00001CEF 31C0 xor eax,eax 5761 00001CF1 A3[EE3C0100] mov [level],eax 5762 00001CF6 A3[F23C0100] mov [ptlevel],eax 5763 00001CFB E8C3000000 call Recurs0 5764 00001D00 DD3D[FA3C0100] fnstsw [x87] 5765 00001D06 8025[FA3C0100]1F and byte[x87],1Fh ;any exception flags? 5766 00001D0D 0F8599010000 GErr: jnz near isErr 5767 00001D13 FF0D[EE3C0100] dec dword[level] ;stack balanced? 5768 00001D19 75F2 jnz GErr 5769 00001D1B 31C0 xor eax,eax 5770 00001D1D 3B05[F23C0100] cmp eax,[ptlevel] ;all parenthesis closed? 5771 00001D23 75E8 jnz GErr 5772 00001D25 4E NoAllgFehl:dec esi 5773 00001D26 89F7 mov edi,esi ;up to here we have read 5774 00001D28 AC lodsb 5775 00001D29 3C3D cmp al,'=' 5776 00001D2B 7408 jz EquChar 5777 00001D2D B03D mov al,'=' 5778 00001D2F E80A020000 call OutChar 5779 00001D34 4F dec edi 5780 00001D35 47 EquChar:inc edi 5781 00001D36 DD15[063D0100] fst qword[lastresult87] ;carry last result for further calc 5782 00001D3C DD05[E5200000] fld qword[factor] 5783 00001D42 DEC9 fmulp st1 5784 00001D44 DF35[FA3C0100] fbstp [x87] 5785 00001D4A 6A0C push byte 12 ;12 digits 5786 00001D4C 59 pop ecx 5787 00001D4D 30F6 xor dh,dh ;flag for suppressing leading 0 5788 00001D4F 8D35[033D0100] lea esi,[x87+9] ;9 BCD data byte and sign 5789 00001D55 FD std 5790 00001D56 AC lodsb 5791 00001D57 08C0 or al,al 5792 00001D59 790B jns plus 5793 00001D5B 3C80 cmp al,0x80 5794 00001D5D 75AE jnz GErr 5795 00001D5F B02D mov al,'-' 5796 00001D61 E8D8010000 call OutChar 5797 00001D66 E83D000000 plus: call OutHlp 5798 00001D6B 08F6 or dh,dh 5799 00001D6D 7507 jnz dec_dig 5800 00001D6F B030 mov al,'0' 5801 00001D71 E8C8010000 call OutChar 5802 ;------- 5803 00001D76 BE[FA3C0100] dec_dig:mov esi,x87 5804 00001D7B 31DB xor ebx,ebx 5805 00001D7D 6A03 push byte 3 5806 00001D7F 59 pop ecx 5807 00001D80 FC cld 5808 00001D81 AC dlop: lodsb 5809 00001D82 88C2 mov dl,al 5810 00001D84 240F and al,0fh 5811 00001D86 750C jnz nonull 5812 00001D88 43 inc ebx 5813 00001D89 88D0 mov al,dl 5814 00001D8B C0E804 shr al,4 5815 00001D8E 7504 jnz nonull 5816 00001D90 43 inc ebx 5817 00001D91 E2EE isnul2: loop dlop 5818 00001D93 C3 ret ;no decimal digits: ready 5819 ;------- 5820 00001D94 6A06 nonull: push byte 6 ;6 decimal digits 5821 00001D96 59 pop ecx 5822 00001D97 29D9 sub ecx,ebx 5823 00001D99 B6FF mov dh,0xff ;now do not suppress 0 5824 00001D9B B02E mov al,'.' 5825 00001D9D E89C010000 call OutChar 5826 00001DA2 8D35[FC3C0100] lea esi,[x87+2] ;decimal digits pos 5827 00001DA8 FD OutHlp: std 5828 00001DA9 AC lodsb 5829 00001DAA 88C2 mov dl,al 5830 00001DAC C0E804 shr al,4 5831 00001DAF E882010000 call OutNumber 5832 00001DB4 49 dec ecx 5833 00001DB5 E30B jecxz xret 5834 00001DB7 88D0 mov al,dl 5835 00001DB9 240F and al,0fh 5836 00001DBB E876010000 call OutNumber 5837 00001DC0 E2E6 loop OutHlp 5838 00001DC2 C3 xret: ret 5839 ;------- 5840 00001DC3 B02B Recurs0:mov al,'+' 5841 00001DC5 50 RecursPars:push eax ;op code 5842 00001DC6 C605[263D0100]00 mov byte[signctl],0 ;last token was an opcode 5843 00001DCD AC RecConti:lodsb 5844 00001DCE 3C0A cmp al,LINEFEED ;EOL? 5845 00001DD0 7406 jz short RRR ;jz RecReturn 5846 00001DD2 3C29 cmp al,')' 5847 00001DD4 7474 jz short RRet2 5848 00001DD6 3C3D cmp al,'=' ;end of task? 5849 00001DD8 7476 RRR: jz short RecReturn 5850 00001DDA 3C21 cmp al,'!' ;white space? 5851 00001DDC 72EF jb short RecConti 5852 00001DDE 803D[263D0100]00 cmp byte[signctl],0 ;last was opcode? 5853 00001DE5 7516 jnz short CheckNP ;sign is allowed after opcode only 5854 00001DE7 3C2B cmp al,'+' 5855 00001DE9 740A jz short rPlus 5856 00001DEB 3C2D cmp al,'-' 5857 00001DED 750E jnz short CheckNP 5858 00001DEF FE05[263D0100] inc byte[signctl] ;2 for minus 5859 00001DF5 FE05[263D0100] rPlus: inc byte[signctl] ;1 for plus 5860 00001DFB EBD0 jmp short RecConti ;continue 5861 5862 00001DFD FF35[263D0100] CheckNP:push dword [signctl] ;we need that for numbers and parenthesis 5863 00001E03 3C28 cmp al,'(' 5864 00001E05 750D jnz short CheckNum 5865 00001E07 FF05[F23C0100] inc dword[ptlevel] ;increase nesting level 5866 00001E0D E8B1FFFFFF call Recurs0 ;compute term instead of parse number 5867 00001E12 EB15 jmp short fromP 5868 00001E14 3C30 CheckNum:cmp al,'0' 5869 00001E16 724E jb short noNumber 5870 00001E18 3C72 cmp al,'r' ;last Result 5871 00001E1A 7436 jz short isLastRes 5872 00001E1C 3C70 cmp al,'p' ;pi 3.141593 5873 00001E1E 743A jz short isPi 5874 00001E20 3C39 cmp al,'9' 5875 00001E22 7740 ja short isErr2 5876 00001E24 E86F000000 call Number 5877 00001E29 58 fromP: pop eax ;signctl on stack 5878 00001E2A 3C02 cmp al,2 5879 00001E2C 7502 jnz short isPlus 5880 00001E2E D9E0 FCHS ;parenthesis or number is negative 5881 00001E30 C605[263D0100]01 isPlus: mov byte[signctl],1 ;last token was a number (or parenthesis) 5882 00001E37 8A0424 mov al,[esp] ;our opcode 5883 00001E3A 3C2B cmp al,'+' 5884 00001E3C 748F jz short RecConti 5885 00001E3E 3C2D cmp al,'-' 5886 00001E40 750E jnz short RecReturn 5887 00001E42 C604242B mov byte[esp],'+' ;adding negative value 5888 00001E46 D9E0 FCHS 5889 00001E48 EB83 RecCon2:jmp short RecConti 5890 ;------- 5891 00001E4A FF0D[F23C0100] RRet2: dec dword[ptlevel] 5892 00001E50 58 RecReturn:pop eax 5893 00001E51 C3 ret 5894 ;------- 5895 00001E52 DD05[063D0100] isLastRes:fld qword[lastresult87] 5896 00001E58 EB02 jmp short isPi2 5897 00001E5A D9EB isPi: fldpi 5898 00001E5C FF05[EE3C0100] isPi2: inc dword[level] 5899 00001E62 EBC5 jmp short fromP 5900 00001E64 EB46 isErr2: jmp short isErr 5901 ;------- 5902 00001E66 59 noNumber:pop ecx ;due above "push dword [signctl]" (we don't need it here) 5903 00001E67 8D6424F0 lea esp,[esp-16] 5904 00001E6B D91C24 fstp dword [esp] 5905 00001E6E E852FFFFFF call RecursPars 5906 00001E73 D90424 fld dword [esp] 5907 00001E76 8D642410 lea esp,[esp+16] 5908 00001E7A FF0D[EE3C0100] dec dword[level] 5909 00001E80 3C2A cmp al,'*' 5910 00001E82 7504 jnz noMul 5911 00001E84 DEC9 FMULP st1 5912 00001E86 EBC0 jmp short RecCon2 5913 00001E88 3C2F noMul: cmp al,'/' 5914 00001E8A 7504 jnz noDiv 5915 00001E8C DEF1 FDIVRP st1 5916 00001E8E EBB8 jmp short RecCon2 5917 00001E90 3C2B noDiv: cmp al,'+' 5918 00001E92 7518 jnz isErr ;not one of * / + 5919 00001E94 DEC1 FADDP st1 5920 00001E96 EBB8 jmp short RecReturn 5921 ;------- 5922 00001E98 D9EE Number: FLDZ 5923 00001E9A DF35[FA3C0100] FBSTP [x87] ;init buffer 5924 00001EA0 6A0C push byte 12 ;read 13 chars (up to 12 digits) 5925 00001EA2 59 pop ecx 5926 00001EA3 E885000000 num_ctr:call DigitHlp 5927 00001EA8 7215 jc int_end 5928 00001EAA E2F7 loop num_ctr ;error if >12 digits 5929 isErr: 5930 00001EAC 8B25[F63C0100] mov esp,[stackptr] ;restore stack pos for math calc 5931 %endif ;USE_MATH 5932 %ifdef BEEP_IN_VI 5933 VIBeepForD:PUSH_ALL 5934 <1> VIBeepForD: 5935 00001EB2 60 <1> pusha 5936 %ifdef W32 5937 push byte 0 5938 call MessageBeep 5939 %else 5940 00001EB3 B9[74240000] mov ecx,BeepChar 5941 00001EB8 E8B0FBFFFF call WriteFile00 5942 %endif 5943 POP_ALL 5944 00001EBD 61 <1> popa 5945 %endif 5946 00001EBE C3 ret 5947 ;------- 5948 %ifdef USE_MATH 5949 00001EBF 57 int_end:push edi ;**** 5950 00001EC0 F7D9 neg ecx 5951 00001EC2 8D490D lea ecx,[ecx+13] 5952 00001EC5 51 push ecx ;stor # of integer digits 5953 00001EC6 FF05[EE3C0100] inc dword[level] 5954 00001ECC 4E dec esi ;num_ctr loop has read 1 too much 5955 00001ECD 89F2 mov edx,esi ;position we have read so far 5956 00001ECF 3CFE cmp al,('.'-'0') 5957 00001ED1 7529 jnz integers 5958 00001ED3 46 inc esi 5959 00001ED4 8D3D[FC3C0100] lea edi,[x87+2] ;start of decimal places 5960 00001EDA B103 mov cl,3 ;6/2 decimal places 5961 00001EDC FC dec_ctr:cld 5962 00001EDD E84B000000 call DigitHlp 5963 00001EE2 7215 jc decend 5964 00001EE4 C0E004 shl al,4 5965 00001EE7 88C3 mov bl,al 5966 00001EE9 8807 mov [edi],al ;important if abort at digit 1,3,5 5967 00001EEB E83D000000 call DigitHlp 5968 00001EF0 7207 jc decend 5969 00001EF2 00D8 add al,bl 5970 00001EF4 FD std 5971 00001EF5 AA stosb 5972 00001EF6 E2E4 loop dec_ctr ;if >6 decimal places it will run into error later 5973 00001EF8 46 inc esi 5974 00001EF9 4E decend: dec esi 5975 00001EFA 87D6 xchg edx,esi ;edx where later to continue scanning 5976 ;------- 5977 00001EFC 59 integers:pop ecx ;ecx # of integer digits 5978 00001EFD 4E dec esi ;esi where integer places are 5979 00001EFE 8D3D[FD3C0100] lea edi,[x87+3] ;start of integer part 5980 00001F04 FD intloop:std 5981 00001F05 AC lodsb 5982 00001F06 2C30 sub al,'0' 5983 00001F08 88C3 mov bl,al 5984 00001F0A 49 dec ecx 5985 00001F0B E308 jecxz h2 5986 00001F0D AC lodsb 5987 00001F0E 2C30 sub al,'0' 5988 00001F10 C0E004 shl al,4 5989 00001F13 00D8 add al,bl 5990 00001F15 FC h2: cld 5991 00001F16 AA stosb 5992 00001F17 E302 jecxz h3 5993 00001F19 E2E9 loop intloop 5994 00001F1B DF25[FA3C0100] h3: FBLD [x87] 5995 00001F21 DD05[E5200000] FLD qword [factor] 5996 00001F27 DEF9 fdivp st1 5997 00001F29 89D6 mov esi,edx ;pointer for continued reading 5998 00001F2B 5F pop edi ;**** 5999 00001F2C C3 ret 6000 ;------- 6001 00001F2D AC DigitHlp:lodsb 6002 00001F2E 2C30 sub al,'0' 6003 00001F30 7203 jb dret 6004 00001F32 3C0A cmp al,10 6005 00001F34 F5 cmc 6006 00001F35 C3 dret: ret ;return: al=value / cy if error 6007 ;------- 6008 00001F36 38F0 OutNumber:cmp al,dh ;flag set? 6009 00001F38 7410 jz OCret 6010 00001F3A 0430 add al,'0' 6011 00001F3C B6FF mov dh,0xff ;set flag 6012 00001F3E 56 OutChar:push esi 6013 00001F3F 52 push edx 6014 00001F40 51 push ecx 6015 00001F41 E8C6E1FFFF call NormChar 6016 00001F46 59 pop ecx 6017 00001F47 5A pop edx 6018 00001F48 5E pop esi 6019 00001F49 43 inc ebx 6020 %endif 6021 00001F4A C3 OCret: ret 6022 ;---------------------------------------------------------------------- 6023 %ifdef USE_UNDO 6024 %define ROLLBACK 6025 %undef ROLLBACK 6026 ; Undo is organized in frames on a ringbuffer stack 6027 ; 6028 ; FRAME_AAAAprevFRAME_BBBBprevCURRENT_EMPTY_FRAME 6029 ; ^ v ^ v v 6030 ; | | | | | 6031 ; \-------/ \--------/| | 6032 ; | v 6033 ; v [undoptr] == next free frame 6034 ; [undoptr]-4 == begin of previous frame 6035 ; 6036 ; there are 3 types of frames: DELETE,INSERT,OVERWRITE, see details below: 6037 ; 6038 DataForUndoDelete: 6039 ; 6040 ; Data collector for "delete" by PUSHING undo data into a frame on the undo stack, 6041 ; growing to higher addresses, using a variable size (16+X byte) data structure: 6042 ; 6043 ; |12345679|--WHERE-|--SIZE--|....X |PREV-PTR|--NEXT--| ...... 6044 ; | =sign | =edi | =eax | | | | 6045 ; | | | | | | | 6046 ; | edx+0 | edx+4 | edx+8 | edx+12 |edx+16+X|edx+20+X| <----- ADDRESSES 6047 ; ^^^^^^^^ 6048 ; NEXT_undo_frame_address stored in [undoptr] 6049 ; If the data size is > undobuffer size we have to 6050 ; save the data otherwise, i.e. in a file: 6051 ; |1234567B|--WHERE-|--SIZE--| pusha 6061 00001F5A 7249 jb DFok 6062 ;------- 6063 PUSH_ALL 6064 00001F5C 60 <1> pusha 6065 00001F5D 8B1D[F62E0000] mov ebx,[last_undo_file] 6066 00001F63 09DB or ebx,ebx 6067 00001F65 740E jz noundo_info 6068 00001F67 813B7B563412 cmp dword [ebx],0x01234567B 6069 00001F6D 7506 jnz noundo_info 6070 00001F6F C70300000000 mov dword [ebx],0 ;only ONE external undo info allowed, thus destroy older 6071 00001F75 BE[2B3D0100] noundo_info:mov esi,sot ;i.e. huge undo data 6072 00001F7A 892D[2E2F0100] mov [blockende],ebp 6073 00001F80 BB[ED200000] mov ebx,tempfile2 6074 00001F85 E825F6FFFF call SaveBl3 6075 POP_ALL 6076 00001F8A 61 <1> popa 6077 ;------- 6078 00001F8B E82E010000 call InitUndoFrame0 6079 00001F90 C7027B563412 mov dword [edx],0x01234567B ;2nd signature for "delete" 6080 00001F96 8915[F62E0000] mov [last_undo_file],edx 6081 00001F9C 89E8 mov eax,ebp 6082 00001F9E 2D[2B3D0100] sub eax,sot ;ebp -sot == size of buffer 6083 00001FA3 EB5A jmp short OVWdata 6084 ;------- 6085 DFok: ;i.e. small undo data 6086 00001FA5 89C1 mov ecx,eax ;extra data size / size of copy 6087 00001FA7 E814010000 call InitUndoFrame 6088 00001FAC C70279563412 mov dword [edx],0x012345679 ;signature for "delete", later undo will insert data again 6089 00001FB2 897A04 mov [edx+4],edi ;where 6090 00001FB5 894208 mov [edx+8],eax ;how much 6091 00001FB8 89FE mov esi,edi ;source is inside editor text buffer 6092 00001FBA 8D7A0C lea edi,[edx+12] ;destination of copy 6093 00001FBD FC cld 6094 00001FBE F3A4 rep movsb 6095 00001FC0 A1[FA2E0000] mov eax,[undoptr] ;this frame... 6096 00001FC5 8907 mov [edi],eax ;... is the prev frame for the next one 6097 00001FC7 8D4704 lea eax,[edi+4] ;eax: now the new frame address 6098 00001FCA EB3F jmp short DFex 6099 ;------- 6100 DataForUndoOverwrite: 6101 ; 6102 ; Data collector for "overwrite" by PUSHING data on a stack, 6103 ; growing to higher addresses, using a data structure like in DataForUndoInsert 6104 ; 6105 PUSH_ALL 6106 00001FCC 60 <1> pusha 6107 00001FCD E8EC000000 call InitUndoFrame0 6108 00001FD2 C7027A563412 mov dword [edx],0x01234567A ;signature for "overwrite", later undo will restore 6109 00001FD8 8B07 mov eax,[edi] ;fetch overwritten char 6110 00001FDA EB23 jmp short OVWdata 6111 DataForUndoXchange: 6112 ; 6113 ; Data collector for "Emacs ^T" by PUSHING data on a stack, 6114 ; growing to higher addresses, using a data structure like in DataForUndoOverWrite 6115 ; 6116 PUSH_ALL 6117 00001FDC 60 <1> pusha 6118 00001FDD E8DC000000 call InitUndoFrame0 6119 00001FE2 C70277563412 mov dword [edx],0x012345677 ;signature for "xchg", later undo will restore 6120 00001FE8 EB15 jmp short OVWdata 6121 ;------ 6122 DataForUndoInsert: 6123 ; 6124 ; Data collector for "insert" by PUSHING data on a stack, 6125 ; growing to higher addresses, using a fixed size (16 byte) data structure: 6126 ; 6127 ; |12345678|--WHERE-|--SIZE--|PREV-PTR|--NEXT--| ......... 6128 ; | =sign | =edi | =eax | | | 6129 ; | | | | | | 6130 ; | edx+0 | edx+4 | edx+8 | edx+12 |edx+16 |edx+20 <----- ADDRESSES 6131 ; ^^^^^^^^ 6132 ; NEXT_undo_frame_address stored in [undoptr] 6133 ; 6134 ; An analogue data structure is used for DataForUndoOverwrite: 6135 ; |1234567A|--WHERE-|--CHAR--|PREV-PTR|--NEXT--| ......... 6136 ; 6137 ; 6138 00001FEA 803D[F22E0000]01 cmp byte [enter_undo],1 ;do not collect undo data if within undo operation 6139 00001FF1 741E jz DFUI 6140 PUSH_ALL 6141 00001FF3 60 <1> pusha 6142 00001FF4 E8C5000000 call InitUndoFrame0 6143 00001FF9 C70278563412 mov dword [edx],0x012345678 ;signature for "insert", later undo will delete that data 6144 00001FFF 897A04 OVWdata:mov [edx+4],edi ;where 6145 00002002 894208 mov [edx+8],eax ;how much chars (or the character itself) 6146 00002005 89520C mov [edx+12],edx ;this frame is the prev frame for the next one 6147 00002008 8D4210 lea eax,[edx+16] ;address of next frame 6148 0000200B A3[FA2E0000] DFex: mov [undoptr],eax ;let undoptr point to next frame 6149 POP_ALL 6150 00002010 61 <1> popa 6151 00002011 C3 DFUI: ret 6152 ;---------------------------------------------------------------------- 6153 ; 6154 ; this subroutine is bound to one of the keys like ^KU and 6155 ; will POP any UNDO data from the undo stack using 3 types of undo frames 6156 ; 6157 00002012 C605[F22E0000]01 KeyUndo:mov byte [enter_undo],1 ;do not log dele/insert when in undo mode 6158 00002019 89FB mov ebx,edi ;for case of error 6159 0000201B 8B15[FA2E0000] mov edx,[undoptr] 6160 00002021 8B52FC mov edx,[edx-4] ;get begin of previos frame 6161 00002024 09D2 or edx,edx 6162 00002026 741E jz NotAv ;no date available 6163 00002028 31C9 xor ecx,ecx ;read signature into ecx and destroy sign 6164 0000202A 870A xchg ecx,[edx] ;(destroying is neccessary because it's a ring buffer) 6165 0000202C 8B4208 mov eax,[edx+8] ;data size or character itself 6166 0000202F 8B7A04 mov edi,[edx+4] ;position 6167 00002032 81E977563412 sub ecx,0x12345677 6168 00002038 7410 jz UndoOfXchange 6169 0000203A 49 dec ecx 6170 0000203B 742B jz UndoOfInsert 6171 0000203D 49 dec ecx 6172 0000203E 7413 jz UndoOfDelete 6173 00002040 49 dec ecx 6174 00002041 7421 jz UndoOfOverwrite 6175 00002043 49 dec ecx 6176 00002044 7429 jz ReReadBuffer 6177 00002046 89DF NotAv: mov edi,ebx ;abort UNDO: no valid signature found 6178 %ifdef ROLLBACK 6179 xor edx,edx 6180 %endif 6181 00002048 EB68 jmp short KUret 6182 ;------- 6183 0000204A 8A07 UndoOfXchange:mov al,byte [edi] 6184 0000204C 8647FF xchg byte [edi-1],al 6185 0000204F 8807 mov byte [edi],al 6186 00002051 EB50 jmp short KUexit 6187 ;------- 6188 00002053 8D720C UndoOfDelete:lea esi,[edx+12] ;source ptr for deleted 6189 00002056 56 push esi 6190 00002057 E8F9F1FFFF call InsertByte ;get some space..... 6191 0000205C 5E pop esi ;source ptr (somewhere inside UNDO frame) 6192 0000205D E8B0F2FFFF call MoveBlock ;....and move back into text 6193 00002062 EB3F jmp short KUexit 6194 ;------- 6195 00002064 8807 UndoOfOverwrite:mov byte [edi],al 6196 00002066 EB3B jmp short KUexit 6197 ;------- 6198 00002068 E8BBF1FFFF UndoOfInsert:call DeleteByte 6199 0000206D EB34 jmp short KUexit 6200 ;------- 6201 0000206F 8DA8[2B3D0100] ReReadBuffer:lea ebp,[eax+sot] ;compute eof pointer 6202 00002075 C645000A mov byte [ebp],NEWLINE ;eof-marker 6203 00002079 50 push eax ;size 6204 0000207A BB[ED200000] mov ebx,tempfile2 6205 0000207F E8F3F9FFFF call OpenFile0 6206 00002084 5A pop edx ;size 6207 00002085 781C js KUexit 6208 00002087 93 xchg ebx,eax ;file handle 6209 00002088 B9[2B3D0100] mov ecx,sot 6210 0000208D E8D7F9FFFF call Read_File 6211 00002092 780F js KUexit 6212 00002094 E8E4F9FFFF call CloseFile 6213 00002099 BB[ED200000] mov ebx,tempfile2 6214 0000209E E881FAFFFF call Unlink 6215 ;------- 6216 000020A3 8B15[FA2E0000] KUexit: mov edx,[undoptr] ;switch to undo frame before (i.e. POP) 6217 000020A9 8B52FC mov edx,[edx-4] ;the prev frame.... 6218 000020AC 8915[FA2E0000] mov [undoptr],edx ;...is now current frame 6219 000020B2 C605[F22E0000]00 KUret: mov byte [enter_undo],0 ;leave UNDO status 6220 000020B9 E9C2EEFFFF KUjmp: jmp CheckENum ;renumbering because we have changed the cursor position 6221 ;------- 6222 %ifdef ROLLBACK 6223 RollBack:call KeyUndo 6224 or edx,edx 6225 jnz RollBack 6226 jmp short KUjmp 6227 %endif 6228 ;---------------------------------------------------------------------- 6229 ; 6230 ; This inits the frame data pointer into edx. 6231 ; If there is not enough space we will wrap around to buffer begin and adjust [undoptr]: 6232 ; 6233 ;BEFORE WRAP: 6234 ;|******any_frame**********any_frame********any_frame*******PREV-PTR---------------| buffer_end 6235 ; <---too less---> 6236 ; ^^^^^^^^^ 6237 ; [undoptr] 6238 ;NOW AFTER WRAP: 6239 ;|PREV-PTR<-space_for_new_frame->ame********any_frame*******PREV-PTR---------------| buffer_end 6240 ; ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^ 6241 ; [undoptr] invalid last ok frame 6242 ; frame part 6243 ; 6244 000020BE 31C9 InitUndoFrame0:xor ecx,ecx ;no extra data 6245 000020C0 8B15[FA2E0000] InitUndoFrame:mov edx,[undoptr] ;get current frame 6246 000020C6 BE[E62E0100] mov esi,undobuffer_end-24 6247 000020CB 29CE sub esi,ecx ;extra data if exist 6248 000020CD 39F2 cmp edx,esi ;low memory? 6249 000020CF 7213 jb IUFret ;leave if far away from buffer end 6250 ;------- 6251 000020D1 8B5AFC mov ebx,[edx-4] ;fetch PREV-PTR frame address @[undoptr-4] 6252 000020D4 BA[FE2E0000] mov edx,undobuffer ;wrap around: now BACK AT BUFFER BEGIN... 6253 000020D9 891A mov [edx],ebx ;store prev data frame pointer just before new frame 6254 000020DB 8D5204 lea edx,[edx+4] ;=new frame begins here at undobuffer+4 6255 000020DE 8915[FA2E0000] mov [undoptr],edx 6256 000020E4 C3 IUFret: ret 6257 %endif 6258 %ifdef UTF8RTS 6259 KeyUTF8switch:not byte [isUTF8] 6260 ret 6261 %endif 6262 ;---------------------------------------------------------------------- 6263 %ifdef LINUX 6264 %ifndef CRIPLED_ELF 6265 section .data 6266 bits 32 6267 %endif 6268 %endif 6269 ; 6270 ; CONSTANT DATA AREA 6271 ; 6272 %ifdef USE_MATH 6273 000020E5 0000000080842E41 factor dq 1000000.0 6274 %endif 6275 000020ED 6533232300 tempfile2 db 'e3##',0 ;tempfile (FIXME: use PID for name) 6276 %ifdef USE_PIPE 6277 000020F2 6533242400 tempfile db 'e3$$',0 ;tempfile (FIXME: use PID for name) 6278 %ifdef USE_EX_NO_SED 6279 %ifndef AMD64 6280 exargs dd expath 6281 dd minus_s 6282 dd tempfile 6283 dd 0 6284 %else 6285 exargs dq expath 6286 dq minus_s 6287 dq tempfile 6288 dq 0 6289 %endif 6290 expath db EX_PATH,0 6291 minus_s db '-s',0 6292 wq_suffix db LINEFEED,'wq',LINEFEED 6293 wq_suffix_len equ $-wq_suffix 6294 %else 6295 %ifndef AMD64 6296 000020F7 [0B210000] sedargs dd sedpath ;this way default 6297 000020FB [18210000] dd minus_e 6298 000020FF [DA350100] dd optbuffer 6299 00002103 [F2200000] dd tempfile 6300 00002107 00000000 dd 0 6301 %else 6302 sedargs dq sedpath ;this way default 6303 dq minus_e 6304 dq optbuffer 6305 dq tempfile 6306 dq 0 6307 %endif 6308 0000210B 2F7573722F62696E2F- sedpath db SEDPATH,0 6309 00002114 73656400 6310 %ifndef PERLPIPE 6311 00002118 2D6500 minus_e db '-e',0 6312 %else 6313 minus_e db '-pe',0 6314 %endif 6315 ; 6316 %endif 6317 %endif 6318 ; 6319 0000211B 4F50543F20432F4200 optiontext db 'OPT? C/B',0 6320 00002124 46494C454E414D453A- filename db 'FILENAME:',0 6321 0000212D 00 6322 0000212E 2020204E414D453A00 block db ' NAME:',0 6323 00002137 534156452041533A00 saveas db 'SAVE AS:',0 6324 00002140 202020534156453A00 filesave db ' SAVE:',0 6325 00002149 534156453F20596E6C- asksave db 'SAVE? Ynl',0 6326 00002152 00 6327 00002153 534156453F20596E00 asksave2 db 'SAVE? Yn',0 6328 0000215C 5245504C4143453A00 askreplace1 db 'REPLACE:',0 6329 00002165 524520574954483A00 askreplace2 db 'RE WITH:',0 6330 0000216E 474F204C494E453A00 asklineno db 'GO LINE:',0 6331 00002177 205345415243483A00 askfind db ' SEARCH:',0 6332 00002180 5E51204F4354414C3A- asknumber db '^Q OCTAL:',0 6333 00002189 00 6334 0000218A 6D6F64652045583A00 extext db 'mode EX:',0 6335 00002193 534554204D4F444500 modetxt db 'SET MODE',0 6336 %define DoNo 10 6337 6338 ScanTable: ;another xlat table containing offsets in jumptab1 table 6339 %ifdef W32 6340 db 2 ;VK_PRIOR = Scan 21h (pgup) 6341 db 7 ;VK_NEXT = Scan 22h (pgdn) 6342 db 5 ;(end) 6343 db 0 ;(home) 6344 db 3 ;(left) 6345 db 1 ;(up) 6346 db 4 ;(right) 6347 db 6 ;(dn) 6348 db DoNo ;29h ignored 6349 db DoNo ;2ah ditto 6350 db DoNo ;2bh ditto 6351 db DoNo ;2ch ditto 6352 db 8 ;VK_INSERT = Scan 2dh (insert) 6353 db 9 ;VK_DELETE = Scan 2eh (del) 6354 %else 6355 0000219C 0A db DoNo ; esc[0~ 6356 0000219D 00 db 0 ;keyHome esc[1~ 6357 0000219E 08 db 8 ;keyIns esc[2~ 6358 0000219F 09 db 9 ;keyDel esc[3~ 6359 000021A0 05 db 5 ;keyEnd esc[4~ 6360 000021A1 02 db 2 ;keyPgUp esc[5~ 6361 000021A2 07 db 7 ;KeyPDn esc[6~ 6362 000021A3 00 db 0 ;keyHome esc[7~ 6363 000021A4 05 db 5 ;keyEnd esc[8~ 6364 ;--------------------- 6365 %ifdef QNX 6366 db 8 ;keyIns esc[@ 6367 %endif 6368 000021A5 01 db 1 ;keyUp esc[A 6369 000021A6 06 db 6 ;keyDown esc[B 6370 000021A7 04 db 4 ;keyRight esc[C 6371 000021A8 03 db 3 ;keyLeft esc[D 6372 000021A9 0A db DoNo ; esc[E 6373 000021AA 05 db 5 ;keyEnd esc[F 6374 000021AB 07 db 7 ;keyPgDn esc[G 6375 000021AC 00 db 0 ;keyHome esc[H 6376 %ifndef LINUX 6377 000021AD 02 db 2 ;keyPUp esc[I 6378 000021AE 0A db DoNo ; esc[J 6379 000021AF 0A db DoNo ; esc[K 6380 000021B0 08 db 8 ;keyIns esc[L 6381 %endif 6382 %ifdef QNX 6383 db DoNo ; esc[M 6384 db DoNo ; esc[M 6385 db DoNo ; esc[O 6386 db 9 ; esc[P 6387 db DoNo ; esc[Q 6388 db DoNo ; esc[R 6389 db DoNo ; esc[S 6390 db DoNo ; esc[T 6391 db 7 ; esc[U 6392 db 2 ; esc[V 6393 db DoNo ; esc[W 6394 db DoNo ; esc[X 6395 db 5 ; esc[Y 6396 %endif 6397 STsize equ ($-ScanTable) 6398 %endif 6399 ;---------------------------------------------------------------------- 6400 EmaAltTable: ;another xlat table containing offsets in jumptab1 table 6401 000021B1 12 db 12h ;'B' 6402 000021B2 0A db DoNo ;'C' 6403 000021B3 0A db DoNo ;'D' 6404 000021B4 0A db DoNo ;'E' 6405 000021B5 13 db 13h ;'F' 6406 000021B6 11 db 11h ;'G' 6407 000021B7 3D db 3Dh ;'H' Help! 6408 000021B8 0A db DoNo ;'I' 6409 000021B9 0A db DoNo ;'J' 6410 000021BA 0A db DoNo ;'K' 6411 000021BB 0A db DoNo ;'L' 6412 000021BC 0A db DoNo ;'M' 6413 000021BD 0A db DoNo ;'N' 6414 000021BE 0A db DoNo ;'O' 6415 000021BF 0A db DoNo ;'P' 6416 000021C0 0A db DoNo ;'Q' 6417 000021C1 0A db DoNo ;'R' 6418 000021C2 0A db DoNo ;'S' 6419 000021C3 0A db DoNo ;'T' 6420 000021C4 0A db DoNo ;'U' 6421 000021C5 02 db 2 ;'V' 6422 000021C6 27 db 27h ;'W' 6423 000021C7 3E db 3Eh ;'X' 6424 ATsize equ ($-EmaAltTable) 6425 ;---------------------------------------------------------------------- 6426 %define Beep 0x4E 6427 000021C8 4E VIcmdTable:db Beep;0 6428 000021C9 4E db Beep ;1 6429 000021CA 02 db 2 ;^B PageUp 6430 000021CB 4E db Beep ;3 6431 000021CC 36 db 36h ;^D half PageUp 6432 000021CD 4E db Beep ;5 6433 000021CE 07 db 7 ;^F PageDn 6434 000021CF 4E db Beep ;7 6435 000021D0 03 db 3 ;^H KeyLeft 6436 000021D1 4E db Beep ;9 6437 000021D2 06 db 6 ;^J KeyDown 6438 000021D3 4E db Beep ;11 6439 000021D4 4E db Beep ;12 6440 000021D5 06 db 6 ;^M KeyDown 6441 000021D6 4E db Beep ;^N 6442 000021D7 4E db Beep ;^O 6443 000021D8 4E db Beep ;^P 6444 000021D9 4E db Beep ;^Q 6445 000021DA 4E db Beep ;^R 6446 000021DB 4E db Beep ;^S 6447 000021DC 4E db Beep ;^T 6448 000021DD 37 db 37h ;^U 6449 000021DE 4E db Beep ;22 6450 000021DF 4E db Beep ;23 6451 000021E0 4E db Beep ;24 6452 000021E1 4E db Beep ;25 6453 000021E2 51 db 51h ;^Z 6454 000021E3 4E db Beep ;27 6455 000021E4 4E db Beep ;28 6456 000021E5 4E db Beep ;29 6457 000021E6 4E db Beep ;30 6458 000021E7 4E db Beep ;31 6459 000021E8 04 db 4 ;' ' KeyRight 6460 000021E9 4E db Beep ;33 6461 000021EA 4E db Beep ;34 6462 000021EB 4F db 4fh ;35 Numerics 6463 000021EC 05 db 5 ;'$' KeyEnd 6464 000021ED 4E db Beep ;37 6465 000021EE 4E db Beep ;38 6466 000021EF 50 db 50h ; ' 6467 000021F0 4E db Beep ;40 6468 000021F1 4E db Beep ;41 6469 000021F2 4E db Beep ;42 6470 000021F3 06 db 6 ;'+' KeyDown 6471 000021F4 4E db Beep ;44 6472 000021F5 01 db 1 ;'-' KeyUp 6473 000021F6 4E db Beep ;46 6474 000021F7 39 db 39h ;'/' Search 6475 000021F8 00 db 0 ;'0' KeyHome 6476 000021F9 44 db 44h ;'1' 1G BOF 6477 000021FA 4E db Beep ;'2' 6478 000021FB 4E db Beep ;'3' 6479 000021FC 4E db Beep ;'4' 6480 000021FD 4E db Beep ;'5' 6481 000021FE 4E db Beep ;'6' 6482 000021FF 4E db Beep ;'7' 6483 00002200 4E db Beep ;'8' 6484 00002201 4E db Beep ;'9' 6485 00002202 2C db 2Ch ;':' ex mode 6486 00002203 3E db 3Eh ;';' e3 special command: QUICK leave vi mode :-) press e3ws, e3em, e3pi, e3ne 6487 00002204 4E db Beep ;'<' 6488 00002205 4E db Beep ;'=' 6489 00002206 4E db Beep ;'>' 6490 00002207 3A db 3Ah ;'?' search backw 6491 00002208 4E db Beep ;'@' 6492 00002209 2E db 2Eh ;'A' 6493 0000220A 12 db 12h ;'B' left word 6494 0000220B 4B db 4Bh ;'C' Change rest of line 6495 0000220C 4C db 4Ch ;'D' Delete rest of line (not unlike ^QY in WStar) 6496 0000220D 4E db Beep ;'E' 6497 0000220E 4E db Beep ;'F' 6498 0000220F 0F db 0Fh ;'G' EOF 6499 00002210 30 db 30h ;'H' First LIne 6500 00002211 33 db 33h ;'I' switch to insert mode 6501 00002212 4D db 4Dh ;'J' Join lines 6502 00002213 4E db Beep ;'K' 6503 00002214 31 db 31h ;'L' Last Line 6504 00002215 52 db 52h ;'M' 6505 00002216 4E db Beep ;'N' 6506 00002217 32 db 32h ;'O' Open Line 6507 00002218 3C db 3Ch ;'P' Paste 6508 00002219 4E db Beep ;'Q' 6509 0000221A 34 db 34h ;'R' overwrite 6510 0000221B 40 db 40h ;'S' kill +insmode 6511 0000221C 4E db Beep ;'T' 6512 0000221D 4E db Beep ;'U' 6513 0000221E 4E db Beep ;'V' 6514 0000221F 13 db 13h ;'W' next word 6515 00002220 3F db 3fh ;'X' del left 6516 00002221 4E db Beep ;'Y' 6517 00002222 41 db 41h ;'Z' 6518 00002223 4E db Beep ;'[' 6519 00002224 4E db Beep ;'\' 6520 00002225 4E db Beep ;']' 6521 00002226 38 db 38h ;'^' KeyFirstChar 6522 00002227 4E db Beep ;'_' 6523 00002228 4E db Beep ;'`' 6524 00002229 2D db 2Dh ;'a' append (KeyLeft plus insert mode) 6525 0000222A 12 db 12h ;'b' left word 6526 0000222B 4E db Beep ;'c' 6527 0000222C 35 db 35h ;'d' delete 6528 0000222D 43 db 43h ;'e' 6529 0000222E 4E db Beep ;'f' 6530 0000222F 4E db Beep ;'g' 6531 00002230 03 db 3 ;'h' KeyLeft 6532 00002231 2B db 2Bh ;'i' switch to insert mode 6533 00002232 06 db 6 ;'j' KeyDown 6534 00002233 01 db 1 ;'k' KeyUp 6535 00002234 04 db 4 ;'l' KeyRight 6536 00002235 45 db 45h ;'m' set the one and only marker 'a' 6537 00002236 4E db Beep ;'n' 6538 00002237 2F db 2Fh ;'o' Open Line 6539 00002238 3B db 3Bh ;'p' Paste 6540 00002239 4E db Beep ;'q' 6541 0000223A 4A db 4Ah ;'r' repl one char 6542 0000223B 4E db Beep ;'s' 6543 0000223C 4E db Beep ;'t' 6544 %ifdef USE_UNDO 6545 0000223D 53 db 53h ;'u' UNDO 6546 %else 6547 db Beep ;'u' 6548 %endif 6549 0000223E 4E db Beep ;'v' 6550 0000223F 13 db 13h ;'w' next word 6551 00002240 09 db 9 ;'x' KeyDel 6552 00002241 46 db 46h ;'y' 6553 00002242 42 db 42h ;'z' center line z. 6554 VIsize equ ($-VIcmdTable) 6555 ;---------------------------------------------------------------------- 6556 00002243 0A Ktable db DoNo ;^K@ xlatb table for making pseudo-scancode 6557 00002244 0A db DoNo ;^ka 6558 00002245 24 db 24h ;^kb 24h for example points to KeyCtrlKB function offset 6559 00002246 15 db 15h ;^kc 6560 00002247 0D db 0dh ;^kd 6561 00002248 0A db DoNo ;^ke DoNo means SimpleRet i.e. 'do nothing' 6562 00002249 0A db DoNo ;^kf 6563 0000224A 0A db DoNo ;^kg 6564 0000224B 1D db 1dh ;^kh 6565 0000224C 0A db DoNo ;^ki 6566 0000224D 0A db DoNo ;^kj 6567 0000224E 14 db 14h ;^kk 6568 0000224F 0A db DoNo ;^kl 6569 00002250 3E db 3eh ;^km Set Mode 6570 00002251 4F db 4Fh ;^kn 6571 00002252 0A db DoNo ;^ko 6572 00002253 48 db 48h ;^kp Pipe thru sed 6573 00002254 0B db 0bh ;^kq 6574 00002255 10 db 10h ;^kr 6575 00002256 0C db 0ch ;^ks 6576 00002257 0A db DoNo ;^kt 6577 %ifdef UTF8RTS 6578 db 54h ;^ku ^KU UTF8 view switcher 6579 %else 6580 00002258 0A db DoNo ;^ku 6581 %endif 6582 00002259 23 db 23h ;^kv 6583 0000225A 25 db 25h ;^kw 6584 0000225B 16 db 16h ;^kx 6585 0000225C 19 db 19h ;^ky 6586 0000225D 51 db 51h ;^kz ^KZ suspend (like in joe editor) 6587 Ktable_size equ $-Ktable 6588 0000225E 0A Qtable db DoNo ;^q@ ditto for ^Q menu 6589 0000225F 1A db 1ah ;^qa 6590 00002260 20 db 20h ;^qb 6591 00002261 0F db 0fh ;^qc 6592 00002262 05 db 05h ;^qd 6593 00002263 1E db 1eh ;^qe 6594 00002264 1B db 1bh ;^qf 6595 00002265 0A db DoNo ;^qg 6596 00002266 17 db 17h ;^qh, ^qDEL 6597 00002267 11 db 11h ;^qi 6598 00002268 0A db DoNo ;^qj 6599 00002269 21 db 21h ;^qk 6600 0000226A 0A db DoNo ;^ql 6601 0000226B 0A db DoNo ;^qm 6602 0000226C 0A db DoNo ;^qn 6603 0000226D 0A db DoNo ;^qo 6604 0000226E 18 db 18h ;^qp 6605 0000226F 0A db DoNo ;^qq 6606 00002270 0E db 0eh ;^qr 6607 00002271 00 db 00h ;^qs 6608 00002272 0A db DoNo ;^qt 6609 00002273 0A db DoNo ;^qu 6610 00002274 1C db 1ch ;^qv 6611 00002275 12 db 12h ;^qw 6612 00002276 1F db 1fh ;^qx 6613 00002277 22 db 22h ;^qy 6614 00002278 13 db 13h ;^qz 6615 ;---------------------------------------------------------------------- 6616 00002279 0A Xtable db DoNo ;^x^@ 6617 0000227A 0A db DoNo ;^x^a 6618 0000227B 0A db DoNo ;^x^b 6619 0000227C 0B db 0bh ;^x^c WS: ^KQ 6620 0000227D 0A db DoNo ;^x^d 6621 0000227E 0A db DoNo ;^x^e 6622 0000227F 47 db 47h ;^x^f 6623 00002280 0A db DoNo ;^x^g 6624 00002281 3D db 3Dh ;^x^h i.e. "HELP!" (The Beatles, 1965) ;-) 6625 00002282 10 db 10h ;^x i WS: ^KR 6626 00002283 0A db DoNo ;^x^j 6627 00002284 0A db DoNo ;^x^k 6628 00002285 0A db DoNo ;^x^l 6629 00002286 0A db DoNo ;^x^m 6630 00002287 4F db 4fh ;^x^n numerics 6631 00002288 0A db DoNo ;^x^o 6632 00002289 48 db 48h ;^x^p special sed pipe 6633 0000228A 0A db DoNo ;^x^q 6634 0000228B 0A db DoNo ;^x^r 6635 0000228C 0C db 0ch ;^x^s WS: ^KS 6636 0000228D 0A db DoNo ;^x^t 6637 0000228E 0A db DoNo ;^x^u 6638 0000228F 0A db DoNo ;^x^v 6639 00002290 29 db 29h ;^x^w write to 6640 00002291 26 db 26h ;^x^x xchg mark/point 6641 00002292 0A db DoNo ;^x^y 6642 00002293 0A db DoNo ;^x^z 6643 ;---------------------------------------------------------------------- 6644 00002294 0A PicoJtable db DoNo ;^j@ Junk ops for PI mode 6645 00002295 0A db DoNo ;^ja 6646 00002296 0A db DoNo ;^jb 6647 00002297 0A db DoNo ;^jc 6648 00002298 0A db DoNo ;^jd 6649 00002299 0A db DoNo ;^je 6650 0000229A 0A db DoNo ;^jf 6651 0000229B 0A db DoNo ;^jg 6652 0000229C 17 db 17h ;^jh Junk to line Home 6653 0000229D 0A db DoNo ;^ji 6654 0000229E 0A db DoNo ;^jj 6655 0000229F 0A db DoNo ;^jk 6656 000022A0 22 db 22h ;^jl Junk Line rest 6657 000022A1 0A db DoNo ;^jm 6658 000022A2 0A db DoNo ;^jn 6659 000022A3 0A db DoNo ;^jo 6660 000022A4 48 db 48h ;^jp special sed pipe 6661 000022A5 0A db DoNo ;^jq 6662 000022A6 0A db DoNo ;^jr 6663 000022A7 0A db DoNo ;^js 6664 000022A8 49 db 49h ;^jt repeat last search&replace 6665 000022A9 0A db DoNo ;^ju 6666 000022AA 0A db DoNo ;^jv 6667 000022AB 2A db 2Ah ;^jw Junk Word 6668 000022AC 0A db DoNo ;^jx 6669 000022AD 0A db DoNo ;^jy 6670 000022AE 0A db DoNo ;^jz 6671 000022AF 0A PicoQtable db DoNo ;^q@ Quick motions for PI mode: wordstar counterparts on different keys 6672 000022B0 0A db DoNo ;^qa 6673 000022B1 1F db 1Fh ;^qb Bottom of window 6674 000022B2 4F db 4Fh ;^qc Calc numerics 6675 000022B3 0A db DoNo ;^qd 6676 000022B4 0F db 0fh ;^qe End of file 6677 000022B5 1C db 1Ch ;^qf last Find 6678 000022B6 0A db DoNo ;^qg 6679 000022B7 0A db DoNo ;^qh 6680 000022B8 0A db DoNo ;^qi 6681 000022B9 0A db DoNo ;^qj 6682 000022BA 0A db DoNo ;^qk 6683 000022BB 11 db 11h ;^ql Line number # 6684 000022BC 3E db 3eh ;^qm set mode 6685 000022BD 13 db 13h ;^qn Next word 6686 000022BE 0A db DoNo ;^qo 6687 000022BF 12 db 12h ;^qp Previous word 6688 000022C0 0A db DoNo ;^qq 6689 000022C1 0A db DoNo ;^qr 6690 000022C2 0E db 0Eh ;^qs Start of file 6691 000022C3 1E db 1Eh ;^qt Top of window 6692 %ifdef USE_UNDO 6693 000022C4 53 db 53h ;^qu UNDO 6694 %else 6695 db DoNo ;^qu 6696 %endif 6697 %ifdef UTF8RTS 6698 dw 54h ;^qv UTF8 switcher 6699 %else 6700 000022C5 0A db DoNo ;^qv 6701 %endif 6702 000022C6 0A db DoNo ;^qw 6703 000022C7 0A db DoNo ;^qx 6704 000022C8 0A db DoNo ;^qy 6705 000022C9 0A db DoNo ;^qz 6706 ;---------------------------------------------------------------------- 6707 esize equ 2 ;(byte per entry) 6708 %ifdef ARMCPU 6709 align 2 6710 %endif 6711 6712 jumptab1: ;Storing 16 bit offsets is valid only for code less size 64 kbyte... 6713 ; ... but in assembler that should never be a problem ;) 6714 %ifndef USE_EXT_MOVE 6715 000022CA F902 dw KeyHome -_start ;0 6716 %else 6717 dw KeyHome2 -_start ;0 6718 %endif 6719 000022CC 6502 dw KeyUp -_start ;1 6720 000022CE A602 dw KeyPgUp -_start ;2 6721 000022D0 CC09 dw KeyLeft -_start ;3 6722 000022D2 A603 dw KeyRight -_start ;4 6723 %ifndef USE_EXT_MOVE 6724 000022D4 ED09 dw KeyEnd -_start ;5 6725 %else 6726 dw KeyEnd2 -_start ;5 6727 %endif 6728 000022D6 5402 dw KeyDown -_start ;6 6729 000022D8 B202 dw KeyPgDn -_start ;7 6730 000022DA 1303 dw KeyIns -_start ;8 6731 000022DC 5003 dw KeyDel -_start ;9 0..9 are Cursor pad keys 6732 ;------------------------ 6733 000022DE 4A02 dw SimpleRet -_start ;10 DO_NOTHING == DoNo 6734 000022E0 1708 dw KeyCtrlKQ -_start ;0bh EMA ^X^C 6735 000022E2 F207 dw KeyCtrlKS -_start ;0ch EMA ^X^S 6736 000022E4 0808 dw KeyCtrlKD -_start ;0dh EMA ^X^F 6737 %ifndef USE_EXT_MOVE 6738 000022E6 8705 dw KeyCtrlQR -_start ;0eh EMA Alt< 6739 000022E8 7608 dw KeyCtrlQC -_start ;0fh EMA Alt> 6740 %else 6741 dw KeyCtrlQR2 -_start ;0eh EMA Alt< 6742 dw KeyCtrlQC2 -_start ;0fh EMA Alt> 6743 %endif 6744 000022EA 6507 dw KeyCtrlKR -_start ;10h EMA ^XI 6745 000022EC B205 dw KeyCtrlQI -_start ;11h EMA Alt-G 6746 000022EE D303 dw KeyCtrlQW -_start ;12h EMA Alt-B 6747 000022F0 F403 dw KeyCtrlQZ -_start ;13h EMA Alt-F 6748 ;-------------------------- 6749 ;up to here this functions are considered common for all (exc vi) 6750 ;Of course some use different key names. 6751 ; 6752 ;now follows special stuff for each editor emulation: 6753 ;-------WS and Pico-------- 6754 000022F2 C106 dw KeyCtrlKK -_start ;14h 6755 000022F4 C906 dw KeyCtrlKC -_start ;15h 6756 000022F6 4508 dw KeyCtrlKX -_start ;16h 6757 000022F8 CA05 dw KeyCtrlQDel -_start ;17h 6758 000022FA 8E05 dw KeyCtrlQP -_start ;18h 6759 000022FC 9906 dw KeyCtrlKY -_start ;19h 6760 000022FE 9104 dw KeyCtrlQA -_start ;1ah 6761 00002300 F104 dw KeyCtrlQF -_start ;1bh 6762 00002302 5904 dw KeyCtrlQV -_start ;1ch 6763 00002304 B906 dw KeyCtrlKH -_start ;1dh 6764 00002306 3C04 dw KeyCtrlQE -_start ;1eh 6765 00002308 4804 dw KeyCtrlQX -_start ;1fh 6766 0000230A 9C05 dw KeyCtrlQB -_start ;20h 6767 0000230C A905 dw KeyCtrlQK -_start ;21h 6768 0000230E DF05 dw KeyCtrlQY -_start ;22h 6769 00002310 F306 dw KeyCtrlKV -_start ;23h 6770 00002312 1B07 dw KeyCtrlKB -_start ;24h 6771 00002314 9D07 dw KeyCtrlKW -_start ;25h 6772 ;-------EM-------- 6773 00002316 DD06 dw KeyCtrlXX -_start ;26h 6774 00002318 D813 dw KeyEmaAltW -_start ;27h 6775 0000231A 8204 dw KeyEmaAltPer -_start ;28h Alt-% 6776 0000231C D207 dw KeyEmaCtrlXW -_start ;29h 6777 ;-------PI-------- 6778 0000231E 2906 dw KeyCtrlT -_start ;2Ah 6779 ;-------VI-------- 6780 00002320 A309 dw KeyVIcmdi -_start ;2Bh 6781 00002322 FE09 dw KeyVIex -_start ;2Ch 6782 00002324 9E09 dw KeyVIcmda -_start ;2Dh 6783 00002326 9709 dw KeyVICmdA -_start ;2Eh 6784 00002328 8B09 dw KeyVICmdo -_start ;2Fh 6785 0000232A 3C04 dw KeyCtrlQE -_start ;30h 6786 0000232C 4804 dw KeyCtrlQX -_start ;31h 6787 0000232E 7A09 dw KeyVICmdO -_start ;32h 6788 00002330 3209 dw KeyVICmdI -_start ;33h 6789 00002332 7109 dw KeyVICmdR -_start ;34h 6790 00002334 E708 dw KeyVICmdd -_start ;35h 6791 00002336 8202 dw KeyHalfPgDn -_start ;37h 6792 00002338 7602 dw KeyHalfPgUp -_start ;36h 6793 0000233A B808 dw KeyVI1Char -_start ;38h 6794 0000233C 7104 dw KeyVIfsearch -_start ;39h 6795 0000233E 6D04 dw KeyVIbsearch -_start ;3Ah 6796 00002340 3909 dw KeyVICmdp -_start ;3Bh 6797 00002342 4F09 dw KeyVICmdP -_start ;3Ch 6798 ;------- later added (mostly vi stuff) ------ 6799 00002344 D210 dw KeyHelp -_start ;3Dh general 6800 00002346 C119 dw KeyEditMode -_start ;3Eh general 6801 00002348 4903 dw KeyDell -_start ;3Fh vi 6802 0000234A D408 dw KeyVICmdS -_start ;40h vi 6803 0000234C AE08 dw KeyVICmdZ -_start ;41h vi 6804 0000234E 4211 dw KeyVICmdz -_start ;42h vi 6805 00002350 1E04 dw KeyVIcmde -_start ;43h vi 6806 00002352 6E05 dw KeyVIcmd1 -_start ;44h vi 6807 00002354 3107 dw KeyVICmdm -_start ;45h vi 6808 00002356 3413 dw KeyVICmdy -_start ;46h vi 6809 00002358 AB07 dw KeyEmaCtrlXF -_start ;47h emacs (extended ^KD from WS) 6810 %ifdef USE_PIPE 6811 0000235A 4A1B dw KeyCtrlKP -_start ;48h use sed-pipe in WS,Emacs,Pico 6812 %else 6813 dw SimpleRet -_start ;48h 6814 %endif 6815 0000235C C904 dw KeyPiCtrlJT -_start ;49h Pico 6816 0000235E 3B01 dw KeyVICmdr -_start ;4Ah vi 6817 00002360 AE09 dw KeyVICmdC -_start ;4Bh vi 6818 00002362 D805 dw KeyVICmdD -_start ;4Ch vi 6819 00002364 4203 dw KeyVICmdJ -_start ;4Dh vi 6820 %ifdef BEEP_IN_VI 6821 00002366 B21E dw VIBeepForD -_start ;4Eh vi 6822 %else 6823 dw SimpleRet -_start ;4Eh vi 6824 %endif 6825 00002368 E41C dw KeyCtrlKN -_start ;4Fh general 6826 0000236A 4807 dw KeyVICmdJmpM -_start ;50h vi 6827 %ifdef SYS_kill 6828 0000236C 281B dw KeySuspend -_start ;51h general 6829 %else 6830 dw SimpleRet -_start ;51h 6831 %endif 6832 0000236E 4C11 dw KeyVI_M -_start ;52h vi 6833 %ifdef USE_UNDO 6834 00002370 1220 dw KeyUndo -_start ;53h general 6835 %else 6836 dw SimpleRet -_start ;53h 6837 %endif 6838 %ifdef UTF8RTS 6839 dw KeyUTF8switch-_start ;54h general 6840 %else 6841 00002372 4A02 dw SimpleRet -_start ;54h 6842 %endif 6843 jumps1 equ ($-jumptab1) / esize 6844 ;--- 32 more for WS-------- 6845 00002374 4A02 dw SimpleRet -_start ;^Space 6846 00002376 D303 dw KeyCtrlQW -_start ;^a 6847 00002378 4A02 dw SimpleRet -_start ;^b ;; TEST dw KeyUndo-_start 6848 0000237A B202 dw KeyPgDn -_start ;^c 6849 0000237C A603 dw KeyRight -_start ;^d 6850 0000237E 6502 dw KeyUp -_start ;^e 6851 00002380 F403 dw KeyCtrlQZ -_start ;^f 6852 00002382 5003 dw KeyDel -_start ;^g 7 6853 00002384 4903 dw KeyDell -_start ;^h 8 DEL (7fh is translated) 6854 00002386 0C01 dw NormChar -_start ;^i 9 (TAB) 6855 %ifdef SELFTEST 6856 dw KeyRet -_start ;^j 0ah 6857 %else 6858 00002388 D210 dw KeyHelp -_start ;^j 6859 %endif 6860 0000238A 6901 dw CtrlKMenu -_start ;^k b 6861 0000238C 5505 dw KeyCtrlL -_start ;^l c 6862 0000238E 0202 dw KeyRet -_start ;^m 0dh 6863 00002390 4A02 dw SimpleRet -_start ;^n e 6864 00002392 4A02 dw SimpleRet -_start ;^o f 6865 00002394 D210 dw KeyHelp -_start ;^p 10 Help! 6866 00002396 7201 dw CtrlQMenu -_start ;^q 11 6867 00002398 A602 dw KeyPgUp -_start ;^r 12 6868 0000239A CC09 dw KeyLeft -_start ;^s 13 6869 0000239C 2906 dw KeyCtrlT -_start ;^t 14 6870 %ifdef USE_UNDO 6871 0000239E 1220 dw KeyUndo -_start ;^u 15 (abort in Input) 6872 %else 6873 dw SimpleRet -_start ;^u 6874 %endif 6875 000023A0 1303 dw KeyIns -_start ;^v 16 6876 000023A2 8E02 dw KeyScrollUp -_start ;^w 17 6877 000023A4 5402 dw KeyDown -_start ;^x 18 6878 000023A6 FC05 dw KeyCtrlY -_start ;^y 19 6879 000023A8 9A02 dw KeyScrollDn -_start ;1a 6880 000023AA 4A02 dw SimpleRet -_start ;1b 6881 000023AC 4A02 dw SimpleRet -_start ;1c 6882 000023AE 4A02 dw SimpleRet -_start ;1d 6883 000023B0 4A02 dw SimpleRet -_start ;1e 6884 %ifdef ROLLBACK 6885 dw RollBack -_start ;1f for internal testing of UNDO ring buffer only 6886 %else 6887 000023B2 4A02 dw SimpleRet -_start ;1f 6888 %endif 6889 ;--- 32 more for EM-------- 6890 000023B4 5D07 dw KeyEmaMark -_start ;^Space 6891 000023B6 F902 dw KeyHome -_start ;^a 6892 000023B8 CC09 dw KeyLeft -_start ;^b 6893 000023BA 4A02 dw SimpleRet -_start ;^c (not planned) 6894 000023BC 5003 dw KeyDel -_start ;^d 6895 000023BE ED09 dw KeyEnd -_start ;^e 6896 000023C0 A603 dw KeyRight -_start ;^f 6897 000023C2 4A02 dw SimpleRet -_start ;^g (abort in Input) 6898 000023C4 4903 dw KeyDell -_start ;^h 6899 000023C6 0C01 dw NormChar -_start ;^i (TAB) 6900 000023C8 0202 dw KeyRet -_start ;^j 6901 000023CA 3506 dw KeyEmaCtrlK -_start ;^k 6902 000023CC 6411 dw KeyEmaCtrlL -_start ;^l 6903 000023CE FE01 dw KeyRetNoInd -_start ;^m 0dh 6904 000023D0 5402 dw KeyDown -_start ;^n 6905 000023D2 3004 dw KeyEmaCtrlO -_start ;^o 6906 000023D4 6502 dw KeyUp -_start ;^p 6907 000023D6 5401 dw KeyEmaCtrlQ -_start ;^q 6908 000023D8 D304 dw KeyEmaCtrlR -_start ;^r 6909 000023DA D704 dw KeyEmaCtrlS -_start ;^s 6910 000023DC 8903 dw KeyEmaCtrlT -_start ;^t 6911 %ifdef UTF8RTS 6912 dw KeyUTF8switch-_start ;^u UTF8 mode switcher 6913 ; (ATTENZIONE: that is NOT emacs stuff like: 'C-u runs the command universal-argument') 6914 %else 6915 000023DE 4A02 dw SimpleRet -_start ;^u 6916 %endif 6917 000023E0 B202 dw KeyPgDn -_start ;^v 6918 000023E2 5F06 dw KeyEmaCtrlW -_start ;^w 6919 000023E4 8B01 dw CtrlXMenu -_start ;^x 6920 000023E6 6413 dw KeyEmaCtrlY -_start ;^y 6921 %ifdef SYS_kill 6922 000023E8 281B dw KeySuspend -_start ;^z 6923 %else 6924 dw SimpleRet -_start ;51h 6925 %endif 6926 000023EA 4A02 dw SimpleRet -_start ;1b 6927 000023EC 4A02 dw SimpleRet -_start ;1c 6928 000023EE 4A02 dw SimpleRet -_start ;1d 6929 000023F0 4A02 dw SimpleRet -_start ;1e 6930 %ifdef USE_UNDO 6931 000023F2 1220 dw KeyUndo -_start ;1f 6932 %else 6933 dw SimpleRet -_start ;1f 6934 %endif 6935 ;--- 32 more for PI------ 6936 000023F4 5D07 dw KeyEmaMark -_start ;^Space a redundant marker because ^^ is ugly on some kbds 6937 000023F6 F902 dw KeyHome -_start ;^a 1 6938 000023F8 CC09 dw KeyLeft -_start ;^b 2 6939 000023FA 4A02 dw SimpleRet -_start ;^c 3 6940 000023FC 5003 dw KeyDel -_start ;^d 4 6941 000023FE ED09 dw KeyEnd -_start ;^e 5 6942 00002400 A603 dw KeyRight -_start ;^f 6 6943 00002402 D210 dw KeyHelp -_start ;^g 7 6944 00002404 4903 dw KeyDell -_start ;^h 8 DEL 6945 00002406 0C01 dw NormChar -_start ;^i 9 (TAB) 6946 00002408 7901 dw PicoJMenu -_start ;^j a 6947 0000240A 5F06 dw KeyEmaCtrlW -_start ;^k b 6948 0000240C 5D07 dw KeyEmaMark -_start ;^l c a redundant marker because ^^ is ugly on some kbds 6949 0000240E 0202 dw KeyRet -_start ;^m d 6950 00002410 5402 dw KeyDown -_start ;^n e 6951 00002412 F207 dw KeyCtrlKS -_start ;^o f SAVE 6952 00002414 6502 dw KeyUp -_start ;^p 10 6953 00002416 8201 dw PicoQMenu -_start ;^q 11 6954 00002418 6507 dw KeyCtrlKR -_start ;^r 12 6955 0000241A D207 dw KeyEmaCtrlXW -_start ;^s 13 SAVE_AS 6956 0000241C 7C04 dw PicoCtrlTpico-_start ;^t 14 6957 0000241E 6413 dw KeyEmaCtrlY -_start ;^u 15 6958 00002420 B202 dw KeyPgDn -_start ;^v 16 6959 00002422 D704 dw KeyEmaCtrlS -_start ;^w 17 6960 00002424 1708 dw KeyCtrlKQ -_start ;^x 18 6961 00002426 A602 dw KeyPgUp -_start ;^y 19 6962 %ifdef SYS_kill 6963 00002428 281B dw KeySuspend -_start ;^z 1A (not in pico) 6964 %else 6965 dw SimpleRet -_start ;^z 6966 %endif 6967 0000242A 4A02 dw SimpleRet -_start ;^[ 1B 6968 0000242C 4A02 dw SimpleRet -_start ;^\ 1C 6969 0000242E 4A02 dw SimpleRet -_start ;^] 1D 6970 00002430 5D07 dw KeyEmaMark -_start ;^^ 1E see ^L 6971 00002432 4A02 dw SimpleRet -_start ;1F 6972 ;--- 32 more for NE------ 6973 00002434 5D07 dw KeyEmaMark -_start ;^Space toggle selection mode (no shift cursor keys available!) 6974 00002436 7C05 dw KeyNedCtrlA -_start ;^a 1 Mark all 6975 00002438 1303 dw KeyIns -_start ;^b 2 toggle Ins mode 6976 0000243A D813 dw KeyEmaAltW -_start ;^c 3 COPY 6977 0000243C 4A02 dw SimpleRet -_start ;^d 4 6978 0000243E C119 dw KeyEditMode -_start ;^e 5 set EDit mode 6979 00002440 F104 dw KeyCtrlQF -_start ;^f 6 find 6980 00002442 5505 dw KeyCtrlL -_start ;^g 7 find again 6981 00002444 4903 dw KeyDell -_start ;^h 8 DEL 6982 00002446 0C01 dw NormChar -_start ;^i 9 TAB 6983 00002448 0202 dw KeyRet -_start ;^j a RETURN 6984 0000244A E41C dw KeyCtrlKN -_start ;^k b numerics 6985 0000244C B205 dw KeyCtrlQI -_start ;^l c LINE # 6986 0000244E 0202 dw KeyRet -_start ;^m d RETURN 6987 00002450 AB07 dw KeyEmaCtrlXF -_start ;^n e OPEN another 6988 00002452 AB07 dw KeyEmaCtrlXF -_start ;^o f OPEN another 6989 00002454 4A02 dw SimpleRet -_start ;^p 10 6990 00002456 1708 dw KeyCtrlKQ -_start ;^q 11 EXIT 6991 00002458 9104 dw KeyCtrlQA -_start ;^r 12 REPLACE 6992 0000245A F207 dw KeyCtrlKS -_start ;^s 13 SAVE 6993 0000245C 4A02 dw SimpleRet -_start ;^t 14 6994 %ifdef USE_UNDO 6995 0000245E 1220 dw KeyUndo -_start ;^u 15 UNDO 6996 %else 6997 dw SimpleRet -_start ;^u 15 6998 %endif 6999 00002460 6413 dw KeyEmaCtrlY -_start ;^v 16 PASTE 7000 00002462 D207 dw KeyEmaCtrlXW -_start ;^w 13 SAVE_AS/WRITE TO 7001 00002464 5F06 dw KeyEmaCtrlW -_start ;^x 18 CUT 7002 %ifdef UTF8RTS 7003 dw KeyUTF8switch-_start ;^y 19 7004 %else 7005 00002466 4A02 dw SimpleRet -_start ;^y 19 7006 %endif 7007 %ifdef SYS_kill 7008 00002468 281B dw KeySuspend -_start ;^z 1A 7009 %else 7010 dw SimpleRet -_start ;^z 7011 %endif 7012 0000246A 4A02 dw SimpleRet -_start ;^[ 1B 7013 0000246C 4A02 dw SimpleRet -_start ;^\ 1C 7014 0000246E 4A02 dw SimpleRet -_start ;^] 1D 7015 00002470 4A02 dw SimpleRet -_start ;^^ 1E 7016 00002472 4A02 dw SimpleRet -_start ;1F 7017 ;---------------------------------------------------------------------- 7018 ; 7019 %ifdef W32 7020 scolorslen equ 0 7021 %else 7022 00002474 07 BeepChar db 7 7023 00002475 1B5B34306D1B5B3337- screencolors0 db 27,'[40m',27,'[37m' 7024 0000247E 6D 7025 0000247F 1B5B306D bold0 db 27,'[0m' ;reset to b/w 7026 00002483 1B5B34346D1B5B3333- screencolors1 db 27,'[44m',27,'[33m' ;yellow on blue 7027 0000248C 6D 7028 reversevideoX: 7029 0000248D 1B5B316D bold1: db 27,'[1m' ;bold 7030 scolorslen equ $-screencolors1 7031 boldlen equ $-bold1 ;take care length of bold0 == length of bold1 7032 %ifdef LINUX 7033 db 27,'[7m' ;good for "linux" terminal on /dev/tty (but not xterm,kvt) 7034 ;again take care length = length of boldX 7035 ;!! important: store directly after bold1 !! 7036 %ifdef NEW_CURSOR_MGNT 7037 blockcurs db 27,'[?17;0;64c' ;see e3.h 7038 blockcurslen equ $-blockcurs 7039 normcurs db 27,'[?2c' 7040 normcurslen equ $-normcurs 7041 %endif 7042 %endif 7043 %endif 7044 %ifdef SELFTEST 7045 pipein db 'PIPE_IN',0 7046 %endif 7047 ;------- 7048 %ifdef UTF8 7049 %ifdef UTF8RTS 7050 getPos db 13, 0c3h, 0B6h,27,'[6n',13 ;write carriage_return, followed by 1 UTF8 char 7051 ;german umlaut oe = รถ in UTF-8 7052 gPlen equ $-getPos ;and clean up with another carriage_return 7053 ;Terminal should answer ESC[;R 7054 %endif ;on UTF8 terminals should be column==2 else ==3 7055 %endif 7056 ;------------------------------------------------------------------------- 7057 %ifdef ARMCPU 7058 align 2 7059 %endif 7060 00002491 702057537020506970- editmode:db 'p WSp Pip Emp NE' 7061 0000249A 20456D70204E45 7062 ; 7063 helptext: 7064 000024A1 4D6963726F45646974- db "MicroEditor e3 v2.7.0" 7065 000024AA 6F722065332076322E- 7066 000024B3 372E30 7067 %ifdef YASM 7068 db "Y" 7069 %endif 7070 %ifdef UTF8 7071 db "-UTF8 ",0C2h,0A9h 7072 %else 7073 000024B6 20284329 db " (C)" 7074 %endif 7075 000024BA 323030302D30362041- db "2000-06 A.Kleine",10 7076 000024C3 2E4B6C65696E650A 7077 000024CB 456E7465722066696C- db "Enter filename or leave with RETURN",10,10 7078 000024D4 656E616D65206F7220- 7079 000024DD 6C6561766520776974- 7080 000024E6 682052455455524E0A- 7081 000024EF 0A 7082 %ifdef YASM 7083 %ifdef UTF8 7084 helptextsize equ 54h 7085 %else 7086 helptextsize equ 50h 7087 %endif 7088 %else 7089 helptextsize equ $-helptext 7090 %if helptextsize>127 7091 %error helptextsize 7092 %endif 7093 %endif 7094 000024F0 0A0A0A0909092D3D20- helpfoot:db 10,10,10,TABCHAR,TABCHAR,TABCHAR,"-= PRESS ANY KEY =-" ;at least 6 wasted byte ;-) 7095 000024F9 505245535320414E59- 7096 00002502 204B4559203D2D 7097 %ifdef YASM 7098 helpfootsize equ 19h 7099 %else 7100 helpfootsize equ $-helpfoot 7101 %if helpfootsize>127 7102 %error helpfootsize 7103 %endif 7104 %endif 7105 ; 7106 %ifdef USE_BUILTINHELP 7107 help_ws: 7108 00002509 4B65792062696E6469- db "Key bindings in WS mode:",10,10 7109 00002512 6E677320696E205753- 7110 0000251B 206D6F64653A0A0A 7111 00002523 46696C65733A095E4B- db "Files: ^KR Insert ^KS Save ^KX Save&Exit ^KQ Abort&Exit",10 7112 0000252C 5220496E7365727409- 7113 00002535 5E4B53205361766509- 7114 0000253E 5E4B58205361766526- 7115 00002547 45786974095E4B5120- 7116 00002550 41626F727426457869- 7117 00002559 740A 7118 %ifndef USE_PIPE 7119 db " ^KD Save&Load",10 7120 %else 7121 %ifdef USE_EX_NO_SED 7122 db " ^KD Save&Load ^KP Pipe buffer thru 'ex' ",10 7123 %else 7124 0000255B 095E4B442053617665- db " ^KD Save&Load ^KP Pipe buffer thru 'sed'",10 7125 00002564 264C6F6164095E4B50- 7126 0000256D 205069706520627566- 7127 00002576 666572207468727520- 7128 0000257F 27736564270A 7129 %endif 7130 %endif 7131 00002585 0A db 10 7132 00002586 426C6F636B733A095E- db "Blocks: ^KB Start ^KK End ^KC Copy ^KY Del",10 7133 0000258F 4B4220537461727409- 7134 00002598 5E4B4B20456E640909- 7135 000025A1 5E4B4320436F707909- 7136 000025AA 5E4B592044656C0A 7137 000025B2 095E4B56204D6F7665- db " ^KV Move ^KW Write",10 7138 000025BB 095E4B572057726974- 7139 000025C4 650A 7140 000025C6 0A db 10 7141 000025C7 5365617263683A095E- db "Search: ^QF Find ^L Repeat ^QA Srch&Repl",10 7142 000025D0 51462046696E64095E- 7143 000025D9 4C2020526570656174- 7144 000025E2 095E51412053726368- 7145 000025EB 265265706C0A 7146 000025F1 4D6F76653A095E4520- db "Move: ^E Up ^X Down ^S Left ^D Right",10 7147 000025FA 20557009095E582020- 7148 00002603 446F776E095E532020- 7149 0000260C 4C656674095E442020- 7150 00002615 52696768740A 7151 0000261B 095E52202050616765- db " ^R Page Up ^C Page Dn ^W Scroll Up ^Z Scroll Dn",10 7152 00002624 205570095E43202050- 7153 0000262D 61676520446E095E57- 7154 00002636 20205363726F6C6C20- 7155 0000263F 5570095E5A20205363- 7156 00002648 726F6C6C20446E0A 7157 00002650 517569636B2D095E51- db "Quick- ^QE Wnd Top ^QX Wnd Bott ^QS Home ^QD End",10 7158 00002659 4520576E6420546F70- 7159 00002662 095E515820576E6420- 7160 0000266B 426F7474095E515320- 7161 00002674 486F6D65095E514420- 7162 0000267D 456E640A 7163 00002681 2D4D6F76653A095E51- db "-Move: ^QR BOF ^QC EOF ^QB Blk Begin ^QK Blk End",10 7164 0000268A 5220424F4609095E51- 7165 00002693 4320454F4609095E51- 7166 0000269C 4220426C6B20426567- 7167 000026A5 696E095E514B20426C- 7168 000026AE 6B20456E640A 7169 000026B4 095E4620204E657874- db " ^F Next Word ^A Prev Word ^QI Line# ^QV Last Find",10 7170 000026BD 20576F7264095E4120- 7171 000026C6 205072657620576F72- 7172 000026CF 64095E5149204C696E- 7173 000026D8 6523095E5156204C61- 7174 000026E1 73742046696E640A 7175 000026E9 0A db 10 7176 000026EA 44656C6574653A095E- db "Delete: ^T Word ^Y Line ^H Left ^G Chr",10 7177 000026F3 542020576F7264095E- 7178 000026FC 5920204C696E65095E- 7179 00002705 4820204C656674095E- 7180 0000270E 4720204368720A 7181 00002715 095E5159204C696E65- db " ^QY Line End ^QDel,^QH Line Beg",10 7182 0000271E 20456E64095E514465- 7183 00002727 6C2C5E5148204C696E- 7184 00002730 65204265670A 7185 %ifdef USE_MATH 7186 00002736 4F746865723A095E4B- db "Other: ^KM Set mode ^KN Numerics" 7187 0000273F 4D20536574206D6F64- 7188 00002748 65095E4B4E204E756D- 7189 00002751 6572696373 7190 %else 7191 db "Other: ^KM Set mode" 7192 %endif 7193 %ifdef SYS_kill 7194 00002756 095E4B5A2053757370- db " ^KZ Suspend " 7195 0000275F 656E6420 7196 %endif 7197 %ifdef USE_UNDO 7198 00002763 095E552020556E646F db " ^U Undo" 7199 %endif 7200 %ifdef UTF8RTS 7201 db 10," ^KU UTF8" 7202 %endif 7203 help_ws_size equ $-help_ws 7204 ;------------------------- 7205 help_pi: 7206 0000276C 4B65792062696E6469- db "Key bindings in PICO mode:",10,10 7207 00002775 6E677320696E205049- 7208 0000277E 434F206D6F64653A0A- 7209 00002787 0A 7210 00002788 46696C65733A095E58- db "Files: ^XN ExitNoSave ^XY Exit+Save ^XL Save+Load New File",10 7211 00002791 4E20457869744E6F53- 7212 0000279A 617665095E58592045- 7213 000027A3 7869742B5361766509- 7214 000027AC 5E584C20536176652B- 7215 000027B5 4C6F6164204E657720- 7216 000027BE 46696C650A 7217 000027C3 095E4F202053617665- db " ^O Save ^S Save as ^R Read",10 7218 000027CC 095E53202053617665- 7219 000027D5 206173095E52202052- 7220 000027DE 6561640A 7221 000027E2 0A db 10 7222 000027E3 4D6F76653A095E5020- db "Move: ^P Up ^N Down ^B Left ^F Right",10 7223 000027EC 20557009095E4E2020- 7224 000027F5 446F776E095E422020- 7225 000027FE 4C656674095E462020- 7226 00002807 52696768740A 7227 0000280D 095E59202050616765- db " ^Y Page up ^V Page down ^QN Next word ^QP Previous word",10 7228 00002816 207570095E56202050- 7229 0000281F 61676520646F776E09- 7230 00002828 5E514E204E65787420- 7231 00002831 776F7264095E515020- 7232 0000283A 50726576696F757320- 7233 00002843 776F72640A 7234 00002848 095E412020486F6D65- db " ^A Home ^E End ^QS Start ^QE EOF",10 7235 00002851 095E452020456E6409- 7236 0000285A 095E51532053746172- 7237 00002863 74095E514520454F46- 7238 0000286C 0A 7239 0000286D 095E515420546F7020- db " ^QT Top screen ^QB Bottom scr ^QL Line # ^QF last Find",10 7240 00002876 73637265656E095E51- 7241 0000287F 4220426F74746F6D20- 7242 00002888 736372095E514C204C- 7243 00002891 696E652023095E5146- 7244 0000289A 206C6173742046696E- 7245 000028A3 640A 7246 000028A5 0A db 10 7247 000028A6 5365617263683A095E- db "Search: ^W Where is ^T Search&Repl ^JT Repeat Search & Replace",10 7248 000028AF 572020576865726520- 7249 000028B8 6973095E5420205365- 7250 000028C1 61726368265265706C- 7251 000028CA 095E4A542052657065- 7252 000028D3 617420536561726368- 7253 000028DC 2026205265706C6163- 7254 000028E5 650A 7255 000028E7 0A db 10 7256 000028E8 44656C6574653A095E- db "Delete: ^H Left char ^D This char ^K Kill line/region",10 7257 000028F1 4820204C6566742063- 7258 000028FA 686172095E44202054- 7259 00002903 686973206368617209- 7260 0000290C 5E4B20204B696C6C20- 7261 00002915 6C696E652F72656769- 7262 0000291E 6F6E0A 7263 00002921 095E4A5720576F7264- db " ^JW Word ^JL Line end ^JH Line begin",10 7264 0000292A 095E4A4C204C696E65- 7265 00002933 20656E64095E4A4820- 7266 0000293C 4C696E652062656769- 7267 00002945 6E0A 7268 00002947 0A db 10 7269 00002948 4F746865723A095E55- db "Other: ^U Unkill ^G Help ^^,^L,^ Mark region",10 7270 00002951 2020556E6B696C6C09- 7271 0000295A 5E47202048656C7009- 7272 00002963 5E5E2C5E4C2C5E3C53- 7273 0000296C 50433E204D61726B20- 7274 00002975 726567696F6E0A 7275 %ifndef USE_PIPE 7276 db " ^QM Set Edit Mode ",10 7277 %else 7278 %ifdef USE_EX_NO_SED 7279 db " ^QM Set Edit Mode ^JP Pipe buffer thru 'ex' ",10 7280 %else 7281 0000297C 095E514D2053657420- db " ^QM Set Edit Mode ^JP Pipe buffer thru 'sed'",10 7282 00002985 45646974204D6F6465- 7283 0000298E 09095E4A5020506970- 7284 00002997 652062756666657220- 7285 000029A0 746872752027736564- 7286 000029A9 270A 7287 %endif 7288 %endif 7289 %ifdef USE_MATH 7290 000029AB 095E51432043616C63- db " ^QC Calculate" 7291 000029B4 756C617465 7292 %else 7293 db " " 7294 %endif 7295 %ifdef SYS_kill 7296 000029B9 0909095E5A20537573- db " ^Z Suspend" 7297 000029C2 70656E64 7298 %endif 7299 %ifdef USE_UNDO 7300 000029C6 095E515520556E646F db " ^QU Undo" 7301 %endif 7302 %ifdef UTF8RTS 7303 db 10," ^QV UTF8" 7304 %endif 7305 help_pi_size equ $-help_pi 7306 ;------------------------- 7307 help_em: 7308 000029CF 4B65792062696E6469- db "Key bindings in EMACS mode:",10,10 7309 000029D8 6E677320696E20454D- 7310 000029E1 414353206D6F64653A- 7311 000029EA 0A0A 7312 000029EC 46696C65733A095E58- db "Files: ^X^C Exit ^XI Insert ^X^S Save ^X^F Load New",10 7313 000029F5 5E432045786974095E- 7314 000029FE 58492020496E736572- 7315 00002A07 74095E585E53205361- 7316 00002A10 7665095E585E46204C- 7317 00002A19 6F6164204E65770A 7318 %ifndef USE_PIPE 7319 db " ^X^W Write new ^X^H Help ",10 7320 %else 7321 %ifdef USE_EX_NO_SED 7322 db " ^X^W Write new ^X^H Help ^X^P Pipe buffer thru 'ex' ",10 7323 %else 7324 00002A21 095E585E5720577269- db " ^X^W Write new ^X^H Help ^X^P Pipe buffer thru 'sed'",10 7325 00002A2A 7465206E6577095E58- 7326 00002A33 5E482048656C70095E- 7327 00002A3C 585E50205069706520- 7328 00002A45 627566666572207468- 7329 00002A4E 72752027736564270A 7330 %endif 7331 %endif 7332 00002A57 0A db 10 7333 00002A58 4D6F76653A095E5020- db "Move: ^P Up ^N Down ^B Left ^F Right",10 7334 00002A61 2020557009095E4E20- 7335 00002A6A 20446F776E095E4220- 7336 00002A73 20204C656674095E46- 7337 00002A7C 20202052696768740A 7338 00002A85 09616C745620506720- db " altV Pg up ^V Pg down altB Left word altF Right word",10 7339 00002A8E 7570095E5620205067- 7340 00002A97 20646F776E09616C74- 7341 00002AA0 42204C65667420776F- 7342 00002AA9 726409616C74462052- 7343 00002AB2 6967687420776F7264- 7344 00002ABB 0A 7345 00002ABC 095E41202020486F6D- db " ^A Home ^E End alt< BOF alt> EOF",10 7346 00002AC5 65095E452020456E64- 7347 00002ACE 0909616C743C20424F- 7348 00002AD7 4609616C743E20454F- 7349 00002AE0 460A 7350 00002AE2 09616C744720476F20- db " altG Go line# ^L Center Pos",10 7351 00002AEB 6C696E6523095E4C20- 7352 00002AF4 2043656E7465722050- 7353 00002AFD 6F730A 7354 00002B00 0A db 10 7355 00002B01 5365617263683A095E- db "Search: ^S Find fwd ^R Find bwd alt% Search&Replace like WS",10 7356 00002B0A 532046696E64206677- 7357 00002B13 64095E522046696E64- 7358 00002B1C 2062776409616C7425- 7359 00002B25 205365617263682652- 7360 00002B2E 65706C616365206C69- 7361 00002B37 6B652057530A 7362 00002B3D 0A db 10 7363 00002B3E 4275666665723A0961- db "Buffer: altW Copy ^Y Yank ^ Mark ^X^X Xchg Mark/Pt",10 7364 00002B47 6C745720436F707909- 7365 00002B50 5E592059616E6B0909- 7366 00002B59 5E3C5350433E204D61- 7367 00002B62 726B095E585E582058- 7368 00002B6B 636867204D61726B2F- 7369 00002B74 50740A 7370 00002B77 0A db 10 7371 00002B78 44656C6574653A095E- db "Delete: ^K Line ^W Region ^H Left Chr ^D This Chr",10 7372 00002B81 4B204C696E6509095E- 7373 00002B8A 5720526567696F6E09- 7374 00002B93 5E48204C6566740943- 7375 00002B9C 6872095E4420546869- 7376 00002BA5 73204368720A 7377 00002BAB 0A db 10 7378 %ifdef UTF8 7379 ; FIXME: ^T 7380 db "Other: ^O Open line ^I Ins Tab ^Q Quoted Ins",10 7381 %else 7382 00002BAC 4F746865723A095E4F- db "Other: ^O Open line ^T Xchg Chr ^I Ins Tab ^Q Quoted Ins",10 7383 00002BB5 204F70656E206C696E- 7384 00002BBE 65095E542058636867- 7385 00002BC7 20436872095E492049- 7386 00002BD0 6E7320546162095E51- 7387 00002BD9 2051756F7465642049- 7388 00002BE2 6E730A 7389 %endif 7390 00002BE5 095E4D204E4C09095E- db " ^M NL ^J NL+indent altX Set edit mode",10 7391 00002BEE 4A204E4C2B696E6465- 7392 00002BF7 6E7409616C74582053- 7393 00002C00 65742065646974206D- 7394 00002C09 6F64650A 7395 %ifdef USE_MATH 7396 00002C0D 095E585E4E2043616C- db " ^X^N Calculate" 7397 00002C16 63756C617465 7398 %else 7399 db " " 7400 %endif 7401 %ifdef SYS_kill 7402 00002C1C 0909095E5A20537573- db " ^Z Suspend" 7403 00002C25 70656E64 7404 %endif 7405 %ifdef USE_UNDO 7406 00002C29 095E5F2020556E646F db " ^_ Undo" 7407 %endif 7408 %ifdef UTF8RTS 7409 db 10," ^U UTF-8" 7410 %endif 7411 help_em_size equ $-help_em 7412 ;------------------------- 7413 help_vi: 7414 00002C32 4B65792062696E6469- db "Key bindings in vi mode:",10 7415 00002C3B 6E677320696E207669- 7416 00002C44 206D6F64653A0A 7417 00002C4B 0A db 10 7418 00002C4C 3C4553433E09090965- db " enter cmd mode",10 7419 00002C55 6E74657220636D6420- 7420 00002C5E 6D6F64650A 7421 00002C63 682C6A2C6B2C6C2C2B- db "h,j,k,l,+,-,, move by chars&lines",10 7422 00002C6C 2C2D2C3C5265743E2C- 7423 00002C75 3C5350433E096D6F76- 7424 00002C7E 652062792063686172- 7425 00002C87 73266C696E65730A 7426 00002C8F 5E422C5E462C5E442C- db "^B,^F,^D,^U move by [half]page",10 7427 00002C98 5E5509096D6F766520- 7428 00002CA1 6279205B68616C665D- 7429 00002CAA 706167650A 7430 00002CAF 242C302C5E2C772C62- db "$,0,^,w,b,e,H,L,M,z. move in line/screen",10 7431 00002CB8 2C652C482C4C2C4D2C- 7432 00002CC1 7A2E096D6F76652069- 7433 00002CCA 6E206C696E652F7363- 7434 00002CD3 7265656E0A 7435 00002CD8 2F2C3F2C4709090973- db "/,?,G srch fwd/bwd, go EOF",10 7436 00002CE1 726368206677642F62- 7437 00002CEA 77642C20676F20454F- 7438 00002CF3 460A 7439 00002CF5 6D612C276109090973- db "ma,'a set/go marker a",10 7440 00002CFE 65742F676F206D6172- 7441 00002D07 6B657220610A 7442 00002D0D 782C582C3C44656C3E- db "x,X,,dw,D dele chr,word,EOL",10 7443 00002D16 2C64772C4409096465- 7444 00002D1F 6C65206368722C776F- 7445 00002D28 72642C454F4C0A 7446 00002D2F 532C432C64642C6427- db "S,C,dd,d'a,yy,y'a subst,change,dele,yank",10 7447 00002D38 612C79792C79276109- 7448 00002D41 73756273742C636861- 7449 00002D4A 6E67652C64656C652C- 7450 00002D53 79616E6B0A 7451 00002D58 702C50090909706173- db "p,P paste",10 7452 00002D61 74650A 7453 00002D64 412C612C492C692C3C- db "A,a,I,i,,O,o enter ins.mode",10 7454 00002D6D 496E733E2C4F2C6F09- 7455 00002D76 656E74657220696E73- 7456 00002D7F 2E6D6F64650A 7457 00002D85 522C72090909656E74- db "R,r enter ovw.mode,ovw.chr",10 7458 00002D8E 6572206F76772E6D6F- 7459 00002D97 64652C6F76772E6368- 7460 00002DA0 720A 7461 00002DA2 4A0909096A6F696E20- db "J join lines",10 7462 00002DAB 6C696E65730A 7463 %ifdef USE_UNDO 7464 %ifdef SYS_kill 7465 00002DB1 5A5A2C5E5A2C207509- db "ZZ,^Z, u save&quit,suspend, undo!",10 7466 00002DBA 097361766526717569- 7467 00002DC3 742C73757370656E64- 7468 00002DCC 2C20756E646F210A 7469 %else 7470 db "ZZ, u save&ex, undo!",10 7471 %endif 7472 %else 7473 %ifdef SYS_kill 7474 db "ZZ,^Z save&quit,suspend",10 7475 %else 7476 db "ZZ save&ex",10 7477 %endif 7478 %endif 7479 %ifdef USE_MATH 7480 00002DD4 3B2C23090909453320- db ";,# E3 SPECIAL: set edit mode,calculate",10 7481 00002DDD 5350454349414C3A20- 7482 00002DE6 736574206564697420- 7483 00002DEF 6D6F64652C63616C63- 7484 00002DF8 756C6174650A 7485 %else 7486 db "; E3 SPECIAL:set edit mode",10 7487 %endif 7488 00002DFE 3A772C3A77712C3A78- db ":w,:wq,:x,:q,:q!,:e ex mode:save,quit,save_as,edit other",10 7489 00002E07 2C3A712C3A71212C3A- 7490 00002E10 65096578206D6F6465- 7491 00002E19 3A736176652C717569- 7492 00002E22 742C736176655F6173- 7493 00002E2B 2C65646974206F7468- 7494 00002E34 65720A 7495 00002E37 3A302C3A242C3A3C6C- db ":0,:$,: ex mode:go BOF,EOF,line",10 7496 00002E40 696E65233E09096578- 7497 00002E49 206D6F64653A676F20- 7498 00002E52 424F462C454F462C6C- 7499 00002E5B 696E650A 7500 %ifdef UTF8RTS 7501 db ":h,:u ex mode:help, UTF-8",10 7502 %else 7503 00002E5F 3A680909096578206D- db ":h ex mode:help",10 7504 00002E68 6F64653A68656C700A 7505 %endif 7506 %ifndef USE_PIPE 7507 db " " 7508 %else 7509 %ifdef USE_EX_NO_SED 7510 db ": pipe buffer thru 'ex' " 7511 %else 7512 00002E71 3A3C6F746865722063- db ": pipe buffer thru 'sed'" 7513 00002E7A 6D643E090970697065- 7514 00002E83 206275666665722074- 7515 00002E8C 687275202773656427 7516 %endif 7517 %endif 7518 help_vi_size equ $-help_vi 7519 ;------------------------- 7520 help_ne: 7521 00002E95 4B65792062696E6469- db "Key bindings in NEDIT mode:",10 7522 00002E9E 6E677320696E204E45- 7523 00002EA7 444954206D6F64653A- 7524 00002EB0 0A 7525 00002EB1 0A db 10 7526 00002EB2 46696C65733A09095E- db "Files: ^QN Exit_NoSave ^QY Exit&Save ^QL Save&Load new",10 7527 00002EBB 514E20457869745F4E- 7528 00002EC4 6F53617665095E5159- 7529 00002ECD 204578697426536176- 7530 00002ED6 65095E514C20536176- 7531 00002EDF 65264C6F6164206E65- 7532 00002EE8 770A 7533 00002EEA 09095E532020536176- db " ^S Save ^W WriteTo=SaveAs",10 7534 00002EF3 65095E572020577269- 7535 00002EFC 7465546F3D53617665- 7536 00002F05 41730A 7537 00002F08 4D6F76653A09095E4C- db "Move: ^L Line#",10 7538 00002F11 20204C696E65230A 7539 00002F19 09095E46202046696E- db " ^F Find ^R Search&Replace (like WS)",10 7540 00002F22 64095E522053656172- 7541 00002F2B 6368265265706C6163- 7542 00002F34 6520286C696B652057- 7543 00002F3D 53290A 7544 00002F40 09095E472020476F20- db " ^G Go repeat last ^F,^R",10 7545 00002F49 726570656174206C61- 7546 00002F52 7374205E462C5E520A 7547 00002F5B 0A db 10 7548 00002F5C 53656C6563743A0909- db "Select: ^ begin&extend by cursor keys (like Emacs)",10 7549 00002F65 5E3C53504143453E20- 7550 00002F6E 626567696E26657874- 7551 00002F77 656E64206279206375- 7552 00002F80 72736F72206B657973- 7553 00002F89 20286C696B6520456D- 7554 00002F92 616373290A 7555 00002F97 09095E412020416C6C- db " ^A All buffer",10 7556 00002FA0 206275666665720A 7557 00002FA8 09095E582020437574- db " ^X Cut ^C Copy ^V Paste",10 7558 00002FB1 09095E4320436F7079- 7559 00002FBA 20095E562050617374- 7560 00002FC3 650A 7561 00002FC5 0A db 10 7562 00002FC6 4F746865723A09095E- db "Other: ^E Set edit mode",10 7563 00002FCF 452020536574206564- 7564 00002FD8 6974206D6F64650A 7565 %ifdef UTF8RTS 7566 db " ^Y UTF8 view",10 7567 %endif 7568 %ifdef USE_MATH 7569 00002FE0 09095E4B202043616C- db " ^K Calculate",10 7570 00002FE9 63756C6174650A 7571 %endif 7572 00002FF0 0909616C7448204865- db " altH Help" 7573 00002FF9 6C70 7574 %ifdef SYS_kill 7575 00002FFB 095E5A205375737065- db " ^Z Suspend" 7576 00003004 6E64 7577 %endif 7578 %ifdef USE_UNDO 7579 00003006 095E5520556E646F db " ^U Undo" 7580 %endif 7581 help_ne_size equ $-help_ne 7582 %ifndef YASM 7583 %if help_ws_size != help_pi_size || help_ws_size!= help_em_size || help_ws_size!= help_pi_size || help_ws_size!= help_vi_size 7584 %error Helptext 7585 dw help_vi_size 7586 dw help_ws_size 7587 dw help_pi_size 7588 dw help_em_size 7589 %endif 7590 %endif 7591 %else ;no help texts built in 7592 help_ws: 7593 help_pi: 7594 help_em: 7595 help_vi: 7596 help_ne: 7597 db "This e3 is built w/o help texts." 7598 help_ws_size equ $-help_ws 7599 help_ne_size equ $-help_ws 7600 %endif 7601 ; 7602 errmsgs:errortext ;see e3.h 7603 <1> errmsgs: 7604 0000300E 4F70206E6F74207065- <1> db "Op not permitted",10 7605 00003017 726D69747465640A <1> 7606 0000301F 4E6F20737563682066- <1> db "No such file|directory",10 7607 00003028 696C657C6469726563- <1> 7608 00003031 746F72790A <1> 7609 00003036 0A <1> db 10 7610 00003037 0A <1> db 10 7611 00003038 496E7075742F6F7574- <1> db "Input/output",10 7612 00003041 7075740A <1> 7613 00003045 4E6F20737563682064- <1> db "No such device",10 7614 0000304E 65766963650A <1> 7615 00003054 0A <1> db 10 7616 00003055 0A <1> db 10 7617 00003056 4261642066696C6520- <1> db "Bad file descriptor",10 7618 0000305F 64657363726970746F- <1> 7619 00003068 720A <1> 7620 0000306A 4E6F206368696C6420- <1> db "No child processes",10 7621 00003073 70726F636573736573- <1> 7622 0000307C 0A <1> 7623 0000307D 0A <1> db 10 7624 0000307E 4D656D6F7279206578- <1> db "Memory exhausted",10 7625 00003087 686175737465640A <1> 7626 0000308F 5065726D697373696F- <1> db "Permission denied",10 7627 00003098 6E2064656E6965640A <1> 7628 000030A1 0A <1> db 10 7629 000030A2 0A <1> db 10 7630 000030A3 446576696365206275- <1> db "Device busy",10 7631 000030AC 73790A <1> 7632 000030AF 46696C652065786973- <1> db "File exists",10 7633 000030B8 74730A <1> 7634 000030BB 0A <1> db 10 7635 000030BC 4E6F20737563682064- <1> db "No such device",10 7636 000030C5 65766963650A <1> 7637 000030CB 0A <1> db 10 7638 000030CC 497320612064697265- <1> db "Is a directory",10 7639 000030D5 63746F72790A <1> 7640 000030DB 496E76616C69642061- <1> db "Invalid argument",10 7641 000030E4 7267756D656E740A <1> 7642 000030EC 546F6F206D616E7920- <1> db "Too many open files",10 7643 000030F5 6F70656E2066696C65- <1> 7644 000030FE 730A <1> 7645 00003100 546F6F206D616E7920- <1> db "Too many open files",10 7646 00003109 6F70656E2066696C65- <1> 7647 00003112 730A <1> 7648 00003114 496E617070726F7072- <1> db "Inappropriate ioctl",10 7649 0000311D 6961746520696F6374- <1> 7650 00003126 6C0A <1> 7651 00003128 546578742066696C65- <1> db "Text file busy",10 7652 00003131 20627573790A <1> 7653 00003137 46696C6520746F6F20- <1> db "File too large",10 7654 00003140 6C617267650A <1> 7655 00003146 4E6F20737061636520- <1> db "No space on device",10 7656 0000314F 6F6E20646576696365- <1> 7657 00003158 0A <1> 7658 00003159 496C6C6567616C2073- <1> db "Illegal seek",10 7659 00003162 65656B0A <1> 7660 00003166 522F4F2066696C6520- <1> db "R/O file system",10 7661 0000316F 73797374656D0A <1> 7662 00003176 43616E277420657865- <1> db "Can't exec " 7663 0000317F 6320 <1> 7664 <1> %ifdef USE_EX_NO_SED 7665 <1> db EX_PATH,10 7666 <1> %else 7667 00003181 2F7573722F62696E2F- <1> db SEDPATH,10 7668 0000318A 7365640A <1> 7669 <1> %endif 7670 0000318E 42726F6B656E207069- <1> db "Broken pipe",10 7671 00003197 70650A <1> 7672 7673 ;------- 7674 ; 7675 %ifdef CRIPLED_ELF 7676 filesize equ $ - $$ 7677 %endif 7678 ;----------------------------------------------------------------------- 7679 %ifdef ATHEOS 7680 section .data ;unused in Linux/FreeBSD/BeOS: save byte in ELF header 7681 bits 32 ;unused in W32: save byte in PE header 7682 %endif 7683 ;----------------------------------------------------------------------- 7684 %ifdef NETBSD ;added Sun Oct 9 10:10:00 CEST 2005 7685 section .note.netbsd.ident 7686 align 4 7687 dd 7 7688 dd 4 7689 dd 1 7690 db "NetBSD",0,0 7691 dd 0 7692 %endif 7693 ;----------------------------------------------------------------------- 7694 %ifdef OPENBSD 7695 section .note.openbsd.ident 7696 align 4 7697 dd 8 7698 dd 4 7699 dd 1 7700 db "OpenBSD",0 7701 dd 0 7702 %endif 7703 ;----------------------------------------------------------------------- 7704 section .bss 7705 bits 32 7706 align 4 7707 %ifdef CRIPLED_ELF 7708 bssstart: 7709 %endif 7710 screenbuffer_size equ 62*(160+32) ;estimated 62 lines 160 columns, 32 byte ESC seq (ca.12k) 7711 screenbuffer_dwords equ screenbuffer_size/4 7712 00000000 screenbuffer resb screenbuffer_size 7713 screenbuffer_end equ $ ;If you really have higher screen resolution, 7714 ;...no problem, except some useless redrawing happens. 7715 %ifdef W32 7716 attribbuffer resw 62*160 ;estimated 62 lines 160 columns 7717 attribbuffer_end equ $ 7718 %else 7719 00002E80 termios: resb termios_struc_size 7720 00002EAD termios_orig: resb termios_struc_size 7721 00002EDA winsize: resb winsize_struc_size 7722 setkplen equ 10 7723 00002EE2 setkp resb setkplen ;to store cursor ESC seq like db 27,'[000;000H' 7724 00002EEC resb 2 ;fill up 7725 00002EEE revvoff resd 1 7726 %endif 7727 %ifdef USE_UNDO 7728 00002EF2 enter_undo resd 1 ;a status byte: 1 while in a undo process, else 0 7729 00002EF6 last_undo_file resd 1 ;a pointer to undo info stored external in a disk file 7730 00002EFA undoptr resd 1 ;points on top frame in undo ringbuffer stack 7731 undobuffer_size equ 0x10000 ;64 k 7732 00002EFE undobuffer resb undobuffer_size 7733 undobuffer_end equ $ 7734 %endif 7735 00012EFE lines resd 1 ;equ 24 or similar i.e. screen lines-1 (1 for statusline) 7736 00012F02 columns resd 1 ;equ 80 or similar dword (using only LSB) 7737 00012F06 columne resd 1 ;helper for display of current column 7738 00012F0A zloffst resd 1 ;helper: chars scrolled out at left border 7739 00012F0E fileptr resd 1 ;helper for temp storage of current pos in file 7740 00012F12 kurspos resd 1 ;cursor position set by DispNewScreen() 7741 00012F16 kurspos2 resd 1 ;cursor position set by other functions 7742 7743 00012F1A tabcnt resd 1 ;internal helper byte in DispNewScreen() only 7744 00012F1E changed resd 1 ;status byte: (UN)CHANGED 7745 00012F22 oldQFpos resd 1 7746 00012F26 bereitsges resd 1 ;byte used for ^L 7747 7748 00012F2A blockbegin resd 1 7749 00012F2E blockende resd 1 7750 00012F32 endeedit resd 1 ;byte controls program exit 7751 00012F36 old resd 1 ;helper for ^QP 7752 00012F3A veryold resd 1 ;ditto 7753 00012F3E linenr resd 1 ;current line 7754 00012F42 showblock resd 1 ;helper for ^KH 7755 00012F46 suchlaenge resd 1 ;helper for ^QA,^QF 7756 00012F4A repllaenge resd 1 7757 00012F4E vorwarts resd 1 7758 00012F52 grossklein resd 1 ;helper byte for ^QF,^QA 7759 ; ^ ^ ^ ^ TODO check UTF-8 stuff here 7760 00012F56 ch2linebeg resd 1 ;helper keeping cursor pos max at EOL (up/dn keys) 7761 00012F5A numeriere resd 1 ;byte controls re-numeration 7762 00012F5E read_b resd 1 ;buffer for getchar 7763 %ifdef W32 7764 resd 4 ;4 extra due size INPUT_RECORD in w32 7765 %endif 7766 00012F62 isbold resd 1 ;control of bold display of ws-blocks 7767 00012F66 inverse resd 1 7768 00012F6A insstat resd 1 7769 7770 %ifdef AMD64 7771 ErrNr resq 1 7772 %else 7773 00012F6E ErrNr resd 1 ;used similar libc errno, but not excactly equal 7774 %endif 7775 errlen equ 100 7776 00012F72 error resb errlen ;reserved space for string: 'ERROR xxx:tttteeeexxxxtttt',0 7777 7778 00012FD6 maxlen resd 1 7779 ;------- 7780 ; 7781 maxfilenamelen equ 255 7782 00012FDA filepath resb maxfilenamelen+1 7783 000130DA bakpath resb maxfilenamelen+1 7784 000131DA blockpath resb maxfilenamelen+1 7785 000132DA replacetext resb maxfilenamelen+1 7786 000133DA suchtext resb maxfilenamelen+1 7787 000134DA suchtext2 resb maxfilenamelen+1 ;for PICO mode 7788 000135DA optbuffer resb optslen ;buffer for search/replace options and for ^QI 7789 linkbuffersize equ 4 7790 00013656 linkbuffer resb linkbuffersize 7791 0001365A sigaction resd 40 7792 ;------ 7793 000136FA perms resd 1 7794 %ifdef SYS_fstat 7795 000136FE fstatbuf: resb stat_struc_size 7796 %endif 7797 %ifdef SYS_utime 7798 00013762 accesstime: resb utimbuf_struc_size 7799 %endif 7800 ;------- 7801 00013772 screenline resb 256+4*scolorslen ;max possible columns + 4 color ESC seq per line 7802 ;(buffer for displaying a text line) 7803 %ifdef W32 7804 attribline resb 256*2 ;attrib is a word 7805 %endif 7806 000138AA EmaKiSize resd 1 7807 000138AE EmaKiSrc resd 1 7808 000138B2 EmaMark resd 1 7809 EmaCtrl: 7810 000138B6 EmaCtrlK resb 1 7811 000138B7 EmaCtrlS resb 1 7812 000138B8 resb 2 7813 000138BA EmaNumHelper resd 1 7814 000138BE VICmdMode resd 1 7815 000138C2 VIbufch resd 1 7816 000138C6 VInolinebased resd 1 7817 000138CA PicoSearch resd 1 ;where search started 7818 %ifdef UTF8RTS 7819 isUTF8 resd 1 7820 %endif 7821 %ifdef USE_PIPE 7822 000138CE sedpipeB0 resd 1 7823 000138D2 sedpipeB1 resd 1 7824 000138D6 sedpipeC0 resd 1 7825 000138DA sedpipeC1 resd 1 7826 %endif 7827 7828 000138DE mode resd 1 7829 7830 000138E2 readfds resd 1 ;select data struc 7831 000138E6 timevalsec resd 1 ;lowest 7832 000138EA timevalusec resd 1 ;most significant 7833 7834 7835 buffercopysize equ 1024 7836 000138EE buffercopy resb buffercopysize 7837 %ifdef USE_MATH 7838 00013CEE level resd 1 ;balance 7839 00013CF2 ptlevel resd 1 ;parenthesis balance 7840 %ifdef AMD64 7841 stackptr resq 1 7842 %else 7843 00013CF6 stackptr resd 1 ;escape recursion 7844 %endif 7845 00013CFA x87 resd 3 ;12 byte (need 10 byte for 80 bit BCD) 7846 00013D06 lastresult87 resq 4 ;8 byte 7847 00013D26 signctl resd 1 7848 %endif 7849 %ifdef W32 7850 heap resd 1 7851 hin resd 1 7852 hout resd 1 7853 w32result resd 1 ;for the w32 API calls 7854 csbi resd 6 ;screen_buffer_info 7855 %endif 7856 7857 %ifdef SYS_brk 7858 max equ 1024000 ;valid for NEW created files only 7859 %else 7860 max equ 10240000 7861 %endif 7862 ;------- 7863 00013D2A text resb max 7864 sot equ (text+1) ;start-of-text 7865 7866 %ifdef CRIPLED_ELF 7867 bsssize equ $-bssstart 7868 %endif