Page 2 of 2

Re: 6502 VT100 Terminal(?)

Posted: Mon Nov 13, 2023 9:10 pm
by BigEd
Need to remove that trailing slash:
https://mdfs.net/Docs/Comp/Comms/ANSI.htm

Re: 6502 VT100 Terminal(?)

Posted: Fri Feb 06, 2026 6:27 pm
by masterhit
Heres a code snippet, that might be useful:

Code: Select all

; ANSI / VT100 Cursor positioning (Row ; Col) in 6502 assembler
; CURX is the memory location for the X position, and
; CURY the one for the Y position...
; TEMP is somewhere...
; CHOUT on the KIM-1 is  $1EA0

GOTOXY:
          LDA #$1B      ; ESC
          JSR CHOUT
          LDA #$5B      ; '['
          JSR CHOUT

          LDA CURY      ; Row first!
          JSR PUTDEC

          LDA #$3B      ; ';'
          JSR CHOUT

          LDA CURX      ; Column... after
          JSR PUTDEC

          LDA #$48      ; 'H'
          JSR CHOUT
          RTS

; Dezimalzahl ausgeben (A-Register, 0-99)
; Benutzt TEMP als temporäre Variable
PUTDEC:
          STA TEMP      ; Wert sichern
          LDY #0        ; Zehner-Zähler

PUTDEC_T: CMP #10
          BCS PUTDEC_S  ; >= 10
          JMP PUTDEC_D
PUTDEC_S: SEC
          SBC #10
          INY
          JMP PUTDEC_T

PUTDEC_D: ; A enthält Einer
          TAX           ; Einer nach X retten

          TYA           ; Zehner
          BNE PUTDEC_Z  ; Wenn nicht 0
          JMP PUTDEC1
PUTDEC_Z: CLC
          ADC #$30      ; In ASCII umwandeln
          JSR CHOUT

PUTDEC1:  TXA           ; Einer zurück
          CLC
          ADC #$30      ; In ASCII umwandeln
          JSR CHOUT

          LDA TEMP      ; Original wiederherstellen
          RTS

Re: 6502 VT100 Terminal(?)

Posted: Sat Feb 14, 2026 4:47 am
by jgharston
BigEd wrote:
Need to remove that trailing slash:
https://mdfs.net/Docs/Comp/Comms/ANSI.htm
Added sample code for 6502 and Z80.