Home | YS MegaBasic Contents |
MACHINE CODE AND YS MegaBasicDOKE AND CALLIt's still possible to run Z80 machine code programs alongside YS MegaBasic, but there are one or two points worth noting as you make the transition to the MegaSpectrum.The top section of memory above address 45000 is used by YS MegaBasic; thus, any machine code routines of your own that use this area will have to be moved down. YS MegaBasic uses interrupt mode 2, so any routines that mess about with the interrupts will probably need some attention before they'll work properly. When you're dealing with the Z80 processor it's often necessary to POKE two-byte values into memory. YS MegaBasic provides the 'DOKE_' command to perform this task. This is followed by two numeric expressions (separated by commas); the first is the address to be POKEd and the second, the data that's actually going to be placed into memory. The data is stored using the standard Z80 convention - that is, LSB first, MSB second. The 'CALL_' command is used to call machine code routines in memory and it too is followed by a numeric expression - the address of the routine to be called. This address can then, if required, be followed by any number of numeric expressions. These expressions are evaluated and the result pushed on to the machine stack. This feature allows parameters to be passed to machine code routines. |
19.b |
---|
THE FRONT-PANELThe 'front-panel' is provided to allow users the opportunity to alter memory and registers when using hexadecimal. The front-panel is activated either by executing the 'MON' command, or typing 'Control F' while a program is running. The front-panel uses window three and this should always be at least 40 columns by 20 lines or the display won't function correctly.Once the front-panel is activated, you'll be greeted by columns of hexadecimal numbers. On the left (in cyan) is the list of registers with the accumulator at the top; the flags register is shown in binary. The asterisk indicates the current register. On the right is the current piece of memory with the current location shown on the inverse strip; at the bottom is the input line (shown in green). The front-panel is controlled by a number of single-letter commands; these may be followed by up to three Hex numbers. All Hex numbers must be typed out in full; if a 16-bit Hex number is required then a four digit number must be typed. Note that 'n' represents an eight-bit Hex number and 'nn' represents a 16-bit Hex number.
| ||||||||||||||||||||||||
20 |
---|