Jump to content
IGNORED

Action! include assembler routine


Recommended Posts

Hi,

 

I do not understand it is as variable shift from action! an assembler routine, here I put an example I'm trying to make it work.

BYTE FUNC CIO=*(
	INT SECTOR,
	BYTE OP,
	CARD DATA,
	BYTE DRIVE)
[
            ; ORG $600
$68	    ;PLA 
$68	    ;PLA Sector HI
$8D $0B $03 ;STA $30B
$68         ;PLA  Sector LO
$8D $0A $03 ;STA $30A
$68	    ;PLA 
$8D $09 $03 ;STA $309
$68	    ;PLA  (R, W o P)
$8D $02 $03 ;STA $302
$A2 $80	    ;LDX #$80 WRITE MODE
$8E $08 $03 ;STX $308 BYTE * SECTOR
$C9 $52     ;CMP #'R'  READ ?
$D0 $02     ;BNE NOREAD
$A2 $40     ;LDX #$40 READ MODE
            ;NOREAD
$8E $03 $03 ;STX $303;
$68         ;PLA Buffer HI
$8D $05 $03 ;STA $305
$68	    ;PLA Buffer LO
$8D $04 $03 ;STA $304
$68         ;PLA 
$85 $D5     ;STA $D5  Status HI 
$68         ;PLA  Drive num.
$18	    ;CLC
$8D $01 $03 ;STA $301 DRIVE
$69 $30	    ;ADC #$30
$8D $00 $03 ;STA $300 DEVICE
            ;LOOPREAD
$20 $53 $E4 ;JSR $E453 CIO
$84 $D4     ;STY $D4 Status BASIC
$60	    ;RTS
]

PROC MAIN()
	CARD buf
	BYTE status
	status = CIO(360,82,buf,1)
	printf(" %S %U",buf,status)
RETURN

It is that I am wrong?

greetings

Edited by ascrnet
Link to comment
Share on other sites

Your function's 2nd arg is a CHAR but you pass "R". "R" and 'R is not the same thing. Try passing 'R instead of "R".

 

you're absolutely right, and I corrected but still not working. I think not taking good input parameters.

 

greetings

Link to comment
Share on other sites

Unfortunately I'm super green when it comes to assembly, so I'm not very good at spotting what might be wrong in the machine code. But... I noticed that there is an ORG directive in the commented assembler code using page 6. Action may not be putting the routine at Page 6, so if there are hard references to it that can be bad. You can tell Action to put a function or procedure at a certain address like this:

PROC test(BYTE v1, v2 , v3) = $600
  ;blah
  ;blah
RETURN

But if you do that, you must remember that Action 1st allocates space for the routine's variables. In this example, that would be 3 bytes. So the actual code would start at $603.

 

Also, I think Action has an internal CIO routine, though in theory if you make your own routine with the same name that is the one which will be used. However, if yours doesn't function fully the same way, it may break other library routines of Action which depend on the original internal CIO working a certain way.

Link to comment
Share on other sites

The code looks position-independent to me: presumably it had been assembled at $0600 previously for testing and the commented out ORG was left in. Note that $E453 is miscommented as "CIO" when it's actually the DSKINV vector. I'm wondering if it might be better to JSR to SIOV at $E459 instead.

Link to comment
Share on other sites

thanks for the ideas, now at least read the unit but place the parameters in the same assembly code.
BYTE FUNC CIONEW=*(CARD DATA)
[
$68	    	 
$A9 $01      ; Sector HI
$8D $0B $03 
$A9 $68	     ; Sector LO	
$8D $0A $03 
$A9 $00     
$8D $09 $03 
$A9 $52     ; R
$8D $02 $03
$A2 $80	    
$8E $08 $03
$C9 $52   
$D0 $02   
$A2 $40   
$8E $03 $03
$68       
$8D $05 $03
$68	     
$8D $04 $03
$A9 $00  
$85 $D5  
$A9 $01  ; DRIVE # 
$18	  
$8D $01 $03 
$69 $30	   
$8D $00 $03 
$20 $53 $E4 
$84 $D4     
$60	   
]

