OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 10 to Rev 11
    Reverse comparison

Rev 10 → Rev 11

/a-z80/trunk/host/zxspectrum_de1/zxspectrum_de1.sv
63,8 → 63,9
output wire SRAM_UB_N,
output wire SRAM_LB_N,
 
//-------- My little imitation of a Kempston joystick -----------
input wire [5:0] kempston,
//-------- Atari joystick mapped as Kempston
input wire [4:0] kempston, // Input with weak pull-up
output wire kempston_gnd, // Helps mapping to DB9 cable
output wire [4:0] LEDG, // Show the joystick state
 
//-------- Misc and debug -------------------
85,6 → 86,7
assign GPIO_1[15:0] = A[15:0];
assign GPIO_1[23:16] = D[7:0];
assign GPIO_1[31:24] = {nM1,nMREQ,nIORQ,nRD,nWR,nRFSH,nHALT,nBUSACK};
assign kempston_gnd = 0;
 
// Top 3 green LEDs show various states:
assign LEDGTOP[2] = 0; // Reserved for future use
129,11 → 131,10
// Normally data supplied by the ULA
D[7:0] = ula_data;
 
// Kempston joystick at the IO address of 0x1F: active bits are high: 000FUDLR
// The bits are scrambled since I just happen to solder them that way on a game
// pad I've got (see my blog); you can remap it if you have another kind of joystick
// Kempston joystick at the IO address 0x1F; active bits are high:
// FIRE UP DOWN LEFT RIGHT
if (A[7:0]==8'h1F) begin
D[7:0] = { 3'b0, !kempston[3],!kempston[5],!kempston[4],!kempston[0],!kempston[2] };
D[7:0] = { 3'b0, !kempston[4],!kempston[0],!kempston[1],!kempston[2],!kempston[3] };
end
end
default:
284,10 → 285,10
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Lit green LEDs to show activity on a Kempston compatible joystick
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assign LEDG[0] = !kempston[5]; // UP
assign LEDG[1] = !kempston[4]; // DOWN
assign LEDG[2] = !kempston[0]; // LEFT
assign LEDG[3] = !kempston[2]; // RIGHT
assign LEDG[4] = !kempston[3] | !kempston[1]; // BUTTON
assign LEDG[0] = !kempston[0]; // UP
assign LEDG[1] = !kempston[1]; // DOWN
assign LEDG[2] = !kempston[2]; // LEFT
assign LEDG[3] = !kempston[3]; // RIGHT
assign LEDG[4] = !kempston[4]; // FIRE
 
endmodule
/a-z80/trunk/host/zxspectrum_de1/zxspectrum_de1.qsf
393,15 → 393,14
###########################################################################
# GPIO-0 Expansion Header 1
###########################################################################
set_location_assignment PIN_A13 -to GPIO_0[0]
set_location_assignment PIN_A13 -to kempston_gnd
set_location_assignment PIN_B13 -to GPIO_0[1]
set_location_assignment PIN_A14 -to GPIO_0[2]
set_location_assignment PIN_A14 -to kempston[4]
set_location_assignment PIN_B14 -to GPIO_0[3]
set_location_assignment PIN_A15 -to GPIO_0[4]
set_location_assignment PIN_B15 -to GPIO_0[5]
set_location_assignment PIN_A16 -to GPIO_0[6]
set_location_assignment PIN_B16 -to GPIO_0[7]
set_location_assignment PIN_A17 -to GPIO_0[8]
set_location_assignment PIN_A15 -to kempston[3]
set_location_assignment PIN_B15 -to kempston[2]
set_location_assignment PIN_A16 -to kempston[1]
set_location_assignment PIN_B16 -to kempston[0]
set_location_assignment PIN_B17 -to GPIO_0[9]
set_location_assignment PIN_A18 -to GPIO_0[10]
set_location_assignment PIN_B18 -to GPIO_0[11]
419,20 → 418,20
set_location_assignment PIN_F22 -to GPIO_0[23]
set_location_assignment PIN_G21 -to GPIO_0[24]
set_location_assignment PIN_G22 -to GPIO_0[25]
set_location_assignment PIN_J21 -to kempston[0] # GPIO_0[26]
set_location_assignment PIN_J22 -to kempston[1] # GPIO_0[27]
set_location_assignment PIN_K21 -to kempston[2] # GPIO_0[28]
set_location_assignment PIN_K22 -to kempston[3] # GPIO_0[29]
set_location_assignment PIN_J19 -to kempston[4] # GPIO_0[30]
set_location_assignment PIN_J20 -to kempston[5] # GPIO_0[31]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[0]
set_location_assignment PIN_J21 -to GPIO_0[26]
set_location_assignment PIN_J22 -to GPIO_0[27]
set_location_assignment PIN_K21 -to GPIO_0[28]
set_location_assignment PIN_K22 -to GPIO_0[29]
set_location_assignment PIN_J19 -to GPIO_0[30]
set_location_assignment PIN_J20 -to GPIO_0[31]
set_instance_assignment -name IO_STANDARD LVTTL -to kempston_gnd
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[1]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[2]
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to kempston[4]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[3]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[4]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[5]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[6]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[7]
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to kempston[3]
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to kempston[2]
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to kempston[1]
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to kempston[0]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[8]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[9]
set_instance_assignment -name IO_STANDARD LVTTL -to GPIO_0[10]
551,7 → 550,7
set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED WITH WEAK PULL-UP"
set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS ON
set_global_assignment -name SMART_RECOMPILE ON
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS OFF
set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS ON
set_global_assignment -name STRATIX_CONFIGURATION_DEVICE EPCS4
set_global_assignment -name OPTIMIZE_POWER_DURING_SYNTHESIS "NORMAL COMPILATION"
set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING "NORMAL COMPILATION"
584,9 → 583,9
set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL
set_global_assignment -name FITTER_EARLY_TIMING_ESTIMATE_MODE OPTIMISTIC
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING ON
set_global_assignment -name PHYSICAL_SYNTHESIS_ASYNCHRONOUS_SIGNAL_PIPELINING OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION ON
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC_FOR_AREA OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_MAP_LOGIC_TO_MEMORY_FOR_AREA OFF
set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT NORMAL
639,4 → 638,5
set_global_assignment -name SYSTEMVERILOG_FILE zxspectrum_de1.sv
set_global_assignment -name QIP_FILE pll.qip
set_global_assignment -name QIP_FILE ram16.qip
set_global_assignment -name SDC_FILE zxspectrum_de1.sdc
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
/a-z80/trunk/host/zxspectrum_de1/zxspectrum_de1.sdc
0,0 → 1,97
#**************************************************************
## VENDOR "Altera"
## PROGRAM "Quartus II"
## VERSION "Version 13.0.1 Build 232 06/12/2013 Service Pack 1 SJ Web Edition"
##
## DEVICE "EP2C20F484C7"
##
#**************************************************************
# Time Information
#**************************************************************
 
set_time_format -unit ns -decimal_places 3
 
#**************************************************************
# Create Clock
#**************************************************************
 
create_clock -name "CLOCK_27" -period 27MHz [get_ports {CLOCK_27}]
create_clock -name "CLOCK_24" -period 24MHz [get_ports {CLOCK_24}]
create_clock -name KEY1 -period 10.000 [get_ports {KEY1}]
create_clock -name beep -period 10.000 [get_registers {ula:ula_|beep}]
 
derive_pll_clocks -create_base_clocks
 
#**************************************************************
# Create Generated Clock
#**************************************************************
 
create_generated_clock -name clk_cpu -source [get_pins {ula_|clocks_|clk_cpu|clk}] -divide_by 4 [get_pins {ula_|clocks_|clk_cpu|regout}]
 
#**************************************************************
# Set Clock Latency
#**************************************************************
 
 
#**************************************************************
# Set Clock Uncertainty
#**************************************************************
 
derive_clock_uncertainty
 
#**************************************************************
# Set Input Delay
#**************************************************************
 
set_input_delay -clock CLOCK_27 -max 2 [all_inputs]
set_input_delay -clock CLOCK_27 -min 1 [all_inputs]
 
set_input_delay -add_delay -max -clock [get_clocks {CLOCK_24}] 2.000 [get_ports {CLOCK_24}]
set_input_delay -add_delay -min -clock [get_clocks {CLOCK_24}] 1.000 [get_ports {CLOCK_24}]
 
set_input_delay -add_delay -max -clock [get_clocks {CLOCK_27}] 2.000 [get_ports {CLOCK_27}]
set_input_delay -add_delay -min -clock [get_clocks {CLOCK_27}] 1.000 [get_ports {CLOCK_27}]
 
#**************************************************************
# Set Output Delay
#**************************************************************
 
set_output_delay -clock CLOCK_24 10 [all_outputs]
 
#**************************************************************
# Set Clock Groups
#**************************************************************
 
set_clock_groups -asynchronous \
-group [get_clocks {CLOCK_24}] \
-group [get_clocks {CLOCK_27}] \
-group [get_clocks {clk_cpu}] \
-group [get_clocks {KEY1}] \
-group [get_clocks {beep}] \
-group ula_|pll_|altpll_component|pll|clk[0] \
-group ula_|pll_|altpll_component|pll|clk[1]
 
#**************************************************************
# Set False Path
#**************************************************************
 
 
#**************************************************************
# Set Multicycle Path
#**************************************************************
 
 
#**************************************************************
# Set Maximum Delay
#**************************************************************
 
 
#**************************************************************
# Set Minimum Delay
#**************************************************************
 
 
#**************************************************************
# Set Input Transition
#**************************************************************
 
/a-z80/trunk/host/zxspectrum_de1/rom/zxspectrum_rom.asm
2,6 → 2,9
;** An Assembly File Listing to generate a 16K ROM for the ZX Spectrum **
;************************************************************************
;
; 03-13-2016:
; Add custom NMI handler and a function to enter game pokes after pressing the NMI button
;
; 11-10-2014:
; This version has been updated to correctly handle the NMI jump.
;
251,11 → 254,12
;; RESET
L0066: PUSH AF ; save the
PUSH HL ; registers.
LD HL,($5CB0) ; fetch the system variable NMIADD.
; LD HL,($5CB0) ; fetch the system variable NMIADD.
LD HL, nmi_handler ; Custom NMI handler
LD A,H ; test address
OR L ; for zero.
 
; JR NZ,L0070 ; skip to NO-RESET if NOT ZERO
; JR NZ,L0070 ; skip to NO-RESET if NOT ZERO
JR Z,L0070 ; **FIXED**
 
JP (HL) ; jump to routine ( i.e. L0000 )
19103,6 → 19107,106
;; spare
L386E: DEFB $FF, $FF ;
 
; ----------------------------------------------------------------------------
; This custom NMI handler provides a way to enter a POKE for a game by typing in
; the address (5 decimal digits) followed by the value (3 decimal digits)
; after which the value will be stored to the selected location.
; ----------------------------------------------------------------------------
nmi_handler: ; NMI handler
push bc
push de
push ix
ld hl,$04000 ; Use the screen memory as a temp storage
ld e,$08 ; Will load 8 characters (numbers)
next_key:
ld bc,$f7fe ; Number row 1..5
in a,(c)
ld c,a
ld a,$01 ; Preload "1"
bit 0,c ; If the key has been pressed
jr z,accept_key ; Accept it
inc a ; Preload "2"
bit 1,c ; and continue for every key up to "5"
jr z,accept_key
inc a
bit 2,c
jr z,accept_key
inc a
bit 3,c
jr z,accept_key
inc a
bit 4,c
jr z,accept_key
ld bc,$effe ; Number row 6...0
in a,(c)
ld c,a
ld a,$06
bit 4,c
jr z,accept_key
inc a
bit 3,c
jr z,accept_key
inc a
bit 2,c
jr z,accept_key
inc a
bit 1,c
jr z,accept_key
xor a
bit 0,c
jr z,accept_key
jp next_key
accept_key:
ld (hl),a ; Store current key value into the buffer
inc hl
poll_key_release: ; Poll for any pressed key to be released
ld bc,$f7fe
in a,(c)
cpl
and $1f
jr nz,poll_key_release
ld bc,$effe
in a,(c)
cpl
and $1f
jr nz,poll_key_release
dec e ; Decrement the number of keys expected
jr nz,next_key ; Jump back to accept next key if not yet done
ld ix,$4000
ld b,$05 ; First 5 numbers represent the address to POKE to
call decimal_to_hl
push hl ; Address is in HL, store it
ld b,$03 ; Next 3 numbers represent the value to POKE
call decimal_to_hl
ld a,l ; Value is in L
pop hl ; Get the address
ld (hl),a ; POKE a value
pop ix
pop de
pop bc
pop hl
pop af
retn
; Read a decimal value pointed to by IX register
; The number of digits is given in B register
; Return the value in HL register
decimal_to_hl:
ld hl,$0000 ; Start with value of 0
lp2:
push bc
ld b,$09 ; Multiply the current value by 10
push hl
pop de
lp1:
add hl,de
djnz lp1
pop bc
ld e,(ix+0) ; Read in the next digit
ld d,$00
add hl,de ; Add in the new value
inc ix
djnz lp2 ; Loop for the requested number of digits
ret
 
DEFB $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF;
DEFB $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF;
/a-z80/trunk/host/zxspectrum_de1/rom/readme.txt
1,7 → 1,10
The "original" ZX Spectrum ROM
==============================
http://www.wearmouth.demon.co.uk/zx82.htm
* I have "fixed" the NMI bug so the KEY1 which is connected to the NMI pin can be used.
* "fixed" the NMI bug so the KEY1 which is connected to the NMI pin can be used.
* Added a custom NMI handler that provides a way to enter a POKE for a game by typing
in the address (5 decimal digits) followed by the value (3 decimal digits)
after which the value will be stored to the selected location.
 
The GOSH WONDERFUL ROM
======================
11,3 → 14,9
SW0 selects which ROM image (which 16K block) is used.
 
See the User's Guide for more information on this design.
 
CREATE ROM IMAGES
=================
Run assemble.bat to create ZX Spectrum ROM (rom.bin)
Run this command to append the two images:
copy /b rom.bin + gw03.rom combined.rom

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.