Vice monitor and zero pages

You need an actual VIC.

Moderator: Moderators

User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Vice monitor and zero pages

Post by Victragic »

Hi,

does anyone use the inbuilt monitor with VICE for programming?

I'm trying to work out how to absolutely address a zero page location.. when I enter an instruction such as

A 2000 LDA $00FC

..such as I would do with VICmon.. the monitor will completely ignore the first half of the address and change the instruction to

. 2000 LDA $FC

which is not what I want!

Anyone know the answer? I guess I may have to post to someone at the VICE team, have seriously looked for the answer to this online but not found it.

Cheers!

-Glen
3^4 is 81.0000001
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

I'm just a beginner myself in ML, but Isn't that the same thing? You're getting a number from a zero page address ($fc). The monitor just drops the beginning zeros. But I think the addressing mode is different. The opcode would be $ad for absolute and $a5 for zero page. I believe the reason for this is that zero page addressing is a bit faster that abosolute. Maybe someone with the knowlege can let me know if that's correct or not.
Rob
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

zero pages

Post by Victragic »

Perhaps I'll explain this as I understand it and someone can correct me too if I am wrong.

Zero pages are useful for setting vectors, ie 16-bit addresses that can be used as various pointers to address any of the 64kb range. They are stored first as the low-byte, then as the high-byte.

To read the contents of the memory location the vector is pointing to, you would use the command

LDA $FB - where FB,FC is set as a 16-bit address - say $00 $94 for the top of colour memory on an 8K + VIC, this would load the contents of $9400 into the accumulator

But, if I wanted to read what the actual value of location $00FB was (aka the absolute value) I would use

LDA $00FB

and the accumulator would be loaded with #$00...

With HESMON and VICMON the assembler recognises the difference between addressing as $00FB and $FB, and records the instruction as either AD or A5 accordingly..

VICE monitor however, always ignores the first 00 and records the instruction as A5..

Does anyone have an answer for this?

Thanks!

-Glen

(Still cutting my teeth on VIC20s after 25 years..)
3^4 is 81.0000001
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

I think you want indirect addressing. But, that's still a bit deep for me. :(
Rob
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Indirect & Zero Page

Post by Victragic »

Yep, don't worry I go cross-eyed over these things.. :oops:

I guess I could use indirect addressing but I'm after speed...

To explain part of my project, I've made a bitmap that is 224 * 284, by using an expanded screen, and a raster interrupt effect to switch between 2 4kb character sets..

.. in trying to make some useful graphics routines, I find it useful to point a zero page 'vector' to the first byte that I want to change.. keeps it easy particularly as there is an annoying 64-byte 'overlap' in the middle of the bitmap where the two character maps collide..

This requires a lot of looping to set the vector to the correct byte, I guess potentially a few hundred loops per character depending on screen location, so the difference between using 3 cycles per loop and 5/6 cycles per loop on one instruction would be significant..

Was working fine when using HESMON or VICMON, but I don't want to waste any memory on my assembler (particularly when the bitmap alone takes up 8k of memory) and VICE monitor seems so much nicer to use..

anyway, maybe I just need some fresh air and a new hobby.. lol

-G
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

To explain part of my project, I've made a bitmap that is 224 * 284, by using an expanded screen, and a raster interrupt effect to switch between 2 4kb character sets..
You know, that the VIC chip can only address internal memory? That means you're restricted to $0000-$03FF, and $1000-$1FFF. VICE does not take that restriction into account.

If you don't want to touch to lower 1K, 160x192 is the maximum feasible resolution for a bitmap.

Michael
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

VIC Bitmaps

Post by Victragic »

You know, that the VIC chip can only address internal memory? That means you're restricted to $0000-$03FF, and $1000-$1FFF. VICE does not take that restriction into account.
Nope, didn't know that as I still don't have a real PAL machine to play around on..

Immaterial really as from what I've read most TVs wouldn't be able to display all that resolution anyway.

I'm surprised though that the VIC chip can't read the 3K expansion block between 0400 and 0fff - That's within the 16k 'range' for the VIC chip... what difference would it make if it was 'onboard' RAM or 'external' RAM?

..or, I could replace the 4k character ROM with 4k RAM and get around it that way I guess (shudder.. no, I don't think I'd try that..)

