Jump to content
  • entries
    15
  • comments
    7
  • views
    14,257

Dissecting Atari Display Lists

kenjennings

858 views

A while ago I was working on a project and needed to know where the Atari OS chose to create its graphics modes in memory. I ended up making a tool in BASIC XL that walks the current display list, and describes each ANTIC instruction.

The output looks like this below. The example is a dump of the GRAPHICS 2 display list which includes a text window:

Disassembled Display List (GR2)to its corresponding graphics lineand Scan Line...DL Byte  Value   Gfx Line Scan Line(s)         TV Scan Line(s)      Description=======  =====   ======== ============         ===============      ============$000 000 $70 112          $01 - $08 001 - 008  $08 - $0F 008 - 015  8 Blank Lines$001 001 $70 112          $09 - $10 009 - 016  $10 - $17 016 - 023  8 Blank Lines$002 002 $70 112          $11 - $18 017 - 024  $18 - $1F 024 - 031  8 Blank Lines$003 003 $47 071 $01 001  $19 - $28 025 - 040  $20 - $2F 032 - 047  Mode 7 + LMS (16 Scan Lines)$004 004 $70 112$005 005 $9E 158$006 006 $07 007 $02 002  $29 - $38 041 - 056  $30 - $3F 048 - 063  Mode 7 (16 Scan Lines)$007 007 $07 007 $03 003  $39 - $48 057 - 072  $40 - $4F 064 - 079  Mode 7 (16 Scan Lines)$008 008 $07 007 $04 004  $49 - $58 073 - 088  $50 - $5F 080 - 095  Mode 7 (16 Scan Lines)$009 009 $07 007 $05 005  $59 - $68 089 - 104  $60 - $6F 096 - 111  Mode 7 (16 Scan Lines)$00A 010 $07 007 $06 006  $69 - $78 105 - 120  $70 - $7F 112 - 127  Mode 7 (16 Scan Lines)$00B 011 $07 007 $07 007  $79 - $88 121 - 136  $80 - $8F 128 - 143  Mode 7 (16 Scan Lines)$00C 012 $07 007 $08 008  $89 - $98 137 - 152  $90 - $9F 144 - 159  Mode 7 (16 Scan Lines)$00D 013 $07 007 $09 009  $99 - $A8 153 - 168  $A0 - $AF 160 - 175  Mode 7 (16 Scan Lines)$00E 014 $07 007 $0A 010  $A9 - $B8 169 - 184  $B0 - $BF 176 - 191  Mode 7 (16 Scan Lines)$00F 015 $42 066 $0B 011  $B9 - $C0 185 - 192  $C0 - $C7 192 - 199  Mode 2 + LMS (8 Scan Lines)$010 016 $60 096$011 017 $9F 159$012 018 $02 002 $0C 012  $C1 - $C8 193 - 200  $C8 - $CF 200 - 207  Mode 2 (8 Scan Lines)$013 019 $02 002 $0D 013  $C9 - $D0 201 - 208  $D0 - $D7 208 - 215  Mode 2 (8 Scan Lines)$014 020 $02 002 $0E 014  $D1 - $D8 209 - 216  $D8 - $DF 216 - 223  Mode 2 (8 Scan Lines)$015 021 $41 065                                                   JVB - Jump Vertical Blank$016 022 $58 088$017 023 $9E 158


.


All the numeric values are output as hexadecimal values first, and decimal values second.


"DL Byte" reports the instruction byte's offset from the start of the Display List.

"Value" is the Display List Instruction.

"Gfx Line" counts the number of text or mode lines of actual graphics output by the display list. Blank line, LMS, and Jump instructions do not count as graphics lines. (Yeah, kind of useless. What was I thinking?)

"Scan Lines" shows the starting scan line and ending scan line of the instruction as ANTIC outputs scan lines.

"TV Scan Lines" reports the starting scan line and ending scan line of the instruction. The reason for the difference is that the Atari's scan line generator doesn't start until the 8th scan line of the television.

"Description" is a text explanation of the ANTIC instruction plus any other options added to the instruction.


If I were to do this again, I think I would add a screen memory counter to report the physical memory ANTIC outputs with the text or map modes.


Here is the BASIC XL listing:

1000 Save "D2:EXAMDL.BXL"1005 Fast1010 Rem DISASSEMBLE A DISPLAY LIST.1015 Rem RESULT APPEARS ON "D2:"1020 Rem JUST SET GMODE TO THE DESIRED1025 Rem GRAPHICS MODE AND EVERYTHING1030 Rem ELSE IS AUTOMATIC.1035 Rem A CLEVER PERSON COULD CHANGE1040 Rem HOW THE DL LOCATION IS1045 Rem DETERMINED AND SO DISASSEMBLE1050 Rem A CUSTOM DISPLAY LIST.1055 Rem1060 Rem DL BYTE, VALUE, GFX LINE, SCAN LINE(S), TV SCAN LINE(S), DESCRIPTION1065 Rem1070 Dim Scl(16)1075   For Loop=0 To 15:Read Scl(Loop):Next Loop1080 Data 0,0,8,10,8,16,8,16,8,4,4,2,1,2,1,11085 Rem1090 Gmode=0:Rem OS GRAPHICS MODE.1095 Dev$="D2:":Rem DEVICE STRING.1100 Rem1105 Trap 1880:Rem STOP DISASSEMBLY.  CLOSE FILE.1110 Rem1115 Tmode=Gmode&$10:Rem TEXT OPTION.1120 Gmode=Gmode&$0f:Rem BASE GRAPHICS MODE1125 If ((Gmode<1) Or ((Gmode> And (Gmode<12))) Then Tmode=01130 Graphics Gmode+Tmode1135 Dl=Dpeek($0230)1140 Maxoffset=240*3:Rem MUST BE A LIMIT SOMEWHERE1145 M$="023456789ABCDEF":Rem MODES. $2 = "2"1150 Gline=0:Lastg=0:Rem CURRENT GFX LINE1155 Sline=0:Lasts=0:Rem SCAN LINE1160 Tline=7:Lastt=7:Rem TVSCAN LINE. FIRST ONE REPORTED WILL BE 8.1165 Scanlines=0:Rem SCAN LINES IN CURRENT INSTRUCTION1170 Jvb=0:Rem FLAG THAT JVB WAS SEEN TO END THE LOOP1175 Fname$=Dev$,"GR",Str$(Gmode+Tmode),"DL.TXT"1180 Open #1,8,0,Fname$1185 ? #1;"Disassembled Display List (GR";Str$(Gmode);1190 If (Tmode) Then ? #1;" + ";Str$(Tmode);1195 ? #1;")"1200 ? #1;"to its corresponding graphics line"1205 ? #1;"and Scan Line...":? #1:? #11210 ? #1;"DL Byte    Value     Gfx Line  ";1215 ? #1;"Scan Line(s)          ";1220 ? #1;"TV Scan Line(s)       Description"1225 ? #1;"=======    =====     ========  ";1230 ? #1;"============          ";1235 ? #1;"===============       ============"1240   For Loop=0 To Maxoffset1245   Rem DISPLAY LIST BYTE OFFSET1250   Vla=Loop:Gosub 1665:Rem DOHEX1AS3N31255   ? #1;"   ";1260   Rem DISPLAY LIST BYTE VALUE1265   Dla=Dl+Loop1270   B=Peek(Dla)1275   Vla=B:Gosub 1700:Rem DOHEX1AS2N31280   Rem WHEN DUMPING ADDRESS BYTES1285   Rem SKIP THE REST OF THIS ...  1290   If (Dladr>0) Then Goto 1505:Rem SKIP REMAINDER OF PROCESSING1295   ? #1;"   ";1300   Rem DISSECT INSTRUCTION1305   Dlins=B&$0f:Rem DL INSTRUCTION1310   Insmod=B&$f0:Rem INSTRUCTION MODIFIER1315   Rem TEST FOR JUMPS1320     If (Dlins=1):Rem PROBABLE JUMP1325     Rem FIELDS UP TO THE DESCRIPTION ARE BLANK.1330     ? #1;"                                                      ";1335       If ((B=$01) Or (B=$41)):Rem JUMP1340       Dladr=3:Rem JUMPS ARE 3-BYTE INSTRUCTIONS1345         If (B=$01):Rem DL JUMP TO ADDRESS1350         ? #1;"JMP - Jump To Address";1355         Else :Rem JUMP VERTICAL BLANK1360         ? #1;"JVB - Jump Vertical Blank";1365         Jvb=11370         Endif1375       Else :Rem ILLEGAL INSTRUCTION1380       ? #1;"Illegal Instruction";1385       Endif1390     Else :Rem BLANK LINES OR GFX LINES?1395     Rem TEST FOR BLANK LINES1400       If (Dlins<1):Rem A BLANK LINE INSTRUCTION1405       Rem GFX DATA LINE IS BLANK (OBVIOUSLY, SINCE NO RENDERED PIXELS)1410       ? #1;"          ";1415       Scanlines=((Insmod&$70)/16)+1:Gosub 1615:Rem DOSCANLINES1420       Rem DESCRIPTION1425       ? #1;Scanlines;" Blank Line";1430       If (Scanlines>1) Then ? #1;"s";1435       Gosub 1830:Rem DOMODIFIERS1440       Endif1445     Rem DO REGULAR GRAPHICS LINES1450       If (Dlins>1):Rem EVERYTHING $2 TO $F1455       Scanlines=Scl(Dlins)1460       Gosub 1570:Rem DOGFXLINES1465       Rem DESCRIPTION1470       ? #1;"Mode ";M$(Dlins,Dlins);1475       Gosub 1830:Rem DOMODIFIERS1480       ? #1;" (";Scanlines;" Scan Line";1485       If (Scanlines>1) Then ? #1;"s";1490       ? #1;")";1495       Endif1500     Endif1505   ? #11510   If (Dladr>0) Then Dladr=Dladr-1:If (Jvb And (Dladr<1)) Then Loop=Maxoffset1515   Next Loop1520 ? #1:Close #11525 End1530 Rem1535 Rem DOGFXLINES1540 Rem FOR ANY NORMAL GFX MODE USING1545 Rem SCREEN RAM JUST INCREMENT THE1550 Rem LINE COUNTER.  A BIT OF CHEATING1555 Rem HERE AS WE FALL THROUGH TO THE1560 Rem DOSCANLINES CODE ...1565 Rem1570 Gline=Gline+11575 Vla=Gline:Gosub 1700:Rem DOHEXAS2N31580 ? #1;"   ";1585 Rem1590 Rem DOSCANLINES1595 Rem GIVEN THE NUMBER OF SCAN LINES1600 Rem UPDATE THE SCAN LINE COUNTERS1605 Rem AND PRINT THEM.1610 Rem1615 Sline=Lasts+1:Lasts=Lasts+Scanlines1620 Vla=Sline:Vlb=Lasts:Gosub 1765:Rem DOHEXPAIR1625 Tline=Lastt+1:Lastt=Lastt+Scanlines1630 Vla=Tline:Vlb=Lastt:Gosub 1765:Rem DOHEXPAIR1635 Return1640 Rem1645 Rem DOHEX1AS3N31650 Rem OUTPUT A NUMBER AS 3 DIGIT HEX, 3 DIGIT DEC1655 Rem INPUT = VLA1660 Rem1665 Ha$=Hex$(Vla)1670 Print #1; Using "/$!!! &&&",Ha$(2,4),Vla;1675 Return1680 Rem1685 Rem DOHEX1AS2N31690 Rem OUTPUT A NUMBER AS 2 DIGIT HEX, 3 DIGIT DEC1695 Rem INPUT = VLA1700 Ha$=Hex$(Vla)1705 Print #1; Using "/$!! &&&",Ha$(3,4),Vla;1710 Return1715 Rem1720 Rem DOHEXPAIR1725 Rem OUTPUT ONE OR TWO NUMBERS AS1730 Rem 2 DIGIT HEX, 3 DIGIT DEC1735 Rem IF SECOND NUMBER IS LESS THAN1740 Rem FIRST NUMBER, DO NOT OUTPUT1745 Rem THE SECOND NUMBER.1750 Rem INPUT = VLA1755 Rem INPUT = VLB1760 Rem1765 Ha$=Hex$(Vla)1770 Hb$=Hex$(Vlb)1775   If (Vlb>Vla):Rem OUTPUT BOTH1780   Print #1; Using "/$!! /- /$!!  &&& /- &&&  ",Ha$(3,4),Hb$(3,4),Vla,Vlb;1785   Else :Rem OUTPUT ONLY THE FIRST1790   Print #1; Using "/$!!        &&&        ",Ha$(3,4),Vla;1795   Endif1800 Return1805 Rem1810 Rem DOMODIFIERS1815 Rem OUTPUT TEXT OF MODIFIERS IF SET1820 Rem INPUT = INSMOD INSTRUCTION MODIFIERS1825 Rem INPUT = DLINS INSTRUCTION1830 If (Insmod&$80) Then ? #1;" + DLI";1835   If (Dlins>1):Rem REGULAR GRAPHICS1840   If (Insmod&$40) Then ? #1;" + LMS";:Dladr=3:Rem THIS HAS TWO TRAILER BYTES TO PARTIALLY IGNORE1845   If (Insmod&$20) Then ? #1;" + VSCROLL";1850   If (Insmod&$10) Then ? #1;" + HSCROLL";1855   Endif1860 Return1865 Rem1870 Rem HOPE FOR CLEANLINESS.1875 Rem TRAP ERROR AND CLOSE FILE.1880 Poke 82,0:Poke 710,0:Graphics 01885 ? "Trap Error ";Err(0);" at line ";Err(1)1890 List Err(1)1895 Trap 01900 Close #11905 End



Below in tar and zip file formats is the source program, and the program's output for all the regular Atari OS text and graphics modes (rename .tar.gz.zip to .tar.gz):

Source code:
EXAMDL.tar.gz.zip
EXAMDL.zip

Display List Dumps:
DLDUMPS.tar.gz.zip
DLDUMPS.zip


-------------------------------------------------------------------------------------------


1 Corinthians 3:19 For the wisdom of this world is foolishness in God's sight. As it is written: "He catches the wise in their craftiness";





2 Comments


Recommended Comments

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...