Jump to content
IGNORED

Action! Pointers and GR.7 sample


Recommended Posts

Hi,

 

I am trying now to write a simple GR7 sample to show Action! speed. For that I am reading the display list information to get the address of the graphics 7+16 mode. This is the program:

 PROC MAIN()                           
   CARD I                              
   CARD DL=560                         
   CARD POINTER DLADDR                 
   CARD POINTER SCR                    
                                       
   GRAPHICS(7+16)                      
                                       
   DLADDR=DL                           
   DLADDR==+4 ;FIRST BYTE START GR7    
                                       
   SCR=DLADDR^                         
                                       
   FOR I=1 TO 3840 DO                  
    SCR^=135                           
    SCR==+1                            
   OD                                  
                                                                              
   FOR I=1 TO 33000 DO OD              
                                       
 RETURN                                

It does work as expected but I have to confess I don't understand why I had to set a variable DL=560 (addresses 560/561 which points to the start of the display list) and a DLADDR pointer and lastly, associate DL to DLADDR in order for the program to work.

 

I've tried simple do something like DLADDR=560^ without using the variable DL. Action! compiler accepts it but the program crashes the computer. My (misled) understanding tells that DLADDR=560^ would give me the same result as DLADDR=DL^ since DL=560 (and it is not a pointer). What I am missing here?

 

Thanks again!

 

 

 

Link to comment
Share on other sites

You could do it shorter I think.

 

CARD DL=560

 

SCR=DL+4   ; address of DL@560+ skip ahead to LMS address

SCR=SCR^  ; Set SCR to screen address

 

To use just DLADDR you could do something like

DLADDR = PeekC(560)+4

SCR=DLADDR^

 

560^ is not a valid construct, I don't know why the compiler doesn't flag it as an error. Either you need a variable assigned to 560 like you did with DL or you need to use PEEKC to retrieve the contents at 560.

Link to comment
Share on other sites

Hey Alfred, 

 

I understand what you say, but when I tried incrementing the variable by two, the result in screen shows I am skipping one byte. When I go back to 1, it seem to work fine.

 

Also, changing the declaration from CARD SCR to BYTE SCR doesn't make any visible difference (Please, see the attached video to demonstrate what I did).

 

What do you think?

 

Thanks!

 

(if it is not working here, there is a copy at http://www.mediafire.com/file/tq7scjihxjd5ql8/action1.mov/file)

Edited by pedgarcia
Link to comment
Share on other sites

The reason SCR==+1 works is because you are poking the CARD 135 ($0087) so it is hiding the fact that you are poking a $00 as the MSB. When you change it to SCR==+2  now you see the effect of the CARD value.

 

Change the code to:

 

SCR^=34695    ; $8787

SCR==+2

 

and it should work correctly.

Link to comment
Share on other sites

Interesting that makes it shorter indeed!

 

Yesterday I was playing with the SCR pointer declaration and looking at the monitor. Now I can understand how it works. If I declare it as BYTE, I can increment by one since SCR is pointing to a 8-bit BYTE. If it is declared as a pointer to a CARD, then I need to assign a 16-bit value and increment by 2 to match the size of the data the pointer is pointing to. 

 

Thanks!

 

 

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...