interesting, but I guess my question was about the VICE monitor and I'm hijacking my own thread..

-G
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: VIC Bitmaps

Post by Mike »

Victragic wrote:I'm surprised though [...] what difference would it make if it was 'onboard' RAM or 'external' RAM?
The VIC-20 has split address busses for the VIC chip and the 6502. This is, because the 6502 doesn't have a Access Enable Clock signal, which could tri-state its address bus. But only the 6502 address bus and chip enable signals are visible at the expansion connector.
or, I could replace the 4k character ROM with 4k RAM and get around it that way I guess (shudder.. no, I don't think I'd try that..)
... and then you'd need to convince others to mod their VIC, too.

Michael
a1bert
Vic 20 Dabbler
Posts: 96
Joined: Mon Jan 23, 2006 12:49 am

Re: zero pages

Post by a1bert »

Victragic wrote:LDA $FB - where FB,FC is set as a 16-bit address - say $00 $94 for the top of colour memory on an 8K + VIC, this would load the contents of $9400 into the accumulator
You are thinking about indexed indirect addressing.
ldy #0
lda ($fb),y

lda $fb is a zero-page addressing, which reads the content of $fb to A. lda $00fb is absolute addressing mode and just has a 16-bit address, no other difference in operation (except 3 bytes instead of 2 and 4 cycles instead of 3).

Some assemblers have a way to force absolute addressing for seemingly zero-page addresses, but I don't know if this is possible in the VICE monitor (it is not a real assembler anyway).

-Pasi
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

VICE monitor

Post by Victragic »

I don't know if this is possible in the VICE monitor (it is not a real assembler anyway).
Umm.. it assembles, it disassembles, what more does it need to be a 'real' assembler?

-G
3^4 is 81.0000001
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: VICE monitor

Post by eslapion »

Victragic wrote:Umm.. it assembles, it disassembles, what more does it need to be a 'real' assembler?

-G
It does NOT dissasemble and assemble. It decodes and it encodes single lines of codes.

A real assembler requires that you type a complete text file with such things as aliases and labels and then it will compile your full text file into a program you can execute.

A monitor does not have any use for labels and aliases, codes only one line at a time and directly converts binary information found in the computer's memory into... mnemonics or ASCII or HEX values.

A monitor is more like a debugger. An assembler will never allow you to investigate and modify the content of memory directly.
a1bert
Vic 20 Dabbler
Posts: 96
Joined: Mon Jan 23, 2006 12:49 am

Re: VICE monitor

Post by a1bert »

Victragic wrote:it assembles, it disassembles, what more does it need to be a 'real' assembler?
There are several requirements for a useful assembler, but the most important one(s) is: labels and symbols with values. With the VICE one-line assembly you have to use absolute addresses. When you make a jump to a larger address, you have to just guess the address, keep coding, and then remember to fix the original jump when you have coded the jump target instruction.

a silly example:

COLUMNS = 22
.org $1000
sei
lda #0
ldx #COLUMNS-1
loop:
sta $1e00,x
dex
bpl loop
jsr setcolors
cli
rts

setcolors:
lda #$9f
sta $900f
rts

-Pasi
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Assemblers for the VIC20

Post by Victragic »

Cool, that would be a lot easier than trying to work out offsets manually, and remembering addresses etc..

I guess most people today would use their PCs for the assembling/compiling rather than their VICs, so I'll probably investigate what is available..

- I understand there is a program called 'Quetzalcoatl' that can be used as both a mini-C compiler and a 6502 assembler, are there any recommendations for a good VIC assembler?

Cheers
-G
3^4 is 81.0000001
MacbthPSW
Vic 20 Afficionado
Posts: 478
Joined: Wed Apr 06, 2005 1:56 pm

Post by MacbthPSW »

I think most people agree that the ca65 assembler included in the cc65 package is the most powerful one around (out of those freely available, anyway).

For smaller projects, I like to use DASM. It's what I used for VIC Splatform.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes: DASM, ca65 and xa may be the three most common 6502 cross-assemblers (in no particular order). Some people use variants of TASM as well.

Back to your original question; DASM (at least v2.12.04) also assembles LDA $00FC as LDA $FC. I don't know if more recent versions of DASM has solved this.
Anders Carlsson

Image Image Image Image Image
Post Reply