Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!pnet01.cts.COM!mwilson From: mwilson@pnet01.cts.COM (Marc Wilson) Newsgroups: comp.os.cpm Subject: how to do it Message-ID: <8805102336.AA04654@crash.cts.com> Date: 10 May 88 23:35:37 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: pnet01!mwilson@nosc.mil Organization: The Internet Lines: 173 Sorry to all, but the only address I have for Don bounced. Twice. What follows is the original message. --------Forwarded Message-------- >From mwilson Tue May 10 10:46:59 1988 Date: Tue, 10 May 88 10:46:56 PDT From: mwilson (Marc Wilson) To: crash!ucbvax.Berkeley.EDU!donk Subject: How to do it Cc: mwilson Sorry it took me so long to get back to you with this, but I've been so busy lately, I just haven't had time to cook up a good example. I usually don't use M80/L80. If I *do* use M80, then I use one of the public domain linkers, like PDLN, or ProLink. My preferred linker is DRI's LINK, but I use SLR Systems SLRNK when I want speed. All of them are in the ASM: directory. Ok, what we need here is a good example. Take a look at the file below. As you can see, the only thing in it is a CSEG. Note the *absence* of any ORG statement. ----- C0:SCRATCH>lt test.z80 ^S pause, ^C abort, ^X next file, ^Z no paging, space next line, others page TEST.Z80 ; Program: TEST.Z80 ; Author: Marc Wilson ; Version: 1.0 ; Date: 10 May 1988 ; This is a test to cause M80/L80 to generate a .HEX file with an origin ; other than 100h cseg start: ld c,9 ld de,msg jp 5 msg: db 'This is a test.$' end ----- Ok, we've got a test file. Let's assemble it... My copy of M80 has been patched to return flags for warnings ant fatal errors in the Z-System registers. It is otherwise *identical* to M80 v3.44. ----- C0:SCRATCH>asm:m80 =test.z80/z M80 v3.44 for LB/Z80 Z-System No Fatal error(s) ----- Well, it assembled with no errors, let's try linking it. ----- C0:SCRATCH>asm:l80 /p:1000,test,test/n/x/e Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft Data 1000 1018 < 24> 38940 Bytes Free [0000 1018 16] ----- Hmmm... it looks like L80 has indeed created a zero-filled .HEX file. However, if you look again, you can see that the data area goes from 1000 to 1018. Since I didn't specify a separate address for the data segment, the code segment is there. Let's look at the .HEX file. ----- C0:SCRATCH>lt test.hex ^S pause, ^C abort, ^X next file, ^Z no paging, space next line, others page TEST.HEX :181000000E09110810C3050054686973206973206120746573742E2489 :00000001FF ----- Uh oh, awful short. No zero-fill records here. ----- C0:SCRATCH>mload test MLOAD ver. 2.5 Copyright (C) 1983, 1984, 1985, 1987 by NightOwl Software, Inc. Loaded 24 bytes (0018H) to file C0:TEST.COM Start address: 1000H Ending address: 1017H Bias: 0000H Saved image size: 128 bytes (0080H, - 1 records) ++ Warning: program origin NOT at 100H ++ ----- Well, what do you know? MLOAD says that the start address is 1000h, and the ending address is 1017H. Definately no zero-fill here. As another check, let's look at the .COM file generated by MLOAD. Note that we *cannot* run this file, as MLOAD warned us its ORiGin wasn't at 100h, but at 1000h. ----- C0:SCRATCH>ddt test.com DDT VERS 2.2 NEXT PC 0180 0100 -l100 0100 MVI C,09 0102 LXI D,1008 0105 JMP 0005 [ ... ] -d108 0108 54 68 69 73 20 69 73 20 This is 0110 61 20 74 65 73 74 2E 24 00 00 00 00 00 00 00 00 a test.$........ [ ... ] -g0 ----- Look at the address field of the LXI D instruction. It's 1008h. This indicates that this file does indeed have an origin above 100h. ----- Well, I'd say that that fits your requirements. On another related subject, why are you using a .HEX file at all? That requires much tedious calculation of offsets, etc. Why not just assemble to a binary file and install? Much simpler, and faster. If I can help with anything else, please don't hesitate to ask. -- Marc Wilson -- mwilson@crash.CTS.COM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Marc Wilson ARPA: ...!crash!mwilson@nosc.mil ...!crash!pnet01!pro-sol!mwilson@nosc.mil UUCP: [ cbosgd | hp-sdd!hplabs | sdcsvax | nosc ]!crash!mwilson INET: mwilson@crash.CTS.COM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --------End Forwarded Message-------- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Marc Wilson ARPA: ...!crash!mwilson@nosc.mil ...!crash!pnet01!pro-sol!mwilson@nosc.mil UUCP: [ cbosgd | hp-sdd!hplabs | sdcsvax | nosc ]!crash!mwilson INET: mwilson@crash.CTS.COM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~