forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

noob asm5900 prob

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Thu Jan 06, 2005 2:15 am    Post subject: noob asm5900 prob Reply with quote

hi,
i am new to ps2dev. i coded the following with asm5900 and ps2lib20.
it only shows a red frame at the tv`s borders:

Code:

TARGET ELF, R5900

code SEGMENT 0x400000
     ASSIGN pc:code.main, gp:0x432101, sp:0x123454

INCLUDE "..\ps2lib\macros.inc"
INCLUDE "..\ps2lib\equates.inc"
INCLUDE "..\ps2lib\syscalls.inc"
INCLUDE "..\ps2lib\dma.inc"
INCLUDE "..\ps2lib\gif.inc"
INCLUDE "..\ps2lib\gs.inc"

SCREEN_W EQU 384
SCREEN_H EQU 256
SCREEN_M EQU 7

main PROC
        subi sp, 0x200
        jal Dma02Reset
        nop
       
        addiu a0, zero, NON_INTERLACED
        addiu a1, zero, PAL
        addiu a2, zero, FRAME
        jal GsInit
        nop
       
        addiu a0, zero, SCREEN_W
        addiu a1, zero, SCREEN_H
        addiu a2, zero, PSMCT32
        addiu a3, zero, SCREEN_M
        jal GsSetVideoMode
        nop
       
;following draws a red rect at tv's borders!??
;                          B       G      R
        addi a1, zero, 0
        sll a1, a1, 16
        addi a2, zero, 0
        sll a2, a2, 8
        addi a3, zero, 255
        sll a3, a3, 0
        or a0, a1, a2
        or a0, a0, a3
        jal GsSetBgColor
        nop

        j $

main ENDP
GIF_DECLARE_PACKET gif, 0x00
code ENDS
END code.main

thx inadvance
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Thu Jan 06, 2005 2:47 am    Post subject: Reply with quote

the color for GsSetBgColor goes into v0 not a0 (dont know why, should actually be a0). then it works (already tested) ;)


and by the way, why do all newbies have to write that they are "noobs" into the title? if they realy want to inform everyone that they are noobs, isnt it sufficient to write it into the post itself?
_________________
infj
Back to top
View user's profile Send private message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Thu Jan 06, 2005 3:33 am    Post subject: Reply with quote

works ine now ;) thanks

ps:i will never write it again, promised!
Back to top
View user's profile Send private message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Thu Jan 06, 2005 7:45 pm    Post subject: Reply with quote

it worked only once...
after a recompiling it shows the rect again!?

when i take a look at the GsSetBgColor proc in gs.inc it takes the color in a0. so what is the prob now???

thanks in advance

..::[carsten]::..
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Jan 06, 2005 9:28 pm    Post subject: Reply with quote

just to simplify that piece of code ( li is a macro and should be in macros.inc )

li a0, 0x0000FF
jal GsSetBgColor
nop

wait:
j wait
nop

this should work, afair from wiRe's ps2lib, but it was a long time I looked at it.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Fri Jan 07, 2005 1:20 am    Post subject: Reply with quote

maybe we have different versions of the gs.inc, but mine ("GS Lib v2.0") takes the color in v0

Code:

; desc: change background color
; in: v0 = background color ((B<<16)|(G<<8)|(R<<0))
; waste: at
GsSetBgColor    PROC
                li          at, GS_REG
                sd          v0, 0xE0(at)
                jr          ra
                nop
GsSetBgColor    ENDP


Quote:
after a recompiling it shows the rect again!?

i dont understand that question o_O
_________________
infj
Back to top
View user's profile Send private message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Fri Jan 07, 2005 4:58 am    Post subject: Reply with quote

i think i downloaded my version at wire's page. may mail me yours? hopefully it works afterwards...
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Fri Jan 07, 2005 10:46 am    Post subject: Reply with quote

i also dont know where mine is from, so i just checked the one from wire's page and its different, seems like mine is older.
i tested your code with the new one (with color in a0) - still works.

so when you set the color in a0 it doesnt work? or what exactly is your problem now?
_________________
infj
Back to top
View user's profile Send private message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Sun Jan 09, 2005 11:26 pm    Post subject: Reply with quote

my GsSetBgColor takes the color in a0 (look at gs.inc). the code i posted should change the bgcolor to red, but it only draws a red rect at the borders of the tv!? i also tried out an older version (1.3 i think), which takes color in v0, but there is the same problem...
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Mon Jan 10, 2005 5:43 am    Post subject: Reply with quote

ah, now i understand your problem. actually it not a problem, the program works as it should. the borders of the tv are the "background".
if you want to make the whole screen red for example you have to draw something on it. the easiest way i think would be to draw a sprite.

try add this to your program instead of the SetBgColor code:
Code:

   la          at, gif_packet|0x20000000       ; uncached mem
   addi        v0, zero, SCREEN_W
   sll         v0, v0, 4
   ori         v0, 0x8000
   sh          v0, gif_packet.~cls_xy+0(at)
   addi        v0, zero, SCREEN_H
   sll         v0, v0, 4
   ori         v0, 0x8000
   sh          v0, gif_packet.~cls_xy+2(at)

   la          a0, gif_packet                  ; send the gif
   jal         Dma02SendGif
   addiu       a1, zero, gif_packet._size/16

   wait:
   j wait
   nop 

   gif_packet   TABLE ALIGN 16
cls:      GIF_TAG     4, 1, 0, 0, 0, 1, GIF_AD
      GIF_DATA    GS_PRIM, PRIM_SPRITE
      GIF_DATA    GS_RGBAQ, 0x800000ff ;RED
      GIF_DATA    GS_XYZ2, 0
cls_xy:      GIF_DATA    GS_XYZ2, 0
   gif_packet   ENDT

_________________
infj
Back to top
View user's profile Send private message
..::[carsten]::..



Joined: 06 Jan 2005
Posts: 6

PostPosted: Tue Jan 11, 2005 12:22 am    Post subject: Reply with quote

that's confusing...
why is this proc called setbgcolor if it does not set thebackground's color????

thanks
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Tue Jan 11, 2005 4:03 am    Post subject: Reply with quote

The background on a TV is the border, because the space in the middle of the TV is the foreground.

Definition of background: The area of the C64 screen in which programmers are not allowed to draw yet do it anyways. (I think thats how the saying goes...)
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group