Printing text on screen using ASM

Basic and Machine Language

Moderator: Moderators

Post Reply
20questions
Vic 20 Hobbyist
Posts: 114
Joined: Sun Mar 10, 2019 7:39 pm
Location: lodi california
Occupation: student

Printing text on screen using ASM

Post by 20questions »

Still somewhat new to 6502 and i was wondering how to print text on screen. I read in the Programmers manual to use JSR $FFd2 to do so.
however I'm not so sure

This was the code i had printed:
LDA $68
JSR $FFD2
LDA $69
JSR $FFD2
LDA $65
JSR $FFD2
LDA $68
JSR $FFd2
(DEAD)

I didn't see an ASM equivalent to print so i'm playing this by ear...poorly :?
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start 8)
User avatar
srowe
Vic 20 Scientist
Posts: 1356
Joined: Mon Jun 16, 2014 3:19 pm

Re: Printing text on screen using ASM

Post by srowe »

You can either re-use the BASIC routine PRTSTR ($CB1E) to print a string terminated by a NUL

Code: Select all

prtstr = $cb1e

	lda #<text
	ldy #>text
	jsr prtstr

text	.byt	"hello, world",$0d,$00
or just implementing something similar from scratch.
20questions
Vic 20 Hobbyist
Posts: 114
Joined: Sun Mar 10, 2019 7:39 pm
Location: lodi california
Occupation: student

Re: Printing text on screen using ASM

Post by 20questions »

srowe wrote: Sat Jan 04, 2020 12:56 am You can either re-use the BASIC routine PRTSTR ($CB1E) to print a string terminated by a NUL

Code: Select all

prtstr = $cb1e

	lda #<text
	ldy #>text
	jsr prtstr

text	.byt	"hello, world",$0d,$00
or just implementing something similar from scratch.
how do i do this in Vicmon? it doesn't allow the use of labels
Bedroom coder=rock star
modern coder= pop star
i'd rather be a rock star than a pop start 8)
User avatar
Mike
Herr VC
Posts: 4901
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Printing text on screen using ASM

Post by Mike »

20questions wrote:how do i do this in Vicmon? it doesn't allow the use of labels
In the thread "A sample programming session in VICMON" I give several examples, where strings are PRINTed with JSR $FFD2.

VICMON only provides a non-symbolic direct assembler. You either need to adopt the method(s) I lined out in said thread, or otherwise keep aside a piece of paper where you write down all relevant addresses and character codes in hexadecimal to insert them as instruction operands as necessary.

BTW, your first example in this thread here won't work as intended. You wrongly use zeropage addressing to read the values contained in addresses $65, $68 and $69 into A, which by themselves very likely will *not* contain $65, $68 and $69 as values. You should be using immediate addressing instead, signified by #$65, #$68 and #$69 as operands (note the hashes!), which truly load the values $65, $68 and $69 into A.
Post Reply