Jump to content
IGNORED

Assembly: Print to Screen & EOUTCH


Recommended Posts

There are many different OS variants/replacements for Atari computers (QMEG, HI-Speed, LLE, ...). Therefore you should always use the correct vectors. The shortest way for your use case is something like:

 

.proc print_char;IN: <A> = char, changes <A>, <X>, <Y>

sta temp
lda $e407 ;Use PUT_CHAR from E: handler

pha

lda $e406

pha

temp = *+1

lda #$00

rts

.endp

Edited by JAC!
Link to comment
Share on other sites

I had not thought about non atari os's. Good advice. Thats the why I was looking for.

 

Since im learning assembly help me understand that code.

 

Store acc in temp. (The value A from my code)

Load acc with value in e407

Push acc to stack

Load acc with value in e406

Push acc to stack

Temp storage space (where the a is stored)

Load acc with 0

Return

 

So my code loads acc with 65 (A), then jumps to this routine. Which instruction is actually causing the a to print via the e: put vector? I guess im not seeing something. And Why E and not S? Noob questions i know, but im learning. Thx.

Link to comment
Share on other sites

The code pushes the PUT_CHAR vector address on the stack.

The RTS causes this routine to "return" to the address on the stack... which is now the PUT_CHAR vector address.

The PUT CHAR routine will return by RTS which will end up using the original address -- that is, returning to the point in the code that called this print_char routine in the first place.

Link to comment
Share on other sites

The code pushes the PUT_CHAR vector address on the stack.

The RTS causes this routine to "return" to the address on the stack... which is now the PUT_CHAR vector address.

The PUT CHAR routine will return by RTS which will end up using the original address -- that is, returning to the point in the code that called this print_char routine in the first place.

Ok, that makes sense. Thx! And thsnks phaeron for the additional why. Edited by Ripdubski
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...