; **************************** ; ; *** support.lib *** ; ; **************************** ; ; ; ; ;****************************************************** ; ; Support library of macros and eaquates ; ; by A. Skjellum ; ; contents organized in this library: ; july 22, 1980 ; ; Copyright 1980 (C) Anthony Skjellum. ; All rights reserved. ; ;****************************************************** ; ; ; ;***************************************************** ; ; Macros ; ;***************************************************** ; ; ; ;***************************************************** ; ; dsub ; ; Does hl = hl - reg; ; ; Reg defaults to hl. ; ;**************************************************** ; ; ; dsub macro reg ora a if nul reg dsbc h else dsbc reg endif endm ; ; ;**************************************************** ; ; dmov ; ; loads the contents of one sixteen bit ; register with another. ; ; b,d,h are valid arguments. ; ; ;***************************************************** ; dmov macro reg1,reg2 mov reg1,reg2 mov reg1+1,reg2+1 endm ; ; ; ;****************************************************** ; ; Topld ; ; loads the spec. register with the contents ; of the top of stack. ; ; ;****************************************************** ; ; topld macro reg pop reg push reg endm ; ; ;****************************************************** ; ; xchgb ; ; Exchanges the contents of bc and hl (bc<-> hl) ; ;******************************************************* ; xchgb macro push b xthl pop b endm ; ; ;******************************************************* ; ; ixchg ; ; Exchanges the contents of x or y with the ; specified register pair. ; ; ;****************************************************** ; ixchg macro ireg,reg push reg xti&ireg pop reg endm ; ; ;****************************************************** ; ; Source ; Dest ; Count ; ; These set up the registers hl, de and bc ; prior to block moves. They were introduced ; to emphasize the nature of the block ; mode transfers in the code. ; ;****************************************************** ; source macro value lxi h,value endm dest macro value lxi d,value endm count macro value lxi b,value endm ; ; ;****************************************************** ; ; Load ; ; Does (de):=(hl); ; ;****************************************************** ; load macro mov a,m stax d endm ; ; ;****************************************************** ; ; com ; ; Used for making byte-word sequence tables ; ;****************************************************** ; com macro byte,word db byte dw word endm ; ; ;****************************************************** ; ; ;****************************************************** ; ; Escom ; ; Used to make bytr-word-byte sequence tables. ; ;****************************************************** ; ; escom macro byte,word,attr com byte,word db attr endm ; ; ;****************************************************** ; ; jmpr ; ; Z80 library expects "jr" command. This makes ; both valid. ; ;****************************************************** ; jmpr macro ?addr jr ?addr endm ; ; ; ; ;****************************************************** ; ; Equates ; ;****************************************************** ; ; off equ 0 ;logical off on equ 0FFFFH ;logical on ; ; maxw equ 64 ;64 char lines maxl equ 16 ;16 lines on the display ; ; ; space equ 32 ;space char cr equ 13 ;carrage return lf equ 10 ;linr feed del equ 7fh ;del, rub out, char chcls equ 6 ;cntrl f char: clear screen chrght equ 18 ;cntrl r char: curs. right cheos equ 19 ;cntrl s char: del. eos cheol equ 20 ;cntrl t char: del. eol chup equ 21 ;cntrl u char: curs. up chcln equ 22 ;cntrl v char: clear line chcloz equ 23 ;cntrl w char: close line chopen equ 24 ;cntrl x char: line open chadr equ 25 ;cntrl y char: cursor address chlft equ 12 ;cntrl l char: cursor left bk equ 8 ;backspace chhme equ 5 ;cntrl e char: cursor home chesc equ 27 ;escape mode char ; ; dspl equ 0f800h ;screen address espl equ dspl+400h ;first position of background display pcount equ (maxl-1)*maxw ;points to last line relative dline equ dspl+pcount ;commonly used address ; dpage equ (dspl shr 8) ;start page epage equ dpage+4 ;start of background memory page fpage equ dpage+8 ;page after background memory ; ; ; ;****************************************************** ; ; Test Macro ; ;****************************************************** ; test macro local temp,stor lxi sp,temp lhld 1 lxi d,6 dad d shld stor+1 ;; stor: call 0 res 7,a cpi 3 jz 0 call video jmpr stor ds 64 temp: endm ; ; ;