2018-01-19 07:14:38 +00:00
|
|
|
|
NEW
|
2019-05-25 21:24:07 +02:00
|
|
|
|
AUTO 3,1
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2018-07-20 07:43:11 +02:00
|
|
|
|
* LoadLib
|
2017-08-24 14:46:48 +02:00
|
|
|
|
* in :
|
2019-07-22 08:31:01 +02:00
|
|
|
|
* Y,A = PTR To "LibName" C-String
|
2017-08-24 14:46:48 +02:00
|
|
|
|
* out :
|
|
|
|
|
* A = hMem To loaded LIB
|
|
|
|
|
*--------------------------------------
|
2020-09-25 14:05:23 +02:00
|
|
|
|
K.LoadLib jsr PS.Find.LIB
|
2021-01-12 22:14:13 +01:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2019-07-24 17:17:08 +02:00
|
|
|
|
jsr BIN.Load K.Buf256 = "/PATH/BIN"
|
2021-01-12 22:14:13 +01:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-08-25 17:02:16 +02:00
|
|
|
|
>STYA .1+1
|
2019-02-03 21:58:26 +00:00
|
|
|
|
|
2017-08-24 14:46:48 +02:00
|
|
|
|
txa Pass hLib to LibLoad
|
2021-01-12 22:14:13 +01:00
|
|
|
|
pha
|
2017-08-24 14:46:48 +02:00
|
|
|
|
ldx #LIBMGR.LOAD
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2019-02-03 21:58:26 +00:00
|
|
|
|
.1 jsr $ffff SELF MODIFIED, Call LIB.LOAD function
|
2017-08-24 14:46:48 +02:00
|
|
|
|
|
2021-01-12 22:14:13 +01:00
|
|
|
|
plx
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
jsr K.FreeMem
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 txa
|
2019-02-03 21:58:26 +00:00
|
|
|
|
* clc
|
2021-01-12 22:14:13 +01:00
|
|
|
|
.99 rts
|
2017-08-24 14:46:48 +02:00
|
|
|
|
*--------------------------------------
|
2018-07-20 07:43:11 +02:00
|
|
|
|
* UnloadLib
|
2017-08-24 14:46:48 +02:00
|
|
|
|
* in :
|
|
|
|
|
* A = hMem To Lib
|
|
|
|
|
* out :
|
|
|
|
|
*--------------------------------------
|
2018-06-18 08:22:50 +02:00
|
|
|
|
K.UnloadLib pha
|
2018-12-20 17:23:43 +01:00
|
|
|
|
jsr K.GetMemPtr
|
|
|
|
|
>STYA .2+1
|
|
|
|
|
|
2019-10-25 17:09:13 +02:00
|
|
|
|
ldy #S.MEM.REFCNT
|
|
|
|
|
lda (ZPMemMgrSPtr),y
|
|
|
|
|
dec
|
2019-02-05 13:45:15 +00:00
|
|
|
|
bne .8
|
2019-10-25 17:09:13 +02:00
|
|
|
|
|
|
|
|
|
ldx #LIBMGR.UNLOAD
|
2017-08-25 17:02:16 +02:00
|
|
|
|
.2 jsr $ffff Self Modified, Call LIB.UNLOAD function
|
2017-08-24 14:46:48 +02:00
|
|
|
|
pla
|
2018-06-22 08:24:35 +02:00
|
|
|
|
jmp K.FreeMem
|
2019-10-25 17:09:13 +02:00
|
|
|
|
|
|
|
|
|
.8 sta (ZPMemMgrSPtr),y
|
|
|
|
|
pla
|
2019-02-05 13:45:15 +00:00
|
|
|
|
* clc
|
2019-10-03 08:25:27 +02:00
|
|
|
|
rts
|
2018-06-21 17:12:10 +02:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # LoadDrv
|
2018-07-20 07:43:11 +02:00
|
|
|
|
* ## ASM
|
2018-06-21 17:12:10 +02:00
|
|
|
|
* Y,A = PTR to "NAME.DRV [PARAM]" C-String
|
2018-10-11 17:23:06 +02:00
|
|
|
|
* ## RETURN VALUE
|
2018-06-21 17:12:10 +02:00
|
|
|
|
* none
|
|
|
|
|
*\--------------------------------------
|
2018-06-18 08:22:50 +02:00
|
|
|
|
K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0"
|
2018-01-19 07:14:38 +00:00
|
|
|
|
|
2020-09-25 14:05:23 +02:00
|
|
|
|
jsr PS.Find.DRV
|
2017-08-25 17:02:16 +02:00
|
|
|
|
bcs .9
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2019-07-24 17:17:08 +02:00
|
|
|
|
jsr BIN.Load K.Buf256 = "/PATH/BIN"
|
2017-08-25 17:02:16 +02:00
|
|
|
|
bcs .9
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2018-07-05 17:39:36 +02:00
|
|
|
|
>STYA .3+1
|
2019-02-03 21:58:26 +00:00
|
|
|
|
|
2018-01-19 07:14:38 +00:00
|
|
|
|
ldx #$ff
|
|
|
|
|
|
|
|
|
|
.1 inx Skip "BIN"
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2018-01-19 07:14:38 +00:00
|
|
|
|
.2 lda $ffff,x
|
2017-08-25 17:02:16 +02:00
|
|
|
|
bne .1
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2018-01-19 07:14:38 +00:00
|
|
|
|
txa
|
|
|
|
|
sec
|
|
|
|
|
adc .2+1
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
2018-06-28 17:26:34 +02:00
|
|
|
|
adc .2+2 Y,A = ARGS
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2018-07-05 17:39:36 +02:00
|
|
|
|
.3 jsr $ffff SELF MODIFIED, call Dev.Detect
|
2021-04-29 13:56:34 +02:00
|
|
|
|
jsr BIN.Load.Free
|
2019-02-03 21:58:26 +00:00
|
|
|
|
bcs .9
|
2021-01-12 22:14:13 +01:00
|
|
|
|
|
2017-08-25 17:02:16 +02:00
|
|
|
|
lda #0 Make sure RC = 0 if success
|
2019-07-22 08:31:01 +02:00
|
|
|
|
* clc
|
2017-08-25 17:02:16 +02:00
|
|
|
|
.9 rts
|
2018-01-18 06:49:41 +00:00
|
|
|
|
*--------------------------------------
|
2018-06-28 17:26:34 +02:00
|
|
|
|
* BIN.Load
|
2015-03-14 22:48:35 +01:00
|
|
|
|
* in :
|
2019-07-24 17:17:08 +02:00
|
|
|
|
* K.Buf256 = /BIN/PATH (CSTR)
|
2015-03-14 22:48:35 +01:00
|
|
|
|
* out :
|
|
|
|
|
* Y,A = MEMPTR
|
|
|
|
|
* X = hMem of Code Segment
|
|
|
|
|
*--------------------------------------
|
2020-11-19 16:34:02 +01:00
|
|
|
|
BIN.Load lda A2osX.FSID
|
2019-12-03 16:42:17 +01:00
|
|
|
|
bne .11
|
|
|
|
|
|
|
|
|
|
ldx #$ff
|
|
|
|
|
|
|
|
|
|
.10 inx
|
|
|
|
|
lda K.Buf256,x
|
|
|
|
|
beq .11
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .10
|
|
|
|
|
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
bcs .10
|
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
bra .10
|
|
|
|
|
|
|
|
|
|
.11 ldx #0
|
2019-07-24 17:17:08 +02:00
|
|
|
|
|
2018-08-20 17:15:37 +02:00
|
|
|
|
.1 cpx Mem.LastSlot
|
|
|
|
|
beq BIN.Load.1
|
|
|
|
|
|
2018-12-20 17:23:43 +01:00
|
|
|
|
inx we will skip Slot 0...
|
|
|
|
|
txa
|
2019-02-01 20:01:54 +00:00
|
|
|
|
jsr MEM.GetMemByID
|
2018-12-20 17:23:43 +01:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
2018-08-20 17:15:37 +02:00
|
|
|
|
bpl .1 In Use?
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2017-11-22 17:27:50 +01:00
|
|
|
|
ldy #S.MEM.BIN any BIN PATH in this slot?
|
2018-12-20 17:23:43 +01:00
|
|
|
|
lda (ZPMemMgrSPtr),y
|
2018-08-20 17:15:37 +02:00
|
|
|
|
beq .1
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2018-08-20 17:15:37 +02:00
|
|
|
|
jsr K.GetMemPtr X unmodified, get pathname
|
2017-11-22 17:27:50 +01:00
|
|
|
|
>STYA .3+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2019-07-22 08:31:01 +02:00
|
|
|
|
.2 lda K.Buf256,y
|
2017-11-22 17:27:50 +01:00
|
|
|
|
.3 cmp $ffff,y SELF MODIFIED
|
2018-08-20 17:15:37 +02:00
|
|
|
|
bne .1
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2017-11-22 17:27:50 +01:00
|
|
|
|
iny
|
|
|
|
|
ora #0
|
|
|
|
|
bne .2
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2019-07-22 08:31:01 +02:00
|
|
|
|
stx BIN.hMem save hMem
|
2018-12-20 17:23:43 +01:00
|
|
|
|
txa
|
2019-02-03 21:58:26 +00:00
|
|
|
|
jsr MEM.GetMemByID
|
2019-07-18 17:55:43 +02:00
|
|
|
|
jsr Mem.IncRefCnt
|
2017-11-22 17:27:50 +01:00
|
|
|
|
clc
|
2019-07-22 08:31:01 +02:00
|
|
|
|
jmp MEM.GetMEMPTR Y,A=Ptr
|
2019-10-03 08:25:27 +02:00
|
|
|
|
*--------------------------------------
|
2019-01-26 14:01:05 +00:00
|
|
|
|
* STAT Already called by Filesearch in FindDRV, FindLIB
|
|
|
|
|
* STAT Already called by PS.Load (TXT,BIN,SYS)
|
2019-10-03 08:25:27 +02:00
|
|
|
|
*--------------------------------------
|
2020-02-14 08:21:56 +01:00
|
|
|
|
BIN.Load.1 >PUSHWI K.Buf256
|
|
|
|
|
>PUSHBI O.RDONLY
|
|
|
|
|
>PUSHBI S.FI.T.BIN
|
|
|
|
|
>LDYA K.S.STAT+S.STAT.P.AUXTYPE
|
2018-06-29 16:16:40 +02:00
|
|
|
|
>STYA BIN.R.CS.Start
|
2016-09-28 17:34:15 +02:00
|
|
|
|
>PUSHYA Push AUXTYPE
|
2020-12-15 14:23:22 +01:00
|
|
|
|
|
2019-07-29 17:38:55 +02:00
|
|
|
|
jsr K.LoadFile
|
2021-05-04 19:31:21 +02:00
|
|
|
|
bcs .9 Error Loading file
|
2020-02-14 08:21:56 +01:00
|
|
|
|
|
2018-01-18 06:49:41 +00:00
|
|
|
|
stx BIN.hMem save hMem
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
2017-08-24 08:47:31 +02:00
|
|
|
|
pha YA=CODE+DATA size
|
2016-09-30 17:04:55 +02:00
|
|
|
|
tya
|
2019-07-22 08:31:01 +02:00
|
|
|
|
* clc
|
2018-07-13 16:38:24 +02:00
|
|
|
|
adc BIN.R.CS.Start Get AUXTYPE for actual Base Address
|
2017-10-27 16:56:46 +02:00
|
|
|
|
sta BIN.R.End compute Range End=AUXTYPE+FILELEN
|
2016-09-30 17:04:55 +02:00
|
|
|
|
pla
|
2018-06-29 16:16:40 +02:00
|
|
|
|
adc BIN.R.CS.Start+1
|
2017-10-27 16:56:46 +02:00
|
|
|
|
sta BIN.R.End+1
|
2016-09-30 17:04:55 +02:00
|
|
|
|
|
|
|
|
|
txa
|
2018-06-21 17:12:10 +02:00
|
|
|
|
jsr K.GetMemPtr
|
2019-07-22 08:31:01 +02:00
|
|
|
|
>STYA ZPPtr1 set ZPPtr1 -> New Code start
|
2016-09-30 17:04:55 +02:00
|
|
|
|
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.CompOfsYA YA = actual load address
|
2020-09-05 20:44:58 +02:00
|
|
|
|
|
|
|
|
|
jsr Mem.SetOwnerPS0 this CS is owned by PS 0
|
|
|
|
|
|
2018-09-11 15:32:56 +02:00
|
|
|
|
ldy #H.BIN.CS.SIZE get Code Len
|
2017-01-12 18:43:45 +01:00
|
|
|
|
lda (ZPPtr1),y
|
2019-07-22 08:31:01 +02:00
|
|
|
|
pha
|
2016-10-12 17:46:38 +02:00
|
|
|
|
iny
|
2017-01-12 18:43:45 +01:00
|
|
|
|
lda (ZPPtr1),y
|
2019-07-22 08:31:01 +02:00
|
|
|
|
ply
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.CompCSEndYA
|
2017-10-27 16:56:46 +02:00
|
|
|
|
jsr BIN.RelExe
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2021-08-01 15:45:15 +02:00
|
|
|
|
jsr STRING.DupBuf256 get back bin path & jsr K.strdup make a copy of this string
|
2021-04-29 13:56:34 +02:00
|
|
|
|
bcs BIN.Load.Free
|
2019-12-03 16:42:17 +01:00
|
|
|
|
|
2020-09-05 20:44:58 +02:00
|
|
|
|
jsr Mem.SetOwnerPS0 Make BINPATH owned by PS0
|
|
|
|
|
|
2019-02-03 21:58:26 +00:00
|
|
|
|
lda BIN.hMem Keep X=new string hMem
|
2019-01-30 06:20:13 +00:00
|
|
|
|
jsr MEM.GetMemByID X unmodified
|
2018-12-20 17:23:43 +01:00
|
|
|
|
lda (ZPMemMgrSPtr)
|
2015-03-14 22:48:35 +01:00
|
|
|
|
ora #S.MEM.F.CODE This is a code segment
|
2018-12-20 17:23:43 +01:00
|
|
|
|
sta (ZPMemMgrSPtr)
|
2016-03-13 22:47:19 +01:00
|
|
|
|
|
2018-12-20 17:23:43 +01:00
|
|
|
|
txa Get Back Cmd line hMem
|
2015-03-14 22:48:35 +01:00
|
|
|
|
ldy #S.MEM.BIN
|
2018-12-20 17:23:43 +01:00
|
|
|
|
sta (ZPMemMgrSPtr),y
|
2019-07-24 17:17:08 +02:00
|
|
|
|
ldx BIN.hMem setup X = CS hMem
|
2018-12-20 17:23:43 +01:00
|
|
|
|
clc
|
2019-02-03 21:58:26 +00:00
|
|
|
|
jmp MEM.GetMEMPTR ...and Y,A=PTR to CS
|
2021-04-29 13:56:34 +02:00
|
|
|
|
|
2021-05-04 19:31:21 +02:00
|
|
|
|
.9 rts
|
|
|
|
|
|
2021-04-29 13:56:34 +02:00
|
|
|
|
BIN.Load.Free php
|
|
|
|
|
pha
|
|
|
|
|
lda BIN.hMem
|
|
|
|
|
jsr K.FreeMem
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
rts Discard Loaded Code, exits CS
|
2018-06-28 17:26:34 +02:00
|
|
|
|
*/--------------------------------------
|
2018-07-20 07:43:11 +02:00
|
|
|
|
* # InsDrv
|
|
|
|
|
* ## C
|
2019-07-22 08:31:01 +02:00
|
|
|
|
* `void * insdrv (void * src, void * crvcsstart, void * drvcssize, void * drvend);`
|
2018-07-20 07:43:11 +02:00
|
|
|
|
* ## ASM
|
2018-07-19 17:33:55 +02:00
|
|
|
|
* `>PUSHW DRV.END`
|
2019-07-22 08:31:01 +02:00
|
|
|
|
* `>PUSHW DRV.CS.SIZE`
|
2018-07-19 17:33:55 +02:00
|
|
|
|
* `>PUSHW DRV.CS.START`
|
|
|
|
|
* `>LDYA L.SRC`
|
2019-02-26 16:50:42 +00:00
|
|
|
|
* `>SYSCALL insdrv`
|
2018-10-11 17:23:06 +02:00
|
|
|
|
* ## RETURN VALUE
|
2018-07-17 17:45:59 +02:00
|
|
|
|
* Y,A = Ptr to installed driver
|
2018-06-28 17:26:34 +02:00
|
|
|
|
*\--------------------------------------
|
2019-07-22 08:31:01 +02:00
|
|
|
|
K.InsDrv >STYA ZPPtr3 SRC PTR for move
|
2018-07-17 17:45:59 +02:00
|
|
|
|
>PULLW BIN.R.CS.Start
|
2019-07-28 22:39:30 +02:00
|
|
|
|
>PULLYA DRV.CS.SIZE
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.CompCSEndYA
|
2019-07-28 22:39:30 +02:00
|
|
|
|
>PULLA BIN.R.End
|
|
|
|
|
sta BIN.R.End
|
|
|
|
|
sec
|
|
|
|
|
sbc BIN.R.CS.Start
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
>PULLA
|
|
|
|
|
sta BIN.R.End+1
|
|
|
|
|
sbc BIN.R.CS.Start+1
|
|
|
|
|
>STYA BIN.R.Size
|
2021-07-10 21:09:43 +02:00
|
|
|
|
jsr MEM.GetKBuf Y,A = CODE + DATA
|
2019-01-11 16:06:05 +00:00
|
|
|
|
bcs .9 No More Room to load Driver
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
>STYA ZPPtr1 Y,A = DST Buf for RelDrv...
|
2019-07-22 08:31:01 +02:00
|
|
|
|
>STYA ZPPtr4 ...for move...
|
2019-01-11 16:06:05 +00:00
|
|
|
|
sty .7+1 ...and for exit
|
|
|
|
|
sta .8+1
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.CompOfsYA
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
2019-07-28 22:39:30 +02:00
|
|
|
|
lda BIN.R.Size
|
2019-07-22 08:31:01 +02:00
|
|
|
|
eor #$ff
|
|
|
|
|
tax
|
2019-07-28 22:39:30 +02:00
|
|
|
|
lda BIN.R.Size+1
|
2016-09-28 17:34:15 +02:00
|
|
|
|
eor #$ff
|
|
|
|
|
pha
|
|
|
|
|
ldy #0
|
2023-10-18 07:41:12 +02:00
|
|
|
|
|
2018-06-29 16:16:40 +02:00
|
|
|
|
.1 inx
|
|
|
|
|
bne .2
|
2021-08-13 20:34:20 +02:00
|
|
|
|
|
2016-09-28 17:34:15 +02:00
|
|
|
|
pla
|
2016-10-04 18:01:07 +02:00
|
|
|
|
inc
|
2018-06-29 16:16:40 +02:00
|
|
|
|
beq .3
|
2021-08-13 20:34:20 +02:00
|
|
|
|
|
2016-09-28 17:34:15 +02:00
|
|
|
|
pha
|
2023-10-18 07:41:12 +02:00
|
|
|
|
|
2019-07-22 08:31:01 +02:00
|
|
|
|
.2 lda (ZPPtr3),y
|
|
|
|
|
sta (ZPPtr4),y
|
2016-09-28 17:34:15 +02:00
|
|
|
|
iny
|
2018-06-29 16:16:40 +02:00
|
|
|
|
bne .1
|
2021-08-13 20:34:20 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
inc ZPPtr3+1
|
2019-07-22 08:31:01 +02:00
|
|
|
|
inc ZPPtr4+1
|
2018-06-29 16:16:40 +02:00
|
|
|
|
bra .1
|
2021-08-13 20:34:20 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
.3 jsr BIN.RelDrv Relocate at Ptr1
|
2021-08-13 20:34:20 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
.7 ldy #$ff SELF MODIFIED
|
|
|
|
|
.8 lda #$ff SELF MODIFIED
|
2019-10-03 08:25:27 +02:00
|
|
|
|
.9 rts
|
2016-09-27 17:51:59 +02:00
|
|
|
|
*--------------------------------------
|
2017-10-27 16:56:46 +02:00
|
|
|
|
BIN.RelExe ldy #H.BIN.T+1
|
2017-01-12 18:43:45 +01:00
|
|
|
|
lda (ZPPtr1),y
|
2017-10-17 17:40:21 +02:00
|
|
|
|
cmp /H.BIN.T.BIN65
|
2016-10-04 18:01:07 +02:00
|
|
|
|
beq .1
|
2020-11-26 20:47:57 +01:00
|
|
|
|
|
2017-10-17 17:40:21 +02:00
|
|
|
|
cmp /H.BIN.T.DRV65
|
2016-10-04 18:01:07 +02:00
|
|
|
|
beq .1
|
2020-11-26 20:47:57 +01:00
|
|
|
|
|
2018-10-21 22:54:07 +02:00
|
|
|
|
lda #E.IBIN
|
2016-10-04 18:01:07 +02:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-11-26 20:47:57 +01:00
|
|
|
|
|
2016-10-04 18:01:07 +02:00
|
|
|
|
.1 ldy #H.BIN.JMP relocate Main JMP
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.RelAtPtr1Y
|
2016-09-27 17:51:59 +02:00
|
|
|
|
|
2021-05-04 19:31:21 +02:00
|
|
|
|
ldy #16 skip Header, CS.SIZE & DS.SIZE... (16 bytes)
|
2016-09-30 17:04:55 +02:00
|
|
|
|
|
2016-09-27 17:51:59 +02:00
|
|
|
|
.HS 2C bit abs
|
2019-10-03 08:25:27 +02:00
|
|
|
|
*--------------------------------------
|
2021-05-04 19:31:21 +02:00
|
|
|
|
BIN.RelDrv ldy #2 start after CLD JMP
|
2018-07-17 17:45:59 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
.1 iny
|
2018-09-09 10:11:42 +02:00
|
|
|
|
lda (ZPPtr1),y HI in A
|
|
|
|
|
beq .2 $00xx = end of table
|
2020-11-26 20:47:57 +01:00
|
|
|
|
|
2016-09-27 17:51:59 +02:00
|
|
|
|
dey
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.RelAtPtr1Y
|
2016-09-27 17:51:59 +02:00
|
|
|
|
|
|
|
|
|
iny
|
2020-11-26 20:47:57 +01:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1+1
|
2016-09-27 17:51:59 +02:00
|
|
|
|
|
|
|
|
|
bra .1
|
2019-10-03 08:25:27 +02:00
|
|
|
|
*--------------------------------------
|
2021-05-04 19:31:21 +02:00
|
|
|
|
.2 jsr SHARED.AddYp12P1 add current offset in Y to Ptr
|
2018-12-20 17:23:43 +01:00
|
|
|
|
* + 1 to skip last 00 from beq .2
|
|
|
|
|
* ZPPtr1=Current Code PTR
|
2019-07-22 18:28:44 +02:00
|
|
|
|
lda BIN.R.CS.End
|
2018-07-19 17:33:55 +02:00
|
|
|
|
clc
|
|
|
|
|
adc BIN.R.Offset
|
2019-07-22 18:28:44 +02:00
|
|
|
|
sta BIN.R.Stop
|
|
|
|
|
lda BIN.R.CS.End+1
|
2019-07-22 08:31:01 +02:00
|
|
|
|
adc BIN.R.Offset+1
|
2019-07-22 18:28:44 +02:00
|
|
|
|
sta BIN.R.Stop+1
|
2018-07-19 17:33:55 +02:00
|
|
|
|
|
2019-07-22 08:31:01 +02:00
|
|
|
|
.3 lda (ZPPtr1) get OPCODE
|
2016-09-28 17:34:15 +02:00
|
|
|
|
lsr /2
|
2016-09-27 17:51:59 +02:00
|
|
|
|
tax
|
2021-07-10 21:09:43 +02:00
|
|
|
|
lda BIN.65R02,x get OPCODE definition
|
2016-09-30 17:04:55 +02:00
|
|
|
|
bcs .4 go get LO nibble
|
2016-09-28 17:34:15 +02:00
|
|
|
|
lsr
|
|
|
|
|
lsr move HI -> LO
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2016-09-30 17:04:55 +02:00
|
|
|
|
.4 and #$0f
|
2016-09-28 17:34:15 +02:00
|
|
|
|
bit #$8 abs addressing?
|
2019-07-22 08:31:01 +02:00
|
|
|
|
beq .5 no....
|
2016-09-28 17:34:15 +02:00
|
|
|
|
and #7 save Opcode length...
|
2016-09-27 17:51:59 +02:00
|
|
|
|
pha
|
|
|
|
|
ldy #1
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr BIN.RelAtPtr1Y
|
2019-07-22 08:31:01 +02:00
|
|
|
|
pla get back Opcode length...
|
2019-01-11 16:06:05 +00:00
|
|
|
|
|
2019-07-22 08:31:01 +02:00
|
|
|
|
.5 tay A = OPCODE length
|
2021-05-04 19:31:21 +02:00
|
|
|
|
jsr SHARED.AddY2P1
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
2019-07-22 18:28:44 +02:00
|
|
|
|
.6 cmp BIN.R.Stop A = ZPPtr1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
bne .3
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
2019-01-11 16:06:05 +00:00
|
|
|
|
lda ZPPtr1+1
|
2019-07-22 18:28:44 +02:00
|
|
|
|
.7 cmp BIN.R.Stop+1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
bne .3 next opcode....
|
2019-07-22 08:31:01 +02:00
|
|
|
|
|
|
|
|
|
clc Make sure exit with CC
|
|
|
|
|
rts
|
|
|
|
|
*-------------------------------------- YA = CS Size
|
2021-05-04 19:31:21 +02:00
|
|
|
|
BIN.CompCSEndYA pha
|
2019-07-22 08:31:01 +02:00
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc BIN.R.CS.Start
|
|
|
|
|
sta BIN.R.CS.End ZPPtr1 + CodeLen
|
|
|
|
|
pla
|
|
|
|
|
adc BIN.R.CS.Start+1
|
|
|
|
|
sta BIN.R.CS.End+1
|
|
|
|
|
rts
|
|
|
|
|
*-------------------------------------- YA = Target Address
|
2021-05-04 19:31:21 +02:00
|
|
|
|
BIN.CompOfsYA pha
|
2019-07-22 08:31:01 +02:00
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
sbc BIN.R.CS.Start
|
|
|
|
|
sta BIN.R.Offset
|
|
|
|
|
pla
|
|
|
|
|
sbc BIN.R.CS.Start+1
|
|
|
|
|
sta BIN.R.Offset+1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-05-04 19:31:21 +02:00
|
|
|
|
BIN.RelAtPtr1Y lda (ZPPtr1),y Get LO
|
2016-09-28 17:34:15 +02:00
|
|
|
|
tax save LO in X
|
|
|
|
|
iny make Y point to HI
|
2018-07-17 17:45:59 +02:00
|
|
|
|
lda (ZPPtr1),y Get HI
|
2018-06-29 16:16:40 +02:00
|
|
|
|
cpx BIN.R.CS.Start
|
|
|
|
|
sbc BIN.R.CS.Start+1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
bcc .9 addr < BIN.R.CS.Start, out of range
|
2016-09-28 17:34:15 +02:00
|
|
|
|
txa Get back LO
|
2017-10-27 16:56:46 +02:00
|
|
|
|
cpx BIN.R.End
|
2018-07-17 17:45:59 +02:00
|
|
|
|
lda (ZPPtr1),y Get HI
|
2017-10-27 16:56:46 +02:00
|
|
|
|
sbc BIN.R.End+1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
bcs .9 addr > BIN.R.End, out of range
|
2016-09-28 17:34:15 +02:00
|
|
|
|
txa Get back LO
|
2016-09-27 17:51:59 +02:00
|
|
|
|
dey
|
2019-01-11 16:06:05 +00:00
|
|
|
|
clc
|
|
|
|
|
adc BIN.R.Offset
|
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
|
2016-09-27 17:51:59 +02:00
|
|
|
|
iny
|
2019-01-11 16:06:05 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2017-10-27 16:56:46 +02:00
|
|
|
|
adc BIN.R.Offset+1
|
2019-01-11 16:06:05 +00:00
|
|
|
|
sta (ZPPtr1),y
|
|
|
|
|
.9 rts
|
2016-09-27 17:51:59 +02:00
|
|
|
|
*--------------------------------------
|
2019-01-04 13:17:31 +00:00
|
|
|
|
* 6502/65C02/65816 OPCODES
|
|
|
|
|
* Bit 3 : 1 = absolute addressing
|
|
|
|
|
* Bit 2-1-0 : opcode + @ length
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
|
2021-07-10 21:09:43 +02:00
|
|
|
|
* BIN.65816
|
2019-01-04 13:17:31 +00:00
|
|
|
|
* TO DO : Make 2 different tables
|
|
|
|
|
* http://axis.llx.com/~nparker/a2/opcodes.html
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 65R02 OPCODES
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
|
|
|
|
|
BIN.65R02 .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS B.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
|
|
|
|
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
|
|
|
|
*--------------------------------------
|
2015-03-14 22:48:35 +01:00
|
|
|
|
MAN
|
2020-12-15 14:23:22 +01:00
|
|
|
|
SAVE usr/src/sys/kernel.s.bin
|
|
|
|
|
LOAD usr/src/sys/kernel.s
|
2015-03-14 22:48:35 +01:00
|
|
|
|
ASM
|