Quantcast
Channel: stardot.org.uk
Viewing all articles
Browse latest Browse all 2417

development tools • Re: Porting BASIC2 to a homebrew system

$
0
0
Hmm.. struggling a bit with OSWORD=&00 - probably because I've never used the BRK instruction before.

Image

If Escape is pressed, there's a JMP $9838

9838 just seems to contain a single BRK instruction.. so wouldn't that cause the execution to occur from the vector at FFFE?

Looking at FFFE, we have address DC1C.

Code:

This page ([url]https://mdfs.net/Docs/Comp/BBC/OS1-20/DC1C[/url]) tells me it calls this code:DC1CSTA &FC     ;save ADC1EPLA         ;get back status (flags)DC1FPHA         ;and save againDC20AND #&10    ;check if BRK flag setDC22BNE &DC27   ;if so goto DC27DC24JMP (&0204) ;else JMP (IRQ1V)
So it must branch into $DC27 below, right?

Code:

**************************************************************************                                                                       **               BRK handling routine                                    **                                                                       **************************************************************************DC27TXA         ;save X on stackDC28PHA         ;DC29TSX         ;get status pointerDC2ALDA &0103,X ;get Program Counter loDC2DCLD         ;DC2ESEC         ;set carryDC2FSBC #&01    ;subtract 2 (1+carry)DC31STA &FD     ;and store it in &FDDC33LDA &0104,X ;get hi byteDC36SBC #&00    ;subtract 1 if necessaryDC38STA &FE     ;and store in &FEDC3ALDA &F4     ;get currently active ROMDC3CSTA &024A   ;and store it in &24ADC3FSTX &F0     ;store stack pointer in &F0DC41LDX #&06    ;and issue ROM service call 6DC43JSR &F168   ;(User BRK) to ROMs                ;at this point &FD/E point to byte after BRK                ;ROMS may use BRK for their own purposesDC46LDX &028C   ;get current languageDC49JSR &DC16   ;select ROMDC4CPLA         ;get back original value of XDC4DTAX         ;DC4ELDA &FC     ;get back original value of ADC50CLI         ;allow interruptsDC51JMP (&0202) ;and JUMP via BRKV (normally into current language)
So ultimately, using vector $0202, control is handed back to $b402, correct? I'm hoping I can just skip the entire code from MOS and continue execution at $b402.

Image

Statistics: Posted by SparkyNZ — Sun Feb 18, 2024 6:01 am



Viewing all articles
Browse latest Browse all 2417

Trending Articles