Unexpanded VIC 20 Memory

Basic and Machine Language

Moderator: Moderators

shem
Vic 20 Enthusiast
Posts: 197
Joined: Sun Sep 17, 2006 6:52 am

Post by shem »

The above program is designed for an unexpanded vic 3583 bytes
try it in vice turn off extra ram first
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

Okie Dokie, I've gotten DASM to assemble my *.TXT files into working *.prg and execute with the proper SYS command.
I got VICmon from Zimmers, and successfully wrote and executed one of those as well, how would I write a DASM file in VICmon format, and is there a VICmon version for Unexpanded VIC?
I wrote that TEST.ASM on the VICmon, but I keep getting that annoying . dot and I cant seem to leave vicmon to run the program from BASIC line prompt.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Administrative note: This topic has now taken on quite a programming subject, thus I moved the whole thread.
Anders Carlsson

Image Image Image Image Image
Richard James
Vic 20 Devotee
Posts: 269
Joined: Mon Feb 04, 2008 6:06 am

Post by Richard James »

You don't leave VicMon. You can execute it from inside. According to the instructions in the programmers reference manual chapter INTRODUCTION TO MACHINE LANGUAGE you just press shift + clr/home and type G and the address. In the example in the manual the program started at 1400 so I typed G 1400 and enter.

Also the sample program ends in BRK not RTS. I don't know why.
Change is inevitable except from a vending machine.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I think BRK will make the program exit to a monitor environment. Perhaps not with VICMON, but on the older 6502 systems.
Anders Carlsson

Image Image Image Image Image
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

Ok so back to the 1.3 demo:

1 REM VIC VERSION
800 FOR AD=864TO885:READDA:POKEAD,DA:NEXTAD
805 PRINT"SYS 864 TO ACTIVATE"
810 DATA 160, 0, 169, 1, 153, 0
820 DATA 30, 153, 0, 31, 169, 6
830 DATA 153, 0, 150, 153, 0, 151
840 DATA 200, 208, 237, 96

How does this fill the screens with chr$ 65 aka A character?

According to the code we are putting data value 160 into memory location 864, and 864 on an unexpanded vic is the Cassette buffer up to 885 for this program. I don't understand how we can fill the screen by POKEing a couple numbers into Casette RAM... :?
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

You're not just POKEing a couple of numbers into cassette buffer RAM, you're POKEing a program into cassette buffer RAM and executing it with the SYS 864.

Lee.
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

ok.. so here is the Assembly Language equivilent, which won't execute when loaded, i tried my best to get it to DASM standards:

Code: Select all

#processor 6502
        
            org 7680	;this is decimal start screen ram instead of $1E00
char.a  equ $41		 
	    ldy #$00	
	    lda #char.a	
loop   sta $0400,y    ;not sure if we need 768 or 512 addresses here
	    sta $0500,y	 ;because 7680-8191 is only 511 not 768 
	    sta $0600,y    ; and this was written for commodore 64 originaly
       sta $0700,y   	
	    iny		
	    bne loop	
	    rts	
it broken :(
Last edited by Legacy on Mon Jan 26, 2009 4:27 pm, edited 2 times in total.
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Try this ..

Code: Select all

#processor 6502

char  EQU   "A"-$40           ; the PETSCII fill character
colr  EQU   6                 ; the fill colour

scrn1 EQU   $1E00             ; start of the first screen page
scrn2 EQU   $1EFA             ; start of the second screen page

colp1 EQU   $9600             ; start of the first colour page
colp2 EQU   $96FA             ; start of the second colour page

      ORG   $0FFF

      dc.w  Begin

Begin
      dc.w  nextline          ; next line pointer
      dc.w  $0001             ; 1
      dc.b  $9E               ; SYS
      dc.b  "4109"            ; the decimal value of entry as characters
      dc.b  $00               ; end of line marker
nextline
      dc.w  $0000             ; BASIC end of text

entry
      LDY   #$00              ; clear the index
loop
      LDA   #char             ; set the fill character
      STA   scrn1,Y           ; save the character to page 1
      STA   scrn2,Y           ; save the character to page 2
      LDA   #colr             ; set the fill colour
      STA   colp1,Y           ; save the colour to page 1
      STA   colp2,Y           ; save the colour to page 2
      DEY                     ; decrement the index
      BNE   loop              ; loop if more to do

      RTS
I don't have DASM so there may be syntax errors but the program is good. Save the resulting binary as "name.prg" and it can be loaded into vice.

In vice, with no expansion RAM, it will list as 1 SYS4109 and typing RUN will fill the screen with blue A characters.

BTW When you post your own code please use the code tags to preserve the formatting.

Lee.
Last edited by Leeeeee on Tue Jan 27, 2009 12:05 pm, edited 1 time in total.
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

Syntax error 'A'-$40 aborting assembly, then I tried with just $40 and that had even more errors.

There must be a tutorial that is consistent with DASM or an emulated Assembler for VICE with lots of source and explanation. Ive had to go out and buy 3 books on 6502 vic because going back and forth from programmers refrence to ML for beginners, and VICE/DASM/vicmon24576 is alot of headaches. Hopefully the books arrive soon.

thats fd up dude , by the time i stopped DASM the file was 360 MB large, i thought you guys were here to help
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

Syntax error 'A'-$40 aborting assembly
Replace the single quotes with double quotes and all occurances of ds. with dc.
i thought you guys were here to help
No need to thank us, it's our pleasure.

Lee.
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

i just dont know why i compiled a 400mb assembly file, this is frustrating, but i do appreciate all the help , i think we need to drop the forum and get on irc or something, and u all can be like my personal real time data base :lol: :lol: :lol:

ps - program did work, very fast too, gave me whiplash
DELETED

Post by DELETED »

DELETED
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I believe Legacy could have use of an archive of small DASM examples. Copy and paste from a forum involves a high risk of failure since the assembler is so picky on indention. One space too many or too little may end up in pure frustration.

Leg, do you think a set of simple (preferrably commented) programs would help you get going?
Anders Carlsson

Image Image Image Image Image
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

That would be great thanks carlsson, and I have a copy of VIC Revealed coming too. I know its a learning process, just hard to learn without the proper tools. I am self taught in vc++ , vb, and I went to school for that too. So hopefully with a little hard work and determination I'll be on my way to understanding why a processor does what it does, and make it do what I want it to. Thanks!
Post Reply