annotate annotqt.asm @ 2:eac01194cb9a tip

annotated qt variant (annotqt)
author C. Masloch <pushbx@38.de>
date Thu, 25 Oct 2012 18:40:16 +0200
parents
children
rev   line source
2
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
1 ;86dos/nasm/quine ; annotated qt variant! (but regular payload)
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
2 ;public-domain,20110613,20121025,ecm
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
3 ; a minimal header has been retained as a necessary
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
4 ; identifier, which is naturally present both in the
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
5 ; source and as the program's "sign-on" message
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
6 ; this includes the copyright status and change dates
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
7 cpu 8086 ; this variant is semantically valid and entirely
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
8 org 256 ; equivalent to the original, only shorter!
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
9 a: ; short for alpha, this replaces start
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
10 mov dx,d ; short for and replaces data
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
11 mov cx,D ; capital letters replace _size prefixed labels
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
12 call c ; short for converted, formerly disp_converted
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
13 mov di,d
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
14 l: ; all labels are short forms, including loop here
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
15 mov dx,p ; prefix and prefix_size here use the same convention
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
16 mov cx,P ; as described for data and data_size above
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
17 call u ; as d is already taken, this is short for unconverted
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
18 mov dx,di
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
19 mov al,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
20 mov cx,-1 ; note the lack of blanks after commas
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
21 repne scasb ; and of course all the indentation is also missing
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
22 mov cx,di
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
23 dec cx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
24 dec cx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
25 sub cx,dx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
26 call u
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
27 mov dx,s ; formerly suffix
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
28 mov cx,S ; formerly suffix_size
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
29 call u
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
30 cmp di,o ; (see second-to-last line)
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
31 jne l
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
32 mov dx,e ; formerly end
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
33 mov cx,E ; formerly end_size
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
34 call u
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
35 mov ax,4C00h ; still not an 86-DOS 1.x (less reliable) call style
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
36 int 33 ; deeming some rather odd things acceptable here
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
37 c: ; (disp_)converted
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
38 mov si,dx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
39 jcxz .d
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
40 .l: ; this could be shortened further to just . (dot)
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
41 lodsb
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
42 cmp al,64 ; same as the int 33, 64 is shorter than 40h
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
43 jne .n
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
44 push cx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
45 push si
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
46 call .t
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
47 mov dx,q ; formerly doublequote
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
48 mov cx,Q ; formerly doublequote_size
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
49 call u
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
50 pop dx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
51 pop cx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
52 .n:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
53 loop .l
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
54 .d:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
55 inc si
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
56 .t:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
57 lea cx,[si-1]
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
58 sub cx,dx
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
59 u:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
60 mov bx,1 ; same as the original not using the CP/M-style call
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
61 mov ah,64 ; (again 40h written in decimal)
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
62 int 33 ; though it doesn't allow writing dollar signs anyway
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
63 retn ; this could use the ret alias but i dislike it
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
64 q:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
65 db '"'
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
66 Q equ $-q
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
67 p:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
68 db 'db "' ; such indirection could probably be simplified
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
69 P equ $-p
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
70 s:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
71 db '",13,10',13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
72 S equ $-s
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
73 e:
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
74 db "o:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
75 db "D equ $-d",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
76 E equ $-e
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
77 d: ; here comes the qt payload in its full 700-byte glory
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
78 db ";86dos/nasm/quine",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
79 db ";public-domain,20110613,20121025,ecm",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
80 db "cpu 8086",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
81 db "org 256",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
82 db "a:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
83 db "mov dx,d",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
84 db "mov cx,D",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
85 db "call c",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
86 db "mov di,d",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
87 db "l:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
88 db "mov dx,p",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
89 db "mov cx,P",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
90 db "call u",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
91 db "mov dx,di",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
92 db "mov al,10",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
93 db "mov cx,-1",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
94 db "repne scasb",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
95 db "mov cx,di",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
96 db "dec cx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
97 db "dec cx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
98 db "sub cx,dx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
99 db "call u",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
100 db "mov dx,s",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
101 db "mov cx,S",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
102 db "call u",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
103 db "cmp di,o",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
104 db "jne l",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
105 db "mov dx,e",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
106 db "mov cx,E",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
107 db "call u",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
108 db "mov ax,4C00h",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
109 db "int 33",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
110 db "c:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
111 db "mov si,dx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
112 db "jcxz .d",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
113 db ".l:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
114 db "lodsb",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
115 db "cmp al,64",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
116 db "jne .n",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
117 db "push cx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
118 db "push si",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
119 db "call .t",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
120 db "mov dx,q",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
121 db "mov cx,Q",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
122 db "call u",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
123 db "pop dx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
124 db "pop cx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
125 db ".n:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
126 db "loop .l",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
127 db ".d:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
128 db "inc si",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
129 db ".t:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
130 db "lea cx,[si-1]",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
131 db "sub cx,dx",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
132 db "u:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
133 db "mov bx,1",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
134 db "mov ah,64",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
135 db "int 33",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
136 db "retn",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
137 db "q:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
138 db "db '@'",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
139 db "Q equ $-q",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
140 db "p:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
141 db "db 'db @'",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
142 db "P equ $-p",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
143 db "s:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
144 db "db '@,13,10',13,10",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
145 db "S equ $-s",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
146 db "e:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
147 db "db @o:@,13,10",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
148 db "db @D equ $-d@,13,10",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
149 db "E equ $-e",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
150 db "d:",13,10
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
151 o: ; the first label being alpha this last one is omega
eac01194cb9a annotated qt variant (annotqt)
C. Masloch <pushbx@38.de>
parents:
diff changeset
152 D equ $-d