Help with this code learn

By Angra

Rookie (32)

Angra's picture

30-04-2015, 03:58

I am trying to compile this code and i am getting 3 fatal erros on .org, .start and .rom:

;--------------------------------------------
; PROGRAMA HELLO WORLD, PARA O MSX
;--------------------------------------------

.org 8000h
.start 8000h
.bin

INITXT equ 050eh
LDIRVM equ 0744h

INICIO:

call INITXT
ld BC, 12
ld DE, 0
ld HL, TEXTO
call LDIRVM

FIM:

jp FIM

TEXTO:

db "Hello World!"

Login or register to post comments

By Manuel

Ascended (19462)

Manuel's picture

30-04-2015, 07:37

You forgot to say which compiler/assembler you used and which errors you got....

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

30-04-2015, 12:16

Many assemblers don't like "." in front of ORG and lines need to be intended. Problem with start is probably because "." is used to define "sub-label" and there is no normal label before or that 8000h is tried to be compiled as assembler command.

Generally speaking, this is not very good example, but especially:

INITXT equ 050eh
LDIRVM equ 0744h

... please don't use these addresses. It may cause compatibility issues. instead use:

INITXT equ 006ch
LDIRVM equ 005ch

By Angra

Rookie (32)

Angra's picture

02-05-2015, 04:19

thanks Smile

using m80

now i am getting no end statement errors on start and bin

By AxelF

Champion (395)

AxelF's picture

02-05-2015, 13:43

Why not use a bit more advanced compiler, like Sjasm for example.

By Grauw

Ascended (10767)

Grauw's picture

02-05-2015, 16:47

Or Glass or Pasmo, which are cross-platform.

As for the errors, remove the .start and .bin directives, they are not standard assembler syntax and probably not recognised by M80. I guess they are meant to generate .BIN files on a certain assembler?

You can also generate BIN files without them though, just define the headers manually like:

    db 0FEH
    dw _begin, _end, _exec

    org 9000H
_begin:
_exec:
    ; your program here

_end:

Or generate a ROM file in stead:

    org 4000H

    db "AB"
    dw _exec
    dw 0, 0, 0, 0, 0, 0

_exec:
    ; your program here

    ds 8000H - $  ; pad to 16K

Or a COM file (MSX-DOS):

    org 100H

_exec:
    ; your program here