public static void tecmo_draw_sprites(osd_bitmap bitmap, int priority) {
        int offs;

        /* draw all visible sprites of specified priority */
        for (offs = 0; offs < spriteram_size[0]; offs += 8) {
            int flags = spriteram.read(offs + 3);

            if ((flags >> 6) == priority) {
                int bank = spriteram.read(offs + 0);
                if ((bank & 4) != 0) { /* visible */

                    int which = spriteram.read(offs + 1);
                    int code;
                    int size = (spriteram.read(offs + 2) & 3);
                    /* 0 = 8x8 1 = 16x16 2 = 32x32 3 = 64x64 */
                    if (size == 3) {
                        continue;	/* not used by these games */
                    }

                    if (video_type != 0) {
                        code = (which) + ((bank & 0xf8) << 5); /* silkworm */
                    } else {
                        code = (which) + ((bank & 0xf0) << 4); /* rygar */
                    }

                    if (size == 1) {
                        code >>= 2;
                    } else if (size == 2) {
                        code >>= 4;
                    }

                    drawgfx(bitmap, Machine.gfx[size + 1],
                            code,
                            flags & 0xf, /* color */
                            bank & 1, /* flipx */
                            bank & 2, /* flipy */
                            spriteram.read(offs + 5) - ((flags & 0x10) << 4), /* sx */
                            spriteram.read(offs + 4) - ((flags & 0x20) << 3), /* sy */
                            Machine.drv.visible_area,
                            priority == 3 ? TRANSPARENCY_THROUGH : TRANSPARENCY_PEN,
                            priority == 3 ? palette_transparent_pen : 0);
                }
            }
        }
    }