{created by www.mzretro.ch, lived.ch, 2026} |||||| --------------------------------------------------------------------------------------------------- PAL-ASSEMBLER-VIC-20 {CARTRIDGE VERSION, RAM BLOCK 5, $A000} --------------------------------------------------------------------------------------------------- That being said, I hope it actually it is! Why would I say that? Well, It could be found on several pages, but all that there was were 2 files {sometimes just one}: Assem.prg and Assem2.0.prg! I actually tried to load this files pretty much normally, but it result in a big mess on the screen. All I could do at that point, was to leave this behind and go check the other assembler downloads. And that is what I did. Later I also found pages with the same files and one had SYS 700 to start. However, as said, i did not even come so far to be able to type SYS 700. Okay, keep it in the background... Many days later, i found out that some .prg, are actually not really .prg files, but cartridges. And you could load them with LOAD"name",8,1 to go to the right address. And I actually thought it would go to dec 700, hex $02bc... Well, it didn't... Few days back, I saw a you tube video with the PAL assembler code for the Commodore C64. At first it didn't impact me... Haha... But today {28th of May 2026}, I recalled my thoughts from back then and say: Hey, i saw that somewhere... And PAL-Assembler for VIC20 was born! --------------------------------------------------------------------------------------------------- HOW CAN I LOAD/USE IT? Prerequisites: STEP 1: Under PREFERENCES, select SETTINGS... {a window will open} 01. Go to MACHINE/MODEL and select: RAM BLOCK 0 {to get 3KB additional assembly space} RAM BLOCK 1 {to get 8KB and keep 3KB *free for assembly code} RAM BLOCK 5 {That's where the cartridge will be, $A000} In the left bottom corner tag the "Save Settings on Exit" box Close the window RESET the Emulation {FILE/RESET/Reset Machine CPU} NOTE:{DO NOT "Power Cycle the Machine} *INFORMATION: - without the additional 8KB BLOCK 1 RAM, we would have following configuration: COLOR MAP - $9600, dec 38400 SCREEN - $1e00, dec 7680 BASIC Start - $0400, dec 1024 / BASIC end - $1dff, dec 7679 - with additional 8KB BLOCK RAM 1, we are getting following configuration: COLOR MAP - $9400, dec 37888 SCREEN - $1000, dec 4096 BASIC Start - $1200, dec 4608 / BASIC end - $3fff, 16383 STEP 2: After the RAM is set, continue here: 01. From the Menu bar, choose FILE, Attach Cartridge Image... {A window will open} 02. Select GENERIC {under Cartridge Type} 03. Select 4/8Kib CARTRIDGE at $A000 {under Cartridge ID} 04. Navigate to the folder where you have saved: Assembler{PAL}.crt {if you won't see it, select "All Files or CRT Images" {in the right bottom corner, above "Close"} 05. When you see it, Select the file 06. Then click on ATTACH {on the left near the Close button}, {in VICE 3.10} When that is done, you'll see this: {and probably think it didn't install anything. That's what i thought too, hehe} --------------------------------------------------------------------------------------------------- **** cbm basic v2 **** 11775 bytes free ready. --------------------------------------------------------------------------------------------------- However, by typing SYS 700, you see an additional message: {meaning: we are good to go} sys 700 *** assembling *** 2 ]0000-0000 ready. --------------------------------------------------------------------------------------------------- Okay, to where from now on? Damn, I think we are having the same questions! I had no idea without any instructions and i typed: 10 *= $0340 20 lda #$6c 30 sta $900f 40 rts run ?syntax error in 10 ready. --------------------------------------------------------------------------------------------------- Long story short, i searched the planet for some kind of instruction and did found a text document! Note: This assembler is old, from 1982 {at least for the Commodore C64} But it looks better than anything newer {and is less complex/complicated} Let's try this: 10 sys 700 15 .opt oo 20 *=$0340 30 lda #$93 45 jsr $ffd2 ;cls 50 lda #$6d 55 sta $900f 60 lda #$03 65 sta $0286 68 lda #$07 70 ldx #$00 75 loop sta $9600,x 80 inx 85 cpx #$42 90 bne loop 95 rts ready. Let's try it out! Type RUN and hit ENTER run Result: *** assembling *** 2 ]0340-035c ready. Line 15 is important! That .OPT OO {O like in Omega, not 00} will make the code immediately be available & place it into the memory location you specified with *=(address) That means nothing else, but it already can be run by typing SYS 832 {in our case here} Let's do that: SYS 832 {You can't see it here, but if you did all well, the text color {cyan} will change, also the border {green} and screen color {blue}} Congratulation, you wrote your first assembly code! --------------------------------------------------------------------------------------------------- I cannot tell, if this assembler is 1:1, meaning the same as the PAL-Assembler for the Commodore C64, but so far, commands are behaving pretty compatible. Assembler itself is pretty easy, user friendly and I enjoyed this time testing it. Actually, it is not just an assembler. It is a combo where you can also combine BASIC / Assembler. I didn't tried that. The guide is having examples in case you are interested. Sure, to master it, you'll need to read the manual anyway and exercise properly. And that can only be done by writing short assembly lines at the very beginning, where you will understand what is going on and why. Alright, from my side I put together what was possible so this assembler won't just be Assem.prg, a file which nobody is going to use, but a program which actually can be used and I am sure it will be a wonderful help to everyone who wants to start learning assembler on Commodore VIC-20! Highly recommended assembler for the VIC-20! I didn't thought a beauty like this is hiding under the name Assam and Assam2.0 --------------------------------------------------------------------------------------------------- 28.05.2026 --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- IN THIS SECTION I WILL WRITE SOME CODE, GIVE YOU IDEAS AND SHOW THE WAY OF HOW IN ASSEMBLER YOU CAN WRITE SMALL CODE WITH GREAT IMPACT AND IMPROVE OVERALL BASIC SPEED AND PROGRAM EXECUTION: EXAMPLE ARE FOR THE FOLLOWING VIC-20 SETUP - 3KB RAM BLOCK 0 - 8KB RAM BLOCK 1 - 8KB RAM BLOCK 5 = attached PAL-Assembler for the VIC-20 --------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------- As a beginner, you probably won't be writing a complex game in assembler the first day, but small BASIC helpers are always welcome and it is a great way to learn assembler. Motto is: every byte counts! Example: Note: {we have added also 3KB RAM BLOCK 0. This is a memory are from $0400 to $0fff {dec, 1024 to 4095} {that is an area where you can place all you assembly lines and they will not be effected by BASIC} That is done very simple: list 10 sys 700 20 .opt oo 30 *=$0400 35 ; start sys 1024 40 lda #$3 45 sta $0286 50 lda #$6d 60 sta $900f 65 rts Nice to play with colors, but in cases of helpers, that won't be needed. Here a few more useful example: EXAMPLE 1: {waiting on ENTER to be pressed} --------------------------------------------------------------------------------------------------- 10 sys 700 20 .opt oo 30 *=$0400 35 ; start sys 1024 40 up jsr $ffe4 45 cmp #$0d 50 bne up 60 rts In BASIC: 10 get a$:if a$=chr$(13) then goto 30 20 goto 10 30 print "hello!" With the little helper 10 sys 1024:print "hello!" This little helper is making room for your BASIC code. You could write bigger projects in BASIC with the same RAM amount. In case you would write a program where user had options to select things out of a menu. A small helper like this one would save you not only significant amount of precious BASIC memory, but it would also spare you from typing more than necessary. --------------------------------------------------------------------------------------------------- EXAMPLE 2: {Delete a line on the screen {0 -22} --------------------------------------------------------------------------------------------------- PAL-ASSEMBLER SOURCE: 10 sys 700 20 .opt oo 30 *=$0400 35 ; start sys 1024 40 clc 45 ldx #$00 ;lines 50 ldy #$00 ;columns 60 jsr $fff0 65 ldx #$00 70 del lda #$20 80 jsr $ffd2 85 inx 90 cpx #$16 95 bne del 98 rts For this one we need the examine the assembly code and see the addresses: $0400 18 clc $0401 A2 00 ldx #$00 ;lines $0403 a0 00 ldy #$00 ;column $0405 20 f0 ff jsr $fff0 $0408 a0 00 ldx #$00 $040a a9 20 lda #$20 ;SPACE $040c 20 d2 ff jsr $ffd2 $040f e8 inx $0410 e0 16 cpx #$16 $0412 do f6 bne $040a $0414 60 rts How to use this helper? We can set lines and columns {column will remain @ 0 for now} and actually what's going to be put {SPACE} there too! Since this is practically a BASIC PRINT command, also every single control key will do its job, just like in BASIC, however much faster! How do we call this from BASIC: Line is at the address $0401, A2 is a token for LDX, so $00 is at $0402, dec 1026 Column is @ $0404, dec 1028. We will keep it @ 0 to delete the whole line! SPACE {this is deleting the lines} is @ $040b, dec 1035 USAGE {Deletion}: Will delete line 10 {actually line 11 {0 - 10}} 10 poke 1026,10: rem line 11 30 sys 1024 To delete lines 0 to 4 {5 lines} do this: 10 for a=0 to 4:poke 1026,a 20 sys 1024:next Now we will replace space and make a line out of it! ASCII Code 195 Try also 191, or actually any ASCII graphic symbol {check Commodore VIC-20 manuals} USAGE {Fill-In}: 10 poke 1035,195: rem 191 20 for a=4 to 8:poke 1026,a 30 sys 1024:next Now let's talk about the column. We didn't touched that yet for a reason. Deletion loop is set to delete exactly 22 characters. Changing the column value from 0 something else, would jump to the next line and delete stuff there. Not what we wanted! We have to be precaution when column is used for our own purposes and make something out of it. This is how it is done: --------------------------------------------------------------------------------------------------- EXAMPLE 3: BOX-FILL, COLUMN-FILL, DOUBLE-LINE {many possibilities, depends on you imagination} --------------------------------------------------------------------------------------------------- Let's get our code again and make some additional notes: $0400 18 clc $0401 A2 00 ldx #$00 ;lines, poke 1026 $0403 a0 00 ldy #$00 ;column, poke 1028 $0405 20 f0 ff jsr $fff0 $0408 a0 00 ldx #$00 ;LOOP start poke 1033 {NEVER SET X > #$15, dec 21} $040a a9 20 lda #$20 ;SPACE poke 1035 {ASCII GFX Symbol} $040c 20 d2 ff jsr $ffd2 $040f e8 inx $0410 e0 16 cpx #$16 ;END LOOP poke 1041 {KEEP ALWAYS lower than LOOP START!} $0412 do f6 bne $040a $0414 60 rts USAGE {Fill-In} a block 10 x 10 fields (cursors} {basically, by exchanging the 230 with 32,hex $20 you could use that} {to delete a portion of the screen too} 10 poke 1035,230:rem block ;graphic symbol 20 poke 1028,4:rem column ;max value 21 {0 to 21} = 22 characters 30 poke 1033,4:rem start ;loop start, minimum value 0, max 21 - keep < loop end 40 poke 1041,14;rem end ;loop end, minimum value 1, max 22 - keep > loop start 50 for a = 4 to 13 ;max value is 22 {0 to 22} = 23 lines 60 poke 1026,a:sys 1024 70 next As you can see, this little helper has a lot of functionality. Next you could try to draw 3 columns, each 5 characters wide and SPACE in-between 2 characters. That's an order soldier! --------------------------------------------------------------------------------------------------- EXAMPLE 4: {PRESS ANY KEY} Fom this example, I am using my new Commodore VIC-20 DEV SETUP! [PAL ASSEMBLER {Floppy} and NEW, VICMon-2 @ $A000, check my page at www.mzretro.ch or www.lived.ch] --------------------------------------------------------------------------------------------------- And we will continue with the PRESS ANY KEY button! In BASIC this would look like this 10 print "any key pressed" 20 get a$:if a$<>"" then goto 40 30 goto 10: 40 print "ready!" PAL-ASSEMBLER SOURCE: 10 sys 700 20 .opt oo 30 *=$0400 35 ; start sys 1024 40 ; press any key 50 lda #$00:sta $c6 53 delay lda $c6 55 cmp #$01 60 bcc delay 65 beq out 75 out rts ASSEMBLY LISTING {VICMon}: ., 0400 lda #$00 - Accumulator to 0 ., 0402 sta $c6 - to delete the keyboard buffer ., 0404 lda $c6 - read the buffer ., 0406 cmp #$01 - is it 1? ., 0408 bcc $0404 - less than 1, then check $c6, dec 198 again ., 040a beq $040c - as soon as it is one {any key pressed! Except C=, SHIFT, CONTROL}, exit ., 040c rts NOTE: this would also go without BEQ, {because the next command would be RTS anyway!} But i put it here to show how you could branch to somewhere else, execute that and maybe first then exit with RTS to BASIC. And yes, you could also have JSR/JMP instead of BEQ to jump further than 128 bytes -+ Called from BASIC, it would look like this: 10 print "press any key" 20 SYS 1024:print "ready!" And if you would define variables first 10 ank$="press any key" 20 oki$="ready!" Then you could use this even easier: 100 print pak$:sys 1024: print oki$ --------------------------------------------------------------------------------------------------- 30.05.2026