gen80 conditional assemble?

بواسطة lintweaker

Champion (364)

صورة lintweaker

30-01-2021, 14:16

I have an existing program, written in gen80 assembly which I now try to make to work for both MSX-BASIC and in DOS by adding conditional assembly (e.g. for BDOS calls).
According to the gen80 manual it should support IF ... THEN ... ENDC but it gives me

Bad mnemonic in ....

on the IF statement. A simplified piece of code that shoud work?

DOS equ 1
   org 0100h
IF DOS
  ld a,1
ELSE
 ld a,2
ENDC
 ret

Any ideas what I am doing wrong here? I tried various alterations to no avail.
This with gen80 2.04.

Login أوregister لوضع تعليقاتك

بواسطة Sandy Brand

Master (225)

صورة Sandy Brand

30-01-2021, 16:01

I am not too familiar with GEN80.

However, a quick look at this HiSoft DevPac 80 Manual (older version) shows some examples whereby the conditional logic has some leading spacing.

The manual seems to suggest that only labels are allowed to start at the left side, other mnemonics need to have either a label or some spacing in front of them. So in your case it now thinks a label called 'IF' is defined, which is then followed by the mnemonic 'DOS', which it doesn't understand of course.

Maybe give that a try? :)

بواسطة santiontanon

Paragon (1282)

صورة santiontanon

30-01-2021, 16:06

I think Sandy got it! In the pdf linked in his response, this is explained in pages G-14 and G-15, where the document explains how the assembler interprets each line of code.

بواسطة lintweaker

Champion (364)

صورة lintweaker

30-01-2021, 16:30

Thanks guys! That is it. Very much overlooked by me - the normal quickly scan the manual to get what you need method - did not work here Smile