diff --git a/BaS_GNU/BaS_GNU/Makefile b/BaS_GNU/BaS_GNU/Makefile index fa070ee..ff2d2cb 100644 --- a/BaS_GNU/BaS_GNU/Makefile +++ b/BaS_GNU/BaS_GNU/Makefile @@ -53,4 +53,4 @@ $(OBJDIR)/%.o:$(SRCDIR)/%.c $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ $(OBJDIR)/%.o:$(SRCDIR)/%.S - $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ + $(CC) -c $(CFLAGS) -Wa,--bitwise-or $(INCLUDE) $< -o $@ diff --git a/BaS_GNU/BaS_GNU/sources/illegal_instruction.s b/BaS_GNU/BaS_GNU/sources/illegal_instruction.s deleted file mode 100644 index 21461b3..0000000 --- a/BaS_GNU/BaS_GNU/sources/illegal_instruction.s +++ /dev/null @@ -1,328 +0,0 @@ -.public _illegal_instruction -.public _illegal_table_make - -.include "startcf.h" -.include "ii_macro.h" -.include "ii_func.h" -.include "ii_op.h" -.include "ii_opc.h" -.include "ii_add.h" -.include "ii_sub.h" -.include "ii_or.h" -.include "ii_and.h" -.include "ii_dbcc.h" -.include "ii_shd.h" -.include "ii_movem.h" -.include "ii_lea.h" -.include "ii_shift.h" -.include "ii_exg.h" -.include "ii_movep.h" -.include "ii_ewf.h" -.include "ii_move.h" - -.extern _ii_shift_vec -.extern ewf - -/*******************************************************/ -.text -ii_error: - nop - halt - nop - nop - -_illegal_instruction: -#ifdef ii_on - move.w #0x2700,sr - lea -ii_ss(a7),a7 - movem.l d0/d1/a0/a1,(a7) - move.l pc_off(a7),a0 // pc - mvz.w (a0)+,d0 // code - lea table,a1 - move.l 0(a1,d0*4),a1 - jmp (a1) -/*************************************************************************************************/ -#endif -_illegal_table_make: -#ifdef ii_on - lea table,a0 - moveq #0,d0 -_itm_loop: - move.l #ii_error,(a0)+ - addq.l #1,d0 - cmp.l #0xF000,d0 - bne _itm_loop -//------------------------------------------------------------------------- - ii_ewf_lset // diverse fehlende adressierungn -//------------------------------------------------------------------------- -// 0x0000 -// ori - ii_lset_op 00 -// andi - ii_lset_op 02 -// subi - ii_lset_op 04 -// addi - ii_lset_op 06 -// eori - ii_lset_op 0a -// cmpi - ii_lset_op 0c -// movep - ii_movep_lset -//------------------------------------------------------------------------- -// 0x1000 move.b -// 0x2000 move.l -// 0x3000 move.w - ii_move_lset -//------------------------------------------------------------------------- -// 0x4000 -//------------------------------------------------------------------------- -// negx - ii_lset_op 40 -// neg - ii_lset_op 44 -// not - ii_lset_op 46 -//--------------------------------------------------------------------------------------------- -// lea d8(ax,dy.w),az; d8(pc,dy.w),az -//------------------------------------------------------------------- - ii_lea_lset -//------------------------------------------------------------------- -// movem -//------------------------------------------------------------------- - ii_movem_lset -//------------------------------------------------------------------------- -// 0x5000 -//------------------------------------------------------------------------- -// addq, subq - ii_lset_op 50 - ii_lset_op 51 - ii_lset_op 52 - ii_lset_op 53 - ii_lset_op 54 - ii_lset_op 55 - ii_lset_op 56 - ii_lset_op 57 - ii_lset_op 58 - ii_lset_op 59 - ii_lset_op 5a - ii_lset_op 5b - ii_lset_op 5c - ii_lset_op 5d - ii_lset_op 5e - ii_lset_op 5f -// dbcc - ii_lset_dbcc -// scc - ii_lset_opc 50 - ii_lset_opc 51 - ii_lset_opc 52 - ii_lset_opc 53 - ii_lset_opc 54 - ii_lset_opc 55 - ii_lset_opc 56 - ii_lset_opc 57 - ii_lset_opc 58 - ii_lset_opc 59 - ii_lset_opc 5a - ii_lset_opc 5b - ii_lset_opc 5c - ii_lset_opc 5d - ii_lset_opc 5e - ii_lset_opc 5f -//------------------------------------------------------------------------- -// 0x8000 or -//------------------------------------------------------------------------- - ii_lset_func 8 -//------------------------------------------------------------------------- -// 0x9000 sub -//------------------------------------------------------------------------- - ii_lset_func 9 -//------------------------------------------------------------------------- -// 0xb000 -//------------------------------------------------------------------------- -// eor - ii_lset_op b1 - ii_lset_op b3 - ii_lset_op b5 - ii_lset_op b7 - ii_lset_op b9 - ii_lset_op bb - ii_lset_op bd - ii_lset_op bf -//------------------------------------------------------------------------- -// 0xc000 -//------------------------------------------------------------------------- -// and - ii_lset_func c -// exg - ii_exg_lset -//------------------------------------------------------------------------- -// 0xd000 add -//------------------------------------------------------------------------- - ii_lset_func d -//------------------------------------------------------------------------- -// 0xe000 -//------------------------------------------------------------------------- -// shift register - ii_shift_lset e -//------------------------------------------------- -// differenz zwischen orginal und gemoved korrigieren - lea ii_error(pc),a1 - move.l a1,d1 - sub.l #ii_error,d1 - lea table,a0 - moveq #0,d0 -_itkorr_loop: - add.l d1,(a0)+ - addq.l #1,d0 - cmp.l #0xF000,d0 - bne _itkorr_loop -#endif - rts -#ifdef ii_on -//***********************************************************************************/ -//------------------------------------------------------------------------- - ii_ewf_func // diverse fehlende adressierungn -//------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// 0x0000 -//-------------------------------------------------------------------- -// ori 00 - ii_op 00,or.l,i -//-------------------------------------------------------------------- -// andi 02 - ii_op 02,and.l,i -//-------------------------------------------------------------------- -// subi 04 - ii_op 04,and.l,i -//-------------------------------------------------------------------- -// addi 06 - ii_op 06,add.l,i -//-------------------------------------------------------------------- -// eori 0a - ii_op 0a,eor.l,i -//-------------------------------------------------------------------- -// cmpi 0c - ii_op 0c,cmp.l,i -//-------------------------------------------------------------------- -// movep - ii_movep_func -///--------------------------------------------------------------------------------------------- -// 0x1000 move.b -// 0x2000 move.l -// 0x3000 move.w - ii_move_op -//--------------------------------------------------------------------------------------------- -// 0x4000 -//--------------------------------------------------------------------------------------------- -// neg 0x40.. - ii_op 40,negx.l,n -//--------------------------------------------------------------------------------------------- -// neg 0x44.. - ii_op 44,neg.l,n -//--------------------------------------------------------------------------------------------- -// not 0x46.. - ii_op 46,not.l,n -//--------------------------------------------------------------------------------------------- -// lea d8(ax,dy.w),az; d8(pc,dy.w),az -//------------------------------------------------------------------- - ii_lea_func -//------------------------------------------------------------------- -// movem -//-------------------------------------------------------------------- -ii_movem_func -//--------------------------------------------------------------------------------------------- -// 0x5000 -//--------------------------------------------------------------------------------------------- -//dbcc - ii_dbcc_func -// addq 0x5... - ii_op 50,addq.l #8,q - ii_op 52,addq.l #1,q - ii_op 54,addq.l #2,q - ii_op 56,addq.l #3,q - ii_op 58,addq.l #4,q - ii_op 5a,addq.l #5,q - ii_op 5c,addq.l #6,q - ii_op 5e,addq.l #7,q -//--------------------------------------------------------------------------------------------- -// subq 0x5... - ii_op 51,subq.l #8,q - ii_op 53,subq.l #1,q - ii_op 55,subq.l #2,q - ii_op 57,subq.l #3,q - ii_op 59,subq.l #4,q - ii_op 5b,subq.l #5,q - ii_op 5d,subq.l #6,q - ii_op 5f,subq.l #7,q -//--------------------------------------------------------------------------------------------- -// 0x5... scc - ii_opc 50,st,c - ii_opc 51,sf,c - ii_opc 52,shi,c - ii_opc 53,sls,c - ii_opc 54,scc,c - ii_opc 55,scs,c - ii_opc 56,sne,c - ii_opc 57,seq,c - ii_opc 58,svc,c - ii_opc 59,svs,c - ii_opc 5a,spl,c - ii_opc 5b,smi,c - ii_opc 5c,sge,c - ii_opc 5d,slt,c - ii_opc 5e,sgt,c - ii_opc 5f,sle,c -//--------------------------------------------------------------------------------------------- -// 0x6000 -//-------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// 0x7000 -//-------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// 0x8000 -//--------------------------------------------------------------------------------------------- -// or - ii_func 8,or -//--------------------------------------------------------------------------------------------- -// 0x9000 -//--------------------------------------------------------------------------------------------- -// sub - ii_func 9,sub -//--------------------------------------------------------------------------------------------- -// 0xa000 -//-------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// 0xb000 -//--------------------------------------------------------------------------------------------- -// eor - ii_op b1,eor.l d0,q - ii_op b3,eor.l d1,q - ii_op b5,eor.l d2,q - ii_op b7,eor.l d3,q - ii_op b9,eor.l d4,q - ii_op bb,eor.l d5,q - ii_op bd,eor.l d6,q - ii_op bf,eor.l d7,q -//--------------------------------------------------------------------------------------------- -// 0xc000 -//--------------------------------------------------------------------------------------------- -// and - ii_func c,and -// exg - ii_exg_func -//--------------------------------------------------------------------------------------------- -// 0xd000 -//--------------------------------------------------------------------------------------------- -// add - ii_func d,add -//--------------------------------------------------------------------------------------------- -// 0xe000 shift -//-------------------------------------------------------------------- - ii_shift_op -//-------------------------------------------------------------------- -// 0xf000 -//-------------------------------------------------------------------- -#endif \ No newline at end of file diff --git a/BaS_GNU/BaS_GNU/sources/mmu.S b/BaS_GNU/BaS_GNU/sources/mmu.S index 0d3fade..9c668f7 100644 --- a/BaS_GNU/BaS_GNU/sources/mmu.S +++ b/BaS_GNU/BaS_GNU/sources/mmu.S @@ -2,20 +2,20 @@ /* INIT ACR und MMU /* /********************************************************************/ -.include "startcf.h" +#include "startcf.h" -.extern _rt_vbr -.extern _rt_cacr -.extern _rt_asid -.extern _rt_acr0 -.extern _rt_acr1 -.extern _rt_acr2 -.extern _rt_acr3 -.extern _rt_mmubar -.extern ___MMUBAR -.extern cpusha -.extern _video_tlb -.extern _video_sbt + .extern _rt_vbr + .extern _rt_cacr + .extern _rt_asid + .extern _rt_acr0 + .extern _rt_acr1 + .extern _rt_acr2 + .extern _rt_acr3 + .extern _rt_mmubar + .extern ___MMUBAR + .extern cpusha + .extern _video_tlb + .extern _video_sbt /* Register read/write macros */ #define MCF_MMU_MMUCR ___MMUBAR @@ -74,8 +74,8 @@ #define cb_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(01)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X) #define nc_mmudr (MCF_MMU_MMUDR_SZ(00)|MCF_MMU_MMUDR_CM(10)|MCF_MMU_MMUDR_R|MCF_MMU_MMUDR_W|MCF_MMU_MMUDR_X) -.public _mmu_init -.public _mmutr_miss + .global _mmu_init + .global _mmutr_miss .text _mmu_init: diff --git a/BaS_GNU/BaS_GNU/sources/movem.h b/BaS_GNU/BaS_GNU/sources/movem.h deleted file mode 100644 index b79349d..0000000 --- a/BaS_GNU/BaS_GNU/sources/movem.h +++ /dev/null @@ -1,256 +0,0 @@ -// movem -_ii_movem_lset: .macro -// movem rx,xxx.L - ii_lset 0x48f9 -// movem rx,-(ax) - -// movem (ax)+,rx - ii_lset 0x4cd8 - ii_lset 0x4cd9 - ii_lset 0x4cda - ii_lset 0x4cdb - ii_lset 0x4cdc - ii_lset 0x4cdd - ii_lset 0x4cde - ii_lset 0x4cdf -// movem xxx.L,rx - ii_lset 0x4cf9 -.endm -//***********************************************************************************/ -_ii_movem_func: .macro -//------------------------------------------------------------------- -// movem.l -//-------------------------------------------------------------------- -// movem.l (ax)+,reg -//-------------------------------------------------------------------- -//------------------------------------------------------------------------------- -ii_0x4cd8: // movem.l (a0)+,reglist - mvm_macro 0x4cd0,0x41e8,2 -ii_0x4cd9: // movem.l (a1)+,reglist - mvm_macro 0x4cd1,0x43e9,2 -ii_0x4cda: // movem.l (a2)+,reglist - mvm_macro 0x4cd2,0x45ea,2 -ii_0x4cdb: // movem.l (a3)+,reglist - mvm_macro 0x4cd3,0x47eb,2 -ii_0x4cdc: // movem.l (a4)+,reglist - mvm_macro 0x4cd4,0x49ec,2 -ii_0x4cdd: // movem.l (a5)+,reglist - mvm_macro 0x4cd5,0x4bed,2 -ii_0x4cde: // movem.l (a6)+,reglist - mvm_macro 0x4cd6,0x4dee,2 -ii_0x4cdf: // movem.l (a7)+,reglist - mvm_macro 0x4cd7,0x4fef,2 -//---------------------------------------------------------------------------- -ii_0x48f9: // movem.l reg,xxx.L - move.w (a0)+,d0 - move.l (a0)+,a1 - movemrm_macro - ii_end -//--------------------------------------------------------------------------------------------- -ii_0x4cf9: // movem.l xxx.L,reg - move.w (a0)+,d0 - move.l (a0)+,a1 - movemmr_macro - ii_end -.endm -//============================================================== -mvm_macro:.macro -halt - lea az_reg_table,a1 - mvz.b (a0),d1 - mvz.b 0(a1,d1)+,d0 - mvz.b 1(a0),d1 - mvz.b 0(a1,d1)+,d1 - add.l d0,d1 - lea ___RAMBAR1,a1 - move.l a1,pc_off(a7) - move.l a1,d0 - addq.l #1,d0 - movec d0,RAMBAR1 - move.w #\1,(a1)+ // movem.x (ax),reg_list - move.w (a0)+,(a1)+ // register list - move.w #\2,(a1)+ // lea 0(ax),ax - lsl.l #\3,d1 // * anzahl byts pro wert - move.w d1,(a1)+ // offset von lea - move.w #0x4ef9,(a1)+ // jmp.l - move.l a0,(a1) // rücksprungadresse - move.l #___RAMBAR1 + 0x81,d0 // instruction - movec d0,RAMBAR1 - movem.l (a7),d0/d1/a0/a1 - lea ii_ss(a7),a7 // stack erhöhen - rte - .endm - .long 0 -az_reg_table: - .byte 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 // 0-f - .byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 10-1f - .byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 20-2f - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 30-3f - .byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 40-4f - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 50 - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 60 - .byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // 70 - .byte 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5 // 80-8f - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // 90 - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // a0 - .byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // b0 - .byte 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6 // c0 - .byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // d0 - .byte 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7 // e0 - .byte 4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8 // f0 -//--------------------------------------------------------------------------------- -movemrm_macro:.macro // in d0 register liste, in a1 zieladresse -halt - tst.b d0 // datenregister zu verschieben? - bne mrm_dx // ja-> - lsr.l #8,d0 // sonst zu addressregister - jmp mmrm_nd7 // -> -mrm_dx: - lsr.l #1,d0 - bcc mmrm_nd0 - move.l d0_off(a7),(a1)+ -mmrm_nd0: - lsr.l #1,d0 - bcc mmrm_nd1 - move.l d1_off(a7),(a1)+ -mmrm_nd1: - lsr.l #1,d0 - bcc mmrm_nd2 - move.l d2,(a1)+ -mmrm_nd2: - lsr.l #1,d0 - bcc mmrm_nd3 - move.l d3,(a1)+ -mmrm_nd3: - lsr.l #1,d0 - bcc mmrm_nd4 - move.l d4,(a1)+ -mmrm_nd4: - lsr.l #1,d0 - bcc mmrm_nd5 - move.l d5,(a1)+ -mmrm_nd5: - lsr.l #1,d0 - bcc mmrm_nd6 - move.l d6,(a1)+ -mmrm_nd6: - lsr.l #1,d0 - bcc mmrm_nd7 - move.l d7,(a1)+ -mmrm_nd7: - tst.b d0 // addressregister zu verschieben? - beq mmrm_na7 - lsr.l #1,d0 - bcc mmrm_na0 - move.l a0_off(a7),(a1)+ -mmrm_na0: - lsr.l #1,d0 - bcc mmrm_na1 - move.l a1_off(a7),(a1)+ -mmrm_na1: - lsr.l #1,d0 - bcc mmrm_na2 - move.l a2,(a1)+ -mmrm_na2: - lsr.l #1,d0 - bcc mmrm_na3 - move.l a3,(a1)+ -mmrm_na3: - lsr.l #1,d0 - bcc mmrm_na4 - move.l a4,(a1)+ -mmrm_na4: - lsr.l #1,d0 - bcc mmrm_na5 - move.l a5,(a1)+ -mmrm_na5: - lsr.l #1,d0 - bcc mmrm_na6 - move.l a6,(a1)+ -mmrm_na6: - lsr.l #1,d0 - bcc mmrm_na7 - move.l a0,d1 // sichern - move.l usp,a0 // ist ja usp - move.l a0,(a1)+ // nach a0 - move.l d1,a0 // pc zurück -mmrm_na7: - .endm -//--------------------------------------------------------------------------------------------- -movemmr_macro:.macro // in d0 register liste, in a1 source adr -halt - tst.b d0 // datenregister zu verschieben? - bne mmr_dx // ja-> - lsr.l #8,d0 // sonst zu addressregister - bra mmmr_nd7 // -> -mmr_dx: - lsr.l #1,d0 - bcc mmmr_nd0 - move.l (a1)+,d0_off(a7) -mmmr_nd0: - lsr.l #1,d0 - bcc mmmr_nd1 - move.l (a1)+,d1_off(a7) -mmmr_nd1: - lsr.l #1,d0 - bcc mmmr_nd2 - move.l (a1)+,d2 -mmmr_nd2: - lsr.l #1,d0 - bcc mmmr_nd3 - move.l (a1)+,d3 -mmmr_nd3: - lsr.l #1,d0 - bcc mmmr_nd4 - move.l (a1)+,d4 -mmmr_nd4: - lsr.l #1,d0 - bcc mmmr_nd5 - move.l (a1)+,d5 -mmmr_nd5: - lsr.l #1,d0 - bcc mmmr_nd6 - move.l (a1)+,d6 -mmmr_nd6: - lsr.l #1,d0 - bcc mmmr_nd7 - move.l (a1)+,d7 -mmmr_nd7: - tst.b d0 // addressregister zu verschieben? - beq mmmr_na7 // nein-> - lsr.l #1,d0 - bcc mmmr_na0 - move.l (a1)+,a0_off(a7) -mmmr_na0: - lsr.l #1,d0 - bcc mmmr_na1 - move.l (a1)+,a1_off(a7) -mmmr_na1: - lsr.l #1,d0 - bcc mmmr_na2 - move.l (a1)+,a2 -mmmr_na2: - lsr.l #1,d0 - bcc mmmr_na3 - move.l (a1)+,a3 -mmmr_na3: - lsr.l #1,d0 - bcc mmmr_na4 - move.l (a1)+,a4 -mmmr_na4: - lsr.l #1,d0 - bcc mmmr_na5 - move.l (a1)+,a5 -mmmr_na5: - lsr.l #1,d0 - bcc mmmr_na6 - move.l (a1)+,a6 -mmmr_na6: - lsr.l #1,d0 - bcc mmmr_na7 - move.l a0,d1 // sichern - move.l (a1)+,a0 // nach a0 - move.l a0,usp // war ja usp - move.l d1,a0 // pc zurück -mmmr_na7: - .endm diff --git a/BaS_GNU/BaS_GNU/sources/sysinit.h b/BaS_GNU/BaS_GNU/sources/sysinit.h index b7a6c50..2150663 100644 --- a/BaS_GNU/BaS_GNU/sources/sysinit.h +++ b/BaS_GNU/BaS_GNU/sources/sysinit.h @@ -36,11 +36,11 @@ * __SDRAM,__SDRAM_SIZE, __FLASH, __FLASH_SIZE linker * symbols must be defined in the linker command file. */ -extern __declspec(system) uint8 __BOOT_FLASH[]; -extern __declspec(system) uint8 __BOOT_FLASH_SIZE[]; +extern __declspec(system) uint8_t __BOOT_FLASH[]; +extern __declspec(system) uint8_t __BOOT_FLASH_SIZE[]; -extern __declspec(system) uint8 __SDRAM[]; -extern __declspec(system) uint8 __SDRAM_SIZE[]; +extern __declspec(system) uint8_t __SDRAM[]; +extern __declspec(system) uint8_t __SDRAM_SIZE[]; #define BOOT_FLASH_ADDRESS (uint32)__BOOT_FLASH