% ;example 26 mainline routinescreen equ 80 xref initstd_ ; references to xref putchar_ ; system routines xref putnl_ xref itos_ xref display ; reference to user routine jsr initstd_ ; initialize standard I/O ldb number ; load 25 into B jsr hdisplay ; display 25 in hexadecimal jsr putnl_ ; skip to a new line swinumber fcb reen ; display "EVEN" jsr putnl_ ; skip to a new line swiscr80 "fcc "This is an 80-column screen" fcb 0scr40 !fcc "This is a 40-column screen" fcb 0leftstr fcc "ODD" fcb ldb #'l ; on left side prints screen ; display scr80 or scr40 jsr putnl_ ; skip to a new line jsr putnl_ ; skip to a new line ldx #leftstr ; endm ; end of macro "prints" jsr initstd_ ; initialize standard I/O jsr putnl_ ; skip to a new line ifeq (screen - 80) ; if screem equals 80 ldx #scr80  loop ; loop ldb #' ; load ' ' into B pshs y ; save Y jsr putchar_ ; display blank puls y ; restore Y prints macr cmpb #'r ; compare B to 'r' if eq ; if B equals 'r' ifeq \0-80 ; if %0 equals 80 ldy #40 ; load Y with 40 endc 25 endine routine xref initstd_ ; references to xref putnl_ ; system routines xref hdisplay ; reference to user routine lds #$0f ; initialize S pointer g 0rightstr fcb 8 fcb 8 fcb 8 fcc "EVEN" fcb 0 end ; display "ODD" ldx #rightstr ; load address of rightstr ldb #'r ; on right side prints sc load address of leftstr ldb #'l ; on left side prints screen ; display "ODD" ldx #rightstr ; load address of rightstr ldb #'r ; on right side prints sc ; load address of scr80 endc ; end of cond. if ifeq (screen - 40) ; if screen equals 40 ldx #scr40 ; load address of scr40 endc ; end of cond. if leay -1,y ; decrement Y by 1 until eq ; quit if Y equals 0 puls x ; restore X endif ; endif jsr display ; display string  ; end of cond. if ifeq \0-40 ; if %0 equals 40 ldy #20 ; load Y with 20 endc ; end of cond. if pshs x ; save X  ;example 21 mainline routine xref initstd_ ; references to xref putnl_ ; system routines xref length_ xref equal_ xref display ; references to xref read  ;example 22 mainline routine xref initstd_ ; references to xref putnl_ ; system routines xref bdisplay ; reference to user routine lds #$0f ; initialize S pointer  endmainline routine xref initstd_ ; references to xref putnl_ ; system routines xref bdisplay ; reference to user routine lds #$0f ; initialize S pointer  endad file control block jsr closef_ ; close file else ; else ldx #errmsg ; load address of errmsg jsr display ; display string jsr pulay ; display "TRUE" or "FALSE" jsr putnl_ ; skip to a new line swistring1 rmb 41string2 rmb 41true fcc "TRUE" fcb 0false fcc "FALSE" fcb 0length1 rmb 2 end# load file control block jsr closef_ ; close file else ; else ldx #errmsg ; load address of errmsg jsr display ; display string jsr pu leas 4,s ; remove parameters from S if ne ; if strings are equal ldx #true ; load address of "TRUE" else ; else ldx # ldx #storage ; load address ldb ,x ; load chAracter into B quif eq ; quit if null string ldd outptr ; load file control block ead string ldd #string2 ; load address2 jsr length_ ; get length of string2 cmpd length1 ; compare lengths if eq ; if lengths are equal pshs d ";example 22 subroutine bdisplay xdef bdisplay ; definition for exteded use xref display -; reference to user routinebdisplay lda #8 ; load 8 into A loop ; loop  ; definition for external uses lds #$0f ; initialize S pointer jsr initstd_ ; initialize standard I/O ldx #string1 ; load address1 jsr read ; read string  jsr initstd_ ; initialize standard I/O ldb number ; load 25 into B jsr bdisplay ; display 25 in binary jsr putnl_ ; skip to a new line swinumber fcb 25  of "1" endif ; endif pshs d ; save D jsr display ; display "0" or "1" puls d ; restore D deca ; decrement A by 1 quif eq ; quit if A equals 0 endloop ; endloop rtschar0 fcc "0" fcb 0char1 fcc "1" fcb 0 end ldx #char1 ; load address;example 23 mainline routine xref initstd_ ; references to xref putnl_ ; system routines xref hdisplay ; reference to user routine lds #$0f ; initialize S pointer tnl_ ; skip to a new line endif ; endif swioutfile fcc "printer" fcb 0mode fcc "w" fcb 0outptr rmb 2storage rmb 41errmsg fcc "open error" fcb 0 false ; load address of "FALSE" endif ; endif else ; else ldx #false ; load address of "FALSE" endif ; endif jsr disp jsr fdisplay ; diplay string ldd outptr ; load file control block jsr fputnl_ ; skip to a new line endloop ; endloop ldd outptr ; ; push length onto S ldd #string1 ; load address1 pshs d ; push address onto S ldd #string2 ; load address2 jsr equal_ ; compare strings  aslb ; shift B left if cc ; if carry clear ldx #char0 ; load address of "0" else ; else ldx #char1 ; load address ldd #string1 ; load address1 jsr length_ ; get length of string1 std length1 ; store length at length1 ldx #string2 ; load address2 jsr read ; r% ;example 15 subroutine rtn7 which; operates from bank 7; and sends a message from; another bank xdef rtn7 ; definition for external use xref getmessage ; references to "ex15"org $10?include "disk/1.watlib.exp""ex15m.b09""ex12s.b09"bankorg $90 ;optionalbanksize $10 c;optionalbank 1"ex15rtn1.b09"bank 4"ex15rtn4.b09"bank 7"ex15rtn7.b09"bank 10"ex15getm.b09" ; references to  ;example 16 mainline routine xref initstd_ ; references to xref putnl_ ; system routines xref display ; references to xref read ; user routines lds #$0f #storage ; load address ldb ,x ; load character into B quif eq ; quit if null string jsr display ; display string jsr putnl_ ; skip to new;example 16 subroutine read xdef read ; definition for exteded use xref getchar_ #; reference to system routineread loop ; loop pshs x ; save X  endloop ; endloop lda #0 ; 0 is null byte sta ,x ; store as end-of-string rts end ; loop pshs x ; save X P jsr putchar_ ; display character rts end ex13s.asm  ex14m.asmex14rtn1.asm!;example 16 subroutine display xdef display ; definition for exteded use xref putchar_ &; reference to system routinedisplay loop ; loop ldb ,x+ ; load character i rts endy xdef display ; definition for exteded use xref putchar_ &; reference to system routinedisplay loop ; loop ldb ,x+ ; load character i!"ex16sr.b09""ex16sd.b09"ndy xdef display ; definition for exteded use xref putchar_ &; reference to system routinedisplay loop ; loop ldb ,x+ ; load character i xref display ; user routines xref message1 ; reference to stringrtn7 ldb #'7 ; load '7' into B pshs b ; push '7' onto S jsr getmessage ; transfer mesJ"ex17"org $10Ninclude "disk/1.watlib.exp""ex16.b09"include ex17.libtion for exteded use xref putchar_ &; reference to system routinedisplay loop ; loop ldb ,x+ ; load character i ; initialize S pointer jsr initstd_ ; initialize standard I/O loop ; loop ldx #storage ; load address jsr read ; read string ldx a line endloop ; endloop swistorage rmb 41 end loop ; loop ldx #storage ; load address jsr read ; read string ldx  jsr getchar_ ; read character puls x ; restore X cmpb #$0d ; carriage retuern? quif eq ; if yes, then quit stb ,x+ ; store character;example 18 mainline routine xref initstd_ ; references to xref openf_ ; system routines xref closef_ xref putnl_ xref fputnl_ xref display ; references to  xref fdisplay ; definition for external uses xref read lds #$0f ; initialize S pointer jsr initstd_ ; initialize standard I/O ldd #mode ; local address of filnto B quif eq ; quit if null byte pshs x ; save X jsr putchar_ ; display character puls x ; restore X endloop ; endloop e mode pshs d ; push file mode onto S ldd #outfile ; load address of filename jsr openf_ ; open file leas 2,s ; remove file mode from S std outptr  ; file control block address if ne ; if file opened okay loop ; loop ldx #storage ; load address jsr read ; read string sage ldx #message1 ; load address of message1 pshs x ; push address onto S jsr display ; display message rts end xref getmessage ; references to  ;example 11 subroutine xdef display ; definition for external use xref putchar_ &; reference to system routinedisplay ldx 2,s ; pull address into X loop ; loop  ;example 12 mainline routine xref initstd_ ; references to xref getchar_ ; system routines xref putnl_ xref display ; reference to user routine lds #$0f ; in  "hello" else ; else ldx #goodbye ; load address of "goodbye" endif ; endif pshs x ; push address onto S jsr display ; displa;example 12 subroutine xdef display ; definition for external use xref putchar_ &; reference to system routinedisplay ldx 2,s ; pull address into X loop ; loop  X endloop ; endloop ldd ,s++ ; pull return address from S std ,s ; push in place of parameter rts endinto X loop ; loop : 0goodbye fcc "goodbye" fcb 0 endread character cmpb #'h if eq ; if equal to 'h' ldd #hello ; load address of "hello" else ; else ;example 13 subroutine xdef display ; definition for external use xref putchar_ &; reference to system routinedisplay ldx 2,s ; pull address into X loop ; loop tialize standard I/O jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldd #hello ; load address of "hello" else ; else  X endloop ; endloop leas 4,s ; remove return address & parm jmp [-4,s] ; jump indirect through return endl address into X loop ; loop %;example 14 test of bank-switching ;mainline routine xref rtn1 ; references to xref rtn4 ; definition for external uses xref rtn7 xref bankinit_ ; references to  ldb,x+ ; load character into B quif eq ; quit if null byte pshs x ; store X jsr putchar_ ; display character puls x ; restoreitialize S pointer jsr initstd_ ; initialize standard I/O jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldx #hello ; load address of y string jsr putnl_ ; skip to a new line swihello fcc "hello" fcb 0goodbye fcc "goodbye" fcb 0 end ; if equal to 'h' ldx #hello ; load address of ldb,x+ ; load character into B quif eq ; quit if null byte pshs x ; store X jsr putchar_ ; display character puls x ; restore jsr rtn1 ; display '1' jsr putnl_ ; skip to a new line jsr rtn4 ; display '4' jsr putnl_ ; skip to a new line jsr rtn7 ; display '7' M jsr putnl_ ; skip to a ne line swi end lds #$0f ; initialize S pointer jsr bankinit_ ; initialize bank-switching jsr initstd_ ; initialize standard I/O  ldb,x+ ; load character into B quif eq ; quit if null byte pshs x ; store X jsr putchar_ ; display character puls x ; restore ldd #goodbye ; load address of "goodbye" endif ; endif jsr display ; display string jsr putnl_ ; skip to a new line swihello fcc "hello" fcb%;example 14 subroutine rtn1 which; operates from bank 1 xdef rtn1 ; definition for external use xref putchar_ ; references to system routinertn1 ldb #'1 ; load '1' into B  xref initstd_ ; system routines xref putnl_ lds #$0f ; initialize S pointer jsr bankinit_ ; initialize bank-switching jsr initstd_ ; initialize standard I/O L X endloop ; endloop rts endxternal use xref putchar_ &; reference to system routinedisplay ldx 2,s ; pull address into X loop ; loop ;example 1 lda #'a ; display 'a' sta $80 ; on the screen swi end"ex1"org $10"ex1.b09"'a ; display 'a' sta $80 ; on the screen swi end;example 2 xref putchar_ ; reference to system routine ldb #'a ; display 'a' jsr putchar_ ; on the screen swi end7"ex2"org $10=include "disk/1.watlib.exp""ex2.b09"ce to system routine ldb #'a ; display 'a' jsr putchar_ ; on the screen swi end;example 3 xref putchar_ ; reference to system routine ldx #string !; put address of string in Xnext ldb ,x+ ; load character into B beq quit ; quit if null byte example 3 xref putchar_ ; reference to system routine ldx #string !; put address of string in Xnext ldb ,x+ ; load character into B beq quit ; quit if null byte ;example 4 xref putchar_ ; reference to system routine ldx #string ; put address of string in X loop ; loop ldb ,x+ ; load character into B qCng fcc "hello" fcb $0d fcb 0 end routine ldx #string ; put address of string in X loop ; loop ldb ,x+ ; load character into B q;example 5 xref putchar_ ; reference to xref putnl_ ; system routines ldx #string ; put address of string in X loop ; loop ldb ,x+ ;  ; endloop jsr putnl_ ; skip to a new line swistring fcc "hello" fcb 0 end ; put address of string in X loop ; loop ldb ,x+ ; ;example 6 xref putchar_ ; reference to xref putnl_ ; system routines ldx #string ; put address of string in X ldb ,x+ ; load character into B loop  ; until null byte in B jsr putnl_ ; skip to a new line swistring fcc "hello" fcb 0 enddress of string in X ldb ,x+ ; load character into B loop ;example 7 xref getchar_ ; reference to xref putchar_ ; system routines xref putnl_ jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldx #hello ; load address of "hello" else ; else ldx #goodbye ; load address of "goodbye" endif ; endif loop ; loop  pshs x ; save X jsr putchar_ ; display character puls x ; restore X bra next ; repeat loopquit swistring fcc "hello" fcb 0 end ldb,x+ ; load character into B quif eq ; quit if null byte pshs x ; store X jsr putchar_ ; display character puls x ; resuif eq ; quit if null byte pshs x ; save X jsr putchar_ ; display character puls x ; restore X endloop ; endloop swistri tore X endloop ; endloop jsr putnl_ ; skip to a new line swihello fcc "hello" fcb 0goodbye fcc "goodbye" fcb 0 end loop ; loop  load character into B quif eq ; quit if null byte pshs x ; save X jsr putchar_ ; display character puls x ; restore X endloop ;example 8 mainline routine xref initstd_ ; references to xref getchar_ ; system routines xref putnl_ xref display ; reference to user routine jsr initstd_ ; ini ; loop pshs x ; save X jsr putchar_ ; display character puls x ; restore X ldb,x+ ; load character into B until eq 8A  h5 2A ex1.asm ex1.cmd ex2.asm ex2.cmd ex3.asm ex4.asm ex5.asm  ex6.asmex25m.asm ex26m.asm  ex7.asm ex8m.asm ex8s.asm ex8.cmd ex9m.asm ex9s.asm ex10m.asm  ex11m.asm ex11s.asm ex12m.asm ex12s.asm ex13s.asm  ex14m.asmex14rtn1.asmex14rtn4.asmex14rtn7.asmex14.cmd ex15m.asmex15getm.asmex15rtn1.asm ex15rtn4.asmex15rtn7.asm ex15.cmd ex16.asmex16sr.asmex16sd.asm  ex17.lib  ex17.cmd ex18m.asm ex18sf.asm ex.lib ex18.cmdex19m.asm  ex20m.asm ex21m.asm ex22m.asm ex22sb.asm ex23m.asmex23sh.asm ex24m.asm ;example 8 subroutine xdef display ; definition for external use xref putchar_ &; reference to system routinedisplay tfr d,x ; transfer D to X loop ; loop G endloop ; endloop rts endor external use xref putchar_ &; reference to system routinedisplay tfr d,x ; transfer D to X loop ; loop C"ex8"org $10Ginclude "disk/1.watlib.exp""ex8m.b09""ex8s.b09"endor external use xref putchar_ &; reference to system routinedisplay tfr d,x ; transfer D to X loop ; loop ;example 9 mainline routine xref initstd_ ; references to xref getchar_ ; system routines xref putnl_ xref display ; reference to user routine jsr initstd_ ; ini ldx #goodbye ; load address of "goodbye" endif ; endif pshs x ; push address onto S jsr display ; display string jsr putnl_ ; skip to a new;example 9 subroutine xdef display ; definition for external use xref putchar_ &; reference to system routinedisplay puls y ; pull return address into Y puls x ; pullx ; store X jsr putchar_ ; display character puls x ; restore X endloop ; endloop rts endss into Y puls x ; pull ;example 10 mainline routine xref initstd_ ; references to xref getchar_ ; system routines xref putnl_ xref display ; reference to user routine lds #$0f ; i f "hello" else ; else ldx #goodbye ; load address of "goodbye" endif ; endif pshs x ; push address onto S jsr display ; displ ;example 11 mainline routine xref initstd_ ; references to xref getchar_ ; system routines xref putnl_ xref display ; reference to user routine lds #$0f ; in ldb,x+ ; load character into B quif eq ; quit if null byte pshs x ; store X jsr putchar_ ; display character puls x ; restore X  itialize S pointer jsr initstd_ ; initialize standard I/O jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldx #hello ; load address of  "hello" else ; else ldx #goodbye ; load address of "goodbye" endif ; endif pshs x ; push address onto S jsr display ; displatialize standard I/O jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldx #hello ; load address of "hello" else ; else r line swihello fcc "hello" fcb 0goodbye fcc "goodbye" fcb 0 end ; if equal to 'h' ldx #hello ; load address of "hello" else ; else  string address into X pshs y ; push return back onto S loop ; loop ldb,x+ ; load character into B quif eq ; quit if null byte pshs y string leas 2,s ; remove address from S jsr putnl_ ; skip to a new line swihello fcc "hello" fcb 0goodbye fcc "goodbye" fcb 0 end ; load address ofnitialize S pointer jsr initstd_ ; initialize standard I/O jsr getchar_ ; read character cmpb #'h if eq ; if equal to 'h' ldx #hello ; load address o ay string jsr putnl_ ; skip to a new line swihello fcc "hello" fcb 0goodbye fcc "goodbye" fcb 0 end ; if equal to 'h' ldx #hello ; load address o% ;example 14 subroutine rtn4 which; operates from bank 4 xdef rtn4 ; definition for external use xref putchar_ $; references to system routinertn4 ldb #'4 ; load '4' into B % ;example 14 subroutine rtn7 which; operates from bank 7 xdef rtn7 ; definition for external use xref putchar_ $; references to system routinertn7 ldb #'7 ; load '7' into B "ex14"org $103include "disk/1.watlib.exp""ex14m.b09"bankorg $90 ;optionalbanksize $10 Z;optionalbank 0"ex14rtn1.b09"bank 4"ex14rtn4.b09"bank 7"ex14rtn7.b09"ex14rtn4.asmex14rtn7.asm&;example 15 test of bank-switching; &with data in a bank;mainline routine xdef message1 ; external use of string xref rtn1 ; references to xref rtn4 ; definition for externae bank-switching jsr initstd_ ; initialize standard I/O jsr rtn1 ; display "hello . 1" jsr putnl_ ; skip to a new line jsr rtn4 ; display "hello . 4" $;example 15 subroutine to handle; data in bank switched; memory xdef getmessage ; definition for external use xref message1 '; reference to system labelgetmessage lda 2 ; transfer string lda,x+ ; "hello from bank x" quif eq ; from message to sta,y+ ; message1 in the endloop & fcb 0 end lda,x+ ; "hello from bank x" quif eq ; from message to sta,y+ ; message1 in the endloop %;example 15 subroutine rtn1 which; operates from bank 1; and sends a message from; another bank xdef rtn1 ; definition for external use xref getmessage ; references to sage ldx #message1 ; load address of message1 pshs x ; push address onto S jsr display ; display message rts end xref getmessage ; references to O jsr putchar_ ; display character rts end ex13s.asm  ex14m.asmex14rtn1.asmex14rtn4.asmO jsr putchar_ ; display character rts end ex13s.asm  ex14m.asmex14rtn1.asmex14rtn4.asmex14rtn7.asm%;example 15 subroutine rtn4 which; operates from bank 4; and sends a message from; another bank xdef rtn4 ; definition for external use xref getmessage ; references to l uses xref rtn7 xref bankinit_ ; references to xref initstd_ ; system routines xref putnl_ lds #$0f ; initialize S pointer jsr bankinit_ ; initializ jsr putnl_ ; skip to a new line jsr rtn7 ; display "hello . 7" jsr putnl_ ; skip to a new line swimessage1 rmb 17 fcb 0 endnkinit_ ; initializ,s ; load character into A sta number ; store character ldx #message ; load address of message ldy #message1 ; load address of message1 loop ; mainline routine ldd ,s+ ; load return address & std ,s ; store in place of parameter rtsmessage fcc "hello from bank "number fcc "x"  xref display ; user routines xref message1 ; reference to stringrtn4 ldb #'4 ; load '4' into B pshs b ; push 'B' onto S jsr getmessage ; transfer mes xref display ; user routines xref message1 ; reference to stringrtn1 ldb #'1 ; load '1' into B pshs b ; push '1' onto S jsr getmessage ; transfer mes" ;example 18 subroutine fdisplay xdef fdisplay ; definition for exteded use xref fputchar_ 4; reference to system routinefdisplay std outptr loop ; loop ldb ,x+  jsr fputchar_ ; display character leas 2,s ; remove parameter from S puls x ; restore X endloop ; endloop rtsoutptr rmb 2 end 7("ex16sr.b09""ex16sd.b09""ex18sf.b09"lay character leas 2,s ; remove parameter from S puls x ; restore X endloop ; endloop rtsoutptr rmb 2 end I"ex18"org $10:include "disk/1.watlib.exp""ex18m.b09"include ex.lib,s ; remove parameter from S puls x ; restore X endloop ; endloop rtsoutptr rmb 2 end ;example 19 mainline routine xref initstd_ ; references to xref openf_ ; system routines xref closef_ xref putnl_ xref fputnl_ xref display ; references to e mode pshs d ; push file mode onto S ldd #outfile ; load address of filename jsr openf_ ; open file leas 2,s ; remove file mode from S std outptr  ldx #storage ; load address ldb ,x ; load character into B quif eq ; quit if null string ldd outptr ; load file control block sage ldx #message1 ; load address of message1 pshs x ; push address onto S jsr display ; display message rts end xref getmessage ; references to  load file control block jsr closef_ ; close file else ; else ldx #errmsg ; load address of errmsg jsr display ; display string jsr put endd file control block jsr closef_ ; close file else ; else ldx #errmsg ; load address of errmsg jsr display ; display string jsr put ; load character into B quif eq ; quit if null byte pshs x ; save X pshs d ; push character onto S ldd outptr ; load file control block  ;example 20 mainline routine xref initstd_ ; references to xref putnl_ ; system routines xref streq_ xref display ; references to xref read ; definition for external uses lds #$0f ; initialize S pointer jsr initstd_ ; initialize standard I/O ldx #string1 ; load address1 jsr read ; read string ldx #string2  ; load address2 jsr read ; read string ldd #string2 ; load address2 pshs d ; push address onto S ldd #string1 ; load address1 jsr streq_  xref fdisplay ; definition for external uses xref read lds #$0f ; initialize S pointer jsr initstd_ ; initialize standard I/O ldd #mode ; local address of fil ; file control block address if ne ; if file opened okay loop ; loop ldx #storage ; load address jsr read ; read string  jsr fdisplay ; write string ldd outptr ; load file control block jsr fputnl_ ; skip to a new line endloop ; endloop ldd outptr ;  ; compare to strings leas 2,s ; remove string2 address from S if ne ; if string are equal ldx #true ; load address of "TRUE" else ; els nl_ ; skip to a new line endif ; endif swioutfile fcc "tempfile" fcb 0mode fcc "w" fcb 0outptr rmb 2storage rmb 41errmsg fcc "open error" fcb 0 " ;example 23 subroutine hdisplay xdef hdisplay ; definition for exteded use xref putchar_ +; reference to user routinehdisplay clra ; clear A pshs d ; save D  ransfer D to X ldb hchars,x ; load hex digit into B jsr putchar_ ; display first hex char puls d ; restore D andb #$0f ; value of second hex digit tfr  ;example 24 mainline routine xref initstd_ ; references to xref printf_ ; system routines jsr initstd_ ; initialize standard I/O ldb char1 ; load 'a' i ; push 25 onto S ldd #string2 ; load address2 jsr printf_ ; display string2 formatted ldd #string ; load address pshs d ; pus swistring1 0fcc "printf_ can be used to display characters" fcc " such as %c.%n" fcb 0string2 .fcc "it can also be used to display decimal " fcc "numbers such as %d.%n" fcb 0string3 fcc "or hexadecimal n ; and %h in string3string /fcc "'This is a string.'" ; substitution value ; for %s in string3 fcb 0 enders such as %d.%n" fcb 0string3 fcc "or hexadecimal n;example 25 mainline routine xref initstd_ ; references to xref putchar_ ; system routines xref putnl_ xref itos_ xref display #; reference to user routineprints macr e ldx #false ; load address of "FALSE" endif ; endif jsr display ; display "TRUE" or "FALSE" jsr putnl_ ; skip to a new line swistring1 rmb 4 ldb #' ; load ' ' into B pshs y ; save Y jsr putchar_ ; display blank puls y ; restore Y leay -1,y ; decrementro "prints" jsr initstd_ ; initialize standard I/O jsr putnl_ ; skip to a new line ldx #leftstr ; load address of leftstr ldb #'1 ; on left side prints  lsrb ; shift B right 4 times lsrb ; in order to have D lsrb ; contain value of lsrb ; first hexadecimal digit tfr d,x ; td,x ; transfer D to X ldb hchars,x ; load hex digit into B jsr putchar_ ; display second hex char rtshchars fcc "0123456789ABCDEF" end tfr d,x ; tnto B pshs d ; push 'a' onto S ldd #string1 ; load address1 jsr printf_ ; display string1 formatted ldd number ; load 25 into D pshs d h address onto S ldd number ; load 25 into D pshs d ; push 25 onto S ldd #string3 ; load address3 jsr printf_ ; display string3 formatted umbers such as %h or " fcc "strings such as %ss.%n" fcb 0char1 fcb 'a -; substitution value for %c in string1number fdb 25 '; substitution value for %d in string2  ; display "ODD" ldx #rightstr ; load address of rightstr ldb #'r ; on right side prints ; display "EVEN" jsr putnl_ ; skip to a new line  cmpb #'r ; compare B to 'r' if eq ; if B equals 'r' ldy #40 ; load Y with 40 pshs x ; save X loop ; loop m1string2 rmb 41true fcc "TRUE" fcb 0false fcc "FALSE" fcb 0 endf ne ; if string are equal ldx #true ; load address of "TRUE" else ; els  Y by 1 until eq ; quit if Y equals 0 puls x ; restore X endif ; endif jsr display ; display string endm ; end of mac swileftstr fcc "ODD" fcb 0rightstr fcb 8 fcb 8 fcb 8 fcc "EVEN" fcb 0 endtstr ; load address of leftstr ldb #'1 ; on left side prints