I've been playing around on the Master recently with the Sprite ROM and want to display a tilemap consisting of an 11x11 grid, where each tile is 16x16 pixels in mode 1. The plan is for it to look similar to the graphics in Ultima IV/V.
I originally prototyped the idea in BASIC using a pair of FOR loops to plot the sprite tiles and the result was predictably slow. So I thought I'd try and re-implement it in the BASIC assembler, using the GXR/Sprite ROM VDU extensions for selecting and plotting the tiles. Now, this was my first attempt (following some tutorials and with the Creative Assembly book besides me), but the result was still slow. I could see the individual sprites being drawn.
Now I know that it's possible to get much faster graphics drawn to the screen, so I'd value some guidance as to where the performance problem is.
Are the MOS routines - even with the Sprite ROM - simply too slow to be useful?
Do I need to draw direct to screen memory? If so, is it possible to write screen drawing code that is fast and also MOS compatible? (I'd like to be MOS compatible if possible)
Is my code simply horrendous and inefficient? (please remember, this is the first assembly I've ever written!)
Thanks for any pointers!
Code: Select all
10 DIM code 100 20 oswrch=&FFEE 30 FOR pass=0 TO 3 STEP 3 40 P%=code 50 [ OPT pass 60 .selectsprite 70 LDA #23 80 JSR oswrch 90 LDA #27 100 JSR oswrch 110 LDA #0 120 JSR oswrch 130 LDA #1 140 JSR oswrch 150 LDA #0 160 JSR oswrch 170 LDA #0 180 JSR oswrch 190 LDA #0 200 JSR oswrch 210 LDA #0 220 JSR oswrch 230 LDA #0 240 JSR oswrch 250 LDA #0 260 JSR oswrch 270 RTS 280 .displaysprite 285 LDX #200 290 .loop 300 LDA #25 310 JSR oswrch 320 LDA #237 330 JSR oswrch 340 TXA 350 JSR oswrch 360 LDA #0 370 JSR oswrch 380 LDA #0 390 JSR oswrch 400 TXA 410 JSR oswrch 411 DEX 412 BNE loop 420 RTS 430 ] 440 NEXT pass 450 CALL selectsprite 460 CALL displaysprite 470 END