Question about Tniasm.How to make bin files:

Page 1/4
| 2 | 3 | 4

By nikodr

Paladin (726)

nikodr's picture

17-03-2008, 08:49

Hello.I have been using tniasm to generate bin files from asm files.One question i have is how to create msx bin files that have header in them so i can bload them in basic.I know the start address from my program.

I found out this

DB 0FEh
DW Start, End, Begin
ORG loadadress ; (this is the address where the program wil be loaded in memory)

How do i find the End address?do i have to see how many bytes my program uses and add this up?

Login or register to post comments

By Manuel

Ascended (15691)

Manuel's picture

17-03-2008, 08:57

Maybe it's better to contact the author?

By d-fader

Champion (290)

d-fader's picture

17-03-2008, 09:01

nvm, double post Smile

By ro

Guardian (4109)

ro's picture

17-03-2008, 09:01

Neh, it's ASM 101.

db 0x0FE
dw start, endadr, start

org 0xc000
start: <do some asm here>
.
.
.
endadr: end

The asm parser will use the label "endadr:" as it's END adr and put's it in the first 7 bytes header as you declared in the beginning of your source.
The start adr, in this case, is the same as the "run" adr.

By ro

Guardian (4109)

ro's picture

17-03-2008, 09:01

gheh, D-fader, same post, same time Smile

By d-fader

Champion (290)

d-fader's picture

17-03-2008, 09:03

xcept that you can type faster, while I was Running Naked in a Field of Flowers?

By ro

Guardian (4109)

ro's picture

17-03-2008, 09:04

haha, lol.

By nikodr

Paladin (726)

nikodr's picture

17-03-2008, 09:13

I figured what was wrong so all okSmile
Finally i can make bin files.
Thanks for your help!

By nikodr

Paladin (726)

nikodr's picture

17-03-2008, 10:15

I have one question regarding print routine

;subroutine to print text on screen
LD HL,TEXT
PRINT:LD A,(HL)
INC HL
AND A
JP Z,ENDPRINT
CALL CHPUT
JP PRINT
ENDPRINT:RET

TEXT: DB "HELLO this is a testing program,i want to print value of a specific address how can i do that?",0
CHPUT:EQU 0a2h

how can i print the value of an address a byte (from adress &hd000) to be printed with this subroutine?I want to use this so i can print text and then value of adress from ram or rom.
I want to do multiplication or other operations,store the value on a specific address and then print it with that routine.

Can somebody help?

By d-fader

Champion (290)

d-fader's picture

17-03-2008, 11:14

Well, this is some old stuff, don't think it's really optimized, but it should work I guess:


ld hl,decimal
ld a,243
call Calc8Dec

;subroutine to print text on screen
LD HL,TEXT
PRINT:LD A,(HL)
INC HL
AND A
JP Z,ENDPRINT
CALL CHPUT
JP PRINT
ENDPRINT:RET

TEXT: DB "HELLO this is a testing program,i want to print value of a specific address how can i do that? Like this: 
Decimal: DB "xxx... Pretty easy!",0
CHPUT:EQU 0a2h

Calc8Dec:
; routine : Calculate 8 bits decimal
; in      : a - number, hl - address to write the result to
; out     : decimal: the decimal value (3 bytes)
; cmnt    : none

Calc8Dec2:
	ld c,48
Calc3DecLoop:
	sub 100

	jr c,Calc3DecDone

	inc c

	jr Calc3DecLoop

Calc3DecDone:
	add a,100

	ld (hl),c
	inc hl

	ld c,48
Calc2DecLoop:
	sub 10

	jr c,Calc2DecDone

	inc c

	jr Calc2DecLoop

Calc2DecDone:
	add a,10

	ld (hl),c
	inc hl


	ld c,48
Calc1DecLoop:
	sub 1

	jr c,Calc1DecDone

	inc c

	jr Calc1DecLoop

Calc1DecDone:
	ld (hl),c

	ret

If it sucks, I think there are about a zillion other routines just like this to be found on the internet Smile

By ro

Guardian (4109)

ro's picture

17-03-2008, 11:58

in other words: there's no standaard ASM (or BIOS) that can print integers. You need to convert it to text. It's touch, but that's ASM. It's also FAST SmileTongue

Page 1/4
| 2 | 3 | 4