Jump to content
IGNORED

kenjennings' Blog - Dissecting Atari Display Lists


RSS Bot

Recommended Posts

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:

 
"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:
 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:



Display List Dumps:




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


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";


Attached File(s)


http://atariage.com/forums/blog/576/entry-13247-dissecting-atari-display-lists/
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...