Files
RomWBW/Source/BPBIOS/Z34RCP11/z34mac.lib
2020-02-14 17:22:56 -08:00

122 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; Z33MAC.LIB : Macros for use with ZCPR33
; General purpose macros
putreg macro
push hl ; Save registers in order
push de
push bc
endm
getreg macro
pop bc ; Restore registers in order
pop de
pop hl
endm
swap macro
rrca ; Exchange nibbles
rrca
rrca
rrca
endm
;----------------------------------------
; Macro for forming option bytes
; This macro generates a byte with bits corresponding to up to 8 option
; flags. The bits are filled in the order of the parameters and are right
; justified in the byte.
optflag macro f1,f2,f3,f4,f5,f6,f7,f8
flag defl 0 ;; initial value
irp temp,<f1,f2,f3,f4,f5,f6,f7,f8>
if not nul temp
flag defl flag shl 1
if temp
flag defl flag or 1
endif ;;temp
endif ;;not nul temp
endm ;; irp
defb low flag
endm ;; optflag
;-----------------------------------------------------------------------------
; Command table entry definition macro
; Macro to form an entry for one command in the table. The first parameter is
; the name to be used for the command (no quotes); the second parameter is the
; flag that indicates whether or not the command is to be enabled; the third
; parameter is the wheel control flag; and the last parameter is the jump
; address to the code that carries out the command. The command names are
; automatically padded out to the correct length (they will be truncated and
; an error message will result if a command name is too long). The characters
; in the command name are automatically converted to upper case.
command macro cmdname,enableflag,wheelflag,address
if enableflag ;; Generate command only if enabled
whlmask defl wheelflag ;; Initialize variables
count defl cmdsize ;; Initialize to size of each command name
irpc char,cmdname ;; Repeat over letters in command name
count defl count - 1 ;; Count down characters in name
if [ count lt cmdsize ]
;; If character is lower case, convert to upper case
if [ '&char' ge 'a' ] and [ '&char' le 'z' ]
if whlmask
defb [ '&char' and 5fh ] + 80h
else ;;not whlmask
defb [ '&char' and 5fh ]
endif ;;whlmask
else ;;not lower case
if whlmask
defb '&char' + 80h ;; If controlled by wheel, set high bit
else ;;not whlmask
defb '&char' ;; If not restricted, leave high bit clear
endif ;;whlmask
endif ;;lower case
endif ;;[ count lt cmdsize ]
whlmask defl false ;; Turn off high-bit setting after first char
endm ;irpc
;; Pad command name with blanks
if [ count gt cmdsize ] ;; If we underflowed
*** Command name "&cmdname" is too long / truncated ***
else
rept count
defb ' '
endm
endif ;[ count gt cmdsize ]
dw address ;; Dispatch address for command
endif ;enable
endm ;command
; End Z33MAC.LIB