ZX81 Assembly Programming - Getting Started
Re: ZX81 Assembly Programming - Getting Started
Thanks Sirmorris,
What i mean in "optimisation" in fact is not the good word...
I'm just not sure for the "System variables" part about the utility of all entries and if i need all the lines...
What i mean in "optimisation" in fact is not the good word...
I'm just not sure for the "System variables" part about the utility of all entries and if i need all the lines...
-=Zac
Re: ZX81 Assembly Programming - Getting Started
Aaaah!
In all but a couple of cases - yes, you need to have them there if you're creating a P file. It simply won't work without.
One thing that I have started doing is compiling only the REM line to a binary file, then using ZXTOOL to insert it into the BASIC wrapper which is created with ZXTXT2P.
I'll upload an example soon.
C
In all but a couple of cases - yes, you need to have them there if you're creating a P file. It simply won't work without.
One thing that I have started doing is compiling only the REM line to a binary file, then using ZXTOOL to insert it into the BASIC wrapper which is created with ZXTXT2P.
I'll upload an example soon.
C
Re: ZX81 Assembly Programming - Getting Started
Thanks for your help Sir Morris d^.^p
I try several things on TASM... In Swensont document, i try the little program to print a string in DEFB line like that :
And i try another version but no more results, i always have the first caracter and no more...
What's wrong with it ?
I try several things on TASM... In Swensont document, i try the little program to print a string in DEFB line like that :
Code: Select all
LD HL,line ;load HL with address of line
PLINE LD A,(HL) ;load A with a character at HL
CP $FF ;is this $FF
JP Z,END ;if so, then jump to end
CALL PRINT ;print character
INC HL ;increment HL to get to next character
JP PLINE ;jump to beginning of loop
END RET ;exit
line: DEFB _H,_E,_L,_L,_O,$00,_W,_O,_R,_L,_D,$76,$ff
What's wrong with it ?
-=Zac
Re: ZX81 Assembly Programming - Getting Started
Another "mistake", but resolved
In documentation, page 14 where there are 2 lines to change in HTML ZXPaintyOne editor :
here is the source of the complet function for better view
In documentation, page 14 where there are 2 lines to change in HTML ZXPaintyOne editor :
it's not ":=" but "!="1. Insert this as line 265 :
if(x:=62) savedata +=',$'
here is the source of the complet function for better view
Code: Select all
function dataAsHex() {
var savedata = '';
for (var y = 0; y < 48; y += 2) {
savedata += '\n$'; // <--- secondadd
for (var x = 0; x < 64; x += 2) {
seq = '' + pixels[y][x] + pixels[y][x+1] + pixels[y+1][x] + pixels[y+1][x+1]
if (seqToCode[seq] == null) {
alert('Save error: invalid block graphic at coordinates ' + (x/2) + ',' + (y/2));
return;
} else {
savedata += seqToCode[seq];
}
if (x!=62) savedata += ',$' // <--- first add
}
}
return savedata;
}
-=Zac
Re: ZX81 Assembly Programming - Getting Started
I can't answer that question without seeing the PRINT function. If this routine doesn't save the HL register then things could get interesting.Zac wrote:And i try another version but no more results, i always have the first caracter and no more...
What's wrong with it ?
I have attached the BASIC/assembler code that I hinted at earlier.
You need TASM somewhere on your machine, as well as ZXTEXT2P and ZXTOOL available on your command path. Edit the batch file so that the path to the tasm installation is correct for your machine.
The assembler template compiles to a representation of a complete REM line as it would appear in a program. This is then inserted into the compiled BASIC program by ZXTOOL.
To work out why your code isn't working I suggest you learn how to use the debugger in EightyOne. It will help a great deal as you can watch the flow of your code and see where the problem occurs.
- Attachments
-
- ASMBAS.zip
- (913 Bytes) Downloaded 300 times
Re: ZX81 Assembly Programming - Getting Started
Put the following in the REM assembler file and it will happily print hello world:
You don't need to jump to the RET - you can use the conditional return. Also you should consider using JR - jump relative - where possible as this produces smaller faster code. I've used the built-in 'print' routine RST 08 instead of the PRINT routine.
C
Code: Select all
.org 16509
.byte 0,1 ; 1 REM ....
.word rem_end-rem_start ; [length of line]
rem_start:
.byte $ea ; REM
LD HL,line ;load HL with address of line
PLINE: LD A,(HL) ;load A with a character at HL
CP $FF ;is this $FF
ret Z ;if so, then end
rst 10h ;print character
INC HL ;increment HL to get to next character
jr PLINE ;jump to beginning of loop
line: ; HELLO WORLD
.db $2D,$2A,$31,$31,$34,$00,$3C,$34,$37,$31,$29,$76,$ff
.db $76 ; NEWLINE - end of REM line
rem_end:
.end
C
Re: ZX81 Assembly Programming - Getting Started
In my "svars.asm" file i've this entry : PRINT EQU $0808sirmorris wrote:I can't answer that question without seeing the PRINT function. If this routine doesn't save the HL register then things could get interesting.
Perhaps not the good sub-routine address ?!
I download and look at, thanks d^.^psirmorris wrote: I have attached the BASIC/assembler code that I hinted at earlier.
You need TASM somewhere on your machine, as well as ZXTEXT2P and ZXTOOL available on your command path. Edit the batch file so that the path to the tasm installation is correct for your machine.
The assembler template compiles to a representation of a complete REM line as it would appear in a program. This is then inserted into the compiled BASIC program by ZXTOOL.
I have this idea too... can i find a little documentation for that anywhere ?sirmorris wrote:To work out why your code isn't working I suggest you learn how to use the debugger in EightyOne. It will help a great deal as you can watch the flow of your code and see where the problem occurs.
-=Zac
Re: ZX81 Assembly Programming - Getting Started
I've made tiny changes with a pause and used RST 10 :
It's better but :
The program don't seem to see the $FF end data....
The program crach on eightyone emulator but "work" with bizarre code behind the string in VB81_Xur emulator
if i take another source already with RST 10 and pause like this :
I just have a "H" printed and nothing after, just 5/2 at the end of the boucle at the bottom of the screen (in vb81 and eightyone)
??? :X
Code: Select all
PAUSE .equ $0F35
Start CALL SPRINT
RET
myt01 DEFB _H,_E,_L,_L,_O,__,_W,_O,_R,_L,_D,_NL,$FF
SPRINT POP HL
LD A,(HL)
INC HL
PUSH HL
CP $FF
RET Z
RST 10
LD BC,$0050 ;PAUSE LENGTH.
CALL PAUSE
JR SPRINT
The program don't seem to see the $FF end data....
The program crach on eightyone emulator but "work" with bizarre code behind the string in VB81_Xur emulator
if i take another source already with RST 10 and pause like this :
Code: Select all
PAUSE .equ $0F35
LD HL,line ;load HL with address of line
PLINE LD A,(HL) ;load A with a character at HL
CP $FF ;is this $FF
JP Z,END ;if so, then jump to end
RST 10 ;print character
LD BC,$0050 ;PAUSE LENGTH.
CALL PAUSE
INC HL ;increment HL to get to next character
JP PLINE ;jump to beginning of loop
END RET ;exit
line: DEFB _H,_E,_L,_L,_O,$00,_W,_O,_R,_L,_D,$76,$ff
??? :X
-=Zac
Re: ZX81 Assembly Programming - Getting Started
Finally, it's working with this : (using $07F1 for PRINT sub routine)
\o/
But when i try to add a pause between 2 chars, i've another problem :
where i put these 2 lines ? must i save some registry before ? (style BC or/and HL) ? like that :
Code: Select all
PAUSE EQU $0F35
PRINT EQU $07F1
LD HL,line ;load HL with address of line
PLINE LD A,(HL) ;load A with a character at HL
CP $FF ;is this $FF
JP Z,END ;if so, then jump to end
CALL PRINT ; PRINT CHAR
INC HL ;increment HL to get to next character
JP PLINE ;jump to beginning of loop
END RET ;exit
line: DEFB _H,_E,_L,_L,_O,$00,_W,_O,_R,_L,_D,$76,$ff
But when i try to add a pause between 2 chars, i've another problem :
Code: Select all
LD BC,$0050 ;PAUSE LENGTH.
CALL PAUSE
Code: Select all
PUSH BC
PUSH HL
LD BC,$0050 ;PAUSE LENGTH.
CALL PAUSE
POP HL
POP BC
-=Zac
Re: ZX81 Assembly Programming - Getting Started
And finally, finally, this one seem to be good \o/
Thanks Sir Morris
Code: Select all
PAUSE EQU $0F35
PRINT EQU $07F1
LD HL,line ;load HL with address of line
PLINE LD A,(HL) ;load A with a character at HL
CP $FF ;is this $FF
JP Z,END ;if so, then jump to end
CALL PRINT ; PRINT CHAR
INC HL ;increment HL to get to next character
PUSH BC
PUSH HL
LD BC,$0050 ;PAUSE LENGTH.
CALL PAUSE
POP HL
POP BC
JP PLINE ;jump to beginning of loop
END RET ;exit
line: DEFB _H,_E,_L,_L,_O,$00,_W,_O,_R,_L,_D,$76,$ff
-=Zac