but i have some questions about:
1- i'm struggling to use functions that uses more than one argument, because they use ix and iy registers - when i try to use them the display gets totally blank (the functions i'm using are 'fastcall', that accesses simpler registers instead of ix and iy, but it is limited to one argument only) - why that happens? and how can i use ix and iy registers efficiently then?
2- where do i set sp (stack point) register?
3- which i/o ports are used for keyboard (is that exactly like ZX-Spectrum?), ay sound (like from quicksilva), and stuff like that?
thanks in advance!
- (5.28 KiB) Downloaded 167 times
You may use these registers in FAST mode only and have to store old content and restore when your program finish.
But this way you have no display as it is used by the display routines.
I don't understand your question about SP - this is normally set automatically and no need to change.
If you do so you need more information about the compiler, memory areas and so.
If you are programming in C language it may be a better choice to use the z88dk Compiler which offers ZX81 drivers and allow the use of at least the IY register through an own display routine.
my doubt about stack point and ram sizes available were mostly because sz81 emulator, since there you can choose between 1kb, 2kb, 3kb, 4kb, 16kb, 32kb, 48b and 56kb (i didn’t test everything yet), and i imagine that the stack point address depends of the ram amount available, and the zx81 rom routines are unable to detect all of these possibilities
and thanks about the info related to ax and ay registers
If you are more familiar with assembly then you may use other tools as well. Don't know Boriel's language used.
In general if a program is called via the BASIC "usr" interface (RAND USR ...) you may use following registers:
HL' (has to be restored before returning to BASIC)
IY (may be used in FAST mode with display turned off but should be restored when returning)
IX (may be used in FAST mode with display turned off but should be restored when returning)
AF' (may be used in FAST mode with display turned off but should be restored when returning)
I (may be used in SLOW mode but disturbs the picture until restored)
R (unlikely to use for general applications)
16k memory (depending on ram extension)
If you need a temporary additional register using the stack with PUSH and followed by EX SP,(HL) is quite useful as well. This instruction swaps HL and top of stack and a second instruction changes back.
Good luck !
and btw, talking about ay sound, i tried this (quicksilva ports, i guess):
Code: Select all
out $7FFF,7 out $7FFE,$38 out $7FFF,0 out $7FFE,$FE out $7FFF,8 out $7FFE,$0F
I find that this is the only emulator usable(for the ZX81)for tracker/compiler programs and it uses the correct Zonx frequency for the ZX81 as opposed to the spectrum Zonx frequency some emulators adopt and its output is near as dammit the real thing, so once you find the correct ports all should be well.
Hope this is of use.
1. You don't change its value
2. The area of memory you need to index over is restricted to something in the region $4000-$40FF. And only ~30 bytes in size, e.g. the printer buffer
Well - this is not exactly true. The one byte displacement is a signed value which allows an offset only from -128 till +127. So you could address only $4000-$407F while in the area below $4000 mostly no memory is present. But the printer buffer is accessible as all other system variables. Program area starts at $407D.sirmorris wrote:2. The area of memory you need to index over is restricted to something in the region $4000-$40FF. And only ~30 bytes in size, e.g. the printer buffer
Two Index Registers (IX and IY)
The two independent index registers hold a 16-bit base address that is used
in indexed addressing modes. In this mode, an index register is used as a
base to point to a region in memory from which data is to be stored or
retrieved. An additional byte is included in indexed instructions to specify a
displacement from this base. This displacement is specified as a two's
complement signed integer. This mode of addressing greatly simplifies
many types of programs, especially where tables of data are used.
Well you learn something new every day!Well - this is not exactly true. The one byte displacement is a signed value which allows an offset only from -128 till +127.