From e496cc76f5fe73655416f322507e4e1e26178baa Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Thu, 30 Jul 1998 22:57:10 +0200 Subject: [PATCH] X-HEAD 1.0 - displays Atari 8-bit executable headers. --- xhead.asm | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 xhead.asm diff --git a/xhead.asm b/xhead.asm new file mode 100644 index 0000000..1148060 --- /dev/null +++ b/xhead.asm @@ -0,0 +1,142 @@ + IDEAL + P386 + MODEL TINY + CODESEG + ORG 100h + include 'fox.mak' + +smartio = 1 + +start: print hello + mov di, 81h + movzx cx, [di-1] + jcxz usg + mov al, ' ' + repe scasb + je usg + push cx di + dec di + inc cx + mov al, '?' + repne scasb + pop di cx + jne nousg + +usg: mov dx, offset usgtxt +panic: print + int 20h + + smartdisk + +read: mov cx, 2 + fread addr + cmp ax, 2 + mov ax, [addr] + ret + +nousg: lea dx, [di-1] + mov al, ' ' + repne scasb + jne okend + dec di +okend: mov [byte di], 0 + fopen + + call read + mov dx, offset notbin + inc ax + jnz panic + +head1: inc [mods] + call read + jb eof + cmp ax, 0ffffh + je head1 + + inc [blox] + dec [mods] + mov [begn], ax + mov dl, ' ' + dos 2 + mov ax, [begn] + call prword + mov dl, '-' + dos 2 + + call read + mov dx, ax + sub dx, [begn] + inc dx + call prword + cmp dx, 2 + jne skip + cmp [begn], 2e0h + je pexec + cmp [begn], 2e2h + jne skip + inc [inits] +pexec: mov dl, ' ' + dos 2 + call read + call prword + jmp heade + +skip: xor cx, cx + file 4201h +heade: PEOL + jmp head1 + +eof: xor cx, cx + xor dx, dx + file 4202h + push ax + mov al, dl + call pbyte + pop ax + call prword + print byttxt + mov ax, [blox] + call prword + print blotxt + mov ax, [inits] + call prword + print initxt + mov ax, [mods] + call prword + print modtxt + fclose + ret + +prword: push ax + mov al, ah + call pbyte + pop ax +pbyte: ror ax, 4 + and al, 0fh + call pdig + shr ax, 12 +pdig: d2a + pusha + sta dx + dos 2 + popa + ret + +hello db 'X-HEAD 1.0 by Fox/Taquart',eot +usgtxt db 'You must specify a file to analyze.',eot +notbin db 'File is not Atari executable!',eot + smarterr +byttxt db ' bytes',eot +blotxt db ' blocks',eot +initxt db ' inits',eot +modtxt db ' modules',eot + +blox dw 0 +inits dw 0 +mods dw 0 + +addr dw ? +begn dw ? + + ENDS + END start \ No newline at end of file