STE - mouse pointer

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

jury
Captain Atari
Captain Atari
Posts: 278
Joined: Tue Sep 21, 2004 11:11 am
Location: Poland

STE - mouse pointer

Postby jury » Thu Jan 18, 2018 8:42 pm

When I run below code, I get the mouse pointer fine. But when I uncomment the block responsible for setting my own screen memory ( described below ) mouse pointer does not show. Why does it behave like this?

Code: Select all

;super
   clr.l   -(a7)         
   move.w   #32,-(a7)      
   trap   #1         
   addq.l   #6,a7         
   move.l   d0,old_stack      
;save palette
   move.l   #old_palette,a0      
   movem.l   $ffff8240,d0-d7      
   movem.l   d0-d7,(a0)      
;save screen
   move.w   #2,-(a7)      
   trap   #14
   addq.l   #2,a7
   move.l   d0,old_screen      
;save resolution
   move.w   #4,-(a7)      
   trap   #14
   addq.l   #2,a7
   move.w   d0,old_resolution   
;switch to low res
   move.w   #0,-(a7)      
   move.l   #-1,-(a7)
   move.l   #-1,-(a7)      
   move.w   #5,-(a7)      
   trap   #14
   add.l   #12,a7
   
   move.l   $70,old_vbl
;set my own screen  ( this is what causes no mouse pointer )
;   move.l   #screen_buf,d0
;   move.w   #-1,-(a7)
;   move.l   d0,-(a7)
;   move.l   #-1,-(a7)
;   move.w   #5,-(a7)
;   trap   #14
;   add.l   #12,a7

;show mouse
   dc.w   $a000
   dc.w   $a009

   move.w   #7,-(a7)      
   trap   #1         
   addq.l   #2,a7         

;restore stuff
   move.l   old_vbl,$70

   move.w   old_resolution,d0   
   move.w   d0,-(a7)      
   move.l   old_screen,d0      
   move.l   d0,-(a7)      
   move.l   d0,-(a7)      
   move.w   #5,-(a7)      
   trap   #14
   add.l   #12,a7

   move.l   #old_palette,a0      
   movem.l   (a0),d0-d7      
   movem.l   d0-d7,$ffff8240      

   move.l   old_stack,-(a7)      
   move.w   #32,-(a7)      
   trap   #1         
   addq.l   #6,a7         
   
   clr.l   -(a7)
   trap   #1
   
   section data

pic1   incbin   virtual.pi1

screen_buf   
   dcb.w   3*32000,0
old_resolution   dc.w   0
old_stack   dc.l   0
old_screen   dc.l   0
old_vbl   dc.l   0
   section bss
old_palette   ds.l   8


User avatar
Cyprian
Atari God
Atari God
Posts: 1488
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: STE - mouse pointer

Postby Cyprian » Thu Jan 18, 2018 9:20 pm

I guess the OS is still painting a mouse pointer on the old 'screen'.
I changed "logical screen" address, try to modify also "physical screen". Below you can find Setscreen description:
http://toshyp.atari.org/en/Screen_funct ... #Setscreen
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2306
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: STE - mouse pointer

Postby charles » Thu Jan 18, 2018 11:31 pm

if you read some documentation on the mouse pointer, it need to have a equal level of mouse on as mouse off ,
its not as simple as just on or off it builds a layer of 'on' and 'offs'
so as far as I know you could have three ons and one off this would still show the mouse on some level ,,,,

do you already know this?

usually mouse pointer is released during screen updates then redrawn
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

jury
Captain Atari
Captain Atari
Posts: 278
Joined: Tue Sep 21, 2004 11:11 am
Location: Poland

Re: STE - mouse pointer

Postby jury » Fri Jan 19, 2018 11:02 am

Cyprian wrote:I guess the OS is still painting a mouse pointer on the old 'screen'.
I changed "logical screen" address, try to modify also "physical screen".


I'm not sure if I understand correctly, but 'physical screen' is the one I have modified. I did not modify the 'logical screen' as I do not use and just thought that it has to do nothing with the mouse pointer. I changed it now and the mouse pointer showed. I do not understand what the logical screen has to do with it, but at least it works. Well, kind of, because I display it on the hardware scrolled screen, so boy, it looks distorted :) Now I have to overcome it somehow.
Last edited by jury on Fri Jan 19, 2018 11:50 am, edited 1 time in total.

User avatar
Cyprian
Atari God
Atari God
Posts: 1488
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: STE - mouse pointer

Postby Cyprian » Fri Jan 19, 2018 11:35 am

I've just reread my post, oh gosh it looks terrible...
Instead "I changed "logical screen" address, try to modify also "physical screen"" should be "You changed "physical screen" address, try to modify also "logical screen""