PROC MAIN()
	CARD buf
	BYTE status
	; 360,82,1 
	status = CIONEW(buf)
	printf(" %S %U",buf,status)
RETURN
I do not think it will do all possible to direct routine in assembler, I'll see how to do the same thing another way to read a disk sector.

greetings
Link to comment
Share on other sites

What is the: =* after the CIONEW supposed to do?

what I understand is to return a value to the CIONEW function of the library IO.ACT remove the example:
CHAR FUNC CIOQ=*(BYTE dev, CARD addr,size, BYTE cmd, aux1, aux2)
[$29$F$85$A0$86$A1$A$A$A$A$AA$A5$A5
$9D$342$A5$A3$9D$348$A5$A4$9D$349
$A5$A6$F0$8$9D$34A$A5$A7$9D$34B$98
$9D$345$A5$A1$9D$344$20$E456
$8C CIO_status$C0$88$D0$6$98$A4$A0
$99 EOF$A085$60]

 

Here is the toolkit I have collected for action. It seems like it has a bit more than I see in the toolkit dox though. I put that stuff together over a long time ago so who knows. Anyway attached is an ARC file.

 

Take special note of BLOCK_IO.ACT and SECT_IO.ACT

 

 

 

Thanks, but FreeArc tells me that the file is corrupted file attached.

 

greetings

Link to comment
Share on other sites

Here are a couple of files that might be useful. Note that I've never tried these Action! files. The original ACTUSR.ACT was in CRLF format, and converted, so I included both formats.

 

-Larry

thanks for example, is to simulate the basic atari USR in action! He is looking for something more direct.

 

Use (UN)ARC on the Atari itself and it should work just fine. I used the CLI driven ARC of SpartaDOS 4.47 to create it.

 

ahh ok.

 

I found the ftp Holmes a library called SECTOR.ACT

 

which seems to work, I only need to see the sector read.

BYTE _ddir=$303, ;Data direction, 64=recv, 128=send
     _ddev=$300, ;Device ID ($30+drive)
     _ddno=$301, ;Drive number 
     _dcmd=$302  ;Command byte 

CARD _dbuf=$304, ;Buffer pointer
     _sect=$30A, ;Sector number
     SIO   ;Address of SIO routine

PROC ReadSector(BYTE drive, CARD secnum,buf)
  _ddir=64         ;Read data
  _dcmd=$52        ;Read sector command (R)
  _dbuf=buf
  _sect=secnum
  _ddev=$30+drive
  _ddno=drive
  [$6C SIO]
RETURN

PROC MAIN()
  SIO=$E459
  ReadSector(1,361,$600)
RETURN

greetings

  • Like 1
Link to comment
Share on other sites

Now if it works !!!!! Here is the example if another friend who likes Action! need the same. :D

BYTE _ddir=$303, ;Data direction, 64=recv, 128=send
     _ddev=$300, ;Device ID ($30+drive)
     _ddno=$301, ;Drive number
     _dcmd=$302  ;Command byte 

CARD _dbuf=$304, ;Buffer pointer
     _sect=$30A, ;Sector number
     SIO   ;Address of SIO routine

PROC ReadSector(BYTE drive, CARD secnum,buf)
  _ddir=64         ;Read data
  _dcmd=$52        ;Read sector command (R)
  _dbuf=buf
  _sect=secnum
  _ddev=$30+drive
  _ddno=drive
  [$6C SIO]
RETURN

PROC MAIN()
  byte array buff(0)=$600
  byte j
  SIO=$E459
  ReadSector(1,361,buff)
  
  printf("%ESector 361 - D1:%E%E")
  FOR j=0 TO 127 DO
	 printf( "%C",buff(j) )
  OD
   
RETURN

greetings

post-11721-0-48711000-1438884103_thumb.png

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