Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Short ML Program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Short ML Program [message #210127] Tue, 30 July 2013 07:36 Go to next message
J.B. Wood is currently offline  J.B. Wood
Messages: 88
Registered: January 2012
Karma: 0
Member
Hello, all. In episode 10 of Jim Butterfield's C-64 training video he
shows a short ML program residing at $0800-$0830 that will fill the
screen with characters after pressing a key. It appears to load in as a
BASIC program with machine code appended at the end. The code may be
seen at 4:49 into the video at http://www.youtube.co/watch?v=tW6yZhS2_Vw

I can make out most of the hex entries but not all. Does anyone have a
listing of this routine and would you post it? Thanks for your time and
any clarification. Sincerely,
--
J. B. Wood e-mail: arl_123234@hotmail.com
Re: Short ML Program [message #210128 is a reply to message #210127] Tue, 30 July 2013 13:59 Go to previous messageGo to next message
BLuRry is currently offline  BLuRry
Messages: 489
Registered: October 2012
Karma: 0
Senior Member
Given the program's length, it shouldn't be terribly difficult to rewrite it. For what it's worth, the last few byte are probably not important as the RTS (60) is earlier on the last line and therefore probably the last instruction. I'd have to look at a disassembly to be sure of that though.

On Tuesday, July 30, 2013 6:36:20 AM UTC-5, J.B. Wood wrote:
> Hello, all. In episode 10 of Jim Butterfield's C-64 training video he
>
> shows a short ML program residing at $0800-$0830 that will fill the
>
> screen with characters after pressing a key. It appears to load in as a
>
> BASIC program with machine code appended at the end. The code may be
>
> seen at 4:49 into the video at http://www.youtube.co/watch?v=tW6yZhS2_Vw
>
>
>
> I can make out most of the hex entries but not all. Does anyone have a
>
> listing of this routine and would you post it? Thanks for your time and
>
> any clarification. Sincerely,
>
> --
>
> J. B. Wood e-mail: arl_123234@hotmail.com
Re: Short ML Program [message #210135 is a reply to message #210127] Tue, 30 July 2013 16:07 Go to previous messageGo to next message
wwww.leser is currently offline  wwww.leser
Messages: 21
Registered: March 2013
Karma: 0
Junior Member
My reconstruction would be:

100 SYS 2064

..C:0810 A9 04 LDA #$04
..C:0812 85 FD STA $FD
..C:0814 A9 00 LDA #$00
..C:0816 85 FC STA $FC
..C:0818 20 E4 FF JSR $FFE4
..C:081b C9 20 CMP #$20
..C:081d 90 F9 BCC $0818
..C:081f A2 03 LDX #$03
..C:0821 A0 00 LDY #$00
..C:0823 91 FC STA ($FC),Y
..C:0825 C8 INY
..C:0826 D0 FB BNE $0823
..C:0828 EE FD 00 INC $00FD
..C:082b CA DEX
..C:082c 10 F5 BPL $0823
..C:082e C9 3A CMP #$3A
..C:0830 D0 DE BNE $0810
..C:0832 60 RTS

But that seems to be a variant of the program Jim demonstrated in the video before starting the ML monitor, as it fills $07e7 as well (and more).
Re: Short ML Program [message #210136 is a reply to message #210135] Wed, 31 July 2013 13:47 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
On Tuesday, July 30, 2013 2:07:11 PM UTC-6, wwww....@gmail.com wrote:
> My reconstruction would be:
> 100 SYS 2064
> .C:0810 A9 04 LDA #$04
> .C:0812 85 FD STA $FD
> .C:0814 A9 00 LDA #$00
> .C:0816 85 FC STA $FC
> .C:0818 20 E4 FF JSR $FFE4
> .C:081b C9 20 CMP #$20
> .C:081d 90 F9 BCC $0818
> .C:081f A2 03 LDX #$03
> .C:0821 A0 00 LDY #$00
> .C:0823 91 FC STA ($FC),Y
> .C:0825 C8 INY
> .C:0826 D0 FB BNE $0823
> .C:0828 EE FD 00 INC $00FD
> .C:082b CA DEX
> .C:082c 10 F5 BPL $0823
> .C:082e C9 3A CMP #$3A
> .C:0830 D0 DE BNE $0810
> .C:0832 60 RTS

> But that seems to be a variant of the program Jim demonstrated in the video before starting the ML monitor, as it fills $07e7 as well (and more).

Try inputting a chifted letter
Re: Short ML Program [message #210138 is a reply to message #210135] Thu, 01 August 2013 00:12 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
On Tuesday, July 30, 2013 2:07:11 PM UTC-6, wwww....@gmail.com wrote:
> My reconstruction would be:
>
> 100 SYS 2064
>
> .C:0810 A9 04 LDA #$04
> .C:0812 85 FD STA $FD
> .C:0814 A9 00 LDA #$00
> .C:0816 85 FC STA $FC
> .C:0818 20 E4 FF JSR $FFE4
> .C:081b C9 20 CMP #$20
> .C:081d 90 F9 BCC $0818
> .C:081f A2 03 LDX #$03
> .C:0821 A0 00 LDY #$00
> .C:0823 91 FC STA ($FC),Y
> .C:0825 C8 INY
> .C:0826 D0 FB BNE $0823
> .C:0828 EE FD 00 INC $00FD
> .C:082b CA DEX
> .C:082c 10 F5 BPL $0823
> .C:082e C9 3A CMP #$3A
> .C:0830 D0 DE BNE $0810
> .C:0832 60 RTS

I modified Mr. Butterfield's BASIC program driver so that it runs on my
C128D computer and in 64 mode. I added code at the beginning of the
ML so that the screen is placed in lower case / upper case mode. The
code at current C64 locations $083a to $083d was modified to allow for
the input of CTRL letters. With CTRL letter input, the program fills
the screen with lower case letters. In C64 mode, everything works
as expected. In C128D mode, the input routine $ffe4 must return a
binary 0 in the accumulator for a CTRL s. Is this a C128D system bug
or is this something designed into the C128D for some obscure reason?


100 iffre(0)=fre(1) then sys 2090 : stop
110 sys 7210

monitor
pc sr ac xr yr sp
; qfb000 00 00 00 00 f8

082a a9 0e lda #$0e
082c 20 d2 ff jsr $ffd2
082f a9 04 lda #$04
0831 85 fd sta $fd
0833 a9 00 lda #$00
0835 85 fc sta $fc
0837 20 e4 ff jsr $ffe4
083a ea nop
083b ea nop
083c f0 f9 beq $0837
083e a2 03 ldx #$03
0840 a0 00 ldy #$00
0842 91 fc sta ($fc),y
0844 c8 iny
0845 d0 fb bne $0842
0847 ee fd 00 inc $00fd
084a ca dex
084b 10 f5 bpl $0842
084d c9 3a cmp #$3a
084f d0 de bne $082f
0851 60 rts

            
Re: Short ML Program [message #210140 is a reply to message #210135] Thu, 01 August 2013 13:34 Go to previous messageGo to next message
J.B. Wood is currently offline  J.B. Wood
Messages: 88
Registered: January 2012
Karma: 0
Member
On 07/30/2013 04:07 PM, wwww.leser@gmail.com wrote:
> My reconstruction would be:
>
> 100 SYS 2064
>
> .C:0810 A9 04 LDA #$04
> .C:0812 85 FD STA $FD
> .C:0814 A9 00 LDA #$00
> .C:0816 85 FC STA $FC
> .C:0818 20 E4 FF JSR $FFE4
> .C:081b C9 20 CMP #$20
> .C:081d 90 F9 BCC $0818
> .C:081f A2 03 LDX #$03
> .C:0821 A0 00 LDY #$00
> .C:0823 91 FC STA ($FC),Y
> .C:0825 C8 INY
> .C:0826 D0 FB BNE $0823
> .C:0828 EE FD 00 INC $00FD
> .C:082b CA DEX
> .C:082c 10 F5 BPL $0823
> .C:082e C9 3A CMP #$3A
> .C:0830 D0 DE BNE $0810
> .C:0832 60 RTS
>
> But that seems to be a variant of the program Jim demonstrated in the video before starting the ML monitor, as it fills $07e7 as well (and more).
>
First, thanks to all with the quick replies to my OP. Always nice to
find folks still familiar with 6502 opcode after 30+ years! Not
counting filler bytes, it appears the above is what was being displayed
on Jim B's CRT. I had trouble differentiating 0's from 8's, etc.
Discounting the simplicity of the above routine I sometimes think that
with the books, how-to magazine articles and utility software provided
by Jim over the years that he knew more about CBM products than the
folks who designed them ;-) Sincerely,

--
J. B. Wood e-mail: arl_123234@hotmail.com
Re: Short ML Program [message #210141 is a reply to message #210140] Fri, 02 August 2013 12:25 Go to previous messageGo to next message
Payton Byrd is currently offline  Payton Byrd
Messages: 1198
Registered: December 2011
Karma: 0
Senior Member
On Thursday, August 1, 2013 12:34:05 PM UTC-5, J.B. Wood wrote:

> First, thanks to all with the quick replies to my OP. Always nice to
> find folks still familiar with 6502 opcode after 30+ years! Not
> counting filler bytes, it appears the above is what was being displayed
> on Jim B's CRT. I had trouble differentiating 0's from 8's, etc.
> Discounting the simplicity of the above routine I sometimes think that
> with the books, how-to magazine articles and utility software provided
> by Jim over the years that he knew more about CBM products than the
> folks who designed them ;-) Sincerely,

Commodore could have done worse than attempting to hire Jim.
Re: Short ML Program [message #210143 is a reply to message #210141] Fri, 02 August 2013 23:38 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Geo

Re: Short ML Program [message #364760 is a reply to message #210127] Fri, 02 March 2018 13:02 Go to previous message
wwww.leser is currently offline  wwww.leser
Messages: 21
Registered: March 2013
Karma: 0
Junior Member
This newsgroup used to be entertaining! Where's all the fun gone?
Let me try some:

Try to imagine you didn't already have an idea as to how fast machine language can be as compared to BASIC. Would Jim Butterfield's demonstration have convinced you that it is worth the while learning how to do computer programming in assembly language? He assures us that BASIC could never fill the screen at the same rate as his assembly program does, and that's certainly true. But is the difference really as great as it appears from the video?

10 print chr$(19);
20 get a$
30 for i=1 to 7
40 a$=a$+a$
60 next
70 a$=left$(a$,111)
80 print a$;a$;a$;a$;a$;a$;a$;a$;a$;
90 if left$(a$,1)<>":" then 10

Can you improve upon my program above, or rewrite it, to make it run faster?
Would you take a different approach, like the following?

10 printchr$(147)
20 co=53248:ca=8448:ir=56334
30 fori=0to7:poke8192+32*8+i,0:next
40 poke53272,24
50 poke198,0:wait198,1:get a$
60 pb=co+8*(asc(a$)-64)
70 pokeir,peek(ir)and254:poke1,peek(1)and251
80 fori=0to7:pokeca+i,peek(pb+i):next
90 poke1,peek(1)or4:pokeir,peek(ir)or1
100 if a$<>":"then 50
110 poke53272,21

(Line 60 needs some work.)

Besides that, did you notice that Jim Butterfield's assembly program, too, can be improved upon, speed-wise? Here's a hint: Most monitors' mnemonic-to-opcode translators won't even let you not do the improvement (but VICE's monitor will.)

Another oddity that's apparent from the video hasn't been mentioned yet: Jim Butterfield's machine does not exhibit the Commodore 64's standard character set. It looks more like the VIC-20(or PET?)'s character set to me. Did Jim Butterfield use a modified machine? Could that account somehow for the curious fact that the very last character on screen remains blank?

Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: The Commodore Story movie at Computer History Museum 2/23/18
Next Topic: Next SCCAN meeting - Saturday, March 10
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Apr 20 07:33:47 EDT 2024

Total time taken to generate the page: 0.30742 seconds