myscreen=$cb ; and $cc ; demo to print lines of text directly to screen org $2000 resetscreen ; point at screen start address MVA #0 myx ; set x and y to 0,0 sta count ; loop counter for demo sta myy MVA #cls adr+1 ; and hi byte move ; move to print position getlen ; get string length, returned in X reg putmess ; put message to screen resetscreen ; and reset screen pointer MVA #0 myx MVY #1 myy ; down 1 line l1 move ; move cursor to x,y MVA #message adr+1 getlen ; get string length, length in x putmess ; put message on screen @x,y inc myy ; X+1, Y+1 for loop print inc myx resetscreen ; restore start screen address inc count lda count cmp #23 ; loop to put 23 strings on screen bne l1 xx jmp xx rts putmess .proc ; print string loop MVA adr c1+1 ; change address at c1 to point at text string MVA adr+1 c1+2 stx xtmp ; save length ldy #0 ldx #0 c1 MVA count,x (myscreen),y ; address will change @ runtime ; put char on screen inc myscreen ; move cursor to next postion bne next ; taking care of high byte too inc myscreen+1 next inx cpx xtmp ; are we finished bne c1 ; no, next character rts MVA count,x (myscreen),y xtmp .byte 0 .endp move .proc ; move cursor to print location ldy myy ; load y position beq over ; y=0 so top line loop ADW myscreen #40 myscreen ; add 40 for each line dey bne loop over lda myx ; finally add x position clc adc myscreen sta myscreen lda #0 adc myscreen+1 sta myscreen+1 ; now pointing to correct screen position rts .endp resetscreen .proc ; restore screen pointer MVA $58 myscreen MVA $59 myscreen+1 rts .endp getlen .proc ; get string length $FF is terminator ldx #255 MVA adr c1+1 ; change address at c1 MVA adr+1 c1+2 loop inx c1 lda count,x ; address will change inx cmp #$ff bne c1 dex ; x has length rts .endp cls .byte " Direct Screen Printing Demonstration",0xFF ; clear line with dos prompt message .byte "this is a test message",$FF adr .word 0 ; temp store for message address myx .byte 0 ; x screen position myy .byte 0 ; y screen position count .byte 0