Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #814 > unrolled thread
| Started by | jcullenhome@comcast.net |
|---|---|
| First post | 2013-08-26 20:35 -0700 |
| Last post | 2013-08-29 10:02 -0700 |
| Articles | 13 — 6 participants |
Back to article view | Back to comp.sys.apple2.programmer
ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-26 20:35 -0700
Re: ProDOS MLI -- why I'm failing! gids.rs@sasktel.net - 2013-08-26 22:06 -0700
Re: ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-27 18:38 -0700
Re: ProDOS MLI -- why I'm failing! David Schmenk <dschmenk@gmail.com> - 2013-08-27 19:28 -0700
Re: ProDOS MLI -- why I'm failing! gids.rs@sasktel.net - 2013-08-27 22:19 -0700
Re: ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-28 05:48 -0700
Re: ProDOS MLI -- why I'm failing! David Schmidt <schmidtd@my-deja.com> - 2013-08-28 10:18 -0400
Re: ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-28 08:42 -0700
Re: ProDOS MLI -- why I'm failing! Antoine Vignau <antoine.vignau@laposte.net> - 2013-08-28 11:33 -0700
Re: ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-28 15:27 -0700
Re: ProDOS MLI -- why I'm failing! jcullenhome@comcast.net - 2013-08-28 19:45 -0700
Re: ProDOS MLI -- why I'm failing! "Bill Buckels" <bbuckels@mts.net> - 2013-08-29 07:33 -0500
Re: ProDOS MLI -- why I'm failing! Antoine Vignau <antoine.vignau@laposte.net> - 2013-08-29 10:02 -0700
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-26 20:35 -0700 |
| Subject | ProDOS MLI -- why I'm failing! |
| Message-ID | <0f4e038e-98dd-4b3d-8bed-a6913313f365@googlegroups.com> |
Greetings all!
I'm getting back into Assembly after a long while and I'm trying to do a simple task of entering and loading a filename.
Years ago, I had no problems opening and reading, etc with the MLI, but for some reason it's not working.. It's probably something stupid!
Below is my Merlin source:
Right now, this is a test which is BRUN from BASIC.SYSTEM, so I am aware of the whole prefix difference between the two. I basically accept user input for a filename (then set each char to low ascii).
I make two calls to Set_Prefix, then to Open.. that's all so far because I just wanted to verify the errors before reading... etc
Both calls are throwing $40 - pathname syntax.
If anyone can skim thru and tell me where I jumped the shark, I would be grateful!
It's driving me crazy because I know I've done this before!
Thanks!
-----
ORG $800
HOME EQU $FC58
COUT EQU $FDED
HTAB EQU $0024
VTAB EQU $0025
KEY EQU $C000
STROBE EQU $C010
IOBUFF EQU $900
MAIN NOP
JSR HOME
JSR GETFILE
RTS
*--------------------------------
*--- routines ------
*--- getFile prompts for and loads the image file
GETFILE LDX #0
:MSGLOOP LDA FILEMSG,X
CPX #25
BEQ :DONE
JSR COUT
INX
BNE :MSGLOOP
:DONE NOP
LDX #0
:GETKEY LDA KEY
BPL :GETKEY
STA STROBE
JSR COUT
SEC
SBC #128
STA FILENAME,X
INX
CMP #$0D *<return>
BNE :GETKEY
JSR $BF00
DFB #$C6
DA SETP
CLC
JSR COUT *error code
JSR $BF00 *call MLI
DFB #$C8 *open command
DA OPENPARM
CLC
JSR COUT *testing error code
RTS
*data area------
SETP DFB #$01
DA PREFIXC
OPENPARM DFB #$03
DA FILENAMC
DA IOBUFF
REFNUM DFB #$00
FILEMSG ASC "Please enter a filename: "
FILENAMC DFB #$08
FILENAME DS 8
PREFIXC DFB #$05
PREFIX ASC '/DEV/'
[toc] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2013-08-26 22:06 -0700 |
| Message-ID | <fa77085d-ab98-43cd-ba82-b50d87124e31@googlegroups.com> |
| In reply to | #814 |
Try this and note the changes;
GETFILE LDX #0
:MSGLOOP LDA FILEMSG,X
CPX #25
BEQ :DONE
JSR COUT
INX
BNE :MSGLOOP
:DONE LDX #0
:GETKEY LDA KEY
BPL :GETKEY
STA STROBE
CMP #$8D ; moved here so it does not get stored with filename
BEQ :SETPFX
JSR COUT
AND #$7F
STA FILENAME,X
INX
BNE :GETKEY
:SETPFX STX FILENAMC ; actual filename length needs to be stored
JSR $BF00
DFB #$C6
DA SETP
CLC
JSR COUT *error code
JSR $BF00 *call MLI
DFB #$C8 *open command
DA OPENPARM
JSR COUT *testing error code
RTS
*data area------
SETP DFB #$01
DA PREFIXC
OPENPARM DFB #$03
DA FILENAMC
DA IOBUFF
REFNUM DFB #$00
FILEMSG ASC "Please enter a filename: "
FILENAMC DFB #$00 ; will be saved went filename entered
FILENAME DS 15 ; a filename can have a maximum of 15 characters
PREFIXC DFB #$05
PREFIX ASC '/DEV/'
[toc] | [prev] | [next] | [standalone]
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-27 18:38 -0700 |
| Message-ID | <48518a47-f08a-429a-bf42-0309fd456e0b@googlegroups.com> |
| In reply to | #815 |
Thanks for your reply! I like some of the changes you suggested, but they are still throwing $40s. I'm going to try changing to a .SYS file and see if that helps. On Tuesday, August 27, 2013 1:06:09 AM UTC-4, gid...@sasktel.net wrote: > Try this and note the changes; > > > > > > > > GETFILE LDX #0 > > :MSGLOOP LDA FILEMSG,X > > CPX #25 > > BEQ :DONE > > JSR COUT > > INX > > BNE :MSGLOOP > > > > :DONE LDX #0 > > :GETKEY LDA KEY > > BPL :GETKEY > > STA STROBE > > CMP #$8D ; moved here so it does not get stored with filename > > BEQ :SETPFX > > JSR COUT > > AND #$7F > > STA FILENAME,X > > INX > > BNE :GETKEY > > > > :SETPFX STX FILENAMC ; actual filename length needs to be stored > > JSR $BF00 > > DFB #$C6 > > DA SETP > > CLC > > > > JSR COUT *error code > > > > JSR $BF00 *call MLI > > DFB #$C8 *open command > > DA OPENPARM > > > > JSR COUT *testing error code > > RTS > > > > > > *data area------ > > SETP DFB #$01 > > DA PREFIXC > > > > OPENPARM DFB #$03 > > DA FILENAMC > > DA IOBUFF > > REFNUM DFB #$00 > > > > FILEMSG ASC "Please enter a filename: " > > > > FILENAMC DFB #$00 ; will be saved went filename entered > > FILENAME DS 15 ; a filename can have a maximum of 15 characters > > > > PREFIXC DFB #$05 > > PREFIX ASC '/DEV/'
[toc] | [prev] | [next] | [standalone]
| From | David Schmenk <dschmenk@gmail.com> |
|---|---|
| Date | 2013-08-27 19:28 -0700 |
| Message-ID | <d6367f37-4963-4203-953e-887b40d1d0b3@googlegroups.com> |
| In reply to | #820 |
On Tuesday, 27 August 2013 18:38:56 UTC-7, jcull...@comcast.net wrote: > Thanks for your reply! > > > > I like some of the changes you suggested, but they are still throwing $40s. > > I'm going to try changing to a .SYS file and see if that helps. > > > > > > On Tuesday, August 27, 2013 1:06:09 AM UTC-4, gid...@sasktel.net wrote: > > > Try this and note the changes; > > > > > > > > > > > > > > > > > > > > > > > > GETFILE LDX #0 > > > > > > :MSGLOOP LDA FILEMSG,X > > > > > > CPX #25 > > > > > > BEQ :DONE > > > > > > JSR COUT > > > > > > INX > > > > > > BNE :MSGLOOP > > > > > > > > > > > > :DONE LDX #0 > > > > > > :GETKEY LDA KEY > > > > > > BPL :GETKEY > > > > > > STA STROBE > > > > > > CMP #$8D ; moved here so it does not get stored with filename > > > > > > BEQ :SETPFX > > > > > > JSR COUT > > > > > > AND #$7F > > > > > > STA FILENAME,X > > > > > > INX > > > > > > BNE :GETKEY > > > > > > > > > > > > :SETPFX STX FILENAMC ; actual filename length needs to be stored > > > > > > JSR $BF00 > > > > > > DFB #$C6 > > > > > > DA SETP > > > > > > CLC > > > > > > > > > > > > JSR COUT *error code > > > > > > > > > > > > JSR $BF00 *call MLI > > > > > > DFB #$C8 *open command > > > > > > DA OPENPARM > > > > > > > > > > > > JSR COUT *testing error code > > > > > > RTS > > > > > > > > > > > > > > > > > > *data area------ > > > > > > SETP DFB #$01 > > > > > > DA PREFIXC > > > > > > > > > > > > OPENPARM DFB #$03 > > > > > > DA FILENAMC > > > > > > DA IOBUFF > > > > > > REFNUM DFB #$00 > > > > > > > > > > > > FILEMSG ASC "Please enter a filename: " > > > > > > > > > > > > FILENAMC DFB #$00 ; will be saved went filename entered > > > > > > FILENAME DS 15 ; a filename can have a maximum of 15 characters > > > > > > > > > > > > PREFIXC DFB #$05 > > > > > > PREFIX ASC '/DEV/' For a quick and dirty way to input a ProDOS string, make sure the stack pointer starts at $FE, call GETLN, and STX $1FF. Pass $1FF as the address of the string to ProDOS. ProDOS will strip the hight bit for filenames.
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2013-08-27 22:19 -0700 |
| Message-ID | <e44cd0b1-d7e1-4b14-af42-92da7a74027b@googlegroups.com> |
| In reply to | #820 |
Since the error is when you are setting the prefix, then the open command won't work anyways. Check the /DEV/ in memory. I am not sure how Merlin stores ascii text, but it may have saved it backwards like this /VED/ when using the ASC '/DEV/'. Most assemblers require double quotes to make forward text in memory like so. ASC "/DEV/". Rob
[toc] | [prev] | [next] | [standalone]
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-28 05:48 -0700 |
| Message-ID | <29b505dc-dd25-4228-94cf-04ed82f187a7@googlegroups.com> |
| In reply to | #822 |
The name of my file is 'test', so when I look at $0280 memory shows "/dev/test' as the prefix.. I also created a .sys version and ran it without BASIC.SYSTEM.. $0280 showed /test as the prefix. My program code viewed thru the monitor shows that my prefix / filename strings are indeed low ascii. When I get home, I'll try digging up my actual floppy that I used years ago when I got MLI to work.. see if I did anything different. This MLI stuff is pretty straightforward, not complicated really. What's going on?? :O Can anybody find anything off with my code / calls above? Thanks again for all the help! Jim On Wednesday, August 28, 2013 1:19:57 AM UTC-4, gid...@sasktel.net wrote: > Since the error is when you are setting the prefix, then the open command won't work anyways. > > > > Check the /DEV/ in memory. I am not sure how Merlin stores ascii text, but it may have saved it backwards like this /VED/ when using the ASC '/DEV/'. > > > > Most assemblers require double quotes to make forward text in memory like so. > > ASC "/DEV/". > > > > Rob
[toc] | [prev] | [next] | [standalone]
| From | David Schmidt <schmidtd@my-deja.com> |
|---|---|
| Date | 2013-08-28 10:18 -0400 |
| Message-ID | <kvl0qq$ipo$1@dont-email.me> |
| In reply to | #824 |
On 8/28/2013 8:48 AM, jcullenhome@comcast.net wrote:
> This MLI stuff is pretty straightforward, not complicated really. What's going on?? :O
> Can anybody find anything off with my code / calls above?
I converted it to ca65 syntax and did similar cleanup as Rob. Running
from BASIC or the program selector, and using MAIN as the test program
to open, I get zeroes on the MLI calls. The main things to check in
your code are:
1) you don't set the file name length via X after figuring it out, as
pointed out by Rob
2) you need to ensure that you actually *have* a /DEV/ prefix on the
disk you're using in the first place.
My ca65 code, for reference:
.include "applechr.i" ; Some Merlin-esque macros
.ORG $2000 ; Unnecessary, but pretties up the listing
HOME = $FC58
COUT = $FDED
KEY = $C000
STROBE = $C010
IOBUFF = $900
MAIN: JSR HOME
JSR GETFILE
HERE: JMP HERE ; Just loop since I'm too lazy for QUIT MLI
RTS ; Would crash if called from selector
;--------------------------------
;--- routines ------
;--- getFile prompts for and loads the image file
GETFILE: LDX #0
MSGLOOP: LDA FILEMSG,X
CPX #25
BEQ DONE
JSR COUT
INX
BNE MSGLOOP
DONE: LDX #0
GETKEY: LDA KEY
BPL GETKEY
STA STROBE
CMP #$8D
BEQ SETPFX
JSR COUT
AND #$7F ; Strip the high bit
STA FILENAME,X
INX
BNE GETKEY
SETPFX: JSR COUT ; Use final return to split the line
STX FILENAMC
JSR $BF00
.BYTE $C6
.ADDR SETP
CLC
JSR COUT ;error code
JSR $BF00 ;call MLI
.BYTE $C8 ;open command
.ADDR OPENPARM
CLC
JSR COUT ;testing error code
RTS
;data area------
SETP: .BYTE $01
.ADDR PREFIXC
OPENPARM: .BYTE $03
.ADDR FILENAMC
.ADDR IOBUFF
REFNUM: .BYTE $00
FILEMSG: asc "Please enter a filename: "
FILENAMC: .BYTE $00
FILENAME: .res 15,$00 ; Space for 15 characters
PREFIXC: .BYTE $05
PREFIX: asc "/DEV/" ; Make sure this actually exists...
[toc] | [prev] | [next] | [standalone]
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-28 08:42 -0700 |
| Message-ID | <ff8ebce6-0f08-4be7-8089-2e5510f77994@googlegroups.com> |
| In reply to | #825 |
Thanks! Last night I did incorporate Rob's suggestions.. saving the X as length etc. When I get home, I'll incorporate yours as well. I've used both Sweet16 as well as JACE to see if there's a difference. I'm using a hardrive image who's volume name is indeed '/DEV/' one thing I've noticed is that when I intentionally type in a wrong file, or type in the whole: '/Dev/<filename>', I get a file not found code returned, and a pathname syntax when using the existing file. On Wednesday, August 28, 2013 10:18:00 AM UTC-4, schmidtd wrote: > On 8/28/2013 8:48 AM, > > > This MLI stuff is pretty straightforward, not complicated really. What's going on?? :O > > > Can anybody find anything off with my code / calls above? > > > > I converted it to ca65 syntax and did similar cleanup as Rob. Running > > from BASIC or the program selector, and using MAIN as the test program > > to open, I get zeroes on the MLI calls. The main things to check in > > your code are: > > 1) you don't set the file name length via X after figuring it out, as > > pointed out by Rob > > 2) you need to ensure that you actually *have* a /DEV/ prefix on the > > disk you're using in the first place. > > > > My ca65 code, for reference: > > > > .include "applechr.i" ; Some Merlin-esque macros > > .ORG $2000 ; Unnecessary, but pretties up the listing > > > > HOME = $FC58 > > COUT = $FDED > > KEY = $C000 > > STROBE = $C010 > > IOBUFF = $900 > > > > MAIN: JSR HOME > > JSR GETFILE > > > > HERE: JMP HERE ; Just loop since I'm too lazy for QUIT MLI > > RTS ; Would crash if called from selector > > > > ;-------------------------------- > > ;--- routines ------ > > > > ;--- getFile prompts for and loads the image file > > > > GETFILE: LDX #0 > > MSGLOOP: LDA FILEMSG,X > > CPX #25 > > BEQ DONE > > JSR COUT > > INX > > BNE MSGLOOP > > > > DONE: LDX #0 > > GETKEY: LDA KEY > > BPL GETKEY > > STA STROBE > > CMP #$8D > > BEQ SETPFX > > JSR COUT > > AND #$7F ; Strip the high bit > > STA FILENAME,X > > INX > > BNE GETKEY > > > > SETPFX: JSR COUT ; Use final return to split the line > > STX FILENAMC > > JSR $BF00 > > .BYTE $C6 > > .ADDR SETP > > CLC > > > > JSR COUT ;error code > > > > JSR $BF00 ;call MLI > > .BYTE $C8 ;open command > > .ADDR OPENPARM > > CLC > > > > JSR COUT ;testing error code > > > > RTS > > > > ;data area------ > > SETP: .BYTE $01 > > .ADDR PREFIXC > > > > > > OPENPARM: .BYTE $03 > > .ADDR FILENAMC > > .ADDR IOBUFF > > REFNUM: .BYTE $00 > > > > > > FILEMSG: asc "Please enter a filename: " > > > > FILENAMC: .BYTE $00 > > FILENAME: .res 15,$00 ; Space for 15 characters > > > > PREFIXC: .BYTE $05 > > PREFIX: asc "/DEV/" ; Make sure this actually exists...
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2013-08-28 11:33 -0700 |
| Message-ID | <fa4d30ec-d7f5-4158-8fbf-98f736631d3e@googlegroups.com> |
| In reply to | #814 |
Knowing that you have the boot prefix at $280: $280:08 2F 53 59 53 54 45 4D 45 (/SYSTEME) At $0300:20 00 BF C6 30 03 85 FE 20 00 BF C8 40 03 85 FF 60 $330:01 80 02 $340:03 80 02 00 09 00 300G returns no errors at $FE..$FF That means that your prefix is not OK. It: - should have chars with bit 7=0 - must start with a / - can end with a / with SET_PREFIX - must not end with a / WITH OPEN You set a prefix, you open a file, those are two different things! Good luck, av
[toc] | [prev] | [next] | [standalone]
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-28 15:27 -0700 |
| Message-ID | <b0dd22f3-94d4-4116-b810-cb45df9fb4e6@googlegroups.com> |
| In reply to | #828 |
Antoine, Thank you! Your simple example worked! When I first boot into my system.. and I'm in Basic, $0280 contains "../pv.." it's messed up.. so in the monitor, I manually entered '/dev' into that location. then I manually set the open param pathname to point to the file I want to open. Both FE and FF were $00! Now, I tried $280 with $04 > '/dev' and with $05 '/dev/'.. both $00. Other than that, they fail.. so I might just be getting my lengths messed up. Now that I've done it by hand, seen the results and what the data looks like, I'll try it again from Merlin after dinner! Thanks again!! On Wednesday, August 28, 2013 2:33:30 PM UTC-4, Antoine Vignau wrote: > Knowing that you have the boot prefix at $280: > > $280:08 2F 53 59 53 54 45 4D 45 (/SYSTEME) > > > > At $0300:20 00 BF C6 30 03 85 FE 20 00 BF C8 40 03 85 FF 60 > > $330:01 80 02 > > $340:03 80 02 00 09 00 > > > > 300G returns no errors at $FE..$FF > > > > That means that your prefix is not OK. It: > > - should have chars with bit 7=0 > > - must start with a / > > - can end with a / with SET_PREFIX > > - must not end with a / WITH OPEN > > > > You set a prefix, you open a file, those are two different things! > > > > Good luck, > > av
[toc] | [prev] | [next] | [standalone]
| From | jcullenhome@comcast.net |
|---|---|
| Date | 2013-08-28 19:45 -0700 |
| Message-ID | <d06b5200-8548-452d-ae4d-d15b771a5b04@googlegroups.com> |
| In reply to | #829 |
Ok, folks.. this thread is an example of what happens when you haven't touched Assembly in years and think you remember more than you really do! Turns out that my code was correct...mostly. Thanks again to Antoine for his direct to the monitor example which helped me really put an eye on things. Turns out.. for some reason.. after calling an MLI I would $FDED the result, it would display '@' which is $40, but when I instead STA the result to an address it was $00. I don't know why.. with my code and Antoine's code in the monitor, I went back and forth wondering why mine kept getting errors.. until I stored the result.. The next problem I had was my Read and Close Param lists... luckily I face palmed and got it right quick. In my lists for 'Ref_num' I thought it was a good idea to: DFB REFNUM <-my variable.. instead of LDA REFNUM, STA ReadParm+1.. etc. So now it successfully loads the pic file that I type in and turns on the Hi-Res screen! Thanks again to all of you for helping me clean my code! Now onto the next phase of getting myself into more trouble! ;) On Wednesday, August 28, 2013 6:27:44 PM UTC-4, jcull...@comcast.net wrote: > Antoine, Thank you! > > > > Your simple example worked! > > When I first boot into my system.. and I'm in Basic, $0280 contains "../pv.." > > it's messed up.. so in the monitor, I manually entered '/dev' into that location. > > then I manually set the open param pathname to point to the file I want to open. > > Both FE and FF were $00! > > > > Now, I tried $280 with $04 > '/dev' and with $05 '/dev/'.. both $00. > > Other than that, they fail.. so I might just be getting my lengths messed up. > > Now that I've done it by hand, seen the results and what the data looks like, I'll try it again from Merlin after dinner! > > > > Thanks again!! > > > > > > On Wednesday, August 28, 2013 2:33:30 PM UTC-4, Antoine Vignau wrote: > > > Knowing that you have the boot prefix at $280: > > > > > > $280:08 2F 53 59 53 54 45 4D 45 (/SYSTEME) > > > > > > > > > > > > At $0300:20 00 BF C6 30 03 85 FE 20 00 BF C8 40 03 85 FF 60 > > > > > > $330:01 80 02 > > > > > > $340:03 80 02 00 09 00 > > > > > > > > > > > > 300G returns no errors at $FE..$FF > > > > > > > > > > > > That means that your prefix is not OK. It: > > > > > > - should have chars with bit 7=0 > > > > > > - must start with a / > > > > > > - can end with a / with SET_PREFIX > > > > > > - must not end with a / WITH OPEN > > > > > > > > > > > > You set a prefix, you open a file, those are two different things! > > > > > > > > > > > > Good luck, > > > > > > av
[toc] | [prev] | [next] | [standalone]
| From | "Bill Buckels" <bbuckels@mts.net> |
|---|---|
| Date | 2013-08-29 07:33 -0500 |
| Message-ID | <kvnf2a$5i6$1@speranza.aioe.org> |
| In reply to | #830 |
<jcullenhome@comcast.net> wrote: > Thanks again to all of you for helping me clean my code! Now onto the next > phase of getting myself into more trouble! ;) Thanks for the thread everyone. It was very enjoyable and informative. I refrained from posting how Aztec C does this because I want to deveop a more assembly language approach in my own Apple II coding. Small examples like this are excellent reading. I followed along in C. I wish more threads like this would happen here. Bill
[toc] | [prev] | [next] | [standalone]
| From | Antoine Vignau <antoine.vignau@laposte.net> |
|---|---|
| Date | 2013-08-29 10:02 -0700 |
| Message-ID | <100b297c-d44d-411c-9dab-5a708754caf6@googlegroups.com> |
| In reply to | #830 |
Good news, welcome back to the "real" world of assembly programmers. God knows how that has been difficult for me to launch Merlin again a few years back :-) Go to the next step... G (what can I write here) Antoine
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web