Login
Forum Help



Post Your Message
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

SVS
on 2019-04-02
08:42:23
 Re: Puzzling about OPEN

Hi again,
I've investigated about the difference between B-R and U1.
The B-R (and mirrored the B-W) takes the first byte of the sector as number of valid bytes to be read. Then if a sector contains, for example, "03 41 51 6A F8 ..." it will transfer only 41 51 6A (3 bytes). This way can be useful for some customized data structures, anyway each sector allowing 1 less byte of data. The U1 on the contrary transfers the whole sector of data starting from the first byte.

About the matter of the ":". It is a flag for the DOS to indicate the end of the command. You can send the command as long as you want, it acknowledges only the first character (for ex. N can be NEW, NE, N, but even NEWAGE happy ). When found the ":" it understands that the command name is finished and the following data (if any) are the parameters.

Posted By

Charlemagne
on 2019-04-02
07:57:21
 Re: Puzzling about OPEN

Yes, you are right SVS, it's hard two streams to flow in the same course... happy



I have just read about "U1 or UA" and "U2 or UB"... ...well the difference between "U1 or UA" and "B-R" is that "U1 or UA" takes no notice of the buffer-pointer (the first byte of a block).

But I don't understand why does "M-Rxy" (where x=low byte of address, y=high byte of address) work in ROMSave... ...because the syntax is: "M-R:" (with colon), but you may be right again and the syntax is different in assembly a little bit.

Posted By

SVS
on 2019-04-02
03:03:10
 Re: Puzzling about OPEN

So you cannot use two different files on the same data channel(?)

For example:
10 OPEN 1,8,2,"HELLO,SEQ,WRITE": OPEN 2,8,2,"WORLD,SEQ,WRITE"

I suppose you obtain an error by using the same channelnumber because it is already in use.


DOS syntax is different? I don't think so, because...

I was referring to the fact that you always have to set the unit number (standard is 0), for example "N0:diskname" instead of "N:diskname"

20 PRINT#15,"B-R:";2,0,18,0: REM Reading BAM

It is recommended to use "U1" or "UA" instead of "B-R", I don't remember exactly the reason, maybe for a pointer matter.

Greetz

Posted By

Charlemagne
on 2019-04-02
02:52:44
 Re: Puzzling about OPEN

Thank you SVS,

eg.:
10 OPEN 1,8,2,"HELLO,SEQ,WRITE":REM OPEN 1,8,2,"HELLO,S,W"
20 PRINT#1,"WORLD";CHR$(13);
30 CLOSE 1

Channel (if unit=8..11):
- 0: save
- 1: load
- 2..14: data
- 15: command

What is the difference between:
1.: 10 OPEN 1,8,2,"HELLO,SEQ,WRITE"
and
2.: 10 OPEN 1,8,3,"HELLO,SEQ,WRITE"
?

So you cannot use two different files on the same data channel(?)
For example:
10 OPEN 1,8,2,"HELLO,SEQ,WRITE": OPEN 2,8,2,"WORLD,SEQ,WRITE"

I haven't read about "Append", yet.

DOS syntax is different? I don't think so, because...
http://codebase64.org/doku.php?id=base:writing_a_file_byte-by-byte

But, in that case when you use random files (not sequential), the syntax is really different, in BASIC, too:
10 OPEN 15,8,15: OPEN 1,8,2,"#": REM Open Pseudo-file
20 PRINT#15,"B-R:";2,0,18,0: REM Reading BAM
30 FOR I=0 TO 255
40 GET#1,X$: PRINT X$;
50 NEXT I
60 CLOSE 1: CLOSE 15

http://codebase64.org/doku.php?id=base:reading_a_sector_from_disk

By the way ROMSave saves files with SAVE ($FFD8 -> $F194), so siz doesn't save ROMs with writing files. He only sends some commands to the command channel, such like "M-R" and "M-W".

Posted By

SVS
on 2019-04-01
11:29:36
 Re: Puzzling about OPEN

Some more info if can help:

CHANNELNUMBER: is used to tell the device how to manage the data transfer. 0: means load binary data from device to memory; 1: save binary data from memory to device; 15: send a commands to device.
These values are involved into buffer management too, especially when you have more opened files.

MODE: don't forget the convenient "A" mode that allows to append data to an existing SEQ/USR file without to read all the current data and then re-save all them.

SYNTAX: If you code a program in assembly, remember that you must use the DOS syntax that is different than the BASIC syntax. In short words you have to send to the unit a single string like:
"xy:zzzzzzz" where x is the command (1 letter), y is the unit (0 or 1), zzzzz is the filename. For example:
BASIC: SCRATCH "myfile"
DOS: "S0:myfile"

Le me know happy

Posted By

Charlemagne
on 2019-03-31
03:01:20
 Re: Puzzling about OPEN

Thank you siz, it seems to be good.

What do you think about ROMSave by siz? happy

Posted By

siz
on 2019-03-31
15:35:49
 Re: Puzzling about OPEN

Try to lookup KERNAL reference and generic Commodore assembly programming tutorials. For example http://codebase64.org/doku.php?id=base:io_programming (It's the same for the plus/4)

Posted By

Charlemagne
on 2019-03-31
14:12:57
 Puzzling about OPEN

Hello,

After reading about OPEN, I am mixed up with it:

1.: OPEN as general: "OPEN filenumber, unitnumber, channelnumber, stringexpression"
- filenumber: 1..255
- unitnumber: 0..15 (0: keyboard, 1: casette, 2: modem, 4/5: printer, 8-11: disk)
- channelnumber: 0..15 (eg.: unit=1 (casette): 0=input, 1=output, 2=output+EOT)
- stringexpression: filename

2.: OPEN as a file open: "OPEN filenumber, unitnumber, channelnumber, stringexpression"
- filenumber, unitnumber is just like as above
- channelnumber: (if unit=8) 2..14 (WHAT IS THIS???)
- stringexpression: "name,type,mode"
- - name: filename
- - type: PRG/SEQ/USR/REL = P/S/U/R
- - mode: READ/WRITE = R/W

What does the data-channel mean exactly? I know the 15 means the command-channel.

The another question about OPEN is that: "How do you handle files in assembly?"

$B8 = file-number
$B9 = open-mode
$BA = unit number
$BB = start of the command string
$B7 = the length of the command

So how do you create a new file on the disk and how do you write bytes into it in assembly?

Thanks!


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon