04-17-2019, 01:14 PM
Hi
THIS CODE WORKS AS EXPECTED
1) CLS
2) Print "Hello"
3) Make a sound with assembler subroutine
4) Print "World"
5) Make the STOP
--------INI CODE ---------------------------------------------------------------------------------------------
SUB mySound()
ASM
LD B,5
loop:
PUSH BC
LD HL,768
anotherLoop:
LD DE,1
PUSH HL
CALL 949 ;'ROM BEEPER ROUTINE 949 = $3B5
POP HL
LD DE,16
AND A
SBC HL,DE
JR NZ, anotherLoop
POP BC
DJNZ loop
RET
END ASM
END SUB
CLS : REM 'Clear screen
PRINT "Hello" : REM 'Print Hello on screen
mySound() : REM 'Make the sound
PRINT "World" : REM 'Print World on screen
STOP : REM STOP the program
----------------- END CODE ----------------------------------------------------------------------------------------------------
But if i change something, doesn't work
Per example :
1) ¿BUG ERROR?
If i change the assembler code and i put PUSH IX AT THE BEGINNING AND POP IX AT THE END
that is the advice in this forum to all assembler routines
SUB mySound()
ASM
PUSH IX ; This make the program not work properly
LD B,5
......
......
......
DJNZ loop
POP IX ; This make the program not work properly
RET
END ASM
END SUB
doesn't work
2) ¿BUG ERROR?
If i add some blank space to the words printed per example "hello " blank space at the end or somewhere
or at the printed word "world " make the program not work properly and don't execute the last print and the stop
3) ¿BUG ERROR?
If i add ; at the end of the word "Hello" per example "Hello"; doesn't work either
4) ¿BUG ERROR?
If i make the words "Hello" and "World" variables Per example a$ = "Hello", b$ = "World"
anfd i make
PRINT a$ : REM 'Print Hello on screen
mySound() : REM 'Make the sound
PRINT b$ : REM 'Print World on screen
doesn't work either
-----------------------------------------------------------------------------------------------------------------
I don't know what is going on ¿?¿?¿
Thanks
THIS CODE WORKS AS EXPECTED
1) CLS
2) Print "Hello"
3) Make a sound with assembler subroutine
4) Print "World"
5) Make the STOP
--------INI CODE ---------------------------------------------------------------------------------------------
SUB mySound()
ASM
LD B,5
loop:
PUSH BC
LD HL,768
anotherLoop:
LD DE,1
PUSH HL
CALL 949 ;'ROM BEEPER ROUTINE 949 = $3B5
POP HL
LD DE,16
AND A
SBC HL,DE
JR NZ, anotherLoop
POP BC
DJNZ loop
RET
END ASM
END SUB
CLS : REM 'Clear screen
PRINT "Hello" : REM 'Print Hello on screen
mySound() : REM 'Make the sound
PRINT "World" : REM 'Print World on screen
STOP : REM STOP the program
----------------- END CODE ----------------------------------------------------------------------------------------------------
But if i change something, doesn't work
Per example :
1) ¿BUG ERROR?
If i change the assembler code and i put PUSH IX AT THE BEGINNING AND POP IX AT THE END
that is the advice in this forum to all assembler routines
SUB mySound()
ASM
PUSH IX ; This make the program not work properly
LD B,5
......
......
......
DJNZ loop
POP IX ; This make the program not work properly
RET
END ASM
END SUB
doesn't work
2) ¿BUG ERROR?
If i add some blank space to the words printed per example "hello " blank space at the end or somewhere
or at the printed word "world " make the program not work properly and don't execute the last print and the stop
3) ¿BUG ERROR?
If i add ; at the end of the word "Hello" per example "Hello"; doesn't work either
4) ¿BUG ERROR?
If i make the words "Hello" and "World" variables Per example a$ = "Hello", b$ = "World"
anfd i make
PRINT a$ : REM 'Print Hello on screen
mySound() : REM 'Make the sound
PRINT b$ : REM 'Print World on screen
doesn't work either
-----------------------------------------------------------------------------------------------------------------
I don't know what is going on ¿?¿?¿
Thanks