|
nedoPC.orgCommunity for electronics hobbyists, established in 2002 |
|
Last visit was: 10 Nov 2024 12:49
|
It is currently 10 Nov 2024 12:49
|
Author |
Message |
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
It's taken from my local archive - in 2003 it was copied from petersplus.com web-site (creators of computer Sprinter). How-to articles | | | | Quote: Q10002. How to access the modem from Sprinter computer?SummaryThis article describe ISA-8 interaction. More informationIf 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. 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: 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
| | | | |
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. 27 April 2002 PETERS PLUS LTD. | | | | |
| | | | Quote: Q10015. How to load any palette or separate color?SummaryThis article contain examples of loading a palette and separated color. More information | | | | Code: ;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
| | | | |
19 March 2003. PETERS PLUS LTD. | | | | |
Last edited by Shaos on 18 May 2013 00:02, edited 1 time in total.
|
17 May 2013 22:36 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
|
17 May 2013 23:16 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
Hardware issues
| | | | Quote: Q10012. Hard disk was detected, but BIOS says "Invalid partition table"
Symptoms
600Mb-2Gb hard disk was detected by BIOS, but then BIOS says "Invalid partition table".
Cause
Your hard disk hasn't "partition table" or uses another partition code, not 0x01 (FAT12), 0x04 (FAT16 'old' up to 32M), 0x06 (FAT16 over 32M), 0x0E (FAT16 'win95' LBA-mapped). Probably, it is 0x0B (FAT32 'win95'), 0x0C (FAT32 'win95' LBA-mapped), 0x1B (FAT32 'hidden'), 0x1C (FAT32 'hidden' LBA-mapped) or another code.
Solution
You should prepare your hard disk as MS-DOS FAT16 disk before formating it.
5 January 2003. PETERS PLUS LTD.
| | | | |
|
17 May 2013 23:19 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
Programming
| | | | Quote: Q10009. Screen memory location.SummaryThis article contain usage examples of graphic modes. More informationToday, Estex DSS support four screen modes: text 40x32 with 16 colors (mode 02h); text 80x32 with 16 colors (mode 03h); graphic 320x256 with 256 colors (mode 81h); graphic 640x256 with 16 colors (mode 82h); The default mode for the DSS is 80x32 text mode, if your program need another screen mode then you need to switch it by DSS function 50h (SETVMOD). Also before switching you should ask DSS and save current screen mode by function 51h (GETVMOD). And when you program will be ready to finished, restore it by 50h (SETVMOD). for example: DSS has some functions for outing symbols and strings at the text screen. But for the graphic modes you need to write it yourself. for example: For painting at the graphic screen memory, you need to set one of three memory frames 04000h-07FFFh, 08000h-0BFFFh, 0C000h-0FFFFh. It can be made by set value 50h to the ports 0A2h, 0C2h or 0E2h. Don't forgot about STACK place! for example: if you want to set one point then routine for 81h mode will look like: | | | | Code: ; HL - x coord ; DE - y coord IN A,(0E2h) ;read page number LD C,A ;move it to C (save) LD A,50h ;page of video RAM OUT (0E2h),A ;set it to third frame 0C000-0FFFFh LD A,E ;Y-coord (0...255) OUT (89h),A ;set to Y-port LD DE,0C000h ;frame address ADD HL,DE ;add x-coord LD A,255 ;point color (0...255) (index to palette) LD (HL),A ;put pixel LD A,C ;restore page number OUT (0E2h) ;set it
| | | | |
Note: Before it, you need to set required colors at the palette. 30 May 2002. PETERS PLUS LTD. | | | | |
|
17 May 2013 23:29 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
Routines collection
| | | | Quote: Q10018. Routine of transformation of half-byte to ASCII symbol.AssemblerAny assembler. InputA = low 4 bits OutputÀ = ASCII symbol (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) RoutineAdded byMac Buster | | | | |
| | | | Quote: Q10019. Routine (GetSwitch) of filling of ASCIIZ buffer with the command-line parameter value.More informationRoutine fills an ASCIIZ buffer with the string after the "=" sign of a predetermined command-line switch of the form /SWITCH=VALUE. The switch name is *NOT* case sensitive. AssemblerAny assembler. Input(SP+0)=Ret address (SP+2)=Address of cmdline ASCIIZ string, preceded by its len in ONE byte (SP+4)=Address of ASCIIZ parameter to find its value (SP+6)=Address of ASCIIZ buffer to fill with the parameter's value OutputCarry flag reset=OK Carry flag set=Error (no chars in cmdline, etc) A : Zero BC: Amount of chars remaining in command line DE: Points to the terminating NULL of the buffer to fill HL: Points to one after the last byte copied from the cmdline Routine | | | | Code: GetSwitch: POP HL ;Fetch return address in HL POP DE ;Fetch cmdline address in DE POP BC ;Fetch param address in BC EX (SP),HL ;Push ret addr, buffer addr to HL LD (GS_Param),BC ;Save param ASCIIZ address LD (GS_OutBf),HL ;Save output buffer address EX DE,HL ;CmdLine to HL, OutBuff to DE LD C,(HL) ;CmdLine len to C (just-a-byte) LD B,0 ;Hi-byte of BC is zero INC HL ;Point to first char in CmdLine GS_GetSlash: LD A,"/" ;Char to find to A CPIR ;Find the slash JR Z,GS_ChkParam ;Slash found. Check param. JR GS_Error ;Outta chars or no slashes! GS_ChkParam: LD DE,(GS_Param) ;Param name address to DE DEC HL ;Compensate for first INC HL GS_CP_Loop: DEC BC ;Take char into account INC HL ;Point to next char LD A,(DE) ;Param name char to A INC DE ;Point to next char in param name OR A ;Is End Of String? JR Z,GS_Found ;Jump if so: Param found! CP (HL) ;Same as (HL)? JR Z,GS_CP_Loop ;Continue if so XOR 020h ;Toggle uppercase/lowercase bit CP (HL) ;Same as (HL)? JR Z,GS_CP_Loop ;Jump if so JR GS_GetSlash ;Bad param: Continue search for "/" GS_Found: LD A,(HL) ;Char should be "=" CP "=" ;Is it? JR NZ,GS_GetSlash ;Jump back if not: Wrong param INC HL ;Point to char after equals sign LD DE,(GS_OutBf) ;DE points to start of buffer GS_CopyBuff: LD A,(HL) ;Move value char to A CP " " ;Is space? JR Z,GS_Done ;Jump if so. Transfer finished CP 00h ;End of cmdline? JR Z,GS_Done ;Jump if so. No more to transfer LD (DE),A ;Copy char to output buffer INC HL ;Point to next char INC DE ;Point to next placeholder JR GS_CopyBuff ;Loop back until done GS_Done: XOR A ;Reset A LD (DE),A ;Terminate the string RET ;Done :) GS_Error: SCF ;Flag "ERROR!!!" RET ;Done :(
GS_OutBf: DB 00h,00h ;Output buffer address GS_Param: DB 00h,00h ;Parameter name address
| | | | |
Added byMarcelo Lopez | | | | |
| | | | Quote: Q10020. Routine (ExpandMacros) of expanded macros in an ASCII buffer with the nth ASCIIZ string from another buffer.More informationWill replace occurrences of "%1" to "%9" in an ASCIIZ buffer for the Nth ASCIIZ string from a parameter buffer, delivering an ASCII (not ASCIIZ) string in a supplied address. The parameter string block MUST start with a NULL char (ASCII 0). Example: | | | | Code: Src: DB "Marcelo %1 %2." Param: DB 00,"made",00,"me.",00 Desti: DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
| | | | |
After executing the routine, DESTI will hold the following string (note that the destination string is not ASCIIZ): AssemblerAny assembler. Input(SP+6) -> Source buffer start address (Src in the example) (SP+4) -> Param buffer start address (Param in the example) (SP+2) -> Destination buffer start address (Desti in the example) (SP+0) -> Normal return address Output A : Zero B : Zero (if strings replaced), Hi byte of param buff addr if not C : Low byte of parameter buffer address DE: Pointer to the last byte in the output buffer + 1 HL: Pointer to the last byte in the source buffer + 1 Routine | | | | Code: ExpandMacros: POP HL ;Fetch ret addr briefly POP DE ;Fetch OutBuffer in DE POP BC ;Fetch ParBuffer in BC EX (SP),HL ;Exchg Ret to (SP) and RawBuff to HL EM_SavePtr: LD (EM_PBuff),BC ;Save param buffer ptr EM_Loop: LD A,(HL) ;Char to A INC HL ;Point to next char OR A ;Is it a zero? RET Z ;Finished if so CP "%" ;Is it the macro indicator? JR NZ,EM_CopyChr ;Jump if not LD A,(HL) ;Char after "%" to A CP "0" ;Is char > "0"? JR NC,EM_ChkNine ;Jump if so EM_CopyPct: LD A,"%" ;Restore percentage sign in A JR EM_CopyChr ;And transfer it to out buffer EM_ChkNine: CP "9" ;Is char lower than "9"? JR NC,EM_CopyPct ;Jump if not to transfer the "%" SUB "0" ;Now is 0 <= A <= 9 PUSH HL ;Save input buffer pointer LD HL,(EM_PBuff) ;Get Param Buffer address in HL LD B,A ;Param number to B XOR A ;Reset A to zero EM_FindPar: PUSH BC ;Save counter in B LD BC,0 ;Prepare to loop thru 64K CPIR ;Look for a zero char POP BC ;Restore zeroes counter DJNZ EM_FindPar ;Loop back until param is found EM_CopyPar: LD A,(HL) ;Param char to A INC HL ;Point to next char in param OR A ;Is it zero? JR NZ,EM_CopyPar2 ;Go on to copy char POP HL ;Restore main in buffer pointer INC HL ;Skip param number JR EM_Loop ;And continue looping EM_CopyPar2: LD (DE),A ;Copy char in param to output buffer INC DE ;Advance out buffer pointer JR EM_CopyPar ;And loop thru all chars in param EM_CopyChr: LD (DE),A ;Copy char in main to output buffer INC DE ;Advance out buffer pointer JR EM_Loop ;And loop thru all chars in main
EM_PBuff: DW 0000h ;Param buffer save zone
| | | | |
Added byMarcelo Lopez | | | | |
|
17 May 2013 23:59 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
Routines collection (cont.)
| | | | Quote: Q10022. Routine (Ascii2Word) of converting an ASCIIZ buffer with numbers to a word.More informationRoutine converts an ASCIIZ number to a 2-byte value. The number can have a prefix character to preset the number base. In case of hex numbers, the letter case does NOT matter. This routine DOES NOT deal with negative or fractional numbers. All returned values are positive. The routine will work with values in the range 0 - 65,535 (dec), 0 - FFFF (hex), 0 - 177777 (oct), or 0 - 1111 1111 1111 1111 (bin). Prefix: "@": Means OCTAL number follows (ex: @345; bad ex: @87) "#": Means HEXADECIMAL number follows (ex: #F00f; bad ex: #G0) "%": Means BINARY number follows (ex: %1010; bad ex: %5) 'no prefix': Default, for DECIMAL numbers (ex: 987; bad ex: 3A57) AssemblerAny assembler. Input(SP+2) -> ASCIIZ string starting address (SP+0) -> Normal return address OutputCarry flag reset: Operation was successful. A=Lo-byte of converted word HL=Converted word Carry flag set: Error (overflow or invalid char in buffer) Routine | | | | Code: Ascii2Word: POP HL ;Fetch ret addr briefly EX (SP),HL ;Exchg Ret (SP) with BufferAddr (HL) A2W_Init: LD DE,0 ;Reset... LD (A2W_RetVal),DE ;...return value LD A,(HL) ;Get first char in buffer LD C,0Fh ;Prepare for HEX CP "#" ;Is HEX prefix? JR Z,A2W_Nxt ;Jump if so LD C,07h ;Prepare for OCT CP "@" ;Is OCT prefix? JR Z,A2W_Nxt ;Jump if so LD C,01h ;Prepare for BIN CP "%" ;Is BIN prefix? JR Z,A2W_Nxt ;Jump if so LD C,09h ;Ok, number is DEC DEC HL ;Compensate for next INC HL A2W_Nxt: INC HL ;Point to next char in buffer LD A,(HL) ;Char to A CP 0h ;End of string? JR Z,A2W_Done ;Jump if so PUSH HL ;Save buffer address while adding LD HL,(A2W_RetVal) ;Get return value so far PUSH HL ;Copy HL to... POP DE ;... register DE LD B,C ;Get loop index to B A2W_Add: ADC HL,DE ;Perform sum... DJNZ A2W_Add ;... B times JR C,A2W_Ovfl ;Abort if overflow SUB "0" ;Convert ASCII in A to number CP 9 ;Less than 9? JR C,A2W_Chk ;Jump if so. RES 5,A ;Force char uppercase (just in case) SUB 7 ;Deduct "A" - "9" diff. A2W_Chk: LD E,A ;Save number to E LD D,0 ;Reset hi-byte of DE INC C ;Test if... CP C ;... A > C, and... JR NC,A2W_Ovfl ;... abort if so... DEC C ;... 'cos it's invalid char. XOR A ;Clear carry flag for next ADC ADC HL,DE ;Add the number to the return value JR C,A2W_Ovfl ;Jump if overflow LD (A2W_RetVal),HL ;Store result so far POP HL ;Fetch back string pointer JR A2W_Nxt ;Keep looping A2W_Ovfl: SCF ;Set carry flag to say "Error!" POP HL ;Stack balancing RET ;Return to caller A2W_Done: LD HL,(A2W_RetVal) ;Fetch return value LD A,L ;Lo-byte of result to A RET ;Back to caller
A2W_RetVal: DEFW 0000h ;Return value storage
| | | | |
Added byMarcelo Lopez | | | | |
| | | | Quote: Q10023. Routine (Word2Hex) of preparing a 16 bit number to be printed in HEX form.More informationConverts a 2-byte value to four hexadecimal characters. All values are considered positive. Uses Byte2Hex routine twice... AssemblerAny assembler. Input(SP+4) -> Number to convert (SP+2) -> Four-byte ASCII buffer start address (SP+0) -> Normal return address OutputASCII buffer is filled with the converted number A : Ascii code of lowest nibble of converted number DE: Number to convert HL: Pointer to last char in buffer RoutineAdded byMarcelo Lopez | | | | |
| | | | Quote: Q10024. Routine (Byte2Hex) of preparing an 8 bit number to be printed in HEX form.More informationConverts a 1-byte value to four hexadecimal characters. All values are considered positive. AssemblerAny assembler. Input(SP+4) -> Number to convert (in LSB, MSB is ignored) (SP+2) -> Two-byte ASCII buffer start address (SP+0) -> Normal return address OutputASCII buffer is filled with the converted number A : Ascii code of lowest nibble of converted number D : Ignored MSB of number to convert E : Number to convert HL: Pointer to last char in buffer Routine | | | | Code: Byte2Hex: POP HL ;Get ret address temporarily POP DE ;Get Buffer address LD (B2HBuf),DE ;Save Buffer address POP DE ;Get Number PUSH HL ;Push return value LD HL,(B2HBuf) ;Make HL point to buffer LD A,E ;Number to A (H=0, and ignored) RRCA ;Get hi-nibble of A into lo-nibble RRCA RRCA RRCA AND 0Fh ;Isolate lo-nibble ADD A,"0" ;Add ASCII for zero CP 3Ah ;Greater than "9"? JR C,B2HBig1 ;Jump if so ADD A,07h ;Add ASCII difference to "A" B2HBig1: LD (HL),A ;Save char to buffer INC HL ;Point to next char in buffer LD A,E ;Rretrieve number AND 0Fh ;Isolate lo-nibble ADD A,"0" ;Add ASCII for "0" CP 3Ah ;Greater than "9"? JR C,B2HBig2 ;Jump if so ADD A,07h ;Add ASCII difference to "A" B2HBig2: LD (HL),A ;Save char to buffer RET ;Done.
B2HBuf: DW 0000h
| | | | |
Added byMarcelo Lopez | | | | |
|
18 May 2013 00:11 |
|
|
Shaos
Admin
Joined: 08 Jan 2003 23:22 Posts: 23399 Location: Silicon Valley
|
Routines collection (cont.)
| | | | Quote: Q10025. Routine (Byte2Ascii) of preparing an 8 bit number to be printed in decimal form.More informationRoutine converts an 1-byte number to ASCII characters. Leading zeroes are replaced by spaces. All values are considered positive. AssemblerAny assembler. Input(SP+4) -> Number to convert (in LSB, MSB is ignored) (SP+2) -> Three-byte ASCII buffer start address (SP+0) -> Normal return address OutputASCII buffer is filled with converted number A : Ascii code of LSB C : Ascii code of mid-significant digit (or space, if it was zero) HL: Pointer to last char in buffer Routine | | | | Code: Byte2Ascii: POP BC ;Fetch ret address temporarily POP HL ;Fetch ASCII buffer address POP DE ;Fetch nmber to convert in E PUSH BC ;Push back ret address LD A,E ;Get number to convert in A LD C,"0"-1 ;Prepare character B2A_3: INC C ;Inc char SUB 100 ;Subtract 100 from A JR NC,B2A_3 ;Keep looping until negative ADD A,100 ;Restore positive value LD E,A ;Save value temporarily LD A,C ;Hundreds char to A CP "0" ;Is zero? JR NZ,B2A_Hundreds ;Jump if not LD C," " ;Preset to put a space if Hundreds=0 B2A_Hundreds: LD (HL),C ;Save hundreds char LD A,E ;Retrieve old value INC HL ;Point to next char LD C,"0"-1 ;Prepare character B2A_2: INC C ;Inc char SUB 10 ;Subtract 10 from A JR NC,B2A_2 ;Keep looping until negative ADD A,"0"+10 ;Restore positive value (and ASCII) LD E,A ;Save char briefly LD A,C ;Tens char to A CP "0" ;Is zero? JR NZ,B2A_Tens ;Jump if not LD C," " ;Change char to be a space LD A,E ;Retrieve last char B2A_Tens: LD (HL),C ;Save tens char INC HL ;Point to next char LD (HL),A ;Save units char (don't check for 0) RET ;Done
| | | | |
Added byMarcelo Lopez | | | | |
| | | | Quote: Q10026. Routine (Word2Ascii) of preparing a 16 bit number to be printed in decimal form.More informationRoutine converts a 2-byte number to ASCII characters. All values are considered positive. AssemblerAny assembler. Input(SP+4) -> Number to convert (SP+2) -> Five-byte ASCII buffer start address (SP+0) -> Normal return address OutputASCII buffer is filled with converted number A : Ascii code of LSB BC: 000Ah DE: Buffer start address HL: Least significant digit of number to convert Routine | | | | Code: ;Word2Ascii: POP BC ;Retrieve ret address ; POP DE ;Fetch ASCII buffer ; POP HL ;Fetch number to convert ; PUSH BC ;Push ret address back Word2Ascii: POP HL ;Ret addr briefly to HL POP DE ;Fetch ASCII buffer to DE EX (SP),HL ;Exchg Ret (SP) with Number (HL) LD BC,10000 ;Prepare BC to subtract PUSH IX ;Save content of IX PUSH DE ;Transfer content of POP IX ;Register DE to IX LD (IX+0),"0"-1 ;Insert char in buffer XOR A ;Clear carry flag W2A_5: INC (IX+0) ;Inc char SBC HL,BC ;Deduct 10K from HL JR NC,W2A_5 ;Loop until negative result ADD HL,BC ;Restore positive in HL LD BC,1000 ;Prepare BC to subtract LD (IX+1),"0"-1 ;Insert char in buffer XOR A ;Clear carry flag W2A_4: INC (IX+1) ;Inc char SBC HL,BC ;Deduct 1K from HL JR NC,W2A_4 ;Loop until negative result ADD HL,BC ;Restore positive in HL LD BC,100 ;Prepare BC to subtract LD (IX+2),"0"-1 ;Insert char in buffer XOR A ;Clear carry flag W2A_3: INC (IX+2) ;Inc char SBC HL,BC ;Deduct 100 from HL JR NC,W2A_3 ;Loop until negative result ADD HL,BC ;Restore positive in HL LD BC,10 ;Prepare BC to subtract LD (IX+3),"0"-1 ;Insert char in buffer XOR A ;Clear carry flag W2A_2: INC (IX+3) ;Inc char SBC HL,BC ;Deduct 10 from HL JR NC,W2A_2 ;Loop until negative result ADD HL,BC ;Restore positive to HL LD A,L ;Last number to A ADD A,"0" ;Add the "0" difference LD (IX+4),A ;Put last char in buffer POP IX ;Restore original value in IX RET
| | | | |
Added byMarcelo Lopez | | | | |
|
18 May 2013 00:14 |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|