├── README.md ├── cpm8k ├── .gitignore ├── Makefile ├── README.md ├── bios.s ├── biosboot.s ├── bioscall1.s ├── bioscall2.s ├── bioscall3.s ├── bioscall4.s ├── biosdef.s ├── biosif.s ├── biosmem.s ├── biostrap.s ├── cpm8k-1.png ├── cpmsys.o ├── cpmsys.rel ├── cpmsys.x ├── diska │ └── diska.txt ├── diskb │ └── diskb.txt ├── diskc │ └── diskc.txt ├── diskd │ └── diskd.txt ├── diskdefs ├── diskio.s ├── fpe.o ├── fpedep.o ├── libcpm.a ├── packages │ ├── README │ └── base │ │ ├── ar8k.z8k │ │ ├── asz8k.pd │ │ ├── asz8k.z8k │ │ ├── basepa.h │ │ ├── bdos.h │ │ ├── cpm.h │ │ ├── ctype.h │ │ ├── ddt.z8k │ │ ├── dump.z8k │ │ ├── ed.z8k │ │ ├── errno.h │ │ ├── ld8k.z8k │ │ ├── libcpm.a │ │ ├── nmz8k.z8k │ │ ├── opt.c │ │ ├── opt1.c │ │ ├── option.h │ │ ├── pip.z8k │ │ ├── portab.h │ │ ├── setjmp.h │ │ ├── signal.h │ │ ├── sizez8k.z8k │ │ ├── startup.8kn │ │ ├── startup.o │ │ ├── stat.z8k │ │ ├── stdio.h │ │ ├── unstds.h │ │ ├── xcon.z8k │ │ ├── xdump.z8k │ │ ├── zcc.z8k │ │ ├── zcc1.z8k │ │ ├── zcc2.z8k │ │ └── zcc3.z8k ├── put.s └── z8530.s ├── schematic ├── README.md ├── Z8001MB-cpu.pdf ├── Z8001MB-iodev.pdf ├── Z8001MB-memory.pdf ├── Z8001MB.JPG └── Z8KMMAP.PLD └── z8kboot ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── booter.c ├── sio.c ├── sio.h ├── z8001macro.h ├── z8kmon ├── Makefile ├── conio.s ├── cpu.s ├── dcmnd.s ├── gcmnd.s ├── ide.s ├── iocmnd.s ├── lcmnd.s ├── scmnd.s ├── z8001mb.x ├── z8530.s ├── z8kmon.s └── zcmnd.s └── z8kmonimg.h /README.md: -------------------------------------------------------------------------------- 1 | # Z8001MB - Building CP/M-8000 Machine Project 2 | **Zilog Z8001 Microprocessor Board and CP/M-8000 porting** 3 | This board is designed to run CP/M-8000 released by Digital Research in 1984. It runs at 6MHz clock speed, and has 256k bytes SRAM, two serial ports, and one 8 bit IDE interface to connect CF memory card. This board has a simple memory mapping hardware in a CPLD to split I/D spaces. It makes possible to run CP/M-8000 commands, such as assembler and C compiler. 4 | 5 | ## In the directories 6 | ## schematic 7 | **Circuit diagrams of the Z8001MB** 8 | Three PDFs shows circuit diagrams of CPU, memory, memory mapping logic and interfaces. 9 | 10 | **My had-wired borad** 11 | ![Z8001MB](./schematic/Z8001MB.JPG) 12 | 13 | ## z8kboot 14 | **Boot program and machine code monitor for Z8001** 15 | The boot program runs on ATMEGA165P after resetting, and transfers a machine code monitor to the SRAM. The machine code monitor is written in assembly language, GNU AS. 16 | 17 | ## cpm8k 18 | **CP/M-8000 BIOS for Z8001MB** 19 | The original CP/M-8000 BIOS was written in C language. But it makes hard to implement BIOS on other machines without running CP/M-8000. So, I wrote a BIOS with GNU assembler under Linux, converted the CP/M-8000 object file and libraries to COFF object format, and linked them with GNU linker. It makes easy to buid CP/M-8000 system. 20 | 21 | **Running CP/M-8000** 22 | ![cpm8k](./cpm8k/cpm8k-1.png) 23 | 24 | ## NEW 25 | 01 Aug 2022 : FPU emulation is linked to CP/M-8000 BIOS 26 | 04 Aug 2022 : Add devpack.zip in cpm8k/diska. This file contains developping tools from Digital Research. 27 | 13 Aug 2022 : Remove devpack.zip, and move files contained in devpack.zip into packages directory. 28 | -------------------------------------------------------------------------------- /cpm8k/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.swp 3 | *.img 4 | *.bin 5 | cpm8k 6 | 7 | !fpe.o 8 | !fpedep.o 9 | !startup.o 10 | -------------------------------------------------------------------------------- /cpm8k/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for cpm8k 2 | 3 | AS = z8k-coff-as 4 | LD = z8k-coff-ld 5 | OBJCOPY = z8k-coff-objcopy 6 | 7 | .SUFFIXES: .o .s 8 | 9 | objs = biosboot.o biosif.o biostrap.o biosmem.o\ 10 | bios.o bioscall1.o bioscall2.o bioscall3.o bioscall4.o\ 11 | z8530.o diskio.o put.o\ 12 | 13 | .PHONY: all 14 | all: cpm8k.bin 15 | 16 | cpm8k.bin: $(objs) biosdef.s cpmsys.o libcpm.a cpmsys.x 17 | $(LD) -mz8002 -T cpmsys.x -L./ -o cpm8k $(objs) cpmsys.o fpe.o fpedep.o -lcpm 18 | $(OBJCOPY) -S -O binary cpm8k cpm8k.bin 19 | 20 | .s.o: 21 | $(AS) -z8002 -o $@ $< 22 | 23 | .PHONY: dskimg 24 | dskimg: 25 | mkfs.cpm -f cpm8k -b cpm8k.bin diska.img 26 | cpmcp -f cpm8k diska.img diska/*.* 0: 27 | mkfs.cpm -f cpm8k diskb.img 28 | cpmcp -f cpm8k diskb.img diskb/*.* 0: 29 | mkfs.cpm -f cpm8k diskc.img 30 | cpmcp -f cpm8k diskc.img diskc/*.* 0: 31 | mkfs.cpm -f cpm8k diskd.img 32 | cpmcp -f cpm8k diskd.img diskd/*.* 0: 33 | dd if=diska.img of=disk.img count=16384 bs=512 conv=notrunc 34 | dd if=diskb.img of=disk.img count=16384 bs=512 seek=16384 conv=notrunc 35 | dd if=diskc.img of=disk.img count=16384 bs=512 seek=32768 conv=notrunc 36 | dd if=diskd.img of=disk.img count=16384 bs=512 seek=49152 conv=notrunc 37 | 38 | .PHONY: clean 39 | clean: 40 | $(RM) -f cpm8k cpm8k.bin cpm8k.hex $(objs) *.img 41 | -------------------------------------------------------------------------------- /cpm8k/README.md: -------------------------------------------------------------------------------- 1 | # CP/M-8000 2 | 3 | ![CPM8k](./cpm8k-1.png) 4 | 5 | This directory includes CP/M-8000 BIOS source codes for the Z8001MB and COFF-converted object files releaced by Digital Research. You can build your own CP/M-8000 system by cross assembling on Linux and Windows. To build CP/M-8000 system you need GNU tools and set up them before. 6 | 7 | ## Preparation 8 | * Download GNU Binutils and buid it with **--target==z8k-coff** option. I use GNU Binutils 2.34. 9 | * Download **CP/M-8000 1.1** in [Digital Research Source Code](http://www.cpm.z80.de/source.html) and unzip it. There are 4 disk images containing CP/M commands in the ZIP file. You can skip this step if you don't need. 10 | * Install cpmtools package, and append the **diskdefs** in the cpm8k directory to **/etc/cpmtools/diskdefs**. 11 | 12 | ## Build and make a boot disk image 13 | * Type **make** in the cpm8k directory. 14 | * Chose files in packages/, and copy them into diska/b/c/d directories. 15 | * Type **make dskimg** 16 | * Write **disk.img** to a boot device with **dd** command. 17 | 18 | ``` 19 | In the cpm8k directory 20 | $ make 21 | $ cp packages/base/*.* diska/ 22 | $ make dskmg 23 | $ sudo dd if=disk.img.bin of=/dev/sd? 24 | ``` 25 | **"sd?"** is your device to write the boot disk image. 26 | Execute **dd** with care. Do not set a wrong device for **"of"**. 27 | 28 | 29 | ## License 30 | cpmsys.rel, cpmsys.o, libcpm.a and files in packages/base - These files by Digital Resarch. See "The Unofficial CP/M Web Site" 31 | others - MIT License 32 | -------------------------------------------------------------------------------- /cpm8k/bios.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! bios.s 3 | ! CP/M-8000 BIOS Main 4 | ! This BIOS was written based on Digital Research CP/M-8000 BIOS 5 | ! 6 | ! Copyright (c) 2020, 4sun5bu 7 | !------------------------------------------------------------------------------ 8 | 9 | .extern sysinit initscc, disk_init, puts 10 | .extern func0, func1, func2, func3, func4 11 | .extern func5, func6, func7, func8, func9 12 | .extern func10, func11, func12, func13, func14 13 | .extern func15, func16, func17, func18, func19 14 | .extern func20, func21, func22 15 | .extern secbvalid, secbdirty 16 | 17 | .global biosinit, biosentry 18 | .global _sysseg, _usrseg, _sysstk, _psap, _trapvec 19 | .global iobyte 20 | 21 | .include "biosdef.s" 22 | 23 | unsegm 24 | sect .text 25 | 26 | biosinit: 27 | clr secbLBA 28 | clr secbLBA + 2 29 | clrb secbvalid 30 | clrb secbdirty 31 | ret 32 | 33 | biosentry: 34 | cp r3, #22 35 | jr gt, false 36 | sll r3, #1 37 | ld r1, biostbl(r3) 38 | jp @r1 39 | false: 40 | ret 41 | 42 | !------------------------------------------------------------------------------ 43 | ! BIOS Jump Table 44 | 45 | sect .data 46 | .even 47 | 48 | biostbl: 49 | .word func0 50 | .word func1 51 | .word func2 52 | .word func3 53 | .word func4 54 | .word func5 55 | .word func6 56 | .word func7 57 | .word func8 58 | .word func9 59 | .word func10 60 | .word func11 61 | .word func12 62 | .word func13 63 | .word func14 64 | .word func15 65 | .word func16 66 | .word func17 67 | .word func18 68 | .word func19 69 | .word func20 70 | .word func21 71 | .word func22 72 | 73 | !------------------------------------------------------------------------------ 74 | sect .data 75 | iobyte: 76 | .word 0 77 | 78 | !------------------------------------------------------------------------------ 79 | 80 | sect .bss 81 | .even 82 | 83 | _sysseg: 84 | .space 2 ! system segment 85 | _usrseg: 86 | .space 2 ! user segment 87 | _sysstk: 88 | .space 4 ! system stack pointer 89 | _psap: 90 | .space 4 ! program status area ptr 91 | 92 | _trapvec: 93 | .space NTRAPS * 4 94 | -------------------------------------------------------------------------------- /cpm8k/biosboot.s: -------------------------------------------------------------------------------- 1 | ! ******** biosboot.8kn for cpm.sys + cpmldr.sys***** 2 | ! * Copyright 1984, Digital Research Inc. 3 | ! * 4 | ! * 821013 S. Savitzky (Zilog) -- adapt for nonseg. 5 | ! * 820930 S. Savitzky (Zilog) -- created 6 | ! * 840813 R. Weiser (DRI) -- conditional assembly 7 | ! * 8 | ! * 20200229 4sun5bu -- modified for assembling with GNU as 9 | ! * 10 | ! **************************************************** 11 | 12 | sect .text 13 | unsegm 14 | 15 | ! **************************************************** 16 | ! * 17 | ! * NOTE -- THIS CODE IS HIGHLY SYSTEM-DEPENDENT 18 | ! * 19 | ! * This module contains both the bootstrap 20 | ! * writer, and the code that receives control 21 | ! * after being booted. 22 | ! * 23 | ! * The main function of the latter is to make 24 | ! * sure that the system, whose entry point is 25 | ! * called "bios", is passed a valid stack 26 | ! * and PSA pointer. 27 | ! * 28 | ! * Although this code runs segmented, it must 29 | ! * be linked with non-segmented code, so it 30 | ! * looks rather odd. 31 | ! * 32 | ! **************************************************** 33 | 34 | 35 | ! **************************************************** 36 | ! * 37 | ! * Globl and external 38 | ! * 39 | ! **************************************************** 40 | 41 | .global entry, _start 42 | 43 | ! **************************************************** 44 | ! * 45 | ! * Externals 46 | ! * 47 | ! **************************************************** 48 | 49 | .extern psa 50 | .extern _bss_top, _bss_end ! Decleared in the linker script 51 | 52 | ! **************************************************** 53 | ! * 54 | ! * Constants 55 | ! * 56 | ! **************************************************** 57 | 58 | .equ SYSTEM, 0x03000000 ! system address 59 | .equ SYSSTK, (SYSTEM + 0x0BFFE) ! system stack top 60 | 61 | ! **************************************************** 62 | ! * 63 | ! * Entry Points and post-boot Initialization 64 | ! * 65 | ! **************************************************** 66 | 67 | _start: ! suppress linker warning 68 | entry: 69 | ! segmented mode 70 | di vi, nvi 71 | 72 | ldl rr2, #_bss_top ! Clear BSS Region 73 | ldl rr4, #_bss_end 74 | sub r5, r3 75 | inc r5, #1 76 | 1: 77 | clrb @r2 ! clrb @rr2 78 | inc r3, #1 79 | djnz r5, 1b 80 | 81 | ldl rr14, #SYSSTK ! set system stack pointer 82 | 83 | ldl rr2, #psa ! set PSAP 84 | ldctl psapseg, r2 85 | ldctl psapoff, r3 86 | 87 | ldar r2, . ! jump to bios in biosif.s 88 | ld r3, #bios 89 | jp @r2 90 | -------------------------------------------------------------------------------- /cpm8k/bioscall1.s: -------------------------------------------------------------------------------- 1 | ! ----------------------------------------------------------------------------- 2 | ! CP/M-8000 BIOS func0, 1 3 | ! 4 | ! Copyright (c) 2020, 4sun5bu 5 | !------------------------------------------------------------------------------ 6 | 7 | .extern biosinit, _wboot 8 | 9 | .global bios, func0, func1 10 | 11 | unsegm 12 | sect .text 13 | 14 | !------------------------------------------------------------------------------ 15 | ! func0 16 | ! Initialization 17 | 18 | func0: 19 | call biosinit 20 | clr r7 21 | 22 | ret 23 | !------------------------------------------------------------------------------ 24 | ! func1 25 | ! Warm Boot 26 | 27 | func1: 28 | call _wboot 29 | ret 30 | -------------------------------------------------------------------------------- /cpm8k/bioscall2.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! CP/M-8000 BIOS func2-7 3 | ! 4 | ! Copyright (c) 2020, 4sun5bu 5 | !------------------------------------------------------------------------------ 6 | 7 | .extern scc_in, scc_out, scc_status, dbgbc 8 | 9 | .global func2, func3, func4, func5, func6, func7 10 | 11 | unseg 12 | sect .text 13 | 14 | !------------------------------------------------------------------------------ 15 | ! func2 16 | ! Console Status 17 | 18 | func2: 19 | jp scc_status 20 | 21 | !------------------------------------------------------------------------------ 22 | ! func3 23 | ! Read Console Character Input 24 | 25 | func3: 26 | jp scc_in 27 | 28 | !------------------------------------------------------------------------------ 29 | ! func4 30 | ! Write Console Character Output 31 | 32 | func4: 33 | jp scc_out 34 | 35 | !------------------------------------------------------------------------------ 36 | ! func5 37 | ! List Charactor Output 38 | 39 | func5: 40 | ret 41 | 42 | !------------------------------------------------------------------------------ 43 | ! func6 44 | ! Auxialiary Output 45 | 46 | func6: 47 | ret 48 | 49 | !------------------------------------------------------------------------------ 50 | ! func7 51 | ! Auxialiary Input 52 | 53 | func7: 54 | ret 55 | -------------------------------------------------------------------------------- /cpm8k/bioscall3.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! CP/M-8000 BIOS func8-14, 16, 21 3 | ! 4 | ! Copyright (c) 2020, 4sun5bu 5 | !------------------------------------------------------------------------------ 6 | 7 | .extern setsec, settrk, dphtbl, dbgbc, setdsk, setdma 8 | .extern _sysseg, puthex16, putln, putsp, scc_out 9 | 10 | .global func8, func9, func10, func11, func12 11 | .global func13, func14, func16, func21, flush 12 | .global secbLBA, secbvalid, secbdirty 13 | 14 | .include "biosdef.s" 15 | 16 | unsegm 17 | sect .text 18 | 19 | !------------------------------------------------------------------------------ 20 | ! func8 21 | ! Home 22 | 23 | func8: 24 | ld settrk, #0 25 | ret 26 | 27 | !------------------------------------------------------------------------------ 28 | ! func9 29 | ! Select Disk Drive 30 | 31 | func9: 32 | cp r5, #MAXDSK 33 | jr nc, 1f 34 | ld setdsk, r5 35 | sll r5, #4 36 | lda r7, dphtbl(r5) 37 | ld r6, _sysseg 38 | ret 39 | 1: 40 | clr r6 41 | clr r7 42 | ret 43 | 44 | !------------------------------------------------------------------------------ 45 | ! func10 46 | ! Set Track 47 | 48 | func10: 49 | ld settrk, r5 50 | ret 51 | 52 | !------------------------------------------------------------------------------ 53 | ! func11 54 | ! Set Sector 55 | 56 | func11: 57 | ld setsec, r5 58 | ret 59 | 60 | !------------------------------------------------------------------------------ 61 | ! func12 62 | ! Set DMA Address 63 | 64 | func12: 65 | ldl setdma, rr4 66 | ret 67 | 68 | !------------------------------------------------------------------------------ 69 | ! func13 70 | ! Read Sector 71 | 72 | func13: 73 | call convLBA 74 | cpl rr2, secbLBA 75 | jr ne, 1f 76 | testb secbvalid 77 | jr nz, 2f 78 | 1: 79 | pushl @r15, rr2 ! read the sector into the buffer 80 | call flush 81 | popl rr2, @r15 82 | ldl secbLBA, rr2 83 | lda r4, secbuf 84 | call diskrd 85 | ldb secbvalid, #1 86 | 2: 87 | ld r1, setsec 88 | and r1, #0x0003 89 | sll r1, #7 ! 128x 90 | lda r7, secbuf(r1) 91 | ld r6, _sysseg ! rr6 - secbuf address 92 | ldl rr4, setdma ! rr4 - DMA address 93 | ld r3, #SECSZ 94 | SEG 95 | ldirb @r4, @r6, r3 ! data copy to the DMA 96 | NONSEG 97 | clrb secbdirty 98 | clr r7 99 | ret 100 | 101 | !------------------------------------------------------------------------------ 102 | ! func14 103 | ! Write Sector 104 | 105 | func14: 106 | push @r15, r5 107 | call convLBA 108 | cpl rr2, secbLBA 109 | jr ne, 1f 110 | testb secbvalid 111 | jr nz, 2f 112 | 1: 113 | pushl @r15, rr2 ! read the sector into the buffer 114 | call flush 115 | popl rr2, @r15 116 | ldl secbLBA, rr2 117 | lda r4, secbuf 118 | call diskrd 119 | ldb secbvalid, #1 120 | 2: 121 | ld r1, setsec 122 | and r1, #0x0003 123 | sll r1, #7 ! 128x 124 | lda r7, secbuf(r1) 125 | ld r6, _sysseg ! rr6 - secbuf address 126 | ldl rr4, setdma 127 | ld r3, #SECSZ 128 | SEG 129 | ldirb @r6, @r4, r3 130 | NONSEG 131 | ldb secbdirty, #1 132 | pop r5, @r15 133 | cp r5, #1 134 | jr ne, 3f 135 | call flush 136 | 3: 137 | clr r7 138 | ret 139 | 140 | !------------------------------------------------------------------------------ 141 | ! func16 142 | ! Sector Transrate 143 | 144 | func16: 145 | testl rr6 146 | jr z, 1f 147 | SEG 148 | ldb rl7, r6(r5) ! ldb rl7, rr6(r5) 149 | clrb rh7 150 | NONSEG 151 | ret 152 | 1: 153 | ld r7, r5 154 | ret 155 | 156 | !------------------------------------------------------------------------------ 157 | ! func21 158 | ! Flush Buffer 159 | 160 | func21: 161 | call flush 162 | clr r7 163 | ret 164 | 165 | !------------------------------------------------------------------------------ 166 | ! flush 167 | ! write back the secbuf to the disk 168 | 169 | flush: 170 | testb secbdirty 171 | ret z ! not modified 172 | testb secbvalid 173 | ret z ! not valid 174 | ldl rr2, secbLBA 175 | lda r4, secbuf 176 | call diskwr 177 | clrb secbdirty 178 | clrb secbvalid 179 | ret 180 | 181 | !------------------------------------------------------------------------------ 182 | ! convLBA 183 | ! Convert secter and track to LBA 184 | ! input : (settrk), (setsec) and (setdsk) 185 | ! return : rr2 - LBA 186 | ! convert to 00000000-000000dd-ddtttttt-tttsssss 187 | 188 | convLBA: 189 | ld r3, settrk 190 | sll r3, #5 191 | ld r2, setsec 192 | srl r2, #2 193 | add r3, r2 194 | and r3, #0x3fff 195 | ld r2, setdsk 196 | sll r2, #14 197 | add r3, r2 198 | ld r2, setdsk 199 | srl r2, #2 200 | ret 201 | 202 | !------------------------------------------------------------------------------ 203 | sect .data 204 | .even 205 | !------------------------------------------------------------------------------ 206 | ! Sector Translate Table 207 | ! These parameters are based on the CP/M BIOS writen by Mr.Grant's. 208 | ! Refer to "Grant's homebuilt electronics" Web page. 209 | ! http://http://searle.x10host.com/cpm/index.html 210 | 211 | ! Two reserved tracks, for boot disk 212 | dpb0: 213 | .word 128 ! SPT : sectors per track 214 | .byte 5 ! BSH : block shift 215 | .byte 31 ! BLM : block mask 216 | .byte 1 ! EXM : extent mask 217 | .byte 0 ! Dummy 218 | .word 2039 ! DSM : bloks for data 219 | .word 511 ! DRM : size of directory 220 | .byte 0xf0 ! AL0 : directory allocation bitmap 221 | .byte 0 ! AL1 222 | .word 0 ! CKS : checksum 223 | .word 2 ! OFF : Reserved track 224 | 225 | ! Without reserved track, not for boot disk 226 | dpb1: 227 | .word 128 ! SPT : sectors per track 228 | .byte 5 ! BSH : block shift 229 | .byte 31 ! BLM : block mask 230 | .byte 1 ! EXM : extent mask 231 | .byte 0 ! Dummy 232 | .word 2047 ! DSM : bloks for data 233 | .word 511 ! DRM : size of directory 234 | .byte 0xf0 ! AL0 : directory allocation bitmap 235 | .byte 0 ! AL1 236 | .word 0 ! CKS : checksum 237 | .word 0 ! OFF : Reserved track 238 | 239 | !------------------------------------------------------------------------------ 240 | ! Disk parameter header table 241 | 242 | dphtbl: 243 | .word 0, 0, 0, 0, dirbuf, dpb0, csv0, alv0 244 | .word 0, 0, 0, 0, dirbuf, dpb0, csv1, alv1 245 | .word 0, 0, 0, 0, dirbuf, dpb0, csv2, alv2 246 | .word 0, 0, 0, 0, dirbuf, dpb0, csv3, alv3 247 | 248 | !------------------------------------------------------------------------------ 249 | sect .bss 250 | 251 | !------------------------------------------------------------------------------ 252 | ! BDOS Scratchpad Area 253 | 254 | csv0: 255 | .space 128 256 | csv1: 257 | .space 128 258 | csv2: 259 | .space 128 260 | csv3: 261 | .space 128 262 | 263 | alv0: 264 | .space 257 265 | alv1: 266 | .space 257 267 | alv2: 268 | .space 257 269 | alv3: 270 | .space 257 271 | 272 | dirbuf: 273 | .space SECSZ 274 | 275 | dskerr: 276 | .space 2 277 | 278 | !------------------------------------------------------------------------------ 279 | !.space 1024 280 | 281 | setdsk: 282 | .space 2 283 | settrk: 284 | .space 2 285 | setsec: 286 | .space 2 287 | setdma: 288 | .space 4 289 | 290 | !------------------------------------------------------------------------------ 291 | ! sector buffer 292 | ! 293 | secbuf: 294 | .space PSECSZ 295 | 296 | secbLBA: 297 | .space 4 298 | 299 | secbvalid: 300 | .space 1 301 | secbdirty: 302 | .space 1 303 | secbtrk: 304 | .space 2 305 | secbdsk: 306 | .space 2 307 | secbsec: 308 | .space 2 309 | 310 | -------------------------------------------------------------------------------- /cpm8k/bioscall4.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! CP/M-8000 BIOS func 15, 17-20, 22 3 | ! 4 | ! Copyright (c) 2020, 4sun5bu 5 | !------------------------------------------------------------------------------ 6 | 7 | .extern _trapvec, iobyte, dbgbc 8 | 9 | .global func15, func17, func18, func19, func20, func22 10 | 11 | .include "biosdef.s" 12 | 13 | unsegm 14 | sect .text 15 | 16 | !------------------------------------------------------------------------------ 17 | ! func15 18 | ! Retrun LIST Status TODO: Implement 19 | 20 | func15: 21 | clr r7 22 | ret 23 | 24 | !------------------------------------------------------------------------------ 25 | ! func17 26 | ! ??? 27 | 28 | func17: 29 | clr r6 30 | clr r7 31 | ret 32 | 33 | !------------------------------------------------------------------------------ 34 | ! func18 35 | ! Get Memory Region Table Address 36 | 37 | func18: 38 | ld r6, _sysseg 39 | lda r7, memtbl 40 | ret 41 | 42 | !------------------------------------------------------------------------------ 43 | ! func19 44 | ! Get IOBYTE 45 | 46 | func19: 47 | ld r7, iobyte 48 | ret 49 | 50 | !------------------------------------------------------------------------------ 51 | ! func20 52 | ! Set IOBYTE 53 | 54 | func20: 55 | ld iobyte, r5 56 | ret 57 | 58 | !------------------------------------------------------------------------------ 59 | ! func22 60 | ! Set Exception Handler Address 61 | 62 | func22: 63 | sll r5, #2 64 | ldl rr0, _trapvec(r5) 65 | ldl _trapvec(r5), rr6 66 | ldl rr6, rr0 67 | ret 68 | 69 | !------------------------------------------------------------------------------ 70 | sect .data 71 | even 72 | 73 | memtbl: 74 | .if ID_SPLIT == 1 75 | .word 0x05 76 | .long 0x0A000000 ! Region 1 77 | .long 0x00010000 ! merged I and D 78 | .long 0x08000000 ! Region 2 79 | .long 0x00010000 ! separated I 80 | .long 0x08000000 ! Region 3 81 | .long 0x00010000 ! separeted D 82 | .long 0x0B000000 ! Region 4 83 | .long 0x00010000 ! accessing I as D 84 | .long 0x09000000 ! for DDT? 85 | .long 0x00010000 86 | 87 | .else 88 | .word 0x04 89 | .long 0x01000000 ! Region 1 90 | .long 0x00010000 91 | .long 0x00000000 ! Region 2 92 | .long 0x00000000 93 | .long 0x00000000 ! Region 3 94 | .long 0x00000000 95 | .long 0x01000000 ! Region 4 96 | .long 0x00010000 97 | .endif 98 | -------------------------------------------------------------------------------- /cpm8k/biosdef.s: -------------------------------------------------------------------------------- 1 | ! ************ biosdefs.s ****************************************************** 2 | ! * 3 | ! * Assembly language definitions for 4 | ! * CP/M-8000 (tm) BIOS 5 | ! * 6 | ! * 821013 S. Savitzky (Zilog) -- created. 7 | ! * 8 | ! * 20200211 4sun5bu -- modified for assembling with GNU as 9 | 10 | ! ****************************************************************************** 11 | ! if ID_SPLIT = 1, I and D space split supported 12 | ! ****************************************************************************** 13 | .equ ID_SPLIT, 1 14 | 15 | ! ****************************************************************************** 16 | ! * 17 | ! * System Calls and Trap Indexes 18 | ! * 19 | ! ****************************************************************************** 20 | 21 | .equ XFER_SC, 1 22 | .equ MEM_SC, 1 23 | .equ BIOS_SC, 3 24 | .equ BDOS_SC, 2 25 | 26 | ! * the traps use numbers similar to those in the 27 | ! * 68K version of P-CP/M 28 | .equ NTRAPS, 48 ! total number of traps 29 | .equ SC0TRAP, 32 ! trap # of system call 0 30 | 31 | ! Z8000 traps 32 | .equ NMITRAP, 0 ! non-maskable int. 33 | .equ EPUTRAP, 1 ! EPU (floating pt. emulator) 34 | .equ SEGTRAP, 2 ! segmentation (68K bus err) 35 | .equ PITRAP, 8 ! priviledge violation 36 | ! Interrupts, etc. 37 | .equ TRACETR, 9 ! trace 38 | 39 | ! **************************************************** 40 | ! * 41 | ! * C Stack frame equates 42 | ! * 43 | ! * A C stack frame consists of the PC on top, 44 | ! * followed by the arguments, leftmost argument first. 45 | ! * 46 | ! * The caller adjusts the stack on return. 47 | ! * Returned value is in r7 (int) or rr6 (long) 48 | ! * 49 | ! **************************************************** 50 | 51 | .equ PCSIZE, 2 ! PC size non-segmented 52 | .equ INTSIZE, 2 ! INT data type size 53 | .equ LONGSIZE, 4 ! LONG data type size 54 | 55 | .equ ARG1, PCSIZE ! integer arguments 56 | .equ ARG2, ARG1+INTSIZE 57 | .equ ARG3, ARG2+INTSIZE 58 | .equ ARG4, ARG3+INTSIZE 59 | .equ ARG5, ARG4+INTSIZE 60 | 61 | ! ****************************************************************************** 62 | ! * 63 | ! * Segmented Mode Operations 64 | ! * 65 | ! * NOTE: segmented indirect-register operations 66 | ! * can be done by addressing the low half 67 | ! * of the register pair. 68 | ! * 69 | ! ****************************************************************************** 70 | 71 | ! START segmented mode 72 | ! r0 destroyed. 73 | .macro SEG 74 | ldctl r0, fcw 75 | set r0, #15 76 | ldctl FCW, r0 77 | .endm 78 | 79 | ! END segmented mode 80 | ! r0 destroyed. 81 | .macro NONSEG 82 | ldctl r0, fcw 83 | res r0, #15 84 | ldctl FCW, r0 85 | .endm 86 | 87 | ! (segaddr) segmented CALL 88 | .macro scall 89 | .word 0x5F00 90 | .long ?1 ! bit 31 need to be 1 91 | .endm 92 | 93 | ! (|segaddr|) short segmented CALL 94 | .macro sscall 95 | .word 0x5F00 96 | .word ?1 ! bit 15 need to be 0 97 | .endm 98 | 99 | ! ****************************************************************************** 100 | ! * 101 | ! * System Call Trap Handler Stack Frame 102 | ! * 103 | ! ****************************************************************************** 104 | 105 | .equ cr0, 0 ! WORD caller r0 106 | .equ cr1, cr0+2 ! WORD caller r1 107 | .equ cr2, cr1+2 ! WORD caller r2 108 | .equ cr3, cr2+2 ! WORD caller r3 109 | .equ cr4, cr3+2 ! WORD caller r4 110 | .equ cr5, cr4+2 ! WORD caller r5 111 | .equ cr6, cr5+2 ! WORD caller r6 112 | .equ cr7, cr6+2 ! WORD caller r7 113 | .equ cr8, cr7+2 ! WORD caller r8 114 | .equ cr9, cr8+2 ! WORD caller r9 115 | .equ cr10, cr9+2 ! WORD caller r10 116 | .equ cr11, cr10+2 ! WORD caller r11 117 | .equ cr12, cr11+2 ! WORD caller r12 118 | .equ cr13, cr12+2 ! WORD caller r13 119 | .equ nr14, cr13+2 ! WORD normal r14 120 | .equ nr15, nr14+2 ! WORD normal r15 121 | .equ scinst, nr15+2 ! WORD SC instruction 122 | .equ scfcw, scinst+2 ! WORD caller FCW 123 | .equ scseg, scfcw+2 ! WORD caller PC SEG 124 | .equ scpc, scseg+2 ! WORD caller PC OFFSET 125 | 126 | .equ FRAMESZ, scpc+2 127 | 128 | !------------------------------------------------------------------------------ 129 | ! Disk parameter definitions 130 | ! 131 | 132 | .equ MAXDSK, 4 133 | .equ SECSZ, 128 134 | .equ PSECSZ, 512 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /cpm8k/biosif.s: -------------------------------------------------------------------------------- 1 | ! ********* biosif.8kn for cpm.sys + cpmldr.sys ******* 2 | ! * Copyright 1984, Digital Research Inc. 3 | ! * 4 | ! * Assembly language interface for CP/M-8000(tm) BIOS 5 | ! * ----- System-Independent ----- 6 | ! * 7 | ! * 821013 S. Savitzky (Zilog) -- split into modules 8 | ! * 820913 S. Savitzky (Zilog) -- created. 9 | ! * 840811 R. Weiser (DRI) -- conditional assembly 10 | ! * 11 | ! * 20200211 4sun5bu -- modified for assembling with GNU as 12 | 13 | .include "biosdef.s" 14 | 15 | unsegm 16 | sect .text 17 | 18 | ! **************************************************** 19 | ! * 20 | ! * NOTE 21 | ! * The C portion of the BIOS is non-segmented. 22 | ! * 23 | ! * This assembly-language module is assembled 24 | ! * non-segmented, and serves as the interface. 25 | ! * 26 | ! * Segmented operations are well-isolated, and 27 | ! * are either the same as their non-segmented 28 | ! * counterparts, or constructed using macros. 29 | ! * The resulting code looks a little odd. 30 | ! * 31 | ! **************************************************** 32 | 33 | ! **************************************************** 34 | ! * 35 | ! * Externals 36 | ! * 37 | ! **************************************************** 38 | 39 | .extern biosinit ! BIOS init 40 | .extern _flush ! Flush buffers 41 | .extern ccp ! Command Processor 42 | .extern trapinit ! trap startup 43 | .extern flush 44 | .extern scc_init 45 | .extern disk_init 46 | .extern _psap, _sysseg, _sysstk 47 | 48 | ! **************************************************** 49 | ! * 50 | ! * Global declarations 51 | ! * 52 | ! **************************************************** 53 | 54 | .global bios ! initialization 55 | .global _wboot ! arm boot 56 | .global _input ! input a byte 57 | .global _output ! output a byte 58 | 59 | ! **************************************************** 60 | ! * 61 | ! * Bios Initialization and Entry Point 62 | ! * 63 | ! * This is where control comes after boot. 64 | ! * If (the label LOADER is true 1) 65 | ! * Control is transferred to -ldcpm 66 | ! * else 67 | ! * Control is transferred to the ccp. 68 | ! * 69 | ! * We get here from bootstrap with: 70 | ! * segmented mode 71 | ! * valid stack pointer 72 | ! * valid PSA in RAM 73 | ! * 74 | ! **************************************************** 75 | 76 | bios: 77 | ! segmented mode 78 | ! Get system (PC) segment into r4 79 | di vi, nvi 80 | calr kludge ! get PC segment on stack 81 | kludge: 82 | popl rr4, @r14 83 | ldctl r2, PSAPSEG ! get PSAP into rr2. 84 | ldctl r3, PSAPOFF 85 | 86 | ! go non-segmented. save PSAP, system segment, 87 | ! system stack pointer (in system segment, please) 88 | NONSEG 89 | ldl _psap, rr2 90 | ld _sysseg, r4 91 | ld r14, _sysseg 92 | ldl _sysstk, rr14 93 | 94 | push @r15, #_wboot ! set up system stack so that a return will warm boot 95 | 96 | call trapinit ! set up traps, then enable interrupts 97 | ei vi, nvi 98 | 99 | call scc_init ! set up serial port and prrint a message 100 | lda r4, bootmsg 101 | call puts 102 | 103 | call disk_init ! set up disk drive 104 | 105 | call biosinit ! set up C part of Bios 106 | jp ccp ! Turn control over to command processor 107 | 108 | ! ***************************************************** 109 | ! * 110 | ! * Warm Boot 111 | ! * 112 | ! * flush buffers and initialize Bios 113 | ! * then transfer to CCP 114 | ! * 115 | ! ***************************************************** 116 | 117 | _wboot: 118 | call flush 119 | call biosinit 120 | ldl rr14, _sysstk 121 | jp ccp 122 | 123 | !------------------------------------------------------------------------------ 124 | sect .rodata 125 | bootmsg: 126 | .asciz "\r\nCP/M-8000 BIOS ver.0.11" 127 | 128 | -------------------------------------------------------------------------------- /cpm8k/biosmem.s: -------------------------------------------------------------------------------- 1 | ! ******* biosmem.8kn for cpm.sys + cpmldr.sys ******** 2 | ! * Copyright 1984, Digital Research Inc. 3 | ! * 4 | ! * Memory Management for CP/M-8000(tm) BIOS 5 | ! * for Olivetti M20 (Z8001) system. 6 | ! * 7 | ! * 821013 S. Savitzky (Zilog) -- split modules 8 | ! * 820913 S. Savitzky (Zilog) -- created. 9 | ! * 840815 R. Weiser (DRI) -- conditional assembly 10 | ! * 11 | ! * 2020 4sun5bu -- modified for assembling with GNU as 12 | 13 | .include "biosdef.s" 14 | 15 | sect .text 16 | 17 | ! **************************************************** 18 | ! * 19 | ! * This module copies data from one memory space 20 | ! * to another. The machine-dependent parts of 21 | ! * the mapping are well isolated. 22 | ! * 23 | ! * Segmented operations are well-isolated, and 24 | ! * are either the same as their non-segmented 25 | ! * counterparts, or constructed using macros. 26 | ! * 27 | ! **************************************************** 28 | 29 | 30 | ! **************************************************** 31 | ! * 32 | ! * Global declarations 33 | ! * 34 | ! **************************************************** 35 | 36 | !.extern _sysseg, _usrseg, _sysstk, _psap 37 | .global memsc 38 | 39 | ! **************************************************** 40 | ! * 41 | ! * Externals 42 | ! * 43 | ! **************************************************** 44 | 45 | .extern xfersc 46 | 47 | ! **************************************************** 48 | ! * 49 | ! * System/User Memory Access 50 | ! * 51 | ! * _mem_cpy( source, dest, length) 52 | ! * long source, dest, length; 53 | ! * _map_adr( addr, space) -> paddr 54 | ! * long addr; int space; 55 | ! * 56 | ! * _map_adr( addr, -1) -> addr 57 | ! * sets user seg# from addr 58 | ! * 59 | ! * _map_adr( addr, -2) 60 | ! * control transfer to context at addr. 61 | ! * 62 | ! * system call: mem_cpy 63 | ! * rr6: source 64 | ! * rr4: dest 65 | ! * rr2: length (0 < length <= 64K) 66 | ! * returns 67 | ! * registers unchanged 68 | ! * 69 | ! * system call: map_adr 70 | ! * rr6: logical addr 71 | ! * r5: space code 72 | ! * r4: ignored 73 | ! * rr2: 0 74 | ! * returns 75 | ! * rr6: physical addr 76 | ! * 77 | ! * space codes: 78 | ! * 0: caller data 79 | ! * 1: caller program 80 | ! * 2: system data 81 | ! * 3: system program 82 | ! * 4: TPA data 83 | ! * 5: TPA program 84 | ! * 85 | ! * x+256 x=1, 3, 5 : segmented I-space addr. 86 | ! * instead of data access 87 | ! * 88 | ! * FFFF: set user segment 89 | ! * 90 | ! **************************************************** 91 | 92 | 93 | memsc: 94 | ! memory manager system call 95 | ! CALLED FROM SC 96 | ! IN SEGMENTED MODE 97 | ! rr6: source 98 | ! rr4: dest / space 99 | ! rr2: length / 0 100 | testl rr2 101 | jr z, mem_map 102 | 103 | mem_copy: 104 | ! copy data. 105 | ! rr6: source 106 | ! rr4: dest 107 | ! rr2: length 108 | ldirb @r4, @r6, r3 109 | ldl rr6, rr4 ! rr6 = dest + length 110 | ret 111 | 112 | mem_map: 113 | ! map address 114 | ! rr6: source 115 | ! r4: caller's seg. 116 | ! r5: space 117 | ! r2: caller's FCW 118 | NONSEG 119 | cp r5, #-2 ! space=-2: xfer 120 | jp eq, xfersc 121 | ld r4, scseg + 4(r15) 122 | ld r2, scfcw + 4(r15) 123 | calr map_1 124 | ldl cr6 + 4(r15), rr6 ! return rr6 125 | SEG 126 | ret 127 | 128 | map_1: 129 | ! dispatch 130 | cp r5, #0xFFFF 131 | jr eq, set_usr ! space=-1: user seg 132 | cpb rl5, #0 133 | jr eq, call_data 134 | cpb rl5, #1 135 | jr eq, call_prog 136 | cpb rl5, #2 137 | jr eq, sys_data 138 | cpb rl5, #3 139 | jr eq, sys_prog 140 | cpb rl5, #4 141 | jr eq, usr_data 142 | cpb rl5, #5 143 | jr eq, usr_prog 144 | ret ! default: no mapping 145 | 146 | set_usr: ! -1: set user seg. 147 | ld _usrseg, r6 148 | ret 149 | 150 | ! *** THE FOLLOWING CODE IS SYSTEM-DEPENDENT *** 151 | ! * 152 | ! * rr6= logical address 153 | ! * r4 = caller's PC segment 154 | ! * r2 = caller's FCW 155 | ! * returns 156 | ! * rr6= mapped address 157 | ! * 158 | ! * Most of the system dependencies are in map_prog, 159 | ! * which maps a program segment into a data segment 160 | ! * for access as data. 161 | 162 | call_data: 163 | bit r2, #15 ! segmented caller? 164 | ret nz ! yes-- use passed seg 165 | ld r6, r4 ! no -- use pc segment 166 | ret ! already mapped 167 | 168 | call_prog: 169 | bit r2, #15 ! segmented caller? 170 | jr nz, map_prog ! yes-- use passed seg 171 | ld r6, r4 ! no -- use pc segment 172 | jr map_prog ! map prog as data 173 | 174 | sys_data: 175 | ld r6, _sysseg 176 | ret 177 | 178 | sys_prog: 179 | ld r6, _sysseg 180 | ret ! assume sys does not 181 | ! separate code, data 182 | 183 | usr_data: 184 | ld r0, #-1 185 | cp r0, _usrseg 186 | ret eq 187 | ld r6, _usrseg 188 | ret 189 | 190 | usr_prog: 191 | ld r0, #-1 192 | cp r0, _usrseg 193 | jr eq, map_prog 194 | ld r6, _usrseg 195 | jr map_prog 196 | 197 | map_prog: 198 | ! map program addr into data 199 | ! rr6 = address 200 | testb rh5 ! data access? 201 | ret nz ! no: done 202 | and r6, #0x7F00 ! extract seg bits 203 | 204 | ! Z8001MB: segment 8 is the only one with 205 | ! separate I and D spaces, and 206 | ! the I space is accessed 207 | ! as segment 10's data. 208 | .if ID_SPLIT == 1 209 | cpb rh6, #8 210 | ret ne 211 | ldb rh6, #10 212 | .endif 213 | ret 214 | -------------------------------------------------------------------------------- /cpm8k/biostrap.s: -------------------------------------------------------------------------------- 1 | ! ********** biostrap.8kn cpm.sys + cpmldr.sys ****** 2 | ! * Copyright 1984, Digital Research Inc. 3 | ! * 4 | ! * Trap handlers for CP/M-8000(tm) BIOS 5 | ! * 6 | ! * 821013 S. Savitzky (Zilog) -- created 7 | ! * 821123 D. Dunlop (Zilog) -- added Olivetti M20- 8 | ! * specific code to invalidate track buffer 9 | ! * contents when disk drive motor stops 10 | ! * (fixes directory-overwrite on disk change) 11 | ! * 830305 D. Sallume (Zilog) -- added FPE trap 12 | ! * code. 13 | ! * 840815 R. WEISER (DRI) -- conditional assembly 14 | ! * 15 | ! * 20200211 4sun5bu -- modified and converted for assembling with GNU as 16 | 17 | ! **************************************************** 18 | ! * 19 | ! * NOTE 20 | ! * Trap and interrupt handlers are started up 21 | ! * in segmented mode. 22 | ! * 23 | ! **************************************************** 24 | 25 | 26 | ! **************************************************** 27 | ! * 28 | ! * Externals 29 | ! * 30 | ! **************************************************** 31 | 32 | .extern biosentry ! Bios 33 | .extern memsc ! memory-management SC 34 | .extern _sysseg, _psap 35 | 36 | ! **************************************************** 37 | ! * 38 | ! * Global declarations 39 | ! * 40 | ! **************************************************** 41 | 42 | .global trapinit, _trapvec, _trap, fp_epu 43 | .global xfersc, psa 44 | 45 | ! **************************************************** 46 | ! * 47 | ! * System Call and General Trap Handler And Dispatch 48 | ! * 49 | ! * It is assumed that the system runs 50 | ! * non-segmented on a segmented CPU. 51 | ! * 52 | ! * _trap is jumped to segmented, with the 53 | ! * following information on the stack: 54 | ! * 55 | ! * trap type: WORD 56 | ! * reason: WORD 57 | ! * fcw: WORD 58 | ! * pc: LONG 59 | ! * 60 | ! * The trap handler is called as a subroutine, 61 | ! * with all registers saved on the stack, 62 | ! * IN SEGMENTED MODE. This allows the trap 63 | ! * handler to be in another segment (with some 64 | ! * care). This is useful mainly to the debugger. 65 | ! * 66 | ! * All registers except rr0 are also passed 67 | ! * intact to the handler. 68 | ! * 69 | ! **************************************************** 70 | .include "biosdef.s" 71 | 72 | unsegm 73 | sect .text 74 | 75 | sc_trap: ! system call trap server 76 | push @r14,@r14 77 | _trap: 78 | sub r15, #30 ! push caller state 79 | ldm @r14, r0, #14 ! r0 - r15 80 | NONSEG ! go nonsegmented 81 | ldctl r1, nsp 82 | ld nr14(r15), r14 83 | ex r1, nr15(r15) 84 | 85 | ! trap# now in r1 86 | cpb rh1, #0x7F ! system call? 87 | jr ne, trap_disp ! no 88 | clrb rh1 ! yes: map it 89 | add r1, #SC0TRAP 90 | 91 | ! === need range check === 92 | 93 | trap_disp: ! dispatch 94 | sll r1, #2 95 | ldl rr0, _trapvec(r1) 96 | testl rr0 97 | jr z, _trap_ret ! zero -- no action 98 | ! else call seg @rr0 99 | pushl @r15, rr0 ! (done via kludge) 100 | SEG 101 | popl rr0, @r14 ! popl rr0, @rr14 102 | calr trap_1 103 | jr _trap_ret 104 | trap_1: ! jp @rr0 105 | pushl @r14, rr0 ! pushl @rr14, rr0 106 | ret 107 | 108 | _trap_ret: ! return from trap or interrupt 109 | NONSEG 110 | ld r1, nr15(r15) ! pop state 111 | ld r14, nr14(r15) 112 | ldctl nsp, r1 113 | SEG ! go segmented for the iret. 114 | ldm r0, @r14, #14 ! ldm r0, @rr14, #14 115 | add r15, #32 ! restore caller state 116 | iret ! return from interrupt 117 | 118 | ! **************************************************** 119 | ! * 120 | ! * Assorted Trap Handlers 121 | ! * 122 | ! **************************************************** 123 | 124 | epu_trap: 125 | push @r14, #EPUTRAP 126 | jr _trap 127 | 128 | pi_trap: 129 | push @r14, #PITRAP 130 | jr _trap 131 | 132 | seg_trap: 133 | push @r14, #SEGTRAP 134 | jr _trap 135 | 136 | nmi_trap: 137 | push @r14, #NMITRAP 138 | jr _trap 139 | 140 | ! **************************************************** 141 | ! * 142 | ! * Bios system call handler 143 | ! * 144 | ! * r3 = operation code 145 | ! * rr4 = P1 146 | ! * rr6 = P2 147 | ! **************************************************** 148 | 149 | biossc: ! call bios 150 | NONSEG 151 | ld r0, scfcw + 4(r15) ! if caller nonseg, normal 152 | and r0, #0xC000 153 | jr nz, seg_ok 154 | ld r4, scseg + 4(r15) ! then add seg to P1, P2 155 | ld r6, r4 156 | seg_ok: 157 | ! set up C stack frame, TODO: modify for assembly subroutine 158 | pushl @r15, rr6 159 | pushl @r15, rr4 160 | push @r15, r3 161 | call biosentry ! call C program 162 | 163 | ! clean stack & return 164 | add r15, #10 165 | ldl cr6 +4(r15), rr6 ! with long in rr6 166 | SEG 167 | ret 168 | 169 | ! **************************************************** 170 | ! * 171 | ! * Context Switch System Call 172 | ! * 173 | ! * xfer(context) 174 | ! * long context; 175 | ! * 176 | ! * context is the physical (long) address of: 177 | ! * r0 178 | ! * ... 179 | ! * r13 180 | ! * r14 (normal r14) 181 | ! * r15 (normal r15) 182 | ! * ignored word 183 | ! * FCW (had better specify normal mode) 184 | ! * PC segment 185 | ! * PC offset 186 | ! * 187 | ! * The system stack pointer is not affected. 188 | ! * 189 | ! * Control never returns to the caller. 190 | ! * 191 | ! **************************************************** 192 | 193 | xfersc: 194 | ! enter here from system call 195 | ! build frame on system stack 196 | ! when called from system call, the frame replaces 197 | ! the caller's context, which will never be resumed. 198 | 199 | SEG 200 | inc r15, #4 ! discard return addr 201 | ldl rr4, rr14 ! move context 202 | ld r2, #FRAMESZ / 2 203 | ldir @r4, @r6, r2 204 | jr _trap_ret ! restore context 205 | 206 | ! **************************************************** 207 | ! * 208 | ! * _trapinit -- initialize trap system 209 | ! * 210 | ! **************************************************** 211 | 212 | ! * 213 | ! * PSA (Program Status Area) structure 214 | ! * 215 | .equ ps, 8 ! size of a program status entry 216 | ! --- segmented --- 217 | .equ psa_epu, 1 * ps ! EPU trap offset 218 | .equ psa_prv, 2 * ps ! priviledged instruction trap 219 | .equ psa_sc, 3 * ps ! system call trap 220 | .equ psa_seg, 4 * ps ! segmentation trap 221 | .equ psa_nmi, 5 * ps ! non-maskable interrupt 222 | .equ psa_nvi, 6 * ps ! non-vectored interrupt 223 | .equ psa_vi, 7 * ps ! vectored interrupt 224 | .equ psa_vec, psa_vi + (ps / 2) ! vectors 225 | 226 | trapinit: 227 | ! initialize trap table 228 | lda r2, _trapvec 229 | ld r0, #NTRAPS 230 | subl rr4, rr4 231 | clrtraps: 232 | ldl @r2, rr4 233 | inc r2, #4 234 | djnz r0, clrtraps 235 | 236 | ld r2, _sysseg 237 | lda r3, biossc 238 | ldl _trapvec + (BIOS_SC + SC0TRAP) * 4, rr2 239 | lda r3, memsc 240 | ldl _trapvec + (MEM_SC + SC0TRAP) * 4, rr2 241 | lda r3, fp_epu 242 | ldl _trapvec + EPUTRAP * 4, rr2 243 | 244 | ! initialize some PSA entries. 245 | ! rr0 PSA entry: FCW (ints ENABLED) 246 | ! rr2 PSA entry: PC 247 | ! rr4 -> PSA slot 248 | 249 | ldl rr4, _psap 250 | SEG 251 | ldl rr0, #0x0000D800 ! FCW 252 | 253 | add r5, #ps ! EPU trap 254 | ldar r2, epu_trap ! ldar rr2, epu_trap 255 | ldm @r4, r0, #4 ! ldm @rr4, r0, #4 256 | 257 | add r5, #ps ! Priviledged Inst 258 | ldar r2, pi_trap 259 | ldm @r4, r0, #4 260 | 261 | add r5, #ps ! System Call 262 | ldar r2, sc_trap 263 | ldm @r4, r0, #4 264 | 265 | add r5, #ps ! segmentation 266 | ldar r2, seg_trap 267 | ldm @r4, r0, #4 268 | 269 | add r5, #ps ! Non-Maskable Int. 270 | ldar r2, nmi_trap 271 | ldm @r4, r0, #4 272 | 273 | NONSEG 274 | ret 275 | 276 | 277 | !fp_epu: 278 | ! ret 279 | /* 280 | dbgbc: 281 | ! Segmented mode 282 | .word 0x5d00 ! ldl 0x03a000, rr0 283 | .word 0x8300 284 | .word 0xa000 285 | .word 0x5d02 ! ldl 0x03a004, rr2 286 | .word 0x8300 287 | .word 0xa004 288 | .word 0x5d04 ! ldl 0x03a008, rr4 289 | .word 0x8300 290 | .word 0xa008 291 | .word 0x5d06 ! ldl 0x03a00c, rr6 292 | .word 0x8300 293 | .word 0xa00c 294 | .word 0x5d08 ! ldl 0x03a010, rr8 295 | .word 0x8300 296 | .word 0xa010 297 | .word 0x5d0a ! ldl 0x03a014, rr10 298 | .word 0x8300 299 | .word 0xa014 300 | .word 0x5d0c ! ldl 0x03a018, rr12 301 | .word 0x8300 302 | .word 0xa018 303 | .word 0x5d0e ! ldl 0x03a01c, rr14 304 | .word 0x8300 305 | .word 0xa01c 306 | mset 307 | halt 308 | */ 309 | 310 | !------------------------------------------------------------------------------- 311 | sect .psa 312 | 313 | ! PSA is located by the linker script 314 | psa: 315 | .space 100 316 | -------------------------------------------------------------------------------- /cpm8k/cpm8k-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/cpm8k-1.png -------------------------------------------------------------------------------- /cpm8k/cpmsys.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/cpmsys.o -------------------------------------------------------------------------------- /cpm8k/cpmsys.rel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/cpmsys.rel -------------------------------------------------------------------------------- /cpm8k/cpmsys.x: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff-z8k") 2 | OUTPUT_ARCH("z8002") 3 | ENTRY(_start) 4 | 5 | MEMORY 6 | { 7 | CPMSYS : ORIGIN = 0x30000, LENGTH = 64k 8 | /* ROM : ORIGIN = , LENGTH = */ 9 | } 10 | 11 | SECTIONS 12 | { 13 | .text : 14 | { 15 | *(.text) 16 | } > CPMSYS 17 | 18 | .psa : 19 | { 20 | . = ALIGN(256); 21 | *(.psa) 22 | } > CPMSYS 23 | 24 | .rodata : 25 | { 26 | *(.rdata) 27 | *(.rodata) 28 | } > CPMSYS 29 | 30 | .data : 31 | { 32 | *(.data) 33 | } > CPMSYS 34 | 35 | .bss : 36 | { 37 | _bss_top = . ; 38 | *(.bss); 39 | _bss_end = . ; 40 | } > CPMSYS 41 | } 42 | 43 | -------------------------------------------------------------------------------- /cpm8k/diska/diska.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/diska/diska.txt -------------------------------------------------------------------------------- /cpm8k/diskb/diskb.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/diskb/diskb.txt -------------------------------------------------------------------------------- /cpm8k/diskc/diskc.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/diskc/diskc.txt -------------------------------------------------------------------------------- /cpm8k/diskd/diskd.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/diskd/diskd.txt -------------------------------------------------------------------------------- /cpm8k/diskdefs: -------------------------------------------------------------------------------- 1 | diskdef cpm8k 2 | seclen 128 3 | tracks 512 4 | sectrk 128 5 | blocksize 4096 6 | maxdir 512 7 | skew 0 8 | boottrk 2 9 | os 2.2 10 | end 11 | -------------------------------------------------------------------------------- /cpm8k/diskio.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! diskio.s 3 | ! Disk I/O subroutines 4 | ! 5 | ! Copyright(c) 2020 4sun5bu 6 | 7 | .global diskrd, diskwr, disk_init 8 | 9 | .equ IDE_DATAW, 0x0020 ! Word access 10 | .equ IDE_DATAB, 0x0021 ! Byte access 11 | .equ IDE_ERROR, 0x0023 12 | .equ IDE_FEATURES, 0x0023 13 | .equ IDE_SECT_CNT, 0x0025 14 | .equ IDE_SECT_NUM, 0x0027 15 | .equ IDE_CYL_LOW, 0x0029 16 | .equ IDE_CYL_HIGH, 0x002b 17 | .equ IDE_DEV_HEAD, 0x002d 18 | .equ IDE_STATUS, 0x002f 19 | .equ IDE_COMND, 0x002f 20 | 21 | .equ BSY_BIT, 7 22 | .equ DRDY_BIT, 6 23 | .equ DRQ_BIT, 3 24 | .equ ERR_BIT, 0 25 | 26 | .macro CHKBSY 27 | bsy_loop\@: 28 | inb rl0, #IDE_STATUS 29 | bitb rl0, #BSY_BIT 30 | jr nz, bsy_loop\@ 31 | .endm 32 | 33 | .macro CHKDRDY 34 | drdy_loop\@: 35 | inb rl0, #IDE_STATUS 36 | bitb rl0, #DRDY_BIT 37 | jr z, drdy_loop\@ 38 | .endm 39 | 40 | .macro CHKDRQ 41 | drq_loop\@: 42 | inb rl0, #IDE_STATUS 43 | bitb rl0, #DRQ_BIT 44 | jr z, drq_loop\@ 45 | .endm 46 | 47 | unsegm 48 | sect .text 49 | 50 | !------------------------------------------------------------------------------ 51 | disk_init: 52 | CHKBSY 53 | CHKDRDY 54 | ldb rl0, #0x01 ! Set to byte access 55 | outb #IDE_FEATURES, rl0 56 | ldb rl0, #0xef ! 57 | outb #IDE_COMND, rl0 58 | ret 59 | 60 | !------------------------------------------------------------------------------ 61 | ! diskrd 62 | ! One sector read 63 | ! input rr2 --- LBA 64 | ! r4 --- Buffer Address 65 | 66 | diskrd: 67 | CHKBSY 68 | CHKDRDY 69 | ldb rl0, #1 70 | outb #IDE_SECT_CNT, rl0 71 | outb #IDE_SECT_NUM, rl3 72 | outb #IDE_CYL_LOW, rh3 73 | outb #IDE_CYL_HIGH, rl2 74 | andb rh2, #0x0f 75 | orb rh2, #0x40 76 | outb #IDE_DEV_HEAD, rh2 77 | ldb rl0, #0x20 ! data in command 78 | outb #IDE_COMND, rl0 79 | CHKDRQ 80 | CHKBSY 81 | inb rl0, #IDE_STATUS ! Reset INTRQ 82 | 1: 83 | inb rl0, #IDE_DATAB 84 | ldb @r4, rl0 85 | inc r4, #1 86 | inb rl0, #IDE_STATUS ! Check if data exists 87 | bitb rl0, #DRQ_BIT 88 | jr nz, 1b 89 | inb rl0, #IDE_STATUS ! 90 | ret 91 | 92 | !------------------------------------------------------------------------------ 93 | ! diskwr 94 | ! One sector write 95 | ! input rr2 --- LBA 96 | ! r4 --- Buffer Address 97 | 98 | diskwr: 99 | CHKBSY 100 | CHKDRDY 101 | ldb rl0, #1 102 | outb #IDE_SECT_CNT, rl0 103 | xorb rl0, rl0 104 | outb #IDE_SECT_NUM, rl3 105 | outb #IDE_CYL_LOW, rh3 106 | outb #IDE_CYL_HIGH, rl2 107 | andb rh2, #0x0f 108 | orb rh2, #0x40 109 | outb #IDE_DEV_HEAD, rh2 110 | ldb rl0, #0x30 ! data out command 111 | outb #IDE_COMND, rl0 112 | CHKDRQ 113 | CHKBSY 114 | inb rl0, #IDE_STATUS ! Reset INTRQ 115 | 1: 116 | ldb rl0, @r4 117 | outb #IDE_DATAB, rl0 118 | inc r4, #1 119 | inb rl0, #IDE_STATUS ! Check if data exists 120 | bitb rl0, #DRQ_BIT 121 | jr nz, 1b 122 | CHKBSY 123 | inb rl0, #IDE_STATUS 124 | ret 125 | -------------------------------------------------------------------------------- /cpm8k/fpe.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/fpe.o -------------------------------------------------------------------------------- /cpm8k/fpedep.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/fpedep.o -------------------------------------------------------------------------------- /cpm8k/libcpm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/libcpm.a -------------------------------------------------------------------------------- /cpm8k/packages/README: -------------------------------------------------------------------------------- 1 | The base/ directory contains CP/M commands and misc files released by Digital Research. 2 | See "Unofficial The CP/M Web Site", http://gaby.de/cpm/index.html 3 | 4 | -------------------------------------------------------------------------------- /cpm8k/packages/base/ar8k.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/ar8k.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/asz8k.pd: -------------------------------------------------------------------------------- 1 | 305h 205h 0 0 0b500h 0 adc ADC 2 | 304h 204h 0 0 0b400h 0 adcb ADCB 3 | 305h 205h 0 0 8100h 0 4 | 305h 1d08h 0 0 100h 0 5 | 305h 209h 0 0 100h 0 6 | 305h 90ah 0 0 4100h 0 add ADD 7 | 304h 204h 0 0 8000h 0 8 | 304h 1c08h 0 0 0 0 9 | 304h 209h 0 0 0 0 10 | 304h 90ah 0 0 4000h 0 addb ADDB 11 | 306h 206h 0 0 9600h 0 12 | 306h 1e08h 0 0 1600h 0 13 | 306h 209h 0 0 1600h 0 14 | 306h 90ah 0 0 5600h 0 addl ADDL 15 | 305h 205h 0 0 8700h 0 16 | 305h 1d08h 0 0 700h 0 17 | 305h 209h 0 0 700h 0 18 | 305h 90ah 0 0 4700h 0 and AND 19 | 304h 204h 0 0 8600h 0 20 | 304h 1c08h 0 0 600h 0 21 | 304h 209h 0 0 600h 0 22 | 304h 90ah 0 0 4600h 0 andb ANDB 23 | 205h 308h 0 0 0a700h 0 24 | 209h 308h 0 0 2700h 0 25 | 90ah 308h 0 0 6700h 0 26 | 505h 305h 0 0 2700h 100h bit BIT 27 | 204h 1108h 0 0 0a600h 0 28 | 209h 1108h 0 0 2600h 0 29 | 90ah 1108h 0 0 6600h 0 30 | 504h 1105h 0 0 2600h 100h bitb BITB 31 | 209h 0 0 0 1f00h 0 32 | 90ah 0 0 0 5f00h 0 call CALL 33 | 1a03h 0 0 0 0d000h 0 calr CALR 34 | 205h 0 0 0 8d08h 0 35 | 209h 0 0 0 0d08h 0 36 | 90ah 0 0 0 4d08h 0 clr CLR 37 | 204h 0 0 0 8c08h 0 38 | 209h 0 0 0 0c08h 0 39 | 90ah 0 0 0 4c08h 0 clrb CLRB 40 | 205h 0 0 0 8d00h 0 41 | 209h 0 0 0 0d00h 0 42 | 90ah 0 0 0 4d00h 0 com COM 43 | 204h 0 0 0 8c00h 0 44 | 209h 0 0 0 0c00h 0 45 | 90ah 0 0 0 4c00h 0 comb COMB 46 | 0f0eh 0 0 0 8d05h 0 47 | 0f0eh 0f0eh 0 0 8d05h 0 48 | 0f0eh 0f0eh 0f0eh 0 8d05h 0 49 | 0f0eh 0f0eh 0f0eh 0f0eh 8d05h 0 comflg COMFLG 50 | 305h 205h 0 0 8b00h 0 51 | 305h 1d08h 0 0 0b00h 0 52 | 305h 209h 0 0 0b00h 0 53 | 305h 90ah 0 0 4b00h 0 54 | 209h 1d08h 0 0 0d01h 0 55 | 90ah 1d08h 0 0 4d01h 0 cp CP 56 | 304h 204h 0 0 8a00h 0 57 | 304h 1c08h 0 0 0a00h 0 58 | 304h 209h 0 0 0a00h 0 59 | 304h 90ah 0 0 4a00h 0 60 | 209h 1c08h 0 0 0c01h 0 61 | 90ah 1c08h 0 0 4c01h 0 cpb CPB 62 | 306h 206h 0 0 9000h 0 63 | 306h 1e08h 0 0 1000h 0 64 | 306h 209h 0 0 1000h 0 65 | 306h 90ah 0 0 5000h 0 cpl CPL 66 | 605h 209h 505h 70dh 0bb08h 100h cpd CPD 67 | 604h 209h 505h 70dh 0ba08h 100h cpdb CPDB 68 | 605h 209h 505h 70dh 0bb0ch 100h cpdr CPDR 69 | 604h 209h 505h 70dh 0ba0ch 100h cpdrb CPDRB 70 | 605h 209h 505h 70dh 0bb00h 100h cpi CPI 71 | 604h 209h 505h 70dh 0ba00h 100h cpib CPIB 72 | 605h 209h 505h 70dh 0bb04h 100h cpir CPIR 73 | 604h 209h 505h 70dh 0ba04h 100h cpirb CPIRB 74 | 609h 209h 505h 70dh 0bb0ah 100h cpsd CPSD 75 | 609h 209h 505h 70dh 0ba0ah 100h cpsdb CPSDB 76 | 609h 209h 505h 70dh 0bb0eh 100h cpsdr CPSDR 77 | 609h 209h 505h 70dh 0ba0eh 100h cpsdrb CPSDRB 78 | 609h 209h 505h 70dh 0bb02h 100h cpsi CPSI 79 | 609h 209h 505h 70dh 0ba02h 100h cpsib CPSIB 80 | 609h 209h 505h 70dh 0bb06h 100h cpsir CPSIR 81 | 609h 209h 505h 70dh 0ba06h 100h cpsirb CPSIRB 82 | 204h 0 0 0 0b000h 0 dab DAB 83 | 205h 0 0 0 0ab00h 0 84 | 209h 0 0 0 2b00h 0 85 | 90ah 0 0 0 6b00h 0 86 | 205h 1308h 0 0 0ab00h 0 87 | 209h 1308h 0 0 2b00h 0 88 | 90ah 1308h 0 0 6b00h 0 dec DEC 89 | 204h 0 0 0 0aa00h 0 90 | 209h 0 0 0 2a00h 0 91 | 90ah 0 0 0 6a00h 0 92 | 204h 1308h 0 0 0aa00h 0 93 | 209h 1308h 0 0 2a00h 0 94 | 90ah 1308h 0 0 6a00h 0 decb DECB 95 | 120fh 0 0 0 7c03h 0 96 | 120fh 120fh 0 0 7c03h 0 di DI 97 | 306h 205h 0 0 9b00h 0 98 | 306h 1d08h 0 0 1b00h 0 99 | 306h 209h 0 0 1b00h 0 100 | 306h 90ah 0 0 5b00h 0 div DIV 101 | 307h 206h 0 0 9a00h 0 102 | 307h 1e08h 0 0 1a00h 0 103 | 307h 209h 0 0 1a00h 0 104 | 307h 90ah 0 0 5a00h 0 divl DIVL 105 | 105h 1803h 0 0 0f080h 0 djnz DJNZ 106 | 104h 1803h 0 0 0f000h 0 dbjnz DBJNZ 107 | 120fh 0 0 0 7c07h 0 108 | 120fh 120fh 0 0 7c07h 0 ei EI 109 | 305h 205h 0 0 0ad00h 0 110 | 305h 209h 0 0 2d00h 0 111 | 305h 90ah 0 0 6d00h 0 ex EX 112 | 304h 204h 0 0 0ac00h 0 113 | 304h 209h 0 0 2c00h 0 114 | 304h 90ah 0 0 6c00h 0 exb EXB 115 | 206h 0 0 0 0b10ah 0 exts EXTS 116 | 205h 0 0 0 0b100h 0 extsb EXTSB 117 | 207h 0 0 0 0b107h 0 extsl EXTSL 118 | 214h 514h 0 0 8e04h 8580h 119 | 214h 505h 0 0 8f08h 8584h 120 | 514h 209h 0 0 0f04h 8584h 121 | 514h 90ah 0 0 4f04h 8584h fabs FABS 122 | 214h 505h 0 0 8f08h 8581h 123 | 514h 209h 0 0 0f04h 8581h 124 | 514h 90ah 0 0 4f04h 8581h fabss FABSS 125 | 214h 505h 0 0 8f08h 8583h 126 | 514h 209h 0 0 0f04h 8583h 127 | 514h 90ah 0 0 4f04h 8583h fabsd FABSD 128 | 214h 514h 0 0 8e04h 4580h 129 | 214h 505h 0 0 8f08h 4584h 130 | 514h 209h 0 0 0f04h 4584h 131 | 514h 90ah 0 0 4f04h 4584h fadd FADD 132 | 214h 505h 0 0 8f08h 4581h 133 | 514h 209h 0 0 0f04h 4581h 134 | 514h 90ah 0 0 4f04h 4581h fadds FADDS 135 | 214h 505h 0 0 8f08h 4583h 136 | 514h 209h 0 0 0f04h 4583h 137 | 514h 90ah 0 0 4f04h 4583h faddd FADDD 138 | 214h 0 0 0 8e04h 100h fclr FCLR 139 | 214h 514h 0 0 8e04h 4110h 140 | 214h 505h 0 0 8f08h 4114h 141 | 514h 209h 0 0 0f04h 4114h 142 | 514h 90ah 0 0 4f04h 4114h fcp FCP 143 | 214h 505h 0 0 8f08h 4111h 144 | 514h 209h 0 0 0f04h 4111h 145 | 514h 90ah 0 0 4f04h 4111h fcps FCPS 146 | 214h 505h 0 0 8f08h 4113h 147 | 514h 209h 0 0 0f04h 4113h 148 | 514h 90ah 0 0 4f04h 4113h fcpd FCPD 149 | 214h 514h 0 0 8e04h 4120h 150 | 214h 505h 0 0 8f08h 4124h 151 | 514h 209h 0 0 0f04h 4124h 152 | 514h 90ah 0 0 4f04h 4124h fcpx FCPX 153 | 214h 505h 0 0 8f08h 4121h 154 | 514h 209h 0 0 0f04h 4121h 155 | 514h 90ah 0 0 4f04h 4121h fcpxs FCPXS 156 | 214h 505h 0 0 8f08h 4123h 157 | 514h 209h 0 0 0f04h 4123h 158 | 514h 90ah 0 0 4f04h 4123h fcpxd FCPXD 159 | 214h 514h 0 0 8e00h 4110h fcpf FCPF 160 | 214h 514h 0 0 8e00h 4120h fcpfx FCPFX 161 | 214h 0 0 0 8e00h 110h fcpz FCPZ 162 | 214h 0 0 0 8e00h 120h fcpzx FCPZX 163 | 214h 514h 0 0 8e04h 45a0h 164 | 214h 505h 0 0 8f08h 45a4h 165 | 514h 209h 0 0 0f04h 45a4h 166 | 514h 90ah 0 0 4f04h 45a4h fdiv FDIV 167 | 214h 505h 0 0 8f08h 45a1h 168 | 514h 209h 0 0 0f04h 45a1h 169 | 514h 90ah 0 0 4f04h 45a1h fdivs FDIVS 170 | 214h 505h 0 0 8f08h 45a3h 171 | 514h 209h 0 0 0f04h 45a3h 172 | 514h 90ah 0 0 4f04h 45a3h fdivd FDIVD 173 | 214h 514h 0 0 8e04h 85d0h 174 | 214h 505h 0 0 8f08h 85d4h 175 | 514h 209h 0 0 0f04h 85d4h 176 | 514h 90ah 0 0 4f04h 85d4h fint FINT 177 | 214h 505h 0 0 8f08h 85d1h 178 | 514h 209h 0 0 0f04h 85d1h 179 | 514h 90ah 0 0 4f04h 85d1h fints FINTS 180 | 214h 505h 0 0 8f08h 85d3h 181 | 514h 209h 0 0 0f04h 85d3h 182 | 514h 90ah 0 0 4f04h 85d3h fintd FINTD 183 | 214h 514h 0 0 8e04h 8500h 184 | 214h 505h 0 0 8f08h 8504h 185 | 514h 209h 0 0 0f04h 8504h 186 | 514h 90ah 0 0 4f04h 8504h 187 | 505h 214h 0 0 8f00h 8104h 188 | 209h 514h 0 0 0f0ch 8104h 189 | 90ah 514h 0 0 4f0ch 8104h fld FLD 190 | 214h 505h 0 0 8f08h 8501h 191 | 514h 209h 0 0 0f04h 8501h 192 | 514h 90ah 0 0 4f04h 8501h 193 | 505h 214h 0 0 8f00h 8101h 194 | 209h 514h 0 0 0f0ch 8101h 195 | 90ah 514h 0 0 4f0ch 8101h flds FLDS 196 | 214h 505h 0 0 8f08h 8503h 197 | 514h 209h 0 0 0f04h 8503h 198 | 514h 90ah 0 0 4f04h 8503h 199 | 505h 214h 0 0 8f00h 8103h 200 | 209h 514h 0 0 0f0ch 8103h 201 | 90ah 514h 0 0 4f0ch 8103h fldd FLDD 202 | 214h 505h 1608h 0 8f08h 8510h 203 | 214h 505h 0 0 8f08h 8514h 204 | 514h 209h 1608h 0 0f04h 8510h 205 | 514h 209h 0 0 0f04h 8514h 206 | 514h 90ah 1608h 0 4f04h 8510h 207 | 514h 90ah 0 0 4f04h 8514h 208 | 505h 214h 1608h 0 8f00h 8110h 209 | 505h 214h 0 0 8f00h 8114h 210 | 209h 514h 1608h 0 0f0ch 8110h 211 | 209h 514h 0 0 0f0ch 8114h 212 | 90ah 514h 1608h 0 4f0ch 8110h 213 | 90ah 514h 0 0 4f0ch 8114h fldbcd FLDBCD 214 | 21ah 505h 0 0 8f08h 0c100h 215 | 215h 506h 0 0 8f08h 0c101h 216 | 216h 505h 0 0 8f08h 0c104h 217 | 51ah 209h 0 0 0f04h 0c100h 218 | 515h 209h 0 0 0f04h 0c101h 219 | 516h 209h 0 0 0f04h 0c104h 220 | 51ah 90ah 0 0 4f04h 0c100h 221 | 515h 90ah 0 0 4f04h 0c101h 222 | 516h 90ah 0 0 4f04h 0c104h 223 | 505h 21ah 0 0 8f00h 0c100h 224 | 506h 215h 0 0 8f00h 0c101h 225 | 505h 216h 0 0 8f00h 0c104h 226 | 209h 51ah 0 0 0f0ch 0c100h 227 | 209h 515h 0 0 0f0ch 0c101h 228 | 209h 516h 0 0 0f0ch 0c104h 229 | 90ah 51ah 0 0 4f0ch 0c100h 230 | 90ah 515h 0 0 4f0ch 0c101h 231 | 90ah 516h 0 0 4f0ch 0c104h fldctl FLDCTL 232 | 217h 0 0 0 8e00h 0c110h fldctlb FLDCTLB 233 | 214h 506h 0 0 8f08h 8521h 234 | 514h 209h 0 0 0f04h 8521h 235 | 514h 90ah 0 0 4f04h 8521h 236 | 506h 214h 0 0 8f00h 8121h 237 | 209h 514h 0 0 0f0ch 8121h 238 | 90ah 514h 0 0 4f0ch 8121h fldil FLDIL 239 | 214h 507h 0 0 8f08h 8523h 240 | 514h 209h 0 0 0f04h 8523h 241 | 514h 90ah 0 0 4f04h 8523h 242 | 507h 214h 0 0 8f00h 8123h 243 | 209h 514h 0 0 0f0ch 8123h 244 | 90ah 514h 0 0 4f0ch 8123h fldiq FLDIQ 245 | 214h 514h 0 0 8e04h 8130h 246 | 214h 505h 0 0 8f08h 8134h 247 | 514h 209h 0 0 0f04h 8134h 248 | 514h 90ah 0 0 4f04h 8134h 249 | 505h 214h 0 0 8f00h 8134h 250 | 209h 514h 0 0 0f0ch 8134h 251 | 90ah 514h 0 0 4f0ch 8134h fldm FLDM fldnf FLDNF 252 | 506h 214h 0 0 8f00h 8141h 253 | 209h 514h 0 0 0f0ch 8141h 254 | 90ah 514h 0 0 4f0ch 8141h fldtl FLDTL 255 | 507h 214h 0 0 8f00h 8143h 256 | 209h 514h 0 0 0f0ch 8143h 257 | 90ah 514h 0 0 4f0ch 8143h fldtq FLDTQ 258 | 214h 514h 0 0 8e04h 45b0h 259 | 214h 505h 0 0 8f08h 45b4h 260 | 514h 209h 0 0 0f04h 45b4h 261 | 514h 90ah 0 0 4f04h 45b4h fmul FMUL 262 | 214h 505h 0 0 8f08h 45b1h 263 | 514h 209h 0 0 0f04h 45b1h 264 | 514h 90ah 0 0 4f04h 45b1h fmuls FMULS 265 | 214h 505h 0 0 8f08h 45b3h 266 | 514h 209h 0 0 0f04h 45b3h 267 | 514h 90ah 0 0 4f04h 45b3h fmuld FMULD 268 | 214h 514h 0 0 8e04h 8590h 269 | 214h 505h 0 0 8f08h 8594h 270 | 514h 209h 0 0 0f04h 8594h 271 | 514h 90ah 0 0 4f04h 8594h fneg FNEG 272 | 214h 505h 0 0 8f08h 8591h 273 | 514h 209h 0 0 0f04h 8591h 274 | 514h 90ah 0 0 4f04h 8591h fnegs FNEGS 275 | 214h 505h 0 0 8f08h 8593h 276 | 514h 209h 0 0 0f04h 8593h 277 | 514h 90ah 0 0 4f04h 8593h fnegd FNEGD 278 | 214h 514h 0 0 8e04h 85b0h 279 | 214h 505h 0 0 8f08h 85b4h 280 | 514h 209h 0 0 0f04h 85b4h 281 | 514h 90ah 0 0 4f04h 85b4h fpwr2 FPWR2 282 | 214h 505h 0 0 8f08h 85b1h 283 | 514h 209h 0 0 0f04h 85b1h 284 | 514h 90ah 0 0 4f04h 85b1h fpwr2s FPWR2S 285 | 214h 505h 0 0 8f08h 85b3h 286 | 514h 209h 0 0 0f04h 85b3h 287 | 514h 90ah 0 0 4f04h 85b3h fpwr2d FPWR2D 288 | 214h 514h 0 0 8e00h 45c0h fremstep FREMSTEP 289 | 214h 514h 0 0 8e04h 45c0h 290 | 214h 505h 0 0 8f08h 45c4h 291 | 514h 209h 0 0 0f04h 45c4h 292 | 514h 90ah 0 0 4f04h 45c4h fremsnf FREMSNF 293 | 214h 505h 0 0 8f08h 45c1h 294 | 514h 209h 0 0 0f04h 45c1h 295 | 514h 90ah 0 0 4f04h 45c1h fremsnfs FREMSNFS 296 | 214h 505h 0 0 8f08h 45c3h 297 | 514h 209h 0 0 0f04h 45c3h 298 | 514h 90ah 0 0 4f04h 45c3h fremsnfd FREMSNFD 299 | 1018h 0 0 0 8e04h 0c120h fresflg FRESFLG 300 | 1018h 0 0 0 8e24h 0c120h frestrap FRESTRAP 301 | 214h 514h 0 0 8e04h 5a0h 302 | 214h 505h 0 0 8f08h 5a4h 303 | 514h 209h 0 0 0f04h 5a4h 304 | 514h 90ah 0 0 4f04h 5a4h frvdiv FRVDIV 305 | 214h 505h 0 0 8f08h 5a1h 306 | 514h 209h 0 0 0f04h 5a1h 307 | 514h 90ah 0 0 4f04h 5a1h frvdivs FRVDIVS 308 | 214h 505h 0 0 8f08h 5a3h 309 | 514h 209h 0 0 0f04h 5a3h 310 | 514h 90ah 0 0 4f04h 5a3h frvdivd FRVDIVD 311 | 214h 514h 0 0 8e04h 590h 312 | 214h 505h 0 0 8f08h 594h 313 | 514h 209h 0 0 0f04h 594h 314 | 514h 90ah 0 0 4f04h 594h frvsub FRVSUB 315 | 214h 505h 0 0 8f08h 591h 316 | 514h 209h 0 0 0f04h 591h 317 | 514h 90ah 0 0 4f04h 591h frvsubs FRVSUBS 318 | 214h 505h 0 0 8f08h 593h 319 | 514h 209h 0 0 0f04h 593h 320 | 514h 90ah 0 0 4f04h 593h frvsubd FRVSUBD 321 | 1018h 0 0 0 8e04h 0c130h fsetflg FSETFLG 322 | 1019h 0 0 0 8e04h 0c140h fsetmode FSETMODE 323 | 1018h 0 0 0 8e24h 0c130h fsettrap FSETTRAP 324 | 214h 514h 0 0 8e04h 85c0h 325 | 214h 505h 0 0 8f08h 85c4h 326 | 514h 209h 0 0 0f04h 85c4h 327 | 514h 90ah 0 0 4f04h 85c4h fsqr FSQR 328 | 214h 505h 0 0 8f08h 85c1h 329 | 514h 209h 0 0 0f04h 85c1h 330 | 514h 90ah 0 0 4f04h 85c1h fsqrs FSQRS 331 | 214h 505h 0 0 8f08h 85c3h 332 | 514h 209h 0 0 0f04h 85c3h 333 | 514h 90ah 0 0 4f04h 85c3h fsqrd FSQRD 334 | 214h 514h 0 0 8e04h 4590h 335 | 214h 505h 0 0 8f08h 4594h 336 | 514h 209h 0 0 0f04h 4594h 337 | 514h 90ah 0 0 4f04h 4594h fsub FSUB 338 | 214h 505h 0 0 8f08h 4591h 339 | 514h 209h 0 0 0f04h 4591h 340 | 514h 90ah 0 0 4f04h 4591h fsubs FSUBS 341 | 214h 505h 0 0 8f08h 4593h 342 | 514h 209h 0 0 0f04h 4593h 343 | 514h 90ah 0 0 4f04h 4593h fsubd FSUBD 344 | 0 0 0 0 7a00h 0 halt HALT 345 | 305h 212h 0 0 3d00h 0 346 | 205h 1d03h 0 0 3b04h 0 in IN 347 | 304h 212h 0 0 3c00h 0 348 | 204h 1d03h 0 0 3a04h 0 inb INB 349 | 205h 0 0 0 0a900h 0 350 | 209h 0 0 0 2900h 0 351 | 90ah 0 0 0 6900h 0 352 | 205h 1308h 0 0 0a900h 0 353 | 209h 1308h 0 0 2900h 0 354 | 90ah 1308h 0 0 6900h 0 inc INC 355 | 204h 0 0 0 0a800h 0 356 | 209h 0 0 0 2800h 0 357 | 90ah 0 0 0 6800h 0 358 | 204h 1308h 0 0 0a800h 0 359 | 209h 1308h 0 0 2800h 0 360 | 90ah 1308h 0 0 6800h 0 incb INCB 361 | 609h 212h 505h 0 3b08h 108h ind IND 362 | 609h 212h 505h 0 3a08h 108h indb INDB 363 | 609h 212h 505h 0 3b08h 100h indr INDR 364 | 609h 212h 505h 0 3a08h 100h indrb INDRB 365 | 609h 212h 505h 0 3b00h 108h ini INI 366 | 609h 212h 505h 0 3a00h 108h inib INIB 367 | 609h 212h 505h 0 3b00h 100h inir INIR 368 | 609h 212h 505h 0 3a00h 100h inirb INIRB 369 | 0 0 0 0 7b00h 0 iret IRET 370 | 209h 0 0 0 1e08h 0 371 | 90ah 0 0 0 5e08h 0 372 | 30dh 209h 0 0 1e00h 0 373 | 30dh 90ah 0 0 5e00h 0 jp JP 374 | 1903h 0 0 0 0e800h 0 375 | 10dh 1903h 0 0 0e000h 0 jr JR 376 | 305h 205h 0 0 0a100h 0 377 | 305h 1d08h 0 0 2100h 0 378 | 305h 209h 0 0 2100h 0 379 | 305h 90ah 0 0 6100h 0 380 | 305h 0b0bh 0 0 3100h 0 381 | 305h 0d0ch 0 0 7100h 100h 382 | 209h 305h 0 0 2f00h 0 383 | 90ah 305h 0 0 6f00h 0 384 | 209h 1d08h 0 0 0d05h 0 385 | 90ah 1d08h 0 0 4d05h 0 386 | 0b0bh 305h 0 0 3300h 0 387 | 0d0ch 305h 0 0 7300h 100h ld LD 388 | 304h 204h 0 0 0a000h 0 389 | 104h 808h 0 0 0c000h 0 390 | 304h 209h 0 0 2000h 0 391 | 304h 90ah 0 0 6000h 0 392 | 304h 0b0bh 0 0 3000h 0 393 | 304h 0d0ch 0 0 7000h 100h 394 | 209h 304h 0 0 2e00h 0 395 | 90ah 304h 0 0 6e00h 0 396 | 209h 1c08h 0 0 0c05h 0 397 | 90ah 1c08h 0 0 4c05h 0 398 | 0b0bh 304h 0 0 3200h 0 399 | 0d0ch 304h 0 0 7200h 100h ldb LDB 400 | 306h 206h 0 0 9400h 0 401 | 306h 1e08h 0 0 1400h 0 402 | 306h 209h 0 0 1400h 0 403 | 306h 90ah 0 0 5400h 0 404 | 306h 0b0bh 0 0 3500h 0 405 | 306h 0d0ch 0 0 7500h 100h 406 | 209h 306h 0 0 1d00h 0 407 | 90ah 306h 0 0 5d00h 0 408 | 0b0bh 306h 0 0 3700h 0 409 | 0d0ch 306h 0 0 7700h 100h ldl LDL 410 | 313h 90ah 0 0 7600h 0 411 | 313h 0b0bh 0 0 3400h 0 412 | 313h 0d0ch 0 0 7400h 100h lda LDA 413 | 313h 1b03h 0 0 3400h 0 ldar LDAR 414 | 11h 204h 0 0 8c09h 0 415 | 204h 11h 0 0 8c01h 0 ldctlb LDCTLB 416 | 310h 205h 0 0 7d08h 0 417 | 205h 310h 0 0 7d00h 0 ldctl LDCTL 418 | 609h 209h 505h 0 0bb09h 108h ldd LDD 419 | 609h 209h 505h 0 0ba09h 108h lddb LDDB 420 | 609h 209h 505h 0 0bb09h 100h lddr LDDR 421 | 609h 209h 505h 0 0ba09h 100h lddrb LDDRB 422 | 609h 209h 505h 0 0bb01h 108h ldi LDI 423 | 609h 209h 505h 0 0ba01h 108h ldib LDIB 424 | 609h 209h 505h 0 0bb01h 100h ldir LDIR 425 | 609h 209h 505h 0 0ba01h 100h ldirb LDIRB 426 | 205h 308h 0 0 0bd00h 0 ldk LDK 427 | 505h 209h 1708h 0 1c01h 100h 428 | 505h 90ah 1708h 0 5c01h 100h 429 | 209h 505h 1708h 0 1c09h 100h 430 | 90ah 505h 1708h 0 5c09h 100h ldm LDM 431 | 209h 0 0 0 3900h 0 432 | 90ah 0 0 0 7900h 0 ldps LDPS 433 | 305h 1b03h 0 0 3100h 0 434 | 1b03h 305h 0 0 3300h 0 ldr LDR 435 | 304h 1b03h 0 0 3000h 0 436 | 1b03h 304h 0 0 3200h 0 ldrb LDRB 437 | 306h 1b03h 0 0 3500h 0 438 | 1b03h 306h 0 0 3700h 0 ldrl LDRL 439 | 0 0 0 0 7b0ah 0 mbit MBIT 440 | 205h 0 0 0 7b0dh 0 mreq MREQ 441 | 0 0 0 0 7b09h 0 mres MRES 442 | 0 0 0 0 7b08h 0 mset MSET 443 | 306h 205h 0 0 9900h 0 444 | 306h 1d08h 0 0 1900h 0 445 | 306h 209h 0 0 1900h 0 446 | 306h 90ah 0 0 5900h 0 mult MULT 447 | 307h 206h 0 0 9800h 0 448 | 307h 1e08h 0 0 1800h 0 449 | 307h 209h 0 0 1800h 0 450 | 307h 90ah 0 0 5800h 0 multl MULTL 451 | 205h 0 0 0 8d02h 0 452 | 209h 0 0 0 0d02h 0 453 | 90ah 0 0 0 4d02h 0 neg NEG 454 | 204h 0 0 0 8c02h 0 455 | 209h 0 0 0 0c02h 0 456 | 90ah 0 0 0 4c02h 0 negb NEGB 457 | 0 0 0 0 8d07h 0 nop NOP 458 | 305h 205h 0 0 8500h 0 459 | 305h 1d08h 0 0 500h 0 460 | 305h 209h 0 0 500h 0 461 | 305h 90ah 0 0 4500h 0 or OR 462 | 304h 204h 0 0 8400h 0 463 | 304h 1c08h 0 0 400h 0 464 | 304h 209h 0 0 400h 0 465 | 304h 90ah 0 0 4400h 0 orb ORB 466 | 612h 209h 505h 0 3b0ah 100h otdr OTDR 467 | 612h 209h 505h 0 3a0ah 100h otdrb OTDRB 468 | 612h 209h 505h 0 3b02h 100h otir OTIR 469 | 612h 209h 505h 0 3a02h 100h otirb OTIRB 470 | 212h 305h 0 0 3f00h 0 471 | 1d03h 205h 0 0 3b06h 0 out OUT 472 | 212h 304h 0 0 3e00h 0 473 | 1d03h 204h 0 0 3a06h 0 outb OUTB 474 | 612h 209h 505h 0 3b0ah 108h outd OUTD 475 | 612h 209h 505h 0 3a0ah 108h outdb OUTDB 476 | 612h 209h 505h 0 3b02h 108h outi OUTI 477 | 612h 209h 505h 0 3a02h 108h outib OUTIB 478 | 305h 209h 0 0 9700h 0 479 | 309h 209h 0 0 1700h 0 480 | 0a0ah 209h 0 0 5700h 0 pop POP 481 | 306h 209h 0 0 9500h 0 482 | 309h 209h 0 0 1500h 0 483 | 0a0ah 209h 0 0 5500h 0 popl POPL 484 | 209h 305h 0 0 9300h 0 485 | 209h 309h 0 0 1300h 0 486 | 209h 0a0ah 0 0 5300h 0 487 | 209h 1d08h 0 0 0d09h 0 push PUSH 488 | 209h 306h 0 0 9100h 0 489 | 209h 309h 0 0 1100h 0 490 | 209h 0a0ah 0 0 5100h 0 pushl PUSHL 491 | 205h 308h 0 0 0a300h 0 492 | 209h 308h 0 0 2300h 0 493 | 90ah 308h 0 0 6300h 0 494 | 505h 305h 0 0 2300h 100h res RES 495 | 204h 1108h 0 0 0a200h 0 496 | 209h 1108h 0 0 2200h 0 497 | 90ah 1108h 0 0 6200h 0 498 | 504h 1105h 0 0 2200h 100h resb RESB 499 | 0f0eh 0 0 0 8d03h 0 500 | 0f0eh 0f0eh 0 0 8d03h 0 501 | 0f0eh 0f0eh 0f0eh 0 8d03h 0 502 | 0f0eh 0f0eh 0f0eh 0f0eh 8d03h 0 resflg RESFLG 503 | 0 0 0 0 9e08h 0 504 | 30dh 0 0 0 9e00h 0 ret RET 505 | 205h 0 0 0 0b300h 0 506 | 205h 1f08h 0 0 0b300h 0 rl RL 507 | 204h 0 0 0 0b200h 0 508 | 204h 1f08h 0 0 0b200h 0 rlb RLB 509 | 205h 0 0 0 0b308h 0 510 | 205h 1f08h 0 0 0b308h 0 rlc RLC 511 | 204h 0 0 0 0b208h 0 512 | 204h 1f08h 0 0 0b208h 0 rlcb RLCB 513 | 304h 204h 0 0 0be00h 0 rldb RLDB 514 | 205h 0 0 0 0b304h 0 515 | 205h 1f08h 0 0 0b304h 0 rr RR 516 | 204h 0 0 0 0b204h 0 517 | 204h 1f08h 0 0 0b204h 0 rrb RRB 518 | 205h 0 0 0 0b30ch 0 519 | 205h 1f08h 0 0 0b30ch 0 rrc RRC 520 | 204h 0 0 0 0b20ch 0 521 | 204h 1f08h 0 0 0b20ch 0 rrcb RRCB 522 | 304h 204h 0 0 0bc00h 0 rrdb RRDB 523 | 305h 205h 0 0 0b700h 0 sbc SBC 524 | 304h 204h 0 0 0b600h 0 sbcb SBCB 525 | 808h 0 0 0 7f00h 0 sc SC 526 | 205h 505h 0 0 0b30bh 100h sda SDA 527 | 204h 505h 0 0 0b20bh 100h sdab SDAB 528 | 206h 505h 0 0 0b30fh 100h sdal SDAL 529 | 205h 505h 0 0 0b303h 100h sdl SDL 530 | 204h 505h 0 0 0b203h 100h sdlb SDLB 531 | 206h 505h 0 0 0b307h 100h sdll SDLL 532 | 205h 308h 0 0 0a500h 0 533 | 209h 308h 0 0 2500h 0 534 | 90ah 308h 0 0 6500h 0 535 | 505h 305h 0 0 2500h 100h set SET 536 | 204h 1108h 0 0 0a400h 0 537 | 209h 1108h 0 0 2400h 0 538 | 90ah 1108h 0 0 6400h 0 539 | 504h 1105h 0 0 2400h 100h setb SETB 540 | 0f0eh 0 0 0 8d01h 0 541 | 0f0eh 0f0eh 0 0 8d01h 0 542 | 0f0eh 0f0eh 0f0eh 0 8d01h 0 543 | 0f0eh 0f0eh 0f0eh 0f0eh 8d01h 0 setflg SETFLG 544 | 205h 1d03h 0 0 3b05h 0 sin SIN 545 | 204h 1d03h 0 0 3a05h 0 sinb SINB 546 | 609h 212h 505h 0 3b09h 108h sind SIND 547 | 609h 212h 505h 0 3a09h 108h sindb SINDB 548 | 609h 212h 505h 0 3b09h 100h sindr SINDR 549 | 609h 212h 505h 0 3a09h 100h sindrb SINDRB 550 | 609h 212h 505h 0 3b01h 108h sini SINI 551 | 609h 212h 505h 0 3a01h 108h sinib SINIB 552 | 609h 212h 505h 0 3b01h 100h sinir SINIR 553 | 609h 212h 505h 0 3a01h 100h sinirb SINIRB 554 | 205h 0 0 0 0b309h 101h 555 | 205h 1d08h 0 0 0b309h 0 sla SLA 556 | 204h 0 0 0 0b209h 101h 557 | 204h 1d08h 0 0 0b209h 0 slab SLAB 558 | 206h 0 0 0 0b30dh 101h 559 | 206h 1d08h 0 0 0b30dh 0 slal SLAL 560 | 205h 0 0 0 0b301h 101h 561 | 205h 1d08h 0 0 0b301h 0 sll SLL 562 | 204h 0 0 0 0b201h 101h 563 | 204h 1d08h 0 0 0b201h 0 sllb SLLB 564 | 206h 0 0 0 0b305h 101h 565 | 206h 1d08h 0 0 0b305h 0 slll SLLL 566 | 612h 209h 505h 0 3b0bh 100h sotdr SOTDR 567 | 612h 209h 505h 0 3a0bh 100h sotdrb SOTDRB 568 | 612h 209h 505h 0 3b03h 100h sotir SOTIR 569 | 612h 209h 505h 0 3a03h 100h sotirb SOTIRB 570 | 1d03h 205h 0 0 3b07h 0 sout SOUT 571 | 1d03h 204h 0 0 3a07h 0 soutb SOUTB 572 | 612h 209h 505h 0 3b0bh 108h soutd SOUTD 573 | 612h 209h 505h 0 3a0bh 108h soutdb SOUTDB 574 | 612h 209h 505h 0 3b03h 108h souti SOUTI 575 | 612h 209h 505h 0 3a03h 108h soutib SOUTIB 576 | 205h 0 0 0 0b309h 301h 577 | 205h 1d08h 0 0 0b309h 200h sra SRA 578 | 204h 0 0 0 0b209h 301h 579 | 204h 1d08h 0 0 0b209h 200h srab SRAB 580 | 206h 0 0 0 0b30dh 301h 581 | 206h 1d08h 0 0 0b30dh 200h sral SRAL 582 | 205h 0 0 0 0b301h 301h 583 | 205h 1d08h 0 0 0b301h 200h srl SRL 584 | 204h 0 0 0 0b201h 301h 585 | 204h 1d08h 0 0 0b201h 200h srlb SRLB 586 | 206h 0 0 0 0b305h 301h 587 | 206h 1d08h 0 0 0b305h 200h srll SRLL 588 | 305h 205h 0 0 8300h 0 589 | 305h 1d08h 0 0 300h 0 590 | 305h 209h 0 0 300h 0 591 | 305h 90ah 0 0 4300h 0 sub SUB 592 | 304h 204h 0 0 8200h 0 593 | 304h 1c08h 0 0 200h 0 594 | 304h 209h 0 0 200h 0 595 | 304h 90ah 0 0 4200h 0 subb SUBB 596 | 306h 206h 0 0 9200h 0 597 | 306h 1e08h 0 0 1200h 0 598 | 306h 209h 0 0 1200h 0 599 | 306h 90ah 0 0 5200h 0 subl SUBL 600 | 30dh 205h 0 0 0af00h 0 tcc TCC 601 | 30dh 204h 0 0 0ae00h 0 tccb TCCB 602 | 205h 0 0 0 8d04h 0 603 | 209h 0 0 0 0d04h 0 604 | 90ah 0 0 0 4d04h 0 test TEST 605 | 204h 0 0 0 8c04h 0 606 | 209h 0 0 0 0c04h 0 607 | 90ah 0 0 0 4c04h 0 testb TESTB 608 | 206h 0 0 0 9c08h 0 609 | 209h 0 0 0 1c08h 0 610 | 90ah 0 0 0 5c08h 0 testl TESTL 611 | 209h 609h 505h 0 0b808h 100h trdb TRDB 612 | 209h 609h 505h 0 0b80ch 100h trdrb TRDRB 613 | 209h 609h 505h 0 0b800h 100h trib TRIB 614 | 209h 609h 505h 0 0b804h 100h trirb TRIRB 615 | 209h 609h 505h 0 0b80ah 100h trtdb TRTDB 616 | 209h 609h 505h 0 0b80eh 10eh trtdrb TRTDRB 617 | 209h 609h 505h 0 0b802h 100h trtib TRTIB 618 | 209h 609h 505h 0 0b806h 10eh trtirb TRTIRB 619 | 205h 0 0 0 8d06h 0 620 | 209h 0 0 0 0d06h 0 621 | 90ah 0 0 0 4d06h 0 tset TSET 622 | 204h 0 0 0 8c06h 0 623 | 209h 0 0 0 0c06h 0 624 | 90ah 0 0 0 4c06h 0 tsetb TSETB 625 | 305h 205h 0 0 8900h 0 626 | 305h 1d08h 0 0 900h 0 627 | 305h 209h 0 0 900h 0 628 | 305h 90ah 0 0 4900h 0 xor XOR 629 | 304h 204h 0 0 8800h 0 630 | 304h 1c08h 0 0 800h 0 631 | 304h 209h 0 0 800h 0 632 | 304h 90ah 0 0 4800h 0 xorb XORB 633 | 634 | 1 .end .END 635 | 2 .equ .EQU 636 | 3 .input .INPUT 637 | 4 .byte .BYTE 638 | 5 .word .WORD 639 | 6 .set .SET 640 | 7 .block .BLOCK 641 | 8 .org .ORG 642 | 9 .clist .CLIST 643 | 10 .sect .SECT 644 | 11 .space .SPACE 645 | 12 .stitle .STITLE 646 | 13 .title .TITLE 647 | 14 .list .LIST 648 | 15 .else .ELSE 649 | 16 .endif .ENDIF 650 | 17 .if .IF 651 | 18 .global .GLOBAL 652 | 19 .abs .ABS 653 | 20 .align .ALIGN 654 | 21 .within .WITHIN 655 | 22 .macro .MACRO 656 | 23 .endm .ENDM 657 | 24 .long .LONG 658 | 25 .eject .EJECT 659 | 26 .common .COMMON 660 | 28 .endr .ENDR 661 | 29 .repeat .REPEAT 662 | 30 .error .ERROR 663 | 31 .exit .EXIT 664 | 33 .warn .WARN 665 | 51 .epuid .EPUID 666 | 667 | 100h $ 668 | 1000h rh0 RH0 669 | 1001h rh1 RH1 670 | 1002h rh2 RH2 671 | 1003h rh3 RH3 672 | 1004h rh4 RH4 673 | 1005h rh5 RH5 674 | 1006h rh6 RH6 675 | 1007h rh7 RH7 676 | 1008h rl0 RL0 677 | 1009h rl1 RL1 678 | 100ah rl2 RL2 679 | 100bh rl3 RL3 680 | 100ch rl4 RL4 681 | 100dh rl5 RL5 682 | 100eh rl6 RL6 683 | 100fh rl7 RL7 684 | 1100h r0 R0 685 | 1101h r1 R1 686 | 1102h r2 R2 687 | 1103h r3 R3 688 | 1104h r4 R4 689 | 1105h r5 R5 690 | 1106h r6 R6 691 | 1107h r7 R7 692 | 1108h r8 R8 693 | 1109h r9 R9 694 | 110ah r10 R10 695 | 110bh r11 R11 696 | 110ch r12 R12 697 | 110dh r13 R13 698 | 110eh r14 R14 699 | 110fh r15 R15 700 | 1200h rr0 RR0 701 | 1202h rr2 RR2 702 | 1204h rr4 RR4 703 | 1206h rr6 RR6 704 | 1208h rr8 RR8 705 | 120ah rr10 RR10 706 | 120ch rr12 RR12 707 | 120eh rr14 RR14 708 | 1300h rq0 RQ0 709 | 1304h rq4 RQ4 710 | 1308h rq8 RQ8 711 | 130ch rq12 RQ12 712 | 1401h lt LT flu FLU 713 | 1402h le LE flue FLUE 714 | 1403h ule ULE fle FLE 715 | 1404h ov OV pe PE p P v V fun FUN 716 | 1405h mi MI s S 717 | 1406h z Z eq EQ feq FEQ 718 | 1407h c C ult ULT flt FLT 719 | 1409h ge GE fge FGE 720 | 140ah gt GT fgt FGT 721 | 140bh ugt UGT fgu FGU 722 | 140ch nov NOV po PO ford FORD 723 | 140dh pl PL 724 | 140eh nz NZ ne NE fneu FNEU 725 | 140fh nc NC uge UGE fgeu FGEU 726 | 150eh nvi NVI 727 | 150dh vi VI 728 | 1602h fcw FCW 729 | 1603h refresh REFRESH 730 | 1604h psapseg PSAPSEG 731 | 1605h psapoff PSAPOFF psap PSAP 732 | 1606h nspseg NSPSEG 733 | 1607h nspoff NSPOFF nsp NSP 734 | 1701h flags FLAGS 735 | 1800h f0 F0 736 | 1801h f1 F1 737 | 1802h f2 F2 738 | 1803h f3 F3 739 | 1804h f4 F4 740 | 1805h f5 F5 741 | 1806h f6 F6 742 | 1807h f7 F7 743 | 1900h sc SC 744 | 1901h pc1 PC1 745 | 1902h pc2 PC2 746 | 1904h fflags FFLAGS 747 | 1a06h fop1 FOP1 748 | 1a07h fop2 FOP2 749 | 1b00h ouflg OUFLG 750 | 1b01h invflg INVFLG 751 | 1b02h intflg INTFLG 752 | 1b03h sysflg SYSFLG 753 | 1b04h cmpflg CMPFLG 754 | 1c01h inv INV 755 | 1c02h fov FOV 756 | 1c04h un UN 757 | 1c08h dz DZ 758 | 1c10h inx INX 759 | 1c20h de DE 760 | 1c40h nan NAN NaN 761 | 1c80h ix IX 762 | 1d00h rn RN 763 | 1d10h rz RZ 764 | 1d20h rp RP 765 | 1d30h rm RM 766 | 1e05h user USER 767 | 1f01h sgl SGL 768 | 1f03h dbl DBL 769 | ; @(#)asz8k.pdc 3.2 770 |  771 | -------------------------------------------------------------------------------- /cpm8k/packages/base/asz8k.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/asz8k.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/basepa.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* */ 3 | /* B A S E P A G E . H */ 4 | /* ------------------- */ 5 | /* */ 6 | /* This file contains a definition of the CP/M basepage structure, */ 7 | /* b_page. */ 8 | /* */ 9 | /* NOTE: In the portable CP/M environment, it is NOT guaranteed */ 10 | /* that the location of the base page is known at link-edit time */ 11 | /* (as it is, for example, in CP/M-80 and CP/M-86.) Instead, a */ 12 | /* pointer to the current basepage is delivered by the BDOS */ 13 | /* to each new program which is run. This pointer, _base, is */ 14 | /* initialized by the C startup function (startup.s) and is */ 15 | /* available to C programs as an external. */ 16 | /* */ 17 | /* This file has been modified to live with the BDOS definitions. */ 18 | /* */ 19 | /****************************************************************************/ 20 | 21 | #ifndef BASEPA_H 22 | #define BASEPA_H 23 | 24 | struct b_page 25 | { 26 | XADDR ltpa; /* Low TPA address */ 27 | XADDR htpa; /* High TPA address */ 28 | XADDR lcode; /* Start address of code seg*/ 29 | long codelen; /* Code segment length */ 30 | XADDR ldata; /* Start address of data seg*/ 31 | long datalen; /* Data segment length */ 32 | XADDR lbss; /* Start address of bss seg */ 33 | long bsslen; /* Bss segment length */ 34 | long freelen; /* Free segment length */ 35 | char resvd1[20]; /* Reserved area */ 36 | struct fcb fcb2; /* Second basepage FCB */ 37 | struct fcb fcb1; /* First basepage FCB */ 38 | char buff[128]; /* Default DMA buffer, */ 39 | /* command line tail */ 40 | }; 41 | 42 | #endif /* BASEPA_H */ 43 |  44 | -------------------------------------------------------------------------------- /cpm8k/packages/base/bdos.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* */ 3 | /* B D O S . H */ 4 | /* ----------- */ 5 | /* */ 6 | /* Copyright (c) 1982, Zilog Incorporated */ 7 | /* */ 8 | /* Macros defining the direct BDOS calls used by the standard CP/M */ 9 | /* utilities (ED, PIP, STAT, SET, SHOW.) Some necessary data */ 10 | /* data structures are also defined. */ 11 | /* */ 12 | /* All macros return a long value, even when the BDOS function they */ 13 | /* call does produce a return parameter. */ 14 | /* */ 15 | /* This header file can be used applications which do not require */ 16 | /* to use the C standard I/O library functions. For applications */ 17 | /* which require the library, but which wish to make use of the */ 18 | /* additional information in this file, cpm.h should be included in */ 19 | /* the source ahead of this file. The compiler flags multiple */ 20 | /* definition errors if this ordering is not observed. */ 21 | /* */ 22 | /* portab.h must always be included ahead of this file. */ 23 | /* */ 24 | /****************************************************************************/ 25 | 26 | #ifndef BDOS_H 27 | #define BDOS_H 28 | 29 | extern long __BDOS(); /* BDOS entry point */ 30 | 31 | #define XADDR long /* 32-bit address data type */ 32 | 33 | /****************************************************************************/ 34 | /* The following BDOS calls are defined in cpm.h. Define them only if they */ 35 | /* are not defined already. */ 36 | /****************************************************************************/ 37 | 38 | #ifndef EXIT /* Find out where we stand */ 39 | /* Define if necessary */ 40 | #define EXIT 0 /* Exit to BDOS */ 41 | #define CONOUT 2 /* Direct console output */ 42 | #define LSTOUT 5 /* Direct list device output*/ 43 | #define CONIO 6 /* Direct console I/O */ 44 | #define CONBUF 10 /* Read console buffer */ 45 | #define OPEN 15 /* OPEN a disk file */ 46 | #define CLOSE 16 /* Close a disk file */ 47 | #define DELETE 19 /* Delete a disk file */ 48 | #define CREATE 22 /* Create a disk file */ 49 | #define SETDMA 26 /* Set DMA address */ 50 | #define B_READ 33 /* Read Random record */ 51 | #define B_WRITE 34 /* Write Random record */ 52 | #define FILSIZ 35 /* Compute File Size */ 53 | #define SETMSC 44 /* Set Multi-Sector Count */ 54 | 55 | #endif 56 | 57 | /****************************************************************************/ 58 | /* The following BDOS calls are not defined in cpm.h */ 59 | /****************************************************************************/ 60 | 61 | #define CONIN 1 /* Single char I/P with echo*/ 62 | #define READER 3 /* Paper tape input */ 63 | #define PUNCH 4 /* Paper tape output */ 64 | #define GET_IOB 7 /* Get I/O byte */ 65 | #define SET_IOB 8 /* Set I/O byte */ 66 | #define PRINT 9 /* Print $-terminated line */ 67 | #define CONSTAT 11 /* Check if I/P char waiting*/ 68 | #define VERSION 12 /* Return version number */ 69 | #define RS_DISK 13 /* Reset disk system */ 70 | #define SEL_DISK 14 /* Select disk */ 71 | #define SRCH_1ST 17 /* Search 1st filename match*/ 72 | #define SRCH_NEXT 18 /* Search next match */ 73 | #define S_READ 20 /* Sequential read from file*/ 74 | #define S_WRITE 21 /* Sequential write to file */ 75 | #define RENAME 23 /* Rename a file */ 76 | #define RET_LOGIN 24 /* Return login vector */ 77 | #define RET_CDISK 25 /* Return current disk */ 78 | #define GET_ALLOC 27 /* Get allocation vector */ 79 | #define WR_PROTD 28 /* Write protect disk */ 80 | #define GET_RO 29 /* Get read-only vector */ 81 | #define SET_ATT 30 /* Set file attributes */ 82 | #define GET_DPB 31 /* Get disk parameters */ 83 | #define GSET_UCODE 32 /* Get/set user code */ 84 | #define SET_RAND 36 /* Set random record */ 85 | #define RS_DRIVE 37 /* Reset disk specified drv */ 86 | /* 38, 39 not used */ 87 | #define B_WRZF 40 /* Write random, zero fill */ 88 | /* 41 - 43 not used */ 89 | #define RET_ERRORS 45 /* Set error return mode */ 90 | #define GET_DFS 46 /* Get free disk space */ 91 | #define CHAIN 47 /* Chain to program via CCP */ 92 | #define FLUSH 48 /* Flush buffers to disk */ 93 | #define GSET_SCB 49 /* Get/set system control bk*/ 94 | #define BIOS_CALL 50 /* Direct call to BIOS */ 95 | /* 51 - 58 not used */ 96 | #define PROG_LOAD 59 /* Program load */ 97 | /* 60 unused */ 98 | #define SET_EXV 61 /* Set exception vector */ 99 | #define SET_SUP 62 /* Set supervisor state */ 100 | #define SET_LABEL 100 /* Set directory label */ 101 | #define GET_LABEL 101 /* Get directory label */ 102 | #define GET_XFCB 102 /* Get extended FCB */ 103 | #define SET_XFCB 103 /* Set extended FCB */ 104 | #define COND_LST 161 /* Conditionally attach LST:*/ 105 | 106 | /****************************************************************************/ 107 | /* The macros themselves... */ 108 | /****************************************************************************/ 109 | 110 | #define _conin() (__BDOS(CONIN, (long) 0)) 111 | 112 | #define _conout(a) (__BDOS(CONOUT, (long) (a))) 113 | 114 | #define _reader() (__BDOS(READER, (long) 0)) 115 | 116 | #define _punch(a) (__BDOS(PUNCH, (long) (a))) 117 | 118 | #define _lstout(a) (__BDOS(LSTOUT, (long) (a))) 119 | 120 | #define _conio(a) (__BDOS(CONIO, (long) (a))) 121 | 122 | #define _get_iob() (__BDOS(GET_IOB, (long) 0)) 123 | 124 | #define _set_iob(a) (__BDOS(SET_IOB, (long) (a))) 125 | 126 | #define _print(a) (__BDOS(PRINT, (long) (a))) 127 | 128 | #define _conbuf(a) (__BDOS(CONBUF, (long) (a))) 129 | 130 | #define _constat() (__BDOS(CONSTAT, (long) 0)) 131 | 132 | #define _version() (__BDOS(VERSION, (long) 0)) 133 | 134 | #define _rs_disk(a) (__BDOS(RS_DISK, (long) (a))) 135 | 136 | #define _sel_disk(a) (__BDOS(SEL_DISK, (long) (a))) 137 | 138 | #define _open(a) (__BDOS(OPEN, (long) (a))) 139 | 140 | #define _close(a) (__BDOS(CLOSE, (long) (a))) 141 | 142 | #define _srch_1st(a) (__BDOS(SRCH_1ST, (long) (a))) 143 | 144 | #define _srch_next() (__BDOS(SRCH_NEXT, (long) 0)) 145 | 146 | #define _delete(a) (__BDOS(DELETE, (long) (a))) 147 | 148 | #define _s_read(a) (__BDOS(S_READ, (long) (a))) 149 | 150 | #define _s_write(a) (__BDOS(S_WRITE, (long) (a))) 151 | 152 | #define _create(a) (__BDOS(CREATE, (long) (a))) 153 | 154 | #define _rename(a) (__BDOS(RENAME, (long) (a))) 155 | 156 | #define _ret_login() (__BDOS(RET_LOGIN, (long) 0)) 157 | 158 | #define _ret_cdisk() (__BDOS(RET_CDISK, (long) 0)) 159 | 160 | #define _setdma(a) (__BDOS(SETDMA, (long) (a))) 161 | 162 | #define _get_alloc() (__BDOS(GET_ALLOC, (long) 0)) 163 | 164 | #define _wr_protd() (__BDOS(WR_PROTD, (long) 0)) 165 | 166 | #define _get_ro() (__BDOS(GET_RO, (long) 0)) 167 | 168 | #define _set_att(a) (__BDOS(SET_ATT, (long) (a))) 169 | 170 | /* _get_dpb has parameter in*/ 171 | /* some implementations */ 172 | /* of CP/M but not others */ 173 | /* This macro suitable only */ 174 | /* for former */ 175 | #define _get_dpb(a) (__BDOS(GET_DPB, (long) (a))) 176 | /* This one handles latter */ 177 | #define _get_dpa() (__BDOS(GET_DPB, (long) 0)) 178 | 179 | #define _gset_ucode(a) (__BDOS(GSET_UCODE, (long) (a))) 180 | 181 | #define _b_read(a) (__BDOS(B_READ, (long) (a))) 182 | 183 | #define _b_write(a) (__BDOS(B_WRITE, (long) (a))) 184 | 185 | #define _filsiz(a) (__BDOS(FILSIZ, (long) (a))) 186 | 187 | #define _set_rand(a) (__BDOS(SET_RAND, (long) (a))) 188 | 189 | #define _rs_drive(a) (__BDOS(RS_DRIVE, (long) (a))) 190 | 191 | #define _b_wrzf(a) (__BDOS(B_WRZF, (long) (a))) 192 | 193 | #define _setmsc(a) (__BDOS(SETMSC, (long) (a))) 194 | 195 | #define _ret_errors(a) (__BDOS(RET_ERRORS, (long) (a))) 196 | 197 | #define _get_dfs(a) (__BDOS(GET_DFS, (long) (a))) 198 | 199 | #define _chain() (__BDOS(CHAIN, (long) 0)) 200 | 201 | #define _flush() (__BDOS(FLUSH, (long) 0)) 202 | 203 | #define _gset_scb(a) (__BDOS(GSET_SCB, (long) (a))) 204 | 205 | #define _bios_call(a) (__BDOS(BIOS_CALL, (long) (a))) 206 | 207 | #define _prog_load(a) (__BDOS(PROG_LOAD, (long) (a))) 208 | 209 | #define _set_exv(a) (__BDOS(SET_EXV, (long) (a))) 210 | 211 | #define _set_sup(a) (__BDOS(SET_SUP, (long) 0)) 212 | 213 | #define _get_label(a) (__BDOS(GET_LABEL, (long) (a))) 214 | 215 | #define _set_label(a) (__BDOS(SET_LABEL, (long) (a))) 216 | 217 | #define _get_xfcb(a) (__BDOS(GET_XFCB, (long) (a))) 218 | 219 | #define _set_xfcb(a) (__BDOS(SET_XFCB, (long) (a))) 220 | 221 | #define _cond_lst() (__BDOS(COND_LST, (long) 0)) 222 | 223 | /****************************************************************************/ 224 | /* BIOS calls, for use in conjunction with BDOS call 50 & struct bios_parms */ 225 | /****************************************************************************/ 226 | 227 | #define _INIT 0 /* Cold start */ 228 | #define _WARM 1 /* Warm start */ 229 | #define _CONST 2 /* Console status */ 230 | #define _CONIN 3 /* Read console character */ 231 | #define _CONOUT 4 /* Write console character */ 232 | #define _LIST 5 /* Write listing character */ 233 | #define _PUNCH 6 /* Write punch character */ 234 | #define _READER 7 /* Read tape character */ 235 | #define _HOME 8 /* Move to track 0 */ 236 | #define _SELDSK 9 /* Select disk drive */ 237 | #define _SETTRK 10 /* Set track number */ 238 | #define _SETSEC 11 /* Set sector number */ 239 | #define _SETDMA 12 /* Set DMA address */ 240 | #define _READ 13 /* Read selected sector */ 241 | #define _WRITE 14 /* Write selected sector */ 242 | #define _LISTST 15 /* Return list status */ 243 | #define _GETMRT 16 /* Get memory region table */ 244 | /* address */ 245 | #define _GETIOB 17 /* Get IOBYTE value */ 246 | #define _SETIOB 18 /* Set IOBYTE value */ 247 | #define _FLUSH 19 /* Flush buffers */ 248 | #define _SETEXC 20 /* Set exception vector */ 249 | 250 | /****************************************************************************/ 251 | /* FCB structure is defined in cpm.h. Define it here only if it is not */ 252 | /* defined already. Declare some useful values at the same time. */ 253 | /****************************************************************************/ 254 | 255 | #ifndef SECSIZ /* Not already declared? */ 256 | struct fcbtab /* File control block */ 257 | { /* */ 258 | BYTE drive; /* Disk drive field */ 259 | BYTE fname[8]; /* File name */ 260 | BYTE ftype[3]; /* File type */ 261 | BYTE extent; /* Current extent number */ 262 | BYTE s1,s2; /* "system reserved" */ 263 | BYTE reccnt; /* Record counter */ 264 | BYTE resvd[16]; /* More "system reserved" */ 265 | LONG record; /* Note -- we overlap the */ 266 | /* current record field to */ 267 | /* make this useful. */ 268 | }; 269 | 270 | #define fcb fcbtab /* A useful synonym */ 271 | #define SECSIZ 128 /* size of CP/M sector */ 272 | #define _MAXSXFR 1 /* max # sectors xferrable */ 273 | #define _MAXSHFT 12 /* shift right BDOS rtn val */ 274 | 275 | #endif 276 | 277 | /****************************************************************************/ 278 | /* Data structures not defined in cpm.h */ 279 | /****************************************************************************/ 280 | 281 | struct dpbs /* Disk parameter block */ 282 | { 283 | UWORD spt; /* Sectors per track */ 284 | BYTE bls; /* Block shift factor */ 285 | BYTE bms; /* Block mask */ 286 | BYTE exm; /* Extent mark */ 287 | /* BYTE filler; *** Pad to align words ***/ 288 | UWORD mxa; /* Maximum allocation (blks)*/ 289 | UWORD dmx; /* Max directory entries */ 290 | UWORD dbl; /* Directory alloc. map */ 291 | UWORD cks; /* Directory checksum */ 292 | UWORD ofs; /* Track offset from track 0*/ 293 | }; 294 | 295 | struct bios_parm /* BIOS parameters for BDOS */ 296 | { /* call 50 */ 297 | UWORD req; /* BIOS request code */ 298 | LONG p1; /* First parameter */ 299 | LONG p2; /* Second parameter */ 300 | }; 301 | 302 | struct scbs /* System control block */ 303 | { 304 | BYTE resvd_1[6]; /* Reserved for system use */ 305 | BYTE u_flags[4]; /* Utility flags */ 306 | BYTE d_flags[4]; /* Display flags */ 307 | BYTE clp_flags[2]; /* Command Line Proc flags */ 308 | UWORD p_error; /* Program error return code*/ 309 | BYTE resvd_2[8]; /* Reserved for system use */ 310 | BYTE con_w; /* Console width */ 311 | BYTE con_c; /* Console column */ 312 | BYTE con_l; /* Console page length */ 313 | BYTE resvd_3[5]; /* Reserved for system use */ 314 | UWORD conin_r; /* CONIN redirection flag */ 315 | UWORD conout_r; /* CONOUT redirection flag */ 316 | UWORD auxin_r; /* AUXIN redirection flag */ 317 | UWORD auxout_r; /* AUXOUT redirection flag */ 318 | UWORD lstout_r; /* LSTOUT redirection flag */ 319 | BYTE resvd_4[2]; /* Reserved for system use */ 320 | BOOLEAN ctl_h_a; /* Backspace active */ 321 | BOOLEAN rubout_a; /* Rubout active */ 322 | BYTE resvd_5[2]; /* Reserved for system use */ 323 | UWORD c_xlate; /* Console translate func. */ 324 | UWORD con_m; /* Console mode (raw/cooked)*/ 325 | UWORD buff_a; /* 128 byte buffer available*/ 326 | BYTE o_delim; /* Output delimiter */ 327 | BOOLEAN lo_flag; /* List output flag */ 328 | BYTE resvd_6[2]; /* Reserved for system use */ 329 | UWORD d_m_a; /* Current DMA address */ 330 | BYTE disk_no; /* Current disk */ 331 | BYTE bdos_info[2]; /* BDOS variable info */ 332 | BYTE resvd_7[3]; /* Reserved for system use */ 333 | BYTE user_no; /* Current user number */ 334 | BYTE resvd_8[6]; /* Reserved for system use */ 335 | BYTE bdos_mode; /* BDOS error mode */ 336 | BYTE c_chain[4]; /* Current search chain */ 337 | BYTE tmp_drv; /* Drive for temporary files*/ 338 | BYTE resvd_9[7]; /* Reserved for system use */ 339 | BYTE date_s[5]; /* Date stamp */ 340 | BYTE error_jmp[3]; /* Error jump */ 341 | UWORD cmb_a; /* Common memory base addr */ 342 | UWORD bdos_ent; /* BDOS entry point */ 343 | }; 344 | 345 | struct scbpb /* SCB parameter block */ 346 | { 347 | BYTE off; /* Index to data in SCB */ 348 | BYTE op; /* Operation: 0xff Set byte */ 349 | /* 0xfe Set word */ 350 | /* else Get word */ 351 | UWORD val; /* Byte/word value to be set*/ 352 | }; 353 | 354 | #define SET_BYTE 0xff 355 | #define SET_WORD 0xfe 356 | #define GET 0 357 | 358 | /****************************************************************************/ 359 | /* HILO must be defined for the Z8000. Undefine it first, in case cpm.h */ 360 | /* has already defined it. The tagless structures defining byte ordering */ 361 | /* which are declared in cpm.h are not redeclared here (the use of members */ 362 | /* of tagless structures to define offsets is an obsolete feature of the C */ 363 | /* language.) */ 364 | /****************************************************************************/ 365 | 366 | #undef HILO 367 | #define HILO 368 | 369 | #endif /* BDOS_H */ 370 |  371 | -------------------------------------------------------------------------------- /cpm8k/packages/base/cpm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* */ 3 | /* C P M . H */ 4 | /* --------- */ 5 | /* Copyright 1982 by Digital Research Inc. All rights reserved. */ 6 | /* */ 7 | /* This file contains CP/M specific definitions for the CP/M */ 8 | /* C Run Time Library. */ 9 | /* This file is intended only for inclusion with those functions */ 10 | /* dealing directly with the BDOS, as well as any function which */ 11 | /* has hardware dependent code (byte storage order, for instance). */ 12 | /* */ 13 | /* must be included BEFORE this file. */ 14 | /* */ 15 | /****************************************************************************/ 16 | 17 | /* 18 | * CP/M FCB definition 19 | */ 20 | 21 | #ifndef CPM_H 22 | #define CPM_H 23 | 24 | struct fcbtab /****************************/ 25 | { /* */ 26 | BYTE drive; /* Disk drive field */ 27 | BYTE fname[8]; /* File name */ 28 | BYTE ftype[3]; /* File type */ 29 | BYTE extent; /* Current extent number */ 30 | BYTE s1,s2; /* "system reserved" */ 31 | BYTE reccnt; /* Record counter */ 32 | BYTE resvd[16]; /* More "system reserved" */ 33 | LONG record; /* Note -- we overlap the */ 34 | /* current record field to */ 35 | /* make this useful. */ 36 | }; /****************************/ 37 | #define SECSIZ 128 /* size of CP/M sector */ 38 | #define _MAXSXFR 1 /* max # sectors xferrable */ 39 | #define _MAXSHFT 12 /* shift right BDOS rtn val */ 40 | /* to obtain nsecs on err */ 41 | /****************************/ 42 | /****************************************************************************/ 43 | /* */ 44 | /* Channel Control Block (CCB) */ 45 | /* */ 46 | /* One CCB is allocated (statically) for each of the 16 possible open */ 47 | /* files under C (including STDIN, STDOUT, STDERR). Permanent data */ 48 | /* regarding the channel is kept here. */ 49 | /* */ 50 | /* */ 51 | /****************************************************************************/ 52 | 53 | struct ccb /************************************/ 54 | { /* */ 55 | BYTE flags; /* Flags byte */ 56 | BYTE chan; /* Channel number being used */ 57 | LONG offset; /* File offset word (bytes) */ 58 | LONG sector; /* Sector currently in buffer */ 59 | LONG hiwater; /* High water mark */ 60 | struct fcbtab fcb; /* File FCB (may have TTY info)*/ 61 | BYTE buffer[SECSIZ]; /* Read/write buffer */ 62 | }; /************************************/ 63 | 64 | #define MAXCCBS 16 /* Maximum # CC Blocks */ 65 | extern struct ccb _fds[MAXCCBS]; /* Declare storage */ 66 | #define FD struct ccb /* FD Type definition */ 67 | /************************************/ 68 | /* Flags word bit definitions */ 69 | /************************************/ 70 | #define OPENED 0x01 /* Channel is OPEN */ 71 | #define ISTTY 0x02 /* Channel open to TTT */ 72 | #define ISLPT 0x04 /* Channel open to LPT */ 73 | #define ISREAD 0x08 /* Channel open readonly */ 74 | #define ISASCII 0x10 /* ASCII file attached */ 75 | #define ATEOF 0x20 /* End of file encountered */ 76 | #define DIRTY 0x40 /* Buffer needs writing */ 77 | #define ISSPTTY 0x80 /* Special tty info */ 78 | /************************************/ 79 | #define READ 0 /* Read mode parameter for open */ 80 | #define WRITE 1 /* Write mode */ 81 | 82 | /* CCB manipulation macros *************************************/ 83 | #define _getccb(i) (&_fds[i]) /* Get CCB addr */ 84 | 85 | /* Error handling *************************************/ 86 | EXTERN WORD errno; /* error place for assigning */ 87 | EXTERN WORD __cpmrv; /* the last BDOS return value */ 88 | EXTERN WORD _errcpm; /* place to save __cpmrv */ 89 | #define RETERR(val,err) {errno=(err);_errcpm=__cpmrv;return(val);} 90 | /************************************/ 91 | 92 | /****************************************************************************/ 93 | /* */ 94 | /* B D O S F u n c t i o n D e f i n i t i o n s */ 95 | /* ------------------------------------------------- */ 96 | /* */ 97 | /* Following are BDOS function definitions used by the C runtime */ 98 | /* library. */ 99 | /* */ 100 | /****************************************************************************/ 101 | 102 | /****************************/ 103 | #define EXIT 0 /* Exit to BDOS */ 104 | #define CONOUT 2 /* Direct console output */ 105 | #define LSTOUT 5 /* Direct list device output*/ 106 | #define CONIO 6 /* Direct console I/O */ 107 | #define CONBUF 10 /* Read console buffer */ 108 | #define OPEN 15 /* OPEN a disk file */ 109 | #define CLOSE 16 /* Close a disk file */ 110 | #define DELETE 19 /* Delete a disk file */ 111 | #define CREATE 22 /* Create a disk file */ 112 | #define SETDMA 26 /* Set DMA address */ 113 | #define B_READ 33 /* Read Random record */ 114 | #define B_WRITE 34 /* Write Random record */ 115 | #define FILSIZ 35 /* Compute File Size */ 116 | #define SETMSC 44 /* Set Multi-Sector Count */ 117 | /****************************/ 118 | 119 | /****************************************************************************/ 120 | /* Other CP/M definitions */ 121 | /****************************************************************************/ 122 | #define TERM "CON:" /* Console file name */ 123 | #define LIST "LST:" /* List device file name */ 124 | #define EOFCHAR 0x1a /* End of file character-^Z */ 125 | /****************************/ 126 | /****************************************************************************/ 127 | /* Hardware dependencies */ 128 | /****************************************************************************/ 129 | #define HILO /* used when bytes stored */ 130 | /* Hi,Lo */ 131 | /****************************/ 132 | #ifdef HILO /* Hi/Lo storage used in */ 133 | struct { /* 68K */ 134 | BYTE lbhihi; /* Use this for accessing */ 135 | BYTE lbhilo; /* ordered bytes in 32 bit*/ 136 | BYTE lblohi; /* LONG qtys. */ 137 | BYTE lblolo; /* */ 138 | }; /* */ 139 | struct { /* Use this for accessing */ 140 | WORD lwhi; /* ordered words in 32 bit*/ 141 | WORD lwlo; /* LONG qtys. */ 142 | }; /* */ 143 | #else /****************************/ 144 | struct { /* Lo/Hi storage use on */ 145 | BYTE lblolo; /* PDP-11, VAX, 8086,... */ 146 | BYTE lblohi; /* */ 147 | BYTE lbhilo; /* */ 148 | BYTE lbhihi; /* */ 149 | }; /* */ 150 | struct { /* */ 151 | WORD lwlo; /* */ 152 | WORD lwhi; /* */ 153 | }; /* */ 154 | #endif /****************************/ 155 | /*************************** end of cpm.h ***********************************/ 156 | 157 | #endif /* CPM_H */ 158 |  159 | -------------------------------------------------------------------------------- /cpm8k/packages/base/ctype.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * CTYPE.H - macros to classify ASCII-coded integers by table lookup. 3 | * 4 | * 5 | * Note: Integer args are undefined for all int values > 127, 6 | * except for macro 'isascii()'. 7 | * Assumes: 8 | * User will link with standard library functions. 9 | * Compiler can handle declarator initializers and 10 | * '#defines' with parameters. 11 | ***************************************************************************/ 12 | 13 | #ifndef CTYPE_H 14 | #define CTYPE_H 15 | 16 | /* Define bit patterns for character classes */ 17 | #define __c 01 18 | #define __p 02 19 | #define __d 04 20 | #define __u 010 21 | #define __l 020 22 | #define __s 040 23 | #define __cs 041 24 | #define __ps 042 25 | 26 | #ifndef CTYPE 27 | extern char __atab[]; 28 | #endif 29 | 30 | #define isascii(ch) ((ch) < 0200) 31 | #define isalpha(ch) (__atab[ch] & (__u | __l)) 32 | #define isupper(ch) (__atab[ch] & __u) 33 | #define islower(ch) (__atab[ch] & __l) 34 | #define isdigit(ch) (__atab[ch] & __d) 35 | #define isalnum(ch) (__atab[ch] & (__u | __l | __d)) 36 | #define isspace(ch) (__atab[ch] & __s) 37 | #define ispunct(ch) (__atab[ch] & __p) 38 | #define isprint(ch) (__atab[ch] & (__u | __l | __d | __p)) 39 | #define iscntrl(ch) (__atab[ch] & __c) 40 | #define tolower(ch) (isupper(ch) ? (ch)-'A'+'a' : (ch) ) 41 | #define toupper(ch) (islower(ch) ? (ch)-'a'+'A' : (ch) ) 42 | #define toascii(ch) ((ch) & 0177) 43 | 44 | #endif /* CTYPE_H */ 45 |  46 | -------------------------------------------------------------------------------- /cpm8k/packages/base/ddt.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/ddt.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/dump.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/dump.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/ed.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/ed.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * errno.h - error codes 3 | */ 4 | 5 | #ifndef ERRNO_H 6 | #define ERRNO_H 7 | 8 | #define EPERM 1 9 | #define ENOENT 2 10 | #define ESRCH 3 11 | #define EINTR 4 12 | #define EIO 5 13 | #define ENXIO 6 14 | #define E2BIG 7 15 | #define ENOEXEC 8 16 | #define EBADF 9 17 | #define ECHILD 10 18 | #define EAGAIN 11 19 | #define ENOMEM 12 20 | #define EACCES 13 21 | #define EFAULT 14 22 | #define ENOTBLK 15 23 | #define EBUSY 16 24 | #define EEXIST 17 25 | #define EXDEV 18 26 | #define ENODEV 19 27 | #define ENOTDIR 20 28 | #define EISDIR 21 29 | #define EINVAL 22 30 | #define ENFILE 23 31 | #define EMFILE 24 32 | #define ENOTTY 25 33 | #define ETXTBSY 26 34 | #define EFBIG 27 35 | #define ENOSPC 28 36 | #define ESPIPE 29 37 | #define EROFS 30 38 | #define EMLINK 31 39 | #define EPIPE 32 40 | 41 | /* math software */ 42 | #define EDOM 33 43 | #define ERANGE 34 44 | 45 | /* hereafter is available to CP/M specials */ 46 | #define ENODSPC 35 47 | 48 | /****** end of errno.h ******/ 49 | 50 | #endif /* ERRNO_H */ 51 |  52 | -------------------------------------------------------------------------------- /cpm8k/packages/base/ld8k.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/ld8k.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/libcpm.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/libcpm.a -------------------------------------------------------------------------------- /cpm8k/packages/base/nmz8k.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/nmz8k.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/opt.c: -------------------------------------------------------------------------------- 1 | #include "option.h" 2 | MINIMAL 3 |  4 | -------------------------------------------------------------------------------- /cpm8k/packages/base/opt1.c: -------------------------------------------------------------------------------- 1 | #include "option.h" 2 | NOFLOAT 3 |  4 | -------------------------------------------------------------------------------- /cpm8k/packages/base/option.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * 3 | * O P T I O N H e a d e r F i l e 4 | * ----------------------------------- 5 | * Copyright 1984 by Digital Research Inc. 6 | * 7 | * Date: 3/7/84 8 | * 9 | * The CLEAR*.L86 libraries provide a large number of functions which 10 | * are not needed by every program, but which must be linked into the program 11 | * because their usage is data driven. One example is the floating point 12 | * conversion routines in the "printf()" function. The programmer can specify 13 | * "%f", "%g" or "%e" conversions which the linker can not detect. If the 14 | * program never needs or uses these conversions, the code in the "printf()" 15 | * routine will never be used. The "option.h" module gives the programmer 16 | * a mechanism of communicating to the linker that certain low level functions 17 | * are optional (not used by the program), and can be left out to save space 18 | * in the program load image (.CMD file). 19 | * 20 | * "option.h" provides a set of definitions which allow the programmer 21 | * to specify certain options of the CLEAR* Run Time libraries (CLEARS.L86 or 22 | * CLEARL.L86) which the program does not use. The programmer can 23 | * choose broad sets of options (i.e. "MINIMAL"), or can choose specific 24 | * options to stub out of the final program (i.e. "NOFLOAT"). 25 | * 26 | * Each definition contains a "tag declaration". The tag declaration 27 | * will link in a module from the OPTION*.L86 (OPTIONS.L86 or OPTIONL.L86) 28 | * library which also contains a "stubroutine" for some internal 29 | * function of the CLEAR* Run Time Library. 30 | * 31 | * For example, the definition of NOFLOAT is "int nofloat();". When 32 | * the programmer specifies "NOFLOAT" in the source file and then links the 33 | * final program with the OPTION* library, the linker links in the module from 34 | * the OPTION* library which contains "nofloat()". This module also contains 35 | * certain stubroutines which satisfy functional references to the floating 36 | * point conversion routines in "printf()". Thus, the code for these 37 | * conversions will not be linked into the final program load image. If 38 | * the program happens to use the "%f", "%g" or "%e" printf() conversions, 39 | * the stubroutines provided will print an error message and exit. 40 | * 41 | * We recommend that the programmer compile a separate module containing 42 | * the tag definitions, and then link this module and the OPTION* library 43 | * along with the rest of the program. For example, to reduce the size of 44 | * the "hello.c" program load image, the programmer could prepare a file 45 | * (named "opt.c" in this example) that looks like: 46 | * opt.c: 47 | * #include "option.h" 48 | * MINIMAL 49 | * Then, after compiling hello.c and opt.c, the link command should look like: 50 | * LINK86 HELLO,OPT,OPTIONS.L86[SEARCH 51 | * Note that the "[SEARCH]" option is very important, since LINK86 will pull 52 | * in all routines in OPTIONS.L86 if you do not use this option. 53 | * 54 | * 55 | * Specific options are documented below. 56 | * 57 | ****************************************************************************/ 58 | 59 | 60 | /************* 61 | * NOFLOAT: link out floating point conversion routines in "printf()", 62 | * "fprintf()", and "sprintf()". 63 | **************/ 64 | #define NOFLOAT _nofloat(){ nofloat(); } 65 | 66 | /************* 67 | * NOLONG: link out long integer conversion routines in "printf()", 68 | * "fprintf()", and "sprintf()". 69 | * Saves: CPM small 3200, big 3500 70 | **************/ 71 | #define NOLONG _nolong(){ nolong(); } 72 | 73 | 74 | /************* 75 | * NOTTYIN: eliminates the functions to "read()" from the console. 76 | * Watch out when you use STDIN on reads. 77 | * Saves: CPM small 300, big 350 78 | *************/ 79 | #define NOTTYIN _nottyin(){ nottyin(); } 80 | 81 | 82 | 83 | /************* 84 | * NOWILDCARDS: eliminates wildcard expansion on command line. 85 | * Saves: CPM small 500, big 650 86 | *************/ 87 | #define NOWILDCARDS _nowildcards(){ nowildcards(); } 88 | 89 | 90 | 91 | /************************************************************************* 92 | * DISK I/O Options 93 | *************************************************************************/ 94 | 95 | /************* 96 | * MAXFILES5: reduces the maximum number of open files allowed from 16 to 5. 97 | * Note: this includes console files. 98 | * Saves: CPM small 1950, big 1950 99 | *************/ 100 | #define MAXFILES5 maxf5(){ maxfiles5(); } 101 | 102 | /************* 103 | * NOFILESZ: eliminates the functions to calculate the size of a file. 104 | * Watch out when you append 'fopen(name,"a")' or use 'lseek(fd,xx,2)'. 105 | * Saves: CPM small 550, big 800 106 | *************/ 107 | #define NOFILESZ _nofilesz(){ nofilesz(); } 108 | 109 | /************* 110 | * NOBINARY: eliminates BINARY low level Disk I/O subroutines. 111 | * Watch out when you do binary file i/o: openb(), creatb(), 112 | * fopenb(), freopb(). 113 | * Saves: CPM small 2200, big 2900 114 | *************/ 115 | #define NOBINARY _nobinary(){ nobinary(); } 116 | 117 | /************* 118 | * NOASCII: eliminates ASCII low level Disk I/O subroutines. 119 | * Watch out when you redirect output to a file, or do any ascii file i/o: 120 | * open(), opena(), creat(), creatb(), fopen(), fopena(), freopen(). 121 | * Saves: CPM small 1100, big 1500 122 | *************/ 123 | #define NOASCII noascii(){ noascii(); } 124 | 125 | 126 | 127 | /************* 128 | * MINIMAL: tags to make "hello.c" as small as possible. 129 | *************/ 130 | #define MINIMAL NOFLOAT NOTTYIN NOFILESZ MAXFILES5 NOWILDCARDS \ 131 | NOASCII NOBINARY 132 | 133 | 134 | 135 | /************* 136 | * NOSTARTUP: links out all of the CLEAR initialization routines, including 137 | * command line redirection (">", "<", and ">>" command line ops) and 138 | * wildcard expansion. Also leaves out opening STDIN, STDOUT, and STDERR. 139 | * Warning: this could have peculiar side effects, and should be used only 140 | * by experienced programmers. 141 | **************/ 142 | #define NOSTARTUP _nostartup(){ nostartup(); } 143 |  144 | -------------------------------------------------------------------------------- /cpm8k/packages/base/pip.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/pip.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/portab.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * C P / M C R U N T I M E L I B H E A D E R F I L E 4 | * ------------------------------------------------------------- 5 | * Copyright 1982 by Digital Research Inc. All rights reserved. 6 | * 7 | * This is an include file for assisting the user to write portable 8 | * programs for C. 9 | * 10 | *****************************************************************************/ 11 | 12 | #ifndef PORTAB_H 13 | #define PORTAB_H 14 | 15 | /* 16 | * Standard type definitions 17 | */ 18 | /***************************/ 19 | #define BYTE char /* Signed byte */ 20 | #define BOOLEAN char /* 2 valued (true/false) */ 21 | #define WORD short /* Signed word (16 bits) */ 22 | #define UWORD unsigned int /* unsigned word */ 23 | #define LONG long /* signed long (32 bits) */ 24 | #define ULONG unsigned long /* Unsigned long */ 25 | #define REG register /* register variable */ 26 | #define LOCAL auto /* Local var on 68000 */ 27 | #define EXTERN extern /* External variable */ 28 | #define MLOCAL static /* Local to module */ 29 | #define GLOBAL /**/ /* Global variable */ 30 | #define VOID /**/ /* Void function return */ 31 | /***************************/ 32 | #define UBYTE unsigned char /* Unsigned byte */ 33 | 34 | 35 | /****************************************************************************/ 36 | /* Miscellaneous Definitions: */ 37 | /****************************************************************************/ 38 | #define FAILURE (-1) /* Function failure return val */ 39 | #define SUCCESS (0) /* Function success return val */ 40 | #define YES 1 /* "TRUE" */ 41 | #define NO 0 /* "FALSE" */ 42 | #define FOREVER for(;;) /* Infinite loop declaration */ 43 | #define NULL 0 /* Null pointer value */ 44 | #define EOF (-1) /* EOF Value */ 45 | #define TRUE (1) /* Function TRUE value */ 46 | #define FALSE (0) /* Function FALSE value */ 47 | 48 | /*************************** end of portab.h ********************************/ 49 | 50 | #endif /* PORTAB_H */ 51 |  52 | -------------------------------------------------------------------------------- /cpm8k/packages/base/setjmp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* */ 3 | /* s e t j m p . h */ 4 | /* --------------- */ 5 | /* */ 6 | /* Copyright 1982 by Zilog Inc. All rights reserved */ 7 | /* */ 8 | /* Definitions for setjmp and longjmp non-local goto library functions.*/ 9 | /* jmp_buf is large enough to hold copies of the eight "safe" */ 10 | /* registers and a segmented return address. Thus the last word is */ 11 | /* not used in non-segmented environments */ 12 | /* */ 13 | /****************************************************************************/ 14 | 15 | #ifndef SETJMP_H 16 | #define SETJMP_H 17 | 18 | typedef int jmp_buf[10]; 19 | 20 | extern int setjmp(), longjmp(); 21 | 22 | #endif /* SETJMP_H */ 23 |  24 | -------------------------------------------------------------------------------- /cpm8k/packages/base/signal.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************/ 2 | /* */ 3 | /* S i g n a l H e a d e r F i l e */ 4 | /* ----------------------------------- */ 5 | /* */ 6 | /* Copyright 1982 by Digital Research, Inc. All rights reserved. */ 7 | /* */ 8 | /* Define the "signal" arguments, so anyone using the function will */ 9 | /* not get compile-time errors. Some functions are not implemented. */ 10 | /* */ 11 | /****************************************************************************/ 12 | 13 | #ifndef SIGNAL_H 14 | #define SIGNAL_H 15 | 16 | #define NSIG 16 /* 16 simulated signals */ 17 | #define SIGHUP 1 /* Hangup */ 18 | #define SIGINT 2 /* Interrupt (^C) */ 19 | #define SIGQUIT 3 /* Quit signal */ 20 | #define SIGILL 4 /* Illegal Instruction trap */ 21 | #define SIGTRAP 5 /* Trace Trap */ 22 | #define SIGIOT 6 /* IOT instruction (on PDP-11) */ 23 | #define SIGEMT 7 /* EMT instruction (TRAP on 68k) */ 24 | #define SIGFPE 8 /* Floating point exception */ 25 | #define SIGKILL 9 /* Kill (cannot be intercepted) */ 26 | #define SIGBUS 10 /* BUSERR (non-ex memory reference) */ 27 | #define SIGSEGV 11 /* Segmentation (MMU) violation */ 28 | #define SIGSYS 12 /* Bad argument to system call */ 29 | #define SIGPIPE 13 /* Write on a broken pipe */ 30 | #define SIGALRM 14 /* Alarm clock (what a name!) */ 31 | #define SIGTERM 15 /* Software termination signal */ 32 | /************************************/ 33 | #define BADSIG (-1L) /* Error return */ 34 | #define SIG_DFL (0L) /* Default action on signal call */ 35 | #define SIG_IGN (1L) /* Ignore */ 36 | /************************************/ 37 | 38 | #endif /* SIGNAL_H */ 39 |  40 | -------------------------------------------------------------------------------- /cpm8k/packages/base/sizez8k.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/sizez8k.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/startup.8kn: -------------------------------------------------------------------------------- 1 | ;******************************************************* 2 | ;* 3 | ;* S T A R T U P 4 | ;* ------------- 5 | ;* Copyright 1984, Digital Research Inc. 6 | ;* All rights reserved 7 | ;* 8 | ;* C runtime startup for CP/M-Z8K (tm) 9 | ;* 10 | ;* Modified by rfw 03/20/84 save new break address 11 | ;* Bill Gord - 7 Sept 84 - add word to __con segment 12 | ;* to prevent data allocation 13 | ;* at word 0 in split I/D 14 | ;* - __sovf properly puts message 15 | ;* pointer in RR6 16 | ;* Bill Gord 15 Nov 84 - Add m.init entry to keep 17 | ;* REAL compilers happy 18 | ;* - Rearranged startup/exit code 19 | ;* - stack overflow test in __BDOS 20 | ;* 2 Dec 84 - BG - now that ld8k prevents use of word zero 21 | ;* in splid I/D, remove use of __con 22 | ;* 19 Dec 84 BG - properly initialize the USER, FFLAGS, and 23 | ;* F0...F7 registers in Z8070 (or its 24 | ;* emulator) 25 | ;* 26 | ;******************************************************* 27 | 28 | ;******************************************************* 29 | ;* 30 | ;*This module contains the following entry points: 31 | ;* 32 | ;*m.init: 33 | ;*__start: 34 | ;* The low-level runtime startup routine for C 35 | ;* programs. Clears BSS area, sets up global 36 | ;* pointers to basepage (__base) and end of BSS 37 | ;* (__break). Passes start address and length of 38 | ;* command line tail to __main (see xmain.c) for 39 | ;* tokenizing. __main calls the user's main 40 | ;* function. On return from __main, __exit (see 41 | ;* below) is entered. 42 | ;* 43 | ;*__exit: 44 | ;* Default return address for programs. The 45 | ;* address of __exit (0x0002) is pushed onto the 46 | ;* user stack before each user program is run. 47 | ;* __exit performs a warm boot. Most user 48 | ;* programs will end with an explicit warm boot or 49 | ;* with a call to exit(), which in turn does a 50 | ;* call to _exit() (true name __exit.) after 51 | ;* cleaning up the Standard I/O system. 52 | ;* 53 | ;*_brk: 54 | ;* C definition: BYTE *brk(addr) 55 | ;* BYTE *addr; 56 | ;* 57 | ;* Change the position of the end of BSS for the 58 | ;* user program. Checks only that the new value 59 | ;* does not come too close to the stack. Returns 60 | ;* -1 if it does, 0 if it is OK. 61 | ;* 62 | ;*___BDOS: 63 | ;* C definition: UWORD __BDOS(number, argument) 64 | ;* UWORD number; 65 | ;* LONG argument; 66 | ;* 67 | ;* C interface to BDOS. Calls BDOS function 68 | ;* with argument . Returns 69 | ;* BDOS return value. 70 | ;* 71 | ;* In addition, a number of global variables are 72 | ;* defined. See below for details. 73 | ;* 74 | ;*************************************************** 75 | 76 | ;*************************************************** 77 | ;* 78 | ;* Globals (can be used by other modules) 79 | ;* 80 | ;*************************************************** 81 | 82 | .global __start ; Runtime startup 83 | .global m.init 84 | .global __exit ; Default return 85 | .global _brk ; brk function 86 | .global ___BDOS ; BDOS entry point 87 | 88 | .global __break ; Initial bss end 89 | .global ___cpmrv ; BDOS return value 90 | .global __base ; Pointer to basepage 91 | .global __sovf ; Stack Overflow 92 | .global _rw_ 93 | 94 | .global ___pname ; (Fake) program name 95 | .global ___tname ; Console name 96 | .global ___lname ; List device name 97 | .global ___xeof ; End of file char 98 | 99 | ;*************************************************** 100 | ;* 101 | ;* Externals (defined in other modules) 102 | ;* 103 | ;*************************************************** 104 | 105 | .global __main ; Main C function 106 | 107 | ;*************************************************** 108 | ;* 109 | ;* Definitions 110 | ;* 111 | ;*************************************************** 112 | 113 | ; Offsets in basepage 114 | lbss .equ 24 ; Pointer to bss start 115 | bsslen .equ 28 ; Bss length 116 | command .equ 128 ; Command tail 117 | 118 | BDOS_SC .equ 2 ; BDOS system call 119 | EXIT .equ 0 ; BDOS exit request 120 | PRINT .equ 9 ; BDOS print request 121 | 122 | safety .equ 0100h ; Stack growth allowance 123 | 124 | ;*************************************************** 125 | ;* 126 | ;* C Stack frame equates 127 | ;* 128 | ;* A C stack frame consists of the PC on top, 129 | ;* followed by the arguments, leftmost first. 130 | ;* 131 | ;* The caller adjusts the stack on return. 132 | ;* Returned value is in r7 (int) or rr6 (long) 133 | ;* 134 | ;**************************************************** 135 | 136 | PCSIZE .equ 2 ;PC size non-segmented 137 | INTSIZE .equ 2 ;INT data type size 138 | LONGSIZE .equ 4 ;LONG data type size 139 | 140 | ARG1 .equ PCSIZE ;integer arguments 141 | ARG2 .equ ARG1+INTSIZE 142 | 143 | ;*************************************************** 144 | ;* 145 | ;* Data area 146 | ;* 147 | ;*************************************************** 148 | 149 | __data .sect 150 | 151 | 152 | ; Fake program name 153 | ; (CCP eats real one) 154 | ___pname: .byte "C runtime ", 0 155 | ___tname: .byte "CON:", 0 ; Console name 156 | ___lname: .byte "LST:", 0 ; List device 157 | ___xeof: .byte 01ah ; End of file 158 | ovf: .byte "Stack Overflow $", 0 ; Error Mess. 159 | 160 | ; Copyright message 161 | .byte "CLEARZ8K V 02.00" 162 | .byte "Copyright(c) 1984, Digital Research Inc." 163 | .byte "XXXX-0000-654321", 0 164 | 165 | __bss .sect 166 | 167 | __break: .block 2 ; Initial bss end 168 | ___cpmrv: .block 2 ; BDOS return value 169 | __base: .block 2 ; Pointer to basepage 170 | 171 | __text .sect 172 | 173 | ;*************************************************** 174 | ;* 175 | ;* __start 176 | ;* 177 | ;*************************************************** 178 | 179 | m.init: 180 | __start: 181 | ldk r2,#0 ; clear some 182 | ldk r3,#0 ; registers 183 | call _rw_ ; security reasons 184 | 185 | ld r2, ARG1(r15) ; Get basepage address 186 | ld r4, (lbss+2)(r2); Get bss start, length 187 | ld r1, (bsslen+2)(r2) ; (offset only) 188 | lda r6, r1(r4) ; r6 <- end of bss 189 | rr r1, #1 ; length <- word count 190 | jr z, xdone ; Empty bss? 191 | 192 | xclear: 193 | clr @r4 ; Clear out bss area 194 | inc r4, #2 195 | djnz r1, xclear 196 | 197 | xdone: 198 | ld __base, r2 ; Pointer to basepage 199 | ld __break, r6 ; Set up break address 200 | ; Get cmd line start 201 | lda r4, (command+1)(r2) ; address 202 | ldb rl2, -1(r4) ; and cmd line length 203 | ldb rh2, #0 ; Pad to 16 bits 204 | push @r15, r2 ; Stack both as params 205 | push @r15, r4 206 | ldk r14, #0 ; Clear frame pointer 207 | 208 | ldk r0,#0 ; initialize Z8070 or fpe 209 | ldk r1,#0 210 | fldctl user,r0 ; disable all traps, round to nearest 211 | fldctl fflags,rr0 ; nothing interesting has happened yet 212 | fldil f0,rr0 ; and zero all the regs 213 | fldil f1,rr0 214 | fldil f2,rr0 215 | fldil f3,rr0 216 | fldil f4,rr0 217 | fldil f5,rr0 218 | fldil f6,rr0 219 | fldil f7,rr0 220 | 221 | call __main ; Call main function 222 | 223 | __exit: 224 | ldk r5, #EXIT ; User prog returns 225 | sc #BDOS_SC ; here: warm boot 226 | 227 | 228 | 229 | ;*************************************************** 230 | ;* 231 | ;* _brk 232 | ;* 233 | ;*************************************************** 234 | 235 | _brk: 236 | ld r2, ARG1(r15) ; Pick up new value 237 | ld r7, r2 238 | add r2, #safety ; Safe distance below 239 | cp r2, r15 ; current stack? 240 | jr ult, brkok ; Go save the new break 241 | ; address !! rfw 242 | ld r7, #0 243 | dec r7, #1 ; It's not: return -1 244 | ret 245 | 246 | brkok: 247 | ld __break, r7 ; Squirrel it away for later 248 | ldk r7, #0 ; make sure ret is setup 249 | ret ; Return 250 | 251 | ;*************************************************** 252 | ;* 253 | ;* ___BDOS 254 | ;* 255 | ;*************************************************** 256 | 257 | ___BDOS: 258 | ; r5 <- request code 259 | ; rr6 <- parameter 260 | ldm r5, ARG1(r15), #3 261 | sc #BDOS_SC ; Trap into BDOS 262 | 263 | cp r15, __break ; Check for Stack overflow 264 | jr ult, __sovf 265 | ret ; Return value already in r7 266 | 267 | __sovf: ldk r5, #PRINT ; Function 9 String Print 268 | ldk r6, #0 269 | ld r7,ovf ; rr6 ->message 270 | sc #BDOS_SC ; Pass it off 271 | jr __exit ; exit now 272 | 273 | 274 | .end 275 | ion 9 String Print 276 | ldk r6, #0 277 | ld r7,ovf ; rr6 ->message 278 | sc #BDOS_SC ; Pass it off 279 | jr __exit ; exit now 280 | 281 | 282 | .end 283 |  284 | -------------------------------------------------------------------------------- /cpm8k/packages/base/startup.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/startup.o -------------------------------------------------------------------------------- /cpm8k/packages/base/stat.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/stat.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/stdio.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * C P / M C H E A D E R F I L E 4 | * ----------------------------------- 5 | * Copyright 1982 by Digital Research Inc. All rights reserved. 6 | * 7 | * This is the standard include file for the CP/M C Run Time Library. 8 | * 9 | *****************************************************************************/ 10 | 11 | #ifndef STDIO_H 12 | #define STDIO_H 13 | /* */ 14 | #ifndef BYTE /* If it looks like portab.h not */ 15 | #include /* included already, include it */ 16 | #endif /* */ 17 | /* */ 18 | /**************************************************************************** 19 | * Stream I/O File Definitions 20 | *****************************************************************************/ 21 | #define BUFSIZ 512 /* Standard (ascii) buf size */ 22 | #define MAXFILES 16 /* Max # open files ( < 32 ) */ 23 | struct _iobuf { /* */ 24 | WORD _fd; /* file descriptor for low level io */ 25 | WORD _flag; /* stream info flags */ 26 | BYTE *_base; /* base of buffer */ 27 | BYTE *_ptr; /* current r/w pointer */ 28 | WORD _cnt; /* # chars to be read/have been wrt */ 29 | }; /* */ 30 | #ifndef FILE /* conditionally include: */ 31 | extern struct _iobuf _iob[MAXFILES]; /* an array of this info */ 32 | #define FILE struct _iobuf /* stream definition */ 33 | #endif /* flag byte definition */ 34 | 35 | #define _IOREAD 0x01 /* readable file */ 36 | #define _IOWRT 0x02 /* writeable file */ 37 | #define _IOABUF 0x04 /* alloc'd buffer */ 38 | #define _IONBUF 0x08 /* no buffer */ 39 | #define _IOERR 0x10 /* error has occurred */ 40 | #define _IOEOF 0x20 /* EOF has occurred */ 41 | #define _IOLBUF 0x40 /* handle as line buffer */ 42 | #define _IOSTRI 0x80 /* this stream is really a string */ 43 | #define _IOASCI 0x100 /* this was opened as an ascii file */ 44 | /************************************/ 45 | #define stdin (&_iob[0]) /* standard input stream */ 46 | #define stdout (&_iob[1]) /* " output " */ 47 | #define stderr (&_iob[2]) /* " error " */ 48 | /************************************/ 49 | #define clearerr(p) ((p)->_flag & ~_IOERR) /* clear error flag */ 50 | #define feof(p) ((p)->_flag & _IOEOF) /* EOF encountered on stream */ 51 | #define ferror(p) ((p)->_flag & _IOERR) /* error encountered on stream */ 52 | #define fileno(p) ((p)->_fd) /* get stream's file descriptor */ 53 | #define getchar() getc(stdin) /* get char from stdin */ 54 | #define putchar(c) putc(c,stdout) /* put char to stdout */ 55 | #define putc fputc 56 | #define getc fgetc 57 | 58 | FILE *fopen(), *fopena(), *fopenb(), *fdopen(); 59 | FILE *freopen(), *freopa(), *freopb(); 60 | LONG ftell(), getl(); 61 | BYTE *fgets(), *gets(); 62 | 63 | int opena(); 64 | int openb(); 65 | int creat(); 66 | long lseek(); 67 | int close(); 68 | int read(); 69 | int write(); 70 | 71 | /****************************************************************************/ 72 | /* */ 73 | /* M A C R O S */ 74 | /* ----------- */ 75 | /* */ 76 | /* Define some stuff as macros .... */ 77 | /* */ 78 | /****************************************************************************/ 79 | 80 | #define abs(x) ((x) < 0 ? -(x) : (x)) /* Absolute value function */ 81 | 82 | #define max(x,y) (((x) > (y)) ? (x) : (y)) /* Max function */ 83 | #define min(x,y) (((x) < (y)) ? (x) : (y)) /* Min function */ 84 | 85 | /*************************** end of stdio.h *********************************/ 86 | 87 | #endif /* STDIO_H */ 88 |  89 | -------------------------------------------------------------------------------- /cpm8k/packages/base/unstds.h: -------------------------------------------------------------------------------- 1 | /* 07/20/82 Added new types WORD and BYTE (DMH) */ 2 | /* 10/15/82 Added some new defines (DMH) */ 3 | /* 11/13/82 This is the version for Unidot comp- */ 4 | /* iler which doesn't support unsigned. */ 5 | 6 | /* the pseudo storage classes */ 7 | 8 | #ifndef UNSTDS_H 9 | #define UNSTDS_H 10 | 11 | #define AFAST register 12 | #define FAST register 13 | #define GLOBAL extern 14 | #define IMPORT extern 15 | #define INTERN static 16 | #define LOCAL static 17 | 18 | /* the pseudo types */ 19 | 20 | typedef char TEXT, TINY; 21 | typedef double DOUBLE; 22 | typedef int ARGINT, BOOL, VOID; 23 | typedef long LONG; 24 | typedef short BITS, COUNT, FILE; 25 | typedef unsigned BYTES, WORD; 26 | typedef unsigned char BYTE, UTINY; 27 | typedef unsigned long ULONG; 28 | typedef unsigned short UCOUNT; 29 | 30 | /* system parameters */ 31 | 32 | #define STDIN 0 33 | #define STDOUT 1 34 | #define STDERR 2 35 | #define YES 1 36 | #define NO 0 37 | #define TRUE 1 38 | #define FALSE 0 39 | #define NULL 0 40 | #define FOREVER for (;;) 41 | #define BUFSIZE 512 42 | #define BWRITE -1 43 | #define READ 0 44 | #define WRITE 1 45 | #define UPDATE 2 46 | #define EOF -1 47 | #define BYTMASK 0377 48 | 49 | /* macros */ 50 | #define abs(x) ((x) < 0 ? -(x) : (x)) 51 | #define gtc(pf) (0 < (pf)->_nleft ? (--(pf)->_nleft, *(pf)->_pnext++ & BYTMASK) \ 52 | : getc(pf)) 53 | #define isalpha(c) (islower(c) || isupper(c)) 54 | #define isdigit(c) ('0' <= (c) && (c) <= '9') 55 | #define islower(c) ('a' <= (c) && (c) <= 'z') 56 | #define isupper(c) ('A' <= (c) && (c) <= 'Z') 57 | #define iswhite(c) ((c) <= ' ' || 0177 <= (c)) /* ASCII ONLY */ 58 | #define max(x, y) (((x) < (y)) ? (y) : (x)) 59 | #define min(x, y) (((x) < (y)) ? (x) : (y)) 60 | #define ptc(pf, c) if ((pf)->_nleft < 512) (pf)->_buf[(pf)->_nleft++] = (c); \ 61 | else putc(pf, (c)) 62 | #define tolower(c) (isupper(c) ? ((c) + ('a' - 'A')) : (c)) 63 | #define toupper(c) (islower(c) ? ((c) - ('a' - 'A')) : (c)) 64 | 65 | /* the file IO structure */ 66 | 67 | typedef struct fio 68 | { 69 | FILE _fd; 70 | COUNT _nleft; 71 | COUNT _fmode; 72 | TEXT *_pnext; 73 | TEXT _buf[BUFSIZE]; 74 | } FIO; 75 | 76 | #endif /* UNSTDS_H */ 77 |  78 | -------------------------------------------------------------------------------- /cpm8k/packages/base/xcon.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/xcon.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/xdump.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/xdump.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/zcc.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/zcc.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/zcc1.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/zcc1.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/zcc2.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/zcc2.z8k -------------------------------------------------------------------------------- /cpm8k/packages/base/zcc3.z8k: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/cpm8k/packages/base/zcc3.z8k -------------------------------------------------------------------------------- /cpm8k/put.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! put.s 3 | ! Subroutines for console out 4 | ! 5 | 6 | .global putln, putsp, puts, puthex8, puthex16 7 | 8 | .extern scc_out 9 | 10 | unsegm 11 | sect .text 12 | 13 | !------------------------------------------------------------------------------ 14 | ! putln 15 | ! print CR and LF 16 | ! destroyed: rl0, r1, rl5 17 | 18 | putln: 19 | ldb rl5, #'\r' 20 | call scc_out 21 | ldb rl5, #'\n' 22 | jp scc_out 23 | 24 | !------------------------------------------------------------------------------ 25 | ! putsp 26 | ! print ' ' 27 | ! destroyed: rl0, r1, rl5 28 | 29 | putsp: 30 | ldb rl5, #' ' 31 | jp scc_out 32 | 33 | !------------------------------------------------------------------------------ 34 | ! puts 35 | ! print a zero terminated string 36 | ! destroyed: rl0, r1, rl5 37 | 38 | puts: 39 | ldb rl5, @r4 40 | testb rl5 41 | ret z 42 | call scc_out 43 | inc r4, #1 44 | jr puts 45 | 46 | !------------------------------------------------------------------------------ 47 | ! puthex4 48 | ! print a lower 4bit value in hex 49 | ! input: rl5 --- value 50 | ! destroyed: r0, r1, rl5 51 | 52 | puthex4: 53 | andb rl5, #0x0f 54 | addb rl5, #'0' 55 | cpb rl5, #('0' + 10) 56 | jp lt, scc_out 57 | addb rl5, #('A' - '0' - 10) 58 | jp scc_out 59 | 60 | !------------------------------------------------------------------------------ 61 | ! puthex8 62 | ! print a 8bit value in hex 63 | ! input: rl5 --- value 64 | ! destroyed: r0, r1, r5 65 | 66 | puthex8: 67 | ldb rh5, rl5 68 | rrb rl5, #2 69 | rrb rl5, #2 70 | call puthex4 71 | ldb rl5, rh5 72 | jr puthex4 73 | 74 | !------------------------------------------------------------------------------ 75 | ! puthex16 76 | ! print a 16bit value in hex 77 | ! input: r5 --- value 78 | ! destroyed: r0, r1, r4, r5 79 | 80 | puthex16: 81 | ld r4, r5 82 | ldb rl5, rh5 83 | call puthex8 84 | ldb rl5, rl4 85 | jr puthex8 86 | -------------------------------------------------------------------------------- /cpm8k/z8530.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! z8530.s 3 | ! Serial Communication routines for Z8530 SCC 4 | ! 5 | ! Copyright(c) 2020 4sun5bu 6 | 7 | .equ SCCAC, 0x0005 8 | .equ SCCAD, 0x0007 9 | 10 | .global scc_init, scc_out, scc_in, scc_status 11 | 12 | unsegm 13 | sect .text 14 | 15 | !------------------------------------------------------------------------------ 16 | ! scc_init 17 | ! initialize Z8530 SCC 18 | ! destroyed: r2, r3, r4 19 | 20 | scc_init: 21 | ld r2, #(scccmde - scccmds) ! initialize Z8530 22 | ld r3, #SCCAC 23 | ld r4, #scccmds 24 | otirb @r3, @r4, r2 25 | ret 26 | 27 | !------------------------------------------------------------------------------ 28 | ! scc_out 29 | ! output 1 byte to the serial port 30 | ! input: r5 --- Ascii code 31 | ! destroyed: rl0 32 | 33 | scc_out: 34 | inb rl0, #SCCAC 35 | andb rl0, #0x04 36 | jr z, scc_out 37 | outb #SCCAD, rl5 38 | ret 39 | 40 | !------------------------------------------------------------------------------ 41 | ! scc_in 42 | ! input 1 byte from the serial port 43 | ! return: r7 --- read data 44 | ! destroyed: r0, r1 45 | 46 | scc_in: 47 | inb rl0, #SCCAC 48 | andb rl0, #0x01 49 | jr z, scc_in 50 | clr r7 51 | inb rl7, #SCCAD 52 | ret 53 | 54 | !------------------------------------------------------------------------------ 55 | ! scc_status 56 | ! return: r7 --- 0xff:data exists, 0x00:no data 57 | ! destroyed: r1, r10 58 | 59 | scc_status: 60 | inb rl0, #SCCAC 61 | clr r7 62 | andb rl0, #0x01 63 | ret z 64 | com r7 65 | ret 66 | 67 | !------------------------------------------------------------------------------ 68 | sect .rdata 69 | 70 | scccmds: 71 | !.byte 9, 0xc0 ! Reset 72 | .byte 3, 0xc0 ! Receiver disable 73 | .byte 5, 0xe2 ! Transmiter disable 74 | .byte 4, 0x44 ! x16, 1stop-bit, non-parity 75 | .byte 3, 0xe0 ! Receive 8bit/char 76 | .byte 5, 0xe2 ! Send 8bit/char dtr rts 77 | .byte 11, 0x50 ! BG use for receiver and transmiter 78 | .byte 12, 37 ! 4800bps at 6MHz clock 79 | .byte 13, 00 80 | .byte 14, 0x02 ! PCLK for BG 81 | .byte 14, 0x03 ! BG enable 82 | .byte 3, 0xe1 ! Receiver enable 83 | .byte 5, 0xea ! Transmiter enable 84 | scccmde: 85 | -------------------------------------------------------------------------------- /schematic/README.md: -------------------------------------------------------------------------------- 1 | # Z8001MB 2 | 3 | The Z8001MB board is designed to run CP/M-8000. The CPU runs at 6MHz clock speed, and it has 256kB SRAM, 2ch Serial ports and one IDE interface. 4 | ![Z8001MB](./Z8001MB.JPG) 5 | * **6MHz CPU clock** is generated from the 12MHz crystal oscillator by ATMEGA164 micro controller. 74F TTL logic ICs are chosen for running at 10MHz clock. At slower clock speed, 4 or 6MHz, 74LS logic ICs would can work. 6 | * **ROM less** at the boot up, the ATMEGA164 controls the Z8001 CPU bus, and write the boot code to the SRAM. After the copying, the ATMEGA frees the CPU bus and negates the reset signal. Then Z8001 CPU wakes up. 7 | * **256kB SRAM** can be possible for running CP/M-8000. 8 | * **Zilog Z8530 SCC** for serial communication. The z8kmon, machine monitor, operates it at 4800bps for a console I/O. To connect PC you need a level converter or a USB-Serial converter. 9 | * **IDE interface** is connected with 8bit bus. 16bit connection may be work, but I haven't tried yet. A CF card is connected through an adapter, and stores the CP/M-8000 disk image in it. 10 | 11 | To run this board you need to write boot code to the ATMEGA chip, and change fuse bits to disable JTAG and choose external clock input. The value of the lfuse is 0xE0, and hfuse is 0xD9. 12 | 13 | 2020.05.10 14 | To support I/D separation, a CPLD ATF1502 is added. It maps different address spaces for instructions and data access that some CP/M-8000 commands require. Z8kMMAP.PLD is the configuration file for the CPLD. 15 | -------------------------------------------------------------------------------- /schematic/Z8001MB-cpu.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/schematic/Z8001MB-cpu.pdf -------------------------------------------------------------------------------- /schematic/Z8001MB-iodev.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/schematic/Z8001MB-iodev.pdf -------------------------------------------------------------------------------- /schematic/Z8001MB-memory.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/schematic/Z8001MB-memory.pdf -------------------------------------------------------------------------------- /schematic/Z8001MB.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/4sun5bu/Z8001MB/790e9debe08d2f03c2f4d644614a0f1947ec7889/schematic/Z8001MB.JPG -------------------------------------------------------------------------------- /schematic/Z8KMMAP.PLD: -------------------------------------------------------------------------------- 1 | Name Z8KMMAP ; 2 | PartNo 00 ; 3 | Date 2020/05/05 ; 4 | Revision 01 ; 5 | Designer 4sun5bu ; 6 | Company 4sun5bu ; 7 | Assembly None ; 8 | Location Tokyo ; 9 | Device f1502ispplcc44 ; 10 | 11 | /* *************** INPUT PINS *********************/ 12 | PIN [4,5,6,8] = [LS0..LS3]; 13 | PIN [9,11] = [ST2, ST3]; 14 | /* *************** OUTPUT PINS *********************/ 15 | PIN [24..27] = [PS0..PS3]; /* */ 16 | 17 | LS4 = ST3 & !ST2; /* Data/Stack Request */ 18 | 19 | FIELD input = [LS4..LS0]; 20 | FIELD output = [PS3..PS0]; 21 | TABLE input => output { 22 | 0 => 0; 1 => 1; 2 => 2; 3 => 3; /* not Data request */ 23 | 4 => 0; 5 => 1; 6 => 2; 7 => 3; 24 | 8 => 1; 9 => 0; a => 1; b => 1; 25 | c => 0; d => 1; e => 2; f => 3; 26 | 27 | 10 => 0; 11 => 1; 12 => 2; 13 => 3; /* Data request */ 28 | 14 => 0; 15 => 1; 16 => 2; 17 => 3; 29 | 18 => 2; 19 => 0; 1a => 1; 1b => 1; 30 | 1c => 0; 1d => 1; 1e => 2; 1f => 3; 31 | } -------------------------------------------------------------------------------- /z8kboot/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.o 3 | *.swp 4 | *.elf 5 | *.hex 6 | z8kmon 7 | 8 | -------------------------------------------------------------------------------- /z8kboot/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 4sun5bu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /z8kboot/Makefile: -------------------------------------------------------------------------------- 1 | OBJS = booter.o z8kbootimg.o 2 | 3 | .PHONY: all 4 | all: z8kbooter.elf 5 | 6 | z8kbooter.elf: $(OBJS) 7 | avr-gcc -mmcu=atmega164p -o z8kbooter.elf $(OBJS) 8 | avr-objcopy -I elf32-avr -O ihex z8kbooter.elf z8kbooter.hex 9 | 10 | booter.o: booter.c z8001macro.h z8kmonimg.h 11 | avr-gcc -O0 -mmcu=atmega164p -c booter.c 12 | 13 | z8kbootimg.o: z8kmon 14 | cp ./z8kmon/z8kmon.bin ./ 15 | avr-objcopy -I binary -B avr -O elf32-avr z8kmon.bin z8kbootimg.o \ 16 | --rename-section .data=.progmem.data,contents,alloc,load,readonly,data 17 | 18 | sio.o: sio.c sio.h 19 | avr-gcc -O0 -mmcu=atmega164p -c sio.c 20 | 21 | .PHONY: z8kmon 22 | z8kmon: 23 | make -C ./z8kmon 24 | 25 | .PHONY: write 26 | write: 27 | #/mnt/c/WinAVR-20100110/bin/avrdude.exe -c avrisp2 -P usb -p m164p -U flash:w:z8kbooter.hex:i -v 28 | avrdude -c avrisp2 -P usb -p m164p -U flash:w:z8kbooter.elf:e -v 29 | 30 | .PHONY: clean 31 | clean: 32 | rm -f booter.o sio.o z8kbootimg.o z8kbooter.elf z8kmon.bin z8kbooter.hex 33 | make -C z8kmon clean 34 | -------------------------------------------------------------------------------- /z8kboot/README.md: -------------------------------------------------------------------------------- 1 | # z8kBoot 2 | 3 | ## About z8kboot and z8kmon 4 | * Z8kboot is a booter program running on the ATMEGA164P micro controller. It copies a z8kmon binary to the SRAM, and run it. 5 | * The z8kmon is a simple machine code monitor for Zilog Z8001 CPU running in segmeted mode. It has basic monitor commands such as Dump memory, Set data, Load HEX file, etc. It can also boot a program from the 1st resion of IDE drive. 6 | 7 | ## LICENSE 8 | This software is released under the MIT License, see LICENSE. 9 | 10 | ## Build 11 | On Debian-based distribution 12 | * Install gcc-avr, avr-libc and avrdude packages. 13 | * Download and build binutils with **--target=z8k-coff** option and install. 14 | * In the z8kboot directory, type **make**. 15 | * Write **z8kboot.elf** file to the ATMEGA164P. In the makefile there is a target to program with the avrdude and the Atmel AVRISP mkII. 16 | 17 | ## z8kmon Commands 18 | * d \ \\ 19 | Memory dump from **saddr** to **eaddr**. Without **eaddr**, it dumps 256 bytes from **saddr**. Just typing **d** dumps from the next address where dumped last time. 20 | 21 | * s \\ 22 | Memory set at **addr**. It shows a value at the address, and you can set a value in 8bit hex. Pressing '**Enter**', without a value. To quit, enter '**!**'. 23 | 24 | * g \\ 25 | Go command calls **addr**. It keeps **addr**, and the address is used, if **g** command doesn't have **addr**. 26 | 27 | * l \ 28 | Load Intel HEX format. After entering '**l**', upload intel hex format file. Start Adress in the HEX format is applied for '**g**' command. 29 | 30 | * z \ 31 | Load 32kB from the first sector of the IDE drive to the SRAM at 0x30000, and jump to start. This command is for booting CP/M-8000. 32 | 33 | ## Modification for your machine 34 | * z8kmon assumes that RAM area starts from 0x000000, and the size is 64k byte at least. The monitor is located at 0x000000. If you want to relocate at other address, you need to edit linker scriput **z8001mb.x**, and change the reset vector in **z8kmon.s** to start up from the address. 35 | 36 | -------------------------------------------------------------------------------- /z8kboot/booter.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * booter.c 3 | * Boot code for z8kmon, copy binary image from the ATMEGA ROM 4 | * to the Z8001 SRAM at 0x00000, and jump there 5 | * 6 | * Copyright (c) 2019 4sun5bu 7 | ******************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "z8kmonimg.h" 14 | #include "z8001macro.h" 15 | 16 | unsigned int mem_word_read(unsigned int address) 17 | { 18 | SET_READ 19 | SET_WORD_ACCESS 20 | ACT_MREQ 21 | 22 | // Address set 23 | SET_AD_OUT 24 | ACT_AS 25 | PORTA = address & 0x00ff; 26 | PORTC = (address & 0xff00) >> 8; 27 | DEACT_AS 28 | 29 | // Data read 30 | SET_AD_IN 31 | ACT_DS 32 | unsigned int data = PINA + (PINC << 8); 33 | DEACT_DS 34 | DEACT_MREQ 35 | 36 | return data; 37 | } 38 | 39 | unsigned char mem_byte_read(unsigned int address) 40 | { 41 | SET_READ 42 | SET_BYTE_ACCESS 43 | ACT_MREQ 44 | 45 | // Address set 46 | SET_AD_OUT 47 | ACT_AS 48 | PORTA = address & 0x00ff; 49 | PORTC = (address & 0xff00) >> 8; 50 | DEACT_AS 51 | 52 | // Data read 53 | SET_AD_IN 54 | ACT_DS 55 | 56 | unsigned char data; 57 | if (address &= 0b00000001) 58 | data = PINA; 59 | else 60 | data = PINC; 61 | DEACT_DS 62 | DEACT_MREQ 63 | 64 | return data; 65 | } 66 | 67 | void mem_word_write(unsigned int address, unsigned int data) 68 | { 69 | SET_WRITE 70 | SET_WORD_ACCESS 71 | ACT_MREQ 72 | 73 | // Address set 74 | SET_AD_OUT 75 | ACT_AS 76 | PORTA = address & 0x00ff; 77 | PORTC = (address & 0xff00) >> 8; 78 | DEACT_AS 79 | 80 | // Data write 81 | ACT_DS 82 | PORTA = data & 0x00ff; 83 | PORTC = (data & 0xff00) >> 8; 84 | 85 | DEACT_DS 86 | DEACT_MREQ 87 | } 88 | 89 | void mem_byte_write(unsigned int address, unsigned char data) 90 | { 91 | SET_WRITE 92 | SET_BYTE_ACCESS 93 | ACT_MREQ 94 | 95 | // Address set 96 | SET_AD_OUT 97 | ACT_AS 98 | PORTA = address & 0x00ff; 99 | PORTC = (address & 0xff00) >> 8; 100 | DEACT_AS 101 | 102 | // Data write 103 | ACT_DS 104 | if (address &= 0b00000001) 105 | PORTA = data; 106 | else 107 | PORTC = data; 108 | 109 | DEACT_DS 110 | DEACT_MREQ 111 | } 112 | 113 | int main(void) 114 | { 115 | cli(); 116 | 117 | FREE_BUS 118 | SET_AD_IN 119 | DEACT_BUSREQ; 120 | DEACT_MREQ; 121 | DEACT_DS 122 | DEACT_AS 123 | START_CLOCK 124 | 125 | ACT_RESET 126 | for (int i = 0; i < 1024; i++) 127 | { 128 | asm("nop"); 129 | } 130 | DEACT_RESET 131 | 132 | ACT_BUSREQ 133 | while (CHECK_BUSACK); 134 | GOT_BUS 135 | DEACT_AS 136 | DEACT_DS 137 | DEACT_MREQ 138 | 139 | // Write boot code to SRAM 140 | __flash const unsigned char *z8kmon_bin = &_binary_z8kmon_bin_start; 141 | const unsigned int z8kmon_bin_size = (unsigned int)&_binary_z8kmon_bin_size; 142 | 143 | for (int i = 0; i < z8kmon_bin_size; i++) 144 | { 145 | int count; 146 | for (count = 0; count < 3; count++) 147 | { 148 | unsigned char data = z8kmon_bin[i]; 149 | mem_byte_write(0x0000 + i, data); 150 | if (data == mem_byte_read(0x0000 + i)) 151 | break; 152 | } 153 | if (count == 3) 154 | { 155 | while (1) 156 | { 157 | // Boot fale 158 | } 159 | } 160 | } 161 | 162 | SET_AD_IN 163 | FREE_BUS 164 | ACT_RESET 165 | DEACT_BUSREQ 166 | for (int i = 0; i < 1024; i++) 167 | { 168 | asm("nop"); 169 | } 170 | DEACT_RESET 171 | 172 | while(1) 173 | { 174 | } 175 | } 176 | 177 | -------------------------------------------------------------------------------- /z8kboot/sio.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * sio.c 3 | * Sirial Comunication routines for ATMEGA164P 4 | * 5 | * Copyright (c) 2019 4sun5bu 6 | ******************************************************************************/ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "sio.h" 13 | 14 | void init_usart() 15 | { 16 | // USART 初期化 17 | UBRR0H = 0x00; // 19200bps 18 | UBRR0L = 38; 19 | UCSR0A = 0x00; // 20 | UCSR0B = 0x18; // 00011000b receive/send enable 21 | UCSR0C = 0x06; // 00000110b 8bit, one stop bit, none-parity 22 | } 23 | 24 | void sout_char(char value) 25 | { 26 | while ((UCSR0A & 0x20) == 0); 27 | UDR0 = value; 28 | } 29 | 30 | void sout_string(char *str) 31 | { 32 | while (*str != 0) 33 | { 34 | sout_char(*str); 35 | str ++; 36 | } 37 | } 38 | 39 | void sout_hex4(unsigned int value) 40 | { 41 | unsigned char four_bit; 42 | 43 | four_bit = value & 0x000f; 44 | if (four_bit < 10) 45 | sout_char('0' + four_bit); 46 | else 47 | sout_char('a' + four_bit - 10); 48 | } 49 | 50 | void sout_hex8(unsigned int value) 51 | { 52 | sout_hex4((value & 0x00f0) >> 4); 53 | sout_hex4(value & 0x000f); 54 | } 55 | 56 | void sout_hex16(unsigned int value) 57 | { 58 | sout_hex8(value >> 8); 59 | sout_hex8(value & 0xff); 60 | } 61 | 62 | char sin_char() 63 | { 64 | if (!(UCSR0A & 0x80)) 65 | return 0x00; 66 | return UDR0; 67 | } 68 | 69 | void sin_string(char *buf) 70 | { 71 | while (1) 72 | { 73 | if (!(UCSR0A & 0x80)) 74 | continue; 75 | *buf = UDR0; 76 | if (*buf == '\n') 77 | { 78 | *buf == 0; 79 | return; 80 | } 81 | buf++; 82 | } 83 | } -------------------------------------------------------------------------------- /z8kboot/sio.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * sio.h 3 | * Header fine for Sirial Comunication routines 4 | * 5 | * Copyright (c) 2019 4sun5bu 6 | ******************************************************************************/ 7 | 8 | #ifndef __SIO_H__ 9 | #define __SIO_H__ 10 | 11 | void init_usart(); 12 | void sout_char(char value); 13 | void sout_string(char *str); 14 | void sout_hex4(unsigned int value); 15 | void sout_hex8(unsigned int value); 16 | void sout_hex16(unsigned int value); 17 | 18 | char sin_char(); 19 | void sin_string(char *buf); 20 | 21 | #endif -------------------------------------------------------------------------------- /z8kboot/z8001macro.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * z8001macro.h 3 | * Definition of macros to control Z8001 bus signals 4 | * 5 | * Copyright (c) 2019 4sun5bu 6 | ******************************************************************************/ 7 | 8 | #ifndef __Z8001_MACRO_H__ 9 | #define __Z8001_MACRO_H__ 10 | 11 | #define FREE_BUS {DDRB = 0b11111011; DDRD = 0b10000001;} 12 | #define GOT_BUS {DDRB = 0b11111011; DDRD = 0b11111111;} 13 | 14 | #define SET_AD_IN {DDRA = 0b00000000; DDRC = 0b00000000;} 15 | #define SET_AD_OUT {DDRA = 0b11111111; DDRC = 0b11111111;} 16 | 17 | #define ACT_RESET {PORTB &= 0b11111110;} 18 | #define DEACT_RESET {PORTB |= 0b00000001;} 19 | #define ACT_BUSREQ {PORTB &= 0b11111101;} 20 | #define DEACT_BUSREQ {PORTB |= 0b00000010;} 21 | #define CHECK_BUSACK (!(PINB & 0b00000100)) 22 | 23 | #define ACT_AS {PORTD &= 0b11111011;} 24 | #define DEACT_AS {PORTD |= 0b00000100;} 25 | #define SET_WORD_ACCESS {PORTD &= 0b11110111;} 26 | #define SET_BYTE_ACCESS {PORTD |= 0b00001000;} 27 | #define SET_READ {PORTD |= 0b00010000;} 28 | #define SET_WRITE {PORTD &= 0b11101111;} 29 | #define ACT_MREQ {PORTD &= 0b11011111;} 30 | #define DEACT_MREQ {PORTD |= 0b00100000;} 31 | #define ACT_DS {PORTD &= 0b10111111;} 32 | #define DEACT_DS {PORTD |= 0b01000000;} 33 | 34 | #define SET_ST_INTERNAL {PORTB &= 0b11100111; PORTD &= 0b11111100;} 35 | #define SET_ST_SPIO {PORTB &= 0b11100111; PORTD |= 0b00000011;} 36 | #define SET_ST_DTMEM {PORTB &= 0b11100111; PORTB |= 0b00010000; PORTD &= 0b11111100;} 37 | #define SET_ST_INSTMEM {PORTB &= 0b11100111; PORTB |= 0b00011000; PORTD &= 0b11111100;} 38 | 39 | #define CLOCK_L {PORTD &= 0b01111111;} 40 | #define CLOCK_H {PORTD |= 0b10000000;} 41 | #define INVERT_CLOCK {PIND |= 0b10000000;} 42 | #define START_CLOCK {TCNT2 = 0; \ 43 | TCCR2A = 0b01000011; \ 44 | TCCR2B = 0b00001001; \ 45 | OCR2A = 0;} 46 | #define STOP_CLOCK {} 47 | 48 | #endif // __Z8001_MACRO_H__ -------------------------------------------------------------------------------- /z8kboot/z8kmon/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for z8kmon 2 | 3 | AS = z8k-coff-as 4 | LD = z8k-coff-ld 5 | OBJCOPY = z8k-coff-objcopy 6 | 7 | .SUFFIXES: .o .s 8 | 9 | objs = z8kmon.o cpu.o conio.o z8530.o ide.o\ 10 | dcmnd.o scmnd.o gcmnd.o lcmnd.o iocmnd.o zcmnd.o 11 | 12 | .PHONY: all 13 | all: z8kmon.bin 14 | 15 | z8kmon.bin: $(objs) z8001mb.x 16 | $(LD) -mz8001 -T z8001mb.x -o z8kmon $(objs) 17 | $(OBJCOPY) -O binary z8kmon z8kmon.bin 18 | 19 | .s.o: 20 | $(AS) -o $@ $< 21 | 22 | .PHONY: clean 23 | clean: 24 | $(RM) -f z8kmon.bin z8kmon $(objs) -------------------------------------------------------------------------------- /z8kboot/z8kmon/conio.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! string.s 3 | ! Subroutines for string output, input and convert 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global puts, putln, putsp, puthex8, puthex16 9 | .global gets, skipsp, ishex, strhex8, strhex16 10 | .global toupper 11 | 12 | sect .text 13 | segm 14 | 15 | !------------------------------------------------------------------------------ 16 | ! putln 17 | ! Send CR and LF 18 | ! 19 | ! destroyed: r0 20 | 21 | putln: 22 | ldb rl0, #'\r' 23 | call putc 24 | ldb rl0, #'\n' 25 | jp putc 26 | 27 | !------------------------------------------------------------------------------ 28 | ! putsp 29 | ! Send SPACE 30 | ! 31 | ! destroyed: r0 32 | 33 | putsp: 34 | ldb rl0, #' ' 35 | jp putc 36 | 37 | !------------------------------------------------------------------------------ 38 | ! puts 39 | ! Print a zero terminated string 40 | ! 41 | ! input: rr4 --- string address 42 | ! destroyed: r0, rr4 43 | 44 | puts: 45 | ldb rl0, @rr4 46 | testb rl0 47 | ret z 48 | call putc 49 | inc r5, #1 50 | jr puts 51 | 52 | !------------------------------------------------------------------------------ 53 | ! puthex4 54 | ! Print a lower 4bit value in hex 55 | ! 56 | ! input: rl0 --- value 57 | ! destroyed: r0 58 | 59 | puthex4: 60 | andb rl0, #0x0f 61 | addb rl0, #'0' 62 | cpb rl0, #('0' + 10) 63 | jp lt, putc 64 | addb rl0, #('A' - '0' - 10) 65 | jp putc 66 | 67 | !------------------------------------------------------------------------------ 68 | ! puthex8 69 | ! Print a 8bit value in hex 70 | ! 71 | ! input: rl4 --- value 72 | ! destroyed: r0, r4 73 | 74 | puthex8: 75 | ldb rl0, rl4 76 | srlb rl0, #4 77 | call puthex4 78 | ldb rl0, rl4 79 | jr puthex4 80 | 81 | !------------------------------------------------------------------------------ 82 | ! puthex16 83 | ! Print a 16bit value in hex 84 | ! 85 | ! input: r4 --- value 86 | ! destroyed: r0, r1, r4 87 | 88 | puthex16: 89 | ld r1, r4 90 | ldb rl4, rh4 91 | call puthex8 92 | ldb rl4, rl1 93 | jr puthex8 94 | 95 | !------------------------------------------------------------------------------ 96 | ! gets 97 | ! Input 1 line 98 | ! 99 | ! input: rr4 --- buffer address 100 | ! return: rr4 --- address of zero terminated string 101 | ! destroyed: r0 102 | 103 | gets: 104 | pushl @rr14, rr4 105 | push @rr14, r2 106 | clr r2 107 | 1: 108 | call getc 109 | cpb rl0, #'\b' 110 | jr nz, 2f 111 | test r2 112 | jr z, 1b 113 | call putc 114 | ldb rl0, #' ' 115 | call putc 116 | ldb rl0, #'\b' 117 | call putc 118 | dec r5, #1 119 | dec r2, #1 120 | jr 1b 121 | 2: 122 | cpb rl0, #'\r' 123 | jr eq, 3f 124 | cpb rl0, #'\n' 125 | jr eq, 3f 126 | call putc 127 | ldb @rr4, rl0 128 | inc r5, #1 129 | inc r2, #1 130 | jr 1b 131 | 3: 132 | call putln 133 | ldb @rr4, #0 134 | pop r2, @rr14 135 | popl rr4, @rr14 136 | ret 137 | 138 | !------------------------------------------------------------------------------ 139 | ! skipsp 140 | ! Skip space 141 | ! 142 | ! input: rr4 --- string address 143 | ! return: rr4 --- next character address 144 | ! rl0 --- next character 145 | 146 | skipsp: 147 | ldb rl0, @rr4 148 | cpb rl0, #' ' 149 | ret ne 150 | inc r5, #1 151 | jr skipsp 152 | 153 | !------------------------------------------------------------------------------ 154 | ! ishex 155 | ! Check and convert an ascii code to 4-bit hex value 156 | ! 157 | ! input: rl0 --- ascii character 158 | ! return: rl0 --- 0x00 - 0x0f 159 | ! CF --- error 160 | ! destroyed: 161 | 162 | ishex: 163 | cpb rl0, #'0' 164 | jr lt, 2f 165 | cpb rl0, #'9' 166 | jr gt, 1f 167 | subb rl0, #'0' 168 | ret 169 | 1: 170 | call toupper 171 | cpb rl0, #'A' 172 | jr lt, 2f 173 | cpb rl0, #'F' 174 | jr gt, 2f 175 | subb rl0, #('A' - 0x0a) 176 | ret 177 | 2: 178 | setflg c 179 | ret 180 | 181 | !------------------------------------------------------------------------------ 182 | ! strhex8 183 | ! Convert string to 8bit hex 184 | ! 185 | ! input: rr4 --- string address 186 | ! return: rl0 --- value 187 | ! CF --- error 188 | ! rr4 --- next address 189 | ! destroyed: r0 190 | 191 | strhex8: 192 | ldb rl0, @rr4 193 | call ishex 194 | ret c 195 | ldb rh0, rl0 196 | inc r5, #1 197 | ldb rl0, @rr4 198 | call ishex 199 | ret c 200 | rlb rh0, #2 201 | rlb rh0, #2 202 | addb rl0, rh0 203 | inc r5, #1 204 | ret 205 | 206 | !------------------------------------------------------------------------------ 207 | ! strhex16 208 | ! Convert string to 16bit hex 209 | ! 210 | ! input: rr4 --- string address 211 | ! return: r0 --- value 212 | ! CF --- error 213 | ! rr4 --- next address 214 | ! destroyed: r0, rl1 215 | 216 | strhex16: 217 | call strhex8 218 | ldb rl1, rl0 219 | ret c 220 | call strhex8 221 | ldb rh0, rl1 222 | ret 223 | 224 | !------------------------------------------------------------------------------ 225 | ! toupper 226 | ! Convert lowercase letter to uppercase 227 | ! 228 | ! input: rl0 --- ascii code 229 | ! output: rl0 --- converted ascii code 230 | ! destroyed: 231 | 232 | toupper: 233 | cpb rl0, #'a' 234 | ret lt 235 | cpb rl0, #'z' 236 | ret gt 237 | subb rl0, #0x20 238 | ret 239 | 240 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/cpu.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! cpu.s 3 | ! Misc routines for Z8001 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global linr2seg, seg2linr, put_laddr, str2saddr, put_saddr 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! linr2seg 15 | ! Convert linear address to segmented address 16 | 17 | ! input: rr4 --- linear address 18 | ! return: rr4 --- segmented address 19 | 20 | linr2seg: 21 | ldb rh4, rl4 22 | xorb rl4, rl4 23 | orb rh4, #0x80 24 | ret 25 | 26 | !------------------------------------------------------------------------------ 27 | ! seg2linr 28 | ! Convert segmented address to linear address 29 | ! 30 | ! input: rr4 --- segmented address 31 | ! return: rr4 --- linear address 32 | 33 | seg2linr: 34 | ldb rl4, rh4 35 | xorb rh4, rh4 36 | andb rl4, #0x7f 37 | ret 38 | 39 | !------------------------------------------------------------------------------ 40 | ! str2saddr 41 | ! Convert string to segmented address 42 | ! 43 | ! input: rr4 --- string address 44 | ! return: CF --- Error 45 | ! rr0 --- segmented address 46 | ! rr4 --- next string address 47 | ! destroyed: r2 48 | 49 | str2saddr: 50 | call strhex8 51 | ret c 52 | ldb rh2, rl0 53 | orb rh2, #0x80 54 | clrb rl2 55 | cpb @rr4, #':' 56 | jr ne, 1f 57 | inc r5, #1 58 | 1: 59 | call strhex16 60 | ret c 61 | ld r1, r0 62 | ld r0, r2 63 | ret 64 | 65 | !------------------------------------------------------------------------------ 66 | ! put_saddr 67 | ! Print a segmented address in hex 68 | ! 69 | ! input: rr4 --- segmented address 70 | ! destroyed: r0, r1, rr2, rr4 71 | 72 | put_saddr: 73 | ldl rr2, rr4 74 | ldb rl4, rh2 75 | andb rl4, #0x7f 76 | call puthex8 77 | ldb rl0, #':' 78 | call putc 79 | ld r4, r3 80 | call puthex16 81 | ret 82 | 83 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/dcmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! dumpcmnd.s 3 | ! Dump command 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global dump_cmnd, dcmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! dump_cmnd 15 | ! Memory dump from start address to end address 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, r3, rr4, rr6 19 | 20 | dump_cmnd: 21 | testb @rr4 22 | jr z, dc1 ! EOL 23 | call str2saddr 24 | jr c, dcmnd_usage ! illegal start address 25 | ldl dumpaddr, rr0 26 | call skipsp ! end address 27 | testb @rr4 28 | jr z, dc1 ! only start address 29 | call str2saddr 30 | jr c, dcmnd_usage ! illegal end address 31 | ldl rr6, rr0 32 | jr dc2 33 | dc1: 34 | ldl rr6, dumpaddr 35 | add r7, #255 36 | jr nc, dc2 37 | incb rh6, #1 38 | orb rh6, #0x80 39 | dc2: 40 | ldl rr4, dumpaddr 41 | call dump 42 | inc r7, #1 43 | jr nc, dc3 44 | incb rh6, #1 45 | dc3: 46 | ldl dumpaddr, rr6 47 | call putln 48 | ret 49 | 50 | dcmnd_usage: 51 | lda rr4, usage 52 | jp puts 53 | 54 | !------------------------------------------------------------------------------ 55 | ! dump 56 | ! Memory dump from start address to end address 57 | ! 58 | ! input: rr4 --- start address 59 | ! rr6 --- end address 60 | ! destroyed: r0, r1, r2, r3, rr4, rr6, rr8 61 | 62 | dump: 63 | ldl rr8, rr4 64 | lda rr4, header 65 | call puts 66 | ldl rr4, rr8 67 | dloop: 68 | ldl rr8, rr6 69 | call line_dump 70 | call putln 71 | ldl rr6, rr8 72 | cpl rr4, rr6 73 | jr le, dloop 74 | ret 75 | 76 | !------------------------------------------------------------------------------ 77 | ! line_dump 78 | ! Dump 16 bytes in hex and in ascii character 79 | ! 80 | ! input: rr4 --- real address for line dump 81 | ! return: rr4 --- next address 82 | ! destroyed: r0, r1, r2, r3, rr6 83 | 84 | line_dump: 85 | ldl rr6, rr4 86 | call put_saddr 87 | ldb rl0, #'|' 88 | call putc 89 | call putsp 90 | ldl rr4, rr6 91 | call hex_dump 92 | ldb rl0, #'|' 93 | call putc 94 | call putsp 95 | ldl rr4, rr6 96 | call ascii_dump 97 | ret 98 | 99 | !------------------------------------------------------------------------------ 100 | ! hex and ascii_dump 101 | ! Dump 16 bytes in hex and ascii 102 | ! 103 | ! input: rr4 --- segmented address for line dump 104 | ! return: rr4 --- next address 105 | ! destroyed: r0, r1, r2, r3 106 | 107 | hex_dump: 108 | ldl rr2, rr4 109 | ldb rl1, #16 110 | hdloop: 111 | ldb rl4, @rr2 112 | call puthex8 113 | call putsp 114 | add r3, #1 115 | jr nc, hd1 116 | incb rh2, #1 117 | orb rh2, #0x80 118 | hd1: 119 | decb rl1, #1 120 | jr nz, hdloop 121 | ldl rr4, rr2 122 | ret 123 | 124 | ascii_dump: 125 | ldl rr2, rr4 126 | ldb rl1, #16 127 | adloop: 128 | ldb rl0, @rr2 129 | cpb rl0, #' ' 130 | jr ge, ad1 131 | ldb rl0, #'.' 132 | jr ad2 133 | ad1: 134 | cpb rl0, #'~' 135 | jr le, ad2 136 | ldb rl0, #'.' 137 | ad2: 138 | call putc 139 | add r3, #1 140 | jr nc, ad3 141 | incb rh2, #1 142 | orb rh2, #0x80 143 | ad3: 144 | decb rl1, #1 145 | jr nz, adloop 146 | ldl rr4, rr2 147 | ret 148 | 149 | !------------------------------------------------------------------------------ 150 | sect .rodata 151 | 152 | header: 153 | .asciz "Address +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\r\n" 154 | 155 | usage: 156 | .asciz "Dump\t: d [xxxxxx] [yyyyyy]\r\n" 157 | 158 | !------------------------------------------------------------------------------ 159 | sect .bss 160 | .global dumpaddr 161 | 162 | dumpaddr: 163 | .long 0 164 | 165 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/gcmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! gocmnd.s 3 | ! go command 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global go_cmnd, gcmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! go_cmnd 15 | ! Memory write from start address 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, rr4 19 | 20 | go_cmnd: 21 | testb @rr4 22 | jr z, gc1 ! EOL, without address 23 | call str2saddr 24 | jr c, gcmnd_usage 25 | ldl goaddr, rr0 26 | gc1: 27 | ldl rr4, goaddr 28 | call @rr4 29 | ret 30 | 31 | gcmnd_usage: 32 | lda rr4, usage 33 | jp puts 34 | 35 | !------------------------------------------------------------------------------ 36 | sect .rodata 37 | usage: 38 | .asciz "Go\t: g [xxxxxx]\r\n" 39 | 40 | !------------------------------------------------------------------------------ 41 | sect .bss 42 | .global goaddr 43 | 44 | goaddr: 45 | .long 0 46 | 47 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/ide.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! ide.s 3 | ! Subroutines for HDD read and write 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global ide_init, ide_read 9 | 10 | sect .text 11 | segm 12 | 13 | !.equ IDE16, 1 14 | 15 | .equ IDE_DATAW, 0x0020 ! Word access 16 | .equ IDE_DATAB, 0x0021 ! Byte access 17 | .equ IDE_ERROR, 0x0023 18 | .equ IDE_FEATURES, 0x0023 19 | .equ IDE_SECT_CNT, 0x0025 20 | .equ IDE_SECT_NUM, 0x0027 21 | .equ IDE_CYL_LOW, 0x0029 22 | .equ IDE_CYL_HIGH, 0x002b 23 | .equ IDE_DEV_HEAD, 0x002d 24 | .equ IDE_STATUS, 0x002f 25 | .equ IDE_COMND, 0x002f 26 | .equ IDE_ALT_STATUS, 0x003d 27 | .equ IDE_DEV_CTRL, 0x003d 28 | 29 | .equ BSYBIT, 0x80 30 | .equ DRDYBIT, 0x40 31 | .equ DREQBIT, 0x08 32 | .equ ERRBIT, 0x01 33 | 34 | chkbsy: 35 | inb rl0, #IDE_STATUS 36 | andb rl0, #(BSYBIT | DREQBIT) 37 | jr nz, chkbsy 38 | ret 39 | 40 | ide_init: 41 | call chkbsy 42 | .ifdef IDE16 43 | ldb rl0, #0x81 ! Word access 44 | .else 45 | ldb rl0, #0x01 ! Byte access 46 | .endif 47 | outb #IDE_FEATURES, rl0 48 | ldb rl0, #0xef 49 | outb #IDE_COMND, rl0 50 | call chkbsy 51 | ldb rl0, #0x08 ! set PIO mode 0 52 | outb #IDE_SECT_CNT, rl0 53 | ldb rl0, #0x03 54 | outb #IDE_FEATURES, rl0 55 | ldb rl0, #0xef 56 | outb #IDE_COMND, rl0 57 | inb rl0, #IDE_STATUS 58 | ret 59 | 60 | !------------------------------------------------------------------------------ 61 | ! ide_read 62 | ! Read a sector from a IDE disk 63 | ! 64 | ! input: rr2 --- LBA 65 | ! rr4 --- buffer address 66 | ! destroyed: r0, r2, r5 67 | 68 | ide_read: 69 | call chkbsy ! Device selection 70 | ldb rl0, #0x40 71 | outb #IDE_DEV_HEAD, rl0 72 | call chkbsy 73 | clrb rl0 ! Clear Features 74 | outb #IDE_FEATURES, rl0 75 | ldb rl0, #0b00000010 ! Disable Interrupt 76 | outb #IDE_DEV_CTRL, rl0 77 | ldb rl0, #1 ! One sector read 78 | outb #IDE_SECT_CNT, rl0 79 | outb #IDE_SECT_NUM, rl3 ! Set LBA 80 | outb #IDE_CYL_LOW, rh3 81 | outb #IDE_CYL_HIGH, rl2 82 | andb rh2, #0x0f 83 | orb rh2, #0x40 84 | outb #IDE_DEV_HEAD, rh2 85 | ldb rl0, #0x20 ! READ SECTOR command 86 | outb #IDE_COMND, rl0 87 | .ifdef IDE16 88 | inb rl0, #IDE_ALT_STATUS ! Reset INTRQ 89 | .endif 90 | 1: 91 | inb rl0, #IDE_STATUS 92 | bitb rl0, #0 93 | setflg c 94 | ret nz 95 | andb rl0, #(BSYBIT | DREQBIT) 96 | cpb rl0, #DREQBIT 97 | jr nz, 1b 98 | 99 | .ifdef IDE16 100 | ld r1, #256 101 | 2: 102 | in r0, #IDE_DATAW 103 | exb rl0, rh0 104 | ld @rr4, r0 105 | inc r5, #2 106 | djnz r1, 2b 107 | .else 108 | ld r1, #512 109 | 2: 110 | inb rl0, #IDE_DATAB 111 | ldb @rr4, rl0 112 | inc r5, #1 113 | djnz r1, 2b 114 | .endif 115 | .ifdef IDE16 116 | inb rl0, #IDE_ALT_STATUS ! 117 | .endif 118 | inb rl0, #IDE_STATUS ! 119 | resflg c 120 | ret 121 | 122 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/iocmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! icmnd.s 3 | ! Reading and Writing I/O port command 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global ior_cmnd, iow_cmnd, icmnd_usage, ocmnd_usage, icmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! ior_cmnd 15 | ! I/O read and print at a port address 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, r3, rr4 19 | 20 | ior_cmnd: 21 | testb @rr4 22 | jr z, icmnd_usage ! EOL 23 | call strhex16 24 | jr c, icmnd_usage 25 | push @rr14, r0 26 | ld r4, r0 27 | call puthex16 28 | ldb rl0, #':' 29 | call putc 30 | pop r0, @rr14 31 | 1: 32 | inb rl4, @r0 33 | call puthex8 34 | call putln 35 | ret 36 | 37 | icmnd_usage: 38 | lda rr4, i_usage 39 | jp puts 40 | 41 | !------------------------------------------------------------------------------ 42 | ! iow_cmnd 43 | ! I/O write one byte at a port address 44 | ! 45 | ! input: rr4 --- options address 46 | ! destroyed: r0, r1, r2, r3, rr4, rr6, rr8 47 | 48 | iow_cmnd: 49 | testb @rr4 50 | jr z, ocmnd_usage ! EOL 51 | call strhex16 52 | jr c, ocmnd_usage 53 | ld ioaddr, r0 54 | ld r4, r0 55 | call puthex16 56 | ldb rl0, #':' 57 | call putc 58 | lda rr4, linebuff 59 | call gets 60 | call skipsp 61 | orb rl0, rl0 62 | ret z 63 | call strhex8 64 | ret c 65 | ld r1, ioaddr 66 | outb @r1, rl0 67 | ret 68 | 69 | ocmnd_usage: 70 | lda rr4, o_usage 71 | jp puts 72 | 73 | !------------------------------------------------------------------------------ 74 | sect .rodata 75 | 76 | i_usage: 77 | .asciz "Input\t: i xxxx\r\n" 78 | o_usage: 79 | .asciz "Output\t: o xxxx\r\n" 80 | 81 | !------------------------------------------------------------------------------ 82 | sect .bss 83 | .global ioaddr 84 | 85 | ioaddr: 86 | .word 0 87 | 88 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/lcmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! lcmnd.s 3 | ! Load Intel HEX file command 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global load_cmnd, lcmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! load_cmnd 15 | ! Load intel hex file 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, r3, rr4, rr6, rr8 19 | 20 | load_cmnd: 21 | clr segment 22 | clr segment + 2 23 | clr offset 24 | testb @rr4 25 | jr z, lcloop 26 | call strhex16 27 | jp c, lcmnd_usage 28 | ld offset, r0 29 | lcloop: 30 | lda rr4, buff 31 | call gets 32 | call ihex_line 33 | testb rl0 34 | ret mi ! Error 35 | ret z ! ihex end 36 | jr lcloop 37 | 38 | checksum: 39 | clrb rh2 40 | call strhex8 41 | jr c, ihex_err 42 | addb rh2, rl0 43 | ldb rl2, rl0 44 | addb rl2, #3 45 | cs1: 46 | call strhex8 47 | jr c, ihex_err 48 | addb rh2, rl0 49 | dbjnz rl2, cs1 50 | call strhex8 ! checksum 51 | jr c, ihex_err 52 | negb rh2 53 | cpb rl0, rh2 54 | jr ne, cs_err 55 | ret 56 | 57 | ihex_line: 58 | cpb @rr4, #':' 59 | jr ne, ihex_err 60 | inc r5, #1 61 | ldl rr6, rr4 62 | call checksum 63 | ldl rr4, rr6 64 | call strhex8 65 | ldb rl6, rl0 ! rl6 --- byte count 66 | call strhex16 67 | ld r2, r0 ! r2 --- data address 68 | call strhex8 ! rl0 --- record type 69 | testb rl0 70 | jr z, data_rec ! type 0 71 | decb rl0, #1 72 | jr z, data_end ! type 1 73 | decb rl0, #1 74 | jr z, seg_addr ! type 2 75 | decb rl0, #1 76 | jr z, seg_saddr ! type 3 77 | decb rl0, #1 78 | jr z, linr_addr ! type 4 79 | decb rl0, #1 80 | jr z, linr_saddr ! type 5 81 | ihex_err: 82 | lda rr4, errmsg1 83 | jr ce1 84 | cs_err: 85 | lda rr4, errmsg2 86 | ce1: 87 | call puts 88 | ldb rl0, #0xff 89 | ret 90 | 91 | data_rec: 92 | ldl rr8, rr4 ! copy rr4 to rr6 93 | ld r5, offset 94 | add r5, r2 ! 95 | clr r4 ! rr4 --- offset + address 96 | addl rr4, segment ! add segment address 97 | call linr2seg 98 | ldl rr2, rr4 ! rr2 --- segmented address 99 | ldl rr4, rr8 ! return rr4 100 | dr1: 101 | call strhex8 102 | ldb @rr2, rl0 103 | add r3, #1 ! increment lower address 104 | jr nc, dr2 105 | incb rh2, #1 106 | orb rh2, #0x80 107 | dr2: 108 | dbjnz rl6, dr1 109 | jr no_err 110 | 111 | data_end: 112 | xorb rl0, rl0 113 | ret 114 | 115 | seg_addr: 116 | call strhex16 117 | ld r1, r0 ! rr0 --- DS 118 | clr r0 119 | slll rr0, #4 120 | ldl segment, rr0 121 | jr no_err 122 | 123 | seg_saddr: 124 | call strhex16 125 | ld r3, r0 126 | clr r2 ! rr2 --- CS 127 | call strhex16 128 | ld r5, r0 129 | clr r4 ! rr4 --- IP 130 | slll rr2, #4 131 | addl rr4, rr2 ! add CS + IP 132 | call linr2seg 133 | ldl goaddr, rr4 134 | jr no_err 135 | 136 | linr_addr: 137 | call strhex16 138 | ld segment, r0 139 | clr segment + 2 140 | jr no_err 141 | 142 | linr_saddr: 143 | call strhex16 144 | ld r2, r0 145 | call strhex16 146 | ld r5, r0 147 | ld r4, r2 148 | call linr2seg 149 | ldl goaddr, rr4 150 | no_err: 151 | ldb rl0, #0x01 152 | ret 153 | 154 | lcmnd_usage: 155 | lda rr4, usage 156 | jp puts 157 | 158 | !------------------------------------------------------------------------------ 159 | sect .rodata 160 | usage: 161 | .asciz "Load HEX: l [xxxx]\r\n" 162 | 163 | errmsg1: 164 | .asciz "Illegal input\r\n" 165 | 166 | errmsg2: 167 | .asciz "Checksum error\r\n" 168 | 169 | !------------------------------------------------------------------------------ 170 | sect .bss 171 | 172 | segment: 173 | .long 0 174 | offset: 175 | .word 0 176 | buff: 177 | .space 80 178 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/scmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! scmnd.s 3 | ! Write command 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global set_cmnd, scmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! set_cmnd 15 | ! Memory set from start address 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, r3, rr4, rr6 19 | 20 | set_cmnd: 21 | ldl rr6, setaddr 22 | testb @rr4 23 | jr z, scloop1 ! without address 24 | call str2saddr 25 | jr c, scmnd_usage 26 | ldl setaddr, rr0 27 | ldl rr6, rr0 28 | scloop1: 29 | ldl rr4, rr6 30 | call put_saddr 31 | ldb rl0, #':' 32 | call putc 33 | ldb rl4, @rr6 34 | call puthex8 35 | call putsp 36 | lda rr4, linebuff 37 | call gets 38 | call skipsp 39 | testb rl0 40 | jr nz, scloop2 41 | add r7, #1 42 | jr nc, scloop1 43 | incb rh6, #1 44 | orb rh6, #0x80 45 | jr scloop1 46 | scloop2: 47 | call strhex8 48 | jr nc, sc1 ! illegal value 49 | ldl setaddr, rr6 50 | ret 51 | sc1: 52 | ldb @rr6, rl0 53 | add r7, #1 54 | jr nc, sc2 55 | incb rh6, #1 56 | orb rh6, #0x80 57 | sc2: 58 | call skipsp 59 | testb rl0 60 | jr nz, scloop2 61 | jr scloop1 62 | 63 | scmnd_usage: 64 | lda rr4, usage 65 | jp puts 66 | 67 | !------------------------------------------------------------------------------ 68 | sect .rodata 69 | usage: 70 | .asciz "Set\t: s [xxxxxx]\r\n" 71 | 72 | !------------------------------------------------------------------------------ 73 | sect .bss 74 | .global setaddr 75 | 76 | setaddr: 77 | .long 0 78 | 79 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/z8001mb.x: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff-z8k") 2 | OUTPUT_ARCH("z8001") 3 | ENTRY(_start) 4 | 5 | MEMORY 6 | { 7 | RAM : ORIGIN = 0x0000, LENGTH = 256k 8 | /* ROM : ORIGIN = , LENGTH = */ 9 | } 10 | 11 | SECTIONS 12 | { 13 | .rstvec : 14 | { 15 | *(.rstvec) 16 | } > RAM 17 | 18 | .text : 19 | { 20 | *(.text) 21 | } > RAM 22 | 23 | .rodata : 24 | { 25 | *(.rodata) 26 | } > RAM 27 | 28 | .data : 29 | { 30 | *(.data) 31 | } > RAM 32 | 33 | .bss : 34 | { 35 | __start_bss = . ; 36 | *(.bss); 37 | *(COMMON); 38 | __end_bss = . ; 39 | } > RAM 40 | } 41 | 42 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/z8530.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! z8530.s 3 | ! Serial I/O routines for Z8530 SCC 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global initscc, putc, getc 9 | 10 | sect .text 11 | segm 12 | 13 | .equ SCCAC, 0x0005 14 | .equ SCCAD, 0x0007 15 | 16 | !------------------------------------------------------------------------------ 17 | ! initscc 18 | ! Initialize Z8530 SCC 19 | ! 20 | ! destroyed: r2, r3 ,rr4 21 | 22 | initscc: 23 | ld r2, #(scccmde - scccmds) ! initialize Z8530 24 | ld r3, #SCCAC 25 | ldl rr4, #scccmds 26 | otirb @r3, @rr4, r2 27 | ret 28 | 29 | !------------------------------------------------------------------------------ 30 | ! putc 31 | ! output 1 byte to the PORT A 32 | ! 33 | ! input: rl0 --- Ascii code 34 | ! destroyed: r0 35 | 36 | putc: 37 | inb rh0, #SCCAC 38 | andb rh0, #0x04 39 | jr z, putc 40 | outb #SCCAD, rl0 41 | ret 42 | 43 | !------------------------------------------------------------------------------ 44 | ! getc 45 | ! input 1 byte from the PORT A 46 | ! 47 | ! return: rl0 --- read data 48 | ! destroyed: r0 49 | 50 | getc: 51 | inb rh0, #SCCAC 52 | andb rh0, #0x01 53 | jr z, getc 54 | inb rl0, #SCCAD 55 | ret 56 | 57 | !------------------------------------------------------------------------------ 58 | sect .rodata 59 | 60 | scccmds: 61 | .byte 9, 0xc0 ! Reset 62 | .byte 4, 0x44 ! x16, 1stop-bit, non-parity 63 | .byte 3, 0xe0 ! Receive 8bit/char, rts auto 64 | .byte 5, 0xe2 ! Send 8bit/char, dtr rts 65 | .byte 11, 0x50 ! BG use for receiver and transmiter 66 | .byte 12, 37 ! 4800bps at 6MHz clock 67 | .byte 13, 00 68 | .byte 14, 0x02 ! PCLK for BG 69 | .byte 14, 0x03 ! BG enable 70 | .byte 3, 0xe1 ! Receiver enable 71 | .byte 5, 0xea ! Transmiter enable 72 | scccmde: 73 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/z8kmon.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! z8kmon.s 3 | ! Machine code monitor for Z8001 in segment mode 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | ! Released under the MIT license, see LICENSE. 7 | !------------------------------------------------------------------------------ 8 | 9 | sect .text 10 | segm 11 | 12 | !------------------------------------------------------------------------------ 13 | sect .rstvec 14 | 15 | .word 0x0000 16 | .word 0xc000 17 | .word 0x0000 18 | .word _start 19 | 20 | !------------------------------------------------------------------------------ 21 | sect .text 22 | 23 | .global _start 24 | 25 | _start: 26 | ldl rr14, #0x80000000 ! set stack pointer 27 | call initscc 28 | lda rr4, bootmsg 29 | call puts 30 | clr r1 31 | ld r0, #0x8000 32 | ldl dumpaddr, rr0 33 | ldl setaddr, rr0 34 | ldl goaddr, rr0 35 | loop: 36 | ldb rl0, #'>' 37 | call putc 38 | call putsp 39 | lda rr4, linebuff 40 | call gets 41 | call skipsp 42 | ldb rl0, @rr4 43 | testb rl0 44 | jr z, loop 45 | call toupper 46 | ldb rh0, rl0 47 | inc r5, #1 48 | call skipsp 49 | ldb rl0, #((tbl_end - cmnd_tbl) / 6) 50 | lda rr2, cmnd_tbl 51 | lp1: 52 | cpb rh0, @rr2 53 | jr eq, lp2 54 | inc r3, #6 55 | dbjnz rl0, lp1 56 | jr lp3 57 | lp2: 58 | inc r3, #2 59 | ldl rr2, @rr2 60 | call @rr2 61 | jr loop 62 | lp3: 63 | cpb rh0, #'H' 64 | jr ne, cmnderr 65 | call dcmnd_usage 66 | call scmnd_usage 67 | call gcmnd_usage 68 | call lcmnd_usage 69 | call icmnd_usage 70 | call ocmnd_usage 71 | call zcmnd_usage 72 | jr loop 73 | cmnderr: 74 | lda rr4, errmsg 75 | call puts 76 | lda rr4, linebuff 77 | call puts 78 | call putln 79 | jr loop 80 | 81 | !------------------------------------------------------------------------------ 82 | sect .rodata 83 | 84 | cmnd_tbl: 85 | .byte 'D', ' ' 86 | .long dump_cmnd 87 | .byte 'S', ' ' 88 | .long set_cmnd 89 | .byte 'L', ' ' 90 | .long load_cmnd 91 | .byte 'G', ' ' 92 | .long go_cmnd 93 | .byte 'Z', ' ' 94 | .long z_cmnd 95 | .byte 'I', ' ' 96 | .long ior_cmnd 97 | .byte 'O', ' ' 98 | .long iow_cmnd 99 | tbl_end: 100 | 101 | bootmsg: 102 | .asciz "\033[2J\033[0;0HZ8001 Machine Code Monitor Ver.0.2.0\r\n" 103 | errmsg: 104 | .asciz "??? " 105 | 106 | !------------------------------------------------------------------------------ 107 | sect .bss 108 | .global linebuff 109 | 110 | linebuff: 111 | .space 80 112 | -------------------------------------------------------------------------------- /z8kboot/z8kmon/zcmnd.s: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------ 2 | ! zcmnd.s 3 | ! Load CP/M-8000 and run 4 | ! 5 | ! Copyright (c) 2019 4sun5bu 6 | !------------------------------------------------------------------------------ 7 | 8 | .global z_cmnd, zcmnd_usage 9 | 10 | sect .text 11 | segm 12 | 13 | !------------------------------------------------------------------------------ 14 | ! z_cmnd 15 | ! Load 32kB data from the first IDE Drive to 0x30000, and jump 16 | ! 17 | ! input: rr4 --- options address 18 | ! destroyed: r0, r1, r2, r3, rr4, rr12 19 | 20 | z_cmnd: 21 | lda rr4, zmsg1 22 | call puts 23 | call ide_init 24 | ldl rr2, #0 25 | ldl rr4, #0x83000000 26 | 1: 27 | pushl @rr14, rr4 28 | pushl @rr14, rr2 29 | call ide_read 30 | jr c, zcmnd_err 31 | ldb rl0, #'*' 32 | call putc 33 | popl rr2, @rr14 34 | popl rr4, @rr14 35 | add r5, #512 36 | inc r3, #1 37 | cp r3, #64 38 | jr nz, 1b 39 | jp 0x83000000 40 | 41 | zcmnd_err: 42 | popl rr2, @rr14 43 | popl rr4, @rr14 44 | lda rr4, errmsg 45 | jp puts 46 | 47 | zcmnd_usage: 48 | lda rr4, usage 49 | jp puts 50 | 51 | !------------------------------------------------------------------------------ 52 | sect .rodata 53 | 54 | zmsg1: 55 | .string "Load from CF \0" 56 | errmsg: 57 | .string "Boot error\r\n\0" 58 | 59 | usage: 60 | .asciz "Z boot\t: z (no options)\r\n" 61 | 62 | -------------------------------------------------------------------------------- /z8kboot/z8kmonimg.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * z8kmonimg.h 3 | * Declarations of start address and size of z8kmon 4 | * 5 | * Copyright (c) 2019 4sun5bu 6 | ******************************************************************************/ 7 | 8 | #ifndef __MONZ8KIMG_H__ 9 | #define __MONZ8KIMG_H__ 10 | 11 | extern unsigned char _binary_z8kmon_bin_start; 12 | extern unsigned char _binary_z8kmon_bin_size; 13 | 14 | #endif --------------------------------------------------------------------------------