ML

Basic and Machine Language

Moderator: Moderators

User avatar
Floopy
Vic 20 Hobbyist
Posts: 109
Joined: Mon Feb 27, 2017 7:38 pm
Location: US
Occupation: Mechatronics

ML

Postby Floopy » Thu Mar 30, 2017 11:02 am

Since my last post on the IF function (not "statement" " did not think about that until after), I have tried to learn machine language a little. My problem is that I can't find anyway to write machine language on my Vic-20. I can't seem to find software to do this for me, and when I do they are expensive cartridges. Is their any cassette or floppy software out their for writing machine language??
Thank you!
-Floopy

User avatar
srowe
Vic 20 Afficionado
Posts: 468
Joined: Mon Jun 16, 2014 3:19 pm

Re: ML

Postby srowe » Thu Mar 30, 2017 12:19 pm

All you need to write machine code directly is a machine code monitor, you can download VICMON from here.

http://www.zimmers.net/anonftp/pub/cbm/vic20/roms/tools/4k/index.html

Using a monitor is a bit laborious, assemblers that allow you to define symbols and have comments are easier to use. I haven't used a native assembler for decades, perhaps someone else can recommend one.

I find it far easier to write code on my PC, assemble it and copy the binaries across. In that way I can use modern editors, revision control etc.

User avatar
beamrider
Vic 20 Nerd
Posts: 825
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: ML

Postby beamrider » Thu Mar 30, 2017 1:07 pm

I would suggest starting with. CbmPrg and if you outgrow that or are not on a windows environment, move to ca65

User avatar
Mike
Herr VC
Posts: 2993
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: ML

Postby Mike » Thu Mar 30, 2017 1:16 pm

srowe wrote:All you need to write machine code directly is a machine code monitor, [...]

All it needs is an opcode table, pen and paper, working out all branch offsets by hand, collecting the instructions and their operands in (decimal) numbers into DATA lines, and finally POKEing all these numbers into the given memory range (preferably protected from BASIC use). :twisted:

... :lol:

How did they code ML games back in the old days? (and take a good look at Lee's reply. ;))

User avatar
Floopy
Vic 20 Hobbyist
Posts: 109
Joined: Mon Feb 27, 2017 7:38 pm
Location: US
Occupation: Mechatronics

Re: ML

Postby Floopy » Thu Mar 30, 2017 6:07 pm

Thanks everybody :D
-Floopy

User avatar
darkatx
Vic 20 Afficionado
Posts: 440
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Re: ML

Postby darkatx » Thu Mar 30, 2017 9:54 pm

Ahhh the late great Leeeeee, gone but not forgotten!
Learning all the time... :)

Forbidden64
Vic 20 Hobbyist
Posts: 109
Joined: Sun Feb 28, 2016 9:59 pm
Location: CA USA

Re: ML

Postby Forbidden64 » Tue Apr 04, 2017 10:25 pm

There is a way to do this with no investment required, and nothing but an unexpanded vic with tape. There are also multiple ways to do it...most people here have EVERYTHING for the vic, and forget that some people just plain don't, nor are they willing to spend hundreds of dollars on modern interfacing add-ons, or build cables etc..

TINYMON, for example, was I believe the earliest monitor for the vic, and runs in native ram. It is aptly named...In fact it came out before ram expansions were widely adopted, and cost around 80$ extra on top of your 300$ for the computer, and 129$ for the datasette, or, originally required the typer to know someone with a PET, which would have enough memory to insert all the data statements and then poke them all into memory and save it...but someone thought of a way!

Given that today most people have at least SOME manner of ram expander...this latter step isn't normally talked about or even viable in an era where even fewer people have a PET. Even if you don't have a ram expander, you can still type it in the native vic. TINYMON gives you a full monitor, but not assembler..IE you are typing in machine language, and converting mnemonics probably using notepad's find and replace... , and fits onto the VIC screen, while only using around 750 bytes. In fact, that revision to the text came out in the compilation of compute's gazette. Here is the book, which contains the program on page 195( or page 203 of the actual PDF). Immediately following are instructions for typing it into a vic with no ram expander:


http://commodore.bombjack.org/books/com ... of_VIC.zip

The way I got it onto mine was by using a regular tape recorder, and a program called 'tap dancer' for droid phones. You put your phone in airplane mode, and then you can write files from the web in .tap/ .t64 file extensions directly to tape. Some volume control fiddling is usually required, although for me, writing TINYMON worked the first try.

This is a good starter book:
http://commodore.bombjack.org/books/com ... puters.zip

Of course once you have any monitor, you can enter core dumps of anything you like directly. In fact, you can do that with the hex to dec converter/poker in the first book of vic.
Like this one for instance, which is full of memory core dumps you can key back in very quickly...no fluff, just hex, although it provides a twin listing disassembled for easier reading:
http://commodore.bombjack.org/books/com ... nd_128.zip

and these ones which all combined, will give you a decent machine code library to cobble things together (you can just enter the hex codes in the core dump listings/in the display of the disassembly:
for example: 4096 A9 07 LDA #$07
you could just put: '4096 A9 07' xx xx xx ...and so on until you run out of line space. Several of these actually have straight up core dumps that you can enter directly into tinymons style of interface.

http://commodore.bombjack.org/books/com ... he_C64.zip

http://commodore.bombjack.org/books/com ... or_C64.zip

User avatar
Mike
Herr VC
Posts: 2993
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: ML

Postby Mike » Thu Apr 06, 2017 3:44 am

Tinymon is also available on zimmers: link.

One game, DEFENDER, that I had as type-in in a magazine in the 80ies even came with an own HEX monitor (including checksums), the listing itself spanned four pages as hex dump. :shock:

User avatar
ravenxau
Vic 20 Devotee
Posts: 295
Joined: Fri May 28, 2004 10:03 pm

Re: ML

Postby ravenxau » Sat Apr 29, 2017 10:59 pm

The Usborne book, "Machine Code For Beginners" shows how to write code and use a hex loader to make it all work...I was able to get ML stuff working as a 12 year old in the 80's....interestingly, I still have my copy of the book as a reference to this day...
Android Tablet running Frodo 64 emulator running VIC 20 emulator....


Return to “Programming”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest