Question about Kernal function GETIN $FFE4

Basic and Machine Language

Moderator: Moderators

Post Reply
KingTrode
Vic 20 Hobbyist
Posts: 133
Joined: Tue Apr 13, 2010 2:32 am

Question about Kernal function GETIN $FFE4

Post by KingTrode »

According to the PRG registers affected by this are A and X.

I seem to be getting corruption of Y register after calling this. :?

Is the PRG incorrect?
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

I'd always assume that kernel functions use all registers. There are not many registers in a 6502 anyway.
You could have a look into the ROM listing or step into the routine using a debugger to see what's happening.
Buy the new Bug-Wizard, the first 100 bugs are free!
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

Kananga wrote:I'd always assume that kernel functions use all registers. There are not many registers in a 6502 anyway.
You could have a look into the ROM listing or step into the routine using a debugger to see what's happening.
yes!

In case of GETIN function:

If GETIN uses keyboard:

- if no key pressed (empty key buffer) only AC ist used
- if key in buffer, all registers are lost

If other sources (IEC) register are lost.
KingTrode
Vic 20 Hobbyist
Posts: 133
Joined: Tue Apr 13, 2010 2:32 am

Post by KingTrode »

Kananga wrote:I'd always assume that kernel functions use all registers. There are not many registers in a 6502 anyway.
You could have a look into the ROM listing or step into the routine using a debugger to see what's happening.
Most kernel functions will most likely use all registers, it's which ones are preserved by the function and restored on return (other than those which are used to return values)

CHROUT $FFD2 affects none for example, otherwise a print loop would involve some form of --> TXA/TYA PHA before and PLA TAY/TAX afterwards.

It's not a big problem as I'll just push it on the stack, was just wondering if this is incorrect - and how many other errors might be in the book.
KingTrode
Vic 20 Hobbyist
Posts: 133
Joined: Tue Apr 13, 2010 2:32 am

Post by KingTrode »

Diddl wrote:
Kananga wrote:I'd always assume that kernel functions use all registers. There are not many registers in a 6502 anyway.
You could have a look into the ROM listing or step into the routine using a debugger to see what's happening.
yes!

In case of GETIN function:

If GETIN uses keyboard:

- if no key pressed (empty key buffer) only AC ist used
- if key in buffer, all registers are lost

If other sources (IEC) register are lost.
So the PRG is incorrect then.

Thanks for all replies :D
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

KingTrode wrote: So the PRG is incorrect then.
That's why I always have a commented ROM listing on my desk when programming for the VIC. ;)
Buy the new Bug-Wizard, the first 100 bugs are free!
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Kananga wrote:
KingTrode wrote: So the PRG is incorrect then.
That's why I always have a commented ROM listing on my desk when programming for the VIC. ;)
I have an annotated memory map layout which includes the names of the ROM routine entry points, but doesn't include comments about their register dependencies and usage - if you have that, do you feel like sharing? I'll post my VICMap file in exchange... :)
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

FD22 wrote: I have an annotated memory map layout which includes the names of the ROM routine entry points, but doesn't include comments about their register dependencies and usage - if you have that, do you feel like sharing? I'll post my VICMap file in exchange... :)
Is your map the one found on funet/zimmers?
The commented ROM listing I have is in the German book "VC-20 Intern" (published by Data Becker, 1983). I don't know if anybody scanned it already and it is in German, of course.
Buy the new Bug-Wizard, the first 100 bugs are free!
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Nope - well, not exactly, it's obviously the VIC memory map, but I've annotated every writeable memory location and named every ROM routine (using either the commonly-accepted name, or a representative one of my own making if there didn't seem to be one).

Does anyone have a link to an annotated / commented ROM disassembly?
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

I just found this in The Complete Commodore Inner Space Anthology (ftp.zimmers.net/pub/cbm/manuals/anthology/index.html):

GETIN FFE4 "Get character from current input device"
output: .A .. data .X .. alt. .Y alt.

(Machine Language Section: BASIC 2.0/4.0 Kernal Routines, VIC 20/Commodore 64 Kernal Routines)

Not a ROM listing, but it looks like a useful reference.
Buy the new Bug-Wizard, the first 100 bugs are free!
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

FD22 wrote:Nope - well, not exactly, it's obviously the VIC memory map, but I've annotated every writeable memory location and named every ROM routine (using either the commonly-accepted name, or a representative one of my own making if there didn't seem to be one).
Sounds like your map is more comprehensive than the one I use for my debugger (http://vic20emu.googlecode.com/svn/trun ... vicrom.sym) (It's the one from zimmers.net)
Would you like to share your map?
Buy the new Bug-Wizard, the first 100 bugs are free!
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

Here is a link to my VICMap file, which is designed to be used as an 'include' for DASM-based VIC Assembler projects (which is what I created it for). You can rename it as '.asm' if you're using that as your Assembler extension - I already have that associated with an x86 dev-tool, so I use .6502 to map DASM source files to a different toolchain.

Here it is: http://vicdev.googlecode.com/files/VICMap.6502
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

Thanks for sharing!
I'd like to borrow from your map what's missing from my symbol file for the Debugger, if you don't mind.
Buy the new Bug-Wizard, the first 100 bugs are free!
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

Thanks for that definition file.
FD22
Vic 20 Hobbyist
Posts: 148
Joined: Mon Feb 15, 2010 12:31 pm

Post by FD22 »

If I minded anyone using it, or a derivative of it, I wouldn't have posted it. ;)

I've gleaned an immense amount of VIC-related information from this forum and other internet resources, so I consider posting stuff like VICMap a fair return for all the knowledge now in my head that other peoples' work has contributed to.
Post Reply