CPCWiki forum

Deutsches CPC-Forum => Emulatoren => Topic started by: SerErris on 18:19, 26 September 23

Title: Winape Assembler/Debugger does weird things
Post by: SerErris on 18:19, 26 September 23
Hi all,

I have a problem with WinApe and I am not sure if I am seeing ghosts (sorry for the very bad translation from german).

I have this nice Assembler code (only a fraction of it):


org #8000

Main:
LD DE,&00
mainLoop: ;#8003 ;while StartAddress < EndAddress
PUSH IX ;Copy current Address to
POP     HL ;HL
LD      A,L ;Check if HL<BC
SUB C
LD A,H
SBC B
RET NC ;if HL<BC return (end address before start adress)
ADD HL,DE   ;Add offset to HL
CALL printAddress ;Print Address

This compiles perfectly. Looking at the debugger view it looks like that I am at breakpoint at #8000:
winape_debugger.jpg

So where it should read LD DE,0000 it reads LD DE,hl ??

The assembler did the right thing (11 00 00) is excatly the opcode for LD DE,0000

Also if I disassemble the code, it turns back into LD DE,#0000

That is absolutely strange and I never had it.

Anyone has any idea?
Title: Re: Winape Assembler/Debugger does weird things
Post by: roudoudou on 18:25, 26 September 23
hl is in lower case so i guess this assembler lets you use hl as label or variable or symbol and you declared something related to this elsewhere
Title: Re: Winape Assembler/Debugger does weird things
Post by: Prodatron on 20:55, 26 September 23

This happens, if you define hl as a label with the value #0000
winape.png

WinApe is doing everything correctly.
Title: Re: Winape Assembler/Debugger does weird things
Post by: SerErris on 08:33, 27 September 23
Hm, okay I was not aware that I did use any label "hl". And Indeed I did not, however I hate that Winape Assembler does not correctly parse comments.

If you have a : in a comment, everything after it is not considered a comment anymore.

So this line.

; Destroys: HL

Which should be perfect fine, actually defines HL as a label! And as I do not asign anything its values is 0, so the assembler automatically replaces my code DE,&00 with DE,hl.

Thanks for clarifying that for me.
Title: Re: Winape Assembler/Debugger does weird things
Post by: Jean-Marie on 09:55, 27 September 23
I had noticed this strange behavior regarding the comments. A solution is to type the semicolon twice, like :
;; comment here
Powered by SMFPacks Menu Editor Mod