6502 VT100 Terminal(?)

Let's talk about anything related to the 6502 microprocessor.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 6502 VT100 Terminal(?)

Post by BigEd »

Need to remove that trailing slash:
https://mdfs.net/Docs/Comp/Comms/ANSI.htm
masterhit
Posts: 1
Joined: 06 Feb 2026

Re: 6502 VT100 Terminal(?)

Post 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
jgharston
Posts: 181
Joined: 22 Feb 2004

Re: 6502 VT100 Terminal(?)

Post 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.
Post Reply