├── PRL.COM ├── RSX.COM ├── ZSM.COM ├── DUMP.COM ├── ZSMPP.COM ├── BINTOASM.COM ├── HEXTOCOM.COM ├── PRNTOSYM.COM ├── hextobin.com ├── make_prl.bat ├── make_rsx.bat ├── releases ├── zsm28 │ ├── ZSM.COM │ └── ZSM.DOC ├── zsm29 │ ├── ZSM29.COM │ ├── ZSM29.DOC │ └── ZCHANGES.DOC ├── zsm30 │ ├── ZSM30.COM │ ├── CRASHZSM.ZSM │ ├── ZSM30.TXT │ ├── DUDOPS.ZSM │ └── ZSMDOC.DOC ├── zsm31 │ ├── ZSM31.COM │ ├── CRASHZSM.ZSM │ ├── ZSM31.TXT │ ├── DUDOPS.ZSM │ └── ZSMDOC.DOC ├── zsm32 │ ├── ZSM32.COM │ ├── CRASHZSM.ZSM │ ├── ZSM32.TXT │ ├── DUDOPS.ZSM │ └── ZSMDOC.DOC ├── zsm33 │ ├── ZSM33.COM │ ├── CRASHZSM.ZSM │ ├── ZSM33.TXT │ └── DUDOPS.ZSM ├── zsm34 │ ├── ZSM34.COM │ ├── CRASHZSM.ZSM │ ├── ZSM34.TXT │ └── DUDOPS.ZSM ├── zsm20 │ ├── Z80ASM.COM │ ├── TEST2.ASM │ ├── TEST1A.ASM │ ├── Z80DOC.DOC │ ├── Z80OPCDS.ASM │ ├── Z80.LIB │ ├── Z80.DOC │ └── Z80SUBS.ASM └── zsm24 │ ├── Z80ASMUK.COM │ └── Z80DOCUK.DOC ├── .gitignore ├── README.MD ├── bintoasm.c ├── dump.c ├── hextobin.c ├── zsmpp.c ├── prntosym.c ├── hextocom.c ├── prl.c └── rsx.c /PRL.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/PRL.COM -------------------------------------------------------------------------------- /RSX.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/RSX.COM -------------------------------------------------------------------------------- /ZSM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/ZSM.COM -------------------------------------------------------------------------------- /DUMP.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/DUMP.COM -------------------------------------------------------------------------------- /ZSMPP.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/ZSMPP.COM -------------------------------------------------------------------------------- /BINTOASM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/BINTOASM.COM -------------------------------------------------------------------------------- /HEXTOCOM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/HEXTOCOM.COM -------------------------------------------------------------------------------- /PRNTOSYM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/PRNTOSYM.COM -------------------------------------------------------------------------------- /hextobin.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/hextobin.com -------------------------------------------------------------------------------- /make_prl.bat: -------------------------------------------------------------------------------- 1 | cpm cc prl 2 | cpm ccopt prl 3 | cpm zsm prl 4 | cpm hextocom prl -------------------------------------------------------------------------------- /make_rsx.bat: -------------------------------------------------------------------------------- 1 | cpm cc rsx 2 | cpm ccopt rsx 3 | cpm zsm rsx 4 | cpm hextocom rsx -------------------------------------------------------------------------------- /releases/zsm28/ZSM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm28/ZSM.COM -------------------------------------------------------------------------------- /releases/zsm29/ZSM29.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm29/ZSM29.COM -------------------------------------------------------------------------------- /releases/zsm29/ZSM29.DOC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm29/ZSM29.DOC -------------------------------------------------------------------------------- /releases/zsm30/ZSM30.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm30/ZSM30.COM -------------------------------------------------------------------------------- /releases/zsm31/ZSM31.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm31/ZSM31.COM -------------------------------------------------------------------------------- /releases/zsm32/ZSM32.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm32/ZSM32.COM -------------------------------------------------------------------------------- /releases/zsm33/ZSM33.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm33/ZSM33.COM -------------------------------------------------------------------------------- /releases/zsm34/ZSM34.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm34/ZSM34.COM -------------------------------------------------------------------------------- /releases/zsm20/Z80ASM.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm20/Z80ASM.COM -------------------------------------------------------------------------------- /releases/zsm24/Z80ASMUK.COM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MiguelVis/zsm/HEAD/releases/zsm24/Z80ASMUK.COM -------------------------------------------------------------------------------- /releases/zsm30/CRASHZSM.ZSM: -------------------------------------------------------------------------------- 1 | ORG 0100H 2 | ; 3 | Z 4 | ; 5 | END 6 | CIFIED$ 7 | OPEN FAILED 8 | $ -------.------LIB------.------------------.---------.---------.---- -------------------------------------------------------------------------------- /releases/zsm31/CRASHZSM.ZSM: -------------------------------------------------------------------------------- 1 | ORG 0100H 2 | ; 3 | Z 4 | ; 5 | END 6 | CIFIED$ 7 | OPEN FAILED 8 | $ -------.------LIB------.------------------.---------.---------.---- -------------------------------------------------------------------------------- /releases/zsm32/CRASHZSM.ZSM: -------------------------------------------------------------------------------- 1 | ORG 0100H 2 | ; 3 | Z 4 | ; 5 | END 6 | CIFIED$ 7 | OPEN FAILED 8 | $ -------.------LIB------.------------------.---------.---------.---- -------------------------------------------------------------------------------- /releases/zsm33/CRASHZSM.ZSM: -------------------------------------------------------------------------------- 1 | ORG 0100H 2 | ; 3 | Z 4 | ; 5 | END 6 | CIFIED$ 7 | OPEN FAILED 8 | $ -------.------LIB------.------------------.---------.---------.---- -------------------------------------------------------------------------------- /releases/zsm34/CRASHZSM.ZSM: -------------------------------------------------------------------------------- 1 | ORG 0100H 2 | ; 3 | Z 4 | ; 5 | END 6 | CIFIED$ 7 | OPEN FAILED 8 | $ -------.------LIB------.------------------.---------.---------.---- -------------------------------------------------------------------------------- /releases/zsm34/ZSM34.TXT: -------------------------------------------------------------------------------- 1 | Changes made in version 3.4 2 | --------------------------- 3 | 4 | - Avoid labels start with '$', it clashes with $ PC ref. 5 | - Allow labels start with '_' in expressions. 6 | 7 | By Miguel Garcia / FloppySoftware - 10 Oct 2018. 8 | 9 | http://www.floppysoftware.es 10 | floppysoftware@gmail.com 11 | 12 |  -------------------------------------------------------------------------------- /releases/zsm33/ZSM33.TXT: -------------------------------------------------------------------------------- 1 | Changes made in version 3.3 2 | --------------------------- 3 | 4 | - Solved bug in DB, DEFB, DW, DEFW pseudo op-codes when there 5 | are more than one argument, separated with commas. 6 | 7 | By Miguel Garcia / FloppySoftware - 22 Sep 2018. 8 | 9 | http://www.floppysoftware.es 10 | floppysoftware@gmail.com 11 | 12 |  -------------------------------------------------------------------------------- /releases/zsm31/ZSM31.TXT: -------------------------------------------------------------------------------- 1 | ZSM 3.1 by Miguel Garcia / FloppySoftware - 30 Nov 2016 2 | 3 | Changes in the source code are marked as ';%' in the comments. 4 | 5 | Changes in this version: 6 | - Removed feature level for ZSM version. 7 | - Removed date/time code. 8 | - Enabled '_' and '$' as the first character in labels (as stated 9 | in the doc. some versions ago!). 10 | - Modulus can be '%' too, as in previous versions. 11 | - Disabled '%' as valid character for labels. 12 | - Modified usage explanation. 13 | 14 | http://www.floppysoftware.es 15 | floppysoftware@gmail.com 16 | 17 |  -------------------------------------------------------------------------------- /releases/zsm32/ZSM32.TXT: -------------------------------------------------------------------------------- 1 | Changes made in version 3.2 2 | --------------------------- 3 | 4 | - Solved bug in rotate op-codes (rl r, rlc r, rr r, rrc r, sla r, 5 | sra r, srl r): op-codes with 'c' register were translated to 6 | machine code as if the 'e' register was used instead. See S24 7 | section. 8 | - Added patch from Ed, to restore support for date/time in titles 9 | in CP/M 3: "This patched version restores date/time code as 10 | assembly-time option (see DATE EQU). Now works with 8080 or Z80.". 11 | 12 | By Miguel Garcia / FloppySoftware - 01 Jan 2017. 13 | 14 | http://www.floppysoftware.es 15 | floppysoftware@gmail.com 16 | 17 |  -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # --------------------------- 2 | # MESCC & TOOL CHAIN BINARIES 3 | # --------------------------- 4 | cpm.exe 5 | cpm2.exe 6 | cpm_player.exe 7 | cc.com 8 | cc.COM 9 | CC.COM 10 | ccopt.com 11 | ccopt.COM 12 | CCOPT.COM 13 | #zsm.com 14 | #ZSM.COM 15 | #hextocom.com 16 | #hextocom.COM 17 | #HEXTOCOM.COM 18 | #link.com 19 | #LINK.COM 20 | #prntosym.com 21 | #prntosym.COM 22 | #PRNTOSYM.COM 23 | #zmac.exe 24 | 25 | # --------------- 26 | # MESCC LIBRARIES 27 | # --------------- 28 | alloc.h 29 | atexit.h 30 | bsearch.h 31 | clock.h 32 | conio.h 33 | cpm.h 34 | ctype.h 35 | fileio.h 36 | fprintf.h 37 | mem.h 38 | mescc.h 39 | printf.h 40 | qsort.h 41 | rand.h 42 | redir.h 43 | setjmp.h 44 | sprintf.h 45 | stdbool.h 46 | string.h 47 | xprintf.h 48 | z80.h 49 | 50 | # ------------------ 51 | # INTERMEDIATE FILES 52 | # ------------------ 53 | *.HEX 54 | *.ZSM 55 | *.PRN 56 | 57 | # ----------------------- 58 | # PROJECT FILES & FOLDERS 59 | # ----------------------- 60 | backup/ 61 | !releases/zsm*/*.ZSM -------------------------------------------------------------------------------- /releases/zsm20/TEST2.ASM: -------------------------------------------------------------------------------- 1 | MULT:; UNSIGNED SIXTEEN BIT INTEGER MULTIPLY. 2 | ; ON ENTRANCE: MULTIPLIER IN DE. 3 | ; MULTIPLICAND IN HL. 4 | ; 5 | ; ON EXIT: RESULT IN HL. 6 | ; 7 | ; REGISTER USES: 8 | ; 9 | ; 10 | ; H HIGH ORDER PARTIAL RESULT 11 | ; L LOW ORDER PARTIAL RESULT 12 | ; D HIGH ORDER MULTIPLICAND 13 | ; E LOW ORDER MULTIPLICAND 14 | ; B COUNTER FOR NUMBER OF SHIFTS 15 | ; C HIGH ORDER BITS OF MULTIPLIER 16 | ; A LOW ORDER BITS OF MULTIPLIER 17 | ; 18 | LD B,16; NUMBER OF BITS- INITIALIZE 19 | LD C,D; MOVE MULTIPLIER 20 | LD A,E; 21 | LD X,Y ;SHOULD GET 'U' ERROR 22 | LOAD A,B ;SHOULD GET 'O' ERROR 23 | CP 'A' ;TEST 'X' FORMAT 24 | EX DE,HL; MOVE MULTIPLICAND 25 | LD HL,0; CLEAR PARTIAL RESULT 26 | EJECT ;TEST EJECT PROCESSING 27 | MLOOP: SRL C; SHIFT MULTIPLIER RIGHT 28 | RRA; LEAST SIGNIFICANT BIT IS IN CARRY 29 | JR NC,NOADD-$; IF NO CARRY SKIP THE ADD 30 | ADD HL,DE; ELSE ADD MULTIPLICAND TO PARTIAL RESULT 31 | NOADD: EX DE,HL; SHIFT MULTIPLICAND LEFT 32 | ADD HL,HL; BY MULTIPLYING IT BY TWO 33 | EX DE,HL; 34 | DJNZ MLOOP-$; REPEAT UNTIL NO MORE BITS 35 | RET; 36 | END; 37 |  -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | ZSM 2 | === 3 | 4 | ZSM, also known as Z80ASMUK, is a Z80 assembler for CP/M, that outputs HEX files. 5 | 6 | I like so much this assembler, so I have recopiled every ZSM version I could find over the Internet and my own disks. 7 | 8 | I have even contributed a bit to ZSM with code of my own, mainly patches. 9 | 10 | ![ZSM image](http://www.floppysoftware.es/images/cpm-zsm.jpg "ZSM image") 11 | 12 | Additional tools 13 | ---------------- 14 | 15 | I have developed some companion tools, in order to have a good native development tool chain for the Z80 assembler programming language under the CP/M operating system: 16 | - `zsmpp`: source code preprocessor for the ZSM assembler. 17 | - `bintoasm`: converts a binary file into an assembler file for ZSM. 18 | - `hextobin`: converts a HEX file into a binary file. 19 | - `hextocom`: converts an HEX file into a COM file for CP/M. 20 | - `prl`: makes PRL relocatable files from COM files. 21 | - `prntosym`: extracts symbols from a PRN file (from ZSM v2.8+) and generates an assembler file for ZSM. 22 | - `rsx`: manages RSX files. 23 | - `dump`: prints file contents in hexadecimal and ascii format. 24 | 25 | License 26 | ------- 27 | 28 | Reading the source code of ZSM, it seems there are various custom licenses involved. 29 | 30 | Regarding my companion tools, they are under the GPL license. -------------------------------------------------------------------------------- /releases/zsm30/ZSM30.TXT: -------------------------------------------------------------------------------- 1 | ZSM30.txt 2 | 3 | 4 | I was really excited to see that someone had done some work on ZSM 5 | and the new version is available on UK-Vol 65. I use this program 6 | quite a lot and, over the years, have built up a 'hate list' of its 7 | defects. These are mostly errors it tolerates, usually it does what 8 | it thinks you mean, rather than hurting your feelings by pointing out 9 | that you have made a mistake. Unfortunately it rarely gets it right, 10 | and just leaves you to puzzle out where you went wrong. 11 | 12 | I must say Ian Watters had done a good job with his revision, he had 13 | even found bugs that were not on my quite extensive list. He had 14 | also added several improvements and new facilities which have made 15 | it a much better assembler. However, it was disappointing to find 16 | that my worst 'hates' were still there waiting to catch the unwary. 17 | 18 | It is for this reason that I decided, if I didn't get down to it and 19 | put it right myself, no one else would. I have therefore spent 20 | several months of part time work going through my 'hate list' and 21 | fixing whatever I could. I won't claim I have found all the bugs, 22 | Ian's work shows how a fresh mind will turn up things you never 23 | thought of, but at least I have cleared my own list now. I offer the 24 | results in this volume 25 | 26 | I would be interested to hear anyone's views and further hates. However, 27 | I am reluctant to embark on the major revision that would be involved in 28 | including a 'Macro' facility. It would be better to do this with 29 | ZMAC. Perhaps a broad hint could be given to its author. 30 | 31 | C.G.Maxfield 32 | 39 Parkdale, 33 | Bounds Green Rd, 34 | LONDON, 35 | N11 2HB. 36 | 37 | Mar '91 38 | 39 | 40 | Yours Sincerely. 41 | 42 | 43 | Chris Maxfield. GW3HAI. 44 | 45 | 46 | P. S. 47 | A machine readable ASCII copy of this letter is included on my disk. 48 | 49 |  -------------------------------------------------------------------------------- /bintoasm.c: -------------------------------------------------------------------------------- 1 | /* BinToAsm.c 2 | 3 | Converts a binary file into an assembler file for Z80. 4 | 5 | Copyright (C) 2004-2015 Miguel I. Garcia Lopez, FloppySoftware 6 | 7 | This program is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 20 | 21 | To compile with MESCC: 22 | 23 | cc bintoasm 24 | ccopt bintoasm.zsm 25 | zsm bintoasm 26 | hextocom bintoasm 27 | 28 | Revisions: 29 | 30 | 22 Feb 2004 : v1.00 31 | 03 Apr 2007 : v1.01 / Minor changes. 32 | 10 Apr 2007 : Output 8 bytes in a line instead of 16. 33 | 15 May 2007 : v1.02 / Added title & usage help. 34 | 04 Sep 2015 : v1.03 / Amended some messages and comments. 35 | */ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #define VERSION "1.03 / 04 Sep 2015\n\n(c) 2004-2015 FloppySoftware" 46 | 47 | FILE *fpi, *fpo; 48 | 49 | int data, chpos; 50 | unsigned counter; 51 | 52 | main(argc, argv) 53 | int argc, argv[]; 54 | { 55 | printf("BinToAsm v%s\n\n", VERSION); 56 | 57 | if(argc!=3) 58 | { 59 | printf("Usage: bintoasm binfile asmfile\n"); 60 | exit(1); 61 | } 62 | 63 | if((fpi=fopen(argv[1],"rb"))==NULL) 64 | error("Opening input file"); 65 | 66 | if((fpo=fopen(argv[2],"w"))==NULL) 67 | error("Opening output file"); 68 | 69 | counter=chpos=0; 70 | 71 | while((data=fgetc(fpi))!=EOF) 72 | { 73 | if(!chpos) 74 | fprintf(fpo, " DEFB"); 75 | 76 | fprintf(fpo, " %03d", data); 77 | 78 | if(++chpos!=8) 79 | fprintf(fpo, ","); 80 | else 81 | { 82 | fprintf(fpo, "\n"); 83 | chpos=0; 84 | } 85 | 86 | ++counter; 87 | } 88 | 89 | printf("%d bytes\n", counter); 90 | 91 | if(fclose(fpi)) 92 | error("Closing input file"); 93 | 94 | if(fclose(fpo)) 95 | error("Closing output file"); 96 | } 97 | 98 | error(txt) 99 | char *txt; 100 | { 101 | printf("ERROR: %s\n", txt); 102 | exit(1); 103 | } 104 | -------------------------------------------------------------------------------- /releases/zsm29/ZCHANGES.DOC: -------------------------------------------------------------------------------- 1 | Below is an extract from zsm.zsm giving the changes from version 2.8 + notes 2 | 3 | In short, the bits in lower case in ZSM.zsm are mine! Let's hope I haven't 4 | added any new 'undocumented features'! 5 | 6 | 7 | ;----------------------------------------------- 8 | ; 9 | ; Version 2.9 by R'ian March 1988 10 | ; 11 | ; a) message 'L' is a "Label error" -- omission? 12 | ; b) change modulus to '\', -- personal taste, 13 | ; allowing '%' in labels same as zmac.com 14 | ; c) give help if no command tail -- being nice to user 15 | ; d) check that boot code isn't too long -- prevention better 16 | ; than crashing! 17 | ; e) tell user where we're at -- nice again 18 | ; f) default origin 100h, not 0 -- personal taste, 19 | ; & made an equate same as zmac again! 20 | ; g) add ASSERT -- makes checks like 21 | ; 'd' easier 22 | ; h) default page length split into one -- taste 23 | ; for CON: & one for LST:/file + equated 24 | ; i) slight bug in drive select for .PRN -- slight bug fix 25 | ; file fixed -- now O: works -- and tidy 26 | ; rest of setup code 27 | ; j) allow multiple list options -- like -- bug fix 28 | ; wot it said in the .DOC file 29 | ; k) change source input routines a bit! -- add a few equates 30 | ; mostly to prepare for 31 | ; version 3.0 (macros) 32 | ; l) alter the list options symbol table -- saves a few bytes 33 | ; to include their execution addresses, and t-states, but 34 | ; rather than index them up later... really taste again 35 | ; m) add SORT/NOSORT -- saves a lot of time 36 | ; for big programs & 37 | ; easier than changing 38 | ; the sort algolrithm 39 | ; n) add time/date to titles (if Z80 only -- gosh, I'm nice to 40 | ; version running on a CP/M+ machine) users! 41 | ; o) move 'start up' data to end of symbol -- lack of space, good 42 | ; table & make more space at the start job I added 'd'! 43 | ; p) add .LESS. -- signed less than -- rest are unsigned 44 | ; q) LIST ops don't do anything on pass 1. -- cure a 'feature' 45 | ; Pass 2 now starts with the defaults 46 | ; r) Stop too long labels overwriting such -- bug fix 47 | ; uneeded variables as PC, Val & PassNo! 48 | ; s) Fix -$, *$ etc bug in long DB & DWs -- bug fix 49 | ; t) Don't print date if before 11th Apr 88 -- in case date not set 50 | ; 51 | ;=============================================== 52 | 53 | Change 'm' (NOSORT) was added after seeing how long the sort was taking thanks 54 | to change 'e'... 55 | 56 | Change 'o' was caused by an ASSERTion failing, which was helpful of it! 57 | 58 | Changes 'q' & 'r' were made thanks to noticing the effects of tests in ZSMTEST 59 | -- I was testing the multiple list options & noticed that NONE of the .prn 60 | file was 'tabbed', instead of the bits after NOTAB 61 | -- + trying to generate a label error with a long label name, try it with 62 | version 2.8! 63 | 64 | Change 's' was thanks to converting mvp.asm to .zsm... 65 |  66 |  -------------------------------------------------------------------------------- /dump.c: -------------------------------------------------------------------------------- 1 | /* dump.c 2 | 3 | Print contents of a file in byte and ascii format. 4 | 5 | (c) 2000-2015 Miguel I. Garcia Lopez, FloppySoftware. 6 | 7 | This program is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2 of the License, or (at your 10 | option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | 21 | Usage: 22 | 23 | dump filename 24 | 25 | To compile with MESCC: 26 | 27 | cc dump 28 | ccopt dump.zsm 29 | zsm dump 30 | hextocom dump 31 | 32 | Revisions: 33 | 34 | ?? ?? 2000 : v1.00 35 | 10 Nov 2013 : v1.20 36 | 04 Sep 2015 : v1.21 : Amended some messages and comments. 37 | */ 38 | 39 | /* LIBRARIES 40 | */ 41 | 42 | #define CC_FREAD 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | /* DEFs 49 | */ 50 | 51 | #define VERSION "Dump v1.21 / 04 Sep 2015\n\n(c) 2000-2015 FloppySoftware" 52 | 53 | /* PROGRAM 54 | */ 55 | 56 | main(argc,argv) 57 | int argc; 58 | int argv[]; 59 | { 60 | int i, /* Counter */ 61 | offset; /* Offset in file */ 62 | 63 | FILE *fp; /* Channel for file */ 64 | 65 | char buffer[16]; /* Buffer for input file */ 66 | 67 | /* Check right number of parameters */ 68 | 69 | if(argc != 2) 70 | { 71 | puts(VERSION); 72 | puts("\nUsage: dump fname"); 73 | return 1; 74 | } 75 | 76 | /* Open file in binary mode */ 77 | 78 | if((fp = fopen((argv[1]),"rb")) == NULL) 79 | error("Can't open file"); 80 | 81 | /* Initialize variables */ 82 | 83 | offset=0; 84 | 85 | /* Start */ 86 | 87 | while(fread(buffer, 16, 1, fp) == 1) 88 | { 89 | /* Print offset */ 90 | 91 | puthex4(offset); putchar(' '); putchar(':'); putchar(' '); 92 | 93 | /* Print data in hexadecimal format */ 94 | 95 | for(i = 0; i < 16; ++i) 96 | { 97 | puthex2(buffer[i]); putchar(' '); 98 | } 99 | 100 | /* Separator */ 101 | 102 | putchar(':'); putchar(' '); 103 | 104 | /* Print data in ascii format */ 105 | 106 | for(i = 0; i < 16; ++i) 107 | { 108 | if(buffer[i] > 31 && buffer[i] < 128) 109 | putchar(buffer[i]); 110 | else 111 | putchar('.'); 112 | } 113 | 114 | /* End of line */ 115 | 116 | putchar('\n'); 117 | 118 | /* Update offset */ 119 | 120 | offset += 16; 121 | } 122 | 123 | fclose(fp); 124 | 125 | return 0; 126 | } 127 | 128 | error(txt) 129 | char *txt; 130 | { 131 | puts(txt); 132 | 133 | exit(1); 134 | } 135 | 136 | puthex4(word) 137 | int word; 138 | { 139 | puthex2(word >> 8); 140 | puthex2(word); 141 | } 142 | 143 | puthex2(byte) 144 | char byte; 145 | { 146 | puthex1(byte >> 4); 147 | puthex1(byte); 148 | } 149 | 150 | puthex1(nibble) 151 | char nibble; 152 | { 153 | nibble &= 0x0F; 154 | 155 | putchar(nibble < 10 ? '0' + nibble : 'A' + nibble - 10); 156 | } 157 | 158 | -------------------------------------------------------------------------------- /releases/zsm20/TEST1A.ASM: -------------------------------------------------------------------------------- 1 | ; 2 | ; Z80 ASSEMBLER TEST INSTRUCTION FILE 3 | ; 4 | ORG 100H ;TEST ORG PSEUDO OP 5 | LABEL1 EQU $ ;TEST EQU PSEUDO OP 6 | DEFW LABEL1 ;TEST DEFW PSEUDO OP 7 | DEFB 03FH ;TEST DEFB PSEUDO OP FORM 1 8 | DEFB 'THIS IS A TEST' ;TEST DEFB PSEUDO OP FORM 2 9 | DEFS 55 ;TEST DEFS PSEUDO OP 10 | ; 11 | ; THE NEXT THREE LINES USE THE IBM PSEUDO WHICH WAS ADDED TO 12 | ; FACILITATE SCREEN FORMATTING. 13 | ; 14 | ; THE FORMAT IS: IBM HEX,ASCII,HEX,ASCII,... WITH NO QUOTES 15 | ; AROUND THE ASCII 16 | ; 17 | ; IF THE USER WHISHES TO USE ASCII FIRST THEN THE FIRST BYTE MUST 18 | ; BEGIN WITH A QUOTE. 19 | ; 20 | ; THE HEX NUMBERS MUST BE IN PAIRS AND MUST NOT HAVE 'H' AFTER THEM 21 | ; THE ASCII STRINGS CAN INCLUDE ANY CHARACTERS (INCLUDING QUOTES AND 22 | ; SEMI-COLONS EXCEPT NO COMMAS 23 | ; 24 | ; 25 | ; 26 | IBM 1A0000,TOP OF SCREEN ON LEAR SEIGLER ADM3,0D0A0D0A,DOWN 3 LINES 27 | IBM 0FAD,ASCII CODING,0FE4,SCREEN FORMATTING 28 | IBM 'ASCII FIRST,0DFF,THEN HEX 29 | ; 30 | LD A,B ;TEST LOAD 31 | LD A,0FFH 32 | LD A,(HL) 33 | LD A,(IX+5) 34 | LD A,(IY+6) 35 | LD (HL),B 36 | LD (IX+5),B 37 | LD (IY+5),B 38 | LD (HL),23 39 | LD (IX+1),24 40 | LD (IY+1),25 41 | LD (BC),A 42 | LD (DE),A 43 | LD (LABEL1),A 44 | LD A,(BC) 45 | LD A,(DE) 46 | LD A,(LABEL1) 47 | LD A,I 48 | LD A,R 49 | LD I,A 50 | LD R,A 51 | LD BC,LABEL1 52 | LD DE,LABEL1 53 | LD HL,LABEL1 54 | LD SP,LABEL1 55 | LD IX,LABEL1 56 | LD IY,LABEL1 57 | LD HL,(LABEL1) 58 | LD IX,(LABEL1) 59 | LD IY,(LABEL1) 60 | LD (LABEL1),HL 61 | LD (LABEL1),BC 62 | LD (LABEL1),DE 63 | LD (LABEL1),IX 64 | LD (LABEL1),IY 65 | LD SP,HL 66 | LD SP,IX 67 | LD SP,IY 68 | PUSH BC 69 | PUSH DE 70 | PUSH HL 71 | PUSH AF 72 | PUSH IX 73 | PUSH IY 74 | POP BC 75 | POP DE 76 | POP HL 77 | POP IX 78 | POP IY 79 | POP AF 80 | EX DE,HL 81 | EX AF,AF' 82 | EXX 83 | EX (SP),HL 84 | EX (SP),IX 85 | EX (SP),IY 86 | LDI 87 | LDIR 88 | LDD 89 | LDDR 90 | CPI 91 | CPIR 92 | CPD 93 | CPDR 94 | ADD A 95 | ADD 0FFH 96 | ADD (HL) 97 | ADD (IX+5) 98 | ADD (IY+6) 99 | ADC A 100 | SUB A 101 | SBC A 102 | AND A 103 | OR A 104 | XOR A 105 | CP A 106 | INC A 107 | INC (HL) 108 | INC (IX+3) 109 | INC (IY+5) 110 | DEC (HL) 111 | DAA 112 | CPL 113 | NEG 114 | CCF 115 | SCF 116 | NOP 117 | HALT 118 | DI 119 | EI 120 | IM0 121 | IM1 122 | IM2 123 | ADD HL,BC 124 | ADC HL,DE 125 | SBC HL,DE 126 | ADD IX,BC 127 | ADD IY,DE 128 | INC IX 129 | INC IY 130 | DEC IX 131 | DEC IY 132 | RLCA 133 | RLA 134 | RRCA 135 | RRA 136 | RLC B 137 | 138 | RLC (HL) 139 | RLC (IX+5) 140 | RLC (IY+4) 141 | RL B 142 | RRC B 143 | RR B 144 | SLA B 145 | SRA B 146 | SRL B 147 | RLD 148 | RRD 149 | BIT 5,E 150 | BIT 5,(HL) 151 | BIT 5,(IX+5) 152 | BIT 5,(IY+4) 153 | SET 4,B 154 | SET 4,(HL) 155 | SET 4,(IX+5) 156 | SET 4,(IY+4) 157 | RES 4,E 158 | RES 4,(HL) 159 | JP LABEL1 160 | JP NZ,LABEL1 161 | JP C,LABEL1 162 | JR +6 163 | JR C,5 164 | JR NC,5 165 | JR Z,5 166 | JR NZ,5 167 | JP (HL) 168 | JP (IX) 169 | JP (IY) 170 | DJNZ 5 171 | CALL LABEL1 172 | CALL NZ,LABEL1 173 | RET 174 | RET NZ 175 | RETI 176 | RETN 177 | RST 38H 178 | IN A,(03H) 179 | IN B,(C) 180 | INI 181 | INIR 182 | IND 183 | INDR 184 | OUT (034H),A 185 | OUT (C),E 186 | OUTI 187 | OTIR 188 | OUTD 189 | OTDR 190 | END $ 191 |  -------------------------------------------------------------------------------- /releases/zsm20/Z80DOC.DOC: -------------------------------------------------------------------------------- 1 | 2 | 3 | Z 4 | 8 5 | 0 6 | A 7 | S 8 | M 9 | 10 | 11 | ZILOG/MOSTEK 12 | 13 | Z80-CPU 14 | 15 | 16 | ASSEMBLY 17 | LANGUAGE 18 | PROCESSOR 19 | 20 | 21 | (C) COPYRIGHT 1977 LCS 22 | ALL RIGHTS RESERVED 23 | 24 | 25 | LATEST REVISION: 21-JULY-1977 26 | 27 | 28 | Z 8 0 A S M 29 | 30 | Z80ASM IS AN ASSEMBLER FOR THE ZILOG/MOSTEK Z80-CPU MICROPROCESSOR. 31 | 32 | IT IS DESIGNED TO RUN UNDER THE CP/M OPERATING SYSTEM FROM DIGITAL RESEARCH. 33 | 34 | CP/M WILL RUN ON EITHER AN 8080A SYSTEM OR A Z80 SYSTEM. Z80ASM WILL RUN 35 | 36 | IN THE CP/M MINIMUM (16K) SYSTEM BUT WILL UTILIZE MORE MEMORY FOR SYMBOL 37 | 38 | TABLE STORAGE IN LARGER (UP TO 64K) CP/M SYSTEMS. 39 | 40 | Z80ASM READS A SOURCE (ASM) FILE PRODUCED BY THE CP/M 'ED' TEXT EDITOR 41 | 42 | PROGRAM AND PRODUCES AN OPTIONAL LISTING (ON THE LST: DEVICE) AND AN OPTIONAL 43 | 44 | OBJECT CODE (HEX) FILE IN INTEL FORMAT HEX. THE 'HEX' FILE CAN BE LOADED 45 | 46 | FOR EXECUTION USING 'DDT' OR 'LOAD' COMMANDS OF CP/M OR IT CAN BE PUNCHED 47 | 48 | ON PAPER TAPE USING THE 'PIP' PROGRAM. 49 | 50 | INPUT STATEMENTS ARE FREE FORMAT (I.E. NOT COLUMN ORIENTED). BETWEEN 51 | 52 | FIELDS ANY NUMBER OF BLANK OR TAB CHARACTERS MAY BE PRESENT BUT WITHIN A FIELD 53 | 54 | THERE MAY BE NO BLANK OR TAB CHARACTERS. HOWEVER, STATEMENTS LABELS MUST BE 55 | 56 | IN THE FIRST POSITION OF THE LINE. STATEMENT LABELS MAY HAVE A COLON FOLLOWING 57 | 58 | THEM BUT THE COLON IS NOT REQUIRED. COMMENTS ARE PRECEEDED BY A SEMICOLON 59 | 60 | AND MAY APPEAR BY THEMSELVES OR FOLLOWING ALL OF THE FIELDS ON A SOURCE LINE. 61 | 62 | 63 | ALL THE ZILOG/MOSTEK MNEMONICS ARE SUPPORTED WITH THE FOLLOWING 64 | 65 | EXCEPTIONS: 66 | 67 | 1. THE Z80CPU TECHNICAL MANUAL HAS CONFLICTING INFORMATION REGARDING 68 | THE SYNTAX OF THE RLC,RL,RRC AND RR INSTRUCTIONS WHEN THE A 69 | REGISTER IS USED AS THE OPERAND. ON PAGE 50 THE FORMS 70 | 'RLCA','RLA','RRCA','RRA' ARE USED WHILE ON PAGE 68 THE FORM 71 | 'RR A' IS SHOWN. Z80ASM WILL SUPPORT ONLY THE 'RRA', ETC. FORM. 72 | 73 | 2. THE Z80CPU MANUAL DOES NOT DESCRIBE THE PSEUDO OPERATORS AVAILABLE 74 | EXCEPT THAT 'EQU' AND 'DEFS' ARE USED ON PAGE 67 IN THE SAMPLE 75 | PROGRAM. THE LIST BELOW DESCRIBES THE PSEUDO OPERATORS AVAILABLE 76 | IN Z80ASM AND THEIR ARGUMENT FORMATS: 77 | 78 |