robus Posted December 21, 2023 Share Posted December 21, 2023 I'm realizing that I'm not accessing the font bitmap data correctly and that's causing some ROMs to look completely wrong on load. I realize that I've been lucky with Centipede (and a couple of others) in that the font data is properly addressable even with my broken approach which was simply: (CHBASE << 8 + fontName * 8 + slice) (where slice is the section through the font data for the scan line) This is quite different from the actual addressing mode which is a more complex arrangement of CHBASE (7 or 6 bits) << 8 + fontName (6 or 7 bits) << 3 + slice. However switching to that makes things worse rather than better! I think I'm still not grokking it correctly, but the address I'm creating seems to match the documentation at least. Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 (edited) Here's an example from Pac-Man, obviously the charset data is completely wrong, but the code is setting the base to 0xE0, which is the standard set and grabbing characters from that but it looks quite wrong on screen. Edited December 21, 2023 by robus Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 I'm wondering if the screen ram pointer is wrong, though I don't see how, but the layout of characters doesn't reflect the maze at all? Quote Link to comment Share on other sites More sharing options...
phaeron Posted December 21, 2023 Share Posted December 21, 2023 The thing to realize about ANTIC is that it has no adder, so it can only create addresses by simple logic and incrementers. The address used to fetch character data is created just by routing bits from CHBASE, the current character name, and the row (delta) counter. Pac-Man changes CHBASE from $E0 to $30 mid-screen via a DLI after the status bar. But yeah, that's not your only problem, because the character names clearly aren't right either. The maze is stored at $C00 as a normal-width IR mode 4 playfield which should have this data: 2 Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 Yeah - that looks like a maze. I believe I'm servicing the DLI appropriately (giving it cycles on the last scan line of the mode requesting it and then releasing WSYNC and giving it some more cycles to finish it off), but I guess something is going wrong as I'm definitely not getting the new font or the new data address (though that should just come in the regular DL instructions of course). OK time for some more test cases to explore that behavior. And thanks again for your invaluable help. Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 Hmm - well I am getting 0xC00 as screen ram: _screenRAM uint16 0x0c00 Quote Link to comment Share on other sites More sharing options...
phaeron Posted December 21, 2023 Share Posted December 21, 2023 DLI shouldn't matter -- as you mention the screen address is changed purely by the display list alone, so even with the DLI simply disabled you would get this: It looks like the screen at $0C00 is created by an RLE decompression routine, so you may have a CPU problem. 1 Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 But when I look at the byte stored there, while they start off similar it seems to veer off quite quickly! Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 3 minutes ago, phaeron said: It looks like the screen at $0C00 is created by an RLE decompression routine, so you may have a CPU problem Hmm - not sure about the CPU issue as I've got tests for every instruction, though perhaps? I imagine that's all uncompressed as part of load and doesn't require an ISR I'm not handling? But definitely something has gone amiss. Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 I've found some Pac-Man source and I'm not seeing the RLE you mention? It seems like it's just copying the maze data to the 0xC00 screen ram? 1INIT LDX #0 P1INIL LDA DATMAZ,X STA PACMAZ,X LDA DATMAZ+$100,X STA PACMAZ+$100,X LDA DATMAZ+$200,X STA PACMAZ+$200,X LDA DATMAZ+$300,X STA PACMAZ+$300,X INX BNE P1INIL From here: https://atariwiki.org/wiki/Wiki.jsp?page=PAC-MAN (specifically PAC3.ASM) Quote Link to comment Share on other sites More sharing options...
phaeron Posted December 21, 2023 Share Posted December 21, 2023 The maze screen gets copied from $0800 to $0C00, but it's decompressed to $0800 first. Looks like the linked source is for the disk version, which doesn't seem to have the compression logic. Quote Link to comment Share on other sites More sharing options...
robus Posted December 21, 2023 Author Share Posted December 21, 2023 (edited) 5 minutes ago, phaeron said: The maze screen gets copied from $0800 to $0C00, but it's decompressed to $0800 first. Looks like the linked source is for the disk version, which doesn't seem to have the compression logic. Ah! I guess I need to work on disassembling the ROM so I can follow along and find out where things are going off the rails. Appreciate the assist as always! Edited December 21, 2023 by robus Quote Link to comment Share on other sites More sharing options...
robus Posted December 22, 2023 Author Share Posted December 22, 2023 This seems to be the chunk of code that differs from the Disk version: A3A8 A9 00 LDA #$00 A3AA 85 3E STA $3E A3AC A9 08 LDA #$08 A3AE 85 3F STA $3F A3B0 A9 E1 LDA #$E1 A3B2 85 3C STA $3C A3B4 A9 A1 LDA #$A1 A3B6 85 3D STA $3D A3B8 A0 00 LDY #$00 A3BA B1 3C LA3BA LDA ($3C),Y A3BC 85 2A STA $2A A3BE 30 02 BMI LA3C2 A3C0 10 2B BPL LA3ED A3C2 C9 FF LA3C2 CMP #$FF A3C4 F0 30 BEQ LA3F6 A3C6 24 2A BIT $2A A3C8 70 11 BVS LA3DB A3CA 29 7F AND #$7F A3CC AA TAX A3CD 20 9E A6 JSR $A69E A3D0 20 9C A6 JSR $A69C A3D3 20 A5 A6 LA3D3 JSR $A6A5 A3D6 CA DEX A3D7 10 FA BPL LA3D3 A3D9 30 DF BMI LA3BA A3DB 29 3F LA3DB AND #$3F A3DD 20 A5 A6 JSR $A6A5 A3E0 20 9E A6 JSR $A69E A3E3 20 AE A6 JSR $A6AE A3E6 20 A5 A6 JSR $A6A5 A3E9 B1 3C LDA ($3C),Y A3EB 29 0F AND #$0F A3ED 20 A5 A6 LA3ED JSR $A6A5 A3F0 20 9E A6 JSR $A69E A3F3 4C BA A3 JMP $A3BA A3F6 A9 95 LA3F6 LDA #$95 A3F8 85 3C STA $3C A3FA A9 BE LDA #$BE A3FC 85 3D STA $3D A3FE A9 00 LDA #$00 A400 85 3E STA $3E A402 A9 A6 LDA #$06 A4A4 85 3F STA $3F A4A6 A0 00 LDY #$00 A408 A2 00 LDX #$00 A40A 20 AE A6 LA40A JSR $A6AE A40D 20 A5 A6 JSR $A6A5 A410 20 9C A6 JSR $A69C A413 29 0F AND #$0F A415 20 A5 A6 JSR $A6A5 A418 E8 INX A419 D0 EF BNE LA40A A41B A9 03 LDA #$03 A41D 85 3C STA $3C A41F A9 A0 LDA #$A0 A421 85 3D STA $3D A423 A9 00 LDA #$00 A425 85 3E STA $3E A427 A9 30 LDA #$30 A429 85 3F STA $3F A42B 20 68 A6 JSR $A668 A42E A9 13 LDA #$13 A430 85 3C STA $3C A432 A9 BE LDA #$BE A434 85 3D STA $3D A436 A9 08 LDA #$08 A438 85 3E STA $3E A43A A9 18 LDA #$18 A43C 85 3F STA $3F A43E 20 68 A6 JSR $A668 And calling a bunch of subroutines in the process. But I can see right at the beginning that it's loading 0x0800 into some vector address and then taking data(?) from 0xA1E1 and processing it through zero page indexing in 0x3C, but of course I've no idea what it's actually doing with that data (or what it looks like) Quote Link to comment Share on other sites More sharing options...
robus Posted December 22, 2023 Author Share Posted December 22, 2023 And found the bug in the BIT microcode of my CPU! Not quite a maze yet, but at least maze like! Quote Link to comment Share on other sites More sharing options...
robus Posted December 22, 2023 Author Share Posted December 22, 2023 Closer, but still no quite right yet 1 Quote Link to comment Share on other sites More sharing options...
robus Posted December 23, 2023 Author Share Posted December 23, 2023 A good night's sleep revealed my logic errors in the DLI handling: 1 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.