Z81 I/O

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
questarian
Posts: 57
Joined: Sun Jun 17, 2012 9:40 pm

Z81 I/O

Post by questarian »

Does any know of, or can point me in the direction of to, I/O routines that I can call from BASIC to read data/files from tape and, in particular, from a ZXpander?

Thanks!
-J. E. Bielak-
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Z81 I/O

Post by sirmorris »

Hi,

I can't help with tape but I know a little bit about zxpand :lol: What language are you going to be using? BASIC is almost out of the question as it has no native input/output calls. You will need to program in C, machine code or call machine code routines from a BASIC program.

If you let me know a little more about what you want to do I will be happy to help as best I can :D

Regards

Charlie
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Z81 I/O

Post by 1024MAK »

ZX BASIC has no I/O data file system to SAVE or LOAD from tape (or indeed to anything else).

However, if you can write assembly language (machine code), or can politely ask someone else who can, there is no reason why you could not develop your own. The code could be based on the routines in the ROM that save and load whole programs.

Or instead if you are using ZX BASIC, store your data in variables. Don't enter them as part of the program, use INPUT (or INKEY$). From then on, only use GO TO, do not use RUN.
SAVE the program and all the variables are saved as well as the program. So when you load the program, the Zeddy will LOAD both the program and all the variables. Just remember, do not use RUN as this clears the variables...

If the data (variables) changes or more data is added, SAVE the program again.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: Z81 I/O

Post by sirmorris »

Re-reading the original post it's occurred to me that data can be loaded to memory using the LOAD/SAVE extensions on zxpand.

SAVE "FILE;xxx;yy"

[where xxx is the memory address of the start of data and yy is the length in bytes] will save the data to FILE.

LOAD "FILE;xxx"

[where xxx is the address in memory where you'd like your data stored] will retrieve the data file.

HTH,

Charlie
User avatar
questarian
Posts: 57
Joined: Sun Jun 17, 2012 9:40 pm

Re: Z81 I/O

Post by questarian »

sirmorris wrote:I can't help with tape but I know a little bit about zxpand :lol: What language are you going to be using? BASIC is almost out of the question as it has no native input/output calls. You will need to program in C, machine code or call machine code routines from a BASIC program.
Lol. Yes, I can see where you could know a few things. :lol:

BASIC to start. I've been working mostly with VBA for the last 15 years, so the only thing rustier then my assembly is my C... but it give me an excuse to pick it all up again. :D I've found z88dk, which looks promising and, as I haven't done any assembly on a Z80 (mostly 6502, 6809, and smattering of 8086 in college) I've been digging up references and code examples.
sirmorris wrote:If you let me know a little more about what you want to do I will be happy to help as best I can :D
Minimally, being able to create an open files for sequential reading & writing. My wish list: Some directory routines would be great, but as I've had to make file system routines for other retro machines, It be nice to be able to read/write sectors directly off the SD.

I'm thinking of coding a file browser & launcher, and then perhaps resurrecting some old 80's multi-platform projects we never finished.
sirmorris wrote:Re-reading the original post it's occurred to me that data can be loaded to memory using the LOAD/SAVE extensions on zxpand.
Thanks. Yes, I saw that.
1024MAK wrote:... The code could be based on the routines in the ROM that save and load whole programs.
I found a Document with the Z81 ROM dissembled and, once I get a better handle on Z80 opcodes, I'll try that.

-John-
Post Reply