| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler Thread 2
The previous thread took a little long to load, so this is a new fresh one.. |
|
... 592 posts hidden. Click here to view all posts.... |
| |
JackAsser
Registered: Jun 2002 Posts: 1997 |
Quote: i just tried to post a few bugs again and the same error.
here are 2 bugs i've found tho,
1. Script
when using a Hashtable like this, .var pixelTable = Hashtable() and then using it in a loop generates this:
parsing
flex pass 1
.if (pixelTable.get(key) != null)
^
Error: Unknown function : !=
2. Reading bytes from binary files
when loading binary files like this, .var dataFile = LoadBinary("data\hiresvector\lightwave.obj")
and then reading it byte by byte using vectorFile.get(i) gives back random signs of the byte. it can be solved by doing vectorFile.get(i) & 255 so it seems kickasm is reading 32 bits and gives back 8 without clearing the other 24 bits or something.
-Pantaloon
Due to Java's lack of unsigned data types a byte read from a file is always signed. When converted to an int, it's properly sign extended, and as you say, to read unsigned in Java one has to convert the byte into a larger data type, say short or int, then mask the lower 8 bits via the "and 0xff".
Would ofcourse be nice if KickAss did that for you, or assume unsigned always and add some .getSigned(i) or even .get<DataType>(i). |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Jackasser is right. Javas byte primitive is signed and ranges from -128 to 127. I will se if I can make you an unsigned getter.
The != function should be defined for the most common object types. What objects have you stored in the table?
|
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
the hashtable entries contains a List that contains structs that are defined like this: .struct Pixel {addr,mask} |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Ok, Here is a workaround. List hasn't got the != function right now. So use null!=pixelTable.get(key) which will call the != function on the null object instead. |
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
thx :) |
| |
TWW
Registered: Jul 2009 Posts: 542 |
Observe the folowing:
//------------------------------------------------------------------------ -------------------------------------------
//-Routine for pulling $d800 Collors.
//------------------------------------------------------------------------------ -------------------------------------
.pc = * "Collor Puller Routine"
.label coll1 = CollPull
.label coll2 = CollPull+235
.label coll3 = CollPull+235*2
.label coll4 = CollPull+235*3
.label coll5 = CollPull+235*4
.label coll6 = CollPull+235*5
.label coll7 = CollPull+235*6
.label coll8 = CollPull+235*7
.label coll9 = CollPull+235*8
.label coll10 = CollPull+235*9
.label coll11 = CollPull+235*10
.label coll12 = CollPull+235*11
.label coll13 = CollPull+235*12
.label coll14 = CollPull+235*13
.label coll15 = CollPull+235*14
.label coll16 = CollPull+235*15
.label coll17 = CollPull+235*16
.label coll18 = CollPull+235*17
.label coll19 = CollPull+235*18
.label coll20 = CollPull+235*19
.label coll21 = CollPull+235*20
.label coll22 = CollPull+235*21
.label coll23 = CollPull+235*22
.label coll24 = CollPull+235*23
.label coll25 = CollPull+235*24
CollPull:
.for (y=0;y<25;y++) {
.for (x=0;x<39;x++) {
lda $d801+x+[y*40]
sta $d800+x+[y*40]
}
rts
}
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
This allowes me to jsr collN for any of the 25 lines i need. My question is; Is there some more fancysmancy way of handling the labels in this case (Include it in the loop f.ex) something like this:
.for (y=0;y<25;y++) {
.label "coll"+toIntString(y+1)
.for (x=0;x<39;x++) {
lda $d801+x+[y*40]
sta $d800+x+[y*40]
}
rts
}
and then be able to jsr coll5 f.ex. outside the scope?
If not can I use the .label in conjunction with list() to generate the label list? |
| |
Oswald
Registered: Apr 2002 Posts: 5034 |
fancymansy way in graham ass (took 5 minutes):
*= $1000
x = $f0
y = $f1
speedcode = $4000
labelslo = $c000
labelshi = $c028
sei
jsr makespeed
ldx column
lda labelslo,x
sta self+1
lda labelshi,x
sta self+2
self jsr speedcode
jmp *
makespeed
lda #0
sta x
sta y
lda #<speedcode
sta $fc
lda #>speedcode
sta $fd
loop2
ldx x
lda $fc
sta labelslo,x
lda $fd
sta labelshi,x
loop1
lda y
asl
tay
lda mul40,y
clc
adc x
sta $fa
lda mul40+1,y
adc #>$d800
sta $fb
ldy #$00 ;lda $d801
lda c0
sta ($fc),y
iny
lda $fa
clc
adc #$01
sta ($fc),y
iny
lda $fb
adc #$00
sta ($fc),y
iny
lda c1 ;sta $d800
sta ($fc),y
iny
lda $fa
sta ($fc),y
iny
lda $fb
sta ($fc),y
iny
tya
clc
adc $fc
sta $fc
bcc *+4
inc $fd
inc y
lda y
cmp #25
bne loop1
ldy #$00
lda #$60
sta ($fc),y ; rts
inc $fc
bne *+4
inc $fd
lda #0
sta y
inc x
lda x
cmp #40
bne loop2
rts
c0 lda $d800
c1 sta $d800
mul40 .word 0,40,80,120,160,200,240,280,320,360,400,440,480,520,560,600,640,680,720,760,800, 840,880,920,960 |
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
.pc = * "Collor Puller Routine" CollPull:
.var l = List()
.for (y=0;y<25;y++)
{
.eval l = l.add(*)
.for (x=0;x<39;x++)
{
lda $d801+x+[y*40]
sta $d800+x+[y*40]
}
rts
}
lotable:
.fill l.size(), <l.get(i)
hitable:
.fill l.size(), >l.get(i)
and use like this
// y contains the row
ldy #$00
lda lotable,y
sta jsra+1
lda hitable,y
sta jsra+2
jsra: jsr $0000
or from script
jsr l.get(0)
|
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
Slammer:
Would it be possible to add a new script command in kickasm, something like this:
.var data = .system "myprog.exe " + cmdlineString
so it's possible to call an external program while kickasm is doing the scriptjob ? |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Yep, absolutely. One of the long term goals of creating v3 was making an architecture that made things like this possible. However, im a bit busy at the moment so don't expect it soon.
|
Previous - 1 | ... | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ... | 61 - Next |