#zxspectrum — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #zxspectrum, aggregated by home.social.
-
Paloma Patrol (2026) by ZXBasicGames for ZX Spectrum.
You're Madrid's mayor. Pigeons are locked and loaded. Intercept every dropping with your head (your position is random, naturally) to keep Plaza Mayor spotless. A 128K BASIC tribute to a press conference gone gloriously wrong.🕊
-
RustHeir Chess Puzzle Melts the Board Under You
#RustHeir #Commodore64 #C64 #ZXSpectrum #RetroGaming #ChessPuzzle #8Bit #IndieGame #SIDChip #RetroComputing
https://theoasisbbs.com/rustheir-chess-puzzle-melts-the-board-under-you/?fsp_sid=13761 -
RustHeir Chess Puzzle Melts the Board Under You
#RustHeir #Commodore64 #C64 #ZXSpectrum #RetroGaming #ChessPuzzle #8Bit #IndieGame #SIDChip #RetroComputing
https://theoasisbbs.com/rustheir-chess-puzzle-melts-the-board-under-you/?fsp_sid=13761 -
RustHeir Chess Puzzle Melts the Board Under You
#RustHeir #Commodore64 #C64 #ZXSpectrum #RetroGaming #ChessPuzzle #8Bit #IndieGame #SIDChip #RetroComputing
https://theoasisbbs.com/rustheir-chess-puzzle-melts-the-board-under-you/?fsp_sid=13761 -
RustHeir Chess Puzzle Melts the Board Under You
#RustHeir #Commodore64 #C64 #ZXSpectrum #RetroGaming #ChessPuzzle #8Bit #IndieGame #SIDChip #RetroComputing
https://theoasisbbs.com/rustheir-chess-puzzle-melts-the-board-under-you/?fsp_sid=13761 -
RustHeir Chess Puzzle Melts the Board Under You
#RustHeir #Commodore64 #C64 #ZXSpectrum #RetroGaming #ChessPuzzle #8Bit #IndieGame #SIDChip #RetroComputing
https://theoasisbbs.com/rustheir-chess-puzzle-melts-the-board-under-you/?fsp_sid=13761 -
The Sinclair Spectrum Gets A Desktop GUI
https://fed.brid.gy/r/https://hackaday.com/2026/09/21/the-sinclair-spectrum-gets-a-desktop-gui/
-
The Sinclair Spectrum Gets A Desktop GUI
https://fed.brid.gy/r/https://hackaday.com/2026/09/21/the-sinclair-spectrum-gets-a-desktop-gui/
-
The Sinclair Spectrum Gets A Desktop GUI
https://fed.brid.gy/r/https://hackaday.com/2026/09/21/the-sinclair-spectrum-gets-a-desktop-gui/
-
GitHub - mindbox77/zxdesk: A GUI operating system for the 48K ZX Spectrum, in Z80 assembly · GitHub
https://github.com/mindbox77/zxdesk
A graphical desktop for the ZX Spectrum 48K, written in Z80 assembly. #software #zxspectrum #offrehacked -
GitHub - mindbox77/zxdesk: A GUI operating system for the 48K ZX Spectrum, in Z80 assembly · GitHub
https://github.com/mindbox77/zxdesk
A graphical desktop for the ZX Spectrum 48K, written in Z80 assembly. #software #zxspectrum #offrehacked -
GitHub - mindbox77/zxdesk: A GUI operating system for the 48K ZX Spectrum, in Z80 assembly · GitHub
https://github.com/mindbox77/zxdesk
A graphical desktop for the ZX Spectrum 48K, written in Z80 assembly. #software #zxspectrum #offrehacked -
GitHub - mindbox77/zxdesk: A GUI operating system for the 48K ZX Spectrum, in Z80 assembly · GitHub
https://github.com/mindbox77/zxdesk
A graphical desktop for the ZX Spectrum 48K, written in Z80 assembly. #software #zxspectrum #offrehacked -
GitHub - mindbox77/zxdesk: A GUI operating system for the 48K ZX Spectrum, in Z80 assembly · GitHub
https://github.com/mindbox77/zxdesk
A graphical desktop for the ZX Spectrum 48K, written in Z80 assembly. #software #zxspectrum #offrehacked -
RC2014/Z80 Minimal ROM
I want to ROM-ify the messing about I’ve been doing with the AY-3-8910 driver and video code, so I need to figure out what boot-strapping is required to get a basic Z80 machine up and running from power-on. Then I can programme it all into a ROM and just have it startup automatically.
Some key resources:
- Minimal RC2014 boot and initialisation: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/init/rc2014init.asm
- Z80 boot template: https://jacobielectronix.wordpress.com/2015/12/07/z80-cpu-boot-asm-template/
- ZX Spectrum ROM Dissassembly (book and online): https://skoolkid.github.io/rom/
To start, we can note the following from the Z80 User Manual:
“RESET. Reset (input, active Low).”
“RESET initializes the CPU as follows: it resets the interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the interrupt status to Mode 0. During reset time, the address and data bus enter a high-imped ance state, and all control output signals enter an inactive state. R must be active for a minimum of three full clock cycles before a reset operation is complete.”
So execution will be starting from address $0000 (a cleared Program Counter).
There are several special addresses that will require code – these are the RST locations associated with the RST instruction as described here: https://jnz.dk/z80/rst_p.html. RST is basically a 1-byte CALL equivalent, but it can only call one of eight locations: $00, $08, $10, $18, $20, $28, $30, $38.
A key location for me will be RST $38 which is the interrupt handler I’ll need to handle for the /INT 50Hz interrupt.
Other things that will have to be done on first power up include:
- Any required memory initialisation – e.g. if any of it has to be set to zero or copied from ROM to RAM or anything that needs presetting to a specific value.
- Any required hardware initialisation – e.g. for a R2014 this usually means getting the serial link up and running.
- Set the stack pointer to somewhere at the top of RAM.
- Initialise any hardware registers and then jump to the main application.
I don’t think I need to do anything special to the CPU registers or flags, but happy to be corrected! I haven’t found an obvious “this is what you do to start a Z80” type resource so far, so I’m just inferring from the references listed above right now.
AY Driver ROM
Most of the code and data for the AY driver and tune can be relocated to ROM, but there are several blocks of state variables that must be placed in RAM. Consequently, I’ve had to do the following:
- Create a RAM block at origin $8000 for the state variables.
- Remove the origin statements for Code_Start and Data_Start, but I’ve replaced them with assembler labels.
- Add in some code to pre-initialise the state variables all to zero on startup.
- As well as the AY driver state variables, there are a few additional state variables associated with the following:
- Positions related to the display harness
- Some values associated with the CLOCK, one of which (FIFTY) also needs initialising to 50 on power up.
- The AY driver’s internal “stack” (e.g. SP_A).
- And it also turns out that it has to be able to clear the keypress that my own harness pre-sets to “0” otherwise it constantly resets to play the first tune. So I need to move that to RAM too.
My initialisation code is as follows:
; RESET and Bootstrap
.org $00
jp AYSTART
; RST jump tables
.org $08
ret
.org $10
ret
.org $18
ret
.org $20
ret
.org $28
ret
.org $30
ret
.org $38 ; Maskable /INT
ei
reti ; Return from interrupt
.org $66 ; Non-maskable /NMI
retn ; Return from non-maskable interrupt
; Bootstrap code
.org $100
AYSTART:
; Initialise stack
ld sp, $FF00
; Set all AYVars in RAM to 0
xor a
VARINITLoop:
ld hl, AYVARSTART
ld bc,(AYVAREND-AYVARSTART)
ld (hl),a
inc hl
dec bc
jp nz,VARINITLoop
; Initialise any specific variable values
ld hl,FIFTY
ld a,50
ld (hl),a
; Preset the keypress for first tune
ld hl,LASTK
ld a,48 ; Preset keypress to "0" for the first tune
ld (hl),a
; Enable the 50Hz Interrupt
im 1
ei
; Run the driver
jp Code_StartThere are a couple of hard-coded references to address 50000 (decimal) which is Data_Start. These have had to be changed. The locations/definitions between the original CODE_BOT: and DATA_TOP: labels are now as follows:
CODE_BOT:
CALC1: EQU CODE_BOT-CODE_TOP
;--------------------------------------
; ORG Data_Start
Data_Start:
NTUNES: EQU 1
NEFFECTS: EQU 1
;--------------------------------------
CALC2: DW CALC
Tunes: DB NTUNES
Effects: DB NEFFECTS
;--------------------------------------
DATA_TOP:The original code has 5 tunes and 21 effects which can be selected by pressing a key. I’ve not ported any keyboard handling over as yet, so it only plays the one tune. I’ve cleared out the data for four of the tunes and all the effects bar one. I’ve left one effect in as I don’t know how the code handles having zero effects.
This has an advantage in that all fixed data and code now fits within 8K, which is the standard, common ROM block size for RC2014.
Programming
I can now take the standard ROM that came with my Classic II from here: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/Factory/R0000009.BIN, which has the following ROMs built in:
$0000-$1FFFRC2014 32K BASIC$2000-$3FFF
$4000-$5FFF
$6000-$7FFF
$A000-$BFFF
$C000-$DFFFUnused$E000-$EFFFSCM Z80 MonitorI can thus load this image into a programmer and then add in the HEX records for the AY driver at location $2000-3FFF remembering not to clear the loaded contents first. Then it will be selectable via the ROM jumpers
The above location are EEPROM locations. The jumpers control the state of A13, A14, A15 as seen by the EEPROM. From the RC2014 point of view any selected image will always appear at address $0000-$1FFF in the wider memory map no matter its position in the EPROM.
I’ve programmed it to W27C512s and used it with my RC2014 micro module, which takes 27C512 ROMS. My Classic II is described as also taking 27C512 ROMs, but the latest revision of the board actually uses half of a 128K ST39SF010.
Conclusion
It is great to be able to just turn on the RC2014 and have it come up playing the AY music. This means that for a complete player I now have:
- A RC2014 backplane (any will do).
- RC2014 micro system with custom ROM.
- My ZX Spectrum Compatible Video for RC2014 (V2 with the 50Hz interrupt).
- Either Ed Brindley’s AY-3-8910 for RC2014 or the WhyEm sound card.
Kevin
#ay38910 #rc2014 #zxSpectrum -
RC2014/Z80 Minimal ROM
I want to ROM-ify the messing about I’ve been doing with the AY-3-8910 driver and video code, so I need to figure out what boot-strapping is required to get a basic Z80 machine up and running from power-on. Then I can programme it all into a ROM and just have it startup automatically.
Some key resources:
- Minimal RC2014 boot and initialisation: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/init/rc2014init.asm
- Z80 boot template: https://jacobielectronix.wordpress.com/2015/12/07/z80-cpu-boot-asm-template/
- ZX Spectrum ROM Dissassembly (book and online): https://skoolkid.github.io/rom/
To start, we can note the following from the Z80 User Manual:
“RESET. Reset (input, active Low).”
“RESET initializes the CPU as follows: it resets the interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the interrupt status to Mode 0. During reset time, the address and data bus enter a high-imped ance state, and all control output signals enter an inactive state. R must be active for a minimum of three full clock cycles before a reset operation is complete.”
So execution will be starting from address $0000 (a cleared Program Counter).
There are several special addresses that will require code – these are the RST locations associated with the RST instruction as described here: https://jnz.dk/z80/rst_p.html. RST is basically a 1-byte CALL equivalent, but it can only call one of eight locations: $00, $08, $10, $18, $20, $28, $30, $38.
A key location for me will be RST $38 which is the interrupt handler I’ll need to handle for the /INT 50Hz interrupt.
Other things that will have to be done on first power up include:
- Any required memory initialisation – e.g. if any of it has to be set to zero or copied from ROM to RAM or anything that needs presetting to a specific value.
- Any required hardware initialisation – e.g. for a R2014 this usually means getting the serial link up and running.
- Set the stack pointer to somewhere at the top of RAM.
- Initialise any hardware registers and then jump to the main application.
I don’t think I need to do anything special to the CPU registers or flags, but happy to be corrected! I haven’t found an obvious “this is what you do to start a Z80” type resource so far, so I’m just inferring from the references listed above right now.
AY Driver ROM
Most of the code and data for the AY driver and tune can be relocated to ROM, but there are several blocks of state variables that must be placed in RAM. Consequently, I’ve had to do the following:
- Create a RAM block at origin $8000 for the state variables.
- Remove the origin statements for Code_Start and Data_Start, but I’ve replaced them with assembler labels.
- Add in some code to pre-initialise the state variables all to zero on startup.
- As well as the AY driver state variables, there are a few additional state variables associated with the following:
- Positions related to the display harness
- Some values associated with the CLOCK, one of which (FIFTY) also needs initialising to 50 on power up.
- The AY driver’s internal “stack” (e.g. SP_A).
- And it also turns out that it has to be able to clear the keypress that my own harness pre-sets to “0” otherwise it constantly resets to play the first tune. So I need to move that to RAM too.
My initialisation code is as follows:
; RESET and Bootstrap
.org $00
jp AYSTART
; RST jump tables
.org $08
ret
.org $10
ret
.org $18
ret
.org $20
ret
.org $28
ret
.org $30
ret
.org $38 ; Maskable /INT
ei
reti ; Return from interrupt
.org $66 ; Non-maskable /NMI
retn ; Return from non-maskable interrupt
; Bootstrap code
.org $100
AYSTART:
; Initialise stack
ld sp, $FF00
; Set all AYVars in RAM to 0
xor a
VARINITLoop:
ld hl, AYVARSTART
ld bc,(AYVAREND-AYVARSTART)
ld (hl),a
inc hl
dec bc
jp nz,VARINITLoop
; Initialise any specific variable values
ld hl,FIFTY
ld a,50
ld (hl),a
; Preset the keypress for first tune
ld hl,LASTK
ld a,48 ; Preset keypress to "0" for the first tune
ld (hl),a
; Enable the 50Hz Interrupt
im 1
ei
; Run the driver
jp Code_StartThere are a couple of hard-coded references to address 50000 (decimal) which is Data_Start. These have had to be changed. The locations/definitions between the original CODE_BOT: and DATA_TOP: labels are now as follows:
CODE_BOT:
CALC1: EQU CODE_BOT-CODE_TOP
;--------------------------------------
; ORG Data_Start
Data_Start:
NTUNES: EQU 1
NEFFECTS: EQU 1
;--------------------------------------
CALC2: DW CALC
Tunes: DB NTUNES
Effects: DB NEFFECTS
;--------------------------------------
DATA_TOP:The original code has 5 tunes and 21 effects which can be selected by pressing a key. I’ve not ported any keyboard handling over as yet, so it only plays the one tune. I’ve cleared out the data for four of the tunes and all the effects bar one. I’ve left one effect in as I don’t know how the code handles having zero effects.
This has an advantage in that all fixed data and code now fits within 8K, which is the standard, common ROM block size for RC2014.
Programming
I can now take the standard ROM that came with my Classic II from here: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/Factory/R0000009.BIN, which has the following ROMs built in:
$0000-$1FFFRC2014 32K BASIC$2000-$3FFF
$4000-$5FFF
$6000-$7FFF
$A000-$BFFF
$C000-$DFFFUnused$E000-$EFFFSCM Z80 MonitorI can thus load this image into a programmer and then add in the HEX records for the AY driver at location $2000-3FFF remembering not to clear the loaded contents first. Then it will be selectable via the ROM jumpers
The above location are EEPROM locations. The jumpers control the state of A13, A14, A15 as seen by the EEPROM. From the RC2014 point of view any selected image will always appear at address $0000-$1FFF in the wider memory map no matter its position in the EPROM.
I’ve programmed it to W27C512s and used it with my RC2014 micro module, which takes 27C512 ROMS. My Classic II is described as also taking 27C512 ROMs, but the latest revision of the board actually uses half of a 128K ST39SF010.
Conclusion
It is great to be able to just turn on the RC2014 and have it come up playing the AY music. This means that for a complete player I now have:
- A RC2014 backplane (any will do).
- RC2014 micro system with custom ROM.
- My ZX Spectrum Compatible Video for RC2014 (V2 with the 50Hz interrupt).
- Either Ed Brindley’s AY-3-8910 for RC2014 or the WhyEm sound card.
Kevin
#ay38910 #rc2014 #zxSpectrum -
RC2014/Z80 Minimal ROM
I want to ROM-ify the messing about I’ve been doing with the AY-3-8910 driver and video code, so I need to figure out what boot-strapping is required to get a basic Z80 machine up and running from power-on. Then I can programme it all into a ROM and just have it startup automatically.
Some key resources:
- Minimal RC2014 boot and initialisation: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/init/rc2014init.asm
- Z80 boot template: https://jacobielectronix.wordpress.com/2015/12/07/z80-cpu-boot-asm-template/
- ZX Spectrum ROM Dissassembly (book and online): https://skoolkid.github.io/rom/
To start, we can note the following from the Z80 User Manual:
“RESET. Reset (input, active Low).”
“RESET initializes the CPU as follows: it resets the interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the interrupt status to Mode 0. During reset time, the address and data bus enter a high-imped ance state, and all control output signals enter an inactive state. R must be active for a minimum of three full clock cycles before a reset operation is complete.”
So execution will be starting from address $0000 (a cleared Program Counter).
There are several special addresses that will require code – these are the RST locations associated with the RST instruction as described here: https://jnz.dk/z80/rst_p.html. RST is basically a 1-byte CALL equivalent, but it can only call one of eight locations: $00, $08, $10, $18, $20, $28, $30, $38.
A key location for me will be RST $38 which is the interrupt handler I’ll need to handle for the /INT 50Hz interrupt.
Other things that will have to be done on first power up include:
- Any required memory initialisation – e.g. if any of it has to be set to zero or copied from ROM to RAM or anything that needs presetting to a specific value.
- Any required hardware initialisation – e.g. for a R2014 this usually means getting the serial link up and running.
- Set the stack pointer to somewhere at the top of RAM.
- Initialise any hardware registers and then jump to the main application.
I don’t think I need to do anything special to the CPU registers or flags, but happy to be corrected! I haven’t found an obvious “this is what you do to start a Z80” type resource so far, so I’m just inferring from the references listed above right now.
AY Driver ROM
Most of the code and data for the AY driver and tune can be relocated to ROM, but there are several blocks of state variables that must be placed in RAM. Consequently, I’ve had to do the following:
- Create a RAM block at origin $8000 for the state variables.
- Remove the origin statements for Code_Start and Data_Start, but I’ve replaced them with assembler labels.
- Add in some code to pre-initialise the state variables all to zero on startup.
- As well as the AY driver state variables, there are a few additional state variables associated with the following:
- Positions related to the display harness
- Some values associated with the CLOCK, one of which (FIFTY) also needs initialising to 50 on power up.
- The AY driver’s internal “stack” (e.g. SP_A).
- And it also turns out that it has to be able to clear the keypress that my own harness pre-sets to “0” otherwise it constantly resets to play the first tune. So I need to move that to RAM too.
My initialisation code is as follows:
; RESET and Bootstrap
.org $00
jp AYSTART
; RST jump tables
.org $08
ret
.org $10
ret
.org $18
ret
.org $20
ret
.org $28
ret
.org $30
ret
.org $38 ; Maskable /INT
ei
reti ; Return from interrupt
.org $66 ; Non-maskable /NMI
retn ; Return from non-maskable interrupt
; Bootstrap code
.org $100
AYSTART:
; Initialise stack
ld sp, $FF00
; Set all AYVars in RAM to 0
xor a
VARINITLoop:
ld hl, AYVARSTART
ld bc,(AYVAREND-AYVARSTART)
ld (hl),a
inc hl
dec bc
jp nz,VARINITLoop
; Initialise any specific variable values
ld hl,FIFTY
ld a,50
ld (hl),a
; Preset the keypress for first tune
ld hl,LASTK
ld a,48 ; Preset keypress to "0" for the first tune
ld (hl),a
; Enable the 50Hz Interrupt
im 1
ei
; Run the driver
jp Code_StartThere are a couple of hard-coded references to address 50000 (decimal) which is Data_Start. These have had to be changed. The locations/definitions between the original CODE_BOT: and DATA_TOP: labels are now as follows:
CODE_BOT:
CALC1: EQU CODE_BOT-CODE_TOP
;--------------------------------------
; ORG Data_Start
Data_Start:
NTUNES: EQU 1
NEFFECTS: EQU 1
;--------------------------------------
CALC2: DW CALC
Tunes: DB NTUNES
Effects: DB NEFFECTS
;--------------------------------------
DATA_TOP:The original code has 5 tunes and 21 effects which can be selected by pressing a key. I’ve not ported any keyboard handling over as yet, so it only plays the one tune. I’ve cleared out the data for four of the tunes and all the effects bar one. I’ve left one effect in as I don’t know how the code handles having zero effects.
This has an advantage in that all fixed data and code now fits within 8K, which is the standard, common ROM block size for RC2014.
Programming
I can now take the standard ROM that came with my Classic II from here: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/Factory/R0000009.BIN, which has the following ROMs built in:
$0000-$1FFFRC2014 32K BASIC$2000-$3FFF
$4000-$5FFF
$6000-$7FFF
$A000-$BFFF
$C000-$DFFFUnused$E000-$EFFFSCM Z80 MonitorI can thus load this image into a programmer and then add in the HEX records for the AY driver at location $2000-3FFF remembering not to clear the loaded contents first. Then it will be selectable via the ROM jumpers
The above location are EEPROM locations. The jumpers control the state of A13, A14, A15 as seen by the EEPROM. From the RC2014 point of view any selected image will always appear at address $0000-$1FFF in the wider memory map no matter its position in the EPROM.
I’ve programmed it to W27C512s and used it with my RC2014 micro module, which takes 27C512 ROMS. My Classic II is described as also taking 27C512 ROMs, but the latest revision of the board actually uses half of a 128K ST39SF010.
Conclusion
It is great to be able to just turn on the RC2014 and have it come up playing the AY music. This means that for a complete player I now have:
- A RC2014 backplane (any will do).
- RC2014 micro system with custom ROM.
- My ZX Spectrum Compatible Video for RC2014 (V2 with the 50Hz interrupt).
- Either Ed Brindley’s AY-3-8910 for RC2014 or the WhyEm sound card.
Kevin
#ay38910 #rc2014 #zxSpectrum -
RC2014/Z80 Minimal ROM
I want to ROM-ify the messing about I’ve been doing with the AY-3-8910 driver and video code, so I need to figure out what boot-strapping is required to get a basic Z80 machine up and running from power-on. Then I can programme it all into a ROM and just have it startup automatically.
Some key resources:
- Minimal RC2014 boot and initialisation: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/init/rc2014init.asm
- Z80 boot template: https://jacobielectronix.wordpress.com/2015/12/07/z80-cpu-boot-asm-template/
- ZX Spectrum ROM Dissassembly (book and online): https://skoolkid.github.io/rom/
To start, we can note the following from the Z80 User Manual:
“RESET. Reset (input, active Low).”
“RESET initializes the CPU as follows: it resets the interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the interrupt status to Mode 0. During reset time, the address and data bus enter a high-imped ance state, and all control output signals enter an inactive state. R must be active for a minimum of three full clock cycles before a reset operation is complete.”
So execution will be starting from address $0000 (a cleared Program Counter).
There are several special addresses that will require code – these are the RST locations associated with the RST instruction as described here: https://jnz.dk/z80/rst_p.html. RST is basically a 1-byte CALL equivalent, but it can only call one of eight locations: $00, $08, $10, $18, $20, $28, $30, $38.
A key location for me will be RST $38 which is the interrupt handler I’ll need to handle for the /INT 50Hz interrupt.
Other things that will have to be done on first power up include:
- Any required memory initialisation – e.g. if any of it has to be set to zero or copied from ROM to RAM or anything that needs presetting to a specific value.
- Any required hardware initialisation – e.g. for a R2014 this usually means getting the serial link up and running.
- Set the stack pointer to somewhere at the top of RAM.
- Initialise any hardware registers and then jump to the main application.
I don’t think I need to do anything special to the CPU registers or flags, but happy to be corrected! I haven’t found an obvious “this is what you do to start a Z80” type resource so far, so I’m just inferring from the references listed above right now.
AY Driver ROM
Most of the code and data for the AY driver and tune can be relocated to ROM, but there are several blocks of state variables that must be placed in RAM. Consequently, I’ve had to do the following:
- Create a RAM block at origin $8000 for the state variables.
- Remove the origin statements for Code_Start and Data_Start, but I’ve replaced them with assembler labels.
- Add in some code to pre-initialise the state variables all to zero on startup.
- As well as the AY driver state variables, there are a few additional state variables associated with the following:
- Positions related to the display harness
- Some values associated with the CLOCK, one of which (FIFTY) also needs initialising to 50 on power up.
- The AY driver’s internal “stack” (e.g. SP_A).
- And it also turns out that it has to be able to clear the keypress that my own harness pre-sets to “0” otherwise it constantly resets to play the first tune. So I need to move that to RAM too.
My initialisation code is as follows:
; RESET and Bootstrap
.org $00
jp AYSTART
; RST jump tables
.org $08
ret
.org $10
ret
.org $18
ret
.org $20
ret
.org $28
ret
.org $30
ret
.org $38 ; Maskable /INT
ei
reti ; Return from interrupt
.org $66 ; Non-maskable /NMI
retn ; Return from non-maskable interrupt
; Bootstrap code
.org $100
AYSTART:
; Initialise stack
ld sp, $FF00
; Set all AYVars in RAM to 0
xor a
VARINITLoop:
ld hl, AYVARSTART
ld bc,(AYVAREND-AYVARSTART)
ld (hl),a
inc hl
dec bc
jp nz,VARINITLoop
; Initialise any specific variable values
ld hl,FIFTY
ld a,50
ld (hl),a
; Preset the keypress for first tune
ld hl,LASTK
ld a,48 ; Preset keypress to "0" for the first tune
ld (hl),a
; Enable the 50Hz Interrupt
im 1
ei
; Run the driver
jp Code_StartThere are a couple of hard-coded references to address 50000 (decimal) which is Data_Start. These have had to be changed. The locations/definitions between the original CODE_BOT: and DATA_TOP: labels are now as follows:
CODE_BOT:
CALC1: EQU CODE_BOT-CODE_TOP
;--------------------------------------
; ORG Data_Start
Data_Start:
NTUNES: EQU 1
NEFFECTS: EQU 1
;--------------------------------------
CALC2: DW CALC
Tunes: DB NTUNES
Effects: DB NEFFECTS
;--------------------------------------
DATA_TOP:The original code has 5 tunes and 21 effects which can be selected by pressing a key. I’ve not ported any keyboard handling over as yet, so it only plays the one tune. I’ve cleared out the data for four of the tunes and all the effects bar one. I’ve left one effect in as I don’t know how the code handles having zero effects.
This has an advantage in that all fixed data and code now fits within 8K, which is the standard, common ROM block size for RC2014.
Programming
I can now take the standard ROM that came with my Classic II from here: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/Factory/R0000009.BIN, which has the following ROMs built in:
$0000-$1FFFRC2014 32K BASIC$2000-$3FFF
$4000-$5FFF
$6000-$7FFF
$A000-$BFFF
$C000-$DFFFUnused$E000-$EFFFSCM Z80 MonitorI can thus load this image into a programmer and then add in the HEX records for the AY driver at location $2000-3FFF remembering not to clear the loaded contents first. Then it will be selectable via the ROM jumpers
The above location are EEPROM locations. The jumpers control the state of A13, A14, A15 as seen by the EEPROM. From the RC2014 point of view any selected image will always appear at address $0000-$1FFF in the wider memory map no matter its position in the EPROM.
I’ve programmed it to W27C512s and used it with my RC2014 micro module, which takes 27C512 ROMS. My Classic II is described as also taking 27C512 ROMs, but the latest revision of the board actually uses half of a 128K ST39SF010.
Conclusion
It is great to be able to just turn on the RC2014 and have it come up playing the AY music. This means that for a complete player I now have:
- A RC2014 backplane (any will do).
- RC2014 micro system with custom ROM.
- My ZX Spectrum Compatible Video for RC2014 (V2 with the 50Hz interrupt).
- Either Ed Brindley’s AY-3-8910 for RC2014 or the WhyEm sound card.
Kevin
#ay38910 #rc2014 #zxSpectrum -
RC2014/Z80 Minimal ROM
I want to ROM-ify the messing about I’ve been doing with the AY-3-8910 driver and video code, so I need to figure out what boot-strapping is required to get a basic Z80 machine up and running from power-on. Then I can programme it all into a ROM and just have it startup automatically.
Some key resources:
- Minimal RC2014 boot and initialisation: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/init/rc2014init.asm
- Z80 boot template: https://jacobielectronix.wordpress.com/2015/12/07/z80-cpu-boot-asm-template/
- ZX Spectrum ROM Dissassembly (book and online): https://skoolkid.github.io/rom/
To start, we can note the following from the Z80 User Manual:
“RESET. Reset (input, active Low).”
“RESET initializes the CPU as follows: it resets the interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the interrupt status to Mode 0. During reset time, the address and data bus enter a high-imped ance state, and all control output signals enter an inactive state. R must be active for a minimum of three full clock cycles before a reset operation is complete.”
So execution will be starting from address $0000 (a cleared Program Counter).
There are several special addresses that will require code – these are the RST locations associated with the RST instruction as described here: https://jnz.dk/z80/rst_p.html. RST is basically a 1-byte CALL equivalent, but it can only call one of eight locations: $00, $08, $10, $18, $20, $28, $30, $38.
A key location for me will be RST $38 which is the interrupt handler I’ll need to handle for the /INT 50Hz interrupt.
Other things that will have to be done on first power up include:
- Any required memory initialisation – e.g. if any of it has to be set to zero or copied from ROM to RAM or anything that needs presetting to a specific value.
- Any required hardware initialisation – e.g. for a R2014 this usually means getting the serial link up and running.
- Set the stack pointer to somewhere at the top of RAM.
- Initialise any hardware registers and then jump to the main application.
I don’t think I need to do anything special to the CPU registers or flags, but happy to be corrected! I haven’t found an obvious “this is what you do to start a Z80” type resource so far, so I’m just inferring from the references listed above right now.
AY Driver ROM
Most of the code and data for the AY driver and tune can be relocated to ROM, but there are several blocks of state variables that must be placed in RAM. Consequently, I’ve had to do the following:
- Create a RAM block at origin $8000 for the state variables.
- Remove the origin statements for Code_Start and Data_Start, but I’ve replaced them with assembler labels.
- Add in some code to pre-initialise the state variables all to zero on startup.
- As well as the AY driver state variables, there are a few additional state variables associated with the following:
- Positions related to the display harness
- Some values associated with the CLOCK, one of which (FIFTY) also needs initialising to 50 on power up.
- The AY driver’s internal “stack” (e.g. SP_A).
- And it also turns out that it has to be able to clear the keypress that my own harness pre-sets to “0” otherwise it constantly resets to play the first tune. So I need to move that to RAM too.
My initialisation code is as follows:
; RESET and Bootstrap
.org $00
jp AYSTART
; RST jump tables
.org $08
ret
.org $10
ret
.org $18
ret
.org $20
ret
.org $28
ret
.org $30
ret
.org $38 ; Maskable /INT
ei
reti ; Return from interrupt
.org $66 ; Non-maskable /NMI
retn ; Return from non-maskable interrupt
; Bootstrap code
.org $100
AYSTART:
; Initialise stack
ld sp, $FF00
; Set all AYVars in RAM to 0
xor a
VARINITLoop:
ld hl, AYVARSTART
ld bc,(AYVAREND-AYVARSTART)
ld (hl),a
inc hl
dec bc
jp nz,VARINITLoop
; Initialise any specific variable values
ld hl,FIFTY
ld a,50
ld (hl),a
; Preset the keypress for first tune
ld hl,LASTK
ld a,48 ; Preset keypress to "0" for the first tune
ld (hl),a
; Enable the 50Hz Interrupt
im 1
ei
; Run the driver
jp Code_StartThere are a couple of hard-coded references to address 50000 (decimal) which is Data_Start. These have had to be changed. The locations/definitions between the original CODE_BOT: and DATA_TOP: labels are now as follows:
CODE_BOT:
CALC1: EQU CODE_BOT-CODE_TOP
;--------------------------------------
; ORG Data_Start
Data_Start:
NTUNES: EQU 1
NEFFECTS: EQU 1
;--------------------------------------
CALC2: DW CALC
Tunes: DB NTUNES
Effects: DB NEFFECTS
;--------------------------------------
DATA_TOP:The original code has 5 tunes and 21 effects which can be selected by pressing a key. I’ve not ported any keyboard handling over as yet, so it only plays the one tune. I’ve cleared out the data for four of the tunes and all the effects bar one. I’ve left one effect in as I don’t know how the code handles having zero effects.
This has an advantage in that all fixed data and code now fits within 8K, which is the standard, common ROM block size for RC2014.
Programming
I can now take the standard ROM that came with my Classic II from here: https://github.com/RC2014Z80/RC2014/blob/master/ROMs/Factory/R0000009.BIN, which has the following ROMs built in:
$0000-$1FFFRC2014 32K BASIC$2000-$3FFF
$4000-$5FFF
$6000-$7FFF
$A000-$BFFF
$C000-$DFFFUnused$E000-$EFFFSCM Z80 MonitorI can thus load this image into a programmer and then add in the HEX records for the AY driver at location $2000-3FFF remembering not to clear the loaded contents first. Then it will be selectable via the ROM jumpers
The above location are EEPROM locations. The jumpers control the state of A13, A14, A15 as seen by the EEPROM. From the RC2014 point of view any selected image will always appear at address $0000-$1FFF in the wider memory map no matter its position in the EPROM.
I’ve programmed it to W27C512s and used it with my RC2014 micro module, which takes 27C512 ROMS. My Classic II is described as also taking 27C512 ROMs, but the latest revision of the board actually uses half of a 128K ST39SF010.
Conclusion
It is great to be able to just turn on the RC2014 and have it come up playing the AY music. This means that for a complete player I now have:
- A RC2014 backplane (any will do).
- RC2014 micro system with custom ROM.
- My ZX Spectrum Compatible Video for RC2014 (V2 with the 50Hz interrupt).
- Either Ed Brindley’s AY-3-8910 for RC2014 or the WhyEm sound card.
Kevin
#ay38910 #rc2014 #zxSpectrum -
We charge a very modest fee for our ZX Spectrum games, it doesn't raise much but it allows us to sometimes get a new bit of software or hardware or a pizza etc. So if you want to support us you can check out our games at puttycad.itch.io #newRetro #zxspectrum #retro #games Poopy Platforms soon! ;)
-
We charge a very modest fee for our ZX Spectrum games, it doesn't raise much but it allows us to sometimes get a new bit of software or hardware or a pizza etc. So if you want to support us you can check out our games at puttycad.itch.io #newRetro #zxspectrum #retro #games Poopy Platforms soon! ;)
-
We charge a very modest fee for our ZX Spectrum games, it doesn't raise much but it allows us to sometimes get a new bit of software or hardware or a pizza etc. So if you want to support us you can check out our games at puttycad.itch.io #newRetro #zxspectrum #retro #games Poopy Platforms soon! ;)
-
We charge a very modest fee for our ZX Spectrum games, it doesn't raise much but it allows us to sometimes get a new bit of software or hardware or a pizza etc. So if you want to support us you can check out our games at puttycad.itch.io #newRetro #zxspectrum #retro #games Poopy Platforms soon! ;)
-
We charge a very modest fee for our ZX Spectrum games, it doesn't raise much but it allows us to sometimes get a new bit of software or hardware or a pizza etc. So if you want to support us you can check out our games at puttycad.itch.io #newRetro #zxspectrum #retro #games Poopy Platforms soon! ;)
-
#screenshotsaturday Poopy Platforms will be the next game from PuttyCAD & 100 Tin Soldiers... #retro #zxspectrum #poopyplatforms #newretro coming soon to puttycad.itch.io
-
#screenshotsaturday Poopy Platforms will be the next game from PuttyCAD & 100 Tin Soldiers... #retro #zxspectrum #poopyplatforms #newretro coming soon to puttycad.itch.io
-
#screenshotsaturday Poopy Platforms will be the next game from PuttyCAD & 100 Tin Soldiers... #retro #zxspectrum #poopyplatforms #newretro coming soon to puttycad.itch.io
-
Babyman VS Terminatots Part 1 Helpers... Will be adding these to the game page puttycad.itch.io #babyman #zxspectrum #8bit #retro #newretro #gaming #gamer #puttycad #100tinsoldiers
-
Babyman VS Terminatots Part 1 Helpers... Will be adding these to the game page puttycad.itch.io #babyman #zxspectrum #8bit #retro #newretro #gaming #gamer #puttycad #100tinsoldiers
-
Babyman VS Terminatots Part 1 Helpers... Will be adding these to the game page puttycad.itch.io #babyman #zxspectrum #8bit #retro #newretro #gaming #gamer #puttycad #100tinsoldiers
-
Babyman VS Terminatots Part 1 Helpers... Will be adding these to the game page puttycad.itch.io #babyman #zxspectrum #8bit #retro #newretro #gaming #gamer #puttycad #100tinsoldiers
-
Promo art - Lockdown Town Collection - ZX Spectrum - puttycad.itch.io #zxspectrum #games #gamer #retro #newretro
-
Promo art - Lockdown Town Collection - ZX Spectrum - puttycad.itch.io #zxspectrum #games #gamer #retro #newretro
-
Promo art - Lockdown Town Collection - ZX Spectrum - puttycad.itch.io #zxspectrum #games #gamer #retro #newretro
-
Zaprogramuj swoje ZX Spectrum! Prosty BASIC, wielkie możliwośc
Powrót do korzeni: Programowanie w języku BASIC na komputerze The Spectrum
Premiera urządzenia The Spectrum wywołała spore poruszenie w świecie miłośników retrokomputingu. Choć sieć zalała fala unboxingów i testów dołączonych gier, warto spojrzeć na ten sprzęt z innej perspektywy. The Spectrum, będący w rzeczywistości zaawansowanym emulatorem zamkniętym w nowoczesnej obudowie, to nie tylko konsola do gier, ale przede wszystkim narzędzie programistyczne. Dzięki pełnowymiarowej klawiaturze z naniesionymi komendami języka ZX BASIC, urządzenie to staje się idealną platformą do nauki podstaw programowania oraz tworzenia własnych gier i aplikacji.
Złota biblioteka programisty – literatura z epoki
Zanim przejdziemy do praktyki, warto pochylić się nad zasobami wiedzy, które kształtowały pokolenia programistów w latach 80. i 90. Literatura tamtego okresu jest niezwykle bogata i do dziś stanowi cenne źródło informacji.
Jedną z fundamentalnych pozycji jest wydana w 1987 roku książka „Pierwsze kontakty z mikrokomputerem ZX Spectrum”. To idealny podręcznik dla osób, które nigdy wcześniej nie miały styczności z tą architekturą. Autorzy w przystępny sposób wyjaśniają obsługę klawiatury oraz podstawowe komendy BASIC-a, a całość uzupełniają gotowe listingi programów do samodzielnego wpisania.
Kolejną, wręcz kultową pozycją, jest „Przewodnik po ZX Spectrum”. To kompendium wiedzy traktujące o komputerze w sposób całościowy. Znajdziemy tam nie tylko naukę BASIC-a, ale także wprowadzenie do Assemblera, opisy innych języków (takich jak C, Forth czy Logo) oraz szczegółowe aspekty sprzętowe, w tym rozpiskę szyny krawędziowej oryginalnego modelu.
Dla osób szukających wyzwań doskonałym wyborem będą publikacje Rolanda Wrocławka, który na łamach „Młodego Technika” prowadził kursy programowania, czy popularna seria „Wszystko o komputerze”, składająca się z 13 zeszytów tworzących kompleksowy kurs od podstaw do zaawansowanych technik maszynowych. Nie można też zapomnieć o prasie komputerowej, ze słynnym „Bajtkiem” na czele, gdzie rubryka „Klan Spectrum” dostarczała niezliczonych listingów, w tym tak użytecznych narzędzi, jak generatory polskich znaków.
Filozofia klawiatury i tryb edycji
Klawiatura The Spectrum na pierwszy rzut oka może wydawać się skomplikowana. Wynika to z faktu, że każdemu klawiszowi przypisano konkretne komendy języka BASIC. Zamiast wpisywać słowo „PRINT” litera po literze, wywołujemy je jednym naciśnięciem klawisza „P”.
System operuje na różnych typach kursora:
- Kursor L: Służy do wpisywania liter i kontynuowania komend.
- Kursor E (Extended): Wywoływany kombinacją klawiszy CAPS SHIFT i SYMBOL SHIFT. Pozwala na dostęp do komend oznaczonych na zielono, takich jak TAB czy funkcje matematyczne.
- Symbol Shift: Używany wraz z kursorem E, daje dostęp do poleceń oznaczonych kolorem czerwonym (np. CIRCLE, SCREEN).
Współczesna wersja komputera w trybie klasycznym wita nas ekranem powitalnym z datą zaktualizowaną na rok 2024, ale cała reszta – w tym logika edycji linii – pozostała wierna oryginałowi. Programowanie w BASIC-u wymaga numeracji linii (od 1 do 9999). Edycja istniejącej linii odbywa się poprzez najechanie na nią znakiem wyboru i użycie kombinacji CAPS SHIFT + 1, co przenosi kod do dolnej części ekranu, gdzie możemy dokonać zmian. Skasowanie linii jest jeszcze prostsze – wystarczy wpisać jej numer i nacisnąć ENTER.
Interakcja z użytkownikiem i logika programu
Podstawą każdego programu jest komunikacja. Komenda PRINT służy do wyświetlania treści na ekranie, natomiast BORDER pozwala zarządzać kolorem ramki (dostępna paleta obejmuje 8 podstawowych kolorów, choć w pełnej konfiguracji Spectrum obsługuje ich 15).
Prawdziwa zabawa zaczyna się jednak przy użyciu komendy INPUT, która wymusza interakcję. W BASIC-u kluczowe jest rozróżnienie typów zmiennych:
- Zmienna numeryczna (np. A) przechowuje liczby.
- Zmienna tekstowa (np. A$) przechowuje ciągi znaków.
Łącząc to z instrukcją warunkową IF…THEN oraz komendą skoku GOTO, możemy stworzyć prosty mechanizm „pseudo-chatu” lub gry tekstowej. Program może zadać pytanie, poczekać na odpowiedź użytkownika, porównać ją ze wzorcem i w zależności od wyniku – wyświetlić reakcję lub zapętlić się, prosząc o ponowne wprowadzenie danych. Tak budowane były dawne gry paragrafowe, które mimo braku grafiki, potrafiły wciągnąć gracza na długie godziny.
Grafika i proste animacje
ZX Spectrum, mimo rozdzielczości 256×192 piksele, oferuje ciekawe możliwości graficzne. Do dyspozycji programisty oddano trzy główne komendy:
- PLOT: Rysuje pojedynczy punkt o zadanych współrzędnych X i Y.
- DRAW: Rysuje linię od ostatniego punktu do zadanej lokalizacji.
- CIRCLE: Pozwala narysować okrąg, wymagając podania współrzędnych środka oraz promienia.
Zastosowanie pętli FOR…NEXT pozwala na automatyzację procesu rysowania. Przykładowo, tworząc pętlę wykonującą się 20 razy i zwiększając w każdym kroku promień okręgu o zmienną z licznika, otrzymamy efektowną grafikę interferencyjną. Należy jedynie pamiętać o granicach ekranu – wyjście poza obszar roboczy skutkuje przerwaniem programu i błędem raportowanym przez interpreter.
Budowa silnika gry na przykładzie „Węża”
Wykorzystując zdobytą wiedzę, możemy pokusić się o stworzenie fundamentów pod prostą grę zręcznościową. Kluczowym elementem jest tutaj instrukcja INKEY$, która w przeciwieństwie do INPUT, nie zatrzymuje programu, lecz sprawdza „w locie”, czy jakiś klawisz jest w danej chwili naciśnięty.
W prostym schemacie sterowania pikselem (analogicznym do gry „Wąż”) używamy klawiszy:
- Q / A: Ruch w pionie (góra/dół).
- O / P: Ruch w poziomie (lewo/prawo).
Program w pętli odczytuje stan klawiatury, aktualizuje współrzędne X i Y, a następnie rysuje punkt w nowym miejscu. Aby gra była grywalna, można dodać warunki sprawdzające, czy gracz nie dotknął krawędzi ekranu. Taki model programowania, oparty na ciągłym sprawdzaniu warunków i aktualizacji obrazu, jest podstawą tworzenia gier wideo od dziesięcioleci.
Podsumowanie
Programowanie na The Spectrum w języku ZX BASIC to fascynująca podróż do czasów, gdy zrozumienie działania komputera było na wyciągnięcie ręki. Choć dziś dysponujemy ogromną mocą obliczeniową i zaawansowanymi silnikami graficznymi, ograniczenia 8-bitowej architektury wciąż uczą dyscypliny, logicznego myślenia i kreatywności. Niezależnie od tego, czy chcesz odświeżyć sobie wspomnienia z młodości, czy po raz pierwszy spróbować swoich sił w retro-kodowaniu, świat 15 kolorów i 48 kilobajtów pamięci wciąż ma wiele do zaoferowania.
Zachęcamy do eksperymentowania z kodem i sięgania po starą literaturę – to najlepszy sposób, by w pełni wykorzystać potencjał drzemiący w tym niepozornym urządzeniu.
Warto wypróbować: Spróbuj napisać program, który zmienia kolory ramki w rytm naciśniętych klawiszy lub stwórz prosty labirynt tekstowy, korzystając wyłącznie z komend PRINT i INPUT.
#basicProgramowanie #jakProgramować #językProgramowania #kod #kodBasic #kody #komputer #komputerRetro #Komputery #komputeryRetro #łatweProgramowanie #programowanie #programowanieBasic #programowanieWBasic #programowanieZxSpectrum #prosteProgramowanie #retroKomputer #retroKomputery #retroSprzet #RetroGaming #retrogralniaProgramowanie #retrogralniaZxSpectrum #sprzętRetro #TheGameIsNotOver #zxSpectrum #zxSpectrumProgramowanie #zxSpectrumRetrogralnia -
Something to brighten your day! Here's the loading screen for Gherbert Groundhog 2: Gherbert in the Garden #GherbertInTheGarden #GherbertGroundhog2 #loadingscreen #zxspectrum #8bit #pixelart #puttycad #psychicparrot #retro #newretro by myself and @psychicparrot42
-
Something to brighten your day! Here's the loading screen for Gherbert Groundhog 2: Gherbert in the Garden #GherbertInTheGarden #GherbertGroundhog2 #loadingscreen #zxspectrum #8bit #pixelart #puttycad #psychicparrot #retro #newretro by myself and @psychicparrot42
-
Something to brighten your day! Here's the loading screen for Gherbert Groundhog 2: Gherbert in the Garden #GherbertInTheGarden #GherbertGroundhog2 #loadingscreen #zxspectrum #8bit #pixelart #puttycad #psychicparrot #retro #newretro by myself and @psychicparrot42
-
Something to brighten your day! Here's the loading screen for Gherbert Groundhog 2: Gherbert in the Garden #GherbertInTheGarden #GherbertGroundhog2 #loadingscreen #zxspectrum #8bit #pixelart #puttycad #psychicparrot #retro #newretro by myself and @psychicparrot42
-
Something to brighten your day! Here's the loading screen for Gherbert Groundhog 2: Gherbert in the Garden #GherbertInTheGarden #GherbertGroundhog2 #loadingscreen #zxspectrum #8bit #pixelart #puttycad #psychicparrot #retro #newretro by myself and @psychicparrot42