"logical screen" means the memory area where the OS is drawing their data, whereas "physical screen" means the memory area pointed by the MMU/Shifter hardware registers.
Therefore you should modify both pointers physical and logical.

Therefore replace your code:

Code: Select all

;set my own screen  ( this is what causes no mouse pointer )
   move.l   #screen_buf,d0
   move.w   #-1,-(a7)
   move.l   d0,-(a7)
   move.l   #-1,-(a7)
   move.w   #5,-(a7)
   trap   #14
   add.l   #12,a7


with following one:

Code: Select all

;set my own screen  ( this is what causes no mouse pointer )
   move.l   #screen_buf,d0
   move.w   #-1,-(a7)
   move.l   d0,-(a7)
   move.l   d0,-(a7)
   move.w   #5,-(a7)
   trap   #14
   add.l   #12,a7
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2306
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: STE - mouse pointer

Postby charles » Fri Jan 19, 2018 11:02 pm

its been a long while since I have touched asm , but don't you preserve registers before a bios,xbios,gemdos?

this might help ,,thinking out loud , sorry
atari is my lifestyle,not a hobby.
HOLD ON ! ! !,
Im printing unreadable characters ...!

jury
Captain Atari
Captain Atari
Posts: 278
Joined: Tue Sep 21, 2004 11:11 am
Location: Poland

Re: STE - mouse pointer

Postby jury » Sat Feb 10, 2018 4:54 pm

I'm trying to understand mouse working in ST but it gets me more and more confused so far. I've read some documentation on this topic ( Atari Compendium, ST Internals ) but it did not get me far away yet.
So to better understand working of mouse I decided to write some kind of 'scanner' for $fc02 so I could look up whats going on there. Here it is:

Code: Select all

;super mode
   clr.l   -(a7)
   move.w   #32,-(a7)
   trap   #1
   addq.l   #6,a7
   move.l   d0,old_stack

main
   cmp.b   #0,$fffc02
   bgt   print_byte

   cmp.b   #$39,$fffc02
   bne   main

;restore
   move.l   old_stack,-(a7)
   move.w   #32,-(a7)
   trap   #1
   addq.l   #6,a7
   
   clr.l   -(a7)
   trap   #1

print_byte
   clr.l   d0
   move.b   $fffc02,d0
;   move.l   #$F6,d0
   move.l   d0,d1
   lsr.b   #4,d0
   andi.l   #$0f,d0
   andi.l   #$0f,d1

;convert to ascii
   cmp.b   #9,d0
   bgt   d0_char
   add.l   #48,d0
   bra   skip_d0
d0_char
   add.l   #55,d0
skip_d0
   cmp.b   #9,d1
   bgt   d1_char
   add.l   #48,d1
   bra   skip_d1
d1_char
   add.l   #55,d1
skip_d1
;print byte from d0 + space character
   move.w   d0,-(a7)
   move.w   #2,-(a7)
   trap   #1
   addq.l   #4,a7

   move.w   d1,-(a7)
   move.w   #2,-(a7)
   trap   #1
   addq.l   #4,a7

   move.w   #32,-(a7)
   move.w   #2,-(a7)
   trap   #1
   addq.l   #4,a7

   rts

old_stack
   ds.l   1


But this code breaks after first call to 'print_byte' subroutine. When checked under mon, it looks like the rts jumps at address 0 and of course continuation of the program is not possible. How come it does not return to the proper address?

But if I change the main section to:

Code: Select all

main
;   cmp.b   #0,$fffc02
;   bgt   print_byte
   bsr   print_byte

   cmp.b   #$39,$fffc02
   bne   main

and in subroutine print_byte uncomment the move.l #$F6,d0 instruction, the code seems to work fine, rts is done properly, so the program endlessly prints F6 characters :)

User avatar
Cyprian
Atari God
Atari God
Posts: 1488
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: STE - mouse pointer

Postby Cyprian » Sat Feb 10, 2018 6:42 pm

BSR means "jump to subroutine", RTS means "back from subroutine". Those instructions use a stack (and modify stack registers USP/ SSP) for preserving SR and PC registers.

An equivalent of BGT is just JMP (conditional one) instruction. Those instructions don't touch a stack (USP/ SSP)

Therefore you can't BGT /RTS combination for subroutines.

try to change that RTS instruction to "BRA main"
Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Aranym / Steem / Saint
http://260ste.appspot.com/

jury
Captain Atari
Captain Atari
Posts: 278
Joined: Tue Sep 21, 2004 11:11 am
Location: Poland

Re: STE - mouse pointer

Postby jury » Sat Feb 10, 2018 6:49 pm

Yes, just found it also, but thanks a lot for the help! Owe you a beer :)


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: insane and 4 guests

cron