Monday, September 18, 2017

Copy the Apple ii text screen to the Third Millenium Arcade Board

So I thought I'd see if I could copy the apple ii's text screen to the tms9918.

Once I've loaded the font into the tms9918 memory, I can just copy bytes from the apple ii's text screen to the tms9918's memory.

Yes, it's not optimized, because I was assembling it by hand with the CALL -151 monitor.

So to write bytes to the TMS9918, you write the low byte of the address to $C0C3, then the high byte with bit 6 set (so we add 64 or $40). We want to write to location zero, so that means writing a $00, then a $40 to $C0C3.

Now any bytes written to $C0C2 will go to that address and then auto-increment the destination address.

We use the routine at $FBC1 to calculate the address of the text line given in A. That clobbers A so we have to restore it. It stores the address in $28 and $29. We use LDA ($28),Y to access the text memory, then STA it to $C0C2. Keep going until we get 32 chars in the line CPY #$20, and then keep going until we've done 24 lines CPX #$18.

4030-   A9 00       LDA   #$00
4032-   8D C3 C0    STA   $C0C3
4035-   A9 40       LDA   #$40
4037-   8D C3 C0    STA   $C0C3
403A-   A9 00       LDA   #$00
403C-   AA          TAX   
403D-   8A          TXA   
403E-   20 C1 FB    JSR   $FBC1
4041-   A0 00       LDY   #$00
4043-   48          PHA   
4044-   B1 28       LDA   ($28),Y
4046-   8D C2 C0    STA   $C0C2
4049-   68          PLA   
404A-   C8          INY   
404B-   C0 20       CPY   #$20
404D-   30 F4       BMI   $4043
404F-   E8          INX   
4050-   E0 18       CPX   #$18
4052-   30 E9       BMI   $403D
4054-   60          RTS   

If you're wondering why it's multicolored, I was experimenting with the TMS9918 color table.



My uploaded font, with the characters from 0-127 copied to 128-255 and colored with the color table. The color table for the 32x24 mode 0 has 32 bytes total: a single color for 8 character patterns.





I think the crazy colors look cool. Distracting but kind of cool.

No comments:

Post a Comment