Compare commits
No commits in common. 'master' and 'df6d37d7326b4cdb99b7a53e93e98dfdbe72f423' have entirely different histories.
master
...
df6d37d732
@ -1,55 +0,0 @@
|
||||
LD = ../bin/ld65
|
||||
AS = ../bin/ca65
|
||||
CC = ../bin/cc65
|
||||
AL = ../bin/align
|
||||
DA = /home/astoria/bin/da65
|
||||
|
||||
CINCLUDE = -I../include
|
||||
CFLAGS = -t none --cpu $(CPU)
|
||||
LFLAGS = -C ../lib/rpc8e.cfg
|
||||
LLIBS = ../lib/rpc8e.lib
|
||||
|
||||
#gonna leave this here for now
|
||||
CPU = 65c02
|
||||
|
||||
|
||||
IMAGES = test_iox.img
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: $(IMAGES)
|
||||
|
||||
%.s: %.c
|
||||
$(CC) $(CFLAGS) $(CINCLUDE) $<
|
||||
|
||||
%.o: %.s
|
||||
$(AS) $(CFLAGS) $<
|
||||
|
||||
%.img: %.o conio.o
|
||||
$(LD) $(LFLAGS) $< conio.o $(LLIBS) -o $@
|
||||
$(AL) $@
|
||||
|
||||
|
||||
clean:
|
||||
rm *.o *.s
|
||||
|
||||
.PHONY: testemu
|
||||
|
||||
testemu: test_iox.img
|
||||
emu65el02 test_iox.img
|
||||
|
||||
.PHONY: testgame
|
||||
|
||||
testgame: test_iox.img
|
||||
touch /home/astoria/.local/share/PolyMC/instances/WOAHITSBACK/.minecraft/saves/New\ World-/redpower/disk_09e74aca3d58e92a.img
|
||||
rm /home/astoria/.local/share/PolyMC/instances/WOAHITSBACK/.minecraft/saves/New\ World-/redpower/disk_09e74aca3d58e92a.img
|
||||
cp test_iox.img /home/astoria/.local/share/PolyMC/instances/WOAHITSBACK/.minecraft/saves/New\ World-/redpower/disk_09e74aca3d58e92a.img
|
||||
|
||||
.PHONY: devgame
|
||||
|
||||
devgame: test_iox.img
|
||||
touch /home/astoria/Downloads/redpower/saves/New\ World/redpower/disk_b2f279b88ec3d8f5.img
|
||||
rm /home/astoria/Downloads/redpower/saves/New\ World/redpower/disk_b2f279b88ec3d8f5.img
|
||||
cp test_iox.img /home/astoria/Downloads/redpower/saves/New\ World/redpower/disk_b2f279b88ec3d8f5.img
|
||||
|
||||
.SUFFIXES:
|
@ -1,114 +0,0 @@
|
||||
#include "conio.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
//Slow, find how str function does it and apply to whole string at once?
|
||||
//Technically could be void, but with returning string allows you to use it easy.
|
||||
char * strinv(char str[]) {
|
||||
int i;
|
||||
for(i = 0; i < strlen(str); i++){
|
||||
str[i] = inv(str[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
//This is currently unable to screenwrap. Improve in the future.
|
||||
void conprint(char * str, int x, int y){
|
||||
rb_map_device(conid);
|
||||
con->line = y % 50;
|
||||
memcpy(con->display + x, str, strlen(str));
|
||||
}
|
||||
|
||||
void set_conid(int id){
|
||||
conid = id;
|
||||
}
|
||||
|
||||
int get_conid(){
|
||||
return conid;
|
||||
}
|
||||
|
||||
struct cursor_pos {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
void set_cursor_pos(int x, int y) {
|
||||
rb_map_device(conid);
|
||||
con->cursor_x = x;
|
||||
con->cursor_y = y;
|
||||
}
|
||||
|
||||
struct cursor_pos get_cursor_pos() {
|
||||
struct cursor_pos cursor;
|
||||
rb_map_device(conid);
|
||||
cursor.x = con->cursor_x;
|
||||
cursor.y = con->cursor_y;
|
||||
return cursor;
|
||||
}
|
||||
|
||||
void set_cursor_mode(int mode) {
|
||||
rb_map_device(conid);
|
||||
con->cursor_mode = mode;
|
||||
}
|
||||
|
||||
int get_cursor_mode() {
|
||||
rb_map_device(conid);
|
||||
return con->cursor_mode;
|
||||
}
|
||||
|
||||
void conclear(){
|
||||
rb_map_device(conid);
|
||||
blit(1, ' ', (char)0xBD, 0, 0, 80, 50);
|
||||
set_cursor_pos(0,0);
|
||||
}
|
||||
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h) {
|
||||
con->blit_start_x = x;
|
||||
con->blit_start_y = y;
|
||||
con->blit_offset_x = xo;
|
||||
con->blit_offset_y = yo;
|
||||
con->blit_width = w;
|
||||
con->blit_height = h;
|
||||
con->blit_mode = command;
|
||||
while(con->blit_mode != 0) ; //WAI
|
||||
}
|
||||
#define LF 13
|
||||
#define BSP 8
|
||||
|
||||
char * read_keyboard() {
|
||||
int pos = 0;
|
||||
char buf[128];
|
||||
int breakpoint = 1;
|
||||
int cursorp;
|
||||
rb_map_device(conid);
|
||||
memset(buf, 0, 128);
|
||||
cursorp = con->cursor_x;
|
||||
con->line = con->cursor_y;
|
||||
while(breakpoint) {
|
||||
while(con->kb_pos != con->kb_start && breakpoint) {
|
||||
switch(con->kb_key) {
|
||||
case LF :
|
||||
fill(' ', cursorp, con->cursor_y, con->cursor_x, 1);
|
||||
con->cursor_x = cursorp;
|
||||
breakpoint = 0;
|
||||
con->kb_start++;
|
||||
break;
|
||||
case BSP :
|
||||
con->kb_pos--;
|
||||
con->cursor_x--;
|
||||
pos--;
|
||||
buf[pos] = ' ';
|
||||
con->display[con->cursor_x] = ' ';
|
||||
break;
|
||||
default :
|
||||
buf[pos] = con->kb_key;
|
||||
con->display[con->cursor_x] = con->kb_key;
|
||||
con->cursor_x++;
|
||||
con->kb_start++;
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#ifndef CONIO_H
|
||||
#define CONIO_H
|
||||
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
|
||||
#define redbus 0x0300
|
||||
|
||||
int conid = 0x01;
|
||||
Console* con = (Console*)redbus;
|
||||
char * strinv(char str[]);
|
||||
void conprint(char * str, int x, int y);
|
||||
void set_conid(int id);
|
||||
int get_conid();
|
||||
void set_cursor_pos(int x, int y);
|
||||
void set_cursor_mode(int mode);
|
||||
int get_cursor_mode();
|
||||
void conclear();
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h);
|
||||
char * read_keyboard();
|
||||
#endif
|
@ -1,31 +0,0 @@
|
||||
//test_iox.c
|
||||
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
#include <iox.h>
|
||||
#include "test_iox.h"
|
||||
#include "conio.h"
|
||||
#include <stdlib.h>
|
||||
#include <sortron.h>
|
||||
|
||||
#define redbus 0x0300
|
||||
#define IOXID 0x03
|
||||
|
||||
|
||||
Iox* expand;
|
||||
int* output;
|
||||
|
||||
void main() {
|
||||
Sortron* sort = (Sortron*)redbus;
|
||||
int status;
|
||||
rb_set_window((void*)redbus);
|
||||
rb_map_device(0x04);
|
||||
rb_enable();
|
||||
sort->slot = 1;
|
||||
sort->quantity = 5;
|
||||
sort->command = EJECT;
|
||||
rb_map_device(conid);
|
||||
conprint("f", 0, 5);
|
||||
conprint(itoa(sizeof(long), 0, 10), 0, 0);
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
LD = ../bin/ld65
|
||||
AS = ../bin/ca65
|
||||
CC = ../bin/cc65
|
||||
AL = ../bin/align
|
||||
|
||||
CINCLUDE = -I../include
|
||||
CFLAGS = -t none --cpu $(CPU)
|
||||
LFLAGS = -C ../lib/rpc8e.cfg
|
||||
LLIBS = ../lib/rpc8e.lib
|
||||
|
||||
#gonna leave this here for now
|
||||
CPU = 65c02
|
||||
|
||||
|
||||
IMAGES = astoriaTest.img
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: $(IMAGES)
|
||||
|
||||
%.s: %.c
|
||||
$(CC) $(CFLAGS) $(CINCLUDE) $<
|
||||
|
||||
%.o: %.s
|
||||
$(AS) $(CFLAGS) $<
|
||||
|
||||
%.img: %.o test.o
|
||||
$(LD) $(LFLAGS) $< test.o $(LLIBS) -o $@
|
||||
$(AL) $@
|
||||
|
||||
|
||||
clean:
|
||||
rm *.o *.s
|
||||
|
||||
.SUFFIXES:
|
@ -1,63 +0,0 @@
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#define RB 0x0300
|
||||
#define LSTREAM 47
|
||||
#define SCREEN_W 80
|
||||
#define SCREEN_H 50
|
||||
|
||||
Console* con;
|
||||
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h) {
|
||||
con->blit_start_x = x;
|
||||
con->blit_start_y = y;
|
||||
con->blit_offset_x = xo;
|
||||
con->blit_offset_y = yo;
|
||||
con->blit_width = w;
|
||||
con->blit_height = h;
|
||||
con->blit_mode = command;
|
||||
while(con->blit_mode != 0) ; //WAI
|
||||
}
|
||||
|
||||
void linefeed() {
|
||||
scroll(0,1,0,0,SCREEN_W,SCREEN_H-3);
|
||||
fill(0x20,0,LSTREAM,SCREEN_W,1);
|
||||
}
|
||||
|
||||
unsigned char cursor = 0;
|
||||
|
||||
void print(char* buffer) {
|
||||
unsigned char i = 0;
|
||||
|
||||
if(buffer[0] == 0) return;
|
||||
|
||||
con->line = LSTREAM;
|
||||
|
||||
if(cursor == 0) linefeed();
|
||||
|
||||
while(buffer[i] != 0 && i < 128) {
|
||||
if(buffer[i] == '\n' || cursor == 80) {
|
||||
cursor = 0;
|
||||
linefeed();
|
||||
} else {
|
||||
con->display[cursor] = buffer[i];
|
||||
++cursor;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if(i < 128)
|
||||
cursor = 0;
|
||||
}
|
||||
|
||||
void init_tests() {
|
||||
rb_set_window((void*)RB);
|
||||
con = (Console*)RB;
|
||||
rb_enable();
|
||||
}
|
||||
|
||||
void main(){
|
||||
print("test");
|
||||
}
|
@ -1,181 +0,0 @@
|
||||
//irc_client.c
|
||||
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
#include <disk.h>
|
||||
|
||||
#define RB 0x0300
|
||||
|
||||
Console* con;
|
||||
Disk* dis;
|
||||
|
||||
#define DSTAT 32
|
||||
#define DOUT 31
|
||||
#define DIN 30
|
||||
|
||||
|
||||
#define LPROMPT 49
|
||||
#define LSTAT 48
|
||||
#define LSTREAM 47
|
||||
|
||||
#define SCREEN_W 80
|
||||
#define SCREEN_H 50
|
||||
|
||||
#define map_con() rb_map_device(0x01);
|
||||
#define map_dis() rb_map_device(0x02);
|
||||
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h) {
|
||||
con->blit_start_x = x;
|
||||
con->blit_start_y = y;
|
||||
con->blit_offset_x = xo;
|
||||
con->blit_offset_y = yo;
|
||||
con->blit_width = w;
|
||||
con->blit_height = h;
|
||||
con->blit_mode = command;
|
||||
while(con->blit_mode != 0) ; //WAI
|
||||
}
|
||||
|
||||
#define LF 13
|
||||
|
||||
void prepare_screen() {
|
||||
map_con();
|
||||
fill(0x20,0,0,SCREEN_W,SCREEN_H);
|
||||
invert(0,LSTAT,SCREEN_W,1);
|
||||
con->cursor_x = 0;
|
||||
con->cursor_y = LPROMPT;
|
||||
con->cursor_mode = 2;
|
||||
}
|
||||
|
||||
char send = 0;
|
||||
char recv = 0;
|
||||
char outbuf[128];
|
||||
char inbuf[128];
|
||||
|
||||
#define CONTROL 0
|
||||
#define READPTR 1
|
||||
#define WRITEPTR 2
|
||||
|
||||
unsigned char flush() {
|
||||
dis->command = WRITE;
|
||||
while(dis->command != IDLE && dis->command != FAIL) ;
|
||||
return dis->command;
|
||||
}
|
||||
|
||||
unsigned char wait() {
|
||||
dis->command = READ;
|
||||
while(dis->command != IDLE && dis->command != FAIL) ;
|
||||
return dis->command;
|
||||
}
|
||||
|
||||
void prepare_disk() {
|
||||
map_dis();
|
||||
dis->sector_num = DSTAT;
|
||||
dis->sector[CONTROL] = 'N';
|
||||
flush();
|
||||
}
|
||||
|
||||
unsigned char cursor = 0;
|
||||
|
||||
void linefeed() {
|
||||
scroll(0,1,0,0,SCREEN_W,SCREEN_H-3);
|
||||
fill(0x20,0,LSTREAM,SCREEN_W,1);
|
||||
}
|
||||
|
||||
void print(char* buffer) {
|
||||
unsigned char i = 0;
|
||||
|
||||
if(buffer[0] == 0) return;
|
||||
|
||||
con->line = LSTREAM;
|
||||
|
||||
if(cursor == 0) linefeed();
|
||||
|
||||
while(buffer[i] != 0 && i < 128) {
|
||||
if(buffer[i] == '\n' || cursor == 80) {
|
||||
cursor = 0;
|
||||
linefeed();
|
||||
} else {
|
||||
con->display[cursor] = buffer[i];
|
||||
++cursor;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if(i < 128)
|
||||
cursor = 0;
|
||||
}
|
||||
|
||||
void read_keyboard() {
|
||||
con->line = LPROMPT;
|
||||
while(con->kb_pos != con->kb_start) {
|
||||
outbuf[con->cursor_x] = con->kb_key;
|
||||
if(con->kb_key == LF) {
|
||||
outbuf[con->cursor_x+1] = 0;
|
||||
fill(0x20,0,LPROMPT,SCREEN_W,1);
|
||||
send = 1;
|
||||
con->cursor_x = 0;
|
||||
++con->kb_start;
|
||||
break;
|
||||
}
|
||||
con->display[con->cursor_x] = con->kb_key;
|
||||
++con->cursor_x;
|
||||
++con->kb_start;
|
||||
}
|
||||
}
|
||||
|
||||
void perform_io() {
|
||||
unsigned int i = 0;
|
||||
|
||||
map_dis();
|
||||
|
||||
i = 0;
|
||||
dis->sector_num = DIN;
|
||||
wait();
|
||||
while(dis->sector[i] != 0 && i < 128) {
|
||||
inbuf[i] = dis->sector[i];
|
||||
dis->sector[i] = 0;
|
||||
++i;
|
||||
}
|
||||
inbuf[i] = 0;
|
||||
|
||||
flush();
|
||||
|
||||
i = 0;
|
||||
|
||||
dis->sector_num = DOUT;
|
||||
if(send == 1) {
|
||||
while(outbuf[i] != 0 && i < 128) {
|
||||
dis->sector[i] = outbuf[i];
|
||||
++i;
|
||||
}
|
||||
//send = 0;
|
||||
} else dis->sector[i] == 0;
|
||||
if(!flush() && send == 1) send = 0;
|
||||
|
||||
map_con();
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
rb_set_window((void*)RB);
|
||||
con = (Console*)RB;
|
||||
dis = (Disk*)RB;
|
||||
rb_enable();
|
||||
|
||||
prepare_screen();
|
||||
|
||||
print("IRC for RPC8/e\nInitializing IO buffer space... ");
|
||||
|
||||
prepare_disk();
|
||||
|
||||
map_con();
|
||||
|
||||
print("[DONE]\nStarting IO loop.");
|
||||
|
||||
while(1) {
|
||||
read_keyboard();
|
||||
perform_io();
|
||||
print(inbuf);
|
||||
inbuf[0] = 0;
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#define RB 0x0300
|
||||
#define LSTREAM 47
|
||||
#define SCREEN_W 80
|
||||
#define SCREEN_H 50
|
||||
|
||||
Console* con;
|
||||
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h) {
|
||||
con->blit_start_x = x;
|
||||
con->blit_start_y = y;
|
||||
con->blit_offset_x = xo;
|
||||
con->blit_offset_y = yo;
|
||||
con->blit_width = w;
|
||||
con->blit_height = h;
|
||||
con->blit_mode = command;
|
||||
while(con->blit_mode != 0) ; //WAI
|
||||
}
|
||||
|
||||
void linefeed() {
|
||||
scroll(0,1,0,0,SCREEN_W,SCREEN_H-3);
|
||||
fill(0x20,0,LSTREAM,SCREEN_W,1);
|
||||
}
|
||||
|
||||
unsigned char cursor = 0;
|
||||
|
||||
void print(char* buffer) {
|
||||
unsigned char i = 0;
|
||||
|
||||
if(buffer[0] == 0) return;
|
||||
|
||||
con->line = LSTREAM;
|
||||
|
||||
if(cursor == 0) linefeed();
|
||||
|
||||
while(buffer[i] != 0 && i < 128) {
|
||||
if(buffer[i] == '\n' || cursor == 80) {
|
||||
cursor = 0;
|
||||
linefeed();
|
||||
} else {
|
||||
con->display[cursor] = buffer[i];
|
||||
++cursor;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if(i < 128)
|
||||
cursor = 0;
|
||||
}
|
||||
|
||||
void init_tests() {
|
||||
rb_set_window((void*)RB);
|
||||
con = (Console*)RB;
|
||||
rb_enable();
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
void init_tests();
|
||||
void print(char* buffer);
|
||||
|
||||
#define TEST(NAME, COND) print(NAME); print(#COND); if((COND)) print("PASS\n"); else print("FAIL\n")
|
@ -1,304 +0,0 @@
|
||||
;
|
||||
; File generated by cc65 v 2.13.3
|
||||
;
|
||||
.fopt compiler,"cc65 v 2.13.3"
|
||||
.setcpu "65C02"
|
||||
.smart on
|
||||
.autoimport on
|
||||
.case on
|
||||
.debuginfo off
|
||||
.importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
|
||||
.macpack longbranch
|
||||
.import _rb_enable
|
||||
.import _rb_set_window
|
||||
.export _init_tests
|
||||
.export _print
|
||||
.export _con
|
||||
.export _blit
|
||||
.export _linefeed
|
||||
.export _cursor
|
||||
|
||||
.segment "DATA"
|
||||
|
||||
_cursor:
|
||||
.byte $00
|
||||
|
||||
.segment "BSS"
|
||||
|
||||
_con:
|
||||
.res 2,$00
|
||||
|
||||
; ---------------------------------------------------------------
|
||||
; void __near__ init_tests (void)
|
||||
; ---------------------------------------------------------------
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _init_tests: near
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
ldx #$03
|
||||
lda #$00
|
||||
jsr _rb_set_window
|
||||
ldx #$03
|
||||
lda #$00
|
||||
sta _con
|
||||
stx _con+1
|
||||
jsr _rb_enable
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; ---------------------------------------------------------------
|
||||
; void __near__ print (__near__ unsigned char*)
|
||||
; ---------------------------------------------------------------
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _print: near
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
lda #$00
|
||||
jsr pusha
|
||||
ldy #$02
|
||||
jsr ldaxysp
|
||||
ldy #$00
|
||||
jsr ldauidx
|
||||
cmp #$00
|
||||
jsr booleq
|
||||
jeq L0029
|
||||
jmp L0045
|
||||
L0029: lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldx #$00
|
||||
lda #$2F
|
||||
ldy #$00
|
||||
jsr staspidx
|
||||
ldx #$00
|
||||
lda _cursor
|
||||
cmp #$00
|
||||
jsr booleq
|
||||
jeq L002E
|
||||
jsr _linefeed
|
||||
L002E: ldy #$02
|
||||
jsr ldaxysp
|
||||
jsr pushax
|
||||
ldy #$02
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
jsr tosaddax
|
||||
ldy #$00
|
||||
jsr ldauidx
|
||||
cmp #$00
|
||||
jsr boolne
|
||||
jeq L0035
|
||||
ldy #$00
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
cmp #$80
|
||||
jsr boolult
|
||||
jne L0033
|
||||
L0035: ldx #$00
|
||||
lda #$00
|
||||
jeq L0036
|
||||
L0033: ldx #$00
|
||||
lda #$01
|
||||
L0036: jeq L0032
|
||||
ldy #$02
|
||||
jsr ldaxysp
|
||||
jsr pushax
|
||||
ldy #$02
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
jsr tosaddax
|
||||
ldy #$00
|
||||
jsr ldauidx
|
||||
cmp #$0A
|
||||
jsr booleq
|
||||
jne L0038
|
||||
ldx #$00
|
||||
lda _cursor
|
||||
cmp #$50
|
||||
jsr booleq
|
||||
jne L0038
|
||||
ldx #$00
|
||||
lda #$00
|
||||
jeq L003A
|
||||
L0038: ldx #$00
|
||||
lda #$01
|
||||
L003A: jeq L0037
|
||||
ldx #$00
|
||||
lda #$00
|
||||
sta _cursor
|
||||
jsr _linefeed
|
||||
jmp L003E
|
||||
L0037: lda _con
|
||||
ldx _con+1
|
||||
ldy #$10
|
||||
jsr incaxy
|
||||
jsr pushax
|
||||
ldx #$00
|
||||
lda _cursor
|
||||
jsr tosaddax
|
||||
jsr pushax
|
||||
ldy #$04
|
||||
jsr ldaxysp
|
||||
jsr pushax
|
||||
ldy #$04
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
jsr tosaddax
|
||||
ldy #$00
|
||||
jsr ldauidx
|
||||
ldy #$00
|
||||
jsr staspidx
|
||||
ldx #$00
|
||||
inc _cursor
|
||||
lda _cursor
|
||||
L003E: ldy #$00
|
||||
ldx #$00
|
||||
clc
|
||||
lda #$01
|
||||
adc (sp),y
|
||||
sta (sp),y
|
||||
jmp L002E
|
||||
L0032: ldy #$00
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
cmp #$80
|
||||
jsr boolult
|
||||
jeq L0045
|
||||
ldx #$00
|
||||
lda #$00
|
||||
sta _cursor
|
||||
L0045: jsr incsp3
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; ---------------------------------------------------------------
|
||||
; void __near__ blit (unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)
|
||||
; ---------------------------------------------------------------
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _blit: near
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$07
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$08
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$06
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$09
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$05
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$0A
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$04
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$0B
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$03
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$0C
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$02
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$0D
|
||||
jsr staspidx
|
||||
lda _con
|
||||
ldx _con+1
|
||||
jsr pushax
|
||||
ldy #$08
|
||||
ldx #$00
|
||||
lda (sp),y
|
||||
ldy #$07
|
||||
jsr staspidx
|
||||
L0012: lda _con
|
||||
ldx _con+1
|
||||
ldy #$07
|
||||
jsr ldauidx
|
||||
cmp #$00
|
||||
jsr boolne
|
||||
jeq L0013
|
||||
jmp L0012
|
||||
L0013: jsr incsp7
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
; ---------------------------------------------------------------
|
||||
; void __near__ linefeed (void)
|
||||
; ---------------------------------------------------------------
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _linefeed: near
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
lda #$03
|
||||
jsr pusha
|
||||
lda #$00
|
||||
jsr pusha
|
||||
lda #$01
|
||||
jsr pusha
|
||||
lda #$00
|
||||
jsr pusha
|
||||
lda #$00
|
||||
jsr pusha
|
||||
lda #$50
|
||||
jsr pusha
|
||||
lda #$2F
|
||||
jsr pusha
|
||||
jsr _blit
|
||||
lda #$01
|
||||
jsr pusha
|
||||
lda #$20
|
||||
jsr pusha
|
||||
lda #$00
|
||||
jsr pusha
|
||||
lda #$00
|
||||
jsr pusha
|
||||
lda #$2F
|
||||
jsr pusha
|
||||
lda #$50
|
||||
jsr pusha
|
||||
lda #$01
|
||||
jsr pusha
|
||||
jsr _blit
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
@ -1,22 +0,0 @@
|
||||
//test_rb.c
|
||||
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
|
||||
#define redbus 0x0300
|
||||
#define default_console_id 0x01
|
||||
|
||||
void main() {
|
||||
Console* console;
|
||||
|
||||
rb_set_window((void*)redbus);
|
||||
rb_map_device(default_console_id);
|
||||
rb_enable();
|
||||
|
||||
|
||||
console = (Console*)redbus;
|
||||
|
||||
console->cursor_mode = 2;
|
||||
console->display[0] = 'X';
|
||||
console->display[1] = inv('Y');
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include "test.h"
|
||||
|
||||
|
||||
// void* malloc (size_t size);
|
||||
// void* calloc (size_t count, size_t size);
|
||||
// void* realloc (void* block, size_t size);
|
||||
// void free (void* block);
|
||||
// void _heapadd (void* mem, size_t size);
|
||||
// size_t _heapblocksize (const void* block);
|
||||
// size_t _heapmemavail (void);
|
||||
// size_t _heapmaxavail (void);
|
||||
// int rand (void);
|
||||
// void srand (unsigned seed);
|
||||
// void _randomize (void);
|
||||
// void abort (void);
|
||||
//// int abs (int val);
|
||||
// long labs (long val);
|
||||
//// int atoi (const char* s);
|
||||
// long atol (const char* s);
|
||||
// int atexit (void (*exitfunc) (void));
|
||||
// void* bsearch (const void* key, const void* base, size_t n, size_t size, int (*cmp) (const void*, const void*));
|
||||
// div_t div (int numer, int denom);
|
||||
// void exit (int ret);
|
||||
// char* getenv (const char* name);
|
||||
// void qsort (void* base, size_t count, size_t size, int (*compare) (const void*, const void*));
|
||||
// long strtol (const char* nptr, char** endptr, int base);
|
||||
// unsigned long strtoul (const char* nptr, char** endptr, int base);
|
||||
// int system (const char* s);
|
||||
// void _swap (void* p, void* q, size_t size);
|
||||
//// char* itoa (int val, char* buf, int radix);
|
||||
// char* utoa (unsigned val, char* buf, int radix);
|
||||
// char* ltoa (long val, char* buf, int radix);
|
||||
// char* ultoa (unsigned long val, char* buf, int radix);
|
||||
// int putenv (char* s);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
char temp[5];
|
||||
|
||||
init_tests();
|
||||
|
||||
TEST("abs", 1 == abs(-1));
|
||||
TEST("abs", 0xFAF == abs(0xFAF));
|
||||
|
||||
TEST("itoa-atoi", 257 == atoi(itoa(257, temp, 10)));
|
||||
}
|
@ -1 +0,0 @@
|
||||
/home/astoria/Downloads/cc65-2.13.3/src/ca65html/ca65html
|
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
LD = ../bin/ld65
|
||||
AS = ../bin/ca65
|
||||
CC = ../bin/cc65
|
||||
AL = ../bin/align
|
||||
DA = /home/astoria/bin/da65
|
||||
|
||||
CINCLUDE = -I../include
|
||||
CFLAGS = -t none --cpu $(CPU)
|
||||
LFLAGS = -C ../lib/rpc8e.cfg
|
||||
LLIBS = ../lib/rpc8e.lib
|
||||
|
||||
#gonna leave this here for now
|
||||
CPU = 65c02
|
||||
|
||||
|
||||
IMAGES = downloader.img
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: $(IMAGES)
|
||||
|
||||
%.s: %.c
|
||||
$(CC) $(CFLAGS) -Oi $(CINCLUDE) $<
|
||||
|
||||
%.o: %.s
|
||||
$(AS) $(CFLAGS) $<
|
||||
|
||||
%.img: %.o conio.o
|
||||
$(LD) $(LFLAGS) $< conio.o $(LLIBS) -o $@
|
||||
$(AL) $@
|
||||
|
||||
clean:
|
||||
rm *.o *.s
|
||||
|
||||
.SUFFIXES:
|
@ -1,114 +0,0 @@
|
||||
#include "conio.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
//Slow, find how str function does it and apply to whole string at once?
|
||||
//Technically could be void, but with returning string allows you to use it easy.
|
||||
char * strinv(char str[]) {
|
||||
int i;
|
||||
for(i = 0; i < strlen(str); i++){
|
||||
str[i] = inv(str[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
//This is currently unable to screenwrap. Improve in the future.
|
||||
void conprint(char * str, int x, int y){
|
||||
rb_map_device(conid);
|
||||
con->line = y % 50;
|
||||
memcpy(con->display + x, str, strlen(str));
|
||||
}
|
||||
|
||||
void set_conid(int id){
|
||||
conid = id;
|
||||
}
|
||||
|
||||
int get_conid(){
|
||||
return conid;
|
||||
}
|
||||
|
||||
struct cursor_pos {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
void set_cursor_pos(int x, int y) {
|
||||
rb_map_device(conid);
|
||||
con->cursor_x = x;
|
||||
con->cursor_y = y;
|
||||
}
|
||||
|
||||
struct cursor_pos get_cursor_pos() {
|
||||
struct cursor_pos cursor;
|
||||
rb_map_device(conid);
|
||||
cursor.x = con->cursor_x;
|
||||
cursor.y = con->cursor_y;
|
||||
return cursor;
|
||||
}
|
||||
|
||||
void set_cursor_mode(int mode) {
|
||||
rb_map_device(conid);
|
||||
con->cursor_mode = mode;
|
||||
}
|
||||
|
||||
int get_cursor_mode() {
|
||||
rb_map_device(conid);
|
||||
return con->cursor_mode;
|
||||
}
|
||||
|
||||
void conclear(){
|
||||
rb_map_device(conid);
|
||||
blit(1, ' ', (char)0xBD, 0, 0, 80, 50);
|
||||
set_cursor_pos(0,0);
|
||||
}
|
||||
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h) {
|
||||
con->blit_start_x = x;
|
||||
con->blit_start_y = y;
|
||||
con->blit_offset_x = xo;
|
||||
con->blit_offset_y = yo;
|
||||
con->blit_width = w;
|
||||
con->blit_height = h;
|
||||
con->blit_mode = command;
|
||||
while(con->blit_mode != 0) ; //WAI
|
||||
}
|
||||
#define LF 13
|
||||
#define BSP 8
|
||||
|
||||
char * read_keyboard() {
|
||||
int pos = 0;
|
||||
char buf[128];
|
||||
int breakpoint = 1;
|
||||
int cursorp;
|
||||
rb_map_device(conid);
|
||||
memset(buf, 0, 128);
|
||||
cursorp = con->cursor_x;
|
||||
con->line = con->cursor_y;
|
||||
while(breakpoint) {
|
||||
while(con->kb_pos != con->kb_start && breakpoint) {
|
||||
switch(con->kb_key) {
|
||||
case LF :
|
||||
blit(1, ' ', (char)0xBD, cursorp, con->cursor_y, con->cursor_x, 1);
|
||||
con->cursor_x = cursorp;
|
||||
breakpoint = 0;
|
||||
con->kb_start++;
|
||||
break;
|
||||
case BSP :
|
||||
con->kb_pos--;
|
||||
con->cursor_x--;
|
||||
pos--;
|
||||
buf[pos] = ' ';
|
||||
con->display[con->cursor_x] = ' ';
|
||||
break;
|
||||
default :
|
||||
buf[pos] = con->kb_key;
|
||||
con->display[con->cursor_x] = con->kb_key;
|
||||
con->cursor_x++;
|
||||
con->kb_start++;
|
||||
pos++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#ifndef CONIO_H
|
||||
#define CONIO_H
|
||||
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
|
||||
#define redbus 0x0300
|
||||
|
||||
int conid = 0x01;
|
||||
Console* con = (Console*)redbus;
|
||||
char * strinv(char str[]);
|
||||
void conprint(char * str, int x, int y);
|
||||
void set_conid(int id);
|
||||
int get_conid();
|
||||
void set_cursor_pos(int x, int y);
|
||||
void set_cursor_mode(int mode);
|
||||
int get_cursor_mode();
|
||||
void conclear();
|
||||
void blit(char command, char x, char y, char xo, char yo, char w, char h);
|
||||
char * read_keyboard();
|
||||
#endif
|
@ -1,69 +0,0 @@
|
||||
// Internet Downloader
|
||||
#include <redbus.h>
|
||||
#include <console.h>
|
||||
#include <internet.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <disk.h>
|
||||
#include "conio.h"
|
||||
#include "downloader.h"
|
||||
|
||||
#define redbus 0x0300
|
||||
|
||||
void download_file() {
|
||||
unsigned int i;
|
||||
con->cursor_mode = 0;
|
||||
conprint("Downloading file, please wait warmly.", 0, 6);
|
||||
rb_map_device(0x05);
|
||||
memset(internet->url, 0, 50);
|
||||
strcpy(internet->url, buffer);
|
||||
internet->command = 1;
|
||||
while(internet->command == 1);
|
||||
if(internet->command == 0xFF){
|
||||
conprint("Error in file download, please try again", 0, 7);
|
||||
} else {
|
||||
sectorcount = internet->sector_count;
|
||||
conprint(strcat(strcat("The file downloaded is of size ", itoa(sectorcount, 0, 10)), " Kilobytes"), 0, 7);
|
||||
conprint("Transferring data", 0, 8);
|
||||
for(i = 0; i <= sectorcount; ++i){
|
||||
rb_map_device(0x05);
|
||||
internet->sector_num = i;
|
||||
memcpy(databuf, internet->webbuf, 128);
|
||||
rb_map_device(0x02);
|
||||
disk->sector_num = i;
|
||||
memcpy(disk->sector, databuf, 128);
|
||||
disk->command = (char)5;
|
||||
while(disk->command != 0x00 && disk->command != 0xFF);
|
||||
}
|
||||
conprint("Data transferred!", 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
memset(buffer, 0, 50);
|
||||
memset(ynbuf, 0, 50);
|
||||
memset(databuf, 0, 50);
|
||||
internet = (Internet*)redbus;
|
||||
disk = (Disk*)redbus;
|
||||
con = (Console*)redbus;
|
||||
rb_set_window((void*)redbus);
|
||||
rb_enable();
|
||||
conclear();
|
||||
conprint("Internet Disk Retrieval System V1.3", 0, 0);
|
||||
conprint("Please remove disk now", 0, 1);
|
||||
conprint("Enter a URL to download from: ", 0, 2);
|
||||
con->cursor_y = 3;
|
||||
strcpy(buffer, read_keyboard());
|
||||
conprint("You are trying to download a file from: ", 0, 3);
|
||||
conprint(buffer, 0, 4);
|
||||
con->cursor_x = 23;
|
||||
con->cursor_y = 5;
|
||||
conprint("Is this correct? (Y/N)", 0, 5);
|
||||
memset(ynbuf, 0, 50);
|
||||
strcpy(ynbuf, read_keyboard());
|
||||
if(ynbuf[0] == 'Y' || ynbuf[0] == 'y') {
|
||||
download_file();
|
||||
} else{
|
||||
conprint("Download cancelled", 0, 6);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
// downloader.h
|
||||
Internet* internet;
|
||||
Disk* disk;
|
||||
unsigned char buffer[50];
|
||||
unsigned char ynbuf[50];
|
||||
char databuf[128];
|
||||
unsigned int sectorcount;
|
@ -1,20 +0,0 @@
|
||||
#ifndef EXTENSIONS_H
|
||||
#define EXTENSIONS_H
|
||||
extern void wait();
|
||||
extern void stop();
|
||||
|
||||
void sleep_ticks(int n){
|
||||
unsigned int i;
|
||||
for(i = 0; i < n; ++i){
|
||||
wait();
|
||||
}
|
||||
}
|
||||
|
||||
void sleep_seconds(int n){
|
||||
unsigned int i;
|
||||
for(i = 0; i < n * 20; ++i){
|
||||
wait();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,30 +0,0 @@
|
||||
//internet.h
|
||||
|
||||
// 0x00-0x7F: Disk sector buffer
|
||||
// 0x80-0x81: Sector number
|
||||
// 0x82: Disk command:
|
||||
// 0: Idle/success
|
||||
// 1: Read Disk Name
|
||||
// 2: Write Disk Name
|
||||
// 3: Read Disk Serial
|
||||
// 4: Read Disk Sector
|
||||
// 5: Write Disk Sector
|
||||
// 0xFF: Command failure
|
||||
|
||||
typedef enum {
|
||||
INTERNET_IDLE = 0,
|
||||
DOWNLOAD_WEBSITE = 1,
|
||||
CLEAR_WEBSITE = 2,
|
||||
INTERNET_FAIL = 0xFF
|
||||
} InternetCommand;
|
||||
|
||||
typedef struct Internet {
|
||||
//RAM
|
||||
char command;
|
||||
char url[50];
|
||||
unsigned int sector_num;
|
||||
//ROM
|
||||
unsigned int sector_count;
|
||||
char webbuf[0x80];
|
||||
} Internet;
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue