Hi all,
I'm not new to 8-bit assembly (I've gotten demos running on VIC-20, C64, NES and GB/C) and I got an application booting but the cryptic description of how the 9938 works in the programmer's guide has left me fairly puzzled as to why I can't get a sprite displaying.
Its either something obvious and stupid that I'm not seeing, or there's possibly something wrong with the documentation (there are certainly discrepancies between the 9938 guide and ChibiAkuma's website, for instance)
My graphics init code is this:
di ld a, %00000100 out ($99),a ld a,0+128 out ($99),a ld a, %01000010 out ($99),a ld a,1+128 out ($99),a
which should presumably set m4 on (graphics mode 3), h/v interrupts off, sprites to 16x16, and screen rendering enabled.
I'll leave out most of the boring repetitive code, but I'm setting sprites to $3800, attributes @$1e00 which makes the palette at $1c00.
The only thing I could be doing wrong is mis-interpreting how to write to vram, if the above looks correct. Here is my copy-in code:
; set the target address for data write - $3800 ld a,%00000000 di out ($99),a ld a,14+128 out ($99),a ; store 0 in r#14 ld a,0 out ($99),a ; write bits 0-7 to port 1 ld a,%01111000 ;$38+64 out ($99),a ei ; now, copy all data into reg #0 ($98) ld hl,testsprite ld b,(8*4) ; size of sprite = 8*4 .loadloop ld a,(hl) inc hl dec b ret z ; do while b > 0, else ret back to main loop out ($98),a jr .loadloop
And finally, here's my sprite data:
testsprite DB $00,$0F,$1F,$3F,$3F,$71,$71,$7F DB $7F,$7F,$78,$7E,$7F,$3F,$1F,$07 DB $00,$E0,$F0,$F8,$F8,$88,$8C,$8C DB $FC,$FC,$FC,$1C,$F8,$F8,$F0,$00 testspriteattr DB 100,100,0,0 testspritepal DB 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
If anyone has any clue, let me know. I'd also be happy to upload my source or a .dsk file. Here is my current result:
Imgur link
Thanks all!