CURSOR - POSITION in ASSEMBLER -------------------------------------------------------------------------------------------------- TOOL: Built-In ML-Monitor {Commodore C128} Language: Assembler Extra: Files are on floppy disk Author: Misel Zivanovic Note: (C) 18th DEC 2025 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- Setting a cursor to a specific position isn't so difficult in BASIC. And also not in assembler! BASIC POSSIBILITIES! CHAR 1,10,0 CHAR 1,10,0,"here i am" PRINTTAB(0-255) {This is going over few rows if the numbers are higher than 40} {e.g. a value of 200 is then 5th row} {e.g. a value of 220 is approximately middle of the screen, 5th row} Poke 235,(rows, 0 - 24): Poke 236,(columns, 0 - 39) SYS 65520,rows {0 - 24},columns {0 - 39},0 And finally, you could also use special CHR$ codes to place the cursor where you want! {check one of the Commodore C128 books for more info in regard to that} --------------------------------------------------------------------------------------------------- ASSEMBLER PART {ML-CODE}: {as usually, copy/paste} >00b00 a9 0a 85 eb a9 03 85 ec:I..KI..L >00b08 a9 20 38 20 f0 ff a2 00:I 8 P.B. >00b10 bd 29 0b 69 40 09 40 c9:.).I@.@I >00b18 5a b0 09 20 d2 ff e8 e0:zP. R.H. >00b20 1d d0 ed 60 a9 20 4c 1b:.PM.I l. >00b28 0b 20 14 05 12 0d 09 0e:. ...... >00b30 01 14 0f 12 20 09 13 20:.... .. >00b38 03 0f 0d 09 0e 07 20 06:...... . >00b40 0f 12 20 19 0f 15 20 20:.. ... NOTE: The message is here, so copy and paste this, not the code below! --------------------------------------------------------------------------------------------------- ALL EXPLAINED: So, what do we have here: . 00b00 a9 0a lda #$0a row #10 . 00b02 85 eb sta $eb write to register . 00b04 a9 03 lda #$03 column . 00b06 85 ec sta $ec write to register . 00b08 a9 20 lda #$20 SPACE {empty} . 00b0a 38 sec set carry {needed to differ between SET {SEC} and READ {CLC} the cursor position} . 00b0b 20 f0 ff jsr $fff0 Call the KERNAL routine . 00b0e a2 00 ldx #$00 counter to zero for our message . 00b10 bd 29 0b lda $0b29,x read the message . 00b13 69 40 adc #$40 add 64 to counter {to get the right characters} . 00b15 09 40 ora #$40 and invert {because carry is set! without this you would get reverse characters!} . 00b17 c9 5a cmp #$5a get read of everything accept the characters {alphabet} . 00b19 b0 09 bcs $0b24 replace it there with SPACE #$20, dec 32 . 00b1b 20 d2 ff jsr $ffd2 Bring it on the screen . 00b1e e8 inx counter up . 00b1f e0 1d cpx #$1d message end? . 00b21 d0 ed bne $0b10 No? Repeat! . 00b23 60 rts Back to BASIC . 00b24 a9 20 lda #$20 Replacement for all but characters {alphabet}, SPACE inserted instead e.g. # = " " . 00b26 4c 1b 0b jmp $0b1b Message is not part of the code here! ---------------------------------------------------------------------------------------------------