Jump to content
matthew180

F18A programming, info, and resources

Recommended Posts

36 minutes ago, FarmerPotato said:

So, to keep sprites from floating over the BML, I must zero out their pattern bytes. This is do-able.

You could use the GPU and the HSYNC trigger to set VR51 (number of sprites processed) to 0 when it reaches a certain scan line, and set it back again when it reaches the bottom of the screen. I'm doing something similar in the Mario demo where I'm preventing the top part of the screen from scrolling using the HSYNC trigger, so I have some code to share:

 

*      GPU code
INIGP1 XORG GPUPRG
       LI	R15,>47FE			       ; Set up stack pointer
*	   Set the HSYNC trigger
       MOVB @>6032,R0
       ORI  R0,>4000                   ; Set GPU_HTRIG
	   MOVB	R0,@>6032
RETURN IDLE
*	   HSYNC routine
	   CLR	R0
	   MOVB	@>7000,R0			       ; Get scanline no
	   SWPB	R0
	   INC	R0
	   CLR  R1                         ; Scroll reg value at top
	   LI   R2,>0800                   ; Name table reg value at top
	   CI	R0,32				       ; Check scanline
	   JLT	GPU1                       ; At top
	   CI	R0,239				       ; Check scanline
	   JGT	GPU1                       ; Below bottom
       MOV  @GSCRLX,R1                 ; Scroll offset at bottom
       MOV  R1,R3                      ; Copy
       ANDI R1,>00FF                   ; Isolate scroll reg value
       SWPB R1                         ; To MSB
       ANDI R3,>0100                   ; Isolate page bit
       SOC  R3,R2                      ; OR >0800
GPU1   MOVB R1,@>6019			       ; Set scroll register 2
       MOVB R2,@>600A			       ; Set name table register 2
       JMP  RETURN
GSCRLX DATA >0000
       AORG
INIGP2

Edit: In GPU code you can get the current scanline at >7000. The VRs are directly accessed from >6000->603f. To copy the GPU code to the VDP you can use:

*      Copy program to VDP RAM
       LI   R0,GPUPRG
       LI   R1,INIGP1
       LI   R2,INIGP2-INIGP1
       BL   @VMBW
*     Set the GPU PC which also triggers it
      LI   R0,GPUPRG/256+>3600
      BL   @VWTR
      LI   R0,>3700
      BL   @VWTR

 
Edited by Asmusr

Share this post


Link to post
Share on other sites
9 minutes ago, Asmusr said:

You could use the GPU and the HSYNC trigger to set VR51 (number of sprites processed) to 0 when it reaches a certain scan line, and set it back again when it reaches the bottom of the screen.

 

Oh, that's a good idea! Simple solution. I'll see what other effects this leads to.

 

 

Share this post


Link to post
Share on other sites

Question: can a BML span 256 pixels wide? Or is 255 the limit? This is relevant to hiding 4 rows during scrolling and provide a non-scrolling status area with a little video running (not tile based).
Or should I just use the scanline / GPU to turn off TL1 and 2?

 

Share this post


Link to post
Share on other sites
5 minutes ago, FarmerPotato said:

Question: can a BML span 256 pixels wide? Or is 255 the limit? This is relevant to hiding 4 rows during scrolling.
Or should I just use the scanline / GPU to turn off TL1 and 2?

 

Yes, setting VR35=0 means width=256.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...