ascrnet Posted August 4, 2015 Share Posted August 4, 2015 (edited) 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 August 4, 2015 by ascrnet Quote Link to comment Share on other sites More sharing options...
+Ripdubski Posted August 4, 2015 Share Posted August 4, 2015 Im not an expert, try removing all the comments inside the code block. I think the code block is expecting to only see the bytes of the program. 1 Quote Link to comment Share on other sites More sharing options...
joyfulcoder Posted August 4, 2015 Share Posted August 4, 2015 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". Quote Link to comment Share on other sites More sharing options...
kenfused Posted August 4, 2015 Share Posted August 4, 2015 Action does not pass parameters on the stack like basic or return values the same way. Iirc it uses a and x and some zero page locations Quote Link to comment Share on other sites More sharing options...
ascrnet Posted August 4, 2015 Author Share Posted August 4, 2015 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 Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 Action! code blocks must be raw object (machine) code. It doesn't in-line assemble. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted August 5, 2015 Share Posted August 5, 2015 He's not trying to inline assemble: the assembly language is commented out, although it was suggested that this in itself might cause issues. Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 He's not trying to inline assemble: the assembly language is commented out, although it was suggested that this in itself might cause issues. Right you are. Where _is_ that coffee? Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 According to the Action! dox, anything on a line after and including a semicolon are completely ignored by the compiler. Supposedly. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted August 5, 2015 Share Posted August 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
ascrnet Posted August 5, 2015 Author Share Posted August 5, 2015 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 Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 What is the: =* after the CIONEW supposed to do? Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 5, 2015 Share Posted August 5, 2015 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 ACT_TK.ARC Quote Link to comment Share on other sites More sharing options...
ascrnet Posted August 6, 2015 Author Share Posted August 6, 2015 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 Quote Link to comment Share on other sites More sharing options...
+Larry Posted August 6, 2015 Share Posted August 6, 2015 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 Action! Assembler.atr Quote Link to comment Share on other sites More sharing options...
fujidude Posted August 6, 2015 Share Posted August 6, 2015 (edited) 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. Edited August 6, 2015 by fujidude Quote Link to comment Share on other sites More sharing options...
ascrnet Posted August 6, 2015 Author Share Posted August 6, 2015 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 1 Quote Link to comment Share on other sites More sharing options...
ascrnet Posted August 6, 2015 Author Share Posted August 6, 2015 Now if it works !!!!! Here is the example if another friend who likes Action! need the same. 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.