Image Map Image Map
Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Trying Hi Tech C with different results...

  1. #1

    Default Trying Hi Tech C with different results...

    I have a program that compiles to around 19K using the z88dk cross compiler. I'd like to find a native in CP/M compiler though instead that can produce 8080 (and possibly Z80) code though. Tonight I was testing Hi Tech C, but it wouldn't work under the 2.2 CP/M from the N8VEM (or is it zcpr or something?), but it would work on the cpmplus.zip for SIMH that I downloaded.

    Could this be because cpmplus has more TPA available?

    On the n8vem image, I was getting odd things where the c.exe became corrupted, and then it would hang when I was compiling main.c.

    Is there a tool or utility that shows the maximum TPA in a CP/M system? Is there a built in command to do it?

  2. #2

    Default

    I didn't get a chance to download tpa.asm before the forum went down and the messages got lost. Can it be reposted?

  3. #3

    Default

    Code:
    ; Program to print TPA space available, in K-bytes
    
    	org	100h
    	lxi	d,0
    	lhld	6
    	mov	a,h
    	rrc
    	rrc
    	ani	03fh
    loop1:
    	cpi	10
    	jc	lt10
    	sui	10
    	mov	d,a
    	mov	a,e
    	adi	10h
    	daa
    	mov	e,a
    	mov	a,d
    	jmp	loop1
    lt10:	add	e
    	daa
    	push	h
    	call	hexout
    	pop	h
    	mov	a,h
    	ani	03h
    	mov	h,a
    	mvi	a,0
    	jz	zero
    loop2:
    	adi	25h
    	daa
    	dcr	h
    	jnz	loop2
    	push	psw
    	mvi	e,'.'
    	mvi	c,2
    	call	5
    	pop	psw
    	call	hexout
    zero:
    	lxi	d,kmsg
    	mvi	c,9
    	call	5
    	jmp	0
    
    hexout:
    	push	psw
    	rrc
    	rrc
    	rrc
    	rrc
    	call	hexdig
    	pop	psw
    hexdig: ani	0fh
    	adi	90h
    	daa
    	aci	40h
    	daa
    	mov	e,a
    	mvi	c,2
    	jmp	5
    
    kmsg:	db	'K TPA',13,10,'$'
    
    	end

  4. #4
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    26,995
    Blog Entries
    20

    Default

    Whew, that's a lot of code!

    How about this (It's been more than 30 years since I've had to code 8080, but here goes):

    Code:
    	org	100H
    
    Entry:
    	lda	7
    	dcr	a
    	rar
    	rar
    	ani	3fh
    	mvi	l,'0'
    cvd2:	sui	10
    	jc	cvd4
    	inr	l
    	jmp	cvd2
    
    cvd4:	adi	10+'0'
    	mov	h,a
    	shld	kdec
    	lxi	d,kmsg
    	mvi	c,9
    	jmp	5
    
    kmsg:	db	13,10
    kdec:	db	'00K available',13,10,'$'
    
    	end	entry
    Note that using XSUB will reduce the TPA size.

  5. #5
    Join Date
    Jul 2005
    Location
    State College, PA
    Posts
    133

    Default

    (I posted this before the crash).

    Back in the day, I used BDS C on a TRS-80 Model 4 running Montezuma Micro CP/M 2.2. The compiler and documentation are freely available, here:

    https://www.bdsoft.com/resources/bdsc.html

  6. #6

    Default

    I tried your tpa version Chuck. Here is both. Yours is TPA2.COM.

    Code:
    A>tpa
    A:TPA      COM
    61K TPA
    
    A>tpa2
    A:TPA2     COM
    
    60K available
    
    A>
    Any idea why it is showing the A:TPA COM and A:TPA2 COM ??? I don't remember it doing that when I ran TPA.COM before???

    Also, they aren't the same!

    Chuck - yours is considerably shorter!

  7. #7

    Default

    Quote Originally Posted by alank2 View Post
    I tried your tpa version Chuck. Here is both. Yours is TPA2.COM.

    Code:
    A>tpa
    A:TPA      COM
    61K TPA
    
    A>tpa2
    A:TPA2     COM
    
    60K available
    
    A>
    Any idea why it is showing the A:TPA COM and A:TPA2 COM ??? I don't remember it doing that when I ran TPA.COM before???

    Also, they aren't the same!

    Chuck - yours is considerably shorter!
    My program reports the memory boundary at the top of TPA, to 1/4 K. Chuck's reports the amount of memory between 0100 and top of TPA, truncated to K bytes. Neither really tells you how much memory a given application will be able to use, since the size of the application, and it's data requirements, factors into that.

  8. #8
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    26,995
    Blog Entries
    20

    Default

    Exactly. I don't count the lower 100h as being available memory, since you can't load a program into it. I also truncate, but could just as easily have rounded up by adding 3 to a before the two right shifts.

    As I mentioned, there are things that can affect the amount in the TPA. Try running the program with XSUB active, for example.

    I thought mine was kind of interesting because it uses no stack space at all.

  9. #9

    Default

    Any idea why it shows a directory like thing in the CP/M 3.1 OS's like I showed above?

  10. #10
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    26,995
    Blog Entries
    20

    Default

    CP/M 3 BIOS/XBIOS is tricky stuff. I suspect a bug. Have you tried on real z80 hardware?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •