home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / software / utilities / emulation / frodo / src / 6569.asm < prev    next >
Assembly Source File  |  1996-01-29  |  56KB  |  2,899 lines

  1. *
  2. * 6569.asm - VIC-Emulation
  3. *
  4. * Copyright (C) 1994-1996 by Christian Bauer
  5. *
  6.  
  7. *
  8. * Anmerkungen:
  9. * ------------
  10. *
  11. * Funktionsweise/Periodic:
  12. *  - Die VIC-Emulation arbeitet zeilenweise. Pro (simulierter)
  13. *    C64-Rasterzeile wird vom 6510-Task die Routine Periodic6569
  14. *    aufgerufen, die eine Pixelzeile der Grafik anhand der aktuellen
  15. *    Einstellungen in den VIC-Registern aufbaut. Dadurch können
  16. *    Rastereffekte sehr gut emuliert werden.
  17. *  - Die Emulation schreibt die Grafikdaten für eine Rasterzeile in einen
  18. *    8-Bit-Chunky-Puffer, der in jeder Rasterzeile in die Anzeige kopiert
  19. *    wird. Bei 4 Bit werden die Daten für ein ganzes Bild in den Puffer
  20. *    kopiert, der dann im VIC-VBlank konvertiert wird.
  21. *  - Die Auswahl der 5 verschiedenen Darstellungsmodi (plus 3 ungültige,
  22. *    die einen schwarzen Bildschirm erzeugen) geschieht über den
  23. *    Zeiger DisplayProc, der auf die entsprechende Routine (z.B. TextStd,
  24. *    BitMapMulti etc.) zeigt und der bei einem Schreibzugriff auf eines
  25. *    der beiden Kontrollregister CTRL1/CTRL2 neu gesetzt wird
  26. *
  27. * 6510-Zyklenzähler
  28. *  - In jeder Rasterzeile wird der Zyklenzähler für die CPU neu gesetzt,
  29. *    und zwar unterschiedlich je nachdem, ob eine Bad Line stattfand
  30. *    oder nicht
  31. *  - Für jedes dargestellte Sprite werden nochmal je 2 Zyklen abgezogen
  32. *
  33. * Bad Lines:
  34. *  - Eine Bad Line ist dann, wenn $30 <= RASTER <= $f7 und
  35. *    die unteren drei Bits von RASTER mit den unteren drei Bits von
  36. *    Reg. $11 (Y-Scroll) übereinstimmen
  37. *  - In einer Bad Line werden 40 Bytes aus Videomatrix und Farb-RAM geholt
  38. *
  39. * Rasterzähler RC/Grafikdarstellung:
  40. *  - Der RC wird in jeder Bad Line auf Null gesetzt, gleichzeitig wird
  41. *    die Darstellung der Grafik angeschaltet (DISPLAYOFF wird gelöscht)
  42. *  - Am Ende einer Rasterzeile wird der RC um 1 erhöht, es sei denn,
  43. *    er steht auf 7. In diesem Fall wird die Darstellung ausgeschaltet.
  44. *  - Ist DISPLAYOFF gesetzt, wird in der Textspalte $3fff dargestellt,
  45. *    ansonsten Text oder Bitmapgrafik
  46. *  - Deshalb wird im oberen/unteren Rahmen immer $3fff dargestellt, weil
  47. *    es dort keine Bad Lines gibt und der RC nie zurückgesetzt wird
  48. *
  49. * Videomatrixzähler VC:
  50. *  - Es gibt zwei Register, VCBASE und VCCOUNT. Zum Zugriff auf die
  51. *    Grafikdaten wird VCCOUNT benutzt.
  52. *  - Beim VBlank wird VCBASE auf Null gesetzt
  53. *  - Zu Beginn jeder Zeile wird VCCOUNT mit dem Wert aus VCBASE geladen
  54. *  - Wenn DISPLAYOFF gelöscht ist und Grafik dargestellt wird, wird
  55. *    VCCOUNT um 40 erhöht (symbolisch für die 40 Zugriffe des VIC)
  56. *  - Wenn die Darstellung abgeschaltet wird, weil RC=7 ist (am Ende
  57. *    einer Zeile) wird VCBASE mit dem Wert aus VCCOUNT geladen
  58. *
  59. * Spritedatenzähler MCx/Spritedarstellung:
  60. *  - Da die Spritedaten beim VIC am Ende einer Rasterzeile geholt werden
  61. *    und daher die Y-Positionen der Sprites eins niedriger als die
  62. *    Rasterzeilennummern sind, werden die Spritedatenzähler in der
  63. *    Emulation am Ende einer Rasterzeile gehandhabt (nachdem die Sprites
  64. *    gezeichnet wurden)
  65. *  - Wenn ein Sprite eingeschaltet ist und die Y-Koordinate gleich den
  66. *    unteren 8 Bit von RASTER ist, wird der Datenzähler auf Null gesetzt
  67. *    und die Darstellung des Sprite eingeschaltet (Bit in SPRITEON).
  68. *    Jede folgende Rasterzeile wird der Zähler um 3 erhöht, solange er
  69. *    kleiner als 60 ist. Erreicht er 60, wird die Darstellung des Sprite
  70. *    ausgeschaltet. Wenn das Sprite Y-expandiert ist, wird der Zähler nur
  71. *    in den Zeilen erhöht, in denen die unteren Bits von Y-Koordinate und
  72. *    Zeilennummer gleich sind.
  73. *  - Der Puffer GfxCollBuf wird beim Malen der Grafikdaten mit Flags
  74. *    gefüllt, ob das zugehörige Pixel ein Vorder- oder Hintergrundpixel
  75. *    ist. Dieser Puffer wird für die Sprite-Grafik-Kollisionserkennung
  76. *    und für das Zeichnen von Hintergrundsprites benutzt.
  77. *
  78. * X-Scroll>0 und 40 Spalten:
  79. *  - Wenn der X-Scroll>0 und die 40-Spalten-Darstellung eingeschaltet
  80. *    ist, hängt das, was am linken Bildrand dargestellt wird, vom
  81. *    aktuellen Grafikmodus ab
  82. *  - Im Standard-Text-, Multicolor-Text- und Multicolor-Bitmap-Modus wird
  83. *    dort die Hintergrundfarbe aus Reg.$21 dargestellt
  84. *  - Im Standard-Bitmap- und ECM-Text-Modus wird die Hintergrundfarbe
  85. *    der letzten 8 Pixel der vorherigen Zeile dargestellt
  86. *
  87. * Inkompatibilitäten:
  88. *  - Effekte, die durch die Änderung von VIC-Registern innerhalb einer
  89. *    Rasterzeile erreicht werden, können nicht emuliert werden
  90. *  - Sprite-Kollisionen werden nur innerhalb des sichtbaren Bereiches
  91. *    erkannt, Kollisionen mit $3fff werden gar nicht erkannt
  92. *  - X-expandierte Sprites mit X-Koordinaten >=$140 werden nicht angezeigt.
  93. *    Genaugenommen sollte ein Sprite nur dann unsichtbar sein, wenn die
  94. *    X-Koordinate zwischen $1f8 und $1ff liegt.
  95. *  - In den Bitmap-Darstellungen ab den Adressen $0000 und $8000 sollte
  96. *    eigentlich ab $1000/$9000 das Char-ROM sichtbar sein. Aus
  97. *    Geschwindigkeitsgründen wird in der Emulation das RAM darunter
  98. *    dargestellt. Dies sollte keine Rolle spielen, da diese Bitmap-Seiten
  99. *    aus dem genannten Grund von keinem Programm komplett verwendet werden.
  100. *  - Der IRQ wird bei jedem Schreibzugriff in das Flag-Register gelöscht.
  101. *    Das ist ein Hack für die RMW-Befehle des 6510, die zuerst den
  102. *    Originalwert schreiben.
  103. *  - Kein Lightpen-Interrupt
  104. *
  105.  
  106. SPR_DATA_COLL    SET 1    ;0 - Keine Sprite-Hintergrund-Prioritäten/-Kollisionen
  107.  
  108.         MACHINE    68020
  109.  
  110.         INCLUDE    "exec/types.i"
  111.         INCLUDE    "exec/macros.i"
  112.         INCLUDE    "exec/nodes.i"
  113.         INCLUDE    "graphics/rastport.i"
  114.         INCLUDE    "libraries/cybergraphics.i"
  115.  
  116.         XREF    _SysBase    ;Main.asm
  117.         XREF    _GfxBase
  118.         XREF    _CyberGfxBase
  119.  
  120.         XREF    TheRAM        ;6510.asm
  121.         XREF    TheChar
  122.         XREF    TheColor
  123.         XREF    IntIsVICIRQ
  124.         XREF    CyclesLeft
  125.  
  126.         XREF    CountTODs    ;6526.asm
  127.         XREF    Periodic6526
  128.  
  129.         XREF    _OpenDisplay    ;Display.c
  130.         XREF    _RedrawDisplay
  131.         XREF    _the_rast_port
  132.         XREF    _temp_rp
  133.  
  134.         XDEF    Init6569
  135.         XDEF    _GetVICDump
  136.         XDEF    OpenGraphics
  137.         XDEF    ChangedVA
  138.         XDEF    ReadFrom6569
  139.         XDEF    WriteTo6569
  140.         XDEF    Periodic6569
  141.  
  142.         XDEF    DisplayID    ;Prefs
  143.         XDEF    ScreenType
  144.         XDEF    NormalCycles
  145.         XDEF    BadLineCycles
  146.         XDEF    SpritesOn
  147.         XDEF    Collisions
  148.         XDEF    Overscan
  149.         XDEF    SkipLatch
  150.         XDEF    LimitSpeed
  151.         XDEF    DirectVideo
  152.  
  153.         SECTION    "text",CODE
  154.  
  155.  
  156. **
  157. ** Definitionen
  158. **
  159.  
  160. ; VIC-Register
  161. M0Y        = $01    ;Y-Position von Sprite 0
  162. M1Y        = $03    ;Y-Position von Sprite 1
  163. M2Y        = $05    ;Y-Position von Sprite 2
  164. M3Y        = $07    ;Y-Position von Sprite 3
  165. M4Y        = $09    ;Y-Position von Sprite 4
  166. M5Y        = $0b    ;Y-Position von Sprite 5
  167. M6Y        = $0d    ;Y-Position von Sprite 6
  168. M7Y        = $0f    ;Y-Position von Sprite 7
  169. MX8        = $10    ;Höchste Bits der Sprite X-Positionen
  170. CTRL1        = $11    ;Steuerreg. 1
  171. RASTER        = $12    ;Rasterzähler
  172. LPX        = $13    ;Lightpen X
  173. LPY        = $14    ;Lightpen Y
  174. SPREN        = $15    ;Sprite eingeschaltet
  175. CTRL2        = $16    ;Steuerreg. 2
  176. MYE        = $17    ;Sprite Y-Expansion
  177. VBASE        = $18    ;Basisadressen
  178. IRQFLAG        = $19    ;Interruptreg.
  179. IRQMASK        = $1a
  180. MDP        = $1b    ;Sprite Priorität
  181. MMC        = $1c    ;Sprite Multicolor
  182. MXE        = $1d    ;Sprite X-Expansion
  183. CLXSPR        = $1e    ;Kollisionsreg.
  184. CLXBGR        = $1f
  185. EC        = $20    ;Rahmenfarbe
  186. B0C        = $21    ;Hintergrundfarbe
  187.  
  188. ; Zusätzliche Register
  189. DISPLAYOFF    = $2f    ;Flag: $3fff wird dargestellt
  190. IRQRASTER    = $30    ;Rasterzeile, bei der ein IRQ ausgelöst wird (Wort)
  191. XSCROLL        = $32    ;X-Scroll-Wert (Wort)
  192. YSCROLL        = $34    ;Y-Scroll-Wert (Wort)
  193. DXSTART        = $36    ;Aktuelle Werte des Randbereichs
  194. DXSTOP        = $38
  195. DYSTART        = $3a
  196. DYSTOP        = $3c
  197. RC        = $3e    ;Rasterzähler RC
  198. MATRIXBASE    = $40    ;Videomatrix-Basis (Amiga-Adresse)
  199. CHARBASE    = $44    ;Zeichengenerator-Basis (Amiga-Adresse)
  200. BITMAPBASE    = $48    ;Bitmap-Basis (Amiga-Adresse)
  201. CURRENTA5    = $4c    ;Augenblicklicher Zeiger im ChunkyBuf
  202.             ;Speicher für a5 zwischen Aufrufen von Periodic6569
  203. CURRENTRASTER    = $50    ;Augenblickliche Rasterzeile
  204.             ;Speicher für d7 zwischen Aufrufen von Periodic6569
  205. LASTBKGD    = $52    ;Letzte dargestellte Hintergrundfarbe
  206. SPRITEON    = $53    ;Sprite wird dargestellt, pro Sprite ein Bit
  207. BORDERON    = $54    ;Flag: Oberer/unterer Rahmen wird dargestellt
  208. IS38COL        = $55    ;Flag: 38 Spalten
  209. BADLINEENABLE    = $56    ;Flag: Bad Lines sind zugelassen
  210.             ;In Zeile $30 wird Bit 4 in $D011 getestet und
  211.             ; dieses Flag entsprechend gesetzt
  212. SKIPFRAME    = $57    ;Flag: Dieses Frame überspringen, nichts zeichnen
  213. BADLINE        = $58    ;Flag: Bad-Line-Zustand
  214. MC0        = $5a    ;Spritedatenzähler 0
  215. MC1        = $5c
  216. MC2        = $5e
  217. MC3        = $60
  218. MC4        = $62
  219. MC5        = $64
  220. MC6        = $66
  221. MC7        = $68    ;Spritedatenzähler 7
  222. VCBASE        = $6a    ;VC-Zwischenspeicher
  223. VCCOUNT        = $6c    ;VC-Zähler
  224. CIAVABASE    = $6e    ;16-Bit Basisadresse durch Cia-VA14/15
  225. BORDERLONG    = $70    ;Vorberechnete Farbwerte
  226. BACK0LONG    = $74
  227. SPRX0        = $78    ;16-Bit Sprite-X-Koordinaten
  228. SPRX1        = $7a
  229. SPRX2        = $7c
  230. SPRX3        = $7e
  231. SPRX4        = $80
  232. SPRX5        = $82
  233. SPRX6        = $84
  234. SPRX7        = $86
  235. SPR0BASE    = $88
  236. SPR1BASE    = $8a
  237. SPR2BASE    = $8c
  238. SPR3BASE    = $8e
  239. SPR4BASE    = $90
  240. SPR5BASE    = $92
  241. SPR6BASE    = $94
  242. SPR7BASE    = $96
  243. VICRegLength    = $98
  244.  
  245. ; Anzahl Rasterzeilen
  246. TotalRasters    = $138
  247.  
  248. ; Textfenster-Koordinaten (Stop-Werte sind immer eins mehr)
  249. Row25YStart    = $33
  250. Row25YStop    = $fb
  251. Row24YStart    = $37
  252. Row24YStop    = $f7
  253.  
  254. Col40XStart    = $20
  255. Col40XStop    = $160
  256. Col38XStart    = $27
  257. Col38XStop    = $157
  258.  
  259. ; Erste und letzte mögliche Zeile für Bad Lines
  260. FirstDMALine    = $30
  261. LastDMALine    = $f7
  262.  
  263. ; Erste und letzte dargestellte Zeile
  264. FirstDispLine    = $10
  265. LastDispLine    = $11f    ;eigentlich $12b
  266.  
  267. ; Größe der Anzeige
  268. DisplayX    = $180    ;Muß ein Vielfaches von 32 sein (wg. c2p4)!
  269. DisplayY    = LastDispLine-FirstDispLine+1
  270.  
  271. ; ScreenTypes
  272. STYP_8BIT    = 0    ;8-Bit-Screen, WritePixelLine8/
  273. STYP_4BIT    = 1    ;4-Bit-Screen, c2p4
  274. STYP_1BIT    = 2    :1-Bit-Screen, Amiga Mono
  275.  
  276. ; cybergraphics.library
  277. CYBRMATTR_ISLINEARMEM = $80000009
  278. GetCyberMapAttr    = -96
  279. DoCDrawMethod    = -156
  280.  
  281.  
  282. *
  283. * Makros
  284. *
  285.  
  286. ; Sprite darstellen
  287. DoSprite    MACRO    ;Nummer
  288.         btst    #\1,SPRITEON(a4) ;Wird das Sprite dargestellt?
  289.         beq    \@1$
  290.  
  291.         move.l    MATRIXBASE(a4),a0
  292.         moveq    #0,d0
  293.         move.b    $03f8+\1(a0),d0    ;Datenzeiger
  294.         lsl.w    #6,d0        ;*64
  295.         add.w    MC\1(a4),d0    ;MC dazunehmen
  296.         bsr    GetPhysical
  297.         move.l    (a0),d0        ;d0: Spritedaten
  298.  
  299.         move.w    SPRX\1(a4),d1    ;d1: X-Koordinate
  300.         move.l    a5,a1
  301.         add.w    d1,a1
  302.         addq.l    #8,a1        ;a1: Ziel im Bildschirmspeicher
  303.         lea    SprCollBuf+8,a2
  304.         add.w    d1,a2        ;a2: Ziel im Kollisionspuffer
  305.     IFNE    SPR_DATA_COLL
  306.         lea    GfxCollBuf+8,a3
  307.         add.w    d1,a3        ;a3: Zeiger auf Grafik-Kollisionspuffer
  308.     ENDC
  309.  
  310.         move.b    $27+\1(a4),d2    ;d2: Spritefarbe
  311.  
  312.         move.b    #1<<\1,d7    ;d7: Sprite-Bit
  313.         move.l    Sprite\1Proc,a0
  314.         jsr    (a0)
  315. \@1$
  316.         ENDM
  317.  
  318.  
  319. **
  320. ** Emulation vorbereiten
  321. **
  322.  
  323. *
  324. * Register vorbereiten
  325. *
  326.  
  327. Init6569    lea    Registers,a0
  328.         move.w    #7,RC(a0)
  329.         move.w    #-1,CURRENTRASTER(a0)
  330.         move.l    TheRAM,MATRIXBASE(a0)
  331.         move.l    TheRAM,CHARBASE(a0)
  332.         move.l    TheRAM,BITMAPBASE(a0)
  333.         clr.w    CIAVABASE(a0)
  334.         move.w    #63,MC0(a0)
  335.         move.w    #63,MC1(a0)
  336.         move.w    #63,MC2(a0)
  337.         move.w    #63,MC3(a0)
  338.         move.w    #63,MC4(a0)
  339.         move.w    #63,MC5(a0)
  340.         move.w    #63,MC6(a0)
  341.         move.w    #63,MC7(a0)
  342.  
  343.         bsr    SetDispProc
  344.         bsr    SetSpriteProcs
  345.         rts
  346.  
  347. *
  348. * Screen und Fenster öffnen
  349. * d0=0: Alles OK
  350. * d0=1: Konnte Screen nicht öffnen
  351. * d0=2: Kein Speicher
  352. *
  353.  
  354. OpenGraphics    pea    DisplayY
  355.         pea    DisplayX
  356.         moveq    #0,d0
  357.         move.w    Overscan,d0
  358.         move.l    d0,-(sp)
  359.         move.l    DisplayID,-(sp)
  360.         move.w    ScreenType,d0
  361.         move.l    d0,-(sp)
  362.         jsr    _OpenDisplay
  363.         lea    20(sp),sp
  364.         tst.l    d0
  365.         bne    1$
  366.  
  367.         move.l    _CURRENTA5,Registers+CURRENTA5
  368.  
  369.         move.l    _CyberGfxBase,d0
  370.         beq    2$
  371.         move.l    a6,-(sp)
  372.         move.l    d0,a6
  373.  
  374.         move.l    _the_rast_port,a0    ;Ist es eine CyberGfx-Bitmap?
  375.         move.l    rp_BitMap(a0),a0
  376.         move.l    #CYBRMATTR_ISCYBERGFX,d0
  377.         jsr    GetCyberMapAttr(a6)
  378.         tst.l    d0
  379.         beq    3$
  380.  
  381.         move.l    _the_rast_port,a0    ;Ja, Direkter Zugriff erlaubt?
  382.         move.l    rp_BitMap(a0),a0
  383.         move.l    #CYBRMATTR_ISLINEARMEM,d0
  384.         jsr    GetCyberMapAttr(a6)
  385.         tst.l    d0
  386.         beq    3$
  387.         sne    IsCyber            ;Ja, DoCDrawMethod kann benutzt werden
  388.  
  389.         tst.w    DirectVideo        ;Zugriff ohne DoCDrawMethod gewünscht?
  390.         beq    3$
  391.  
  392.         move.l    _the_rast_port,a0    ;Ja, XMod und Basisadresse bestimmen
  393.         move.l    rp_BitMap(a0),a0
  394.         move.l    #CYBRMATTR_XMOD,d0
  395.         jsr    GetCyberMapAttr(a6)
  396.         move.l    d0,CyberXMod
  397.  
  398.         move.l    _the_rast_port,a0
  399.         move.l    rp_BitMap(a0),a0
  400.         move.l    #CYBRMATTR_DISPADR,d0
  401.         jsr    GetCyberMapAttr(a6)
  402.         move.l    d0,CyberBase
  403.         spl    IsCyberDirect
  404. 3$
  405.         move.l    (sp)+,a6
  406. 2$
  407.         moveq    #0,d0
  408. 1$        rts
  409.  
  410.  
  411. **
  412. ** VIC-Status in Datenstruktur schreiben
  413. **
  414.  
  415. _GetVICDump    lea    Registers,a0
  416.         move.l    4(sp),a1
  417.  
  418.         move.b    SPRX0+1(a0),(a1)+
  419.         move.b    M0Y(a0),(a1)+
  420.         move.b    SPRX1+1(a0),(a1)+
  421.         move.b    M1Y(a0),(a1)+
  422.         move.b    SPRX2+1(a0),(a1)+
  423.         move.b    M2Y(a0),(a1)+
  424.         move.b    SPRX3+1(a0),(a1)+
  425.         move.b    M3Y(a0),(a1)+
  426.         move.b    SPRX4+1(a0),(a1)+
  427.         move.b    M4Y(a0),(a1)+
  428.         move.b    SPRX5+1(a0),(a1)+
  429.         move.b    M5Y(a0),(a1)+
  430.         move.b    SPRX6+1(a0),(a1)+
  431.         move.b    M6Y(a0),(a1)+
  432.         move.b    SPRX7+1(a0),(a1)+
  433.         move.b    M7Y(a0),(a1)+
  434.         move.b    MX8(a0),(a1)+
  435.  
  436.         move.b    CTRL1(a0),d0
  437.         and.b    #$7f,d0
  438.         move.b    CURRENTRASTER(a0),d1
  439.         lsl.b    #7,d1
  440.         or.b    d1,d0
  441.         move.b    d0,(a1)+
  442.         move.b    CURRENTRASTER+1(a0),(a1)+
  443.  
  444.         lea    LPX(a0),a0
  445.         moveq    #27,d0        ;LPX..M7C
  446. 1$        move.b    (a0)+,(a1)+
  447.         dbra    d0,1$
  448.  
  449.         lea    Registers,a0
  450.         addq.l    #1,a1
  451.         move.w    IRQRASTER(a0),(a1)+
  452.         move.w    VCCOUNT(a0),(a1)+
  453.         move.w    VCBASE(a0),(a1)+
  454.         move.b    RC+1(a0),(a1)+
  455.         move.b    SPRITEON(a0),(a1)+
  456.  
  457.         move.b    MC0+1(a0),(a1)+
  458.         move.b    MC1+1(a0),(a1)+
  459.         move.b    MC2+1(a0),(a1)+
  460.         move.b    MC3+1(a0),(a1)+
  461.         move.b    MC4+1(a0),(a1)+
  462.         move.b    MC5+1(a0),(a1)+
  463.         move.b    MC6+1(a0),(a1)+
  464.         move.b    MC7+1(a0),(a1)+
  465.  
  466.         tst.b    DISPLAYOFF(a0)
  467.         sne.b    (a1)+
  468.         sne.b    (a1)+
  469.         tst.b    BADLINE(a0)
  470.         sne.b    (a1)+
  471.         sne.b    (a1)+
  472.         tst.b    BADLINEENABLE(a0)
  473.         sne.b    (a1)+
  474.         sne.b    (a1)+
  475.         move.w    CIAVABASE(a0),(a1)+
  476.         move.w    MATRIXBASE+2(a0),(a1)+
  477.         move.w    CHARBASE+2(a0),(a1)+
  478.         move.w    BITMAPBASE+2(a0),(a1)+
  479.  
  480.         move.l    d2,-(sp)
  481.         move.w    CIAVABASE(a0),d2
  482.         move.l    MATRIXBASE(a0),a0
  483.         moveq    #7,d1
  484.         lea    $03f8(a0),a0
  485. 2$        moveq    #0,d0
  486.         move.b    (a0)+,d0
  487.         lsl.w    #6,d0
  488.         or.w    d2,d0
  489.         move.w    d0,(a1)+
  490.         dbra    d1,2$
  491.         move.l    (sp)+,d2
  492.         rts
  493.  
  494.  
  495. **
  496. ** CIA-VA14/15 hat sich geändert, Video-Bank wechseln
  497. ** d0.b: Neue VA ($00-$03)
  498. **
  499.  
  500. ChangedVA    lea    Registers,a0    ;Wichtig für WrVBASE
  501.         clr.w    d1        ;VABase speichern
  502.         move.b    d0,d1
  503.         ror.w    #2,d1
  504.         move.w    d1,CIAVABASE(a0)
  505.  
  506.         move.b    VBASE(a0),d1 ;Zeiger neu berechnen
  507.         bra    WrVBASE
  508.  
  509.  
  510. **
  511. ** Aus einer VIC-16-Bit-Adresse die entsprechende Amiga-Adresse berechnen
  512. ** -> d0.w: 16-Bit-Adresse
  513. ** <- a0.l: 32-Bit-Adresse
  514. **
  515.  
  516. GetPhysical    or.w    CIAVABASE(a4),d0 ;VA14/15 dazunehmen
  517.         move.w    d0,d1
  518.         and.w    #$7000,d1
  519.         cmp.w    #$1000,d1
  520.         beq    1$
  521.         move.l    TheRAM,a0
  522.         moveq    #0,d1
  523.         move.w    d0,d1
  524.         add.l    d1,a0
  525.         rts
  526. 1$        and.w    #$0fff,d0    ;$1000-$1fff, $9000-$9fff: Char-ROM
  527.         move.l    TheChar,a0
  528.         add.w    d0,a0
  529.         rts
  530.  
  531.  
  532. **
  533. ** Aus einem VIC-Register lesen
  534. ** d0.l: Registernummer ($00-$3f)
  535. ** Rückgabe: d0.b: Byte
  536. **
  537. ** Darf das obere Wort von d0 und d1 nicht verändern!
  538. **
  539.  
  540. ReadFrom6569    lea    Registers,a0
  541.         move.l    ReadTab(pc,d0.l*4),a1
  542.         jmp    (a1)
  543.  
  544.         CNOP    0,4
  545. ReadTab        dc.l    RdSprX
  546.         dc.l    RdNormal
  547.         dc.l    RdSprX
  548.         dc.l    RdNormal
  549.         dc.l    RdSprX
  550.         dc.l    RdNormal
  551.         dc.l    RdSprX
  552.         dc.l    RdNormal
  553.         dc.l    RdSprX
  554.         dc.l    RdNormal
  555.         dc.l    RdSprX
  556.         dc.l    RdNormal
  557.         dc.l    RdSprX
  558.         dc.l    RdNormal
  559.         dc.l    RdSprX
  560.         dc.l    RdNormal
  561.  
  562.         dc.l    RdNormal
  563.         dc.l    RdCTRL1
  564.         dc.l    RdRASTER
  565.         dc.l    RdNormal
  566.         dc.l    RdNormal
  567.         dc.l    RdNormal
  568.         dc.l    RdCTRL2
  569.         dc.l    RdNormal
  570.         dc.l    RdVBASE
  571.         dc.l    RdIRQFLAG
  572.         dc.l    RdIRQMASK
  573.         dc.l    RdNormal
  574.         dc.l    RdNormal
  575.         dc.l    RdNormal
  576.         dc.l    RdCLXSPR
  577.         dc.l    RdCLXBGR
  578.  
  579.         dc.l    RdColor
  580.         dc.l    RdColor
  581.         dc.l    RdColor
  582.         dc.l    RdColor
  583.         dc.l    RdColor
  584.         dc.l    RdColor
  585.         dc.l    RdColor
  586.         dc.l    RdColor
  587.         dc.l    RdColor
  588.         dc.l    RdColor
  589.         dc.l    RdColor
  590.         dc.l    RdColor
  591.         dc.l    RdColor
  592.         dc.l    RdColor
  593.         dc.l    RdColor
  594.         dc.l    RdUndef
  595.  
  596.         dc.l    RdUndef
  597.         dc.l    RdUndef
  598.         dc.l    RdUndef
  599.         dc.l    RdUndef
  600.         dc.l    RdUndef
  601.         dc.l    RdUndef
  602.         dc.l    RdUndef
  603.         dc.l    RdUndef
  604.         dc.l    RdUndef
  605.         dc.l    RdUndef
  606.         dc.l    RdUndef
  607.         dc.l    RdUndef
  608.         dc.l    RdUndef
  609.         dc.l    RdUndef
  610.         dc.l    RdUndef
  611.         dc.l    RdUndef
  612.  
  613. RdNormal    move.b    (a0,d0.l),d0
  614.         rts
  615.  
  616. RdSprX        move.b    SPRX0+1(a0,d0.l),d0    ;LSB lesen
  617.         rts
  618.  
  619. RdCTRL1        move.b    CTRL1(a0),d0
  620.         and.b    #$7f,d0
  621.         move.b    CURRENTRASTER(a0),d1    ;MSB des Rasterzählers lesen
  622.         lsl.b    #7,d1
  623.         or.b    d1,d0            ;und dazunehmen
  624.         rts
  625.  
  626. RdRASTER    move.b    CURRENTRASTER+1(a0),d0    ;Rasterzähler lesen
  627.         rts
  628.  
  629. RdCTRL2        move.b    CTRL2(a0),d0
  630.         or.b    #$c0,d0            ;Unbenutzte Bits auf 1
  631.         rts
  632.  
  633. RdVBASE        move.b    VBASE(a0),d0
  634.         or.b    #$01,d0            ;Unbenutzte Bits auf 1
  635.         rts
  636.  
  637. RdIRQFLAG    move.b    IRQFLAG(a0),d0
  638.         or.b    #$70,d0            ;Unbenutzte Bits auf 1
  639.         rts
  640.  
  641. RdIRQMASK    move.b    IRQMASK(a0),d0
  642.         or.b    #$f0,d0            ;Unbenutzte Bits auf 1
  643.         rts
  644.  
  645. RdCLXSPR    lea    CLXSPR(a0),a0
  646.         move.b    (a0),d0            ;Lesen und löschen
  647.         clr.b    (a0)
  648.         rts
  649.  
  650. RdCLXBGR    lea    CLXBGR(a0),a0
  651.         move.b    (a0),d0            ;Lesen und löschen
  652.         clr.b    (a0)
  653.         rts
  654.  
  655. RdColor        move.b    (a0,d0.l),d0        ;Bei den Farbregistern
  656.         or.b    #$f0,d0            ;das obere Nibble setzen
  657.         rts
  658.  
  659. RdUndef        st.b    d0            ;Nicht existierendes Register
  660.         rts
  661.  
  662.  
  663. **
  664. ** In ein VIC-Register schreiben
  665. ** d0.l: Registernummer ($00-$3f)
  666. ** d1.b: Byte
  667. **
  668. ** Darf das obere Wort von d0 und d1 nicht verändern!
  669. **
  670.  
  671. WriteTo6569    lea    Registers,a0
  672.         move.l    WriteTab(pc,d0.l*4),a1
  673.         jmp    (a1)
  674.  
  675.         CNOP    0,4
  676. WriteTab    dc.l    WrSprX
  677.         dc.l    WrNormal
  678.         dc.l    WrSprX
  679.         dc.l    WrNormal
  680.         dc.l    WrSprX
  681.         dc.l    WrNormal
  682.         dc.l    WrSprX
  683.         dc.l    WrNormal
  684.         dc.l    WrSprX
  685.         dc.l    WrNormal
  686.         dc.l    WrSprX
  687.         dc.l    WrNormal
  688.         dc.l    WrSprX
  689.         dc.l    WrNormal
  690.         dc.l    WrSprX
  691.         dc.l    WrNormal
  692.  
  693.         dc.l    WrSprXMSB
  694.         dc.l    WrCTRL1
  695.         dc.l    WrRASTER
  696.         dc.l    WrNormal
  697.         dc.l    WrNormal
  698.         dc.l    WrNormal
  699.         dc.l    WrCTRL2
  700.         dc.l    WrNormal
  701.         dc.l    WrVBASE
  702.         dc.l    WrIRQFLAG
  703.         dc.l    WrIRQMASK
  704.         dc.l    WrMDP
  705.         dc.l    WrMMC
  706.         dc.l    WrMXE
  707.         dc.l    WrUndef
  708.         dc.l    WrUndef
  709.  
  710.         dc.l    WrBorder
  711.         dc.l    WrBack0
  712.         dc.l    WrNormal
  713.         dc.l    WrNormal
  714.         dc.l    WrNormal
  715.         dc.l    WrNormal
  716.         dc.l    WrNormal
  717.         dc.l    WrNormal
  718.         dc.l    WrNormal
  719.         dc.l    WrNormal
  720.         dc.l    WrNormal
  721.         dc.l    WrNormal
  722.         dc.l    WrNormal
  723.         dc.l    WrNormal
  724.         dc.l    WrNormal
  725.         dc.l    WrUndef
  726.  
  727.         dc.l    WrUndef
  728.         dc.l    WrUndef
  729.         dc.l    WrUndef
  730.         dc.l    WrUndef
  731.         dc.l    WrUndef
  732.         dc.l    WrUndef
  733.         dc.l    WrUndef
  734.         dc.l    WrUndef
  735.         dc.l    WrUndef
  736.         dc.l    WrUndef
  737.         dc.l    WrUndef
  738.         dc.l    WrUndef
  739.         dc.l    WrUndef
  740.         dc.l    WrUndef
  741.         dc.l    WrUndef
  742.         dc.l    WrUndef
  743.  
  744. WrNormal    move.b    d1,(a0,d0.l)
  745. WrUndef        rts
  746.  
  747. WrSprX        move.b    d1,SPRX0+1(a0,d0.l)
  748.         rts
  749.  
  750. WrSprXMSB    move.b    d1,MX8(a0)
  751.         lea    SPRX7(a0),a0    ;MSBs in 16-Bit-Werte umrechnen
  752.         moveq    #7,d0
  753. 1$        add.b    d1,d1
  754.         bcs    2$
  755.         clr.b    (a0)
  756.         bra    3$
  757. 2$        move.b    #1,(a0)
  758. 3$        subq.w    #2,a0
  759.         dbra    d0,1$
  760.         rts
  761.  
  762. WrCTRL1        move.b    d1,CTRL1(a0)
  763.  
  764.         move.b    d1,d0        ;Y-Scroll
  765.         and.w    #7,d0
  766.         move.w    d0,YSCROLL(a0)
  767.  
  768.         move.b    d1,d0        ;MSB der IRQ-Rasterzeile
  769.         lsr.b    #7,d0
  770.         move.b    d0,IRQRASTER(a0)
  771.  
  772.         btst    #3,d1        ;24/25 Zeilen
  773.         beq    1$
  774.         move.w    #Row25YStart,DYSTART(a0)
  775.         move.w    #Row25YStop,DYSTOP(a0)
  776.         bra    SetDispProc
  777. 1$        move.w    #Row24YStart,DYSTART(a0)
  778.         move.w    #Row24YStop,DYSTOP(a0)
  779.         bra    SetDispProc
  780.  
  781. SetDispProc    moveq    #0,d0        ;ECM, BMM und MCM holen
  782.         move.b    CTRL1(a0),d0
  783.         and.b    #$60,d0
  784.         move.b    CTRL2(a0),d1
  785.         and.b    #$10,d1
  786.         or.b    d1,d0
  787.         lsr.b    #2,d0        ;Als Index in DispProcTab benutzen
  788.         cmp.w    #STYP_1BIT,ScreenType
  789.         beq    1$
  790.         move.l    (DispProcTab,pc,d0.l),DisplayProc
  791.         rts
  792. 1$        move.l    (MonoDispProcTab,pc,d0.l),DisplayProc
  793.         rts
  794.  
  795. WrRASTER    move.b    d1,IRQRASTER+1(a0)
  796.         rts
  797.  
  798. WrCTRL2        move.b    d1,CTRL2(a0)
  799.  
  800.         move.b    d1,d0        ;X-Scroll
  801.         and.w    #7,d0
  802.         move.w    d0,XSCROLL(a0)
  803.  
  804.         btst    #3,d1        ;38/40 Zeilen
  805.         seq.b    IS38COL(a0)
  806.         beq    1$
  807.         move.w    #Col40XStart,DXSTART(a0)
  808.         move.w    #Col40XStop,DXSTOP(a0)
  809.         bra    SetDispProc
  810. 1$        move.w    #Col38XStart,DXSTART(a0)
  811.         move.w    #Col38XStop,DXSTOP(a0)
  812.         bra    SetDispProc
  813.  
  814. WrVBASE        move.l    a0,a1        ;a1: Zeiger auf Register
  815.         move.b    d1,VBASE(a1)
  816.  
  817.         move.l    a4,-(sp)
  818.         move.l    a1,a4        ;Für GetPhysical
  819.  
  820.         move.w    d1,-(sp)
  821.         move.b    d1,d0        ;Videomatrixbasis berechnen
  822.         and.w    #$f0,d0
  823.         lsl.w    #6,d0
  824.         bsr    GetPhysical
  825.         move.l    a0,MATRIXBASE(a1)
  826.         move.w    (sp),d1        ;Nur lesen, nicht entfernen
  827.  
  828.         move.b    d1,d0        ;Zeichengeneratorbasis berechnen
  829.         and.w    #$0e,d0
  830.         ror.w    #6,d0
  831.         bsr    GetPhysical
  832.         move.l    a0,CHARBASE(a1)
  833.         move.w    (sp)+,d1
  834.  
  835.         move.b    d1,d0
  836.         and.w    #$08,d0
  837.         ror.w    #6,d0
  838.         bsr    GetPhysical
  839.         move.l    a0,BITMAPBASE(a1)
  840.  
  841.         move.l    (sp)+,a4
  842.         rts
  843.  
  844. WrIRQFLAG    not.b    d1        ;Gesetztes Bit: Flag löschen
  845.         and.b    #$0f,d1
  846.         move.b    IRQFLAG(a0),d0
  847.         and.b    d1,d0
  848.  
  849.         clr.b    IntIsVICIRQ    ;IRQ zurücknehmen (Hack!)
  850.  
  851.         move.b    d0,d1        ;Erlaubter IRQ noch gesetzt?
  852.         and.b    IRQMASK(a0),d1
  853.         beq    1$
  854.         or.b    #$80,d0        ;Ja, Master-Bit setzen
  855. 1$        move.b    d0,IRQFLAG(a0)
  856.         rts
  857.  
  858. WrIRQMASK    and.b    #$0f,d1
  859.         move.b    d1,IRQMASK(a0)
  860.  
  861.         and.b    IRQFLAG(a0),d1    ;Gesetzter IRQ jetzt erlaubt?
  862.         beq    1$
  863.         or.b    #$80,IRQFLAG(a0) ;Ja, Master-Bit setzen
  864.         st.b    IntIsVICIRQ    ; und Interrupt auslösen
  865.         rts
  866. 1$        clr.b    IntIsVICIRQ    ;Nein, Interrupt zurücknehmen
  867.         and.b    #$7f,IRQFLAG(a0) ; und Master-Bit löschen
  868.         rts
  869.  
  870. WrMDP        move.b    d1,MDP(a0)
  871.         bra    SetSpriteProcs
  872.  
  873. WrMMC        move.b    d1,MMC(a0)
  874.         bra    SetSpriteProcs
  875.  
  876. WrMXE        move.b    d1,MXE(a0)        ;Fällt durch!
  877.  
  878. SetSpriteProcs    moveq    #7,d1
  879.         lea    Sprite7Proc,a1
  880. 1$        moveq    #0,d0
  881.         btst    d1,MXE(a0)
  882.         beq    2$
  883.         or.b    #1,d0
  884. 2$        btst    d1,MMC(a0)
  885.         beq    3$
  886.         or.b    #2,d0
  887. 3$        btst    d1,MDP(a0)
  888.         beq    4$
  889.         or.b    #4,d0
  890. 4$        move.l    (SpriteProcTab,pc,d0.l*4),(a1)
  891.         subq.w    #4,a1
  892.         dbra    d1,1$
  893.         rts
  894.  
  895. WrBorder    move.b    d1,EC(a0)
  896.         move.b    d1,d0        ;In ein Langwort konvertieren
  897.         lsl.w    #8,d0
  898.         move.b    d1,d0
  899.         move.w    d0,d1
  900.         swap    d0
  901.         move.w    d1,d0
  902.         move.l    d0,BORDERLONG(a0)
  903.         moveq    #0,d0
  904.         rts
  905.  
  906. WrBack0        move.b    d1,B0C(a0)
  907.         move.b    d1,d0        ;In ein Langwort konvertieren
  908.         lsl.w    #8,d0
  909.         move.b    d1,d0
  910.         move.w    d0,d1
  911.         swap    d0
  912.         move.w    d1,d0
  913.         move.l    d0,BACK0LONG(a0)
  914.         moveq    #0,d0
  915.         rts
  916.  
  917.  
  918. **
  919. ** Eine Rasterzeile des VIC ausführen
  920. **
  921. ** d7: Rasterzeilenzähler
  922. ** a4: Zeiger auf VIC-Register
  923. ** a5: Zeiger auf das Ziel im Bildschirmspeicher
  924. **
  925.  
  926. ; VBlank: Zähler zurücksetzen
  927. VICVBlank    move.w    #-1,CURRENTRASTER(a4)
  928.         clr.w    VCBASE(a4)
  929.  
  930.         bsr    CountTODs    ;TODs zählen
  931.  
  932.         subq.w    #1,SkipCounter
  933.         sne    SKIPFRAME(a4)
  934.         bne    Periodic6569
  935.         move.w    SkipLatch,SkipCounter
  936.  
  937. ; Grafik darstellen
  938.         jsr    _RedrawDisplay
  939.         move.l    _CURRENTA5,CURRENTA5(a4)
  940.  
  941. ; CyberDirect: Basisadresse des Bildschirmspeichers holen
  942.         tst.b    IsCyberDirect
  943.         beq    1$
  944.         move.l    _CyberGfxBase,a6
  945.         move.l    _the_rast_port,a0
  946.         move.l    rp_BitMap(a0),a0
  947.         move.l    #CYBRMATTR_DISPADR,d0
  948.         jsr    GetCyberMapAttr(a6)
  949.         move.l    d0,CyberBase
  950. 1$
  951.         ;fällt durch!
  952.  
  953. *
  954. * Aktuelle Rasterzeile holen
  955. *
  956.  
  957. Periodic6569    lea    Registers,a4
  958.         move.w    CURRENTRASTER(a4),d7
  959.  
  960. *
  961. * Rasterzähler erhöhen (muß hier geschehen, damit bei einem Raster-IRQ
  962. *  der Wert des Rasterzählers mit der IRQ-Zeile übereinstimmt)
  963. *
  964.  
  965.         addq.w    #1,d7
  966.         move.w    d7,CURRENTRASTER(a4)
  967.         cmp.w    #TotalRasters,d7    ;Bildende erreicht?
  968.         beq    VICVBlank
  969.  
  970. *
  971. * Raster-IRQ auslösen, wenn Vergeichswert erreicht
  972. *
  973.  
  974.         cmp.w    IRQRASTER(a4),d7    ;IRQ-Zeile erreicht?
  975.         bne    NoRasterIRQ
  976.         bsr    DoRasterIRQ
  977. NoRasterIRQ
  978.  
  979. *
  980. * In Zeile $30 entscheidet das DEN-Bit, ob Bad Lines auftreten dürfen
  981. *
  982.  
  983.         cmp.w    #$30,d7
  984.         bne    1$
  985.         btst    #4,CTRL1(a4)
  986.         sne    BADLINEENABLE(a4)
  987. 1$
  988.  
  989. *
  990. * Neue Anzahl CPU-Zyklen setzen
  991. *
  992.  
  993.         move.w    NormalCycles,CyclesLeft
  994.  
  995.         tst.b    SKIPFRAME(a4)
  996.         bne    VICSkip
  997.  
  998. *
  999. * Innerhalb des sichtbaren Bereichs?
  1000. *
  1001.  
  1002.         cmp.w    #FirstDispLine,d7
  1003.         blo    VICNop
  1004.         cmp.w    #LastDispLine,d7
  1005.         bhi    VICNop
  1006.  
  1007. *
  1008. * Zeiger in Bildschirmspeicher nach a5 holen
  1009. *
  1010.  
  1011.         move.l    CURRENTA5(a4),a5
  1012.  
  1013. *
  1014. * VC-Zähler setzen
  1015. *
  1016.  
  1017.         move.w    VCBASE(a4),VCCOUNT(a4)
  1018.         clr.b    BADLINE(a4)
  1019.  
  1020. *
  1021. * Bei Amiga-Mono in Mono-VIC-Routine verzweigen
  1022. *
  1023.  
  1024.         cmp.w    #STYP_1BIT,ScreenType
  1025.         beq    AmigaMono6569
  1026.  
  1027. *
  1028. * "Bad Lines"-Videomatrixzugriff:
  1029. * 40 Bytes aus Videomatrix und Farb-RAM lesen und zwischenspeichern
  1030. *
  1031.  
  1032.         tst.b    BADLINEENABLE(a4) ;War das DEN-Bit in Rasterzeile $30 gesetzt?
  1033.         beq    NoBadLine
  1034.  
  1035.         cmp.w    #FirstDMALine,d7 ;Innerhalb des DMA-Bereiches?
  1036.         blo    NoBadLine
  1037.         cmp.w    #LastDMALine,d7
  1038.         bhi    NoBadLine
  1039.  
  1040.         move.b    d7,d0        ;Ja, stimmen die unteren Bits
  1041.         and.b    #7,d0        ;der Rasterzeile mit dem Y-Scroll
  1042.         cmp.b    YSCROLL+1(a4),d0 ;überein?
  1043.         bne    NoBadLine
  1044.  
  1045. IsBadLine    st.b    BADLINE(a4)    ;Ja, Bad Line
  1046.         move.w    VCCOUNT(a4),d2    ;d2: VC Videomatrix-Zähler
  1047.  
  1048.         move.l    MATRIXBASE(a4),a0 ;Videomatrixbasis holen
  1049.         add.w    d2,a0        ;Videomatrixzähler dazunehmen
  1050.  
  1051.         move.l    TheColor,a2    ;Zeiger auf Farb-RAM holen
  1052.         add.w    d2,a2        ;Videomatrixzähler dazunehmen
  1053.  
  1054.         lea    MatrixLine,a1    ;Videomatrix- und Farb-RAM-Zeile lesen
  1055.         lea    ColorLine,a3
  1056.         movem.l    (a0)+,d0-d6    ;Je 40 Bytes kopieren
  1057.         movem.l    d0-d6,(a1)
  1058.         movem.l    (a2)+,d0-d6
  1059.         movem.l    d0-d6,(a3)
  1060.         movem.l    (a0)+,d0-d2
  1061.         movem.l    d0-d2,28(a1)
  1062.         movem.l    (a2)+,d0-d2
  1063.         movem.l    d0-d2,28(a3)
  1064.  
  1065.         clr.w    RC(a4)        ;RC zurücksetzen
  1066.         clr.b    DISPLAYOFF(a4)    ;Darstellung anschalten
  1067.  
  1068.         move.w    BadLineCycles,CyclesLeft ;Andere Anzahl Zyklen
  1069. NoBadLine
  1070.  
  1071. *
  1072. * Oberen und unteren Rahmen handhaben
  1073. *
  1074.  
  1075.         cmp.w    DYSTOP(a4),d7    ;Unteres Ende des Fensters erreicht?
  1076.         bne    1$        ; -> Rahmen einschalten
  1077.         st.b    BORDERON(a4)
  1078.         bra    TBBorderDraw
  1079.  
  1080. 1$        btst    #4,CTRL1(a4)    ;Rahmen nur abschalten, wenn DEN-Bit gesetzt
  1081.         beq    TBBorderDone
  1082.         cmp.w    DYSTART(a4),d7    ;Oberes Ende des Fensters erreicht?
  1083.         bne    TBBorderDone    ; -> Rahmen abschalten
  1084.         clr.b    BORDERON(a4)
  1085.         bra    TBNoBorder
  1086.  
  1087. TBBorderDone    tst.b    BORDERON(a4)    ;Rahmen an?
  1088.         beq    TBNoBorder
  1089.  
  1090. TBBorderDraw    move.l    a5,a0        ;Ja, Rahmen malen.
  1091.         move.l    BORDERLONG(a4),d0 ;d0.l: Rahmenfarbe
  1092.         moveq    #DisplayX/4-1,d1
  1093. 1$        move.l    d0,(a0)+
  1094.         dbra    d1,1$
  1095.         bra    VICIncA5    ;Sonst nix
  1096. TBNoBorder
  1097.  
  1098. *
  1099. * Inhalt des Fensters: Darstellung eingeschaltet?
  1100. *
  1101.  
  1102.         lea    Col40XStart(a5),a1
  1103.         add.w    XSCROLL(a4),a1    ;a1: Ziel in Bildschirmspeicher
  1104.         lea    MatrixLine,a2    ;a2: Zeichencodes
  1105.         lea    ColorLine,a3    ;a3: Farbcodes
  1106.     IFNE    SPR_DATA_COLL
  1107.         lea    GfxCollBuf+Col40XStart,a6
  1108.         add.w    XSCROLL(a4),a6    ;a6: Grafik-Kollisionspuffer
  1109.     ENDC
  1110.  
  1111.         tst.b    DISPLAYOFF(a4)    ;$3FFF darstellen?
  1112.         bne    Show3FFF
  1113.  
  1114.         move.l    DisplayProc,a0    ;Nein, Routine für entsp. Modus anspringen
  1115.         jmp    (a0)
  1116.  
  1117. *
  1118. * Standard-Text: Zeichendaten holen und darstellen
  1119. *
  1120.  
  1121. TextStd        add.w    #40,VCCOUNT(a4)    ;VC erhöhen (wird nicht verwendet)
  1122.  
  1123.         move.l    CHARBASE(a4),a0    ;a0: Zeichengeneratorbasis
  1124.         add.w    RC(a4),a0    ;RC dazunehmen
  1125.  
  1126.         move.l    BACK0LONG(a4),d3 ;d3.l: Hintergrundfarbe
  1127.  
  1128.         move.l    d3,Col40XStart(a5) ;Hintergrund, wenn X-Scroll>0
  1129.         move.l    d3,Col40XStart+4(a5)
  1130.  
  1131. ; Schleife für 40 Zeichen
  1132.         moveq    #39,d1        ;d1: Zeichenzähler
  1133.         moveq    #0,d0
  1134. CharLoop    move.b    (a2)+,d0    ;Zeichencode lesen
  1135.         move.b    (a0,d0.l*8),d0    ;Zeichendaten lesen
  1136.         beq    OnlyBack
  1137.         move.b    (a3)+,d2    ;d2: Zeichenfarbe
  1138.  
  1139. ; 8 Pixel konvertieren
  1140.         add.b    d0,d0
  1141.         bcc    11$
  1142.         move.b    d2,(a1)+
  1143.     IFNE    SPR_DATA_COLL
  1144.         st.b    (a6)+
  1145.     ENDC
  1146.         bra    12$
  1147. 11$        move.b    d3,(a1)+
  1148.     IFNE    SPR_DATA_COLL
  1149.         clr.b    (a6)+
  1150.     ENDC
  1151. 12$        add.b    d0,d0
  1152.         bcc    21$
  1153.         move.b    d2,(a1)+
  1154.     IFNE    SPR_DATA_COLL
  1155.         st.b    (a6)+
  1156.     ENDC
  1157.         bra    22$
  1158. 21$        move.b    d3,(a1)+
  1159.     IFNE    SPR_DATA_COLL
  1160.         clr.b    (a6)+
  1161.     ENDC
  1162. 22$        add.b    d0,d0
  1163.         bcc    31$
  1164.         move.b    d2,(a1)+
  1165.     IFNE    SPR_DATA_COLL
  1166.         st.b    (a6)+
  1167.     ENDC
  1168.         bra    32$
  1169. 31$        move.b    d3,(a1)+
  1170.     IFNE    SPR_DATA_COLL
  1171.         clr.b    (a6)+
  1172.     ENDC
  1173. 32$        add.b    d0,d0
  1174.         bcc    41$
  1175.         move.b    d2,(a1)+
  1176.     IFNE    SPR_DATA_COLL
  1177.         st.b    (a6)+
  1178.     ENDC
  1179.         bra    42$
  1180. 41$        move.b    d3,(a1)+
  1181.     IFNE    SPR_DATA_COLL
  1182.         clr.b    (a6)+
  1183.     ENDC
  1184. 42$        add.b    d0,d0
  1185.         bcc    51$
  1186.         move.b    d2,(a1)+
  1187.     IFNE    SPR_DATA_COLL
  1188.         st.b    (a6)+
  1189.     ENDC
  1190.         bra    52$
  1191. 51$        move.b    d3,(a1)+
  1192.     IFNE    SPR_DATA_COLL
  1193.         clr.b    (a6)+
  1194.     ENDC
  1195. 52$        add.b    d0,d0
  1196.         bcc    61$
  1197.         move.b    d2,(a1)+
  1198.     IFNE    SPR_DATA_COLL
  1199.         st.b    (a6)+
  1200.     ENDC
  1201.         bra    62$
  1202. 61$        move.b    d3,(a1)+
  1203.     IFNE    SPR_DATA_COLL
  1204.         clr.b    (a6)+
  1205.     ENDC
  1206. 62$        add.b    d0,d0
  1207.         bcc    71$
  1208.         move.b    d2,(a1)+
  1209.     IFNE    SPR_DATA_COLL
  1210.         st.b    (a6)+
  1211.     ENDC
  1212.         bra    72$
  1213. 71$        move.b    d3,(a1)+
  1214.     IFNE    SPR_DATA_COLL
  1215.         clr.b    (a6)+
  1216.     ENDC
  1217. 72$        add.b    d0,d0
  1218.         bcc    81$
  1219.         move.b    d2,(a1)+
  1220.     IFNE    SPR_DATA_COLL
  1221.         st.b    (a6)+
  1222.     ENDC
  1223.         bra    82$
  1224. 81$        move.b    d3,(a1)+
  1225.     IFNE    SPR_DATA_COLL
  1226.         clr.b    (a6)+
  1227.     ENDC
  1228. 82$        dbra    d1,CharLoop
  1229.         bra    DoSprites
  1230.  
  1231. ; Nur Hintergrund
  1232.         CNOP    0,4
  1233. OnlyBack    move.l    d3,(a1)+
  1234.         move.l    d3,(a1)+
  1235.     IFNE    SPR_DATA_COLL
  1236.         clr.l    (a6)+
  1237.         clr.l    (a6)+
  1238.     ENDC
  1239.         addq.w    #1,a3        ;Farb-RAM-Byte überspringen
  1240.         dbra    d1,CharLoop
  1241.         bra    DoSprites
  1242.  
  1243. *
  1244. * Multicolor-Text: Zeichendaten holen und darstellen
  1245. *
  1246.  
  1247. TextMulti    add.w    #40,VCCOUNT(a4)    ;VC erhöhen (wird nicht verwendet)
  1248.  
  1249.         move.l    CHARBASE(a4),a0    ;a0: Zeichengeneratorbasis
  1250.         add.w    RC(a4),a0    ;RC dazunehmen
  1251.  
  1252.         move.l    BACK0LONG(a4),d3 ;d3.l: Farbe 0
  1253.  
  1254.         move.w    $22(a4),d4    ;d4.w: Farbe 1
  1255.         move.b    $22(a4),d4
  1256.  
  1257.         move.w    $23(a4),d5    ;d5.w: Farbe 2
  1258.         move.b    $23(a4),d5
  1259.  
  1260.         move.l    d3,Col40XStart(a5) ;Hintergrund, wenn X-Scroll>0
  1261.         move.l    d3,Col40XStart+4(a5)
  1262.  
  1263. ; Schleife für 40 Zeichen
  1264.         moveq    #39,d1        ;d1: Zeichenzähler
  1265.         moveq    #0,d0
  1266. CharMLoop    move.b    (a2)+,d0    ;Zeichencode lesen
  1267.         move.b    (a0,d0.l*8),d0    ;Zeichendaten lesen
  1268.         beq    MOnlyBack
  1269.         move.b    (a3)+,d2    ;d2: Farbnibble
  1270.         bclr    #3,d2        ;Standard oder Multi?
  1271.         beq    StdInMulti
  1272.  
  1273. ; Multicolor: 4 Pixel konvertieren
  1274.         add.b    d0,d0
  1275.         bcc    11$
  1276.         add.b    d0,d0
  1277.         bcc    12$
  1278.         move.b    d2,(a1)+    ;11
  1279.         move.b    d2,(a1)+
  1280.     IFNE    SPR_DATA_COLL
  1281.         st.b    (a6)+
  1282.         st.b    (a6)+
  1283.     ENDC
  1284.         bra    14$
  1285. 12$        move.w    d5,(a1)+    ;10
  1286.     IFNE    SPR_DATA_COLL
  1287.         st.b    (a6)+
  1288.         st.b    (a6)+
  1289.     ENDC
  1290.         bra    14$
  1291. 11$
  1292.     IFNE    SPR_DATA_COLL
  1293.         clr.w    (a6)+
  1294.     ENDC
  1295.         add.b    d0,d0
  1296.         bcc    13$
  1297.         move.w    d4,(a1)+    ;01
  1298.         bra    14$
  1299. 13$        move.w    d3,(a1)+    ;00
  1300. 14$
  1301.  
  1302.         add.b    d0,d0
  1303.         bcc    21$
  1304.         add.b    d0,d0
  1305.         bcc    22$
  1306.         move.b    d2,(a1)+    ;11
  1307.         move.b    d2,(a1)+
  1308.     IFNE    SPR_DATA_COLL
  1309.         st.b    (a6)+
  1310.         st.b    (a6)+
  1311.     ENDC
  1312.         bra    24$
  1313. 22$        move.w    d5,(a1)+    ;10
  1314.     IFNE    SPR_DATA_COLL
  1315.         st.b    (a6)+
  1316.         st.b    (a6)+
  1317.     ENDC
  1318.         bra    24$
  1319. 21$
  1320.     IFNE    SPR_DATA_COLL
  1321.         clr.w    (a6)+
  1322.     ENDC
  1323.         add.b    d0,d0
  1324.         bcc    23$
  1325.         move.w    d4,(a1)+    ;01
  1326.         bra    24$
  1327. 23$        move.w    d3,(a1)+    ;00
  1328. 24$
  1329.  
  1330.         add.b    d0,d0
  1331.         bcc    31$
  1332.         add.b    d0,d0
  1333.         bcc    32$
  1334.         move.b    d2,(a1)+    ;11
  1335.         move.b    d2,(a1)+
  1336.     IFNE    SPR_DATA_COLL
  1337.         st.b    (a6)+
  1338.         st.b    (a6)+
  1339.     ENDC
  1340.         bra    34$
  1341. 32$        move.w    d5,(a1)+    ;10
  1342.     IFNE    SPR_DATA_COLL
  1343.         st.b    (a6)+
  1344.         st.b    (a6)+
  1345.     ENDC
  1346.         bra    34$
  1347. 31$
  1348.     IFNE    SPR_DATA_COLL
  1349.         clr.w    (a6)+
  1350.     ENDC
  1351.         add.b    d0,d0
  1352.         bcc    33$
  1353.         move.w    d4,(a1)+    ;01
  1354.         bra    34$
  1355. 33$        move.w    d3,(a1)+    ;00
  1356. 34$
  1357.  
  1358.         add.b    d0,d0
  1359.         bcc    41$
  1360.         add.b    d0,d0
  1361.         bcc    42$
  1362.         move.b    d2,(a1)+    ;11
  1363.         move.b    d2,(a1)+
  1364.     IFNE    SPR_DATA_COLL
  1365.         st.b    (a6)+
  1366.         st.b    (a6)+
  1367.     ENDC
  1368.         bra    44$
  1369. 42$        move.w    d5,(a1)+    ;10
  1370.     IFNE    SPR_DATA_COLL
  1371.         st.b    (a6)+
  1372.         st.b    (a6)+
  1373.     ENDC
  1374.         bra    44$
  1375. 41$
  1376.     IFNE    SPR_DATA_COLL
  1377.         clr.w    (a6)+
  1378.     ENDC
  1379.         add.b    d0,d0
  1380.         bcc    43$
  1381.         move.w    d4,(a1)+    ;01
  1382.         bra    44$
  1383. 43$        move.w    d3,(a1)+    ;00
  1384. 44$
  1385.         dbra    d1,CharMLoop
  1386.         bra    DoSprites
  1387.  
  1388. ; Standard: 8 Pixel konvertieren
  1389.         CNOP    0,4
  1390. StdInMulti    add.b    d0,d0
  1391.         bcc    11$
  1392.         move.b    d2,(a1)+
  1393.     IFNE    SPR_DATA_COLL
  1394.         st.b    (a6)+
  1395.     ENDC
  1396.         bra    12$
  1397. 11$        move.b    d3,(a1)+
  1398.     IFNE    SPR_DATA_COLL
  1399.         clr.b    (a6)+
  1400.     ENDC
  1401. 12$        add.b    d0,d0
  1402.         bcc    21$
  1403.         move.b    d2,(a1)+
  1404.     IFNE    SPR_DATA_COLL
  1405.         st.b    (a6)+
  1406.     ENDC
  1407.         bra    22$
  1408. 21$        move.b    d3,(a1)+
  1409.     IFNE    SPR_DATA_COLL
  1410.         clr.b    (a6)+
  1411.     ENDC
  1412. 22$        add.b    d0,d0
  1413.         bcc    31$
  1414.         move.b    d2,(a1)+
  1415.     IFNE    SPR_DATA_COLL
  1416.         st.b    (a6)+
  1417.     ENDC
  1418.         bra    32$
  1419. 31$        move.b    d3,(a1)+
  1420.     IFNE    SPR_DATA_COLL
  1421.         clr.b    (a6)+
  1422.     ENDC
  1423. 32$        add.b    d0,d0
  1424.         bcc    41$
  1425.         move.b    d2,(a1)+
  1426.     IFNE    SPR_DATA_COLL
  1427.         st.b    (a6)+
  1428.     ENDC
  1429.         bra    42$
  1430. 41$        move.b    d3,(a1)+
  1431.     IFNE    SPR_DATA_COLL
  1432.         clr.b    (a6)+
  1433.     ENDC
  1434. 42$        add.b    d0,d0
  1435.         bcc    51$
  1436.         move.b    d2,(a1)+
  1437.     IFNE    SPR_DATA_COLL
  1438.         st.b    (a6)+
  1439.     ENDC
  1440.         bra    52$
  1441. 51$        move.b    d3,(a1)+
  1442.     IFNE    SPR_DATA_COLL
  1443.         clr.b    (a6)+
  1444.     ENDC
  1445. 52$        add.b    d0,d0
  1446.         bcc    61$
  1447.         move.b    d2,(a1)+
  1448.     IFNE    SPR_DATA_COLL
  1449.         st.b    (a6)+
  1450.     ENDC
  1451.         bra    62$
  1452. 61$        move.b    d3,(a1)+
  1453.     IFNE    SPR_DATA_COLL
  1454.         clr.b    (a6)+
  1455.     ENDC
  1456. 62$        add.b    d0,d0
  1457.         bcc    71$
  1458.         move.b    d2,(a1)+
  1459.     IFNE    SPR_DATA_COLL
  1460.         st.b    (a6)+
  1461.     ENDC
  1462.         bra    72$
  1463. 71$        move.b    d3,(a1)+
  1464.     IFNE    SPR_DATA_COLL
  1465.         clr.b    (a6)+
  1466.     ENDC
  1467. 72$        add.b    d0,d0
  1468.         bcc    81$
  1469.         move.b    d2,(a1)+
  1470.     IFNE    SPR_DATA_COLL
  1471.         st.b    (a6)+
  1472.     ENDC
  1473.         bra    82$
  1474. 81$        move.b    d3,(a1)+
  1475.     IFNE    SPR_DATA_COLL
  1476.         clr.b    (a6)+
  1477.     ENDC
  1478. 82$        dbra    d1,CharMLoop
  1479.         bra    DoSprites
  1480.  
  1481. ; Nur Hintergrund
  1482.         CNOP    0,4
  1483. MOnlyBack    move.l    d3,(a1)+
  1484.         move.l    d3,(a1)+
  1485.     IFNE    SPR_DATA_COLL
  1486.         clr.l    (a6)+
  1487.         clr.l    (a6)+
  1488.     ENDC
  1489.         addq.w    #1,a3        ;Farb-RAM-Byte überspringen
  1490.         dbra    d1,CharMLoop
  1491.         bra    DoSprites
  1492.  
  1493. *
  1494. * Extended Color Mode: Grafikdaten holen und darstellen
  1495. *
  1496.  
  1497. TextECM        add.w    #40,VCCOUNT(a4)    ;VC erhöhen (wird nicht verwendet)
  1498.  
  1499.         move.l    CHARBASE(a4),a0    ;a0: Zeichengeneratorbasis
  1500.         add.w    RC(a4),a0    ;RC dazunehmen
  1501.  
  1502.         move.b    $21(a4),d3    ;d3: Hintergrund 0
  1503.         move.b    $22(a4),d4    ;d4: Hintergrund 1
  1504.         move.b    $23(a4),d5    ;d5: Hintergrund 2
  1505.  
  1506.         move.w    LASTBKGD(a4),d0    ;Letzter Hintergrund, wenn X-Scroll>0
  1507.         move.b    LASTBKGD(a4),d0
  1508.  
  1509.         move.w    d0,Col40XStart(a5)
  1510.         move.w    d0,Col40XStart+2(a5)
  1511.         move.w    d0,Col40XStart+4(a5)
  1512.         move.w    d0,Col40XStart+6(a5)
  1513.  
  1514. ; Schleife für 40 Zeichen
  1515. ; d7: Aktuelle Hintergrundfarbe
  1516.         moveq    #39,d1        ;d1: Zeichenzähler
  1517.         moveq    #0,d0
  1518. CharELoop    move.b    (a2)+,d0    ;Zeichencode lesen
  1519.         move.b    (a3)+,d2    ;d2: Farbnibble
  1520.         bclr    #7,d0
  1521.         bne    1$
  1522.         bclr    #6,d0
  1523.         bne    2$
  1524.         move.b    d3,d7        ;00: Hintergrund 0
  1525.         bra    4$
  1526. 2$        move.b    d4,d7        ;01: Hintergrund 1
  1527.         bra    4$
  1528. 1$        bclr    #6,d0
  1529.         bne    3$
  1530.         move.b    d5,d7        ;10: Hintergrund 2
  1531.         bra    4$
  1532. 3$        move.b    $24(a4),d7    ;11: Hintergrund 3
  1533. 4$        move.b    (a0,d0.l*8),d0    ;Zeichendaten lesen
  1534.         beq    EOnlyBack
  1535.  
  1536. ; 8 Pixel konvertieren
  1537.         add.b    d0,d0
  1538.         bcc    11$
  1539.         move.b    d2,(a1)+
  1540.     IFNE    SPR_DATA_COLL
  1541.         st.b    (a6)+
  1542.     ENDC
  1543.         bra    12$
  1544. 11$        move.b    d7,(a1)+
  1545.     IFNE    SPR_DATA_COLL
  1546.         clr.b    (a6)+
  1547.     ENDC
  1548. 12$        add.b    d0,d0
  1549.         bcc    21$
  1550.         move.b    d2,(a1)+
  1551.     IFNE    SPR_DATA_COLL
  1552.         st.b    (a6)+
  1553.     ENDC
  1554.         bra    22$
  1555. 21$        move.b    d7,(a1)+
  1556.     IFNE    SPR_DATA_COLL
  1557.         clr.b    (a6)+
  1558.     ENDC
  1559. 22$        add.b    d0,d0
  1560.         bcc    31$
  1561.         move.b    d2,(a1)+
  1562.     IFNE    SPR_DATA_COLL
  1563.         st.b    (a6)+
  1564.     ENDC
  1565.         bra    32$
  1566. 31$        move.b    d7,(a1)+
  1567.     IFNE    SPR_DATA_COLL
  1568.         clr.b    (a6)+
  1569.     ENDC
  1570. 32$        add.b    d0,d0
  1571.         bcc    41$
  1572.         move.b    d2,(a1)+
  1573.     IFNE    SPR_DATA_COLL
  1574.         st.b    (a6)+
  1575.     ENDC
  1576.         bra    42$
  1577. 41$        move.b    d7,(a1)+
  1578.     IFNE    SPR_DATA_COLL
  1579.         clr.b    (a6)+
  1580.     ENDC
  1581. 42$        add.b    d0,d0
  1582.         bcc    51$
  1583.         move.b    d2,(a1)+
  1584.     IFNE    SPR_DATA_COLL
  1585.         st.b    (a6)+
  1586.     ENDC
  1587.         bra    52$
  1588. 51$        move.b    d7,(a1)+
  1589.     IFNE    SPR_DATA_COLL
  1590.         clr.b    (a6)+
  1591.     ENDC
  1592. 52$        add.b    d0,d0
  1593.         bcc    61$
  1594.         move.b    d2,(a1)+
  1595.     IFNE    SPR_DATA_COLL
  1596.         st.b    (a6)+
  1597.     ENDC
  1598.         bra    62$
  1599. 61$        move.b    d7,(a1)+
  1600.     IFNE    SPR_DATA_COLL
  1601.         clr.b    (a6)+
  1602.     ENDC
  1603. 62$        add.b    d0,d0
  1604.         bcc    71$
  1605.         move.b    d2,(a1)+
  1606.     IFNE    SPR_DATA_COLL
  1607.         st.b    (a6)+
  1608.     ENDC
  1609.         bra    72$
  1610. 71$        move.b    d7,(a1)+
  1611.     IFNE    SPR_DATA_COLL
  1612.         clr.b    (a6)+
  1613.     ENDC
  1614. 72$        add.b    d0,d0
  1615.         bcc    81$
  1616.         move.b    d2,(a1)+
  1617.     IFNE    SPR_DATA_COLL
  1618.         st.b    (a6)+
  1619.     ENDC
  1620.         bra    82$
  1621. 81$        move.b    d7,(a1)+
  1622.     IFNE    SPR_DATA_COLL
  1623.         clr.b    (a6)+
  1624.     ENDC
  1625. 82$        dbra    d1,CharELoop
  1626.  
  1627.         move.b    d7,LASTBKGD(a4)    ;Letzte Hintergrundfarbe merken
  1628.         move.w    CURRENTRASTER(a4),d7    ;d7 wurde zerstört
  1629.         bra    DoSprites
  1630.  
  1631. ; Nur Hintergrund
  1632.         CNOP    0,4
  1633. EOnlyBack    move.b    d7,(a1)+
  1634.         move.b    d7,(a1)+
  1635.         move.b    d7,(a1)+
  1636.         move.b    d7,(a1)+
  1637.         move.b    d7,(a1)+
  1638.         move.b    d7,(a1)+
  1639.         move.b    d7,(a1)+
  1640.         move.b    d7,(a1)+
  1641.     IFNE    SPR_DATA_COLL
  1642.         clr.l    (a6)+
  1643.         clr.l    (a6)+
  1644.     ENDC
  1645.         dbra    d1,CharELoop
  1646.         move.b    d7,LASTBKGD(a4)    ;Letzte Hintergrundfarbe merken
  1647.         move.w    CURRENTRASTER(a4),d7    ;d7 wurde zerstört
  1648.         bra    DoSprites
  1649.  
  1650. *
  1651. * Standard-BitMap: Grafikdaten holen und darstellen
  1652. *
  1653.  
  1654. BitMapStd    move.l    BITMAPBASE(a4),a0 ;a0: Bitmap-Basis
  1655.         move.w    VCCOUNT(a4),d0    ;VC holen
  1656.         lsl.w    #3,d0        ;*8
  1657.         add.w    RC(a4),d0    ;RC dazunehmen
  1658.         add.w    d0,a0        ;und zur Bitmap-Basis dazunehmen
  1659.  
  1660.         add.w    #40,VCCOUNT(a4)    ;VC erhöhen
  1661.  
  1662.         move.w    LASTBKGD(a4),d0    ;Letzter Hintergrund, wenn X-Scroll>0
  1663.         move.b    LASTBKGD(a4),d0
  1664.  
  1665.         move.w    d0,Col40XStart(a5)
  1666.         move.w    d0,Col40XStart+2(a5)
  1667.         move.w    d0,Col40XStart+4(a5)
  1668.         move.w    d0,Col40XStart+6(a5)
  1669.  
  1670. ; Schleife für 40 Bytes
  1671.         moveq    #39,d1        ;d1: Zeichenzähler
  1672. BitMapLoop    move.b    (a2)+,d2    ;Farbe holen
  1673.         move.b    d2,d3        ;d3: Hintergrundfarbe
  1674.         move.b    (a0),d0        ;Byte holen
  1675.         beq    BOnlyBack
  1676.         lsr.b    #4,d2        ;d2: Vordergrundfarbe
  1677.  
  1678. ; 8 Pixel konvertieren
  1679.         add.b    d0,d0
  1680.         bcc    11$
  1681.         move.b    d2,(a1)+
  1682.     IFNE    SPR_DATA_COLL
  1683.         st.b    (a6)+
  1684.     ENDC
  1685.         bra    12$
  1686. 11$        move.b    d3,(a1)+
  1687.     IFNE    SPR_DATA_COLL
  1688.         clr.b    (a6)+
  1689.     ENDC
  1690. 12$        add.b    d0,d0
  1691.         bcc    21$
  1692.         move.b    d2,(a1)+
  1693.     IFNE    SPR_DATA_COLL
  1694.         st.b    (a6)+
  1695.     ENDC
  1696.         bra    22$
  1697. 21$        move.b    d3,(a1)+
  1698.     IFNE    SPR_DATA_COLL
  1699.         clr.b    (a6)+
  1700.     ENDC
  1701. 22$        add.b    d0,d0
  1702.         bcc    31$
  1703.         move.b    d2,(a1)+
  1704.     IFNE    SPR_DATA_COLL
  1705.         st.b    (a6)+
  1706.     ENDC
  1707.         bra    32$
  1708. 31$        move.b    d3,(a1)+
  1709.     IFNE    SPR_DATA_COLL
  1710.         clr.b    (a6)+
  1711.     ENDC
  1712. 32$        add.b    d0,d0
  1713.         bcc    41$
  1714.         move.b    d2,(a1)+
  1715.     IFNE    SPR_DATA_COLL
  1716.         st.b    (a6)+
  1717.     ENDC
  1718.         bra    42$
  1719. 41$        move.b    d3,(a1)+
  1720.     IFNE    SPR_DATA_COLL
  1721.         clr.b    (a6)+
  1722.     ENDC
  1723. 42$        add.b    d0,d0
  1724.         bcc    51$
  1725.         move.b    d2,(a1)+
  1726.     IFNE    SPR_DATA_COLL
  1727.         st.b    (a6)+
  1728.     ENDC
  1729.         bra    52$
  1730. 51$        move.b    d3,(a1)+
  1731.     IFNE    SPR_DATA_COLL
  1732.         clr.b    (a6)+
  1733.     ENDC
  1734. 52$        add.b    d0,d0
  1735.         bcc    61$
  1736.         move.b    d2,(a1)+
  1737.     IFNE    SPR_DATA_COLL
  1738.         st.b    (a6)+
  1739.     ENDC
  1740.         bra    62$
  1741. 61$        move.b    d3,(a1)+
  1742.     IFNE    SPR_DATA_COLL
  1743.         clr.b    (a6)+
  1744.     ENDC
  1745. 62$        add.b    d0,d0
  1746.         bcc    71$
  1747.         move.b    d2,(a1)+
  1748.     IFNE    SPR_DATA_COLL
  1749.         st.b    (a6)+
  1750.     ENDC
  1751.         bra    72$
  1752. 71$        move.b    d3,(a1)+
  1753.     IFNE    SPR_DATA_COLL
  1754.         clr.b    (a6)+
  1755.     ENDC
  1756. 72$        add.b    d0,d0
  1757.         bcc    81$
  1758.         move.b    d2,(a1)+
  1759.     IFNE    SPR_DATA_COLL
  1760.         st.b    (a6)+
  1761.     ENDC
  1762.         bra    82$
  1763. 81$        move.b    d3,(a1)+
  1764.     IFNE    SPR_DATA_COLL
  1765.         clr.b    (a6)+
  1766.     ENDC
  1767. 82$        addq.l    #8,a0        ;Quellzeiger erhöhen
  1768.         dbra    d1,BitMapLoop
  1769.  
  1770.         move.b    d3,LASTBKGD(a4)    ;Letzte Hintergrundfarbe merken
  1771.         bra    DoSprites
  1772.  
  1773. ; Nur Hintergrund
  1774.         CNOP    0,4
  1775. BOnlyBack    move.b    d3,(a1)+
  1776.         move.b    d3,(a1)+
  1777.         move.b    d3,(a1)+
  1778.         move.b    d3,(a1)+
  1779.         move.b    d3,(a1)+
  1780.         move.b    d3,(a1)+
  1781.         move.b    d3,(a1)+
  1782.         move.b    d3,(a1)+
  1783.     IFNE    SPR_DATA_COLL
  1784.         clr.l    (a6)+
  1785.         clr.l    (a6)+
  1786.     ENDC
  1787.         addq.l    #8,a0        ;Quellzeiger erhöhen
  1788.         dbra    d1,BitMapLoop
  1789.         move.b    d3,LASTBKGD(a4)    ;Letzte Hintergrundfarbe merken
  1790.         bra    DoSprites
  1791.  
  1792. *
  1793. * Multicolor-Bitmap: Grafikdaten holen und darstellen
  1794. *
  1795.  
  1796. BitMapMulti    move.l    BITMAPBASE(a4),a0 ;a0: Bitmap-Basis
  1797.         move.w    VCCOUNT(a4),d0    ;VC holen
  1798.         lsl.w    #3,d0        ;*8
  1799.         add.w    RC(a4),d0    ;RC dazunehmen
  1800.         add.w    d0,a0        ;und zur Bitmap-Basis dazunehmen
  1801.  
  1802.         add.w    #40,VCCOUNT(a4)    ;VC erhöhen
  1803.  
  1804.         move.l    BACK0LONG(a4),d5 ;d5.w: Farbe 0
  1805.  
  1806.         move.l    d5,Col40XStart(a5) ;Hintergrund, wenn X-Scroll>0
  1807.         move.l    d5,Col40XStart+4(a5)
  1808.  
  1809. ; Schleife für 40 Bytes
  1810.         moveq    #39,d1
  1811. BitMapMLoop    move.b    (a2)+,d2    ;Farbe 1/2 holen
  1812.         move.b    (a0),d0        ;Byte holen
  1813.         beq    BMOnlyBack
  1814.         move.b    d2,d3        ;d3.b: Farbe 2
  1815.         lsl.w    #8,d3
  1816.         move.b    d2,d3
  1817.         lsr.b    #4,d2        ;d2.b: Farbe 1
  1818.         move.b    (a3),d4        ;d4.b: Farbe 3
  1819.         lsl.w    #8,d4
  1820.         move.b    (a3)+,d4
  1821.  
  1822. ; 4 Pixel konvertieren
  1823.         add.b    d0,d0
  1824.         bcc    11$
  1825.         add.b    d0,d0
  1826.         bcc    12$
  1827.         move.w    d4,(a1)+    ;11
  1828.     IFNE    SPR_DATA_COLL
  1829.         st.b    (a6)+
  1830.         st.b    (a6)+
  1831.     ENDC
  1832.         bra    14$
  1833. 12$        move.w    d3,(a1)+    ;10
  1834.     IFNE    SPR_DATA_COLL
  1835.         st.b    (a6)+
  1836.         st.b    (a6)+
  1837.     ENDC
  1838.         bra    14$
  1839. 11$    
  1840.     IFNE    SPR_DATA_COLL
  1841.         clr.w    (a6)+
  1842.     ENDC
  1843.         add.b    d0,d0
  1844.         bcc    13$
  1845.         move.b    d2,(a1)+    ;01
  1846.         move.b    d2,(a1)+
  1847.         bra    14$
  1848. 13$        move.w    d5,(a1)+    ;00
  1849. 14$
  1850.  
  1851.         add.b    d0,d0
  1852.         bcc    21$
  1853.         add.b    d0,d0
  1854.         bcc    22$
  1855.         move.w    d4,(a1)+    ;11
  1856.     IFNE    SPR_DATA_COLL
  1857.         st.b    (a6)+
  1858.         st.b    (a6)+
  1859.     ENDC
  1860.         bra    24$
  1861. 22$        move.w    d3,(a1)+    ;10
  1862.     IFNE    SPR_DATA_COLL
  1863.         st.b    (a6)+
  1864.         st.b    (a6)+
  1865.     ENDC
  1866.         bra    24$
  1867. 21$    
  1868.     IFNE    SPR_DATA_COLL
  1869.         clr.w    (a6)+
  1870.     ENDC
  1871.         add.b    d0,d0
  1872.         bcc    23$
  1873.         move.b    d2,(a1)+    ;01
  1874.         move.b    d2,(a1)+
  1875.         bra    24$
  1876. 23$        move.w    d5,(a1)+    ;00
  1877. 24$
  1878.  
  1879.         add.b    d0,d0
  1880.         bcc    31$
  1881.         add.b    d0,d0
  1882.         bcc    32$
  1883.         move.w    d4,(a1)+    ;11
  1884.     IFNE    SPR_DATA_COLL
  1885.         st.b    (a6)+
  1886.         st.b    (a6)+
  1887.     ENDC
  1888.         bra    34$
  1889. 32$        move.w    d3,(a1)+    ;10
  1890.     IFNE    SPR_DATA_COLL
  1891.         st.b    (a6)+
  1892.         st.b    (a6)+
  1893.     ENDC
  1894.         bra    34$
  1895. 31$    
  1896.     IFNE    SPR_DATA_COLL
  1897.         clr.w    (a6)+
  1898.     ENDC
  1899.         add.b    d0,d0
  1900.         bcc    33$
  1901.         move.b    d2,(a1)+    ;01
  1902.         move.b    d2,(a1)+
  1903.         bra    34$
  1904. 33$        move.w    d5,(a1)+    ;00
  1905. 34$
  1906.  
  1907.         add.b    d0,d0
  1908.         bcc    41$
  1909.         add.b    d0,d0
  1910.         bcc    42$
  1911.         move.w    d4,(a1)+    ;11
  1912.     IFNE    SPR_DATA_COLL
  1913.         st.b    (a6)+
  1914.         st.b    (a6)+
  1915.     ENDC
  1916.         bra    44$
  1917. 42$        move.w    d3,(a1)+    ;10
  1918.     IFNE    SPR_DATA_COLL
  1919.         st.b    (a6)+
  1920.         st.b    (a6)+
  1921.     ENDC
  1922.         bra    44$
  1923. 41$    
  1924.     IFNE    SPR_DATA_COLL
  1925.         clr.w    (a6)+
  1926.     ENDC
  1927.         add.b    d0,d0
  1928.         bcc    43$
  1929.         move.b    d2,(a1)+    ;01
  1930.         move.b    d2,(a1)+
  1931.         bra    44$
  1932. 43$        move.w    d5,(a1)+    ;00
  1933. 44$
  1934.         addq.l    #8,a0        ;Quellzeiger erhöhen
  1935.         dbra    d1,BitMapMLoop
  1936.         bra    DoSprites
  1937.  
  1938. ; Nur Hintergrund
  1939.         CNOP    0,4
  1940. BMOnlyBack    move.l    d5,(a1)+
  1941.         move.l    d5,(a1)+
  1942.     IFNE    SPR_DATA_COLL
  1943.         clr.l    (a6)+
  1944.         clr.l    (a6)+
  1945.     ENDC
  1946.         addq.w    #1,a3        ;Farb-RAM-Byte überspringen
  1947.         addq.l    #8,a0        ;Quellzeiger erhöhen
  1948.         dbra    d1,BitMapMLoop
  1949.         bra    DoSprites
  1950.  
  1951. *
  1952. * Ungültiger Darstellungsmodus: Schwarzen Bildschirm anzeigen
  1953. *
  1954.  
  1955. BlackScreen    add.w    #40,VCCOUNT(a4)    ;VC erhöhen
  1956.  
  1957.         moveq    #39,d0        ;40 Zeichen schwarz
  1958. 1$        clr.l    (a1)+
  1959.         clr.l    (a1)+
  1960.     IFNE    SPR_DATA_COLL
  1961.         clr.l    (a6)+
  1962.         clr.l    (a6)+
  1963.     ENDC
  1964.         dbra    d0,1$
  1965.         bra    DoSprites
  1966.  
  1967. *
  1968. * $3FFF darstellen
  1969. *
  1970.  
  1971. Show3FFF    move.l    BACK0LONG(a4),d3 ;d3.w: Hintergrundfarbe
  1972.  
  1973.         move.l    d3,Col40XStart(a5) ;Hintergrund, wenn X-Scroll>0
  1974.         move.l    d3,Col40XStart+4(a5)
  1975.  
  1976.         btst    #6,CTRL1(a4)
  1977.         bne    11$
  1978.         move.w    #$3fff,d0    ;Byte bei $3FFF lesen
  1979.         bra    12$
  1980. 11$        move.w    #$39ff,d0    ;ECM: Byte bei $39FF lesen
  1981. 12$        bsr    GetPhysical
  1982.         move.b    (a0),d0        ;Byte lesen
  1983.  
  1984. ; 4 Pixel nach d1 konvertieren, 0: Hintergrund, 1: schwarz
  1985.         moveq    #0,d1
  1986.         add.b    d0,d0
  1987.         bcs    1$
  1988.         move.b    d3,d1
  1989. 1$        lsl.w    #8,d1
  1990.         add.b    d0,d0
  1991.         bcs    2$
  1992.         move.b    d3,d1
  1993. 2$        lsl.l    #8,d1
  1994.         add.b    d0,d0
  1995.         bcs    3$
  1996.         move.b    d3,d1
  1997. 3$        lsl.l    #8,d1
  1998.         add.b    d0,d0
  1999.         bcs    4$
  2000.         move.b    d3,d1
  2001. 4$
  2002.  
  2003. ; 4 Pixel nach d2 konvertieren
  2004.         moveq    #0,d2
  2005.         add.b    d0,d0
  2006.         bcs    5$
  2007.         move.b    d3,d2
  2008. 5$        lsl.w    #8,d2
  2009.         add.b    d0,d0
  2010.         bcs    6$
  2011.         move.b    d3,d2
  2012. 6$        lsl.l    #8,d2
  2013.         add.b    d0,d0
  2014.         bcs    7$
  2015.         move.b    d3,d2
  2016. 7$        lsl.l    #8,d2
  2017.         add.b    d0,d0
  2018.         bcs    8$
  2019.         move.b    d3,d2
  2020. 8$
  2021.  
  2022. ; Zeile schreiben
  2023.         moveq    #39,d0        ;d0: Bytezähler
  2024. Loop3FFF    move.l    d1,(a1)+
  2025.         move.l    d2,(a1)+
  2026.     IFNE    SPR_DATA_COLL
  2027.         clr.l    (a6)+        ;Falsch!!
  2028.         clr.l    (a6)+
  2029.     ENDC
  2030.         dbra    d0,Loop3FFF
  2031.  
  2032. *
  2033. * Sprites malen?
  2034. *
  2035.  
  2036. DoSprites    tst.b    SPRITEON(a4)    ;Ist überhaupt ein Sprite z.Z. sichtbar?
  2037.         beq    DrawLRBorder    ;Nein, dann Rahmen
  2038.         tst.w    SpritesOn    ;Sprite-Darstellung angeschaltet?
  2039.         beq    DrawLRBorder
  2040.  
  2041. *
  2042. * Mindestens ein Sprite ist sichtbar, Sprites malen
  2043. *
  2044.  
  2045. ; Kollisions-Puffer löschen
  2046.         lea    SprCollBuf,a0
  2047.         moveq    #DisplayX/4-1,d0
  2048. 1$        clr.l    (a0)+
  2049.         dbra    d0,1$
  2050.  
  2051. ; Sprites malen
  2052.         moveq    #0,d4        ;Sprite-Grafik Kollisionsflag
  2053.         moveq    #0,d5        ;Sprite-Sprite Kollisionsflag
  2054.         DoSprite 0
  2055.         DoSprite 1
  2056.         DoSprite 2
  2057.         DoSprite 3
  2058.         DoSprite 4
  2059.         DoSprite 5
  2060.         DoSprite 6
  2061.         DoSprite 7
  2062.         move.w    CURRENTRASTER(a4),d7    ;d7 wurde zerstört
  2063.  
  2064. ; Kollisions-Flags auswerten
  2065.         tst.w    Collisions
  2066.         beq    DrawLRBorder
  2067.  
  2068.         move.b    CLXSPR(a4),d0
  2069.         or.b    d5,CLXSPR(a4)    ;Bits im Kollisionsregister setzen
  2070.         tst.b    d0        ;Haben bereits Kollisionen stattgefunden?
  2071.         bne    2$
  2072.         or.b    #$04,IRQFLAG(a4) ;Nein, IMMC-Bit setzen
  2073.         btst    #2,IRQMASK(a4)    ;IRQ erlaubt?
  2074.         beq    2$
  2075.         or.b    #$80,IRQFLAG(a4) ;Ja, IRQ-Bit setzen
  2076.         st.b    IntIsVICIRQ    ;Und Interrupt auslösen
  2077.  
  2078. 2$        move.b    CLXBGR(a4),d0
  2079.         or.b    d4,CLXBGR(a4)
  2080.         tst.b    d0
  2081.         bne    DrawLRBorder
  2082.         or.b    #$02,IRQFLAG(a4)
  2083.         btst    #1,IRQMASK(a4)
  2084.         beq    DrawLRBorder
  2085.         or.b    #$80,IRQFLAG(a4)
  2086.         st.b    IntIsVICIRQ
  2087.  
  2088. *
  2089. * Linken und rechten Rahmen zeichnen
  2090. *
  2091.  
  2092. ; 40-Spalten-Rahmen
  2093. DrawLRBorder    move.l    a5,a0
  2094.         move.l    BORDERLONG(a4),d0 ;d0.l: Rahmenfarbe
  2095.  
  2096.         move.l    d0,(a0)+    ;Links: $00..$1f
  2097.         move.l    d0,(a0)+
  2098.         move.l    d0,(a0)+
  2099.         move.l    d0,(a0)+
  2100.         move.l    d0,(a0)+
  2101.         move.l    d0,(a0)+
  2102.         move.l    d0,(a0)+
  2103.         move.l    d0,(a0)+
  2104.  
  2105.         lea    Col40XStop-Col40XStart(a0),a0
  2106.         move.l    d0,(a0)+    ;Rechts: $160..$17f
  2107.         move.l    d0,(a0)+
  2108.         move.l    d0,(a0)+
  2109.         move.l    d0,(a0)+
  2110.         move.l    d0,(a0)+
  2111.         move.l    d0,(a0)+
  2112.         move.l    d0,(a0)+
  2113.         move.l    d0,(a0)
  2114.  
  2115. ; 38-Spalten-Rahmen
  2116.         tst.b    IS38COL(a4)
  2117.         beq    1$
  2118.  
  2119.         lea    Col40XStart(a5),a0
  2120.         move.l    d0,(a0)+    ;Links: $20..$26
  2121.         move.w    d0,(a0)+
  2122.         move.b    d0,(a0)
  2123.  
  2124.         lea    Col38XStop(a5),a0
  2125.         move.b    d0,(a0)+    ;Rechts: $157..$15e
  2126.         move.l    d0,(a0)+
  2127.         move.l    d0,(a0)+
  2128. 1$        bra    VICIncA5
  2129.  
  2130. *
  2131. * Bild wird übersprungen, nur Bad-Line-Zyklen berechnen
  2132. *
  2133.  
  2134. VICSkip        cmp.w    #FirstDMALine,d7 ;Innerhalb des DMA-Bereiches?
  2135.         blo    VICNop
  2136.         cmp.w    #LastDMALine,d7
  2137.         bhi    VICNop
  2138.  
  2139.         move.b    d7,d0        ;Ja, stimmen die unteren Bits
  2140.         and.b    #7,d0        ;der Rasterzeile mit dem Y-Scroll
  2141.         cmp.b    YSCROLL+1(a4),d0 ;überein?
  2142.         bne    VICNop
  2143.  
  2144.         move.w    BadLineCycles,CyclesLeft
  2145.         bra    VICNop
  2146.  
  2147. *
  2148. * Bei 8 Bit eine Pixelzeile darstellen
  2149. * Zeiger in ChunkyBuf erhöhen
  2150. *
  2151.  
  2152. VICIncA5    cmp.w    #STYP_8BIT,ScreenType
  2153.         bne    VICIncA5Really
  2154.  
  2155.         tst.b    IsCyber
  2156.         beq    1$
  2157.         tst.b    IsCyberDirect
  2158.         beq    2$
  2159.  
  2160.         moveq    #DisplayX/4-1,d0    ;CyberDirect
  2161.         lea    ChunkyBuf,a0
  2162.         move.l    CyberBase,a1
  2163.         move.l    a1,d1
  2164. 3$        move.l    (a0)+,(a1)+
  2165.         dbra    d0,3$
  2166.         add.l    CyberXMod,d1
  2167.         move.l    d1,CyberBase
  2168.         bra    VICIncRC        
  2169.  
  2170. 2$        move.l    _CyberGfxBase,a6    ;Cyber
  2171.         lea    CyberHook,a0
  2172.         move.l    _the_rast_port,a1
  2173.         sub.l    a2,a2
  2174.         jsr    DoCDrawMethod(a6)
  2175.         bra    VICIncRC
  2176.  
  2177. 1$        move.l    _GfxBase,a6        ;Normal
  2178.         move.l    _the_rast_port,a0
  2179.         moveq    #0,d0
  2180.         move.w    CURRENTRASTER(a4),d1
  2181.         sub.w    #FirstDispLine,d1
  2182.         move.l    #DisplayX,d2
  2183.         lea    ChunkyBuf,a2
  2184.         lea    _temp_rp,a1
  2185.         JSRLIB    WritePixelLine8
  2186.         bra    VICIncRC
  2187.  
  2188. CyberHookProc    move.l    (a1),a0        ;a0: Adresse des Bildschirmspeichers
  2189.         moveq    #0,d0
  2190.         move.w    20(a1),d0
  2191.         move.w    Registers+CURRENTRASTER,d1
  2192.         sub.w    #FirstDispLine,d1
  2193.         mulu.w    d1,d0
  2194.         add.l    d0,a0
  2195.         lea    ChunkyBuf,a1
  2196.         moveq    #DisplayX/4-1,d0
  2197. 1$        move.l    (a1)+,(a0)+
  2198.         dbra    d0,1$
  2199.         rts
  2200.  
  2201. VICIncA5Really    add.l    #DisplayX,CURRENTA5(a4)
  2202.  
  2203. *
  2204. * RC erhöhen, Darstellung abschalten, wenn gleich 7
  2205. * (braucht nur im sichtbaren Bereich zu geschehen)
  2206. *
  2207.  
  2208. VICIncRC    cmp.w    #7,RC(a4)
  2209.         beq    1$
  2210.         addq.w    #1,RC(a4)
  2211.         bra    2$
  2212. 1$        st.b    DISPLAYOFF(a4)
  2213.         move.w    VCCOUNT(a4),VCBASE(a4)
  2214. 2$
  2215.  
  2216. *
  2217. * MCs erhöhen (muß in jeder Rasterzeile geschehen, damit die Sprites
  2218. *  auch im Overscan-Bereich korrekt dargestellt werden)
  2219. *
  2220.  
  2221. ; Wenn alle Sprites aus sind, direkt zu CIA-Periodic springen
  2222. VICNop        lea    SPRITEON(a4),a3
  2223.         move.b    SPREN(a4),d0
  2224.         or.b    (a3),d0
  2225.         beq    Periodic6526
  2226.  
  2227. ; MC für jedes Sprite zählen (7..0)
  2228.         moveq    #7,d6        ;d6: Spritenummer
  2229.         lea    M7Y(a4),a1    ;a1: Zeiger auf erste Y-Koordinate
  2230.         lea    MC7(a4),a2    ;a2: Zeiger auf MC
  2231.  
  2232. MCLoop        move.b    (a1),d0        ;Y-Koordinate
  2233.         btst    d6,SPREN(a4)    ;Sprite angeschaltet?
  2234.         bne    1$
  2235. 3$        cmp.w    #60,(a2)    ;Nein, MC kleiner als 60?
  2236.         blo    2$
  2237.         bclr    d6,(a3)        ;Nein, Sprite nicht mehr darstellen
  2238.         bra    5$
  2239.  
  2240. 1$        cmp.b    d0,d7        ;Sprite angeschaltet, Y-Koord. vergleichen
  2241.         bne    3$
  2242.         clr.w    (a2)        ;Gleich, MC zurücksetzen
  2243.         bset    d6,(a3)        ;Und Sprite ab jetzt darstellen
  2244.         bra    5$
  2245.  
  2246. 2$        btst    d6,MYE(a4)    ;MC kleiner als 60, Sprite Y-expandiert?
  2247.         beq    4$
  2248.         eor.b    d7,d0        ;Ja, nur erhöhen, wenn Bit 0
  2249.         and.b    #$01,d0        ; der Y-Koordinate gleich Bit 0
  2250.         bne    5$        ; des Rasterzählers ist
  2251. 4$        addq.w    #3,(a2)        ;MC erhöhen
  2252.         subq.w    #2,CyclesLeft    ;2 Zyklen vom 6510 abziehen
  2253.  
  2254. 5$        subq.w    #2,a1        ;Zeiger auf Y-Koordinate erhöhen
  2255.         subq.w    #2,a2        ;Zeiger auf MC erhöhen
  2256.         dbra    d6,MCLoop
  2257.  
  2258. ; Zu CIA-Periodic springen
  2259.         bra    Periodic6526
  2260.  
  2261.  
  2262. **
  2263. ** Raster-IRQ auslösen
  2264. **
  2265.  
  2266. DoRasterIRQ    lea    Registers,a0
  2267.         or.b    #$01,IRQFLAG(a0)    ;IRST-Bit setzen
  2268.         btst    #0,IRQMASK(a0)        ;Raster-IRQ erlaubt?
  2269.         beq    1$
  2270.         or.b    #$80,IRQFLAG(a0)    ;Ja, IRQ-Bit setzen
  2271.         st.b    IntIsVICIRQ        ;Und Interrupt auslösen
  2272. 1$        rts
  2273.  
  2274.  
  2275. **
  2276. ** Ein Sprite zeichnen
  2277. ** d0.l: Spritedaten
  2278. ** d1.w: X-Koordinate
  2279. ** d2.b: Spritefarbe
  2280. ** d3  : (Temp.)
  2281. ** d4.b: Kollisionsergebnis Sprite-Hintergrund
  2282. ** d5.b: Kollisionsergebnis Sprite-Sprite
  2283. ** d6  : (Pixelzähler)
  2284. ** d7.b: Sprite-Bit (1,2,4, ...)
  2285. ** a1  : Ziel im Bildschirmspeicher
  2286. ** a2  : Ziel im Kollisionspuffer
  2287. ** a3  : Zeiger auf Grafik-Kollisionspuffer
  2288. **
  2289.  
  2290.         CNOP    0,4
  2291. ; Standard-Sprite: 3 Byte mit je 8 Pixeln konvertieren
  2292. DrawSprStd    cmp.w    #DisplayX-24,d1    ;Sprite horizontal sichtbar?
  2293.         bhs    DSSRts
  2294.  
  2295.         moveq    #0,d6        ;Pixelzähler
  2296. DSSLoop        add.l    d0,d0        ;Pixel gesetzt?
  2297.         bcc    DSSNext
  2298.  
  2299.     IFNE    SPR_DATA_COLL
  2300.         tst.b    (a3,d6.l)    ;Ist hier schon Grafik?
  2301.         beq    1$
  2302.         or.b    d7,d4        ;Ja, Kollision erkannt
  2303. 1$
  2304.     ENDC
  2305.         move.b    (a2,d6.l),d1    ;Ist schon ein Sprite da?
  2306.         bne    DSSDont
  2307.  
  2308.         move.b    d2,(a1,d6.l)    ;Nein, Punkt setzen
  2309.         move.b    d7,(a2,d6.l)
  2310.         bra    DSSNext
  2311.  
  2312. DSSDont        or.b    d1,d5        ;Ja, Kollision erkannt zwischen bestehendem
  2313.         or.b    d7,d5        ; und aktuellem Sprite
  2314.  
  2315. DSSNext        addq.w    #1,d6
  2316.         cmp.w    #24,d6
  2317.         bne    DSSLoop
  2318. DSSRts        rts
  2319.  
  2320.         CNOP    0,4
  2321. ; X-expandiertes Standard-Sprite: 3 Byte mit je 8 Pixeln konvertieren
  2322. DrawSprStdExp    cmp.w    #DisplayX-48,d1
  2323.         bhs    DSSERts
  2324.  
  2325.         moveq    #0,d6
  2326. DSSELoop    add.l    d0,d0
  2327.         bcc    DSSENext
  2328.  
  2329.     IFNE    SPR_DATA_COLL
  2330.         tst.b    (a3,d6.l)
  2331.         beq    1$
  2332.         or.b    d7,d4
  2333. 1$
  2334.     ENDC
  2335.         move.b    (a2,d6.l),d1
  2336.         bne    DSSEDont1st
  2337.  
  2338.         move.b    d2,(a1,d6.l)
  2339.         move.b    d7,(a2,d6.l)
  2340.         bra    DSSETest2nd
  2341.  
  2342. DSSEDont1st    or.b    d1,d5
  2343.         or.b    d7,d5
  2344.  
  2345. DSSETest2nd
  2346.     IFNE    SPR_DATA_COLL
  2347.         tst.b    1(a3,d6.l)
  2348.         beq    1$
  2349.         or.b    d7,d4
  2350. 1$
  2351.     ENDC
  2352.         move.b    1(a2,d6.l),d1
  2353.         bne    DSSEDont2nd
  2354.  
  2355.         move.b    d2,1(a1,d6.l)
  2356.         move.b    d7,1(a2,d6.l)
  2357.         bra    DSSENext
  2358.  
  2359. DSSEDont2nd    or.b    d1,d5
  2360.         or.b    d7,d5
  2361.  
  2362. DSSENext    addq.w    #2,d6
  2363.         cmp.w    #48,d6
  2364.         bne    DSSELoop
  2365. DSSERts        rts
  2366.  
  2367.         CNOP    0,4
  2368. ; Multicolor-Sprite: 3 Byte mit je 4 Pixeln konvertieren
  2369. DrawSprMulti    cmp.w    #DisplayX-24,d1
  2370.         bhs    DSMRts
  2371.  
  2372.         moveq    #0,d6
  2373. DSMLoop        add.l    d0,d0        ;Farbe des Pixels bestimmen
  2374.         bcc    DSMFirstIs0
  2375.         add.l    d0,d0
  2376.         bcc    DSMDraw10
  2377.         move.b    $26(a4),d3    ;11
  2378.         bra    DSMDraw
  2379. DSMDraw10    move.b    d2,d3        ;10
  2380.         bra    DSMDraw
  2381. DSMFirstIs0    add.l    d0,d0
  2382.         bcc    DSMNext
  2383.         move.b    $25(a4),d3    ;01
  2384.  
  2385. DSMDraw
  2386.     IFNE    SPR_DATA_COLL
  2387.         tst.b    (a3,d6.l)
  2388.         beq    1$
  2389.         or.b    d7,d4
  2390. 1$
  2391.     ENDC
  2392.         move.b    (a2,d6.l),d1
  2393.         bne    DSMDont1st
  2394.  
  2395.         move.b    d3,(a1,d6.l)
  2396.         move.b    d7,(a2,d6.l)
  2397.         bra    DSMTest2nd
  2398.  
  2399. DSMDont1st    or.b    d1,d5
  2400.         or.b    d7,d5
  2401.  
  2402. DSMTest2nd
  2403.     IFNE    SPR_DATA_COLL
  2404.         tst.b    1(a3,d6.l)
  2405.         beq    1$
  2406.         or.b    d7,d4
  2407. 1$
  2408.     ENDC
  2409.         move.b    1(a2,d6.l),d1
  2410.         bne    DSMDont2nd
  2411.  
  2412.         move.b    d3,1(a1,d6.l)
  2413.         move.b    d7,1(a2,d6.l)
  2414.         bra    DSMNext
  2415.  
  2416. DSMDont2nd    or.b    d1,d5
  2417.         or.b    d7,d5
  2418.  
  2419. DSMNext        addq.w    #2,d6
  2420.         cmp.w    #24,d6
  2421.         bne    DSMLoop
  2422. DSMRts        rts
  2423.  
  2424.         CNOP    0,4
  2425. ; X-expandiertes Multicolor-Sprite: 3 Byte mit je 4 Pixeln konvertieren
  2426. DrawSprMultiExp    cmp.w    #DisplayX-48,d1
  2427.         bhs    DSMERts
  2428.  
  2429.         moveq    #0,d6
  2430. DSMELoop    add.l    d0,d0
  2431.         bcc    DSMEFirstIs0
  2432.         add.l    d0,d0
  2433.         bcc    DSMEDraw10
  2434.         move.b    $26(a4),d3    ;11
  2435.         bra    DSMEDraw
  2436. DSMEDraw10    move.b    d2,d3        ;10
  2437.         bra    DSMEDraw
  2438. DSMEFirstIs0    add.l    d0,d0
  2439.         bcc    DSMENext
  2440.         move.b    $25(a4),d3    ;01
  2441.  
  2442. DSMEDraw
  2443.     IFNE    SPR_DATA_COLL
  2444.         tst.b    (a3,d6.l)
  2445.         beq    1$
  2446.         or.b    d7,d4
  2447. 1$
  2448.     ENDC
  2449.         move.b    (a2,d6.l),d1
  2450.         bne    DSMEDont1st
  2451.  
  2452.         move.b    d3,(a1,d6.l)
  2453.         move.b    d7,(a2,d6.l)
  2454.         bra    DSMETest2nd
  2455.  
  2456. DSMEDont1st    or.b    d1,d5
  2457.         or.b    d7,d5
  2458.  
  2459. DSMETest2nd
  2460.     IFNE    SPR_DATA_COLL
  2461.         tst.b    1(a3,d6.l)
  2462.         beq    1$
  2463.         or.b    d7,d4
  2464. 1$
  2465.     ENDC
  2466.         move.b    1(a2,d6.l),d1
  2467.         bne    DSMEDont2nd
  2468.  
  2469.         move.b    d3,1(a1,d6.l)
  2470.         move.b    d7,1(a2,d6.l)
  2471.         bra    DSMETest3rd
  2472.  
  2473. DSMEDont2nd    or.b    d1,d5
  2474.         or.b    d7,d5
  2475.  
  2476. DSMETest3rd
  2477.     IFNE    SPR_DATA_COLL
  2478.         tst.b    2(a3,d6.l)
  2479.         beq    1$
  2480.         or.b    d7,d4
  2481. 1$
  2482.     ENDC
  2483.         move.b    2(a2,d6.l),d1
  2484.         bne    DSMEDont3rd
  2485.  
  2486.         move.b    d3,2(a1,d6.l)
  2487.         move.b    d7,2(a2,d6.l)
  2488.         bra    DSMETest4th
  2489.  
  2490. DSMEDont3rd    or.b    d1,d5
  2491.         or.b    d7,d5
  2492.  
  2493. DSMETest4th
  2494.     IFNE    SPR_DATA_COLL
  2495.         tst.b    3(a3,d6.l)
  2496.         beq    1$
  2497.         or.b    d7,d4
  2498. 1$
  2499.     ENDC
  2500.         move.b    3(a2,d6.l),d1
  2501.         bne    DSMEDont4th
  2502.  
  2503.         move.b    d3,3(a1,d6.l)
  2504.         move.b    d7,3(a2,d6.l)
  2505.         bra    DSMENext
  2506.  
  2507. DSMEDont4th    or.b    d1,d5
  2508.         or.b    d7,d5
  2509.  
  2510. DSMENext    addq.w    #4,d6
  2511.         cmp.w    #48,d6
  2512.         bne    DSMELoop
  2513. DSMERts        rts
  2514.  
  2515.         CNOP    0,4
  2516. ; Standard-Sprite im Hintergrund: 3 Byte mit je 8 Pixeln konvertieren
  2517. DrawBackStd    cmp.w    #DisplayX-24,d1    ;Sprite horizontal sichtbar?
  2518.         bhs    DBSRts
  2519.  
  2520.         moveq    #0,d6        ;Pixelzähler
  2521. DBSLoop        add.l    d0,d0        ;Pixel gesetzt?
  2522.         bcc    DBSNext
  2523.  
  2524.     IFNE    SPR_DATA_COLL
  2525.         tst.b    (a3,d6.l)    ;Ist hier schon Grafik?
  2526.         beq    1$
  2527.         or.b    d7,d4        ;Ja, Kollision erkannt
  2528.         move.b    (a2,d6.l),d1    ;Ist schon ein Sprite da?
  2529.         beq    DBSNext
  2530.         or.b    d1,d5        ;Ja, Kollision erkannt
  2531.         or.b    d7,d5
  2532.         bra    DBSNext        ;Sprite nicht zeichnen
  2533. 1$
  2534.     ENDC
  2535.         move.b    (a2,d6.l),d1    ;Ja, ist schon ein Sprite da?
  2536.         bne    DBSDont
  2537.  
  2538.         move.b    d2,(a1,d6.l)    ;Nein, Punkt setzen
  2539.         move.b    d7,(a2,d6.l)
  2540.         bra    DBSNext
  2541.  
  2542. DBSDont        or.b    d1,d5        ;Ja, Kollision erkannt zwischen bestehendem
  2543.         or.b    d7,d5        ; und aktuellem Sprite
  2544.  
  2545. DBSNext        addq.w    #1,d6
  2546.         cmp.w    #24,d6
  2547.         bne    DBSLoop
  2548. DBSRts        rts
  2549.  
  2550.         CNOP    0,4
  2551. ; X-expandiertes Standard-Sprite im Hintergrund: 3 Byte mit je 8 Pixeln konvertieren
  2552. DrawBackStdExp    cmp.w    #DisplayX-48,d1
  2553.         bhs    DBSERts
  2554.  
  2555.         moveq    #0,d6
  2556. DBSELoop    add.l    d0,d0
  2557.         bcc    DBSENext
  2558.  
  2559.     IFNE    SPR_DATA_COLL
  2560.         tst.b    (a3,d6.l)
  2561.         beq    1$
  2562.         or.b    d7,d4
  2563.         move.b    (a2,d6.l),d1
  2564.         beq    DBSETest2nd
  2565.         or.b    d1,d5
  2566.         or.b    d7,d5
  2567.         bra    DBSETest2nd
  2568. 1$
  2569.     ENDC
  2570.         move.b    (a2,d6.l),d1
  2571.         bne    DBSEDont1st
  2572.  
  2573.         move.b    d2,(a1,d6.l)
  2574.         move.b    d7,(a2,d6.l)
  2575.         bra    DBSETest2nd
  2576.  
  2577. DBSEDont1st    or.b    d1,d5
  2578.         or.b    d7,d5
  2579.  
  2580. DBSETest2nd
  2581.     IFNE    SPR_DATA_COLL
  2582.         tst.b    1(a3,d6.l)
  2583.         beq    1$
  2584.         or.b    d7,d4
  2585.         move.b    1(a2,d6.l),d1
  2586.         beq    DBSENext
  2587.         or.b    d1,d5
  2588.         or.b    d7,d5
  2589.         bra    DBSENext
  2590. 1$
  2591.     ENDC
  2592.         move.b    1(a2,d6.l),d1
  2593.         bne    DBSEDont2nd
  2594.  
  2595.         move.b    d2,1(a1,d6.l)
  2596.         move.b    d7,1(a2,d6.l)
  2597.         bra    DBSENext
  2598.  
  2599. DBSEDont2nd    or.b    d1,d5
  2600.         or.b    d7,d5
  2601.  
  2602. DBSENext    addq.w    #2,d6
  2603.         cmp.w    #48,d6
  2604.         bne    DBSELoop
  2605. DBSERts        rts
  2606.  
  2607.         CNOP    0,4
  2608. ; Multicolor-Sprite im Hintergrund: 3 Byte mit je 4 Pixeln konvertieren
  2609. DrawBackMulti    cmp.w    #DisplayX-24,d1
  2610.         bhs    DBMRts
  2611.  
  2612.         moveq    #0,d6
  2613. DBMLoop        add.l    d0,d0        ;Farbe des Pixels bestimmen
  2614.         bcc    DBMFirstIs0
  2615.         add.l    d0,d0
  2616.         bcc    DBMDraw10
  2617.         move.b    $26(a4),d3    ;11
  2618.         bra    DBMDraw
  2619. DBMDraw10    move.b    d2,d3        ;10
  2620.         bra    DBMDraw
  2621. DBMFirstIs0    add.l    d0,d0
  2622.         bcc    DBMNext
  2623.         move.b    $25(a4),d3    ;01
  2624.  
  2625. DBMDraw
  2626.     IFNE    SPR_DATA_COLL
  2627.         tst.b    (a3,d6.l)
  2628.         beq    1$
  2629.         or.b    d7,d4
  2630.         move.b    (a2,d6.l),d1
  2631.         beq    DBMTest2nd
  2632.         or.b    d1,d5
  2633.         or.b    d7,d5
  2634.         bra    DBMTest2nd
  2635. 1$
  2636.     ENDC
  2637.         move.b    (a2,d6.l),d1
  2638.         bne    DBMDont1st
  2639.  
  2640.         move.b    d3,(a1,d6.l)
  2641.         move.b    d7,(a2,d6.l)
  2642.         bra    DBMTest2nd
  2643.  
  2644. DBMDont1st    or.b    d1,d5
  2645.         or.b    d7,d5
  2646.  
  2647. DBMTest2nd
  2648.     IFNE    SPR_DATA_COLL
  2649.         tst.b    1(a3,d6.l)
  2650.         beq    1$
  2651.         or.b    d7,d4
  2652.         move.b    1(a2,d6.l),d1
  2653.         beq    DBMNext
  2654.         or.b    d1,d5
  2655.         or.b    d7,d5
  2656.         bra    DBMNext
  2657. 1$
  2658.     ENDC
  2659.         move.b    1(a2,d6.l),d1
  2660.         bne    DBMDont2nd
  2661.  
  2662.         move.b    d3,1(a1,d6.l)
  2663.         move.b    d7,1(a2,d6.l)
  2664.         bra    DBMNext
  2665.  
  2666. DBMDont2nd    or.b    d1,d5
  2667.         or.b    d7,d5
  2668.  
  2669. DBMNext        addq.w    #2,d6
  2670.         cmp.w    #24,d6
  2671.         bne    DBMLoop
  2672. DBMRts        rts
  2673.  
  2674.         CNOP    0,4
  2675. ; X-expandiertes Multicolor-Sprite im Hintergrund: 3 Byte mit je 4 Pixeln konvertieren
  2676. DrawBackMultiExp cmp.w    #DisplayX-48,d1
  2677.         bhs    DBMERts
  2678.  
  2679.         moveq    #0,d6
  2680. DBMELoop    add.l    d0,d0
  2681.         bcc    DBMEFirstIs0
  2682.         add.l    d0,d0
  2683.         bcc    DBMEDraw10
  2684.         move.b    $26(a4),d3    ;11
  2685.         bra    DBMEDraw
  2686. DBMEDraw10    move.b    d2,d3        ;10
  2687.         bra    DBMEDraw
  2688. DBMEFirstIs0    add.l    d0,d0
  2689.         bcc    DBMENext
  2690.         move.b    $25(a4),d3    ;01
  2691.  
  2692. DBMEDraw
  2693.     IFNE    SPR_DATA_COLL
  2694.         tst.b    (a3,d6.l)
  2695.         beq    1$
  2696.         or.b    d7,d4
  2697.         move.b    (a2,d6.l),d1
  2698.         beq    DBMETest2nd
  2699.         or.b    d1,d5
  2700.         or.b    d7,d5
  2701.         bra    DBMETest2nd
  2702. 1$
  2703.     ENDC
  2704.         move.b    (a2,d6.l),d1
  2705.         bne    DBMEDont1st
  2706.  
  2707.         move.b    d3,(a1,d6.l)
  2708.         move.b    d7,(a2,d6.l)
  2709.         bra    DBMETest2nd
  2710.  
  2711. DBMEDont1st    or.b    d1,d5
  2712.         or.b    d7,d5
  2713.  
  2714. DBMETest2nd
  2715.     IFNE    SPR_DATA_COLL
  2716.         tst.b    1(a3,d6.l)
  2717.         beq    1$
  2718.         or.b    d7,d4
  2719.         move.b    1(a2,d6.l),d1
  2720.         beq    DBMETest3rd
  2721.         or.b    d1,d5
  2722.         or.b    d7,d5
  2723.         bra    DBMETest3rd
  2724. 1$
  2725.     ENDC
  2726.         move.b    1(a2,d6.l),d1
  2727.         bne    DBMEDont2nd
  2728.  
  2729.         move.b    d3,1(a1,d6.l)
  2730.         move.b    d7,1(a2,d6.l)
  2731.         bra    DBMETest3rd
  2732.  
  2733. DBMEDont2nd    or.b    d1,d5
  2734.         or.b    d7,d5
  2735.  
  2736. DBMETest3rd
  2737.     IFNE    SPR_DATA_COLL
  2738.         tst.b    2(a3,d6.l)
  2739.         beq    1$
  2740.         or.b    d7,d4
  2741.         move.b    2(a2,d6.l),d1
  2742.         beq    DBMETest4th
  2743.         or.b    d1,d5
  2744.         or.b    d7,d5
  2745.         bra    DBMETest4th
  2746. 1$
  2747.     ENDC
  2748.         move.b    2(a2,d6.l),d1
  2749.         bne    DBMEDont3rd
  2750.  
  2751.         move.b    d3,2(a1,d6.l)
  2752.         move.b    d7,2(a2,d6.l)
  2753.         bra    DBMETest4th
  2754.  
  2755. DBMEDont3rd    or.b    d1,d5
  2756.         or.b    d7,d5
  2757.  
  2758. DBMETest4th
  2759.     IFNE    SPR_DATA_COLL
  2760.         tst.b    3(a3,d6.l)
  2761.         beq    1$
  2762.         or.b    d7,d4
  2763.         move.b    3(a2,d6.l),d1
  2764.         beq    DBMENext
  2765.         or.b    d1,d5
  2766.         or.b    d7,d5
  2767.         bra    DBMENext
  2768. 1$
  2769.     ENDC
  2770.         move.b    3(a2,d6.l),d1
  2771.         bne    DBMEDont4th
  2772.  
  2773.         move.b    d3,3(a1,d6.l)
  2774.         move.b    d7,3(a2,d6.l)
  2775.         bra    DBMENext
  2776.  
  2777. DBMEDont4th    or.b    d1,d5
  2778.         or.b    d7,d5
  2779.  
  2780. DBMENext    addq.w    #4,d6
  2781.         cmp.w    #48,d6
  2782.         bne    DBMELoop
  2783. DBMERts        rts
  2784.  
  2785.  
  2786. **
  2787. ** Amiga-Mono-Routinen einbinden
  2788. **
  2789.  
  2790.         INCLUDE    "6569mono.i"
  2791.  
  2792.  
  2793. **
  2794. ** Konstanten
  2795. **
  2796.  
  2797. ; Tabelle der Display-Routinen (jeweils für Farbe und Monochrom)
  2798.         CNOP    0,4
  2799. DispProcTab    dc.l    TextStd
  2800.         dc.l    TextMulti
  2801.         dc.l    BitMapStd
  2802.         dc.l    BitMapMulti
  2803.         dc.l    TextECM
  2804.         dc.l    BlackScreen
  2805.         dc.l    BlackScreen
  2806.         dc.l    BlackScreen
  2807.  
  2808. MonoDispProcTab    dc.l    FTextStd
  2809.         dc.l    FTextStd
  2810.         dc.l    FBitMapStd
  2811.         dc.l    FBitMapStd
  2812.         dc.l    FTextStd
  2813.         dc.l    FBlackScreen
  2814.         dc.l    FBlackScreen
  2815.         dc.l    FBlackScreen
  2816.  
  2817. ; Tabelle der Sprite-Display-Routinen
  2818. SpriteProcTab    dc.l    DrawSprStd
  2819.         dc.l    DrawSprStdExp
  2820.         dc.l    DrawSprMulti
  2821.         dc.l    DrawSprMultiExp
  2822.         dc.l    DrawBackStd
  2823.         dc.l    DrawBackStdExp
  2824.         dc.l    DrawBackMulti
  2825.         dc.l    DrawBackMultiExp
  2826.  
  2827. ; Hook für DoCDrawMethod
  2828. CyberHook    dc.l    0,0
  2829.         dc.l    CyberHookProc
  2830.         dc.l    0
  2831.         dc.l    0
  2832.  
  2833.  
  2834. **
  2835. ** Datenbereich
  2836. **
  2837.  
  2838. ; Variablen
  2839.         CNOP    0,4
  2840. DisplayProc    dc.l    0    ;Zeiger auf die Display-Routine (Text/Bitmap etc.)
  2841.  
  2842. Sprite0Proc    dc.l    0    ;Zeiger auf Display-Routinen für die einzelnen Sprites
  2843. Sprite1Proc    dc.l    0
  2844. Sprite2Proc    dc.l    0
  2845. Sprite3Proc    dc.l    0
  2846. Sprite4Proc    dc.l    0
  2847. Sprite5Proc    dc.l    0
  2848. Sprite6Proc    dc.l    0
  2849. Sprite7Proc    dc.l    0
  2850.  
  2851. DisplayID    dc.l    0    ;Prefs: DisplayID des Screens
  2852. ScreenType    dc.w    0    ;Prefs: Typ der Screen-Ansteuerung
  2853. NormalCycles    dc.w    0    ;Prefs: Anzahl 6510-Zyklen pro Rasterzeile
  2854. BadLineCycles    dc.w    0    ;Prefs: Anzahl 6510-Zyklen in einer Bad Line
  2855. SpritesOn    dc.w    0    ;Prefs: Sprites-Darstellung angeschaltet
  2856. Collisions    dc.w    0    ;Prefs: Sprite-Kollisionen angeschaltet
  2857. Overscan    dc.w    0    ;Prefs: Overscan-Typ für Amiga-Modi
  2858. DirectVideo    dc.w    0    ;Prefs: Direkter Grafikspeicherzugriff bei 8 Bit erlaubt
  2859.  
  2860. SkipCounter    dc.w    1
  2861.         XDEF    _SkipLatch
  2862. _SkipLatch
  2863. SkipLatch    dc.w    0    ;Prefs: Nur jedes nte Bild darstellen
  2864.  
  2865.         XDEF    _LimitSpeed
  2866. _LimitSpeed
  2867. LimitSpeed    dc.w    0    ;Prefs: Geschwindigkeit auf 100% beschränken
  2868.  
  2869. IsCyber        dc.b    0    ;#0: DoCDrawMethod kann statt WritePixelLine8 benutzt werden
  2870. IsCyberDirect    dc.b    0    ;#0: Direkter Bildschirmspeicherzugriff erlaubt
  2871.         CNOP    0,4
  2872. CyberBase    dc.l    0    ;Basisadresse des Bildschirmspeichers
  2873. CyberXMod    dc.l    0    ;Modulo des Bildschirmspeichers
  2874.  
  2875.         CNOP    0,4
  2876. Registers    ds.b    VICRegLength    ;VIC-Register
  2877. MatrixLine    ds.b    40    ;Eine Bildschirmzeile
  2878. ColorLine    ds.b    40    ;Eine Farb-RAM-Zeile
  2879.  
  2880.  
  2881. **
  2882. ** Nicht initialisierte Daten
  2883. **
  2884.  
  2885.         SECTION    "BSS",BSS
  2886.         XDEF    _ChunkyBuf
  2887. _ChunkyBuf
  2888. ChunkyBuf    ds.b    DisplayX*DisplayY ;Puffer für die Chunky-Bitmap
  2889.  
  2890. SprCollBuf    ds.b    DisplayX    ;Puffer für Sprite-Sprite-Kollisionen
  2891.     IFNE    SPR_DATA_COLL
  2892. GfxCollBuf    ds.b    DisplayX    ;Puffer für Sprite-Grafik-Kollisionen und Priorität
  2893.     ENDC
  2894.  
  2895.         XDEF    _CURRENTA5
  2896. _CURRENTA5    ds.l    1        ;Kommunikation mit _RedrawDisplay
  2897.  
  2898.         END
  2899.