Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #3878 > unrolled thread
| Started by | laseractiveguy@gmail.com |
|---|---|
| First post | 2017-09-01 11:01 -0700 |
| Last post | 2017-09-02 23:15 -0700 |
| Articles | 11 — 7 participants |
Back to article view | Back to comp.sys.apple2.programmer
Displaying a 16 or 24 bit value in decimal.... laseractiveguy@gmail.com - 2017-09-01 11:01 -0700
Re: Displaying a 16 or 24 bit value in decimal.... laseractiveguy@gmail.com - 2017-09-01 11:04 -0700
Re: Displaying a 16 or 24 bit value in decimal.... John Brooks <jbrooks@blueshiftinc.com> - 2017-09-01 12:49 -0700
Re: Displaying a 16 or 24 bit value in decimal.... laseractiveguy@gmail.com - 2017-09-01 13:36 -0700
Re: Displaying a 16 or 24 bit value in decimal.... laseractiveguy@gmail.com - 2017-09-01 13:47 -0700
Re: Displaying a 16 or 24 bit value in decimal.... gids.rs@sasktel.net - 2017-09-01 13:57 -0700
Re: Displaying a 16 or 24 bit value in decimal.... gids.rs@sasktel.net - 2017-09-01 14:02 -0700
Re: Displaying a 16 or 24 bit value in decimal.... James Davis <JPD.Enterprises@outlook.com> - 2017-09-01 19:05 -0700
Re: Displaying a 16 or 24 bit value in decimal.... Michael J. Mahon <mjmahon@aol.com> - 2017-09-01 22:38 -0500
Re: Displaying a 16 or 24 bit value in decimal.... Tom Porter <laseractiveguy@gmail.com> - 2017-09-02 13:37 -0700
Re: Displaying a 16 or 24 bit value in decimal.... Michael Barry <barrym95838@yahoo.com> - 2017-09-02 23:15 -0700
| From | laseractiveguy@gmail.com |
|---|---|
| Date | 2017-09-01 11:01 -0700 |
| Subject | Displaying a 16 or 24 bit value in decimal.... |
| Message-ID | <dffb8b6a-08ec-46e1-b7be-3f1134e09fa4@googlegroups.com> |
I have been searching the internet for days, and trying examples I find, but nothing seems to be working... I want to display a 16 bit value (from 2 bytes) onto the screen. (24 bit be better, but I'll take anything at this point!) As a last ditch effort... I am thinking about the ERROR routine in Applesoft... it always displays the ADDRESS of the line that has an error... and it cant be above 65xxx.... so it has to be a 2 byte number/address. Wrong direction I'm sure... Anybody have ideas? Thanks in advance... Tom (*Ps, any monitor subroutines to do this... I know there are several routines that can display HEX values from a couple of registers... if only it was that easy!
[toc] | [next] | [standalone]
| From | laseractiveguy@gmail.com |
|---|---|
| Date | 2017-09-01 11:04 -0700 |
| Message-ID | <10c8b533-e1de-4f3f-be89-845db8530654@googlegroups.com> |
| In reply to | #3878 |
If I can get this simple 'thing' up and going, I can finally start doing some comparisons between IDIOT Compiler and others like TASC, BEAGLE and Einstein... its going to be very interesting....
[toc] | [prev] | [next] | [standalone]
| From | John Brooks <jbrooks@blueshiftinc.com> |
|---|---|
| Date | 2017-09-01 12:49 -0700 |
| Message-ID | <cf222c5f-ce7e-48de-be0a-ba3306d44a6a@googlegroups.com> |
| In reply to | #3878 |
On Friday, September 1, 2017 at 11:01:10 AM UTC-7, laserac...@gmail.com wrote:
> I have been searching the internet for days, and trying examples I find, but nothing seems to be working... I want to display a 16 bit value (from 2 bytes) onto the screen. (24 bit be better, but I'll take anything at this point!)
>
> As a last ditch effort... I am thinking about the ERROR routine in Applesoft... it always displays the ADDRESS of the line that has an error... and it cant be above 65xxx.... so it has to be a 2 byte number/address. Wrong direction I'm sure...
>
> Anybody have ideas? Thanks in advance... Tom
> (*Ps, any monitor subroutines to do this... I know there are several routines that can display HEX values from a couple of registers... if only it was that easy!
There was a discussion about printing decimal numbers recently on CSA2. Here is a 24-bit unsigned decimal print routine I wrote a month or two ago after that discussion.
It's 35 bytes of 6502 code with a 6-byte demo that prints $123456 as decimal 1193046. This print routine removes leading zeroes. $000000 prints as "0".
0300: A0 12 LDY #12
0302: A2 34 LDX #34
0304: A9 56 LDA #56
0306: 20 4A FF JSR FF4A
0309: A9 00 LDA #00
030B: B8 CLV
030C: A2 18 LDX #18
030E: C9 05 CMP #05
0310: 90 03 BCC 0315 {+03}
0312: E9 85 SBC #85
0314: 38 SEC
0315: 26 45 ROL 45
0317: 26 46 ROL 46
0319: 26 47 ROL 47
031B: 2A ROL
031C: CA DEX
031D: D0 EF BNE 030E {-11}
031F: 48 PHA
0320: A9 FD LDA #FD
0322: 48 PHA
0323: A9 E1 LDA #E1
0325: 48 PHA
0326: 70 E1 BVS 0309 {-1F}
0328: 60 RTS
I'm on twitter if you'd like to discuss.
-JB
@JBrooksBSI
[toc] | [prev] | [next] | [standalone]
| From | laseractiveguy@gmail.com |
|---|---|
| Date | 2017-09-01 13:36 -0700 |
| Message-ID | <227a16a7-ba76-4bb5-a47a-05dc7c80c841@googlegroups.com> |
| In reply to | #3878 |
John... I did get your code working... its actually perfect for my needs... I will tell you a lot of the inputs didn't have $ so I assumed they were decimal, but infact everything is in hex... but that's my own problem... I cant do assembly in HEX :) One note... if you put RTS at the end of the statement, it hangs, so I had to put BRK to get it to come back to applesoft. I'm putting this straightway into Idiot Assembler! Thank you so much
[toc] | [prev] | [next] | [standalone]
| From | laseractiveguy@gmail.com |
|---|---|
| Date | 2017-09-01 13:47 -0700 |
| Message-ID | <ab794144-be3a-45c1-a27d-8f24b0e5afe2@googlegroups.com> |
| In reply to | #3878 |
If you do two PLA commands afterwards... it returns back to the original calling routine... well, in this case Applesoft. Works like a charm...
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2017-09-01 13:57 -0700 |
| Message-ID | <013ea521-2429-47e5-91e4-74cf39210afc@googlegroups.com> |
| In reply to | #3882 |
On Friday, September 1, 2017 at 2:47:48 PM UTC-6, laserac...@gmail.com wrote: > If you do two PLA commands afterwards... it returns back to the original calling routine... well, in this case Applesoft. Works like a charm... There is a bug that will also show up sooner or later. There are 3 pushes that fall through if the BVS fails. As you found out doing two PLA's will return to applelsoft, but the first PHA gets left on the stack, thus if you call the routine enough times you will get an "OUT OF MEMORY" error.
[toc] | [prev] | [next] | [standalone]
| From | gids.rs@sasktel.net |
|---|---|
| Date | 2017-09-01 14:02 -0700 |
| Message-ID | <b8032094-227a-4922-9b94-61e0cd6c6fb1@googlegroups.com> |
| In reply to | #3883 |
On Friday, September 1, 2017 at 2:57:30 PM UTC-6, gid...@sasktel.net wrote: > On Friday, September 1, 2017 at 2:47:48 PM UTC-6, laserac...@gmail.com wrote: > > If you do two PLA commands afterwards... it returns back to the original calling routine... well, in this case Applesoft. Works like a charm... > > > There is a bug that will also show up sooner or later. There are 3 pushes that fall through if the BVS fails. As you found out doing two PLA's will return to applelsoft, but the first PHA gets left on the stack, thus if you call the routine enough times you will get an "OUT OF MEMORY" error. I meant in your case since you have to use the two PLA's. As the code is written though, nothing should be left on the stack to be pulled.
[toc] | [prev] | [next] | [standalone]
| From | James Davis <JPD.Enterprises@outlook.com> |
|---|---|
| Date | 2017-09-01 19:05 -0700 |
| Message-ID | <51c661db-3e65-4436-bff9-5d7959cd7a63@googlegroups.com> |
| In reply to | #3878 |
On Friday, September 1, 2017 at 11:01:10 AM UTC-7, laserac...@gmail.com wrote:
> I have been searching the internet for days, and trying examples I find, but nothing seems to be working... I want to display a 16 bit value (from 2 bytes) onto the screen. (24 bit be better, but I'll take anything at this point!)
>
> As a last ditch effort... I am thinking about the ERROR routine in Applesoft... it always displays the ADDRESS of the line that has an error... and it cant be above 65xxx.... so it has to be a 2 byte number/address. Wrong direction I'm sure...
>
> Anybody have ideas? Thanks in advance... Tom
> (*Ps, any monitor subroutines to do this... I know there are several routines that can display HEX values from a couple of registers... if only it was that easy!
Hi laserac...,
There are 3 entry points in the Old Monitor ROM that might be of use to you for this. They are (with my analysis):
PRNTYX EQU $F940 ;[OM] PRINT CONTENTS OF THE Y-REGISTER & THE X-REGISTER AS 4 HEXADECIMAL DIGITS--(2 AT A TIME);
; THE A-REGISTER & X-REGISTER ARE ALTERED; (TYA, THEN DO PRNTAX).
PRNTAX EQU $F941 ;[OM] (1) PRINT CONTENTS OF THE A-REGISTER AS 2 HEXADECIMAL DIGITS; THEN DO THE X-REGISTER NEXT; THE A-
; REGISTER & X-REGISTER ARE ALTERED; (OUTPUT BRANCH TARGET HIGH ADRRESS {JSR PRBYTE, THEN DO PRNTX}).
PRNTX EQU $F944 ;[OM] (2) PRINT CONTENTS OF X-REGISTER AS 2 HEXADECIMAL DIGITS; THE A-REGISTER & X-REGISTER ARE ALTERED;
; (OUTPUT BRANCH TARGET LOW ADRRESS {TXA, JMP PRBYTE}--RETURN TO CALLER {EXIT INSTDSP SUBROUTINE}).
and this is the code:
F940: 98 281 PRNTYX TYA ;[OM]
F941: 20 DA FD 282 PRNTAX JSR PRBYTE ;[OM] OUTPUT TARGET ADR
F944: 8A 283 PRNTX TXA ;[OM] OF BRANCH AND RETURN
F945: 4C DA FD 284 JMP PRBYTE ;[OM]
I don't know off hand if these are the same in the Autostart Monitor ROM, but I will check to see and let your know....
Yes, they are the same in the Autostart Monitor ROM!
These are part of the Miniassembler / Disassembler (Instruction Display) Subroutines in the Old Monitor ROM, which I am currently analyzing.
Hope they help,
James Davis
[toc] | [prev] | [next] | [standalone]
| From | Michael J. Mahon <mjmahon@aol.com> |
|---|---|
| Date | 2017-09-01 22:38 -0500 |
| Message-ID | <YqKdnWeaXKk3ujfEnZ2dnUU7-bnNnZ2d@giganews.com> |
| In reply to | #3878 |
<laseractiveguy@gmail.com> wrote: > I have been searching the internet for days, and trying examples I find, > but nothing seems to be working... I want to display a 16 bit value > (from 2 bytes) onto the screen. (24 bit be better, but I'll take anything at this point!) > > As a last ditch effort... I am thinking about the ERROR routine in > Applesoft... it always displays the ADDRESS of the line that has an > error... and it cant be above 65xxx.... so it has to be a 2 byte > number/address. Wrong direction I'm sure... > > Anybody have ideas? Thanks in advance... Tom > (*Ps, any monitor subroutines to do this... I know there are several > routines that can display HEX values from a couple of registers... if > only it was that easy! > > The Applesoft ROM is a good place to look. Try LINPRT (A,X) at $ED24. -- -michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
[toc] | [prev] | [next] | [standalone]
| From | Tom Porter <laseractiveguy@gmail.com> |
|---|---|
| Date | 2017-09-02 13:37 -0700 |
| Message-ID | <7c385d40-f26e-4540-8d61-4ed93e862f5a@googlegroups.com> |
| In reply to | #3878 |
This is why MJM is brilliant...
[Try LINPRT (A,X) at $ED24.]
-michael
[toc] | [prev] | [next] | [standalone]
| From | Michael Barry <barrym95838@yahoo.com> |
|---|---|
| Date | 2017-09-02 23:15 -0700 |
| Message-ID | <d75848ef-8aef-4124-8b00-03df50a90871@googlegroups.com> |
| In reply to | #3891 |
On Saturday, September 2, 2017 at 1:37:47 PM UTC-7, Tom Porter wrote: > This is why MJM is brilliant... > > [Try LINPRT (A,X) at $ED24.] > -michael I agree that MJM is brilliant, but certainly not for this reason. Mike B.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web