Assembly information

Pagina 2/5
1 | | 3 | 4 | 5

Van pitpan

Prophet (3152)

afbeelding van pitpan

26-11-2004, 15:20

For creating MSX ROMs you can check asMSX v.0.10.
Get it at http://www.robsy.net/asmsx.htm

For creating a ROM file using asMSX v.0.10 you only need to include the following header to your source code:

.bios ; this defines all MSX1 subroutine names: ENASCR, LDIRVM, GTSTCK, etc.
.page 1 ; set at 4000h. Use .page 2 to start at 8000h
.rom ; defines the output file as a ROM
.start MY_PROGRAM ; defines the boot address for the ROM file

MY_PROGRAM:
; Include here your code

After assembling you will get a corretly sized (8, 16 o 32 KB) ROM file.

The package has got some simple examples. You can also download a full commented opensource game at http://www.robsy.net/progs.htm

At the moment all the documentation and comments are in spanish, but that shouldn't be a problem for you, being brazilian. Anyway, an updated v.0.11 version will be published by the end of this month, with a translated documentation and several other examples and tiny helpful tools (file converters, compressors, examples, etc.)

Another full-source MSX game is coming. And an updated version of the crappy PONG CLASSIC v.0.10 aswell.

Give it a try, Leandro.

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

26-11-2004, 15:33

Sure I will try it! Big smile

Just in case, what do I have in mind...

One or two players game running and shooting just like Son Son, Risky Woods or Metal Slug. Scenery composed by graphic blocks, simple background tune. 10 stages, and graphics would change at each two stages. Scroll would be 8x8 pixels, of course, but enemies would move smoothly (just like in Magical KidWiz). Five bosses that would be just 32x32 pixel sprites. It can be done in 32 Kbytes, I guess.

I wonder if your compiler could be adapted to generate 64, 128, 256 and 512 Kbytes ROMs as well. Smile

Van sjoerd

Hero (602)

afbeelding van sjoerd

26-11-2004, 15:39

I rewrote a hello world that was lying around here somewhere:

; hoi.asm

; bios routine addresses

Init32 equ 7bh
SetWrt equ 53h
ChGet equ 9fh
ChPut equ 0a2h

; rom header

  size 8000h               ; 32KB ROM
  org 4000h                ; ROM starts on address 4000h

  db "AB"
  dw Start                 ; init address
  dw 0,0,0
  dw 0,0,0

Start
  call Init32              ; bios routine to init screen 1
  ld hl,6144               ; put writeaddress in registerpair HL
  call SetWrt              ; set vdp for writing from address in HL
  ld hl,HelloWorldTxt      ; put adress of our string in registerpair HL
  call Print               ; subroutine that prints string to screen
  call ChGet               ; bios routine to read a character from the keyboard
  ret                      ; return to BASIC ROM

Print
  ld a,(hl)                ; put char that HL points to in register A
  or a                     ; A=A OR A, and set flags, like the zeroflag when A=0
  ret z                    ; return if the zeroflag is set
  call ChPut               ; bios routine to output char in A to the screen
  inc hl                   ; increase the stringpointer
  jr Print                 ; jump to start of the routine to print next char

HelloWorldTxt              ; Label for our string
  db "Hello World!",0      ; an array so to say :)

Of course I am using SjASM Smile (like "sjasm -l hoi.asm hoi.rom").
To create ROM files, you could use asMSX, that has even a ROM directive.

Van pitpan

Prophet (3152)

afbeelding van pitpan

26-11-2004, 15:47

Of course that it can be adapted for that. All that you need is to import the symbols table, create different files for every ROM page and then just link them alltogether.

Anyway, I would suggest you to start with an easier project. Assembler is tricky, try some basic concepts before starting with a BIG project. And look at ADVENTURE ISLAND, MAGICAL KID WIZ and several others: they are only 32 KB long.

Regards,

Edward Robsy

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

26-11-2004, 17:03

By the way,

Can I use C and Assembly in MSX together?

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

26-11-2004, 17:03

If I started a big project...

I'd rather program it in a high level language (Blitz Basic for PC, for instance), but adapting some features to behave like a real MSX. After that I'd start to convert it into Assembly.

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

26-11-2004, 17:27

My first compiling error in Assembly...

.bios 
.page 1 
.rom
.start MY_PROGRAM 

MY PROGRAM:
call Init32

At AsMSX, it returns: Sintax error at line 6... Sad

Van Thom

Paladin (691)

afbeelding van Thom

26-11-2004, 17:28

Your compiler doesn't support spaces in LABELS?

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

26-11-2004, 17:41

Mea culpa! Now it returns an "undefined identifier" at the "Call Init 32". Tongue

.bios 
.page 1 
.rom
.start MY_PROGRAM 

MY_PROGRAM:
call Init 32

Van Maggoo

Paragon (1216)

afbeelding van Maggoo

26-11-2004, 17:44

By the way,

Can I use C and Assembly in MSX together?

You can but beleive me you don't want to Smile

Pagina 2/5
1 | | 3 | 4 | 5