Help needed to start writing ZX81 games...
Re: Help needed to start writing ZX81 games...
Do you know the C-compiler Z88DK? So you could write games also in C.
It supports also the ZX81 (e. g. true HIRES (Wilf Rigter) and moving sprites) and a demo game shows how.
See
http://www.z88dk.org/wiki/doku.php/
and
http://www.z88dk.org/forum/forums.php
Siggi
It supports also the ZX81 (e. g. true HIRES (Wilf Rigter) and moving sprites) and a demo game shows how.
See
http://www.z88dk.org/wiki/doku.php/
and
http://www.z88dk.org/forum/forums.php
Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
http://zx81.ddns.net/ZxTeaM
Re: Help needed to start writing ZX81 games...
Can't download EO !!!
The file must be trunkated...
The file must be trunkated...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Re: Help needed to start writing ZX81 games...
viewtopic.php?f=4&t=67&p=461
This might be useful. It shows a cheeky technique for liberating the IY register for use in slow mode.
Let me know if I can be of any further help.
-Charlie
This might be useful. It shows a cheeky technique for liberating the IY register for use in slow mode.
Let me know if I can be of any further help.
-Charlie
Re: Help needed to start writing ZX81 games...
Sir Morris
do us a favour put the soldering iron and vero board away and get coding again!!!
I thought Andre had some off-the-wall games ideas, this ones a little cracker (sprites on a zeddy yeees!!!)
You've done in m/l what he does in basic 10 out of 10.
Regards Moggy
do us a favour put the soldering iron and vero board away and get coding again!!!
I thought Andre had some off-the-wall games ideas, this ones a little cracker (sprites on a zeddy yeees!!!)
You've done in m/l what he does in basic 10 out of 10.
Regards Moggy
- BrunoFlorindo
- Posts: 290
- Joined: Sat May 10, 2008 2:46 am
- Location: Anaheim, CA, USA
Re: Help needed to start writing ZX81 games...
Nice to see Bob here! Maybe some of the current Speccy titles can have a ZX81 port? Ever since Mike Wynne was able to come up with a Speccy emulator for the Zeddy, I started to believe anything is possible!
And at some point, if possible, the new games could have optional AY sound. Not everyone has AY interfaces, but emulators would allow us to enjoy it.
And at some point, if possible, the new games could have optional AY sound. Not everyone has AY interfaces, but emulators would allow us to enjoy it.
Re: Help needed to start writing ZX81 games...
Just getting something on-screen in assembler will be nice to begin with! Once I've got into my stride though anything could happen.BrunoFlorindo wrote:Nice to see Bob here! Maybe some of the current Speccy titles can have a ZX81 port?
Re: Help needed to start writing ZX81 games...
Hi Bob,
I've just started playing with assembly language on an (emulated) ZX81. On a machine with an expanded display file (that is, on a machine with > 3KB RAM), the main thing to know is that there *must* be 25 Newline characters otherwise the machine will crash (or at least the display will become completely messed up).
The beginning of the display file is pointed to by the 16-bit value held at 16396 and 16397.
The first character must be a ZX81 newline character (decimal 118), this is followed by 32 display characters and then the line is terminated with another newline character. Each of the following lines is terminated by a newline character. Do not overwrite these characters by mistake!
I wrote the following routine for writing to the screen. You call MAKE_TABLE once at the beginning of your program, and then call PRINT_CHAR with a line, column and character value each time you want to put a character on screen. It uses a lookup table to hold the location of the first character of each line, and then adds the column position to get to the screen location.
I assemble this into a BIN file using the Pasmo assembler, then use a utility called BIN2P to transform that into a .P file with a BASIC loader ready to use in an emulator. (These tools are available for Linux, others will probably be able to advise what's best under Windows).
I'm very much a beginner at assembly language, so forgive anything that isn't clear or is suboptimal. The code is here, everyone please feel free to use it as you like:
Cheers,
Colin.
I've just started playing with assembly language on an (emulated) ZX81. On a machine with an expanded display file (that is, on a machine with > 3KB RAM), the main thing to know is that there *must* be 25 Newline characters otherwise the machine will crash (or at least the display will become completely messed up).
The beginning of the display file is pointed to by the 16-bit value held at 16396 and 16397.
The first character must be a ZX81 newline character (decimal 118), this is followed by 32 display characters and then the line is terminated with another newline character. Each of the following lines is terminated by a newline character. Do not overwrite these characters by mistake!
I wrote the following routine for writing to the screen. You call MAKE_TABLE once at the beginning of your program, and then call PRINT_CHAR with a line, column and character value each time you want to put a character on screen. It uses a lookup table to hold the location of the first character of each line, and then adds the column position to get to the screen location.
I assemble this into a BIN file using the Pasmo assembler, then use a utility called BIN2P to transform that into a .P file with a BASIC loader ready to use in an emulator. (These tools are available for Linux, others will probably be able to advise what's best under Windows).
I'm very much a beginner at assembly language, so forgive anything that isn't clear or is suboptimal. The code is here, everyone please feel free to use it as you like:
Code: Select all
; Print Character Routine
;
; Prints a character at a
; specified print position.
;
;
; Entry point to print the character
;
; Registers:
; A -> Line
; B -> Column
; C -> Character to Print
PRINT_CHAR LD D, 00 ; Zero high byte of line counter
ADD A, A ; Multiply line offset by two (2 bytes per line address)
LD E, A
LD HL, ADDRESS_TABLE ; Point to beginning of screen address table
ADD HL, DE ; Move pointer to address of beginning of screen line
LD E, (HL) ; Store low byte of screen address
INC HL
LD D, (HL) ; Store high byte of screen address
EX DE, HL ; Place screen address into HL
LD D, 0 ; Put column position
LD E, B ; into DE.
ADD HL, DE ; Point HL to character position on line
LD (HL), C ; Put character into display file
RET
;
; This routine only needs to be called once to create the screen line address table
;
MAKE_TABLE LD HL, ADDRESS_TABLE ; Address table pointer
LD DE, (16396) ; D_FILE
INC DE ; Step over first control character
LD B, 24 ; Count 24 lines
TABLE_LOOP LD (HL), E ; Store address of
INC HL ; first character
LD (HL), D ; of each screen line.
INC HL
PUSH BC
LD BC, 33 ; Add 33 characters
EX DE, HL ; to screen address pointer
ADD HL, BC ; (32 visible characters
EX DE, HL ; plus newline)
POP BC
DJNZ TABLE_LOOP ; Loop to process next line
RET
ADDRESS_TABLE DS 48 ; Reserve space for the 24 line addresses
Colin.
Re: Help needed to start writing ZX81 games...
Having read Colins message, I thought I would add how I handle screen address calculation. It might be a byte or two longer but doesn't need the table and takes the same amount of time regardless of coordinates. As I don't use basic once my M/c starts, the start of the display never moves so don't need to use (D_FILE).
I use the CALC0 entry point when b and c are set for another object, e.g. the enemy.
Enjoy
Code: Select all
CALC ld b, (xcoord) ; normally for player
ld c, (ycord) ; normally for player
CALC0 ld h,0
ld l,b
push hl
add hl,hl ; x2
add hl,hl ; x4
add hl,hl ; x8
add hl,hl ; x16
add hl,hl ; x32
pop de
add hl,de ; x33
ld e,c
add hl,de
ld de, <address of display + 1>
add hl,de
ld a,(hl) ; optional
ret
Enjoy