; 6502bench SourceGen v1.8.1 CO_off_stack eq 0 {const} ;coroutine stack COP_00_OPWRC eq 0 {const} ;OPWRC - write character in A to VDU __EVESC eq 1 {const} ;ESCape flag COP_01_OPWRS eq 1 {const} ;Print the zero-terminate text following the cop instruction HDMMM eq 1 {const} ;MM Global handle - ??? MM_HANDLE_1_SPECIAL_QRY eq 1 {const} __EVPRE eq 2 {const} ;Event mask indicates a pre-empt __MMFP eq $02 {const} ;Free a pool CO_off_Parent eq 2 {const} ;Pointer to parent coroutine COP_02_OPWRA eq 2 {const} ;OPWRA - write string at BHA EVENT_2_CHARINBUF eq 2 {const} ;A character is entering an input buffer HND_type_2_CBMEM eq 2 {const} ;Handle type - Memory block COP_03_OPNLI eq 3 {const} ;OSNEWL __MMBP eq 4 {const} ;Undocumented mm call - TODO check for deprecated CO_off_flags eq 4 {const} ;Coroutine block offset - flags COP_04_OPRDC eq $04 {const} HND_type_4_CBSIND eq 4 {const} ;Handle type - module call reference - QRY used in STCSI CO_off_B eq 5 {const} ;offset in couroutine of bank register EVENT_5_TIMER_ZERO eq 5 {const} ;Interval timer crossed zero __MMASD eq 6 {const} ;Allocate small descending CO_off_DP eq 6 {const} ;offset in couroutine block of DP pointer COP_06_OPOSB eq 6 {const} ;OSBYTE HND_type_6_CBCO eq 6 {const} ;Handle type - coroutine COP_07_OPOSW eq 7 {const} ;OSWORD HDMMW eq 7 {const} ;A memory pool well known handle - QRY - looks to be used with some unknown hardare at 450000 VDU_07_BELL eq 7 {const} CO_off_8_BRKBLOCK eq 8 {const} ;Contains a pointer to block that contains a pointer to a break handler in bank 0 HND_type_8_CBCO2 eq 8 {const} ;Handle type - coroutine break handler QRY VDUMOD_OPX_8_EXPLODE eq 8 {const} __MMASA eq $0a {const} ;Allocate small ascending __STGIT eq $0a {const} ;ST 0A - STGIT - GSINIT start reading GSTRANS string CR or space terminates COP_0A_OPBGT eq $0a {const} ;BGET HND_type_A_CBLCB eq $0a {const} ;Handle type - ??? VDUMOD_OPX_A eq $0a {const} B0B_offs_B_type eq $0b {const} ;Offset of the type byte in a handle block COP_0B_OPBPT eq $0b {const} ;BPUT COP_0B_OPBPUT eq $0b {const} ;BPUT __MMALA eq $0c {const} ;Allocate large asending area __STGLN eq $0c {const} ;ST 0C - STGLN - GSINIT read line only <CR> terminates HND_type_C_CBMOD eq $0c {const} ;Handle type - module QRY VDUMOD_OPX_C_HIMEM eq $0c {const} VDU_0D_CR eq $0d {const} __MMBAS eq $0e {const} ;Return Pool Base in BHA __STGRD eq $0e {const} ;ST 0E - STGRD - GSREAD B0B_TYPE_LL_IRQ eq $0e {const} ;Handle type - Interrupt handler COP_0E_OPCOM eq $0e {const} ;Interpret command in BHA VDUMOD_OPX_E_HIMEMBYX eq $0e {const} COP_0F_OPERR eq $0f {const} COP_10_OPADP eq $10 {const} ;Allocate direct page HND_type_10_CBHN eq $10 {const} ;Handle type - device handle MMLEN eq $10 {const} ;COPMM reason code, Y contains handle, exit BHA contains length VDUMOD_OPX_10_GETCURSOR eq $10 {const} __DVOPN eq $12 {const} ;DVOPN - 12 - Open device / file __MMTOP eq $12 {const} ;Return the address of the top of the pool HND_type_12_CBDFR eq $12 {const} ;Handle type - ??? COP_13_OPAST eq $13 {const} ;allocate stack __DVCLS eq $14 {const} ;DVCLS - 14 - close device/file __STSBK eq $14 {const} ;ST 14 - STSBK - Read Break Signature VDUMOD_OPX_14_FLASH_QRY eq $14 {const} VDU_15_DELLN eq $15 {const} __DVBGT eq $16 {const} ;DVBGT - 16 - BGET from device __STTBK eq $16 {const} ;ST 16 - STTBK - Read BRK message text VDUMOD_OPX_16_GETCHARXY eq $16 {const} __DVBPT eq $18 {const} ;DVBPT - 18 - BPUT to device __MMAZB eq $18 {const} ;Allocate Bank 0 area COP_18_OPRLH eq $18 {const} ;Read hex number VDUMOD_OPX_24_READVDUVAR eq 24 {const} __DVCGT eq $1a {const} ;DVCGT - 1A - device control byte get __DVCPT eq $1c {const} ;DVCPT - 14 - send a control byte to the device __STGAD eq $1c {const} ;ST 1C - STGAD - add Y to GSREAD pointer __DVEOF eq $1e {const} ;DVEOF - 1E - Check for device EOF __STBMB eq $20 {const} ;ST 20 - STBMB - Get last BRK address to BHA COFLAG_hasBRKhandler eq $20 {const} ;When set there's a break handler COP_20_OPSEV eq $20 {const} ;Set Event - QRY - set escape when called with A=0003 MHCFS eq $20 {const} ;Module type bits $20 - FS interface support COP_21_OPPRE eq $21 {const} ;allow pre-emption VDUMOD_OPX_22_READSTATUS eq $22 {const} __DVLOD eq $24 {const} ;DVLOD - 24 - Load a file COP_24_OPCVD eq $24 {const} ;Convert direct page index __DVSAV eq $26 {const} ;DVSAV - 26 - save a file COP_26_OPBHA eq $26 {const} ;Set BHA to start of string immediate __DVRLE eq $28 {const} ;DVRLE - 28 - Read Load/Execute address COP_28_OPCMD eq $28 {const} COP_29_OPRFR eq $29 {const} ;Find reference to module, entry BHA points name, X contains pointer in DP to 8 byte block __DVWLE eq $2a {const} ;DVWLE - 2A - Write Load/Execute address __DVRAT eq $2c {const} ;DVRAT - 2C - read file attributes COP_2C_OPFMA eq $2c {const} ;Find module by address COP_2D_OPWRM eq $2d {const} ;OPWRM - write module name __DVWAT eq $2e {const} ;DVWAT - 2E - write file attributes COP_2F_OPIIQ eq $2f {const} ;intercept interrupt __DVRSP eq $30 {const} ;DVRSP - 30 - read sequential pointer __DVWSP eq $32 {const} ;DVWSP - 32 - write sequential pointer COP_32_OPSUM eq $32 {const} ;Compute end-around-carry sum __DVRPL eq $34 {const} ;DVRPL - 34 - read file phyiscal length COP_34_OPRMI eq $34 {const} ;Read module info __DVRLL eq $36 {const} ;DVRLL - 36 - read file logical length COP_36_OPNLU eq $36 {const} ;Name lookup __DVWLL eq $38 {const} ;DVWLL - 38 - write file logical length __DVRCH eq $3a {const} ;DVRCH - 3A - read catalog header __DVRFN eq $3c {const} ;DVRFN - 3C - read file / object from directory __DVDEL eq $3e {const} ;DCDEL - 3E - delete a file __DVREN eq $40 {const} ;DVREN - 40 - rename a file COFLAG_HASDP eq $40 {const} ;coroutine block flags bitmask for has valid DP __DVUNK eq $42 {const} ;DVUNK - 42 - ??? __VDU_42 eq $42 {const} ;Vdu module command 42 __VDU_44 eq $44 {const} ;Copy screen contents to BHA COP_44_OPOPN eq $44 {const} COP_45_OPCLS eq $45 {const} ;Close file __VDU_46 eq $46 {const} ;Restore variables COP_46_OPEND eq $46 {const} ;Check for EOF __VDU_48 eq $48 {const} ;restore the screen contents __VDU_4A eq $4a {const} ;VDU module call 4A COP_4F_OPSAV eq $4f {const} ;save a file from memory COP_50_OPRLE eq $50 {const} ;Read Load/Execute/Length of file COP_51_OPWLE eq $51 {const} ;Write Load/Exec address of file COP_57_OPRLL eq $57 {const} ;read logical length (extent) COP_59_OPRCH eq $59 {const} ;OPRCH - read catalogue header information COP_5A_OPRFN eq $5a {const} ;OPRFN - read file object info COP_5C_OPREN eq $5c {const} ;rename file COP_61_OPERC eq $61 {const} DPLOC_SYS eq $ac00 {const} STACKTOP_SYS_QRY eq $adff {const} ;Set at reset QRY STACKTOP_RESET eq $ffe0 {const} ;Stack during reset bob_ll_irq_pri__next eq $00 bob_ll_irq_sec__prior eq 0 DPCOP_Y eq 1 {addr/2} ;offset of Y in COP entry/exit frame bob_ll_irq_sec__dp eq 1 bob_ll_irq_pri__irqf eq $02 DPCOP_X eq 3 {addr/3} ;offset of X in COP entry/exit frame bob_ll_irq_sec__flags eq 3 bob_ll_irq_sec__fphand eq 4 DPCOP_AH eq 5 {addr/2} ;offset of AH in COP entry/exit frame bob_ll_irq_pri__mand eq 5 bob_ll_irq_pri__meor eq $06 DPCOP_B eq 7 {addr/1} ;offset of B(ank) in COP entry/exit frame bob_ll_irq_pri__psec eq 7 bob_ll_irq_sec__hitct eq 7 DPCOP_DP eq 8 {addr/2} ;offset of DP in COP entry/exit frame bob_ll_irq_pri__fpand eq $09 DPCOP_P eq 10 {addr/1} ;offset of P in COP entry/exit frame DPCOP_PC eq 11 {addr/2} ;offset of PC in COP entry/exit frame bob_ll_irq_sec__type eq 11 DPCOP_K eq 13 {addr/1} ;offset of K (program bank) in COP entry/exit frame __MMFND eq $14 ;Find a memory pool by task pool handle COP_1A_OPFZB eq $1a ;free zero bank pool COP_2E_OPFPO eq $2e ;find pool owner COP_31_OPMIQ eq $31 ;modify interrupt intercept __VDU_40 eq $40 ;VDU module call 40 - QRY get screen size in HA COP_4E_OPLOD eq $4e ;load a file into memory COP_5B_OPDEL eq $5b ;delete file VDU_7F_BKSP eq $7f ;Backspace DPSYS_D8_B_SAV eq $d8 {addr/1} ;OSWORD saves caller's bank register BANK0_MEM_IRQ6502 eq $4040 ;QRY? Vector for IRQ in 6502 mode set at reset SYSVARS eq $a500 {addr/207} ;QRY SYSVARS SYSVAR_20_EVENTV eq $a520 {addr/2} ;EVENTV - vector must point at MOS ROM bank! SYSVAR_22_UPTV eq $a522 {addr/2} ;User print vector QOSBY_VECTOR eq $a524 {addr/2} SYSVARS_INSV eq $a52a {addr/2} SYSVARS_REMV eq $a52c {addr/2} SYSVARS_CNPV eq $a52e {addr/2} SYSVAR_CFS_TIMEOUT eq $a540 {addr/1} SYSVAR_41_input_stream eq $a541 ;Currently selected input stream SYSVAR_66_KB_SEMAPHORE eq $a542 {addr/1} ;keyboard scan semaphore SYSVAR_RS232_MODE eq $a545 {addr/1} SYSVAR_48_UNKNOWN_ULA eq $a548 SYSVAR_51_FLASHCTDN eq $a551 {addr/1} SYSVAR_82_ELK_ULA_MISC eq $a552 {addr/1} SYSVAR_FLASH_MARK eq $a553 SYSVAR_58_ESCBRK_EFFECT eq $a558 {addr/1} SYSVAR_ELK_ULA_IE eq $a55b {addr/1} ;Soft copy of ULA interrupt mask SYSVAR_ELK_SOFTKEY_STRLEN eq $a55d {addr/1} SYSVAR_FLAGS_SOMETHINGOSBYTEY eq $a55e {addr/1} SYSVAR_SOFTKEY_STRLEN eq $a568 {addr/1} SYSVAR_VDU_QLEN eq $a56a {addr/1} SYSVAR_SOUND_EXT_FLAG eq $a56b {addr/1} SYSVARS_6C_ESCCHAR eq $a56c {addr/1} SYSVARS_75_ESCACTION eq $a575 {addr/1} SYSVAR_78_SOUND_SEMAPHORE eq $a578 ;Sound semaphore SYSVARS_7C_OUTDEST eq $a57c {addr/1} ;output destination - FX3 SYSVARS_ULA_MISC_COPY eq $a582 {addr/1} SYSVARS_83_TIMER_SWITCH eq $a583 {addr/1} ;100Hz timer switch SYSVAR_SOFTKEY_CONS eq $a584 SYSVAR_85_PRINTER_DEST eq $a585 SYSVARS_8d_lastbreak eq $a58d SYSVAR_OSBYTE_255_STARTUP eq $a58f SYSVAR_91_TIMERS eq $a591 {addr/10} ;100 Hz timers SYSVAR_9A_INTERVAL eq $a59a {addr/5} ;Interval timer SYSVARS_B0_INKEYCTDN eq $a5b0 {addr/2} SYSVARS_OSWORD_0_PARMS eq $a5b2 {addr/3} SYSVAR_B5_EVENT_ENABLE_TABLE eq $a5b5 {addr/10} ;Event enble table SYSVARS_ELK_BUFFER_BUSY eq $a5c3 {addr/8} DPSYS_OSWORD0_BUFPTR eq $a5e3 {addr/2} SOUND_QRY_T eq $a814 SOUND_QRY_S eq $a81b SOUND_STATUS_QRY eq $a820 {addr/1} SOUND_TONE_QRY eq $a821 {addr/1} SOUND_QRY_X eq $a822 {addr/1} SOUND_CUR_CHAN_QRY eq $a825 {addr/1} SYSFNK eq $ab00 {addr/256} ;Soft Keys Area DPSYS eq $ac00 {addr/256} ;System's direct page area DPSYS_PAGEMODE_CTR eq $ac69 DPSYS_DP_ECO eq $ac9d {addr/2} ;Econet Direct Page Save QRY DPSYS_MOD_ECONET eq $ac9f {addr/8} ;module reference for econet DPSYS_MOD_NET eq $acaf {addr/6} ;Module block for high level network module QRY - find out name DPSYS_MOD_VDU eq $acbf {addr/8} ;vdu module reference DPSYS_DP_KEYBOARD eq $acc7 {addr/8} ;module reference for keyboard module DPSYS_D1_EXEC_handle eq $acd1 {addr/2} DPVAR_ACD4_HANDSET_STATUS_QRY eq $acd4 {addr/1} DPSYS_D6_OSW_DPSAV eq $acd6 {addr/2} ;OSWORD caller's saved DP DPSYS_GSREAD_flags eq $acdd {addr/1} ;bit 7 is quotes detected, bit 6 is terminate on space DPSYS_OSB_X eq $acea {addr/1} ;OSBYTE saved X DPSYS_OSB_Y eq $aceb {addr/1} ;OSBYTE saved Y DPSYS_OSB_A eq $acec {addr/1} ;OSBYTE save in SYS DP DPSYS_GSREAD_ptr eq $aced {addr/3} ;GSREAD pointer in __ST DPSYS_OSB_IND eq $acf6 {addr/2} B0LST_OPEN_FILES eq $fdfe {addr/2} ;QRY - list of all open files (handle type 10) B0LST_FREE_BLOCKS eq $fe00 {addr/2} ;A list of free [handle block]s B0LSTEND_FREE_BLOCKS eq $fe02 {addr/2} ;points to the last entry in the free list B0LL_IRQ_BLOCKS eq $fe06 {addr/2} ;looks to be a list of interrupt handlers DP_HANDLE_VIDEO_QRY eq $fe0c {addr/2} ;QRY see fe/d355 B0LST_MODULES_QRY eq $fe0e {addr/2} B0_IRQ_STACK eq $fe10 {addr/2} ;contains a stack pointer to be used for interrupts block_FE20 eq $fe20 {addr/16} ;block QRY tblB0JumpTableFE80_QRY eq $fe80 {addr/52} ;QRY set up from ROM during reset at FEb4e8 tblB0JumpTableFEE0_QRY eq $fee0 {addr/32} EXSYS eq $ff00 {addr/256} ;Extended system variables MM_HANDLE_TAB eq $ff00 {addr/80} ;Looks to contain a set of memory handles EXSYS_FpHandles eq $ff02 {addr/3} EXSYS_CO_A_SAVE eq $ff05 {addr/2} ;used in CCO EXSYS_0D_BRKADDR_SAVE eq $ff0d {addr/3} EXSYS_CUR_COROUTINE eq $ff10 {addr/2} ;Stores the current coroutine's pointer SYS_ESCAPE_FLAG_QRY eq $ff13 tblB0JumpTableFF80_QRY eq $ff80 {addr/80} ;jump table that branches to jmls to default cop handlers QRY? LOWCALL__MM eq $ff8c LOWCALL__KB eq $ffac ;direct call to Keyboard routines QRY? BANK0_HW_VECTORS eq $ffe0 {addr/32} BANK0_HW_NMI816 eq $ffea {addr/2} ;Native mode IRQ HW vector BANK0_HW_IRQ6502 eq $fffe {addr/2} ;hardware vector 6502 IRQ BANK0_HW_NMI816_SHAD1M eq $10ffea {addr/2} BANK0_HW_IRQ6502_SHAD1M eq $10fffe {addr/2} ;IRQ for 6502 mode in 1M shadow bank QRY? see reset HW_ECONET eq $410000 VIA_ORB eq $420000 {addr/1} VIA_ORA eq $420001 {addr/1} VIA_DDRB eq $420002 {addr/1} VIA_DDRA eq $420003 {addr/1} VIA_T1C_L eq $420004 {addr/1} VIA_T1C_H eq $420005 {addr/1} VIA_T1L_L eq $420006 {addr/1} VIA_T1L_H eq $420007 {addr/1} VIA_ACR eq $42000b {addr/1} VIA_PCR eq $42000c {addr/1} VIA_IFR eq $42000d {addr/1} VIA_IER eq $42000e {addr/1} HW_VIDEO_BASE eq $450000 {addr/10000} ;Video ULA / Screen memory sheila_ULA_IRQ_CTL eq $45fe00 sheila_ULA_CASSH eq $45fe04 {addr/1} sheila_ULA_PAG_IRQCLR eq $45fe05 {addr/1} sheila_UKA_TONE eq $45fe06 shiela_ULA_MISC eq $45fe07 {addr/1} ;ULA misc control sheila_ULA_PAL eq $45fe08 {addr/8} HW_EXTIO eq $800000 {addr/10000} ;External IO space HW_TYPE_DETECT_QRY eq $f0fff8 ;QRY Seems to detect different motherboard types SYSVAR_IRQCTL_COPY eq $fea55b {addr/1} addrs $feae00 rwid shortm,shortx fe/ae00 MOSSTART brl ServiceEnter ;Branch to Service Routine fe/ae03 dd3 $005065 ;Module length-2 fe/ae06 dd2 $0100 ;version BCD fe/ae08 dd4 $00000002 ;FLAGS fe/ae0c dd2 $0000 ;RESV fe/ae0e zstr “MOS/HELP/LOAD/SAVE/KEY/FX/EXEC/RESET/LCB/CLOSEALL/DELETE/RENAM” ;Command Table + “E/CAT/EX” fe/ae55 zstr “//file [load_addr]/file [from_addr] [to_addr||+len] [exec_addr” ;Command help table + “] [load_addr]/key_num [string]/fx_num [x] [y]/[file]//num//fil” + “e/file1 file2/[fs:][dir]/[fs:][dir]” ; Service Call Handler ; ; Dispatches to routine index in X ; ; DP is hard coded to AC00 rwid longm,longx fe/aef5 ServiceEnter php fe/aef6 rep #$30 fe/aef8 cpx #$000a fe/aefb bcs @ServiceExitFail fe/aefd pea DPSYS fe/af00 pld ;Set DP register tp AC00 fe/af01 sep #$30 rwid shortm,shortx fe/af03 jsr (tblServices,x) fe/af06 bcs @ServiceExitFail fe/af08 plp rwid longm,longx fe/af09 clc fe/af0a rtl rwid shortm,shortx fe/af0b @ServiceExitFail plp rwid longm,longx fe/af0c sec fe/af0d rtl fe/af0e tblServices dd2 Serv0_starCommand & $ffff fe/af10 dd2 Serv2_RESET & $ffff fe/af12 dd2 Serv4_QRY & $ffff fe/af14 dd2 Serv6_QRY & $ffff fe/af16 dd2 Serv8_QRY & $ffff rwid shortm,shortx fe/af18 Serv0_starCommand tyx fe/af19 ldy #$00 fe/af1b clc fe/af1c sep #$30 fe/af1e jsr (tblStarCommandDispatch,x) fe/af21 rts fe/af22 tblStarCommandDispatch dd2 starMOS & $ffff fe/af24 dd2 starMOS & $ffff fe/af26 dd2 starLOAD & $ffff fe/af28 dd2 starSAVE & $ffff fe/af2a dd2 starKEY & $ffff fe/af2c dd2 starFX & $ffff fe/af2e dd2 starEXEC & $ffff fe/af30 dd2 starRESET & $ffff fe/af32 dd2 starLCB & $ffff fe/af34 dd2 starCLOSEALL & $ffff fe/af36 dd2 starDELETE & $ffff fe/af38 dd2 starRENAME & $ffff fe/af3a dd2 starCAT & $ffff fe/af3c dd2 starEX & $ffff fe/af3e starCLOSEALL php fe/af3f rep #$30 rwid longm,longx fe/af41 phk fe/af42 jsr closeAllFiles ;long call fe/af45 plp rwid shortm,shortx fe/af46 rts fe/af47 starMOS cop COP_01_OPWRS fe/af49 zstr “Communicator Operating System”,$0a,$0d,“Version 1.00 13/Nov/86” + “ (C)1986”,$0a,$0d fe/af89 rts fe/af8a Serv4_QRY pea $0000 fe/af8d plb dbank $00 fe/af8e plb ;Data Bank to 0 fe/af8f pha fe/af90 tay fe/af91 jsr LFEE22E fe/af94 plx fe/af95 lda #$00 fe/af97 cpx SYSVARS_6C_ESCCHAR fe/af9a bne LFEAFA2 fe/af9c ldx SYSVARS_75_ESCACTION fe/af9f bne LFEAFA2 fe/afa1 inc A fe/afa2 LFEAFA2 rts fe/afa3 Serv6_QRY pea $0000 fe/afa6 plb fe/afa7 plb fe/afa8 eor #$00 fe/afaa beq LFEAFBC fe/afac sei fe/afad lda $d5 fe/afaf cmp #$81 fe/afb1 bcc LFEAFBA fe/afb3 cli fe/afb4 LFEAFB4 lda $d5 fe/afb6 cmp #$80 fe/afb8 bcs LFEAFB4 fe/afba LFEAFBA lda #$ff fe/afbc LFEAFBC sta $d3 fe/afbe rts fe/afbf tblInitSysVars dd2 defaultUSERV & $ffff ;USERV fe/afc1 dd2 default_IVBRK & $ffff ;BRKV fe/afc3 dd2 $0000 ;IRQ1V fe/afc5 dd2 $0000 ;IRQ2V fe/afc7 dd2 doLNCLI & $ffff ;CLIV fe/afc9 dd2 doDispatchOSBYTE & $ffff ;BYTEV fe/afcb dd2 enterOSWORD_BHA & $ffff ;WORDV fe/afcd dd2 TFEDEFF & $ffff ;WRCHV fe/afcf dd2 int_OPRDC & $ffff ;RDCHV fe/afd1 dd2 donothingRTS & $ffff ;FILEV fe/afd3 dd2 donothingRTS & $ffff ;ARGSV fe/afd5 dd2 donothingRTS & $ffff ;BGETV fe/afd7 dd2 donothingRTS & $ffff ;BPUTV fe/afd9 dd2 donothingRTS & $ffff ;GBPBV fe/afdb dd2 donothingRTS & $ffff ;FINDV fe/afdd dd2 donothingRTS & $ffff ;FSCV fe/afdf dd2 donothingRTS & $ffff ;EVNTV fe/afe1 dd2 donothingRTS & $ffff ;UPTV fe/afe3 dd2 donothingRTS & $ffff ;NETV fe/afe5 dd2 donothingRTS & $ffff ;VDUV fe/afe7 dd2 $0000 ;KEYV - QRY assume this gets set up by KEYBOARD module? fe/afe9 dd2 defaultINSV & $ffff ;ISNV fe/afeb dd2 defaultREMV & $ffff ;REMV fe/afed dd2 defaultCNPV & $ffff ;CNPV fe/afef dd2 donothingRTS & $ffff ;IND1V fe/aff1 dd2 donothingRTS & $ffff ;IND2V fe/aff3 dd2 donothingRTS & $ffff ;IND3V fe/aff5 dd2 SYSVARS-112 ;&236 - address of OS vars (A6) fe/aff7 dd2 $0d9f ;&238 - address of vector table QRY fe/aff9 dd2 $a5a0 ;&23A - address of ROM info table QRY fe/affb dd2 $0000 ;&23C - address of key translation table QRY fe/affd dd2 $0000 ;&23E - address of VDU variables QRY fe/afff dd1 $00 fe/b000 dd1 $00 fe/b001 dd1 $ff fe/b002 fill 8,$00 fe/b00a dd1 $ff fe/b00b dd1 $04 fe/b00c dd1 $04 fe/b00d dd1 $00 fe/b00e dd1 $ff fe/b00f dd1 $00 fe/b010 dd1 $19 fe/b011 dd1 $19 fe/b012 dd1 $19 fe/b013 dd1 $32 fe/b014 dd1 $08 fe/b015 fill 5,$00 fe/b01a dd1 $ff fe/b01b fill 5,$00 fe/b020 dd1 $50 fe/b021 dd1 $00 fe/b022 dd1 $03 fe/b023 dd1 $90 fe/b024 dd1 $64 fe/b025 dd1 $06 fe/b026 dd1 $81 fe/b027 dd1 $00 fe/b028 dd1 $00 fe/b029 dd1 $00 fe/b02a dd1 $00 fe/b02b dd1 $1b fe/b02c dd1 $01 fe/b02d dd1 $d0 fe/b02e dd1 $e0 fe/b02f dd1 $f0 fe/b030 dd1 $01 fe/b031 dd1 $80 fe/b032 dd1 $90 fe/b033 dd1 $00 fe/b034 dd1 $00 fe/b035 dd1 $00 fe/b036 dd1 $ff fe/b037 dd1 $ff fe/b038 dd1 $ff fe/b039 fill 9,$00 fe/b042 dd1 $05 fe/b043 dd1 $ff fe/b044 dd1 $00 fe/b045 dd1 $0a fe/b046 fill 5,$00 fe/b04b dd1 $ff fe/b04c dd1 $ea fe/b04d dd1 $4f fe/b04e dd1 $b0 fe/b04f Serv2_RESET sei fe/b050 clc fe/b051 xce ;Enter native mode fe/b052 ldal $400000 ;Disable boot rom mapping QRY fe/b056 sei fe/b057 clc fe/b058 xce ;re-enter naitve mode WHY? fe/b059 rep #$38 ;16 bits and clear decimal flag rwid longm,longx fe/b05b sep #$20 rwid shortm fe/b05d lda #$10 ;Clear Screen interrupt if fe/b05f stal shiela_ULA_MISC fe/b063 rep #$20 rwid longm fe/b065 lda #$0ff0 ;palette to white on blue QRY? fe/b068 stal sheila_ULA_PAL fe/b06c stal sheila_ULA_PAL+2 fe/b070 stal sheila_ULA_PAL+4 fe/b074 stal sheila_ULA_PAL+6 fe/b078 lda #BANK0_MEM_IRQ6502 fe/b07b stal f:BANK0_HW_IRQ6502 fe/b07f stal BANK0_HW_IRQ6502_SHAD1M fe/b083 lda #BANK0_HW_IRQ6502 fe/b086 stal f:BANK0_HW_NMI816 fe/b08a stal BANK0_HW_NMI816_SHAD1M fe/b08e lda #STACKTOP_RESET ;we need a temporary stack for the next instructions fe/b091 tcs fe/b092 phk dbank K (auto) fe/b093 plb fe/b094 bpl @runninglow ;if running from bank 0/low memory skip ahead, else vector through FFFFF0 ; QRY - not sure what happens here, does the jml somehow do memory mapping or ; does the 440000 load? fe/b096 jml $fffff0 ;Not sure what this will do looks to jump into padding at end of Calculator if rom1 is at top of address space!?! QRY fe/b09a @runninglow ldal $440000 ;we're not sure why it does a read here QRY QRYMAME fe/b09e lda #STACKTOP_SYS_QRY fe/b0a1 tcs ;set system stack fe/b0a2 lda #DPLOC_SYS fe/b0a5 tcd ;set system DP fe/b0a6 lda #B0LST_MODULES_QRY ;empty modules list fe/b0a9 stal f:B0LST_MODULES_QRY fe/b0ad lda #$fdfe fe/b0b0 stal f:B0LST_OPEN_FILES fe/b0b4 lda #$0000 fe/b0b7 stal f:$00fe12 fe/b0bb jsr initialize_default_vectors_QRY fe/b0be sep #$30 rwid shortm,shortx fe/b0c0 jsr LFECF59 fe/b0c3 jsr LFECDB5 fe/b0c6 jsr LFED2B8 fe/b0c9 jsr allocWorkspacesQry fe/b0cc jsr doTDCbadly ;TODO: remove altogether fe/b0cf jsr setupIRQstackandhandlers fe/b0d2 phk fe/b0d3 jsr LFEEE48 fe/b0d6 rep #$30 rwid longm,longx fe/b0d8 jsr LFEFE0A fe/b0db sep #$30 rwid shortm,shortx fe/b0dd pea $0000 fe/b0e0 plb fe/b0e1 plb fe/b0e2 jsr LFEB3EB fe/b0e5 jsr LFEB400 fe/b0e8 jsr resIrqLastBreak fe/b0eb jsr LFEB4B8 fe/b0ee lda #$80 fe/b0f0 sta $a58e fe/b0f3 stx $a584 fe/b0f6 phd fe/b0f7 pea $ff00 fe/b0fa pld fe/b0fb lda #$70 fe/b0fd sta DPCOP_K fe/b0ff lda #$e8 fe/b101 sta $0e fe/b103 phk fe/b104 pla fe/b105 sta $0f fe/b107 pld fe/b108 pea $0000 fe/b10b plb dbank $00 fe/b10c plb fe/b10d lda #$f8 fe/b10f sta SYSVAR_OSBYTE_255_STARTUP fe/b112 ldx #$90 fe/b114 ldy #$8d fe/b116 lda #$01 fe/b118 sta SYSVARS_8d_lastbreak fe/b11b clv fe/b11c clc fe/b11d php fe/b11e jsr initSYSVARS fe/b121 jsr LFEB407 fe/b124 ldx #$02 fe/b126 phk fe/b127 jsr callModVDU fe/b12a lda SYSVAR_OSBYTE_255_STARTUP fe/b12d ldx #$36 fe/b12f phk fe/b130 jsr callModVDU fe/b133 ora #$c4 fe/b135 sta SYSVARS_ULA_MISC_COPY fe/b138 stal shiela_ULA_MISC fe/b13c stal sheila_ULA_CASSH fe/b140 lda #$0c ;enable display end and RTC interrupts fe/b142 sta SYSVAR_IRQCTL_COPY & $ffff fe/b145 stal sheila_ULA_IRQ_CTL fe/b149 lda #$88 ;rom page enable, NMI clear 6502 trumps NMI QRY fe/b14b stal sheila_ULA_PAG_IRQCLR fe/b14f jsr OSBYTE_74 fe/b152 jsr LFEB46F fe/b155 jsr LFEB440 fe/b158 jsr OSBYTE_12 fe/b15b cop COP_26_OPBHA ;Set BHA to start of following string and skip fe/b15d zstr “KEYBOARD” fe/b166 ldx #<DPSYS_DP_KEYBOARD ;offset in DP fe/b168 ldy #$00 ;must be 0? fe/b16a cop COP_29_OPRFR ;Get reference to KEYBOARD module in dp at offset C7 fe/b16c bcc @keyboard_found fe/b16e cop COP_0F_OPERR ;throw an error fe/b170 zstr “Cannot find KEYBOARD module” fe/b18c @keyboard_found ldx #$02 fe/b18e jsl LOWCALL__KB fe/b192 lda #$31 fe/b194 ldx #$18 fe/b196 jsl __KB fe/b19a phk dbank K (auto) fe/b19b plb fe/b19c lda #$16 ;22 - VDU set mode fe/b19e cop COP_00_OPWRC fe/b1a0 ldal f:SYSVAR_OSBYTE_255_STARTUP fe/b1a4 cop COP_00_OPWRC fe/b1a6 jsr LFEEE46 fe/b1a9 phb fe/b1aa cop COP_01_OPWRS ;write immed fe/b1ac zstr $0a,“Acorn Communicator ” fe/b1c1 ldy #MM_HANDLE_1_SPECIAL_QRY fe/b1c3 ldx #MMLEN fe/b1c5 jsl LOWCALL__MM fe/b1c9 phb fe/b1ca pla fe/b1cb xba fe/b1cc rep #$30 rwid longm,longx fe/b1ce lsr A fe/b1cf lsr A fe/b1d0 clc fe/b1d1 adc #$0028 fe/b1d4 pha fe/b1d5 pea $4600 fe/b1d8 plb fe/b1d9 plb fe/b1da lda $2000 fe/b1dd eor #$0080 fe/b1e0 ldx a:$0000 fe/b1e3 sta a:$0000 fe/b1e6 eor $2000 fe/b1e9 stx a:$0000 fe/b1ec beq LFEB1F1 fe/b1ee lda #$0018 fe/b1f1 LFEB1F1 adc $01,S fe/b1f3 plx fe/b1f4 jsr LFEB382 fe/b1f7 sep #$30 rwid shortm,shortx fe/b1f9 cop COP_01_OPWRS fe/b1fb zstr “K”,$0d,$0a,$0a fe/b200 plb fe/b201 bra LFEB203 fe/b203 LFEB203 phk dbank K (auto) fe/b204 plb fe/b205 ldx #$00 fe/b207 bra @lpstart fe/b209 @lp txa fe/b20a adc #$03 fe/b20c tax fe/b20d @lpstart lda tblQRY & $ffff,x fe/b210 beq LFEB217 fe/b212 jsr call_KB_10 fe/b215 bcc @lp fe/b217 LFEB217 phx fe/b218 ldx #$18 fe/b21a jsl __KB fe/b21e plx fe/b21f lda 0+(tblQRY & $ffff)+1,x fe/b222 beq LFEB231 fe/b224 phx fe/b225 ldx #$02 fe/b227 cop COP_28_OPCMD fe/b229 zstr “ECONET” fe/b230 plx fe/b231 LFEB231 lda 0+(tblQRY & $ffff)+2,x fe/b234 bne LFEB25A fe/b236 cop COP_26_OPBHA fe/b238 zstr “MENU” fe/b23d ldy #$00 fe/b23f rep #$30 rwid longm,longx fe/b241 phk fe/b242 jsr brlFindModule fe/b245 sep #$30 rwid shortm,shortx fe/b247 bcs @nomenu fe/b249 rep #$30 rwid longm,longx fe/b24b phk fe/b24c jsr brlGetOrCreateModCallBlock fe/b24f sep #$30 rwid shortm,shortx fe/b251 pea $0000 fe/b254 plb fe/b255 plb fe/b256 bcc LFEB2B3 fe/b258 @nomenu lda #$01 fe/b25a LFEB25A cmp #$01 fe/b25c beq LFEB2A4 fe/b25e lda #$d3 fe/b260 jsr call_KB_10 fe/b263 bcc LFEB2A4 fe/b265 cop COP_26_OPBHA fe/b267 zstr “RAMinitialise”,$0d fe/b276 cop COP_0E_OPCOM fe/b278 cop COP_01_OPWRS fe/b27a zstr “CMOS MEMORY INITIALISED - NOW REBOOT”,$0d,$0a,$0a fe/b2a2 LFEB2A2 bra LFEB2A2 fe/b2a4 LFEB2A4 cop COP_26_OPBHA fe/b2a6 zstr “BASIC” fe/b2ac ldx #$00 fe/b2ae txy fe/b2af cop COP_34_OPRMI fe/b2b1 LFEB2B1 bcs LFEB2B1 fe/b2b3 LFEB2B3 phb fe/b2b4 xba fe/b2b5 pha fe/b2b6 xba fe/b2b7 pha fe/b2b8 pea $0200 fe/b2bb pld fe/b2bc ldx #$02 fe/b2be jsl __CO fe/b2c2 bcc LFEB2DE fe/b2c4 brk $00 fe/b2c6 zstr “Cannot start BASIC/MENU” fe/b2de LFEB2DE pla fe/b2df xba fe/b2e0 pla fe/b2e1 xba fe/b2e2 plb fe/b2e3 ldx #$02 fe/b2e5 jsr LFEDC35 fe/b2e8 HERE_SPIN bra HERE_SPIN fe/b2ea tblQRY dd1 $b1 fe/b2eb dd1 $ff fe/b2ec dd1 $01 fe/b2ed dd1 $e8 fe/b2ee dd1 $ff fe/b2ef dd1 $02 fe/b2f0 dd1 $00 fe/b2f1 dd1 $ff fe/b2f2 dd1 $00 fe/b2f3 call_KB_10 phx fe/b2f4 ldx #$10 fe/b2f6 jsl __KB fe/b2fa plx fe/b2fb rts fe/b2fc allocWorkspacesQry php fe/b2fd phd fe/b2fe phb fe/b2ff rep #$30 rwid longm,longx fe/b301 lda #$0100 fe/b304 ldx #__MMAZB fe/b307 jsl __MM fe/b30b bcc skAllocWorkspacesOK fe/b30d cop0FAllocMemory cop COP_0F_OPERR fe/b30f zstr “MOS couldn't allocate memory” fe/b32c skAllocWorkspacesOK pea EXSYS fe/b32f pld fe/b330 pha fe/b331 phb fe/b332 phb fe/b333 lda #$00e0 fe/b336 sta <MM_HANDLE_TAB fe/b338 phd fe/b339 ldx #MMLEN fe/b33c jsl __MM fe/b340 pld fe/b341 plx fe/b342 stx <EXSYS_FpHandles+1 fe/b344 plx fe/b345 stx <EXSYS_FpHandles fe/b347 sta [<EXSYS_FpHandles] fe/b349 tay fe/b34a lda #$0000 fe/b34d dey fe/b34e dey fe/b34f @cllp sta [<EXSYS_FpHandles],y fe/b351 dey fe/b352 dey fe/b353 bne @cllp fe/b355 ldal f:$00fe04 fe/b359 ldy #$0002 fe/b35c sta [<EXSYS_FpHandles],y fe/b35e ldx #$0010 fe/b361 ldy #$0005 fe/b364 jsl __MM fe/b368 tcd fe/b369 ldx #$000e fe/b36c ldy #$0005 fe/b36f jsl __MM fe/b373 bcs cop0FAllocMemory fe/b375 ldx #$0004 fe/b378 jsl __MM fe/b37c bcs cop0FAllocMemory fe/b37e plb fe/b37f pld fe/b380 plp fe/b381 rts fe/b382 LFEB382 ldx #$0064 fe/b385 jsr LFEB391 fe/b388 ldx #$000a fe/b38b jsr LFEB391 fe/b38e ldx #$0001 fe/b391 LFEB391 phx fe/b392 ldx #$ffff fe/b395 LFEB395 inx fe/b396 sec fe/b397 sbc $01,S fe/b399 bcs LFEB395 fe/b39b adc $01,S fe/b39d pha fe/b39e txa fe/b39f ora #$0030 fe/b3a2 cop COP_00_OPWRC fe/b3a4 pla fe/b3a5 plx fe/b3a6 rts ; TODO: this looks like a load of nonsense? could be replaced with a TDC? rwid shortm,shortx fe/b3a7 doTDCbadly php fe/b3a8 phb fe/b3a9 phk dbank K (auto) fe/b3aa plb fe/b3ab phd fe/b3ac tdc fe/b3ad rep #$30 rwid longm,longx fe/b3af pld fe/b3b0 plb fe/b3b1 plp rwid shortm,shortx fe/b3b2 rts rwid longm,longx fe/b3b3 makeCallBackBlockHnd4 phx fe/b3b4 pld ;set DP to X fe/b3b5 pha fe/b3b6 lda #HND_type_4_CBSIND fe/b3b9 jsr allocB0B fe/b3bc bcs LFEB3E9 fe/b3be lda templateModCallBack2 & $ffff fe/b3c1 stal f:bob_ll_irq_pri__next,x fe/b3c5 lda 0+(templateModCallBack2 & $ffff)+5 fe/b3c8 stal f:$000005,x fe/b3cc lda $01 fe/b3ce stal f:$000002,x fe/b3d2 lda $02 fe/b3d4 stal f:$000003,x fe/b3d8 stz $02 fe/b3da stx $01 fe/b3dc pla fe/b3dd stal f:$000008,x fe/b3e1 rts rwid shortm,shortx fe/b3e2 templateModCallBack2 phd fe/b3e3 jsl bob_ll_irq_pri__next fe/b3e7 pld fe/b3e8 rtl rwid longm,longx fe/b3e9 LFEB3E9 bra LFEB3E9 rwid shortm,shortx fe/b3eb LFEB3EB lda #$53 fe/b3ed stal $400006 fe/b3f1 stal $400006 fe/b3f5 lda #$00 fe/b3f7 stal $400004 fe/b3fb stal $400002 fe/b3ff rts fe/b400 LFEB400 lda #$03 fe/b402 stal $430000 fe/b406 rts fe/b407 LFEB407 lda #$00 fe/b409 ldx #$cf fe/b40b LFEB40B sta bob_ll_irq_pri__next,x fe/b40d inx fe/b40e bne LFEB40B fe/b410 rts fe/b411 initSYSVARS phb fe/b412 phk dbank K (auto) fe/b413 plb fe/b414 lda #$00 fe/b416 @blanklp cpx #$c3 fe/b418 bcc @sk1 fe/b41a lda #$ff fe/b41c @sk1 stal f:SYSVARS,x fe/b420 inx fe/b421 bne @blanklp fe/b423 tyx fe/b424 @cpylp lda 0+(tblInitSysVars & $ffff)-1,x fe/b427 stal f:SYSVARS-1,x fe/b42b dex fe/b42c bne @cpylp fe/b42e plb fe/b42f rts fe/b430 resIrqLastBreak lda #$00 fe/b432 stal sheila_ULA_IRQ_CTL fe/b436 sta SYSVARS_8d_lastbreak fe/b439 lda #$f8 fe/b43b stal sheila_ULA_PAG_IRQCLR fe/b43f rts fe/b440 LFEB440 ldal HW_TYPE_DETECT_QRY fe/b444 beq LFEB46E fe/b446 ldal VIA_ORB fe/b44a and #$df fe/b44c stal VIA_ORB fe/b450 ldal $459fff fe/b454 and #$0f fe/b456 sta $cf fe/b458 ldal $45bfff fe/b45c asl A fe/b45d asl A fe/b45e asl A fe/b45f asl A fe/b460 ora $cf fe/b462 sta $cf fe/b464 ldal VIA_ORB fe/b468 ora #$20 fe/b46a stal VIA_ORB fe/b46e LFEB46E rts fe/b46f LFEB46F lda #$90 fe/b471 stal VIA_IER fe/b475 lda #$00 fe/b477 stal VIA_ORA fe/b47b lda #$ff fe/b47d stal VIA_DDRA fe/b481 lda #$6e fe/b483 stal VIA_ORB fe/b487 ldal HW_TYPE_DETECT_QRY fe/b48b bne LFEB491 fe/b48d lda #$66 fe/b48f bra LFEB493 fe/b491 LFEB491 lda #$f6 fe/b493 LFEB493 stal VIA_DDRB fe/b497 lda #$29 fe/b499 stal VIA_PCR fe/b49d lda #$a1 fe/b49f stal VIA_T1C_L fe/b4a3 stal VIA_T1L_L fe/b4a7 lda #$01 fe/b4a9 stal VIA_T1C_H fe/b4ad stal VIA_T1L_H fe/b4b1 lda #$40 fe/b4b3 stal VIA_ACR fe/b4b7 rts fe/b4b8 LFEB4B8 phd fe/b4b9 phb fe/b4ba cop COP_26_OPBHA fe/b4bc zstr “RAMstart”,$0d fe/b4c6 cop COP_0E_OPCOM fe/b4c8 plb fe/b4c9 pld fe/b4ca rts ; moves program bytes from this rom to bank 0 ; ; number of bytes must be even and contained in HA rwid longm,longx fe/b4cb movPrg2B0 phk dbank K (auto) fe/b4cc plb fe/b4cd @lp dec A fe/b4ce dec A fe/b4cf bmi @ex fe/b4d1 pha fe/b4d2 lda $0000,y fe/b4d5 stal f:bob_ll_irq_pri__next,x fe/b4d9 pla fe/b4da inx fe/b4db inx fe/b4dc iny fe/b4dd iny fe/b4de bra @lp fe/b4e0 @ex rts fe/b4e1 initialize_default_vectors_QRY php fe/b4e2 sei fe/b4e3 rep #$30 fe/b4e5 ldy #tblDefaultRoutines & $ffff fe/b4e8 ldx #tblB0JumpTableFE80_QRY fe/b4eb lda #$0034 fe/b4ee jsr movPrg2B0 fe/b4f1 sep #$20 ; Resets all the jml bank addresses to point to current ROM rwid shortm fe/b4f3 phk fe/b4f4 pla fe/b4f5 ldx #$0033 fe/b4f8 @lp0 stal f:LFE80,x fe/b4fc dex fe/b4fd dex fe/b4fe dex fe/b4ff dex fe/b500 bpl @lp0 fe/b502 rep #$20 rwid longm fe/b504 ldy #tblDefaultRoutines2Pre & $ffff fe/b507 ldx #tblB0JumpTableFF80_QRY fe/b50a lda #$0034 fe/b50d jsr movPrg2B0 fe/b510 ldy #tblDefaultHwJml & $ffff fe/b513 ldx #tblB0JumpTableFEE0_QRY fe/b516 lda #$0020 fe/b519 jsr movPrg2B0 fe/b51c sep #$20 ; Resets all the jml bank addresses to point to current ROM rwid shortm fe/b51e phk fe/b51f pla ;this ROM's bank fe/b520 ldx #$001f fe/b523 LFEB523 stal f:LFEE0,x fe/b527 dex fe/b528 dex fe/b529 dex fe/b52a dex fe/b52b bpl LFEB523 fe/b52d rep #$20 rwid longm fe/b52f ldy #tblHWVectors & $ffff fe/b532 ldx #BANK0_HW_VECTORS fe/b535 lda #$0020 fe/b538 jsr movPrg2B0 fe/b53b plp fe/b53c rts ******************************************************************************** * ; Note: the following table is copied to bank 0 at fe80 and then all the * * bank addresses are tweaked to point back at this ROM * * * * TODO: tidy the arithmetic below to & 0x00FFFF * ******************************************************************************** fe/b53d addrs $fe80 rwid shortm,shortx 00/fe80 LFE80 jml default__TB-$fe0000 00/fe84 LFE84 jml default__LN-$fe0000 00/fe88 LFE88 jml default__ST-$fe0000 00/fe8c LFE8C jml default__MM-$fe0000 00/fe90 LFE90 jml default__CO-$fe0000 00/fe94 LFE94 jml default__CCO-$fe0000 00/fe98 LFE98 jml default__CWT-$fe0000 00/fe9c LFE9C jml default__CRS-$fe0000 00/fea0 LFEA0 jml default__OSB-$fe0000 00/fea4 LFEA4 jml default__OSW-$fe0000 00/fea8 LFEA8 jml default__VDU-$fe0000 00/feac LFEAC jml default__KB-$fe0000 00/feb0 LFEB0 jml default__EV-$fe0000 adrend ↑ $fe80 ******************************************************************************** * BRL's to the jump table above for "well known" entry points * * * * QRY not clear why this double indirection is needed? * ******************************************************************************** fe/b571 addrs *-$fdb5f1 00/ff80 __TB brl LFE80 00/ff83 nop 00/ff84 __LN brl LFE84 00/ff87 nop 00/ff88 __ST brl LFE88 00/ff8b nop 00/ff8c __MM brl LFE8C 00/ff8f nop 00/ff90 __CO brl LFE90 00/ff93 nop 00/ff94 __CCO brl LFE94 00/ff97 nop 00/ff98 __CWT brl LFE98 00/ff9b nop 00/ff9c __CRS brl LFE9C 00/ff9f nop 00/ffa0 __OSB brl LFEA0 00/ffa3 nop 00/ffa4 OSW brl LFEA4 00/ffa7 nop 00/ffa8 __VDU brl LFEA8 00/ffab nop 00/ffac __KB brl LFEAC 00/ffaf nop 00/ffb0 __EV brl LFEB0 00/ffb3 nop adrend ↑ $ff80 ; ZXXXXXXX fe/b5a5 addrs $fee0 00/fee0 LFEE0 jml tblDefaultHwJml-$fe0000 00/fee4 jml tblDefaultHwJml-$fdfffc ;TODO - fix this up to reference self &FFFF 00/fee8 hwjmpvecCOP jml default_IVCOP-$fe0000 ;COP 00/feec hwjmpvecBRK jml default_IVBRK-$fe0000 ;BRK 00/fef0 hwjmpvecABORT jml Serv2_RESET-$fe0000 ;ABORT - causes a RESET 00/fef4 hwjmpvecNMI jml default_IVNMI-$fe0000 ;NMI 00/fef8 hwjmpvecRESET jml Serv2_RESET-$fe0000 ;RESET 00/fefc hwjmpvecIRQ jml default_IVIRQ-$fe0000 ;IRQ adrend ↑ $fee0 fe/b5c5 default_IVNMI rti fe/b5c6 tblHWVectors dd2 $0000 fe/b5c8 dd2 $0000 fe/b5ca dd2 hwjmpvecCOP fe/b5cc dd2 hwjmpvecBRK fe/b5ce dd2 hwjmpvecABORT fe/b5d0 dd2 hwjmpvecNMI fe/b5d2 dd2 hwjmpvecRESET fe/b5d4 dd2 hwjmpvecIRQ fe/b5d6 dd2 $0000 fe/b5d8 dd2 $0000 fe/b5da dd2 $0000 fe/b5dc dd2 $0000 fe/b5de dd2 hwjmpvecABORT fe/b5e0 dd2 hwjmpvecNMI fe/b5e2 dd2 hwjmpvecRESET fe/b5e4 dd2 $ff00 fe/b5e6 default__TB cop COP_0F_OPERR fe/b5e8 zstr “FC interface not supported” fe/b603 default__VDU rtl ******************************************************************************** * LN - ???? * * * * QRY this is a "well known" entry point at 00/FF84 * * * * op 0 calls __ST/0 (get string pointer to "SYSTEM") * * op 2 calls the CLI vector * ******************************************************************************** fe/b604 default__LN php fe/b605 rep #$30 rwid longm,longx fe/b607 cpx #$0004 fe/b60a bcs @retsec fe/b60c phd fe/b60d phb fe/b60e pea DPSYS fe/b611 pld fe/b612 sep #$30 rwid shortm,shortx fe/b614 jsr (tblLnFunctions,x) fe/b617 plb fe/b618 pld fe/b619 bcs @retsec fe/b61b plp fe/b61c clc fe/b61d rtl fe/b61e @retsec plp fe/b61f sec fe/b620 rtl fe/b621 tblLnFunctions dd2 __ST_0 & $ffff ;0 - do __ST_0 fe/b623 dd2 doLNCLI & $ffff ;2 - __LNCLI ******************************************************************************** * __ST operation 0 * * * * return long pointer BHA to string "SYSTEM" * ******************************************************************************** fe/b625 __ST_0 rep #$30 rwid longm,longx fe/b627 phk dbank K (auto) fe/b628 plb fe/b629 lda #strSYSTEM & $ffff fe/b62c rts fe/b62d strSYSTEM zstr “SYSTEM” ******************************************************************************** * Main BRK handler - saves the registers on the stack and passes control to * * the coroutine BRK handler * ******************************************************************************** rwid shortm,shortx fe/b634 default_IVBRK cld fe/b635 rep #$30 rwid longm,longx fe/b637 phd fe/b638 phb fe/b639 pha fe/b63a phx fe/b63b phy ; stack/DP contains ; +D K ; +B PC ; +A FLAGS ; +8 DP ; +7 B ; +5 HA ; +3 X ; +1 Y fe/b63c tsc fe/b63d tcd fe/b63e lda $0c fe/b640 stal f:EXSYS_0D_BRKADDR_SAVE+1 ;store 24 bit pointer to byte after the BRK instruction fe/b644 lda $0b fe/b646 dec A fe/b647 stal f:EXSYS_0D_BRKADDR_SAVE fe/b64b ldx #$003c ;TODO: what VDU function? fe/b64e phk fe/b64f jsr callModVDU fe/b652 jmp coHandleBRK ******************************************************************************** * The COP handler * ******************************************************************************** rwid shortm,shortx fe/b655 default_IVCOP plp fe/b656 php ;Not sure what this sequence is for, reestablish caller's SEI or SED flags - seems dodgy fe/b657 rep #$38 rwid longm,longx fe/b659 phd ;8 fe/b65a phb ;7 fe/b65b pha ;5 fe/b65c phx ;3 fe/b65d phy ;1 fe/b65e tsc ; at this point D and S point to the stack ; ; +13 PBR ; +11 PC ; +10 P ; +8 DP ; +7 B ; +5 A ; +3 X ; +1 Y fe/b65f tcd fe/b660 dec bob_ll_irq_sec__type ;decrement 16 bit return pointer to point at the signature byte fe/b662 lda [bob_ll_irq_sec__type] ;get signature byte fe/b664 asl A ;multiply by 2 to get index fe/b665 and #$00ff ;mask off whatever we fetched in high byte fe/b668 cmp #$00c4 ;compare to C4 - 2*$62 fe/b66b bcs @handlege62 ;jump forward for high COPs fe/b66d @dispatch tax ;transfer index to X fe/b66e lda bob_ll_irq_pri__mand ;restore A from stack fe/b670 phk ; The callee stack will now look like this: ; ; +16 PBR ; +14 PC ; +13 P ; +11 DP ; +10 B ; +8 A ; +6 X ; +4 Y ; +1 FE/B673 - return address of COP dispatcher ; ; The DP register will point at byte below Y ; ; +13 PBR ; +11 PC ; +10 P ; +8 DP ; +7 B ; +5 A ; +3 X ; +1 Y fe/b671 jsr (tblCOPDispatch,x) ;long jump to handler in dispatch table fe/b674 @ret rep #$30 fe/b676 ply ;restore all regs except plp fe/b677 plx fe/b678 pla fe/b679 plb fe/b67a pld fe/b67b bcs @retSEC ;check for CS and jump forward for return with CS fe/b67d plp rwid shortm,shortx fe/b67e clc fe/b67f rtl rwid longm,longx fe/b680 @retSEC plp rwid shortm,shortx fe/b681 sec fe/b682 rtl rwid longm,longx fe/b683 @ret_unimplemented stz bob_ll_irq_sec__flags ;clear saved X fe/b685 sec ;return error fe/b686 bra @ret fe/b688 @handlege62 cmp #$00e0 fe/b68b bcc @ret_unimplemented ;less than E0 - i.e COP 31..6F fe/b68d lda [bob_ll_irq_sec__type] ;get cop number as 16 bits (will be nn7x) fe/b68f inc bob_ll_irq_sec__type ;step return address past it fe/b691 xba ;swap byte order will now be somethig like 7xnn fe/b692 asl A ;now Exnn or Fxnn fe/b693 cmp #$e000 fe/b696 bcs @ret_unimplemented ;QRY - this looks like a bug? they must all surely be >= e000?!?! fe/b698 sbc #$df3b ;subtract df3e to put in range fe/b69b bra @dispatch fe/b69d tblCOPDispatch dd2 COP_00 & $ffff ;OPWRC 00 = OSWRCH fe/b69f dd2 COP_01 & $ffff ;OPWRS 01 = Write String Immediate fe/b6a1 dd2 COP_02 & $ffff ;OPWRA 02 = Write string at BHA fe/b6a3 dd2 COP_03 & $ffff ;OPNLI 03 = OSNEWL - write CR/LF fe/b6a5 dd2 COP_04 & $ffff ;OPRDC 04 = read character fe/b6a7 dd2 COP_05 & $ffff ;OPCLI 05 = OSCLI = execute command fe/b6a9 dd2 COP_06 & $ffff ;OPOSB 06 - OSBYTE fe/b6ab dd2 COP_07 & $ffff ;OPOSW 07 - OSWORD fe/b6ad dd2 copBadCOP & $ffff fe/b6af dd2 copBadCOP & $ffff fe/b6b1 dd2 COP_0A & $ffff ;OPBGT 0A - BGET fe/b6b3 dd2 COP_0B & $ffff ;OPBPT 0B - BPUT fe/b6b5 dd2 copBadCOP & $ffff fe/b6b7 dd2 COP_0D & $ffff ;???? 0D - Throws a not implemented error fe/b6b9 dd2 COP_OE & $ffff ;OPCOM 0E - OSCLI with string in BHA fe/b6bb dd2 COP_0F & $ffff ;OPERR 0E - Raise an error fe/b6bd dd2 COP_10 & $ffff ;OPADP 10 - Allocate direct page fe/b6bf dd2 COP_10 & $ffff ;OPADF 11 - Allocate direct page - supposed to be fast but isnt...or is it? fe/b6c1 dd2 COP_12 & $ffff ;OPFD 12 - QRY not in docco fe/b6c3 dd2 COP_13 & $ffff ;OPAST 13 - Allocate Stack fe/b6c5 dd2 COP_14 & $ffff ;OPFST 14 - Free Stack fe/b6c7 dd2 COP_15 & $ffff ;OPASC 15 - Write ASCII convert <CR> to <CR><LF> fe/b6c9 dd2 COP_16 & $ffff ;OPAEV 16 - Acknowledge Event fe/b6cb dd2 COP_17 & $ffff ;OPBYX 17 - Convert BYXD to BHA fe/b6cd dd2 COP_18 & $ffff ;OPRLH 18 - Read hex number fe/b6cf dd2 COP_19 & $ffff ;OPRLS 19 - read literal string QRY not documented fe/b6d1 dd2 COP_1A & $ffff ;OPFZB 1A - free bank 0 memory fe/b6d3 dd2 COP_1B & $ffff ;OPARM 1B - call Arithmetic module fe/b6d5 dd2 COP_1C & $ffff ;OPSCX 1C - Save Context fe/b6d7 dd2 COP_1D & $ffff ;OPRCX 1D - Restore Context fe/b6d9 dd2 COP_1E & $ffff ;OPSSC 1E - Save the screen fe/b6db dd2 COP_1F & $ffff ;OPRSC 1F - Restore the screen fe/b6dd dd2 COP_20 & $ffff ;OPSEV 20 - QRY set even fe/b6df dd2 COP_21 & $ffff ;OPPRE 21 - Allow preemption fe/b6e1 dd2 COP_22 & $ffff ;OPRLN 22 - Read a line to buffer fe/b6e3 dd2 COP_23 & $ffff ;OPCVS 23 - Convert stack index fe/b6e5 dd2 COP_24 & $ffff ;OPCVD 24 - convert direct page index fe/b6e7 dd2 COP_25 & $ffff ;OPCRC 25 - superceded use OPSUM fe/b6e9 dd2 COP_26 & $ffff ;OPBHA 26 - Get BHA address of immediate string fe/b6eb dd2 COP_27 & $ffff ;OPREF 27 - ? fe/b6ed dd2 COP_28 & $ffff ;OPCMD 28 - call a module fe/b6ef dd2 COP_29 & $ffff ;OPRFR 29 - reference a module fe/b6f1 dd2 COP_2A & $ffff ;OPURF 2A - Unreference a module fe/b6f3 dd2 COP_2B & $ffff ;OPDIS 2B - ? fe/b6f5 dd2 COP_2C & $ffff ;OPFMA 2C - find module by address fe/b6f7 dd2 COP_2D & $ffff ;OPWRM 2D - write module name fe/b6f9 dd2 COP_2E & $ffff ;OPFPO 2E - find pool owner fe/b6fb dd2 COP_2F & $ffff ;OPIIQ 2F - intercept interrupt fe/b6fd dd2 COP_30 & $ffff ;OPRIQ 30 - release interrupt fe/b6ff dd2 COP_31 & $ffff ;OPMIQ 31 - modify interrupt fe/b701 dd2 COP_32 & $ffff ;OPSUM 32 - compute end around carry checksum fe/b703 dd2 COP_33 & $ffff ;OPSLM 33 - scan list of modules fe/b705 dd2 COP_34 & $ffff ;OPRMI 34 - read module info fe/b707 dd2 COP_35 & $ffff ;OPAM 35 - Add module fe/b709 dd2 COP_36 & $ffff ;OPNLU 36 - name lookup fe/b70b dd2 copBadCOP & $ffff ;37 fe/b70d dd2 COP_38 & $ffff ;OPAH 38 - allocate a 16 bit handle fe/b70f dd2 COP_39 & $ffff ;OPFH 39 - free handle fe/b711 dd2 COP_3A & $ffff ;OPCUH 3A - call device driver using handle fe/b713 dd2 copBadCOP & $ffff ;3B fe/b715 dd2 COP_3C & $ffff ;OPDTD 3C - ??? fe/b717 dd2 COP_3D & $ffff ;OPGSR 3D fe/b719 dd2 COP_3E & $ffff ;OPADY 3E - Add Y to BHA fe/b71b dd2 COP_3F & $ffff ;OPATR 3F - ??? fe/b71d dd2 COP_40 & $ffff ;OPFTR 40 - ??? fe/b71f dd2 COP_41 & $ffff ;OPECO 41 - call low-level Econet routines fe/b721 dd2 COP_42 & $ffff ;OPRHL 42 - ??? fe/b723 dd2 COP_43 & $ffff ;OPXKC 43 - Examine keyboard character fe/b725 dd2 COP_44 & $ffff ;OPOPN 44 - open device driver fe/b727 dd2 COP_45 & $ffff ;OPCLS 45 - close device driver fe/b729 dd2 COP_46 & $ffff ;OPEND 46 - test for EOF fe/b72b dd2 COP_47 & $ffff ;OPMM 47 - call memory management module fe/b72d dd2 COP_48 & $ffff ;OPVER 48 - return OS version number fe/b72f dd2 COP_49 & $ffff ;OPFSC 49 - free screen fe/b731 dd2 COP_4A & $ffff ;OPNET 4A - high level Econet routines fe/b733 dd2 COP_4B & $ffff ;OPVH 4B - validate handle fe/b735 dd2 COP_4C & $ffff ;OPBGB 4C - get a block of bytes from a file fe/b737 dd2 COP_4D & $ffff ;OPBPB 4D - put a block of bytes to a file fe/b739 dd2 COP_4E & $ffff ;OPLOD 4E - load file fe/b73b dd2 COP_4F & $ffff ;OPSAV 4F - save a file fe/b73d dd2 COP_50 & $ffff ;OPRLE 50 - read file load/exec/length fe/b73f dd2 COP_51 & $ffff ;OPWLE 51 - write file load/exec fe/b741 dd2 COP_52 & $ffff ;OPRAT 52 - read attributes fe/b743 dd2 COP_53 & $ffff ;OPWAT 53 - write file attributes fe/b745 dd2 COP_54 & $ffff ;OPRSP 54 - read sequential pointer fe/b747 dd2 COP_55 & $ffff ;OPWSP 55 - write sequential pointer fe/b749 dd2 COP_56 & $ffff ;OPRPL 56 - read physical length fe/b74b dd2 COP_57 & $ffff ;OPRLL 57 - read logical length fe/b74d dd2 COP_58 & $ffff ;OPWLL 58 - write logical length fe/b74f dd2 COP_59 & $ffff ;OPRCH 59 - read catalogue header information fe/b751 dd2 COP_5A & $ffff ;OPRFN 5A - read object file names from directory fe/b753 dd2 COP_5B & $ffff ;OPDEL 5B - delete a named object fe/b755 dd2 COP_5C & $ffff ;OPREN 5C - rename object fe/b757 dd2 COP_5D & $ffff ;OPSTAR 5D - execute star command and print error fe/b759 dd2 COP_5E & $ffff ;OPFCX 5E - free vdu context including fonts fe/b75b dd2 COP_5F & $ffff ;OPOSX 5F - call OSWORD with pointer in X QRY fe/b75d dd2 COP_60 & $ffff ;OPDFR 60 - ??? fe/b75f dd2 COP_61 & $ffff ;OPERC 61 - ???? error something ??? fe/b761 copBadCOP cop COP_0F_OPERR fe/b763 zstr “Bad COP - use new version” ******************************************************************************** * COP 48 - OPVER - return version number * * * * Action: Puts the operating system version in A * * * * On Entry: No requirements * * On Exit: A = version number * * DBXY preserved * * * * returns 1 in A * ******************************************************************************** fe/b77d COP_48 lda #$0001 fe/b780 sta bob_ll_irq_pri__mand ;this is the saved A register fe/b782 rtl ******************************************************************************** * COP 15 - OPASC - BBC OPASCI * * * * Action: Send the byte in A to the VDU drivers. If the byte is &0D (carriage * * return) then send &0A, &0D to the VDU drivers (line feed+ carriage return). * * * * On entry: A = character code. * * On exit: DBAXY preserved * ******************************************************************************** fe/b783 COP_15 and #$00ff fe/b786 cmp #$000d fe/b789 bne COP_00 ******************************************************************************** * COP 03 - OSNLI - BBC OSNEWL * * * * Action: Send LF CR to the VDU drivers. Line feed is ASCII 10 (decimal), * * carriage return is ASCII 13 (decimal). * * * * On entry: No requirement * * On exit: DBAXY preserved * ******************************************************************************** fe/b78b COP_03 lda #$000a fe/b78e phk fe/b78f jsr COP_00 fe/b792 lda #$000d ******************************************************************************** * COP 00 - OPWRC - Write Char in A * * * * Action: Send the byte in A to the VDU drivers. * * * * On entry: A = character code * * On exit: DBAXY preserved * * * ******************************************************************************** fe/b795 COP_00 ldx #$0004 fe/b798 phk fe/b799 jsr callModVDU fe/b79c rtl ******************************************************************************** * COP 1B - call the ARITHMETIC module * * * * On Entry: Reason code in X, arithmetic stack pointer in BHA * * * * On Exit: BHA updated * ******************************************************************************** fe/b79d COP_1B ldx bob_ll_irq_sec__flags fe/b79f phd fe/b7a0 cop COP_28_OPCMD fe/b7a2 zstr “ARITHMETIC” fe/b7ad pld fe/b7ae stx bob_ll_irq_sec__flags fe/b7b0 sta bob_ll_irq_pri__mand fe/b7b2 sep #$20 rwid shortm fe/b7b4 phb fe/b7b5 pla fe/b7b6 sta bob_ll_irq_pri__psec fe/b7b8 rtl ******************************************************************************** * COP 26 - OPBHA * * * * returns the immediate string following the COP call as BHA * ******************************************************************************** rwid longm fe/b7b9 COP_26 lda DPCOP_PC+1 fe/b7bb sta bob_ll_irq_pri__meor fe/b7bd lda bob_ll_irq_sec__type fe/b7bf inc A fe/b7c0 sta bob_ll_irq_pri__mand ; This skips over any string following the cop call fe/b7c2 @copExitImmedStr inc bob_ll_irq_sec__type fe/b7c4 lda [bob_ll_irq_sec__type] fe/b7c6 and #$00ff fe/b7c9 bne @copExitImmedStr fe/b7cb rtl fe/b7cc LFEB7CC lda #$0006 fe/b7cf ldx #$004e fe/b7d2 ldy #$0000 fe/b7d5 phk fe/b7d6 jsr callModVDU fe/b7d9 lda #$000c fe/b7dc ldx #$004e fe/b7df ldy #$0000 fe/b7e2 phk fe/b7e3 jsr callModVDU fe/b7e6 lda #$000a fe/b7e9 ldx #$004e fe/b7ec ldy #$0000 fe/b7ef phk fe/b7f0 jsr callModVDU fe/b7f3 rts ******************************************************************************** * COP 2B - OPDIS * * * * QRY * ******************************************************************************** fe/b7f4 COP_2B jsr LFEB7CC fe/b7f7 LFEB7F7 inc bob_ll_irq_sec__type fe/b7f9 lda [bob_ll_irq_sec__type] fe/b7fb and #$00ff fe/b7fe beq LFEB80C fe/b800 ldx #$004e fe/b803 ldy #$0000 fe/b806 phk fe/b807 jsr callModVDU fe/b80a bra LFEB7F7 fe/b80c LFEB80C rtl ******************************************************************************** * COP 01 - OPWRS - write string immediate * * * * read characters from bytes following cop, check for 0 and pass on to write * * character routine * ******************************************************************************** fe/b80d COP_01 inc bob_ll_irq_sec__type fe/b80f lda [bob_ll_irq_sec__type] fe/b811 and #$00ff fe/b814 beq @ret fe/b816 phk fe/b817 jsr COP_00 fe/b81a bra COP_01 fe/b81c @ret rtl ******************************************************************************** * COP 02 - OPWRA - write string at BHA * * * * TODO: DOCO: NOTE: This seems to imply that X is set to 0 for 0 terminated, 1 * * for control terminated string - not in systems manual * * * ******************************************************************************** fe/b81d COP_02 lda bob_ll_irq_sec__flags ;get passed X and check is < 2 and use to determine type of terminator fe/b81f lsr A fe/b820 cmp #$0002 fe/b823 bcc @skok fe/b825 brk $00 fe/b827 zstr “COP `OPWRA: invalid termination option” fe/b84e @skok tax fe/b84f ldy #$0000 fe/b852 @lp lda [bob_ll_irq_pri__mand],y ;use BHA at 05 as pointer fe/b854 and #$00ff fe/b857 beq @ret ;check for 0 terminator fe/b859 cpx #$0001 fe/b85c bne @sknocc ;if X<>1 skip forwards fe/b85e cmp #$0020 fe/b861 bcc @ret ;else exit on control character fe/b863 @sknocc phx fe/b864 phy fe/b865 phk fe/b866 jsr COP_00 fe/b869 ply fe/b86a plx fe/b86b iny fe/b86c bra @lp fe/b86e @ret rtl ******************************************************************************** * COP 04 - OPRDC - read a character from input * * * * No conditions * * * * On exit: * * if C = 0 then A contains the ASCII value of the character. * * if C = 1 then * * if HA = $1B (@SCESC) then the ESCAPE key was pressed * * if HA = $00 (@SCPRE) then the current task was pre-empted. * * * * DBXY preserved * ******************************************************************************** fe/b86f COP_04 phd fe/b870 pea $ac00 fe/b873 pld ;set DP = AC00 fe/b874 sep #$30 rwid shortm,shortx fe/b876 jsr int_OPRDC fe/b879 pld fe/b87a sta bob_ll_irq_pri__mand ;return in A, clear B fe/b87c stz bob_ll_irq_pri__meor fe/b87e rtl ******************************************************************************** * COP 5D - OPSTAR - execute command in BHA * * * * Action: QRY looks to call OPCOM and if there's an error prints the error * ******************************************************************************** rwid longm,longx fe/b87f COP_5D jsr doOPSTAR fe/b882 rtl ******************************************************************************** * COP 05 - OPCLI - execute command line * * * * Action: This call sends the address of a command line string to the * * operating system's command line interpreter. The string must be terminated * * by CR (ASCII &0D). * * On entry: either: BYX contains the absolute address of the start of the * * command line * * OR: Y is 0 and X contains an offset from the direct page register D. The * * start of the command line is in the direct page at address D+X. * * On exit: No registers preserved * ******************************************************************************** fe/b883 COP_05 jsr makeBXYptr ******************************************************************************** * COP 0E OPCOM - execute command at BHA * * * * Action: This call sends the address of a command line string to the * * operating system's command line interpreter. The string must be terminated * * by CR (ASCII &0D). * * On entry: BHA points to the start of the command * * On exit: No registers preserved * ******************************************************************************** fe/b886 COP_OE phd fe/b887 pea DPLOC_SYS fe/b88a pld fe/b88b jsr doLNCLI fe/b88e pld ;back to COP DP that points at user stack fe/b88f rep #$30 ;and update saved registers with results of OSCLI fe/b891 sta bob_ll_irq_pri__mand fe/b893 stx bob_ll_irq_sec__flags fe/b895 sty bob_ll_irq_sec__dp fe/b897 sep #$30 rwid shortm,shortx fe/b899 phb fe/b89a pla fe/b89b sta bob_ll_irq_pri__psec fe/b89d rtl ******************************************************************************** * COP 06 - OPOSB = OSBYTE * * * * This call caries out various operations, the specific operation depending on * * the contents of A on entry. Other data can be passed in X and Y. If results * * are generated, these are returned in X and Y. Only a very small subset of * * BBC OSBYTE calls is supported. * * On entry: A contains the reason code. The reason code determines the * * function of the call. * * * * On exit: X and Y will contain results if the call produces them. * * * * D preserved * ******************************************************************************** rwid longm,longx fe/b89e COP_06 phd fe/b89f ldx bob_ll_irq_sec__flags fe/b8a1 sep #$30 rwid shortm,shortx fe/b8a3 jsr doDispatchOSBYTE fe/b8a6 pld fe/b8a7 sep #$30 fe/b8a9 stx bob_ll_irq_sec__flags fe/b8ab stz bob_ll_irq_sec__fphand fe/b8ad copret8bitY sep #$30 fe/b8af sty bob_ll_irq_sec__dp fe/b8b1 stz bob_ll_irq_pri__irqf fe/b8b3 rtl ******************************************************************************** * COP 5F - OPOSX - QRY * * * * looks to call OSWORD but with a different pointer arrangement BYY? * ******************************************************************************** rwid longm,longx fe/b8b4 COP_5F phd fe/b8b5 pei (bob_ll_irq_sec__dp) fe/b8b7 bra LFEB8C1 ******************************************************************************** * COP 07 - OPOSW = OSWORD * * * * Action: This call caries out various operations, the specific operation * * depending on the contents of A on entry. BYX points to a control block in * * memory, and this block contains data for the call, and will contain results * * from the call. * * On entry: * * EITHER: BYX points to a control block in memory * * OR: Y = 0 and X contains an offset from the direct page register D. The * * start of the control block is in the direct page at address D+X. * * A contains the reason code. The reason code determines the function of the * * call. * * On exit: D preserved * * * * For OPOSW with A = 0 (read line from input) * * Y = line length (including CR if applicable). * * If C = 0 then CR termimated input. * * If C = 1 then ESCAPE terminated input * ******************************************************************************** fe/b8b9 COP_07 phd fe/b8ba ldx bob_ll_irq_sec__flags fe/b8bc jsr makeBXYptr ; The DP register will point at byte below Y BHA will have been rearranged if ; Y=0 so that BHA = 0/DP+X ; ; +13 PBR ; +11 PC ; +10 P ; +8 DP ; +7 B ; +5 A ; +3 X ; +1 Y fe/b8bf pei (DPCOP_AH) ;caller A fe/b8c1 LFEB8C1 pei (DPCOP_B-1) ;caller H,B fe/b8c3 pei (DPCOP_DP) ;caller DP fe/b8c5 pea DPSYS fe/b8c8 pld fe/b8c9 plx fe/b8ca stx <DPSYS_D6_OSW_DPSAV fe/b8cc sep #$30 rwid shortm,shortx fe/b8ce plx fe/b8cf plx fe/b8d0 stx DPSYS_D8_B_SAV ;caller's Bank fe/b8d2 rep #$30 rwid longm,longx fe/b8d4 plx ;caller's A (OSWORD number) fe/b8d5 sep #$30 rwid shortm,shortx fe/b8d7 jsr enterOSWORD_BHA fe/b8da rep #$30 rwid longm,longx fe/b8dc pld fe/b8dd bra copret8bitY ******************************************************************************** * COP 47 - OPMM - call the memory management routine * * * * Action: This calls the memory management routine. The reason code is passed * * in X, and the pool handle is passed in Y. All handles arc 16-bit. so calls * * to OPMM must be made in 16-bit XY mode. * * * * On entry: X = reason code. * * Y = pool handle. * * On exit: If C = 0 then the call succeeded. * * If C = I then the call failed. X = error code. BHA points to * * zero-terminated error message. * * D preserved * ******************************************************************************** fe/b8df COP_47 phd fe/b8e0 pei (bob_ll_irq_sec__flags) fe/b8e2 pei (DPCOP_DP) fe/b8e4 pld fe/b8e5 plx fe/b8e6 jsl __MM fe/b8ea pld fe/b8eb bcs LFEB8FC fe/b8ed sta bob_ll_irq_pri__mand fe/b8ef stx bob_ll_irq_sec__flags fe/b8f1 sty bob_ll_irq_sec__dp fe/b8f3 sep #$20 rwid shortm fe/b8f5 phb fe/b8f6 pla fe/b8f7 sta bob_ll_irq_pri__psec fe/b8f9 rep #$20 rwid longm fe/b8fb rtl fe/b8fc LFEB8FC cop COP_26_OPBHA fe/b8fe zstr “Memory call failed” fe/b911 ldx #$0001 fe/b914 sec fe/b915 rtl ******************************************************************************** * COP 0D - ERR not implemented * * * * Not implemented - throws an error * ******************************************************************************** fe/b916 COP_0D cop COP_0F_OPERR fe/b918 zstr “OPFND used - interface not longer valid” ******************************************************************************** * COP 17 - OPBYX * * * * Converts a BBC-type BYX pointer to a Communicator-type BHA pointer, ir Y is * * non-zero then YX Ls simply copied to HA. If Y is zero then X is taken as an * * ofTset from the direct page register D. BHA is calculated as the absolute * * value of this direct page address. * * * * Entry: * * BYX points to an address, or Y = 0 and XD points to a direct page * * address. * * Exit: * * BHA points to equivalent address. * * * * D preserved * ******************************************************************************** fe/b940 COP_17 jsr makeBXYptr fe/b943 sta bob_ll_irq_pri__mand ;store HA on stack frame at 05 fe/b945 sep #$30 rwid shortm,shortx fe/b947 phb fe/b948 pla fe/b949 sta bob_ll_irq_pri__psec ;store caller's B at 07 fe/b94b rtl ******************************************************************************** * either: BYX contains the absolute address * * OR: Y(16) = 0 and X contains an offset from the direct page register D. The * * pointer is D+X. * * * * This assumes a COP entry frame in DP * * * ******************************************************************************** rwid longm,longx fe/b94c makeBXYptr php fe/b94d sep #$30 rwid shortm,shortx fe/b94f tya ;A(8)=Y(8) fe/b950 xba ;put Y in H fe/b951 lda bob_ll_irq_sec__flags ;get X in A fe/b953 rep #$30 rwid longm,longx fe/b955 ldy bob_ll_irq_sec__dp ;check for 0 in Y fe/b957 bne @ret fe/b959 clc ;if Y is zero fe/b95a lda bob_ll_irq_sec__flags ;add original X to DP and set B=0 fe/b95c adc DPCOP_DP dbank $00 fe/b95e pea $0000 fe/b961 plb fe/b962 plb fe/b963 @ret plp fe/b964 rts ******************************************************************************** * COP 21 - OPPRE - allow preemption * * * * Action: This call is used lo allow pre-emption of the current task at a * * convenient point. The call allows the MOS to check whether the user has * * selected another task. If another task has been requested then the call * * returns with the carry set, and the event must be acknowledged using OPAEV. * * * * On entry: No requirements. * * * * On exit: If C = 0 then the module was not pre-empted. * * If C = 1 then the module was pre-empted. * * DBHAXY preserved * ******************************************************************************** fe/b965 COP_21 pea $ac00 fe/b968 pld fe/b969 phk dbank K (auto) fe/b96a plb fe/b96b sep #$30 rwid shortm,shortx fe/b96d ldal f:SYSVAR_41_input_stream fe/b971 tax fe/b972 jsr OSBYTE_98 fe/b975 bcs @noparent fe/b977 cmp #$f0 fe/b979 bcc @noparent fe/b97b jsr getCurCorParent fe/b97e bcs @noparent fe/b980 xba fe/b981 lda #$00 fe/b983 xba fe/b984 ldx #$08 fe/b986 jsl __CWT fe/b98a lda #>__EVPRE fe/b98c xba fe/b98d lda #__EVPRE fe/b98f cop COP_20_OPSEV fe/b991 sec fe/b992 rtl fe/b993 @noparent clc fe/b994 rtl ******************************************************************************** * COP 24 - OPCVD - convert DP index * * * * Action: This call takes a direct page relative address and converts it to an * * absolute BHA address. * * * * On entry: HA contains a 16 bit offset from the direct page register. * * On exit: If C = 0 then BHA contains the absolute address (D+HA). * * If C = 1 then the direct page offset is invalid. * * DXY preserved * ******************************************************************************** rwid longm,longx fe/b995 COP_24 clc fe/b996 adc DPCOP_DP fe/b998 bcs @ret fe/b99a sta bob_ll_irq_pri__mand fe/b99c sep #$20 rwid shortm fe/b99e stz bob_ll_irq_pri__psec fe/b9a0 @ret rtl ******************************************************************************** * COP 23 - OPCVS - convert stack index * * * * Action: This call takes a stack pointer relative address and converts it to * * an absolute BHA address. * * * * On entry: HA contains a 16 bit offset from the stack pointer. * * On exit: If C = 0 then BHA contains the absolute address (S+HA). * * If C = 1 then the stack offset is invalid. * ******************************************************************************** rwid longm fe/b9a1 COP_23 phd fe/b9a2 clc fe/b9a3 adc $01,S fe/b9a5 adc #$000d fe/b9a8 pld fe/b9a9 bcs @ret fe/b9ab sta bob_ll_irq_pri__mand fe/b9ad sep #$20 rwid shortm fe/b9af stz bob_ll_irq_pri__psec fe/b9b1 @ret rtl ******************************************************************************** * COP 22 - OPRLN - Read a line to buffer * * * * Action: This call will read a line of characters from the keyboard. The call * * uses a control block which gives the address at which the characters are to * * be put, the length of this buffer, and the number of characters to be sent * * to the VDU drivers. Ihis number can be zero in which case no characters are * * printed. * * * * During this call the current task may be pre-empted, in which case the carry * * flag will indicate as much. If either ESCAPE is pressed or a preempt occurs * * then the next cal1 must be to OPAEV to acknowledge the event. * * * * On entry: BHA points to a control block somewhere in memory. * * The format of the control block is as follows. * * +0 4 byte pointer to the keyboard buffer. * * The least significant byte first (0) and the most significant byte * * last (3). The most significant byte mu.stbe zero (&00}. * * +4 2 byte buffer size. The buffer can be any size up to 6SS3S characters. * * +6 2 byte prefix length. This is the number of characters in the buffer * * which will be sent to the VDU drivers. Therefore it must not be * * greater than the buffer size. If the prefix length is zero then no * * characters are sent to the VDU drivers * * +8 4 byte 0 word for future expansion * * * * On exit: If C = 0 then the lirte has been read and the characters are in * * the buffer. * * A contains the terminator of the input siring (CR ASCII 13 * * decimal). * * The length of the string in the buffer is given by the 2 bytes at * * offset +6 in the control block. * * If C = 1 then * * if HA = @SCESC% (£SCESC in MASM) then the ESCAPE key was pressed * * or * * if HA = @SCPRE% (£SCPRE in MASM) then the current task was pre- * * empted. * * DBXY preserved * * Offsets 0 to 5 remain the same. * ******************************************************************************** rwid longm fe/b9b2 COP_22 ldy #$0002 fe/b9b5 lda [bob_ll_irq_pri__mand],y fe/b9b7 xba fe/b9b8 pha fe/b9b9 plb fe/b9ba plb fe/b9bb lda [bob_ll_irq_pri__mand] fe/b9bd pha fe/b9be ldy #$0004 fe/b9c1 lda [bob_ll_irq_pri__mand],y fe/b9c3 pha fe/b9c4 ldy #$0006 fe/b9c7 lda [bob_ll_irq_pri__mand],y fe/b9c9 pha fe/b9ca tax fe/b9cb beq LFEB9DD fe/b9cd cmp $03,S fe/b9cf beq LFEB9DD fe/b9d1 bcc LFEB9D6 fe/b9d3 brl LFEBA54 fe/b9d6 LFEB9D6 lda $03,S fe/b9d8 bne LFEB9DD fe/b9da brl LFEBA54 fe/b9dd LFEB9DD jsr LFEEA7B fe/b9e0 cli fe/b9e1 lda $01,S fe/b9e3 tay fe/b9e4 bra LFEB9ED fe/b9e6 LFEB9E6 lda #$0007 fe/b9e9 dey fe/b9ea LFEB9EA iny fe/b9eb LFEB9EB cop COP_00_OPWRC fe/b9ed LFEB9ED phx fe/b9ee lda #$0000 fe/b9f1 xba fe/b9f2 lda #$0003 fe/b9f5 ldx #$0002 fe/b9f8 jsl __EV fe/b9fc plx fe/b9fd bcs LFEBA6C fe/b9ff cop COP_04_OPRDC fe/ba01 bcs LFEBA6C fe/ba03 cmp #$007f fe/ba06 bne LFEBA10 fe/ba08 cpy #$0000 fe/ba0b beq LFEB9ED fe/ba0d dey fe/ba0e bra LFEB9EB fe/ba10 LFEBA10 cmp #$0018 fe/ba13 beq LFEBA1A fe/ba15 cmp #$0015 fe/ba18 bne LFEBA27 fe/ba1a LFEBA1A tya fe/ba1b beq LFEB9ED fe/ba1d lda #$007f fe/ba20 LFEBA20 cop COP_00_OPWRC fe/ba22 dey fe/ba23 bne LFEBA20 fe/ba25 bra LFEB9ED fe/ba27 LFEBA27 cmp #$000e fe/ba2a beq LFEB9EB fe/ba2c cmp #$000f fe/ba2f beq LFEB9EB fe/ba31 cmp #$000d fe/ba34 beq LFEBA3B fe/ba36 cmp #$0020 fe/ba39 bcc LFEB9E6 fe/ba3b LFEBA3B sep #$20 rwid shortm fe/ba3d sta ($05,S),y fe/ba3f rep #$20 rwid longm fe/ba41 cmp #$000d fe/ba44 beq LFEBA5A fe/ba46 pha fe/ba47 tya fe/ba48 cmp $05,S fe/ba4a pla fe/ba4b bcs LFEB9E6 fe/ba4d cmp #$0020 fe/ba50 bcc LFEB9ED fe/ba52 bra LFEB9EA fe/ba54 LFEBA54 ldx #$ffff fe/ba57 sec fe/ba58 bra LFEBA76 fe/ba5a LFEBA5A cop COP_03_OPNLI fe/ba5c pha fe/ba5d lda #$0000 fe/ba60 xba fe/ba61 lda #$0001 fe/ba64 ldx #$0002 fe/ba67 jsl __EV fe/ba6b pla fe/ba6c LFEBA6C and #$00ff fe/ba6f tax fe/ba70 tya fe/ba71 ldy #$0006 fe/ba74 sta [bob_ll_irq_pri__mand],y fe/ba76 LFEBA76 stx bob_ll_irq_pri__mand fe/ba78 ply fe/ba79 ply fe/ba7a ply fe/ba7b rtl fe/ba7c phk fe/ba7d jsr CheckEOF fe/ba80 bcs LFEBA97 fe/ba82 lsr A fe/ba83 bcc LFEBA97 fe/ba85 cop COP_26_OPBHA fe/ba87 zstr “End of file” fe/ba93 ldx #$0001 fe/ba96 sec fe/ba97 LFEBA97 rtl ******************************************************************************** * COP 0A - OPBGT - BGET * * * * Action: Read one byte from an open device or file. The channel must * * previously have been opened using OPOPN. * * * * On entry: Y contains the handle from OPOPN. * * On exit: A contains the byte read from the file. * * if C = I then an enor has occurred, and A is invalid. * * No registers preserved * ******************************************************************************** fe/ba98 COP_0A phk fe/ba99 jsr doBGET fe/ba9c sta bob_ll_irq_pri__mand fe/ba9e bcs retCopXBHA fe/baa0 rtl ******************************************************************************** * COP 0B - OPBPT - BPUT * * * * Action: Write one byte to an open file or device. The channel must * * previously have been opened using OPOPN. * * * * On entry: Y contains the file handle from OPOPN. * * A contains the byte to be written. * * On exit: No registers preserved * ******************************************************************************** fe/baa1 COP_0B phk fe/baa2 jsr doBPUT fe/baa5 bcs retCopXBHA fe/baa7 rtl ******************************************************************************** * COP 44 - OPOPN - open device driver * * Action: This call opens a device driver. * * On entry: BHA points to the name (with colon). terminated by CR(&0D). * * Y = &40 for input * * Y = &80 for output * * Y = &C0 for update * * On exit: C = 0 means that the device driver is open and Y = handle. * * If C= I then the device failed to open, the error code is in X * * and BHA points to a zeroterminated error message. * * D preserved * * * * Not documented here is the option to pass Y=$60 to open a device handle and * * bypass auto-config - this is used internally * ******************************************************************************** fe/baa8 COP_44 phk fe/baa9 jsr doOPOPN_openFile fe/baac bcs retCopXBHA fe/baae sty bob_ll_irq_sec__dp fe/bab0 rtl fe/bab1 retCopXBHA stx bob_ll_irq_sec__flags fe/bab3 sta bob_ll_irq_pri__mand fe/bab5 sep #$20 rwid shortm fe/bab7 phb fe/bab8 pla fe/bab9 sta bob_ll_irq_pri__psec fe/babb rep #$20 rwid longm fe/babd rtl ******************************************************************************** * COP 45 - OPCLS - close device driver * * Action: This call closes a device driver which has been opened using OPOPN. * * * * On entry: Y = handle allocated by OPOPN. * * On exit: If C = 0 then driver is closed. * * If C = 1 then the driver close failed, X = error code and BHA * * points to a zero-terminated error message. * * D preserved * ******************************************************************************** fe/babe COP_45 phk fe/babf jsr closeFile fe/bac2 bcs retCopXBHA fe/bac4 rtl ******************************************************************************** * COP 46 - OPEND - test for end of file * * Action: This call will test an open file to see if the end of file has been * * reached. * * * * On entry: Y contains the file handle returned by OPOPN. * * On exit: If C = 0 then * * If lsb A = 0 the end of file has not been reached, * * If lsb A = 1 then the end of file has been reached. * * Note: only the least significant bit of A (or HA) need be tested. * * If C = 1 then the call failed. * * X = error code (X = 0 means "Not implemented on this driver"). * * BHA points to a zero-terminated error message * * DAXY preserved * ******************************************************************************** fe/bac5 COP_46 phk fe/bac6 jsr CheckEOF fe/bac9 bcs retCopXBHA fe/bacb sta bob_ll_irq_pri__mand fe/bacd rtl ******************************************************************************** * COP 4B - OPVH - validate handle * * * * Action: Checks whether a handle is conect for the given device name. * * On entry: BHA points to the zero-terminated device name. * * Y = handle * * On exit: If C = 0 then handle valid. * * If C = 1 then handle not valid. * * DY preserved * ******************************************************************************** fe/bace COP_4B cpy #$0100 fe/bad1 bcc @retNotAHandle fe/bad3 tyx fe/bad4 ldal f:$00000b,x fe/bad8 and #$00ff fe/badb eor #$0010 fe/bade cmp #$0001 fe/bae1 bcs @retNotAHandle fe/bae3 ldal f:bob_ll_irq_sec__flags,x fe/bae7 pha fe/bae8 lda bob_ll_irq_pri__mand fe/baea phk fe/baeb jsr getFSTrampolineFromprefix fe/baee pla fe/baef bcs @retBadModule fe/baf1 bvs @retBadModule fe/baf3 pha fe/baf4 txa fe/baf5 eor $01,S fe/baf7 cmp #$0001 fe/bafa pla fe/bafb bcs @retBadModule fe/bafd rtl fe/bafe @retNotAHandle cop COP_26_OPBHA fe/bb00 zstr “Not a handle” fe/bb0d bra @retsecX1 fe/bb0f @retBadModule cop COP_26_OPBHA fe/bb11 zstr “Bad module” fe/bb1c @retsecX1 ldx #$0001 fe/bb1f sec fe/bb20 brl retCopXBHA ******************************************************************************** * COP 38 - OPAH - allocate 16 bit handle * * Action: This call allocates a 16 bit handle lo the device whose name is * * pointed to by BHA. The handle is returned in Y. * * * * On entry: BHA points to the device name. Device drivers are called with a * * colon appended to the module name to distinguish them from files. * * For example, to allocate a handle for the driver module MODEM, * * BHA must point to "MODEM:" * * Y = 0. * * * * On exit: If C = 0 then handle was allocated and Y s handle. * * If C = 1 then the call failed lo allocate a handle. * * No registers preserved * ******************************************************************************** fe/bb23 COP_38 phk fe/bb24 jsr getFSTrampolineFromprefix fe/bb27 bcs @retsec fe/bb29 bvs @retsec fe/bb2b phx fe/bb2c ldy #$fdfe fe/bb2f lda #HND_type_10_CBHN fe/bb32 jsr LFEF8E4 fe/bb35 pla fe/bb36 bcs @retsec fe/bb38 stal f:$000003,x fe/bb3c stx bob_ll_irq_sec__dp fe/bb3e rtl fe/bb3f @retsec stz bob_ll_irq_sec__flags fe/bb41 sec fe/bb42 rtl ******************************************************************************** * COP 39 - OPFH - free handle * * * * Action: This call frees the handle allocated by OPAH. * * * * On entry: Y = handle. * * On exit: If C = 0 then the handle is freed. * * If C = 1 then the call failed to free the handle. * * No registers preserved * ******************************************************************************** fe/bb43 COP_39 ldx bob_ll_irq_sec__dp fe/bb45 ldy #$fdfe fe/bb48 jsr LFEF92C fe/bb4b rtl ******************************************************************************** * COP 3A - OPCUH - call device driver using handle * * * * Action: Calls the device driver whose handle was allocated by OPAH. * * * * On entry: Y = handle. * * Other registers and/br data as required by device driver. * * On exit: HAXYB registers as returned from device driver. * * If C = 0 then the codes returned from driver are valid. * * If C = 1 then either the handle was invalid, or the codes returned * * * * by the driver are invalid. * * D preserved * * * * QRY - caller's X is used but not documented? * ******************************************************************************** fe/bb4c COP_3A ldx bob_ll_irq_sec__flags fe/bb4e phk fe/bb4f jsr callDevHandle fe/bb52 rep #$30 fe/bb54 sta bob_ll_irq_pri__mand fe/bb56 stx bob_ll_irq_sec__flags fe/bb58 sty bob_ll_irq_sec__dp fe/bb5a sep #$20 rwid shortm fe/bb5c phb fe/bb5d pla fe/bb5e sta bob_ll_irq_pri__psec fe/bb60 rtl ******************************************************************************** * COP 36 - OPNLU - name lookup * * * * Action: This call checks a list of names to see if a qiecific name is * * present. If it is then the offset of the name from the start of the list is * * given in Y. * * * * On entry: The 4 byte address at D,0 points to the start of the name list. * * The 4 byte address at D,4 points to the name to be located. * * If Y = 0 then the slash "/" character is used as a delimiter. * * If Y <> 0 then the character whose ASCII code is in Y is used as * * a delimiter. * * On exit: If C = 0 then the name is in the list at offset Y from the start * * If C = 1 then the name is not in the list * * No registers preserved * * * * TODO: Documentation correction the actual input addresses are D,X and D,X+4 * ******************************************************************************** rwid longm fe/bb61 COP_36 phd fe/bb62 lda DPCOP_DP fe/bb64 clc fe/bb65 adc bob_ll_irq_sec__flags fe/bb67 tcd fe/bb68 phk fe/bb69 jsr doNameSearch fe/bb6c pld fe/bb6d sty bob_ll_irq_sec__dp fe/bb6f rtl ******************************************************************************** * Action: Adds a module to the list of modules held by the MOS. * * * * On entry: Y holds the handle of the memory pool in which the module has been * * loaded. * * On exit: C = 0 means that the module was added to the list. * * C = 1 means that the module was not added to the list. * * No registers preserved * * * * TODO: DOCO: Further to above when C = 1, X = 1 BHA contains a reason string * ******************************************************************************** fe/bb70 COP_35 ldx #$000e fe/bb73 jsl __MM fe/bb77 bcs LFEBB9F fe/bb79 phd fe/bb7a phb fe/bb7b phb fe/bb7c pha fe/bb7d per tblLFEF0E1+9 fe/bb80 phk dbank K (auto) fe/bb81 plb fe/bb82 tsc fe/bb83 tcd fe/bb84 jsr LFEEF2D fe/bb87 bcs LFEBB94 fe/bb89 plx fe/bb8a phx fe/bb8b jsr LFEEF9D fe/bb8e pla fe/bb8f pla fe/bb90 pla fe/bb91 pld fe/bb92 clc fe/bb93 rtl fe/bb94 LFEBB94 pla fe/bb95 pla fe/bb96 pla fe/bb97 pld fe/bb98 jsr cop26BadModuleX1 fe/bb9b sec fe/bb9c brl retCopXBHA fe/bb9f LFEBB9F jsr cop26BadHandleX1 fe/bba2 sec fe/bba3 brl retCopXBHA ******************************************************************************** * COP 34 - OPRMI - read module Info * * Action: Read information about the module whose name is pointed to by BHA. * * The entry address can be read, or the flag and code type bytes. * * * * On entry: BHA points to module name * * X = hint (returned by OPSLM) or 0. * * Y = 0 to read entry address (address of BRL). * * Y = 2 to read the code type bytes. * * Y = 4 to read module version. * * Note: this COP must be called in 16-bit XY mode to read the * * module-type flags. * * On exit: C = 0 means that the module was found and module information read. * * C = 1 means that the module was not found. * * If C = 0 and Y = 0 then BHA contains the entry address of the * * module, this being the address of the BRL, the first byte of * * the module header. * * If C = 0 and Y = 2 then HA contains code type bytes 0 and 1, X * * contains code type bytes 2 and 3. * * If C = 0 and Y = 4 then HA = version. * * D preserved * * * ******************************************************************************** fe/bba6 COP_34 ldx #$0000 fe/bba9 ldy #$0000 fe/bbac phk fe/bbad jsr findModuleByName_Q fe/bbb0 bcs LFEBBE8 fe/bbb2 pei (bob_ll_irq_sec__dp) fe/bbb4 tdc fe/bbb5 clc fe/bbb6 adc #$0005 fe/bbb9 tcd fe/bbba phk fe/bbbb jsr LFEF2B7 fe/bbbe plx fe/bbbf beq LFEBBD8 fe/bbc1 tdc fe/bbc2 dec A fe/bbc3 dec A fe/bbc4 tcd fe/bbc5 cpx #$0002 fe/bbc8 bne LFEBBDA fe/bbca ldy #$000a fe/bbcd lda [bob_ll_irq_pri__irqf],y fe/bbcf tax fe/bbd0 dey fe/bbd1 dey fe/bbd2 lda [bob_ll_irq_pri__irqf],y fe/bbd4 stx bob_ll_irq_pri__next fe/bbd6 sta bob_ll_irq_pri__irqf fe/bbd8 LFEBBD8 clc fe/bbd9 rtl fe/bbda LFEBBDA cpx #$0004 fe/bbdd bne LFEBBE8 fe/bbdf ldy #$0006 fe/bbe2 lda [bob_ll_irq_pri__irqf],y fe/bbe4 sta bob_ll_irq_pri__irqf fe/bbe6 clc fe/bbe7 rtl fe/bbe8 LFEBBE8 sec fe/bbe9 rtl ******************************************************************************** * COP 33 - OPSLM - scan list of modules * * Action: This call returns with BHA pointing to a location containing the * * name of the next module in the list X and Y return hints used by the * * operating system to find this module quickly. * * * * On entry: BHA either points to the name of the previous module, or to a free * * * * area of memory containing a number of spaces terminated by zero * * (&00). * * In the latter case, BHA is preserved, and the name of the first * * module in the list is written to the location pointed to by BHA. * * The first name in the list is either truncated or padded with * * spaces to fit the number of spaces allocated on entry. * * X = hint (retunted by previous OPSLM), or 0. * * Y = hint (returned by previous OPSLM), or 0. * * * * On exit: BHA points to the name of the next module. * * X = hint (number used by the operating system). * * Y = hint (number used by the opeiatmg system). * * No registers preserved * * * * To call: * * Example: * * COP * * EQUB@OPSLU% from BASIC * ******************************************************************************** fe/bbea COP_33 phb fe/bbeb pha fe/bbec phb fe/bbed pha fe/bbee tsc fe/bbef inc A fe/bbf0 tcd fe/bbf1 ldy #$0000 fe/bbf4 lda [bob_ll_irq_sec__flags],y fe/bbf6 jsr checkValidModnameChar fe/bbf9 ldal f:B0LST_MODULES_QRY fe/bbfd bcs LFEBC11 fe/bbff lda bob_ll_irq_sec__flags fe/bc01 ldx #$0000 fe/bc04 ldy #$0000 fe/bc07 phk fe/bc08 jsr findModuleByName_Q fe/bc0b bcs LFEBC74 fe/bc0d ldal f:bob_ll_irq_pri__next,x fe/bc11 LFEBC11 cmp #$fe0e fe/bc14 beq LFEBC74 fe/bc16 tax fe/bc17 phk fe/bc18 jsr LFEF2B7 fe/bc1b ldy #$000e fe/bc1e jsr LFEF343 fe/bc21 ldy #$ffff fe/bc24 LFEBC24 iny fe/bc25 bmi LFEBC74 fe/bc27 lda [bob_ll_irq_pri__next],y fe/bc29 and #$00ff fe/bc2c cmp #$002f fe/bc2f beq LFEBC36 fe/bc31 cmp #$0020 fe/bc34 bcs LFEBC24 fe/bc36 LFEBC36 tyx fe/bc37 LFEBC37 dey fe/bc38 bmi LFEBC44 fe/bc3a lda [bob_ll_irq_sec__flags],y fe/bc3c and #$00ff fe/bc3f cmp #$0020 fe/bc42 bcs LFEBC37 fe/bc44 LFEBC44 ldy #$0000 fe/bc47 LFEBC47 tya fe/bc48 phx fe/bc49 cmp $01,S fe/bc4b plx fe/bc4c bcs LFEBC59 fe/bc4e sep #$20 rwid shortm fe/bc50 lda [bob_ll_irq_pri__next],y fe/bc52 sta [bob_ll_irq_sec__flags],y fe/bc54 rep #$20 rwid longm fe/bc56 iny fe/bc57 bra LFEBC47 fe/bc59 LFEBC59 lda [bob_ll_irq_sec__flags],y fe/bc5b and #$00ff fe/bc5e cmp #$0020 fe/bc61 bcc LFEBC6E fe/bc63 sep #$20 rwid shortm fe/bc65 lda #$20 fe/bc67 sta [bob_ll_irq_sec__flags],y fe/bc69 rep #$20 rwid longm fe/bc6b iny fe/bc6c bra LFEBC59 fe/bc6e LFEBC6E clc fe/bc6f LFEBC6F pla fe/bc70 plb fe/bc71 pla fe/bc72 plb fe/bc73 rtl fe/bc74 LFEBC74 sec fe/bc75 bra LFEBC6F ******************************************************************************** * COP 22 - OPCMD call a module * * * * Action: Call the module whose name, tenninated by zero,follows * * cmmediately. * * * * On entry: Any values required by the module to be passed in the registers. * * * * Inline string which is the module name terminated by zero (&00). * * * * On exit: Carry bit is setand X = 0 if the module was not found. * ******************************************************************************** fe/bc77 COP_28 lda bob_ll_irq_sec__type ;get caller PC fe/bc79 inc A ;increment to point at the module name fe/bc7a pei (DPCOP_PC+1) ;get caller's program bank into B fe/bc7c plb fe/bc7d plb fe/bc7e ldy #$0000 fe/bc81 phk fe/bc82 jsr brlFindModule ;look for the module fe/bc85 bcs modNotFoundRetZ fe/bc87 phk fe/bc88 jsr brlGetOrCreateModCallBlock fe/bc8b bcs modNotFoundRetZ ; make an rti frame that will return to an rti fe/bc8d phd ;an rti frame that will return to an rti fe/bc8e phk fe/bc8f per LFEBCA8 fe/bc92 pea $0000 ;place 0000 on the stack fe/bc95 plb ;discard stacked byte fe/bc96 pha ;push A (module B0 jump block) fe/bc97 pea $0000 fe/bc9a plb ;another single 0 fe/bc9b pei (DPCOP_DP) fe/bc9d pei (bob_ll_irq_pri__meor) fe/bc9f plb fe/bca0 lda bob_ll_irq_pri__mand fe/bca2 ldx bob_ll_irq_sec__flags fe/bca4 ldy bob_ll_irq_sec__dp fe/bca6 plb fe/bca7 pld ; BHAXY are now as per caller ; ; stack contains ; ; +7 @rti long address for module to return to which will do another RTI - QRY ; why? ; +6 00 - bank 0 ; +4 jump block entry in bank 0 ; +3 00 - dummy flags ; +1 caller DP fe/bca8 LFEBCA8 rti ******************************************************************************** * QRY - possible dead code? * ******************************************************************************** rwid shortm,shortx fe/bca9 rep #$30 rwid longm,longx fe/bcab pha fe/bcac phd fe/bcad lda $05,S fe/bcaf tcd fe/bcb0 pla fe/bcb1 sta DPCOP_DP fe/bcb3 pla fe/bcb4 sta bob_ll_irq_pri__mand fe/bcb6 pld fe/bcb7 stx bob_ll_irq_sec__flags fe/bcb9 sty bob_ll_irq_sec__dp fe/bcbb sep #$20 rwid shortm fe/bcbd phb fe/bcbe pla fe/bcbf sta bob_ll_irq_pri__psec fe/bcc1 rep #$20 rwid longm fe/bcc3 brl @copExitImmedStr fe/bcc6 modNotFoundRetZ stz bob_ll_irq_sec__flags fe/bcc8 brl @copExitImmedStr ******************************************************************************** * COP 2A - OPURF - unreference module * * Action: Let the operating system know you no longer require access to a * * module. * * On entry: X points to the start of the 8 byte block in direct page which was * * initialised when the module was referenced. * * On exit: C = 0 means that the module was found and unreferenced. * * C = 1 means that the value in X was invalid. * * DBHA preserved * ******************************************************************************** fe/bccb COP_2A lda DPCOP_DP fe/bccd clc fe/bcce adc bob_ll_irq_sec__flags fe/bcd0 tax fe/bcd1 ldal f:$000002,x fe/bcd5 and #$00ff fe/bcd8 cmp #$0001 fe/bcdb ldal f:$000001,x fe/bcdf bcs @skq fe/bce1 ldal f:bob_ll_irq_pri__next,x fe/bce5 inc A fe/bce6 @skq tcd fe/bce7 lda $0b fe/bce9 and #$00ff fe/bcec cmp #$0006 fe/bcef bne @retSEC fe/bcf1 sep #$20 rwid shortm fe/bcf3 lda $07 fe/bcf5 beq @retSEC fe/bcf7 dec $07 fe/bcf9 rep #$20 rwid longm fe/bcfb phx fe/bcfc pld fe/bcfd stz bob_ll_irq_pri__next fe/bcff stz $02 fe/bd01 bcs @retCLC fe/bd03 stz $04 fe/bd05 @retCLC clc fe/bd06 rtl rwid shortm fe/bd07 @retSEC sec fe/bd08 rtl ******************************************************************************** * COP 29 - OPRFR - reference module * * Action: Set up entry and return addresses in an 8 byte block in direct page * * for the module whose name is pointed to by BHA. * * On entry: BHA points to the module name which is terminated by zero (&00). * * X points to the start of the 8 byte block in direct page which * * will * * be initialised by the OPRFR routine. * * Y = 0 * * On exit: C = 0 means that the module was found and the block initialised. * * C = 1 means that the module was not found. * * DB preserved. * ******************************************************************************** rwid longm fe/bd09 COP_29 phk fe/bd0a jsr COP_27 fe/bd0d bcs @ret fe/bd0f ldal f:$000001,x ;adjust the address at offset 01 to be an RTL addres fe/bd13 dec A ;i.e. subtract 1 fe/bd14 stal f:bob_ll_irq_pri__next,x ;store at offset 0 fe/bd18 lda #$0000 ;zero offset 2,3 - QRY bank address address at 01 will always be 0 fe/bd1b stal f:$000002,x fe/bd1f lda #(LFEFE64_anRTL & $ffff)-1 ;make an RTLable address to an RTL fe/bd22 stal f:$000003,x fe/bd26 sep #$20 rwid shortm fe/bd28 phk fe/bd29 pla fe/bd2a stal f:$000005,x fe/bd2e rep #$20 rwid longm fe/bd30 @ret rtl ******************************************************************************** * COP 27 - OPREF - OPRFR with different return structure * * * * On Entry: X is a DP offset to an 8 byte block to receive a module pointer * * BHA points to zero terminated module name * * * * On Exit: C = 0, offset 1,2 in block contain a pointer to code to call the * * module * * C = 1 for not found * * * * QRY * * * * This looks to be called by OPRFR but OPRFR rearranges the returned block * * order * * * * This find the module, and place a * * * * phd * * jsl <module service entry> * * pld * * rtl * * * * somewhere in bank 0 and place a 16 bit pointer to this at offset 1, the rest * * of the block in zeroed * ******************************************************************************** fe/bd31 COP_27 lda DPCOP_DP fe/bd33 clc fe/bd34 adc bob_ll_irq_sec__flags ;HA = DPX fe/bd36 adc #$0004 fe/bd39 bcs @ret ;Exit with SEC if DPX+4 is outside bank 0 fe/bd3b sbc #$0003 ;knock back to HA = DPX fe/bd3e tax ;transfer to X fe/bd3f lda #$0000 ;clear DPX+0..DPX+7 fe/bd42 stal f:bob_ll_irq_pri__next,x fe/bd46 stal f:$000002,x fe/bd4a stal f:$000004,x fe/bd4e stal f:$000006,x fe/bd52 phx fe/bd53 lda bob_ll_irq_pri__mand ;get back BHA (module name) fe/bd55 phk fe/bd56 jsr brlGetModCallRef ;long call actual module find fe/bd59 plx ;get back DPX pointer fe/bd5a bcs @ret fe/bd5c stal f:$000001,x ;store pointer at offset 1 fe/bd60 @ret rtl ******************************************************************************** * COP 0F - OPERR - system error * * * * Action: This is used as a debugging aid. When the call is executed, a fatal * * error is generated. A zero-terminated string immediately following the COP * * signature is printed, followed by a listing of the contents of the 6SSC8l6's * * registers. The register string is printed as: * * * * address of COP OPERR signature byte (3 bytes) * * status (I byte) * * D (2 bytes) * * BHA (3 bytes) * * X (2 bytes) * * Y (2 bytes) * * The bytes are printed as pairs of hexadecimaldigits separated by spaces. * * * * On entry: Inline error string. * * On exit: No exit the machine "hangs". * ******************************************************************************** fe/bd61 COP_0F cop COP_01_OPWRS ;Write a newline TODO: Use OPNLI fe/bd63 zstr $0d,$0a fe/bd66 phk fe/bd67 jsr COP_01 ;QRY - this prints the message after the original caller's COP fe/bd6a cop COP_01_OPWRS fe/bd6c zstr $0d,$0a,“*** Fatal System Error:” fe/bd86 ldx #$000d fe/bd89 jsr @dumpregs fe/bd8c cop COP_01_OPWRS fe/bd8e zstr “ ***”,$0d,$0a,$0a fe/bd96 @here bra @here ;hang up the machine fe/bd98 @dumpregs lda #$0020 ;dump registers fe/bd9b cop COP_00_OPWRC fe/bd9d lda bob_ll_irq_pri__next,x fe/bd9f jsr printHexA fe/bda2 dex fe/bda3 bne @dumpregs fe/bda5 rts fe/bda6 printHexA pha fe/bda7 lsr A fe/bda8 lsr A fe/bda9 lsr A fe/bdaa lsr A fe/bdab jsr printHexNyb fe/bdae pla fe/bdaf printHexNyb pha fe/bdb0 php fe/bdb1 sep #$20 rwid shortm fe/bdb3 and #$0f fe/bdb5 ora #$30 fe/bdb7 cmp #$3a fe/bdb9 bcc @sk fe/bdbb adc #$06 fe/bdbd @sk cop COP_00_OPWRC fe/bdbf plp rwid longm fe/bdc0 pla fe/bdc1 rts ******************************************************************************** * COP 10 - OPADP - Allocate direct page * * * * Action: This call is used to request a direct page of a certain size, the * * size being a 2 byte number which follows the call. The call returns with HA * * pointing to an address in bank zero which can be used as the base of the * * direct page. * * * * On entry: Inline 2 byte size (in bytes) of direct page requested. * * On exit: C = 0 means that the direct page has been allocated, and HA * * contains the address of the base. * * C = 1 means that the call failed to allocate a direct page. * * XY preserved * * Note: D is not preserved. * * * * TODO: Check against original docuimentation (above) OPADF returns in D not * * in HA! check but it looks like DP and HA are set to the new value. * * * * QRY - OPADF and OPADP are the SAME - this must surely be a mistake? Or are * * they all fast?! * ******************************************************************************** fe/bdc2 COP_10 ldy #$0001 fe/bdc5 lda [bob_ll_irq_sec__type],y ;get 16 bit parameter into A fe/bdc7 inc bob_ll_irq_sec__type fe/bdc9 inc bob_ll_irq_sec__type ;step return address past it fe/bdcb ldx #__MMAZB ;allocate ZP page pool fe/bdce jsl __MM fe/bdd2 bcs @fail fe/bdd4 sta bob_ll_irq_pri__mand fe/bdd6 sta DPCOP_DP fe/bdd8 eor #$0000 ;check for 0 fe/bddb bne allocOK fe/bddd phk fe/bdde jsr COP_12 ;try and free it - TODO why would it return 0, why try and free? fe/bde1 @fail sec fe/bde2 rtl fe/bde3 allocOK phx fe/bde4 pei (DPCOP_PC+1) fe/bde6 plb fe/bde7 plb ;get return bank fe/bde8 lda bob_ll_irq_sec__type ;get return address fe/bdea cop COP_2C_OPFMA ;find the module that called us fe/bdec bcc LFEBDFF fe/bdee ldx #__MMFND ;find memory pool just returned fe/bdf1 jsl __MM fe/bdf5 lda #$0000 fe/bdf8 bcs LFEBE00 fe/bdfa ldal f:$000008,x fe/bdfe tax fe/bdff LFEBDFF txa fe/be00 LFEBE00 plx fe/be01 stal f:DPCOP_DP,x fe/be05 clc fe/be06 rtl ******************************************************************************** * COP 12 - OPFD - Free direct page * * * * On Entry: DP to free in D * * On Exit: C = 0 freed ok * * * * QRY no docco * ******************************************************************************** fe/be07 COP_12 lda DPCOP_DP fe/be09 sta bob_ll_irq_pri__mand ******************************************************************************** * COP 1A - OPFZB - free bank 0 memory * * * * Action: Tells the operating system that space allocated in bank zero is * * finished with. This should be done every time space is no longer requited so * * that bank zero is not exhausted. * * On entry: HA contains the address of the bank zero pool base. * * On exit: If C = 0 then the pool has been freed. * * If C = 1 then the routine could not free the pool. * * No registers preserved * ******************************************************************************** fe/be0b COP_1A pea $0000 fe/be0e plb dbank $00 fe/be0f plb fe/be10 ldy #$0001 fe/be13 ldx #__MMFND fe/be16 jsl __MM fe/be1a bcs @retsec fe/be1c ldx #__MMBAS fe/be1f jsl __MM fe/be23 cmp bob_ll_irq_pri__mand fe/be25 bne @retsec fe/be27 ldx #__MMFP fe/be2a jsl __MM fe/be2e bcs @retsec fe/be30 clc fe/be31 rtl fe/be32 @retsec sec fe/be33 rtl ******************************************************************************** * COP 13 - OPAST - Allocate Stack * * * * Action: This call is used to request a stack of a certain size, the size * * being a 2 byte number which follows the call. The call returns with HA * * containing an address which can be transferred to the stack pointer. * * * * On entry: Inline 2 byte size (in bytes) of stack requested. * * On exit: C = 0 means that the stack has been allocated, and HA contains * * the address to be transferred to the stack pointer. * * C = 1 means that the call failed to allocate a stack. * * DBXY preserved * ******************************************************************************** fe/be34 COP_13 ldy #$0001 fe/be37 lda [bob_ll_irq_sec__type],y fe/be39 inc bob_ll_irq_sec__type fe/be3b inc bob_ll_irq_sec__type fe/be3d ldx #__MMAZB fe/be40 jsl __MM fe/be44 bcs @ret fe/be46 ldx #__MMTOP fe/be49 jsl __MM fe/be4d tax fe/be4e dex fe/be4f dex fe/be50 lda #$dead ;Store "DEAD" above stack - checked in OPFST (free) fe/be53 stal f:bob_ll_irq_pri__next,x fe/be57 dex fe/be58 stx bob_ll_irq_pri__mand fe/be5a brl allocOK fe/be5d @ret rtl ******************************************************************************** * COP 14 - OPFST - Free a stack * * * * Action: Tells the operating system that space allocated to a stack is * * finished with. This should be done every time a stack is no longer required. * * Only space allocated by OPAST can be freed by this call. * * * * On entry: HA contains an address within the stack. (This means that the * * current value of the stack pointer can usually be used to free the * * stack.) * * * * On exit: If C = 0 then the stack has been freed. * * If C = I then the routine could not free the stack. * * DBAXY preserved * ******************************************************************************** fe/be5e COP_14 pea $0000 fe/be61 plb fe/be62 plb fe/be63 ldx #__MMFND fe/be66 jsl __MM fe/be6a bcs @retsec fe/be6c ldx #__MMTOP fe/be6f jsl __MM fe/be73 tax fe/be74 dex fe/be75 dex fe/be76 ldal f:bob_ll_irq_pri__next,x fe/be7a cmp #$dead ;check for "DEAD" at the top of stack and panic if not there fe/be7d bne @retsec fe/be7f ldx #__MMFP ;Free it fe/be82 jsl __MM fe/be86 rtl fe/be87 @retsec sec fe/be88 rtl ******************************************************************************** * COP 16 - OPAEV - Acknowledge Event * * * * Action: This call acknowledges the occurrence of an event * * * * On entry: HA contains the event mask which specifies the events to be * * acknowledged. Possible event masks arc __EVESC to acknowledge the * * ESCAPE event and __EVPRE to acknowledge the pre-emptevent * * On exit: If C = 0 then the specified event is acknowledged. * * If C = 1 then an attempt was made to clear an event which had not * * previously been set * * DBAXY preserved * ******************************************************************************** fe/be89 COP_16 pha fe/be8a ldal f:SYS_ESCAPE_FLAG_QRY fe/be8e tax fe/be8f and $01,S fe/be91 eor $01,S fe/be93 cmp #$0001 fe/be96 txa fe/be97 ora $01,S fe/be99 eor $01,S fe/be9b stal f:SYS_ESCAPE_FLAG_QRY fe/be9f pla fe/bea0 rtl ******************************************************************************** * COP 20 - OPSEV - Set an event * * * * QRY * * * * On Entry: HA contains even flags mask that are to be set * ******************************************************************************** fe/bea1 COP_20 oral f:SYS_ESCAPE_FLAG_QRY fe/bea5 stal f:SYS_ESCAPE_FLAG_QRY fe/bea9 clc fe/beaa rtl fe/beab php fe/beac rep #$30 fe/beae phd fe/beaf phb fe/beb0 pha fe/beb1 phx fe/beb2 phy fe/beb3 cop COP_01_OPWRS fe/beb5 zstr “ regs:” fe/bebd dd1 $3b fe/bebe tcd fe/bebf ldx #$000a fe/bec2 jsr @dumpregs fe/bec5 cop COP_03_OPNLI fe/bec7 ply fe/bec8 plx fe/bec9 pla fe/beca plb fe/becb pld fe/becc plp fe/becd rts ******************************************************************************** * OPERC 61 - ???? error something ??? * * * * QRY - * * * * looks if X & 1 = 0 then "Error (no message)" * * the string pointed to BHA is < 4 ASCII chars "Error (terse message)" * * if it contains unprintable chars then "Error (bad message)" * * else pass thru BHA * ******************************************************************************** fe/bece COP_61 lda bob_ll_irq_sec__flags fe/bed0 lsr A fe/bed1 bcc bhaErrorNoMessage fe/bed3 pei (bob_ll_irq_pri__meor) fe/bed5 plb fe/bed6 plb fe/bed7 ldx bob_ll_irq_pri__mand fe/bed9 ldy #$0000 fe/bedc LFEBEDC phx fe/bedd lda ($01,S),y fe/bedf plx fe/bee0 and #$00ff fe/bee3 beq LFEBEF2 fe/bee5 cmp #$0020 fe/bee8 bcc bhaErrorBadErrorMEssage fe/beea cmp #$007f fe/beed bcs bhaErrorBadErrorMEssage fe/beef iny fe/bef0 bra LFEBEDC fe/bef2 LFEBEF2 cpy #$0004 fe/bef5 bcc bhaErrorTerse fe/bef7 clc fe/bef8 rtl fe/bef9 bhaErrorNoMessage cop COP_26_OPBHA fe/befb zstr “Error (no message)” fe/bf0e bra LFEBF40 fe/bf10 bhaErrorBadErrorMEssage cop COP_26_OPBHA fe/bf12 zstr “Error (bad message)” fe/bf26 bra LFEBF40 fe/bf28 bhaErrorTerse cop COP_26_OPBHA fe/bf2a zstr “Error (terse message)” fe/bf40 LFEBF40 dd1 $48 fe/bf41 lda bob_ll_irq_sec__flags fe/bf43 ora #$0001 fe/bf46 tax fe/bf47 pla fe/bf48 sec fe/bf49 brl retCopXBHA ******************************************************************************** * COP 60 - OPDFR - ???? * ******************************************************************************** fe/bf4c COP_60 lda #HND_type_12_CBDFR fe/bf4f jsr allocB0B fe/bf52 bcs @reterrNoRoom fe/bf54 lda #$0000 fe/bf57 stal f:bob_ll_irq_pri__next,x fe/bf5b lda bob_ll_irq_sec__dp fe/bf5d stal f:$000004,x fe/bf61 lda bob_ll_irq_sec__flags fe/bf63 stal f:$000006,x fe/bf67 lda DPCOP_DP fe/bf69 stal f:$000002,x fe/bf6d lda bob_ll_irq_pri__meor fe/bf6f stal f:$000009,x fe/bf73 lda bob_ll_irq_pri__mand fe/bf75 stal f:$000008,x fe/bf79 phx fe/bf7a lda #$fe12 fe/bf7d LFEBF7D tax fe/bf7e ldal f:bob_ll_irq_pri__next,x fe/bf82 bne LFEBF7D fe/bf84 pla fe/bf85 stal f:bob_ll_irq_pri__next,x fe/bf89 clc fe/bf8a rtl fe/bf8b @reterrNoRoom cop COP_26_OPBHA fe/bf8d zstr “No room” fe/bf95 ldx #$0001 fe/bf98 brl retCopXBHA rwid shortm,shortx fe/bf9b LFEBF9B php fe/bf9c phb fe/bf9d @loop phd fe/bf9e rep #$30 rwid longm,longx fe/bfa0 ldal f:$00fe12 fe/bfa4 beq LFEBFC5 fe/bfa6 tcd fe/bfa7 tax fe/bfa8 lda bob_ll_irq_pri__next fe/bfaa stal f:$00fe12 fe/bfae phk fe/bfaf per @loop fe/bfb2 pei ($09) fe/bfb4 pei ($07) fe/bfb6 plb fe/bfb7 pei ($02) fe/bfb9 pei ($06) fe/bfbb pei ($04) fe/bfbd jsr freeB0Block fe/bfc0 ply fe/bfc1 plx fe/bfc2 pld fe/bfc3 php fe/bfc4 rti fe/bfc5 LFEBFC5 pld fe/bfc6 plb fe/bfc7 plp fe/bfc8 clc fe/bfc9 rtl ******************************************************************************** * COP 43 - OPXKC - examine keyboard character * * Action: If keyboard buffer is not empty then A becomes the first character * * in the buffer. Note that the character is not removed from the keyboard * * buffer so repetition of this call will yield the same result. Consequently a * * call to OPXKC cannot cause a pre-empt tooccur. * * * * On entry: No requirements * * On exit: If C = 0 then A = first character in keyboard buffer. * * If C = I then keyboard buffer is empty. * * DX preserved * * * ******************************************************************************** fe/bfca COP_43 phd fe/bfcb pea $ac00 fe/bfce pld fe/bfcf phk dbank K (auto) fe/bfd0 plb fe/bfd1 sep #$30 rwid shortm,shortx fe/bfd3 ldal f:SYSVAR_41_input_stream fe/bfd7 tax fe/bfd8 jsr OSBYTE_98 fe/bfdb pld fe/bfdc sta bob_ll_irq_pri__mand fe/bfde rtl ******************************************************************************** * COP 42 - OPRHL - ??? * * * * QRY - something Econet-ey * ******************************************************************************** rwid longm,longx fe/bfdf COP_42 ldal HW_TYPE_DETECT_QRY fe/bfe3 bne LFEBFEB fe/bfe5 ldal HW_ECONET fe/bfe9 bra LFEBFEF fe/bfeb LFEBFEB ldal f:DPSYS+207 fe/bfef LFEBFEF pha fe/bff0 and #$001f fe/bff3 sta bob_ll_irq_pri__mand fe/bff5 pla fe/bff6 stz bob_ll_irq_sec__dp fe/bff8 ror A fe/bff9 ror A fe/bffa ror A fe/bffb ror A fe/bffc ror A fe/bffd ror A fe/bffe rol bob_ll_irq_sec__dp fe/c000 ror A fe/c001 rol bob_ll_irq_sec__dp fe/c003 ror A fe/c004 rol bob_ll_irq_sec__dp fe/c006 rtl ******************************************************************************** * COP 41 - OPECO call low - level Econet routines * * Action: This call performs data transfer to and from the Econet filing * * system. It performs several tasks depending upon the reason code in X. * * On entry: X = reason code. * * Other registers contain or point to arguments. * * On exit: C = 0 means that the call was successful. * * If C = 1 and X <> 0 then the call failed and the error code is in * * X. * * If C = 1 and X = 0 then the Econet module is not present * * D preserved * ******************************************************************************** fe/c007 COP_41 phd fe/c008 pha fe/c009 ldx bob_ll_irq_sec__flags fe/c00b lda DPCOP_DP fe/c00d pea DPSYS fe/c010 pld fe/c011 sta <DPSYS_MOD_ECONET-2 ;caller DP fe/c013 lda <DPSYS_MOD_ECONET+4 fe/c015 ora <DPSYS_MOD_ECONET+2 fe/c017 ora <DPSYS_MOD_ECONET fe/c019 beq @noeconet fe/c01b pla fe/c01c phk fe/c01d jsr _callModEconet fe/c020 pld ;get back COP stack DP fe/c021 sta bob_ll_irq_pri__mand fe/c023 stx bob_ll_irq_sec__flags fe/c025 sty bob_ll_irq_sec__dp fe/c027 sep #$20 rwid shortm fe/c029 phb fe/c02a pla fe/c02b sta bob_ll_irq_pri__psec fe/c02d rep #$20 rwid longm fe/c02f rtl fe/c030 @noeconet pld fe/c031 pld fe/c032 pld fe/c033 stz bob_ll_irq_sec__flags fe/c035 sec fe/c036 rtl ******************************************************************************** * COP 4A - OPNET high-level Econet routines * * Action: This call performs several tasks depending upon the reason code in * * X. * * On entry: X = reason code. * * Other registers contain or point to arguments. * * On exit: C = 0 means that the call was successful. * * If C = 1 then the call failed and the error code is in X. * * If C = 1 and X = 0 then the Econei module is not present. * * If C = 1 and X = 1 then BHA points to an error message. * * D preserved * ******************************************************************************** fe/c037 COP_4A phd fe/c038 pha fe/c039 ldx bob_ll_irq_sec__flags fe/c03b pea DPSYS fe/c03e pld fe/c03f lda <DPSYS_MOD_NET+4 fe/c041 ora <DPSYS_MOD_NET+2 fe/c043 ora <DPSYS_MOD_NET fe/c045 beq @retsec fe/c047 pla fe/c048 phk fe/c049 jsr _callModNetwork fe/c04c pld fe/c04d sta bob_ll_irq_pri__mand fe/c04f stx bob_ll_irq_sec__flags fe/c051 sty bob_ll_irq_sec__dp fe/c053 sep #$20 rwid shortm fe/c055 phb fe/c056 pla fe/c057 sta bob_ll_irq_pri__psec fe/c059 rep #$20 rwid longm fe/c05b rtl fe/c05c @retsec pla fe/c05d pld fe/c05e stz bob_ll_irq_sec__flags fe/c060 sec fe/c061 rtl ******************************************************************************** * COP 3F - OPATR - ??? * ******************************************************************************** fe/c062 COP_3F ldx #__MMBAS fe/c065 jsl __MM fe/c069 bcs @retSecX0 fe/c06b tay fe/c06c lda DPCOP_DP fe/c06e clc fe/c06f adc bob_ll_irq_sec__flags fe/c071 tax fe/c072 dey fe/c073 tya fe/c074 stal f:bob_ll_irq_pri__next,x fe/c078 phb fe/c079 phb fe/c07a pla fe/c07b stal f:$000002,x fe/c07f per LFEFE63_anRTL fe/c082 pla fe/c083 stal f:$000003,x fe/c087 phk fe/c088 phk fe/c089 pla fe/c08a stal f:$000005,x fe/c08e lda #$dead fe/c091 stal f:$000006,x fe/c095 clc fe/c096 rtl fe/c097 @retSecX0 stz bob_ll_irq_sec__flags fe/c099 rtl ******************************************************************************** * COP 40 - OPFTR - ??? free something see OPATR * ******************************************************************************** fe/c09a COP_40 lda DPCOP_DP fe/c09c clc fe/c09d adc bob_ll_irq_sec__flags fe/c09f tax fe/c0a0 ldal f:bob_ll_irq_pri__meor,x fe/c0a4 eor #$dead fe/c0a7 cmp #$0001 fe/c0aa rtl ******************************************************************************** * COP 3D - OPGSR - ??? * * * * Does an RTL * ******************************************************************************** fe/c0ab COP_3D rtl ******************************************************************************** * COP 3E - OPADY - add Y to BHA * * Action: BHA becomes BHA+Y. Y is zeroed. * * * * On entry: No requirements * * On exit: BHA := BHA + Y * * Y = 0 * * DBX preserved * ******************************************************************************** fe/c0ac COP_3E clc fe/c0ad adc bob_ll_irq_sec__dp fe/c0af sta bob_ll_irq_pri__mand fe/c0b1 bcc LFEC0B9 fe/c0b3 sep #$20 rwid shortm fe/c0b5 inc bob_ll_irq_pri__psec fe/c0b7 rep #$20 rwid longm fe/c0b9 LFEC0B9 stz bob_ll_irq_sec__dp fe/c0bb rtl ******************************************************************************** * COP 32 - OPSUM - compute end-around-carry sum * * * * Action: Gives a sum of all the bits in a block whose start is pointed to by * * BHA and whose length in bytes is in Y. * * * * On entry: BHA points to thestartof the block to be summed. * * Y = length of block in bytes. * * On exit: If C = 0 then thesum has been computed and theresult is in HA. * * If C = 1 then either the length was zero (Y = 0) or all the bytes * * in the block were zero (HA = 0). * * DXY preserved * ******************************************************************************** fe/c0bc COP_32 tyx ;byte count into X fe/c0bd beq @retzsec fe/c0bf lda #$0000 ;sum fe/c0c2 tay ;zero offset fe/c0c3 clc fe/c0c4 @lp dex fe/c0c5 bne @nla ;if zero here then 1 byte left fe/c0c7 pha fe/c0c8 lda [bob_ll_irq_pri__mand],y fe/c0ca iny fe/c0cb and #$00ff fe/c0ce adc $01,S ;add to low part of stacked A fe/c0d0 sta $01,S fe/c0d2 pla ;pop A fe/c0d3 bra LFEC0DC ;and return fe/c0d5 @nla adc [bob_ll_irq_pri__mand],y fe/c0d7 iny fe/c0d8 iny fe/c0d9 dex fe/c0da bne @lp fe/c0dc LFEC0DC adc #$0000 ;add last carry in fe/c0df beq @retzsec fe/c0e1 tax fe/c0e2 eor [bob_ll_irq_pri__mand],y ;this looks to additionally check against any checksum after the block fe/c0e4 stx bob_ll_irq_pri__mand fe/c0e6 cmp #$0001 ;return Z for match QRY - check this fe/c0e9 rtl fe/c0ea @retzsec stz bob_ll_irq_pri__mand fe/c0ec sec fe/c0ed rtl ******************************************************************************** * COP 2E - OPFPO - find pool owner * * * * Action This call attempts to find the module which owns the memory pool * * pointed to by BHA. * * * * On Entry: BHA points to the pool address. * * Y = 0 * * On Exit: If C = 0 then the pool owner has been found, and BHA ptnnts to an * * address within the owner module. * * If C = 1 then the owner was not found. * * No registers preserved * * * * TODO DOCO: Further to documented API if Y non-zero on entry then BHA is * * ignored instead Y is used as a pool handle * ******************************************************************************** fe/c0ee COP_2E phd fe/c0ef phy fe/c0f0 ply fe/c0f1 bne LFEC0FC ;if Y<>0 then skip MMFND and use passed Y fe/c0f3 ldx #__MMFND fe/c0f6 jsl __MM fe/c0fa bcs @retpld fe/c0fc LFEC0FC jsr getHandleYtoX fe/c0ff bcs @retpld fe/c101 ldal f:$000008,x ;QRY - TODO find out what __MMFND returns in X - undocumented! fe/c105 pha fe/c106 ldx #B0LST_MODULES_QRY ;get head of modules list fe/c109 LFEC109 ldal f:bob_ll_irq_pri__next,x ;get next module fe/c10d cmp #B0LST_MODULES_QRY ;check for back round to start fe/c110 beq @retpldpld ;exit with C = 1 fe/c112 tax ;transfer A to X fe/c113 cmp $01,S fe/c115 bne LFEC109 fe/c117 tsc fe/c118 tcd fe/c119 phb fe/c11a phk fe/c11b jsr LFEF22E fe/c11e pla fe/c11f plb fe/c120 pld fe/c121 sta bob_ll_irq_pri__mand fe/c123 sep #$20 rwid shortm fe/c125 phb fe/c126 pla fe/c127 sta bob_ll_irq_pri__psec fe/c129 clc fe/c12a rtl rwid longm fe/c12b @retpldpld pld fe/c12c @retpld pld fe/c12d rtl ******************************************************************************** * COP 2D - OPWRM - write module name * * * * Action: Given an address in BHA. this call will send the name of the module * * which exists at that addressto the VDU drivers. If no module exists at that * * address then the call returns with the carry bit set. * * * * On entry: BHA points to somewhere within a module. * * On exit: If C = 0 then the name of the module has been sent to the VDU * * drivers. * * If C = 1 then the module was not found. * * D preserved * ******************************************************************************** fe/c12e COP_2D cop COP_2C_OPFMA ;find the module fe/c130 bcs @ret ;branch if not found fe/c132 phb fe/c133 pha fe/c134 tsc fe/c135 tcd fe/c136 ldy #$0000 fe/c139 @lp lda [$01],y ;get chars from pointer on stack fe/c13b and #$00ff fe/c13e beq @done fe/c140 cmp #‘/’ fe/c143 beq @done ;module name terminator fe/c145 jsr modNameToUpper fe/c148 xba fe/c149 cop COP_00_OPWRC fe/c14b iny fe/c14c bne @lp fe/c14e @done pla fe/c14f plb fe/c150 clc fe/c151 @ret rtl ******************************************************************************** * COP 2C - OPFMA - find module given address within module * * * * Action: Given an address in BHA, this call will reutm in BHA the address of * * the name of the module tat exists at that address. If no module exists at * * that address then the call returns with the carry bit set. * * * * On entry: BHA points to somewhere within a module. * * On exit: If C = 0 then BHA points to the module name. * * If C = 1 then the module was not found. * * D preserved * ******************************************************************************** fe/c152 COP_2C phk fe/c153 jsr brlFindModuleByAddress fe/c156 stx bob_ll_irq_sec__flags fe/c158 bcs @ret fe/c15a sta bob_ll_irq_pri__mand fe/c15c sep #$20 rwid shortm fe/c15e phb fe/c15f pla fe/c160 sta bob_ll_irq_pri__psec fe/c162 rep #$20 rwid longm fe/c164 @ret rtl ******************************************************************************** * COP 18 - OPRLH - Read hex number * * * * Action: BHA points to a line of hex in meniory. This call translates a * * certain number of hex digits into nibbles stored starting at the location * * pointed to by DX. The number of nibbles required is in Y. * * * * On entry: BHA points to line of hexcharacters. * * DX points to location at which number is to be stored in direct * * page. * * Y contains the number of nibbles required. * * On exit: BHA points to the rest of the line. * * If C = 0 then DX points to the Y nibbles in direct page. * * If C = 1 then the call failed. * * DXY preserved * ******************************************************************************** fe/c165 COP_18 lda DPCOP_DP fe/c167 clc fe/c168 adc bob_ll_irq_sec__flags fe/c16a bcs @secrts fe/c16c tax fe/c16d lda bob_ll_irq_sec__dp fe/c16f inc A fe/c170 beq @secrts fe/c172 lsr A fe/c173 beq @secrts fe/c175 tay fe/c176 sep #$20 rwid shortm fe/c178 phx fe/c179 phy fe/c17a lda #$00 fe/c17c @zlp stal f:bob_ll_irq_pri__next,x ;zero the result fe/c180 inx fe/c181 dey fe/c182 bne @zlp fe/c184 ply fe/c185 plx fe/c186 rep #$20 rwid longm fe/c188 jsr scanHexBHA fe/c18b bcs @secrts fe/c18d LFEC18D jsr getCharBHAinc fe/c190 bcs @clcret fe/c192 jsr parseHexDigit fe/c195 bcs @clcret fe/c197 jsr LFEC201 fe/c19a bcs LFEC1A0 fe/c19c bra LFEC18D fe/c19e @clcret clc fe/c19f rtl fe/c1a0 LFEC1A0 jsr @lp2 fe/c1a3 @secrts sec fe/c1a4 rtl fe/c1a5 @lp2 jsr getCharBHAinc fe/c1a8 bcs @ret fe/c1aa jsr parseHexDigit fe/c1ad bcc @lp2 fe/c1af jsr decDPCOP_BHA fe/c1b2 clc fe/c1b3 @ret rts fe/c1b4 getCharBHAinc lda [bob_ll_irq_pri__mand] fe/c1b6 and #$00ff fe/c1b9 jsr incDPCOP_BHA fe/c1bc cmp #‘ ’ fe/c1bf bcs @retclc fe/c1c1 jsr decDPCOP_BHA fe/c1c4 sec fe/c1c5 rts fe/c1c6 @retclc cmp #‘:’ fe/c1c9 bcc @daft ;TODO: beautiful - I think this can go? fe/c1cb @daft clc fe/c1cc rts fe/c1cd parseHexDigit cmp #‘0’ fe/c1d0 bcc @retsec fe/c1d2 cmp #‘:’ fe/c1d5 bcc @sk09 fe/c1d7 and #$00df fe/c1da cmp #‘A’ fe/c1dd bcc @retsec fe/c1df cmp #‘G’ fe/c1e2 bcs @retsec fe/c1e4 sec fe/c1e5 sbc #$0037 fe/c1e8 clc fe/c1e9 rts fe/c1ea @sk09 sec fe/c1eb sbc #‘0’ fe/c1ee clc fe/c1ef rts fe/c1f0 @retsec sec fe/c1f1 rts fe/c1f2 scanHexBHA jsr getCharBHAinc fe/c1f5 bcs @retsec fe/c1f7 jsr parseHexDigit fe/c1fa bcs scanHexBHA fe/c1fc jsr decDPCOP_BHA fe/c1ff clc fe/c200 @retsec rts fe/c201 LFEC201 asl A fe/c202 asl A fe/c203 asl A fe/c204 asl A fe/c205 asl A fe/c206 asl A fe/c207 asl A fe/c208 asl A fe/c209 asl A fe/c20a asl A fe/c20b asl A fe/c20c asl A fe/c20d asl A fe/c20e jsr LFEC243 fe/c211 bcs LFEC23F fe/c213 asl A fe/c214 jsr LFEC243 fe/c217 bcs LFEC23F fe/c219 asl A fe/c21a jsr LFEC243 fe/c21d bcs LFEC23F fe/c21f asl A fe/c220 jsr LFEC243 fe/c223 bcs LFEC23F fe/c225 lda bob_ll_irq_sec__dp fe/c227 lsr A fe/c228 bcc LFEC241 fe/c22a phx fe/c22b phy fe/c22c sep #$20 rwid shortm fe/c22e LFEC22E inx fe/c22f dey fe/c230 bne LFEC22E fe/c232 dex fe/c233 lda #$0f fe/c235 cmpl f:bob_ll_irq_pri__next,x fe/c239 rep #$20 rwid longm fe/c23b ply fe/c23c plx fe/c23d bcs LFEC241 fe/c23f LFEC23F sec fe/c240 rts fe/c241 LFEC241 clc fe/c242 rts fe/c243 LFEC243 pha fe/c244 sep #$20 rwid shortm fe/c246 phx fe/c247 phy fe/c248 LFEC248 ldal f:bob_ll_irq_pri__next,x fe/c24c rol A fe/c24d stal f:bob_ll_irq_pri__next,x fe/c251 inx fe/c252 dey fe/c253 bne LFEC248 fe/c255 ply fe/c256 plx fe/c257 rep #$20 rwid longm fe/c259 pla fe/c25a rts fe/c25b incDPCOP_BHA inc bob_ll_irq_pri__mand fe/c25d bne @sk fe/c25f sep #$20 rwid shortm fe/c261 inc bob_ll_irq_pri__psec fe/c263 rep #$20 rwid longm fe/c265 @sk rts fe/c266 decDPCOP_BHA pha fe/c267 lda bob_ll_irq_pri__mand fe/c269 cmp #$0001 fe/c26c dec bob_ll_irq_pri__mand fe/c26e bcs @ret fe/c270 sep #$20 rwid shortm fe/c272 dec bob_ll_irq_pri__psec fe/c274 rep #$20 rwid longm fe/c276 @ret pla fe/c277 rts ******************************************************************************** * COP 19 - OPRLS - ? * * * * Appears to read a string surrounded by quotes into a buffer at DPX, length Y * ******************************************************************************** fe/c278 COP_19 lda DPCOP_DP fe/c27a clc fe/c27b adc bob_ll_irq_sec__flags fe/c27d bcs @retsec fe/c27f tax fe/c280 @scanlp jsr getCharBHAinc ;skip forward looking for quotes fe/c283 bcs @retsec fe/c285 cmp #‘"’ fe/c288 bne @scanlp fe/c28a ldy #$0000 fe/c28d @lp jsr getCharBHAinc fe/c290 bcs @retsec fe/c292 cmp #‘"’ fe/c295 bne @noq fe/c297 jsr getCharBHAinc ;check for "" fe/c29a bcs @zetend fe/c29c cmp #‘"’ fe/c29f bne @decretok fe/c2a1 @noq jsr @staDPY ;store char fe/c2a4 iny fe/c2a5 beq @retsec fe/c2a7 bra @lp fe/c2a9 @decretok jsr decDPCOP_BHA fe/c2ac @zetend lda #$0000 fe/c2af jsr @staDPY fe/c2b2 cpy bob_ll_irq_sec__dp fe/c2b4 sty bob_ll_irq_sec__dp fe/c2b6 rtl fe/c2b7 @retsec sec fe/c2b8 rtl fe/c2b9 @staDPY cpy bob_ll_irq_sec__dp fe/c2bb bcs @ret fe/c2bd phd fe/c2be phx fe/c2bf pld fe/c2c0 sep #$20 rwid shortm fe/c2c2 sta [bob_ll_irq_pri__next],y fe/c2c4 rep #$20 rwid longm fe/c2c6 pld fe/c2c7 @ret rts ******************************************************************************** * COP 1C - OPSCX - Save context * * * * Action: Used by the menu program (and others) to save the context of the * * screen and the operating system variables when switching to a different * * task. It must be used only after an OPSSC call. * * * * On entry: No Requirements. * * On exit: If C = 0 then the call succeeded and Y contains the context pool * * handle. * * If C = 1 then the call failed. * * D preserved * ******************************************************************************** fe/c2c8 COP_1C ldx #__VDU_4A fe/c2cb phk fe/c2cc jsr callModVDU ;Get VDU variables size QRY - VDU mod seems to return 000080 fe/c2cf ldx #$000c fe/c2d2 jsr BXXaddHA fe/c2d5 ldy #$0002 fe/c2d8 ldx #__MMALA fe/c2db jsl __MM fe/c2df bcs LFEC2EE fe/c2e1 sty bob_ll_irq_sec__dp fe/c2e3 jsr saveCTX fe/c2e6 ldx #__VDU_42 fe/c2e9 phk fe/c2ea jsr callModVDU fe/c2ed clc fe/c2ee LFEC2EE rtl ******************************************************************************** * COP 1D - OPRCX - Restore context * * * * Action: Used by the menu program (and othets) to restore a context * * previously saved using OPSCX. It must be used only before an OPRSC call. * * * * On entry: Y = context pool handle allocated by OPSCX. Must be in 16bit * * XYmode. * * On exit: If C = O then the context is restored and the pool freed. * * If C = I then the call failed. * * D preserved * ******************************************************************************** fe/c2ef COP_1D ldx #__MMBAS fe/c2f2 jsl __MM fe/c2f6 bcs @ret fe/c2f8 jsr restoreCTX fe/c2fb ldx #__VDU_46 fe/c2fe phk fe/c2ff jsr callModVDU fe/c302 ldy bob_ll_irq_sec__dp fe/c304 ldx #__MMFP fe/c307 jsl __MM fe/c30b @ret rtl ******************************************************************************** * COP 1E - OPSSC - save the screen * * * * Action: Used by the menu program (and others) to save the contents of the * * screen display. * * * * On entry: Must be in 16bit XY mode. * * On exit: If C = 0 then the call succeeded and Y contains the screenpool * * handle. * * If C = 1 then the call failed. * * D preserved * ******************************************************************************** fe/c30c COP_1E ldx #__VDU_40 fe/c30f phk fe/c310 jsr callModVDU fe/c313 ldy #$0002 fe/c316 ldx #__MMASA fe/c319 jsl __MM fe/c31d bcs LFEC329 fe/c31f sty bob_ll_irq_sec__dp fe/c321 ldx #__VDU_44 fe/c324 phk fe/c325 jsr callModVDU fe/c328 clc fe/c329 LFEC329 rtl ******************************************************************************** * COP 1F - OPRSC - restore the screen * * * * Action: Used by the menu program (and others) to restore the contents of a * * screen previously saved using OPSSC. * * * * On entry: Y = screen pool handle allocated by OPSSC. * * On exit: If C = O then the screen is restored and the pool freed. * * If C = 1 then the call failed. * * D preserved * ******************************************************************************** fe/c32a COP_1F ldx #__MMBAS fe/c32d jsl __MM ;check the pool handle and get the base fe/c331 bcs @ret fe/c333 ldx #__VDU_48 fe/c336 phk fe/c337 jsr callModVDU ;copy screen back ******************************************************************************** * COP 49 - OPFSC - free screen * * * * Action: Frees a saved screen which is no longer required. * * * * On entry: Y = screen pool handle allocated by OPSSC. * * On exit: If C = O then the screen is freed and the pool handle freed. * * If C = 1 then the call failed. * * D preserved * ******************************************************************************** fe/c33a COP_49 ldy bob_ll_irq_sec__dp fe/c33c ldx #__MMFP fe/c33f jsl __MM ;free the pool fe/c343 @ret rtl ******************************************************************************** * COP 5E - OPFCX free context of VDU and MOS (including fonts) * * * * Action: Frees a saved context that is no longer required. * * * * On entry: Y = context pool handle allocated by OPSCX. * * On exit: If C = 0 then the context is freed and the pool handle freed. * * If C = 1 then the call failed to free the context * * D preserved * ******************************************************************************** fe/c344 COP_5E ldx #__MMBAS fe/c347 jsl __MM fe/c34b bcs @retsec fe/c34d phy fe/c34e ldx #$000c fe/c351 jsr BXXaddHA fe/c354 ldx #$0052 fe/c357 phk fe/c358 jsr callModVDU fe/c35b ply fe/c35c bra COP_49 fe/c35e @retsec sec fe/c35f rts ; This appears to be a set of B0 locations that are saved on a context switch fe/c360 tblVarsToSaveCtx dd2 $ff13 fe/c362 dd2 $ff14 fe/c364 dd2 $a552 fe/c366 dd2 $a553 fe/c368 dd2 $a551 fe/c36a dd2 $a571 fe/c36c dd2 $a572 fe/c36e dd2 $a573 fe/c370 dd2 $a574 fe/c372 dd2 $a576 fe/c374 dd2 $a57d fe/c376 dd2 $a53c fe/c378 dd2 $0000 fe/c37a restoreCTX clc fe/c37b bra LFEC37E fe/c37d saveCTX sec fe/c37e LFEC37E phd fe/c37f phb fe/c380 pha fe/c381 tsc fe/c382 tcd fe/c383 phk dbank K (auto) fe/c384 plb fe/c385 ldx #$0000 fe/c388 txy fe/c389 @ctxReStLp phx fe/c38a lda tblVarsToSaveCtx & $ffff,x fe/c38d beq @done fe/c38f tax fe/c390 sep #$20 rwid shortm fe/c392 bcc @dores fe/c394 ldal f:bob_ll_irq_pri__next,x fe/c398 sta [bob_ll_irq_sec__dp],y fe/c39a bra @sk fe/c39c @dores lda [bob_ll_irq_sec__dp],y fe/c39e stal f:bob_ll_irq_pri__next,x fe/c3a2 @sk rep #$20 rwid longm fe/c3a4 iny fe/c3a5 plx fe/c3a6 inx fe/c3a7 inx fe/c3a8 bra @ctxReStLp fe/c3aa @done plx fe/c3ab bcc @skres fe/c3ad lda #$0000 fe/c3b0 stal f:SYS_ESCAPE_FLAG_QRY fe/c3b4 @skres pla fe/c3b5 plb fe/c3b6 pld fe/c3b7 ldx #$000c fe/c3ba BXXaddHA php fe/c3bb phx fe/c3bc clc fe/c3bd adc $01,S fe/c3bf plx fe/c3c0 bcc @sk fe/c3c2 sep #$20 rwid shortm fe/c3c4 phb fe/c3c5 pla fe/c3c6 inc A fe/c3c7 pha fe/c3c8 plb fe/c3c9 @sk plp rwid longm fe/c3ca rts ******************************************************************************** * COP 25 - OPCRC - superceded use COP_32 OPSUM * ******************************************************************************** fe/c3cb COP_25 cop COP_0F_OPERR fe/c3cd zstr “Bad call - OPCRC has been superceded by OPSUM” ******************************************************************************** * COP 4C - OPBGB get block * * Action: Reads the number of bytes specified in the control block from the * * currently open file whose handle is in Y, to the address in memory specified * * in the control block. The bytes are read from the file starting at the * * position given by the sequential pointer. The sequential pointer can be * * altered using OPWSP. * * * * On Entry: Y = handle returned by OPOPN. * * BHA points to a control block of the following form. * * Offset * * +0 Start address of memory (low byte first) * * +4 Length of memory to be transferred (low byte first) * * On Exit: If C = 0 then X = O means transfer successful. * * X = 2 means that fewer bytes were transferred than * * specified in the control block, and the * * control * * block is updated to show the number of bytes * * that were transferred. * * If C = 1 then the transfer was unsuccessful. X = error code. BHA * * points to a zero terminated error message * ******************************************************************************** fe/c3fb COP_4C php fe/c3fc phd fe/c3fd rep #$30 fe/c3ff ldx #$0020 fe/c402 phx fe/c403 bra LFEC40D ******************************************************************************** * COP 4D - OPBPB put block * * Action: Writes the number of bytes specified in the control block. from the * * address in memory specified in the control block, to the file whose handle * * is in Y. The bytes are written to the file starting at the position given by * * the sequential pointer. The sequential pointer can be altered using OPWSP. * * On entry: Y = handle returned by OPOPN. * * BHA points to a control block ot the following form. * * Offset * * +0 Start address of memory (low byte first) * * +4 Length of memory to be transferred (low byte first) * * On exit: If C = 0 then transfer was successful. * * If C = 1 then the transfer was unsuccessful. X = error code. BHA * * points to a zero terminated error message. * * Y preserved * ******************************************************************************** fe/c405 COP_4D php fe/c406 phd fe/c407 rep #$30 fe/c409 ldx #$0022 fe/c40c phx fe/c40d LFEC40D phy fe/c40e phk fe/c40f jsr callDevHandle fe/c412 bcs LFEC41C fe/c414 LFEC414 ply fe/c415 ply fe/c416 ply fe/c417 php fe/c418 ply fe/c419 brl retCopXBHA fe/c41c LFEC41C txy fe/c41d bne LFEC414 fe/c41f ldy #$0006 fe/c422 jsr LFEC6AA fe/c425 lda bob_ll_irq_pri__psec fe/c427 ora bob_ll_irq_pri__fpand fe/c429 beq LFEC445 fe/c42b lda #$ffff fe/c42e dec bob_ll_irq_pri__psec fe/c430 cmp bob_ll_irq_pri__psec fe/c432 bne LFEC436 fe/c434 dec bob_ll_irq_pri__fpand fe/c436 LFEC436 ldx DPCOP_K fe/c438 cpx #$0020 fe/c43b bne LFEC442 fe/c43d jsr LFEC44C fe/c440 bra LFEC445 fe/c442 LFEC442 jsr LFEC496 fe/c445 LFEC445 stx DPCOP_K fe/c447 plx fe/c448 txs fe/c449 jmp LFEC6BD fe/c44c LFEC44C ldy bob_ll_irq_sec__type fe/c44e cop COP_0A_OPBGT fe/c450 sep #$30 rwid shortm,shortx fe/c452 sta [bob_ll_irq_sec__flags] fe/c454 rep #$30 rwid longm,longx fe/c456 bcs LFEC473 fe/c458 lda #$ffff fe/c45b dec bob_ll_irq_pri__psec fe/c45d cmp bob_ll_irq_pri__psec fe/c45f bne LFEC467 fe/c461 dec bob_ll_irq_pri__fpand fe/c463 cmp bob_ll_irq_pri__fpand fe/c465 beq LFEC46F fe/c467 LFEC467 inc bob_ll_irq_sec__flags fe/c469 bne LFEC44C fe/c46b inc bob_ll_irq_pri__mand fe/c46d bra LFEC44C fe/c46f LFEC46F ldx #$0000 fe/c472 rts fe/c473 LFEC473 phd fe/c474 lda $0f fe/c476 tcd fe/c477 ldy #$0000 fe/c47a sec fe/c47b lda $07,S fe/c47d sbc [bob_ll_irq_pri__mand],y fe/c47f ldy #$0004 fe/c482 sta [bob_ll_irq_pri__mand],y fe/c484 ldy #$0002 fe/c487 lda $09,S fe/c489 sbc [bob_ll_irq_pri__mand],y fe/c48b ldy #$0006 fe/c48e sta [bob_ll_irq_pri__mand],y fe/c490 ldx #$0002 fe/c493 clc fe/c494 pld fe/c495 rts fe/c496 LFEC496 ldy bob_ll_irq_sec__type fe/c498 lda [bob_ll_irq_sec__flags] fe/c49a cop COP_0B_OPBPT fe/c49c bcs LFEC4B6 fe/c49e lda #$ffff fe/c4a1 dec bob_ll_irq_pri__psec fe/c4a3 cmp bob_ll_irq_pri__psec fe/c4a5 bne LFEC4AD fe/c4a7 dec bob_ll_irq_pri__fpand fe/c4a9 cmp bob_ll_irq_pri__fpand fe/c4ab beq LFEC4B5 fe/c4ad LFEC4AD inc bob_ll_irq_sec__flags fe/c4af bne LFEC496 fe/c4b1 inc bob_ll_irq_pri__mand fe/c4b3 bra LFEC496 fe/c4b5 LFEC4B5 clc fe/c4b6 LFEC4B6 rts ******************************************************************************** * COP 4E - OPLOD - load file * * * * Action: Loads a file into memwy from the specified filing system. * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 File LOAD address (low byte first) * * +8 File EXEC address (low byte first) * * +12 Initial memory location (low byte first) * * +16 Length of memory area (low byte first) * * * * A zero length parameter will cause anylength of file to be loaded. * * * * The length is updated upon exit to show the number of bytes * * actually * * loaded. * * The load address and execution address are not parameters they are * * * * set on exit to the file's values. * * On exit: If C = 0 and X = O then the file was loaded successfully and the * * load and execution addresses are valid. * * If C = 0 and X = 2 then the file was loaded successfully but the * * load and execution addressess are invalid. * * If C = 1 then the load was unsuccessful, X = error code. BHA * * points * * to a zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c4b7 COP_4E php fe/c4b8 phd fe/c4b9 rep #$30 fe/c4bb ldx #__DVLOD ;DVLOD - load a file fe/c4be phx fe/c4bf bra LFEC4C9 ******************************************************************************** * COP 4F - OPSAV - save file * * * * Action: Saves an area of memory to the specified filing system. * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 File LOAD address (low byte first) * * +8 File EXEC address (low byte first) * * +12 Initial memory location (low byte first) * * +16 Length ot memory area (low byte first) * * On exit: If C = 0 and X = 0 then the file was saved successfully and the * * load and execution addresses were successfully updated. * * If C = 0 and X = 2 then the file was saved successfully but the * * load and execution addresses were not successfully updated. * * If C = 1 then the save was unsuccessful. X = error code. BHA * * points * * to zero-terminated error message. * * Y preserved. * ******************************************************************************** fe/c4c1 COP_4F php fe/c4c2 phd fe/c4c3 rep #$30 fe/c4c5 ldx #__DVSAV fe/c4c8 phx fe/c4c9 LFEC4C9 phy fe/c4ca jsr callFSX_BHAblock fe/c4cd bcs LFEC4D7 fe/c4cf LFEC4CF ply fe/c4d0 ply fe/c4d1 ply fe/c4d2 php fe/c4d3 ply fe/c4d4 brl retCopXBHA fe/c4d7 LFEC4D7 txy fe/c4d8 bne LFEC4CF fe/c4da ldy #$0012 fe/c4dd jsr LFEC6AA fe/c4e0 lda #$ffff fe/c4e3 dec $13 fe/c4e5 cmp $13 fe/c4e7 bne LFEC4EB fe/c4e9 dec $15 fe/c4eb LFEC4EB ldx $19 fe/c4ed cpx #$0024 fe/c4f0 bne LFEC4F7 fe/c4f2 jsr LFEC501 fe/c4f5 bra LFEC4FA fe/c4f7 LFEC4F7 jsr LFEC5B1 fe/c4fa LFEC4FA stx $19 fe/c4fc plx fe/c4fd txs fe/c4fe jmp LFEC6BD fe/c501 LFEC501 lda $13 fe/c503 and $15 fe/c505 cmp #$ffff fe/c508 bne LFEC50F fe/c50a sec fe/c50b ldx #$0000 fe/c50e rts fe/c50f LFEC50F phd fe/c510 lda $1b fe/c512 tcd fe/c513 sep #$30 rwid shortm,shortx fe/c515 lda bob_ll_irq_pri__psec fe/c517 pha fe/c518 plb fe/c519 rep #$30 rwid longm,longx fe/c51b lda bob_ll_irq_pri__mand fe/c51d pld fe/c51e cop COP_50_OPRLE fe/c520 bcs LFEC528 fe/c522 pea $0000 fe/c525 tay fe/c526 bra LFEC543 fe/c528 LFEC528 pea $0002 fe/c52b lda #$ffff fe/c52e sta $19 fe/c530 bra LFEC543 fe/c532 dd1 $98 fe/c533 dd1 $18 fe/c534 dd1 $e5 fe/c535 dd1 $13 fe/c536 dd1 $8a fe/c537 dd1 $e5 fe/c538 dd1 $15 fe/c539 dd1 $90 fe/c53a dd1 $08 fe/c53b dd1 $f0 fe/c53c dd1 $06 fe/c53d LFEC53D plx fe/c53e ldx #$8000 fe/c541 sec fe/c542 rts fe/c543 LFEC543 ldy #$0040 fe/c546 jsr LFEC604 fe/c549 bcc LFEC54E fe/c54b brl LFEC5AF fe/c54e LFEC54E sty $17 fe/c550 LFEC550 cop COP_0A_OPBGT fe/c552 bcs LFEC573 fe/c554 sep #$30 rwid shortm,shortx fe/c556 sta [$0f] fe/c558 rep #$30 rwid longm,longx fe/c55a lda #$ffff fe/c55d dec $13 fe/c55f cmp $13 fe/c561 bne LFEC569 fe/c563 dec $15 fe/c565 cmp $15 fe/c567 beq LFEC53D fe/c569 LFEC569 ldy $17 fe/c56b inc $0f fe/c56d bne LFEC550 fe/c56f inc $11 fe/c571 bra LFEC550 fe/c573 LFEC573 phy fe/c574 cop COP_46_OPEND fe/c576 ply fe/c577 phx fe/c578 pha fe/c579 phb fe/c57a ldy $17 fe/c57c cop COP_45_OPCLS fe/c57e plb fe/c57f pla fe/c580 plx fe/c581 bcs LFEC5AF fe/c583 and #$0001 fe/c586 bne LFEC58E fe/c588 sec fe/c589 ldx #$9000 fe/c58c bra LFEC5AF fe/c58e LFEC58E phd fe/c58f lda $1b fe/c591 tcd fe/c592 ldy #$000c fe/c595 sec fe/c596 lda $15,S fe/c598 sbc [bob_ll_irq_pri__mand],y fe/c59a ldy #$0010 fe/c59d sta [bob_ll_irq_pri__mand],y fe/c59f ldy #$000e fe/c5a2 lda $17,S fe/c5a4 sbc [bob_ll_irq_pri__mand],y fe/c5a6 ldy #$0012 fe/c5a9 sta [bob_ll_irq_pri__mand],y fe/c5ab pld fe/c5ac clc fe/c5ad plx fe/c5ae rts fe/c5af LFEC5AF ply fe/c5b0 rts fe/c5b1 LFEC5B1 ldy #$0080 fe/c5b4 jsr LFEC604 fe/c5b7 bcc LFEC5BC fe/c5b9 brl LFEC5F4 fe/c5bc LFEC5BC lda $13 fe/c5be and $15 fe/c5c0 cmp #$ffff fe/c5c3 beq LFEC5E4 fe/c5c5 LFEC5C5 phy fe/c5c6 lda [$0f] fe/c5c8 cop COP_0B_OPBPT fe/c5ca ply fe/c5cb bcs LFEC5FA fe/c5cd lda #$ffff fe/c5d0 dec $13 fe/c5d2 cmp $13 fe/c5d4 bne LFEC5DC fe/c5d6 dec $15 fe/c5d8 cmp $15 fe/c5da beq LFEC5E4 fe/c5dc LFEC5DC inc $0f fe/c5de bne LFEC5C5 fe/c5e0 inc $11 fe/c5e2 bra LFEC5C5 fe/c5e4 LFEC5E4 cop COP_45_OPCLS fe/c5e6 bcs LFEC5F4 fe/c5e8 lda #$0003 fe/c5eb cop COP_24_OPCVD fe/c5ed cop COP_51_OPWLE fe/c5ef bcs LFEC5F5 fe/c5f1 ldx #$0000 fe/c5f4 LFEC5F4 rts fe/c5f5 LFEC5F5 ldx #$0002 fe/c5f8 clc fe/c5f9 rts fe/c5fa LFEC5FA phx fe/c5fb phb fe/c5fc pha fe/c5fd cop COP_45_OPCLS fe/c5ff pla fe/c600 plb fe/c601 plx fe/c602 sec fe/c603 rts fe/c604 LFEC604 lda bob_ll_irq_pri__mand fe/c606 xba fe/c607 pha fe/c608 plb fe/c609 plb fe/c60a lda bob_ll_irq_sec__flags fe/c60c cop COP_44_OPOPN fe/c60e rts ******************************************************************************** * COP 50 - OPRLE - read load address, execute address, and length of file * * * * Action: Reads the load address, execute address, and length of a file. * * * * On Entry: BHA points to a contnd block of the following form. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 File LOAD address (low byte first) * * +8 File EXEC address (low byte first) * * * * The load address and execution address are not paramcters they * * are set on exit to the file's values. * * On Exit: If C = 0 then the control block has been updated to give the load * * and execute addresses, and the length is in XHA (2 bytes in X, * * 4 bytes in total). * * If C = 1 then the call was unsuccessful, X = error code, * * BHA points to a zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c60f COP_50 ldx #__DVRLE fe/c612 jsr callFSX_BHAblock fe/c615 bcs LFEC61A fe/c617 LFEC617 brl retCopXBHA fe/c61a LFEC61A txy fe/c61b bne LFEC617 fe/c61d ldy #$0001 fe/c620 lda [bob_ll_irq_pri__mand],y fe/c622 pha fe/c623 plb fe/c624 plb fe/c625 lda [bob_ll_irq_pri__mand] fe/c627 ldy #$0040 fe/c62a cop COP_44_OPOPN fe/c62c bcc LFEC631 fe/c62e brl retCopXBHA fe/c631 LFEC631 phy fe/c632 lda #$0000 fe/c635 ldy #$000a fe/c638 LFEC638 sta [bob_ll_irq_pri__mand],y fe/c63a dey fe/c63b dey fe/c63c cpy #$0004 fe/c63f bcs LFEC638 fe/c641 ply fe/c642 tsx fe/c643 pea $0000 fe/c646 pea $0000 fe/c649 tsc fe/c64a phx fe/c64b inc A fe/c64c pea $0000 fe/c64f plb fe/c650 plb fe/c651 cop COP_57_OPRLL fe/c653 bcc @clcexit fe/c655 phk fe/c656 per @secexit-1 fe/c659 brl retCopXBHA rwid shortm,shortx fe/c65c @secexit cop COP_45_OPCLS fe/c65e plx fe/c65f txs fe/c660 sec fe/c661 rtl rwid longm,longx fe/c662 @clcexit cop COP_45_OPCLS fe/c664 pla fe/c665 pla fe/c666 plx fe/c667 clc fe/c668 brl retCopXBHA ******************************************************************************** * COP 51 - OPWLE - write load address and execute address of file * * * * Action: Writes new load and execute addresses to a file. * * * * On entry: BHA points to a control block of the following fonn. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 File LOAD address (low byte first) * * +8 File EXEC address (low byte first) * * On exit: If C = 0 then the file has been updated. * * If C = 1 then the update was unsuccessful. X = error code, * * BHA points to a zero terminated error message. * * Y preserved * ******************************************************************************** fe/c66b COP_51 ldx #__DVWLE fe/c66e bra callFSTODOrename ******************************************************************************** * COP 52 - OPRAT - read attributes * * * * Action: Reads the 4-byte file attributes. * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 File attributes (low byte first) * * * * The attributes have the following meanings: * * low byte bit 0 0 not readable by owner * * 1 readable by owner * * bit 1 0 not writable by owner * * 1 writable by owner * * bit 2 undefined * * bit 3 0 not locked * * 1 locked * * bit 4 0 not readable by public * * 1 readable by public * * bit 5 0 not writable by public * * 1 writable by public * * bit 6 undefined * * bit 7 undefined * * low middle byte days * * high middle byte * * bits 0..3 months * * bits 4..7 years since 1981 * * high byte undefined * * On exit: If C = 0 and X = l then a file was found and the attributes were * * read successfully. * * If C = 0 and X = 2 then a directory was found and the attributes * * were read successfully. * * If C = 1 then the call was unsuccessful, X = enor code, BHA * * points * * to a zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c670 COP_52 ldx #__DVRAT fe/c673 bra callFSTODOrename ******************************************************************************** * COP 53 - OPWAT - write file attributes * * * * Action: Writes the 4-byte file attributes * * * * For parameters see OPRAT above * ******************************************************************************** fe/c675 COP_53 ldx #__DVWAT fe/c678 bra callFSTODOrename ******************************************************************************** * COP 54 - OPRSP - read sequential pointer * * * * Action: Reads the sequential pointer the position within a file at which the * * next read/write operation will occur. * * * * On entry: Y = handle * * BHA points to a control block of the following form. * * Offset * * +0 Sequence number or logical length (low byte first) * * * * On exit: If C = 0 then the sequential pointer was read successfully into * * the control block. * * If C = 1 then the call was unsuccessful, X = error code, BHA * * points * * to a zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c67a COP_54 ldx #__DVRSP fe/c67d bra LFEC6A3 ******************************************************************************** * COP 55 - write sequential pointer * * * * Action: Writes a new value to the sequential pointer - the position within a * * file at which the next read/write operation will occur. * * * * Parameters are as for COP 54 OPRSP * ******************************************************************************** fe/c67f COP_55 ldx #__DVWSP fe/c682 bra LFEC6A3 ******************************************************************************** * COP 56 - OPRPL - read physical length * * * * Action: Reads the physical length of a file, ie the actual length stored on * * the media. * * * * On entry: BHA points to a contnd block of the following form. * * Offset * * +0 Pointer to name of file (low byte first) * * +4 length (low byte first) * * On exit: If C = 0 then the physical length was read successfully into the * * control block. * * If C = 1 then the call was unsuccessful. X = error code, BHA * * points * * to a zero-teiminaied error message. * * Y preserved * ******************************************************************************** fe/c684 COP_56 ldx #__DVRPL fe/c687 bra LFEC6A3 ******************************************************************************** * COP 57 - OPRLL - read logical length * * Action: Reads the logical length (extent) ot a file. * * On entry: Y = handle * * BHA points to a control block of the following form. * * Offset * * +0 Sequence number or length (low byte first) * * On exit: If C = 0 then the logical length was read successfully into the * * control block. * * If C = 1 then the call was unsuccessful, X = error code, BHA * * points * * to a zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c689 COP_57 ldx #__DVRLL fe/c68c bra LFEC6A3 ******************************************************************************** * COP 58 - OPWLL - write logical length * * * * Action: Writes the logical length (extent) of a file. * * * * On entry: Y = handle * * BHA points to a control block of the following form. * * Offset * * +0 Sequence number or length (low byte first) * * On exit: If C = 0 then the logical length was written successfully. * * If C = 1 then the call was unsuccessful. X = error code, BHA points * * * * to a zero-tenninated error message. * * Y preserved * ******************************************************************************** fe/c68e COP_58 ldx #__DVWLL fe/c691 bra LFEC6A3 ******************************************************************************** * COP 50 - OPRCH - read catalogue header and information * * * * Action: Given the pathname, which may contain wildcards, this call will give * * the full directory name and information about that directory. * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to name of directory (low byte first) * * +4 Pointer to 49 byte long buffer area (low byte first) * * * * On exit: If C = 0, the 49 byte buffer area specified in the control block * * returns with the following information. * * BHA undefined * * Buffer contents after call: * * Offset * * +0 0 = owner. &FF = public * * +1 Cycle number * * +2 Boot option * * +3..12 Directory name (without wildcards), left-justified padded * * with spaces * * 13..28 CSD disc name, same format (used to be last) * * 29..38 CSD name, same format * * 39..48 LIB name, same format * * * * If C = 1 then directory not found, X = error code, BHA points to * * zero-terminated error message. * * Y preserved * * * ******************************************************************************** fe/c693 COP_59 ldx #__DVRCH fe/c696 bra callFSTODOrename ******************************************************************************** * COP 5A - OPRFN - Read file (object) names from directory * * * * Action: Given the pathname, which may contain wildcards, this call will read * * the number and names of entries in the specified directory. The information * * is put in an area of memory whose start address is supplied. Each name is * * terminated by rero (&00). * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to name of directory (low byte first) * * +4 Pointer to start of memory area (low byte first) * * +8 Type of info wanted * * +10 Number of names * * +12 Filing system work space (16 bytes) * * (Initially the whole area should be zero) * * * * The type of info values are: * * 0 for name only (maximum 16 bytes per name) , * * 1 for short information (maximum 20 bytes per entry) * * 2 for full information (maximum 80 bytes per entry) * * * * The actual content of these results is filing system dependent * * The number of names is a parameter which can be set so the call * * will read up to that number of entries. If there are any remaining * * * * then the call can be used again, without disturbing the control * * block, to carry on from where it left off. For the first call * * however, the workspace should be zeroed. * * On exit: If C = 0 then X = the number of names read, and the names and * * info are in memory separated by zeros. * * If C = 1 then directory not found, X = error code, BHA points to * * zero-terminated error message. * * Y preserved * ******************************************************************************** fe/c698 COP_5A ldx #__DVRFN fe/c69b bra callFSTODOrename ;TODO: remove branch to next instr fe/c69d callFSTODOrename jsr callFSX_BHAblock fe/c6a0 brl retCopXBHA fe/c6a3 LFEC6A3 phk fe/c6a4 jsr callDevHandle fe/c6a7 brl retCopXBHA fe/c6aa LFEC6AA pla fe/c6ab sta bob_ll_irq_sec__flags fe/c6ad tsx fe/c6ae LFEC6AE lda [bob_ll_irq_pri__mand],y fe/c6b0 pha fe/c6b1 dey fe/c6b2 dey fe/c6b3 bpl LFEC6AE fe/c6b5 phx fe/c6b6 tsx fe/c6b7 lda bob_ll_irq_sec__flags fe/c6b9 pha fe/c6ba txa fe/c6bb tcd fe/c6bc rts fe/c6bd LFEC6BD ply fe/c6be plx fe/c6bf pld fe/c6c0 stx bob_ll_irq_sec__flags fe/c6c2 sta bob_ll_irq_pri__mand fe/c6c4 sep #$30 rwid shortm,shortx fe/c6c6 phb fe/c6c7 pla fe/c6c8 sta bob_ll_irq_pri__psec fe/c6ca bcs LFEC6CF fe/c6cc plp fe/c6cd clc fe/c6ce rtl fe/c6cf LFEC6CF plp fe/c6d0 sec fe/c6d1 rtl ******************************************************************************** * COP 5C - OPREN - rename an object * * * * Action: Will attempt to rename an object (file or directory). * * * * On entry: BHA points to a control block of the following form. * * Offset * * +0 Pointer to old filename (low byte first) * * +4 Pointer to new filename (low byte first) * * On exit: If C = 0 then the object has been renamed. * * If C = I then object not found or not renamed. X = error code, BHA * * * * points to zero terminated error message. * * Y preserved * ******************************************************************************** rwid longm,longx fe/c6d2 COP_5C phd fe/c6d3 phd fe/c6d4 phd fe/c6d5 phd fe/c6d6 phd fe/c6d7 tsx fe/c6d8 phx fe/c6d9 pld fe/c6da phk fe/c6db jsr skipSpacesBHA fe/c6de phk fe/c6df jsr getFSTrampolineFromprefix fe/c6e2 bcs @badfilename fe/c6e4 pha fe/c6e5 tya fe/c6e6 and #$0020 fe/c6e9 beq @plaerrBadFilename fe/c6eb pla fe/c6ec sta bob_ll_irq_sec__dp fe/c6ee phb fe/c6ef phb fe/c6f0 ply fe/c6f1 sty bob_ll_irq_sec__flags fe/c6f3 stx bob_ll_irq_pri__mand fe/c6f5 phk fe/c6f6 jsr skipFileNameAndTrailingSpaces fe/c6f9 phk fe/c6fa jsr getFSTrampolineFromprefix fe/c6fd bcs @badfilename fe/c6ff bvc LFEC703 fe/c701 ldx bob_ll_irq_pri__mand fe/c703 LFEC703 pha fe/c704 tya fe/c705 and #$0020 fe/c708 beq @plaerrBadFilename fe/c70a pla fe/c70b cpx bob_ll_irq_pri__mand fe/c70d bne @badfilename fe/c70f sta bob_ll_irq_pri__mand fe/c711 phb fe/c712 phb fe/c713 pla fe/c714 sta bob_ll_irq_pri__psec fe/c716 lda #$0001 fe/c719 cop COP_24_OPCVD fe/c71b txy fe/c71c ldx #__DVREN fe/c71f phk fe/c720 jsr callFSModuleTrampolineInY fe/c723 bra LFEC739 fe/c725 @plaerrBadFilename pla fe/c726 @badfilename cop COP_26_OPBHA fe/c728 zstr “Bad filename” fe/c735 ldx #$0001 fe/c738 sec fe/c739 LFEC739 pld fe/c73a pld fe/c73b pld fe/c73c pld fe/c73d pld fe/c73e brl retCopXBHA ******************************************************************************** * COP 5B - OPDEL - delete anamed object * * * * Action: This call will attempt to delete a named object (ie a file or a * * directory) from a directory. * * * * On entry: BHA points to the object name. * * On exit: If C = 0 then the object was deleted. * * If C = 1 then object not found or not deleted, X = error code. * * BHA points to zero terminated error message. * * Y preserved * ******************************************************************************** fe/c741 COP_5B phk fe/c742 jsr skipSpacesBHA fe/c745 phk fe/c746 jsr getFSTrampolineFromprefix fe/c749 bcs LFEC75E fe/c74b pha fe/c74c tya fe/c74d and #$0020 fe/c750 beq LFEC75D fe/c752 pla fe/c753 txy fe/c754 ldx #__DVDEL fe/c757 phk fe/c758 jsr callFSModuleTrampolineInY fe/c75b bra LFEC761 fe/c75d LFEC75D pla fe/c75e LFEC75E jsr cop26BadNameX1 fe/c761 LFEC761 brl retCopXBHA fe/c764 LFEC764 phk fe/c765 jsr skipSpacesBHA fe/c768 phk fe/c769 jsr getFSTrampolineFromprefix fe/c76c bcc LFEC780 fe/c76e cop COP_26_OPBHA fe/c770 zstr “Bad prefix” fe/c77b ldx #$0001 fe/c77e sec fe/c77f rts fe/c780 LFEC780 txy fe/c781 ldx #__DVUNK fe/c784 phk fe/c785 jsr callFSModuleTrampolineInY fe/c788 bcc LFEC7A0 fe/c78a pha fe/c78b txa fe/c78c lsr A fe/c78d pla fe/c78e bcs LFEC7A0 fe/c790 inx fe/c791 cop COP_26_OPBHA fe/c793 zstr “Bad command” fe/c79f sec fe/c7a0 LFEC7A0 rts ******************************************************************************** * This is a generic entry point for calls such as DVRLE which require a * * pointer to a control block * * * * The filename is parsed and the required FS module found and the call passed * * on to the module * * * * On Entry: * * BHA Pointer to a control block * * * * Control Block must have a long pointer to a filename * * * * Everything else depends on which function call is in X * ******************************************************************************** fe/c7a1 callFSX_BHAblock ldy #$0001 fe/c7a4 lda [bob_ll_irq_pri__mand],y fe/c7a6 pha fe/c7a7 plb fe/c7a8 plb ;get B from block fe/c7a9 ldy #$0000 fe/c7ac lda [bob_ll_irq_pri__mand],y ;get A from block fe/c7ae phb fe/c7af phb fe/c7b0 pha fe/c7b1 phx ; stack ; +6 B ; +5 B ; +3 A ; +1 X fe/c7b2 jsr ljGetFsTrampolineFromPrefix fe/c7b5 txy ;stack FS entry point in Y fe/c7b6 plx ;get back X - FS function code fe/c7b7 bcs @badname fe/c7b9 phy ;stash the FS trampoline ; stack ; +6 B ; +5 B ; +3 A ; +1 FS trampoline fe/c7ba ldy #$0000 fe/c7bd sta [bob_ll_irq_pri__mand],y ;update pointer in block to point just after ':' fe/c7bf ldy #$0002 fe/c7c2 phb fe/c7c3 phb fe/c7c4 pla fe/c7c5 sta [bob_ll_irq_pri__mand],y fe/c7c7 ply ;get back trampoline address fe/c7c8 pei (bob_ll_irq_pri__meor) fe/c7ca plb fe/c7cb plb ;set B to B from block fe/c7cc lda bob_ll_irq_pri__mand ;get AH from block fe/c7ce phk fe/c7cf jsr callFSModuleTrampolineInY ;call the driver fe/c7d2 tay fe/c7d3 pla fe/c7d4 sta [bob_ll_irq_pri__mand] fe/c7d6 pla fe/c7d7 phy ;this is the returned A fe/c7d8 ldy #$0002 fe/c7db sta [bob_ll_irq_pri__mand],y ;reset BHA in block to how it was fe/c7dd pla ;the A returned by the FS function fe/c7de rts fe/c7df @badname pla fe/c7e0 pla fe/c7e1 brl cop26BadNameX1 fe/c7e4 ljGetFsTrampolineFromPrefix phk fe/c7e5 jsr getFSTrampolineFromprefix fe/c7e8 rts fe/c7e9 callDevHandle jsr getBlockFromHandle fe/c7ec bcs @ret fe/c7ee phd fe/c7ef phb fe/c7f0 phb fe/c7f1 pha fe/c7f2 phk fe/c7f3 per @exit-1 fe/c7f6 pea $0000 fe/c7f9 plb ;push a 0 fe/c7fa lda $0003,y ;get FS trampoline fe/c7fd dec A fe/c7fe pha ;push trampoline long address - 1 fe/c7ff lda $09,S fe/c801 pha fe/c802 plb fe/c803 plb fe/c804 lda $07,S ;get back BHA pointer fe/c806 rtl ;call FS trampoline rwid shortm,shortx fe/c807 @exit pld fe/c808 pld fe/c809 pld fe/c80a @ret rtl rwid longm,longx fe/c80b callFSModuleTrampolineInY phd fe/c80c phb fe/c80d phb fe/c80e pha fe/c80f phk fe/c810 per @exit-1 fe/c813 pea $0000 fe/c816 plb fe/c817 dey fe/c818 phy ; stack ; ; +B D ; +A B ; +9 B ; +7 A ; +6 K ; +4 exit code pointer ; +3 $0 (bank address) of module entry ; +1 Y-1 as passed in (address of B0 module trampoline to call) fe/c819 lda $09,S fe/c81b pha fe/c81c plb fe/c81d plb fe/c81e lda $07,S fe/c820 ldy #$0000 fe/c823 rtl fe/c824 @exit pld fe/c825 pld fe/c826 pld fe/c827 rtl fe/c828 getBlockFromHandle pha fe/c829 phx fe/c82a cpy #$0100 fe/c82d bcc @notAHandle fe/c82f tyx fe/c830 ldal f:bob_ll_irq_sec__type,x fe/c834 and #$00ff fe/c837 eor #HND_type_10_CBHN fe/c83a cmp #$0001 ;set carry if <> fe/c83d bcs @notAHandle fe/c83f plx fe/c840 pla fe/c841 rts fe/c842 @notAHandle plx fe/c843 plx fe/c844 cop COP_26_OPBHA fe/c846 zstr “Not a handle” fe/c853 ldx #$0001 fe/c856 sec fe/c857 rts fe/c858 pha fe/c859 xba fe/c85a per LFEC860-1 fe/c85d brl LFEC86A fe/c860 LFEC860 lda $01,S fe/c862 per LFEC868-1 fe/c865 brl LFEC86A fe/c868 LFEC868 pla fe/c869 rts fe/c86a LFEC86A and #$00ff fe/c86d pha fe/c86e lsr A fe/c86f lsr A fe/c870 lsr A fe/c871 lsr A fe/c872 per LFEC878-1 fe/c875 brl LFEC879 fe/c878 LFEC878 pla fe/c879 LFEC879 and #$000f fe/c87c sed fe/c87d cmp #$000a fe/c880 adc #$0030 fe/c883 cld fe/c884 cop COP_00_OPWRC fe/c886 rts fe/c887 cop26BadNameX1 cop COP_26_OPBHA fe/c889 zstr “Bad name” fe/c892 bra retX1 fe/c894 cop26BadModuleX1 cop COP_26_OPBHA fe/c896 zstr “Bad module” fe/c8a1 bra retX1 fe/c8a3 cop26BadHandleX1 cop COP_26_OPBHA fe/c8a5 zstr “Bad handle” fe/c8b0 retX1 ldx #$0001 fe/c8b3 sec fe/c8b4 rts ******************************************************************************** * COP 3C - OPDTD - QRY * ******************************************************************************** fe/c8b5 COP_3C ldx bob_ll_irq_sec__flags fe/c8b7 phd fe/c8b8 pei (DPCOP_DP) fe/c8ba pld fe/c8bb per LFEC8C1-1 fe/c8be brl LFEC8D1 fe/c8c1 LFEC8C1 pld fe/c8c2 sta bob_ll_irq_pri__mand fe/c8c4 stx bob_ll_irq_sec__flags fe/c8c6 sty bob_ll_irq_sec__dp fe/c8c8 sep #$30 rwid shortm,shortx fe/c8ca phb fe/c8cb pla fe/c8cc sta bob_ll_irq_pri__psec fe/c8ce rep #$30 rwid longm,longx fe/c8d0 rtl fe/c8d1 LFEC8D1 php fe/c8d2 sep #$30 rwid shortm,shortx fe/c8d4 cpx #$00 fe/c8d6 bne LFEC8E4 fe/c8d8 sta $88 fe/c8da sec fe/c8db ror bob_ll_irq_sec__dp fe/c8dd stz bob_ll_irq_pri__irqf fe/c8df stz bob_ll_irq_pri__next fe/c8e1 brl LFECACB fe/c8e4 LFEC8E4 cpx #$02 fe/c8e6 beq LFEC903 fe/c8e8 cpx #$04 fe/c8ea bne LFEC8F7 fe/c8ec per LFEC8F2-1 fe/c8ef brl LFECB72 fe/c8f2 LFEC8F2 bcs LFEC917 fe/c8f4 brl LFECACB fe/c8f7 LFEC8F7 cpx #$06 fe/c8f9 bne LFEC917 fe/c8fb per LFEC8FE+2 fe/c8fe LFEC8FE brl LFECB84 fe/c901 dd1 $80 fe/c902 dd1 $ef fe/c903 LFEC903 sta bob_ll_irq_sec__flags fe/c905 xba fe/c906 sta bob_ll_irq_sec__fphand fe/c908 phb fe/c909 pla fe/c90a sta bob_ll_irq_pri__mand fe/c90c tya fe/c90d ldx bob_ll_irq_pri__next fe/c90f bpl LFEC91A fe/c911 LFEC911 cmp #$20 fe/c913 bcs LFEC917 fe/c915 stz bob_ll_irq_pri__next fe/c917 LFEC917 plp rwid longm,longx fe/c918 sec fe/c919 rts rwid shortm,shortx fe/c91a LFEC91A sta $10,x fe/c91c cpx #$01 fe/c91e bcc LFEC975 fe/c920 bne LFEC959 fe/c922 rep #$10 rwid longx fe/c924 ldy #$0000 fe/c927 LFEC927 sep #$20 fe/c929 lda [bob_ll_irq_sec__flags],y fe/c92b beq LFEC983 fe/c92d cmp $10 fe/c92f beq LFEC93B fe/c931 rep #$30 rwid longm fe/c933 tya fe/c934 clc fe/c935 adc #$000a fe/c938 tay fe/c939 bra LFEC927 rwid shortm fe/c93b LFEC93B ldx #$0000 fe/c93e LFEC93E iny fe/c93f lda [bob_ll_irq_sec__flags],y fe/c941 sta bob_ll_irq_pri__psec,x fe/c943 inx fe/c944 cpx #$0009 fe/c947 bcc LFEC93E fe/c949 sep #$30 rwid shortx fe/c94b lda $88 fe/c94d beq LFEC959 fe/c94f lda bob_ll_irq_pri__psec fe/c951 cmp #$86 fe/c953 beq LFEC959 fe/c955 cmp #$87 fe/c957 bne LFEC983 fe/c959 LFEC959 ldx bob_ll_irq_pri__next fe/c95b lda $10,x fe/c95d bit bob_ll_irq_pri__psec fe/c95f bmi LFEC975 fe/c961 cmp #$3f fe/c963 beq LFEC98A fe/c965 cmp #$25 fe/c967 beq LFEC98A fe/c969 cmp #$21 fe/c96b beq LFEC98A fe/c96d cmp #$5b fe/c96f bcs LFEC975 fe/c971 cmp #$40 fe/c973 bcs LFEC98A fe/c975 LFEC975 cmp #$20 fe/c977 bcc LFEC98C fe/c979 inc bob_ll_irq_pri__next fe/c97b lda bob_ll_irq_pri__next fe/c97d cmp #$20 fe/c97f lda $10,x fe/c981 bcc LFEC9E6 fe/c983 LFEC983 sep #$30 fe/c985 sec fe/c986 ror bob_ll_irq_pri__next fe/c988 bra LFEC911 fe/c98a LFEC98A sta $10 fe/c98c LFEC98C lda #$00 fe/c98e adc #$00 fe/c990 sta bob_ll_irq_pri__next fe/c992 stz $10,x fe/c994 txa fe/c995 beq LFEC9E6 fe/c997 stz bob_ll_irq_pri__irqf fe/c999 lda bob_ll_irq_pri__psec fe/c99b cmp #$00 fe/c99d bne LFEC9A2 fe/c99f brl LFECAC7 fe/c9a2 LFEC9A2 cmp #$01 fe/c9a4 bne LFEC9A9 fe/c9a6 brl LFECA77 fe/c9a9 LFEC9A9 cmp #$02 fe/c9ab beq LFECA11 fe/c9ad cmp #$83 fe/c9af beq LFEC9E9 fe/c9b1 cmp #$90 fe/c9b3 bne LFEC9B8 fe/c9b5 brl LFECACE fe/c9b8 LFEC9B8 cmp #$85 fe/c9ba bne LFEC9BF fe/c9bc brl LFECA63 fe/c9bf LFEC9BF cmp #$86 fe/c9c1 bne LFEC9C6 fe/c9c3 brl LFECB2E fe/c9c6 LFEC9C6 cmp #$87 fe/c9c8 bne LFEC9CD fe/c9ca brl LFECB32 fe/c9cd LFEC9CD cop COP_0F_OPERR fe/c9cf zstr “Bad DTD parameter type” fe/c9e6 LFEC9E6 brl LFEC917 fe/c9e9 LFEC9E9 rep #$30 rwid longm,longx fe/c9eb per LFEC9F1-1 fe/c9ee brl LFECAF0 fe/c9f1 LFEC9F1 ldx #$0080 fe/c9f4 ldy #$0006 fe/c9f7 cop COP_18_OPRLH fe/c9f9 bcs LFEC9E6 fe/c9fb ldx $0e fe/c9fd beq LFECA07 fe/c9ff lda $81 fe/ca01 sta bob_ll_irq_sec__dp,x fe/ca03 lda $80 fe/ca05 sta bob_ll_irq_pri__next,x fe/ca07 LFECA07 lda $81 fe/ca09 pha fe/ca0a plb fe/ca0b plb fe/ca0c lda $80 fe/ca0e brl LFECAC7 rwid shortm,shortx fe/ca11 LFECA11 rep #$30 rwid longm,longx fe/ca13 stz $80 fe/ca15 ldx #$0001 fe/ca18 stx $82 fe/ca1a LFECA1A lda $10,x fe/ca1c and #$00ff fe/ca1f inx fe/ca20 cmp #$0020 fe/ca23 beq LFECA1A fe/ca25 dex fe/ca26 LFECA26 lda $10,x fe/ca28 and #$00ff fe/ca2b beq LFECA55 fe/ca2d sec fe/ca2e sbc #$0030 fe/ca31 cmp #$000a fe/ca34 bcs LFEC9E6 fe/ca36 ldy $80 fe/ca38 cpy #$1999 fe/ca3b bcc LFECA44 fe/ca3d bne LFEC9E6 fe/ca3f cmp #$0006 fe/ca42 bcs LFEC9E6 fe/ca44 LFECA44 pha fe/ca45 tya fe/ca46 asl A fe/ca47 asl A fe/ca48 adc $80 fe/ca4a asl A fe/ca4b adc $01,S fe/ca4d sta $80 fe/ca4f pla fe/ca50 inx fe/ca51 stz $82 fe/ca53 bra LFECA26 fe/ca55 LFECA55 lda $82 fe/ca57 bne LFEC9E6 fe/ca59 lda $80 fe/ca5b ldx $0e fe/ca5d beq LFECA61 fe/ca5f sta bob_ll_irq_pri__next,x fe/ca61 LFECA61 bra LFECAC7 rwid shortm,shortx fe/ca63 LFECA63 rep #$30 rwid longm,longx fe/ca65 clv fe/ca66 per LFECA6C-1 fe/ca69 brl LFECAFC rwid shortm,shortx fe/ca6c LFECA6C bcs LFECA77 fe/ca6e per LFECA74-1 fe/ca71 brl LFECB93 fe/ca74 LFECA74 brl LFEC917 fe/ca77 LFECA77 sep #$30 fe/ca79 clc fe/ca7a lda bob_ll_irq_sec__flags fe/ca7c adc DPCOP_P fe/ca7e sta $80 fe/ca80 lda bob_ll_irq_sec__fphand fe/ca82 adc bob_ll_irq_sec__type fe/ca84 sta $81 fe/ca86 lda bob_ll_irq_pri__mand fe/ca88 sta $82 fe/ca8a lda [$80] fe/ca8c tay fe/ca8d inc $80 fe/ca8f bne LFECA97 fe/ca91 inc $81 fe/ca93 bne LFECA97 fe/ca95 inc $82 fe/ca97 LFECA97 phd fe/ca98 clc fe/ca99 pla fe/ca9a adc #$11 fe/ca9c sta $84 fe/ca9e pla fe/ca9f adc #$00 fe/caa1 sta $85 fe/caa3 stz $86 fe/caa5 ldx #$80 fe/caa7 cop COP_36_OPNLU fe/caa9 bcc LFECAAE fe/caab brl LFEC9E6 fe/caae LFECAAE lda bob_ll_irq_pri__psec fe/cab0 cmp #$85 fe/cab2 bne LFECABC fe/cab4 lda $11 fe/cab6 per LFECABC-1 fe/cab9 brl LFECB84 fe/cabc LFECABC tya fe/cabd rep #$10 rwid longx fe/cabf ldx $0e fe/cac1 beq LFECAC5 fe/cac3 sta bob_ll_irq_pri__next,x fe/cac5 LFECAC5 sep #$10 rwid shortx fe/cac7 LFECAC7 rep #$30 rwid longm,longx fe/cac9 ldx DPCOP_DP rwid shortm,shortx fe/cacb LFECACB plp fe/cacc clc fe/cacd rts fe/cace LFECACE sep #$30 fe/cad0 rep #$10 rwid longx fe/cad2 ldy $0e fe/cad4 beq LFECAE6 fe/cad6 ldx #$0001 fe/cad9 LFECAD9 lda $10,x fe/cadb phx fe/cadc tyx fe/cadd sta bob_ll_irq_pri__next,x fe/cadf plx fe/cae0 inx fe/cae1 iny fe/cae2 cmp #$00 fe/cae4 bne LFECAD9 fe/cae6 LFECAE6 rep #$30 rwid longm fe/cae8 per LFECAEE-1 fe/caeb brl LFECAF0 rwid shortm,shortx fe/caee LFECAEE bra LFECAC7 rwid longm,longx fe/caf0 LFECAF0 pea $0000 fe/caf3 plb fe/caf4 plb fe/caf5 phd fe/caf6 pla fe/caf7 clc fe/caf8 adc #$0011 fe/cafb rts fe/cafc LFECAFC sep #$30 rwid shortm,shortx fe/cafe ldy #$00 fe/cb00 LFECB00 lda [bob_ll_irq_sec__flags],y fe/cb02 sec fe/cb03 beq LFECB20 fe/cb05 phy fe/cb06 cmp $11 fe/cb08 bne LFECB23 fe/cb0a bvs LFECB19 fe/cb0c php fe/cb0d tya fe/cb0e clc fe/cb0f adc #$08 fe/cb11 tay fe/cb12 plp fe/cb13 rep #$30 rwid longm,longx fe/cb15 lda [bob_ll_irq_sec__flags],y fe/cb17 beq LFECB23 rwid shortm,shortx fe/cb19 LFECB19 sep #$10 fe/cb1b ply fe/cb1c rep #$30 rwid longm,longx fe/cb1e tax fe/cb1f clc rwid shortm,shortx fe/cb20 LFECB20 rep #$30 rwid longm,longx fe/cb22 rts rwid shortm,shortx fe/cb23 LFECB23 sep #$30 fe/cb25 pla fe/cb26 php fe/cb27 clc fe/cb28 adc #$0a fe/cb2a plp fe/cb2b tay fe/cb2c bra LFECB00 fe/cb2e LFECB2E lda #$06 fe/cb30 bra LFECB34 fe/cb32 LFECB32 lda #$04 fe/cb34 LFECB34 sta bob_ll_irq_pri__meor fe/cb36 sep #$40 fe/cb38 rep #$30 rwid longm,longx fe/cb3a per LFECB40-1 fe/cb3d brl LFECAFC rwid shortm,shortx fe/cb40 LFECB40 sep #$30 fe/cb42 bcs LFECB6F fe/cb44 lda [bob_ll_irq_sec__flags],y fe/cb46 per LFECB4C-1 fe/cb49 brl LFECB84 fe/cb4c LFECB4C tya fe/cb4d clc fe/cb4e adc bob_ll_irq_pri__meor fe/cb50 tay fe/cb51 rep #$30 rwid longm,longx fe/cb53 lda [bob_ll_irq_sec__flags],y fe/cb55 clc fe/cb56 adc bob_ll_irq_sec__flags fe/cb58 sta $80 fe/cb5a sep #$30 rwid shortm,shortx fe/cb5c lda bob_ll_irq_pri__mand fe/cb5e sta $82 fe/cb60 ldy #$00 fe/cb62 LFECB62 lda [$80],y fe/cb64 beq LFECB6F fe/cb66 per LFECB6C-1 fe/cb69 brl LFECB84 fe/cb6c LFECB6C iny fe/cb6d bra LFECB62 fe/cb6f LFECB6F brl LFEC917 fe/cb72 LFECB72 lda #$00 fe/cb74 ldx bob_ll_irq_sec__dp fe/cb76 sec fe/cb77 bmi LFECB83 fe/cb79 inc bob_ll_irq_sec__dp fe/cb7b lda $30,x fe/cb7d bne LFECB82 fe/cb7f sec fe/cb80 ror bob_ll_irq_sec__dp fe/cb82 LFECB82 clc fe/cb83 LFECB83 rts fe/cb84 LFECB84 stz bob_ll_irq_sec__dp fe/cb86 ldx bob_ll_irq_pri__irqf fe/cb88 cpx #$4f fe/cb8a bcs LFECB92 fe/cb8c sta $30,x fe/cb8e stz COP_31_OPMIQ,x fe/cb90 inc bob_ll_irq_pri__irqf fe/cb92 LFECB92 rts fe/cb93 LFECB93 sep #$20 fe/cb95 lda [bob_ll_irq_sec__flags],y fe/cb97 sta $30 fe/cb99 rep #$30 rwid longm,longx fe/cb9b phy fe/cb9c tya fe/cb9d clc fe/cb9e adc #$0001 fe/cba1 tay fe/cba2 sep #$20 rwid shortm fe/cba4 lda [bob_ll_irq_sec__flags],y fe/cba6 rep #$30 rwid longm fe/cba8 ply fe/cba9 cmp #$0001 fe/cbac beq LFECBC4 fe/cbae cmp #$0002 fe/cbb1 beq LFECC07 fe/cbb3 cmp #$0083 fe/cbb6 bne LFECBBB fe/cbb8 brl LFECC4A fe/cbbb LFECBBB cmp #$0090 fe/cbbe bne LFECBC3 fe/cbc0 brl LFECC98 fe/cbc3 LFECBC3 rts fe/cbc4 LFECBC4 sep #$20 rwid shortm fe/cbc6 lda bob_ll_irq_pri__mand fe/cbc8 sta $82 fe/cbca rep #$30 rwid longm fe/cbcc tya fe/cbcd clc fe/cbce adc #$0004 fe/cbd1 tay fe/cbd2 lda [bob_ll_irq_sec__flags],y fe/cbd4 clc fe/cbd5 adc bob_ll_irq_sec__flags fe/cbd7 sta $80 fe/cbd9 ldy #$0000 fe/cbdc sep #$20 rwid shortm fe/cbde lda bob_ll_irq_pri__next,x fe/cbe0 sep #$30 rwid shortx fe/cbe2 tax fe/cbe3 LFECBE3 lda [$80],y fe/cbe5 beq LFECBF0 fe/cbe7 iny fe/cbe8 cmp [$80] fe/cbea bne LFECBE3 fe/cbec dex fe/cbed dex fe/cbee bpl LFECBE3 fe/cbf0 LFECBF0 ldx #$01 fe/cbf2 LFECBF2 lda [$80],y fe/cbf4 sta $30,x fe/cbf6 beq LFECC00 fe/cbf8 cmp [$80] fe/cbfa beq LFECC00 fe/cbfc inx fe/cbfd iny fe/cbfe bra LFECBF2 fe/cc00 LFECC00 stz $30,x fe/cc02 stz bob_ll_irq_sec__dp fe/cc04 rep #$30 rwid longm,longx fe/cc06 rts fe/cc07 LFECC07 sep #$20 rwid shortm fe/cc09 lda #$01 fe/cc0b sta bob_ll_irq_sec__dp fe/cc0d rep #$30 rwid longm fe/cc0f lda bob_ll_irq_pri__next,x fe/cc11 per tblBin2Dec fe/cc14 phk dbank K (auto) fe/cc15 plb fe/cc16 ldy #$0008 fe/cc19 LFECC19 ldx #$00ff fe/cc1c sec fe/cc1d LFECC1D inx fe/cc1e sbc ($01,S),y fe/cc20 bcs LFECC1D fe/cc22 adc ($01,S),y fe/cc24 pha fe/cc25 sep #$30 rwid shortm,shortx fe/cc27 txa fe/cc28 ldx bob_ll_irq_sec__dp fe/cc2a cmp #$00 fe/cc2c bne LFECC36 fe/cc2e cpx #$01 fe/cc30 bne LFECC36 fe/cc32 cpy #$00 fe/cc34 bne LFECC3C fe/cc36 LFECC36 ora #$30 fe/cc38 sta $30,x fe/cc3a inc bob_ll_irq_sec__dp fe/cc3c LFECC3C rep #$30 rwid longm,longx fe/cc3e pla fe/cc3f dey fe/cc40 dey fe/cc41 bpl LFECC19 fe/cc43 pla fe/cc44 sep #$30 rwid shortm,shortx fe/cc46 ldx bob_ll_irq_sec__dp fe/cc48 bra LFECC00 rwid longm,longx fe/cc4a LFECC4A sep #$30 rwid shortm,shortx fe/cc4c lda #$01 fe/cc4e sta bob_ll_irq_sec__dp fe/cc50 lda bob_ll_irq_pri__irqf,x fe/cc52 per LFECC58-1 fe/cc55 brl LFECC75 fe/cc58 LFECC58 lda bob_ll_irq_sec__dp,x fe/cc5a per LFECC60-1 fe/cc5d brl LFECC75 fe/cc60 LFECC60 lda bob_ll_irq_pri__next,x fe/cc62 per LFECC68-1 fe/cc65 brl LFECC75 fe/cc68 LFECC68 ldx bob_ll_irq_sec__dp fe/cc6a cpx #$01 fe/cc6c bne LFECC73 fe/cc6e lda #$30 fe/cc70 sta $30,x fe/cc72 inx fe/cc73 LFECC73 bra LFECC00 fe/cc75 LFECC75 pha fe/cc76 lsr A fe/cc77 lsr A fe/cc78 lsr A fe/cc79 lsr A fe/cc7a per LFECC80-1 fe/cc7d brl LFECC81 fe/cc80 LFECC80 pla fe/cc81 LFECC81 phx fe/cc82 ldx bob_ll_irq_sec__dp fe/cc84 and #$0f fe/cc86 bne LFECC8C fe/cc88 cpx #$01 fe/cc8a beq LFECC96 fe/cc8c LFECC8C sed fe/cc8d cmp #$0a fe/cc8f adc #$30 fe/cc91 cld fe/cc92 sta $30,x fe/cc94 inc bob_ll_irq_sec__dp fe/cc96 LFECC96 plx fe/cc97 rts rwid longm,longx fe/cc98 LFECC98 sep #$20 rwid shortm fe/cc9a ldy #$0001 fe/cc9d LFECC9D lda bob_ll_irq_pri__next,x fe/cc9f phx fe/cca0 tyx fe/cca1 sta $30,x fe/cca3 plx fe/cca4 inx fe/cca5 iny fe/cca6 cmp #$00 fe/cca8 bne LFECC9D fe/ccaa stz bob_ll_irq_sec__dp fe/ccac rep #$30 rwid longm fe/ccae rts fe/ccaf tblBin2Dec dd2 1 fe/ccb1 dd2 10 fe/ccb3 dd2 100 fe/ccb5 dd2 1000 fe/ccb7 dd2 10000 ; This is added to the end of the interrupt handler list rwid shortm,shortx fe/ccb9 irqh_catchall rtl ; TODO: find out what cb1 is connected to fe/ccba irqh_via_cb1 pea $0000 fe/ccbd plb fe/ccbe plb fe/ccbf stal VIA_IFR fe/ccc3 ldy #$f3 fe/ccc5 jsr LFEE22E fe/ccc8 clc fe/ccc9 rtl fe/ccca irqh_vsync pea $0000 fe/cccd plb dbank $00 fe/ccce plb fe/cccf ldx #$12 fe/ccd1 phk fe/ccd2 jsr callModVDU fe/ccd5 lda SYSVAR_51_FLASHCTDN fe/ccd8 beq LFECCF9 fe/ccda dec SYSVAR_51_FLASHCTDN fe/ccdd bne LFECCF9 fe/ccdf ldx SYSVAR_82_ELK_ULA_MISC fe/cce2 lda SYSVAR_48_UNKNOWN_ULA fe/cce5 beq LFECCEA fe/cce7 ldx SYSVAR_FLASH_MARK fe/ccea LFECCEA eor #$07 fe/ccec sta SYSVAR_48_UNKNOWN_ULA fe/ccef stx SYSVAR_51_FLASHCTDN fe/ccf2 tay fe/ccf3 ldx #$14 fe/ccf5 phk fe/ccf6 jsr callModVDU fe/ccf9 LFECCF9 dec SYSVAR_CFS_TIMEOUT fe/ccfc lda #$10 fe/ccfe bra irqh_100Hz fe/cd00 irqh_ula_rtc pea $0000 fe/cd03 plb dbank $00 fe/cd04 plb fe/cd05 lda #$20 fe/cd07 irqh_100Hz stal sheila_ULA_PAG_IRQCLR fe/cd0b lda SYSVARS_83_TIMER_SWITCH ;timer switch flips between 10 and 5 fe/cd0e tax fe/cd0f eor #$0f ;flip fe/cd11 pha fe/cd12 tay fe/cd13 sec fe/cd14 @tlp lda SYSVAR_91_TIMERS-1,x ;decrement timer into new copy from old fe/cd17 adc #$00 fe/cd19 sta SYSVAR_91_TIMERS-1,y fe/cd1c dex fe/cd1d beq @tsk fe/cd1f dey fe/cd20 bne @tlp fe/cd22 @tsk pla fe/cd23 sta SYSVARS_83_TIMER_SWITCH ;store updated flipped switch fe/cd26 ldx #$05 fe/cd28 LFECD28 inc SYSVAR_9A_INTERVAL,x fe/cd2b bne LFECD35 fe/cd2d dex fe/cd2e bne LFECD28 fe/cd30 ldy #EVENT_5_TIMER_ZERO fe/cd32 jsr callEventIfEnabled fe/cd35 LFECD35 lda SYSVARS_B0_INKEYCTDN fe/cd38 bne LFECD42 fe/cd3a lda SYSVARS_B0_INKEYCTDN+1 fe/cd3d beq LFECD45 fe/cd3f dec SYSVARS_B0_INKEYCTDN+1 fe/cd42 LFECD42 dec SYSVARS_B0_INKEYCTDN fe/cd45 LFECD45 bit SYSVAR_78_SOUND_SEMAPHORE fe/cd48 bpl LFECD55 fe/cd4a inc SYSVAR_78_SOUND_SEMAPHORE fe/cd4d cli fe/cd4e jsr doSoundInterrupt fe/cd51 sei fe/cd52 dec SYSVAR_78_SOUND_SEMAPHORE fe/cd55 LFECD55 bit $d3 fe/cd57 bmi LFECD61 fe/cd59 lda $d5 fe/cd5b inc $d5 fe/cd5d cmp #$80 fe/cd5f bcs LFECD7C fe/cd61 LFECD61 lda SYSVAR_66_KB_SEMAPHORE fe/cd64 beq LFECD72 fe/cd66 inc SYSVAR_66_KB_SEMAPHORE fe/cd69 ldx #$0c fe/cd6b jsl __KB fe/cd6f dec SYSVAR_66_KB_SEMAPHORE fe/cd72 LFECD72 bit SYSVARS_ELK_BUFFER_BUSY+3 fe/cd75 bmi @clcrtl fe/cd77 jmp LFEDF12 fe/cd7a @clcrtl clc fe/cd7b rtl fe/cd7c LFECD7C lda $d5 fe/cd7e cmp #$82 fe/cd80 beq LFECD88 fe/cd82 cmp #$83 fe/cd84 beq LFECD94 fe/cd86 LFECD86 bra LFECD72 fe/cd88 LFECD88 ldal VIA_ORB fe/cd8c and #$df fe/cd8e stal VIA_ORB fe/cd92 bra LFECD86 fe/cd94 LFECD94 stz $d4 fe/cd96 stz $d5 fe/cd98 ldal VIA_IFR fe/cd9c and #$08 fe/cd9e bne LFECDA2 fe/cda0 dec $d4 fe/cda2 LFECDA2 ldal VIA_ORB fe/cda6 ora #$20 fe/cda8 stal VIA_ORB fe/cdac lda #$08 fe/cdae stal VIA_IFR fe/cdb2 brl LFECD61 fe/cdb5 LFECDB5 php fe/cdb6 rep #$30 rwid longm,longx fe/cdb8 lda #$0000 fe/cdbb stal f:B0LST_FREE_BLOCKS fe/cdbf lda #$fe00 fe/cdc2 stal f:B0LSTEND_FREE_BLOCKS fe/cdc6 lda #$e000 fe/cdc9 LFECDC9 pha fe/cdca tax fe/cdcb jsr freeB0Block fe/cdce pla fe/cdcf clc fe/cdd0 adc #$000c fe/cdd3 cmp #$fcf5 fe/cdd6 bcc LFECDC9 fe/cdd8 plp rwid shortm,shortx fe/cdd9 rts ******************************************************************************** * Return the block pointed to X to the free list * * * * On Entry: * * X is a pointer to a B0Block * ******************************************************************************** rwid longm,longx fe/cdda freeB0Block phy fe/cddb php fe/cddc sei fe/cddd rep #$30 fe/cddf txy ;Y=X fe/cde0 lda #$0000 fe/cde3 stal f:bob_ll_irq_pri__next,x ;clear X->[0] fe/cde7 sep #$20 rwid shortm fe/cde9 stal f:$00000b,x ;clear X->[b] fe/cded rep #$20 rwid longm fe/cdef ldal f:B0LSTEND_FREE_BLOCKS fe/cdf3 tax ;X = ($FE02) fe/cdf4 tya ;A=org X fe/cdf5 stal f:bob_ll_irq_pri__next,x fe/cdf9 stal f:B0LSTEND_FREE_BLOCKS fe/cdfd plp fe/cdfe ply fe/cdff clc fe/ce00 rts ******************************************************************************** * Allocate a B0Block from the free list * * On entry: * * A contains the B0B type * * * * On exit: * * If Cy=1: * * X=A on entry there was an error not allocated * * If Cy=0: * * X=A=B0 pointer to 12 byte block with type set, other fields = $FF * ******************************************************************************** fe/ce01 allocB0B php fe/ce02 sei fe/ce03 rep #$30 fe/ce05 tax fe/ce06 ldal f:B0LST_FREE_BLOCKS fe/ce0a bne @ok fe/ce0c plp fe/ce0d sec fe/ce0e rts fe/ce0f @ok phx fe/ce10 tax fe/ce11 cmpl f:B0LSTEND_FREE_BLOCKS fe/ce15 bne @sk ; if this was the last block then clear the last block pointer - point the last ; block pointer at the front pointer this will cause the next "free" to ; magically update both list pointers fe/ce17 lda #B0LST_FREE_BLOCKS fe/ce1a stal f:B0LSTEND_FREE_BLOCKS fe/ce1e @sk ldal f:bob_ll_irq_pri__next,x ;get the blocks next pointer fe/ce22 stal f:B0LST_FREE_BLOCKS ;store as the front pointer (will be 0 if last block) fe/ce26 lda #$ffff ;blank out the block fe/ce29 stal f:$00000a,x fe/ce2d stal f:$000008,x fe/ce31 stal f:$000006,x fe/ce35 stal f:$000004,x fe/ce39 stal f:$000002,x fe/ce3d stal f:bob_ll_irq_pri__next,x fe/ce41 pla fe/ce42 sep #$20 rwid shortm fe/ce44 stal f:B0B_offs_B_type,x ;set the type byte fe/ce48 rep #$20 rwid longm fe/ce4a txa fe/ce4b plp fe/ce4c clc fe/ce4d rts fe/ce4e LFECE4E ldal f:B0LST_FREE_BLOCKS fe/ce52 beq LFECE69 fe/ce54 ldy #$0000 fe/ce57 LFECE57 iny fe/ce58 beq memFreeListError fe/ce5a tax fe/ce5b ldal f:bob_ll_irq_pri__next,x fe/ce5f bne LFECE57 fe/ce61 txa fe/ce62 cmpl f:B0LSTEND_FREE_BLOCKS fe/ce66 bne memFreeListError fe/ce68 rts fe/ce69 LFECE69 ldal f:B0LSTEND_FREE_BLOCKS fe/ce6d cmp #$fe00 fe/ce70 bne memFreeListError fe/ce72 rts fe/ce73 memFreeListError cop COP_0F_OPERR fe/ce75 zstr “Memory error: list of free blocks corrupted” ******************************************************************************** * Allocate a Handle * * * * On Entry * * X The B0Block address to store in the handle * * * * On Exit * * If Cy=1: * * No handle allocated, run out of handles * * If Cy=0: * * Y The handle * * * * Others preserved * ******************************************************************************** fe/cea1 allocHandle phd fe/cea2 pha fe/cea3 pea EXSYS fe/cea6 pld fe/cea7 ldy #$0000 fe/ceaa lda [<EXSYS_FpHandles],y ;getHandleBlockSize fe/ceac and #$fffe fe/ceaf beq @retsec fe/ceb1 tay fe/ceb2 @lp dey fe/ceb3 dey fe/ceb4 beq @retsec fe/ceb6 lda [<EXSYS_FpHandles],y fe/ceb8 bne @lp fe/ceba txa fe/cebb sta [<EXSYS_FpHandles],y fe/cebd pla fe/cebe pld fe/cebf clc fe/cec0 rts fe/cec1 @retsec pla fe/cec2 pld fe/cec3 sec fe/cec4 rts fe/cec5 LFECEC5 jsr getHandleYtoX fe/cec8 pha fe/cec9 bcs @sk fe/cecb ldal f:$00000b,x fe/cecf and #$00ff fe/ced2 eor #$0002 fe/ced5 cmp #$0001 fe/ced8 @sk pla fe/ced9 rts ******************************************************************************** * Given a handle in Y returns the B0Block pointer. For odd numbered handles * * (well known handles) the block is returned for valid handles. For even * * numbered handles, searches the [Handle Allocation Table]. * * * * On Entry: * * Y Contains a handle * * * * On Exit: * * C=0 Found * * DP the address of the handle block * * or C=1 Failed - no such handle allocated * * * * TODO: corrupts X unnecessarily, lots of tax etc that is unnecessary * ******************************************************************************** fe/ceda getHandleYtoX phd fe/cedb pha fe/cedc tya fe/cedd beq @retsec fe/cedf bit #$0001 fe/cee2 bne @wellknownhandle fe/cee4 pea EXSYS fe/cee7 pld fe/cee8 lda [<EXSYS_FpHandles],y fe/ceea @ok tax fe/ceeb beq @retsec fe/ceed cpx #$ffff fe/cef0 beq @retsec fe/cef2 bne @retclc fe/cef4 @wellknownhandle tyx fe/cef5 cpx #$000a fe/cef8 bcs @retsec fe/cefa phb fe/cefb phk dbank K (auto) fe/cefc plb fe/cefd lda 0+(tblWellKnownHandlePointers & $ffff)-1,x fe/cf00 plb fe/cf01 eor #$0000 fe/cf04 beq @retsec fe/cf06 pha fe/cf07 pld fe/cf08 lda bob_ll_irq_pri__next fe/cf0a bra @ok fe/cf0c @retclc pla fe/cf0d pld fe/cf0e clc fe/cf0f rts fe/cf10 @retsec pla fe/cf11 pld fe/cf12 sec fe/cf13 rts fe/cf14 tblWellKnownHandlePointers dd2 $fe04 ;HDMMM fe/cf16 dd2 $0000 ;HDMM0 - QRY fe/cf18 dd2 $fe08 ;HDMMC fe/cf1a dd2 $fe0a ;HDMMW fe/cf1c dd2 $fe0c ;HDMMV ******************************************************************************** * The [Handle Allocation Table] pointed to by long pointer at $FF02 is * * searched for this entry and its entry is zeroed if found * * * * On entry: * * X contains a handle block pointer * * * * On exit: * * C=0 indicates block found * * Y contains the index of the entry (handle ? QRY?) * * X,D preserved * * or C=1 the pointer was not found * * Y contains the index of the last entry (entries are allocated * * descending * * so the first in address order) * * * * TODO: why not use the find method below! * ******************************************************************************** fe/cf1e freeHandleForB0BlockX phx fe/cf1f pea EXSYS fe/cf22 pld fe/cf23 ldy #$0000 fe/cf26 lda [<EXSYS_FpHandles],y ;get pointer to end of handle block + 2 fe/cf28 tay fe/cf29 dey fe/cf2a dey fe/cf2b @lp lda [<EXSYS_FpHandles],y fe/cf2d cmp $01,S ;compare to passed in X fe/cf2f beq @fnd fe/cf31 dey fe/cf32 dey ;move backwards through handle list fe/cf33 bne @lp fe/cf35 plx fe/cf36 sec fe/cf37 rts fe/cf38 @fnd lda #$0000 fe/cf3b sta [<EXSYS_FpHandles],y ;zero out the entry and return clc fe/cf3d plx fe/cf3e clc fe/cf3f rts ******************************************************************************** * The [Handle Allocation Table] pointed to by long pointer at $FF02 is * * searched for an entry that contains X * * * * On entry: * * X contains a handle block pointer * * * * On exit: * * C=0 indicates block found * * Y contains the index of the entry (handle) * * or C=1 the pointer was not found * * Y contains the index of the last entry (entries are allocated * * descending * * so the first in address order) * * * * X preserved * * D,A corrupted * ******************************************************************************** fe/cf40 findHandleByAddr pea EXSYS fe/cf43 pld fe/cf44 ldy #$0000 fe/cf47 lda [<EXSYS_FpHandles],y fe/cf49 tay fe/cf4a dey fe/cf4b dey fe/cf4c txa fe/cf4d @lp cmp [<EXSYS_FpHandles],y fe/cf4f beq @retclc fe/cf51 dey fe/cf52 dey fe/cf53 bne @lp fe/cf55 sec fe/cf56 rts fe/cf57 @retclc clc fe/cf58 rts rwid shortm,shortx fe/cf59 LFECF59 php fe/cf5a phb fe/cf5b rep #$30 rwid longm,longx fe/cf5d pea $0000 fe/cf60 plb dbank $00 fe/cf61 plb fe/cf62 lda #$0000 fe/cf65 sta EXSYS_CUR_COROUTINE+1 fe/cf68 sta SYS_ESCAPE_FLAG_QRY fe/cf6b lda #$0010 ;block length fe/cf6e stal f:block_FE20 fe/cf72 lda #block_FE20 fe/cf75 jsr blockClear fe/cf78 jsr initEXSYS_QRY fe/cf7b plb fe/cf7c plp rwid shortm,shortx fe/cf7d clc fe/cf7e rts rwid longm,longx fe/cf7f initEXSYS_QRY phb fe/cf80 phd fe/cf81 pea EXSYS fe/cf84 pld fe/cf85 lda #$0008 ;block length fe/cf88 sta <EXSYS_CO_A_SAVE fe/cf8a pea $0000 fe/cf8d plb dbank $00 fe/cf8e plb fe/cf8f stz <EXSYS_FpHandles+1 fe/cf91 lda #$ff05 fe/cf94 sta <EXSYS_FpHandles fe/cf96 jsr blockClear fe/cf99 pld fe/cf9a plb fe/cf9b clc fe/cf9c rts ; On Entry: ; BHA points at a "block" where the first two bytes contain the block length ; ; The block is zeroed from BHA+[BHA]-1 downto BHA+2 fe/cf9d blockClear php fe/cf9e rep #$30 fe/cfa0 pha fe/cfa1 ldy #$0000 fe/cfa4 lda ($01,S),y fe/cfa6 tay fe/cfa7 sep #$20 rwid shortm fe/cfa9 lda #$00 fe/cfab @lp dey fe/cfac cpy #$0002 fe/cfaf bcc @sk fe/cfb1 sta ($01,S),y fe/cfb3 bra @lp fe/cfb5 @sk rep #$20 rwid longm fe/cfb7 pla fe/cfb8 plp fe/cfb9 clc fe/cfba rts ******************************************************************************** * ST - SYSTEM? * * * * This well known entry is called as 00/FF88 * ******************************************************************************** rwid shortm,shortx fe/cfbb default__ST php fe/cfbc rep #$30 rwid longm,longx fe/cfbe cpx #$0022 fe/cfc1 bcs @resec fe/cfc3 phd fe/cfc4 phb fe/cfc5 phk dbank K (auto) fe/cfc6 plb fe/cfc7 pea DPSYS fe/cfca pld fe/cfcb sep #$30 ; after this JSR (inside routine) stack is ; +6 return P (though SEC/CLC will override) ; +4 return D ; +3 return B ; +1 return address to this routine ($cfce) rwid shortm,shortx fe/cfcd jsr (tbl__ST_dispatch,x) fe/cfd0 plb fe/cfd1 pld fe/cfd2 bcs @resec fe/cfd4 plp fe/cfd5 clc fe/cfd6 rtl fe/cfd7 @resec plp fe/cfd8 sec fe/cfd9 rtl fe/cfda tbl__ST_dispatch dd2 __ST_0 & $ffff ;ST 0 - return string "SYSTEM" fe/cfdc dd2 doSTRTI & $ffff ;ST 2 - return B0 FF80 table vector after re-indexing fe/cfde dd2 doSTWTI & $ffff ;ST 4 - update B0 FF80 table vector after re-indexing fe/cfe0 dd2 doSTRSI & $ffff ;ST 6 - return B0 FE80 table vector after re-indexing fe/cfe2 dd2 doSTWSI & $ffff ;ST 8 - update B0 FE80 table vector after re-indexing fe/cfe4 dd2 doSTGIT & $ffff ;ST A - GSINIT with Carry clear - i.e. Space or CR terminates unquoted fe/cfe6 dd2 doSTGLN & $ffff ;ST C - GSINIT with Carry set - i.e. only CR terminates unquoted fe/cfe8 dd2 doSTGRD & $ffff ;ST E - gsread update flags from H fe/cfea dd2 syserrUseCoroutines & $ffff ;ST 10 - bad call fe/cfec dd2 syserrUseCoroutines2 & $ffff ;ST 12 - bad call fe/cfee dd2 doSTSBK & $ffff ;ST 14 - look something up in a table pointed to by 00FF0D,0 fe/cff0 dd2 doSTTBK & $ffff ;ST 16 - look something up in a table pointed to by 00FF0D,Y fe/cff2 dd2 doSTCSI & $ffff ;ST 18 - STCSI - create a call back block HND type 4 fe/cff4 dd2 doSTRBRK & $ffff ;ST 1A - STRBRK - reexecute last brk fe/cff6 dd2 doSTGAD & $ffff ;ST 1C - STGAD - add Y to GSREAD pointer fe/cff8 dd2 doSTBMP & $ffff ;ST 1E - STBMP - Print Module name of last break address followed by a colon fe/cffa dd2 doSTBMB & $ffff ;ST 1E - STBMP - Print Module name of last break address followed by a colon ******************************************************************************** * ST 0A - STGIT - GSINIT CC * * * * Initialise a GSREAD string, space or CR will terminate an unquoted string * ******************************************************************************** fe/cffc doSTGIT clc fe/cffd bra _ST_AC_int ******************************************************************************** * ST 0C - STGLN - GSINIT read line * * * * Initialise a GSREAD string, only CR will terminate an unquoted string * ******************************************************************************** fe/cfff doSTGLN sec fe/d000 _ST_AC_int sta <DPSYS_GSREAD_ptr fe/d002 xba fe/d003 sta <DPSYS_GSREAD_ptr+1 fe/d005 lda $03,S fe/d007 sta <DPSYS_GSREAD_ptr+2 fe/d009 ror <DPSYS_GSREAD_flags ;DD gets loaded with top bit set if entered via OP C fe/d00b jsr __ST_skipSpaces fe/d00e iny fe/d00f cmp #$22 fe/d011 beq @notq fe/d013 dey ;if first char is not " then back up one fe/d014 clc fe/d015 @notq ror <DPSYS_GSREAD_flags fe/d017 pha fe/d018 lda <DPSYS_GSREAD_flags fe/d01a xba fe/d01b pla fe/d01c cmp #$0d fe/d01e beq @ret fe/d020 clc fe/d021 @ret rts fe/d022 @lp iny fe/d023 __ST_skipSpaces lda [<DPSYS_GSREAD_ptr],y fe/d025 cmp #$20 fe/d027 beq @lp fe/d029 cmp #$0d fe/d02b rts fe/d02c gsread_dec_digit lda [$ed],y fe/d02e cmp #‘:’ fe/d030 bcs gsread_clc_ret fe/d032 cmp #$30 fe/d034 bcc gsread_clc_ret fe/d036 and #$0f fe/d038 rts fe/d039 gsread_clc_ret clc fe/d03a rts fe/d03b gsread_iny_hex_digit iny fe/d03c gsread_hex_digit jsr gsread_dec_digit fe/d03f bcs @inyret fe/d041 and #$df fe/d043 cmp #‘G’ fe/d045 bcs gsread_clc_ret fe/d047 cmp #‘A’ fe/d049 bcc gsread_clc_ret fe/d04b php fe/d04c sbc #$37 fe/d04e plp fe/d04f @inyret iny fe/d050 rts ******************************************************************************** * ST 0E - STGRD - GSREAD * * * * Do GSREAD * * * * QRY - looks to update the flags from passed in H * ******************************************************************************** fe/d051 doSTGRD xba fe/d052 and #$fe fe/d054 sta <DPSYS_GSREAD_flags fe/d056 gsread_read lda [<DPSYS_GSREAD_ptr],y fe/d058 beq LFED05E fe/d05a cmp #$0d fe/d05c bne LFED064 fe/d05e LFED05E bit <DPSYS_GSREAD_flags fe/d060 bmi brkBadString fe/d062 bpl LFED07F fe/d064 LFED064 cmp #$20 fe/d066 bcc brkBadString fe/d068 bne LFED070 fe/d06a bit <DPSYS_GSREAD_flags fe/d06c bmi LFED0E1 fe/d06e bvc LFED07F fe/d070 LFED070 cmp #$22 fe/d072 bne LFED095 fe/d074 bit <DPSYS_GSREAD_flags fe/d076 bpl LFED0E1 fe/d078 iny fe/d079 lda [<DPSYS_GSREAD_ptr],y fe/d07b cmp #$22 fe/d07d beq LFED0E1 fe/d07f LFED07F jsr __ST_skipSpaces fe/d082 sec fe/d083 xba fe/d084 lda <DPSYS_GSREAD_ptr-16 fe/d086 xba fe/d087 rts fe/d088 brkBadString brk $fd fe/d08a zstr “Bad string” fe/d095 LFED095 cmp #‘|’ fe/d097 bne LFED0E1 fe/d099 iny fe/d09a lda [<DPSYS_GSREAD_ptr],y fe/d09c cmp #‘|’ fe/d09e beq LFED0E1 fe/d0a0 cmp #‘"’ fe/d0a2 beq LFED0E1 fe/d0a4 cmp #‘&’ fe/d0a6 bne LFED0BE fe/d0a8 jsr gsread_iny_hex_digit fe/d0ab bcc brkBadString fe/d0ad asl A fe/d0ae asl A fe/d0af asl A fe/d0b0 asl A fe/d0b1 pha fe/d0b2 jsr gsread_hex_digit fe/d0b5 bcc brkBadString fe/d0b7 ora $01,S fe/d0b9 sta $01,S fe/d0bb pla fe/d0bc bra LFED0EA fe/d0be LFED0BE cmp #‘!’ fe/d0c0 bne LFED0CB fe/d0c2 iny fe/d0c3 lda <DPSYS_GSREAD_flags fe/d0c5 ora #$01 fe/d0c7 sta <DPSYS_GSREAD_flags fe/d0c9 bra gsread_read fe/d0cb LFED0CB cmp #‘ ’ fe/d0cd bcc brkBadString fe/d0cf cmp #‘?’ fe/d0d1 beq LFED0DF fe/d0d3 phx fe/d0d4 ldx #$14 fe/d0d6 jsl __KB fe/d0da plx fe/d0db sep #$40 fe/d0dd bra LFED0E2 fe/d0df LFED0DF lda #$7f fe/d0e1 LFED0E1 clv fe/d0e2 LFED0E2 iny fe/d0e3 rol A fe/d0e4 pha fe/d0e5 lda $dd fe/d0e7 ror A fe/d0e8 pla fe/d0e9 ror A fe/d0ea LFED0EA xba fe/d0eb lda $dd fe/d0ed xba fe/d0ee clc fe/d0ef rts ******************************************************************************** * ST 1C - STGAD - add Y to GSREAD pointer * * * * returns updated pointer in BHA but doesn't update stored pointer * ******************************************************************************** fe/d0f0 doSTGAD clc fe/d0f1 tya fe/d0f2 adc <DPSYS_GSREAD_ptr fe/d0f4 xba fe/d0f5 ldy <DPSYS_GSREAD_ptr+2 fe/d0f7 ldx <DPSYS_GSREAD_ptr+1 fe/d0f9 bcc @skinc fe/d0fb inx fe/d0fc bne @skinc fe/d0fe iny fe/d0ff @skinc tya fe/d100 sta $03,S fe/d102 txa fe/d103 xba fe/d104 clc fe/d105 ldy #$00 fe/d107 rts ******************************************************************************** * ST 20 - STBMB - Get last break address to BHA * ******************************************************************************** fe/d108 doSTBMB ldal f:EXSYS_0D_BRKADDR_SAVE+2 fe/d10c sta $03,S fe/d10e ldal f:EXSYS_0D_BRKADDR_SAVE+1 fe/d112 xba fe/d113 ldal f:EXSYS_0D_BRKADDR_SAVE fe/d117 clc fe/d118 rts ******************************************************************************** * ST 1E - STBMP - Print Module name of last break address followed by a colon * * or ?: for not found * ******************************************************************************** fe/d119 doSTBMP ldx #__STBMB fe/d11b jsl __ST ;get break address to BHA fe/d11f cop COP_2D_OPWRM ;print module name of last BRK fe/d121 bcc @retcolon ;ok fe/d123 ldy #$00 ;faile to print fe/d125 cop COP_2E_OPFPO ;find pool owner of BHA fe/d127 bcs @retqrycolon fe/d129 cop COP_2D_OPWRM ;try print pool owner module name fe/d12b bcc @retcolon fe/d12d @retqrycolon cop COP_01_OPWRS fe/d12f zstr “?” fe/d131 @retcolon cop COP_01_OPWRS fe/d133 zstr “: ” fe/d136 rts fe/d137 syserrUseCoroutines cop COP_0F_OPERR fe/d139 zstr “use coroutines not STSEN” fe/d152 syserrUseCoroutines2 cop COP_0F_OPERR fe/d154 zstr “use coroutines not STREN” ******************************************************************************** * ST 1A - STRBRK - re-execute last BRK * ******************************************************************************** fe/d16d doSTRBRK pea EXSYS fe/d170 pld fe/d171 rep #$20 rwid longm fe/d173 dec <EXSYS_0D_BRKADDR_SAVE fe/d175 jml [EXSYS_0D_BRKADDR_SAVE] ; TODO dead code? rwid shortm fe/d178 sec fe/d179 rts ******************************************************************************** * ST 14 - STSBK Read the BRK signature * * * * Action: This call returns the error number associated with the last BRK * * executed. * * * * On Entry: * * X STSBK * * Exit: * * A Error number of the last error * * HY State to be used in subsequent calls * * BD Preserved * * * * Note that HY must be preserved between the STSBK call and subsequent calls * * to STTBK * ******************************************************************************** fe/d17a doSTSBK sep #$10 fe/d17c ldy #$00 fe/d17e jsr doSTTBK fe/d181 ldy #$01 fe/d183 rts ******************************************************************************** * ST 16 - STTBK - Read BRK message * * * * Action: This call reiurns the next character in the error message associated * * with the last BRK executed. * * * * Entry: * * HY State returned by lastSTSBK or STTBK * * X STTBK * * Exit: * * B,D Preserved * * C=0 Then next byte was read * * A Next byte in BRK message text * * HY State for next STTBK * * or C=1 Last character has been read * ******************************************************************************** fe/d184 doSTTBK sep #$10 fe/d186 pea EXSYS fe/d189 pld fe/d18a lda [<EXSYS_0D_BRKADDR_SAVE],y fe/d18c beq @sec fe/d18e iny fe/d18f beq @deysec fe/d191 clc fe/d192 rts fe/d193 @deysec dey fe/d194 @sec sec fe/d195 rts ******************************************************************************** * ST 02 - STRTI - Read table I????? * * * * Looks up from 00FF80 table a value and returns in BHA (QRY) * ******************************************************************************** fe/d196 doSTRTI php fe/d197 sei fe/d198 cpy #$eb fe/d19a bcc __ST_plpretsec ;if Y < EB then exit fail fe/d19c lda 0+(tbl__ST_2_indices & $ffff)-235,y fe/d19f beq __ST_plpretsec fe/d1a1 tax fe/d1a2 pea $0000 dbank $00 fe/d1a5 plb fe/d1a6 plb fe/d1a7 ldal f:tblB0JumpTableFF80_QRY-127,x fe/d1ab pha fe/d1ac ldal f:tblB0JumpTableFF80_QRY-126,x fe/d1b0 pha fe/d1b1 ldal f:tblB0JumpTableFF80_QRY-125,x fe/d1b5 pha ; fe/d1b6 __ST_retstackedBHA_clc pla fe/d1b7 sta $06,S ; after this JSR (inside routine) stack is ; +9 return P (though SEC/CLC will override) ; +7 return D ; +6 return B (updated from A above) ; +4 return address to dispatch routine ($cfce) ; +3 mode / flags ; +2 A to pop here ; +1 H to pop here fe/d1b9 pla fe/d1ba xba fe/d1bb pla fe/d1bc plp fe/d1bd clc fe/d1be rts ******************************************************************************** * ST 04 - STWTI - Write table I????? * * * * updates from BHA 00FF80 table value and returns old in BHA (QRY) * ******************************************************************************** fe/d1bf doSTWTI php fe/d1c0 sei fe/d1c1 cpy #$eb fe/d1c3 bcc __ST_plpretsec fe/d1c5 tax fe/d1c6 lda 0+(tbl__ST_2_indices & $ffff)-235,y fe/d1c9 beq __ST_plpretsec fe/d1cb pea $0000 ;TODO pointless bank swap? fe/d1ce plb fe/d1cf plb fe/d1d0 txy fe/d1d1 tax fe/d1d2 ldal f:tblB0JumpTableFF80_QRY-127,x fe/d1d6 pha fe/d1d7 ldal f:tblB0JumpTableFF80_QRY-126,x fe/d1db pha fe/d1dc ldal f:tblB0JumpTableFF80_QRY-125,x fe/d1e0 pha fe/d1e1 tya fe/d1e2 stal f:tblB0JumpTableFF80_QRY-127,x fe/d1e6 xba fe/d1e7 stal f:tblB0JumpTableFF80_QRY-126,x fe/d1eb lda $07,S fe/d1ed stal f:tblB0JumpTableFF80_QRY-125,x fe/d1f1 bra __ST_retstackedBHA_clc fe/d1f3 __ST_plpretsec plp fe/d1f4 sec fe/d1f5 rts ******************************************************************************** * ST 06 - STRSI - Read Table ??? * * * * Looks up from 00FE01 table a value and returns in BHA (QRY) * ******************************************************************************** fe/d1f6 doSTRSI php fe/d1f7 sei fe/d1f8 cpy #$eb fe/d1fa bcc __ST_plpretsec fe/d1fc lda 0+(tbl__ST_2_indices & $ffff)-235,y fe/d1ff beq __ST_plpretsec fe/d201 tax fe/d202 pea $0000 ;TODO: check - think this does nothing fe/d205 plb fe/d206 plb fe/d207 ldal f:tblB0JumpTableFE80_QRY-127,x fe/d20b pha fe/d20c ldal f:tblB0JumpTableFE80_QRY-126,x fe/d210 pha fe/d211 ldal f:tblB0JumpTableFE80_QRY-125,x fe/d215 pha fe/d216 bra__ST_retstackedBHA_clc bra __ST_retstackedBHA_clc ******************************************************************************** * ST 08 - STWSI - Write table I???? * * * * updates from BHA 00FE80 table value and returns old in BHA (QRY) * ******************************************************************************** fe/d218 doSTWSI php fe/d219 sep #$30 fe/d21b sei fe/d21c cpy #$eb fe/d21e bcc __ST_plpretsec fe/d220 tax fe/d221 lda 0+(tbl__ST_2_indices & $ffff)-235,y fe/d224 beq __ST_plpretsec fe/d226 pea $0000 fe/d229 plb fe/d22a plb fe/d22b txy fe/d22c tax fe/d22d ldal f:tblB0JumpTableFE80_QRY-127,x fe/d231 pha fe/d232 ldal f:tblB0JumpTableFE80_QRY-126,x fe/d236 pha fe/d237 ldal f:tblB0JumpTableFE80_QRY-125,x fe/d23b pha fe/d23c tya fe/d23d stal f:tblB0JumpTableFE80_QRY-127,x fe/d241 xba fe/d242 stal f:tblB0JumpTableFE80_QRY-126,x fe/d246 lda $07,S fe/d248 stal f:tblB0JumpTableFE80_QRY-125,x fe/d24c bra bra__ST_retstackedBHA_clc ; This looks to point at a set of offsets into tables in the system area at ; 00FE00 fe/d24e tbl__ST_2_indices dd1 $00 fe/d24f dd1 $b0 fe/d250 dd1 $ac fe/d251 dd1 $a8 fe/d252 dd1 $a4 fe/d253 dd1 $a0 fe/d254 dd1 $9c fe/d255 dd1 $98 fe/d256 dd1 $94 fe/d257 dd1 $e4 fe/d258 dd1 $e8 fe/d259 dd1 $ec fe/d25a dd1 $f0 fe/d25b dd1 $f8 fe/d25c dd1 $f4 fe/d25d dd1 $fc fe/d25e dd1 $90 fe/d25f dd1 $8c fe/d260 dd1 $88 fe/d261 dd1 $84 fe/d262 dd1 $00 ******************************************************************************** * ST 18 - STCSI - Create FE80 table call back * * * * Appears to make a call back block (handle type 4) but doesn't assign a * * handle * ******************************************************************************** fe/d263 doSTCSI php fe/d264 sei fe/d265 rep #$30 rwid longm,longx fe/d267 cpy #$00eb fe/d26a bcc @retsec fe/d26c tax fe/d26d lda 0+(tbl__ST_2_indices & $ffff)-235,y fe/d270 and #$00ff fe/d273 beq @retsec fe/d275 clc fe/d276 adc #$fe00 fe/d279 tax fe/d27a lda $05,S fe/d27c jsr makeCallBackBlockHnd4 fe/d27f plp rwid shortm,shortx fe/d280 clc fe/d281 rts rwid longm,longx fe/d282 @retsec plp rwid shortm,shortx fe/d283 sec fe/d284 rts ******************************************************************************** * MM - Memory management entry point * ******************************************************************************** fe/d285 default__MM php fe/d286 rep #$30 rwid longm,longx fe/d288 cpx #$001c fe/d28b bcs @resetc fe/d28d phd fe/d28e phb fe/d28f jsr (tblMMdispatch,x) fe/d292 plb fe/d293 pld fe/d294 bcs @resetc fe/d296 plp rwid shortm,shortx fe/d297 clc fe/d298 rtl rwid longm,longx fe/d299 @resetc plp rwid shortm,shortx fe/d29a sec fe/d29b rtl fe/d29c tblMMdispatch dd2 __ST_0 & $ffff ;0 - __MMNXT - return string "SYSTEM"? fe/d29e dd2 doMMINIT & $ffff ;2 - __MMINIT - initialise memory management routines fe/d2a0 dd2 doMMBP & $ffff ;4 - __MMBP - ??? fe/d2a2 dd2 doMMASD & $ffff ;6 - __MMASD - allocate small descending area fe/d2a4 dd2 doMMALD & $ffff ;8 - __MMALD - allocate large descending fe/d2a6 dd2 doMMASA & $ffff ;A - __MMASA - allocate a small ascending fe/d2a8 dd2 doMMALA & $ffff ;C - __MMALA - allocate large asending fe/d2aa dd2 doMMBAS & $ffff ;E - __MMBAS - get base of pool fe/d2ac dd2 doMMLEN & $ffff ;10 - __MMLEN - return pool length fe/d2ae dd2 doMMTOP & $ffff ;12 - __MMTOP - return top of pool fe/d2b0 dd2 doMMFND & $ffff ;14 - __MMFND - find a pool by address fe/d2b2 dd2 doMMCHK & $ffff ;16 - __MMCHK - check integrity of memory system fe/d2b4 dd2 doMMAZB & $ffff ;18 - __MMAZB - Allocate Bank 0 fe/d2b6 dd2 doMMMRG & $ffff ;1A - __MMMRG - merge two pools fe/d2b8 LFED2B8 php fe/d2b9 phd fe/d2ba phb fe/d2bb rep #$30 rwid longm,longx fe/d2bd jsr LFED2FF fe/d2c0 bcs LFED2FA fe/d2c2 jsr LFED324 fe/d2c5 bcs LFED2FA fe/d2c7 jsr LFED336 fe/d2ca bcs LFED2FA fe/d2cc lda #$2000 fe/d2cf ldx #$0018 fe/d2d2 jsl __MM fe/d2d6 bcs LFED2FA fe/d2d8 ldx #$000e fe/d2db jsl __MM fe/d2df lda #$a500 fe/d2e2 pea $0900 fe/d2e5 pld fe/d2e6 ldy #$0001 fe/d2e9 ldx #$0004 fe/d2ec jsl __MM fe/d2f0 bcs LFED2FA fe/d2f2 jsr initEXSYS_QRY fe/d2f5 plb fe/d2f6 pld fe/d2f7 plp rwid shortm,shortx fe/d2f8 clc fe/d2f9 rts rwid longm,longx fe/d2fa LFED2FA plb fe/d2fb pld fe/d2fc plp rwid shortm,shortx fe/d2fd sec fe/d2fe rts rwid longm,longx fe/d2ff LFED2FF lda #HND_type_2_CBMEM fe/d302 jsr allocB0B fe/d305 bcs LFED323 fe/d307 tax fe/d308 jsr LFED6D7 fe/d30b txa fe/d30c jsr LFED6D2 fe/d30f lda #$0000 fe/d312 stal f:bob_ll_irq_sec__fphand,x fe/d316 lda #$ffff fe/d319 stal f:bob_ll_irq_pri__meor,x fe/d31d txa fe/d31e stal f:$00fe0a fe/d322 clc fe/d323 LFED323 rts fe/d324 LFED324 ldal f:$00fe0a fe/d328 tax fe/d329 jsr LFED374 fe/d32c jsr LFED5DE fe/d32f txa fe/d330 stal f:$00fe04 fe/d334 clc fe/d335 rts fe/d336 LFED336 pea $4600 fe/d339 plb fe/d33a plb fe/d33b lda #$0000 fe/d33e pea $8000 fe/d341 pld fe/d342 ldy #$0007 fe/d345 ldx #$0004 fe/d348 jsl __MM fe/d34c jsr LFECEC5 fe/d34f txa fe/d350 stal f:$00fe08 fe/d354 rts ******************************************************************************** * TODO: check - the following block looks like it may be dead code? * ******************************************************************************** fe/d355 pea HW_VIDEO_BASE >> 8 ;TODO: shift! fe/d358 plb fe/d359 plb fe/d35a lda #HW_VIDEO_BASE & $ffff fe/d35d pea HW_EXTIO >> 8 fe/d360 pld fe/d361 ldy #HDMMW fe/d364 ldx #__MMBP fe/d367 jsl __MM fe/d36b jsr LFECEC5 fe/d36e txa fe/d36f stal f:DP_HANDLE_VIDEO_QRY fe/d373 rts fe/d374 LFED374 php fe/d375 phd fe/d376 sei fe/d377 phd fe/d378 phd fe/d379 phd fe/d37a tsc fe/d37b tcd fe/d37c inc A fe/d37d sta bob_ll_irq_sec__flags fe/d37f lda #$0009 fe/d382 sta bob_ll_irq_pri__mand fe/d384 LFED384 dec bob_ll_irq_pri__mand fe/d386 beq LFED3AE fe/d388 jsr LFED3B5 fe/d38b bcc LFED384 fe/d38d lda bob_ll_irq_pri__mand fe/d38f inc A fe/d390 pha fe/d391 LFED391 dec bob_ll_irq_pri__mand fe/d393 beq LFED39C fe/d395 jsr LFED3B5 fe/d398 bcs LFED391 fe/d39a dec bob_ll_irq_pri__mand fe/d39c LFED39C inc bob_ll_irq_pri__mand fe/d39e lda bob_ll_irq_pri__mand fe/d3a0 xba fe/d3a1 tay fe/d3a2 pla fe/d3a3 sec fe/d3a4 sbc bob_ll_irq_pri__mand fe/d3a6 xba fe/d3a7 pld fe/d3a8 pld fe/d3a9 pld fe/d3aa pld fe/d3ab plp fe/d3ac clc fe/d3ad rts fe/d3ae LFED3AE pld fe/d3af pld fe/d3b0 pld fe/d3b1 pld fe/d3b2 plp fe/d3b3 sec fe/d3b4 rts fe/d3b5 LFED3B5 lda [bob_ll_irq_sec__flags] fe/d3b7 pha fe/d3b8 eor #$ffff fe/d3bb sta [bob_ll_irq_sec__flags] fe/d3bd eor [bob_ll_irq_sec__flags] fe/d3bf bne LFED3E8 fe/d3c1 dec bob_ll_irq_pri__mand fe/d3c3 lda [bob_ll_irq_sec__flags] fe/d3c5 pha fe/d3c6 eor #$ffff fe/d3c9 sta [bob_ll_irq_sec__flags] fe/d3cb eor [bob_ll_irq_sec__flags] fe/d3cd php fe/d3ce inc bob_ll_irq_pri__mand fe/d3d0 plp fe/d3d1 bne LFED3E7 fe/d3d3 pla fe/d3d4 pha fe/d3d5 sta [bob_ll_irq_sec__flags] fe/d3d7 dec bob_ll_irq_pri__mand fe/d3d9 eor [bob_ll_irq_sec__flags] fe/d3db cmp #$ffff fe/d3de pla fe/d3df sta [bob_ll_irq_sec__flags] fe/d3e1 inc bob_ll_irq_pri__mand fe/d3e3 pla fe/d3e4 sta [bob_ll_irq_sec__flags] fe/d3e6 rts fe/d3e7 LFED3E7 pla fe/d3e8 LFED3E8 pla fe/d3e9 clc fe/d3ea rts ******************************************************************************** * __MM 8 - MMALD - allocate large descending * * * * This call allocates a region of memory from a specified pool. The region is * * taken from the upper region of the pool. * * * * Entry: * * Y Handle of memory pool * * BHA Number of bytes to allocate * * X MMALD * * Exit: * * C=0 Pool allocated successfully * * Y Handle of newly allocated pool * * BHA Base address of newly allocated pod * * or C=1 Failed to allocate new pool * * B,D Preserved * ******************************************************************************** fe/d3eb doMMALD clv fe/d3ec bra mmAllocLarge ******************************************************************************** * __MM A - MMALA - allocate large ascending * * * * This call allocates a region of memory from a specified pool. The region is * * taken from the lower region of the pool. * * * * Entry: * * Y Handle of memory pool * * BHA Number of bytes to allocate * * X MMALA * * Exit: * * C=0 Pool allocated successfully * * Y Handle of newly allocated pool * * BHA Base address of newly allocated pod * * or C=1 Failed to allocate new pool * * B,D Preserved * ******************************************************************************** fe/d3ee doMMALA sep #$40 fe/d3f0 mmAllocLarge php fe/d3f1 clc fe/d3f2 adc #$00ff fe/d3f5 bcc @bankinc fe/d3f7 pha fe/d3f8 sep #$20 rwid shortm fe/d3fa tsc fe/d3fb tcd fe/d3fc inc bob_ll_irq_pri__meor fe/d3fe rep #$20 rwid longm fe/d400 pla fe/d401 @bankinc and #$ff00 ;BHA now contains a size rounded up to pages fe/d404 plp fe/d405 pha fe/d406 ldal f:$00fe04 fe/d40a tax fe/d40b lda $05,S fe/d40d and #$00ff fe/d410 ora $01,S fe/d412 xba fe/d413 pld fe/d414 bra LFED45F ******************************************************************************** * __MM 4 - MMBP - ???? * ******************************************************************************** fe/d416 doMMBP jsr LFECEC5 fe/d419 bcs LFED440 fe/d41b and #$ff00 fe/d41e pha fe/d41f lda $05,S fe/d421 and #$00ff fe/d424 bne LFED435 fe/d426 phx fe/d427 ldal f:$00fe04 fe/d42b tax fe/d42c ldal f:bob_ll_irq_pri__psec,x fe/d430 dec A fe/d431 and #$00ff fe/d434 plx fe/d435 LFED435 ora $01,S fe/d437 xba fe/d438 sta $01,S fe/d43a ply fe/d43b tdc fe/d43c clc fe/d43d adc #$00ff fe/d440 LFED440 bcs LFED465 fe/d442 and #$ff00 fe/d445 xba fe/d446 bra LFED473 ******************************************************************************** * __MM 6 - MMASD - Allocate small descending * * * * This call allocates a region of memory from a specified pool. The region is * * taken from the top of the pool, and must be less than 64K bytes long. * * Moreover, the routine will only succeed if the pool would not cross a bank * * boundary * * * * Entry: * * Y Handle of memory pool * * HA Number of bytes to allttcate * * X MMASD * * Exit * * C=0 Pool allocated successfully * * Y Handle of newly allocated pool * * BHA Base address of newly allocated pool * * or C=1 Failed to allocate new pool * * B,D Preserved * ******************************************************************************** fe/d448 doMMASD clv fe/d449 bra mmAllocSmall ******************************************************************************** * __MM A - MMASA - Allocate small * * * * This call allocates a region of memory from a specified pool. The region is * * taken from the lower area of the pool, and must be less than 64K bytes long. * * Moreover, the routine will only succeed if the pool would not cross a bank * * boundary * * * * Entry: * * Y Handle of memory pool * * HA Number of bytes to allttcate * * X MMASA * * Exit * * C=0 Pool allocated successfully * * Y Handle of newly allocated pool * * BHA Base address of newly allocated pool * * or C=1 Failed to allocate new pool * * B,D Preserved * ******************************************************************************** fe/d44b doMMASA sep #$40 fe/d44d mmAllocSmall php fe/d44e clc fe/d44f adc #$00ff fe/d452 and #$ff00 fe/d455 plp fe/d456 bit #$00ff fe/d459 bne LFED4BA fe/d45b xba fe/d45c clc fe/d45d bra LFED460 fe/d45f LFED45F sec fe/d460 LFED460 php fe/d461 jsr LFECEC5 fe/d464 plb fe/d465 LFED465 bcs LFED4BA fe/d467 pha fe/d468 phx fe/d469 jsr LFED510 fe/d46c bvc LFED46F fe/d46e txy fe/d46f LFED46F plx fe/d470 pla fe/d471 bcs LFED4BA fe/d473 LFED473 jsr LFED5DE fe/d476 bcs LFED4BA fe/d478 jsr LFED6E7 fe/d47b jsr allocHandle fe/d47e bcs LFED4B7 fe/d480 LFED480 phb fe/d481 pha fe/d482 phx fe/d483 sep #$20 rwid shortm fe/d485 lda $0e,S fe/d487 pha fe/d488 plb fe/d489 rep #$20 rwid longm fe/d48b lda $0c,S fe/d48d cop COP_2C_OPFMA fe/d48f bcc LFED4A4 fe/d491 phy fe/d492 ldx #__MMFND fe/d495 jsl __MM fe/d499 ply fe/d49a lda #$0000 fe/d49d bcs LFED4A5 fe/d49f ldal f:$000008,x fe/d4a3 tax fe/d4a4 LFED4A4 txa fe/d4a5 LFED4A5 plx fe/d4a6 stal f:$000008,x fe/d4aa pla fe/d4ab plb fe/d4ac clc fe/d4ad LFED4AD tcd fe/d4ae sep #$20 rwid shortm fe/d4b0 phb fe/d4b1 pla fe/d4b2 sta $03,S fe/d4b4 tdc fe/d4b5 clc fe/d4b6 rts rwid longm fe/d4b7 LFED4B7 jsr LFED4D6 fe/d4ba LFED4BA sec fe/d4bb rts ******************************************************************************** * __MM 2 - MMINIT - initialise MM routines * ******************************************************************************** fe/d4bc doMMINIT jsr LFECEC5 fe/d4bf bcs LFED4D4 fe/d4c1 phx fe/d4c2 LFED4C2 plx fe/d4c3 jsr LFED6C5 fe/d4c6 bcs LFED4D6 fe/d4c8 phx fe/d4c9 LFED4C9 tax fe/d4ca jsr LFED6C5 fe/d4cd bcc LFED4C9 fe/d4cf jsr LFED4D6 fe/d4d2 bra LFED4C2 fe/d4d4 LFED4D4 sec fe/d4d5 rts fe/d4d6 LFED4D6 jsr LFED6C5 fe/d4d9 bcc LFED50B fe/d4db jsr freeHandleForB0BlockX fe/d4de phx fe/d4df jsr LFED6B5 fe/d4e2 pha fe/d4e3 LFED4E3 jsr LFED6B5 fe/d4e6 tax fe/d4e7 bcc LFED4E3 fe/d4e9 tax fe/d4ea jsr LFED6C5 fe/d4ed cmp $03,S fe/d4ef bne LFED4F7 fe/d4f1 pla fe/d4f2 jsr LFED6D7 fe/d4f5 bra LFED503 fe/d4f7 LFED4F7 tax fe/d4f8 jsr LFED6B5 fe/d4fb cmp $03,S fe/d4fd bne LFED4F7 fe/d4ff pla fe/d500 jsr LFED6D2 fe/d503 LFED503 plx fe/d504 jsr freeB0Block fe/d507 jsr doMMCHK fe/d50a rts fe/d50b LFED50B sec fe/d50c jsr doMMCHK fe/d50f rts fe/d510 LFED510 php fe/d511 ldy #$0000 fe/d514 phy fe/d515 ldy #$ffff fe/d518 phy fe/d519 phy fe/d51a pha fe/d51b phx fe/d51c ldal f:bob_ll_irq_sec__fphand,x fe/d520 tay fe/d521 jsr LFED6C5 fe/d524 bcs LFED53D fe/d526 LFED526 tax fe/d527 ldal f:bob_ll_irq_sec__fphand,x fe/d52b jsr LFED593 fe/d52e ldal f:bob_ll_irq_pri__meor,x fe/d532 tay fe/d533 jsr LFED6B5 fe/d536 bcc LFED526 fe/d538 cmp $01,S fe/d53a bne syserrNextPoolXPollANotParD fe/d53c tax fe/d53d LFED53D plx fe/d53e phx fe/d53f ldal f:bob_ll_irq_pri__meor,x fe/d543 jsr LFED593 fe/d546 lda $09,S fe/d548 cmp $03,S fe/d54a plx fe/d54b pla fe/d54c bne LFED54F fe/d54e clc fe/d54f LFED54F ply fe/d550 plx fe/d551 pla fe/d552 bcs LFED557 fe/d554 plp fe/d555 sec fe/d556 rts fe/d557 LFED557 plp fe/d558 clc fe/d559 rts fe/d55a syserrNextPoolXPollANotParD pld ;TODO: pointless ? fe/d55b cop COP_0F_OPERR fe/d55d zstr “Memory SCAN error: NEXT POOL X IS POOL A NOT PARENT D” fe/d593 LFED593 pha fe/d594 phy fe/d595 phb fe/d596 plp fe/d597 bcs LFED5B4 fe/d599 LFED599 ply fe/d59a phy fe/d59b lda $01,S fe/d59d eor $03,S fe/d59f beq LFED5B9 fe/d5a1 and #$ff00 fe/d5a4 beq LFED5B4 fe/d5a6 pla fe/d5a7 clc fe/d5a8 adc #$0100 fe/d5ab and #$ff00 fe/d5ae pha fe/d5af jsr LFED5BC fe/d5b2 bra LFED599 fe/d5b4 LFED5B4 lda $03,S fe/d5b6 jsr LFED5BC fe/d5b9 LFED5B9 pla fe/d5ba pla fe/d5bb rts fe/d5bc LFED5BC sec fe/d5bd phy fe/d5be sbc $01,S fe/d5c0 ply fe/d5c1 cmp $11,S fe/d5c3 bcc LFED5C7 fe/d5c5 sta $11,S fe/d5c7 LFED5C7 cmp $0b,S fe/d5c9 bcc LFED5DD fe/d5cb clc fe/d5cc phy fe/d5cd adc $01,S fe/d5cf ply fe/d5d0 sec fe/d5d1 sbc $0b,S fe/d5d3 sta $0d,S fe/d5d5 lda $0f,S fe/d5d7 inc A fe/d5d8 bne LFED5DD fe/d5da tya fe/d5db sta $0f,S fe/d5dd LFED5DD rts fe/d5de LFED5DE eor #$0000 fe/d5e1 bne LFED5E6 fe/d5e3 brl LFED668 fe/d5e6 LFED5E6 pha fe/d5e7 phx fe/d5e8 phy fe/d5e9 ldal f:bob_ll_irq_sec__fphand,x fe/d5ed cmp $01,S fe/d5ef beq LFED5F3 fe/d5f1 bcs LFED665 fe/d5f3 LFED5F3 pla fe/d5f4 pha fe/d5f5 clc fe/d5f6 adc $05,S fe/d5f8 bcs LFED665 fe/d5fa cmpl f:bob_ll_irq_pri__meor,x fe/d5fe beq LFED602 fe/d600 bcs LFED665 fe/d602 LFED602 txy fe/d603 jsr LFED6C5 fe/d606 bcs LFED639 fe/d608 bra LFED617 fe/d60a LFED60A txy fe/d60b jsr LFED6B5 fe/d60e bcc LFED617 fe/d610 cmp $03,S fe/d612 bne sysErrorNextXisPoolANotParD fe/d614 tax fe/d615 bra LFED62C fe/d617 LFED617 tax fe/d618 ldal f:bob_ll_irq_sec__fphand,x fe/d61c cmp $01,S fe/d61e bcc LFED60A fe/d620 sec fe/d621 sbc $05,S fe/d623 cmp $01,S fe/d625 bcc LFED665 fe/d627 tya fe/d628 cmp $03,S fe/d62a beq LFED639 fe/d62c LFED62C phx fe/d62d tyx fe/d62e ldal f:bob_ll_irq_pri__meor,x fe/d632 plx fe/d633 cmp $01,S fe/d635 beq LFED639 fe/d637 bcs LFED665 fe/d639 LFED639 phx fe/d63a phy fe/d63b lda #HND_type_2_CBMEM fe/d63e jsr allocB0B fe/d641 ply fe/d642 pla fe/d643 bcs LFED665 fe/d645 jsr LFED6D2 fe/d648 pla fe/d649 pha fe/d64a stal f:bob_ll_irq_sec__fphand,x fe/d64e clc fe/d64f adc $05,S fe/d651 stal f:bob_ll_irq_pri__meor,x fe/d655 txa fe/d656 jsr LFED6D7 fe/d659 tya fe/d65a cmp $03,S fe/d65c beq LFED6A7 fe/d65e txa fe/d65f tyx fe/d660 jsr LFED6D2 fe/d663 bra LFED6AC fe/d665 LFED665 ply fe/d666 plx fe/d667 pla fe/d668 LFED668 sec fe/d669 jsr doMMCHK fe/d66c rts fe/d66d sysErrorNextXisPoolANotParD pld ;TODO: pointless before syserr fe/d66e cop COP_0F_OPERR fe/d670 zstr “Memory ALLOC error: NEXT POOL X IS POOL A NOT PARENT D” fe/d6a7 LFED6A7 txa fe/d6a8 tyx fe/d6a9 jsr LFED6D7 fe/d6ac LFED6AC plx fe/d6ad plx fe/d6ae plx fe/d6af tax fe/d6b0 clc fe/d6b1 jsr doMMCHK fe/d6b4 rts fe/d6b5 LFED6B5 phd fe/d6b6 ldal f:bob_ll_irq_pri__next,x fe/d6ba pha fe/d6bb pld fe/d6bc ldal f:bob_ll_irq_sec__fphand,x fe/d6c0 cmp bob_ll_irq_sec__fphand fe/d6c2 tdc fe/d6c3 pld fe/d6c4 rts fe/d6c5 LFED6C5 txa fe/d6c6 cmpl f:bob_ll_irq_pri__irqf,x fe/d6ca beq LFED6D1 fe/d6cc ldal f:bob_ll_irq_pri__irqf,x fe/d6d0 clc fe/d6d1 LFED6D1 rts fe/d6d2 LFED6D2 stal f:bob_ll_irq_pri__next,x fe/d6d6 rts fe/d6d7 LFED6D7 stal f:bob_ll_irq_pri__irqf,x fe/d6db rts ******************************************************************************** * __MM E - MMBAS - Return pool base * * This call returns the base address of a given memory pool. * * Entry: Y Handle of memory pool X MMBAS * * Exit: * * D,Y Preserved * * C=0 Success * * BHA Base address of memory pool * * or C=1 The handle was not a valid one * ******************************************************************************** fe/d6dc doMMBAS jsr LFECEC5 fe/d6df bcs LFED6F2 fe/d6e1 jsr LFED6E7 fe/d6e4 brl LFED4AD fe/d6e7 LFED6E7 ldal f:bob_ll_irq_sec__fphand,x fe/d6eb pha fe/d6ec plb fe/d6ed plb fe/d6ee xba fe/d6ef and #$ff00 fe/d6f2 LFED6F2 rts ******************************************************************************** * __MM 10 - MMLEN - Return pool length * * * * This call returns the longth in bytes of a given memory pool. * * * * Entry: * * Y Handle of memory pool * * X MMLEN * * Exit: * * D,Y Preserved * * C=0 Success * * BHA Length of memory pool * * or C=1 The handle was not a valid one * ******************************************************************************** fe/d6f3 doMMLEN jsr LFECEC5 fe/d6f6 bcs LFED71A fe/d6f8 jsr LFED6FE fe/d6fb brl LFED4AD fe/d6fe LFED6FE jsr LFED6E7 fe/d701 bcs LFED71A fe/d703 phb fe/d704 pha fe/d705 jsr LFED726 fe/d708 sec fe/d709 sbc $01,S fe/d70b sta $01,S fe/d70d sep #$20 rwid shortm fe/d70f phb fe/d710 pla fe/d711 sbc $03,S fe/d713 sta $03,S fe/d715 rep #$20 rwid longm fe/d717 pla fe/d718 plb fe/d719 clc fe/d71a LFED71A rts ******************************************************************************** * __MM 12 - MMTOP - Return pool top * * * * This routine returns the address of the byte after the last byte of the pool * * whose handle is given in Y. That is, if the last available byte in a pool is * * at address &0231FF, the address returned in BHA will be &023200. * * * * Entry: * * Y Handle of memory pool * * X MMTOP * * Exit: * * D,Y Preserved * * C=0 Success * * BHA Top address of pool * * or C=1 The handle was not a valid one. * ******************************************************************************** fe/d71b doMMTOP jsr LFECEC5 fe/d71e bcs LFED731 fe/d720 jsr LFED726 fe/d723 brl LFED4AD fe/d726 LFED726 ldal f:bob_ll_irq_pri__meor,x fe/d72a pha fe/d72b plb fe/d72c plb fe/d72d xba fe/d72e and #$ff00 fe/d731 LFED731 rts ******************************************************************************** * __MM 14 - MMFND - Find a memory pool by address * * * * This routine takes an address and returns the handle of a pool containing * * that address if possible. Note that if the address is within a large pool, * * the handle will only be returned if that pool contains no sub-pools. * * * * Entry: * * BHA Memory address within pool * * X MMFND * * Y HDMMT (2), the task pool handle * * Exit: * * D Preserved * * C=0 A pool containing the address exists * * Y Handle of pool * * or C=1 No pool found * * * * TODO: does something else in Y search sub-pools? * ******************************************************************************** fe/d732 doMMFND jsr doMMCHK fe/d735 phb fe/d736 pha fe/d737 phb fe/d738 plb fe/d739 bne LFED74C fe/d73b ldal f:$00fe04 fe/d73f tax fe/d740 ldal f:bob_ll_irq_pri__meor,x fe/d744 sec fe/d745 sbc #$0100 fe/d748 ora $02,S fe/d74a sta $02,S fe/d74c LFED74C plb fe/d74d ldy #$0007 fe/d750 jsr LFECEC5 fe/d753 bcs LFED768 fe/d755 jsr LFED6C5 fe/d758 LFED758 tax fe/d759 ldal f:bob_ll_irq_pri__meor,x fe/d75d cmp $01,S fe/d75f beq LFED763 fe/d761 bcs LFED76B fe/d763 LFED763 jsr LFED6B5 fe/d766 bcc LFED758 fe/d768 LFED768 pla fe/d769 sec fe/d76a rts fe/d76b LFED76B ldal f:bob_ll_irq_sec__fphand,x fe/d76f cmp $01,S fe/d771 beq LFED775 fe/d773 bcs LFED768 fe/d775 LFED775 jsr LFED6C5 fe/d778 bcc LFED758 fe/d77a pla fe/d77b jmp findHandleByAddr ******************************************************************************** * __MM 16 - MMCHK - Check the integrity of the MM system * * * * This call is a system-level routine to check that the data structures * * maintained by the memory managment software is self-consistent. If the * * system is OK, the routine returns, otherwise an OPERR is executed. * * * * Entry: * * X MMCHK * * Exit: * * D,B Preserved * * A,X,Y Preserved * ******************************************************************************** fe/d77e doMMCHK php fe/d77f phd fe/d780 phb fe/d781 pha fe/d782 phx fe/d783 phy fe/d784 jsr LFECE4E fe/d787 pea $0000 fe/d78a plb fe/d78b plb fe/d78c ldal f:$00fe0a fe/d790 tcd fe/d791 tax fe/d792 jsr LFED6C5 fe/d795 bcs syserrNoSubPools fe/d797 jsr LFED7D4 fe/d79a ply fe/d79b plx fe/d79c pla fe/d79d plb fe/d79e pld fe/d79f plp fe/d7a0 rts fe/d7a1 syserrNoSubPools cop COP_0F_OPERR fe/d7a3 zstr “Memory error: WHOLE MACHINE POOL HAS NO SUBPOOLS” fe/d7d4 LFED7D4 jsr LFED872 fe/d7d7 jsr LFED6C5 fe/d7da bcs LFED7E6 fe/d7dc phd fe/d7dd phx fe/d7de phx fe/d7df pld fe/d7e0 tax fe/d7e1 jsr LFED7D4 fe/d7e4 plx fe/d7e5 pld fe/d7e6 LFED7E6 txy fe/d7e7 jsr LFED6B5 fe/d7ea bcs LFED7FD fe/d7ec tax fe/d7ed ldal f:bob_ll_irq_sec__fphand,x fe/d7f1 pea $0000 fe/d7f4 plb fe/d7f5 plb fe/d7f6 cmp bob_ll_irq_pri__meor,y fe/d7f9 bcc syserrBasePoolLtEndPrev fe/d7fb bra LFED7D4 fe/d7fd LFED7FD phd fe/d7fe eor $01,S fe/d800 cmp #$0001 fe/d803 eor $01,S fe/d805 pld fe/d806 bcs syserrNextPoolXisANotParD fe/d808 rts fe/d809 syserrBasePoolLtEndPrev cop COP_0F_OPERR fe/d80b zstr “Memory error: BASE POOL X < END OF PRECEDING POOL Y” fe/d83f syserrNextPoolXisANotParD cop COP_0F_OPERR fe/d841 zstr “Memory error: NEXT POOL X IS POOL A NOT PARENT D” fe/d872 LFED872 ldal f:bob_ll_irq_sec__fphand,x fe/d876 cmpl f:bob_ll_irq_pri__meor,x fe/d87a beq syserrPoolBaseGtEnd fe/d87c bcs syserrPoolBaseGtEnd fe/d87e lda bob_ll_irq_sec__fphand fe/d880 cmpl f:bob_ll_irq_sec__fphand,x fe/d884 beq LFED888 fe/d886 bcs syserrMemBaseLtParent fe/d888 LFED888 ldal f:bob_ll_irq_pri__meor,x fe/d88c cmp bob_ll_irq_pri__meor fe/d88e beq LFED892 fe/d890 bcs syserrPoolEndgtEndParent fe/d892 LFED892 rts fe/d893 syserrMemBaseLtParent cop COP_0F_OPERR fe/d895 zstr “Memory error: BASE POOL X < BASE PARENT D” fe/d8bf syserrPoolEndgtEndParent cop COP_0F_OPERR fe/d8c1 zstr “Memory error: END POOL X > END PARENT D” fe/d8e9 syserrPoolBaseGtEnd cop COP_0F_OPERR fe/d8eb zstr “Memory error: BASE POOL X > END POOL X” ******************************************************************************** * __MM 18 - MMAZB - Allocate a bank zero area * * * * This call allocates memory from bank zero, in a way similar to MMASD. Note * * that this call should be used only when it is essential that the memory * * allocated is in bank zero, eg to store an interrupt routine. * * * * Bank zero is a relatively precious resource on the 65816 and should not be * * over used if many tasks are to be supported. * * Entry: * * HA Number of bytes to allocate * * X MMAZB * * Exit: * * C=0 Pool allocated successfully * * BHA Base address of newly allocated pool * * Y Handle of new direct page pool * * or C=1 Failed to allocate new pool * * B,D Preserved * * * * QRY HDMMM - is this a special bank 0 pool that we can allocate from? * ******************************************************************************** fe/d912 doMMAZB ldy #HDMMM fe/d915 ldx #__MMASD fe/d918 jsl __MM fe/d91c bcs @retsec fe/d91e phx fe/d91f pha fe/d920 phb ; stack ; ; +4 X - not documented whether MMASD corrupts this ; +2 HA - alloc'd B0 pointer ; +1 B - alloc'd bank fe/d921 ldal f:$00fe04 fe/d925 tax fe/d926 sep #$20 rwid shortm fe/d928 ldal f:$000007,x fe/d92c dec A fe/d92d eor $01,S fe/d92f cmp #$01 fe/d931 rep #$20 rwid longm fe/d933 plb fe/d934 pla fe/d935 plx fe/d936 bcs @fpretsec fe/d938 brl LFED480 fe/d93b @fpretsec ldx #__MMFP ;free the handle fe/d93e jsl __MM fe/d942 @retsec sec fe/d943 rts ******************************************************************************** * __MM 1A - MMMRG - merge two pools * * * * MMMRG - Merge two memory pools into one * * * * This call combines two existing contiguous pools of memory into a single, * * larger one. The pools must not overlap, ie the call may not be used to merge * * a pool with one of its sub-pools. * * * * Entry: * * Y Handle of pool 1 * * HA Handle of pool 2 * * X MMMRG * * Exit: * * C=0 The pools were merged successfully * * Y Handle of composite pool * * or C=1 The pools could not be merged * * B,D Preserved * * * * Note that the handle of the composite pool may be different from both of the * * source handles * ******************************************************************************** fe/d944 doMMMRG pha fe/d945 phy fe/d946 pha fe/d947 jsr LFECEC5 fe/d94a bcc LFED94F fe/d94c brl LFED9E3 fe/d94f LFED94F ply fe/d950 phx fe/d951 jsr LFECEC5 fe/d954 bcc LFED959 fe/d956 brl LFED9E3 fe/d959 LFED959 pld fe/d95a lda bob_ll_irq_sec__fphand fe/d95c cmpl f:bob_ll_irq_sec__fphand,x fe/d960 bcs LFED966 fe/d962 phd fe/d963 txa fe/d964 tcd fe/d965 plx fe/d966 LFED966 jsr LFED6B5 fe/d969 bcs LFED9E4 fe/d96b phd fe/d96c eor $01,S fe/d96e cmp #$0001 fe/d971 pld fe/d972 bcs LFED9E4 fe/d974 ldal f:bob_ll_irq_pri__meor,x fe/d978 cmp bob_ll_irq_sec__fphand fe/d97a bne LFED9E4 fe/d97c lda bob_ll_irq_pri__meor fe/d97e stal f:bob_ll_irq_pri__meor,x fe/d982 txy fe/d983 tdc fe/d984 tax fe/d985 jsr LFED6B5 fe/d988 tyx fe/d989 jsr LFED6D2 fe/d98c tdc fe/d98d tax fe/d98e jsr LFED6C5 fe/d991 bcs LFED9B4 fe/d993 pha fe/d994 LFED994 tax fe/d995 jsr LFED6B5 fe/d998 bcc LFED994 fe/d99a tya fe/d99b jsr LFED6D2 fe/d99e tyx fe/d99f jsr LFED6C5 fe/d9a2 bcs LFED9B0 fe/d9a4 LFED9A4 tax fe/d9a5 jsr LFED6B5 fe/d9a8 bcc LFED9A4 fe/d9aa pla fe/d9ab jsr LFED6D2 fe/d9ae bra LFED9B4 fe/d9b0 LFED9B0 pla fe/d9b1 jsr LFED6D7 fe/d9b4 LFED9B4 ply fe/d9b5 jsr LFECEC5 fe/d9b8 bcs syserrUnexpectedMMRG fe/d9ba txa fe/d9bb phd fe/d9bc eor $01,S fe/d9be cmp #$0001 fe/d9c1 pld fe/d9c2 bcs LFED9CA fe/d9c4 jsr LFED9E8 fe/d9c7 ply fe/d9c8 bra LFED9D1 fe/d9ca LFED9CA tya fe/d9cb ply fe/d9cc pha fe/d9cd jsr LFED9E8 fe/d9d0 ply fe/d9d1 LFED9D1 jsr LFECEC5 fe/d9d4 bcs syserrUnexpectedMMRG fe/d9d6 jsr freeHandleForB0BlockX fe/d9d9 bcs syserrUnexpectedMMRG fe/d9db jsr allocHandle fe/d9de bcs syserrUnexpectedMMRG fe/d9e0 brl LFED480 fe/d9e3 LFED9E3 pla fe/d9e4 LFED9E4 ply fe/d9e5 pla fe/d9e6 sec fe/d9e7 rts fe/d9e8 LFED9E8 jsr LFECEC5 fe/d9eb bcs syserrUnexpectedMMRG fe/d9ed jsr freeHandleForB0BlockX fe/d9f0 bcs syserrUnexpectedMMRG fe/d9f2 jsr freeB0Block fe/d9f5 bcs syserrUnexpectedMMRG fe/d9f7 rts fe/d9f8 syserrUnexpectedMMRG cop COP_0F_OPERR fe/d9fa zstr “Unexpected error: MMMRG” ******************************************************************************** * CO - CoRoutine entry point * ******************************************************************************** rwid shortm,shortx fe/da12 default__CO php fe/da13 rep #$30 rwid longm,longx fe/da15 cpx #$001e fe/da18 bcs LFEDA26 fe/da1a phd fe/da1b phb fe/da1c jsr (tblCoServDispatch,x) fe/da1f plb fe/da20 pld fe/da21 bcs LFEDA26 fe/da23 plp rwid shortm,shortx fe/da24 clc fe/da25 rtl rwid longm,longx fe/da26 LFEDA26 plp rwid shortm,shortx fe/da27 sec fe/da28 rtl fe/da29 tblCoServDispatch dd2 __ST_0 & $ffff fe/da2b dd2 doCOCRE & $ffff ;COPAR - 2 - initialize QRY fe/da2d dd2 doCOENV & $ffff ;COENV - 4 - set coroutine environment fe/da2f dd2 doCODEL & $ffff ;CODEL - 6 - delete coroutine fe/da31 dd2 doCODES & $ffff ;CODES - 8 - destroy coroutine fe/da33 dd2 doCOREN & $ffff ;COREN - A - restore current coroutine's environment fe/da35 dd2 doCOBRK & $ffff ;COBRK - C - Set coroutine BRK handler fe/da37 dd2 doCOCBH & $ffff ;COCBH - E - cancel break handler fe/da39 dd2 doCORTB & $ffff ;CORTB - 10 - ??? fe/da3b dd2 doCOIAM & $ffff ;COIAM - 12 - Return current handle fe/da3d dd2 doCONAME & $ffff ;CONAME - 14 - ??? fe/da3f dd2 doCOINIT & $ffff ;COINIT - 16 - initialise language fe/da41 dd2 doCOKILL & $ffff ;COKILL - 18 - kill language fe/da43 dd2 doCOHELP & $ffff ;COHELP - 1A - language help fe/da45 dd2 doCoMOD & $ffff ;COMOD - 1C - ??? ******************************************************************************** * __CO 1C - COMOD - ??? * * * * Given an address in a module make a coroutine from the module's entry point * * * * Entry: * * BHA contains an address somewhere within a module * * * * QRY Looks to do OPRMI then drops through to COCRE * ******************************************************************************** rwid longm,longx fe/da47 doCoMOD ldx #$0000 fe/da4a txy fe/da4b cop COP_34_OPRMI ;get entry address fe/da4d bcs @retsec ******************************************************************************** * __CO 02 - COCRE - Create a coroutine * * * * This sets up the initial execution address of a new coroutine and declares * * its stack size. * * Entry: * * BHA Entry address of coroutine * * D Desired size of coroutine's stack * * X COCRE * * Exit: * * C=0 Coroutine created successfully * * Y Handle to be used in subsequent calls * * or C=1 Coroutine could not be created * * * * Notes: The stack size must be a non-zero multiple of 256 bytes - &200 is a * * good size * ******************************************************************************** fe/da4f doCOCRE phd fe/da50 phb fe/da51 pha fe/da52 tdc fe/da53 ldx #__MMAZB ;allocate the stack fe/da56 jsl __MM fe/da5a bcs @retsecpop ;stack alloc failed fe/da5c lda #HND_type_6_CBCO fe/da5f jsr allocB0B ;alloc a coroutine block??? QRY fe/da62 bcs @freestackretsec fe/da64 phx fe/da65 pld fe/da66 sty CO_off_DP ;stash handle in DP slot QRY fe/da68 stz CO_off_Parent fe/da6a stz CO_off_flags fe/da6c phx ;stack X - pointer to coroutine block ; stack contents ; +6 D on entry (stack size) ; +3 BHA address of coroutine start ; +1 B0 pointer to corouting block fe/da6d ldx #__MMTOP ;get top of stack fe/da70 jsl __MM fe/da74 sec ;assume in B0 (alloc'd with MMAZB) fe/da75 sbc #$0004 ;subtract 4 to point at 3rd last byte fe/da78 tax ;put that in X fe/da79 lda $03,S ;get BHA on entry fe/da7b stal f:bob_ll_irq_pri__next,x fe/da7f lda $05,S fe/da81 and #$00ff fe/da84 stal f:$000002,x ;store bank - TODO: this looks like it may be a bug - it stores a 0 outside our pool! fe/da88 txa ;put X in A fe/da89 dec A ;decrement so it's suitable as a stack pointer fe/da8a plx ;X = block addr fe/da8b ply ;Y = HA on entry fe/da8c plb ;B = B on entry ; stack is now ; +1 is D on entry fe/da8d phx ;block addr fe/da8e phx ;block addr fe/da8f pld fe/da90 phd ;into D ; stack is now ; +5 D on entry ; +3 block addr ; +1 block addr fe/da91 tsx ;X=caller's stack fe/da92 tcs ;set S = coroutine stack ; coroutine stack is now ; +1 BHA of coroutine start addr fe/da93 phd fe/da94 phb fe/da95 dey fe/da96 phy fe/da97 php ; coroutine stack is now ; ; +7 BHA on entry ; +5 D block address ; +4 B on entry ; +2 HA-1 on entry ; +1 current flags fe/da98 tsc ;coroutine stack pointer into A fe/da99 txs ;back to caller's stack fe/da9a plx ;X = block pointer fe/da9b stal f:CO_off_stack,x ;store coroutine start stack fe/da9f jsr allocHandle fe/daa2 bcs @nohandles fe/daa4 lda #$0000 fe/daa7 stal f:CO_off_DP,x ;zero the DP handle (used to stash stack handle) fe/daab pla fe/daac pld fe/daad clc fe/daae rts fe/daaf @nohandles ldal f:CO_off_DP,x ;get the handle for the stack we stashed earlier fe/dab3 pha ;push it fe/dab4 jsr freeB0Block ;free the block QRY? fe/dab7 ply ;get back stack handle fe/dab8 @freestackretsec ldx #__MMFP fe/dabb jsl __MM fe/dabf @retsecpop pla fe/dac0 plb fe/dac1 pld fe/dac2 @retsec sec fe/dac3 rts ******************************************************************************** * COENV - Set a coroutine's environment * * This specifies the direct page to be used whenever a coroutine is entered. * * If the coroutine is to use any shared direct page workspace (as distinct * * from direct page workspace allocated by itself, this should be called * * immediately after a coroutine is created, or at least before it is called * * for the first time. * * * * Entry: * * Y Handle * * D Direct page to be used by coroutine * * X COENV * * Exit: * * C=0 Environment set correctly * * or C=1 Environment could not be set * * * * TODO: Documentation - Y can be 0 in which case this sets for the current * * coroutine * ******************************************************************************** fe/dac4 doCOENV phd fe/dac5 pea EXSYS fe/dac8 pld fe/dac9 lda <EXSYS_CUR_COROUTINE ;if no handle default to one at offset $10 in table fe/dacb cpy #$0000 fe/dace beq @yeq0 fe/dad0 lda [<EXSYS_FpHandles],y ;coroutine handle's address from the handleblock fe/dad2 @yeq0 tcd ;put it in DP fe/dad3 lda $01,S ;get pushed DP parameter fe/dad5 sta CO_off_DP ;store in the block DP offset fe/dad7 lda CO_off_flags fe/dad9 ora #COFLAG_HASDP fe/dadc sta CO_off_flags ;set flag to indicate we want DP setting on subsequent continues fe/dade pld fe/dadf clc fe/dae0 rts ******************************************************************************** * __CO E - COCBH - Cancel break handler for This coroutine * * * * This call resets the break handler for the current coroutine to a 'no * * handler' state (as when the coroutine is created). If a BRK occurs in a * * routine with no BRK handler, the operating system will attempt to use its * * parent's handler. This carries on up the hierarchy until a valid BRK handler * * is found or the top level is reached. In the latter case, an OPERR COP * * instruction is executed. * * * * Entry: * * X COCBH * * Exit: * * B,D Preserved * * C=0 Break handler was cancelled * * BHA Address of old break handler * * or C=1 There was no break handler to cancel * ******************************************************************************** fe/dae1 doCOCBH ldal f:EXSYS_CUR_COROUTINE fe/dae5 tcd fe/dae6 lda #COFLAG_hasBRKhandler fe/dae9 trb CO_off_flags fe/daeb beq LFEDB04 fe/daed ldx CO_off_8_BRKBLOCK fe/daef sep #$20 rwid shortm fe/daf1 ldal f:$000002,x fe/daf5 sta $03,S ;get K of old break handler fe/daf7 rep #$20 rwid longm fe/daf9 ldal f:bob_ll_irq_pri__next,x ;get HA of old break handler fe/dafd pha fe/dafe jsr freeB0Block fe/db01 pla fe/db02 clc fe/db03 rts fe/db04 LFEDB04 sec fe/db05 rts ******************************************************************************** * __CO C - COBRK - Set the coroutine break handler address * * * * This routine sets the address of the routine to be called when a BRK is * * encountered within the current coroutine. * * * * Entry: * * BHA BRK handler address X COBRK * * Exit: * * C=0 Address was set OK * * or C=1 Address could not be set * ******************************************************************************** fe/db06 doCOBRK pha fe/db07 pea EXSYS fe/db0a pld fe/db0b pei (<EXSYS_CUR_COROUTINE) fe/db0d pld fe/db0e lda CO_off_flags fe/db10 and #COFLAG_hasBRKhandler fe/db13 beq LFEDB19 fe/db15 ldx CO_off_8_BRKBLOCK fe/db17 bra LFEDB2A fe/db19 LFEDB19 lda #HND_type_8_CBCO2 fe/db1c jsr allocB0B fe/db1f bcs LFEDB35 fe/db21 lda CO_off_flags fe/db23 ora #COFLAG_hasBRKhandler fe/db26 sta CO_off_flags fe/db28 stx CO_off_8_BRKBLOCK fe/db2a LFEDB2A txa fe/db2b tcd ; this is the block pointed to by 8 - not sure what goes in it! fe/db2c lda $04,S fe/db2e sta $01 fe/db30 pla fe/db31 sta bob_ll_irq_pri__next fe/db33 clc fe/db34 rts fe/db35 LFEDB35 pla fe/db36 rts ******************************************************************************** * __CO 6 - CODEL- Delete a coroutine * * * * This deletes an existing coroutine. * * * * Entry: * * Y Handle * * X CODEL * * Exit: * * B,D Preserved * * C=0 Coroutine was deleted * * or C=l Coroutine was not deleted * ******************************************************************************** fe/db37 doCODEL rep #$70 ; clear V fe/db39 coDes2 phb fe/db3a phd fe/db3b pea MM_HANDLE_TAB fe/db3e pld fe/db3f lda [$02],y ;get coroutine block from hanbdle fe/db41 pha fe/db42 pld ;coroutine block into D fe/db43 bvs LFEDB54 ;if V set skip parent check fe/db45 sec fe/db46 lda $0b fe/db48 and #$00ff fe/db4b eor #$0006 fe/db4e bne @ret fe/db50 lda $02 fe/db52 bne @ret fe/db54 LFEDB54 phd fe/db55 lda bob_ll_irq_pri__next fe/db57 pea $0000 fe/db5a plb fe/db5b plb fe/db5c ldx #__MMFND fe/db5f jsl __MM fe/db63 bcc @ok fe/db65 brl syserrCoRoutineError fe/db68 @ok phy fe/db69 ldx #__MMTOP fe/db6c jsl __MM fe/db70 sec fe/db71 sbc #$0004 fe/db74 tax fe/db75 dex fe/db76 dex fe/db77 ldal f:bob_ll_irq_pri__next,x fe/db7b cmp $03,S fe/db7d beq LFEDB82 fe/db7f brl syserrCoRoutineError fe/db82 LFEDB82 ply fe/db83 ldx #__MMFP fe/db86 jsl __MM fe/db8a plx fe/db8b jsr freeHandleForB0BlockX fe/db8e txa fe/db8f tcd fe/db90 pei (DPCOP_DP) fe/db92 pei (bob_ll_irq_sec__flags) fe/db94 jsr freeB0Block fe/db97 pla fe/db98 plx fe/db99 bit #$2000 fe/db9c beq @clcret fe/db9e jsr freeB0Block fe/dba1 @clcret clc fe/dba2 @ret pld fe/dba3 plb fe/dba4 rts ******************************************************************************** * __CO 8 - CODES - Destroy coroutine * * * * This acts as CODEL, but does not check that the routine to be deleted has a * * parent. The useof this call is to delete a routine in which a BRK (error * * condition) has occurred, and which has no BRK handler of its own. * * * * Entry: * * Y Handle * * X CODES * * Exit: * * B,D Preserved * * C=0 Coroutine was deleted * * or C=1 Coroutine could not be deleted * ******************************************************************************** fe/dba5 doCODES sep #$40 fe/dba7 bra coDes2 ******************************************************************************** * __CO 1A - COHELP - Language help * * * * These calls relate to the language entry point reason codes. The CO reason * * codes call a given coroutine at its entry point as if it were a language, * * with the appropriate reason code in X. The entry is called as a subroutine, * * not a coroutine, so is expected to return with an RTL. * * * * COHELP calls the coroutine with X=6 * * * * Entry: * * Y Handleof coroutine to be catted * * BHA Arguments * * Exit: B,D Preserved * * BHA,X,Y Results from language entry * ******************************************************************************** fe/dba9 doCOHELP ldx #$0006 fe/dbac bra coLangFn ******************************************************************************** * __CO 14 - CONAME - ??? * * * * These calls relate to the language entry point reason codes. The CO reason * * codes call a given coroutine at its entry point as if it were a language, * * with the appropriate reason code in X. The entry is called as a subroutine, * * not a coroutine, so is expected to return with an RTL. * * * * COHELP calls the coroutine with X=0 * * * * Entry: * * Y Handleof coroutine to be catted * * BHA Arguments * * Exit: B,D Preserved * * BHA,X,Y Results from language entry * ******************************************************************************** fe/dbae doCONAME ldx #$0000 fe/dbb1 bra coLangFn ******************************************************************************** * __CO 16 - COINIT - initialise language * * * * These calls relate to the language entry point reason codes. The CO reason * * codes call a given coroutine at its entry point as if it were a language, * * with the appropriate reason code in X. The entry is called as a subroutine, * * not a coroutine, so is expected to return with an RTL. * * * * COINIT calls the coroutine with X=2 * * * * Entry: * * Y Handleof coroutine to be catted * * BHA Arguments * * Exit: B,D Preserved * * BHA,X,Y Results from language entry * ******************************************************************************** fe/dbb3 doCOINIT ldx #$0002 fe/dbb6 bra coLangFn ******************************************************************************** * __CO 18 - COKILL - kill a language * * * * These calls relate to the language entry point reason codes. The CO reason * * codes call a given coroutine at its entry point as if it were a language, * * with the appropriate reason code in X. The entry is called as a subroutine, * * not a coroutine, so is expected to return with an RTL. * * * * COKILL calls the coroutine with X=4 * * * * Entry: * * Y Handleof coroutine to be catted * * BHA Arguments * * Exit: B,D Preserved * * BHA,X,Y Results from language entry * ******************************************************************************** fe/dbb8 doCOKILL ldx #$0004 fe/dbbb coLangFn phk fe/dbbc per LFEDC10-1 fe/dbbf phk fe/dbc0 phd fe/dbc1 php fe/dbc2 phb fe/dbc3 pha fe/dbc4 phx fe/dbc5 pea $ff00 fe/dbc8 pld fe/dbc9 lda [bob_ll_irq_pri__irqf],y fe/dbcb pha fe/dbcc pld fe/dbcd pei (bob_ll_irq_pri__meor) fe/dbcf lda bob_ll_irq_pri__next fe/dbd1 phd fe/dbd2 pea $0000 fe/dbd5 plb fe/dbd6 plb fe/dbd7 ldx #$0014 fe/dbda jsl __MM fe/dbde bcc LFEDBE3 fe/dbe0 brl syserrCoRoutineError fe/dbe3 LFEDBE3 ldx #$0012 fe/dbe6 jsl __MM fe/dbea sec fe/dbeb sbc #$0004 fe/dbee tax fe/dbef dex fe/dbf0 dex fe/dbf1 pla fe/dbf2 cmpl f:bob_ll_irq_pri__next,x fe/dbf6 beq LFEDBFB fe/dbf8 brl syserrCoRoutineError fe/dbfb LFEDBFB sep #$20 rwid shortm fe/dbfd ldal f:bob_ll_irq_sec__fphand,x fe/dc01 sta $0b,S fe/dc03 rep #$20 rwid longm fe/dc05 ldal f:bob_ll_irq_pri__irqf,x fe/dc09 sta $09,S fe/dc0b pld fe/dc0c plx fe/dc0d pla fe/dc0e plb fe/dc0f rti fe/dc10 LFEDC10 dd1 $60 ******************************************************************************** * 12 - COIAM - Return handle * * * * This call returns the handle of the current coroutine, ie the coroutine from * * which the call to COIAM is made. * * * * Entry: * * X COIAM * * Exit: * * B,D Preserved * * C=0 The handle was found * * Y The current coroutine's handle * * C=l No handle could be found for the caller * ******************************************************************************** fe/dc11 doCOIAM pea EXSYS fe/dc14 pld fe/dc15 pei (<EXSYS_CUR_COROUTINE) fe/dc17 plx fe/dc18 jmp findHandleByAddr ******************************************************************************** * CRS - Resume a sibling coroutine * * * * This acts as a CWT, but instead of returning control back to the parent, it * * passes control to a dormant sibling (ie another child of its parent). It * * acts effectively as if the calling coroutine did a CWT and the parent * * immediately * * did a CCO to the sibling coroutine. When the sibling subseqttently does a * * CWT, control returns to the parent * * * * Entry: * * Y Handle of siUing coroutine * * BHA,X,C Arguments to sibling routine * * * * Out: * * * * BHA,X,C Arguments from next call by parent * * D As determined by set environment * ******************************************************************************** rwid shortm,shortx fe/dc1b default__CRS php fe/dc1c rep #$30 rwid longm,longx fe/dc1e stal f:EXSYS_CO_A_SAVE fe/dc22 tsc fe/dc23 phd fe/dc24 pea EXSYS fe/dc27 pld fe/dc28 sta [<EXSYS_CUR_COROUTINE] fe/dc2a lda [<EXSYS_FpHandles],y fe/dc2c pei (<EXSYS_CUR_COROUTINE) fe/dc2e pld fe/dc2f ldy CO_off_Parent fe/dc31 stz CO_off_Parent fe/dc33 bra _CCO_INT_QRY rwid shortm,shortx fe/dc35 LFEDC35 rep #$30 rwid longm,longx fe/dc37 stal f:EXSYS_CO_A_SAVE fe/dc3b tsc fe/dc3c pha fe/dc3d pea EXSYS fe/dc40 pld fe/dc41 lda [<EXSYS_FpHandles],y fe/dc43 ldy #$0000 fe/dc46 bra _CCO_INT_QRY ******************************************************************************** * CCO - Call a Co-routine * * * * This is used to call a coroutine from its creator (parent). On the first * * call the entry address given in the COCRE call is used. Subsequently, the * * address after the last CWT executed by the routine is used * * * * Entry: * * Y Handle of child * * BHA,X,C Arguments to child coroutine * * Exit: * * BHA,X,C Results from child coroutine * * B,D Preserved * * * * Note: C is the C flag. * ******************************************************************************** rwid shortm,shortx fe/dc48 default__CCO php fe/dc49 phd fe/dc4a rep #$30 rwid longm,longx fe/dc4c stal f:EXSYS_CO_A_SAVE ;we need to preserve A not on the stack as the stack will get switched fe/dc50 pea EXSYS fe/dc53 pld fe/dc54 tsc fe/dc55 sta [<EXSYS_CUR_COROUTINE] ;store current stack at offset 0 in our block fe/dc57 lda [<EXSYS_FpHandles],y fe/dc59 ldy <EXSYS_CUR_COROUTINE fe/dc5b _CCO_INT_QRY tcd fe/dc5c stal f:EXSYS_CUR_COROUTINE fe/dc60 lda B0B_offs_B_type fe/dc62 and #$00ff fe/dc65 eor #HND_type_6_CBCO fe/dc68 beq LFEDC85 fe/dc6a brk $00 fe/dc6c zstr “Invalid coroutine handle” fe/dc85 LFEDC85 lda CO_off_Parent fe/dc87 beq LFEDC8C fe/dc89 brl syserrCoRoutineError fe/dc8c LFEDC8C sty CO_off_Parent ;set ourselves as the parent fe/dc8e lda $01,S ;get parent DP fe/dc90 bit CO_off_flags-1 ;check for $40 in low byte of flags (has DP) fe/dc92 bvc @nodp fe/dc94 lda CO_off_DP ;get stored DP for child fe/dc96 @nodp sta CO_off_DP ;store in child DP fe/dc98 pha ;save DP - again - TODO: there looks to be a lot of unnecessary stuff here fe/dc99 pea EXSYS fe/dc9c pld fe/dc9d lda [<EXSYS_CUR_COROUTINE] ;get stack from offset 0 in block fe/dc9f pld ;set up call DP fe/dca0 tcs ;the rtl below will now return to the address that was last stacked by the child coroutine fe/dca1 ldal f:EXSYS_CO_A_SAVE ;get back A as passed in fe/dca5 plpRetCy bcs @plpRetSec fe/dca7 plp fe/dca8 clc fe/dca9 rtl fe/dcaa @plpRetSec plp fe/dcab sec fe/dcac rtl ******************************************************************************** * CWT - coroutine wait / suspend * * * * Suspends current co-routine and return to parent * ******************************************************************************** rwid shortm,shortx fe/dcad default__CWT php fe/dcae rep #$30 rwid longm,longx fe/dcb0 stal f:EXSYS_CO_A_SAVE ;save AH - we're about to swap out stack so we can't stack it fe/dcb4 ldal f:EXSYS_CUR_COROUTINE ;get pointer to this coroutine's block fe/dcb8 tcd ;in DP fe/dcb9 tsc fe/dcba sta CO_off_stack ;store stack at offset 0 fe/dcbc lda CO_off_Parent fe/dcbe bne LFEDCC3 fe/dcc0 brl syserrCoRoutineError ;flag error - cannot call CWT when no parent?!? fe/dcc3 LFEDCC3 stal f:EXSYS_CUR_COROUTINE ;make parent the current coroutine fe/dcc7 pei (bob_ll_irq_pri__irqf) ;push the address of the parent block on the stack fe/dcc9 stz bob_ll_irq_pri__irqf ;clear current co routine's parent fe/dccb pld ;DP to point at parent block fe/dccc lda bob_ll_irq_pri__next ;load the parent's stack pointer fe/dcce tcs ;and switch to that stack fe/dccf ldal f:EXSYS_CO_A_SAVE ;return AH from coroutine fe/dcd3 pld ;pull D - the DP of the parent coroutine fe/dcd4 bra plpRetCy ;continue coroutine ******************************************************************************** * COREN - Restore current coroutine's environment * * * * This call may be used to restore D to the value set by a previous call to * * COENV. It is useful as many of the OS calls corrupt D. * * * * Entry: * * X COREN * * Exit: * * D Value set in previous call to COENV * * * * TODO: Documentation also seems to restore B which is _NOT_ set up by COENV! * ******************************************************************************** fe/dcd6 doCOREN ldal f:EXSYS_CUR_COROUTINE fe/dcda tcd fe/dcdb sep #$20 rwid shortm fe/dcdd lda CO_off_B fe/dcdf sta $03,S fe/dce1 rep #$20 rwid longm fe/dce3 lda CO_off_DP fe/dce5 sta $04,S fe/dce7 rts fe/dce8 syserrCoRoutineError cop COP_0F_OPERR fe/dcea zstr “Coroutine error” fe/dcfa coHandleBRK tdc fe/dcfb tay fe/dcfc ldal f:EXSYS_CUR_COROUTINE fe/dd00 tax fe/dd01 @lp_par tcd fe/dd02 lda #COFLAG_hasBRKhandler fe/dd05 bit CO_off_flags fe/dd07 bne coCallBrkHandler ;there's a break handler set - call it fe/dd09 lda CO_off_Parent fe/dd0b bne @lp_par ;check parent's for break handler ; If we get this no ancestor has a break handler set so call the system one and ; hang up the machine fe/dd0d cop COP_2D_OPWRM ;write module name to VDU fe/dd0f bcc LFEDD15 fe/dd11 cop COP_01_OPWRS ;write "?" fe/dd13 zstr “?” fe/dd15 LFEDD15 cop COP_01_OPWRS fe/dd17 zstr “: ” fe/dd1a ldx #__STSBK fe/dd1d jsl __ST fe/dd21 LFEDD21 ldx #__STTBK fe/dd24 jsl __ST fe/dd28 bcs sysErrBRKbutNoHandler fe/dd2a cop COP_00_OPWRC fe/dd2c bra LFEDD21 fe/dd2e sysErrBRKbutNoHandler cop COP_01_OPWRS fe/dd30 zstr “*** BRK but no handler:” fe/dd48 tya fe/dd49 tcd fe/dd4a ldx #$000d fe/dd4d jsr @dumpregs fe/dd50 cop COP_01_OPWRS fe/dd52 zstr “ ***”,$0d,$0a fe/dd59 cop COP_0F_OPERR fe/dd5b zstr “” fe/dd5c coCallBrkHandler tdc fe/dd5d cmpl f:EXSYS_CUR_COROUTINE fe/dd61 beq LFEDD66 fe/dd63 lda CO_off_stack ;switch current level's stack in fe/dd65 tcs fe/dd66 LFEDD66 tdc fe/dd67 stal f:EXSYS_CUR_COROUTINE ;set this coroutine as current fe/dd6b phb fe/dd6c phd fe/dd6d cli fe/dd6e php ;push flags for RTI with interrupts (re)enabled fe/dd6f phd fe/dd70 pei (CO_off_8_BRKBLOCK) ;QRY - dunno what's at offset 8 here fe/dd72 pld fe/dd73 lda $01 fe/dd75 sta $05,S fe/dd77 lda bob_ll_irq_pri__next fe/dd79 sta $04,S fe/dd7b pld fe/dd7c pei ($06) fe/dd7e pld fe/dd7f rti ******************************************************************************** * __CO 10 - CORTB - ??? * * * * Does nothing * ******************************************************************************** fe/dd80 doCORTB rep #$30 fe/dd82 rts rwid shortm,shortx fe/dd83 getCurCorParent php fe/dd84 phd fe/dd85 rep #$30 rwid longm,longx fe/dd87 pea EXSYS fe/dd8a pld fe/dd8b pei (<EXSYS_CUR_COROUTINE) fe/dd8d pld fe/dd8e ldx CO_off_Parent fe/dd90 beq @retsec fe/dd92 pld fe/dd93 plp rwid shortm,shortx fe/dd94 clc fe/dd95 rts rwid longm,longx fe/dd96 @retsec pld fe/dd97 plp rwid shortm,shortx fe/dd98 sec fe/dd99 rts fe/dd9a rtl fe/dd9b dd1 $29 fe/dd9c dd1 $43 fe/dd9d dd1 $28 fe/dd9e dd1 $00 ******************************************************************************** * LN 02 - LNCLI - call the CLI vector * * * * OSCLI - TODO: check, remove old API? * ******************************************************************************** rwid longm,longx fe/dd9f doLNCLI php fe/dda0 sep #$20 rwid shortm fe/dda2 rep #$10 fe/dda4 sta <DPSYS_GSREAD_ptr fe/dda6 xba fe/dda7 sta <DPSYS_GSREAD_ptr+1 fe/dda9 ldy #$0000 fe/ddac LFEDDAC lda (<DPSYS_GSREAD_ptr),y fe/ddae cmp #$0d fe/ddb0 beq LFEDDCB fe/ddb2 iny fe/ddb3 bne LFEDDAC fe/ddb5 cop COP_26_OPBHA fe/ddb7 zstr “Line too long” fe/ddc5 ldx #$0001 fe/ddc8 plp rwid longm fe/ddc9 sec fe/ddca rts rwid shortm fe/ddcb LFEDDCB ldy #$ffff fe/ddce LFEDDCE iny fe/ddcf lda (<DPSYS_GSREAD_ptr),y fe/ddd1 cmp #‘ ’ fe/ddd3 beq LFEDDCE fe/ddd5 cmp #‘*’ fe/ddd7 beq LFEDDCE fe/ddd9 cmp #$0d fe/dddb beq LFEDDF7 fe/dddd cmp #‘|’ fe/dddf beq LFEDDF7 fe/dde1 cmp #‘/’ fe/dde3 beq LFEDDFF fe/dde5 cmp #‘.’ fe/dde7 beq LFEDDFE fe/dde9 jsr LFEDE0B fe/ddec phk fe/dded jsr LFEF372 fe/ddf0 bcc LFEDDF7 fe/ddf2 bvs LFEDDFA fe/ddf4 plp rwid longm fe/ddf5 sec fe/ddf6 rts rwid shortm fe/ddf7 LFEDDF7 plp rwid longm fe/ddf8 clc fe/ddf9 rts rwid shortm fe/ddfa LFEDDFA plp rwid longm fe/ddfb brl LFEC764 rwid shortm fe/ddfe LFEDDFE clc fe/ddff LFEDDFF php fe/de00 iny fe/de01 jsr LFEDE0B fe/de04 plp fe/de05 bcs LFEDDFA fe/de07 plp fe/de08 brl starCAT fe/de0b LFEDE0B clc fe/de0c tya fe/de0d adc $ed fe/de0f xba fe/de10 lda $ee fe/de12 adc #$00 fe/de14 xba fe/de15 rts ******************************************************************************** * OSBYTE 7F - Check for EOF * ******************************************************************************** rwid shortx fe/de16 OSBYTE_7F txy fe/de17 phk fe/de18 jsr CheckEOF fe/de1b ldx #$00 fe/de1d bcc @ret fe/de1f dex fe/de20 @ret rts fe/de21 LFEDE21 ldy $d9 fe/de23 LFEDE23 jsr LFEDE67 fe/de26 cmp #$20 fe/de28 beq LFEDE21 fe/de2a LFEDE2A cmp #$0d fe/de2c rts fe/de2d LFEDE2D bcc LFEDE23 fe/de2f LFEDE2F jsr LFEDE23 fe/de32 cmp #$2c fe/de34 bne LFEDE2A fe/de36 ldy $d9 fe/de38 rts fe/de39 LFEDE39 jsr LFEDE23 fe/de3c jsr LFEDE76 fe/de3f bcc LFEDE87 fe/de41 LFEDE41 sta $e1 fe/de43 jsr LFEDE74 fe/de46 bcc LFEDE61 fe/de48 tax fe/de49 lda $e1 fe/de4b asl A fe/de4c bcs LFEDE87 fe/de4e asl A fe/de4f bcs LFEDE87 fe/de51 adc $e1 fe/de53 bcs LFEDE87 fe/de55 asl A fe/de56 bcs LFEDE87 fe/de58 sta $e1 fe/de5a txa fe/de5b adc $e1 fe/de5d bcs LFEDE87 fe/de5f bcc LFEDE41 fe/de61 LFEDE61 ldx $e1 fe/de63 cmp #$0d fe/de65 sec fe/de66 rts fe/de67 LFEDE67 phx fe/de68 phy fe/de69 ldx #__STGRD fe/de6b jsl __ST fe/de6f sty $d9 fe/de71 ply fe/de72 plx fe/de73 rts fe/de74 LFEDE74 ldy $d9 fe/de76 LFEDE76 jsr LFEDE67 fe/de79 cmp #$3a fe/de7b bcs LFEDE87 fe/de7d cmp #$30 fe/de7f bcc LFEDE87 fe/de81 and #$0f fe/de83 rts fe/de84 LFEDE84 jsr LFEDE2F fe/de87 LFEDE87 clc fe/de88 rts fe/de89 dd1 $a4 fe/de8a dd1 $d9 fe/de8b LFEDE8B jsr LFEDE76 fe/de8e bcs LFEDE9E fe/de90 and #$df fe/de92 cmp #$47 fe/de94 bcs LFEDE84 fe/de96 cmp #$41 fe/de98 bcc LFEDE84 fe/de9a php fe/de9b sbc #$37 fe/de9d plp fe/de9e LFEDE9E ldy $d9 fe/dea0 rts fe/dea1 dd1 $a4 fe/dea2 dd1 $d9 fe/dea3 dd1 $20 fe/dea4 dd1 $67 fe/dea5 dd1 $de fe/dea6 dd1 $c9 fe/dea7 dd1 $20 fe/dea8 dd1 $f0 fe/dea9 dd1 $f7 fe/deaa dd1 $c9 fe/deab dd1 $0d fe/deac dd1 $60 fe/dead dd1 $90 fe/deae dd1 $f4 fe/deaf dd1 $20 fe/deb0 dd1 $a3 fe/deb1 dd1 $de fe/deb2 dd1 $c9 fe/deb3 dd1 $2c fe/deb4 str ↑“Pt$Y” fe/deb8 dd1 $60 fe/deb9 starRESET sep #$20 fe/debb lda #$08 fe/debd stal VIA_DDRB fe/dec1 lda #$00 fe/dec3 stal VIA_ORB fe/dec7 @here bra @here ******************************************************************************** * OSBYTE 9D - Fast BPUT * * * * QRY - QRY - QRY this doesn't look right * ******************************************************************************** fe/dec9 OSBYTE_9D phd fe/deca php fe/decb rep #$30 rwid longm,longx fe/decd cpx #$0010 fe/ded0 bcs LFEDEFC fe/ded2 ldy #$0000 fe/ded5 phx fe/ded6 pld fe/ded7 beq LFEDEEA fe/ded9 LFEDED9 lda #HND_type_A_CBLCB fe/dedc jsr allocB0B fe/dedf bcs LFEDEEA fe/dee1 phx fe/dee2 iny fe/dee3 tya fe/dee4 phd fe/dee5 cmp $01,S fe/dee7 pld fe/dee8 bcc LFEDED9 fe/deea LFEDEEA lda #$000a fe/deed jsr allocB0B fe/def0 bcc LFEDEEA fe/def2 tya fe/def3 beq LFEDEFC fe/def5 LFEDEF5 plx fe/def6 jsr freeB0Block fe/def9 dey fe/defa bne LFEDEF5 fe/defc LFEDEFC plp rwid shortm,shortx fe/defd pld fe/defe rts fe/deff TFEDEFF rts fe/df00 OSBYTE_7B_null rts fe/df01 OSBYTE_F bne OSB_FlushInputBuffer fe/df03 FlushAllBuffers ldx #$08 fe/df05 @lp cli fe/df06 sei fe/df07 jsr OSBYTE_15 fe/df0a dex fe/df0b bpl @lp fe/df0d OSBYTE_15 cpx #$09 fe/df0f bcc OSB_FlushBufferX fe/df11 rts fe/df12 LFEDF12 lda #$00 fe/df14 ldx #$03 fe/df16 ldy SYSVAR_85_PRINTER_DEST fe/df19 clc fe/df1a rtl ; TODO: dead code? fe/df1b jsr QOSBY_VECTORthruA524 fe/df1e xba fe/df1f phk fe/df20 lda SYSVAR_22_UPTV+1 fe/df23 pha fe/df24 lda SYSVAR_22_UPTV fe/df27 pha fe/df28 xba fe/df29 php fe/df2a rti fe/df2b OSB_FlushInputBuffer pea $0000 fe/df2e plb dbank $00 fe/df2f plb fe/df30 ldx SYSVAR_41_input_stream ;Get current input stream fe/df33 OSB_FlushBufferX clc fe/df34 LFEDF34 phb fe/df35 pea $0000 fe/df38 plb dbank $00 fe/df39 plb fe/df3a pha fe/df3b php fe/df3c sei fe/df3d bcs @skipsound fe/df3f txa fe/df40 and #$04 fe/df42 beq @skipsound fe/df44 lda SYSVAR_SOUND_EXT_FLAG ;sound flag?? fe/df47 beq @ext_sound_qry fe/df49 txa fe/df4a pha fe/df4b tay fe/df4c ldx #$17 fe/df4e jsr donothingRTS fe/df51 pla fe/df52 tax fe/df53 bne @skipsound fe/df55 @ext_sound_qry jsr SOUND_RESET_CHAN_X_QRY fe/df58 @skipsound sec fe/df59 ldal f:SYSVARS_ELK_BUFFER_BUSY,x fe/df5d ror A fe/df5e stal f:SYSVARS_ELK_BUFFER_BUSY,x fe/df62 cpx #$02 fe/df64 bcs @notinput fe/df66 lda #$00 fe/df68 sta SYSVAR_SOFTKEY_STRLEN fe/df6b sta SYSVAR_ELK_SOFTKEY_STRLEN fe/df6e sta SYSVAR_VDU_QLEN fe/df71 @notinput jsr callCNPV fe/df74 plp fe/df75 pla fe/df76 plb fe/df77 rts fe/df78 defaultCNPV bvc LFEDF83 fe/df7a ldal f:SYSVARS+204,x fe/df7e stal f:$00a5d5,x fe/df82 rts fe/df83 LFEDF83 php fe/df84 sei fe/df85 php fe/df86 sec fe/df87 ldal f:$00a5d5,x fe/df8b sbcl f:SYSVARS+204,x fe/df8f bcs LFEDF99 fe/df91 sec fe/df92 phb fe/df93 phk dbank K (auto) fe/df94 plb fe/df95 sbc LFEE178 & $ffff,x fe/df98 plb fe/df99 LFEDF99 plp fe/df9a bcc LFEDFA6 fe/df9c clc fe/df9d phb fe/df9e phk dbank K (auto) fe/df9f plb fe/dfa0 adc LFEE178 & $ffff,x fe/dfa3 plb fe/dfa4 eor #$ff fe/dfa6 LFEDFA6 ldy #$00 fe/dfa8 tax fe/dfa9 plp fe/dfaa rts fe/dfab LFEDFAB sei fe/dfac jsr callINSV fe/dfaf bcc LFEDFBE fe/dfb1 jsr LFEEAB6 fe/dfb4 bcs LFEDFBE fe/dfb6 pha fe/dfb7 jsr LFEEC18 fe/dfba pla fe/dfbb cli fe/dfbc bra LFEDFAB fe/dfbe LFEDFBE rts fe/dfbf LFEDFBF pha fe/dfc0 stz $a5e2,x fe/dfc3 stz $a5e3,x fe/dfc6 stz $a5e4,x fe/dfc9 stz $a5e5,x fe/dfcc pla fe/dfcd rts fe/dfce LFEDFCE phy fe/dfcf rol A fe/dfd0 rol A fe/dfd1 rol A fe/dfd2 rol A fe/dfd3 ldy #$04 fe/dfd5 LFEDFD5 rol A fe/dfd6 rol $a5e2,x fe/dfd9 rol $a5e3,x fe/dfdc rol $a5e4,x fe/dfdf rol $a5e5,x fe/dfe2 bcs LFEDFE7 fe/dfe4 dey fe/dfe5 bne LFEDFD5 fe/dfe7 LFEDFE7 ply fe/dfe8 rts fe/dfe9 gsreadNext ldx #__STGAD ;add Y to GSREAD pointer fe/dfeb jsl __ST fe/dfef ldx #__STGLN ;start line terminated GSREAD fe/dff1 jsl __ST fe/dff5 pea $0000 fe/dff8 plb fe/dff9 plb fe/dffa rts fe/dffb starLOAD ldy #$ff fe/dffd bra intstarLOADSAVE fe/dfff starSAVE ldy #$00 fe/e001 intstarLOADSAVE phy fe/e002 phk fe/e003 jsr skipSpacesBHA fe/e006 pha fe/e007 stal f:DPSYS_OSWORD0_BUFPTR-1 fe/e00b xba fe/e00c stal f:DPSYS_OSWORD0_BUFPTR fe/e010 xba fe/e011 phb fe/e012 pla fe/e013 stal f:DPSYS_OSWORD0_BUFPTR+1 fe/e017 pla fe/e018 ldy #$00 fe/e01a phy fe/e01b ldx #__STGIT fe/e01d jsl __ST fe/e021 plb fe/e022 ldx #$04 fe/e024 jsr LFEDFBF fe/e027 ldx #$08 fe/e029 jsr LFEDFBF fe/e02c lda #$ff fe/e02e sta $a5f2 fe/e031 sta $a5f3 fe/e034 sta $a5f4 fe/e037 stz $a5f5 fe/e03a LFEE03A ldx #__STGRD fe/e03c jsl __ST fe/e040 bcc LFEE03A fe/e042 jsr gsreadNext fe/e045 sty $d9 fe/e047 ldx #$0c fe/e049 pla fe/e04a beq LFEE086 fe/e04c jsr LFEE0F7 fe/e04f bcc LFEE075 fe/e051 cop COP_26_OPBHA fe/e053 zstr “Bad address” fe/e05f ldx #$01 fe/e061 sec fe/e062 rts fe/e063 @reterrBadCommand cop COP_26_OPBHA fe/e065 zstr “Bad command” fe/e071 ldx #$01 fe/e073 sec fe/e074 rts fe/e075 LFEE075 beq LFEE07A fe/e077 brl @reterrBadCommand fe/e07a LFEE07A rep #$30 rwid longm,longx fe/e07c lda #$a5e2 fe/e07f cop COP_24_OPCVD fe/e081 cop COP_4E_OPLOD fe/e083 sep #$30 rwid shortm,shortx fe/e085 rts fe/e086 LFEE086 jsr gsreadNext fe/e089 ldx #$0c fe/e08b jsr LFEE0F7 fe/e08e bcs @reterrBadCommand fe/e090 jsr LFEDE67 fe/e093 clv fe/e094 cmp #$2b fe/e096 bne LFEE09C fe/e098 sep #$40 fe/e09a ldy $d9 fe/e09c LFEE09C ldx #$10 fe/e09e jsr LFEE0F7 fe/e0a1 bcs @reterrBadCommand fe/e0a3 php fe/e0a4 bvs LFEE0B5 fe/e0a6 ldx #$fc fe/e0a8 sec fe/e0a9 LFEE0A9 lda $a4f6,x fe/e0ac sbc $a4f2,x fe/e0af sta $a4f6,x fe/e0b2 inx fe/e0b3 bne LFEE0A9 fe/e0b5 LFEE0B5 ldx #$03 fe/e0b7 LFEE0B7 lda $a5ee,x fe/e0ba sta $a5ea,x fe/e0bd sta $a5e6,x fe/e0c0 dex fe/e0c1 bpl LFEE0B7 fe/e0c3 plp fe/e0c4 beq LFEE0DA fe/e0c6 ldx #$08 fe/e0c8 jsr LFEE0F7 fe/e0cb bcs @reterrBadCommand fe/e0cd beq LFEE0DA fe/e0cf ldx #$04 fe/e0d1 jsr LFEE0F7 fe/e0d4 bcs @reterrBadCommand fe/e0d6 beq LFEE0DA fe/e0d8 bne @reterrBadCommand fe/e0da LFEE0DA rep #$30 rwid longm,longx fe/e0dc lda #$a5e2 fe/e0df cop COP_24_OPCVD fe/e0e1 cop COP_4F_OPSAV fe/e0e3 sep #$30 rwid shortm,shortx fe/e0e5 rts fe/e0e6 OSBYTE77a brl OSBYTE_77 fe/e0e9 defaultUSERV brk $fe fe/e0eb zstr “Bad command” fe/e0f7 LFEE0F7 php fe/e0f8 jsr LFEDE23 fe/e0fb jsr LFEDE8B fe/e0fe bcc LFEE112 fe/e100 jsr LFEDFBF fe/e103 LFEE103 jsr LFEDFCE fe/e106 bcs LFEE116 fe/e108 jsr LFEDE8B fe/e10b bcs LFEE103 fe/e10d plp fe/e10e cmp #$0d fe/e110 clc fe/e111 rts fe/e112 LFEE112 plp fe/e113 cmp #$0d fe/e115 php fe/e116 LFEE116 plp fe/e117 sec fe/e118 rts fe/e119 starKEY brl starKEY2 fe/e11c starLCB ldx #$9d ;Does OSBYTE &9D fe/e11e bra LFEE12F fe/e120 starFX ldx #__STGLN fe/e122 jsl __ST fe/e126 jsr LFEDE39 fe/e129 bcc defaultUSERV fe/e12b phx fe/e12c php fe/e12d bra LFEE137 fe/e12f LFEE12F phx fe/e130 php fe/e131 ldx #__STGLN fe/e133 jsl __ST fe/e137 LFEE137 lda #$00 fe/e139 pha dbank $00 (auto) fe/e13a plb fe/e13b sta $e0 fe/e13d sta $df fe/e13f plp fe/e140 jsr LFEDE2D fe/e143 beq LFEE15D fe/e145 jsr LFEDE39 fe/e148 bcc defaultUSERV fe/e14a stx $e0 fe/e14c jsr LFEDE2F fe/e14f beq LFEE15D fe/e151 jsr LFEDE39 fe/e154 bcc defaultUSERV fe/e156 stx $df fe/e158 jsr LFEDE23 fe/e15b bne defaultUSERV fe/e15d LFEE15D ldy $df fe/e15f ldx $e0 fe/e161 pla fe/e162 cop COP_06_OPOSB fe/e164 clc fe/e165 rts fe/e166 LFEE166 dd1 $a7 fe/e167 dd1 $aa fe/e168 dd1 $a8 fe/e169 dd1 $a7 fe/e16a dd1 $a7 fe/e16b dd1 $a7 fe/e16c dd1 $a7 fe/e16d dd1 $a7 fe/e16e dd1 $a9 fe/e16f LFEE16F dd1 $00 fe/e170 dd1 $00 fe/e171 dd1 $c0 fe/e172 dd1 $c0 fe/e173 dd1 $50 fe/e174 dd1 $60 fe/e175 dd1 $70 fe/e176 dd1 $80 fe/e177 dd1 $00 fe/e178 LFEE178 dd1 $e0 fe/e179 dd1 $00 fe/e17a dd1 $40 fe/e17b dd1 $c0 fe/e17c dd1 $f0 fe/e17d dd1 $f0 fe/e17e dd1 $f0 fe/e17f dd1 $f0 fe/e180 dd1 $c0 dbank $fe fe/e181 LFEE181 lda LFEE16F & $ffff,x fe/e184 sta $f6 fe/e186 lda LFEE166 & $ffff,x fe/e189 sta $f7 fe/e18b stz $f8 fe/e18d rts ******************************************************************************** * OSBYTE 98 - examing buffer status * ******************************************************************************** fe/e18e OSBYTE_98 sep #$40 fe/e190 bvs callREMV ******************************************************************************** * OSBYTE 91 - read character from buffer * ******************************************************************************** fe/e192 OSBYTE_91 clv fe/e193 callREMV xba fe/e194 phk fe/e195 ldal f:SYSVARS_REMV+1 fe/e199 pha fe/e19a ldal f:SYSVARS_REMV fe/e19e pha fe/e19f xba fe/e1a0 php fe/e1a1 rti fe/e1a2 defaultREMV phb fe/e1a3 php fe/e1a4 sei fe/e1a5 phk dbank K (auto) fe/e1a6 plb fe/e1a7 ldal f:SYSVARS+204,x fe/e1ab cmpl f:$00a5d5,x fe/e1af beq LFEE22A fe/e1b1 tay fe/e1b2 jsr LFEE181 fe/e1b5 lda [$f6],y fe/e1b7 bvs LFEE1D5 fe/e1b9 pha fe/e1ba iny fe/e1bb tya fe/e1bc bne LFEE1C1 fe/e1be lda LFEE178 & $ffff,x fe/e1c1 LFEE1C1 stal f:SYSVARS+204,x fe/e1c5 cpx #$02 fe/e1c7 bcc LFEE1D4 fe/e1c9 cmpl f:$00a5d5,x fe/e1cd bne LFEE1D4 fe/e1cf ldy #$00 fe/e1d1 jsr callEventIfEnabled fe/e1d4 LFEE1D4 pla fe/e1d5 LFEE1D5 tay fe/e1d6 plp fe/e1d7 clc fe/e1d8 plb fe/e1d9 rts fe/e1da LFEE1DA tya fe/e1db ldy #EVENT_2_CHARINBUF fe/e1dd jsr callEventIfEnabled fe/e1e0 tay ******************************************************************************** * OSBYTE 8A - place char in buffer * * * * X=buffer number * * Y=character to place * ******************************************************************************** fe/e1e1 OSBYTE_8A tya fe/e1e2 callINSV xba fe/e1e3 phk fe/e1e4 ldal f:SYSVARS_INSV+1 fe/e1e8 pha fe/e1e9 ldal f:SYSVARS_INSV fe/e1ed pha fe/e1ee xba fe/e1ef php fe/e1f0 rti fe/e1f1 defaultINSV phb fe/e1f2 php fe/e1f3 sei fe/e1f4 phk dbank K (auto) fe/e1f5 plb fe/e1f6 pha fe/e1f7 ldal f:$00a5d5,x fe/e1fb tay fe/e1fc iny fe/e1fd bne LFEE202 fe/e1ff ldy LFEE178 & $ffff,x fe/e202 LFEE202 tya fe/e203 cmpl f:SYSVARS+204,x fe/e207 beq LFEE21E fe/e209 pha fe/e20a ldal f:$00a5d5,x fe/e20e tay fe/e20f pla fe/e210 stal f:$00a5d5,x fe/e214 jsr LFEE181 fe/e217 pla fe/e218 sta [$f6],y fe/e21a plp fe/e21b clc fe/e21c plb fe/e21d rts fe/e21e LFEE21E pla fe/e21f cpx #$02 fe/e221 bcs LFEE22A fe/e223 ldy #$01 fe/e225 jsr callEventIfEnabled fe/e228 pha fe/e229 pla fe/e22a LFEE22A plp fe/e22b sec fe/e22c plb fe/e22d rts fe/e22e LFEE22E phb fe/e22f pea $0000 fe/e232 plb fe/e233 plb fe/e234 ldx #$00 ******************************************************************************** * OSBYTE 99 - write character to buffer * ******************************************************************************** fe/e236 OSBYTE_99 txa fe/e237 and SYSVAR_RS232_MODE fe/e23a bne OSBYTE_8A fe/e23c tya fe/e23d eorl f:SYSVARS_6C_ESCCHAR fe/e241 oral f:SYSVARS_75_ESCACTION fe/e245 beq @doESCape fe/e247 jsr LFEE1DA fe/e24a plb fe/e24b rts fe/e24c @doESCape lda SYSVAR_58_ESCBRK_EFFECT fe/e24f ror A fe/e250 tya fe/e251 bcs @noESC ;Ignore ESCape fe/e253 ldy #$06 fe/e255 jsr callEventIfEnabled fe/e258 bcc @noESC fe/e25a jsr OSBYTE_7D ;Set ESCape condition fe/e25d @noESC clc fe/e25e plb fe/e25f rts fe/e260 INKEY_ctdn pea $0000 fe/e263 plb dbank $00 fe/e264 plb fe/e265 php fe/e266 sei fe/e267 stx SYSVARS_B0_INKEYCTDN fe/e26a sty SYSVARS_B0_INKEYCTDN+1 fe/e26d plp fe/e26e lda #$ff fe/e270 bra LFEE274 fe/e272 int_OPRDC lda #$00 fe/e274 LFEE274 pea $0000 fe/e277 plb dbank $00 fe/e278 plb fe/e279 pha fe/e27a phx fe/e27b phy fe/e27c phk fe/e27d jsr LFEBF9B fe/e280 LFEE280 rep #$10 rwid longx fe/e282 ldy $d1 fe/e284 beq LFEE29D fe/e286 sec fe/e287 ror $e6 fe/e289 phb fe/e28a jsr default__BGET fe/e28d plb fe/e28e php fe/e28f lsr $e6 fe/e291 plp fe/e292 sep #$10 rwid shortx fe/e294 bcc LFEE2E8 fe/e296 phb fe/e297 jsr OSBYTE_77 fe/e29a plb fe/e29b bra LFEE280 fe/e29d LFEE29D sep #$10 fe/e29f phx fe/e2a0 lda #$00 fe/e2a2 xba fe/e2a3 lda #$03 fe/e2a5 ldx #$02 fe/e2a7 jsl __EV fe/e2ab plx fe/e2ac bcs LFEE2E5 fe/e2ae lda SYSVAR_SOFTKEY_STRLEN fe/e2b1 beq LFEE2B9 fe/e2b3 jsr LFEE42C fe/e2b6 clc fe/e2b7 bra LFEE2E8 fe/e2b9 LFEE2B9 php fe/e2ba sei fe/e2bb cop COP_21_OPPRE fe/e2bd bcs LFEE2E0 fe/e2bf ldx SYSVAR_41_input_stream fe/e2c2 jsr LFEE355 fe/e2c5 bcs LFEE2CB fe/e2c7 plp fe/e2c8 clc fe/e2c9 bra LFEE2E8 fe/e2cb LFEE2CB plp fe/e2cc sec fe/e2cd lda $03,S fe/e2cf bpl LFEE29D fe/e2d1 php fe/e2d2 sei fe/e2d3 lda SYSVARS_B0_INKEYCTDN fe/e2d6 ora SYSVARS_B0_INKEYCTDN+1 fe/e2d9 plp fe/e2da eor #$00 fe/e2dc bne LFEE29D fe/e2de bra LFEE2EA fe/e2e0 LFEE2E0 plp fe/e2e1 lda #$00 fe/e2e3 bra LFEE2E7 fe/e2e5 LFEE2E5 lda #$1b fe/e2e7 LFEE2E7 sec fe/e2e8 LFEE2E8 sta $03,S fe/e2ea LFEE2EA ply fe/e2eb plx fe/e2ec pla fe/e2ed rts fe/e2ee LFEE2EE ror A fe/e2ef pla fe/e2f0 bcs LFEE304 fe/e2f2 LFEE2F2 tya fe/e2f3 pha fe/e2f4 jsr LFEE44E fe/e2f7 cmp #$01 fe/e2f9 bne LFEE2FE fe/e2fb brl LFEE35B fe/e2fe LFEE2FE pla fe/e2ff bcc LFEE30B fe/e301 jsr LFEE459 fe/e304 LFEE304 clc fe/e305 rts fe/e306 LFEE306 jsr Serv8_QRY ;beep? fe/e309 pla fe/e30a tax fe/e30b LFEE30B jsr OSBYTE_91 fe/e30e bcs LFEE358 fe/e310 cpx #$01 fe/e312 bne LFEE319 fe/e314 ldy SYSVAR_RS232_MODE fe/e317 bne LFEE357 fe/e319 LFEE319 tay fe/e31a cmp #$80 fe/e31c bcc LFEE357 fe/e31e and #$0f fe/e320 cmp #$0b fe/e322 bcc LFEE2F2 fe/e324 jsr LFEE448 fe/e327 pha fe/e328 lda SYSVARS+125 fe/e32b bne LFEE2EE fe/e32d lda SYSVARS_7C_OUTDEST fe/e330 ror A fe/e331 ror A fe/e332 pla fe/e333 bcs LFEE30B fe/e335 cmp #$87 fe/e337 bne LFEE349 fe/e339 txa fe/e33a pha fe/e33b ldx #$26 fe/e33d phk fe/e33e jsr callModVDU fe/e341 tay fe/e342 beq LFEE306 fe/e344 pla fe/e345 tax fe/e346 tya fe/e347 clc fe/e348 rts fe/e349 LFEE349 tay fe/e34a txa fe/e34b pha fe/e34c tya fe/e34d ldx #$28 fe/e34f phk fe/e350 jsr callModVDU fe/e353 pla fe/e354 tax fe/e355 LFEE355 bra LFEE30B fe/e357 LFEE357 clc fe/e358 LFEE358 bcs LFEE373 fe/e35a rts fe/e35b LFEE35B pla fe/e35c jsr LFEE418 fe/e35f jsr LFEE41B fe/e362 bra LFEE355 fe/e364 lda #$06 fe/e366 QOSBY_VECTORthruA524 xba fe/e367 phk fe/e368 lda QOSBY_VECTOR+1 fe/e36b pha fe/e36c lda QOSBY_VECTOR fe/e36f pha fe/e370 xba fe/e371 php ;jump to address - why not just jmp (X) as bank is 0? fe/e372 rti fe/e373 LFEE373 pha fe/e374 jsr LFEEC18 fe/e377 pla fe/e378 sec fe/e379 rts ; QRY suspect next two are dead code for rom select or something? fe/e37a txa fe/e37b lda #$08 fe/e37d sta $f0 fe/e37f stal sheila_ULA_PAG_IRQCLR fe/e383 rts fe/e384 pha fe/e385 lda #$0c fe/e387 stal sheila_ULA_PAG_IRQCLR fe/e38b pla fe/e38c rts fe/e38d dd1 $60 fe/e38e LFEE38E ply fe/e38f LFEE38F bcc LFEE394 fe/e391 plp fe/e392 sec fe/e393 rts fe/e394 LFEE394 plp fe/e395 clc fe/e396 rts fe/e397 @reterrBadKey cop COP_26_OPBHA fe/e399 zstr “Bad key” fe/e3a1 ldx #$01 fe/e3a3 sec fe/e3a4 rts fe/e3a5 starKEY2 ldx #__STGLN fe/e3a7 jsl __ST fe/e3ab pea $0000 fe/e3ae plb fe/e3af plb fe/e3b0 jsr LFEDE39 fe/e3b3 bcc @reterrBadKey fe/e3b5 cpx #$10 fe/e3b7 bcs @reterrBadKey fe/e3b9 jsr LFEDE2F fe/e3bc php fe/e3bd ldx SYSFNK+16 fe/e3c0 tya fe/e3c1 pha fe/e3c2 jsr LFEE4BD fe/e3c5 bcs LFEE38E fe/e3c7 pla fe/e3c8 tay fe/e3c9 plp fe/e3ca bne LFEE3CE fe/e3cc clc fe/e3cd rts fe/e3ce LFEE3CE phx fe/e3cf ldx #__STGRD ;GSREAD fe/e3d1 jsl __ST fe/e3d5 plx fe/e3d6 bcs LFEE3E2 fe/e3d8 inx fe/e3d9 beq @reterrBadKey fe/e3db dex fe/e3dc jsr Fnkey_StoreXpl1 fe/e3df inx fe/e3e0 bra LFEE3CE fe/e3e2 LFEE3E2 cmp #$0d fe/e3e4 bne @reterrBadKey fe/e3e6 php fe/e3e7 sei fe/e3e8 jsr LFEE4BD fe/e3eb bcs LFEE38F fe/e3ed ldx #$10 fe/e3ef LFEE3EF cpx $e1 fe/e3f1 beq LFEE412 fe/e3f3 php fe/e3f4 phx fe/e3f5 phx fe/e3f6 tyx fe/e3f7 jsr FnKey_LoadX fe/e3fa plx fe/e3fb pha fe/e3fc jsr FnKey_LoadX fe/e3ff pha fe/e400 cmp $02,S fe/e402 php fe/e403 pla fe/e404 sta $04,S fe/e406 pla fe/e407 plx fe/e408 plx fe/e409 plp fe/e40a bne LFEE412 fe/e40c lda SYSFNK+16 fe/e40f jsr FnKey_StoreX fe/e412 LFEE412 dex fe/e413 bpl LFEE3EF fe/e415 plp fe/e416 clc fe/e417 rts fe/e418 LFEE418 and #$0f fe/e41a rts fe/e41b LFEE41B tay fe/e41c jsr LFEE479 fe/e41f sta SYSVAR_SOFTKEY_STRLEN fe/e422 phx fe/e423 tyx fe/e424 jsr FnKey_LoadX fe/e427 plx fe/e428 sta SYSVARS+121 fe/e42b rts fe/e42c LFEE42C phx fe/e42d ldx SYSVARS+121 fe/e430 jsr FnKey_LoadXpl1 fe/e433 inc SYSVARS+121 fe/e436 dec SYSVAR_SOFTKEY_STRLEN fe/e439 xba fe/e43a lda SYSVAR_SOFTKEY_STRLEN fe/e43d xba fe/e43e plx fe/e43f rts fe/e440 pha fe/e441 lda #$01 fe/e443 sta SYSVAR_SOFTKEY_STRLEN fe/e446 pla fe/e447 rts fe/e448 LFEE448 sec fe/e449 and #$0f fe/e44b adc #$7b fe/e44d rts fe/e44e LFEE44E lsr A fe/e44f lsr A fe/e450 lsr A fe/e451 lsr A fe/e452 eor #$04 fe/e454 tay fe/e455 lda SYSVARS+101,y fe/e458 rts fe/e459 LFEE459 pha fe/e45a jsr LFEE44E fe/e45d pla fe/e45e and #$0f fe/e460 clc fe/e461 adc SYSVARS+101,y fe/e464 rts ; Character buffer interpretation settings fe/e465 OSBYTE_DDtoE4 phx fe/e466 phy fe/e467 sec fe/e468 sbc #$dd fe/e46a tay fe/e46b lda SYSVARS+109,y fe/e46e tax fe/e46f and $01,S fe/e471 eor $02,S fe/e473 sta SYSVARS+109,y fe/e476 pla fe/e477 pla fe/e478 rts fe/e479 LFEE479 php fe/e47a sei fe/e47b lda SYSFNK+16 fe/e47e sec fe/e47f phx fe/e480 pha fe/e481 tyx fe/e482 jsr FnKey_LoadX fe/e485 plx fe/e486 pha fe/e487 txa fe/e488 sbc $01,S fe/e48a plx fe/e48b plx fe/e48c sta $f5 fe/e48e txa fe/e48f pha fe/e490 ldx #$10 fe/e492 LFEE492 php fe/e493 phx fe/e494 phx fe/e495 tyx fe/e496 jsr FnKey_LoadX fe/e499 plx fe/e49a pha fe/e49b jsr FnKey_LoadX fe/e49e sec fe/e49f sbc $01,S fe/e4a1 pha fe/e4a2 php fe/e4a3 pla fe/e4a4 sta $04,S fe/e4a6 pla fe/e4a7 plx fe/e4a8 plx fe/e4a9 plp fe/e4aa bcc LFEE4B4 fe/e4ac beq LFEE4B4 fe/e4ae cmp $f5 fe/e4b0 bcs LFEE4B4 fe/e4b2 sta $f5 fe/e4b4 LFEE4B4 dex fe/e4b5 bpl LFEE492 fe/e4b7 pla fe/e4b8 tax fe/e4b9 lda $f5 fe/e4bb plp fe/e4bc rts fe/e4bd LFEE4BD php fe/e4be sei fe/e4bf txa fe/e4c0 pha fe/e4c1 ldy $e1 fe/e4c3 jsr LFEE479 fe/e4c6 sta $f5 fe/e4c8 phx fe/e4c9 tyx fe/e4ca jsr FnKey_LoadX fe/e4cd plx fe/e4ce tay fe/e4cf clc fe/e4d0 adc $f5 fe/e4d2 tax fe/e4d3 sta $f4 fe/e4d5 lda SYSVAR_SOFTKEY_STRLEN fe/e4d8 beq LFEE4ED fe/e4da pla fe/e4db plp fe/e4dc cop COP_26_OPBHA fe/e4de zstr “Key in use” fe/e4e9 ldx #$01 fe/e4eb sec fe/e4ec rts fe/e4ed LFEE4ED dec SYSVAR_SOFTKEY_CONS fe/e4f0 pla fe/e4f1 sec fe/e4f2 sbc $f4 fe/e4f4 sta $f4 fe/e4f6 beq LFEE507 fe/e4f8 LFEE4F8 jsr FnKey_LoadXpl1 fe/e4fb phx fe/e4fc tyx fe/e4fd jsr Fnkey_StoreXpl1 fe/e500 plx fe/e501 iny fe/e502 inx fe/e503 dec $f4 fe/e505 bne LFEE4F8 fe/e507 LFEE507 tya fe/e508 pha fe/e509 ldy $e1 fe/e50b ldx #$10 fe/e50d LFEE50D php fe/e50e phx fe/e50f phx fe/e510 tyx fe/e511 jsr FnKey_LoadX fe/e514 plx fe/e515 pha fe/e516 jsr FnKey_LoadX fe/e519 pha fe/e51a cmp $02,S fe/e51c php fe/e51d pla fe/e51e sta $04,S fe/e520 pla fe/e521 plx fe/e522 plx fe/e523 plp fe/e524 bcc LFEE52D fe/e526 beq LFEE52D fe/e528 sbc $f5 fe/e52a jsr FnKey_StoreX fe/e52d LFEE52D dex fe/e52e bpl LFEE50D fe/e530 lda SYSFNK+16 fe/e533 phx fe/e534 tyx fe/e535 jsr FnKey_StoreX fe/e538 plx fe/e539 pla fe/e53a sta SYSFNK+16 fe/e53d tax fe/e53e inc SYSVAR_SOFTKEY_CONS fe/e541 plp fe/e542 clc fe/e543 rts fe/e544 OSB_ResetFnKeys lda #$11 fe/e546 sta SYSVAR_SOFTKEY_CONS fe/e549 ldx #$10 fe/e54b @lp jsr FnKey_StoreX fe/e54e dex fe/e54f bpl @lp fe/e551 lda #$10 fe/e553 ldx #$00 fe/e555 jsr FnKey_StoreX fe/e558 lda #$1e fe/e55a ldx #$10 fe/e55c jsr Fnkey_StoreXpl1 fe/e55f stz SYSVAR_SOFTKEY_CONS fe/e562 rts fe/e563 FnKey_LoadXpl1 lda SYSFNK+1,x fe/e566 rts fe/e567 Fnkey_StoreXpl1 sta SYSFNK+1,x fe/e56a rts fe/e56b FnKey_LoadX lda SYSFNK,x fe/e56e rts fe/e56f FnKey_StoreX sta SYSFNK,x fe/e572 rts fe/e573 callEventIfEnabled php fe/e574 phb fe/e575 pea $0000 fe/e578 plb dbank $00 fe/e579 plb fe/e57a sei fe/e57b pha fe/e57c sta <DPSYS_OSB_IND fe/e57e lda SYSVAR_B5_EVENT_ENABLE_TABLE,y fe/e581 beq @noten fe/e583 tya fe/e584 ldy <DPSYS_OSB_IND fe/e586 jsr callEVENTV fe/e589 pla fe/e58a plb fe/e58b plp fe/e58c clc fe/e58d rts fe/e58e @noten pla fe/e58f plb fe/e590 plp fe/e591 sec fe/e592 rts **************************************************************** * Converts the char in A into an upper case module name char. * * * * On Entry: A contains a character * * * * On Exit: If C = 0 A contains the original character, B * * contains the character * * converted to uppercase * * If C = 1 A contains the original character, B * * contains the original * * character which was not in the range A..Z or a..z * **************************************************************** rwid longm,longx fe/e593 modNameToUpper php fe/e594 sep #$20 rwid shortm fe/e596 pha fe/e597 and #$df ;convert to upper case fe/e599 cmp #‘A’ fe/e59b bcc @notname fe/e59d cmp #‘[’ fe/e59f bcc @ok fe/e5a1 @notname sec ;set carry and return un modified A fe/e5a2 lda $01,S fe/e5a4 @ok xba fe/e5a5 pla fe/e5a6 bcs @retsec fe/e5a8 plp rwid longm fe/e5a9 clc fe/e5aa rts rwid shortm fe/e5ab @retsec plp rwid longm fe/e5ac sec fe/e5ad rts fe/e5ae tblOSBYTDispatch dd2 OSBYTE_0 & $ffff ;OSBYTE 0 - Get Host OS fe/e5b0 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff ;OSBYTE 1 - R/W user flag fe/e5b2 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff ;OSBYTE 2 - select input stream - manual lies, this does nothing fe/e5b4 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff ;OSBYTE 3 - select output stream - manual lies this does nothing fe/e5b6 dd2 OSBYTE_4 & $ffff ;OSBYTE 4 - cursor keys action fe/e5b8 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5ba dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5bc dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5be dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5c0 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5c2 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5c4 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5c6 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5c8 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5ca dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5cc dd2 OSBYTE_F & $ffff ;OSBYTE 0F - Flush buffers fe/e5ce dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5d0 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5d2 dd2 OSBYTE_12 & $ffff ;OSBYTE 12 - reset function keys fe/e5d4 dd2 OSBYTE_13 & $ffff ;OSBYTE 13 - Wait vsync fe/e5d6 dd2 OSBYTE_14 & $ffff ;OSBYTE 14 - Explode and reset font fe/e5d8 dd2 OSBYTE_15 & $ffff fe/e5da dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5dc dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5de dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5e0 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e5e2 dd2 OSBYTE_1A & $ffff ;OSBYTE 1A - Handset detection fe/e5e4 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff ; --- break in numbers here restart at 73 --- fe/e5e6 dd2 OSBYTE_73 & $ffff ;OSBYTE 73 - blank / restore palette fe/e5e8 dd2 OSBYTE_74 & $ffff ;OSBYTE 74 - reset sound system fe/e5ea dd2 OSBYTE_75 & $ffff ;OSBYTE 75 - read VDU status byte fe/e5ec dd2 OSBYTE_76 & $ffff ;OSBYTE 76 - reflect keyboard in LEDS fe/e5ee dd2 OSBYTE77a & $ffff ;OSBYTE 77 - Close all SPOOL / EXEC files fe/e5f0 dd2 OSBYTE_78 & $ffff ;OSBYTE 78 - Write key pressed data fe/e5f2 dd2 OSBYTE_79 & $ffff ;OSBYTE 79 - Keyboard scan fe/e5f4 dd2 OSBYTE_7A & $ffff ;OSBYTE_7A - keyboard scan from &10 fe/e5f6 dd2 OSBYTE_7B_null & $ffff ;OSBYTE 7B - printer dormancy warning fe/e5f8 dd2 OSBYTE_7C & $ffff ;OSBYTE 7C - Clear ESCape, inform tube fe/e5fa dd2 OSBYTE_7D & $ffff ;OSBYTE 7D - Set ESCape fe/e5fc dd2 OSBYTE_7E & $ffff ;OSBYTE 7E - Acknowledge ESCape condition fe/e5fe dd2 OSBYTE_7F & $ffff ;OSBYTE 7F - Check for EOF fe/e600 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e602 dd2 OSBYTE_81 & $ffff ;OSBYTE 81 - INKEY fe/e604 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e606 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e608 dd2 OSBYTE_84 & $ffff ;OSBYTE 84 - read top of memory HIMEM fe/e60a dd2 OSBYTE_85 & $ffff ;OSBYTE 85 - get HIMEM for MODE in X fe/e60c dd2 OSBYTE_86 & $ffff ;OSBYTE 86 - Get text cursor fe/e60e dd2 OSBYTE_87 & $ffff ;OSBYTE 87 - get char at XY and MODE fe/e610 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e612 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e614 dd2 OSBYTE_8A & $ffff ;OSBYTE 8A - place char in buffer fe/e616 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e618 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e61a dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e61c dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e61e dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e620 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e622 dd2 OSBYTE_91 & $ffff ;OSBYTE 91 - read character from buffer fe/e624 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e626 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e628 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e62a dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e62c dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e62e dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e630 dd2 OSBYTE_98 & $ffff ;OSBYTE 98 - examine buffer status fe/e632 dd2 OSBYTE_99 & $ffff ;OSBYTE 99 - write character to buffer fe/e634 dd2 OSBYTE_9A & $ffff ;OSBYTE 9A - write vdu ULA fe/e636 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e638 dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e63a dd2 OSBYTE_9D & $ffff ;OSBYTE 9D - QRY fe/e63c dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e63e dd2 OSBYTE_DOESNOTHINGBADLY & $ffff fe/e640 dd2 OSBYTE_A0 & $ffff ;OSBYTE A0 - read VDU variable fe/e642 dd2 OSBYTE_A6_FF & $ffff ;OSBYTE A6-FF - read variable fe/e644 dd2 QRY_Call_UKOSWORD & $ffff ;OSWORD > E0 QRY fe/e646 dd2 OSWORD_0 & $ffff ;OSWORD 0 - read line fe/e648 dd2 TFEE963 & $ffff fe/e64a dd2 TFEE976 & $ffff fe/e64c dd2 TFEE95F & $ffff fe/e64e dd2 TFEE972 & $ffff fe/e650 dd2 OSBYTE_0_X & $ffff fe/e652 dd2 OSBYTE_0_X & $ffff fe/e654 dd2 TFEE890 & $ffff fe/e656 dd2 TFEE919 & $ffff fe/e658 dd2 TFEE6D1 & $ffff fe/e65a dd2 TFEE6D5 & $ffff fe/e65c dd2 TFEE6D9 & $ffff fe/e65e dd2 TFEE6DD & $ffff fe/e660 dd2 TFEE6E1 & $ffff rwid shortm,shortx fe/e662 lda #$00 fe/e664 QRY_Call_UKOSWORD xba fe/e665 phk fe/e666 lda SYSVARS+1 fe/e669 pha fe/e66a lda SYSVARS fe/e66d pha fe/e66e xba fe/e66f php fe/e670 rti fe/e671 inc SYSVARS+73 fe/e674 rts ******************************************************************************** * OSBYTE 7E - Acknowledge ESCape condition * ******************************************************************************** fe/e675 OSBYTE_7E ldx #$00 fe/e677 ldal f:SYS_ESCAPE_FLAG_QRY fe/e67b and #$03 fe/e67d beq OSBYTE_7C fe/e67f lda SYSVARS+118 fe/e682 bne LFEE68F fe/e684 cli fe/e685 lda #$00 fe/e687 phb fe/e688 jsr OSBYTE_77 fe/e68b plb fe/e68c jsr FlushAllBuffers fe/e68f LFEE68F ldx #$ff ******************************************************************************** * OSBYTE 7C - Clear ESCape, inform tube * ******************************************************************************** fe/e691 OSBYTE_7C rep #$30 rwid longm,longx fe/e693 ldal f:SYS_ESCAPE_FLAG_QRY fe/e697 and #$fffc fe/e69a stal f:SYS_ESCAPE_FLAG_QRY fe/e69e sep #$30 rwid shortm,shortx fe/e6a0 rts ******************************************************************************** * OSBYTE 7D - Set ESCape * ******************************************************************************** fe/e6a1 OSBYTE_7D lda #$00 fe/e6a3 xba fe/e6a4 lda #$03 fe/e6a6 cop COP_20_OPSEV fe/e6a8 rts ******************************************************************************** * OSBYTE 14 - Explode * ******************************************************************************** fe/e6a9 OSBYTE_14 txa fe/e6aa ldx #VDUMOD_OPX_8_EXPLODE fe/e6ac bra phkCallModVDU ******************************************************************************** * OSBYTE 73 - unknown VDU operation * * * * Blank restore palette * * * * calls VDU module with A=X, X=#&A * ******************************************************************************** fe/e6ae OSBYTE_73 txa fe/e6af ldx #VDUMOD_OPX_A fe/e6b1 bra phkCallModVDU ******************************************************************************** * OSBYTE 75 - read VDU status byte * ******************************************************************************** fe/e6b3 OSBYTE_75 txa fe/e6b4 ldx #VDUMOD_OPX_22_READSTATUS fe/e6b6 bra phkCallModVDU ******************************************************************************** * OSBYTE 84 - read top of memory HIMEM * * * * QRY what does this actually return * ******************************************************************************** fe/e6b8 OSBYTE_84 txa fe/e6b9 ldx #VDUMOD_OPX_C_HIMEM fe/e6bb bra phkCallModVDU ******************************************************************************** * OSBYTE 85 - get HIMEM for MODE in X * ******************************************************************************** fe/e6bd OSBYTE_85 txa fe/e6be ldx #VDUMOD_OPX_E_HIMEMBYX fe/e6c0 bra phkCallModVDU ******************************************************************************** * OSBYTE 86 - Get text cursor * ******************************************************************************** fe/e6c2 OSBYTE_86 txa fe/e6c3 ldx #VDUMOD_OPX_10_GETCURSOR fe/e6c5 bra phkCallModVDU ******************************************************************************** * OSBYTE 87 - get char at XY and MODE * ******************************************************************************** fe/e6c7 OSBYTE_87 txa fe/e6c8 ldx #VDUMOD_OPX_16_GETCHARXY fe/e6ca bra phkCallModVDU ******************************************************************************** * OSBYTE A0 - read VDU variable * ******************************************************************************** fe/e6cc OSBYTE_A0 txa fe/e6cd ldx #VDUMOD_OPX_24_READVDUVAR+12 fe/e6cf bra phkCallModVDU fe/e6d1 TFEE6D1 ldx #$18 fe/e6d3 bra LFEE6E3 fe/e6d5 TFEE6D5 ldx #$1a fe/e6d7 bra LFEE6E3 fe/e6d9 TFEE6D9 ldx #$1c fe/e6db bra LFEE6E3 fe/e6dd TFEE6DD ldx #$1e fe/e6df bra LFEE6E3 fe/e6e1 TFEE6E1 ldx #$20 fe/e6e3 LFEE6E3 pha fe/e6e4 lda $ec fe/e6e6 pha fe/e6e7 plb fe/e6e8 pla fe/e6e9 phkCallModVDU phk fe/e6ea jsr callModVDU fe/e6ed rts ******************************************************************************** * OSBYTE 9A - write vdu ULA * * * * This doesn't seem to work as documented on MDFS.net for the Electron instead * * it: * * * * ULA/COPY = (OLD AND Y) EOR X * * * * returns OLD in X * ******************************************************************************** fe/e6ee OSBYTE_9A phx fe/e6ef phy fe/e6f0 ldx SYSVARS_ULA_MISC_COPY fe/e6f3 txa fe/e6f4 and $01,S fe/e6f6 eor $02,S fe/e6f8 sta SYSVARS_ULA_MISC_COPY fe/e6fb stal shiela_ULA_MISC fe/e6ff pla fe/e700 pla fe/e701 jmp resetFlashCounters ******************************************************************************** * OSBYTE 1A - handset detection * ******************************************************************************** fe/e704 OSBYTE_1A ldx <DPVAR_ACD4_HANDSET_STATUS_QRY fe/e706 rts fe/e707 dd1 $c8 fe/e708 dd1 $18 fe/e709 dd1 $b9 fe/e70a dd1 $52 fe/e70b dd1 $a5 fe/e70c dd1 $48 fe/e70d dd1 $8a fe/e70e dd1 $99 fe/e70f dd1 $52 fe/e710 dd1 $a5 fe/e711 dd1 $68 fe/e712 dd1 $a8 fe/e713 dd1 $ad fe/e714 dd1 $51 fe/e715 dd1 $a5 fe/e716 dd1 $d0 fe/e717 dd1 $19 fe/e718 dd1 $8e fe/e719 dd1 $51 fe/e71a dd1 $a5 fe/e71b dd1 $a9 fe/e71c dd1 $00 fe/e71d dd1 $90 fe/e71e dd1 $02 fe/e71f dd1 $a9 fe/e720 dd1 $07 fe/e721 dd1 $8d fe/e722 dd1 $48 fe/e723 dd1 $a5 fe/e724 dd1 $98 fe/e725 dd1 $48 fe/e726 dd1 $ac fe/e727 dd1 $48 fe/e728 dd1 $a5 fe/e729 dd1 $a2 fe/e72a dd1 $14 fe/e72b dd1 $4b fe/e72c dd1 $20 fe/e72d dd1 $38 fe/e72e dd1 $fe fe/e72f dd1 $68 fe/e730 dd1 $a8 fe/e731 dd1 $50 fe/e732 dd1 $0b fe/e733 dd1 $98 fe/e734 dd1 $e0 fe/e735 dd1 $0a fe/e736 dd1 $b0 fe/e737 dd1 $07 fe/e738 dd1 $bc fe/e739 dd1 $b5 fe/e73a dd1 $a5 fe/e73b dd1 $9d fe/e73c dd1 $b5 fe/e73d dd1 $a5 fe/e73e dd1 $98 fe/e73f dd1 $aa fe/e740 dd1 $60 ******************************************************************************** * OSBYTE 81 - INKEY * * * * On entry: XY=16-bit argument * * On exit: XY=returned character or state * * Cy=when waiting for a character, no character returned * ******************************************************************************** fe/e741 OSBYTE_81 tya fe/e742 bmi LFEE74F fe/e744 cli fe/e745 jsr INKEY_ctdn fe/e748 bcs LFEE74D fe/e74a tax fe/e74b LFEE74B lda #$00 fe/e74d LFEE74D tay fe/e74e rts fe/e74f LFEE74F txa fe/e750 and #$0f fe/e752 beq LFEE769 fe/e754 txa fe/e755 eor #$7f fe/e757 tax fe/e758 txy fe/e759 ldx #$04 fe/e75b jsl __KB fe/e75f rol A fe/e760 LFEE760 ldx #$ff fe/e762 ldy #$ff fe/e764 bcs LFEE768 fe/e766 inx fe/e767 iny fe/e768 LFEE768 rts fe/e769 LFEE769 txa fe/e76a beq LFEE773 fe/e76c jsr OSBYTE_DOESNOTHINGBADLY fe/e76f clc fe/e770 bne LFEE760 fe/e772 rts fe/e773 LFEE773 ldx #$f9 fe/e775 bra LFEE74B fe/e777 dd1 $8a fe/e778 dd1 $49 fe/e779 dd1 $ff fe/e77a dd1 $aa fe/e77b dd1 $e0 fe/e77c dd1 $02 fe/e77d dd1 $b8 fe/e77e dd1 $50 fe/e77f dd1 $02 ; calls the CNPV vector ; ; TODO: check with MAME - must CNPV be called from this ROM - ; bank not passed? ; ; TODO: replace with ; PER + ; JMP (CNPV) ; + fe/e780 callCNPV sep #$40 fe/e782 xba fe/e783 phk fe/e784 lda SYSVARS_CNPV+1 fe/e787 pha fe/e788 lda SYSVARS_CNPV fe/e78b pha fe/e78c xba fe/e78d php fe/e78e rti fe/e78f dd1 $30 fe/e790 dd1 $e6 fe/e791 dd1 $f0 fe/e792 dd1 $0d fe/e793 dd1 $20 fe/e794 dd1 $b6 fe/e795 dd1 $e7 fe/e796 dd1 $f0 fe/e797 dd1 $07 fe/e798 str ↑“<{%=w%*” fe/e79f dd1 $60 fe/e7a0 dd1 $20 fe/e7a1 dd1 $b6 fe/e7a2 dd1 $e7 fe/e7a3 dd1 $f0 fe/e7a4 dd1 $02 fe/e7a5 dd1 $a2 fe/e7a6 dd1 $00 fe/e7a7 str ↑“,w%)” fe/e7ab dd1 $00 fe/e7ac dd1 $8d fe/e7ad dd1 $f7 fe/e7ae dd1 $a5 fe/e7af dd1 $60 fe/e7b0 dd1 $8a fe/e7b1 dd1 $0d fe/e7b2 dd1 $41 fe/e7b3 dd1 $a5 fe/e7b4 dd1 $f0 fe/e7b5 dd1 $b2 ; This looks to be some sort of vestigial attempt at implementing r/w variables ; in OSBYTE but just does an RTS fe/e7b6 OSBYTE_DOESNOTHINGBADLY ldx #$07 fe/e7b8 jsr donothingRTS fe/e7bb ldx <DPSYS_OSB_X fe/e7bd ldy <DPSYS_OSB_Y fe/e7bf eor #$00 fe/e7c1 rts fe/e7c2 OSBYTE_7A ldx #$01 fe/e7c4 OSBYTE_79 txy fe/e7c5 ldx #$04 fe/e7c7 jsl __KB fe/e7cb rts fe/e7cc doDispatchOSBYTE pea DPLOC_SYS fe/e7cf pld fe/e7d0 pea $0000 fe/e7d3 plb dbank $00 fe/e7d4 plb fe/e7d5 pha fe/e7d6 php fe/e7d7 sei fe/e7d8 sta <DPSYS_OSB_A fe/e7da stx <DPSYS_OSB_X fe/e7dc sty <DPSYS_OSB_Y fe/e7de ldx #$07 fe/e7e0 cmp #$73 fe/e7e2 bcc @osb_0to72 fe/e7e4 cmp #$a1 fe/e7e6 bcc @osb_73toA0 fe/e7e8 cmp #$a6 fe/e7ea bcc @exitNotImpl fe/e7ec clc fe/e7ed LFEE7ED lda #$a1 ;numbers A1..A6 get turned to A1; A2 if SEC entered below at e85b fe/e7ef adc #$00 fe/e7f1 @osb_73toA0 sbc #$56 ;73..A2 get turned into 1C..4B fe/e7f3 LFEE7F3 asl A ;; multiply by 2 fe/e7f4 sec fe/e7f5 sty <DPSYS_OSB_Y fe/e7f7 dispatchOSWORDinA tay ;When OSWORD enters here A=98..B4 fe/e7f8 bit SYSVAR_FLAGS_SOMETHINGOSBYTEY fe/e7fb bpl LFEE804 fe/e7fd txa fe/e7fe clv fe/e7ff jsr QOSBY_VECTORthruA524 fe/e802 bvs @restoreflags_returnCy fe/e804 LFEE804 phb fe/e805 phk dbank K (auto) fe/e806 plb fe/e807 lda 0+(tblOSBYTDispatch & $ffff)+1,y fe/e80a sta <DPSYS_OSB_IND+1 fe/e80c lda tblOSBYTDispatch & $ffff,y fe/e80f sta <DPSYS_OSB_IND fe/e811 plb fe/e812 lda <DPSYS_OSB_A fe/e814 ldy <DPSYS_OSB_Y fe/e816 bcs @notosw fe/e818 lda [<DPSYS_OSB_X] ;if carry clear (OSWORD) A = first byte from long ptr fe/e81a @notosw sec fe/e81b ldx <DPSYS_OSB_X fe/e81d jsr callDP_F6_SEC_ZeqX fe/e820 @restoreflags_returnCy ror A fe/e821 plp fe/e822 rol A fe/e823 pla fe/e824 clv fe/e825 rts fe/e826 @osb_0to72 ldy #$00 fe/e828 cmp #$1c fe/e82a bcc LFEE7F3 fe/e82c @exitNotImpl php fe/e82d php fe/e82e OSB_plaplaplpplaSECSEV pla fe/e82f pla fe/e830 bra OSB_plpplaSECSEV fe/e832 dd1 $a6 fe/e833 dd1 $ea fe/e834 dd1 $4c fe/e835 dd1 $20 fe/e836 dd1 $e8 fe/e837 OSB_plpplaSECSEV plp fe/e838 pla fe/e839 sep #$41 fe/e83b rts fe/e83c dd1 $60 fe/e83d enterOSWORD_BHA sep #$30 fe/e83f phx ;caller's A - TODO: pointless push here? Check if to align with OSBYTE entry? fe/e840 php fe/e841 sei fe/e842 sta <DPSYS_OSB_X fe/e844 xba fe/e845 sta <DPSYS_OSB_Y fe/e847 phb fe/e848 pla fe/e849 sta <DPSYS_OSB_A fe/e84b txa fe/e84c pea DPSYS fe/e84f pld dbank $00 fe/e850 pea $0000 fe/e853 plb fe/e854 plb fe/e855 ldx #$08 fe/e857 cmp #$e0 fe/e859 bcc LFEE85E fe/e85b brl LFEE7ED ;enter OSBYTE dispatcher with carry set to index into rest of table fe/e85e LFEE85E cmp #$0e fe/e860 bcs @exitNotImpl fe/e862 adc #$4c fe/e864 asl A fe/e865 bcs OSBYTE_0_X fe/e867 brl dispatchOSWORDinA fe/e86a OSBYTE_0_X ldx #$00 fe/e86c rts ******************************************************************************** * OSBYTE 0 - print OS version or return in X * ******************************************************************************** fe/e86d OSBYTE_0 bne OSBYTE_0_X fe/e86f brk $f7 fe/e871 zstr “Version 1.00 13/Nov/86 (C)1986” fe/e890 TFEE890 ldy #$00 fe/e892 lda SYSVARS+98 fe/e895 bne LFEE8DF fe/e897 lda SYSVAR_SOUND_EXT_FLAG fe/e89a bne LFEE8A1 fe/e89c iny fe/e89d lda [$ea],y fe/e89f cmp #$20 fe/e8a1 LFEE8A1 ldx #$08 fe/e8a3 bcc LFEE8A8 fe/e8a5 brl OSB_plaplaplpplaSECSEV fe/e8a8 LFEE8A8 dey fe/e8a9 lda [$ea],y fe/e8ab jsr LFEE941 fe/e8ae jsr LFEE957 fe/e8b1 ora #$04 fe/e8b3 tax fe/e8b4 bcc LFEE8BB fe/e8b6 jsr LFEDF34 fe/e8b9 ldy #$01 fe/e8bb LFEE8BB jsr LFEE957 fe/e8be sta $f6 fe/e8c0 php fe/e8c1 ldy #$06 fe/e8c3 lda [$ea],y fe/e8c5 pha fe/e8c6 ldy #$04 fe/e8c8 lda [$ea],y fe/e8ca pha fe/e8cb ldy #$02 fe/e8cd lda [$ea],y fe/e8cf rol A fe/e8d0 sec fe/e8d1 sbc #$02 fe/e8d3 asl A fe/e8d4 asl A fe/e8d5 ora $f6 fe/e8d7 jsr LFEDFAB fe/e8da bcc LFEE90B fe/e8dc pla fe/e8dd pla fe/e8de plp fe/e8df LFEE8DF rts fe/e8e0 Serv8_QRY pea $0000 fe/e8e3 plb dbank $00 fe/e8e4 plb fe/e8e5 lda SYSVARS+98 fe/e8e8 bne LFEE8DF fe/e8ea lda SYSVAR_SOUND_EXT_FLAG fe/e8ed beq LFEE8F4 fe/e8ef ldx #$16 fe/e8f1 jmp donothingRTS fe/e8f4 LFEE8F4 php fe/e8f5 sei fe/e8f6 lda SYSVARS+99 fe/e8f9 jsr LFEE941 fe/e8fc tax fe/e8fd lda SYSVARS+100 fe/e900 jsr callINSV fe/e903 lda SYSVARS+102 fe/e906 pha fe/e907 lda SYSVARS+101 fe/e90a pha fe/e90b LFEE90B sec fe/e90c ror SOUND_QRY_T fe/e90f pla fe/e910 jsr callINSV fe/e913 pla fe/e914 jsr callINSV fe/e917 plp fe/e918 rts fe/e919 TFEE919 ldx SYSVARS+98 fe/e91c bne LFEE8DF fe/e91e ldx SYSVAR_SOUND_EXT_FLAG fe/e921 beq LFEE926 fe/e923 brl LFEE8A1 fe/e926 LFEE926 sbc #$01 fe/e928 asl A fe/e929 asl A fe/e92a asl A fe/e92b asl A fe/e92c ora #$0f fe/e92e tax fe/e92f lda #$00 fe/e931 ldy #$10 fe/e933 LFEE933 cpy #$0e fe/e935 bcs LFEE939 fe/e937 lda [$ea],y fe/e939 LFEE939 sta $a8c0,x fe/e93c dex fe/e93d dey fe/e93e bne LFEE933 fe/e940 rts fe/e941 LFEE941 and #$03 fe/e943 ora #$04 fe/e945 cmp SOUND_CUR_CHAN_QRY fe/e948 beq LFEE956 fe/e94a pha fe/e94b clc fe/e94c ldx SOUND_CUR_CHAN_QRY fe/e94f sta SOUND_CUR_CHAN_QRY fe/e952 jsr LFEDF34 fe/e955 pla fe/e956 LFEE956 rts fe/e957 LFEE957 lda [$ea],y fe/e959 cmp #$10 fe/e95b and #$03 fe/e95d iny fe/e95e rts fe/e95f TFEE95F ldx #$0f fe/e961 bne LFEE966 fe/e963 TFEE963 ldx SYSVARS_83_TIMER_SWITCH fe/e966 LFEE966 ldy #$04 fe/e968 LFEE968 lda SYSVARS+140,x fe/e96b sta [$ea],y fe/e96d inx fe/e96e dey fe/e96f bpl LFEE968 fe/e971 LFEE971 rts fe/e972 TFEE972 lda #$0f fe/e974 bne LFEE97C fe/e976 TFEE976 lda SYSVARS_83_TIMER_SWITCH fe/e979 eor #$0f fe/e97b clc fe/e97c LFEE97C pha fe/e97d tax fe/e97e ldy #$04 fe/e980 LFEE980 lda [$ea],y fe/e982 sta SYSVARS+140,x fe/e985 inx fe/e986 dey fe/e987 bpl LFEE980 fe/e989 pla fe/e98a bcs LFEE971 fe/e98c sta SYSVARS_83_TIMER_SWITCH fe/e98f rts ******************************************************************************** * OSWORD 0 - readline * * As per BBC - not sure what the implied bank for the pointer in the block is * ******************************************************************************** dbank $00 fe/e990 OSWORD_0 ldy #$04 ; Copy bytes 2,3,4 to SYSVARS+B0 (different to BBC) fe/e992 @lp lda [<DPSYS_OSB_X],y fe/e994 tyx ;TODO - remove fe/e995 sta SYSVARS_OSWORD_0_PARMS-2,x ;TODO - use Y here fe/e998 dey fe/e999 cpy #$02 fe/e99b bcs @lp ; store the address pointer in DP fe/e99d lda [<DPSYS_OSB_X],y fe/e99f sta <DPSYS_OSWORD0_BUFPTR+1 fe/e9a1 dey fe/e9a2 sty DPSYS_PAGEMODE_CTR-$700 ;Y is zero here; TODO: use STZ fe/e9a5 lda [<DPSYS_OSB_X],y fe/e9a7 sta <DPSYS_OSWORD0_BUFPTR fe/e9a9 cli fe/e9aa bra @loop fe/e9ac @OSW0_BELL lda #VDU_07_BELL ;beep and go round the loop without incrementing Y fe/e9ae dey fe/e9af @OSW0_inyecho iny fe/e9b0 @badcharNoInc ldx DPSYS_D8_B_SAV fe/e9b2 phx ;TODO: pointless push - OPWRC preserves all regs fe/e9b3 cop COP_00_OPWRC fe/e9b5 plx fe/e9b6 stx DPSYS_D8_B_SAV fe/e9b8 @loop ldx DPSYS_D8_B_SAV fe/e9ba phx fe/e9bb cop COP_04_OPRDC ;read char from input stream fe/e9bd plx fe/e9be stx DPSYS_D8_B_SAV fe/e9c0 bcs @ESC_ret ;ESCape fe/e9c2 tax fe/e9c3 lda SYSVARS_7C_OUTDEST fe/e9c6 ror A fe/e9c7 ror A ;rotate twice to see if output disabled fe/e9c8 txa ;restore A fe/e9c9 bcs @novdu ;if VDU disabled skip forward fe/e9cb ldx SYSVAR_VDU_QLEN fe/e9ce bne @badcharNoInc ;if there's stuff in the VDU Q just output the char and continue fe/e9d0 @novdu cmp #VDU_7F_BKSP fe/e9d2 bne @notbksp fe/e9d4 cpy #$00 fe/e9d6 beq @loop ;if zero just loop around fe/e9d8 dey ;decrement pointer fe/e9d9 bcs @badcharNoInc ;always branch round - TODO: change to more meaningful BRA fe/e9db @notbksp cmp #VDU_15_DELLN fe/e9dd bne @storeInBuf fe/e9df tya ;check pointer for 0 fe/e9e0 beq @loop ;nothing in current line got back to reading fe/e9e2 lda #VDU_7F_BKSP fe/e9e4 @dellnlp cop COP_00_OPWRC fe/e9e6 dey fe/e9e7 bne @dellnlp fe/e9e9 beq @loop fe/e9eb @storeInBuf phb ;preserve our Bank fe/e9ec xba ;preserve A (char to store) fe/e9ed lda DPSYS_D8_B_SAV ;get dest bank fe/e9ef pha fe/e9f0 plb fe/e9f1 xba ;get back A fe/e9f2 sta (<DPSYS_OSWORD0_BUFPTR),y fe/e9f4 plb ;back to our bank fe/e9f5 cmp #VDU_0D_CR ;check for EOL fe/e9f7 beq @newlClcRet fe/e9f9 cpy SYSVARS_OSWORD_0_PARMS fe/e9fc bcs @OSW0_BELL ;too long - beep fe/e9fe cmp SYSVARS_OSWORD_0_PARMS+1 fe/ea01 bcc @badcharNoInc ;bad char silently store in buffer no increment fe/ea03 cmp SYSVARS_OSWORD_0_PARMS+2 fe/ea06 beq @OSW0_inyecho fe/ea08 bcc @OSW0_inyecho fe/ea0a bcs @badcharNoInc fe/ea0c @newlClcRet cop COP_03_OPNLI fe/ea0e clc fe/ea0f @ESC_ret tax fe/ea10 rts fe/ea11 dd1 $58 fe/ea12 dd1 $78 fe/ea13 dd1 $da fe/ea14 dd1 $a9 fe/ea15 dd1 $00 fe/ea16 dd1 $eb fe/ea17 dd1 $a9 fe/ea18 dd1 $03 fe/ea19 dd1 $a2 fe/ea1a dd1 $02 fe/ea1b dd1 $22 fe/ea1c dd1 $b0 fe/ea1d dd1 $ff fe/ea1e dd1 $00 fe/ea1f dd1 $fa fe/ea20 dd1 $90 fe/ea21 dd1 $3e fe/ea22 dd1 $2c fe/ea23 dd1 $c6 fe/ea24 dd1 $a5 fe/ea25 dd1 $10 fe/ea26 dd1 $ea fe/ea27 dd1 $20 fe/ea28 dd1 $16 fe/ea29 dd1 $df fe/ea2a dd1 $a0 fe/ea2b dd1 $00 fe/ea2c dd1 $84 fe/ea2d dd1 $eb fe/ea2e dd1 $86 fe/ea2f dd1 $ea fe/ea30 dd1 $20 fe/ea31 dd1 $b6 fe/ea32 dd1 $e7 fe/ea33 dd1 $a9 fe/ea34 dd1 $05 fe/ea35 dd1 $09 fe/ea36 dd1 $f0 fe/ea37 dd1 $80 fe/ea38 dd1 $0d fe/ea39 dd1 $d0 fe/ea3a dd1 $07 fe/ea3b dd1 $a2 fe/ea3c dd1 $32 fe/ea3d dd1 $48 fe/ea3e dd1 $a9 fe/ea3f dd1 $03 fe/ea40 dd1 $aa fe/ea41 dd1 $68 fe/ea42 dd1 $60 fe/ea43 OSBYTE_4 clc fe/ea44 adc #$e9 ;TODO: make this relative to SYSVARS/VDUVARS fe/ea46 stx <DPSYS_OSB_X ;TODO: suspect this is superfluous? fe/ea48 OSBYTE_A6_FF cmp #$dd fe/ea4a bcc @sk1 fe/ea4c cmp #$e5 fe/ea4e bcc @skDDtoE4 fe/ea50 @sk1 tay fe/ea51 lda SYSVARS-112,y fe/ea54 tax fe/ea55 and <DPSYS_OSB_Y fe/ea57 eor <DPSYS_OSB_X fe/ea59 sta SYSVARS-112,y fe/ea5c lda SYSVARS-111,y fe/ea5f tay fe/ea60 rts fe/ea61 @skDDtoE4 jsr OSBYTE_DDtoE4 ;;TODO: replace with jump fe/ea64 rts fe/ea65 dd1 $49 fe/ea66 dd1 $8c fe/ea67 dd1 $0a fe/ea68 dd1 $8d fe/ea69 dd1 $47 fe/ea6a dd1 $a5 fe/ea6b dd1 $60 ******************************************************************************** * OSBYTE 13 (19) - Wait for Vsync * ******************************************************************************** dbank $00 fe/ea6c OSBYTE_13 lda SYSVAR_CFS_TIMEOUT fe/ea6f @lp cli fe/ea70 sei fe/ea71 cmp SYSVAR_CFS_TIMEOUT fe/ea74 beq @lp fe/ea76 rts ******************************************************************************** * OSBYTE 12 - Reset Soft Key Definitions * ******************************************************************************** fe/ea77 OSBYTE_12 jsr OSB_ResetFnKeys fe/ea7a rts rwid longm,longx fe/ea7b LFEEA7B php fe/ea7c rep #$30 fe/ea7e lda #$0000 fe/ea81 tay fe/ea82 ldx #$003a fe/ea85 phk fe/ea86 jsr callModVDU fe/ea89 plp fe/ea8a rts ******************************************************************************** * OSBYTE 76 - reflect keyboard in LEDS * ******************************************************************************** rwid shortm,shortx fe/ea8b OSBYTE_76 php fe/ea8c sei fe/ea8d lda #$40 fe/ea8f jsr LFEEAB6 fe/ea92 bcs LFEEA9E fe/ea94 clc fe/ea95 clv fe/ea96 phx fe/ea97 ldx #$1c fe/ea99 jsl __KB fe/ea9d plx fe/ea9e LFEEA9E plp fe/ea9f rol A fe/eaa0 rts ******************************************************************************** * OSBYTE 78 - write key pressed data * ******************************************************************************** fe/eaa1 OSBYTE_78 txy fe/eaa2 ldx #$18 fe/eaa4 jsl __KB fe/eaa8 rts fe/eaa9 callEVENTV xba fe/eaaa phk fe/eaab lda SYSVAR_20_EVENTV+1 fe/eaae pha fe/eaaf lda SYSVAR_20_EVENTV fe/eab2 pha fe/eab3 xba fe/eab4 php fe/eab5 rti fe/eab6 LFEEAB6 bcc @skCC fe/eab8 pha fe/eab9 lda SYSVARS_ULA_MISC_COPY fe/eabc eor #$c0 fe/eabe stal shiela_ULA_MISC fe/eac2 eor #$c0 fe/eac4 stal shiela_ULA_MISC fe/eac8 pla fe/eac9 @skCC pha fe/eaca phx fe/eacb lda #$00 fe/eacd xba fe/eace lda #$03 fe/ead0 ldx #$02 fe/ead2 jsl __EV fe/ead6 plx fe/ead7 pla fe/ead8 rts fe/ead9 dd1 $ad fe/eada dd1 $87 fe/eadb dd1 $a5 fe/eadc dd1 $49 fe/eadd dd1 $4c fe/eade dd1 $d0 fe/eadf dd1 $04 fe/eae0 dd1 $5c fe/eae1 dd1 $87 fe/eae2 dd1 $a5 fe/eae3 dd1 $00 fe/eae4 str “``/!BO.”,$0d ; QRY this appears to do a jump indirect to (f6) in DP setting flags Z if X==0 ; and Cy=1 ; ; As this is called once in OSBYTE dispatch where DP is known why not just ; ; CPX#0 ; SEC ; JMP(ACF6) fe/eaec callDP_F6_SEC_ZeqX phk fe/eaed phd fe/eaee pha fe/eaef xba fe/eaf0 pha ; +7 RETH ; +6 RETL ; +5 K ; +3 D ; +2 A ; +1 B fe/eaf1 lda <DPSYS_OSB_IND+1 fe/eaf3 sta $04,S fe/eaf5 lda <DPSYS_OSB_IND fe/eaf7 sta $03,S ; +7 RETH ; +6 RETL ; +5 K ; +3 F6,F7 ; +2 A ; +1 B fe/eaf9 pla fe/eafa xba fe/eafb pla ; +5 RETH ; +4 RETL ; +3 K ; +1 F6,F7 fe/eafc cpx #$00 fe/eafe sec fe/eaff php ; +6 RETH ; +5 RETL ; +4 K ; +2 F6,F7 ; +1 FLAGS with Cy=1, Z if X==0 fe/eb00 rti ; TODO - this looks dead as it will trip over the string fe/eb01 ldx #$09 fe/eb03 jsr donothingRTS fe/eb06 jsr LFEEE0B_rts fe/eb09 zstr $0d,“Version 1.00 13/Nov/86 (C)1986” fe/eb29 rts fe/eb2a dec SYSVARS+73 fe/eb2d rts fe/eb2e ldy SYSVARS+68 fe/eb31 ldx #$00 fe/eb33 rts fe/eb34 resetFlashCounters php fe/eb35 sei fe/eb36 ldx #$00 fe/eb38 stx SYSVAR_48_UNKNOWN_ULA fe/eb3b lda SYSVAR_FLASH_MARK fe/eb3e sta SYSVAR_51_FLASHCTDN fe/eb41 ldx #VDUMOD_OPX_14_FLASH_QRY fe/eb43 phk fe/eb44 jsr callModVDU fe/eb47 plp fe/eb48 rts fe/eb49 doSoundInterrupt phb fe/eb4a pea $0000 dbank $00 fe/eb4d plb fe/eb4e plb fe/eb4f lda SYSVAR_SOUND_EXT_FLAG fe/eb52 bne LFEEB5C fe/eb54 lda SOUND_QRY_T fe/eb57 beq LFEEB5C fe/eb59 jsr LFEEB5E fe/eb5c LFEEB5C plb fe/eb5d rts fe/eb5e LFEEB5E ldx SOUND_CUR_CHAN_QRY fe/eb61 lda SYSVARS_ELK_BUFFER_BUSY,x fe/eb64 bmi LFEEB6B fe/eb66 lda SOUND_QRY_S fe/eb69 bne LFEEB6E fe/eb6b LFEEB6B jsr LFEEC5D fe/eb6e LFEEB6E lda SOUND_QRY_S fe/eb71 beq LFEEB84 fe/eb73 cmp #$ff fe/eb75 beq LFEEB87 fe/eb77 dec $a81c fe/eb7a bne LFEEB87 fe/eb7c jsr LFEECDA fe/eb7f dec SOUND_QRY_S fe/eb82 bne LFEEB87 fe/eb84 LFEEB84 jsr LFEEC5D fe/eb87 LFEEB87 ldy $a81d fe/eb8a cpy #$ff fe/eb8c bne LFEEB91 fe/eb8e brl sound_QRY1 fe/eb91 LFEEB91 lda $a81e fe/eb94 beq LFEEB9E fe/eb96 dec $a81e fe/eb99 beq LFEEB9E fe/eb9b brl sound_QRY1 fe/eb9e LFEEB9E lda $a819 fe/eba1 cmp #$03 fe/eba3 beq sound_QRY1 fe/eba5 lda $a8c0,y fe/eba8 and #$7f fe/ebaa sta $a81e fe/ebad lda SOUND_QRY_S-1 fe/ebb0 bne LFEEBDC fe/ebb2 inc $a819 fe/ebb5 lda $a819 fe/ebb8 cmp #$03 fe/ebba bne LFEEBCC fe/ebbc ldy $a81d fe/ebbf lda $a8c0,y fe/ebc2 bmi sound_QRY1 fe/ebc4 lda #$00 fe/ebc6 sta $a819 fe/ebc9 jsr LFEECEB fe/ebcc LFEEBCC lda $a819 fe/ebcf clc fe/ebd0 adc $a81d fe/ebd3 tay fe/ebd4 lda $a8c4,y fe/ebd7 sta SOUND_QRY_S-1 fe/ebda beq sound_QRY1 fe/ebdc LFEEBDC dec SOUND_QRY_S-1 fe/ebdf lda $a81d fe/ebe2 clc fe/ebe3 adc $a819 fe/ebe6 tay fe/ebe7 lda $a8c1,y fe/ebea beq sound_QRY1 fe/ebec clc fe/ebed adc SOUND_STATUS_QRY-1 fe/ebf0 jsr LFEECEB dbank $00 fe/ebf3 sound_QRY1 lda $e5 ;QRY E5? fe/ebf5 ora SYSVARS+98 ;or with sound suppression status fe/ebf8 bne @ret ;if ne then exit fe/ebfa php fe/ebfb sei fe/ebfc lda SYSVARS_ULA_MISC_COPY fe/ebff and #$f9 fe/ec01 ora SOUND_STATUS_QRY fe/ec04 cmp SYSVARS_ULA_MISC_COPY fe/ec07 beq LFEEC10 fe/ec09 sta SYSVARS_ULA_MISC_COPY fe/ec0c stal shiela_ULA_MISC fe/ec10 LFEEC10 plp fe/ec11 lda SOUND_TONE_QRY fe/ec14 stal sheila_UKA_TONE fe/ec18 LFEEC18 lda SOUND_QRY_X fe/ec1b beq @ret fe/ec1d lda $e5 fe/ec1f bne @ret fe/ec21 txa fe/ec22 pha fe/ec23 inc SOUND_CUR_CHAN_QRY-1 fe/ec26 ldx SOUND_CUR_CHAN_QRY-1 fe/ec29 stal sheila_UKA_TONE fe/ec2d pla fe/ec2e tax fe/ec2f @ret rts ******************************************************************************** * OSBYTE 74 * * * * Reset the sound system - Electron * ******************************************************************************** fe/ec30 OSBYTE_74 phb fe/ec31 pea $0000 fe/ec34 plb dbank $00 fe/ec35 plb fe/ec36 ldx #$04 fe/ec38 stx SOUND_CUR_CHAN_QRY fe/ec3b @lp jsr SOUND_RESET_CHAN_X_QRY fe/ec3e inx fe/ec3f cpx #$07 fe/ec41 bne @lp fe/ec43 plb fe/ec44 SOUND_RESET_CHAN_X_QRY phb fe/ec45 pea $0000 fe/ec48 plb dbank $00 fe/ec49 plb fe/ec4a lda #$00 fe/ec4c sta SOUND_QRY_S fe/ec4f sta SYSVARS_ELK_BUFFER_BUSY,x fe/ec52 sta SOUND_QRY_T fe/ec55 jsr SOUND_CLR_QRY fe/ec58 jsr sound_QRY1 fe/ec5b plb fe/ec5c rts fe/ec5d LFEEC5D ldx SOUND_CUR_CHAN_QRY fe/ec60 jsr SOUND_CLR_QRY fe/ec63 lda SYSVARS_ELK_BUFFER_BUSY,x fe/ec66 beq LFEEC70 fe/ec68 lda #$00 fe/ec6a sta SYSVARS_ELK_BUFFER_BUSY,x fe/ec6d sta SOUND_QRY_S fe/ec70 LFEEC70 jsr OSBYTE_98 fe/ec73 bcc LFEEC84 fe/ec75 php fe/ec76 sei fe/ec77 jsr OSBYTE_98 fe/ec7a bcc LFEEC81 fe/ec7c lda #$00 fe/ec7e sta SOUND_QRY_T fe/ec81 LFEEC81 plp fe/ec82 bra SOUND_CLR_QRY fe/ec84 LFEEC84 php fe/ec85 sei fe/ec86 jsr OSBYTE_91 fe/ec89 pha fe/ec8a and #$04 fe/ec8c beq LFEEC9C fe/ec8e pla fe/ec8f jsr SOUND_CLR_QRY fe/ec92 jsr OSBYTE_91 fe/ec95 jsr OSBYTE_91 fe/ec98 plp fe/ec99 jmp LFEECD7 fe/ec9c LFEEC9C lda #$02 fe/ec9e sta SOUND_STATUS_QRY fe/eca1 pla fe/eca2 and #$f8 fe/eca4 asl A fe/eca5 bcc LFEECB2 fe/eca7 cmp #$f0 fe/eca9 bne LFEECB0 fe/ecab lda #$00 fe/ecad sta SOUND_STATUS_QRY fe/ecb0 LFEECB0 lda #$ff dbank $00 fe/ecb2 LFEECB2 sta $a81d fe/ecb5 ldy #$01 fe/ecb7 sty $a81e fe/ecba dey fe/ecbb sty SOUND_QRY_S-1 fe/ecbe sty SOUND_STATUS_QRY-1 fe/ecc1 dey fe/ecc2 sty $a819 fe/ecc5 jsr OSBYTE_91 fe/ecc8 sta $a818 fe/eccb jsr OSBYTE_91 fe/ecce plp fe/eccf pha fe/ecd0 lda $a818 fe/ecd3 jsr LFEECF2 fe/ecd6 pla fe/ecd7 LFEECD7 sta SOUND_QRY_S fe/ecda LFEECDA lda #$05 fe/ecdc sta $a81c fe/ecdf rts fe/ece0 SOUND_CLR_QRY lda #$00 fe/ece2 sta SOUND_STATUS_QRY fe/ece5 LFEECE5 lda #$00 fe/ece7 LFEECE7 sta SOUND_QRY_X fe/ecea rts fe/eceb LFEECEB sta SOUND_STATUS_QRY-1 fe/ecee clc fe/ecef adc $a818 fe/ecf2 LFEECF2 pha fe/ecf3 and #$03 fe/ecf5 tax fe/ecf6 lda SOUND_CUR_CHAN_QRY fe/ecf9 cmp #$04 fe/ecfb bne LFEED1E fe/ecfd pla fe/ecfe and #$04 fe/ed00 beq LFEED12 fe/ed02 phb fe/ed03 phk dbank K (auto) fe/ed04 plb fe/ed05 lda LFEED63 & $ffff,x fe/ed08 stal f:$00a823 fe/ed0c lda LFEED6B & $ffff,x fe/ed0f plb fe/ed10 bra LFEECE7 fe/ed12 LFEED12 phb fe/ed13 phk dbank K (auto) fe/ed14 plb fe/ed15 lda LFEED67 & $ffff,x fe/ed18 plb fe/ed19 sta $a821 fe/ed1c bra LFEECE5 fe/ed1e LFEED1E inx fe/ed1f lda #$00 fe/ed21 sta $a821 fe/ed24 pla fe/ed25 lsr A fe/ed26 lsr A fe/ed27 LFEED27 cmp #$0c fe/ed29 bcc LFEED32 fe/ed2b inc $a821 fe/ed2e sbc #$0c fe/ed30 bne LFEED27 fe/ed32 LFEED32 tay fe/ed33 lda $a821 fe/ed36 pha fe/ed37 phb fe/ed38 phk dbank K (auto) fe/ed39 plb fe/ed3a lda 0+(LFEED59 & $ffff)-2,y dbank $00 fe/ed3d plb fe/ed3e LFEED3E cpy #$07 fe/ed40 sbc #$02 fe/ed42 dex fe/ed43 bne LFEED3E fe/ed45 sta SOUND_TONE_QRY fe/ed48 pla fe/ed49 tay fe/ed4a beq LFEED52 fe/ed4c LFEED4C lsr SOUND_TONE_QRY fe/ed4f dey fe/ed50 bne LFEED4C fe/ed52 LFEED52 dec SOUND_TONE_QRY fe/ed55 bne LFEECE5 fe/ed57 brk $f0 fe/ed59 LFEED59 str ↑“cVK?5* ” fe/ed60 dd1 $97 fe/ed61 dd1 $8f fe/ed62 dd1 $87 fe/ed63 LFEED63 dd1 $40 fe/ed64 dd1 $80 fe/ed65 dd1 $c0 fe/ed66 dd1 $80 fe/ed67 LFEED67 dd1 $3b fe/ed68 dd1 $76 fe/ed69 dd1 $f0 fe/ed6a dd1 $76 fe/ed6b LFEED6B dd1 $7f fe/ed6c dd1 $ff fe/ed6d dd1 $ff fe/ed6e dd1 $ff fe/ed6f dd1 $60 fe/ed70 dd1 $02 fe/ed71 dd1 $0f fe/ed72 str “use COP not call to absolute address” fe/ed96 dd1 $00 fe/ed97 default__OSB cop COP_06_OPOSB fe/ed99 rtl fe/ed9a default__OSW cop COP_07_OPOSW fe/ed9c rtl rwid longx fe/ed9d default__BGET cop COP_0A_OPBGT fe/ed9f rts rwid shortx fe/eda0 default__BPUT cop COP_0B_OPBPUT fe/eda2 rts fe/eda3 syserrorTestEsc cop COP_0F_OPERR fe/eda5 zstr “use TESTESC in $.I.SYSTEM not XXOSESC” ******************************************************************************** * FFB0 - EV - ???? * * * * Well known entry point not documented in Systems Documentation * * * * Given an even mask in A test escape/preempt status * ******************************************************************************** fe/edcb default__EV php fe/edcc rep #$20 rwid longm fe/edce pha fe/edcf and #$00fc fe/edd2 beq @ok fe/edd4 cop COP_0F_OPERR fe/edd6 zstr “invalid A contents in call to `EV” fe/edf8 @ok pla fe/edf9 andl f:SYS_ESCAPE_FLAG_QRY fe/edfd cmp #__EVESC fe/ee00 bcc @retCCPL fe/ee02 plp rwid shortm fe/ee03 sep #$81 fe/ee05 rtl rwid longm fe/ee06 @retCCPL plp rwid shortm fe/ee07 clc fe/ee08 rep #$81 fe/ee0a rtl ; TODO: dead code? fe/ee0b LFEEE0B_rts rts fe/ee0c starEXEC ldx #__STGLN ;GSINIT fe/ee0e jsl __ST fe/ee12 bra closeEXEC2 ******************************************************************************** * OSBYTE 77 - close all EXEC / SPOOL files * ******************************************************************************** fe/ee14 OSBYTE_77 sec fe/ee15 closeEXEC2 php fe/ee16 rep #$10 rwid longx fe/ee18 sep #$20 fe/ee1a php fe/ee1b phy fe/ee1c ldx #$0000 fe/ee1f ldy <DPSYS_D1_EXEC_handle fe/ee21 stx <DPSYS_D1_EXEC_handle fe/ee23 beq LFEEE27 fe/ee25 cop COP_45_OPCLS fe/ee27 LFEEE27 ply fe/ee28 plp fe/ee29 bcs LFEEE3E fe/ee2b ldx #__STGAD ;add Y to GSREAD address fe/ee2e jsl __ST ;Get BHA pointer to first character of filename fe/ee32 ldy #$0040 fe/ee35 cop COP_44_OPOPN fe/ee37 bcc LFEEE3C fe/ee39 ldy #$0000 fe/ee3c LFEEE3C sty <DPSYS_D1_EXEC_handle fe/ee3e LFEEE3E bcc LFEEE43 fe/ee40 plp fe/ee41 sec fe/ee42 rts fe/ee43 LFEEE43 plp fe/ee44 clc fe/ee45 rts rwid shortx fe/ee46 LFEEE46 rts fe/ee47 donothingRTS rts fe/ee48 LFEEE48 brl LFEEE54 ;todo: remove? rwid longm,longx fe/ee4b brlFindModule brl findModule ;todo: remove? fe/ee4e brlGetModCallRef brl getModCallRef ;todo: remove? fe/ee51 brlGetOrCreateModCallBlock brl getOrCreateModCallBlock ;todo: remove? rwid shortm,shortx fe/ee54 LFEEE54 php fe/ee55 phd fe/ee56 phb fe/ee57 rep #$30 rwid longm,longx fe/ee59 pea $0000 fe/ee5c phk fe/ee5d phk fe/ee5e pea MOSSTART & $ffff fe/ee61 per tblLFEF0E1+3 fe/ee64 tsc fe/ee65 tcd fe/ee66 plx fe/ee67 phx fe/ee68 phk dbank K (auto) fe/ee69 plb fe/ee6a bpl LFEEE6F fe/ee6c ldx #(tblLFEF0E1 & $ffff)+9 fe/ee6f LFEEE6F jsr LFEEF9D fe/ee72 ldal f:B0LST_MODULES_QRY fe/ee76 tax fe/ee77 ldal f:bob_ll_irq_pri__psec,x fe/ee7b beq LFEEE89 fe/ee7d tay fe/ee7e jsr getHandleYtoX fe/ee81 ldal f:B0LST_MODULES_QRY fe/ee85 stal f:DPCOP_DP,x fe/ee89 LFEEE89 lda #$0000 fe/ee8c sta bob_ll_irq_sec__flags fe/ee8e sta bob_ll_irq_pri__mand fe/ee90 plx fe/ee91 phx fe/ee92 lda a:$0004,x fe/ee95 sta bob_ll_irq_pri__psec fe/ee97 lda a:$0002,x fe/ee9a sta bob_ll_irq_sec__fphand fe/ee9c cmp #$0100 fe/ee9f bcs LFEEEBE fe/eea1 phb fe/eea2 tay fe/eea3 ldx #__MMBAS fe/eea6 jsl __MM fe/eeaa phb fe/eeab pha fe/eeac plb fe/eead pla fe/eeae sta bob_ll_irq_sec__fphand fe/eeb0 ldx #__MMTOP fe/eeb3 jsl __MM fe/eeb7 phb fe/eeb8 pha fe/eeb9 plb fe/eeba pla fe/eebb sta bob_ll_irq_pri__psec fe/eebd plb fe/eebe LFEEEBE jsr LFEEF2D fe/eec1 bcs LFEEEF3 fe/eec3 plx fe/eec4 phx fe/eec5 jsr LFEEF9D fe/eec8 phb fe/eec9 cop COP_26_OPBHA fe/eecb zstr “MOS” fe/eecf ldx #$0000 fe/eed2 txy fe/eed3 cop COP_34_OPRMI fe/eed5 bcs LFEEEEB fe/eed7 phb fe/eed8 phb fe/eed9 pha fe/eeda per MOSSTART fe/eedd pla fe/eede cmp $01,S fe/eee0 bne LFEEEEE fe/eee2 phk fe/eee3 phk fe/eee4 pla fe/eee5 cmp $03,S fe/eee7 bne LFEEEEE fe/eee9 pla fe/eeea pla fe/eeeb LFEEEEB plb fe/eeec bra LFEEEBE fe/eeee LFEEEEE ldx #$0002 fe/eef1 php fe/eef2 rti fe/eef3 LFEEEF3 plx fe/eef4 phx fe/eef5 lda a:$0000,x fe/eef8 dec A fe/eef9 eor #$ffff fe/eefc and bob_ll_irq_sec__flags fe/eefe clc fe/eeff adc a:$0000,x fe/ef02 sta bob_ll_irq_sec__flags fe/ef04 lda bob_ll_irq_pri__mand fe/ef06 adc #$0000 fe/ef09 sta bob_ll_irq_pri__mand fe/ef0b bit #$ff00 fe/ef0e bne LFEEF16 fe/ef10 lda bob_ll_irq_sec__fphand fe/ef12 cmp bob_ll_irq_pri__psec fe/ef14 bcc LFEEEBE fe/ef16 LFEEF16 pla fe/ef17 clc fe/ef18 adc #$0006 fe/ef1b pha fe/ef1c tax fe/ef1d lda a:$0000,x fe/ef20 beq LFEEF25 fe/ef22 brl LFEEE89 fe/ef25 LFEEF25 pld fe/ef26 pld fe/ef27 pld fe/ef28 pld fe/ef29 plb fe/ef2a pld fe/ef2b plp fe/ef2c rtl fe/ef2d LFEEF2D ldy #$0000 fe/ef30 lda [bob_ll_irq_sec__flags],y fe/ef32 and #$00ff fe/ef35 cmp tblLFEF0E1 & $ffff fe/ef38 beq LFEEF3D fe/ef3a brl LFEEF9B fe/ef3d LFEEF3D ldy #$0005 fe/ef40 lda [bob_ll_irq_sec__flags],y fe/ef42 and #$00ff fe/ef45 bne LFEEF9B fe/ef47 ldy #$0003 fe/ef4a lda [bob_ll_irq_sec__flags],y fe/ef4c sec fe/ef4d sbc #$0003 fe/ef50 bcc LFEEF9B fe/ef52 ldy #$0001 fe/ef55 cmp [bob_ll_irq_sec__flags],y fe/ef57 bcc LFEEF9B fe/ef59 ldy #$000e fe/ef5c lda [bob_ll_irq_sec__flags],y fe/ef5e jsr checkValidModnameChar fe/ef61 bcs LFEEF9B fe/ef63 LFEEF63 lda [bob_ll_irq_sec__flags],y fe/ef65 and #$00ff fe/ef68 beq LFEEF74 fe/ef6a jsr LFEF0BF fe/ef6d bcs LFEEF9B fe/ef6f iny fe/ef70 beq LFEEF9B fe/ef72 bra LFEEF63 fe/ef74 LFEEF74 tya fe/ef75 ldy #$0003 fe/ef78 cmp [bob_ll_irq_sec__flags],y fe/ef7a bcs LFEEF9B fe/ef7c ldy #$0003 fe/ef7f lda [bob_ll_irq_sec__flags],y fe/ef81 clc fe/ef82 adc bob_ll_irq_sec__flags fe/ef84 adc #$0002 fe/ef87 bcs LFEEF9B fe/ef89 ldy #$0003 fe/ef8c lda [bob_ll_irq_sec__flags],y fe/ef8e tay fe/ef8f phb fe/ef90 pei (bob_ll_irq_sec__fphand) fe/ef92 plb fe/ef93 plb fe/ef94 pei (bob_ll_irq_sec__flags) fe/ef96 pla fe/ef97 cop COP_32_OPSUM fe/ef99 plb fe/ef9a rts fe/ef9b LFEEF9B sec fe/ef9c rts fe/ef9d LFEEF9D jsr LFEF067 fe/efa0 bcc LFEEFA5 fe/efa2 brl LFEF03D fe/efa5 LFEEFA5 pha fe/efa6 lda a:$0002,x fe/efa9 cmp #$0100 fe/efac ldy #$0000 fe/efaf bcs LFEEFD1 fe/efb1 phd fe/efb2 phb fe/efb3 ldy #$0003 fe/efb6 lda [bob_ll_irq_sec__flags],y fe/efb8 pha fe/efb9 inc A fe/efba inc A fe/efbb lda a:$0002,x fe/efbe tay fe/efbf pei (bob_ll_irq_sec__fphand) fe/efc1 plb fe/efc2 plb fe/efc3 lda bob_ll_irq_sec__flags fe/efc5 pld fe/efc6 ldx #$0004 fe/efc9 jsl __MM fe/efcd plb fe/efce pld fe/efcf bcs LFEF03D fe/efd1 LFEEFD1 plx fe/efd2 beq LFEEFE9 fe/efd4 ldal f:bob_ll_irq_pri__psec,x fe/efd8 beq LFEEFE6 fe/efda phx fe/efdb phy fe/efdc tay fe/efdd ldx #$0002 fe/efe0 jsl __MM fe/efe4 ply fe/efe5 plx fe/efe6 LFEEFE6 sec fe/efe7 bra LFEEFF1 fe/efe9 LFEEFE9 lda #HND_type_C_CBMOD fe/efec jsr allocB0B fe/efef bcs LFEF033 fe/eff1 LFEEFF1 lda bob_ll_irq_sec__fphand fe/eff3 stal f:bob_ll_irq_pri__mand,x fe/eff7 lda bob_ll_irq_sec__flags fe/eff9 stal f:bob_ll_irq_sec__fphand,x fe/effd tya fe/effe stal f:bob_ll_irq_pri__psec,x fe/f002 bcs LFEF030 fe/f004 phb fe/f005 phx fe/f006 ldal f:bob_ll_irq_pri__mand,x fe/f00a pha fe/f00b plb fe/f00c plb fe/f00d ldal f:bob_ll_irq_sec__fphand,x fe/f011 clc fe/f012 adc #$000e fe/f015 ldx #$0000 fe/f018 ldy #$0000 fe/f01b phk fe/f01c jsr findModuleByName_Q fe/f01f tyx fe/f020 ldal f:bob_ll_irq_pri__next,x fe/f024 plx fe/f025 stal f:bob_ll_irq_pri__next,x fe/f029 txa fe/f02a tyx fe/f02b stal f:bob_ll_irq_pri__next,x fe/f02f plb fe/f030 LFEF030 clc fe/f031 bra LFEF03E fe/f033 LFEF033 tya fe/f034 beq LFEF03D fe/f036 ldx #$0002 fe/f039 jsl __MM fe/f03d LFEF03D sec fe/f03e LFEF03E php fe/f03f ldy #$0003 fe/f042 lda [bob_ll_irq_sec__flags],y fe/f044 clc fe/f045 adc bob_ll_irq_sec__flags fe/f047 pha fe/f048 iny fe/f049 iny fe/f04a lda [bob_ll_irq_sec__flags],y fe/f04c and #$00ff fe/f04f adc bob_ll_irq_pri__mand fe/f051 sta bob_ll_irq_pri__mand fe/f053 pla fe/f054 sta bob_ll_irq_sec__flags fe/f056 lda bob_ll_irq_sec__flags fe/f058 clc fe/f059 adc #$0002 fe/f05c sta bob_ll_irq_sec__flags fe/f05e lda bob_ll_irq_pri__mand fe/f060 adc #$0000 fe/f063 sta bob_ll_irq_pri__mand fe/f065 plp fe/f066 rts fe/f067 LFEF067 php fe/f068 phd fe/f069 phb fe/f06a phx fe/f06b pea B0LST_MODULES_QRY rwid shortm fe/f06e LFEF06E rep #$20 rwid longm fe/f070 plx fe/f071 ldal f:bob_ll_irq_pri__next,x fe/f075 cmp #$fe0e fe/f078 beq LFEF0B3 fe/f07a pha fe/f07b jsr getModCallBlock fe/f07e tcd fe/f07f sep #$20 rwid shortm fe/f081 lda $11,S fe/f083 pha fe/f084 plb fe/f085 ldy #$000d fe/f088 LFEF088 iny fe/f089 lda [bob_ll_irq_pri__next],y fe/f08b jsr checkValidModnameChar fe/f08e bcs LFEF098 fe/f090 eor ($0f,S),y fe/f092 and #$df fe/f094 bne LFEF06E fe/f096 bra LFEF088 fe/f098 LFEF098 lda ($0f,S),y fe/f09a jsr checkValidModnameChar fe/f09d bcc LFEF06E fe/f09f ldy #$0006 fe/f0a2 rep #$20 rwid longm fe/f0a4 lda [bob_ll_irq_pri__next],y fe/f0a6 cmp ($0f,S),y fe/f0a8 sep #$20 rwid shortm fe/f0aa bcc LFEF0B6 fe/f0ac pld fe/f0ad plx fe/f0ae plb fe/f0af pld fe/f0b0 plp rwid longm fe/f0b1 sec fe/f0b2 rts fe/f0b3 LFEF0B3 pea $0000 rwid shortm fe/f0b6 LFEF0B6 rep #$20 rwid longm fe/f0b8 pla fe/f0b9 plx fe/f0ba plb fe/f0bb pld fe/f0bc plp fe/f0bd clc fe/f0be rts fe/f0bf LFEF0BF cmp #$002c fe/f0c2 bcc LFEF0DD fe/f0c4 cmp #$003a fe/f0c7 bcc LFEF0DF fe/f0c9 cmp #$0040 fe/f0cc bcc LFEF0DD fe/f0ce cmp #$005b fe/f0d1 bcc LFEF0DF fe/f0d3 cmp #$0061 fe/f0d6 bcc LFEF0DD fe/f0d8 cmp #$007b fe/f0db bcc LFEF0DF fe/f0dd LFEF0DD sec fe/f0de rts fe/f0df LFEF0DF clc fe/f0e0 rts fe/f0e1 tblLFEF0E1 dd1 $82 fe/f0e2 dd1 $00 fe/f0e3 dd1 $00 fe/f0e4 dd1 $00 fe/f0e5 dd1 $01 fe/f0e6 dd1 $01 fe/f0e7 dd1 $00 fe/f0e8 dd1 $00 fe/f0e9 dd1 $00 fe/f0ea dd1 $00 fe/f0eb dd1 $01 fe/f0ec dd1 $00 fe/f0ed dd1 $80 fe/f0ee dd1 $ff fe/f0ef dd1 $ff fe/f0f0 dd1 $00 fe/f0f1 dd1 $00 fe/f0f2 getModCallRef php fe/f0f3 phd fe/f0f4 rep #$30 fe/f0f6 phk fe/f0f7 jsr findModule fe/f0fa bcs @retsec fe/f0fc phk fe/f0fd jsr getOrCreateModCallBlock fe/f100 bcs @retsec fe/f102 tax fe/f103 sep #$20 rwid shortm fe/f105 ldal f:$000007,x ;increment module reference count by 1 fe/f109 inc A fe/f10a bne @ok fe/f10c cop COP_0F_OPERR ;panic if mod ref >= 255 fe/f10e zstr “Use Count Overflow” fe/f121 @ok stal f:bob_ll_irq_pri__psec,x fe/f125 rep #$20 rwid longm fe/f127 txa fe/f128 pld fe/f129 plp fe/f12a clc fe/f12b rtl fe/f12c @retsec pld fe/f12d plp fe/f12e sec fe/f12f rtl ; ; Entry: BHA is pointer to module name ; Y is either 0 or required version number ; ; Exit: CC for found, pointer to module list entry in X ; CS, X=-1 for not found fe/f130 findModule php fe/f131 phd fe/f132 rep #$30 fe/f134 pea $ffff ;this looks to be the return value, -1 means not found fe/f137 phy fe/f138 phb fe/f139 phb fe/f13a pha ;push BHA pointer fe/f13b pea B0LST_MODULES_QRY fe/f13e lda $03,S ;back off stacked BHA by 14 TODO:why not do this before pushing!? fe/f140 sec fe/f141 sbc #$000e fe/f144 sta $03,S fe/f146 lda $05,S fe/f148 sbc #$0000 fe/f14b sta $05,S fe/f14d @modsrchlp plx ;get back list pointer fe/f14e ldal f:bob_ll_irq_pri__next,x fe/f152 cmp #B0LST_MODULES_QRY fe/f155 beq @unstackExit ;if at head of list exit fe/f157 pha fe/f158 jsr getModCallBlock fe/f15b tax fe/f15c ldy #$000d fe/f15f @strmatchlp iny fe/f160 beq @modsrchlp fe/f162 tsc fe/f163 tcd fe/f164 lda [$03],y ;get character from stacked long BHA-14 pointer fe/f166 jsr checkValidModnameChar ;check it's a valid module name char fe/f169 phx fe/f16a pld ;point to current module name in list fe/f16b bcs @skend ;end of string fe/f16d eor [bob_ll_irq_pri__next],y ;check for equality fe/f16f and #$00df fe/f172 bne @modsrchlp ;no match, next module please fe/f174 bra @strmatchlp fe/f176 @skend lda [bob_ll_irq_pri__next],y ;we got to the end of the passed in string fe/f178 jsr checkValidModnameChar ;were we at the end of the module string? fe/f17b bcc @modsrchlp ;no, next module... fe/f17d lda $07,S ;retrieve passed in Y fe/f17f beq @checkVerGt fe/f181 ldy #$0006 fe/f184 lda [bob_ll_irq_pri__next],y ;get module version number fe/f186 cmp $07,S ;compare with passed in Y fe/f188 bne @modsrchlp ;doesn't match, next module fe/f18a @setWinner pla ;get back list entry pointer fe/f18b pha fe/f18c sta $09,S ;store in return value fe/f18e bra @modsrchlp ;keep going - why TODO: check if this happens, document? fe/f190 @checkVerGt lda $09,S ;get return value fe/f192 cmp #$ffff ;has it been set already? fe/f195 beq @setWinner ;if it hasn't set current as result fe/f197 jsr getModCallBlock fe/f19a tcd fe/f19b ldy #$0006 fe/f19e lda [bob_ll_irq_pri__next],y ;get winner's version fe/f1a0 pha ;save it fe/f1a1 lda $03,S ;get current module list entry fe/f1a3 jsr getModCallBlock ;get module pointer fe/f1a6 tcd fe/f1a7 lda [bob_ll_irq_pri__next],y ;get current module version number fe/f1a9 and #$00ff ;mask off low part?!?!? fe/f1ac cmp $01,S ;compare fe/f1ae pla ;discard pushed fe/f1af bcc @modsrchlp fe/f1b1 bra @setWinner fe/f1b3 @unstackExit pld fe/f1b4 pld fe/f1b5 pld fe/f1b6 pla fe/f1b7 cmp #$ffff ;check for winner fe/f1ba pld fe/f1bb bcs @retsec fe/f1bd plp fe/f1be clc fe/f1bf rtl fe/f1c0 @retsec plp fe/f1c1 sec fe/f1c2 rtl fe/f1c3 getModCallBlock phd fe/f1c4 clc fe/f1c5 adc #$0004 ;HA+=4 fe/f1c8 tcd ;DP=HA fe/f1c9 lda $02 ;HA=[DP,2] fe/f1cb and #$00ff fe/f1ce sec fe/f1cf bne @ret fe/f1d1 lda bob_ll_irq_pri__next fe/f1d3 tax fe/f1d4 clc fe/f1d5 adc #$0002 fe/f1d8 tcd fe/f1d9 clc fe/f1da @ret tdc fe/f1db pld fe/f1dc rts fe/f1dd getOrCreateModCallBlock jsr getModCallBlock fe/f1e0 bcc @retTxa fe/f1e2 phd fe/f1e3 tcd fe/f1e4 lda #HND_type_6_CBCO fe/f1e7 jsr allocB0B fe/f1ea bcs @ret fe/f1ec lda #$0000 fe/f1ef sep #$20 rwid shortm fe/f1f1 stal f:$000007,x ;refernce count fe/f1f5 rep #$20 rwid longm fe/f1f7 stal f:$000008,x ;QRY what is at offset 8 fe/f1fb phk dbank K (auto) fe/f1fc plb fe/f1fd lda templateModCallBlock & $ffff ;get phd, jsl opcodes fe/f200 stal f:bob_ll_irq_pri__next,x ;store at offset 0 fe/f204 lda 0+(templateModCallBlock & $ffff)+5 ;get pld, rtl opcodes fe/f207 stal f:$000005,x ;store at offset 5 fe/f20b lda $01 ;get program bank and high byte of module service fe/f20d stal f:$000003,x ;store at offset 3 fe/f211 lda bob_ll_irq_pri__next ;get 16 bit low address of module fe/f213 stal f:$000002,x ;store at offset 2 fe/f217 stz $01 fe/f219 stx bob_ll_irq_pri__next ;store DPX at 0 - QRY why? fe/f21b pld fe/f21c @retTxa txa fe/f21d @ret rtl ; This is a template module call that is copied to Bank 0 when a module is first ; referenced rwid shortm,shortx fe/f21e templateModCallBlock phd fe/f21f jsl bob_ll_irq_pri__next fe/f223 pld fe/f224 rtl fe/f225 brl findModuleByName_Q fe/f228 brl LFEF372 rwid longm,longx fe/f22b brlFindModuleByAddress brl findModuleByAddress fe/f22e LFEF22E brl LFEF2B7 fe/f231 findModuleByName_Q phd fe/f232 phx fe/f233 phy fe/f234 pea B0LST_MODULES_QRY fe/f237 pea $0000 fe/f23a pea $0000 fe/f23d phb fe/f23e pha fe/f23f phd fe/f240 phd fe/f241 tsc fe/f242 inc A fe/f243 tcd fe/f244 lda $0f fe/f246 bne LFEF24F fe/f248 ldx #B0LST_MODULES_QRY fe/f24b LFEF24B ldal f:bob_ll_irq_pri__next,x fe/f24f LFEF24F cmp #B0LST_MODULES_QRY fe/f252 beq LFEF293 fe/f254 tax fe/f255 phk fe/f256 jsr LFEF2B7 fe/f259 phk fe/f25a jsr LFEF2E7 fe/f25d bvs LFEF267 fe/f25f rol bob_ll_irq_pri__fpand fe/f261 ror bob_ll_irq_pri__fpand fe/f263 bne LFEF267 fe/f265 stx bob_ll_irq_sec__type fe/f267 LFEF267 bcs LFEF28F fe/f269 cpy #$0000 fe/f26c bne LFEF276 fe/f26e sta bob_ll_irq_pri__psec fe/f270 stx bob_ll_irq_pri__fpand fe/f272 sty bob_ll_irq_sec__type fe/f274 bra LFEF293 fe/f276 LFEF276 rol DPCOP_K fe/f278 ror DPCOP_K fe/f27a beq LFEF28F fe/f27c rol bob_ll_irq_pri__fpand fe/f27e ror bob_ll_irq_pri__fpand fe/f280 beq LFEF289 fe/f282 lda #$ffff fe/f285 sta bob_ll_irq_pri__fpand fe/f287 bra LFEF28F fe/f289 LFEF289 sta bob_ll_irq_pri__psec fe/f28b stx bob_ll_irq_pri__fpand fe/f28d sty bob_ll_irq_sec__type fe/f28f LFEF28F lda $0f fe/f291 beq LFEF24B fe/f293 LFEF293 lda bob_ll_irq_pri__fpand fe/f295 sec fe/f296 beq LFEF2A0 fe/f298 inc A fe/f299 beq LFEF29D fe/f29b bra LFEF29F fe/f29d LFEF29D stz bob_ll_irq_pri__fpand fe/f29f LFEF29F clc fe/f2a0 LFEF2A0 pld fe/f2a1 pld fe/f2a2 pla fe/f2a3 php fe/f2a4 clc fe/f2a5 adc $03,S fe/f2a7 bcc LFEF2AE fe/f2a9 plp fe/f2aa plx fe/f2ab inx fe/f2ac phx fe/f2ad php fe/f2ae LFEF2AE plp fe/f2af plb fe/f2b0 pld fe/f2b1 plx fe/f2b2 ply fe/f2b3 pld fe/f2b4 pld fe/f2b5 pld fe/f2b6 rtl fe/f2b7 LFEF2B7 phx fe/f2b8 ldal f:bob_ll_irq_sec__fphand,x fe/f2bc sta bob_ll_irq_pri__next fe/f2be sep #$20 rwid shortm fe/f2c0 ldal f:bob_ll_irq_pri__meor,x fe/f2c4 sta bob_ll_irq_pri__irqf fe/f2c6 rep #$20 rwid longm fe/f2c8 and #$00ff fe/f2cb sec fe/f2cc bne LFEF2E5 fe/f2ce ldal f:bob_ll_irq_sec__fphand,x fe/f2d2 tax fe/f2d3 ldal f:bob_ll_irq_pri__irqf,x fe/f2d7 sta bob_ll_irq_pri__next fe/f2d9 sep #$20 rwid shortm fe/f2db ldal f:bob_ll_irq_sec__fphand,x fe/f2df sta bob_ll_irq_pri__irqf fe/f2e1 rep #$20 rwid longm fe/f2e3 txa fe/f2e4 clc fe/f2e5 LFEF2E5 plx fe/f2e6 rtl fe/f2e7 LFEF2E7 ldy #$000e fe/f2ea jsr LFEF343 ; Action: This call checks a list of names to see if a specific name is present. ; If it is then the offset of the name from the start of the list is given in Y. ; ; On entry: The 4 byte address at D,0 points to the start of the name list. ; The 4 byte address at D,4 points to the name to be located. ; If Y = 0 then the slash "/" character is used as a delimiter. ; If Y <> 0 then the character whose ASCII code is in Y is used as ; a delimiter. ; On exit: If C = 0 then the name is in the list at offset Y from the start ; If C = 1 then the name is not in the list ; No registers preserved fe/f2ed doNameSearch phx fe/f2ee phy fe/f2ef ldx #$0000 fe/f2f2 txy fe/f2f3 LFEF2F3 inx fe/f2f4 dex fe/f2f5 bne LFEF2F9 fe/f2f7 sep #$40 fe/f2f9 LFEF2F9 lda [bob_ll_irq_pri__next],y fe/f2fb jsr LFEF4DE fe/f2fe bcs LFEF30A fe/f300 eor [bob_ll_irq_sec__fphand],y fe/f302 and #$00df fe/f305 bne LFEF317 fe/f307 iny fe/f308 bra LFEF2F9 fe/f30a LFEF30A lda [bob_ll_irq_sec__fphand],y fe/f30c jsr LFEF4DE fe/f30f bcc LFEF331 fe/f311 tya fe/f312 txy fe/f313 clc fe/f314 plx fe/f315 plx fe/f316 rtl fe/f317 LFEF317 lda [bob_ll_irq_sec__fphand],y fe/f319 jsr LFEF4DE fe/f31c bcs LFEF32C fe/f31e and #$00df fe/f321 pha fe/f322 lda [bob_ll_irq_pri__next],y fe/f324 and #$00df fe/f327 cmp $01,S fe/f329 pla fe/f32a bcs LFEF331 fe/f32c LFEF32C inx fe/f32d dex fe/f32e bne LFEF331 fe/f330 clv fe/f331 LFEF331 lda $01,S fe/f333 jsr LFEF35E fe/f336 cmp #$0000 fe/f339 beq LFEF33F fe/f33b inx fe/f33c inx fe/f33d bra LFEF2F3 fe/f33f LFEF33F sec fe/f340 plx fe/f341 plx fe/f342 rtl fe/f343 LFEF343 pha fe/f344 php fe/f345 tya fe/f346 clc fe/f347 adc bob_ll_irq_pri__next fe/f349 sta bob_ll_irq_pri__next fe/f34b sep #$20 rwid shortm fe/f34d lda #$00 fe/f34f adc bob_ll_irq_pri__irqf fe/f351 sta bob_ll_irq_pri__irqf fe/f353 rep #$20 rwid longm fe/f355 ldy #$0000 fe/f358 plp fe/f359 pla fe/f35a rts fe/f35b LFEF35B lda #$0000 fe/f35e LFEF35E pha fe/f35f bra LFEF362 fe/f361 LFEF361 iny fe/f362 LFEF362 lda [bob_ll_irq_pri__next],y fe/f364 jsr LFEF4DE fe/f367 bcc LFEF361 fe/f369 iny fe/f36a jsr LFEF343 fe/f36d ply fe/f36e ldy #$0000 fe/f371 rts rwid shortm,shortx fe/f372 LFEF372 php fe/f373 phd fe/f374 rep #$30 rwid longm,longx fe/f376 phb fe/f377 pha fe/f378 phb fe/f379 pha fe/f37a tsc fe/f37b inc A fe/f37c tcd fe/f37d ldy #$0000 fe/f380 jsr LFEF35B fe/f383 ldx #$0000 fe/f386 cmp #$002f fe/f389 bne LFEF3A4 fe/f38b pla fe/f38c plb fe/f38d phb fe/f38e pha fe/f38f ldx #$0000 fe/f392 ldy #$0000 fe/f395 phk fe/f396 jsr findModuleByName_Q fe/f399 bcc LFEF39E fe/f39b brl @reterrModNotFound fe/f39e LFEF39E txa fe/f39f bne LFEF3A4 fe/f3a1 brl @reterrCommandError fe/f3a4 LFEF3A4 jsr LFEF475 fe/f3a7 pla fe/f3a8 plb fe/f3a9 phb fe/f3aa pha fe/f3ab ldy #$0001 fe/f3ae phk fe/f3af jsr findModuleByName_Q fe/f3b2 bcc LFEF3B7 fe/f3b4 brl @retSev fe/f3b7 LFEF3B7 txa fe/f3b8 bne LFEF3BD fe/f3ba brl @reterrAmbiuousCommand fe/f3bd LFEF3BD phx fe/f3be phy fe/f3bf txa fe/f3c0 phk fe/f3c1 jsr getOrCreateModCallBlock fe/f3c4 ldy #$0000 fe/f3c7 jsr LFEF35B fe/f3ca cmp #$002f fe/f3cd bne LFEF3D2 fe/f3cf jsr LFEF35B fe/f3d2 LFEF3D2 lda bob_ll_irq_pri__next fe/f3d4 cmp #$0001 fe/f3d7 dec bob_ll_irq_pri__next fe/f3d9 bcs LFEF3E1 fe/f3db sep #$20 rwid shortm fe/f3dd dec bob_ll_irq_pri__irqf fe/f3df rep #$20 rwid longm fe/f3e1 LFEF3E1 ply fe/f3e2 plx fe/f3e3 lda [bob_ll_irq_pri__next] fe/f3e5 and #$00ff fe/f3e8 cmp #$0021 fe/f3eb bcs LFEF411 fe/f3ed pla fe/f3ee plb fe/f3ef phb fe/f3f0 pha fe/f3f1 phk fe/f3f2 pea LFEF40C & $ffff fe/f3f5 phb fe/f3f6 pha fe/f3f7 phk fe/f3f8 jsr LFEF2B7 fe/f3fb bcs @plaplberrCommandError fe/f3fd tax fe/f3fe sep #$20 rwid shortm fe/f400 lda #$00 fe/f402 sta $03,S fe/f404 rep #$20 rwid longm fe/f406 pla fe/f407 phx fe/f408 ldx #$0000 fe/f40b php fe/f40c LFEF40C rti rwid shortm,shortx fe/f40d rep #$30 rwid longm,longx fe/f40f bra LFEF459 fe/f411 LFEF411 jsr LFEF475 fe/f414 @retSev sep #$40 fe/f416 bra @popsandret fe/f418 @reterrModNotFound cop COP_26_OPBHA fe/f41a zstr “Module not found” fe/f42b bra @xeq1retsec fe/f42d @reterrAmbiuousCommand cop COP_26_OPBHA fe/f42f zstr “Ambiguous command” fe/f441 bra @xeq1retsec fe/f443 @plaplberrCommandError pla fe/f444 plb fe/f445 @reterrCommandError cop COP_26_OPBHA fe/f447 zstr “Command error” fe/f455 @xeq1retsec ldx #$0001 fe/f458 sec fe/f459 LFEF459 clv fe/f45a @popsandret pld fe/f45b pld fe/f45c pld fe/f45d pld fe/f45e bcc @retClcSev fe/f460 bvc @retsecclv fe/f462 plp fe/f463 sep #$41 fe/f465 rtl fe/f466 @retsecclv plp fe/f467 sec fe/f468 clv fe/f469 rtl fe/f46a @retClcSev bvc @retClcClv fe/f46c plp fe/f46d clc fe/f46e sep #$40 fe/f470 rtl fe/f471 @retClcClv plp fe/f472 clc fe/f473 clv fe/f474 rtl fe/f475 LFEF475 lda bob_ll_irq_sec__flags fe/f477 sta bob_ll_irq_pri__next fe/f479 sep #$20 rwid shortm fe/f47b lda bob_ll_irq_pri__mand fe/f47d sta bob_ll_irq_pri__irqf fe/f47f rep #$20 rwid longm fe/f481 rts fe/f482 findModuleByAddress phd fe/f483 phd fe/f484 phd fe/f485 phb fe/f486 phb fe/f487 pha fe/f488 phb fe/f489 pha fe/f48a tsc fe/f48b inc A fe/f48c tcd fe/f48d ldx #$fe0e rwid shortm fe/f490 LFEF490 rep #$20 rwid longm fe/f492 ldal f:bob_ll_irq_pri__next,x fe/f496 ldx #$0000 fe/f499 cmp #$fe0e fe/f49c beq LFEF4D6 fe/f49e tax fe/f49f phk fe/f4a0 jsr LFEF2B7 fe/f4a3 sep #$20 rwid shortm fe/f4a5 sec fe/f4a6 lda bob_ll_irq_sec__flags fe/f4a8 sbc bob_ll_irq_pri__next fe/f4aa sta bob_ll_irq_pri__psec fe/f4ac lda bob_ll_irq_sec__fphand fe/f4ae sbc bob_ll_irq_sec__dp fe/f4b0 sta DPCOP_DP fe/f4b2 lda bob_ll_irq_pri__mand fe/f4b4 sbc bob_ll_irq_pri__irqf fe/f4b6 sta bob_ll_irq_pri__fpand fe/f4b8 bcc LFEF490 fe/f4ba ldy #$0003 fe/f4bd lda [bob_ll_irq_pri__next],y fe/f4bf sbc bob_ll_irq_pri__psec fe/f4c1 iny fe/f4c2 lda [bob_ll_irq_pri__next],y fe/f4c4 sbc DPCOP_DP fe/f4c6 iny fe/f4c7 lda [bob_ll_irq_pri__next],y fe/f4c9 sbc bob_ll_irq_pri__fpand fe/f4cb bcc LFEF490 fe/f4cd rep #$20 rwid longm fe/f4cf ldy #$000e fe/f4d2 jsr LFEF343 fe/f4d5 clc fe/f4d6 LFEF4D6 pla fe/f4d7 plb fe/f4d8 pld fe/f4d9 pld fe/f4da pld fe/f4db pld fe/f4dc pld fe/f4dd rtl fe/f4de LFEF4DE and #$00ff fe/f4e1 pha fe/f4e2 lda $05,S fe/f4e4 cmp #$0001 fe/f4e7 pla fe/f4e8 bcc checkValidModnameChar fe/f4ea cmp #$0000 fe/f4ed beq LFEF4F5 fe/f4ef cmp $03,S fe/f4f1 beq LFEF4F5 fe/f4f3 clc fe/f4f4 rts fe/f4f5 LFEF4F5 sec fe/f4f6 rts ; Check if the character passed in A is in '!', '.', '0'..'9', 'A'..'Z', ; 'a'..'z' rwid shortm fe/f4f7 checkValidModnameChar php fe/f4f8 rep #$20 rwid longm fe/f4fa and #$00ff fe/f4fd cmp #‘{’ fe/f500 bcs @retsec fe/f502 cmp #‘a’ fe/f505 bcs @retCLC fe/f507 cmp #‘[’ fe/f50a bcs @retsec fe/f50c cmp #‘A’ fe/f50f bcs @retCLC fe/f511 cmp #‘:’ fe/f514 bcs @retsec fe/f516 cmp #‘0’ fe/f519 bcs @retCLC fe/f51b cmp #‘.’ fe/f51e beq @retCLC fe/f520 cmp #‘!’ fe/f523 beq @retCLC fe/f525 @retsec plp rwid shortm fe/f526 sec fe/f527 rts rwid longm fe/f528 @retCLC plp rwid shortm fe/f529 clc fe/f52a rts rwid shortx fe/f52b doErrorDepndOnX pha fe/f52c txa fe/f52d lsr A fe/f52e bcs @Sk fe/f530 pla fe/f531 cop COP_26_OPBHA fe/f533 zstr “Error” fe/f539 sec fe/f53a rtl fe/f53b @Sk pla fe/f53c sec fe/f53d rtl ******************************************************************************** * Given a Handle in Y returns details - QRY - what details * * * * On Entry: * * Y A file handle * * * * On Exit: * * C=0 The file handle was found * * V=1 if the file handle was an odd number QRY - access device control * * channel * * X pointer to filing system module entry point in B0 * * Y file handle with bottom bit cleared * * * * or C=1 The file handle was not found of not of type file * * X=1 * * BHA An error string * ******************************************************************************** rwid longm,longx fe/f53e getFileHandleInfo pha ;save through routine (unless there's an error) fe/f53f tya ;get bottom bit of Y into V and clear fe/f540 lsr A fe/f541 php fe/f542 asl A fe/f543 plp fe/f544 tay fe/f545 tax fe/f546 clv fe/f547 bcc @nosev fe/f549 sep #$40 ;set V here if an odd handle was used - indicates request to access device control channel ?QRY? fe/f54b @nosev cpx #$0100 ;check handle validity fe/f54e bcc @err_badHandle fe/f550 ldal f:B0B_offs_B_type,x ;get handle block type fe/f554 and #$00ff fe/f557 cmp #HND_type_10_CBHN ;check it's a file fe/f55a bne @err_unknown_handle fe/f55c ldal f:$000003,x ;get B0 FS entry trampoline address fe/f560 tax ;return in X fe/f561 pla ;restore A fe/f562 clc fe/f563 rtl fe/f564 @err_badHandle cop COP_26_OPBHA fe/f566 zstr “Bad handle (top byte zero)” fe/f581 bra @popXeq1retsec fe/f583 @err_unknown_handle cop COP_26_OPBHA fe/f585 zstr “Bad handle (not known)” fe/f59c @popXeq1retsec plx fe/f59d ldx #$0001 fe/f5a0 sec fe/f5a1 rtl fe/f5a2 doBGET phk fe/f5a3 jsr getFileHandleInfo fe/f5a6 bcs @ret fe/f5a8 phk fe/f5a9 per LFEFE64_anRTL-1 fe/f5ac pea $0000 dbank $00 fe/f5af plb fe/f5b0 dex fe/f5b1 phx ;push the module jump pointer - 1 suitable for the RTL fe/f5b2 ldx #__DVBGT fe/f5b5 bvc @ret fe/f5b7 ldx #__DVCGT ;control channel get fe/f5ba @ret rtl fe/f5bb doBPUT phk fe/f5bc jsr getFileHandleInfo fe/f5bf bcs @ret fe/f5c1 phk fe/f5c2 per LFEFE64_anRTL-1 ;the module will return to here - QRY check this out, seems a bit convoluted! fe/f5c5 pea $0000 fe/f5c8 plb fe/f5c9 dex fe/f5ca phx fe/f5cb ldx #__DVBPT ;BPUT to device fe/f5ce bvc @ret fe/f5d0 ldx #__DVCPT ;BPUT to device control channel fe/f5d3 @ret rtl fe/f5d4 CheckEOF phk fe/f5d5 jsr getFileHandleInfo fe/f5d8 bcs LFEF5E7 fe/f5da phk fe/f5db per LFEFE64_anRTL-1 fe/f5de pea $0000 fe/f5e1 plb fe/f5e2 dex fe/f5e3 phx fe/f5e4 ldx #__DVEOF fe/f5e7 LFEF5E7 rtl ; QRY - dead code? rwid shortm,shortx fe/f5e8 rtl ; QRY - dead code? rwid longm,longx fe/f5e9 pha fe/f5ea tya fe/f5eb and #$00ff fe/f5ee tay fe/f5ef pla fe/f5f0 phy fe/f5f1 ply fe/f5f2 bne doOPOPN_openFile fe/f5f4 pha fe/f5f5 pla fe/f5f6 bne @sk fe/f5f8 brl closeAllFiles fe/f5fb @sk tay fe/f5fc brl closeFile ******************************************************************************** * This is the main file open entry * * * * for entry / exit see OPOPN * ******************************************************************************** fe/f5ff doOPOPN_openFile phd fe/f600 tsx fe/f601 phd fe/f602 phd fe/f603 pea $0000 fe/f606 phd fe/f607 phd fe/f608 phd fe/f609 phd fe/f60a phy fe/f60b phb fe/f60c pha fe/f60d phx fe/f60e tsx fe/f60f phx fe/f610 pld fe/f611 phy ; stack DP ; ; +17 +16 DP (stack point A just below here) ; +16 +14 DP ; +14 +12 DP ; +12 +10 "$0000" ; +10 +E DP ; +E +C DP ; +C +A DP ; +A +8 DP ; +7 +6 Y (open mode) ; +5 +3 BHA filename pointer ; +3 +1 stack pointer (A) above ; +1 - Y (open mode) fe/f612 phk fe/f613 jsr getFSTrampolineFromprefix fe/f616 sty $14 ;store module type at DP,$14 fe/f618 ply ;restore Y fe/f619 bcs @errModuleNotFoundRestoreEnv fe/f61b sta $08 fe/f61d phb fe/f61e phb fe/f61f pla fe/f620 sta $0a ;store updated BHA (after :) at 8 fe/f622 dex fe/f623 stx DPCOP_PC+1 ;store module trampoline-1 (RTS entry) at C ; stack DP ; ; +16 +16 DP (stack point A just below here) ; +14 +14 FS Module code type bytes ; +12 +12 DP ; +10 +10 "$0000" ; +E +E DP ; +C +C FS trampoline address ; +B +B B of below ; +8 +8 BHA of remainder of filename ; +6 +6 Y (open mode) ; +3 +3 BHA filename pointer ; +1 +1 stack pointer (A) above fe/f625 phk fe/f626 per doOPOPN_continue-1 fe/f629 pea $0000 dbank $00 fe/f62c plb fe/f62d phx fe/f62e tya fe/f62f and #$00c0 fe/f632 tay fe/f633 lda $08 fe/f635 pei ($0a) fe/f637 plb fe/f638 plb ; stack DP ; ; +1C +16 DP (stack point A just below here) ; +1A +14 FS Module code type bytes ; +18 +12 DP ; +16 +10 "$0000" ; +14 +E DP ; +12 +C FS trampoline address -1 ; +F +B B of below ; +E +8 BHA of remainder of filename ; +C +6 Y (open mode) ; +9 +3 BHA filename pointer ; +7 +1 stack pointer (A) above ; +4 K,F695 address of continuation? ; +1 00,FS trampoline address -1 (ready to rtl to) ; ; fe/f639 ldx #__DVOPN fe/f63c rtl ;this will chain to FS operation 12 in module pushed above fe/f63d @clcRetYinA clc fe/f63e bra @retYinA fe/f640 @opbhaFileClosedByDriver cop COP_26_OPBHA fe/f642 zstr “File closed by driver” fe/f658 bra @retErrString fe/f65a @opbhaCouldntConfig cop COP_26_OPBHA fe/f65c zstr “Could not configure” fe/f670 bra @retErrString fe/f672 @errModuleNotFoundRestoreEnv cop COP_26_OPBHA fe/f674 zstr “Module not known” fe/f685 @retErrString ldx #$0001 rwid shortm,shortx fe/f688 @unstackAndError txy fe/f689 plx fe/f68a txs fe/f68b pld fe/f68c tyx fe/f68d brl doErrorDepndOnX rwid longm,longx fe/f690 @retYinA plx fe/f691 txs fe/f692 pld fe/f693 tya rwid shortm,shortx fe/f694 rtl ; stack DP ; ; +16 +16 DP (stack point A just below here) ; +14 +14 FS Module code type bytes ; +12 +12 DP ; +10 +10 "$0000" ; +E +E DP ; +C +C FS trampoline address -1 ; +B +B B of below ; +8 +8 BHA of remainder of filename ; +6 +6 Y (open mode) ; +3 +3 BHA filename pointer ; +1 +1 stack pointer (A) above ; ; This code is the return point from the doOPOPN_xxx function above ; ; Assume DP preserved across the FS call rwid longm,longx fe/f695 doOPOPN_continue bcs @unstackAndError fe/f697 sty $0e ;store handle fe/f699 lda #$0020 ;Bypass device configuration fe/f69c bit $06 ;check Y passed in to OPOPN fe/f69e bne @skipConfig fe/f6a0 lda $14 ;get FS code type bytes fe/f6a2 and #MHCFS ;is a filing system? fe/f6a5 bne @clcRetYinA ;yes return the handle... fe/f6a7 jsr configureDevice ;TODO: what goes on in here - looks to open a secondary device or something?! fe/f6aa bcs @opbhaCouldntConfig ; stack DP ; ; +16 +16 DP (stack point A just below here) ; +14 +14 FS Module code type bytes ; +12 +12 config handle - the configuration file handle ; +10 +10 "$0000" - if configure device called used as a pointer ; to "RAM:!C.<DEV>" ; +E +E File handle ; +C +C FS trampoline address -1 ; +B +B B of below ; +8 +8 BHA of remainder of filename ; +6 +6 Y (open mode) ; +3 +3 BHA filename pointer ; +1 +1 stack pointer (A) above ; ; This code is the return point from the doOPOPN_xxx function above ; ; Assume DP preserved across the FS call fe/f6ac @skipConfig pei ($0a) fe/f6ae plb fe/f6af plb fe/f6b0 lda $08 ;get back BHA fe/f6b2 phk fe/f6b3 jsr skipFileNameAndTrailingSpaces ;skip to next item after filename fe/f6b6 sta $08 fe/f6b8 phb fe/f6b9 phb fe/f6ba pla fe/f6bb sta $0a ;store updated BHA at DP,8 fe/f6bd bcs @atendofstring ; send characters after filename as control bytes ; multiple items separated by ";" fe/f6bf ldy #$0000 fe/f6c2 @lp2 lda [$08],y fe/f6c4 and #$00ff fe/f6c7 cmp #‘ ’ fe/f6ca bcc @atendofstring fe/f6cc cmp #‘;’ fe/f6cf bne LFEF6D4 fe/f6d1 lda #$000d fe/f6d4 LFEF6D4 phy fe/f6d5 jsr call_DVCPT fe/f6d8 ply fe/f6d9 iny fe/f6da bra @lp2 fe/f6dc @atendofstring jsr call_DVCPT_0D fe/f6df lda #‘;’ fe/f6e2 jsr call_DVCPT fe/f6e5 jsr call_DVCPT_0D fe/f6e8 jsr call_DVCGT fe/f6eb bcc @closedbyDrv1 fe/f6ed brl @clcRetYinA fe/f6f0 @closedbyDrv1 cop COP_45_OPCLS fe/f6f2 bcc @closedbyDrv2 rwid shortm,shortx fe/f6f4 brl @unstackAndError rwid longm,longx fe/f6f7 @closedbyDrv2 brl @opbhaFileClosedByDriver ; Allocate a string buffer and construct a string that contains ; ; "RAM:!C.<device name>" ; ; Use this to open a text file on the RAM disk containing configuration commands ; for the device being opened. Try to send those commands to the device's ; control channel to configure it fe/f6fa configureDevice phd fe/f6fb cop COP_10_OPADP fe/f6fd dd2 $0012 ;size to allocate - 18 bytes fe/f6ff pld fe/f700 bcs @freeex fe/f702 sta $10 ;store X/pointer at offset 10 (device ?QRY?) fe/f704 tax fe/f705 lda #$4152 ;TODO: encode as zstr "RAM:!C." fe/f708 stal f:bob_ll_irq_pri__next,x fe/f70c lda #$3a4d fe/f70f stal f:$000002,x fe/f713 lda #$4321 fe/f716 stal f:$000004,x fe/f71a lda #$002e fe/f71d stal f:$000006,x fe/f721 ldy #$0000 fe/f724 @lp lda [$03],y ;append the filepath before ":" to string above < 12 chars fe/f726 sep #$20 rwid shortm fe/f728 cmp #‘:’ fe/f72a bne @sk0 fe/f72c lda #$00 fe/f72e @sk0 stal f:$000007,x fe/f732 rep #$20 rwid longm fe/f734 beq @ok fe/f736 inx fe/f737 iny fe/f738 cpy #$000b fe/f73b bcs @freeex fe/f73d bra @lp fe/f73f @ok pea $0000 fe/f742 plb dbank $00 fe/f743 plb fe/f744 lda $10 ;get back pointer to device config file name fe/f746 ldy #$0060 fe/f749 phk fe/f74a jsr doOPOPN_openFile ;openDevice and skip configuration fe/f74d bcs @clcfreeex fe/f74f sty $12 ;store config file handle fe/f751 @cfgloop ldy $12 ;get back config file handle fe/f753 cop COP_0A_OPBGT ;BGET a byte of the config file fe/f755 bcs @configEof fe/f757 and #$00ff fe/f75a cmp #‘;’ fe/f75d bne @sendctl fe/f75f @skcomment cop COP_0A_OPBGT fe/f761 bcs @configEof fe/f763 and #$00ff fe/f766 cmp #$000d fe/f769 bne @skcomment fe/f76b bra @cfgloop fe/f76d @sendctl jsr call_DVCPT ;send the control byte to the device fe/f770 bra @cfgloop fe/f772 @configEof phk fe/f773 jsr closeFile fe/f776 jsr call_DVCPT_0D fe/f779 @clcfreeex clc fe/f77a @freeex php fe/f77b lda $10 fe/f77d beq @skfree fe/f77f cop COP_1A_OPFZB fe/f781 stz $10 fe/f783 @skfree plp fe/f784 rts fe/f785 call_DVCPT_0D lda #$000d fe/f788 call_DVCPT ldx #__DVCPT fe/f78b bra call_DV_atDP_C fe/f78d call_DVCGT ldx #__DVCGT fe/f790 call_DV_atDP_C phk fe/f791 per ldDP0Erts-1 fe/f794 pea $0000 fe/f797 plb fe/f798 pei ($0c) fe/f79a ldy $0e ;retrieve file handle fe/f79c rtl rwid shortm,shortx fe/f79d ldDP0Erts ldy $0e ;retrieve file handle fe/f79f rts rwid longm,longx fe/f7a0 closeFile phk fe/f7a1 jsr getFileHandleInfo fe/f7a4 bcs LFEF7B9 fe/f7a6 phk fe/f7a7 per LFEFE63_anRTL fe/f7aa pea $0000 fe/f7ad plb fe/f7ae dex fe/f7af phx ;TODO - QRY I think this here calls the filing system with op 14 fe/f7b0 lda #$0000 fe/f7b3 bvc LFEF7B6 fe/f7b5 inc A fe/f7b6 LFEF7B6 ldx #__DVCLS ;14 - DVCLS - close device/file fe/f7b9 LFEF7B9 rtl fe/f7ba closeAllFiles ldx #B0LST_OPEN_FILES fe/f7bd phx fe/f7be ldal f:bob_ll_irq_pri__next,x fe/f7c2 @lp cmp $01,S ;TODO: this could be a cmp #B0LST_OPEN_FILES instead and save the phx/plx fe/f7c4 beq @endoflist fe/f7c6 tax fe/f7c7 ldal f:bob_ll_irq_pri__next,x fe/f7cb pha ;next in list pointer, save fe/f7cc txy fe/f7cd iny fe/f7ce phk fe/f7cf jsr closeFile fe/f7d2 pla ;get back next pointer fe/f7d3 bra @lp fe/f7d5 @endoflist plx fe/f7d6 clc fe/f7d7 rtl rwid shortm,shortx fe/f7d8 skipSpacesBHA php fe/f7d9 rep #$30 rwid longm,longx fe/f7db phd fe/f7dc phy fe/f7dd bra @skst fe/f7df @lp jsr incBHA fe/f7e2 @skst phb fe/f7e3 pha fe/f7e4 ldy #$0000 fe/f7e7 lda ($01,S),y fe/f7e9 and #$00ff fe/f7ec tay fe/f7ed pla fe/f7ee plb fe/f7ef cpy #‘ ’ fe/f7f2 beq @lp fe/f7f4 bcs @retclcply fe/f7f6 sec fe/f7f7 bra @plyret fe/f7f9 @retclcply clc fe/f7fa @plyret ply fe/f7fb pld fe/f7fc bcs @retsec fe/f7fe plp fe/f7ff clc fe/f800 rtl fe/f801 @retsec plp fe/f802 sec fe/f803 rtl fe/f804 skipFileNameAndTrailingSpaces phd fe/f805 phy fe/f806 @lp phb fe/f807 pha fe/f808 ldy #$0000 fe/f80b lda ($01,S),y fe/f80d and #$00ff fe/f810 tay fe/f811 pla fe/f812 plb fe/f813 jsr incBHA fe/f816 cpy #‘ ’ fe/f819 beq @skspace fe/f81b bcs @lp fe/f81d sec fe/f81e bra @retplypld fe/f820 @skspace phk fe/f821 jsr skipSpacesBHA fe/f824 clc fe/f825 @retplypld ply fe/f826 pld fe/f827 rtl ; Finds or creates a module B0 trampoline based upon the prefix of the filename. ; Filenames must be prefixed with a module name or ":" for Net? QRY (check ; documentation) ; ; On Entry: ; BHA contains pointer to filename ; ; On Exit: ; C=1 success ; BHA points just after ":" ; X contains a block 0 module entry trampoline address ; Y contains the module code type bytes ; or C=0 ; BHA preserved ?QRY ; X ? fe/f828 getFSTrampolineFromprefix phd fe/f829 phy fe/f82a phb fe/f82b pha fe/f82c tsc fe/f82d tcd fe/f82e lda [$01] ;get char from BHA fe/f830 and #$00ff fe/f833 cmp #‘:’ fe/f836 beq @retNET fe/f838 ldy #$0000 fe/f83b @lp lda [$01],y fe/f83d and #$00ff fe/f840 cmp #‘!’ fe/f843 bcc @retNET fe/f845 cmp #‘:’ fe/f848 beq @cont fe/f84a iny fe/f84b bne @lp fe/f84d @retNET cop COP_26_OPBHA fe/f84f zstr “NET:” fe/f854 phk fe/f855 jsr getFSTrampolineFromprefix fe/f858 sty $04 ;return in Y fe/f85a bcs @retsec2 fe/f85c pla fe/f85d plb fe/f85e clc fe/f85f bra @retSev fe/f861 @cont pla ;reset BHA pointer as passed in fe/f862 plb fe/f863 phb fe/f864 pha fe/f865 ldx #$0000 fe/f868 ldy #$0002 fe/f86b cop COP_34_OPRMI ;get module code type fe/f86d bcs @retsec2 fe/f86f sta $04 ;store in saved Y fe/f871 and #$0060 ;TODO MHCDEV | MHCFS fe/f874 beq @retsec2 fe/f876 pla ;reset BHA as passed in fe/f877 plb fe/f878 ldx #$0000 fe/f87b ldy #$0000 fe/f87e phk fe/f87f jsr findModuleByName_Q fe/f882 bcs @retsec fe/f884 phb fe/f885 pha fe/f886 txa fe/f887 phk fe/f888 jsr getOrCreateModCallBlock fe/f88b bcs @retsec2 fe/f88d tax fe/f88e pla fe/f88f plb fe/f890 pha fe/f891 ldy #$0000 fe/f894 lda ($01,S),y fe/f896 and #$00ff fe/f899 eor #$003a fe/f89c cmp #$0001 fe/f89f pla fe/f8a0 bcs @retsec fe/f8a2 jsr incBHA ;step over terminating : fe/f8a5 clv fe/f8a6 clc fe/f8a7 bra @ret fe/f8a9 @retsec2 pla fe/f8aa plb fe/f8ab @retsec ldx #$0000 fe/f8ae sec fe/f8af @retSev sep #$40 fe/f8b1 @ret ply fe/f8b2 pld fe/f8b3 rtl ; TODO: this is a horrid way of doing BHA++ fe/f8b4 incBHA php fe/f8b5 rep #$20 fe/f8b7 phd fe/f8b8 phb fe/f8b9 pha fe/f8ba tsc fe/f8bb tcd fe/f8bc sep #$20 rwid shortm fe/f8be inc $01 fe/f8c0 bne @sk fe/f8c2 inc $02 fe/f8c4 bne @sk fe/f8c6 inc $03 fe/f8c8 @sk rep #$20 rwid longm fe/f8ca pla fe/f8cb plb fe/f8cc pld fe/f8cd plp fe/f8ce rts ; TODO: seemingly pointless dead code? rwid shortm,shortx fe/f8cf php fe/f8d0 phb fe/f8d1 pha fe/f8d2 pla fe/f8d3 plb fe/f8d4 plp fe/f8d5 rts fe/f8d6 phy fe/f8d7 tyx fe/f8d8 ldal f:bob_ll_irq_pri__next,x fe/f8dc cmp $01,S fe/f8de beq LFEF8E2 fe/f8e0 tax fe/f8e1 clc fe/f8e2 LFEF8E2 ply fe/f8e3 rts rwid longm,longx fe/f8e4 LFEF8E4 jsr allocB0B fe/f8e7 bcs LFEF8EC fe/f8e9 jsr LFEF8ED fe/f8ec LFEF8EC rts fe/f8ed LFEF8ED phx fe/f8ee phy fe/f8ef tyx fe/f8f0 jsr LFEF942 fe/f8f3 bcc LFEF91D fe/f8f5 brk $00 fe/f8f7 str “List header not found - serious error” fe/f91c dd1 $00 fe/f91d LFEF91D pla fe/f91e plx fe/f91f stal f:bob_ll_irq_pri__next,x fe/f923 txa fe/f924 tyx fe/f925 stal f:bob_ll_irq_pri__next,x fe/f929 tax fe/f92a clc fe/f92b rts fe/f92c LFEF92C jsr LFEF935 fe/f92f bcs LFEF934 fe/f931 jsr freeB0Block fe/f934 LFEF934 rts fe/f935 LFEF935 jsr LFEF942 fe/f938 bcs LFEF941 fe/f93a phx fe/f93b tyx fe/f93c stal f:bob_ll_irq_pri__next,x fe/f940 plx fe/f941 LFEF941 rts fe/f942 LFEF942 phx fe/f943 phy fe/f944 tya fe/f945 LFEF945 tax fe/f946 ldal f:bob_ll_irq_pri__next,x fe/f94a cmp $03,S fe/f94c beq LFEF956 fe/f94e cmp $01,S fe/f950 bne LFEF945 fe/f952 ply fe/f953 plx fe/f954 sec fe/f955 rts fe/f956 LFEF956 txy fe/f957 plx fe/f958 plx fe/f959 ldal f:bob_ll_irq_pri__next,x fe/f95d clc fe/f95e rts fe/f95f doOPSTAR rep #$30 fe/f961 cop COP_0E_OPCOM fe/f963 php ;TODO - bcc before all the pushing and popping! fe/f964 phb fe/f965 pha fe/f966 phx fe/f967 phy fe/f968 bcc @sk fe/f96a cop COP_61_OPERC fe/f96c ldx #$0000 fe/f96f cop COP_02_OPWRA fe/f971 cop COP_03_OPNLI fe/f973 sec fe/f974 @sk ply fe/f975 plx fe/f976 pla fe/f977 plb fe/f978 plp fe/f979 rts rwid shortm,shortx fe/f97a starDELETE cop COP_5B_OPDEL fe/f97c rts fe/f97d starRENAME cop COP_5C_OPREN fe/f97f rts fe/f980 starEX phd fe/f981 rep #$30 rwid longm,longx fe/f983 ldy #$ffff fe/f986 bra LFEF98E rwid shortm,shortx fe/f988 starCAT phd fe/f989 rep #$30 rwid longm,longx fe/f98b ldy #$0000 fe/f98e LFEF98E tsx fe/f98f pea $0000 fe/f992 pea $0000 fe/f995 phb fe/f996 phb fe/f997 pha fe/f998 phx fe/f999 phy fe/f99a cop COP_10_OPADP fe/f99c dd2 $0100 ;direct page size to allocate fe/f99e ply fe/f99f bcc LFEF9CA fe/f9a1 plx fe/f9a2 txs fe/f9a3 pld fe/f9a4 cop COP_26_OPBHA fe/f9a6 zstr “Failed to allocate direct page” fe/f9c5 ldx #$0001 fe/f9c8 sec fe/f9c9 rts fe/f9ca LFEF9CA tcd fe/f9cb sty bob_ll_irq_pri__next fe/f9cd lda $03,S fe/f9cf phk fe/f9d0 jsr skipSpacesBHA fe/f9d3 sta $03,S fe/f9d5 pea $0000 fe/f9d8 plb fe/f9d9 plb fe/f9da tsx fe/f9db inx fe/f9dc inx fe/f9dd inx fe/f9de phd fe/f9df lda #$000a fe/f9e2 clc fe/f9e3 adc $01,S fe/f9e5 sta $09,S fe/f9e7 txa fe/f9e8 plx fe/f9e9 cop COP_59_OPRCH fe/f9eb bcc LFEF9F0 fe/f9ed jmp LFEFAA1 fe/f9f0 LFEF9F0 ldx #$000d fe/f9f3 ldy #$000a fe/f9f6 jsr writeYcharsFromDPX fe/f9f9 lda #$0020 fe/f9fc cop COP_00_OPWRC fe/f9fe lda #$0028 fe/fa01 cop COP_00_OPWRC fe/fa03 lda bob_ll_irq_sec__type fe/fa05 and #$00ff fe/fa08 sta bob_ll_irq_pri__irqf fe/fa0a lda #$0064 fe/fa0d sta bob_ll_irq_sec__fphand fe/fa0f jsr LFEFB5F fe/fa12 lda #$000a fe/fa15 sta bob_ll_irq_sec__fphand fe/fa17 jsr LFEFB5F fe/fa1a lda #$0030 fe/fa1d clc fe/fa1e adc bob_ll_irq_pri__irqf fe/fa20 cop COP_00_OPWRC fe/fa22 lda #$0029 fe/fa25 cop COP_00_OPWRC fe/fa27 ldx #$0004 fe/fa2a jsr LFEFB79 fe/fa2d lda DPCOP_P fe/fa2f and #$00ff fe/fa32 bne LFEFA3E fe/fa34 cop COP_01_OPWRS fe/fa36 zstr “Owner” fe/fa3c bra LFEFA47 fe/fa3e LFEFA3E cop COP_01_OPWRS fe/fa40 zstr “Public” fe/fa47 LFEFA47 cop COP_03_OPNLI fe/fa49 ldx #$0017 fe/fa4c ldy #$0010 fe/fa4f jsr writeYcharsFromDPX fe/fa52 ldx #$0004 fe/fa55 jsr LFEFB79 fe/fa58 cop COP_01_OPWRS fe/fa5a zstr “Option ” fe/fa62 lda DPCOP_PC+1 fe/fa64 and #$0003 fe/fa67 asl A fe/fa68 tax fe/fa69 phk dbank K (auto) fe/fa6a plb fe/fa6b lda tblStrPtrOpts & $ffff,x fe/fa6e ldx #$0000 fe/fa71 cop COP_02_OPWRA fe/fa73 cop COP_03_OPNLI fe/fa75 cop COP_01_OPWRS fe/fa77 zstr “Dir. ” fe/fa7d ldx #$0027 fe/fa80 ldy #$000a fe/fa83 jsr writeYcharsFromDPX fe/fa86 ldx #$0005 fe/fa89 jsr LFEFB79 fe/fa8c cop COP_01_OPWRS fe/fa8e zstr “Lib. ” fe/fa94 ldx #$0031 fe/fa97 ldy #$000a fe/fa9a jsr writeYcharsFromDPX fe/fa9d cop COP_03_OPNLI fe/fa9f cop COP_03_OPNLI fe/faa1 LFEFAA1 plx fe/faa2 pla fe/faa3 plb fe/faa4 plb fe/faa5 sta bob_ll_irq_pri__irqf fe/faa7 pla fe/faa8 pla fe/faa9 ldy #$0008 fe/faac LFEFAAC pea $0000 fe/faaf dey fe/fab0 bne LFEFAAC fe/fab2 pea $000c fe/fab5 lda #$0001 fe/fab8 bit bob_ll_irq_pri__next fe/faba bpl LFEFABD fe/fabc inc A fe/fabd LFEFABD pha fe/fabe pea $0000 fe/fac1 phd fe/fac2 lda #$000a fe/fac5 clc fe/fac6 adc $01,S fe/fac8 sta $01,S fe/faca phb fe/facb phb fe/facc pei (bob_ll_irq_pri__irqf) fe/face phx fe/facf ldx #$0008 fe/fad2 lda #$00a0 fe/fad5 cop COP_06_OPOSB fe/fad7 stx bob_ll_irq_sec__fphand fe/fad9 ldx #$000a fe/fadc cop COP_06_OPOSB fe/fade txa fe/fadf sec fe/fae0 sbc bob_ll_irq_sec__fphand fe/fae2 sta bob_ll_irq_sec__fphand fe/fae4 sta bob_ll_irq_pri__meor fe/fae6 tsx fe/fae7 txa fe/fae8 inc A fe/fae9 inc A fe/faea inc A fe/faeb sta bob_ll_irq_pri__irqf fe/faed LFEFAED pea $0000 fe/faf0 plb fe/faf1 plb fe/faf2 cop COP_5A_OPRFN fe/faf4 bcc LFEFB08 fe/faf6 stx bob_ll_irq_pri__irqf fe/faf8 plx fe/faf9 txs fe/fafa ldx bob_ll_irq_pri__irqf fe/fafc phx fe/fafd phb fe/fafe pha fe/faff tdc fe/fb00 cop COP_1A_OPFZB fe/fb02 pla fe/fb03 plb fe/fb04 plx fe/fb05 pld fe/fb06 sec fe/fb07 rts fe/fb08 LFEFB08 pea $0000 fe/fb0b plb dbank $00 fe/fb0c plb fe/fb0d txy fe/fb0e bne LFEFB20 fe/fb10 ldx bob_ll_irq_sec__fphand fe/fb12 cpx bob_ll_irq_pri__meor fe/fb14 beq LFEFB18 fe/fb16 cop COP_03_OPNLI fe/fb18 LFEFB18 tdc fe/fb19 cop COP_1A_OPFZB fe/fb1b plx fe/fb1c txs fe/fb1d pld fe/fb1e clc fe/fb1f rts fe/fb20 LFEFB20 ldx #$0000 fe/fb23 LFEFB23 lda #$0014 fe/fb26 sta DPCOP_DP fe/fb28 sep #$20 rwid shortm fe/fb2a LFEFB2A lda DPCOP_P,x fe/fb2c beq LFEFB35 fe/fb2e inx fe/fb2f cop COP_00_OPWRC fe/fb31 dec DPCOP_DP fe/fb33 bra LFEFB2A fe/fb35 LFEFB35 inx fe/fb36 bit bob_ll_irq_pri__next fe/fb38 bmi LFEFB54 fe/fb3a lda bob_ll_irq_pri__meor fe/fb3c sec fe/fb3d sbc #$14 fe/fb3f sta bob_ll_irq_pri__meor fe/fb41 bcc LFEFB50 fe/fb43 phx fe/fb44 ldx DPCOP_DP fe/fb46 rep #$30 rwid longm fe/fb48 jsr LFEFB79 fe/fb4b sep #$20 rwid shortm fe/fb4d plx fe/fb4e bra LFEFB56 fe/fb50 LFEFB50 lda bob_ll_irq_sec__fphand fe/fb52 sta bob_ll_irq_pri__meor fe/fb54 LFEFB54 cop COP_03_OPNLI fe/fb56 LFEFB56 rep #$30 rwid longm fe/fb58 dey fe/fb59 bne LFEFB23 fe/fb5b lda bob_ll_irq_pri__irqf fe/fb5d bra LFEFAED fe/fb5f LFEFB5F stz bob_ll_irq_pri__meor fe/fb61 lda bob_ll_irq_pri__irqf fe/fb63 sec fe/fb64 LFEFB64 sbc bob_ll_irq_sec__fphand fe/fb66 bcc LFEFB6C fe/fb68 inc bob_ll_irq_pri__meor fe/fb6a bra LFEFB64 fe/fb6c LFEFB6C adc bob_ll_irq_sec__fphand fe/fb6e sta bob_ll_irq_pri__irqf fe/fb70 clc fe/fb71 lda #$0030 fe/fb74 adc bob_ll_irq_pri__meor fe/fb76 cop COP_00_OPWRC fe/fb78 rts fe/fb79 LFEFB79 txa fe/fb7a beq LFEFB84 fe/fb7c lda #$0020 fe/fb7f LFEFB7F cop COP_00_OPWRC fe/fb81 dex fe/fb82 bne LFEFB7F fe/fb84 LFEFB84 rts fe/fb85 writeYcharsFromDPX pea $0000 fe/fb88 plb dbank $00 fe/fb89 plb fe/fb8a lda bob_ll_irq_pri__next,x fe/fb8c cop COP_00_OPWRC fe/fb8e inx fe/fb8f dey fe/fb90 bne writeYcharsFromDPX fe/fb92 rts fe/fb93 tblStrPtrOpts dd2 strOff & $ffff fe/fb95 dd2 strLoad & $ffff fe/fb97 dd2 strRun & $ffff fe/fb99 dd2 strExec & $ffff fe/fb9b strOff zstr “00 (Off)” fe/fba4 strLoad zstr “01 (Load)” fe/fbae strRun zstr “02 (Run)” fe/fbb7 strExec zstr “03 (Exec)” ; TODO - dead code? rwid shortm,shortx fe/fbc1 rts ******************************************************************************** * Main interrupt handler * * * * This (after preserving some registers) sets up an IRQ handler stack then * * scans through the priority list of registered IRQ handlers calling ones * * which have a pending irq (detected by using their registered hardware * * address and masks) * ******************************************************************************** fe/fbc2 default_IVIRQ rep #$30 ; Stack ; +2..4 rti return address ; +1 Caller flags rwid longm,longx fe/fbc4 phb fe/fbc5 pha fe/fbc6 phx ; Stack ; +7..8 rti return address ; +6 Caller flags ; +5 Caller B ; +3..4 Caller A (16bit) ; +1..2 Caller X ; This is the exit stack should there be no stack swap below fe/fbc7 ldal f:B0_IRQ_STACK ;get interrupt stack fe/fbcb beq @nos ;if 0 then we're already running from that stack TODO: hopefully! check in Mame fe/fbcd tsx ;X = current stack fe/fbce tcs ;set up new interrupt stack fe/fbcf phk ;push long address of stack restore code fe/fbd0 per @restoreOrgStack fe/fbd3 pea $0400 ;push phoney flags (0x04) and bank to be discarded in restore fe/fbd6 pha ;push A (contains stack top) fe/fbd7 phx ;push X (original stack) fe/fbd8 lda #$0000 fe/fbdb stal f:B0_IRQ_STACK ; IRQ private Stack ; +7..9 far rti address to @restoreOrgStack ; +6 flags = 04 ; +5 bank = 00 ; +3..4 B0_IRQ_STACK contents - IRQ private stack pointer ; +1..2 Caller stack pointer (16) ; This is the exit stack after a stack swap fe/fbdf @nos phd fe/fbe0 phy fe/fbe1 pea B0LL_IRQ_BLOCKS ;point at list head in B0 rwid shortm,shortx fe/fbe4 @lp2 sep #$30 fe/fbe6 pld ;pop list header address or previous primary block fe/fbe7 @lp pei (bob_ll_irq_pri__next) ;get address of next item fe/fbe9 pld ;into DP fe/fbea lda [bob_ll_irq_pri__irqf] ;read hardware test register into A fe/fbec tay ;into Y fe/fbed and [bob_ll_irq_pri__fpand] ;and with pointer AND mask fe/fbef eor bob_ll_irq_pri__meor ;eor with mask fe/fbf1 and bob_ll_irq_pri__mand ;and with other AND mask fe/fbf3 beq @lp fe/fbf5 phd ;push block primary pointer to stack - if handler returns with CS this is used to continue the loop fe/fbf6 phk ;push program bank fe/fbf7 pea 0+(@interruptExit & $ffff)-1 ;and address of an rti fe/fbfa pei (bob_ll_irq_pri__psec) ;address of secondary irq block fe/fbfc pld ;into DP fe/fbfd inc bob_ll_irq_sec__hitct fe/fbff bne @skinccy fe/fc01 inc bob_ll_irq_sec__hitct+1 fe/fc03 bne @skinccy fe/fc05 inc bob_ll_irq_sec__hitct+2 fe/fc07 bne @skinccy fe/fc09 inc bob_ll_irq_sec__hitct+3 fe/fc0b @skinccy pei (bob_ll_irq_sec__fphand+1) ;push handler K,PCH fe/fc0d pei (bob_ll_irq_sec__flags) ;push handler P, PCL fe/fc0f pei (bob_ll_irq_sec__dp) ;get handler DP fe/fc11 pld fe/fc12 rti fe/fc13 @interruptExit bcs @lp2 ;if Cy set at handler exit continue with other handlers fe/fc15 pld ;discard stacked block pointer fe/fc16 rep #$30 rwid longm,longx fe/fc18 ply ;restore all stacked stuff and RTI from vector fe/fc19 pld ; Depending on whether a stack swap occurred this will pop the caller ; registers and do and RTI _OR_ if there was a stack swap will set ; X = Caller's stack pointer ; A = top of IRQ stack (original contents of B0_IRQ_STACK) ; B = 0 ; RTI will jump to @restoreOrgStack fe/fc1a plx fe/fc1b pla fe/fc1c plb fe/fc1d rti rwid shortm,shortx fe/fc1e @restoreOrgStack stal f:B0_IRQ_STACK ;restore irq stack address fe/fc22 txs ;restore original stack fe/fc23 plx ;exit to outer vector fe/fc24 pla fe/fc25 plb fe/fc26 rti ******************************************************************************** * COP 2F - OPIIQ - Add interrupt handler * * * * Action: This call is used to add a device's interrupt service to the list of * * such services maintained by the operating system. * * * * On entry: * * Inline 3 byte hardware address of the device which requires * * servicing's status register. * * Inline 1 byte EOR mask, allowing inversion of bits to the correct * * logic level if necessary. * * BHA points to the start address of the interrupt routine. * * X contains an AND mask to discriminate between different devices * * causing interrupts. (X must be set to zero if a call to OPMIQ is * * required.) * * Y contains the priority (range 1 to 255). This will be the * * position within the list of devices which the new entry will * * occupy. * * The lower the value the higher the priority. * * DP is set to the direct page required whilst in the interrupt * * routine. * * P flags are set to give the mode required in the interrupt routine. * * (The operating system sets the I flag.) * * On exit: If C = O then the call succeeded. Y = handle and HA = handle. * * If C = 1 then the call failed. Y = 0 and HA = O. * * No registers preserved * ******************************************************************************** rwid longm,longx fe/fc27 COP_2F cpy #$0000 fe/fc2a bne @YnZ fe/fc2c ldal f:B0LL_IRQ_BLOCKS fe/fc30 beq @YnZ fe/fc32 brl @retSec fe/fc35 @YnZ lda #B0B_TYPE_LL_IRQ fe/fc38 jsr allocB0B fe/fc3b bcc @skok1 fe/fc3d brl @retSec fe/fc40 @skok1 phx fe/fc41 lda #B0B_TYPE_LL_IRQ fe/fc44 jsr allocB0B fe/fc47 bcc @skok2 fe/fc49 brl @retSec2 fe/fc4c @skok2 sep #$20 ; set secondary block contents first rwid shortm fe/fc4e lda DPCOP_Y fe/fc50 stal f:bob_ll_irq_sec__prior,x fe/fc54 lda DPCOP_P fe/fc56 ora #$04 ;ensure interrupt flags are set, rest of flags will be as P on entry fe/fc58 stal f:bob_ll_irq_sec__flags,x fe/fc5c rep #$20 rwid longm fe/fc5e lda DPCOP_AH+1 fe/fc60 stal f:bob_ll_irq_sec__fphand+1,x fe/fc64 lda DPCOP_AH fe/fc66 stal f:bob_ll_irq_sec__fphand,x fe/fc6a lda DPCOP_DP fe/fc6c stal f:bob_ll_irq_sec__dp,x fe/fc70 lda #$0000 fe/fc73 stal f:bob_ll_irq_sec__hitct,x fe/fc77 stal f:bob_ll_irq_sec__hitct+2,x fe/fc7b txa fe/fc7c plx fe/fc7d stal f:bob_ll_irq_pri__psec,x fe/fc81 ldy #$0001 fe/fc84 lda [bob_ll_irq_sec__type],y fe/fc86 stal f:bob_ll_irq_pri__irqf,x fe/fc8a iny fe/fc8b lda [bob_ll_irq_sec__type],y fe/fc8d stal f:bob_ll_irq_pri__irqf+1,x ;default the pointer to and to point at FF fe/fc91 sep #$20 rwid shortm fe/fc93 iny fe/fc94 iny fe/fc95 lda [bob_ll_irq_sec__type],y fe/fc97 stal f:bob_ll_irq_pri__meor,x fe/fc9b lda bob_ll_irq_sec__flags fe/fc9d stal f:bob_ll_irq_pri__mand,x fe/fca1 rep #$20 rwid longm fe/fca3 lda #LFD06_anFF & $ffff fe/fca6 stal f:bob_ll_irq_pri__fpand,x fe/fcaa sep #$20 rwid shortm fe/fcac phk fe/fcad pla fe/fcae stal f:bob_ll_irq_pri__fpand+2,x fe/fcb2 rep #$20 rwid longm fe/fcb4 pea $0000 fe/fcb7 plb dbank $00 fe/fcb8 plb fe/fcb9 pei (DPCOP_Y) ;push original Y parameter fe/fcbb phd ;push DP of COP handler stack frame fe/fcbc php ;push current flags/mode fe/fcbd sei ;disable interrupts fe/fcbe phx ;push X of 1st IRQ handler block fe/fcbf pea B0LL_IRQ_BLOCKS ;push address of IRQ list head fe/fcc2 pld ;make that DP fe/fcc3 @lp phd ; stack ; +8 Y param (priority) ; +6 COP frame ; +5 flags/mode ; +3 pointer to IQ block ; +1 next entry pointer fe/fcc4 lda bob_ll_irq_pri__next ;get pointer at offset 0 (next item) fe/fcc6 beq @skdone ;if 0 exit fe/fcc8 tcd ;make DP point at it fe/fcc9 lda (bob_ll_irq_pri__psec) ;get the interrupt priority from the 1st byte of the second block fe/fccb and #$00ff fe/fcce cmp $08,S ;compare with stacked Y parameters fe/fcd0 pla fe/fcd1 bcs @lp ;if current entry higher or same priority loop fe/fcd3 pha fe/fcd4 tdc ; we're now at a point in the list that is lower priority - insert here, or at ; the end ; ; stack ; +8 Y param (priority) ; +6 COP frame ; +5 flags/mode ; +3 pointer to IQ block ; +1 address of pointer to current entry (or B0LST_IRQ_HANDLER) ; ; A points at current entry or zero if end of list fe/fcd5 @skdone pld fe/fcd6 plx fe/fcd7 stal f:bob_ll_irq_pri__next,x ;store pointer to new entry at next pointer fe/fcdb txa fe/fcdc sta bob_ll_irq_pri__next ;update previous item's (or list front) to point at new entry fe/fcde plp fe/fcdf pld fe/fce0 plx ;discard stacked Y (priority) fe/fce1 tax fe/fce2 jsr allocHandle ;allocate a handle fe/fce5 sty bob_ll_irq_sec__dp ;return in Y fe/fce7 bcc @retY ;success fe/fce9 phx ;fail, save X (pointer to 1st block) fe/fcea ldal f:bob_ll_irq_pri__psec,x ;get second block fe/fcee tax fe/fcef jsr freeB0Block ;free second block fe/fcf2 @retSec2 plx ;pop pointer to 1st block fe/fcf3 jsr freeB0Block ;free 1st block fe/fcf6 @retSec sec ;return fail fe/fcf7 stz bob_ll_irq_sec__dp ;zero Y fe/fcf9 @retY lda bob_ll_irq_sec__dp fe/fcfb sta bob_ll_irq_pri__mand fe/fcfd inc bob_ll_irq_sec__type ;step over the immediate parameters fe/fcff inc bob_ll_irq_sec__type fe/fd01 inc bob_ll_irq_sec__type fe/fd03 inc bob_ll_irq_sec__type fe/fd05 rtl fe/fd06 LFD06_anFF dd1 $ff ******************************************************************************** * COP 31 - OPMIQ - Modify interrupt intercept * * * * Action: This call allows the modification of the address of the AND mask (by * * default set to a location containing &FF), and the value of the AND mask * * contained in X. (X should be set to zero by OPIIQ before using OPMIQ. OPMIQ * * is then used to specify the required mask.) * * * * On entry: Y = handle returned by OPIIQ. * * BHA = 0 means do not modify the address of the AND mask. * * BHA <> 0 means BHA is the new address of the AND mask. * * X = 0 means do not modify the AND mask. * * X <> 0 means X is the new AND mask. * * On exit: C = 0 means that the interrupt intercept was modified. * * C = 1 means that the interrupt intercept was not modified. * * No registers preserved * ******************************************************************************** fe/fd07 COP_31 jsr getHandleYtoX ;look up handle fe/fd0a bcs @retsec ;fail fe/fd0c phx ;save pointer to 1st block fe/fd0d ldal f:bob_ll_irq_pri__psec,x ;get second block pointer fe/fd11 tax ;put it in X fe/fd12 ldal f:bob_ll_irq_sec__type,x ;get type byte in to AH fe/fd16 plx ;get back 1st block pointer fe/fd17 and #$00ff ;mask off type fe/fd1a cmp #B0B_TYPE_LL_IRQ ;check that this is correct type fe/fd1d bne @retsec ;fail fe/fd1f lda bob_ll_irq_pri__meor fe/fd21 ora bob_ll_irq_pri__mand ;Z will be set if passed in BHA = 0 fe/fd23 php ;save mode before disable interrupts fe/fd24 sei ;disable interrupts fe/fd25 beq @sk ;skip forward for BHA=0 fe/fd27 lda DPCOP_AH+1 ;update address of AND mask to BHA fe/fd29 stal f:bob_ll_irq_pri__fpand+1,x fe/fd2d lda DPCOP_AH fe/fd2f stal f:bob_ll_irq_pri__fpand,x fe/fd33 @sk lda DPCOP_X fe/fd35 beq @plpretclc fe/fd37 sep #$20 rwid shortm fe/fd39 stal f:bob_ll_irq_pri__mand,x ;store updated AND mask fe/fd3d rep #$20 rwid longm fe/fd3f @plpretclc plp fe/fd40 clc fe/fd41 rtl fe/fd42 @retsec sec fe/fd43 rtl ******************************************************************************** * COP 30 - OPRIQ - release interrupt * * * * Action: This call removes the specified interrupt service from the list * * * * On entry: Y = handle returned by OPIIQ. * * On exit: C = 0 means that the call released the interrupt intercept. * * C = 1 means that the call failed to release the interrupt * * intercept * * No registers preserved * ******************************************************************************** fe/fd44 COP_30 jsr getHandleYtoX ;get block address from handle fe/fd47 bcs @retsec fe/fd49 phx ;save X fe/fd4a php ;save mode before disable interrupts fe/fd4b sei fe/fd4c ldal f:bob_ll_irq_pri__next,x ;get address of next lower priority interrupt handler fe/fd50 pha ;save it fe/fd51 lda #B0LL_IRQ_BLOCKS ;get address of front of priority list in A fe/fd54 @lp tax ;X=A fe/fd55 ldal f:bob_ll_irq_pri__next,x ;get address of next item in list fe/fd59 beq @retsk ;end of queue fe/fd5b cmp $04,S ;is this the item being removed fe/fd5d bne @lp ;not keep looking fe/fd5f pla ;get address of item following the one being removed fe/fd60 stal f:bob_ll_irq_pri__next,x ;store in the previous item's next pointer (or front of list) fe/fd64 plp ;restore interrupt state fe/fd65 plx ;get back X fe/fd66 jsr freeHandleForB0BlockX ;free the handle for this block (TODO: why not use Y to index here?)P fe/fd69 phx ;save X fe/fd6a ldal f:bob_ll_irq_pri__psec,x ;get pointer to secondary block fe/fd6e tax fe/fd6f jsr freeB0Block ;free secondary block fe/fd72 plx ;get back address of primary block fe/fd73 jsr freeB0Block ;free it fe/fd76 clc ;indicate success fe/fd77 rtl fe/fd78 @retsk plp ;TODO: this is a failure route - I think it should SEC here? fe/fd79 pld fe/fd7a pld fe/fd7b @retsec rtl rwid shortm,shortx fe/fd7c setupIRQstackandhandlers php fe/fd7d rep #$30 rwid longm,longx fe/fd7f phd fe/fd80 phb fe/fd81 cop COP_13_OPAST ;allocate a stack fe/fd83 dd2 $0100 ;stack size fe/fd85 @lockup bcs @lockup ;if carry set here lock up the machine ! fe/fd87 stal f:B0_IRQ_STACK fe/fd8b lda #$0000 fe/fd8e stal f:B0LL_IRQ_BLOCKS fe/fd92 phk dbank K (auto) fe/fd93 plb fe/fd94 sep #$30 rwid shortm,shortx fe/fd96 lda #>irqh_catchall fe/fd98 xba fe/fd99 lda #<irqh_catchall fe/fd9b ldx #$ff fe/fd9d ldy #$00 fe/fd9f pea DPSYS fe/fda2 pld fe/fda3 cop COP_2F_OPIIQ ;set up a catch-all IRQ handler with lowest priority fe/fda5 dd3 $00ffff ;device address fe/fda8 dd1 $00 ;device eor mask fe/fda9 lda #>irqh_ula_rtc fe/fdab xba fe/fdac lda #<irqh_ula_rtc fe/fdae ldy #$21 ;rtc priority fe/fdb0 jsr OPIIQ_ULA_IRQ fe/fdb3 ldx #$08 ;real time clock interrupt mask fe/fdb5 jsr OPMIQ_ULA_IRQ ;also mask with SYSVAR_ELK_ULA_IE fe/fdb8 lda #>irqh_vsync fe/fdba xba fe/fdbb lda #<irqh_vsync fe/fdbd ldy #$20 ;vsync priority fe/fdbf jsr OPIIQ_ULA_IRQ fe/fdc2 ldx #$04 ;vsync interrupt mask fe/fdc4 jsr OPMIQ_ULA_IRQ ;also mask with SYSVAR_ELK_ULA_IE fe/fdc7 lda #>irqh_via_cb1 fe/fdc9 xba fe/fdca lda #<irqh_via_cb1 fe/fdcc phk dbank K (auto) fe/fdcd plb fe/fdce ldx #$00 fe/fdd0 ldy #$10 ;priority fe/fdd2 pea DPSYS fe/fdd5 pld fe/fdd6 cop COP_2F_OPIIQ fe/fdd8 dd3 VIA_IFR fe/fddb dd1 $00 fe/fddc ldx #$10 ;via_cb1 fe/fdde pea $4200 ;TODO: set to >VIA base fe/fde1 plb fe/fde2 plb fe/fde3 lda #>VIA_IER fe/fde5 xba fe/fde6 lda #<VIA_IER fe/fde8 cop COP_31_OPMIQ fe/fdea plb fe/fdeb pld fe/fdec plp fe/fded rts fe/fdee OPMIQ_ULA_IRQ pea $0000 dbank $00 fe/fdf1 plb fe/fdf2 plb fe/fdf3 lda #>SYSVAR_ELK_ULA_IE fe/fdf5 xba fe/fdf6 lda #<SYSVAR_ELK_ULA_IE fe/fdf8 cop COP_31_OPMIQ fe/fdfa rts fe/fdfb OPIIQ_ULA_IRQ phk dbank K (auto) fe/fdfc plb fe/fdfd ldx #$00 fe/fdff pea DPSYS fe/fe02 pld fe/fe03 cop COP_2F_OPIIQ fe/fe05 dd3 sheila_ULA_IRQ_CTL fe/fe08 dd1 $00 fe/fe09 rts rwid longm,longx fe/fe0a LFEFE0A cop COP_26_OPBHA fe/fe0c zstr “VDU” fe/fe10 ldx #DPSYS_MOD_VDU-$ac00 fe/fe13 ldy #$0000 fe/fe16 cop COP_29_OPRFR fe/fe18 cop COP_26_OPBHA fe/fe1a zstr “NET” fe/fe1e ldx #DPSYS_MOD_NET-$ac00 fe/fe21 ldy #$0000 fe/fe24 cop COP_29_OPRFR fe/fe26 cop COP_26_OPBHA fe/fe28 zstr “ECONET” fe/fe2f ldx #DPSYS_MOD_ECONET-$ac00 fe/fe32 ldy #$0000 fe/fe35 cop COP_29_OPRFR fe/fe37 rts rwid shortm,shortx fe/fe38 callModVDU php fe/fe39 phd fe/fe3a phk fe/fe3b jsr _callModVduInt fe/fe3e pld fe/fe3f plp fe/fe40 rtl fe/fe41 _callModVduInt pea DPSYS fe/fe44 pld fe/fe45 pei (<DPSYS_MOD_VDU+4) fe/fe47 pei (<DPSYS_MOD_VDU+2) fe/fe49 pei (<DPSYS_MOD_VDU) fe/fe4b rtl rwid longm,longx fe/fe4c _callModNetwork pei (<DPSYS_MOD_NET+4) fe/fe4e pei (<DPSYS_MOD_NET+2) fe/fe50 pei (<DPSYS_MOD_NET) fe/fe52 rtl fe/fe53 _callModEconet pei (<DPSYS_MOD_ECONET+4) fe/fe55 pei (<DPSYS_MOD_ECONET+2) fe/fe57 pei (<DPSYS_MOD_ECONET) fe/fe59 pei (<DPSYS_DP_ECO) fe/fe5b pld fe/fe5c rtl rwid shortm,shortx fe/fe5d default__KB pei (<DPSYS_DP_KEYBOARD+4) fe/fe5f pei (<DPSYS_DP_KEYBOARD+2) fe/fe61 pei (<DPSYS_DP_KEYBOARD) fe/fe63 LFEFE63_anRTL rtl fe/fe64 LFEFE64_anRTL rtl ;This is where module calls return to by default fe/fe65 dd2 $7966 ;checksum TODO - generate post assemble fe/fe67 fill 153,$ff ;padding TODO - remove adrend ↑ $feae00