Bug in 6502 BRK.

Programming the 6502 microprocessor and its relatives in assembly and other languages.
orac81
Posts: 53
Joined: 20 Apr 2024
Location: uk

Re: Bug in 6502 BRK.

Post by orac81 »

Thats interesting, thanks. So this problem shouldn't occur with the CBM machines as they dont use NMIs in the normal OS.
Perhaps the C128 problem above is caused by some other bug? For example, I recall there is some problem using decimal mode on the v20, because the IRQ rom routine doesn't handle it properly. The machines definitely have other bugs.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Bug in 6502 BRK.

Post by BigDumbDinosaur »

orac81 wrote:
Thats interesting, thanks. So this problem shouldn't occur with the CBM machines as they dont use NMIs in the normal OS.
The pseudo-RS-232 routines in the VIC-20, C-64 and C-128 use NMIs.  In other words, if you are using a modem, you are using NMIs.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
orac81
Posts: 53
Joined: 20 Apr 2024
Location: uk

Re: Bug in 6502 BRK.

Post by orac81 »

Yes, you are right, forgot about rs232, although I built the Maplin userport level converter kit back in the day. Hardly ever used on CBMs since its software driven, 5 volt only, CPU intensive and very slow. 2400 baud was unreliable on the c64 because of NMI conflicts with VIC2 "bad lines", unless you disable the screen.
It would have made more sense to use the V20/C64 ROM space for a mc monitor, and put the rs232 software as a util on the free 1541 disk, a disk was supplied with the modem anyway.
Most CBM devices (like printers) use IEC serial.

Anyway, sounds like IRQ/BRK work together fine, just check the break flag. Not sure its a very profitable way to call code, I wonder what compiler/tool was used on the AttackUfo code, written around 1979ish..
6502inside
Posts: 101
Joined: 03 Jan 2007
Location: Sunny So Cal
Contact:

Re: Bug in 6502 BRK.

Post by 6502inside »

Quote:
Do any early 6502 Forth compilers use this BRK method to save memory?
Dunno about Forth, but Aresco FOCAL on the KIM-1 does use BRK as a software interrupt rather heavily.
Post Reply