Commit 1a68ad9e authored by Scott Duensing's avatar Scott Duensing

Just syncing repo with current code.

parent 6d059cc3
#!/bin/bash -e
OUT=${JOEY}/sdks/iix/IIgs/out/joey
OUT=${JOEY}/sdks/IIgs/ORCA/out/joey
if [ -d ${OUT} ]; then
rm -rf ${OUT}
......@@ -8,7 +8,7 @@ fi
mkdir -p ${OUT}
pushd ${JOEY}/joeylib/joeylib/src
iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm
iix assemble +L jIIgs.asm keep=31:/out/joey/jIIgsasm > jIIgs.asm.map
iix compile jIIgs.c keep=31:/out/joey/jIIgsc
iix compile joey.c keep=31:/out/joey/joey
......@@ -22,17 +22,17 @@ iix -DKeepType=S16 link +L 31:/out/joey/test 31:/out/joey/joeylib keep=31:/out/j
iix dumpobj +D 31:/out/joey/test &> test.dis || true
php ${JOEY}/sdks/iix/ntconverter.php *.mod
php ${JOEY}/sdks/IIgs/ntconverter.php *.mod
popd
mkdir -p ${JOEY}/dist/IIgs
cp -f ${JOEY}/joeylib/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/.
cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000
cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/.
cp -f ${JOEY}/joeylib/joeylib/build-IIgs.helper.sh ${JOEY}/dist/IIgs/.
cp -f ${JOEY}/joeylib/scripts/build-IIgs.helper.sh ${JOEY}/dist/IIgs/.
if [ ! -z $1 ]; then
CADIUS=${JOEY}/sdks/iix/cadius-git/bin/release/cadius
CADIUS=${JOEY}/sdks/IIgs/cadius-git/bin/release/cadius
IMPORT=/tmp/IIgs/import.po
VOL=Import
......@@ -54,7 +54,7 @@ if [ ! -z $1 ]; then
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/music#D50000 > /dev/null
${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/music.w#060000 > /dev/null
pushd ${JOEY}/sdks/iix/gsplus
pushd ${JOEY}/sdks/IIgs/gsplus
./gsplus -resizeable -config IIgsTest.cfg || true
popd
echo ""
......
......@@ -22,6 +22,7 @@
mcopy 13:ORCAInclude:m16.ORCA
mcopy jIIgs.macro
case on
gen on
SHRShad gequ $012000
......@@ -220,38 +221,47 @@ t equ 1
;----------------------------------------
asmB88a start
t equ 1
mo equ 1 ; Mask Offset
so equ 3 ; Source Pixels Offset
to equ 5 ; Target Pixels Offset
t equ 7 ; Temp
xc equ 9 ; X Counter
yc equ 11 ; Y Counter
jsubroutine (4:p,2:cx1,2:cy1,2:cx2,2:cy2,2:alpha),2
jsubroutine (4:p,2:cx1,2:cy1,2:cx2,2:cy2,2:offset),12
using ScanTable
phb ; Push our current data bank onto the stack
; ***TODO*** Mask off unused bits so they can be used for other things elsewhere
; Find offset into tile memory
clc
lda cx1 ; Multiply cx1 by 4 to get offset (two pixels per byte)
asl a
asl a
sta t
clc
lda cy1 ; Multiply cy1 by 16 to get index into scanline table
asl a
asl a
asl a
asl a ; y1 is now in the accumulator
clc
tax
clc
lda >ScanTable,x
adc t ; Add t to scanline offset
tay ; Offset to start of tile
; Find offset into shadow SHR memory
sta so ; Offset to start of source pixels
lda offset ; Load offset
asl a ; Multiply by 4
asl a
clc
adc so ; Add to source pixel offset
sta mo ; Offset to start of mask pixels
; Find offset into shadow SHR memory
lda cx2 ; Multiply cx1 by 4 to get offset (two pixels per byte)
asl a
asl a
sta t
clc
lda cy2 ; Multiply cy1 by 16 to get index into scanline table
asl a
asl a
......@@ -261,134 +271,66 @@ t equ 1
tax
lda >ScanTable,x
adc t ; Add t to scanline offset
tax ; Offset to start of screen memory
sta to ; Offset to start of target pixels
sei ; Disable interrupts while we change data banks
pea $0101 ; Push Effective Address (our new data bank) always 16 bits
plb ; Pull data bank from stack (data bank now $01)
plb ; Do it twice because it's only an 8 bit operation
; Row 1
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 2
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 2
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 3
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 3
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 4
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 4
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 5
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 5
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 6
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 6
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 7
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 7
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
; Move to row 8
txa
adc #158 ; Next line
tax
tya
adc #158 ; Next line
tay
; Row 8
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
inx ; Move to next pixel quad
inx
iny
iny
lda [p],y ; Load 4 pixels from SHA data
sta |SHRShad,x ; Store 4 pixels into screen
lda #0
sta xc ; Load 0 into X and Y counters
sta yc
blitATop ldx to ; Load X and Y registers with target pixel offset
ldy to
lda SHRShad,x ; Load 4 target pixels
ldy mo ; Load Y register with pixel mask offset
and [p],y ; AND with mask
ldy so ; Load Y register with source pixel offset
ora [p],y ; OR with source pixels
sta |SHRShad,x ; Store 4 pixels into screen
clc ; Increment to next pixel target quad
lda #2
adc to
sta to
clc ; Increment to next pixel source quad
lda #2
adc so
sta so
clc ; Increment to next pixel mask quad
lda #2
adc mo
sta mo
clc
lda xc ; Increment X counter
adc #1
sta xc
cmp #2 ; End of X pixels?
bcc blitATop ; Nope!
lda #0 ; Reset X counter
sta xc
clc ; Increment target offset
lda #156
adc to
sta to
clc ; Increment source offset
lda #156
adc so
sta so
clc ; Increment mask offset
lda #156
adc mo
sta mo
clc
lda yc ; Increment Y counter
adc #1
sta yc
cmp #8 ; End of Y pixels?
bcc blitATop ; Nope!
plb ; Pull original data bank from stack
cli ; Restore interrupts
......@@ -410,6 +352,76 @@ asmBorder start
jreturn
end
;----------------------------------------
; Draw a block of tiles from a region of tile data
;----------------------------------------
asmDrawBM start
tileX equ 1
tileY equ 3
offset equ 5
loopX equ 7
loopY equ 9
jsubroutine (2:startX,2:startY,2:width,2:height,4:mapData,2:stride,4:tiles),10
lda #0 ; Zero some starting values
sta offset
clc ; Find loop ending values
lda startX
adc width
sta loopX
clc
lda startY
adc height
sta loopY
ldx startX ; Loop counters
ldy startY
drawTop phy ; Keep Y for later
ldy offset ; Y is now offset into map data
lda [<mapData],y
and #$ff00 ; We only want 8 bits
sta tileX
iny
lda [<mapData],y
and #$ff00 ; We only want 8 bits
sta tileY
iny
sta offset
ply ; Y is our loop counter again
phx ; Protect from clobbering
phy
phy ; Push parameters in reverse for asmB88
phx
ph2 tileY
ph2 tileX
ph4 tiles
jsl asmB88 ; Call tile drawing code
ply ; Unclobber
plx
inx ; Increment x loop
cpx loopX ; Loop until 'width'
bcc drawTop
ldx startX ; Reset x loop
clc
lda offset ; Add stride to offset
adc stride
sta offset
iny ; Increment y loop
cpy loopY ; Loop until 'height'
bcc drawTop
jreturn
end
;----------------------------------------
; Returns the color of a given point
;
......
......@@ -47,7 +47,6 @@ typedef struct {
extern void asmBorder(jint16 c);
extern void asmGrOff(void);
extern void asmGrOn(void);
//extern int asmJoy(int which);
extern int asmJoy(void);
extern void asmSlam(void);
extern void asmStart(jint16 myID, jint16 hertzBy10);
......
......@@ -174,32 +174,58 @@ void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2)
}
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alpha) {
int o1;
int o2;
int x;
int y;
jlPixelPairT p;
jlPixelPairT t;
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset) {
int mo; // Mask offset
int so; // Source Pixel Offset
int to; // Target Pixel Offset
int x;
int y;
jlPixelPairT m; // Mask
jlPixelPairT s; // Source Pixel
jlPixelPairT t; // Target Pixel
// We mask off unused bits in the source tile location so they can be used to hold other data.
o1 = ((cy1 & 0x1f) * 8 * 160) + ((cx1 & 0x3f) * 4);
o2 = (cy2 * 8 * 160) + (cx2 * 4);
mo = ((cy1 & 0x1f) * 8 * 160) + (((cx1 & 0x3f) + offset) * 4);
so = ((cy1 & 0x1f) * 8 * 160) + ((cx1 & 0x3f) * 4);
to = (cy2 * 8 * 160) + (cx2 * 4);
for (y=0; y<8; y++) {
for (x=0; x<4; x++) {
p = sta->pixels[o1++];
t = _jlBackingStore->pixels[o2];
if (p.l != alpha) {
t.l = p.l;
}
if (p.r != alpha) {
t.r = p.r;
}
_jlBackingStore->pixels[o2++] = t;
m = sta->pixels[mo++];
s = sta->pixels[so++];
t = _jlBackingStore->pixels[to];
t.r = (t.r & m.r) | s.r;
t.l = (t.l & m.l) | s.l;
_jlBackingStore->pixels[to++] = t;
}
o1 += 156;
o2 += 156;
mo += 156;
so += 156;
to += 156;
}
}
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlStaT *sta) {
// startX = start tile for drawing
// startY = start tile for drawing
// width = tiles to draw horizontally
// height = tiles to draw vertically
// mapData = pointer to tile x/y pairs to draw
// stride = number of tile bytes to skip in the mapData for every horizontal line
// tiles = sta to fetch tile data from
jint16 x;
jint16 y;
byte tileX;
byte tileY;
juint16 offset = 0;
for (y=startY; y<height; y++) {
for (x=startX; x<width; x++) {
tileX = mapData[offset++];
tileY = mapData[offset++];
jlDrawBlit8x8(sta, tileX, tileY, x, y);
}
offset += stride;
}
}
......
......@@ -142,7 +142,9 @@ void *_jlRealloc(void *pointer, size_t size) {
jint16 i = 0;
size_t diff = 0;
if (pointer != NULL) {
if (pointer == NULL) {
return jlMalloc(size);
} else {
for (i=0; i<JOEY_MEM_BLOCKS; i++) {
if (_jlMemoryBlocks[i].addr == pointer) {
diff = size - _jlMemoryBlocks[i].size;
......@@ -171,30 +173,6 @@ void jlDisplayBorder(jlBorderColorsE color) {
}
void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles) {
// startX = start tile for drawing
// startY = start tile for drawing
// width = tiles to draw horizontally
// height = tiles to draw vertically
// mapData = pointer to tile x/y pairs to draw
// stride = number of tiles to skip in the mapData for every horizontal line
// tiles = sta to fetch tile data from
byte x;
byte y;
byte tileX;
byte tileY;
juint16 offset = 0;
for (y=startY; y<height; y++) {
for (x=startX; x<width; x++) {
tileX = mapData[offset++];
tileY = mapData[offset++];
jlDrawBlit8x8(tiles, tileX, tileY, x, y);
}
offset += stride;
}
}
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2) {
jlDrawLine(x1, y1, x2, y1);
jlDrawLine(x2, y1, x2, y2);
......@@ -336,7 +314,7 @@ void _jlDrawFillAddLine(jint16 startX, jint16 endX, jint16 y, jint16 ignoreStart
for (x=startX; x<endX; x++) {
if (how) {
// Unrolled conents to reduce comparison complexity.
// Unrolled contents to reduce comparison complexity.
if ((isNextInDir || x < ignoreStart || x >= ignoreEnd) && (jlDrawGetPixel(x, y) == _jlDrawFillColor)) {
jlDrawPoint(x, y);
if (regionStart < 0) regionStart = x;
......@@ -345,7 +323,7 @@ void _jlDrawFillAddLine(jint16 startX, jint16 endX, jint16 y, jint16 ignoreStart
regionStart = -1;
}
} else {
// Unrolled conents to reduce comparison complexity.
// Unrolled contents to reduce comparison complexity.
if ((isNextInDir || x < ignoreStart || x >= ignoreEnd) && (jlDrawGetPixel(x, y) != _jlDrawFillColor)) {
jlDrawPoint(x, y);
if (regionStart < 0) regionStart = x;
......
......@@ -210,8 +210,8 @@ void jlDisplayBorder(jlBorderColorsE color);
void jlDisplayPresent(void);
void jlDrawBlit8x8(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alpha);
void jlDrawBlitMap(byte startX, byte startY, byte width, byte height, byte *mapData, juint16 stride, jlStaT *tiles);
void jlDrawBlit8x8a(jlStaT *sta, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte offset);
void jlDrawBlitMap(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, jlStaT *sta);
void jlDrawBox(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawBoxFilled(jint16 x1, jint16 y1, jint16 x2, jint16 y2);
void jlDrawCircle(jint16 x, jint16 y, jint16 radius);
......@@ -283,18 +283,20 @@ bool _jlVecLoad(jlVecT **vec, char *filename);
// Inlined functions - asm code
extern void asmB88(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
extern void asmB88a(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alpha);
extern void asmPoint(jint16 color, jint16 x, jint16 y);
extern void asmDrawBM(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, byte *sta);
extern jint16 asmGetPoint(jint16 x, jint16 y);
extern juint16 asmGetVbl(void);
extern void asmNSwap(byte *mem, jint16 count, jint16 old, jint16 new);
extern void asmPoint(jint16 color, jint16 x, jint16 y);
// Inlined functions
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2)
#define jlDrawBlit8x8a(sta, cx1, cy1, cx2, cy2, alpha) asmB88a((byte *)sta->pixels, cx1, cy1, cx2, cy2, alpha)
#define jlDrawGetPixel(x, y) asmGetPoint(x, y)
#define jlDrawPoint(x, y) asmPoint(_jlDrawColorNibbles, x, y)
#define jlUtilNibbleSwap(mem, count, old, new) asmNSwap(mem, count, (jint16)old, (jint16)new)
#define jlUtilTimer asmGetVbl
#define jlDrawBlit8x8(sta, cx1, cy1, cx2, cy2) asmB88((byte *)sta->pixels, cx1, cy1, cx2, cy2)
#define jlDrawBlit8x8a(sta, cx1, cy1, cx2, cy2, offset) asmB88a((byte *)sta->pixels, cx1, cy1, cx2, cy2, offset)
#define jlDrawBlitMap(startX, startY, width, height, mapData, stride, sta) asmDrawBM(startX, startY, width, height, (byte *)mapData, stride, (byte *)sta->pixels)
#define jlDrawGetPixel(x, y) asmGetPoint(x, y)
#define jlDrawPoint(x, y) asmPoint(_jlDrawColorNibbles, x, y)
#define jlUtilNibbleSwap(mem, count, old, new) asmNSwap(mem, count, (jint16)old, (jint16)new)
#define jlUtilTimer asmGetVbl
#ifdef JOEY_DEBUG
void _jlDebugBorder(jlBorderColorsE color);
......
# --- HERE BE DRAGONS ---
function buildIIgs() {
TARGET=${JOEY}/sdks/iix/IIgs/out/${PROJECT}
TARGET=${JOEY}/sdks/IIgs/ORCA/out/${PROJECT}
GSTARGET=31:/out/${PROJECT}
CADIUS=${JOEY}/sdks/iix/cadius-git/bin/release/cadius
CADIUS=${JOEY}/sdks/IIgs/cadius-git/bin/release/cadius
VOL=Import
WORK=/tmp/IIgs
IMPORT=${WORK}/import.po
......@@ -80,7 +80,7 @@ function buildIIgs() {
# Did they ask for GSPlus to be executed?
if [ ! -z $1 ]; then
# Launch GSPlus
pushd ${JOEY}/sdks/iix/gsplus
pushd ${JOEY}/sdks/IIgs/gsplus
./gsplus -resizeable -config IIgsTest.cfg || true
popd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment