Autor
| incedibly simple assembly problems
|
norakomi msx professional Mensajes: 861 | Publicado: Enero 31 2005, 12:36   |
why why why do I get all those problems, please help me !!
I´m using emulators (rumsx and nlmsx), and whenever I reset I choose a hard reset to clear all the ram.
The emulator I use is: Wbass
The problems which overcome me:
ORG $C000
ld a,4
ld b,a
end
go $c000
register fout
why must this extremely simple programm bug me with this error?
org $c000
ld a,"B"
call $a2
end
go $c000
B
this one works, yeah !! output
org $c000
ld a,"B"
call $a2
ld a,"C"
call $a2
end
go $c000
Waarde te groot of te klein
this one doesn´t, por que ???
org $c000
ld a,"B"
ld (som),a
som: defb 00
end
go $c000
Yes, this one gives me no problems, but the next one is practicly
the same:
org $c000
ld a,"B"
ld (som),a
som: defb 00
ld a,"C"
end
go $c000
Operand fout
I can´t seem to see the problem here......
org $c000
ld a,"B"
ld (som),a
ld a,"C"
som: defb 00
end
go $c000
Operand fout
Who´s playing tricks here, the assembler, the emulator or the
programm?
org $c000
ld a,"B"
end
go $c000
Operand fout
I´m going crazy !!!!!
org $c000
ld a,"B"
ld b,a
end
go $c000
Register fout
this one is the same as the one before but gives a different type
of error..... any one knows how come?
org $c000
ld a,"B"
ld b,a
ld a,"C"
end
go $c000
and this one is also the same, but gives no errors !!!!!
All the help is welcome.......
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Enero 31 2005, 12:42   |
Any routine should have a RET (the line before END) when you want to return to the assembler after your code was executed.
|
|
norakomi msx professional Mensajes: 861 | Publicado: Enero 31 2005, 13:05   |
INCREDIBLE !!!
I started about half a year ago with assemble and kept on bouncing on these problems..... I studied material and studied and studied.
Even bought books about learning assembly and still I got these problems
untill now.
Such a stupidly simple sollution.
adding RET at the end before END::::::!!!!! ::::  ))))
thnkUsomutsj !!! |
|
chaos msx addict Mensajes: 276 | Publicado: Enero 31 2005, 13:39   |
btw, in this example:
org $c000
ld a,"B"
ld (som),a
ld a,"C"
som: defb 00
end
you should place the ret before the "som: defb 00", else it will be executed. |
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Enero 31 2005, 17:06   |
I'll show you your first assembly 'trick' by the way... Normally, you need to end each program with a RETurn, right? So that would be: LD A,"H"
CALL $A2
LD A,"I"
CALL $A2
LD A,"!"
CALL $A2
RET But, and this is your first little trick, normally you can almost always replace a CALL followed immediately by a RET with a single JP (jump) without the RET. So that would be: LD A,"H"
CALL $A2
LD A,"I"
CALL $A2
LD A,"!"
JP $A2 Now ain't that cool?
|
|
pitpan msx master Mensajes: 1390 | Publicado: Enero 31 2005, 19:22   |
Nice one for newbies, Sonic.
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Enero 31 2005, 20:32   |
norakomi: why not join the #msxdev channel on the Rizon IRC network... Many coders are ready to help out with any of your coding-related problems. |
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Febrero 01 2005, 11:48   |
Quote:
| Nice one for newbies, Sonic. 
|
I remember it was the very first 'trick' I learned... ^_^ Made me so happy, "look ma! I saved a byte!!!" |
|
[D-Tail]
 msx guru Mensajes: 3020 | Publicado: Febrero 01 2005, 13:33   |
boh...
ld a,0 vs. xor a  |
|
msd msx professional Mensajes: 618 | Publicado: Febrero 01 2005, 13:41   |
or a/and a instead of cp 0
|
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Febrero 01 2005, 13:49   |
idd, those two came before OUTI.... I can't believe I forgot those!
|
|
|
|
|