# use -x to for -ffreestanding
c-files:
- $(CC) -O -c src/*.c
+ $(CC) -O -c src/*.c -I$(INC)
init:
$(AS) -fas86 src/*.s -i $(INC)
%include "WonderSwan.inc"
extern _main
+extern __end
MYSEGMENT equ 0xF000
mov sp,WS_STACK
in al,IO_HARDWARE_TYPE ; Check Wonderswan Mono/Color
- test al,WS_COLOR
+ test al,WS_COLOR
.mono: jz .mono ; We loop forever if Mono
mov sp,WSC_STACK ; New stack
+
+ call _main
xor ax,ax ; Clear Ram
mov di,0x100
;******************************************
- ROM_HEADER ..start, MYSEGMENT, 0x42, RH_WS_COLOR, RH_ROM_8MBITS, RH_NO_SRAM, RH_HORIZONTAL
+ ;ROM_HEADER __end, MYSEGMENT, 0x42, RH_WS_COLOR, RH_ROM_8MBITS, RH_NO_SRAM, RH_HORIZONTAL
;******************************************
+/* #include <code16bit.h> */
+#include <wonderswan_mem.h>
+
+void outport(c)
+ unsigned c;
+{
+#asm
+ xor dx, dx
+ mov dx, ax
+ shr dx, 8
+ out dx, al
+ ;out 0x15, al
+#endasm
+}
+
int main()
{
- return 1;
+ while(1) {
+ /* outport(0x15EE); */
+ unsigned reg = 0x15;
+ unsigned val = 0xEE;
+ outport((reg << 8) | val);
+
+ }
+ return 0;
}