Typing in a C64 intro by hand
category: general [glöplog]
I have a C64 connected to an old TV, but no tape/disk/whatever to load programs from. I do have a ton of time, however, and a 1k music disc I found on pouet. Is there a way I can manually type it in? I imagine I could perhaps do a thousand POKE commands and then RUN or something, but I don't really know. Can it be done? Which memory addresses should I POKE?
(Obviously, I haven't really used a C64 before).
(Obviously, I haven't really used a C64 before).
You need to learn to type this:
LDA
STA
There. That's all you need. \o/
LDA
STA
There. That's all you need. \o/
Does that work in the standard view where you usually write BASIC?
As a kid I once got one of those C16 coding magazines, where you had to write the code written in the book to get some game out of it. I didn't know how to save to tape yet, only had the C16 for a week or so, so I coded an entire magazine worth of weird shit, couldn't turn off my C16 meanwhile 'coz I didn't know how to save. Probably took me a week or so. When I finally tipped in the last code, and ran the game, it was the worst piece of shit ever made, some horrible helicopter simulator or so with nightmare inducing sounds. I played 5 minutes, and turned off my C16 in despise.
Moral; Get a tape-station or a diskette-station and save time ^^
Moral; Get a tape-station or a diskette-station and save time ^^
Quote:
Does that work in the standard view where you usually write BASIC?
Obviously not, BASIC does not know about assembler opcodes. An easier option would be to save up for a 1541-ultimate II.
Those are assembly instructions, right? I don't have an assembler or MON or anything AFAIK.
Or get a U-II cartridge with Turbo Assembler on your USB-stick or memory-card.
If you want you can 'manually' convert hex to decimal the opcodes and operands, and write those as DATA-statements with READ Q and POKE etc.. its just that it takes forever to actually run a large program this way.
You can either use the above method or write the entire monitor in Basic. A tiny mon where you can write in hex-codes directly into memory, or an assembler-mnemonics converter that and converts the mnemonics into opcodes+operands, but the latter takes more time to program.
If you want you can 'manually' convert hex to decimal the opcodes and operands, and write those as DATA-statements with READ Q and POKE etc.. its just that it takes forever to actually run a large program this way.
You can either use the above method or write the entire monitor in Basic. A tiny mon where you can write in hex-codes directly into memory, or an assembler-mnemonics converter that and converts the mnemonics into opcodes+operands, but the latter takes more time to program.
Also what StringRay said. you can restrict the number of instructions, i.e. keeping only the instructions that is needed. Then use those to load and store code and data into memory.
Yeah. For/Next/Read&Poke/Data lines. Can be done, but is a PITA. You'd need to find the starting address too and correctly set the Basic header, etc, to be able to RUN it. Otherwise use SYS or relocate everything memory. But really, unless you're a maniac, you don't wanna waste your time like that. Get some mass storage, as explained above. :)
Trolling level: Epic
SnC: at least it didnt crash, as the Tetris that I typed in did. Twice, coz I thought I mistyped something, but it was misprinted.
10 poke54296,15:poke54272+rnd(1)*23,rnd(1)*128+rnd(1)*128:goto 10
Back in the days it was widespread to type in machinecode listings from C64 magazines. They released a tool especially for this purpose called MSE. With this one you could directly type in the hex-numbers. And it also contains checksums to detect typos. I guess that wont help you much, because you also need to get the tool on your C64.
If you own an old freezer cartridge like "Final Cartridge" or "Action Replay" it would be easy. They have a machinecode editor inside. Otherwise I would go the Basic read and poke of data-statements way Rudi suggested.
If you own an old freezer cartridge like "Final Cartridge" or "Action Replay" it would be easy. They have a machinecode editor inside. Otherwise I would go the Basic read and poke of data-statements way Rudi suggested.
<type>
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
run <return>
___________________________________________
<type>
10 poke 54272+int(rnd(1)25),int(rnd(1)256) : goto 10
run <return>
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
run <return>
___________________________________________
<type>
10 poke 54272+int(rnd(1)25),int(rnd(1)256) : goto 10
run <return>
Lots of not very useful suggestions in this thread.
There's probably no good way to do what you want to do directly from BASIC without altering the code somewhat. There could be a small BASIC header incorporated into the binary, that does a SYS <addr> to start the program when running - you'd need to strip this out, and then do the SYS to the correct memory location once you have poked the remaining data into RAM. It's not unlikely that the original code location would be immediately after the miniscule BASIC header, meaning it would overwrite the running BASIC program when poking, so you'd need to relocate the code as well, taking care of any non-relative jumps etc.
Another option since it's a tiny production is that it's using some kind of trickery to autostart the code when loading. The problems are similar - you'd need to understand how the code is started and where it's located in memory.
There's probably no good way to do what you want to do directly from BASIC without altering the code somewhat. There could be a small BASIC header incorporated into the binary, that does a SYS <addr> to start the program when running - you'd need to strip this out, and then do the SYS to the correct memory location once you have poked the remaining data into RAM. It's not unlikely that the original code location would be immediately after the miniscule BASIC header, meaning it would overwrite the running BASIC program when poking, so you'd need to relocate the code as well, taking care of any non-relative jumps etc.
Another option since it's a tiny production is that it's using some kind of trickery to autostart the code when loading. The problems are similar - you'd need to understand how the code is started and where it's located in memory.
Characters and the Screen
POKE 53272,21 switch to uppercase mode
POKE 53272,23 switch to lowercase mode
POKE 53280,C change border color (C=0-15)
POKE 53281,C change screen color (C=0-15)
POKE 646,C change cursor color (C=0-15)
POKE 53265,PEEK(53265) AND 23 turn off screen display
POKE 53265,PEEK(53265) OR 16 turn on screen display
The Keyboard
POKE 650,128 all keys repeat
POKE 650,127 no keys repeat
POKE 650,0 normal repeat
POKE 657,128 disable SHIFT-Commodore
POKE 657,0 enable SHIFT-Commodore
POKE 198,0 clear keyboard buffer
POKE 649,1 disable keyboard buffering
POKE 649,0 disable keyboard
POKE 649,10 normal buffering
POKE 808,239 disable RUN/STOP key
POKE 792,193 disable RESTORE
POKE 808,239:POKE 792,193 disable RUN-STOP/RESTORE
POKE 808,234 disable RUN-STOP/RESTORE and LIST
POKE 808,237:POKE 792,71 enable RUN-STOP/RESTORE and LIST
Miscellaneous
POKE 775,200 disable LIST
POKE 775,167 enable LIST
POKE 56341,S set cursor speed (S=0-255)
POKE 204,0 turn cursor on during a GET
POKE 204,255 turn cursor back off
POKE 19,65 turn off question mark during INPUT
POKE 19,0 turn question mark back on
POKE 54296,15:POKE 54296,0 make a click sound
POKE 22,35 LIST won't show line numbers
POKE 774,0 LIST shows line numbers only
POKE 775,100 LIST performs a NEW
POKE 775,121 LIST locks up computer
POKE 775,234 LIST prevents lines from being entered
POKE 819,2 disable SAVE
POKE 819,245 enable SAVE
POKE 199,1 prints in reverse mode
POKE 211,Y move cursor to row Y
POKE 214,X move cursor to column X
Datasette 1530:
poke 818,32 save off
poke 818,0 save on
poke 816,32 load off
poke 816,0` load on
poke 192,255 motor off by runstop/restore
poke 37148,254 motor on
poke 37148,250 motor off
POKE 53272,21 switch to uppercase mode
POKE 53272,23 switch to lowercase mode
POKE 53280,C change border color (C=0-15)
POKE 53281,C change screen color (C=0-15)
POKE 646,C change cursor color (C=0-15)
POKE 53265,PEEK(53265) AND 23 turn off screen display
POKE 53265,PEEK(53265) OR 16 turn on screen display
The Keyboard
POKE 650,128 all keys repeat
POKE 650,127 no keys repeat
POKE 650,0 normal repeat
POKE 657,128 disable SHIFT-Commodore
POKE 657,0 enable SHIFT-Commodore
POKE 198,0 clear keyboard buffer
POKE 649,1 disable keyboard buffering
POKE 649,0 disable keyboard
POKE 649,10 normal buffering
POKE 808,239 disable RUN/STOP key
POKE 792,193 disable RESTORE
POKE 808,239:POKE 792,193 disable RUN-STOP/RESTORE
POKE 808,234 disable RUN-STOP/RESTORE and LIST
POKE 808,237:POKE 792,71 enable RUN-STOP/RESTORE and LIST
Miscellaneous
POKE 775,200 disable LIST
POKE 775,167 enable LIST
POKE 56341,S set cursor speed (S=0-255)
POKE 204,0 turn cursor on during a GET
POKE 204,255 turn cursor back off
POKE 19,65 turn off question mark during INPUT
POKE 19,0 turn question mark back on
POKE 54296,15:POKE 54296,0 make a click sound
POKE 22,35 LIST won't show line numbers
POKE 774,0 LIST shows line numbers only
POKE 775,100 LIST performs a NEW
POKE 775,121 LIST locks up computer
POKE 775,234 LIST prevents lines from being entered
POKE 819,2 disable SAVE
POKE 819,245 enable SAVE
POKE 199,1 prints in reverse mode
POKE 211,Y move cursor to row Y
POKE 214,X move cursor to column X
Datasette 1530:
poke 818,32 save off
poke 818,0 save on
poke 816,32 load off
poke 816,0` load on
poke 192,255 motor off by runstop/restore
poke 37148,254 motor on
poke 37148,250 motor off
i like the idea, but better to do some limits. For example - one screen basic code to type in and run
I have some random things (miniature games and whatnot :D) on my gist that are small enough to be typed in.
You might also wanna check out the Wikipedia page for Type-in program for some general historical context.
You might also wanna check out the Wikipedia page for Type-in program for some general historical context.
If you have a .prg file of the music disc, then the first two bytes of the file tell you where the code should be stored in memory. The bytes 10 40 1f 2e 34 at the start of the .prg file mean that the musicdisc starts at $4010. That means at $4010 should be written $1f,$2e,$34.. You can do this with pokes aswell. Just have a very long "data" list in basic and poke the contents of the music disco into the memory.
However I think the music disc would start at the basic start ($0801), too. That would overwrite your programm (with the "data" lines). I think then you must poke it firstly into memory somewhere else and put somewhere a machine language programm which copies it down again to the basic start and runs it. Most probably in the basic .prg is somewhere the code "SYS blabla" where blabla is the address you must call from your assembler stub after copying the data down by your assembler programm.
Perhaps that's all to complicated. And someone has better ideas. I wish you good luck!
However I think the music disc would start at the basic start ($0801), too. That would overwrite your programm (with the "data" lines). I think then you must poke it firstly into memory somewhere else and put somewhere a machine language programm which copies it down again to the basic start and runs it. Most probably in the basic .prg is somewhere the code "SYS blabla" where blabla is the address you must call from your assembler stub after copying the data down by your assembler programm.
Perhaps that's all to complicated. And someone has better ideas. I wish you good luck!
This thread gives me an idea for a useless utility.
A=RND(-39644):FORA=1TO6:PRINTCHR$(RND(1)*26+65);:NEXT
^ cute one, from Crossbow / Crest :)