stumped... (Development MSX Fora)MSX Resource Center PassionMSX MSX2 contest           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 101 gasten en 6 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - stumped...

Schrijver

stumped...

Whizzy
msx user
Berichten: 56
Geplaatst: 21 Februari 2005, 11:18   
Ok here's my asm question (don't laugh coz it's been a while since i did something with msx...)

I want to create a single .COM file which starts executing at &H0100 (duh) does some initializing and then jumps to &H4000 where the rest of the code is stored.

Now when i use something like this:

ORG 0x100
LD A,1
JP &H4000
ORG &H4000
LD A,2
RET

i expect the compiler (sjasm) to create something like a single file where at offset 0x4000 the LD A,2 statement is, but it is not ?!?!?
Should this work, am i stupid, did i do anything wrong ?

aarhg... i don't get it..

thx guys..
BiFi
msx guru
Berichten: 3142
Geplaatst: 21 Februari 2005, 11:33   
something like this should do the trick:
	org	$100
;
	ld	bc,length
        ld	de,destination		
	ld	hl,souce
	ldir

	ld	a,1
	jp	destination
;
source:	equ	$
;
	phase	$4000
;
destination:
	ld	a,2
	ret
;
length:	equ	$ - destination

	dephase

First you need to move the code to its final destination before you can execute it with the correct result.
Edwin
msx professional
Berichten: 594
Geplaatst: 21 Februari 2005, 12:38   
If you want the space between $100 and $4000 padded in the file, you should reserve the space:

ORG 0x100
LD A,1
JP &H4000

Padding: DS $4000-Padding

ORG &H4000
LD A,2
RET

However, the moving option from BiFi is usually a bit nicer because it produces smaller com files. Do remember to change the ldir copy to an lddr version when the the original data grows beyond $4000.

I assume you want to do this in order to map the bios back in the first page. Ask yourself whether it's actually worth it or whether the slot call is sufficient for you. You can even consider to avoid bios use altogether. (Which is not actually all that hard when you get used to it)
Whizzy
msx user
Berichten: 56
Geplaatst: 21 Februari 2005, 13:16   
Well i'm running it from DOS so no BIOS for me there..

I guess i'll have to modify my program so that it just loads that specfic code at 0x4000 instead of including it into 1 file.

Thx.
sjoerd
msx addict
Berichten: 444
Geplaatst: 21 Februari 2005, 14:04   
SjASM won't recognise phase and dephase, you'll have to use textarea and endt instead. You can take a look at the listfile to see exactly what it does.
Here is the example BiFi gave again, but now it also works with SjASM:

	org	$100
;
	ld	bc,length
        ld	de,destination		
	ld	hl,source
	ldir

	ld	a,1
	jp	destination
;
source:
;
	textarea	$4000
;
destination:
	ld	a,2
	ret
;
length = $ - destination

	endt

Whizzy
msx user
Berichten: 56
Geplaatst: 21 Februari 2005, 15:24   
Thx guys !
 
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.