How-to articles
Q10001. How to parse the command line in my programm?
Summary
This article contain example for getting command line.
More information
24 April 2002.Code: Select all
ORG 8100h-512 ;EXE-file header: dw 5845h ; EXE Signature db 45h ; Reserved (EXE type) db 00h ; Version of EXE file dd 00000200h ; Code offset dw 0000h ; Primary loader size or 0 (no primary loader) dd 00000000h ; Reserved dw 0000h ; Reserved dw START ; Loading address dw START ; Starting address (register PC) dw 0BFFFh ; Stack address (register SP) ds 490 ; Reserved ;code of program START PUSH IX ;IX pointer to Command line parameters POP HL ;ld hl,ix INC HL ;skip size of Command line ;Now, HL pointer to first simbol of parameters ;If you typed "TEST.EXE Hello", then HL pointer to " Hello" ;with first space. LD C,5Ch ;system call number (PCHARS) RST 10h ;call kernel ;return from your program LD C,41h ;system call number (EXIT) RST 10h ;call kernel RET
PETERS PLUS LTD.
Q10002. How to access the modem from Sprinter computer?
Summary
This article describe ISA-8 interaction.
More information
If you want to interaction with ISA devices, you have to make following steps:
1) send 10h value to port 1FFDh(system port);
2) send control byte to port 0E2h(third memory window port);
control byte (corrected in Jan 2021):The read/write signals are forming from read/write signals memory range 0C000h-0FFFFh.Code: Select all
;D7...should be 1 ;D6...should be 1 ;D5...should be 0 ;D4...should be 1 ;D3...should be 0 ;D2...specify access mode (0 - ISA memory, 1 - ISA ports) ;D1...specify index of ISA slot (0 - ISA#1, 1 - ISA#2) ;D0...should be 0
And the address lines A13...A0 has taken from processor data-BUS. The other ISA-signals such as RESET, AEN, A19...A14 can be set in port 9FBDh. And default value is 00h.
port 9FBDh:Code: Select all
D7...RESET D6...AEN D5...A19 D4...A18 D3...A17 D2...A16 D1...A15 D0...A14
When you work with ISA, the access to third memory page are disabled. If you want to address ISA-memory more than 3FFFh, you should specify high bits in port 9FBDh.Code: Select all
ISA_DIR EQU 9FBDh SC_PORT EQU 1FFDh PAGE3 EQU 0E2h SAVE_PAGE DB 0 ;variable for previous status of third memory port RESET_ISA: ; reset ISA device LD C, ISA_DIR LD A,0C0h OUT (C),A CALL Pause_10ms LD A,0 OUT (C),A RET Pause_10ms: LD HL,10000 Loop: DEC HL LD A,H XOR L JR NZ,Loop RET OPEN_ISA_PORTS: ; open access to ISA LD BC,SC_PORT LD A,11h ; <<<<<<<<<< corrected in Jan 2021 OUT (C),A IN A,(PAGE3) ; read value from memory port LD (SAVE_PAGE),A ; save previous status of memory port LD A,0D4h ; control byte for (ports of the 1st ISA slot) OUT (PAGE3), A ; opening ISA port address space LD C,ISA_DIR LD A,0 ; high ISA addresses RESET and AEN signals. OUT (C),A RET CLOSE_ISA_PORTS: ; close access to ISA LD A,(SAVE_PAGE) OUT (PAGE3),A ; restore value of memory port LD BC,SC_PORT LD A,1 ; <<<<<<<<<< corrected in Jan 2021 OUT (C),A ; RET WRITE_ISA_PORT: LD HL,ADRESS_PORT+0C000h ; ISA port address + 0C000h offset 3 memory page LD A,DATA_OUT ; data for writing LD (HL),A ; write data to port which pointered HL RET READ_ISA_PORT: LD HL, ADRESS_PORT+0C000h ; ISA port address + 0C000h offset 3 memory page LD A,(HL) ; read data from port which pointered HL RET
27 April 2002
PETERS PLUS LTD.
Q10008. How to make Sprinter's EXE program?
Summary
This article contain simple example of Sprinter's EXE program.
More information
You can use any assemblers, which have Z80 support. You have to add Sprinter's EXE-header only.
Also, we recommend to you use as STACK address value between 8000h-0BFFFh. It will care you to avoid mistakes with STACK. The DSS and BIOS functions can opened another memory pages in third memory window 0C000h-0FFFFh.Code: Select all
ORG 8100h-512 ;EXE-file header: dw 5845h ; EXE Signature db 45h ; Reserved (EXE type) db 00h ; Version of EXE file dd 00000200h ; Code offset dw 0000h ; Primary loader size or 0 (no primary loader) dd 00000000h ; Reserved dw 0000h ; Reserved dw START ; Loading address dw START ; Starting address (register PC) dw 0BFFFh ; Stack address (register SP) ds 490 ; Reserved ;code of program START ;your program here ;return from your program LD BC,0041h ;exit with 0 error code RST 10h ;system call RET
30 May 2002.
PETERS PLUS LTD.
Q10010. How to use FastRAM?
Summary
This article describe features of using FastRAM.
Guide
For activating FastRAM you need execute CPU instruction IN A,(#FB). After that, in the first memory frame (0000h-3FFFh) will paged empty 16K of FastRAM memory. You may use this memory for more fast routine speed. FastRAM not require any allocation calls for use it. And you shouldn't stored the actual data there.
Remember, if you execute external program, it may destroy your data and code in FastRAM.
And you must do copy your code to FastRAM again for restore it.
Also you can't call BIOS or DSS function during FastRAM are activated.
For deactivating FastRAM you need execute CPU instruction IN A,(#7B).
After that, a first memory frame will paged back 16K of normal memory.
We recommend to disable interrupts for avoid any errors when you will switch FastRAM.
More information
Today, only 16K of FastRAM are available for use.
If you want to use the interrupts, you should put interrupt handler in #0038.
If you plan to use Accelerator in your FastRAM-routine, you must placed data for it more high than #3FFF.
FastRAM will be useful in following cases:
1. If you not use the Accelerator.
2. If you use the RAM data not so often.
3. If program stack was placed into the FastRAM.
1 August 2002.
PETERS PLUS LTD.
Q10015. How to load any palette or separate color?
Summary
This article contain examples of loading a palette and separated color.
More information
19 March 2003.Code: Select all
;Set 5th color as GREEN LD HL,COLOUR LD DE,#0105 LD BC,#FFA4 XOR A RST #08 ; B G R COLOUR DB #00,#80,#00,#00 ... ;Change all colors of palette LD HL,COLOURS LD DE,#0000 LD BC,#FFA4 XOR A RST #08 ;Color's parameters ; B G R COLOUR DB #00,#80,#00,#00 ;Palette COLOURS DB #00,#00,#00,#00 ;Colour 0 DB #00,#00,#80,#00 ;Colour 1 DB #00,#80,#00,#00 ;Colour 2 DB #00,#80,#80,#00 ;Colour 3 DB #FF,#FF,#FF,#00 ;Colour 255
PETERS PLUS LTD.
Q10017. How the DSS/BIOS can be paged out and replaced with RAM at $0000-$3fff?
Summary
This article contain an example of replacing memory page.
More information
You should disable interrupt before replacing memory page.
7 April 2003.Code: Select all
Replace DI ; disable interrupts IN A,($82) ; get page which set $0000-$3FFFF LD (DSSPAGE),A ; store dss page number LD A,your_page ; OUT ($82),A ; replace it with your page. Restore LD A,(DSSPAGE) ; restore dss page number OUT ($82),A ; back dss page EI ; enable interrupts
PETERS PLUS LTD.
Q10021. How to call an Estex application from my program?
Summary
This article contain example for calling an external program.
More information
7 May 2003.Code: Select all
LD HL,prog LD BC,DSS_EXEC RST #10 prog db "prog.exe",0
PETERS PLUS LTD.