1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
| seg001 segment byte public 'CODE'
assume cs:seg001
org 100h
assume es:nothing, ss:nothing, ds:seg001
public start
start proc near
jmp short loc_0_14D
;
aTcclogoV2_1ByK db 0Dh,' ',0Dh,0Ah
db 'TCCLogo v2.1 by Kludge.',0Dh,0Ah
db 1Ah ;
db 0Dh,' ',0Dh,'$'
db 28h dup(0)
;
loc_0_14D: ; CODE XREF: startj
;comment #
cld
xor ax, ax
mov cx, (offset oldVmode - offset encr)
mov si, offset encr
mov di, si
loc_0_158: ; CODE XREF: start+5Ej
lodsb
xor al, ah
nop
xchg ah, al
loop loc_0_158
;#
encr: ; DATA XREF: start+50t start+53o
jmp sub_0_2B6
start endp
;
aNoVgaFound db 0Dh,0Ah ; DATA XREF: sub_0_2B6+1Fo
db 'No VGA found!',0Dh,0Ah,'$'
aCanTGrabMemory db 0Dh,0Ah ; DATA XREF: sub_0_2B6+3Bo
db 'Can',27h,'t grab memory!',0Dh,0Ah,'$'
; X Y/L BG/FG
byte_0_18C db 000h, 00Bh, 041h ; DATA XREF: sub_0_2B6+ACo
db 000h, 02Bh, 043h
db 004h, 043h, 041h
db 004h, 063h, 043h
db 004h, 083h, 041h
db 004h, 0A3h, 043h
db 004h, 0C3h, 041h
db 004h, 0E3h, 043h
db 012h, 005h, 048h
db 010h, 029h, 048h
db 00Fh, 043h, 04Ah
db 00Eh, 063h, 04Ah
db 00Eh, 083h, 04Ah
db 00Fh, 0A3h, 048h
db 010h, 0C9h, 048h
db 012h, 0E5h, 048h
;comment #
db 018h, 043h, 04Eh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
db 018h, 0A3h, 04Fh
;#
db 022h, 005h, 05Ch
db 020h, 029h, 05Ah
db 01Fh, 043h, 059h
db 01Eh, 063h, 058h
db 01Eh, 083h, 058h
db 01Fh, 0A3h, 059h
db 020h, 0C9h, 05Ah
db 023h, 0E5h, 05Ch
db 028h, 043h, 061h
db 028h, 0A3h, 061h
byte_0_1F8 db 5 ; DATA XREF: sub_0_2B6+120r
; sub_0_2B6+12Dr ...
off_0_1F9 dw offset fgLinAddr ; DATA XREF: sub_0_2B6+E2r
; sub_0_2B6+14Bw
db 1, 1, 1
db 0, 0, 0
db 1, 0, 0
db 0, 1, 1
db 0, 1, 0
db 1, 0, 1
db 0, 0, 1
db 1, 1, 0
; S U B R O U T I N E
sub_0_213 proc near ; CODE XREF: sub_0_2B6+8Dp
; sub_0_2B6+182p ...
push ax
push cx
push dx
push si
xor ax, ax
mov cx, 0C3h
mov si, offset byte_0_7EF
loc_0_21F: ; CODE XREF: sub_0_213+32j
push ax
push ax
mov dx, 3DAh
cli
loc_0_225: ; CODE XREF: sub_0_213+15j
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
test al, 8
jnz loc_0_225
loc_0_22A: ; CODE XREF: sub_0_213+1Aj
in al, dx ; Video status bits:
; 0: retrace. 1=display is in vert or horiz retrace.
; 1: 1=light pen is triggered; 0=armed
; 2: 1=light pen switch is open; 0=closed
; 3: 1=vertical sync pulse is occurring.
test al, 8
jz loc_0_22A
mov dx, 3C8h
pop ax
out dx, al
nop
nop
inc dx
loc_0_237: ; CODE XREF: sub_0_213+26j
lodsb
out dx, al
loop loc_0_237
sti
pop ax
or ax, ax
jnz loc_0_247
mov al, 41h
mov cl, 0B1h
jmp short loc_0_21F
;
loc_0_247: ; CODE XREF: sub_0_213+2Cj
pop si
pop dx
pop cx
pop ax
retn
sub_0_213 endp
; S U B R O U T I N E
sub_0_24C proc near ; CODE XREF: sub_0_2B6+1B1p
push bx
push cx
push si
mov cx, 3
xor si, si
mov bx, ax
loc_0_256: ; CODE XREF: sub_0_24C+28j
cmp byte ptr [bx+si], 1
jnz loc_0_268
cmp byte_0_7F2[si], 3Fh
jge loc_0_273
inc byte_0_7F2[si]
jmp short loc_0_273
;
loc_0_268: ; CODE XREF: sub_0_24C+Dj
cmp byte_0_8B2[si], 3Fh
jge loc_0_273
inc byte_0_8B2[si]
loc_0_273: ; CODE XREF: sub_0_24C+14j
; sub_0_24C+1Aj ...
inc si
loop loc_0_256
pop si
pop cx
pop bx
retn
sub_0_24C endp
; S U B R O U T I N E
sub_0_27A proc near ; CODE XREF: sub_0_2B6+1B6p
push bx
push cx
push si
mov cx, 3
xor si, si
mov bx, ax
loc_0_284: ; CODE XREF: sub_0_27A+36j
cmp byte ptr [bx+si], 1
jnz loc_0_2A4
cmp si, 2
jz loc_0_297
cmp byte_0_7F2[si], 0
jle loc_0_2AF
jmp short loc_0_29E
;
loc_0_297: ; CODE XREF: sub_0_27A+12j
cmp byte_0_7F2[si], 18h
jle loc_0_2AF
loc_0_29E: ; CODE XREF: sub_0_27A+1Bj
dec byte_0_7F2[si]
jmp short loc_0_2AF
;
loc_0_2A4: ; CODE XREF: sub_0_27A+Dj
cmp byte_0_8B2[si], 0
jle loc_0_2AF
dec byte_0_8B2[si]
loc_0_2AF: ; CODE XREF: sub_0_27A+19j
; sub_0_27A+22j ...
inc si
loop loc_0_284
pop si
pop cx
pop bx
retn
sub_0_27A endp
; S U B R O U T I N E
sub_0_2B6 proc near ; CODE XREF: start+60j
mov ax, 1A00h
int 10h ; - VIDEO - DISPLAY COMBINATION (PS,VGA/MCGA): read display combination code
cmp al, 1Ah
jnz loc_0_2D3
cmp bl, 7
jz loc_0_2E2
cmp bl, 8
jz loc_0_2E2
cmp bl, 0Bh
jz loc_0_2E2
cmp bl, 0Ch
jz loc_0_2E2
loc_0_2D3: ; CODE XREF: sub_0_2B6+7j
mov ah, 9
mov dx, offset aNoVgaFound ; "\r\nNo VGA found!\r\n$"
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov byte ptr exit_code+1, 5
jmp loc_0_4C5
;
loc_0_2E2: ; CODE XREF: sub_0_2B6+Cj
; sub_0_2B6+11j ...
mov ah, 4Ah
mov bx, offset memtop
mov cl, 4
shr bx, cl
int 21h ; DOS - 2+ - ADJUST MEMORY BLOCK SIZE (SETBLOCK)
; ES = segment address of block to change
; BX = new size in paragraphs
jnb loc_0_2FE
mov ah, 9
mov dx, offset aCanTGrabMemory ; "\r\nCan't grab memory!\r\n$"
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
mov byte ptr exit_code+1, 0Ah
jmp loc_0_4C5
;
loc_0_2FE: ; CODE XREF: sub_0_2B6+37j
cli
mov sp, offset stktop
sti
; mov ah, 0Fh
mov ax, 4F03h
int 10h ; - VIDEO - GET CURRENT VIDEO MODE
; Return: AH = number of columns on screen
; AL = current video mode
; BH = current active display page
mov oldVmode, bx
mov ax, 1017h
xor bx, bx
mov cx, 100h
mov dx, offset DACs
int 10h ; - VIDEO - READ BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
; BX = starting palette register, CX = number of palette registers to read
; ES:DX -> buffer (3 * CX bytes in size)
; Return: CX number of red, green and blue triples in buffer
mov ax, 1009h
mov dx, offset PALs
int 10h ; - VIDEO - READ ALL PALETTE
; ES:DX -> 17-byte buffer
push es
mov ax, 40h
mov es, ax
assume es:nothing
mov ax, word ptr es:[89h]
mov word ptr Vsave, ax
pop es
assume es:seg001
mov ax, 1200h
mov bl, 31h
int 10h ; - VIDEO - ALTERNATE FUNCTION SELECT (VGA, MCGA) - PALETTE LOADING: enable default palette loading
mov ax, 13h
; mov ax, 4F02h
; mov bx, 13h
int 10h ; - VIDEO - SET VIDEO MODE
; AL = mode
xor ax, ax
mov cx, 180h
mov di, offset byte_0_7EF
repe stosw
call sub_0_213
push es
mov ah, 0A0h
mov es, ax
assume es:nothing
xor bx, bx
bgWRloopV: ; CODE XREF: sub_0_2B6+E0j
xor cx, cx
bgWRloopH: ; CODE XREF: sub_0_2B6+DAj
mov ax, 8000
mul bx
mov di, ax
mov ax, 52
mul cl
add ax, 1287
add di, ax
push bx
push cx
mov si, offset byte_0_18C
mov cx, 36
loc_0_368: ; CODE XREF: sub_0_2B6+D2j
push di
push cx
xor ax, ax
lodsb
add di, ax
lodsb
push ax
mov cl, 4
shr ax, cl
mov bx, 320
mul bx
loc_0_37A:
add di, ax
pop cx
and cl, 0Fh
lodsb
loc_0_381: ; CODE XREF: sub_0_2B6+CEj
stosb
inc al
loop loc_0_381
pop cx
pop di
loop loc_0_368
pop cx
pop bx
inc cx
cmp cx, 6
jl bgWRloopH
inc bx
cmp bx, 8
jl bgWRloopV
fgWRloopV: ; CODE XREF: sub_0_2B6+151j
mov di, off_0_1F9
mov si, offset byte_0_18C
mov cx, 24h
fgWRloopH: ; CODE XREF: sub_0_2B6+143j
push di
push cx
xor ax, ax
lodsb
mov bp, ax
lodsb
push ax
mov cl, 4
shr ax, cl
push ax
mov bx, 320
mul bx
add ax, bp
mov bx, 7
mul bx
pop dx
add di, ax
lodsb
pop cx
and cl, 0Fh
mov al, 7
mul cl
mov cx, ax
mov bl, 8
mov ax, dx
shr ax, 1
mov ah, 7
mul ah
loc_0_3D4:
dec ah
loc_0_3D6: ; CODE XREF: sub_0_2B6+13Fj
cmp byte_0_1F8, 1
jnz loc_0_3E1
inc al
jmp short loc_0_3E7
;
loc_0_3E1: ; CODE XREF: sub_0_2B6+125j
mov al, 76h
add al, byte_0_1F8
loc_0_3E7: ; CODE XREF: sub_0_2B6+129j
push cx
repe stosb
pop cx
dec bl
jz loc_0_3F7
sub di, cx
add di, 320
jmp short loc_0_3D6
;
loc_0_3F7: ; CODE XREF: sub_0_2B6+137j
pop cx
pop di
loop fgWRloopH
dec byte_0_1F8
jz loc_0_409
sub off_0_1F9, 321
jmp short fgWRloopV
;
loc_0_409: ; CODE XREF: sub_0_2B6+149j
pop es
assume es:seg001
xor ax, ax
mov bx, 18h
mov cx, 41h
mov di, offset byte_0_7EF
loc_0_415: ; CODE XREF: sub_0_2B6+163j
stosw
xchg ax, bx
stosb
xchg ax, bx
loop loc_0_415
mov cx, 0A5h
repe stosb
mov cl, 4
loc_0_422: ; CODE XREF: sub_0_2B6+170j
stosw
xchg ax, bx
stosb
xchg ax, bx
loop loc_0_422
mov byte ptr [di-2], 16h
mov byte ptr [di-5], 18h
mov byte ptr [di-8], 1Ah
mov byte ptr [di-0Bh], 1Ch
call sub_0_213
loc_0_43B: ; CODE XREF: sub_0_2B6+1CFj
xor cx, cx
loc_0_43D: ; CODE XREF: sub_0_2B6+1CDj
xor dx, dx
loc_0_43F: ; CODE XREF: sub_0_2B6+1C7j
push cx
std
mov si, offset byte_0_8AE
mov di, offset byte_0_8B1
mov cx, 0BDh
repe movsb
mov si, offset byte_0_953
mov di, offset byte_0_956
mov cx, 0A2h
repe movsb
cld
pop cx
xor ax, ax
mov al, 3
mul cl
add ax, 1FBh
cmp dx, 64
jge loc_0_46C
call sub_0_24C
jmp short loc_0_46F
;
loc_0_46C: ; CODE XREF: sub_0_2B6+1AFj
call sub_0_27A
loc_0_46F: ; CODE XREF: sub_0_2B6+1B4j
call sub_0_213
mov ah, 1
int 16h ; KEYBOARD - CHECK BUFFER, DO NOT CLEAR
; Return: ZF clear if character in buffer
; AH = scan code, AL = character
; ZF set if no character in buffer
jnz loc_0_487
inc dx
cmp dx, 80h
jnz loc_0_43F
inc cx
cmp cx, 8
jnz loc_0_43D
jmp short loc_0_43B
;
loc_0_487: ; CODE XREF: sub_0_2B6+1C0j
xor ax, ax
int 16h ; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY
; Return: AH = scan code, AL = character
; xor ax, ax
; mov al, oldVmode
mov bx, oldVmode
mov ax, 4F02h
int 10h ; - VIDEO - SET VIDEO MODE
; AL = mode
mov ax, 1012h
xor bx, bx
mov cx, 100h
mov dx, offset DACs
int 10h ; - VIDEO - SET BLOCK OF DAC REGISTERS (EGA, VGA/MCGA)
; BX = starting color register, CX = number of registers to set
; ES:DX -> table of 3*CX bytes where each 3 byte group represents one
; byte each of red, green and blue (0-63)
mov ax, 1002h
mov dx, offset PALs
int 10h ; - VIDEO - SET ALL PALETTE REGISTERS (Jr, PS, TANDY 1000, EGA, VGA)
; ES:DX -> 17-byte palette register list
and word ptr Vsave, 8
jz loc_0_4B5
mov ax, 1201h
mov bl, 31h
int 10h ; - VIDEO - ALTERNATE FUNCTION SELECT (VGA, MCGA) - PALETTE LOADING: disable default palette loading
loc_0_4B5: ; CODE XREF: sub_0_2B6+1F6j
mov byte ptr exit_code+1, 0
mov ah, 4Ah
mov bx, offset core
mov cl, 4
shr bx, cl
int 21h ; DOS - 2+ - ADJUST MEMORY BLOCK SIZE (SETBLOCK)
; ES = segment address of block to change
; BX = new size in paragraphs
loc_0_4C5: ; CODE XREF: sub_0_2B6+29j
; sub_0_2B6+45j
mov ah, 9
mov dx, offset aTcclogoV2_1ByK ; "\r \r\nTCCLogo v2.1 by Kludge.\r\n"
int 21h ; DOS - PRINT STRING
; DS:DX -> string terminated by "$"
xor ax, ax
mov di, 100h
mov cx, (offset top_clr+1 - offset start)
top_clr: ; DATA XREF: sub_0_2B6+21Bt
repe stosb
exit_code: ; DATA XREF: sub_0_2B6+24w
; sub_0_2B6+40w ...
mov ax, 4CFFh
int 21h ; DOS - 2+ - QUIT WITH EXIT CODE (EXIT)
sub_0_2B6 endp ; AL = exit code
;
oldVmode dw ?
PALs = oldVmode+2
core = PALs+0Dh
Vsave = core + 4
DACs = Vsave+1
byte_0_7EF = DACs+301h
byte_0_7F2 = byte_0_7EF+3
byte_0_8AE = byte_0_7F2+0BCh
byte_0_8B1 = byte_0_8AE+3
byte_0_8B2 = byte_0_8B1+1
byte_0_953 = byte_0_8B2+0A1h
byte_0_956 = byte_0_953+3
stktop = byte_0_956+1D9h
memtop = stktop+10h
fgLinAddr = 3D4Bh
seg001 ends
end start |