+Stephen Posted September 18, 2009 Share Posted September 18, 2009 I'm going crazy here - please help!! I have setup a custom DLI which is doing what I want as far as setting the mode lines and screen RAM, etc. I have a DLI set in 3 places. My DLI code is fairly simple, just a quick register change or two. Before exiting the DLI, I load $0200 with the address of the code for the next DLI. I set all the relevant address on the machine $0200=$0000, $0201=$00B2 when I initially enable the DLIs. I am running test code via TurboBASIC and when I enable the DLIs, the machine doesn't crash, but the DLIs are not working correctly. I'll post the DLIST and DLI code below. > dlist B100: 8 BLANK B101: 8 BLANK B102: DLI 7 BLANK B103: LMS a000 MODE F B106: MODE F B107: MODE F B108: MODE F B109: MODE F B10A: MODE F B10B: MODE F B10C: MODE F B10D: MODE F B10E: DLI MODE F B10F: 8 BLANK B110: MODE 6 B111: MODE 6 B112: MODE 6 B113: MODE 6 B114: MODE 6 B115: MODE 6 B116: MODE 6 B117: MODE 6 B118: MODE 6 B119: MODE 6 B11A: MODE 6 B11B: MODE 6 B11C: MODE 6 B11D: DLI MODE 6 B11E: MODE 6 B11F: MODE 6 B120: MODE 6 B121: MODE 6 B122: JVB b100 > > d b200 B200 PHA ; 3cyc ; 48 B201 LDA #$81 ; 2cyc ; A9 81 B203 STA $D40A ;WSYNC ; 4cyc ; 8D 0A D4 B206 STA $D01B ;PRIOR ; 4cyc ; 8D 1B D0 B209 LDA #$3E ; 2cyc ; A9 3E B20B STA $D400 ;DMACTL ; 4cyc ; 8D 00 D4 B20E LDA #$15 ; 2cyc ; A9 15 B210 STA $0200 ;VDSLST ; 4cyc ; 8D 00 02 B213 PLA ; 4cyc ; 68 B214 RTI ; 6cyc ; 40 B215 PHA ; 3cyc ; 48 B216 LDA #$01 ; 2cyc ; A9 01 B218 STA $D40A ;WSYNC ; 4cyc ; 8D 0A D4 B21B STA $D01B ;PRIOR ; 4cyc ; 8D 1B D0 B21E LDA #$25 ; 2cyc ; A9 25 B220 STA $D400 ;DMACTL ; 4cyc ; 8D 00 D4 B223 LDA #$2A ; 2cyc ; A9 2A B225 STA $0200 ;VDSLST ; 4cyc ; 8D 00 02 B228 PLA ; 4cyc ; 68 B229 RTI ; 6cyc ; 40 B22A PHA ; 3cyc ; 48 B22B LDA #$3D ; 2cyc ; A9 3D B22D STA $D40A ;WSYNC ; 4cyc ; 8D 0A D4 B230 STA $D400 ;DMACTL ; 4cyc ; 8D 00 D4 B233 LDA #$00 ; 2cyc ; A9 00 B235 STA $0200 ;VDSLST ; 4cyc ; 8D 00 02 B238 PLA ; 4cyc ; 68 B239 RTI ; 6cyc ; 40 What I want is simple - 10 lines of ANTIC E, some blanks, then 18 lines of ANTIC 6. I want the 10 lines of ANTIC E to have GTIA 10 in standard playfield width, and the rest of the screen to be narrow playfield non GTIA. When I run the above code, I get narrow playfield the entire screen, and where the 3rd DLI should execute, no characters are displayed on the screen at all. When I replaced my STA PRIORs with STA COLBKs, there was only one color change, and it was just above the final 4 MODE 6 lines. This shows the working display list, with interrupts turned off This is what happens when the above DLI code is enabled This is what it looks like when I replace the 2 STA PRIORs with STA COLBKs Thanks for any help. Stephen Anderson Quote Link to comment Share on other sites More sharing options...
dwhyte Posted September 18, 2009 Share Posted September 18, 2009 (edited) EDIT: My post wasn't relevant... Edited September 18, 2009 by dwhyte Quote Link to comment Share on other sites More sharing options...
Rybags Posted September 18, 2009 Share Posted September 18, 2009 You can't just set up multiple DLIs and be guaranteed they'll run in the order you hope them to. Either do something reading VCOUNT to detect which DLI section should be run (which adds processing overhead you probably could do without), or have a VBlank routine that sets the vector to the first DLI. Alternatively, you could leave DLIs disabled then call a piece of code similar to... lda 20 ; Low byte of RTCLOCK wait cmp 20 beq wait lda #$C0 sta nmien ; Enable all DLIs Of course, make sure the DLI vector points to the first DLI. You then have to be real careful that you don't disable DLIs and re-enable them again without doing that procedure, and be careful not to alter the Display List in a way which could cause the sequence of DLIs to be disturbed. Quote Link to comment Share on other sites More sharing options...
MaPa Posted September 18, 2009 Share Posted September 18, 2009 I don't know if you modify OS VBI etc. but if you didn't disabled shadow register copying in OS VBI, then you shoud do fine without the first DLI and have just two of them and set the values from first DLI as global setting. So these values will be there on top of the screen, then you change them two times to the lower part and in OS VBI it will be back to the starting values. Quote Link to comment Share on other sites More sharing options...
+Stephen Posted September 18, 2009 Author Share Posted September 18, 2009 I don't know if you modify OS VBI etc. but if you didn't disabled shadow register copying in OS VBI, then you shoud do fine without the first DLI and have just two of them and set the values from first DLI as global setting. So these values will be there on top of the screen, then you change them two times to the lower part and in OS VBI it will be back to the starting values. Thanks - I will give that a try this evening. Doing it that way, will I still need code to synchronize the lower 2 DLIs though? Stephen Anderson Quote Link to comment Share on other sites More sharing options...
Rybags Posted September 18, 2009 Share Posted September 18, 2009 Personally, I wouldn't do it that way. Disable Stage 2 VBlank, you lose a whole lot of functionality, and you'll probably find later that you'd have to write extra code to bring it back. I also notice your DLIs all do practically the same thing. You could just use a single DLI and put the values for PRIOR and DMACTL into a table. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 18, 2009 Share Posted September 18, 2009 (edited) Here's a routine I found online which sets up 2 DLI's in a table. You can easily modify it to to DLI's on GPRIOR and DMACTL. 5 RESTORE 170:FOR N=0 TO 99:READ X:POKE 1664+N,X:NEXT N 10 COLTAB=1712:LUMTAB=COLTAB+24 14 X=USR(1693) 40 POKE 512,128 50 POKE 513,6 60 DSTART=DPEEK(560) 70 FOR N=DSTART+6 TO DSTART+28 80 POKE N,130 90 NEXT N 100 POKE DSTART+3,194 120 POKE 54286,192 130 END 170 DATA 72,138,72,174,156,6,189,176,6,141 180 DATA 10,212,141,9,212,189,200,6,141,27 190 DATA 208,238,156,6,104,170,104,64,14,104 200 DATA 169,7,160,168,162,6,32,92,228,96 210 DATA 169,1,141,156,6,76,98,228,162,170 220 DATA 156,170,156,170,156,170,156,170,156,170 230 DATA 156,170,156,170,156,170,156,162,204,204 240 DATA 204,204,14,64,64,64,64,64,64,64 250 DATA 64,64,64,0,0,0,0,0,0,64 260 DATA 64,64,64,64,64,64,64,0,64,64 Edited September 18, 2009 by Synthpopalooza Quote Link to comment Share on other sites More sharing options...
MaPa Posted September 18, 2009 Share Posted September 18, 2009 Personally, I wouldn't do it that way. Disable Stage 2 VBlank, you lose a whole lot of functionality, and you'll probably find later that you'd have to write extra code to bring it back. I also notice your DLIs all do practically the same thing. You could just use a single DLI and put the values for PRIOR and DMACTL into a table. Maybe I understand it wrong but it seems to me that you think I suggested to disable stage 2 of VBI? The opposite is true, I suggested to use OS VBI shadow registry copying to get rid of one of the DLI. Quote Link to comment Share on other sites More sharing options...
MaPa Posted September 18, 2009 Share Posted September 18, 2009 (edited) I don't know if you modify OS VBI etc. but if you didn't disabled shadow register copying in OS VBI, then you shoud do fine without the first DLI and have just two of them and set the values from first DLI as global setting. So these values will be there on top of the screen, then you change them two times to the lower part and in OS VBI it will be back to the starting values. Thanks - I will give that a try this evening. Doing it that way, will I still need code to synchronize the lower 2 DLIs though? Stephen Anderson Yes, you will need to do the sync. But if only two DLI's are running you can just check VCOUNT and branch accordingly. Something like: DLI pha lda VCOUNT cmp #some_adequate_constant bcs DLI2 ... and here starts your first DLI ... pla rti DLI2 ... and here your second DLI for bottom part ... pla rti Edited September 18, 2009 by MaPa Quote Link to comment Share on other sites More sharing options...
+Stephen Posted September 18, 2009 Author Share Posted September 18, 2009 I also notice your DLIs all do practically the same thing. You could just use a single DLI and put the values for PRIOR and DMACTL into a table. Ahh - I never thought of that. Makes perfect sense, I think I'll do it this way. I'm having a much harder time going back to 6502 coding than I imagined I would. Too many years of object oriented C on machines with practically unlimited resources has clouded my thought process It's my goal to have this custom screen setup & running this weekend, even if I have to pull a 24 hour marathon session to finish it! Sad considering this should be a 5 minute task. Thanks for all the help guys. There really needs to be a code repository started for things such as this. I have most of the good Atari books (in hardcopy) and none really do a great job explaining multiple DLIs on a screen and these types of problems (synchronizing with display, etc.) Stephen Anderson Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted September 18, 2009 Share Posted September 18, 2009 I also notice your DLIs all do practically the same thing. You could just use a single DLI and put the values for PRIOR and DMACTL into a table. Ahh - I never thought of that. Makes perfect sense, I think I'll do it this way. I'm having a much harder time going back to 6502 coding than I imagined I would. Too many years of object oriented C on machines with practically unlimited resources has clouded my thought process It's my goal to have this custom screen setup & running this weekend, even if I have to pull a 24 hour marathon session to finish it! Sad considering this should be a 5 minute task. Thanks for all the help guys. There really needs to be a code repository started for things such as this. I have most of the good Atari books (in hardcopy) and none really do a great job explaining multiple DLIs on a screen and these types of problems (synchronizing with display, etc.) Stephen Anderson re: setting up the OS VBL you can use the so called SETVBL routine (check atari archives for some books maybe in De Re) but of course you can do this, too: lda #<vbl sta 546 lda #>vbl sta 547 ... vbl: lda #<first_dli sta 512 lda #>first_dli sta 513 jmp $e45f or you do lda #<vbl sta 548 lda #>vbl sta 549 ... vbl: lda #<first_dli sta 512 lda #>first_dli sta 513 jmp $e462 ;deferred vbl called "XITVBL" should work on XL and XE models but not on 400/800. Quote Link to comment Share on other sites More sharing options...
atariksi Posted September 19, 2009 Share Posted September 19, 2009 I also notice your DLIs all do practically the same thing. You could just use a single DLI and put the values for PRIOR and DMACTL into a table. Ahh - I never thought of that. Makes perfect sense, I think I'll do it this way. I'm having a much harder time going back to 6502 coding than I imagined I would. Too many years of object oriented C on machines with practically unlimited resources has clouded my thought process It's my goal to have this custom screen setup & running this weekend, even if I have to pull a 24 hour marathon session to finish it! Sad considering this should be a 5 minute task. Thanks for all the help guys. There really needs to be a code repository started for things such as this. I have most of the good Atari books (in hardcopy) and none really do a great job explaining multiple DLIs on a screen and these types of problems (synchronizing with display, etc.) Stephen Anderson re: setting up the OS VBL you can use the so called SETVBL routine (check atari archives for some books maybe in De Re) but of course you can do this, too: lda #<vbl sta 546 lda #>vbl sta 547 ... vbl: lda #<first_dli sta 512 lda #>first_dli sta 513 jmp $e45f or you do lda #<vbl sta 548 lda #>vbl sta 549 ... vbl: lda #<first_dli sta 512 lda #>first_dli sta 513 jmp $e462 ;deferred vbl called "XITVBL" should work on XL and XE models but not on 400/800. That should work on 400/800 as well since you are using the vectors and not directly the addresses they point to or where you talking about something else? Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted September 20, 2009 Share Posted September 20, 2009 well... I was not sure if XITVBL ($e462 and $e45f) are the same on 400/800... Quote Link to comment Share on other sites More sharing options...
atariksi Posted September 20, 2009 Share Posted September 20, 2009 well... I was not sure if XITVBL ($e462 and $e45f) are the same on 400/800... I have been using vectors as given in Mapping the Atari (400/800) and they work fine on 800XL/130XE/etc. but I haven't tried the 58481 (BLKBDV) to see what that does on 800XL. 58448 E450 DISKIV 58451 E453 DSKINV 58454 E456 CIOV 58457 E459 SIOV 58460 E45C SETVBV 58463 E45F SYSVBV 58466 E462 XITVBV 58469 E465 SIOINV 58472 E468 SENDEV 58475 E46B INTINV 58478 E46E CIOINV 58481 E471 BLKBDV 58484 E474 WARMSV 58487 E477 COLDSV Quote Link to comment Share on other sites More sharing options...
Rybags Posted September 21, 2009 Share Posted September 21, 2009 "Blackboard vector" exits to Self-Test on XL/XE. Quote Link to comment Share on other sites More sharing options...
+Stephen Posted September 21, 2009 Author Share Posted September 21, 2009 Thanks Heaven - I used your suggestion of some VBI code to sync the uppermost DLI to the top of the screen. Worked a charm. I used immediate mode VBI as the manuals I read said I have 200 cycles, and the code I was using took less than 20. I now have a nice stable screen. Stephen Anderson Quote Link to comment Share on other sites More sharing options...
atariksi Posted September 21, 2009 Share Posted September 21, 2009 "Blackboard vector" exits to Self-Test on XL/XE. Just tried it out. The difference is that Atari 400/800 you can go back to BASIC with program in-tact by hitting RESET whereas to get out of SELF-TEST, you end up doing a cold boot when you hit RESET. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.