Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > [C128] Irq question ...
2019-05-07 21:57
Flavioweb

Registered: Nov 2011
Posts: 463
[C128] Irq question ...

How can i make this code run on a C128 exactily at same addressess?
(I hope this isn't too much off-topic here...)
.C:3000  78          SEI
.C:3001  A9 7F       LDA #$7F
.C:3003  8D 0D DC    STA $DC0D
.C:3006  A9 00       LDA #$00
.C:3008  8D 14 03    STA $0314
.C:300b  A9 40       LDA #$40
.C:300d  8D 15 03    STA $0315
.C:3010  A9 FF       LDA #$FF
.C:3012  8D 12 D0    STA $D012
.C:3015  A9 01       LDA #$01
.C:3017  8D 1A D0    STA $D01A
.C:301a  4E 19 D0    LSR $D019
.C:301d  58          CLI
.C:301e  4C 1E 30    JMP $301E

.C:4000  EE 20 D0    INC $D020
.C:4003  EE 21 D0    INC $D021
.C:4006  AD 12 D0    LDA $D012
.C:4009  CD 12 D0    CMP $D012
.C:400c  F0 FB       BEQ $4009
.C:400e  CE 20 D0    DEC $D020
.C:4011  CE 21 D0    DEC $D021
.C:4014  4E 19 D0    LSR $D019
.C:4017  4C 33 FF    JMP $FF33
 
... 10 posts hidden. Click here to view all posts....
 
2019-05-08 11:29
oziphantom

Registered: Oct 2014
Posts: 490
yeah its a flaw in the KERNAL sadly.. it should have been something like
ff1c  AD 00 FF    LDA $FF00          - A:00 X:17 Y:00 SP:14   -  IZ 
ff1f  48          PHA                - A:00 X:17 Y:00 SP:14   -  IZ 
ff20  8D 00 FF    STA $FF04          - A:00 X:17 Y:00 SP:13   -  IZ

but then it has issues as well. Another flaw of this is it assumes the Stack is at $100 which isn't always true either.. and can lead to fun "why did the monitor just start" scratching head sessions - the lack of chis on x128 can really hurt sometimes.

I remember Bil Herd saying that post release he ask Fred why he didn't use the MMU, and his response was "Because there are no Kernal only registers", to which Bil responded "Why didn't you tell me.."

The handy thing with the Pre Configs is they don't trash a register, so you could put your IRQ at $3FFD
0:3FFD sta FF02 <- disable BASIC LO, HI,EDITOR,MONITOR
0:4000 pha
0:4001 tax
.....
You need to set up the PreConfigs to be what you want first, but it only adds 4 clocks
2019-05-08 12:38
Flavioweb

Registered: Nov 2011
Posts: 463
WTF they choosed to force ROMS ON anyway!?!
If i disable the roms and computer crashes ... are just my businness!
If i want to setup a IRQ under ROMS the only way is to disable kernal... or put a "trampoline" in a ram area...
If i need kernal in other parts of my code, outside the irq, the only solution is to have a trampoline somewhere...
/o\
2019-05-08 13:40
Oswald

Registered: Apr 2002
Posts: 5094
well trampoline it, you only waste some bytes in ram, you can even enter the rom irq faster by bypassing some of it.
2019-05-08 13:58
oziphantom

Registered: Oct 2014
Posts: 490
If you know its not going to be used, you can set up the JMPFAR routine $02/$03/$04 bank lo hi and just point the IRQ vector to x:02e3
2019-05-08 13:59
Krill

Registered: Apr 2002
Posts: 2980
Just have a two-fold approach.

- KERNAL disabled would go to your actual interrupt handler directly via $fffe/f.
- KERNAL enabled would go to the ROM interrupt handler, then to the trampoline via $0314/5, which would then go to the actual interrupt handler.

This way, you're only using the cycles you really need to use while allowing both KERNAL on and off.
2019-05-08 13:59
oziphantom

Registered: Oct 2014
Posts: 490
But yes, welcome to the 128, it has ROM EVERYWHERE, however you can switch out the CHARGEN EVERYWHERE as well which is nice.
2019-05-08 17:48
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Just have a two-fold approach.

- KERNAL disabled would go to your actual interrupt handler directly via $fffe/f.
- KERNAL enabled would go to the ROM interrupt handler, then to the trampoline via $0314/5, which would then go to the actual interrupt handler.

This way, you're only using the cycles you really need to use while allowing both KERNAL on and off.


This is exactly what I do in EotB and my oen handler mimics the kernel so that timing is the same (not c128 related)
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mike
Walt/Bonzai
4gentE/ΤRIΛD
Inge/HVSC
iAN CooG/HVSC
LightSide
zscs
The MeatBall
t0m3000/hf^boom!^ibx
𝘁𝗡𝗚/FairLight
Hairdog/BOOM!^Dream
katon/Lepsi De
Twilight/Excess/Arcade
Steffan/BOOM!
Fresh
New Design/Excess
Wayne Kerr/Flashtro
Guests online: 128
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.045 sec.