Extend your language: Difference between revisions

m
m (Edited XBS to properly fit the task requirement)
Line 3,404:
Sorry, your number 0 must be greater than 0!
</pre>
 
=={{header|Z80 Assembly}}==
The language can only really be extended using macros, since there's no way to add your own commands. This is a simple template for a 4 way branch. It's not the most elegant method, but it gets the job done.
<lang z80>cp b
jr nz,B_False
cp c
jr z,doubleTrue
;B true, C false
 
;your code goes here
 
jp done
B_False:
cp c
jr nz,doubleFalse
;B false, C true
 
;your code goes here
 
jp done
 
doubleTrue:
;your code goes here
jp done
doubleFalse:
;your code goes here
jp done
 
done:
;rest of program</lang>
 
 
=={{header|ZX Spectrum Basic}}==
1,489

edits