+Ripdubski Posted April 24, 2014 Share Posted April 24, 2014 Aside from being XL/XE specific, whats wrong with using this vector (EOUTCH) to print to the screen - if anything - rather than using IOCB? Test Assembler: 10 *= $0600 20 EOUTCH=$F2B0 ; F6A4 for 800 30 LDA #65 40 JSR EOUTCH 50 RTS 60 .END Output: A Quote Link to comment Share on other sites More sharing options...
+JAC! Posted April 24, 2014 Share Posted April 24, 2014 (edited) 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 April 24, 2014 by JAC! Quote Link to comment Share on other sites More sharing options...
+Ripdubski Posted April 25, 2014 Author Share Posted April 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
kenjennings Posted April 25, 2014 Share Posted April 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
phaeron Posted April 25, 2014 Share Posted April 25, 2014 Better to use ICPTL/H from IOCB #0 ($0346/$0347) rather than hardcoding the OS's E: vector. It's automatically set by CIO when the IOCB is opened and that'll still work if the E: device is replaced in HATABS. 1 Quote Link to comment Share on other sites More sharing options...
+Ripdubski Posted April 25, 2014 Author Share Posted April 25, 2014 (edited) 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 April 25, 2014 by Ripdubski Quote Link to comment Share on other sites More sharing options...
+Ripdubski Posted April 25, 2014 Author Share Posted April 25, 2014 (edited) Using CIO and IOCB 0 I was finally able to get Hello World displayed. Thx for the help! Feels like a huge accomplishment though I know it isn't. Edited April 25, 2014 by Ripdubski 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.