Updated for extra ram and external keyboard support
This commit is contained in:
parent
0831441a8a
commit
59f802bc9f
|
@ -6,12 +6,12 @@
|
||||||
;Assumes memory configuration is all-RAM
|
;Assumes memory configuration is all-RAM
|
||||||
;
|
;
|
||||||
;The subroutines use these variables in RAM, same area as ROM monitor:
|
;The subroutines use these variables in RAM, same area as ROM monitor:
|
||||||
current_location: equ 0x7100 ;word variable in RAM
|
current_location: equ 0xE100 ;word variable in RAM
|
||||||
line_count: equ 0x7102 ;byte variable in RAM
|
line_count: equ 0xE102 ;byte variable in RAM
|
||||||
byte_count: equ 0x7103 ;byte variable in RAM
|
byte_count: equ 0xE103 ;byte variable in RAM
|
||||||
value_pointer: equ 0x7104 ;word variable in RAM
|
value_pointer: equ 0xE104 ;word variable in RAM
|
||||||
current_value: equ 0x7106 ;word variable in RAM
|
current_value: equ 0xE106 ;word variable in RAM
|
||||||
buffer: equ 0x7108 ;buffer in RAM -- up to stack area
|
buffer: equ 0xE108 ;buffer in RAM -- up to stack area
|
||||||
;Will use stack of calling program (CP/M) which is re-initialized at re-boot.
|
;Will use stack of calling program (CP/M) which is re-initialized at re-boot.
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
@ -21,12 +21,12 @@ buffer: equ 0x7108 ;buffer in RAM -- up to stack area
|
||||||
#code BOOT, 0x0100
|
#code BOOT, 0x0100
|
||||||
ld hl,code_origin ;start of code to transfer
|
ld hl,code_origin ;start of code to transfer
|
||||||
ld bc,code_end-code_start+1 ;length of code to transfer
|
ld bc,code_end-code_start+1 ;length of code to transfer
|
||||||
ld de,07200h ;target of transfer
|
ld de,0E200h ;target of transfer
|
||||||
ldir ;Z80 transfer instruction
|
ldir ;Z80 transfer instruction
|
||||||
jp 07200h
|
jp 0E200h
|
||||||
code_origin: ;address of first byte of code before transfer
|
code_origin: ;address of first byte of code before transfer
|
||||||
;
|
;
|
||||||
#code MAIN, 0x7200
|
#code MAIN, 0xE200
|
||||||
code_start: jp monitor_start
|
code_start: jp monitor_start
|
||||||
;
|
;
|
||||||
;Puts a single char (byte value) on serial output
|
;Puts a single char (byte value) on serial output
|
||||||
|
@ -54,10 +54,10 @@ write_string: in a,(3) ;read status
|
||||||
;
|
;
|
||||||
;Binary loader. Receive a binary file, place in memory.
|
;Binary loader. Receive a binary file, place in memory.
|
||||||
;Address of load passed in HL, length of load (= file length) in BC
|
;Address of load passed in HL, length of load (= file length) in BC
|
||||||
bload: in a,(3) ;get status
|
bload: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,bload ;not ready, loop
|
jp z,bload ;not ready, loop
|
||||||
in a,(2)
|
in a,(0x1E)
|
||||||
ld (hl),a
|
ld (hl),a
|
||||||
inc hl
|
inc hl
|
||||||
dec bc ;byte counter
|
dec bc ;byte counter
|
||||||
|
@ -91,10 +91,10 @@ get_line: ld c,000h ;line position
|
||||||
ld d,a ;after this don't need to preserve hl
|
ld d,a ;after this don't need to preserve hl
|
||||||
ld a,l ;subroutines called don't use de
|
ld a,l ;subroutines called don't use de
|
||||||
ld e,a
|
ld e,a
|
||||||
get_line_next_char: in a,(3) ;get status
|
get_line_next_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_line_next_char ;not ready, loop
|
jp z,get_line_next_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
cp 00dh ;check if return
|
cp 00dh ;check if return
|
||||||
ret z ;yes, normal exit
|
ret z ;yes, normal exit
|
||||||
cp 07fh ;check if backspace (VT102 keys)
|
cp 07fh ;check if backspace (VT102 keys)
|
||||||
|
@ -378,10 +378,10 @@ load_done: call write_newline
|
||||||
;
|
;
|
||||||
;Get one ASCII character from the serial port.
|
;Get one ASCII character from the serial port.
|
||||||
;Returns with char in A reg. No error checking.
|
;Returns with char in A reg. No error checking.
|
||||||
get_char: in a,(3) ;get status
|
get_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_char ;not ready, loop
|
jp z,get_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
ret
|
ret
|
||||||
;
|
;
|
||||||
;Subroutine to start a new line
|
;Subroutine to start a new line
|
||||||
|
|
16
src/bios.z80
16
src/bios.z80
|
@ -1,8 +1,8 @@
|
||||||
; skeletal cbios for first level of CP/M 2.0 alteration
|
; skeletal cbios for first level of CP/M 2.0 alteration
|
||||||
;
|
;
|
||||||
ccp: equ 6400h ;base of ccp
|
ccp: equ 0E400h ;base of ccp
|
||||||
bdos: equ 6C06h ;bdos entry
|
bdos: equ 0EC06h ;bdos entry
|
||||||
bios: equ 7A00h ;base of bios
|
bios: equ 0FA00h ;base of bios
|
||||||
cdisk: equ 0004h ;address of current disk number 0=a,... l5=p
|
cdisk: equ 0004h ;address of current disk number 0=a,... l5=p
|
||||||
iobyte: equ 0003h ;intel i/o byte
|
iobyte: equ 0003h ;intel i/o byte
|
||||||
disks: equ 04h ;number of disks in the system
|
disks: equ 04h ;number of disks in the system
|
||||||
|
@ -180,8 +180,8 @@ diskok: LD c, a ;send to the ccp
|
||||||
; to insert your own code
|
; to insert your own code
|
||||||
;
|
;
|
||||||
const: ;console status, return 0ffh if character ready, 00h if not
|
const: ;console status, return 0ffh if character ready, 00h if not
|
||||||
in a,(3) ;get status
|
in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,no_char
|
jp z,no_char
|
||||||
ld a,0ffh ;char ready
|
ld a,0ffh ;char ready
|
||||||
ret
|
ret
|
||||||
|
@ -189,10 +189,10 @@ no_char:ld a,00h ;no char
|
||||||
ret
|
ret
|
||||||
;
|
;
|
||||||
conin: ;console character into register a
|
conin: ;console character into register a
|
||||||
in a,(3) ;get status
|
in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,conin ;loop until char ready
|
jp z,conin ;loop until char ready
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
AND 7fh ;strip parity bit
|
AND 7fh ;strip parity bit
|
||||||
ret
|
ret
|
||||||
;
|
;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
; Set memory limit here. This is the amount of contigeous
|
; Set memory limit here. This is the amount of contigeous
|
||||||
; ram starting from 0000. CP/M will reside at the end of this space.
|
; ram starting from 0000. CP/M will reside at the end of this space.
|
||||||
;
|
;
|
||||||
MEM EQU 32 ;for a 62k system (TS802 TEST - WORKS OK).
|
MEM EQU 64 ;for a 62k system (TS802 TEST - WORKS OK).
|
||||||
;
|
;
|
||||||
IOBYTE EQU 3 ;i/o definition byte.
|
IOBYTE EQU 3 ;i/o definition byte.
|
||||||
TDRIVE EQU 4 ;current drive name and user number.
|
TDRIVE EQU 4 ;current drive name and user number.
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
hstbuf equ 0x1200 ;will put 256-byte raw sector here
|
hstbuf equ 0x1200 ;will put 256-byte raw sector here
|
||||||
disk_read equ 0x0296 ;subroutine in 2K ROM
|
disk_read equ 0x0296 ;subroutine in 2K ROM
|
||||||
cpm equ 0x7A00 ;CP/M cold start entry in BIOS
|
cpm equ 0xFA00 ;CP/M cold start entry in BIOS
|
||||||
|
|
||||||
main:
|
main:
|
||||||
ld c,1 ;LBA bits 0 to 7
|
ld c,1 ;LBA bits 0 to 7
|
||||||
ld b,0 ;LBA bits 8 to 15
|
ld b,0 ;LBA bits 8 to 15
|
||||||
ld e,0 ;LBA bits 16 to 23
|
ld e,0 ;LBA bits 16 to 23
|
||||||
ld hl,0x6400 ; Memory address -- start of CCP
|
ld hl,0xE400 ; Memory address -- start of CCP
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
call disk_read ;subroutine in ROM
|
call disk_read ;subroutine in ROM
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#target bin
|
#target bin
|
||||||
#code _HOME, 0x1400
|
#code _HOME, 0x1400
|
||||||
|
|
||||||
_bios equ 0x7A00
|
_bios equ (0x4A00+0xB000)
|
||||||
seldsk equ _bios+0x1b
|
seldsk equ _bios+0x1b
|
||||||
settrk equ _bios+0x1e
|
settrk equ _bios+0x1e
|
||||||
setsec equ _bios+0x21
|
setsec equ _bios+0x21
|
||||||
|
|
|
@ -43,10 +43,10 @@ write_string: in a,(3) ;read status
|
||||||
;
|
;
|
||||||
;Binary loader. Receive a binary file, place in memory.
|
;Binary loader. Receive a binary file, place in memory.
|
||||||
;Address of load passed in HL, length of load (= file length) in BC
|
;Address of load passed in HL, length of load (= file length) in BC
|
||||||
bload: in a,(3) ;get status
|
bload: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,bload ;not ready, loop
|
jp z,bload ;not ready, loop
|
||||||
in a,(2)
|
in a,(0x1E)
|
||||||
ld (hl),a
|
ld (hl),a
|
||||||
inc hl
|
inc hl
|
||||||
dec bc ;byte counter
|
dec bc ;byte counter
|
||||||
|
@ -80,10 +80,10 @@ get_line: ld c,000h ;line position
|
||||||
ld d,a ;after this don't need to preserve hl
|
ld d,a ;after this don't need to preserve hl
|
||||||
ld a,l ;subroutines called don't use de
|
ld a,l ;subroutines called don't use de
|
||||||
ld e,a
|
ld e,a
|
||||||
get_line_next_char: in a,(3) ;get status
|
get_line_next_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_line_next_char ;not ready, loop
|
jp z,get_line_next_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
cp 00dh ;check if return
|
cp 00dh ;check if return
|
||||||
ret z ;yes, normal exit
|
ret z ;yes, normal exit
|
||||||
cp 07fh ;check if backspace (VT102 keys)
|
cp 07fh ;check if backspace (VT102 keys)
|
||||||
|
@ -367,10 +367,10 @@ load_done: call write_newline
|
||||||
;
|
;
|
||||||
;Get one ASCII character from the serial port.
|
;Get one ASCII character from the serial port.
|
||||||
;Returns with char in A reg. No error checking.
|
;Returns with char in A reg. No error checking.
|
||||||
get_char: in a,(3) ;get status
|
get_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_char ;not ready, loop
|
jp z,get_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
ret
|
ret
|
||||||
;
|
;
|
||||||
;Subroutine to start a new line
|
;Subroutine to start a new line
|
||||||
|
|
|
@ -57,10 +57,10 @@ write_string: in a,(3) ;read status
|
||||||
;
|
;
|
||||||
;Binary loader. Receive a binary file, place in memory.
|
;Binary loader. Receive a binary file, place in memory.
|
||||||
;Address of load passed in HL, length of load (= file length) in BC
|
;Address of load passed in HL, length of load (= file length) in BC
|
||||||
bload: in a,(3) ;get status
|
bload: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,bload ;not ready, loop
|
jp z,bload ;not ready, loop
|
||||||
in a,(2)
|
in a,(0x1E)
|
||||||
ld (hl),a
|
ld (hl),a
|
||||||
inc hl
|
inc hl
|
||||||
dec bc ;byte counter
|
dec bc ;byte counter
|
||||||
|
@ -94,10 +94,10 @@ get_line: ld c,000h ;line position
|
||||||
ld d,a ;after this don't need to preserve hl
|
ld d,a ;after this don't need to preserve hl
|
||||||
ld a,l ;subroutines called don't use de
|
ld a,l ;subroutines called don't use de
|
||||||
ld e,a
|
ld e,a
|
||||||
get_line_next_char: in a,(3) ;get status
|
get_line_next_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_line_next_char ;not ready, loop
|
jp z,get_line_next_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
cp 00dh ;check if return
|
cp 00dh ;check if return
|
||||||
ret z ;yes, normal exit
|
ret z ;yes, normal exit
|
||||||
cp 07fh ;check if backspace (VT102 keys)
|
cp 07fh ;check if backspace (VT102 keys)
|
||||||
|
@ -381,10 +381,10 @@ load_done: call write_newline
|
||||||
;
|
;
|
||||||
;Get one ASCII character from the serial port.
|
;Get one ASCII character from the serial port.
|
||||||
;Returns with char in A reg. No error checking.
|
;Returns with char in A reg. No error checking.
|
||||||
get_char: in a,(3) ;get status
|
get_char: in a,(0x1F) ;get status
|
||||||
and 002h ;check RxRDY bit
|
and 001h ;check RxRDY bit
|
||||||
jp z,get_char ;not ready, loop
|
jp z,get_char ;not ready, loop
|
||||||
in a,(2) ;get char
|
in a,(0x1E) ;get char
|
||||||
ret
|
ret
|
||||||
;
|
;
|
||||||
;Subroutine to start a new line
|
;Subroutine to start a new line
|
||||||
|
|
Loading…
Reference in New Issue
Block a user