flat assembler
Message board for the users of flat assembler.
Index
> DOS > DOS seeks (was '' ???????? ?????? ??????? ?? ???????? ?? '') |
FASM challenge: Find out what this code is supposed to do - I'll post the solution later - Hint: it IS useful and works for me ;-) | |||||||||||||||||||||
|
|||||||||||||||||||||
Total Votes : 7 |
Author |
|
Madis731 29 Jul 2008, 09:13
a cracking challenge?
Like you said here: http://board.flatassembler.net/topic.php?p=80082#80075 Seems to be 16-bit code erm, I'll give a wild guess because on 64-bit systems this won't run. 1) \/\/ is nice ASCII-art 2) MOVNTQ is some illusion-making comment - what is so non-temporal about 0??? 3) is Bra a reference to womens' accessories ^o) Anyway: GUESS= your trying to count some interesting files from C-drive root ... and maybe subdirectory named SUB? |
|||
29 Jul 2008, 09:13 |
|
AxelDominatoR 29 Jul 2008, 13:44
I gave you code a rapid look.
From what I have understood, it tries to access the various files managing slashes/backslashes. It prints an happy smiley on good file access and a sad one on access failed. It displays file handles number with n * and good file closure with C. Then at the end you make a test for a 64 bit "long seek", right? |
|||
29 Jul 2008, 13:44 |
|
windwakr 29 Jul 2008, 14:14
It seems to test slashes in file handling? If I make a C:\blah.xxx all 6 blah.xxx's get smiley face. Same with C:\sub\blah.yyy
Some kind of self-modifying code? Why have pop defined as pope? Madis731: It looks like BRA stands for bracket "(" or ")" for smiley or sad face.
|
||||||||||
29 Jul 2008, 14:14 |
|
Madis731 30 Jul 2008, 13:43
windwakr wrote:
I think I know the answer to that. I've been thinking myself about aligning to same-length syntaxes (that sentence came out wierd) but here is a better explanation: Code: push rax rbx rcx pop rcx rbx rax ;you can align by adding a space here push rax rbx rcx popp rcx rbx rax ; this looks better BUT... psh rax rbx rcx pop rcx rbx rax ;...resembles more the other mnemonics: mov sub not xor ;etc. but maybe he's just joking there OT: What I've also thought about is making either push or pop reversed so I can easily copy-paste my push or pop line. Extremely time-expensive manual work: Code: push rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15 pop rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15 ;!!! modified pop |
|||
30 Jul 2008, 13:43 |
|
Shahada 01 Aug 2008, 09:45
You seems to check about operating system accept more slash and if it accept boths back and forward slash in file operation. Isn't it?
|
|||
01 Aug 2008, 09:45 |
|
Shahada 01 Aug 2008, 20:04
Sory windwakr I see not your solution before I answer.
|
|||
01 Aug 2008, 20:04 |
|
windwakr 01 Aug 2008, 20:14
DOS386: You gonna tell us exactly what it does now?
|
|||
01 Aug 2008, 20:14 |
|
DOS386 23 Aug 2008, 07:13
> You gonna tell us exactly what it does now?
YES. Madis731 wrote: Like you said here: Seems to be 16-bit code But in my code the use16 is visible just 5 lines below top of post. Why the sad smiley ? Quote: 3) is Bra a reference to womens' accessories ^o) YES. AxelDominatoR wrote: Quote: I gave you code a rapid look. Very good > It seems to test slashes in file handling? YES. > Some kind of self-modifying code? NO. > Why have pop defined as pope? http://board.flatassembler.net/topic.php?p=73815#73815 THE SOLUTION : It tests the ability of DOS kernel to put up with forward slashes (FreeDOS and EDR-DOS both good), and multiple slashes (FreeDOS: good | EDR-DOS: bad). Also it tests the new 64-bit seek (FreeDOS: not yet supported | EDR-DOS: BUG , but promised to get fixed) Challenge closed - but don't cry, I'll create a new one occasionally _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
23 Aug 2008, 07:13 |
|
DOS386 11 Jan 2009, 10:03
.
. This one exposes the "no-error-handling-at-all-BUG" in INT $21 / AX=$7142 in EDR-DOS (still present in 2009-Jan release) . . Code: ; FASM (R) code | 359 Bytes ; Tests bugged handling of INT $21 / AX = $42 $7142 $7342 $7542 $7742 ; in EDR-DOS and FreeDOS ; (CL) 2009-01-20 | Abuse at your own risk !!! define pope pop define popef popf format binary as "COM" use16 org $0100 ; [80286] ; Welcome call sseol call @f db '(CL) 2009 - Hi seeker (optional file "XX" to test)',0 myxx: db 'XX',0 @@: pope si call ssprint call ssdeol ; Announce open mov dx, 'Op' call ssdchar call ssspc ; Open + pick hen mov dx, myxx mov ax, $3D00 ; Open stuff int $21 ; Try to open call callres jnc short @f ; OK mov ax, $FFFE ; Invalid @@: mov bp, ax ; Hen call ssdeol ; Boast with hen mov dx, 'h=' call ssdchar mov ax, bp ; Hen call sshex16 call ssdeol ; Seek mov ax, $4200 ; Original old seek push ax call sshex16 call ssspc pope ax ; Origin type in AL is "0" - absolute mov bx, bp ; Hen mov cx, 0 ; Position in CX:DX (CX is high) | out DX:AX mov dx, 1 ; Input position is 1 int $21 call callres call ssdeol mov ah, $71 call bigseek mov ah, $73 call bigseek mov ah, $75 call bigseek mov ah, $77 call bigseek ; Announce close mov dx, 'Cl' call ssdchar ; Close mov bx, bp ; Hen mov ah, $3E ; Close it now, enough is enough !!! int $21 jmp zz ;------- ; SUB bigseek: mov al, $42 ; AH = $71 or $73 or $75 or $77 push ax call sshex16 ; Boast with AX call ssspc mov di, $0100 ; Buffer mov dx, di ; For INT also cld xor ax, ax ; MOVNTQ AX, 0 mov cx, 8 rep stosd ; Clear 16 bytes, CL==0 Origin type clc ; !!! pope ax ; Subfunc of INT $21 mov bx, bp ; Hen, if ever valid ... int $21 call callres jmp ssdeol ;----------- ; SUB callres: pushf pusha push ax mov dl, 0 adc dl, $30 push dx mov dx, 'C=' call ssdchar pope dx call sschar ; Report flag(C) call ssspc mov dx, 'A=' call ssdchar pope ax call sshex16 ; Report AX call ssspc popa popef ret ;---- ; SUB Write HEX16 | input in AX | trashes all sshex16: mov cl, 4 yy: mov dl, ah ; DL <- AH move 8 bits, only 4 useful shl ax, 4 shr dl, 4 add dl, $30 cmp dl, $3A jb @f ; "b" : below unsigned | OK, a number add dl, 7 @@: push ax push cx call sschar pope cx pope ax dec cl jnz yy ret ;---- ssspc: mov dl, 32 jmp sschar ;----------- ssdeol: call sseol ; and pass sseol: mov dx, $0A0D ; and pass ssdchar: push dx call sschar pope dx mov dl, dh ; and pass sschar: mov ah, 2 int $21 qq: ret ;---- sssad: call @f db " ",0 @@: pope si ; and pass ssprint: lodsb cmp al, 0 jz short qq ; Stealing a RAT mov dl, al call sschar jmp ssprint ;------------ ; The END of FUN (( zz: call ssdeol call @f db 'The truth is out',0 @@: pope si call ssprint call sssad call ssdeol mov ax, $4C00 ; Exit to DOS int $21 ;-------- ; END. Last edited by DOS386 on 24 Jan 2009, 03:13; edited 1 time in total |
|||
11 Jan 2009, 10:03 |
|
DOS386 24 Jan 2009, 03:10
Download now (all 3 tests in): download.php?id=4177 4'301 Bytes
Code: ; FASM (R) code | 512 Bytes ; Tests unusable performance of FAT "technology" ; (CL) 2009-01-20 | Abuse at your own risk !!! ; 1.5 GiB = 1'610'612'736 = $6000'0000 ; 1.75 GiB = 1'879'048'192 = $7000'0000 define pope pop define popef popf format binary as "COM" use16 org $0100 ; [80286] ; Welcome call sseol call @f db '(CL) 2009 - Hi seeker (need file "XX" >=1.75 GiB to test)',0 myxx: db 'XX',0 @@: pope si call ssprint call ssdeol ; Open junk mov dx, myxx mov ax, $3D00 ; Open stuff int $21 ; Try to open jnc short aa ; OK ; Bunch of trouble call @f db 'Not found',0 @@: pope si jmp short gg ;------------- pp0: call @f db 'We have a problem, dude',0 @@: pope si jmp short gg ;------------- bb: call @f db 'Not bloated enough',0 @@: pope si ; pass ; Finalize trouble gg: call ssprint call sssad jmp zz ; EOF ;------- ; OK so far, seek to end AKA "GetFileSizeObsolete" aa: mov bp, ax ; Hen mov bx, bp ; Hen mov ax, $4202 ; Original old seek to end xor cx, cx ; Position in CX:DX (CX is high) -> DX:AX xor dx, dx ; 0 int $21 pp1: jc short pp0 cmp dx, $7000 ; 1.75 GiB jb short bb ; Too small ; Report what we got push ax ; LO push dx ; HI call @f db 'Size: $',0 @@: pope si call ssprint pope ax call sshex16 mov dl, 39 ; "'" apo call sschar pope ax call sshex16 call ssdeol ; Seek to 0 mov bx, bp ; Hen mov ax, $4200 ; Original old seek back to begin xor cx, cx ; Position in CX:DX (CX is high) -> DX:AX xor dx, dx ; 0 int $21 pp2: jc short pp1 ; Peek timer call sspt push ax ; Do forward run mov cx, 25 ; 25 * 32 MiB = 800 MiB @@: stc ; Fwd call ssstep loop @b pope dx ; Start time in DX call sspt ; Preserves all except AX, AX is end time sub ax, dx ; Result in AX push ax call @f db ' Fwd time: $',0 @@: pope si call ssprint pope ax call sshex16 ; Isolate text call ssdeol ; Seek to 1.5 GiB mov bx, bp mov ax, $4200 ; Original old seek absolute xor dx, dx ; 0 mov cx, $6000 ; Position in CX:DX (CX is high) | 1.5 GiB int $21 jc short pp2 ; Peek timer call sspt push ax ; Do back run mov cx, 25 ; 25 * -32 MiB = -800 MiB , starting at 1536 MiB @@: clc ; Back call ssstep loop @b pope dx ; Start time in DX call sspt ; Preserves all except AX, AX is end time sub ax, dx ; Result in AX push ax call @f db ' Back time: $',0 @@: pope si call ssprint pope ax call sshex16 ; Close mov bx, bp ; Hen mov ah, $3E ; Close it now, enough is enough !!! int $21 jmp zz ;------- ; SUB: Seek step: reading 32 KiB & relative seeking by + or - 32 MiB ; Conmtrolled by flag(C): 1: FWD | 0: BACK ssstep: push cx pushf ; Read mov bx, bp ; Hen mov ax, $3F00 ; Read mov cx, $8000 ; How much: 32 KiB (has almost no effect) mov dx, $4000 ; Where: + 16 KiB int $21 jc short uu ; Seek mov bx, bp ; Hen mov ax, $4201 ; Original old seek relative xor dx, dx ; 0 mov cx, $0200 ; Distance in CX:DX (CX is high) | 32 MiB popef jc @f neg cx ; 0 - $0200 = $FE00 @@: int $21 ; Do seek jc short uu mov dl, 46 ; "." dot only on success call sschar uu: pope cx ret ;---- ; SUB: Peek timer into AX | Preserves all except AX and flags sspt: push es xor ax, ax ; MOVNTQ AX, 0 mov es, ax ; MOVNTQ ES, 0 mov ax, [es:$046C] ; There are 16 upper bits ... ignore the junk pope es ret ;---- ; SUB Write HEX16 | input in AX | trashes all sshex16: mov cl, 4 yy: mov dl, ah ; DL <- AH move 8 bits, only 4 useful shl ax, 4 shr dl, 4 add dl, $30 cmp dl, $3A jb @f ; "b" : below unsigned | OK, a number add dl, 7 @@: push ax push cx call sschar pope cx pope ax dec cl jnz yy ret ;---- ssspc: mov dl, 32 jmp sschar ;----------- ssdeol: call sseol ; and pass sseol: mov dx, $0A0D ; and pass ssdchar: push dx call sschar pope dx mov dl, dh ; and pass sschar: mov ah, 2 int $21 qq: ret ;---- sssad: call @f db " ",0 @@: pope si ; and pass ssprint: lodsb cmp al, 0 jz short qq ; Stealing a RAT mov dl, al call sschar jmp ssprint ;------------ ; The END of FUN (( zz: call ssdeol call @f db 'The truth is out',0 @@: pope si call ssprint call sssad call ssdeol mov ax, $4C00 ; Exit to DOS int $21 ;-------- ; END. Enjoy |
|||
24 Jan 2009, 03:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.