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

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » "AI" on C64... help port?
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
"AI" on C64... help port? [message #5064] Tue, 15 May 2012 10:08 Go to next message
aiiadict is currently offline  aiiadict
Messages: 134
Registered: May 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/

can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?


Rich
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5065 is a reply to message #5064] Tue, 15 May 2012 13:55 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

you may want to go here and download one of the C64 items .

http://project64.c64.org/hw/c64.html

I recommend the Commodore 64 PROGRAMMER'S REFERENCE GUIDE

--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5066 is a reply to message #5064] Tue, 15 May 2012 14:02 Go to previous messageGo to next message
rusure is currently offline  rusure
Messages: 1030
Registered: March 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

On May 15, 7:08 am, aiiad...@gmail.com wrote:
> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-...
>
> can someone look athttp://www.mos6502.com/files/nn64_listing.txtand let me know what the pokes and disk commands do, so I can port this to another BASIC?
>
> Rich

You may want to download some of the C= 64 items from here :

http://project64.c64.org/hw/c64.html

I recommend the Commodore 64 Programmer's Reference Guided
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5068 is a reply to message #5064] Tue, 15 May 2012 19:08 Go to previous messageGo to next message
wf is currently offline  wf
Messages: 1
Registered: May 2012
Karma: 0
Junior Member
From Newsgroup: comp.sys.cbm

On 05/15/2012 06:08 AM, aiiadict@gmail.com wrote:
> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
>
> can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?
>
>
> Rich

The POKEs place characters on the screen. The screen buffer starts at
1024 and is a 40x25 grid. So POKE1024+X+40*Y, puts a character at
X,Y on the screen.

The disk commands write & read individual numeric values sequentially to
a file, with PRINT#5, and INPUT#5, respectively. The contents
of the F1%, F2% and M% arrays are saved & restored, one value at a time.
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5070 is a reply to message #5064] Wed, 16 May 2012 00:13 Go to previous messageGo to next message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm


wrote in message
news:2078785.21.1337087316506.JavaMail.geo-discussion-forums @yneo7...
> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
>
> can someone look at http://www.mos6502.com/files/nn64_listing.txt and let
> me know what the pokes and disk commands do, so I can port this to another
> BASIC?
>
> Rich

Lines 370-390 look like interrupts are being turned off and the character
ROM switched into visible memory for the purpose of copying a character
pattern into the free memory block, then the character ROM is switched back
out and interrupts re-engaged. No idea why, though.

All the PRINT ""; statements are bit puzzling since they don't appear to do
anything. I'll guess that the special (ie., non-ASCII) characters originally
there aren't showing up in the listing. They would most likely have been
"screen clear" and/or "cursor home", ie., the KERNEL character output
routine would have treated them specially.

As has been mentioned, all the POKES based on an address starting at 1024
are directly modifying screen memory, ie., the memory the video chip scans
looking for the character codes of what it should display. They're not
directly concerned with the logic of the neural net but only with how things
look on the screen.

The lines 1840 and 2030 form a command to access a sequential file on drive
0 for writing and reading, respectively. The OPEN statements one line 1850
and 2060 actually open the files as #5 (an arbitrary number) on device 8
(usually a 1541 floppy drive, which actually had only one physical drive,
but not all Commodore drives were so limited). The file #5 is used to refer
to those files in subsequent writes and reads.

Line 50 OPENs file #15 on device 8 with a secondary value of 15. That
secondary value is a special value that accesses the "command channel" of a
drive (as opposed to a "data channel"). It's common and convenient to use
the same number for the file number (but not required). This file is used in
lines 2230+ to ask the drive whether or not an error has occurred during a
write or read (the variables are essentially "error number", "error message
(ie., text)", "error track", "error sector").

- Anton Treuenfels

--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5087 is a reply to message #5064] Wed, 16 May 2012 04:36 Go to previous messageGo to next message
Anssi Saari is currently offline  Anssi Saari
Messages: 319
Registered: January 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

"Anton Treuenfels" writes:

> All the PRINT ""; statements are bit puzzling since they don't appear
> to do anything. I'll guess that the special (ie., non-ASCII)
> characters originally there aren't showing up in the listing.

Yes. The webpage links to a prg file too, but it doesn't have the
control codes either so the program doesnt work too well. One might ask
the author of the post on mos6502.com if he happens to have a working
version somewhere. He might since he posted a screenshot...
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5090 is a reply to message #5064] Wed, 16 May 2012 19:16 Go to previous messageGo to next message
aiiadict is currently offline  aiiadict
Messages: 134
Registered: May 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

On Tuesday, May 15, 2012 6:08:36 AM UTC-7, aiia...@gmail.com wrote:
> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
>
> can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?
>
>
> Rich

lines 360 to 410 are the only thing I haven't been able to figure out
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5091 is a reply to message #5090] Wed, 16 May 2012 20:17 Go to previous messageGo to next message
aiiadict is currently offline  aiiadict
Messages: 134
Registered: May 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

On Wednesday, May 16, 2012 3:16:59 PM UTC-7, aiia...@gmail.com wrote:
> On Tuesday, May 15, 2012 6:08:36 AM UTC-7, aiia...@gmail.com wrote:
> > http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
> >
> > can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?
> >
> >
> > Rich
>
> lines 360 to 410 are the only thing I haven't been able to figure out

310 K=ASC(A$)
PRINT "FETCH ";A$

350 L%=0:rem init l%, the function of this routine is to
fill F1%(L%),
for L% = 0 to 41 (height * width, 7*6)
360 K=(K-64)*8+53248: set k to point to address relative to
the key pressed
370 POKE56333,127:POKE 1,PEEK(1)AND251


380 FORI=0TO6:
POKE49408+I,PEEK(K+I) moves 7 bytes from ?ROM? to RAM
:NEXT


390 POKE 1,PEEK(1) OR 4:POKE 56333,129


400 FOR I = 0 TO 6: rem height
410 J% = PEEK(49408+I)/2:rem get from RAM or ROM relative to I
420 FOR K=1 TO 6:rem width
430 L%=L%+1:rem initialized to zero from outside of i loop, it is
an index into f1%:
440 F1%(L%) = -1 + (2 * (J% AND 1)): rem fills 6 bytes of F1%,
value depends on j%, which
is ?ROM? address?
450 J%=J%/2: rem get next ?bit? from the value retrieved from ?ROM?
460 NEXT K
470 NEXT I
--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #5092 is a reply to message #5091] Wed, 16 May 2012 20:48 Go to previous messageGo to next message
aiiadict is currently offline  aiiadict
Messages: 134
Registered: May 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

On Wednesday, May 16, 2012 4:17:53 PM UTC-7, aiia...@gmail.com wrote:
> On Wednesday, May 16, 2012 3:16:59 PM UTC-7, aiia...@gmail.com wrote:
> > On Tuesday, May 15, 2012 6:08:36 AM UTC-7, aiia...@gmail.com wrote:
> > > http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
> > >
> > > can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?
> > >
> > >
> > > Rich
> >
> > lines 360 to 410 are the only thing I haven't been able to figure out
>
> 310 K=ASC(A$)
> PRINT "FETCH ";A$
>
> 350 L%=0:rem init l%, the function of this routine is to
> fill F1%(L%),
> for L% = 0 to 41 (height * width, 7*6)
> 360 K=(K-64)*8+53248: set k to point to address relative to
> the key pressed
> 370 POKE56333,127:POKE 1,PEEK(1)AND251
>
>
> 380 FORI=0TO6:
> POKE49408+I,PEEK(K+I) moves 7 bytes from ?ROM? to RAM
> :NEXT
>
>

I see what its doing now. moves character from ROM to RAM (7 bytes)

my target computer doesn't have access to character ROM so I'll have to load a character set into RAM.

r

--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #6184 is a reply to message #5064] Tue, 29 May 2012 16:25 Go to previous messageGo to next message
aiiadict is currently offline  aiiadict
Messages: 134
Registered: May 2012
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm

On Tuesday, May 15, 2012 6:08:36 AM UTC-7, aiia...@gmail.com wrote:
> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
>
> can someone look at http://www.mos6502.com/files/nn64_listing.txt and let me know what the pokes and disk commands do, so I can port this to another BASIC?
>
>
> Rich

80 DIM V%,J,I


why is V% dimmed without initializing J and I?


--- Synchronet 3.13a-Win32 NewsLink 1.83
Re: "AI" on C64... help port? [message #6185 is a reply to message #6184] Tue, 29 May 2012 22:54 Go to previous message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
From Newsgroup: comp.sys.cbm


wrote in message
news:82706e1c-3731-466b-81ef-e609c2e1e36b@googlegroups.com.. .
> On Tuesday, May 15, 2012 6:08:36 AM UTC-7, aiia...@gmail.com wrote:
>> http://www.mos6502.com/friday-commodore/artificial-intellige nce-on-a-c64/
>>
>> can someone look at http://www.mos6502.com/files/nn64_listing.txt and let
>> me know what the pokes and disk commands do, so I can port this to
>> another BASIC?
>>
>>
>> Rich
>
> 80 DIM V%,J,I
>
>
> why is V% dimmed without initializing J and I?
>

None of these are array variables; they're all scalar. The DIM statement as
used here simply creates them and initializes them to zero. A faster and
more compact way of saying

80 V%=0:J=0:I=0

although V%, an integer variable, actually takes the same amount of space as
a scalar that a floating point variable does (seven bytes - it's only in
arrays that integer variables save space vs. floating point, two bytes vs.
five per element). If there's any practical reason for doing that, I can
only imagine that it must have something to do with limiting the range of
values V% is allowed to have and making the BASIC interpreter responsible
for guaranteeing it.

Offhand I doubt it, though.

- Anton Treuenfels

--- Synchronet 3.13a-Win32 NewsLink 1.83
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: The Sinclair Spectrum is rubbish!
Next Topic: Michigan Brick Repair Company
Goto Forum:
  

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

Current Time: Tue Sep 27 23:43:42 EDT 2022

Total time taken to generate the page: 0.00300 seconds