-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Z80-Retro/dev
Refactor BIOS and I/O lib for shared use on both the Retro! and Nouveau
- Loading branch information
Showing
29 changed files
with
423 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
*.sym | ||
mkfs | ||
2063-Z80-cpm.zip | ||
Make.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
;**************************************************************************** | ||
; | ||
; Copyright (C) 2024 John Winans | ||
; | ||
; This library is free software; you can redistribute it and/or | ||
; modify it under the terms of the GNU Lesser General Public | ||
; License as published by the Free Software Foundation; either | ||
; version 2.1 of the License, or (at your option) any later version. | ||
; | ||
; This library is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
; Lesser General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU Lesser General Public | ||
; License along with this library; if not, write to the Free Software | ||
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
; USA | ||
; | ||
; https://github.com/johnwinans/2063-Z80-cpm | ||
; | ||
;**************************************************************************** | ||
|
||
bsp_init: | ||
ld a,0 | ||
;out0 (0x36),a ; RCR = 0 = disable the DRAM refresh controller | ||
db 0xed,0x39,0x36 | ||
;out0 (0x32),a ; DCNTL = 0 = zero wait states | ||
db 0xed,0x39,0x32 | ||
|
||
ld a,0x80 | ||
;out0 (0x1f),a ; CCR = 0x80 = run at 1X extal clock speed | ||
db 0xed,0x39,0x1f | ||
|
||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
;**************************************************************************** | ||
; | ||
; Copyright (C) 2024 John Winans | ||
; | ||
; This library is free software; you can redistribute it and/or | ||
; modify it under the terms of the GNU Lesser General Public | ||
; License as published by the Free Software Foundation; either | ||
; version 2.1 of the License, or (at your option) any later version. | ||
; | ||
; This library is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
; Lesser General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU Lesser General Public | ||
; License along with this library; if not, write to the Free Software | ||
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
; USA | ||
; | ||
; https://github.com/johnwinans/2063-Z80-cpm | ||
; | ||
;**************************************************************************** | ||
|
||
; Drivers for the Z8S180 ASCI | ||
|
||
.CNTLA0: equ 0x00 | ||
.CNTLB0: equ 0x02 | ||
.RDR0: equ 0x08 | ||
.ASEXT0: equ 0x12 | ||
.STAT0: equ 0x04 | ||
.TDR0: equ 0x06 | ||
|
||
;############################################################## | ||
; Return NZ if the console UART is ready and Z (with A=0) if not ready. | ||
; Clobbers: AF | ||
;############################################################## | ||
con_tx_ready: | ||
;IN0 A,(.STAT0) ;C4H,read status | ||
db 11101101B,00111000B,.STAT0 | ||
AND 2 | ||
ret ; a = 0 = not ready | ||
|
||
;############################################################## | ||
; Return NZ if the console UART is ready and Z (with A=0) if not ready. | ||
; Clobbers: AF | ||
;############################################################## | ||
con_rx_ready: | ||
; hack to clear any overrun errors (See Errata about ASCI seizures) | ||
;IN0 A,(.CNTLA0) ;C4H,read status | ||
db 11101101B,00111000B,.CNTLA0 | ||
and ~0x08 | ||
;OUT0 (.CNTLA0),A | ||
db 0xed,0x39,.CNTLA0 | ||
|
||
;IN0 A,(.STAT0) ;C4H,read status | ||
db 11101101B,00111000B,.STAT0 | ||
AND 10000000B | ||
ret ; 0 = not ready | ||
|
||
|
||
;############################################################## | ||
; stolen from https://groups.google.com/g/retro-comp/c/N574sGiwmaI?pli=1 | ||
; mods are my fault :-) | ||
;############################################################## | ||
con_init: | ||
LD A,01100100B ; rcv enable, xmit enable, no parity | ||
;LD A,01100101B ; rcv enable, xmit enable, no parity | ||
;OUT0 (.CNTLA0),A ; set cntla | ||
db 0xed,0x39,.CNTLA0 | ||
|
||
LD A,00000000B ; div 10, div 16, div 2 18432000/1/1/10/16/1 = 115200 | ||
;OUT0 (.CNTLB0),A ; set cntlb | ||
db 0xed,0x39,.CNTLB0 | ||
|
||
LD A,01100110B ; no cts, no dcd, no break detect | ||
;OUT0 (.ASEXT0),A ; set ASCI0 EXTENSION CONTROL (Z8S180 only) | ||
db 0xed,0x39,.ASEXT0 | ||
XOR A | ||
;OUT0 (.STAT0),A ; ASCI Status Reg Ch 0 | ||
db 0xed,0x39,.STAT0 | ||
ret | ||
|
||
|
||
;############################################################## | ||
; Wait for the transmitter to become ready and then | ||
; print the character in the C register. | ||
; Clobbers: AF | ||
;############################################################## | ||
con_tx_char: | ||
call con_tx_ready | ||
jr z,con_tx_char | ||
ld a,c | ||
|
||
;OUT0 (.TDR0),A ;C6H | ||
db 0xed,0x39,.TDR0 | ||
|
||
ret | ||
|
||
;############################################################## | ||
; Wait for the receiver to become ready and then return the | ||
; character in the A register. | ||
; Clobbers: AF | ||
; | ||
; XXX need to concern ourselves with the Errata note that | ||
; says we need to write zero into CNTLA0, bit 3 (ERF) to | ||
; reset an overflow error flag when set because RX will | ||
; seize. | ||
; | ||
;############################################################## | ||
con_rx_char: | ||
call con_rx_ready | ||
jr z,con_rx_char | ||
|
||
;IN0 A,(.RDR0) | ||
db 11101101B,00111000B,.RDR0 | ||
|
||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
;**************************************************************************** | ||
; | ||
; Copyright (C) 2024 John Winans | ||
; | ||
; This library is free software; you can redistribute it and/or | ||
; modify it under the terms of the GNU Lesser General Public | ||
; License as published by the Free Software Foundation; either | ||
; version 2.1 of the License, or (at your option) any later version. | ||
; | ||
; This library is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
; Lesser General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU Lesser General Public | ||
; License along with this library; if not, write to the Free Software | ||
; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | ||
; USA | ||
; | ||
; https://github.com/johnwinans/2063-Z80-cpm | ||
; | ||
;**************************************************************************** | ||
|
||
; Z80 Nouveau | ||
|
||
gpio_in: equ 0xf0 ; GP input port | ||
gpio_out: equ 0xf1 ; GP output port | ||
flash_disable: equ 0xfe ; dummy-read from this port to disable the FLASH | ||
|
||
; bit-assignments for General Purpose output port | ||
gpio_out_sd_mosi: equ 0x01 | ||
gpio_out_sd_clk: equ 0x02 | ||
gpio_out_sd_ssel: equ 0x04 | ||
|
||
; bit-assignments for General Purpose input port | ||
;gpio_in_user1: equ 0x20 | ||
gpio_in_sd_det: equ 0x40 | ||
gpio_in_sd_miso: equ 0x80 | ||
|
||
; The initial value to write into the gpio_out latch. | ||
; The value here will idle the SD card interface. | ||
gpio_out_init: equ gpio_out_sd_mosi|gpio_out_sd_clk|gpio_out_sd_ssel |
Oops, something went wrong.