diff options
author | H. Peter Anvin <hpa@zytor.com> | 2014-05-08 08:42:37 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2014-05-08 09:21:08 -0700 |
commit | b0419bb69cea60ed2d8d9ae5a521480c88f2148d (patch) | |
tree | f7990e60cfff4ac4ded8607ead2403617e4159da | |
parent | 497749ec787feb4d03fe66bde6c94e338afbac14 (diff) | |
download | abc80-b0419bb69cea60ed2d8d9ae5a521480c88f2148d.tar.gz abc80-b0419bb69cea60ed2d8d9ae5a521480c88f2148d.tar.xz abc80-b0419bb69cea60ed2d8d9ae5a521480c88f2148d.zip |
data: Add a minimal CP/M loader
CP/M is assumed to live at the immediate beginning of HD volume 4.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | data/Makefile | 9 | ||||
-rw-r--r-- | data/cpm.asm | 76 |
2 files changed, 83 insertions, 2 deletions
diff --git a/data/Makefile b/data/Makefile index aee528d..c11fe5a 100644 --- a/data/Makefile +++ b/data/Makefile @@ -9,7 +9,7 @@ Z80ASM = ../tools/z80asm/z80asm all : keyboard.mif abc80rom.bin basic80.mif \ mmu.mif chargen.mif videoram.mif fgcol.mif sddrom.mif \ - abcsefi.bas abcdkno.bas abcintl.bas + abcsefi.bas abcdkno.bas abcintl.bas cpm.bas abc80rom.bin : buildrom.pl abcbasic.rom ufddos.bin printer.bin $(PERL) buildrom.pl $@ 32768 \ @@ -56,8 +56,13 @@ chargen.mif : chargen.bin $(BIN2MIF) videoram.bin: video.txt genvideo.pl $(PERL) genvideo.pl -40 < $< > $@ || ( rm -f $@ ; exit 1 ) +cpm.bas: cpm.bin + $(PERL) bin2poke.pl $< 32768 1 'Z%=CALL(32768%)' > $@ \ + || ( rm -f $@ ; exit 1 ) + .bin.bas: - $(PERL) bin2poke.pl $< 16384 100 RETURN | cat charpoke.bah - > $@ || ( rm -f $@ ; exit 1 ) + $(PERL) bin2poke.pl $< 16384 100 RETURN | cat charpoke.bah - > $@ \ + || ( rm -f $@ ; exit 1 ) abcsefi.bin : $(FONT) bdf2bin.pl $(PERL) bdf2bin.pl abcsefi $(SIZES) < $< > $@ || ( rm -f $@ ; exit 1 ) diff --git a/data/cpm.asm b/data/cpm.asm new file mode 100644 index 0000000..1830775 --- /dev/null +++ b/data/cpm.asm @@ -0,0 +1,76 @@ +; ----------------------------------------------------------------------- +; +; Copyright 2014 H. Peter Anvin - All Rights Reserved +; +; This program is free software; you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +; Boston MA 02110-1301, USA; either version 2 of the License, or +; (at your option) any later version; incorporated herein by reference. +; +; ----------------------------------------------------------------------- + +; +; CP/M loader for ABC80-DE1 +; +HDSEL: equ 36 +RAMSIZE: equ 64 +BIAS: equ (64-20)*1024 +CPMADDR: equ BIAS+3400h +CPMBIOS: equ BIAS+4A00h +CPMSECTS: equ 50/2 ; Total number of ABC sectors (@256b) + + org 08000h +_start: + di + ld a,7 ; Map 3, NMI disabled + out (7),a + + ld a,HDSEL + out (1),a + + ld hl,CPMADDR + ld sp,hl + xor a + ld e,a ; Current sector + +get_sect: + out (2),a ; Start command + +wait_ready: + in a,(1) ; Status port + rlca + jr nc,wait_ready + + ld a,3 ; READ SECTOR + SECTOR TO HOST + call out_wait_ok + + ld a,4 ; Unit 4, buffer 0, 256 byte sector + call out_wait_ok + + xor a ; Track 0 + call out_wait_ok + + ld a,e ; Sector number + inc e + call out_wait_ok + + xor a + ld b,a ; 256 bytes + ld c,a ; Port 0 + inir + + ld a,CPMSECTS + cp e + jr nz,get_sect + + in a,(7) ; Bus reset + jp CPMBIOS + +out_wait_ok: + out (0),a +wait_ok: + in a,(1) + rrca + ret c + jr wait_ok |